1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef TOOLKIT_ROADMAP_CONTROL_HXX 29*cdf0e10cSrcweir #define TOOLKIT_ROADMAP_CONTROL_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir #include <toolkit/controls/unocontrols.hxx> 33*cdf0e10cSrcweir #include <toolkit/controls/unocontrolmodel.hxx> 34*cdf0e10cSrcweir #include <toolkit/helper/servicenames.hxx> 35*cdf0e10cSrcweir #include <toolkit/controls/roadmapentry.hxx> 36*cdf0e10cSrcweir #include <com/sun/star/container/XContainer.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyChangeListener.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/container/XIndexContainer.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/container/XContainerListener.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/awt/XItemListener.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/awt/XItemEventBroadcaster.hpp> 43*cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx> 44*cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx> 45*cdf0e10cSrcweir #include <cppuhelper/implbase4.hxx> 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir #include <comphelper/uno3.hxx> 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir //........................................................................ 51*cdf0e10cSrcweir namespace toolkit 52*cdf0e10cSrcweir { 53*cdf0e10cSrcweir //........................................................................ 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir typedef GraphicControlModel UnoControlRoadmapModel_Base; 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir typedef ::cppu::ImplHelper3 < ::com::sun::star::lang::XSingleServiceFactory 59*cdf0e10cSrcweir , ::com::sun::star::container::XContainer 60*cdf0e10cSrcweir , ::com::sun::star::container::XIndexContainer 61*cdf0e10cSrcweir > UnoControlRoadmapModel_IBase; 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir typedef UnoControlBase UnoControlRoadmap_Base; 66*cdf0e10cSrcweir typedef ::cppu::ImplHelper4 < ::com::sun::star::awt::XItemEventBroadcaster 67*cdf0e10cSrcweir , ::com::sun::star::container::XContainerListener 68*cdf0e10cSrcweir , ::com::sun::star::awt::XItemListener 69*cdf0e10cSrcweir , ::com::sun::star::beans::XPropertyChangeListener 70*cdf0e10cSrcweir > UnoControlRoadmap_IBase; 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir typedef ::cppu::ImplHelper2< ::com::sun::star::container::XContainerListener, 76*cdf0e10cSrcweir ::com::sun::star::awt::XItemEventBroadcaster> SVTXRoadmap_Base; 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 80*cdf0e10cSrcweir using namespace ::com::sun::star::awt; 81*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 82*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 83*cdf0e10cSrcweir using namespace ::com::sun::star::container; 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir // =================================================================== 87*cdf0e10cSrcweir // = UnoControlRoadmapModel 88*cdf0e10cSrcweir // =================================================================== 89*cdf0e10cSrcweir class UnoControlRoadmapModel : public UnoControlRoadmapModel_Base, 90*cdf0e10cSrcweir public UnoControlRoadmapModel_IBase 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir { 93*cdf0e10cSrcweir private: 94*cdf0e10cSrcweir // PropertyChangeListenerMultiplexer maPropertyListeners; 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir typedef ::std::vector< Reference< XInterface > > RoadmapItemHolderList; 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir ContainerListenerMultiplexer maContainerListeners; 99*cdf0e10cSrcweir RoadmapItemHolderList maRoadmapItems; 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir void MakeRMItemValidation( sal_Int32 Index, Reference< XInterface > xRoadmapItem ); 102*cdf0e10cSrcweir ContainerEvent GetContainerEvent(sal_Int32 Index, Reference< XInterface > ); 103*cdf0e10cSrcweir void SetRMItemDefaultProperties( const sal_Int32 _Index, Reference< XInterface > ); 104*cdf0e10cSrcweir sal_Int16 GetCurrentItemID( Reference< XPropertySet > xPropertySet ); 105*cdf0e10cSrcweir sal_Int32 GetUniqueID(); 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir protected: 109*cdf0e10cSrcweir ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; 110*cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir public: 113*cdf0e10cSrcweir UnoControlRoadmapModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory ); 114*cdf0e10cSrcweir UnoControlRoadmapModel( const UnoControlRoadmapModel& rModel ) : 115*cdf0e10cSrcweir UnoControlRoadmapModel_Base( rModel ), 116*cdf0e10cSrcweir UnoControlRoadmapModel_IBase( rModel ), 117*cdf0e10cSrcweir maContainerListeners( *this ) {} 118*cdf0e10cSrcweir UnoControlModel* Clone() const { return new UnoControlRoadmapModel( *this ); } 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir // XTypeProvider 122*cdf0e10cSrcweir DECLARE_XTYPEPROVIDER( ) 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir // ::com::sun::star::io::XPersistObject 126*cdf0e10cSrcweir ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir // ::com::sun::star::lang::XServiceInfo 129*cdf0e10cSrcweir DECLIMPL_SERVICEINFO_DERIVED( UnoControlRoadmapModel, UnoControlRoadmapModel_Base, szServiceName2_UnoControlRoadmapModel ) 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir sal_Int32 SAL_CALL getCount() throw (RuntimeException); 132*cdf0e10cSrcweir virtual Any SAL_CALL getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException ); 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir virtual void SAL_CALL insertByIndex( sal_Int32 Index, const Any & _Element) throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException ); 135*cdf0e10cSrcweir virtual void SAL_CALL removeByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException ); 136*cdf0e10cSrcweir virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const Any & _Element) throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException ); 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir virtual void SAL_CALL addContainerListener( const Reference< XContainerListener >& xListener ) throw (RuntimeException); 139*cdf0e10cSrcweir virtual void SAL_CALL removeContainerListener( const Reference< XContainerListener >& xListener ) throw (RuntimeException); 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir ::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); } 142*cdf0e10cSrcweir ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); 143*cdf0e10cSrcweir void SAL_CALL acquire() throw() { UnoControlRoadmapModel_Base::acquire(); } 144*cdf0e10cSrcweir void SAL_CALL release() throw() { UnoControlRoadmapModel_Base::release(); } 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir // ::com::sun::star::beans::XPropertySet 148*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException); 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir virtual Reference< XInterface > SAL_CALL createInstance( ) throw (Exception, RuntimeException); 152*cdf0e10cSrcweir virtual Reference< XInterface > SAL_CALL createInstanceWithArguments( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException); 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir virtual Type SAL_CALL getElementType() throw (RuntimeException); 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasElements() throw (RuntimeException); 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir }; 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir // =================================================================== 162*cdf0e10cSrcweir // = UnoRoadmapControl 163*cdf0e10cSrcweir // =================================================================== 164*cdf0e10cSrcweir class UnoRoadmapControl : public UnoControlRoadmap_Base, 165*cdf0e10cSrcweir public UnoControlRoadmap_IBase 166*cdf0e10cSrcweir { 167*cdf0e10cSrcweir private: 168*cdf0e10cSrcweir ItemListenerMultiplexer maItemListeners; 169*cdf0e10cSrcweir public: 170*cdf0e10cSrcweir UnoRoadmapControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory ); 171*cdf0e10cSrcweir ::rtl::OUString GetComponentServiceName(); 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); } 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model) throw ( ::com::sun::star::uno::RuntimeException ); 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& rEvent )throw(::com::sun::star::uno::RuntimeException); 181*cdf0e10cSrcweir void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& rEvent )throw(::com::sun::star::uno::RuntimeException); 182*cdf0e10cSrcweir void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& rEvent )throw(::com::sun::star::uno::RuntimeException); 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir virtual void SAL_CALL addItemListener( const Reference< XItemListener >& l ) throw (RuntimeException); 185*cdf0e10cSrcweir virtual void SAL_CALL removeItemListener( const Reference< XItemListener >& l ) throw (RuntimeException); 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir virtual void SAL_CALL itemStateChanged( const ItemEvent& rEvent ) throw (RuntimeException); 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException); 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir // XTypeProvider 193*cdf0e10cSrcweir DECLARE_XTYPEPROVIDER( ) 194*cdf0e10cSrcweir DECLARE_XINTERFACE() 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir // ::com::sun::star::lang::XServiceInfo 197*cdf0e10cSrcweir DECLIMPL_SERVICEINFO_DERIVED( UnoRoadmapControl, UnoControlBase, szServiceName2_UnoControlRoadmap ) 198*cdf0e10cSrcweir }; 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir //........................................................................ 201*cdf0e10cSrcweir } // toolkit 202*cdf0e10cSrcweir //........................................................................ 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir #endif // _TOOLKIT_ROADMAP_CONTROL_HXX 207