/src/libreoffice/toolkit/inc/controls/dialogcontrol.hxx
Line | Count | Source |
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 | | #pragma once |
21 | | |
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> |
27 | | |
28 | | typedef ::cppu::AggImplInheritanceHelper2 < ControlContainerBase |
29 | | , css::awt::XUnoControlDialog |
30 | | , css::awt::XWindowListener |
31 | | > UnoDialogControl_Base; |
32 | | class UnoDialogControl final : public UnoDialogControl_Base |
33 | | { |
34 | | private: |
35 | | css::uno::Reference< css::awt::XMenuBar > mxMenuBar; |
36 | | TopWindowListenerMultiplexer maTopWindowListeners; |
37 | | bool mbWindowListener; |
38 | | |
39 | | public: |
40 | | |
41 | | UnoDialogControl( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); |
42 | | virtual ~UnoDialogControl() override; |
43 | | OUString GetComponentServiceName() const override; |
44 | | |
45 | | void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; |
46 | | void SAL_CALL disposing( const css::lang::EventObject& Source ) override; |
47 | | void SAL_CALL dispose() override; |
48 | | |
49 | | // css::awt::XTopWindow |
50 | | void SAL_CALL addTopWindowListener( const css::uno::Reference< css::awt::XTopWindowListener >& xListener ) override; |
51 | | void SAL_CALL removeTopWindowListener( const css::uno::Reference< css::awt::XTopWindowListener >& xListener ) override; |
52 | | void SAL_CALL toFront( ) override; |
53 | | void SAL_CALL toBack( ) override; |
54 | | void SAL_CALL setMenuBar( const css::uno::Reference< css::awt::XMenuBar >& xMenu ) override; |
55 | | |
56 | | // css::awt::XWindowListener |
57 | | virtual void SAL_CALL windowResized( const css::awt::WindowEvent& e ) override; |
58 | | virtual void SAL_CALL windowMoved( const css::awt::WindowEvent& e ) override; |
59 | | virtual void SAL_CALL windowShown( const css::lang::EventObject& e ) override; |
60 | | virtual void SAL_CALL windowHidden( const css::lang::EventObject& e ) override; |
61 | | |
62 | | // css::awt::XDialog2 |
63 | | virtual void SAL_CALL endDialog( ::sal_Int32 Result ) override; |
64 | | virtual void SAL_CALL setHelpId( const OUString& Id ) override; |
65 | | |
66 | | // css::awt::XDialog |
67 | | void SAL_CALL setTitle( const OUString& Title ) override; |
68 | | OUString SAL_CALL getTitle() override; |
69 | | sal_Int16 SAL_CALL execute() override; |
70 | | void SAL_CALL endExecute() override; |
71 | | |
72 | | // css::awt::XControl |
73 | | sal_Bool SAL_CALL setModel( const css::uno::Reference< css::awt::XControlModel >& Model ) override; |
74 | | |
75 | | // XModifyListener |
76 | | virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override; |
77 | | |
78 | | // resolve some ambiguous methods |
79 | | virtual css::uno::Reference<css::awt::XWindowPeer> SAL_CALL getPeer() override |
80 | 0 | { return UnoDialogControl_Base::ControlContainerBase::getPeer(); } |
81 | | virtual void SAL_CALL addWindowListener(const css::uno::Reference<css::awt::XWindowListener>& p1) override |
82 | 0 | { UnoDialogControl_Base::ControlContainerBase::addWindowListener(p1); } |
83 | | virtual css::uno::Reference<css::awt::XControlModel> SAL_CALL getModel() override |
84 | 0 | { return UnoDialogControl_Base::ControlContainerBase::getModel(); } |
85 | | virtual void SAL_CALL addEventListener(const css::uno::Reference<css::lang::XEventListener>& p1) override |
86 | 0 | { UnoDialogControl_Base::ControlContainerBase::addEventListener(p1); } |
87 | | virtual void SAL_CALL removeEventListener(const css::uno::Reference<css::lang::XEventListener>& p1) override |
88 | 0 | { UnoDialogControl_Base::ControlContainerBase::removeEventListener(p1); } |
89 | | virtual void SAL_CALL setContext(const css::uno::Reference<css::uno::XInterface>& p1) override |
90 | 0 | { UnoDialogControl_Base::ControlContainerBase::setContext(p1); } |
91 | | virtual css::uno::Reference<css::uno::XInterface> SAL_CALL getContext() override |
92 | 0 | { return UnoDialogControl_Base::ControlContainerBase::getContext(); } |
93 | | virtual css::uno::Reference<css::awt::XView> SAL_CALL getView() override |
94 | 0 | { return UnoDialogControl_Base::ControlContainerBase::getView(); } |
95 | | virtual void SAL_CALL setDesignMode(sal_Bool p1) override |
96 | 0 | { UnoDialogControl_Base::ControlContainerBase::setDesignMode(p1); } |
97 | | virtual sal_Bool SAL_CALL isDesignMode() override |
98 | 0 | { return UnoDialogControl_Base::ControlContainerBase::isDesignMode(); } |
99 | | virtual sal_Bool SAL_CALL isTransparent() override |
100 | 0 | { return UnoDialogControl_Base::ControlContainerBase::isTransparent(); } |
101 | | virtual void SAL_CALL setPosSize(sal_Int32 p1, sal_Int32 p2, sal_Int32 p3, sal_Int32 p4, sal_Int16 p5) override |
102 | 0 | { UnoDialogControl_Base::ControlContainerBase::setPosSize(p1, p2, p3, p4, p5); } |
103 | | virtual css::awt::Rectangle SAL_CALL getPosSize() override |
104 | 0 | { return UnoDialogControl_Base::ControlContainerBase::getPosSize(); } |
105 | | virtual void SAL_CALL setVisible(sal_Bool p1) override |
106 | 0 | { UnoDialogControl_Base::ControlContainerBase::setVisible(p1); } |
107 | | virtual void SAL_CALL setEnable(sal_Bool p1) override |
108 | 0 | { UnoDialogControl_Base::ControlContainerBase::setEnable(p1); } |
109 | | virtual void SAL_CALL setFocus() override |
110 | 0 | { UnoDialogControl_Base::ControlContainerBase::setFocus(); } |
111 | | virtual void SAL_CALL removeWindowListener(const css::uno::Reference<css::awt::XWindowListener>& p1) override |
112 | 0 | { UnoDialogControl_Base::ControlContainerBase::removeWindowListener(p1); } |
113 | | virtual void SAL_CALL addFocusListener(const css::uno::Reference<css::awt::XFocusListener>& p1) override |
114 | 0 | { UnoDialogControl_Base::ControlContainerBase::addFocusListener(p1); } |
115 | | virtual void SAL_CALL removeFocusListener(const css::uno::Reference<css::awt::XFocusListener>& p1) override |
116 | 0 | { UnoDialogControl_Base::ControlContainerBase::removeFocusListener(p1); } |
117 | | virtual void SAL_CALL addKeyListener(const css::uno::Reference<css::awt::XKeyListener>& p1) override |
118 | 0 | { UnoDialogControl_Base::ControlContainerBase::addKeyListener(p1); } |
119 | | virtual void SAL_CALL removeKeyListener(const css::uno::Reference<css::awt::XKeyListener>& p1) override |
120 | 0 | { UnoDialogControl_Base::ControlContainerBase::removeKeyListener(p1); } |
121 | | virtual void SAL_CALL addMouseListener(const css::uno::Reference<css::awt::XMouseListener>& p1) override |
122 | 0 | { UnoDialogControl_Base::ControlContainerBase::addMouseListener(p1); } |
123 | | virtual void SAL_CALL removeMouseListener(const css::uno::Reference<css::awt::XMouseListener>& p1) override |
124 | 0 | { UnoDialogControl_Base::ControlContainerBase::removeMouseListener(p1); } |
125 | | virtual void SAL_CALL addMouseMotionListener(const css::uno::Reference<css::awt::XMouseMotionListener>& p1) override |
126 | 0 | { UnoDialogControl_Base::ControlContainerBase::addMouseMotionListener(p1); } |
127 | | virtual void SAL_CALL removeMouseMotionListener(const css::uno::Reference<css::awt::XMouseMotionListener>& p1) override |
128 | 0 | { UnoDialogControl_Base::ControlContainerBase::removeMouseMotionListener(p1); } |
129 | | virtual void SAL_CALL addPaintListener(const css::uno::Reference<css::awt::XPaintListener>& p1) override |
130 | 0 | { UnoDialogControl_Base::ControlContainerBase::addPaintListener(p1); } |
131 | | virtual void SAL_CALL removePaintListener(const css::uno::Reference<css::awt::XPaintListener>& p1) override |
132 | 0 | { UnoDialogControl_Base::ControlContainerBase::removePaintListener(p1); } |
133 | | virtual void SAL_CALL setStatusText(const OUString& p1) override |
134 | 0 | { UnoDialogControl_Base::ControlContainerBase::setStatusText(p1); } |
135 | | virtual css::uno::Sequence<css::uno::Reference<css::awt::XControl> > SAL_CALL getControls() override |
136 | 0 | { return UnoDialogControl_Base::ControlContainerBase::getControls(); } |
137 | | virtual css::uno::Reference<css::awt::XControl> SAL_CALL getControl(const OUString& p1) override |
138 | 0 | { return UnoDialogControl_Base::ControlContainerBase::getControl(p1); } |
139 | | virtual void SAL_CALL addControl(const OUString& p1, const css::uno::Reference<css::awt::XControl>& p2) override |
140 | 0 | { UnoDialogControl_Base::ControlContainerBase::addControl(p1, p2); } |
141 | | virtual void SAL_CALL removeControl(const css::uno::Reference<css::awt::XControl>& p1) override |
142 | 0 | { UnoDialogControl_Base::ControlContainerBase::removeControl(p1); } |
143 | | |
144 | | |
145 | | // css::lang::XServiceInfo |
146 | | OUString SAL_CALL getImplementationName() override; |
147 | | |
148 | | sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override; |
149 | | |
150 | | css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; |
151 | | |
152 | | private: |
153 | | virtual void PrepareWindowDescriptor( css::awt::WindowDescriptor& rDesc ) override; |
154 | | virtual void ImplModelPropertiesChanged( const css::uno::Sequence< css::beans::PropertyChangeEvent >& rEvents ) override; |
155 | | }; |
156 | | |
157 | | class UnoMultiPageModel final : public ControlModelContainerBase |
158 | | { |
159 | | public: |
160 | | UnoMultiPageModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); |
161 | 0 | UnoMultiPageModel(const UnoMultiPageModel& rOther) : ControlModelContainerBase(rOther) {} |
162 | | virtual ~UnoMultiPageModel() override; |
163 | | |
164 | | rtl::Reference<UnoControlModel> Clone() const override; |
165 | | |
166 | | DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageModel, ControlModelContainerBase, "com.sun.star.awt.UnoMultiPageModel" ) |
167 | | |
168 | | virtual OUString SAL_CALL getServiceName() override; |
169 | | virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; |
170 | | // XNamedContainer |
171 | | void SAL_CALL insertByName( const OUString& aName, const css::uno::Any& aElement ) override; |
172 | | |
173 | | // Override the method of parent class |
174 | | virtual sal_Bool SAL_CALL getGroupControl( ) override; |
175 | | private: |
176 | | virtual css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; |
177 | | ::cppu::IPropertyArrayHelper& getInfoHelper() override; |
178 | | |
179 | | }; |
180 | | |
181 | | class UnoMultiPageControl final : public ControlContainerBase |
182 | | ,public css::awt::XSimpleTabController |
183 | | ,public css::awt::XTabListener |
184 | | { |
185 | | TabListenerMultiplexer maTabListeners; |
186 | | void bindPage( const css::uno::Reference< css::awt::XControl >& _rxControl ); |
187 | | public: |
188 | | UnoMultiPageControl( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); |
189 | | virtual ~UnoMultiPageControl() override; |
190 | | OUString GetComponentServiceName() const override; |
191 | | |
192 | | // css::lang::XServiceInfo |
193 | | DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageControl, ControlContainerBase, "com.sun.star.awt.UnoControlMultiPage" ) |
194 | 0 | css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return ControlContainerBase::queryInterface(rType); } |
195 | | css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; |
196 | 0 | void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); } |
197 | 0 | void SAL_CALL release() noexcept override { OWeakAggObject::release(); } |
198 | | // css::lang::XTypeProvider |
199 | | css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; |
200 | | css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; |
201 | | void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; |
202 | | // css::awt::XSimpleTabController |
203 | | virtual ::sal_Int32 SAL_CALL insertTab() override; |
204 | | virtual void SAL_CALL removeTab( ::sal_Int32 ID ) override; |
205 | | |
206 | | virtual void SAL_CALL setTabProps( ::sal_Int32 ID, const css::uno::Sequence< css::beans::NamedValue >& Properties ) override; |
207 | | virtual css::uno::Sequence< css::beans::NamedValue > SAL_CALL getTabProps( ::sal_Int32 ID ) override; |
208 | | |
209 | | virtual void SAL_CALL activateTab( ::sal_Int32 ID ) override; |
210 | | virtual ::sal_Int32 SAL_CALL getActiveTabID() override; |
211 | | |
212 | | virtual void SAL_CALL addTabListener( const css::uno::Reference< css::awt::XTabListener >& Listener ) override; |
213 | | virtual void SAL_CALL removeTabListener( const css::uno::Reference< css::awt::XTabListener >& Listener ) override; |
214 | | // XTabListener |
215 | | virtual void SAL_CALL inserted( ::sal_Int32 ID ) override; |
216 | | virtual void SAL_CALL removed( ::sal_Int32 ID ) override; |
217 | | virtual void SAL_CALL changed( ::sal_Int32 ID, const css::uno::Sequence< css::beans::NamedValue >& Properties ) override; |
218 | | virtual void SAL_CALL activated( ::sal_Int32 ID ) override; |
219 | | virtual void SAL_CALL deactivated( ::sal_Int32 ID ) override; |
220 | | virtual void SAL_CALL disposing( const css::lang::EventObject& evt ) override; |
221 | | // XComponent |
222 | | void SAL_CALL dispose( ) override; |
223 | | |
224 | | private: |
225 | | virtual void impl_createControlPeerIfNecessary( |
226 | | const css::uno::Reference< css::awt::XControl >& _rxControl |
227 | | ) override; |
228 | | |
229 | | }; |
230 | | |
231 | | |
232 | | class UnoPageModel final : public ControlModelContainerBase |
233 | | { |
234 | | public: |
235 | | UnoPageModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); |
236 | 0 | UnoPageModel(const UnoPageModel& rOther) : ControlModelContainerBase(rOther) {} |
237 | | virtual ~UnoPageModel() override; |
238 | | |
239 | | rtl::Reference<UnoControlModel> Clone() const override; |
240 | | |
241 | | DECLIMPL_SERVICEINFO_DERIVED( UnoPageModel, ControlModelContainerBase, "com.sun.star.awt.UnoPageModel" ) |
242 | | |
243 | | virtual OUString SAL_CALL getServiceName() override; |
244 | | virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; |
245 | | |
246 | | // Override the method of parent class |
247 | | virtual sal_Bool SAL_CALL getGroupControl( ) override; |
248 | | private: |
249 | | virtual css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; |
250 | | ::cppu::IPropertyArrayHelper& getInfoHelper() override; |
251 | | |
252 | | }; |
253 | | |
254 | | class UnoPageControl final : public ControlContainerBase |
255 | | { |
256 | | public: |
257 | | UnoPageControl( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); |
258 | | virtual ~UnoPageControl() override; |
259 | | OUString GetComponentServiceName() const override; |
260 | | |
261 | | |
262 | | // css::lang::XServiceInfo |
263 | | DECLIMPL_SERVICEINFO_DERIVED( UnoPageControl, ControlContainerBase, "com.sun.star.awt.UnoControlPage" ) |
264 | | }; |
265 | | |
266 | | class UnoFrameModel final : public ControlModelContainerBase |
267 | | { |
268 | | public: |
269 | | UnoFrameModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); |
270 | 0 | UnoFrameModel(const UnoFrameModel& rOther) : ControlModelContainerBase(rOther) {} |
271 | | virtual ~UnoFrameModel() override; |
272 | | |
273 | | rtl::Reference<UnoControlModel> Clone() const override; |
274 | | |
275 | | DECLIMPL_SERVICEINFO_DERIVED( UnoFrameModel, ControlModelContainerBase, "com.sun.star.awt.UnoFrameModel" ) |
276 | | |
277 | | virtual OUString SAL_CALL getServiceName() override; |
278 | | virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; |
279 | | |
280 | | private: |
281 | | virtual css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; |
282 | | ::cppu::IPropertyArrayHelper& getInfoHelper() override; |
283 | | }; |
284 | | |
285 | | class UnoFrameControl final : public ControlContainerBase |
286 | | { |
287 | | virtual void ImplSetPosSize( css::uno::Reference< css::awt::XControl >& rxCtrl ) override; |
288 | | public: |
289 | | UnoFrameControl( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); |
290 | | virtual ~UnoFrameControl() override; |
291 | | OUString GetComponentServiceName() const override; |
292 | | |
293 | | // css::lang::XServiceInfo |
294 | | DECLIMPL_SERVICEINFO_DERIVED( UnoFrameControl, ControlContainerBase, "com.sun.star.awt.UnoControlFrame" ) |
295 | | }; |
296 | | |
297 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |