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