Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _TOOLKIT_CONTROLS_UNOCONTROLCONTAINER_HXX_
30 : : #define _TOOLKIT_CONTROLS_UNOCONTROLCONTAINER_HXX_
31 : :
32 : :
33 : : #include <com/sun/star/awt/XControlContainer.hpp>
34 : : #include <com/sun/star/awt/XUnoControlContainer.hpp>
35 : : #include <com/sun/star/container/XContainer.hpp>
36 : : #include <com/sun/star/container/XIdentifierContainer.hpp>
37 : :
38 : : #include <toolkit/controls/unocontrol.hxx>
39 : : #include <toolkit/controls/unocontrolbase.hxx>
40 : : #include <toolkit/helper/macros.hxx>
41 : : #include <toolkit/helper/servicenames.hxx>
42 : :
43 : : #include <cppuhelper/implbase4.hxx>
44 : :
45 : : class UnoControlHolderList;
46 : :
47 : : // ----------------------------------------------------
48 : : // class UnoControlContainer
49 : : // ----------------------------------------------------
50 : : typedef ::cppu::AggImplInheritanceHelper4 < UnoControlBase
51 : : , ::com::sun::star::awt::XUnoControlContainer
52 : : , ::com::sun::star::awt::XControlContainer
53 : : , ::com::sun::star::container::XContainer
54 : : , ::com::sun::star::container::XIdentifierContainer
55 : : > UnoControlContainer_Base;
56 : :
57 : : class UnoControlContainer : public UnoControlContainer_Base
58 : : {
59 : : private:
60 : : UnoControlHolderList* mpControls;
61 : : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > > maTabControllers;
62 : : ContainerListenerMultiplexer maCListeners;
63 : :
64 : : protected:
65 : : void ImplActivateTabControllers();
66 : :
67 : : public:
68 : : UnoControlContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
69 : : UnoControlContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory,
70 : : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xPeer );
71 : : ~UnoControlContainer();
72 : :
73 : :
74 : : // ::com::sun::star::lang::XComponent
75 : : void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
76 : :
77 : : // ::com::sun::star::lang::XEventListener
78 : : void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
79 : :
80 : : // ::com::sun::star::container::XContainer
81 : : void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
82 : : void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
83 : :
84 : : // ::com::sun::star::container::XIdentifierContainer
85 : : virtual ::sal_Int32 SAL_CALL insert( const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
86 : :
87 : : // ::com::sun::star::container::XIdentifierReplace
88 : : virtual void SAL_CALL removeByIdentifier( ::sal_Int32 Identifier ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
89 : : virtual void SAL_CALL replaceByIdentifer( ::sal_Int32 Identifier, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
90 : :
91 : : // ::com::sun::star::container::XIdentifierAccess
92 : : virtual ::com::sun::star::uno::Any SAL_CALL getByIdentifier( ::sal_Int32 Identifierr ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
93 : : virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getIdentifiers( ) throw (::com::sun::star::uno::RuntimeException);
94 : :
95 : : // ::com::sun::star::container::XElementAccess
96 : : virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException);
97 : : virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException);
98 : :
99 : : // ::com::sun::star::awt::XControlContainer
100 : : void SAL_CALL setStatusText( const ::rtl::OUString& StatusText ) throw(::com::sun::star::uno::RuntimeException);
101 : : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > SAL_CALL getControls( ) throw(::com::sun::star::uno::RuntimeException);
102 : : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > SAL_CALL getControl( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
103 : : void SAL_CALL addControl( const ::rtl::OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& Control ) throw(::com::sun::star::uno::RuntimeException);
104 : : void SAL_CALL removeControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& Control ) throw(::com::sun::star::uno::RuntimeException);
105 : :
106 : : // ::com::sun::star::awt::XUnoControlContainer
107 : : void SAL_CALL setTabControllers( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > >& TabControllers ) throw(::com::sun::star::uno::RuntimeException);
108 : : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > > SAL_CALL getTabControllers( ) throw(::com::sun::star::uno::RuntimeException);
109 : : void SAL_CALL addTabController( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController >& TabController ) throw(::com::sun::star::uno::RuntimeException);
110 : : void SAL_CALL removeTabController( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController >& TabController ) throw(::com::sun::star::uno::RuntimeException);
111 : :
112 : : // ::com::sun::star::awt::XControl
113 : : void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
114 : :
115 : : // ::com::sun::star::awt::XWindow
116 : : void SAL_CALL setVisible( sal_Bool Visible ) throw(::com::sun::star::uno::RuntimeException);
117 : :
118 [ # # ][ # # ]: 2 : DECLIMPL_SERVICEINFO_DERIVED( UnoControlContainer, UnoControlBase, szServiceName2_UnoControlContainer )
119 : :
120 : : protected:
121 : : virtual void removingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
122 : : virtual void addingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
123 : :
124 : : /** ensures that the given control has a peer, if necessary and possible
125 : : @param _rxControl
126 : : an ->XControl which has just been inserted into the container. Must not be <NULL/>.
127 : : @precond
128 : : our mutex is locked
129 : : */
130 : : virtual void impl_createControlPeerIfNecessary(
131 : : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl
132 : : );
133 : : private:
134 : : /** adds the control to the container, does necessary notifications, and the like
135 : : @param _rxControl
136 : : the control to add. Must not be <NULL/>
137 : : @param _pName
138 : : Pointer to a name for the control. Might be <NULL/>, in this case an auotmatic name is generated
139 : : @return
140 : : the ID of the newly added control
141 : : */
142 : : sal_Int32 impl_addControl(
143 : : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl,
144 : : const ::rtl::OUString* _pName = NULL
145 : : );
146 : :
147 : : /** removes the given control from the container, including necessary notifications and the like
148 : : @param _nId
149 : : the ID of the control to remove
150 : : @param _rxControl
151 : : the control itself. Must be the one which is stored under the given ID. This parameter could also be
152 : : obtained inside the method, but callers usually have obtained it, anyway.
153 : : @param _pNameAccessor
154 : : the name which the control was registered for. Might be <NULL/>, in this case
155 : : container event broadcasts use the ID as accessor.
156 : : */
157 : : void impl_removeControl(
158 : : sal_Int32 _nId,
159 : : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl,
160 : : const ::rtl::OUString* _pNameAccessor
161 : : );
162 : :
163 : : };
164 : :
165 : :
166 : :
167 : : #endif // _TOOLKIT_CONTROLS_UNOCONTROLCONTAINER_HXX_
168 : :
169 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|