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 _TOOLKIT_CONTROLS_UNOCONTROLCONTAINER_HXX_
21 : #define _TOOLKIT_CONTROLS_UNOCONTROLCONTAINER_HXX_
22 :
23 :
24 : #include <com/sun/star/awt/XControlContainer.hpp>
25 : #include <com/sun/star/awt/XUnoControlContainer.hpp>
26 : #include <com/sun/star/container/XContainer.hpp>
27 : #include <com/sun/star/container/XIdentifierContainer.hpp>
28 :
29 : #include <toolkit/controls/unocontrol.hxx>
30 : #include <toolkit/controls/unocontrolbase.hxx>
31 : #include <toolkit/helper/macros.hxx>
32 : #include <toolkit/helper/servicenames.hxx>
33 :
34 : #include <cppuhelper/implbase4.hxx>
35 :
36 : class UnoControlHolderList;
37 :
38 : // ----------------------------------------------------
39 : // class UnoControlContainer
40 : // ----------------------------------------------------
41 : typedef ::cppu::AggImplInheritanceHelper4 < UnoControlBase
42 : , ::com::sun::star::awt::XUnoControlContainer
43 : , ::com::sun::star::awt::XControlContainer
44 : , ::com::sun::star::container::XContainer
45 : , ::com::sun::star::container::XIdentifierContainer
46 : > UnoControlContainer_Base;
47 :
48 : class UnoControlContainer : public UnoControlContainer_Base
49 : {
50 : private:
51 : UnoControlHolderList* mpControls;
52 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > > maTabControllers;
53 : ContainerListenerMultiplexer maCListeners;
54 :
55 : protected:
56 : void ImplActivateTabControllers();
57 :
58 : public:
59 : UnoControlContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
60 : UnoControlContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory,
61 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xPeer );
62 : ~UnoControlContainer();
63 :
64 :
65 : // ::com::sun::star::lang::XComponent
66 : void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
67 :
68 : // ::com::sun::star::lang::XEventListener
69 : void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
70 :
71 : // ::com::sun::star::container::XContainer
72 : void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
73 : void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
74 :
75 : // ::com::sun::star::container::XIdentifierContainer
76 : 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);
77 :
78 : // ::com::sun::star::container::XIdentifierReplace
79 : virtual void SAL_CALL removeByIdentifier( ::sal_Int32 Identifier ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
80 : 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);
81 :
82 : // ::com::sun::star::container::XIdentifierAccess
83 : 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);
84 : virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getIdentifiers( ) throw (::com::sun::star::uno::RuntimeException);
85 :
86 : // ::com::sun::star::container::XElementAccess
87 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException);
88 : virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException);
89 :
90 : // ::com::sun::star::awt::XControlContainer
91 : void SAL_CALL setStatusText( const ::rtl::OUString& StatusText ) throw(::com::sun::star::uno::RuntimeException);
92 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > SAL_CALL getControls( ) throw(::com::sun::star::uno::RuntimeException);
93 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > SAL_CALL getControl( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
94 : 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);
95 : void SAL_CALL removeControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& Control ) throw(::com::sun::star::uno::RuntimeException);
96 :
97 : // ::com::sun::star::awt::XUnoControlContainer
98 : 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);
99 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > > SAL_CALL getTabControllers( ) throw(::com::sun::star::uno::RuntimeException);
100 : void SAL_CALL addTabController( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController >& TabController ) throw(::com::sun::star::uno::RuntimeException);
101 : void SAL_CALL removeTabController( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController >& TabController ) throw(::com::sun::star::uno::RuntimeException);
102 :
103 : // ::com::sun::star::awt::XControl
104 : 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);
105 :
106 : // ::com::sun::star::awt::XWindow
107 : void SAL_CALL setVisible( sal_Bool Visible ) throw(::com::sun::star::uno::RuntimeException);
108 :
109 0 : DECLIMPL_SERVICEINFO_DERIVED( UnoControlContainer, UnoControlBase, szServiceName2_UnoControlContainer )
110 :
111 : protected:
112 : virtual void PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc );
113 : virtual void removingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
114 : virtual void addingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
115 :
116 : /** ensures that the given control has a peer, if necessary and possible
117 : @param _rxControl
118 : an ->XControl which has just been inserted into the container. Must not be <NULL/>.
119 : @precond
120 : our mutex is locked
121 : */
122 : virtual void impl_createControlPeerIfNecessary(
123 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl
124 : );
125 : private:
126 : /** adds the control to the container, does necessary notifications, and the like
127 : @param _rxControl
128 : the control to add. Must not be <NULL/>
129 : @param _pName
130 : Pointer to a name for the control. Might be <NULL/>, in this case an auotmatic name is generated
131 : @return
132 : the ID of the newly added control
133 : */
134 : sal_Int32 impl_addControl(
135 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl,
136 : const ::rtl::OUString* _pName = NULL
137 : );
138 :
139 : /** removes the given control from the container, including necessary notifications and the like
140 : @param _nId
141 : the ID of the control to remove
142 : @param _rxControl
143 : the control itself. Must be the one which is stored under the given ID. This parameter could also be
144 : obtained inside the method, but callers usually have obtained it, anyway.
145 : @param _pNameAccessor
146 : the name which the control was registered for. Might be <NULL/>, in this case
147 : container event broadcasts use the ID as accessor.
148 : */
149 : void impl_removeControl(
150 : sal_Int32 _nId,
151 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl,
152 : const ::rtl::OUString* _pNameAccessor
153 : );
154 :
155 : };
156 :
157 :
158 :
159 : #endif // _TOOLKIT_CONTROLS_UNOCONTROLCONTAINER_HXX_
160 :
161 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|