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 INCLUDED_TOOLKIT_CONTROLS_DIALOGCONTROL_HXX
21 #define INCLUDED_TOOLKIT_CONTROLS_DIALOGCONTROL_HXX
23 #include <toolkit/controls/controlmodelcontainerbase.hxx>
24 #include <com/sun/star/awt/UnoControlDialog.hpp>
25 #include <com/sun/star/awt/XSimpleTabController.hpp>
26 #include <toolkit/helper/macros.hxx>
27 #include <cppuhelper/implbase2.hxx>
29 namespace com
{ namespace sun
{ namespace star
{ namespace awt
{ class XTopWindowListener
; } } } }
31 typedef ::cppu::AggImplInheritanceHelper2
< ControlContainerBase
32 , css::awt::XUnoControlDialog
33 , css::awt::XWindowListener
34 > UnoDialogControl_Base
;
35 class UnoDialogControl final
: public UnoDialogControl_Base
38 css::uno::Reference
< css::awt::XMenuBar
> mxMenuBar
;
39 TopWindowListenerMultiplexer maTopWindowListeners
;
40 bool mbWindowListener
;
44 UnoDialogControl( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
45 virtual ~UnoDialogControl() override
;
46 OUString
GetComponentServiceName() override
;
48 void SAL_CALL
createPeer( const css::uno::Reference
< css::awt::XToolkit
>& Toolkit
, const css::uno::Reference
< css::awt::XWindowPeer
>& Parent
) override
;
49 void SAL_CALL
disposing( const css::lang::EventObject
& Source
) override
;
50 void SAL_CALL
dispose() override
;
52 // css::awt::XTopWindow
53 void SAL_CALL
addTopWindowListener( const css::uno::Reference
< css::awt::XTopWindowListener
>& xListener
) override
;
54 void SAL_CALL
removeTopWindowListener( const css::uno::Reference
< css::awt::XTopWindowListener
>& xListener
) override
;
55 void SAL_CALL
toFront( ) override
;
56 void SAL_CALL
toBack( ) override
;
57 void SAL_CALL
setMenuBar( const css::uno::Reference
< css::awt::XMenuBar
>& xMenu
) override
;
59 // css::awt::XWindowListener
60 virtual void SAL_CALL
windowResized( const css::awt::WindowEvent
& e
) override
;
61 virtual void SAL_CALL
windowMoved( const css::awt::WindowEvent
& e
) override
;
62 virtual void SAL_CALL
windowShown( const css::lang::EventObject
& e
) override
;
63 virtual void SAL_CALL
windowHidden( const css::lang::EventObject
& e
) override
;
66 virtual void SAL_CALL
endDialog( ::sal_Int32 Result
) override
;
67 virtual void SAL_CALL
setHelpId( const OUString
& Id
) override
;
70 void SAL_CALL
setTitle( const OUString
& Title
) override
;
71 OUString SAL_CALL
getTitle() override
;
72 sal_Int16 SAL_CALL
execute() override
;
73 void SAL_CALL
endExecute() override
;
76 sal_Bool SAL_CALL
setModel( const css::uno::Reference
< css::awt::XControlModel
>& Model
) override
;
79 virtual void SAL_CALL
modified( const css::lang::EventObject
& aEvent
) override
;
81 // resolve some ambiguous methods
82 virtual css::uno::Reference
<css::awt::XWindowPeer
> SAL_CALL
getPeer() override
83 { return UnoDialogControl_Base::ControlContainerBase::getPeer(); }
84 virtual void SAL_CALL
addWindowListener(const css::uno::Reference
<css::awt::XWindowListener
>& p1
) override
85 { UnoDialogControl_Base::ControlContainerBase::addWindowListener(p1
); }
86 virtual css::uno::Reference
<css::awt::XControlModel
> SAL_CALL
getModel() override
87 { return UnoDialogControl_Base::ControlContainerBase::getModel(); }
88 virtual void SAL_CALL
addEventListener(const css::uno::Reference
<css::lang::XEventListener
>& p1
) override
89 { UnoDialogControl_Base::ControlContainerBase::addEventListener(p1
); }
90 virtual void SAL_CALL
removeEventListener(const css::uno::Reference
<css::lang::XEventListener
>& p1
) override
91 { UnoDialogControl_Base::ControlContainerBase::removeEventListener(p1
); }
92 virtual void SAL_CALL
setContext(const css::uno::Reference
<css::uno::XInterface
>& p1
) override
93 { UnoDialogControl_Base::ControlContainerBase::setContext(p1
); }
94 virtual css::uno::Reference
<css::uno::XInterface
> SAL_CALL
getContext() override
95 { return UnoDialogControl_Base::ControlContainerBase::getContext(); }
96 virtual css::uno::Reference
<css::awt::XView
> SAL_CALL
getView() override
97 { return UnoDialogControl_Base::ControlContainerBase::getView(); }
98 virtual void SAL_CALL
setDesignMode(sal_Bool p1
) override
99 { UnoDialogControl_Base::ControlContainerBase::setDesignMode(p1
); }
100 virtual sal_Bool SAL_CALL
isDesignMode() override
101 { return UnoDialogControl_Base::ControlContainerBase::isDesignMode(); }
102 virtual sal_Bool SAL_CALL
isTransparent() override
103 { return UnoDialogControl_Base::ControlContainerBase::isTransparent(); }
104 virtual void SAL_CALL
setPosSize(sal_Int32 p1
, sal_Int32 p2
, sal_Int32 p3
, sal_Int32 p4
, sal_Int16 p5
) override
105 { UnoDialogControl_Base::ControlContainerBase::setPosSize(p1
, p2
, p3
, p4
, p5
); }
106 virtual css::awt::Rectangle SAL_CALL
getPosSize() override
107 { return UnoDialogControl_Base::ControlContainerBase::getPosSize(); }
108 virtual void SAL_CALL
setVisible(sal_Bool p1
) override
109 { UnoDialogControl_Base::ControlContainerBase::setVisible(p1
); }
110 virtual void SAL_CALL
setEnable(sal_Bool p1
) override
111 { UnoDialogControl_Base::ControlContainerBase::setEnable(p1
); }
112 virtual void SAL_CALL
setFocus() override
113 { UnoDialogControl_Base::ControlContainerBase::setFocus(); }
114 virtual void SAL_CALL
removeWindowListener(const css::uno::Reference
<css::awt::XWindowListener
>& p1
) override
115 { UnoDialogControl_Base::ControlContainerBase::removeWindowListener(p1
); }
116 virtual void SAL_CALL
addFocusListener(const css::uno::Reference
<css::awt::XFocusListener
>& p1
) override
117 { UnoDialogControl_Base::ControlContainerBase::addFocusListener(p1
); }
118 virtual void SAL_CALL
removeFocusListener(const css::uno::Reference
<css::awt::XFocusListener
>& p1
) override
119 { UnoDialogControl_Base::ControlContainerBase::removeFocusListener(p1
); }
120 virtual void SAL_CALL
addKeyListener(const css::uno::Reference
<css::awt::XKeyListener
>& p1
) override
121 { UnoDialogControl_Base::ControlContainerBase::addKeyListener(p1
); }
122 virtual void SAL_CALL
removeKeyListener(const css::uno::Reference
<css::awt::XKeyListener
>& p1
) override
123 { UnoDialogControl_Base::ControlContainerBase::removeKeyListener(p1
); }
124 virtual void SAL_CALL
addMouseListener(const css::uno::Reference
<css::awt::XMouseListener
>& p1
) override
125 { UnoDialogControl_Base::ControlContainerBase::addMouseListener(p1
); }
126 virtual void SAL_CALL
removeMouseListener(const css::uno::Reference
<css::awt::XMouseListener
>& p1
) override
127 { UnoDialogControl_Base::ControlContainerBase::removeMouseListener(p1
); }
128 virtual void SAL_CALL
addMouseMotionListener(const css::uno::Reference
<css::awt::XMouseMotionListener
>& p1
) override
129 { UnoDialogControl_Base::ControlContainerBase::addMouseMotionListener(p1
); }
130 virtual void SAL_CALL
removeMouseMotionListener(const css::uno::Reference
<css::awt::XMouseMotionListener
>& p1
) override
131 { UnoDialogControl_Base::ControlContainerBase::removeMouseMotionListener(p1
); }
132 virtual void SAL_CALL
addPaintListener(const css::uno::Reference
<css::awt::XPaintListener
>& p1
) override
133 { UnoDialogControl_Base::ControlContainerBase::addPaintListener(p1
); }
134 virtual void SAL_CALL
removePaintListener(const css::uno::Reference
<css::awt::XPaintListener
>& p1
) override
135 { UnoDialogControl_Base::ControlContainerBase::removePaintListener(p1
); }
136 virtual void SAL_CALL
setStatusText(const OUString
& p1
) override
137 { UnoDialogControl_Base::ControlContainerBase::setStatusText(p1
); }
138 virtual css::uno::Sequence
<css::uno::Reference
<css::awt::XControl
> > SAL_CALL
getControls() override
139 { return UnoDialogControl_Base::ControlContainerBase::getControls(); }
140 virtual css::uno::Reference
<css::awt::XControl
> SAL_CALL
getControl(const OUString
& p1
) override
141 { return UnoDialogControl_Base::ControlContainerBase::getControl(p1
); }
142 virtual void SAL_CALL
addControl(const OUString
& p1
, const css::uno::Reference
<css::awt::XControl
>& p2
) override
143 { UnoDialogControl_Base::ControlContainerBase::addControl(p1
, p2
); }
144 virtual void SAL_CALL
removeControl(const css::uno::Reference
<css::awt::XControl
>& p1
) override
145 { UnoDialogControl_Base::ControlContainerBase::removeControl(p1
); }
148 // css::lang::XServiceInfo
149 OUString SAL_CALL
getImplementationName() override
;
151 sal_Bool SAL_CALL
supportsService(OUString
const & ServiceName
) override
;
153 css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames() override
;
156 virtual void PrepareWindowDescriptor( css::awt::WindowDescriptor
& rDesc
) override
;
157 virtual void ImplModelPropertiesChanged( const css::uno::Sequence
< css::beans::PropertyChangeEvent
>& rEvents
) override
;
160 class UnoMultiPageModel final
: public ControlModelContainerBase
163 UnoMultiPageModel( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
164 virtual ~UnoMultiPageModel() override
;
166 UnoMultiPageModel(UnoMultiPageModel
const &) = default;
167 UnoMultiPageModel(UnoMultiPageModel
&&) = default;
168 UnoMultiPageModel
& operator =(UnoMultiPageModel
const &) = delete; // due to ControlModelContainerBase
169 UnoMultiPageModel
& operator =(UnoMultiPageModel
&&) = delete; // due to ControlModelContainerBase
171 rtl::Reference
<UnoControlModel
> Clone() const override
;
173 DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageModel
, ControlModelContainerBase
, "com.sun.star.awt.UnoMultiPageModel" )
175 virtual OUString SAL_CALL
getServiceName() override
;
176 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
178 void SAL_CALL
insertByName( const OUString
& aName
, const css::uno::Any
& aElement
) override
;
180 // Override the method of parent class
181 virtual sal_Bool SAL_CALL
getGroupControl( ) override
;
183 virtual css::uno::Any
ImplGetDefaultValue( sal_uInt16 nPropId
) const override
;
184 ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() override
;
188 class UnoMultiPageControl final
: public ControlContainerBase
189 ,public css::awt::XSimpleTabController
190 ,public css::awt::XTabListener
192 TabListenerMultiplexer maTabListeners
;
193 void bindPage( const css::uno::Reference
< css::awt::XControl
>& _rxControl
);
195 UnoMultiPageControl( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
196 virtual ~UnoMultiPageControl() override
;
197 OUString
GetComponentServiceName() override
;
199 // css::lang::XServiceInfo
200 DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageControl
, ControlContainerBase
, "com.sun.star.awt.UnoControlMultiPage" )
201 css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
) override
{ return ControlContainerBase::queryInterface(rType
); }
202 css::uno::Any SAL_CALL
queryAggregation( const css::uno::Type
& rType
) override
;
203 void SAL_CALL
acquire() throw() override
{ OWeakAggObject::acquire(); }
204 void SAL_CALL
release() throw() override
{ OWeakAggObject::release(); }
205 // css::lang::XTypeProvider
206 css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes() override
;
207 css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() override
;
208 void SAL_CALL
createPeer( const css::uno::Reference
< css::awt::XToolkit
>& Toolkit
, const css::uno::Reference
< css::awt::XWindowPeer
>& Parent
) override
;
209 // css::awt::XSimpleTabController
210 virtual ::sal_Int32 SAL_CALL
insertTab() override
;
211 virtual void SAL_CALL
removeTab( ::sal_Int32 ID
) override
;
213 virtual void SAL_CALL
setTabProps( ::sal_Int32 ID
, const css::uno::Sequence
< css::beans::NamedValue
>& Properties
) override
;
214 virtual css::uno::Sequence
< css::beans::NamedValue
> SAL_CALL
getTabProps( ::sal_Int32 ID
) override
;
216 virtual void SAL_CALL
activateTab( ::sal_Int32 ID
) override
;
217 virtual ::sal_Int32 SAL_CALL
getActiveTabID() override
;
219 virtual void SAL_CALL
addTabListener( const css::uno::Reference
< css::awt::XTabListener
>& Listener
) override
;
220 virtual void SAL_CALL
removeTabListener( const css::uno::Reference
< css::awt::XTabListener
>& Listener
) override
;
222 virtual void SAL_CALL
inserted( ::sal_Int32 ID
) override
;
223 virtual void SAL_CALL
removed( ::sal_Int32 ID
) override
;
224 virtual void SAL_CALL
changed( ::sal_Int32 ID
, const css::uno::Sequence
< css::beans::NamedValue
>& Properties
) override
;
225 virtual void SAL_CALL
activated( ::sal_Int32 ID
) override
;
226 virtual void SAL_CALL
deactivated( ::sal_Int32 ID
) override
;
227 virtual void SAL_CALL
disposing( const css::lang::EventObject
& evt
) override
;
229 void SAL_CALL
dispose( ) override
;
232 virtual void impl_createControlPeerIfNecessary(
233 const css::uno::Reference
< css::awt::XControl
>& _rxControl
239 class UnoPageModel final
: public ControlModelContainerBase
242 UnoPageModel( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
243 virtual ~UnoPageModel() override
;
245 UnoPageModel(UnoPageModel
const &) = default;
246 UnoPageModel(UnoPageModel
&&) = default;
247 UnoPageModel
& operator =(UnoPageModel
const &) = delete; // due to ControlModelContainerBase
248 UnoPageModel
& operator =(UnoPageModel
&&) = delete; // due to ControlModelContainerBase
250 rtl::Reference
<UnoControlModel
> Clone() const override
;
252 DECLIMPL_SERVICEINFO_DERIVED( UnoPageModel
, ControlModelContainerBase
, "com.sun.star.awt.UnoPageModel" )
254 virtual OUString SAL_CALL
getServiceName() override
;
255 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
257 // Override the method of parent class
258 virtual sal_Bool SAL_CALL
getGroupControl( ) override
;
260 virtual css::uno::Any
ImplGetDefaultValue( sal_uInt16 nPropId
) const override
;
261 ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() override
;
265 class UnoPageControl final
: public ControlContainerBase
268 UnoPageControl( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
269 virtual ~UnoPageControl() override
;
270 OUString
GetComponentServiceName() override
;
273 // css::lang::XServiceInfo
274 DECLIMPL_SERVICEINFO_DERIVED( UnoPageControl
, ControlContainerBase
, "com.sun.star.awt.UnoControlPage" )
277 class UnoFrameModel final
: public ControlModelContainerBase
280 UnoFrameModel( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
281 virtual ~UnoFrameModel() override
;
283 UnoFrameModel(UnoFrameModel
const &) = default;
284 UnoFrameModel(UnoFrameModel
&&) = default;
285 UnoFrameModel
& operator =(UnoFrameModel
const &) = delete; // due to ControlModelContainerBase
286 UnoFrameModel
& operator =(UnoFrameModel
&&) = delete; // due to ControlModelContainerBase
288 rtl::Reference
<UnoControlModel
> Clone() const override
;
290 DECLIMPL_SERVICEINFO_DERIVED( UnoFrameModel
, ControlModelContainerBase
, "com.sun.star.awt.UnoFrameModel" )
292 virtual OUString SAL_CALL
getServiceName() override
;
293 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
296 virtual css::uno::Any
ImplGetDefaultValue( sal_uInt16 nPropId
) const override
;
297 ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() override
;
300 class UnoFrameControl final
: public ControlContainerBase
302 virtual void ImplSetPosSize( css::uno::Reference
< css::awt::XControl
>& rxCtrl
) override
;
304 UnoFrameControl( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
305 virtual ~UnoFrameControl() override
;
306 OUString
GetComponentServiceName() override
;
308 // css::lang::XServiceInfo
309 DECLIMPL_SERVICEINFO_DERIVED( UnoFrameControl
, ControlContainerBase
, "com.sun.star.awt.UnoControlFrame" )
312 #endif // INCLUDED_TOOLKIT_CONTROLS_DIALOGCONTROL_HXX
314 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */