1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: basecontainercontrol.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX
32 #define _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX
34 //____________________________________________________________________________________________________________
35 // includes of other projects
36 //____________________________________________________________________________________________________________
38 #include <com/sun/star/lang/XServiceName.hpp>
39 #include <com/sun/star/lang/XServiceInfo.hpp>
40 #include <com/sun/star/container/XContainer.hpp>
41 #include <com/sun/star/container/XIndexContainer.hpp>
42 #include <com/sun/star/container/XNameReplace.hpp>
43 #include <com/sun/star/container/XContainerListener.hpp>
44 #include <com/sun/star/container/XSet.hpp>
45 #include <com/sun/star/container/ContainerEvent.hpp>
46 #include <com/sun/star/container/XIndexReplace.hpp>
47 #include <com/sun/star/container/XNameContainer.hpp>
48 #include <tools/list.hxx>
50 //____________________________________________________________________________________________________________
51 // includes of my own project
52 //____________________________________________________________________________________________________________
53 #include "basecontrol.hxx"
55 //____________________________________________________________________________________________________________
57 //____________________________________________________________________________________________________________
59 namespace unocontrols
{
61 #define UNO3_REFERENCE ::com::sun::star::uno::Reference
62 #define UNO3_XCONTROL ::com::sun::star::awt::XControl
63 #define UNO3_OUSTRING ::rtl::OUString
64 #define UNO3_XCONTROLMODEL ::com::sun::star::awt::XControlModel
65 #define UNO3_XCONTROLCONTAINER ::com::sun::star::awt::XControlContainer
66 #define UNO3_XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory
67 #define UNO3_TYPE ::com::sun::star::uno::Type
68 #define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
69 #define UNO3_XTOOLKIT ::com::sun::star::awt::XToolkit
70 #define UNO3_XWINDOWPEER ::com::sun::star::awt::XWindowPeer
71 #define UNO3_EVENTOBJECT ::com::sun::star::lang::EventObject
72 #define UNO3_SEQUENCE ::com::sun::star::uno::Sequence
73 #define UNO3_XCONTAINERLISTENER ::com::sun::star::container::XContainerListener
74 #define UNO3_ANY ::com::sun::star::uno::Any
75 #define UNO3_XTABCONTROLLER ::com::sun::star::awt::XTabController
76 #define UNO3_WINDOWDESCRIPTOR ::com::sun::star::awt::WindowDescriptor
77 #define UNO3_XGRAPHICS ::com::sun::star::awt::XGraphics
78 #define UNO3_OMULTITYPEINTERFACECONTAINERHELPER ::cppu::OMultiTypeInterfaceContainerHelper
79 #define UNO3_ILLEGALARGUMENTEXCEPTION ::com::sun::star::lang::IllegalArgumentException
81 //____________________________________________________________________________________________________________
82 // structs, types, forwards
83 //____________________________________________________________________________________________________________
85 struct IMPL_ControlInfo
87 UNO3_REFERENCE
< UNO3_XCONTROL
> xControl
;
91 // makro define a list-class for struct IMPL_ControlInfo!
92 class IMPL_ControlInfoList
;
93 DECLARE_LIST( IMPL_ControlInfoList
, IMPL_ControlInfo
* )
95 //____________________________________________________________________________________________________________
97 //____________________________________________________________________________________________________________
99 class BaseContainerControl
: public UNO3_XCONTROLMODEL
100 , public UNO3_XCONTROLCONTAINER
104 //____________________________________________________________________________________________________________
106 //____________________________________________________________________________________________________________
110 //________________________________________________________________________________________________________
111 // construct/destruct
112 //________________________________________________________________________________________________________
114 /**_______________________________________________________________________________________________________
127 BaseContainerControl( const UNO3_REFERENCE
< UNO3_XMULTISERVICEFACTORY
>& xFactory
);
129 /**_______________________________________________________________________________________________________
142 virtual ~BaseContainerControl();
144 //________________________________________________________________________________________________________
146 //________________________________________________________________________________________________________
148 /**_______________________________________________________________________________________________________
149 @short give answer, if interface is supported
150 @descr The interfaces are searched by type.
154 @param "rType" is the type of searched interface.
156 @return Any information about found interface
158 @onerror A RuntimeException is thrown.
161 virtual UNO3_ANY SAL_CALL
queryInterface( const UNO3_TYPE
& aType
) throw( UNO3_RUNTIMEEXCEPTION
);
163 //________________________________________________________________________________________________________
165 //________________________________________________________________________________________________________
167 /**_______________________________________________________________________________________________________
168 @short get information about supported interfaces
171 @seealso XTypeProvider
175 @return Sequence of types of all supported interfaces
177 @onerror A RuntimeException is thrown.
180 virtual UNO3_SEQUENCE
< UNO3_TYPE
> SAL_CALL
getTypes() throw( UNO3_RUNTIMEEXCEPTION
);
182 //________________________________________________________________________________________________________
184 //________________________________________________________________________________________________________
186 /**_______________________________________________________________________________________________________
199 virtual UNO3_ANY SAL_CALL
queryAggregation( const UNO3_TYPE
& aType
) throw( UNO3_RUNTIMEEXCEPTION
);
201 //________________________________________________________________________________________________________
203 //________________________________________________________________________________________________________
205 /**_______________________________________________________________________________________________________
218 virtual void SAL_CALL
createPeer( const UNO3_REFERENCE
< UNO3_XTOOLKIT
>& xToolkit
,
219 const UNO3_REFERENCE
< UNO3_XWINDOWPEER
>& xParent
) throw( UNO3_RUNTIMEEXCEPTION
);
221 /**_______________________________________________________________________________________________________
234 virtual sal_Bool SAL_CALL
setModel( const UNO3_REFERENCE
< UNO3_XCONTROLMODEL
>& xModel
) throw( UNO3_RUNTIMEEXCEPTION
);
236 /**_______________________________________________________________________________________________________
249 virtual UNO3_REFERENCE
< UNO3_XCONTROLMODEL
> SAL_CALL
getModel() throw( UNO3_RUNTIMEEXCEPTION
);
251 //________________________________________________________________________________________________________
253 //________________________________________________________________________________________________________
255 /**_______________________________________________________________________________________________________
268 virtual void SAL_CALL
dispose() throw( UNO3_RUNTIMEEXCEPTION
);
270 //________________________________________________________________________________________________________
272 //________________________________________________________________________________________________________
274 /**_______________________________________________________________________________________________________
287 virtual void SAL_CALL
disposing( const UNO3_EVENTOBJECT
& rEvent
) throw( UNO3_RUNTIMEEXCEPTION
);
289 //________________________________________________________________________________________________________
291 //________________________________________________________________________________________________________
293 /**_______________________________________________________________________________________________________
306 virtual void SAL_CALL
addControl( const UNO3_OUSTRING
& sName
,
307 const UNO3_REFERENCE
< UNO3_XCONTROL
>& xControl
) throw( UNO3_RUNTIMEEXCEPTION
);
309 /**_______________________________________________________________________________________________________
322 virtual void SAL_CALL
addContainerListener( const UNO3_REFERENCE
< UNO3_XCONTAINERLISTENER
>& xListener
) throw( UNO3_RUNTIMEEXCEPTION
);
324 /**_______________________________________________________________________________________________________
337 virtual void SAL_CALL
removeControl( const UNO3_REFERENCE
< UNO3_XCONTROL
>& xControl
) throw( UNO3_RUNTIMEEXCEPTION
);
339 /**_______________________________________________________________________________________________________
352 virtual void SAL_CALL
removeContainerListener( const UNO3_REFERENCE
< UNO3_XCONTAINERLISTENER
>& xListener
) throw( UNO3_RUNTIMEEXCEPTION
);
354 /**_______________________________________________________________________________________________________
367 virtual void SAL_CALL
setStatusText( const UNO3_OUSTRING
& sStatusText
) throw( UNO3_RUNTIMEEXCEPTION
);
369 /**_______________________________________________________________________________________________________
382 virtual UNO3_REFERENCE
< UNO3_XCONTROL
> SAL_CALL
getControl( const UNO3_OUSTRING
& sName
) throw( UNO3_RUNTIMEEXCEPTION
);
384 /**_______________________________________________________________________________________________________
397 virtual UNO3_SEQUENCE
< UNO3_REFERENCE
< UNO3_XCONTROL
> > SAL_CALL
getControls() throw( UNO3_RUNTIMEEXCEPTION
);
399 //________________________________________________________________________________________________________
400 // XUnoControlContainer
401 //________________________________________________________________________________________________________
403 /**_______________________________________________________________________________________________________
416 virtual void SAL_CALL
addTabController( const UNO3_REFERENCE
< UNO3_XTABCONTROLLER
>& xTabController
) throw( UNO3_RUNTIMEEXCEPTION
);
418 /**_______________________________________________________________________________________________________
431 virtual void SAL_CALL
removeTabController( const UNO3_REFERENCE
< UNO3_XTABCONTROLLER
>& xTabController
) throw( UNO3_RUNTIMEEXCEPTION
);
433 /**_______________________________________________________________________________________________________
446 virtual void SAL_CALL
setTabControllers( const UNO3_SEQUENCE
< UNO3_REFERENCE
< UNO3_XTABCONTROLLER
> >& xTabControllers
) throw( UNO3_RUNTIMEEXCEPTION
);
448 /**_______________________________________________________________________________________________________
461 virtual UNO3_SEQUENCE
< UNO3_REFERENCE
< UNO3_XTABCONTROLLER
> > SAL_CALL
getTabControllers() throw( UNO3_RUNTIMEEXCEPTION
);
463 //________________________________________________________________________________________________________
465 //________________________________________________________________________________________________________
467 /**_______________________________________________________________________________________________________
480 virtual void SAL_CALL
setVisible( sal_Bool bVisible
) throw( UNO3_RUNTIMEEXCEPTION
);
482 //____________________________________________________________________________________________________________
484 //____________________________________________________________________________________________________________
487 using OComponentHelper::disposing
;
488 /**_______________________________________________________________________________________________________
501 virtual UNO3_WINDOWDESCRIPTOR
* impl_getWindowDescriptor( const UNO3_REFERENCE
< UNO3_XWINDOWPEER
>& xParentPeer
);
503 /**_______________________________________________________________________________________________________
516 virtual void impl_paint( sal_Int32 nX
,
518 const UNO3_REFERENCE
< UNO3_XGRAPHICS
>& xGraphics
);
520 //____________________________________________________________________________________________________________
522 //____________________________________________________________________________________________________________
526 /**_______________________________________________________________________________________________________
539 void impl_activateTabControllers();
541 /**_______________________________________________________________________________________________________
554 void impl_cleanMemory();
556 //____________________________________________________________________________________________________________
558 //____________________________________________________________________________________________________________
562 IMPL_ControlInfoList
* m_pControlInfoList
; /// list of pointer of "struct IMPL_ControlInfo" to hold child-controls
563 UNO3_SEQUENCE
< UNO3_REFERENCE
< UNO3_XTABCONTROLLER
> > m_xTabControllerList
; /// list of references of XTabController to hold tab-order in this container
564 UNO3_OMULTITYPEINTERFACECONTAINERHELPER m_aListeners
;
566 }; // class BaseContainerControl
568 } // namespace unocontrols
570 #endif // ifndef _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX