Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef TOOLKIT_DIALOG_CONTROL_HXX
21 : #define TOOLKIT_DIALOG_CONTROL_HXX
22 :
23 : #include <toolkit/controls/controlmodelcontainerbase.hxx>
24 : #include <com/sun/star/awt/XTopWindow.hpp>
25 : #include <com/sun/star/awt/XDialog2.hpp>
26 : #include <com/sun/star/awt/XSimpleTabController.hpp>
27 : #include <com/sun/star/resource/XStringResourceResolver.hpp>
28 : #include <com/sun/star/graphic/XGraphicObject.hpp>
29 : #include "toolkit/helper/servicenames.hxx"
30 : #include "toolkit/helper/macros.hxx"
31 : #include <toolkit/controls/unocontrolcontainer.hxx>
32 : #include <cppuhelper/basemutex.hxx>
33 : #include <cppuhelper/implbase3.hxx>
34 : #include <list>
35 :
36 : // ----------------------------------------------------
37 : // class UnoControlDialogModel
38 : // ----------------------------------------------------
39 :
40 : class UnoControlDialogModel : public ControlModelContainerBase
41 : {
42 : protected:
43 : ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj;
44 : ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
45 : ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
46 : // ::cppu::OPropertySetHelper
47 : void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
48 : public:
49 : UnoControlDialogModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
50 : UnoControlDialogModel( const UnoControlDialogModel& rModel );
51 : ~UnoControlDialogModel();
52 :
53 : UnoControlModel* Clone() const;
54 : // ::com::sun::star::beans::XMultiPropertySet
55 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
56 :
57 : // ::com::sun::star::io::XPersistObject
58 : ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
59 :
60 : // XServiceInfo
61 0 : DECLIMPL_SERVICEINFO_DERIVED( UnoControlDialogModel, ControlModelContainerBase, szServiceName2_UnoControlDialogModel )
62 :
63 : };
64 :
65 : typedef ::cppu::AggImplInheritanceHelper3 < ControlContainerBase
66 : , ::com::sun::star::awt::XTopWindow
67 : , ::com::sun::star::awt::XDialog2
68 : , ::com::sun::star::awt::XWindowListener
69 : > UnoDialogControl_Base;
70 : class UnoDialogControl : public UnoDialogControl_Base
71 : {
72 : private:
73 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar > mxMenuBar;
74 : TopWindowListenerMultiplexer maTopWindowListeners;
75 : bool mbWindowListener;
76 :
77 : public:
78 :
79 : UnoDialogControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
80 : ~UnoDialogControl();
81 : ::rtl::OUString GetComponentServiceName();
82 :
83 : void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
84 : void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
85 : void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
86 :
87 : // ::com::sun::star::awt::XTopWindow
88 : void SAL_CALL addTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
89 : void SAL_CALL removeTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
90 : void SAL_CALL toFront( ) throw (::com::sun::star::uno::RuntimeException);
91 : void SAL_CALL toBack( ) throw (::com::sun::star::uno::RuntimeException);
92 : void SAL_CALL setMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >& xMenu ) throw (::com::sun::star::uno::RuntimeException);
93 :
94 : // ::com::sun::star::awt::XWindowListener
95 : virtual void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException);
96 : virtual void SAL_CALL windowMoved( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException);
97 : virtual void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
98 : virtual void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
99 :
100 : // ::com::sun::star::awt::XDialog2
101 : virtual void SAL_CALL endDialog( ::sal_Int32 Result ) throw (::com::sun::star::uno::RuntimeException);
102 : virtual void SAL_CALL setHelpId( const rtl::OUString& Id ) throw (::com::sun::star::uno::RuntimeException);
103 :
104 : // ::com::sun::star::awt::XDialog
105 : void SAL_CALL setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException);
106 : ::rtl::OUString SAL_CALL getTitle() throw(::com::sun::star::uno::RuntimeException);
107 : sal_Int16 SAL_CALL execute() throw(::com::sun::star::uno::RuntimeException);
108 : void SAL_CALL endExecute() throw(::com::sun::star::uno::RuntimeException);
109 :
110 : // ::com::sun::star::awt::XControl
111 : sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model ) throw(::com::sun::star::uno::RuntimeException);
112 :
113 : // XModifyListener
114 : virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
115 :
116 : // ::com::sun::star::lang::XServiceInfo
117 0 : DECLIMPL_SERVICEINFO( UnoDialogControl, szServiceName2_UnoControlDialog )
118 :
119 : protected:
120 : virtual void PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc );
121 : virtual void ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException);
122 : protected:
123 : };
124 :
125 : class UnoMultiPageModel : public ControlModelContainerBase
126 : {
127 : public:
128 : UnoMultiPageModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
129 : ~UnoMultiPageModel();
130 : UnoMultiPageModel( const UnoMultiPageModel& rModel );
131 :
132 : UnoControlModel* Clone() const;
133 :
134 0 : DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageModel, ControlModelContainerBase, szServiceName_UnoMultiPageModel )
135 :
136 : virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
137 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw( ::com::sun::star::uno::RuntimeException);
138 : // XNamedContainer
139 : void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
140 :
141 : // Override the method of parent Class
142 : virtual sal_Bool SAL_CALL getGroupControl( ) throw (::com::sun::star::uno::RuntimeException);
143 : protected:
144 : virtual ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
145 : ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
146 :
147 : };
148 :
149 : class UnoMultiPageControl : public ControlContainerBase
150 : ,public ::com::sun::star::awt::XSimpleTabController
151 : ,public ::com::sun::star::awt::XTabListener
152 : {
153 : TabListenerMultiplexer maTabListeners;
154 : void bindPage( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
155 : public:
156 : UnoMultiPageControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
157 : ~UnoMultiPageControl();
158 : ::rtl::OUString GetComponentServiceName();
159 :
160 : // ::com::sun::star::lang::XServiceInfo
161 0 : DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageControl, ControlContainerBase, szServiceName_UnoMultiPageControl )
162 0 : ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return ControlContainerBase::queryInterface(rType); }
163 : ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
164 0 : void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
165 0 : void SAL_CALL release() throw() { OWeakAggObject::release(); }
166 : // ::com::sun::star::lang::XTypeProvider
167 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
168 : ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
169 : void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
170 : // com::sun::star::awt::XSimpleTabController
171 : virtual ::sal_Int32 SAL_CALL insertTab() throw (::com::sun::star::uno::RuntimeException);
172 : virtual void SAL_CALL removeTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
173 :
174 : virtual void SAL_CALL setTabProps( ::sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Properties ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
175 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > SAL_CALL getTabProps( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
176 :
177 : virtual void SAL_CALL activateTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
178 : virtual ::sal_Int32 SAL_CALL getActiveTabID() throw (::com::sun::star::uno::RuntimeException);
179 :
180 : virtual void SAL_CALL addTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
181 : virtual void SAL_CALL removeTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
182 : // XTabListener
183 : virtual void SAL_CALL inserted( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException);
184 : virtual void SAL_CALL removed( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException);
185 : virtual void SAL_CALL changed( ::sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Properties ) throw (::com::sun::star::uno::RuntimeException);
186 : virtual void SAL_CALL activated( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException);
187 : virtual void SAL_CALL deactivated( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException);
188 : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& evt ) throw (::com::sun::star::uno::RuntimeException);
189 : // XComponent
190 : void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
191 :
192 : protected:
193 : virtual void impl_createControlPeerIfNecessary(
194 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl
195 : );
196 :
197 : };
198 :
199 :
200 : class UnoPageModel : public ControlModelContainerBase
201 : {
202 : public:
203 : UnoPageModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
204 : ~UnoPageModel();
205 : UnoPageModel( const UnoPageModel& rModel );
206 :
207 : UnoControlModel* Clone() const;
208 :
209 0 : DECLIMPL_SERVICEINFO_DERIVED( UnoPageModel, ControlModelContainerBase, szServiceName_UnoPageModel )
210 :
211 : virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
212 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw( ::com::sun::star::uno::RuntimeException);
213 :
214 : // Override the method of parent Class
215 : virtual sal_Bool SAL_CALL getGroupControl( ) throw (::com::sun::star::uno::RuntimeException);
216 : protected:
217 : virtual ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
218 : ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
219 :
220 : };
221 :
222 : class UnoPageControl : public ControlContainerBase
223 : {
224 : public:
225 : UnoPageControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
226 : ~UnoPageControl();
227 : ::rtl::OUString GetComponentServiceName();
228 :
229 :
230 : // ::com::sun::star::lang::XServiceInfo
231 0 : DECLIMPL_SERVICEINFO_DERIVED( UnoPageControl, ControlContainerBase, szServiceName_UnoPageControl )
232 : };
233 :
234 : class UnoFrameModel : public ControlModelContainerBase
235 : {
236 : public:
237 : UnoFrameModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
238 : ~UnoFrameModel();
239 : UnoFrameModel( const UnoFrameModel& rModel );
240 :
241 : UnoControlModel* Clone() const;
242 :
243 0 : DECLIMPL_SERVICEINFO_DERIVED( UnoFrameModel, ControlModelContainerBase, szServiceName_UnoFrameModel )
244 :
245 : virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
246 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw( ::com::sun::star::uno::RuntimeException);
247 :
248 : protected:
249 : virtual ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
250 : ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
251 : };
252 :
253 : class UnoFrameControl : public ControlContainerBase
254 : {
255 : protected:
256 : virtual void ImplSetPosSize( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxCtrl );
257 : public:
258 : UnoFrameControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
259 : ~UnoFrameControl();
260 : ::rtl::OUString GetComponentServiceName();
261 :
262 : // ::com::sun::star::lang::XServiceInfo
263 0 : DECLIMPL_SERVICEINFO_DERIVED( UnoFrameControl, ControlContainerBase, szServiceName_UnoPageControl )
264 : };
265 :
266 : #endif // TOOLKIT_DIALOG_CONTROL_HXX
267 :
268 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|