1*50e6b072SAndrew Rist /**************************************************************
2*50e6b072SAndrew Rist  *
3*50e6b072SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*50e6b072SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*50e6b072SAndrew Rist  * distributed with this work for additional information
6*50e6b072SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*50e6b072SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*50e6b072SAndrew Rist  * "License"); you may not use this file except in compliance
9*50e6b072SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*50e6b072SAndrew Rist  *
11*50e6b072SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*50e6b072SAndrew Rist  *
13*50e6b072SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*50e6b072SAndrew Rist  * software distributed under the License is distributed on an
15*50e6b072SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*50e6b072SAndrew Rist  * KIND, either express or implied.  See the License for the
17*50e6b072SAndrew Rist  * specific language governing permissions and limitations
18*50e6b072SAndrew Rist  * under the License.
19*50e6b072SAndrew Rist  *
20*50e6b072SAndrew Rist  *************************************************************/
21*50e6b072SAndrew Rist 
22*50e6b072SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef TOOLKIT_TABPAGE_CONTAINER_HXX
25cdf0e10cSrcweir #define TOOLKIT_TABPAGE_CONTAINER_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/awt/tab/XTabPageContainer.hpp>
28cdf0e10cSrcweir #include <com/sun/star/awt/tab/XTabPageContainerModel.hpp>
29cdf0e10cSrcweir #include <com/sun/star/awt/tab/XTabPageContainerListener.hpp>
30cdf0e10cSrcweir #include <com/sun/star/awt/tab/XTabPage.hpp>
31cdf0e10cSrcweir #include <com/sun/star/awt/tab/XTabPageModel.hpp>
32cdf0e10cSrcweir #include <toolkit/controls/unocontrolbase.hxx>
33cdf0e10cSrcweir #include <toolkit/controls/unocontrolmodel.hxx>
34cdf0e10cSrcweir #include <toolkit/helper/servicenames.hxx>
35cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
36cdf0e10cSrcweir #include <comphelper/sequence.hxx>
37cdf0e10cSrcweir #include <toolkit/controls/controlmodelcontainerbase.hxx>
38cdf0e10cSrcweir #include <toolkit/controls/unocontrolmodel.hxx>
39cdf0e10cSrcweir #include <toolkit/helper/listenermultiplexer.hxx>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir using namespace ::com::sun::star::uno;
42cdf0e10cSrcweir //using namespace ::com::sun::star::awt;
43cdf0e10cSrcweir using namespace ::com::sun::star::lang;
44cdf0e10cSrcweir using namespace ::com::sun::star::beans;
45cdf0e10cSrcweir using namespace ::com::sun::star::container;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir //	------------------------------------------------------------------
48cdf0e10cSrcweir //	class ::com::sun::star::awt::tab::UnoControlTabPageContainerModel
49cdf0e10cSrcweir //	------------------------------------------------------------------
50cdf0e10cSrcweir typedef ::cppu::AggImplInheritanceHelper1   <   UnoControlModel
51cdf0e10cSrcweir                                             ,   ::com::sun::star::awt::tab::XTabPageContainerModel
52cdf0e10cSrcweir                                             >   UnoControlTabPageContainerModel_Base;
53cdf0e10cSrcweir class UnoControlTabPageContainerModel : public UnoControlTabPageContainerModel_Base
54cdf0e10cSrcweir {
55cdf0e10cSrcweir private:
56cdf0e10cSrcweir 	std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageModel > > m_aTabPageVector;
57cdf0e10cSrcweir     ContainerListenerMultiplexer		maContainerListeners;
58cdf0e10cSrcweir protected:
59cdf0e10cSrcweir 	::com::sun::star::uno::Any 		ImplGetDefaultValue( sal_uInt16 nPropId ) const;
60cdf0e10cSrcweir 	::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
61cdf0e10cSrcweir 	// ::com::sun::star::beans::XMultiPropertySet
62cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
63cdf0e10cSrcweir 
64cdf0e10cSrcweir public:
65cdf0e10cSrcweir 	UnoControlTabPageContainerModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlTabPageContainerModel(const UnoControlTabPageContainerModel & rModel)66cdf0e10cSrcweir 	UnoControlTabPageContainerModel( const UnoControlTabPageContainerModel& rModel ) : UnoControlTabPageContainerModel_Base( rModel ),maContainerListeners( *this ) {;}
67cdf0e10cSrcweir 
Clone() const68cdf0e10cSrcweir 	UnoControlModel*	Clone() const { return new UnoControlTabPageContainerModel( *this ); }
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 	// ::com::sun::star::io::XPersistObject
71cdf0e10cSrcweir     ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 	// ::com::sun::star::lang::XServiceInfo
74cdf0e10cSrcweir 	DECLIMPL_SERVICEINFO_DERIVED( UnoControlTabPageContainerModel, UnoControlModel, szServiceName_UnoControlTabPageContainerModel )
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     // XTabPageContainerModel
77cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageModel > SAL_CALL createTabPage( ::sal_Int16 TabPageID ) throw (::com::sun::star::uno::RuntimeException);
78cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageModel > SAL_CALL loadTabPage( ::sal_Int16 TabPageID, const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::uno::RuntimeException);
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	// XIndexContainer
81cdf0e10cSrcweir 	virtual void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
82cdf0e10cSrcweir  			throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
83cdf0e10cSrcweir 	virtual void SAL_CALL removeByIndex( sal_Int32 Index )
84cdf0e10cSrcweir  			throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
85cdf0e10cSrcweir 
86cdf0e10cSrcweir     // XIndexReplace
87cdf0e10cSrcweir  	virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
88cdf0e10cSrcweir  			throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
89cdf0e10cSrcweir 
90cdf0e10cSrcweir  	// XIndexAccess
91cdf0e10cSrcweir  	virtual sal_Int32 SAL_CALL getCount() throw (::com::sun::star::uno::RuntimeException);
92cdf0e10cSrcweir 
93cdf0e10cSrcweir  	virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
94cdf0e10cSrcweir  			throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
95cdf0e10cSrcweir 
96cdf0e10cSrcweir  	// XElementAccess
97cdf0e10cSrcweir  	virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw (::com::sun::star::uno::RuntimeException);
98cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL hasElements() throw (::com::sun::star::uno::RuntimeException);
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 	// ::com::sun::star::container::XContainer
101cdf0e10cSrcweir     void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
102cdf0e10cSrcweir     void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
103cdf0e10cSrcweir };
104cdf0e10cSrcweir // ===================================================================
105cdf0e10cSrcweir // = UnoControlTabPageContainer
106cdf0e10cSrcweir // ===================================================================
107cdf0e10cSrcweir typedef ::cppu::AggImplInheritanceHelper1   <   ControlContainerBase
108cdf0e10cSrcweir                                             ,   ::com::sun::star::awt::tab::XTabPageContainer
109cdf0e10cSrcweir                                             >   UnoControlTabPageContainer_Base;
110cdf0e10cSrcweir class UnoControlTabPageContainer : public UnoControlTabPageContainer_Base
111cdf0e10cSrcweir {
112cdf0e10cSrcweir public:
113cdf0e10cSrcweir 	UnoControlTabPageContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
114cdf0e10cSrcweir 	::rtl::OUString				GetComponentServiceName();
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	// ::com::sun::star::lang::XComponent
117cdf0e10cSrcweir     void SAL_CALL dispose(  ) throw(::com::sun::star::uno::RuntimeException);
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 	// ::com::sun::star::awt::XControl
120cdf0e10cSrcweir     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);
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	// ::com::sun::star::awt::tab::XTabPageContainer
123cdf0e10cSrcweir     virtual ::sal_Int16 SAL_CALL getActiveTabPageID() throw (::com::sun::star::uno::RuntimeException);
124cdf0e10cSrcweir     virtual void SAL_CALL setActiveTabPageID( ::sal_Int16 _activetabpageid ) throw (::com::sun::star::uno::RuntimeException);
125cdf0e10cSrcweir     virtual ::sal_Int16 SAL_CALL getTabPageCount(  ) throw (::com::sun::star::uno::RuntimeException);
126cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL isTabPageActive( ::sal_Int16 tabPageIndex ) throw (::com::sun::star::uno::RuntimeException);
127cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL getTabPage( ::sal_Int16 tabPageIndex ) throw (::com::sun::star::uno::RuntimeException);
128cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL getTabPageByID( ::sal_Int16 tabPageID ) throw (::com::sun::star::uno::RuntimeException);
129cdf0e10cSrcweir     virtual void SAL_CALL addTabPageContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
130cdf0e10cSrcweir     virtual void SAL_CALL removeTabPageContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
131cdf0e10cSrcweir 
132cdf0e10cSrcweir     virtual 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);
133cdf0e10cSrcweir 	// ::com::sun::star::lang::XServiceInfo
134cdf0e10cSrcweir 	DECLIMPL_SERVICEINFO_DERIVED( UnoControlTabPageContainer, UnoControlBase, szServiceName_UnoControlTabPageContainer )
135cdf0e10cSrcweir 
136cdf0e10cSrcweir //	using UnoControl::getPeer;
137cdf0e10cSrcweir protected:
138cdf0e10cSrcweir     virtual void        updateFromModel();
139cdf0e10cSrcweir private:
140cdf0e10cSrcweir 	TabPageListenerMultiplexer 	m_aTabPageListeners;
141cdf0e10cSrcweir 	sal_Int16 m_nActiveTabPageId;
142cdf0e10cSrcweir };
143cdf0e10cSrcweir 
144cdf0e10cSrcweir #endif // _TOOLKIT_TABPAGE_CONTAINER_HXX
145