/src/libreoffice/toolkit/source/controls/roadmapcontrol.cxx
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 | | |
21 | | #include <controls/roadmapcontrol.hxx> |
22 | | #include <controls/roadmapentry.hxx> |
23 | | #include <helper/property.hxx> |
24 | | #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> |
25 | | #include <com/sun/star/uno/XComponentContext.hpp> |
26 | | |
27 | | #include <helper/unopropertyarrayhelper.hxx> |
28 | | |
29 | | namespace toolkit |
30 | | { |
31 | | |
32 | | |
33 | | using namespace ::com::sun::star::uno; |
34 | | using namespace ::com::sun::star::awt; |
35 | | using namespace ::com::sun::star::lang; |
36 | | using namespace ::com::sun::star::beans; |
37 | | using namespace ::com::sun::star::container; |
38 | | |
39 | | |
40 | | // helper |
41 | | |
42 | | // = UnoControlRoadmapModel |
43 | | |
44 | | |
45 | | UnoControlRoadmapModel::UnoControlRoadmapModel( const Reference< XComponentContext >& i_factory ) |
46 | 0 | :UnoControlRoadmapModel_Base( i_factory ) |
47 | 0 | ,maContainerListeners( *this ) |
48 | 0 | { |
49 | 0 | ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); |
50 | 0 | ImplRegisterProperty( BASEPROPERTY_BORDER ); |
51 | 0 | ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR ); |
52 | 0 | ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); |
53 | 0 | ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); |
54 | 0 | ImplRegisterProperty( BASEPROPERTY_HELPTEXT ); |
55 | 0 | ImplRegisterProperty( BASEPROPERTY_HELPURL ); |
56 | 0 | ImplRegisterProperty( BASEPROPERTY_IMAGEURL ); |
57 | 0 | ImplRegisterProperty( BASEPROPERTY_GRAPHIC ); |
58 | 0 | ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); |
59 | 0 | ImplRegisterProperty( BASEPROPERTY_COMPLETE ); |
60 | 0 | ImplRegisterProperty( BASEPROPERTY_ACTIVATED ); |
61 | 0 | ImplRegisterProperty( BASEPROPERTY_CURRENTITEMID ); |
62 | 0 | ImplRegisterProperty( BASEPROPERTY_TABSTOP ); |
63 | 0 | ImplRegisterProperty( BASEPROPERTY_TEXT ); |
64 | 0 | } Unexecuted instantiation: toolkit::UnoControlRoadmapModel::UnoControlRoadmapModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: toolkit::UnoControlRoadmapModel::UnoControlRoadmapModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
65 | | |
66 | | |
67 | | OUString UnoControlRoadmapModel::getServiceName() |
68 | 0 | { |
69 | 0 | return u"stardiv.vcl.controlmodel.Roadmap"_ustr; |
70 | 0 | } |
71 | | |
72 | | OUString UnoControlRoadmapModel::getImplementationName() |
73 | 0 | { |
74 | 0 | return u"stardiv.Toolkit.UnoControlRoadmapModel"_ustr; |
75 | 0 | } |
76 | | |
77 | | css::uno::Sequence<OUString> |
78 | | UnoControlRoadmapModel::getSupportedServiceNames() |
79 | 0 | { |
80 | 0 | auto s(UnoControlRoadmapModel_Base::getSupportedServiceNames()); |
81 | 0 | s.realloc(s.getLength() + 2); |
82 | 0 | auto ps = s.getArray(); |
83 | 0 | ps[s.getLength() - 2] = "com.sun.star.awt.UnoControlRoadmapModel"; |
84 | 0 | ps[s.getLength() - 1] = "stardiv.vcl.controlmodel.Roadmap"; |
85 | 0 | return s; |
86 | 0 | } |
87 | | |
88 | | Any UnoControlRoadmapModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const |
89 | 0 | { |
90 | 0 | Any aReturn; |
91 | 0 | switch (nPropId) |
92 | 0 | { |
93 | 0 | case BASEPROPERTY_COMPLETE: |
94 | 0 | case BASEPROPERTY_ACTIVATED: |
95 | 0 | aReturn <<= true; |
96 | 0 | break; |
97 | 0 | case BASEPROPERTY_CURRENTITEMID: |
98 | 0 | aReturn <<= sal_Int16(-1); |
99 | 0 | break; |
100 | 0 | case BASEPROPERTY_TEXT: |
101 | 0 | break; |
102 | 0 | case BASEPROPERTY_BORDER: |
103 | 0 | aReturn <<= sal_Int16(2); // No Border |
104 | 0 | break; |
105 | 0 | case BASEPROPERTY_DEFAULTCONTROL: |
106 | 0 | aReturn <<= u"stardiv.vcl.control.Roadmap"_ustr; |
107 | 0 | break; |
108 | 0 | default : aReturn = UnoControlRoadmapModel_Base::ImplGetDefaultValue( nPropId ); break; |
109 | 0 | } |
110 | | |
111 | 0 | return aReturn; |
112 | 0 | } |
113 | | |
114 | | |
115 | | Reference< XInterface > SAL_CALL UnoControlRoadmapModel::createInstance( ) |
116 | 0 | { |
117 | 0 | return cppu::getXWeak(new ORoadmapEntry()); |
118 | 0 | } |
119 | | |
120 | | |
121 | | Reference< XInterface > SAL_CALL UnoControlRoadmapModel::createInstanceWithArguments( const Sequence< Any >& /*aArguments*/ ) |
122 | 0 | { |
123 | | // Todo: implementation of the arguments handling |
124 | 0 | return cppu::getXWeak(new ORoadmapEntry()); |
125 | 0 | } |
126 | | |
127 | | |
128 | | IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoControlRoadmapModel, UnoControlRoadmapModel_Base, UnoControlRoadmapModel_IBase ) |
129 | | |
130 | | |
131 | | css::uno::Any SAL_CALL UnoControlRoadmapModel::queryAggregation( const css::uno::Type & rType ) |
132 | 0 | { |
133 | 0 | Any aRet = UnoControlRoadmapModel_Base::queryAggregation( rType ); |
134 | 0 | if ( !aRet.hasValue() ) |
135 | 0 | aRet = UnoControlRoadmapModel_IBase::queryInterface( rType ); |
136 | 0 | return aRet; |
137 | 0 | } |
138 | | |
139 | | |
140 | | ::cppu::IPropertyArrayHelper& UnoControlRoadmapModel::getInfoHelper() |
141 | 0 | { |
142 | 0 | static UnoPropertyArrayHelper aHelper( ImplGetPropertyIds() ); |
143 | 0 | return aHelper; |
144 | 0 | } |
145 | | |
146 | | |
147 | | // beans::XMultiPropertySet |
148 | | |
149 | | Reference< XPropertySetInfo > UnoControlRoadmapModel::getPropertySetInfo( ) |
150 | 0 | { |
151 | 0 | static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); |
152 | 0 | return xInfo; |
153 | 0 | } |
154 | | |
155 | | |
156 | | sal_Int32 SAL_CALL UnoControlRoadmapModel::getCount() |
157 | 0 | { |
158 | 0 | return maRoadmapItems.size(); |
159 | 0 | } |
160 | | |
161 | | Any SAL_CALL UnoControlRoadmapModel::getByIndex( sal_Int32 Index ) |
162 | 0 | { |
163 | 0 | if ((Index < 0) || ( o3tl::make_unsigned(Index) >= maRoadmapItems.size())) |
164 | 0 | throw IndexOutOfBoundsException(); |
165 | 0 | Any aAny( maRoadmapItems.at( Index ) ); |
166 | 0 | return aAny; |
167 | 0 | } |
168 | | |
169 | | |
170 | | void UnoControlRoadmapModel::MakeRMItemValidation( sal_Int32 Index, const Reference< XInterface >& xRoadmapItem ) |
171 | 0 | { |
172 | 0 | if (( Index < 0 ) || (o3tl::make_unsigned(Index) > maRoadmapItems.size()) ) |
173 | 0 | throw IndexOutOfBoundsException(); |
174 | 0 | if ( !xRoadmapItem.is() ) |
175 | 0 | throw IllegalArgumentException(); |
176 | 0 | Reference< XServiceInfo > xServiceInfo( xRoadmapItem, UNO_QUERY ); |
177 | 0 | bool bIsRoadmapItem = xServiceInfo->supportsService(u"com.sun.star.awt.RoadmapItem"_ustr); |
178 | 0 | if ( !bIsRoadmapItem ) |
179 | 0 | throw IllegalArgumentException(); |
180 | 0 | } |
181 | | |
182 | | |
183 | | void UnoControlRoadmapModel::SetRMItemDefaultProperties( const Reference< XInterface >& xRoadmapItem) |
184 | 0 | { |
185 | 0 | Reference< XPropertySet > xPropertySet( xRoadmapItem, UNO_QUERY ); |
186 | 0 | Reference< XPropertySet > xProps( xRoadmapItem, UNO_QUERY ); |
187 | 0 | if ( xProps.is() ) |
188 | 0 | { |
189 | 0 | sal_Int32 LocID = 0; |
190 | 0 | Any aValue = xPropertySet->getPropertyValue(u"ID"_ustr); |
191 | 0 | aValue >>= LocID; |
192 | 0 | if (LocID < 0) // index may not be smaller than zero |
193 | 0 | { |
194 | 0 | xPropertySet->setPropertyValue(u"ID"_ustr, Any(GetUniqueID()) ); |
195 | 0 | } |
196 | 0 | } |
197 | 0 | } |
198 | | |
199 | | |
200 | | // The performance of this method could certainly be improved. |
201 | | // As long as only vectors with up to 10 elements are |
202 | | // involved it should be sufficient |
203 | | sal_Int32 UnoControlRoadmapModel::GetUniqueID() |
204 | 0 | { |
205 | 0 | Any aAny; |
206 | 0 | bool bIncrement = true; |
207 | 0 | sal_Int32 CurID = 0; |
208 | 0 | sal_Int32 n_CurItemID = 0; |
209 | 0 | Reference< XInterface > CurRoadmapItem; |
210 | 0 | while ( bIncrement ) |
211 | 0 | { |
212 | 0 | bIncrement = false; |
213 | 0 | for ( const auto& rRoadmapItem : maRoadmapItems ) |
214 | 0 | { |
215 | 0 | CurRoadmapItem = rRoadmapItem; |
216 | 0 | Reference< XPropertySet > xPropertySet( CurRoadmapItem, UNO_QUERY ); |
217 | 0 | aAny = xPropertySet->getPropertyValue(u"ID"_ustr); |
218 | 0 | aAny >>= n_CurItemID; |
219 | 0 | if (n_CurItemID == CurID) |
220 | 0 | { |
221 | 0 | bIncrement = true; |
222 | 0 | CurID++; |
223 | 0 | break; |
224 | 0 | } |
225 | 0 | } |
226 | 0 | } |
227 | 0 | return CurID; |
228 | 0 | } |
229 | | |
230 | | |
231 | | ContainerEvent UnoControlRoadmapModel::GetContainerEvent(sal_Int32 Index, const Reference< XInterface >& xRoadmapItem) |
232 | 0 | { |
233 | 0 | ContainerEvent aEvent; |
234 | 0 | aEvent.Source = *this; |
235 | 0 | aEvent.Element <<= xRoadmapItem; |
236 | 0 | aEvent.Accessor <<= Index; |
237 | 0 | return aEvent; |
238 | 0 | } |
239 | | |
240 | | |
241 | | sal_Int16 UnoControlRoadmapModel::GetCurrentItemID( const Reference< XPropertySet >& xPropertySet ) |
242 | 0 | { |
243 | 0 | Any aAny = xPropertySet->getPropertyValue( GetPropertyName( BASEPROPERTY_CURRENTITEMID ) ); |
244 | 0 | sal_Int16 n_CurrentItemID = 0; |
245 | 0 | aAny >>= n_CurrentItemID; |
246 | 0 | return n_CurrentItemID; |
247 | 0 | } |
248 | | |
249 | | |
250 | | void SAL_CALL UnoControlRoadmapModel::insertByIndex( const sal_Int32 Index, const Any& Element) |
251 | 0 | { |
252 | 0 | if ( ( Index >= ( static_cast<sal_Int32>(maRoadmapItems.size()) + 1 ) ) || (Index < 0)) |
253 | 0 | throw IndexOutOfBoundsException(); |
254 | 0 | Reference< XInterface > xRoadmapItem; |
255 | 0 | Element >>= xRoadmapItem; |
256 | 0 | MakeRMItemValidation( Index, xRoadmapItem); |
257 | 0 | SetRMItemDefaultProperties( xRoadmapItem ); |
258 | 0 | maRoadmapItems.insert( maRoadmapItems.begin() + Index, xRoadmapItem); |
259 | 0 | ContainerEvent aEvent = GetContainerEvent(Index, xRoadmapItem); |
260 | 0 | maContainerListeners.elementInserted( aEvent ); |
261 | 0 | Reference< XPropertySet > xPropertySet( this ); |
262 | 0 | sal_Int16 n_CurrentItemID = GetCurrentItemID( xPropertySet ); |
263 | 0 | if ( Index <= n_CurrentItemID ) |
264 | 0 | { |
265 | 0 | Any aAny(static_cast<sal_Int16>( n_CurrentItemID + 1 ) ); |
266 | 0 | xPropertySet->setPropertyValue( GetPropertyName( BASEPROPERTY_CURRENTITEMID ), aAny ); |
267 | 0 | } |
268 | 0 | } |
269 | | |
270 | | |
271 | | void SAL_CALL UnoControlRoadmapModel::removeByIndex( sal_Int32 Index) |
272 | 0 | { |
273 | 0 | if ((Index < 0) || ( o3tl::make_unsigned(Index) > maRoadmapItems.size())) |
274 | 0 | throw IndexOutOfBoundsException(); |
275 | 0 | Reference< XInterface > xRoadmapItem; |
276 | 0 | maRoadmapItems.erase( maRoadmapItems.begin() + Index ); |
277 | 0 | ContainerEvent aEvent = GetContainerEvent(Index, xRoadmapItem); |
278 | 0 | maContainerListeners.elementRemoved( aEvent ); |
279 | 0 | Reference< XPropertySet > xPropertySet( this ); |
280 | 0 | sal_Int16 n_CurrentItemID = GetCurrentItemID( xPropertySet ); |
281 | 0 | Any aAny; |
282 | 0 | if ( Index > n_CurrentItemID ) |
283 | 0 | return; |
284 | | |
285 | 0 | if ( n_CurrentItemID >= static_cast<sal_Int32>(maRoadmapItems.size()) ) |
286 | 0 | { |
287 | 0 | n_CurrentItemID = sal::static_int_cast< sal_Int16 >( |
288 | 0 | maRoadmapItems.size()-1); |
289 | 0 | if ( n_CurrentItemID < 0 ) |
290 | 0 | return; |
291 | 0 | aAny <<= n_CurrentItemID; |
292 | 0 | } |
293 | 0 | else if (Index == n_CurrentItemID) |
294 | 0 | aAny <<= sal_Int16(-1); |
295 | 0 | else if( Index < n_CurrentItemID) |
296 | 0 | aAny <<= static_cast<sal_Int16>( n_CurrentItemID - 1 ); |
297 | 0 | xPropertySet->setPropertyValue( GetPropertyName( BASEPROPERTY_CURRENTITEMID ), aAny ); |
298 | 0 | } |
299 | | |
300 | | |
301 | | void SAL_CALL UnoControlRoadmapModel::replaceByIndex( const sal_Int32 Index, const Any& Element) |
302 | 0 | { |
303 | 0 | Reference< XInterface > xRoadmapItem; |
304 | 0 | Element >>= xRoadmapItem; |
305 | 0 | MakeRMItemValidation( Index, xRoadmapItem); |
306 | 0 | SetRMItemDefaultProperties( xRoadmapItem ); |
307 | 0 | maRoadmapItems.erase( maRoadmapItems.begin() + Index ); |
308 | 0 | maRoadmapItems.insert( maRoadmapItems.begin() + Index, xRoadmapItem); //push_back( xRoadmapItem ); |
309 | 0 | ContainerEvent aEvent = GetContainerEvent(Index, xRoadmapItem); |
310 | 0 | maContainerListeners.elementReplaced( aEvent ); |
311 | 0 | } |
312 | | |
313 | | |
314 | | Type SAL_CALL UnoControlRoadmapModel::getElementType() |
315 | 0 | { |
316 | 0 | Type aType = cppu::UnoType<XPropertySet>::get(); |
317 | 0 | return aType; |
318 | 0 | } |
319 | | |
320 | | |
321 | | sal_Bool SAL_CALL UnoControlRoadmapModel::hasElements() |
322 | 0 | { |
323 | 0 | return !maRoadmapItems.empty(); |
324 | 0 | } |
325 | | |
326 | | |
327 | | void SAL_CALL UnoControlRoadmapModel::addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) |
328 | 0 | { |
329 | 0 | maContainerListeners.addInterface( xListener ); |
330 | 0 | } |
331 | | |
332 | | void SAL_CALL UnoControlRoadmapModel::removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) |
333 | 0 | { |
334 | 0 | maContainerListeners.removeInterface( xListener ); |
335 | 0 | } |
336 | | |
337 | | |
338 | | // = UnoRoadmapControl |
339 | | |
340 | | |
341 | | UnoRoadmapControl::UnoRoadmapControl() |
342 | 0 | :maItemListeners( *this ) |
343 | 0 | { |
344 | 0 | } |
345 | | |
346 | | IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoRoadmapControl, UnoControlRoadmap_Base, UnoControlRoadmap_IBase ) |
347 | | |
348 | 0 | css::uno::Any UnoRoadmapControl::queryAggregation(css::uno::Type const & aType) { |
349 | 0 | auto ret = UnoControlRoadmap_Base::queryAggregation(aType); |
350 | 0 | if (!ret.hasValue()) { |
351 | 0 | ret = UnoControlRoadmap_IBase::queryInterface(aType); |
352 | 0 | } |
353 | 0 | return ret; |
354 | 0 | } |
355 | | |
356 | | |
357 | | sal_Bool SAL_CALL UnoRoadmapControl::setModel(const Reference< XControlModel >& _rModel) |
358 | 0 | { |
359 | 0 | Reference< XContainer > xC( getModel(), UNO_QUERY ); |
360 | 0 | if ( xC.is() ) |
361 | 0 | xC->removeContainerListener( this ); |
362 | |
|
363 | 0 | bool bReturn = UnoControlBase::setModel( _rModel ); |
364 | |
|
365 | 0 | xC.set(getModel(), css::uno::UNO_QUERY); |
366 | 0 | if ( xC.is() ) |
367 | 0 | xC->addContainerListener( this ); |
368 | |
|
369 | 0 | return bReturn; |
370 | 0 | } |
371 | | |
372 | | |
373 | | OUString UnoRoadmapControl::GetComponentServiceName() const |
374 | 0 | { |
375 | 0 | return u"Roadmap"_ustr; |
376 | 0 | } |
377 | | |
378 | | |
379 | | void UnoRoadmapControl::dispose() |
380 | 0 | { |
381 | 0 | EventObject aEvt; |
382 | 0 | aEvt.Source = getXWeak(); |
383 | 0 | maItemListeners.disposeAndClear( aEvt ); |
384 | 0 | UnoControl::dispose(); |
385 | 0 | } |
386 | | |
387 | | |
388 | | void UnoRoadmapControl::elementInserted( const ContainerEvent& rEvent ) |
389 | 0 | { |
390 | 0 | Reference< XInterface > xRoadmapItem; |
391 | 0 | rEvent.Element >>= xRoadmapItem; |
392 | 0 | Reference< XPropertySet > xRoadmapPropertySet( xRoadmapItem, UNO_QUERY ); |
393 | 0 | if ( xRoadmapPropertySet.is() ) |
394 | 0 | xRoadmapPropertySet->addPropertyChangeListener( OUString(), this ); |
395 | |
|
396 | 0 | Reference< XContainerListener > xPeer(getPeer(), UNO_QUERY); |
397 | 0 | if ( xPeer.is() ) |
398 | 0 | { |
399 | 0 | xPeer->elementInserted( rEvent ); |
400 | 0 | Reference < XPropertySet > xPropertySet( xPeer, UNO_QUERY ); |
401 | 0 | if ( xPropertySet.is() ) |
402 | 0 | xPropertySet->addPropertyChangeListener( OUString(), this ); |
403 | 0 | } |
404 | 0 | } |
405 | | |
406 | | |
407 | | void UnoRoadmapControl::elementRemoved( const ContainerEvent& rEvent ) |
408 | 0 | { |
409 | 0 | Reference< XContainerListener > xPeer(getPeer(), UNO_QUERY); |
410 | 0 | if ( xPeer.is() ) |
411 | 0 | xPeer->elementRemoved( rEvent ); |
412 | 0 | Reference< XInterface > xRoadmapItem; |
413 | 0 | rEvent.Element >>= xRoadmapItem; |
414 | 0 | Reference< XPropertySet > xPropertySet( xRoadmapItem, UNO_QUERY ); |
415 | 0 | if ( xPropertySet.is() ) |
416 | 0 | xPropertySet->removePropertyChangeListener( OUString(), this ); |
417 | 0 | } |
418 | | |
419 | | |
420 | | void UnoRoadmapControl::elementReplaced( const ContainerEvent& rEvent ) |
421 | 0 | { |
422 | 0 | Reference< XContainerListener > xPeer(getPeer(), UNO_QUERY); |
423 | 0 | if ( xPeer.is() ) |
424 | 0 | xPeer->elementReplaced( rEvent ); |
425 | 0 | } |
426 | | |
427 | | |
428 | | void SAL_CALL UnoRoadmapControl::itemStateChanged( const ItemEvent& rEvent ) |
429 | 0 | { |
430 | 0 | sal_Int16 CurItemIndex = sal::static_int_cast< sal_Int16 >(rEvent.ItemId); |
431 | 0 | Reference< XControlModel > xModel = getModel( ); |
432 | 0 | Reference< XPropertySet > xPropertySet( xModel, UNO_QUERY ); |
433 | 0 | xPropertySet->setPropertyValue( GetPropertyName( BASEPROPERTY_CURRENTITEMID ), Any(CurItemIndex) ); |
434 | 0 | if ( maItemListeners.getLength() ) |
435 | 0 | maItemListeners.itemStateChanged( rEvent ); |
436 | 0 | } |
437 | | |
438 | | |
439 | | void SAL_CALL UnoRoadmapControl::addItemListener( const Reference< XItemListener >& l ) |
440 | 0 | { |
441 | 0 | maItemListeners.addInterface( l ); |
442 | 0 | if( getPeer().is() && maItemListeners.getLength() == 1 ) |
443 | 0 | { |
444 | 0 | Reference < XItemEventBroadcaster > xRoadmap( getPeer(), UNO_QUERY ); |
445 | 0 | xRoadmap->addItemListener( this ); |
446 | 0 | } |
447 | 0 | } |
448 | | |
449 | | |
450 | | void SAL_CALL UnoRoadmapControl::removeItemListener( const Reference< XItemListener >& l ) |
451 | 0 | { |
452 | 0 | if( getPeer().is() && maItemListeners.getLength() == 1 ) |
453 | 0 | { |
454 | 0 | Reference < XItemEventBroadcaster > xRoadmap( getPeer(), UNO_QUERY ); |
455 | 0 | xRoadmap->removeItemListener( this ); |
456 | 0 | } |
457 | |
|
458 | 0 | maItemListeners.removeInterface( l ); |
459 | 0 | } |
460 | | |
461 | | |
462 | | void SAL_CALL UnoRoadmapControl::propertyChange( const PropertyChangeEvent& evt ) |
463 | 0 | { |
464 | 0 | Reference< XPropertyChangeListener > xPeer(getPeer(), UNO_QUERY); |
465 | 0 | if ( xPeer.is() ) |
466 | 0 | xPeer->propertyChange( evt ); |
467 | 0 | } |
468 | | |
469 | | OUString UnoRoadmapControl::getImplementationName() |
470 | 0 | { |
471 | 0 | return u"stardiv.Toolkit.UnoRoadmapControl"_ustr; |
472 | 0 | } |
473 | | |
474 | | css::uno::Sequence<OUString> UnoRoadmapControl::getSupportedServiceNames() |
475 | 0 | { |
476 | 0 | auto s(UnoControlBase::getSupportedServiceNames()); |
477 | 0 | s.realloc(s.getLength() + 2); |
478 | 0 | auto ps = s.getArray(); |
479 | 0 | ps[s.getLength() - 2] = "com.sun.star.awt.UnoControlRoadmap"; |
480 | 0 | ps[s.getLength() - 1] = "stardiv.vcl.control.Roadmap"; |
481 | 0 | return s; |
482 | 0 | } |
483 | | |
484 | | } |
485 | | |
486 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
487 | | stardiv_Toolkit_UnoControlRoadmapModel_get_implementation( |
488 | | css::uno::XComponentContext *context, |
489 | | css::uno::Sequence<css::uno::Any> const &) |
490 | 0 | { |
491 | 0 | return cppu::acquire(new toolkit::UnoControlRoadmapModel(context)); |
492 | 0 | } |
493 | | |
494 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
495 | | stardiv_Toolkit_UnoRoadmapControl_get_implementation( |
496 | | css::uno::XComponentContext *, |
497 | | css::uno::Sequence<css::uno::Any> const &) |
498 | 0 | { |
499 | 0 | return cppu::acquire(new toolkit::UnoRoadmapControl()); |
500 | 0 | } |
501 | | |
502 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |