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 #ifndef _COM_SUN_STAR_LANG_XMULTI_COMPONENT_FACTORY_HPP_
30 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
31 #endif
32 #include <com/sun/star/container/XIndexContainer.hpp>
33 #include <com/sun/star/frame/XController.hpp>
34 #include <com/sun/star/frame/XFrame.hpp>
35 #include <com/sun/star/script/XInvocation.hpp>
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 #include <com/sun/star/beans/XMultiPropertySet.hpp>
38 #include <com/sun/star/awt/XControl.hpp>
39 #include <com/sun/star/awt/XControlModel.hpp>
40 #include <com/sun/star/container/XNameContainer.hpp>
41 #include <com/sun/star/container/XNameAccess.hpp>
42 #include <com/sun/star/uno/XComponentContext.hpp>
43 #include <com/sun/star/awt/XActionListener.hpp>
44 #include <com/sun/star/awt/XTextListener.hpp>
45 #include <com/sun/star/awt/XButton.hpp>
46 #include <com/sun/star/awt/XCheckBox.hpp>
47 #include <com/sun/star/awt/XComboBox.hpp>
48 #include <com/sun/star/awt/XTextComponent.hpp>
49 #include <com/sun/star/awt/XRadioButton.hpp>
50 #include <com/sun/star/awt/XListBox.hpp>
51 #include <com/sun/star/awt/XFixedText.hpp>
52 #include <com/sun/star/awt/XControlContainer.hpp>
53 #include <com/sun/star/awt/XReschedule.hpp>
54 #include <com/sun/star/awt/XDialog.hpp>
55 #include <com/sun/star/awt/Size.hpp>
56 #include <cppuhelper/implbase1.hxx>
57 #include <cppuhelper/implbase2.hxx>
58 #include <cppuhelper/implbase3.hxx>
59 
60 // -------------
61 // - UnoDialog -
62 // -------------
63 
64 ////////////////////////////////////////////////////////////////////////
65 
66 class UnoDialog
67 {
68 public :
69 
70 	UnoDialog( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxMSF, com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rxFrame );
71     ~UnoDialog();
72 
73 	void execute();
74 	void endExecute( sal_Bool bStatus );
75 
76 	com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer > createWindowPeer( com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer > xParentPeer )
77 		throw ( com::sun::star::uno::Exception );
78 
79 	com::sun::star::uno::Reference< com::sun::star::uno::XInterface > insertControlModel( const rtl::OUString& rServiceName, const rtl::OUString& rName,
80 		const com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames, const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& rPropertyValues );
81 
82 	void setVisible( const rtl::OUString& rName, sal_Bool bVisible );
83 
84 	sal_Bool isHighContrast();
85 
86 	sal_Int32 getMapsFromPixels( sal_Int32 nPixels ) const;
87 
88 	com::sun::star::uno::Reference< com::sun::star::awt::XButton > insertButton( const rtl::OUString& rName,
89 		com::sun::star::uno::Reference< com::sun::star::awt::XActionListener > xActionListener, const com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames,
90 			const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& rPropertyValues );
91 
92 	com::sun::star::uno::Reference< com::sun::star::awt::XFixedText > insertFixedText( const rtl::OUString& rName,
93 		const com::sun::star::uno::Sequence< rtl::OUString > rPropertyNames, const com::sun::star::uno::Sequence< com::sun::star::uno::Any > rPropertyValues );
94 
95 	com::sun::star::uno::Reference< com::sun::star::awt::XCheckBox > insertCheckBox( const rtl::OUString& rName,
96 		const com::sun::star::uno::Sequence< rtl::OUString > rPropertyNames, const com::sun::star::uno::Sequence< com::sun::star::uno::Any > rPropertyValues );
97 
98 	com::sun::star::uno::Reference< com::sun::star::awt::XControl > insertFormattedField( const rtl::OUString& rName,
99 		const com::sun::star::uno::Sequence< rtl::OUString > rPropertyNames, const com::sun::star::uno::Sequence< com::sun::star::uno::Any > rPropertyValues );
100 
101 	com::sun::star::uno::Reference< com::sun::star::awt::XComboBox > insertComboBox( const rtl::OUString& rName,
102 		const com::sun::star::uno::Sequence< rtl::OUString > rPropertyNames, const com::sun::star::uno::Sequence< com::sun::star::uno::Any > rPropertyValues );
103 
104 	com::sun::star::uno::Reference< com::sun::star::awt::XRadioButton > insertRadioButton( const rtl::OUString& rName,
105 		const com::sun::star::uno::Sequence< rtl::OUString > rPropertyNames, const com::sun::star::uno::Sequence< com::sun::star::uno::Any > rPropertyValues );
106 
107 	com::sun::star::uno::Reference< com::sun::star::awt::XListBox > insertListBox( const rtl::OUString& rName,
108 		const com::sun::star::uno::Sequence< rtl::OUString > rPropertyNames, const com::sun::star::uno::Sequence< com::sun::star::uno::Any > rPropertyValues );
109 
110 	com::sun::star::uno::Reference< com::sun::star::awt::XControl > insertImage( const rtl::OUString& rName,
111 		const com::sun::star::uno::Sequence< rtl::OUString > rPropertyNames, const com::sun::star::uno::Sequence< com::sun::star::uno::Any > rPropertyValues );
112 
113 	void setControlProperty( const rtl::OUString& rControlName, const rtl::OUString& rPropertyName, const com::sun::star::uno::Any& rPropertyValue );
114 	com::sun::star::uno::Any getControlProperty( const rtl::OUString& rControlName, const rtl::OUString& rPropertyName );
115 #if 0
116 	void showMessageBox( const rtl::OUString& rTitle, const rtl::OUString& rMessage, sal_Bool bErrorBox ) const;
117 #endif
118 	void enableControl( const rtl::OUString& rControlName );
119 	void disableControl( const rtl::OUString& rControlName );
120 
121 	com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >		mxMSF;
122 	com::sun::star::uno::Reference< com::sun::star::frame::XController >			mxController;
123 	com::sun::star::uno::Reference< com::sun::star::awt::XReschedule >				mxReschedule;
124 
125 	com::sun::star::uno::Reference< com::sun::star::uno::XInterface >				mxDialogModel;
126 	com::sun::star::uno::Reference< com::sun::star::beans::XMultiPropertySet >		mxDialogModelMultiPropertySet;
127 	com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >			mxDialogModelPropertySet;
128 	com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >	mxDialogModelMSF;
129 	com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >		mxDialogModelNameContainer;
130 	com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >		mxDialogModelNameAccess;
131 
132 	com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >			mxControlModel;
133 
134 	com::sun::star::uno::Reference< com::sun::star::awt::XDialog >					mxDialog;
135 	com::sun::star::uno::Reference< com::sun::star::awt::XControl >					mxControl;
136 	com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer >				mxWindowPeer;
137 
138 	com::sun::star::uno::Reference< com::sun::star::awt::XControlContainer >		mxDialogControlContainer;
139 	com::sun::star::uno::Reference< com::sun::star::lang::XComponent >				mxDialogComponent;
140 	com::sun::star::uno::Reference< com::sun::star::awt::XWindow >					mxDialogWindow;
141 
142 	sal_Bool																		mbStatus;
143 };
144 
145 #endif // UNODIALOG_HXX
146