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 .
22 #include <controls/controlmodelcontainerbase.hxx>
23 #include <com/sun/star/awt/UnoControlDialog.hpp>
24 #include <com/sun/star/awt/XSimpleTabController.hpp>
25 #include <toolkit/helper/macros.hxx>
26 #include <cppuhelper/implbase2.hxx>
28 namespace com::sun::star::awt
{ class XTopWindowListener
; }
30 typedef ::cppu::AggImplInheritanceHelper2
< ControlContainerBase
31 , css::awt::XUnoControlDialog
32 , css::awt::XWindowListener
33 > UnoDialogControl_Base
;
34 class UnoDialogControl final
: public UnoDialogControl_Base
37 css::uno::Reference
< css::awt::XMenuBar
> mxMenuBar
;
38 TopWindowListenerMultiplexer maTopWindowListeners
;
39 bool mbWindowListener
;
43 UnoDialogControl( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
44 virtual ~UnoDialogControl() override
;
45 OUString
GetComponentServiceName() const override
;
47 void SAL_CALL
createPeer( const css::uno::Reference
< css::awt::XToolkit
>& Toolkit
, const css::uno::Reference
< css::awt::XWindowPeer
>& Parent
) override
;
48 void SAL_CALL
disposing( const css::lang::EventObject
& Source
) override
;
49 void SAL_CALL
dispose() override
;
51 // css::awt::XTopWindow
52 void SAL_CALL
addTopWindowListener( const css::uno::Reference
< css::awt::XTopWindowListener
>& xListener
) override
;
53 void SAL_CALL
removeTopWindowListener( const css::uno::Reference
< css::awt::XTopWindowListener
>& xListener
) override
;
54 void SAL_CALL
toFront( ) override
;
55 void SAL_CALL
toBack( ) override
;
56 void SAL_CALL
setMenuBar( const css::uno::Reference
< css::awt::XMenuBar
>& xMenu
) override
;
58 // css::awt::XWindowListener
59 virtual void SAL_CALL
windowResized( const css::awt::WindowEvent
& e
) override
;
60 virtual void SAL_CALL
windowMoved( const css::awt::WindowEvent
& e
) override
;
61 virtual void SAL_CALL
windowShown( const css::lang::EventObject
& e
) override
;
62 virtual void SAL_CALL
windowHidden( const css::lang::EventObject
& e
) override
;
65 virtual void SAL_CALL
endDialog( ::sal_Int32 Result
) override
;
66 virtual void SAL_CALL
setHelpId( const OUString
& Id
) override
;
69 void SAL_CALL
setTitle( const OUString
& Title
) override
;
70 OUString SAL_CALL
getTitle() override
;
71 sal_Int16 SAL_CALL
execute() override
;
72 void SAL_CALL
endExecute() override
;
75 sal_Bool SAL_CALL
setModel( const css::uno::Reference
< css::awt::XControlModel
>& Model
) override
;
78 virtual void SAL_CALL
modified( const css::lang::EventObject
& aEvent
) override
;
80 // resolve some ambiguous methods
81 virtual css::uno::Reference
<css::awt::XWindowPeer
> SAL_CALL
getPeer() override
82 { return UnoDialogControl_Base::ControlContainerBase::getPeer(); }
83 virtual void SAL_CALL
addWindowListener(const css::uno::Reference
<css::awt::XWindowListener
>& p1
) override
84 { UnoDialogControl_Base::ControlContainerBase::addWindowListener(p1
); }
85 virtual css::uno::Reference
<css::awt::XControlModel
> SAL_CALL
getModel() override
86 { return UnoDialogControl_Base::ControlContainerBase::getModel(); }
87 virtual void SAL_CALL
addEventListener(const css::uno::Reference
<css::lang::XEventListener
>& p1
) override
88 { UnoDialogControl_Base::ControlContainerBase::addEventListener(p1
); }
89 virtual void SAL_CALL
removeEventListener(const css::uno::Reference
<css::lang::XEventListener
>& p1
) override
90 { UnoDialogControl_Base::ControlContainerBase::removeEventListener(p1
); }
91 virtual void SAL_CALL
setContext(const css::uno::Reference
<css::uno::XInterface
>& p1
) override
92 { UnoDialogControl_Base::ControlContainerBase::setContext(p1
); }
93 virtual css::uno::Reference
<css::uno::XInterface
> SAL_CALL
getContext() override
94 { return UnoDialogControl_Base::ControlContainerBase::getContext(); }
95 virtual css::uno::Reference
<css::awt::XView
> SAL_CALL
getView() override
96 { return UnoDialogControl_Base::ControlContainerBase::getView(); }
97 virtual void SAL_CALL
setDesignMode(sal_Bool p1
) override
98 { UnoDialogControl_Base::ControlContainerBase::setDesignMode(p1
); }
99 virtual sal_Bool SAL_CALL
isDesignMode() override
100 { return UnoDialogControl_Base::ControlContainerBase::isDesignMode(); }
101 virtual sal_Bool SAL_CALL
isTransparent() override
102 { return UnoDialogControl_Base::ControlContainerBase::isTransparent(); }
103 virtual void SAL_CALL
setPosSize(sal_Int32 p1
, sal_Int32 p2
, sal_Int32 p3
, sal_Int32 p4
, sal_Int16 p5
) override
104 { UnoDialogControl_Base::ControlContainerBase::setPosSize(p1
, p2
, p3
, p4
, p5
); }
105 virtual css::awt::Rectangle SAL_CALL
getPosSize() override
106 { return UnoDialogControl_Base::ControlContainerBase::getPosSize(); }
107 virtual void SAL_CALL
setVisible(sal_Bool p1
) override
108 { UnoDialogControl_Base::ControlContainerBase::setVisible(p1
); }
109 virtual void SAL_CALL
setEnable(sal_Bool p1
) override
110 { UnoDialogControl_Base::ControlContainerBase::setEnable(p1
); }
111 virtual void SAL_CALL
setFocus() override
112 { UnoDialogControl_Base::ControlContainerBase::setFocus(); }
113 virtual void SAL_CALL
removeWindowListener(const css::uno::Reference
<css::awt::XWindowListener
>& p1
) override
114 { UnoDialogControl_Base::ControlContainerBase::removeWindowListener(p1
); }
115 virtual void SAL_CALL
addFocusListener(const css::uno::Reference
<css::awt::XFocusListener
>& p1
) override
116 { UnoDialogControl_Base::ControlContainerBase::addFocusListener(p1
); }
117 virtual void SAL_CALL
removeFocusListener(const css::uno::Reference
<css::awt::XFocusListener
>& p1
) override
118 { UnoDialogControl_Base::ControlContainerBase::removeFocusListener(p1
); }
119 virtual void SAL_CALL
addKeyListener(const css::uno::Reference
<css::awt::XKeyListener
>& p1
) override
120 { UnoDialogControl_Base::ControlContainerBase::addKeyListener(p1
); }
121 virtual void SAL_CALL
removeKeyListener(const css::uno::Reference
<css::awt::XKeyListener
>& p1
) override
122 { UnoDialogControl_Base::ControlContainerBase::removeKeyListener(p1
); }
123 virtual void SAL_CALL
addMouseListener(const css::uno::Reference
<css::awt::XMouseListener
>& p1
) override
124 { UnoDialogControl_Base::ControlContainerBase::addMouseListener(p1
); }
125 virtual void SAL_CALL
removeMouseListener(const css::uno::Reference
<css::awt::XMouseListener
>& p1
) override
126 { UnoDialogControl_Base::ControlContainerBase::removeMouseListener(p1
); }
127 virtual void SAL_CALL
addMouseMotionListener(const css::uno::Reference
<css::awt::XMouseMotionListener
>& p1
) override
128 { UnoDialogControl_Base::ControlContainerBase::addMouseMotionListener(p1
); }
129 virtual void SAL_CALL
removeMouseMotionListener(const css::uno::Reference
<css::awt::XMouseMotionListener
>& p1
) override
130 { UnoDialogControl_Base::ControlContainerBase::removeMouseMotionListener(p1
); }
131 virtual void SAL_CALL
addPaintListener(const css::uno::Reference
<css::awt::XPaintListener
>& p1
) override
132 { UnoDialogControl_Base::ControlContainerBase::addPaintListener(p1
); }
133 virtual void SAL_CALL
removePaintListener(const css::uno::Reference
<css::awt::XPaintListener
>& p1
) override
134 { UnoDialogControl_Base::ControlContainerBase::removePaintListener(p1
); }
135 virtual void SAL_CALL
setStatusText(const OUString
& p1
) override
136 { UnoDialogControl_Base::ControlContainerBase::setStatusText(p1
); }
137 virtual css::uno::Sequence
<css::uno::Reference
<css::awt::XControl
> > SAL_CALL
getControls() override
138 { return UnoDialogControl_Base::ControlContainerBase::getControls(); }
139 virtual css::uno::Reference
<css::awt::XControl
> SAL_CALL
getControl(const OUString
& p1
) override
140 { return UnoDialogControl_Base::ControlContainerBase::getControl(p1
); }
141 virtual void SAL_CALL
addControl(const OUString
& p1
, const css::uno::Reference
<css::awt::XControl
>& p2
) override
142 { UnoDialogControl_Base::ControlContainerBase::addControl(p1
, p2
); }
143 virtual void SAL_CALL
removeControl(const css::uno::Reference
<css::awt::XControl
>& p1
) override
144 { UnoDialogControl_Base::ControlContainerBase::removeControl(p1
); }
147 // css::lang::XServiceInfo
148 OUString SAL_CALL
getImplementationName() override
;
150 sal_Bool SAL_CALL
supportsService(OUString
const & ServiceName
) override
;
152 css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames() override
;
155 virtual void PrepareWindowDescriptor( css::awt::WindowDescriptor
& rDesc
) override
;
156 virtual void ImplModelPropertiesChanged( const css::uno::Sequence
< css::beans::PropertyChangeEvent
>& rEvents
) override
;
159 class UnoMultiPageModel final
: public ControlModelContainerBase
162 UnoMultiPageModel( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
163 UnoMultiPageModel(const UnoMultiPageModel
& rOther
) : ControlModelContainerBase(rOther
) {}
164 virtual ~UnoMultiPageModel() override
;
166 rtl::Reference
<UnoControlModel
> Clone() const override
;
168 DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageModel
, ControlModelContainerBase
, "com.sun.star.awt.UnoMultiPageModel" )
170 virtual OUString SAL_CALL
getServiceName() override
;
171 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
173 void SAL_CALL
insertByName( const OUString
& aName
, const css::uno::Any
& aElement
) override
;
175 // Override the method of parent class
176 virtual sal_Bool SAL_CALL
getGroupControl( ) override
;
178 virtual css::uno::Any
ImplGetDefaultValue( sal_uInt16 nPropId
) const override
;
179 ::cppu::IPropertyArrayHelper
& getInfoHelper() override
;
183 class UnoMultiPageControl final
: public ControlContainerBase
184 ,public css::awt::XSimpleTabController
185 ,public css::awt::XTabListener
187 TabListenerMultiplexer maTabListeners
;
188 void bindPage( const css::uno::Reference
< css::awt::XControl
>& _rxControl
);
190 UnoMultiPageControl( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
191 virtual ~UnoMultiPageControl() override
;
192 OUString
GetComponentServiceName() const override
;
194 // css::lang::XServiceInfo
195 DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageControl
, ControlContainerBase
, "com.sun.star.awt.UnoControlMultiPage" )
196 css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
) override
{ return ControlContainerBase::queryInterface(rType
); }
197 css::uno::Any SAL_CALL
queryAggregation( const css::uno::Type
& rType
) override
;
198 void SAL_CALL
acquire() noexcept override
{ OWeakAggObject::acquire(); }
199 void SAL_CALL
release() noexcept override
{ OWeakAggObject::release(); }
200 // css::lang::XTypeProvider
201 css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes() override
;
202 css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() override
;
203 void SAL_CALL
createPeer( const css::uno::Reference
< css::awt::XToolkit
>& Toolkit
, const css::uno::Reference
< css::awt::XWindowPeer
>& Parent
) override
;
204 // css::awt::XSimpleTabController
205 virtual ::sal_Int32 SAL_CALL
insertTab() override
;
206 virtual void SAL_CALL
removeTab( ::sal_Int32 ID
) override
;
208 virtual void SAL_CALL
setTabProps( ::sal_Int32 ID
, const css::uno::Sequence
< css::beans::NamedValue
>& Properties
) override
;
209 virtual css::uno::Sequence
< css::beans::NamedValue
> SAL_CALL
getTabProps( ::sal_Int32 ID
) override
;
211 virtual void SAL_CALL
activateTab( ::sal_Int32 ID
) override
;
212 virtual ::sal_Int32 SAL_CALL
getActiveTabID() override
;
214 virtual void SAL_CALL
addTabListener( const css::uno::Reference
< css::awt::XTabListener
>& Listener
) override
;
215 virtual void SAL_CALL
removeTabListener( const css::uno::Reference
< css::awt::XTabListener
>& Listener
) override
;
217 virtual void SAL_CALL
inserted( ::sal_Int32 ID
) override
;
218 virtual void SAL_CALL
removed( ::sal_Int32 ID
) override
;
219 virtual void SAL_CALL
changed( ::sal_Int32 ID
, const css::uno::Sequence
< css::beans::NamedValue
>& Properties
) override
;
220 virtual void SAL_CALL
activated( ::sal_Int32 ID
) override
;
221 virtual void SAL_CALL
deactivated( ::sal_Int32 ID
) override
;
222 virtual void SAL_CALL
disposing( const css::lang::EventObject
& evt
) override
;
224 void SAL_CALL
dispose( ) override
;
227 virtual void impl_createControlPeerIfNecessary(
228 const css::uno::Reference
< css::awt::XControl
>& _rxControl
234 class UnoPageModel final
: public ControlModelContainerBase
237 UnoPageModel( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
238 UnoPageModel(const UnoPageModel
& rOther
) : ControlModelContainerBase(rOther
) {}
239 virtual ~UnoPageModel() override
;
241 rtl::Reference
<UnoControlModel
> Clone() const override
;
243 DECLIMPL_SERVICEINFO_DERIVED( UnoPageModel
, ControlModelContainerBase
, "com.sun.star.awt.UnoPageModel" )
245 virtual OUString SAL_CALL
getServiceName() override
;
246 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
248 // Override the method of parent class
249 virtual sal_Bool SAL_CALL
getGroupControl( ) override
;
251 virtual css::uno::Any
ImplGetDefaultValue( sal_uInt16 nPropId
) const override
;
252 ::cppu::IPropertyArrayHelper
& getInfoHelper() override
;
256 class UnoPageControl final
: public ControlContainerBase
259 UnoPageControl( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
260 virtual ~UnoPageControl() override
;
261 OUString
GetComponentServiceName() const override
;
264 // css::lang::XServiceInfo
265 DECLIMPL_SERVICEINFO_DERIVED( UnoPageControl
, ControlContainerBase
, "com.sun.star.awt.UnoControlPage" )
268 class UnoFrameModel final
: public ControlModelContainerBase
271 UnoFrameModel( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
272 UnoFrameModel(const UnoFrameModel
& rOther
) : ControlModelContainerBase(rOther
) {}
273 virtual ~UnoFrameModel() override
;
275 rtl::Reference
<UnoControlModel
> Clone() const override
;
277 DECLIMPL_SERVICEINFO_DERIVED( UnoFrameModel
, ControlModelContainerBase
, "com.sun.star.awt.UnoFrameModel" )
279 virtual OUString SAL_CALL
getServiceName() override
;
280 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
283 virtual css::uno::Any
ImplGetDefaultValue( sal_uInt16 nPropId
) const override
;
284 ::cppu::IPropertyArrayHelper
& getInfoHelper() override
;
287 class UnoFrameControl final
: public ControlContainerBase
289 virtual void ImplSetPosSize( css::uno::Reference
< css::awt::XControl
>& rxCtrl
) override
;
291 UnoFrameControl( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
292 virtual ~UnoFrameControl() override
;
293 OUString
GetComponentServiceName() const override
;
295 // css::lang::XServiceInfo
296 DECLIMPL_SERVICEINFO_DERIVED( UnoFrameControl
, ControlContainerBase
, "com.sun.star.awt.UnoControlFrame" )
299 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */