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