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 0 : 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 : 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 0 : DECLIMPL_SERVICEINFO_DERIVED( UnoControlRoadmapModel, UnoControlRoadmapModel_Base, szServiceName2_UnoControlRoadmapModel )
115 :
116 : sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
117 : virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (css::lang::IndexOutOfBoundsException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
118 :
119 : 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;
120 : virtual void SAL_CALL removeByIndex( sal_Int32 Index ) throw (css::lang::IndexOutOfBoundsException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
121 : 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;
122 :
123 : virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 : virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
125 :
126 0 : css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE { return UnoControlRoadmapModel_Base::queryInterface(rType); }
127 : css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
128 0 : void SAL_CALL acquire() throw() SAL_OVERRIDE { UnoControlRoadmapModel_Base::acquire(); }
129 0 : void SAL_CALL release() throw() SAL_OVERRIDE { UnoControlRoadmapModel_Base::release(); }
130 :
131 :
132 : // ::com::sun::star::beans::XPropertySet
133 : virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
134 :
135 :
136 : virtual css::uno::Reference< XInterface > SAL_CALL createInstance( ) throw (css::uno::Exception, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
137 : 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;
138 :
139 : virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
140 :
141 : virtual sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
142 :
143 : };
144 :
145 :
146 :
147 : // = UnoRoadmapControl
148 :
149 0 : class UnoRoadmapControl : public UnoControlRoadmap_Base,
150 : public UnoControlRoadmap_IBase
151 : {
152 : private:
153 : ItemListenerMultiplexer maItemListeners;
154 : public:
155 : UnoRoadmapControl();
156 : OUString GetComponentServiceName() SAL_OVERRIDE;
157 :
158 0 : void SAL_CALL disposing( const css::lang::EventObject& Source ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE { UnoControlBase::disposing( Source ); }
159 :
160 : void SAL_CALL dispose( ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
161 :
162 :
163 : sal_Bool SAL_CALL setModel(const css::uno::Reference< css::awt::XControlModel >& Model) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
164 :
165 : void SAL_CALL elementInserted( const css::container::ContainerEvent& rEvent ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
166 : void SAL_CALL elementRemoved( const css::container::ContainerEvent& rEvent ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
167 : void SAL_CALL elementReplaced( const css::container::ContainerEvent& rEvent ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
168 :
169 : virtual void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
170 : virtual void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
171 :
172 :
173 : virtual void SAL_CALL itemStateChanged( const css::awt::ItemEvent& rEvent ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
174 :
175 : virtual void SAL_CALL propertyChange( const css::beans::PropertyChangeEvent& evt ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
176 :
177 : // XTypeProvider
178 : DECLARE_XTYPEPROVIDER( )
179 : DECLARE_XINTERFACE()
180 :
181 : // ::com::sun::star::lang::XServiceInfo
182 0 : DECLIMPL_SERVICEINFO_DERIVED( UnoRoadmapControl, UnoControlBase, szServiceName2_UnoControlRoadmap )
183 : };
184 :
185 :
186 : } // toolkit
187 :
188 :
189 :
190 :
191 : #endif // _ INCLUDED_TOOLKIT_CONTROLS_ROADMAPCONTROL_HXX
192 :
193 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|