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 _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX
21 : #define _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_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 : //____________________________________________________________________________________________________________
38 : // "namespaces"
39 : //____________________________________________________________________________________________________________
40 :
41 : namespace unocontrols{
42 :
43 : //____________________________________________________________________________________________________________
44 : // structs, types, forwards
45 : //____________________________________________________________________________________________________________
46 :
47 0 : struct IMPL_ControlInfo
48 : {
49 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xControl ;
50 : OUString sName ;
51 : };
52 :
53 : class BaseContainerControl : public ::com::sun::star::awt::XControlModel
54 : , public ::com::sun::star::awt::XControlContainer
55 : , public BaseControl
56 : {
57 :
58 : //____________________________________________________________________________________________________________
59 : // public methods
60 : //____________________________________________________________________________________________________________
61 :
62 : public:
63 :
64 : //________________________________________________________________________________________________________
65 : // construct/destruct
66 : //________________________________________________________________________________________________________
67 :
68 : /**_______________________________________________________________________________________________________
69 : @short -
70 : @descr -
71 :
72 : @seealso -
73 :
74 : @param -
75 :
76 : @return -
77 :
78 : @onerror -
79 : */
80 :
81 : BaseContainerControl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
82 :
83 : /**_______________________________________________________________________________________________________
84 : @short -
85 : @descr -
86 :
87 : @seealso -
88 :
89 : @param -
90 :
91 : @return -
92 :
93 : @onerror -
94 : */
95 :
96 : virtual ~BaseContainerControl();
97 :
98 : //________________________________________________________________________________________________________
99 : // XInterface
100 : //________________________________________________________________________________________________________
101 :
102 : /**_______________________________________________________________________________________________________
103 : @short give answer, if interface is supported
104 : @descr The interfaces are searched by type.
105 :
106 : @seealso XInterface
107 :
108 : @param "rType" is the type of searched interface.
109 :
110 : @return Any information about found interface
111 :
112 : @onerror A RuntimeException is thrown.
113 : */
114 :
115 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
116 : const ::com::sun::star::uno::Type& aType
117 : ) throw( ::com::sun::star::uno::RuntimeException );
118 :
119 : //________________________________________________________________________________________________________
120 : // XTypeProvider
121 : //________________________________________________________________________________________________________
122 :
123 : /**_______________________________________________________________________________________________________
124 : @short get information about supported interfaces
125 : @descr -
126 :
127 : @seealso XTypeProvider
128 :
129 : @param -
130 :
131 : @return Sequence of types of all supported interfaces
132 :
133 : @onerror A RuntimeException is thrown.
134 : */
135 :
136 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
137 : throw( ::com::sun::star::uno::RuntimeException );
138 :
139 : //________________________________________________________________________________________________________
140 : // XAggregation
141 : //________________________________________________________________________________________________________
142 :
143 : /**_______________________________________________________________________________________________________
144 : @short -
145 : @descr -
146 :
147 : @seealso -
148 :
149 : @param -
150 :
151 : @return -
152 :
153 : @onerror -
154 : */
155 :
156 : virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(
157 : const ::com::sun::star::uno::Type& aType
158 : ) throw( ::com::sun::star::uno::RuntimeException );
159 :
160 : //________________________________________________________________________________________________________
161 : // XControl
162 : //________________________________________________________________________________________________________
163 :
164 : /**_______________________________________________________________________________________________________
165 : @short -
166 : @descr -
167 :
168 : @seealso -
169 :
170 : @param -
171 :
172 : @return -
173 :
174 : @onerror -
175 : */
176 :
177 : virtual void SAL_CALL createPeer(
178 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& xToolkit ,
179 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent
180 : ) throw( ::com::sun::star::uno::RuntimeException );
181 :
182 : /**_______________________________________________________________________________________________________
183 : @short -
184 : @descr -
185 :
186 : @seealso -
187 :
188 : @param -
189 :
190 : @return -
191 :
192 : @onerror -
193 : */
194 :
195 : virtual sal_Bool SAL_CALL setModel(
196 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xModel
197 : ) throw( ::com::sun::star::uno::RuntimeException );
198 :
199 : /**_______________________________________________________________________________________________________
200 : @short -
201 : @descr -
202 :
203 : @seealso -
204 :
205 : @param -
206 :
207 : @return -
208 :
209 : @onerror -
210 : */
211 :
212 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel()
213 : throw( ::com::sun::star::uno::RuntimeException );
214 :
215 : //________________________________________________________________________________________________________
216 : // XComponent
217 : //________________________________________________________________________________________________________
218 :
219 : /**_______________________________________________________________________________________________________
220 : @short -
221 : @descr -
222 :
223 : @seealso -
224 :
225 : @param -
226 :
227 : @return -
228 :
229 : @onerror -
230 : */
231 :
232 : virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
233 :
234 : //________________________________________________________________________________________________________
235 : // XEventListener
236 : //________________________________________________________________________________________________________
237 :
238 : /**_______________________________________________________________________________________________________
239 : @short -
240 : @descr -
241 :
242 : @seealso -
243 :
244 : @param -
245 :
246 : @return -
247 :
248 : @onerror -
249 : */
250 :
251 : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rEvent ) throw( ::com::sun::star::uno::RuntimeException );
252 :
253 : //________________________________________________________________________________________________________
254 : // XControlContainer
255 : //________________________________________________________________________________________________________
256 :
257 : /**_______________________________________________________________________________________________________
258 : @short -
259 : @descr -
260 :
261 : @seealso -
262 :
263 : @param -
264 :
265 : @return -
266 :
267 : @onerror -
268 : */
269 :
270 : virtual void SAL_CALL addControl(
271 : const OUString& sName ,
272 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& xControl
273 : ) throw( ::com::sun::star::uno::RuntimeException );
274 :
275 : /**_______________________________________________________________________________________________________
276 : @short -
277 : @descr -
278 :
279 : @seealso -
280 :
281 : @param -
282 :
283 : @return -
284 :
285 : @onerror -
286 : */
287 :
288 : virtual void SAL_CALL addContainerListener(
289 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener
290 : ) throw( ::com::sun::star::uno::RuntimeException );
291 :
292 : /**_______________________________________________________________________________________________________
293 : @short -
294 : @descr -
295 :
296 : @seealso -
297 :
298 : @param -
299 :
300 : @return -
301 :
302 : @onerror -
303 : */
304 :
305 : virtual void SAL_CALL removeControl(
306 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& xControl
307 : ) throw( ::com::sun::star::uno::RuntimeException );
308 :
309 : /**_______________________________________________________________________________________________________
310 : @short -
311 : @descr -
312 :
313 : @seealso -
314 :
315 : @param -
316 :
317 : @return -
318 :
319 : @onerror -
320 : */
321 :
322 : virtual void SAL_CALL removeContainerListener(
323 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener
324 : ) throw( ::com::sun::star::uno::RuntimeException );
325 :
326 : /**_______________________________________________________________________________________________________
327 : @short -
328 : @descr -
329 :
330 : @seealso -
331 :
332 : @param -
333 :
334 : @return -
335 :
336 : @onerror -
337 : */
338 :
339 : virtual void SAL_CALL setStatusText(
340 : const OUString& sStatusText
341 : ) throw( ::com::sun::star::uno::RuntimeException );
342 :
343 : /**_______________________________________________________________________________________________________
344 : @short -
345 : @descr -
346 :
347 : @seealso -
348 :
349 : @param -
350 :
351 : @return -
352 :
353 : @onerror -
354 : */
355 :
356 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > SAL_CALL getControl(
357 : const OUString& sName
358 : ) throw( ::com::sun::star::uno::RuntimeException );
359 :
360 : /**_______________________________________________________________________________________________________
361 : @short -
362 : @descr -
363 :
364 : @seealso -
365 :
366 : @param -
367 :
368 : @return -
369 :
370 : @onerror -
371 : */
372 :
373 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > SAL_CALL getControls()
374 : throw( ::com::sun::star::uno::RuntimeException );
375 :
376 : //________________________________________________________________________________________________________
377 : // XUnoControlContainer
378 : //________________________________________________________________________________________________________
379 :
380 : /**_______________________________________________________________________________________________________
381 : @short -
382 : @descr -
383 :
384 : @seealso -
385 :
386 : @param -
387 :
388 : @return -
389 :
390 : @onerror -
391 : */
392 :
393 : virtual void SAL_CALL addTabController(
394 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController >& xTabController
395 : ) throw( ::com::sun::star::uno::RuntimeException );
396 :
397 : /**_______________________________________________________________________________________________________
398 : @short -
399 : @descr -
400 :
401 : @seealso -
402 :
403 : @param -
404 :
405 : @return -
406 :
407 : @onerror -
408 : */
409 :
410 : virtual void SAL_CALL removeTabController(
411 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController >& xTabController
412 : ) throw( ::com::sun::star::uno::RuntimeException );
413 :
414 : /**_______________________________________________________________________________________________________
415 : @short -
416 : @descr -
417 :
418 : @seealso -
419 :
420 : @param -
421 :
422 : @return -
423 :
424 : @onerror -
425 : */
426 :
427 : virtual void SAL_CALL setTabControllers(
428 : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > >& xTabControllers
429 : ) throw( ::com::sun::star::uno::RuntimeException );
430 :
431 : /**_______________________________________________________________________________________________________
432 : @short -
433 : @descr -
434 :
435 : @seealso -
436 :
437 : @param -
438 :
439 : @return -
440 :
441 : @onerror -
442 : */
443 :
444 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > > SAL_CALL getTabControllers()
445 : throw( ::com::sun::star::uno::RuntimeException );
446 :
447 : //________________________________________________________________________________________________________
448 : // XWindow
449 : //________________________________________________________________________________________________________
450 :
451 : /**_______________________________________________________________________________________________________
452 : @short -
453 : @descr -
454 :
455 : @seealso -
456 :
457 : @param -
458 :
459 : @return -
460 :
461 : @onerror -
462 : */
463 :
464 : virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw( ::com::sun::star::uno::RuntimeException );
465 :
466 : //____________________________________________________________________________________________________________
467 : // protected methods
468 : //____________________________________________________________________________________________________________
469 :
470 : protected:
471 : using OComponentHelper::disposing;
472 : /**_______________________________________________________________________________________________________
473 : @short
474 : @descr
475 :
476 : @seealso
477 :
478 : @param
479 :
480 : @return
481 :
482 : @onerror
483 : */
484 :
485 : virtual ::com::sun::star::awt::WindowDescriptor* impl_getWindowDescriptor(
486 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParentPeer
487 : );
488 :
489 : /**_______________________________________________________________________________________________________
490 : @short
491 : @descr
492 :
493 : @seealso
494 :
495 : @param
496 :
497 : @return
498 :
499 : @onerror
500 : */
501 :
502 : virtual void impl_paint(
503 : sal_Int32 nX ,
504 : sal_Int32 nY ,
505 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics
506 : );
507 :
508 : //____________________________________________________________________________________________________________
509 : // private methods
510 : //____________________________________________________________________________________________________________
511 :
512 : private:
513 :
514 : /**_______________________________________________________________________________________________________
515 : @short
516 : @descr
517 :
518 : @seealso
519 :
520 : @param
521 :
522 : @return
523 :
524 : @onerror
525 : */
526 :
527 : void impl_activateTabControllers();
528 :
529 : /**_______________________________________________________________________________________________________
530 : @short
531 : @descr
532 :
533 : @seealso
534 :
535 : @param
536 :
537 : @return
538 :
539 : @onerror
540 : */
541 :
542 : void impl_cleanMemory();
543 :
544 : //____________________________________________________________________________________________________________
545 : // private variables
546 : //____________________________________________________________________________________________________________
547 :
548 : private:
549 : // list of pointer of "struct IMPL_ControlInfo" to hold child-controls
550 : ::std::vector< IMPL_ControlInfo* > maControlInfoList;
551 :
552 : // list of references of XTabController to hold tab-order in this container
553 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > > m_xTabControllerList ;
554 :
555 : ::cppu::OMultiTypeInterfaceContainerHelper m_aListeners ;
556 :
557 : }; // class BaseContainerControl
558 :
559 : } // namespace unocontrols
560 :
561 : #endif // ifndef _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX
562 :
563 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|