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 INCLUDED_UNOCONTROLS_INC_BASECONTAINERCONTROL_HXX
21 : #define INCLUDED_UNOCONTROLS_INC_BASECONTAINERCONTROL_HXX
22 :
23 : #include <com/sun/star/lang/XServiceName.hpp>
24 : #include <com/sun/star/lang/XServiceInfo.hpp>
25 : #include <com/sun/star/container/XContainer.hpp>
26 : #include <com/sun/star/container/XIndexContainer.hpp>
27 : #include <com/sun/star/container/XNameReplace.hpp>
28 : #include <com/sun/star/container/XContainerListener.hpp>
29 : #include <com/sun/star/container/XSet.hpp>
30 : #include <com/sun/star/container/ContainerEvent.hpp>
31 : #include <com/sun/star/container/XIndexReplace.hpp>
32 : #include <com/sun/star/container/XNameContainer.hpp>
33 : #include <vector>
34 :
35 : #include "basecontrol.hxx"
36 :
37 : // "namespaces"
38 :
39 : namespace unocontrols{
40 :
41 : // structs, types, forwards
42 :
43 0 : struct IMPL_ControlInfo
44 : {
45 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xControl;
46 : OUString sName;
47 : };
48 :
49 : class BaseContainerControl : public ::com::sun::star::awt::XControlModel
50 : , public ::com::sun::star::awt::XControlContainer
51 : , public BaseControl
52 : {
53 :
54 : // public methods
55 :
56 : public:
57 :
58 : // construct/destruct
59 :
60 : /**_______________________________________________________________________________________________________
61 : */
62 :
63 : BaseContainerControl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
64 :
65 : /**_______________________________________________________________________________________________________
66 : */
67 :
68 : virtual ~BaseContainerControl();
69 :
70 : // XInterface
71 :
72 : /**_______________________________________________________________________________________________________
73 : @short give answer, if interface is supported
74 : @descr The interfaces are searched by type.
75 :
76 : @seealso XInterface
77 :
78 : @param "rType" is the type of searched interface.
79 :
80 : @return Any information about found interface
81 :
82 : @onerror A RuntimeException is thrown.
83 : */
84 :
85 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
86 : const ::com::sun::star::uno::Type& aType
87 : ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
88 :
89 : // XTypeProvider
90 :
91 : /**_______________________________________________________________________________________________________
92 : @short get information about supported interfaces
93 : @seealso XTypeProvider
94 : @return Sequence of types of all supported interfaces
95 :
96 : @onerror A RuntimeException is thrown.
97 : */
98 :
99 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
100 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
101 :
102 : // XAggregation
103 :
104 : /**_______________________________________________________________________________________________________
105 : */
106 :
107 : virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(
108 : const ::com::sun::star::uno::Type& aType
109 : ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
110 :
111 : // XControl
112 :
113 : /**_______________________________________________________________________________________________________
114 : */
115 :
116 : virtual void SAL_CALL createPeer(
117 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& xToolkit ,
118 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent
119 : ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
120 :
121 : /**_______________________________________________________________________________________________________
122 : */
123 :
124 : virtual sal_Bool SAL_CALL setModel(
125 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xModel
126 : ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
127 :
128 : /**_______________________________________________________________________________________________________
129 : */
130 :
131 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel()
132 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
133 :
134 : // XComponent
135 :
136 : /**_______________________________________________________________________________________________________
137 : */
138 :
139 : virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
140 :
141 : // XEventListener
142 :
143 : /**_______________________________________________________________________________________________________
144 : */
145 :
146 : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rEvent ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
147 :
148 : // XControlContainer
149 :
150 : /**_______________________________________________________________________________________________________
151 : */
152 :
153 : virtual void SAL_CALL addControl(
154 : const OUString& sName ,
155 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& xControl
156 : ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
157 :
158 : /**_______________________________________________________________________________________________________
159 : */
160 :
161 : virtual void SAL_CALL removeControl(
162 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& xControl
163 : ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
164 :
165 : /**_______________________________________________________________________________________________________
166 : */
167 :
168 : virtual void SAL_CALL setStatusText(
169 : const OUString& sStatusText
170 : ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
171 :
172 : /**_______________________________________________________________________________________________________
173 : */
174 :
175 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > SAL_CALL getControl(
176 : const OUString& sName
177 : ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
178 :
179 : /**_______________________________________________________________________________________________________
180 : */
181 :
182 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > SAL_CALL getControls()
183 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
184 :
185 : // XWindow
186 :
187 : /**_______________________________________________________________________________________________________
188 : */
189 :
190 : virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
191 :
192 : // protected methods
193 :
194 : protected:
195 : using OComponentHelper::disposing;
196 : /**_______________________________________________________________________________________________________
197 : @short
198 : @descr
199 :
200 : @seealso
201 :
202 : @param
203 :
204 : @return
205 :
206 : @onerror
207 : */
208 :
209 : virtual ::com::sun::star::awt::WindowDescriptor* impl_getWindowDescriptor(
210 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParentPeer
211 : ) SAL_OVERRIDE;
212 :
213 : /**_______________________________________________________________________________________________________
214 : @short
215 : @descr
216 :
217 : @seealso
218 :
219 : @param
220 :
221 : @return
222 :
223 : @onerror
224 : */
225 :
226 : virtual void impl_paint(
227 : sal_Int32 nX ,
228 : sal_Int32 nY ,
229 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics
230 : ) SAL_OVERRIDE;
231 :
232 : // private methods
233 :
234 : private:
235 :
236 : /**_______________________________________________________________________________________________________
237 : @short
238 : @descr
239 :
240 : @seealso
241 :
242 : @param
243 :
244 : @return
245 :
246 : @onerror
247 : */
248 :
249 : void impl_activateTabControllers();
250 :
251 : /**_______________________________________________________________________________________________________
252 : @short
253 : @descr
254 :
255 : @seealso
256 :
257 : @param
258 :
259 : @return
260 :
261 : @onerror
262 : */
263 :
264 : void impl_cleanMemory();
265 :
266 : // private variables
267 :
268 : private:
269 : // list of pointer of "struct IMPL_ControlInfo" to hold child-controls
270 : ::std::vector< IMPL_ControlInfo* > maControlInfoList;
271 :
272 : // list of references of XTabController to hold tab-order in this container
273 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > > m_xTabControllerList;
274 :
275 : ::cppu::OMultiTypeInterfaceContainerHelper m_aListeners;
276 :
277 : }; // class BaseContainerControl
278 :
279 : } // namespace unocontrols
280 :
281 : #endif // INCLUDED_UNOCONTROLS_INC_BASECONTAINERCONTROL_HXX
282 :
283 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|