xref: /AOO41X/main/toolkit/inc/toolkit/controls/roadmapcontrol.hxx (revision 50e6b0721ed882c1c74690abd9bee6b3a8da8cfd)
1*50e6b072SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
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
10cdf0e10cSrcweir  *
11*50e6b072SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
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.
19cdf0e10cSrcweir  *
20*50e6b072SAndrew Rist  *************************************************************/
21*50e6b072SAndrew Rist 
22*50e6b072SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef TOOLKIT_ROADMAP_CONTROL_HXX
25cdf0e10cSrcweir #define TOOLKIT_ROADMAP_CONTROL_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <toolkit/controls/unocontrols.hxx>
29cdf0e10cSrcweir #include <toolkit/controls/unocontrolmodel.hxx>
30cdf0e10cSrcweir #include <toolkit/helper/servicenames.hxx>
31cdf0e10cSrcweir #include <toolkit/controls/roadmapentry.hxx>
32cdf0e10cSrcweir #include <com/sun/star/container/XContainer.hpp>
33cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp>
34cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyChangeListener.hpp>
35cdf0e10cSrcweir #include <com/sun/star/container/XIndexContainer.hpp>
36cdf0e10cSrcweir #include <com/sun/star/container/XContainerListener.hpp>
37cdf0e10cSrcweir #include <com/sun/star/awt/XItemListener.hpp>
38cdf0e10cSrcweir #include <com/sun/star/awt/XItemEventBroadcaster.hpp>
39cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
40cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx>
41cdf0e10cSrcweir #include <cppuhelper/implbase4.hxx>
42cdf0e10cSrcweir 
43cdf0e10cSrcweir 
44cdf0e10cSrcweir #include <comphelper/uno3.hxx>
45cdf0e10cSrcweir 
46cdf0e10cSrcweir //........................................................................
47cdf0e10cSrcweir namespace toolkit
48cdf0e10cSrcweir {
49cdf0e10cSrcweir //........................................................................
50cdf0e10cSrcweir 
51cdf0e10cSrcweir     typedef GraphicControlModel	UnoControlRoadmapModel_Base;
52cdf0e10cSrcweir 
53cdf0e10cSrcweir 
54cdf0e10cSrcweir     typedef ::cppu::ImplHelper3	<	::com::sun::star::lang::XSingleServiceFactory
55cdf0e10cSrcweir 							    ,	::com::sun::star::container::XContainer
56cdf0e10cSrcweir 							    ,	::com::sun::star::container::XIndexContainer
57cdf0e10cSrcweir 							    >	UnoControlRoadmapModel_IBase;
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     typedef UnoControlBase	UnoControlRoadmap_Base;
62cdf0e10cSrcweir     typedef ::cppu::ImplHelper4	<   ::com::sun::star::awt::XItemEventBroadcaster
63cdf0e10cSrcweir 							    ,   ::com::sun::star::container::XContainerListener
64cdf0e10cSrcweir 							    ,	::com::sun::star::awt::XItemListener
65cdf0e10cSrcweir                                 ,   ::com::sun::star::beans::XPropertyChangeListener
66cdf0e10cSrcweir 							    >	UnoControlRoadmap_IBase;
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     typedef ::cppu::ImplHelper2< ::com::sun::star::container::XContainerListener,
72cdf0e10cSrcweir                                  ::com::sun::star::awt::XItemEventBroadcaster>    SVTXRoadmap_Base;
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 	using namespace ::com::sun::star::uno;
76cdf0e10cSrcweir 	using namespace ::com::sun::star::awt;
77cdf0e10cSrcweir 	using namespace ::com::sun::star::lang;
78cdf0e10cSrcweir 	using namespace ::com::sun::star::beans;
79cdf0e10cSrcweir     using namespace ::com::sun::star::container;
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 	// ===================================================================
83cdf0e10cSrcweir 	// = UnoControlRoadmapModel
84cdf0e10cSrcweir 	// ===================================================================
85cdf0e10cSrcweir 	class UnoControlRoadmapModel : public UnoControlRoadmapModel_Base,
86cdf0e10cSrcweir                                    public UnoControlRoadmapModel_IBase
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 	{
89cdf0e10cSrcweir     private:
90cdf0e10cSrcweir //        PropertyChangeListenerMultiplexer 	            maPropertyListeners;
91cdf0e10cSrcweir 
92cdf0e10cSrcweir         typedef ::std::vector< Reference< XInterface > >	RoadmapItemHolderList;
93cdf0e10cSrcweir 
94cdf0e10cSrcweir         ContainerListenerMultiplexer		maContainerListeners;
95cdf0e10cSrcweir         RoadmapItemHolderList			    maRoadmapItems;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir         void                                MakeRMItemValidation( sal_Int32 Index, Reference< XInterface > xRoadmapItem );
98cdf0e10cSrcweir         ContainerEvent                      GetContainerEvent(sal_Int32 Index, Reference< XInterface > );
99cdf0e10cSrcweir         void                                SetRMItemDefaultProperties( const sal_Int32 _Index, Reference< XInterface > );
100cdf0e10cSrcweir         sal_Int16                           GetCurrentItemID( Reference< XPropertySet > xPropertySet );
101cdf0e10cSrcweir         sal_Int32                           GetUniqueID();
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	protected:
105cdf0e10cSrcweir 		::com::sun::star::uno::Any 		ImplGetDefaultValue( sal_uInt16 nPropId ) const;
106cdf0e10cSrcweir 		::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 	public:
109cdf0e10cSrcweir 		UnoControlRoadmapModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
UnoControlRoadmapModel(const UnoControlRoadmapModel & rModel)110cdf0e10cSrcweir 		UnoControlRoadmapModel( const UnoControlRoadmapModel& rModel ) :
111cdf0e10cSrcweir             UnoControlRoadmapModel_Base( rModel ),
112cdf0e10cSrcweir             UnoControlRoadmapModel_IBase( rModel ),
113cdf0e10cSrcweir             maContainerListeners( *this ) {}
Clone() const114cdf0e10cSrcweir 		UnoControlModel*	Clone() const { return new UnoControlRoadmapModel( *this ); }
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	// XTypeProvider
118cdf0e10cSrcweir 	DECLARE_XTYPEPROVIDER( )
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     // ::com::sun::star::io::XPersistObject
122cdf0e10cSrcweir 	::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 	// ::com::sun::star::lang::XServiceInfo
125cdf0e10cSrcweir 	DECLIMPL_SERVICEINFO_DERIVED( UnoControlRoadmapModel, UnoControlRoadmapModel_Base, szServiceName2_UnoControlRoadmapModel )
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 	sal_Int32 SAL_CALL getCount() throw (RuntimeException);
128cdf0e10cSrcweir     virtual Any SAL_CALL getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException );
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     virtual void SAL_CALL insertByIndex( sal_Int32 Index, const Any & _Element) throw	 (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException );
131cdf0e10cSrcweir     virtual void SAL_CALL removeByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException );
132cdf0e10cSrcweir     virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const Any & _Element) throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException );
133cdf0e10cSrcweir 
134cdf0e10cSrcweir     virtual void SAL_CALL addContainerListener( const Reference< XContainerListener >& xListener ) throw (RuntimeException);
135cdf0e10cSrcweir     virtual void SAL_CALL removeContainerListener( const Reference< XContainerListener >& xListener ) throw (RuntimeException);
136cdf0e10cSrcweir 
queryInterface(const::com::sun::star::uno::Type & rType)137cdf0e10cSrcweir 	::com::sun::star::uno::Any	SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlRoadmapModel_Base::queryInterface(rType); }
138cdf0e10cSrcweir     ::com::sun::star::uno::Any	SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
acquire()139cdf0e10cSrcweir 	void						SAL_CALL acquire() throw()	{ UnoControlRoadmapModel_Base::acquire(); }
release()140cdf0e10cSrcweir 	void						SAL_CALL release() throw()	{ UnoControlRoadmapModel_Base::release(); }
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     // ::com::sun::star::beans::XPropertySet
144cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw (::com::sun::star::uno::RuntimeException);
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 
147cdf0e10cSrcweir     virtual Reference< XInterface > SAL_CALL createInstance(  ) throw (Exception, RuntimeException);
148cdf0e10cSrcweir     virtual Reference< XInterface > SAL_CALL createInstanceWithArguments( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException);
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 	virtual Type SAL_CALL getElementType() throw (RuntimeException);
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL hasElements() throw (RuntimeException);
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 	};
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 
157cdf0e10cSrcweir 	// ===================================================================
158cdf0e10cSrcweir 	// = UnoRoadmapControl
159cdf0e10cSrcweir 	// ===================================================================
160cdf0e10cSrcweir 	class UnoRoadmapControl : public UnoControlRoadmap_Base,
161cdf0e10cSrcweir                               public UnoControlRoadmap_IBase
162cdf0e10cSrcweir     {
163cdf0e10cSrcweir     private:
164cdf0e10cSrcweir         ItemListenerMultiplexer 	            maItemListeners;
165cdf0e10cSrcweir 	public:
166cdf0e10cSrcweir 							UnoRoadmapControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
167cdf0e10cSrcweir 		::rtl::OUString		GetComponentServiceName();
168cdf0e10cSrcweir 
disposing(const::com::sun::star::lang::EventObject & Source)169cdf0e10cSrcweir     void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); }
170cdf0e10cSrcweir 
171cdf0e10cSrcweir     void SAL_CALL   dispose(  ) throw(::com::sun::star::uno::RuntimeException);
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 
174cdf0e10cSrcweir     sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model) throw ( ::com::sun::star::uno::RuntimeException );
175cdf0e10cSrcweir 
176cdf0e10cSrcweir     void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& rEvent )throw(::com::sun::star::uno::RuntimeException);
177cdf0e10cSrcweir     void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& rEvent )throw(::com::sun::star::uno::RuntimeException);
178cdf0e10cSrcweir     void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& rEvent )throw(::com::sun::star::uno::RuntimeException);
179cdf0e10cSrcweir 
180cdf0e10cSrcweir     virtual void SAL_CALL addItemListener( const Reference< XItemListener >& l ) throw (RuntimeException);
181cdf0e10cSrcweir     virtual void SAL_CALL removeItemListener( const Reference< XItemListener >& l ) throw (RuntimeException);
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 
184cdf0e10cSrcweir     virtual void SAL_CALL itemStateChanged( const ItemEvent& rEvent ) throw (RuntimeException);
185cdf0e10cSrcweir 
186cdf0e10cSrcweir     virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException);
187cdf0e10cSrcweir 
188cdf0e10cSrcweir 	// XTypeProvider
189cdf0e10cSrcweir 	DECLARE_XTYPEPROVIDER( )
190cdf0e10cSrcweir     DECLARE_XINTERFACE()
191cdf0e10cSrcweir 
192cdf0e10cSrcweir 	// ::com::sun::star::lang::XServiceInfo
193cdf0e10cSrcweir 	DECLIMPL_SERVICEINFO_DERIVED( UnoRoadmapControl, UnoControlBase, szServiceName2_UnoControlRoadmap )
194cdf0e10cSrcweir 	};
195cdf0e10cSrcweir 
196cdf0e10cSrcweir //........................................................................
197cdf0e10cSrcweir } // toolkit
198cdf0e10cSrcweir //........................................................................
199cdf0e10cSrcweir 
200cdf0e10cSrcweir 
201cdf0e10cSrcweir 
202cdf0e10cSrcweir #endif // _TOOLKIT_ROADMAP_CONTROL_HXX
203