1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLCONTAINER_HXX
21 #define INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLCONTAINER_HXX
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>
29 #include <toolkit/controls/unocontrol.hxx>
30 #include <toolkit/controls/unocontrolbase.hxx>
31 #include <toolkit/helper/macros.hxx>
32 #include <toolkit/helper/servicenames.hxx>
34 #include <cppuhelper/implbase4.hxx>
36 class UnoControlHolderList
;
39 // class UnoControlContainer
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
;
48 class UnoControlContainer
: public UnoControlContainer_Base
51 UnoControlHolderList
* mpControls
;
52 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTabController
> > maTabControllers
;
53 ContainerListenerMultiplexer maCListeners
;
56 void ImplActivateTabControllers();
59 UnoControlContainer();
60 UnoControlContainer( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& xPeer
);
61 virtual ~UnoControlContainer();
64 // ::com::sun::star::lang::XComponent
65 void SAL_CALL
dispose() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
67 // ::com::sun::star::lang::XEventListener
68 void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
70 // ::com::sun::star::container::XContainer
71 void SAL_CALL
addContainerListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XContainerListener
>& xListener
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
72 void SAL_CALL
removeContainerListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XContainerListener
>& xListener
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
74 // ::com::sun::star::container::XIdentifierContainer
75 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
, std::exception
) SAL_OVERRIDE
;
77 // ::com::sun::star::container::XIdentifierReplace
78 virtual void SAL_CALL
removeByIdentifier( ::sal_Int32 Identifier
) throw (::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
79 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
, std::exception
) SAL_OVERRIDE
;
81 // ::com::sun::star::container::XIdentifierAccess
82 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
, std::exception
) SAL_OVERRIDE
;
83 virtual ::com::sun::star::uno::Sequence
< ::sal_Int32
> SAL_CALL
getIdentifiers( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
85 // ::com::sun::star::container::XElementAccess
86 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
87 virtual sal_Bool SAL_CALL
hasElements( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
89 // ::com::sun::star::awt::XControlContainer
90 void SAL_CALL
setStatusText( const OUString
& StatusText
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
91 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControl
> > SAL_CALL
getControls( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
92 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControl
> SAL_CALL
getControl( const OUString
& aName
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
93 void SAL_CALL
addControl( const OUString
& Name
, const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControl
>& Control
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
94 void SAL_CALL
removeControl( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControl
>& Control
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
96 // ::com::sun::star::awt::XUnoControlContainer
97 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
, std::exception
) SAL_OVERRIDE
;
98 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTabController
> > SAL_CALL
getTabControllers( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
99 void SAL_CALL
addTabController( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTabController
>& TabController
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
100 void SAL_CALL
removeTabController( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTabController
>& TabController
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
102 // ::com::sun::star::awt::XControl
103 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
, std::exception
) SAL_OVERRIDE
;
105 // ::com::sun::star::awt::XWindow
106 void SAL_CALL
setVisible( sal_Bool Visible
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
108 OUString SAL_CALL
getImplementationName()
109 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
111 css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames()
112 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
115 virtual void PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor
& rDesc
) SAL_OVERRIDE
;
116 virtual void removingControl( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControl
>& _rxControl
);
117 virtual void addingControl( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControl
>& _rxControl
);
119 /** ensures that the given control has a peer, if necessary and possible
121 an ->XControl which has just been inserted into the container. Must not be <NULL/>.
125 virtual void impl_createControlPeerIfNecessary(
126 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControl
>& _rxControl
129 /** adds the control to the container, does necessary notifications, and the like
131 the control to add. Must not be <NULL/>
133 Pointer to a name for the control. Might be <NULL/>, in this case an auotmatic name is generated
135 the ID of the newly added control
137 sal_Int32
impl_addControl(
138 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControl
>& _rxControl
,
139 const OUString
* _pName
= NULL
142 /** removes the given control from the container, including necessary notifications and the like
144 the ID of the control to remove
146 the control itself. Must be the one which is stored under the given ID. This parameter could also be
147 obtained inside the method, but callers usually have obtained it, anyway.
148 @param _pNameAccessor
149 the name which the control was registered for. Might be <NULL/>, in this case
150 container event broadcasts use the ID as accessor.
152 void impl_removeControl(
154 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControl
>& _rxControl
,
155 const OUString
* _pNameAccessor
162 #endif // INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLCONTAINER_HXX
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */