1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef TOOLKIT_DIALOG_CONTROL_HXX
21 #define TOOLKIT_DIALOG_CONTROL_HXX
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>
36 // ----------------------------------------------------
37 // class UnoControlDialogModel
38 // ----------------------------------------------------
40 class UnoControlDialogModel
: public ControlModelContainerBase
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
);
49 UnoControlDialogModel( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
50 UnoControlDialogModel( const UnoControlDialogModel
& rModel
);
51 ~UnoControlDialogModel();
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
);
57 // ::com::sun::star::io::XPersistObject
58 OUString SAL_CALL
getServiceName() throw(::com::sun::star::uno::RuntimeException
);
61 DECLIMPL_SERVICEINFO_DERIVED( UnoControlDialogModel
, ControlModelContainerBase
, szServiceName2_UnoControlDialogModel
)
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
73 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMenuBar
> mxMenuBar
;
74 TopWindowListenerMultiplexer maTopWindowListeners
;
75 bool mbWindowListener
;
79 UnoDialogControl( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
81 OUString
GetComponentServiceName();
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
);
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
);
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
);
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 OUString
& Id
) throw (::com::sun::star::uno::RuntimeException
);
104 // ::com::sun::star::awt::XDialog
105 void SAL_CALL
setTitle( const OUString
& Title
) throw(::com::sun::star::uno::RuntimeException
);
106 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
);
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
);
114 virtual void SAL_CALL
modified( const ::com::sun::star::lang::EventObject
& aEvent
) throw (::com::sun::star::uno::RuntimeException
);
116 // ::com::sun::star::lang::XServiceInfo
117 DECLIMPL_SERVICEINFO( UnoDialogControl
, szServiceName2_UnoControlDialog
)
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
);
125 class UnoMultiPageModel
: public ControlModelContainerBase
128 UnoMultiPageModel( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
129 ~UnoMultiPageModel();
130 UnoMultiPageModel( const UnoMultiPageModel
& rModel
);
132 UnoControlModel
* Clone() const;
134 DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageModel
, ControlModelContainerBase
, szServiceName_UnoMultiPageModel
)
136 virtual 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
);
139 void SAL_CALL
insertByName( const 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
);
141 // Override the method of parent Class
142 virtual sal_Bool SAL_CALL
getGroupControl( ) throw (::com::sun::star::uno::RuntimeException
);
144 virtual ::com::sun::star::uno::Any
ImplGetDefaultValue( sal_uInt16 nPropId
) const;
145 ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper();
149 class UnoMultiPageControl
: public ControlContainerBase
150 ,public ::com::sun::star::awt::XSimpleTabController
151 ,public ::com::sun::star::awt::XTabListener
153 TabListenerMultiplexer maTabListeners
;
154 void bindPage( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControl
>& _rxControl
);
156 UnoMultiPageControl( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
157 ~UnoMultiPageControl();
158 OUString
GetComponentServiceName();
160 // ::com::sun::star::lang::XServiceInfo
161 DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageControl
, ControlContainerBase
, szServiceName_UnoMultiPageControl
)
162 ::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 void SAL_CALL
acquire() throw() { OWeakAggObject::acquire(); }
165 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
);
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
);
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
);
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
);
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
);
190 void SAL_CALL
dispose( ) throw(::com::sun::star::uno::RuntimeException
);
193 virtual void impl_createControlPeerIfNecessary(
194 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControl
>& _rxControl
200 class UnoPageModel
: public ControlModelContainerBase
203 UnoPageModel( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
205 UnoPageModel( const UnoPageModel
& rModel
);
207 UnoControlModel
* Clone() const;
209 DECLIMPL_SERVICEINFO_DERIVED( UnoPageModel
, ControlModelContainerBase
, szServiceName_UnoPageModel
)
211 virtual 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
);
214 // Override the method of parent Class
215 virtual sal_Bool SAL_CALL
getGroupControl( ) throw (::com::sun::star::uno::RuntimeException
);
217 virtual ::com::sun::star::uno::Any
ImplGetDefaultValue( sal_uInt16 nPropId
) const;
218 ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper();
222 class UnoPageControl
: public ControlContainerBase
225 UnoPageControl( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
227 OUString
GetComponentServiceName();
230 // ::com::sun::star::lang::XServiceInfo
231 DECLIMPL_SERVICEINFO_DERIVED( UnoPageControl
, ControlContainerBase
, szServiceName_UnoPageControl
)
234 class UnoFrameModel
: public ControlModelContainerBase
237 UnoFrameModel( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
239 UnoFrameModel( const UnoFrameModel
& rModel
);
241 UnoControlModel
* Clone() const;
243 DECLIMPL_SERVICEINFO_DERIVED( UnoFrameModel
, ControlModelContainerBase
, szServiceName_UnoFrameModel
)
245 virtual 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
);
249 virtual ::com::sun::star::uno::Any
ImplGetDefaultValue( sal_uInt16 nPropId
) const;
250 ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper();
253 class UnoFrameControl
: public ControlContainerBase
256 virtual void ImplSetPosSize( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControl
>& rxCtrl
);
258 UnoFrameControl( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
260 OUString
GetComponentServiceName();
262 // ::com::sun::star::lang::XServiceInfo
263 DECLIMPL_SERVICEINFO_DERIVED( UnoFrameControl
, ControlContainerBase
, szServiceName_UnoPageControl
)
266 #endif // TOOLKIT_DIALOG_CONTROL_HXX
268 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */