xref: /AOO41X/main/sdext/source/minimizer/unodialog.hxx (revision ca62e2c2083b5d0995f1245bad6c2edfb455fbec)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef UNODIALOG_HXX
25 #define UNODIALOG_HXX
26 
27 #include <com/sun/star/uno/Sequence.h>
28 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
29 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
30 #include <com/sun/star/container/XIndexContainer.hpp>
31 #include <com/sun/star/frame/XController.hpp>
32 #include <com/sun/star/frame/XFrame.hpp>
33 #include <com/sun/star/script/XInvocation.hpp>
34 #include <com/sun/star/beans/XPropertySet.hpp>
35 #include <com/sun/star/beans/XMultiPropertySet.hpp>
36 #include <com/sun/star/awt/XControl.hpp>
37 #include <com/sun/star/awt/XControlModel.hpp>
38 #include <com/sun/star/container/XNameContainer.hpp>
39 #include <com/sun/star/container/XNameAccess.hpp>
40 #include <com/sun/star/uno/XComponentContext.hpp>
41 #include <com/sun/star/awt/XActionListener.hpp>
42 #include <com/sun/star/awt/XTextListener.hpp>
43 #include <com/sun/star/awt/XButton.hpp>
44 #include <com/sun/star/awt/XCheckBox.hpp>
45 #include <com/sun/star/awt/XComboBox.hpp>
46 #include <com/sun/star/awt/XTextComponent.hpp>
47 #include <com/sun/star/awt/XRadioButton.hpp>
48 #include <com/sun/star/awt/XListBox.hpp>
49 #include <com/sun/star/awt/XFixedText.hpp>
50 #include <com/sun/star/awt/XControlContainer.hpp>
51 #include <com/sun/star/awt/XReschedule.hpp>
52 #include <com/sun/star/awt/XDialog.hpp>
53 #include <com/sun/star/awt/Size.hpp>
54 
55 // -------------
56 // - UnoDialog -
57 // -------------
58 
59 ////////////////////////////////////////////////////////////////////////
60 
61 class UnoDialog
62 {
63 public :
64 
65     UnoDialog( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
66                const com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer >& rxParent);
67     virtual ~UnoDialog();
68     void execute();
69     void endExecute( sal_Bool bStatus );
70     void setTitle( const rtl::OUString &rTitle);
71 
72 protected:
73     void setVisible( const rtl::OUString& rName, sal_Bool bVisible );
74     sal_Int32 getMapsFromPixels( sal_Int32 nPixels ) const;
75     sal_Bool isHighContrast();
76     void centerDialog();
77 
78     com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer > createWindowPeer() throw ( com::sun::star::uno::Exception );
79 
80     com::sun::star::uno::Reference< com::sun::star::uno::XInterface > insertControlModel( const rtl::OUString& rServiceName, const rtl::OUString& rName,
81         const com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames, const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& rPropertyValues );
82 
83 
84     com::sun::star::uno::Reference< com::sun::star::awt::XButton > insertButton( const rtl::OUString& rName,
85         com::sun::star::uno::Reference< com::sun::star::awt::XActionListener > xActionListener, const com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames,
86             const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& rPropertyValues );
87 
88     com::sun::star::uno::Reference< com::sun::star::awt::XFixedText > insertFixedText( const rtl::OUString& rName,
89         const com::sun::star::uno::Sequence< rtl::OUString > rPropertyNames, const com::sun::star::uno::Sequence< com::sun::star::uno::Any > rPropertyValues );
90 
91     com::sun::star::uno::Reference< com::sun::star::awt::XCheckBox > insertCheckBox( const rtl::OUString& rName,
92         const com::sun::star::uno::Sequence< rtl::OUString > rPropertyNames, const com::sun::star::uno::Sequence< com::sun::star::uno::Any > rPropertyValues );
93 
94     com::sun::star::uno::Reference< com::sun::star::awt::XControl > insertFormattedField( const rtl::OUString& rName,
95         const com::sun::star::uno::Sequence< rtl::OUString > rPropertyNames, const com::sun::star::uno::Sequence< com::sun::star::uno::Any > rPropertyValues );
96 
97     com::sun::star::uno::Reference< com::sun::star::awt::XComboBox > insertComboBox( const rtl::OUString& rName,
98         const com::sun::star::uno::Sequence< rtl::OUString > rPropertyNames, const com::sun::star::uno::Sequence< com::sun::star::uno::Any > rPropertyValues );
99 
100     com::sun::star::uno::Reference< com::sun::star::awt::XRadioButton > insertRadioButton( const rtl::OUString& rName,
101         const com::sun::star::uno::Sequence< rtl::OUString > rPropertyNames, const com::sun::star::uno::Sequence< com::sun::star::uno::Any > rPropertyValues );
102 
103     com::sun::star::uno::Reference< com::sun::star::awt::XListBox > insertListBox( const rtl::OUString& rName,
104         const com::sun::star::uno::Sequence< rtl::OUString > rPropertyNames, const com::sun::star::uno::Sequence< com::sun::star::uno::Any > rPropertyValues );
105 
106     com::sun::star::uno::Reference< com::sun::star::awt::XControl > insertImage( const rtl::OUString& rName,
107         const com::sun::star::uno::Sequence< rtl::OUString > rPropertyNames, const com::sun::star::uno::Sequence< com::sun::star::uno::Any > rPropertyValues );
108 
109     void setControlProperty( const rtl::OUString& rControlName, const rtl::OUString& rPropertyName, const com::sun::star::uno::Any& rPropertyValue );
110     com::sun::star::uno::Any getControlProperty( const rtl::OUString& rControlName, const rtl::OUString& rPropertyName );
111     void enableControl( const rtl::OUString& rControlName );
112     void disableControl( const rtl::OUString& rControlName );
113 
114 protected:
115 
116     com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >        mxContext;
117     com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer >              mxParent;
118 
119     com::sun::star::uno::Reference< com::sun::star::uno::XInterface >               mxDialogModel;
120     com::sun::star::uno::Reference< com::sun::star::beans::XMultiPropertySet >      mxDialogModelMultiPropertySet;
121     com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >           mxDialogModelPropertySet;
122     com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >    mxDialogModelMSF;
123     com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >     mxDialogModelNameContainer;
124     com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >        mxDialogModelNameAccess;
125     com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >            mxControlModel;
126     com::sun::star::uno::Reference< com::sun::star::awt::XDialog >                  mxDialog;
127     com::sun::star::uno::Reference< com::sun::star::awt::XControl >                 mxControl;
128     sal_Bool                                                                        mbStatus;
129 
130     com::sun::star::uno::Reference< com::sun::star::awt::XControlContainer >        mxDialogControlContainer;
131     com::sun::star::uno::Reference< com::sun::star::awt::XWindow >                  mxDialogWindow;
132     com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer >              mxDialogWindowPeer;
133 
134     com::sun::star::uno::Reference< com::sun::star::awt::XReschedule >              mxReschedule;
135 };
136 
137 #endif // UNODIALOG_HXX
138