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