/src/libreoffice/toolkit/source/controls/unocontrols.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 | | #include <com/sun/star/awt/XTextArea.hpp> |
21 | | #include <com/sun/star/awt/XVclWindowPeer.hpp> |
22 | | #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> |
23 | | #include <com/sun/star/uno/XComponentContext.hpp> |
24 | | #include <com/sun/star/awt/VisualEffect.hpp> |
25 | | #include <com/sun/star/awt/LineEndFormat.hpp> |
26 | | #include <com/sun/star/graphic/GraphicProvider.hpp> |
27 | | #include <com/sun/star/graphic/XGraphicProvider.hpp> |
28 | | #include <com/sun/star/util/Date.hpp> |
29 | | #include <com/sun/star/awt/ImageScaleMode.hpp> |
30 | | |
31 | | #include <o3tl/safeint.hxx> |
32 | | #include <controls/formattedcontrol.hxx> |
33 | | #include <toolkit/controls/unocontrols.hxx> |
34 | | #include <tools/urlobj.hxx> |
35 | | #include <helper/property.hxx> |
36 | | #include <toolkit/helper/macros.hxx> |
37 | | #include <unotools/securityoptions.hxx> |
38 | | |
39 | | // for introspection |
40 | | #include <awt/vclxwindows.hxx> |
41 | | #include <cppuhelper/typeprovider.hxx> |
42 | | #include <cppuhelper/queryinterface.hxx> |
43 | | #include <comphelper/processfactory.hxx> |
44 | | #include <comphelper/propertyvalue.hxx> |
45 | | #include <tools/debug.hxx> |
46 | | #include <comphelper/diagnose_ex.hxx> |
47 | | |
48 | | #include <algorithm> |
49 | | |
50 | | #include <helper/imagealign.hxx> |
51 | | #include <helper/unopropertyarrayhelper.hxx> |
52 | | #include <utility> |
53 | | |
54 | | using namespace css; |
55 | | using namespace css::awt; |
56 | | using namespace css::lang; |
57 | | using namespace css::uno; |
58 | | using ::com::sun::star::graphic::XGraphic; |
59 | | using ::com::sun::star::uno::Reference; |
60 | | using namespace ::toolkit; |
61 | | |
62 | | uno::Reference< graphic::XGraphic > |
63 | | ImageHelper::getGraphicAndGraphicObjectFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& xOutGraphicObj, const OUString& _rURL ) |
64 | 0 | { |
65 | 0 | xOutGraphicObj = nullptr; |
66 | 0 | return ImageHelper::getGraphicFromURL_nothrow( _rURL, u""_ustr ); |
67 | 0 | } |
68 | | |
69 | | css::uno::Reference< css::graphic::XGraphic > |
70 | | ImageHelper::getGraphicFromURL_nothrow( const OUString& _rURL, OUString const & referer ) |
71 | 0 | { |
72 | 0 | uno::Reference< graphic::XGraphic > xGraphic; |
73 | 0 | if (_rURL.isEmpty() || SvtSecurityOptions::isUntrustedReferer(referer) || INetURLObject(_rURL).IsExoticProtocol()) |
74 | 0 | return xGraphic; |
75 | | |
76 | 0 | try |
77 | 0 | { |
78 | 0 | const uno::Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); |
79 | 0 | uno::Reference< graphic::XGraphicProvider > xProvider( graphic::GraphicProvider::create(xContext) ); |
80 | 0 | xGraphic = xProvider->queryGraphic({ comphelper::makePropertyValue(u"URL"_ustr, _rURL) }); |
81 | 0 | } |
82 | 0 | catch (const Exception&) |
83 | 0 | { |
84 | 0 | DBG_UNHANDLED_EXCEPTION("toolkit.controls"); |
85 | 0 | } |
86 | |
|
87 | 0 | return xGraphic; |
88 | 0 | } |
89 | | |
90 | | |
91 | | UnoControlEditModel::UnoControlEditModel( const Reference< XComponentContext >& rxContext ) |
92 | 0 | :UnoControlModel( rxContext ) |
93 | 0 | { |
94 | 0 | UNO_CONTROL_MODEL_REGISTER_PROPERTIES<VCLXEdit>(); |
95 | 0 | } Unexecuted instantiation: UnoControlEditModel::UnoControlEditModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: UnoControlEditModel::UnoControlEditModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
96 | | |
97 | | OUString UnoControlEditModel::getServiceName( ) |
98 | 0 | { |
99 | 0 | return u"stardiv.vcl.controlmodel.Edit"_ustr; |
100 | 0 | } |
101 | | |
102 | | uno::Any UnoControlEditModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const |
103 | 0 | { |
104 | 0 | uno::Any aReturn; |
105 | |
|
106 | 0 | switch ( nPropId ) |
107 | 0 | { |
108 | 0 | case BASEPROPERTY_LINE_END_FORMAT: |
109 | 0 | aReturn <<= sal_Int16(awt::LineEndFormat::LINE_FEED); // LF |
110 | 0 | break; |
111 | 0 | case BASEPROPERTY_DEFAULTCONTROL: |
112 | 0 | aReturn <<= u"stardiv.vcl.control.Edit"_ustr; |
113 | 0 | break; |
114 | 0 | default: |
115 | 0 | aReturn = UnoControlModel::ImplGetDefaultValue( nPropId ); |
116 | 0 | break; |
117 | 0 | } |
118 | 0 | return aReturn; |
119 | 0 | } |
120 | | |
121 | | ::cppu::IPropertyArrayHelper& UnoControlEditModel::getInfoHelper() |
122 | 0 | { |
123 | 0 | static UnoPropertyArrayHelper aHelper( ImplGetPropertyIds() ); |
124 | 0 | return aHelper; |
125 | 0 | } |
126 | | |
127 | | // beans::XMultiPropertySet |
128 | | uno::Reference< beans::XPropertySetInfo > UnoControlEditModel::getPropertySetInfo( ) |
129 | 0 | { |
130 | 0 | static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); |
131 | 0 | return xInfo; |
132 | 0 | } |
133 | | |
134 | | OUString UnoControlEditModel::getImplementationName() |
135 | 0 | { |
136 | 0 | return u"stardiv.Toolkit.UnoControlEditModel"_ustr; |
137 | 0 | } |
138 | | |
139 | | css::uno::Sequence<OUString> UnoControlEditModel::getSupportedServiceNames() |
140 | 0 | { |
141 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlEditModel"_ustr, u"stardiv.vcl.controlmodel.Edit"_ustr }; |
142 | 0 | return comphelper::concatSequences(UnoControlModel::getSupportedServiceNames(), vals); |
143 | 0 | } |
144 | | |
145 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
146 | | stardiv_Toolkit_UnoControlEditModel_get_implementation( |
147 | | css::uno::XComponentContext *context, |
148 | | css::uno::Sequence<css::uno::Any> const &) |
149 | 0 | { |
150 | 0 | return cppu::acquire(new UnoControlEditModel(context)); |
151 | 0 | } |
152 | | |
153 | | |
154 | | |
155 | | UnoEditControl::UnoEditControl() |
156 | 0 | :maTextListeners( *this ) |
157 | 0 | ,mnMaxTextLen( 0 ) |
158 | 0 | ,mbSetTextInPeer( false ) |
159 | 0 | ,mbSetMaxTextLenInPeer( false ) |
160 | 0 | ,mbHasTextProperty( false ) |
161 | 0 | { |
162 | 0 | maComponentInfos.nWidth = 100; |
163 | 0 | maComponentInfos.nHeight = 12; |
164 | 0 | } |
165 | | |
166 | | uno::Any SAL_CALL UnoEditControl::queryAggregation( const uno::Type & rType ) |
167 | 0 | { |
168 | 0 | uno::Any aReturn = UnoControlBase::queryAggregation( rType ); |
169 | 0 | if ( !aReturn.hasValue() ) |
170 | 0 | aReturn = UnoEditControl_Base::queryInterface( rType ); |
171 | 0 | return aReturn; |
172 | 0 | } |
173 | | |
174 | | uno::Any SAL_CALL UnoEditControl::queryInterface( const uno::Type & rType ) |
175 | 0 | { |
176 | 0 | return UnoControlBase::queryInterface( rType ); |
177 | 0 | } |
178 | | |
179 | | void SAL_CALL UnoEditControl::acquire( ) noexcept |
180 | 0 | { |
181 | 0 | UnoControlBase::acquire(); |
182 | 0 | } |
183 | | |
184 | | void SAL_CALL UnoEditControl::release( ) noexcept |
185 | 0 | { |
186 | 0 | UnoControlBase::release(); |
187 | 0 | } |
188 | | |
189 | | IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoEditControl, UnoControlBase, UnoEditControl_Base ) |
190 | | |
191 | | OUString UnoEditControl::GetComponentServiceName() const |
192 | 0 | { |
193 | | // by default, we want a simple edit field |
194 | 0 | OUString sName( u"Edit"_ustr ); |
195 | | |
196 | | // but maybe we are to display multi-line text? |
197 | 0 | uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_MULTILINE ) ); |
198 | 0 | bool b = bool(); |
199 | 0 | if ( ( aVal >>= b ) && b ) |
200 | 0 | sName = "MultiLineEdit"; |
201 | |
|
202 | 0 | return sName; |
203 | 0 | } |
204 | | |
205 | | sal_Bool SAL_CALL UnoEditControl::setModel(const uno::Reference< awt::XControlModel >& _rModel) |
206 | 0 | { |
207 | 0 | bool bReturn = UnoControlBase::setModel( _rModel ); |
208 | 0 | mbHasTextProperty = ImplHasProperty( BASEPROPERTY_TEXT ); |
209 | 0 | return bReturn; |
210 | 0 | } |
211 | | |
212 | | void UnoEditControl::ImplSetPeerProperty( const OUString& rPropName, const uno::Any& rVal ) |
213 | 0 | { |
214 | 0 | bool bDone = false; |
215 | 0 | if ( GetPropertyId( rPropName ) == BASEPROPERTY_TEXT ) |
216 | 0 | { |
217 | | // #96986# use setText(), or text listener will not be called. |
218 | 0 | uno::Reference < awt::XTextComponent > xTextComponent( getPeer(), uno::UNO_QUERY ); |
219 | 0 | if ( xTextComponent.is() ) |
220 | 0 | { |
221 | 0 | OUString sText; |
222 | 0 | rVal >>= sText; |
223 | 0 | ImplCheckLocalize( sText ); |
224 | 0 | xTextComponent->setText( sText ); |
225 | 0 | bDone = true; |
226 | 0 | } |
227 | 0 | } |
228 | |
|
229 | 0 | if ( !bDone ) |
230 | 0 | UnoControlBase::ImplSetPeerProperty( rPropName, rVal ); |
231 | 0 | } |
232 | | |
233 | | void UnoEditControl::dispose() |
234 | 0 | { |
235 | 0 | lang::EventObject aEvt( *this ); |
236 | 0 | maTextListeners.disposeAndClear( aEvt ); |
237 | 0 | UnoControl::dispose(); |
238 | 0 | } |
239 | | |
240 | | void UnoEditControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) |
241 | 0 | { |
242 | 0 | UnoControl::createPeer( rxToolkit, rParentPeer ); |
243 | |
|
244 | 0 | uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY ); |
245 | 0 | if ( xText.is() ) |
246 | 0 | { |
247 | 0 | xText->addTextListener( this ); |
248 | |
|
249 | 0 | if ( mbSetMaxTextLenInPeer ) |
250 | 0 | xText->setMaxTextLen( mnMaxTextLen ); |
251 | 0 | if ( mbSetTextInPeer ) |
252 | 0 | xText->setText( maText ); |
253 | 0 | } |
254 | 0 | } |
255 | | |
256 | | void UnoEditControl::textChanged(const awt::TextEvent& e) |
257 | 0 | { |
258 | 0 | uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY ); |
259 | |
|
260 | 0 | if ( mbHasTextProperty ) |
261 | 0 | { |
262 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TEXT ), uno::Any(xText->getText()), false ); |
263 | 0 | } |
264 | 0 | else |
265 | 0 | { |
266 | 0 | maText = xText->getText(); |
267 | 0 | } |
268 | |
|
269 | 0 | if ( maTextListeners.getLength() ) |
270 | 0 | maTextListeners.textChanged( e ); |
271 | 0 | } |
272 | | |
273 | | void UnoEditControl::addTextListener(const uno::Reference< awt::XTextListener > & l) |
274 | 0 | { |
275 | | // tdf#150974 some extensions pass null |
276 | 0 | if (!l) |
277 | 0 | { |
278 | 0 | SAL_WARN("toolkit", "null XTextListener"); |
279 | 0 | return; |
280 | 0 | } |
281 | 0 | maTextListeners.addInterface( l ); |
282 | 0 | } |
283 | | |
284 | | void UnoEditControl::removeTextListener(const uno::Reference< awt::XTextListener > & l) |
285 | 0 | { |
286 | | // tdf#150974 some extensions pass null |
287 | 0 | if (!l) |
288 | 0 | { |
289 | 0 | SAL_WARN("toolkit", "null XTextListener"); |
290 | 0 | return; |
291 | 0 | } |
292 | 0 | maTextListeners.removeInterface( l ); |
293 | 0 | } |
294 | | |
295 | | void UnoEditControl::setText( const OUString& aText ) |
296 | 0 | { |
297 | 0 | if ( mbHasTextProperty ) |
298 | 0 | { |
299 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TEXT ), uno::Any(aText), true ); |
300 | 0 | } |
301 | 0 | else |
302 | 0 | { |
303 | 0 | maText = aText; |
304 | 0 | mbSetTextInPeer = true; |
305 | 0 | uno::Reference < awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY ); |
306 | 0 | if ( xText.is() ) |
307 | 0 | xText->setText( maText ); |
308 | 0 | } |
309 | | |
310 | | // Setting the property to the VCLXWindow doesn't call textChanged |
311 | 0 | if ( maTextListeners.getLength() ) |
312 | 0 | { |
313 | 0 | awt::TextEvent aEvent; |
314 | 0 | aEvent.Source = *this; |
315 | 0 | maTextListeners.textChanged( aEvent ); |
316 | 0 | } |
317 | 0 | } |
318 | | |
319 | | namespace |
320 | | { |
321 | | void lcl_normalize( awt::Selection& _rSel ) |
322 | 0 | { |
323 | 0 | if ( _rSel.Min > _rSel.Max ) |
324 | 0 | ::std::swap( _rSel.Min, _rSel.Max ); |
325 | 0 | } |
326 | | } |
327 | | |
328 | | void UnoEditControl::insertText( const awt::Selection& rSel, const OUString& rNewText ) |
329 | 0 | { |
330 | | // normalize the selection - OUString::replaceAt has a strange behaviour if the min is greater than the max |
331 | 0 | awt::Selection aSelection( rSel ); |
332 | 0 | lcl_normalize( aSelection ); |
333 | |
|
334 | 0 | OUString aOldText = getText(); |
335 | 0 | if (aSelection.Min < 0 || aOldText.getLength() < aSelection.Max) |
336 | 0 | { |
337 | 0 | throw lang::IllegalArgumentException(); |
338 | 0 | } |
339 | | |
340 | | // preserve the selection resp. cursor position |
341 | 0 | awt::Selection aNewSelection( getSelection() ); |
342 | | #ifdef ALSO_PRESERVE_COMPLETE_SELECTION |
343 | | // (not sure - looks uglier ...) |
344 | | sal_Int32 nDeletedCharacters = ( aSelection.Max - aSelection.Min ) - rNewText.getLength(); |
345 | | if ( aNewSelection.Min > aSelection.Min ) |
346 | | aNewSelection.Min -= nDeletedCharacters; |
347 | | if ( aNewSelection.Max > aSelection.Max ) |
348 | | aNewSelection.Max -= nDeletedCharacters; |
349 | | #else |
350 | 0 | aNewSelection.Max = ::std::min( aNewSelection.Min, aNewSelection.Max ) + rNewText.getLength(); |
351 | 0 | aNewSelection.Min = aNewSelection.Max; |
352 | 0 | #endif |
353 | |
|
354 | 0 | OUString aNewText = aOldText.replaceAt( aSelection.Min, aSelection.Max - aSelection.Min, rNewText ); |
355 | 0 | setText( aNewText ); |
356 | |
|
357 | 0 | setSelection( aNewSelection ); |
358 | 0 | } |
359 | | |
360 | | OUString UnoEditControl::getText() |
361 | 0 | { |
362 | 0 | OUString aText = maText; |
363 | |
|
364 | 0 | if ( mbHasTextProperty ) |
365 | 0 | aText = ImplGetPropertyValue_UString( BASEPROPERTY_TEXT ); |
366 | 0 | else |
367 | 0 | { |
368 | 0 | uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY ); |
369 | 0 | if ( xText.is() ) |
370 | 0 | aText = xText->getText(); |
371 | 0 | } |
372 | |
|
373 | 0 | return aText; |
374 | 0 | } |
375 | | |
376 | | OUString UnoEditControl::getSelectedText() |
377 | 0 | { |
378 | 0 | OUString sSelected; |
379 | 0 | uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY ); |
380 | 0 | if ( xText.is() ) |
381 | 0 | sSelected = xText->getSelectedText(); |
382 | |
|
383 | 0 | return sSelected; |
384 | 0 | } |
385 | | |
386 | | void UnoEditControl::setSelection( const awt::Selection& aSelection ) |
387 | 0 | { |
388 | 0 | uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY ); |
389 | 0 | if ( xText.is() ) |
390 | 0 | xText->setSelection( aSelection ); |
391 | 0 | } |
392 | | |
393 | | awt::Selection UnoEditControl::getSelection() |
394 | 0 | { |
395 | 0 | awt::Selection aSel; |
396 | 0 | uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY ); |
397 | 0 | if ( xText.is() ) |
398 | 0 | aSel = xText->getSelection(); |
399 | 0 | return aSel; |
400 | 0 | } |
401 | | |
402 | | sal_Bool UnoEditControl::isEditable() |
403 | 0 | { |
404 | 0 | return !ImplGetPropertyValue_BOOL( BASEPROPERTY_READONLY ); |
405 | 0 | } |
406 | | |
407 | | void UnoEditControl::setEditable( sal_Bool bEditable ) |
408 | 0 | { |
409 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_READONLY ), uno::Any(!bEditable), true ); |
410 | 0 | } |
411 | | |
412 | | sal_Int16 UnoEditControl::getMaxTextLen() |
413 | 0 | { |
414 | 0 | sal_Int16 nMaxLen = mnMaxTextLen; |
415 | |
|
416 | 0 | if ( ImplHasProperty( BASEPROPERTY_MAXTEXTLEN ) ) |
417 | 0 | nMaxLen = ImplGetPropertyValue_INT16( BASEPROPERTY_MAXTEXTLEN ); |
418 | |
|
419 | 0 | return nMaxLen; |
420 | 0 | } |
421 | | |
422 | | void UnoEditControl::setMaxTextLen( sal_Int16 nLen ) |
423 | 0 | { |
424 | 0 | if ( ImplHasProperty( BASEPROPERTY_MAXTEXTLEN) ) |
425 | 0 | { |
426 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MAXTEXTLEN ), uno::Any(nLen), true ); |
427 | 0 | } |
428 | 0 | else |
429 | 0 | { |
430 | 0 | mnMaxTextLen = nLen; |
431 | 0 | mbSetMaxTextLenInPeer = true; |
432 | 0 | uno::Reference < awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY ); |
433 | 0 | if ( xText.is() ) |
434 | 0 | xText->setMaxTextLen( mnMaxTextLen ); |
435 | 0 | } |
436 | 0 | } |
437 | | |
438 | | awt::Size UnoEditControl::getMinimumSize( ) |
439 | 0 | { |
440 | 0 | return Impl_getMinimumSize(); |
441 | 0 | } |
442 | | |
443 | | awt::Size UnoEditControl::getPreferredSize( ) |
444 | 0 | { |
445 | 0 | return Impl_getPreferredSize(); |
446 | 0 | } |
447 | | |
448 | | awt::Size UnoEditControl::calcAdjustedSize( const awt::Size& rNewSize ) |
449 | 0 | { |
450 | 0 | return Impl_calcAdjustedSize( rNewSize ); |
451 | 0 | } |
452 | | |
453 | | awt::Size UnoEditControl::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) |
454 | 0 | { |
455 | 0 | return Impl_getMinimumSize( nCols, nLines ); |
456 | 0 | } |
457 | | |
458 | | void UnoEditControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) |
459 | 0 | { |
460 | 0 | Impl_getColumnsAndLines( nCols, nLines ); |
461 | 0 | } |
462 | | |
463 | | OUString UnoEditControl::getImplementationName( ) |
464 | 0 | { |
465 | 0 | return u"stardiv.Toolkit.UnoEditControl"_ustr; |
466 | 0 | } |
467 | | |
468 | | uno::Sequence< OUString > UnoEditControl::getSupportedServiceNames() |
469 | 0 | { |
470 | 0 | css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlEdit"_ustr, u"stardiv.vcl.control.Edit"_ustr }; |
471 | 0 | return comphelper::concatSequences( UnoControlBase::getSupportedServiceNames( ), vals); |
472 | 0 | } |
473 | | |
474 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
475 | | stardiv_Toolkit_UnoEditControl_get_implementation( |
476 | | css::uno::XComponentContext *, |
477 | | css::uno::Sequence<css::uno::Any> const &) |
478 | 0 | { |
479 | 0 | return cppu::acquire(new UnoEditControl()); |
480 | 0 | } |
481 | | |
482 | | |
483 | | |
484 | | UnoControlFileControlModel::UnoControlFileControlModel( const Reference< XComponentContext >& rxContext ) |
485 | 0 | :UnoControlModel( rxContext ) |
486 | 0 | { |
487 | 0 | ImplRegisterProperty( BASEPROPERTY_ALIGN ); |
488 | 0 | ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); |
489 | 0 | ImplRegisterProperty( BASEPROPERTY_BORDER ); |
490 | 0 | ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR ); |
491 | 0 | ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); |
492 | 0 | ImplRegisterProperty( BASEPROPERTY_ENABLED ); |
493 | 0 | ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE ); |
494 | 0 | ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); |
495 | 0 | ImplRegisterProperty( BASEPROPERTY_HELPTEXT ); |
496 | 0 | ImplRegisterProperty( BASEPROPERTY_HELPURL ); |
497 | 0 | ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); |
498 | 0 | ImplRegisterProperty( BASEPROPERTY_READONLY ); |
499 | 0 | ImplRegisterProperty( BASEPROPERTY_TABSTOP ); |
500 | 0 | ImplRegisterProperty( BASEPROPERTY_TEXT ); |
501 | 0 | ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN ); |
502 | 0 | ImplRegisterProperty( BASEPROPERTY_WRITING_MODE ); |
503 | 0 | ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE ); |
504 | 0 | ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION ); |
505 | 0 | } Unexecuted instantiation: UnoControlFileControlModel::UnoControlFileControlModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: UnoControlFileControlModel::UnoControlFileControlModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
506 | | |
507 | | OUString UnoControlFileControlModel::getServiceName() |
508 | 0 | { |
509 | 0 | return u"stardiv.vcl.controlmodel.FileControl"_ustr; |
510 | 0 | } |
511 | | |
512 | | uno::Any UnoControlFileControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const |
513 | 0 | { |
514 | 0 | if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) |
515 | 0 | { |
516 | 0 | return uno::Any( u"stardiv.vcl.control.FileControl"_ustr ); |
517 | 0 | } |
518 | 0 | return UnoControlModel::ImplGetDefaultValue( nPropId ); |
519 | 0 | } |
520 | | |
521 | | ::cppu::IPropertyArrayHelper& UnoControlFileControlModel::getInfoHelper() |
522 | 0 | { |
523 | 0 | static UnoPropertyArrayHelper aHelper( ImplGetPropertyIds() ); |
524 | 0 | return aHelper; |
525 | 0 | } |
526 | | |
527 | | // beans::XMultiPropertySet |
528 | | uno::Reference< beans::XPropertySetInfo > UnoControlFileControlModel::getPropertySetInfo( ) |
529 | 0 | { |
530 | 0 | static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); |
531 | 0 | return xInfo; |
532 | 0 | } |
533 | | |
534 | | OUString UnoControlFileControlModel::getImplementationName() |
535 | 0 | { |
536 | 0 | return u"stardiv.Toolkit.UnoControlFileControlModel"_ustr; |
537 | 0 | } |
538 | | |
539 | | css::uno::Sequence<OUString> |
540 | | UnoControlFileControlModel::getSupportedServiceNames() |
541 | 0 | { |
542 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlFileControlModel"_ustr, u"stardiv.vcl.controlmodel.FileControl"_ustr }; |
543 | 0 | return comphelper::concatSequences( UnoControlModel::getSupportedServiceNames(), vals); |
544 | 0 | } |
545 | | |
546 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
547 | | stardiv_Toolkit_UnoControlFileControlModel_get_implementation( |
548 | | css::uno::XComponentContext *context, |
549 | | css::uno::Sequence<css::uno::Any> const &) |
550 | 0 | { |
551 | 0 | return cppu::acquire(new UnoControlFileControlModel(context)); |
552 | 0 | } |
553 | | |
554 | | |
555 | | |
556 | | UnoFileControl::UnoFileControl() |
557 | 0 | { |
558 | 0 | } |
559 | | |
560 | | OUString UnoFileControl::GetComponentServiceName() const |
561 | 0 | { |
562 | 0 | return u"filecontrol"_ustr; |
563 | 0 | } |
564 | | |
565 | | OUString UnoFileControl::getImplementationName() |
566 | 0 | { |
567 | 0 | return u"stardiv.Toolkit.UnoFileControl"_ustr; |
568 | 0 | } |
569 | | |
570 | | css::uno::Sequence<OUString> UnoFileControl::getSupportedServiceNames() |
571 | 0 | { |
572 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlFileControl"_ustr, u"stardiv.vcl.control.FileControl"_ustr }; |
573 | 0 | return comphelper::concatSequences( UnoEditControl::getSupportedServiceNames(), vals ); |
574 | 0 | } |
575 | | |
576 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
577 | | stardiv_Toolkit_UnoFileControl_get_implementation( |
578 | | css::uno::XComponentContext *, |
579 | | css::uno::Sequence<css::uno::Any> const &) |
580 | 0 | { |
581 | 0 | return cppu::acquire(new UnoFileControl()); |
582 | 0 | } |
583 | | |
584 | | |
585 | | |
586 | | uno::Any GraphicControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const |
587 | 0 | { |
588 | 0 | if ( nPropId == BASEPROPERTY_GRAPHIC ) |
589 | 0 | return uno::Any( uno::Reference< graphic::XGraphic >() ); |
590 | | |
591 | 0 | return UnoControlModel::ImplGetDefaultValue( nPropId ); |
592 | 0 | } |
593 | | |
594 | | void GraphicControlModel::setFastPropertyValue_NoBroadcast( std::unique_lock<std::mutex>& rGuard, sal_Int32 nHandle, const css::uno::Any& rValue ) |
595 | 0 | { |
596 | 0 | UnoControlModel::setFastPropertyValue_NoBroadcast( rGuard, nHandle, rValue ); |
597 | | |
598 | | // - ImageAlign and ImagePosition need to correspond to each other |
599 | | // - Graphic and ImageURL need to correspond to each other |
600 | 0 | try |
601 | 0 | { |
602 | 0 | switch ( nHandle ) |
603 | 0 | { |
604 | 0 | case BASEPROPERTY_IMAGEURL: |
605 | 0 | if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_GRAPHIC ) ) |
606 | 0 | { |
607 | 0 | mbAdjustingGraphic = true; |
608 | 0 | OUString sImageURL; |
609 | 0 | OSL_VERIFY( rValue >>= sImageURL ); |
610 | 0 | css::uno::Any any; |
611 | 0 | getFastPropertyValue(rGuard, any, BASEPROPERTY_REFERER); |
612 | 0 | OUString referer; |
613 | 0 | any >>= referer; |
614 | 0 | setDependentFastPropertyValue( rGuard, BASEPROPERTY_GRAPHIC, uno::Any( ImageHelper::getGraphicFromURL_nothrow( sImageURL, referer ) ) ); |
615 | 0 | mbAdjustingGraphic = false; |
616 | 0 | } |
617 | 0 | break; |
618 | | |
619 | 0 | case BASEPROPERTY_GRAPHIC: |
620 | 0 | if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_IMAGEURL ) ) |
621 | 0 | { |
622 | 0 | mbAdjustingGraphic = true; |
623 | 0 | setDependentFastPropertyValue( rGuard, BASEPROPERTY_IMAGEURL, uno::Any( OUString() ) ); |
624 | 0 | mbAdjustingGraphic = false; |
625 | 0 | } |
626 | 0 | break; |
627 | | |
628 | 0 | case BASEPROPERTY_IMAGEALIGN: |
629 | 0 | if ( !mbAdjustingImagePosition && ImplHasProperty( BASEPROPERTY_IMAGEPOSITION ) ) |
630 | 0 | { |
631 | 0 | mbAdjustingImagePosition = true; |
632 | 0 | sal_Int16 nUNOValue = 0; |
633 | 0 | OSL_VERIFY( rValue >>= nUNOValue ); |
634 | 0 | setDependentFastPropertyValue( rGuard, BASEPROPERTY_IMAGEPOSITION, uno::Any( getExtendedImagePosition( nUNOValue ) ) ); |
635 | 0 | mbAdjustingImagePosition = false; |
636 | 0 | } |
637 | 0 | break; |
638 | 0 | case BASEPROPERTY_IMAGEPOSITION: |
639 | 0 | if ( !mbAdjustingImagePosition && ImplHasProperty( BASEPROPERTY_IMAGEALIGN ) ) |
640 | 0 | { |
641 | 0 | mbAdjustingImagePosition = true; |
642 | 0 | sal_Int16 nUNOValue = 0; |
643 | 0 | OSL_VERIFY( rValue >>= nUNOValue ); |
644 | 0 | setDependentFastPropertyValue( rGuard, BASEPROPERTY_IMAGEALIGN, uno::Any( getCompatibleImageAlign( translateImagePosition( nUNOValue ) ) ) ); |
645 | 0 | mbAdjustingImagePosition = false; |
646 | 0 | } |
647 | 0 | break; |
648 | 0 | } |
649 | 0 | } |
650 | 0 | catch( const css::uno::Exception& ) |
651 | 0 | { |
652 | 0 | DBG_UNHANDLED_EXCEPTION("toolkit.controls"); |
653 | 0 | OSL_FAIL( "GraphicControlModel::setFastPropertyValue_NoBroadcast: caught an exception while aligning the ImagePosition/ImageAlign properties!" ); |
654 | 0 | mbAdjustingImagePosition = false; |
655 | 0 | } |
656 | 0 | } |
657 | | |
658 | | |
659 | | |
660 | | UnoControlButtonModel::UnoControlButtonModel( const Reference< XComponentContext >& rxContext ) |
661 | 0 | :GraphicControlModel( rxContext ) |
662 | 0 | { |
663 | 0 | UNO_CONTROL_MODEL_REGISTER_PROPERTIES<VCLXButton>(); |
664 | |
|
665 | 0 | osl_atomic_increment( &m_refCount ); |
666 | 0 | { |
667 | 0 | std::unique_lock aGuard(m_aMutex); |
668 | 0 | setFastPropertyValue_NoBroadcast( aGuard, BASEPROPERTY_IMAGEPOSITION, ImplGetDefaultValue( BASEPROPERTY_IMAGEPOSITION ) ); |
669 | | // this ensures that our ImagePosition is consistent with our ImageAlign property (since both |
670 | | // defaults are not per se consistent), since both are coupled in setFastPropertyValue_NoBroadcast |
671 | 0 | } |
672 | 0 | osl_atomic_decrement( &m_refCount ); |
673 | 0 | } Unexecuted instantiation: UnoControlButtonModel::UnoControlButtonModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: UnoControlButtonModel::UnoControlButtonModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
674 | | |
675 | | OUString UnoControlButtonModel::getServiceName() |
676 | 0 | { |
677 | 0 | return u"stardiv.vcl.controlmodel.Button"_ustr; |
678 | 0 | } |
679 | | |
680 | | uno::Any UnoControlButtonModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const |
681 | 0 | { |
682 | 0 | switch ( nPropId ) |
683 | 0 | { |
684 | 0 | case BASEPROPERTY_DEFAULTCONTROL: |
685 | 0 | return uno::Any( u"stardiv.vcl.control.Button"_ustr ); |
686 | 0 | case BASEPROPERTY_TOGGLE: |
687 | 0 | return uno::Any( false ); |
688 | 0 | case BASEPROPERTY_ALIGN: |
689 | 0 | return uno::Any( sal_Int16(PROPERTY_ALIGN_CENTER) ); |
690 | 0 | case BASEPROPERTY_FOCUSONCLICK: |
691 | 0 | return uno::Any( true ); |
692 | 0 | } |
693 | | |
694 | 0 | return GraphicControlModel::ImplGetDefaultValue( nPropId ); |
695 | 0 | } |
696 | | |
697 | | ::cppu::IPropertyArrayHelper& UnoControlButtonModel::getInfoHelper() |
698 | 0 | { |
699 | 0 | static UnoPropertyArrayHelper aHelper( ImplGetPropertyIds() ); |
700 | 0 | return aHelper; |
701 | 0 | } |
702 | | |
703 | | // beans::XMultiPropertySet |
704 | | uno::Reference< beans::XPropertySetInfo > UnoControlButtonModel::getPropertySetInfo( ) |
705 | 0 | { |
706 | 0 | static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); |
707 | 0 | return xInfo; |
708 | 0 | } |
709 | | |
710 | | OUString UnoControlButtonModel::getImplementationName() |
711 | 0 | { |
712 | 0 | return u"stardiv.Toolkit.UnoControlButtonModel"_ustr; |
713 | 0 | } |
714 | | |
715 | | css::uno::Sequence<OUString> UnoControlButtonModel::getSupportedServiceNames() |
716 | 0 | { |
717 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlButtonModel"_ustr, u"stardiv.vcl.controlmodel.Button"_ustr }; |
718 | 0 | return comphelper::concatSequences( GraphicControlModel::getSupportedServiceNames(), vals ); |
719 | 0 | } |
720 | | |
721 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
722 | | stardiv_Toolkit_UnoControlButtonModel_get_implementation( |
723 | | css::uno::XComponentContext *context, |
724 | | css::uno::Sequence<css::uno::Any> const &) |
725 | 0 | { |
726 | 0 | return cppu::acquire(new UnoControlButtonModel(context)); |
727 | 0 | } |
728 | | |
729 | | |
730 | | |
731 | | UnoButtonControl::UnoButtonControl() |
732 | 0 | :maActionListeners( *this ) |
733 | 0 | ,maItemListeners( *this ) |
734 | 0 | { |
735 | 0 | maComponentInfos.nWidth = 50; |
736 | 0 | maComponentInfos.nHeight = 14; |
737 | 0 | } |
738 | | |
739 | | OUString UnoButtonControl::GetComponentServiceName() const |
740 | 0 | { |
741 | 0 | OUString aName( u"pushbutton"_ustr ); |
742 | 0 | uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_PUSHBUTTONTYPE ) ); |
743 | 0 | sal_Int16 n = sal_Int16(); |
744 | 0 | if ( ( aVal >>= n ) && n ) |
745 | 0 | { |
746 | | // Use PushButtonType later when available... |
747 | 0 | switch ( n ) |
748 | 0 | { |
749 | 0 | case 1 /*PushButtonType::OK*/: aName = "okbutton"; |
750 | 0 | break; |
751 | 0 | case 2 /*PushButtonType::CANCEL*/: aName = "cancelbutton"; |
752 | 0 | break; |
753 | 0 | case 3 /*PushButtonType::HELP*/: aName = "helpbutton"; |
754 | 0 | break; |
755 | 0 | default: |
756 | 0 | { |
757 | 0 | OSL_FAIL( "Unknown Button Type!" ); |
758 | 0 | } |
759 | 0 | } |
760 | 0 | } |
761 | 0 | return aName; |
762 | 0 | } |
763 | | |
764 | | void UnoButtonControl::dispose() |
765 | 0 | { |
766 | 0 | lang::EventObject aEvt; |
767 | 0 | aEvt.Source = getXWeak(); |
768 | 0 | maActionListeners.disposeAndClear( aEvt ); |
769 | 0 | maItemListeners.disposeAndClear( aEvt ); |
770 | 0 | UnoControlBase::dispose(); |
771 | 0 | } |
772 | | |
773 | | void UnoButtonControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) |
774 | 0 | { |
775 | 0 | UnoControlBase::createPeer( rxToolkit, rParentPeer ); |
776 | |
|
777 | 0 | uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY ); |
778 | 0 | xButton->setActionCommand( maActionCommand ); |
779 | 0 | if ( maActionListeners.getLength() ) |
780 | 0 | xButton->addActionListener( &maActionListeners ); |
781 | |
|
782 | 0 | uno::Reference< XToggleButton > xPushButton( getPeer(), uno::UNO_QUERY ); |
783 | 0 | if ( xPushButton.is() ) |
784 | 0 | xPushButton->addItemListener( this ); |
785 | 0 | } |
786 | | |
787 | | void UnoButtonControl::addActionListener(const uno::Reference< awt::XActionListener > & l) |
788 | 0 | { |
789 | | // tdf#150974 some extensions pass null |
790 | 0 | if (!l) |
791 | 0 | { |
792 | 0 | SAL_WARN("toolkit", "null XActionListener"); |
793 | 0 | return; |
794 | 0 | } |
795 | | |
796 | 0 | maActionListeners.addInterface( l ); |
797 | 0 | if( getPeer().is() && maActionListeners.getLength() == 1 ) |
798 | 0 | { |
799 | 0 | uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY ); |
800 | 0 | xButton->addActionListener( &maActionListeners ); |
801 | 0 | } |
802 | 0 | } |
803 | | |
804 | | void UnoButtonControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) |
805 | 0 | { |
806 | | // tdf#150974 some extensions pass null |
807 | 0 | if (!l) |
808 | 0 | { |
809 | 0 | SAL_WARN("toolkit", "null XActionListener"); |
810 | 0 | return; |
811 | 0 | } |
812 | | |
813 | 0 | if( getPeer().is() && maActionListeners.getLength() == 1 ) |
814 | 0 | { |
815 | 0 | uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY ); |
816 | 0 | xButton->removeActionListener( &maActionListeners ); |
817 | 0 | } |
818 | 0 | maActionListeners.removeInterface( l ); |
819 | 0 | } |
820 | | |
821 | | void UnoButtonControl::addItemListener(const uno::Reference< awt::XItemListener > & l) |
822 | 0 | { |
823 | 0 | maItemListeners.addInterface( l ); |
824 | 0 | } |
825 | | |
826 | | void UnoButtonControl::removeItemListener(const uno::Reference< awt::XItemListener > & l) |
827 | 0 | { |
828 | 0 | maItemListeners.removeInterface( l ); |
829 | 0 | } |
830 | | |
831 | | void SAL_CALL UnoButtonControl::disposing( const lang::EventObject& Source ) |
832 | 0 | { |
833 | 0 | UnoControlBase::disposing( Source ); |
834 | 0 | } |
835 | | |
836 | | void SAL_CALL UnoButtonControl::itemStateChanged( const awt::ItemEvent& rEvent ) |
837 | 0 | { |
838 | | // forward to model |
839 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), uno::Any(static_cast<sal_Int16>(rEvent.Selected)), false ); |
840 | | |
841 | | // multiplex |
842 | 0 | ItemEvent aEvent( rEvent ); |
843 | 0 | aEvent.Source = *this; |
844 | 0 | maItemListeners.itemStateChanged( aEvent ); |
845 | 0 | } |
846 | | |
847 | | void UnoButtonControl::setLabel( const OUString& rLabel ) |
848 | 0 | { |
849 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), uno::Any(rLabel), true ); |
850 | 0 | } |
851 | | |
852 | | void UnoButtonControl::setActionCommand( const OUString& rCommand ) |
853 | 0 | { |
854 | 0 | maActionCommand = rCommand; |
855 | 0 | if ( getPeer().is() ) |
856 | 0 | { |
857 | 0 | uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY ); |
858 | 0 | xButton->setActionCommand( rCommand ); |
859 | 0 | } |
860 | 0 | } |
861 | | |
862 | | awt::Size UnoButtonControl::getMinimumSize( ) |
863 | 0 | { |
864 | 0 | return Impl_getMinimumSize(); |
865 | 0 | } |
866 | | |
867 | | awt::Size UnoButtonControl::getPreferredSize( ) |
868 | 0 | { |
869 | 0 | return Impl_getPreferredSize(); |
870 | 0 | } |
871 | | |
872 | | awt::Size UnoButtonControl::calcAdjustedSize( const awt::Size& rNewSize ) |
873 | 0 | { |
874 | 0 | return Impl_calcAdjustedSize( rNewSize ); |
875 | 0 | } |
876 | | |
877 | | OUString UnoButtonControl::getImplementationName() |
878 | 0 | { |
879 | 0 | return u"stardiv.Toolkit.UnoButtonControl"_ustr; |
880 | 0 | } |
881 | | |
882 | | css::uno::Sequence<OUString> UnoButtonControl::getSupportedServiceNames() |
883 | 0 | { |
884 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlButton"_ustr, u"stardiv.vcl.control.Button"_ustr }; |
885 | 0 | return comphelper::concatSequences( UnoControlBase::getSupportedServiceNames(), vals); |
886 | 0 | } |
887 | | |
888 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
889 | | stardiv_Toolkit_UnoButtonControl_get_implementation( |
890 | | css::uno::XComponentContext *, |
891 | | css::uno::Sequence<css::uno::Any> const &) |
892 | 0 | { |
893 | 0 | return cppu::acquire(new UnoButtonControl()); |
894 | 0 | } |
895 | | |
896 | | |
897 | | |
898 | | UnoControlImageControlModel::UnoControlImageControlModel( const Reference< XComponentContext >& rxContext ) |
899 | 0 | :GraphicControlModel( rxContext ) |
900 | 0 | ,mbAdjustingImageScaleMode( false ) |
901 | 0 | { |
902 | 0 | UNO_CONTROL_MODEL_REGISTER_PROPERTIES<VCLXImageControl>(); |
903 | 0 | } Unexecuted instantiation: UnoControlImageControlModel::UnoControlImageControlModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: UnoControlImageControlModel::UnoControlImageControlModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
904 | | |
905 | | OUString UnoControlImageControlModel::getServiceName() |
906 | 0 | { |
907 | 0 | return u"stardiv.vcl.controlmodel.ImageControl"_ustr; |
908 | 0 | } |
909 | | |
910 | | OUString UnoControlImageControlModel::getImplementationName() |
911 | 0 | { |
912 | 0 | return u"stardiv.Toolkit.UnoControlImageControlModel"_ustr; |
913 | 0 | } |
914 | | |
915 | | css::uno::Sequence<OUString> |
916 | | UnoControlImageControlModel::getSupportedServiceNames() |
917 | 0 | { |
918 | 0 | const css::uno::Sequence<OUString> vals { |
919 | 0 | u"com.sun.star.awt.UnoControlImageButtonModel"_ustr, |
920 | 0 | u"com.sun.star.awt.UnoControlImageControlModel"_ustr, |
921 | 0 | u"stardiv.vcl.controlmodel.ImageButton"_ustr, |
922 | 0 | u"stardiv.vcl.controlmodel.ImageControl"_ustr |
923 | 0 | }; |
924 | 0 | return comphelper::concatSequences( GraphicControlModel::getSupportedServiceNames(), vals); |
925 | 0 | } |
926 | | |
927 | | uno::Any UnoControlImageControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const |
928 | 0 | { |
929 | 0 | if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) |
930 | 0 | return uno::Any( u"stardiv.vcl.control.ImageControl"_ustr ); |
931 | | |
932 | 0 | if ( nPropId == BASEPROPERTY_IMAGE_SCALE_MODE ) |
933 | 0 | return Any( awt::ImageScaleMode::ANISOTROPIC ); |
934 | | |
935 | 0 | return GraphicControlModel::ImplGetDefaultValue( nPropId ); |
936 | 0 | } |
937 | | |
938 | | ::cppu::IPropertyArrayHelper& UnoControlImageControlModel::getInfoHelper() |
939 | 0 | { |
940 | 0 | static UnoPropertyArrayHelper aHelper( ImplGetPropertyIds() ); |
941 | 0 | return aHelper; |
942 | 0 | } |
943 | | |
944 | | // beans::XMultiPropertySet |
945 | | uno::Reference< beans::XPropertySetInfo > UnoControlImageControlModel::getPropertySetInfo( ) |
946 | 0 | { |
947 | 0 | static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); |
948 | 0 | return xInfo; |
949 | 0 | } |
950 | | |
951 | | void UnoControlImageControlModel::setFastPropertyValue_NoBroadcast( std::unique_lock<std::mutex>& rGuard, sal_Int32 _nHandle, const css::uno::Any& _rValue ) |
952 | 0 | { |
953 | 0 | GraphicControlModel::setFastPropertyValue_NoBroadcast( rGuard, _nHandle, _rValue ); |
954 | | |
955 | | // ScaleImage is an older (and less powerful) version of ScaleMode, but keep both in sync as far as possible |
956 | 0 | try |
957 | 0 | { |
958 | 0 | switch ( _nHandle ) |
959 | 0 | { |
960 | 0 | case BASEPROPERTY_IMAGE_SCALE_MODE: |
961 | 0 | if ( !mbAdjustingImageScaleMode && ImplHasProperty( BASEPROPERTY_SCALEIMAGE ) ) |
962 | 0 | { |
963 | 0 | mbAdjustingImageScaleMode = true; |
964 | 0 | sal_Int16 nScaleMode( awt::ImageScaleMode::ANISOTROPIC ); |
965 | 0 | OSL_VERIFY( _rValue >>= nScaleMode ); |
966 | 0 | setDependentFastPropertyValue( rGuard, BASEPROPERTY_SCALEIMAGE, uno::Any( nScaleMode != awt::ImageScaleMode::NONE ) ); |
967 | 0 | mbAdjustingImageScaleMode = false; |
968 | 0 | } |
969 | 0 | break; |
970 | 0 | case BASEPROPERTY_SCALEIMAGE: |
971 | 0 | if ( !mbAdjustingImageScaleMode && ImplHasProperty( BASEPROPERTY_IMAGE_SCALE_MODE ) ) |
972 | 0 | { |
973 | 0 | mbAdjustingImageScaleMode = true; |
974 | 0 | bool bScale = true; |
975 | 0 | OSL_VERIFY( _rValue >>= bScale ); |
976 | 0 | setDependentFastPropertyValue( rGuard, BASEPROPERTY_IMAGE_SCALE_MODE, uno::Any( bScale ? awt::ImageScaleMode::ANISOTROPIC : awt::ImageScaleMode::NONE ) ); |
977 | 0 | mbAdjustingImageScaleMode = false; |
978 | 0 | } |
979 | 0 | break; |
980 | 0 | } |
981 | 0 | } |
982 | 0 | catch( const Exception& ) |
983 | 0 | { |
984 | 0 | mbAdjustingImageScaleMode = false; |
985 | 0 | throw; |
986 | 0 | } |
987 | 0 | } |
988 | | |
989 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
990 | | stardiv_Toolkit_UnoControlImageControlModel_get_implementation( |
991 | | css::uno::XComponentContext *context, |
992 | | css::uno::Sequence<css::uno::Any> const &) |
993 | 0 | { |
994 | 0 | return cppu::acquire(new UnoControlImageControlModel(context)); |
995 | 0 | } |
996 | | |
997 | | |
998 | | |
999 | | UnoImageControlControl::UnoImageControlControl() |
1000 | 0 | :maActionListeners( *this ) |
1001 | 0 | { |
1002 | | // TODO: Where should I look for defaults? |
1003 | 0 | maComponentInfos.nWidth = 100; |
1004 | 0 | maComponentInfos.nHeight = 100; |
1005 | 0 | } |
1006 | | |
1007 | | OUString UnoImageControlControl::GetComponentServiceName() const |
1008 | 0 | { |
1009 | 0 | return u"fixedimage"_ustr; |
1010 | 0 | } |
1011 | | |
1012 | | void UnoImageControlControl::dispose() |
1013 | 0 | { |
1014 | 0 | lang::EventObject aEvt; |
1015 | 0 | aEvt.Source = getXWeak(); |
1016 | 0 | maActionListeners.disposeAndClear( aEvt ); |
1017 | 0 | UnoControl::dispose(); |
1018 | 0 | } |
1019 | | |
1020 | | sal_Bool UnoImageControlControl::isTransparent() |
1021 | 0 | { |
1022 | 0 | return true; |
1023 | 0 | } |
1024 | | |
1025 | | awt::Size UnoImageControlControl::getMinimumSize( ) |
1026 | 0 | { |
1027 | 0 | return Impl_getMinimumSize(); |
1028 | 0 | } |
1029 | | |
1030 | | awt::Size UnoImageControlControl::getPreferredSize( ) |
1031 | 0 | { |
1032 | 0 | return Impl_getPreferredSize(); |
1033 | 0 | } |
1034 | | |
1035 | | awt::Size UnoImageControlControl::calcAdjustedSize( const awt::Size& rNewSize ) |
1036 | 0 | { |
1037 | 0 | return Impl_calcAdjustedSize( rNewSize ); |
1038 | 0 | } |
1039 | | |
1040 | | OUString UnoImageControlControl::getImplementationName() |
1041 | 0 | { |
1042 | 0 | return u"stardiv.Toolkit.UnoImageControlControl"_ustr; |
1043 | 0 | } |
1044 | | |
1045 | | css::uno::Sequence<OUString> UnoImageControlControl::getSupportedServiceNames() |
1046 | 0 | { |
1047 | 0 | const css::uno::Sequence<OUString> vals { |
1048 | 0 | u"com.sun.star.awt.UnoControlImageButton"_ustr, |
1049 | 0 | u"com.sun.star.awt.UnoControlImageControl"_ustr, |
1050 | 0 | u"stardiv.vcl.control.ImageButton"_ustr, |
1051 | 0 | u"stardiv.vcl.control.ImageControl"_ustr |
1052 | 0 | }; |
1053 | 0 | return comphelper::concatSequences( UnoControlBase::getSupportedServiceNames(), vals); |
1054 | 0 | } |
1055 | | |
1056 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
1057 | | stardiv_Toolkit_UnoImageControlControl_get_implementation( |
1058 | | css::uno::XComponentContext *, |
1059 | | css::uno::Sequence<css::uno::Any> const &) |
1060 | 0 | { |
1061 | 0 | return cppu::acquire(new UnoImageControlControl()); |
1062 | 0 | } |
1063 | | |
1064 | | |
1065 | | |
1066 | | UnoControlRadioButtonModel::UnoControlRadioButtonModel( const Reference< XComponentContext >& rxContext ) |
1067 | 0 | :GraphicControlModel( rxContext ) |
1068 | 0 | { |
1069 | 0 | UNO_CONTROL_MODEL_REGISTER_PROPERTIES<VCLXRadioButton>(); |
1070 | 0 | } Unexecuted instantiation: UnoControlRadioButtonModel::UnoControlRadioButtonModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: UnoControlRadioButtonModel::UnoControlRadioButtonModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
1071 | | |
1072 | | OUString UnoControlRadioButtonModel::getServiceName() |
1073 | 0 | { |
1074 | 0 | return u"stardiv.vcl.controlmodel.RadioButton"_ustr; |
1075 | 0 | } |
1076 | | |
1077 | | uno::Any UnoControlRadioButtonModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const |
1078 | 0 | { |
1079 | 0 | switch ( nPropId ) |
1080 | 0 | { |
1081 | 0 | case BASEPROPERTY_DEFAULTCONTROL: |
1082 | 0 | return uno::Any( u"stardiv.vcl.control.RadioButton"_ustr ); |
1083 | | |
1084 | 0 | case BASEPROPERTY_VISUALEFFECT: |
1085 | 0 | return uno::Any( sal_Int16(awt::VisualEffect::LOOK3D) ); |
1086 | 0 | } |
1087 | | |
1088 | 0 | return GraphicControlModel::ImplGetDefaultValue( nPropId ); |
1089 | 0 | } |
1090 | | |
1091 | | ::cppu::IPropertyArrayHelper& UnoControlRadioButtonModel::getInfoHelper() |
1092 | 0 | { |
1093 | 0 | static UnoPropertyArrayHelper aHelper( ImplGetPropertyIds() ); |
1094 | 0 | return aHelper; |
1095 | 0 | } |
1096 | | |
1097 | | // beans::XMultiPropertySet |
1098 | | uno::Reference< beans::XPropertySetInfo > UnoControlRadioButtonModel::getPropertySetInfo( ) |
1099 | 0 | { |
1100 | 0 | static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); |
1101 | 0 | return xInfo; |
1102 | 0 | } |
1103 | | |
1104 | | OUString UnoControlRadioButtonModel::getImplementationName() |
1105 | 0 | { |
1106 | 0 | return u"stardiv.Toolkit.UnoControlRadioButtonModel"_ustr; |
1107 | 0 | } |
1108 | | |
1109 | | css::uno::Sequence<OUString> |
1110 | | UnoControlRadioButtonModel::getSupportedServiceNames() |
1111 | 0 | { |
1112 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlRadioButtonModel"_ustr, u"stardiv.vcl.controlmodel.RadioButton"_ustr }; |
1113 | 0 | return comphelper::concatSequences( GraphicControlModel::getSupportedServiceNames(), vals); |
1114 | 0 | } |
1115 | | |
1116 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
1117 | | stardiv_Toolkit_UnoControlRadioButtonModel_get_implementation( |
1118 | | css::uno::XComponentContext *context, |
1119 | | css::uno::Sequence<css::uno::Any> const &) |
1120 | 0 | { |
1121 | 0 | return cppu::acquire(new UnoControlRadioButtonModel(context)); |
1122 | 0 | } |
1123 | | |
1124 | | |
1125 | | |
1126 | | UnoRadioButtonControl::UnoRadioButtonControl() |
1127 | 0 | :maItemListeners( *this ) |
1128 | 0 | ,maActionListeners( *this ) |
1129 | 0 | { |
1130 | 0 | maComponentInfos.nWidth = 100; |
1131 | 0 | maComponentInfos.nHeight = 12; |
1132 | 0 | } |
1133 | | |
1134 | | OUString UnoRadioButtonControl::GetComponentServiceName() const |
1135 | 0 | { |
1136 | 0 | return u"radiobutton"_ustr; |
1137 | 0 | } |
1138 | | |
1139 | | void UnoRadioButtonControl::dispose() |
1140 | 0 | { |
1141 | 0 | lang::EventObject aEvt; |
1142 | 0 | aEvt.Source = getXWeak(); |
1143 | 0 | maItemListeners.disposeAndClear( aEvt ); |
1144 | 0 | UnoControlBase::dispose(); |
1145 | 0 | } |
1146 | | |
1147 | | |
1148 | | sal_Bool UnoRadioButtonControl::isTransparent() |
1149 | 0 | { |
1150 | 0 | return true; |
1151 | 0 | } |
1152 | | |
1153 | | void UnoRadioButtonControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) |
1154 | 0 | { |
1155 | 0 | UnoControlBase::createPeer( rxToolkit, rParentPeer ); |
1156 | |
|
1157 | 0 | uno::Reference < awt::XRadioButton > xRadioButton( getPeer(), uno::UNO_QUERY ); |
1158 | 0 | xRadioButton->addItemListener( this ); |
1159 | |
|
1160 | 0 | uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY ); |
1161 | 0 | xButton->setActionCommand( maActionCommand ); |
1162 | 0 | if ( maActionListeners.getLength() ) |
1163 | 0 | xButton->addActionListener( &maActionListeners ); |
1164 | | |
1165 | | // as default, set the "AutoToggle" to true |
1166 | | // (it is set to false in VCLXToolkit::ImplCreateWindow because of #87254#, but we want to |
1167 | | // have it enabled by default because of 85071) |
1168 | 0 | uno::Reference< awt::XVclWindowPeer > xVclWindowPeer( getPeer(), uno::UNO_QUERY ); |
1169 | 0 | if ( xVclWindowPeer.is() ) |
1170 | 0 | xVclWindowPeer->setProperty( GetPropertyName( BASEPROPERTY_AUTOTOGGLE ), css::uno::Any(true) ); |
1171 | 0 | } |
1172 | | |
1173 | | void UnoRadioButtonControl::addItemListener(const uno::Reference < awt::XItemListener > & l) |
1174 | 0 | { |
1175 | 0 | maItemListeners.addInterface( l ); |
1176 | 0 | } |
1177 | | |
1178 | | void UnoRadioButtonControl::removeItemListener(const uno::Reference < awt::XItemListener > & l) |
1179 | 0 | { |
1180 | 0 | maItemListeners.removeInterface( l ); |
1181 | 0 | } |
1182 | | |
1183 | | void UnoRadioButtonControl::addActionListener(const uno::Reference< awt::XActionListener > & l) |
1184 | 0 | { |
1185 | 0 | maActionListeners.addInterface( l ); |
1186 | 0 | if( getPeer().is() && maActionListeners.getLength() == 1 ) |
1187 | 0 | { |
1188 | 0 | uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY ); |
1189 | 0 | xButton->addActionListener( &maActionListeners ); |
1190 | 0 | } |
1191 | 0 | } |
1192 | | |
1193 | | void UnoRadioButtonControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) |
1194 | 0 | { |
1195 | 0 | if( getPeer().is() && maActionListeners.getLength() == 1 ) |
1196 | 0 | { |
1197 | 0 | uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY ); |
1198 | 0 | xButton->removeActionListener( &maActionListeners ); |
1199 | 0 | } |
1200 | 0 | maActionListeners.removeInterface( l ); |
1201 | 0 | } |
1202 | | |
1203 | | void UnoRadioButtonControl::setLabel( const OUString& rLabel ) |
1204 | 0 | { |
1205 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), uno::Any(rLabel), true ); |
1206 | 0 | } |
1207 | | |
1208 | | void UnoRadioButtonControl::setActionCommand( const OUString& rCommand ) |
1209 | 0 | { |
1210 | 0 | maActionCommand = rCommand; |
1211 | 0 | if ( getPeer().is() ) |
1212 | 0 | { |
1213 | 0 | uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY ); |
1214 | 0 | xButton->setActionCommand( rCommand ); |
1215 | 0 | } |
1216 | 0 | } |
1217 | | |
1218 | | void UnoRadioButtonControl::setState( sal_Bool bOn ) |
1219 | 0 | { |
1220 | 0 | sal_Int16 nState = bOn ? 1 : 0; |
1221 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), uno::Any(nState), true ); |
1222 | 0 | } |
1223 | | |
1224 | | sal_Bool UnoRadioButtonControl::getState() |
1225 | 0 | { |
1226 | 0 | sal_Int16 nState = 0; |
1227 | 0 | uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ) ); |
1228 | 0 | aVal >>= nState; |
1229 | 0 | return nState != 0; |
1230 | 0 | } |
1231 | | |
1232 | | void UnoRadioButtonControl::itemStateChanged( const awt::ItemEvent& rEvent ) |
1233 | 0 | { |
1234 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), uno::Any(static_cast<sal_Int16>(rEvent.Selected)), false ); |
1235 | | |
1236 | | // compatibility: |
1237 | | // in OOo 1.0.x, when the user clicked a radio button in a group of buttons, this resulted |
1238 | | // in _one_ itemStateChanged call for exactly the radio button which's state changed from |
1239 | | // "0" to "1". |
1240 | | // Nowadays, since the listener handling changed a lot towards 1.1 (the VCLXWindow reacts on more |
1241 | | // basic events from the VCL-windows, not anymore on the Link-based events like in 1.0.x), this |
1242 | | // isn't the case anymore: For instance, this method here gets called for the radio button |
1243 | | // which is being implicitly _de_selected, too. This is pretty bad for compatibility. |
1244 | | // Thus, we suppress all events with a new state other than "1". This is unlogical, and weird, when looking |
1245 | | // from a pure API perspective, but it's _compatible_ with older product versions, and this is |
1246 | | // all which matters here. |
1247 | | // #i14703# |
1248 | 0 | if ( 1 == rEvent.Selected ) |
1249 | 0 | { |
1250 | 0 | if ( maItemListeners.getLength() ) |
1251 | 0 | maItemListeners.itemStateChanged( rEvent ); |
1252 | 0 | } |
1253 | | // note that speaking strictly, this is wrong: When in 1.0.x, the user would have de-selected |
1254 | | // a radio button _without_ selecting another one, this would have caused a notification. |
1255 | | // With the change done here, this today won't cause a notification anymore. |
1256 | | |
1257 | | // Fortunately, it's not possible for the user to de-select a radio button without selecting another on, |
1258 | | // at least not via the regular UI. It _would_ be possible via the Accessibility API, which |
1259 | | // counts as "user input", too. But in 1.0.x, there was no Accessibility API, so there is nothing |
1260 | | // to be inconsistent with. |
1261 | 0 | } |
1262 | | |
1263 | | awt::Size UnoRadioButtonControl::getMinimumSize( ) |
1264 | 0 | { |
1265 | 0 | return Impl_getMinimumSize(); |
1266 | 0 | } |
1267 | | |
1268 | | awt::Size UnoRadioButtonControl::getPreferredSize( ) |
1269 | 0 | { |
1270 | 0 | return Impl_getPreferredSize(); |
1271 | 0 | } |
1272 | | |
1273 | | awt::Size UnoRadioButtonControl::calcAdjustedSize( const awt::Size& rNewSize ) |
1274 | 0 | { |
1275 | 0 | return Impl_calcAdjustedSize( rNewSize ); |
1276 | 0 | } |
1277 | | |
1278 | | OUString UnoRadioButtonControl::getImplementationName() |
1279 | 0 | { |
1280 | 0 | return u"stardiv.Toolkit.UnoRadioButtonControl"_ustr; |
1281 | 0 | } |
1282 | | |
1283 | | css::uno::Sequence<OUString> UnoRadioButtonControl::getSupportedServiceNames() |
1284 | 0 | { |
1285 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlRadioButton"_ustr, u"stardiv.vcl.control.RadioButton"_ustr }; |
1286 | 0 | return comphelper::concatSequences( UnoControlBase::getSupportedServiceNames(), vals ); |
1287 | 0 | } |
1288 | | |
1289 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
1290 | | stardiv_Toolkit_UnoRadioButtonControl_get_implementation( |
1291 | | css::uno::XComponentContext *, |
1292 | | css::uno::Sequence<css::uno::Any> const &) |
1293 | 0 | { |
1294 | 0 | return cppu::acquire(new UnoRadioButtonControl()); |
1295 | 0 | } |
1296 | | |
1297 | | |
1298 | | |
1299 | | UnoControlCheckBoxModel::UnoControlCheckBoxModel( const Reference< XComponentContext >& rxContext ) |
1300 | 0 | :GraphicControlModel( rxContext ) |
1301 | 0 | { |
1302 | 0 | UNO_CONTROL_MODEL_REGISTER_PROPERTIES<VCLXCheckBox>(); |
1303 | 0 | } Unexecuted instantiation: UnoControlCheckBoxModel::UnoControlCheckBoxModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: UnoControlCheckBoxModel::UnoControlCheckBoxModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
1304 | | |
1305 | | OUString UnoControlCheckBoxModel::getServiceName() |
1306 | 0 | { |
1307 | 0 | return u"stardiv.vcl.controlmodel.CheckBox"_ustr; |
1308 | 0 | } |
1309 | | |
1310 | | uno::Any UnoControlCheckBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const |
1311 | 0 | { |
1312 | 0 | switch ( nPropId ) |
1313 | 0 | { |
1314 | 0 | case BASEPROPERTY_DEFAULTCONTROL: |
1315 | 0 | return uno::Any( u"stardiv.vcl.control.CheckBox"_ustr ); |
1316 | | |
1317 | 0 | case BASEPROPERTY_VISUALEFFECT: |
1318 | 0 | return uno::Any( sal_Int16(awt::VisualEffect::LOOK3D) ); |
1319 | 0 | } |
1320 | | |
1321 | 0 | return GraphicControlModel::ImplGetDefaultValue( nPropId ); |
1322 | 0 | } |
1323 | | |
1324 | | ::cppu::IPropertyArrayHelper& UnoControlCheckBoxModel::getInfoHelper() |
1325 | 0 | { |
1326 | 0 | static UnoPropertyArrayHelper aHelper( ImplGetPropertyIds() ); |
1327 | 0 | return aHelper; |
1328 | 0 | } |
1329 | | |
1330 | | // beans::XMultiPropertySet |
1331 | | uno::Reference< beans::XPropertySetInfo > UnoControlCheckBoxModel::getPropertySetInfo( ) |
1332 | 0 | { |
1333 | 0 | static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); |
1334 | 0 | return xInfo; |
1335 | 0 | } |
1336 | | |
1337 | | OUString UnoControlCheckBoxModel::getImplementationName() |
1338 | 0 | { |
1339 | 0 | return u"stardiv.Toolkit.UnoControlCheckBoxModel"_ustr; |
1340 | 0 | } |
1341 | | |
1342 | | css::uno::Sequence<OUString> UnoControlCheckBoxModel::getSupportedServiceNames() |
1343 | 0 | { |
1344 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlCheckBoxModel"_ustr, u"stardiv.vcl.controlmodel.CheckBox"_ustr }; |
1345 | 0 | return comphelper::concatSequences( GraphicControlModel::getSupportedServiceNames(), vals ); |
1346 | 0 | } |
1347 | | |
1348 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
1349 | | stardiv_Toolkit_UnoControlCheckBoxModel_get_implementation( |
1350 | | css::uno::XComponentContext *context, |
1351 | | css::uno::Sequence<css::uno::Any> const &) |
1352 | 0 | { |
1353 | 0 | return cppu::acquire(new UnoControlCheckBoxModel(context)); |
1354 | 0 | } |
1355 | | |
1356 | | |
1357 | | |
1358 | | UnoCheckBoxControl::UnoCheckBoxControl() |
1359 | 0 | :maItemListeners( *this ), maActionListeners( *this ) |
1360 | 0 | { |
1361 | 0 | maComponentInfos.nWidth = 100; |
1362 | 0 | maComponentInfos.nHeight = 12; |
1363 | 0 | } |
1364 | | |
1365 | | OUString UnoCheckBoxControl::GetComponentServiceName() const |
1366 | 0 | { |
1367 | 0 | return u"checkbox"_ustr; |
1368 | 0 | } |
1369 | | |
1370 | | void UnoCheckBoxControl::dispose() |
1371 | 0 | { |
1372 | 0 | lang::EventObject aEvt; |
1373 | 0 | aEvt.Source = getXWeak(); |
1374 | 0 | maItemListeners.disposeAndClear( aEvt ); |
1375 | 0 | UnoControlBase::dispose(); |
1376 | 0 | } |
1377 | | |
1378 | | sal_Bool UnoCheckBoxControl::isTransparent() |
1379 | 0 | { |
1380 | 0 | return true; |
1381 | 0 | } |
1382 | | |
1383 | | void UnoCheckBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) |
1384 | 0 | { |
1385 | 0 | UnoControlBase::createPeer( rxToolkit, rParentPeer ); |
1386 | |
|
1387 | 0 | uno::Reference < awt::XCheckBox > xCheckBox( getPeer(), uno::UNO_QUERY ); |
1388 | 0 | xCheckBox->addItemListener( this ); |
1389 | |
|
1390 | 0 | uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY ); |
1391 | 0 | xButton->setActionCommand( maActionCommand ); |
1392 | 0 | if ( maActionListeners.getLength() ) |
1393 | 0 | xButton->addActionListener( &maActionListeners ); |
1394 | 0 | } |
1395 | | |
1396 | | void UnoCheckBoxControl::addItemListener(const uno::Reference < awt::XItemListener > & l) |
1397 | 0 | { |
1398 | 0 | maItemListeners.addInterface( l ); |
1399 | 0 | } |
1400 | | |
1401 | | void UnoCheckBoxControl::removeItemListener(const uno::Reference < awt::XItemListener > & l) |
1402 | 0 | { |
1403 | 0 | maItemListeners.removeInterface( l ); |
1404 | 0 | } |
1405 | | |
1406 | | void UnoCheckBoxControl::addActionListener(const uno::Reference< awt::XActionListener > & l) |
1407 | 0 | { |
1408 | 0 | maActionListeners.addInterface( l ); |
1409 | 0 | if( getPeer().is() && maActionListeners.getLength() == 1 ) |
1410 | 0 | { |
1411 | 0 | uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY ); |
1412 | 0 | xButton->addActionListener( &maActionListeners ); |
1413 | 0 | } |
1414 | 0 | } |
1415 | | |
1416 | | void UnoCheckBoxControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) |
1417 | 0 | { |
1418 | 0 | if( getPeer().is() && maActionListeners.getLength() == 1 ) |
1419 | 0 | { |
1420 | 0 | uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY ); |
1421 | 0 | xButton->removeActionListener( &maActionListeners ); |
1422 | 0 | } |
1423 | 0 | maActionListeners.removeInterface( l ); |
1424 | 0 | } |
1425 | | |
1426 | | void UnoCheckBoxControl::setActionCommand( const OUString& rCommand ) |
1427 | 0 | { |
1428 | 0 | maActionCommand = rCommand; |
1429 | 0 | if ( getPeer().is() ) |
1430 | 0 | { |
1431 | 0 | uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY ); |
1432 | 0 | xButton->setActionCommand( rCommand ); |
1433 | 0 | } |
1434 | 0 | } |
1435 | | |
1436 | | |
1437 | | void UnoCheckBoxControl::setLabel( const OUString& rLabel ) |
1438 | 0 | { |
1439 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), uno::Any(rLabel), true ); |
1440 | 0 | } |
1441 | | |
1442 | | void UnoCheckBoxControl::setState( sal_Int16 n ) |
1443 | 0 | { |
1444 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), uno::Any(n), true ); |
1445 | 0 | } |
1446 | | |
1447 | | sal_Int16 UnoCheckBoxControl::getState() |
1448 | 0 | { |
1449 | 0 | sal_Int16 nState = 0; |
1450 | 0 | uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ) ); |
1451 | 0 | aVal >>= nState; |
1452 | 0 | return nState; |
1453 | 0 | } |
1454 | | |
1455 | | void UnoCheckBoxControl::enableTriState( sal_Bool b ) |
1456 | 0 | { |
1457 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TRISTATE ), uno::Any(b), true ); |
1458 | 0 | } |
1459 | | |
1460 | | void UnoCheckBoxControl::itemStateChanged( const awt::ItemEvent& rEvent ) |
1461 | 0 | { |
1462 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), uno::Any(static_cast<sal_Int16>(rEvent.Selected)), false ); |
1463 | |
|
1464 | 0 | if ( maItemListeners.getLength() ) |
1465 | 0 | maItemListeners.itemStateChanged( rEvent ); |
1466 | 0 | } |
1467 | | |
1468 | | awt::Size UnoCheckBoxControl::getMinimumSize( ) |
1469 | 0 | { |
1470 | 0 | return Impl_getMinimumSize(); |
1471 | 0 | } |
1472 | | |
1473 | | awt::Size UnoCheckBoxControl::getPreferredSize( ) |
1474 | 0 | { |
1475 | 0 | return Impl_getPreferredSize(); |
1476 | 0 | } |
1477 | | |
1478 | | awt::Size UnoCheckBoxControl::calcAdjustedSize( const awt::Size& rNewSize ) |
1479 | 0 | { |
1480 | 0 | return Impl_calcAdjustedSize( rNewSize ); |
1481 | 0 | } |
1482 | | |
1483 | | OUString UnoCheckBoxControl::getImplementationName() |
1484 | 0 | { |
1485 | 0 | return u"stardiv.Toolkit.UnoCheckBoxControl"_ustr; |
1486 | 0 | } |
1487 | | |
1488 | | css::uno::Sequence<OUString> UnoCheckBoxControl::getSupportedServiceNames() |
1489 | 0 | { |
1490 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlCheckBox"_ustr, u"stardiv.vcl.control.CheckBox"_ustr }; |
1491 | 0 | return comphelper::concatSequences( UnoControlBase::getSupportedServiceNames(), vals ); |
1492 | 0 | } |
1493 | | |
1494 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
1495 | | stardiv_Toolkit_UnoCheckBoxControl_get_implementation( |
1496 | | css::uno::XComponentContext *, |
1497 | | css::uno::Sequence<css::uno::Any> const &) |
1498 | 0 | { |
1499 | 0 | return cppu::acquire(new UnoCheckBoxControl()); |
1500 | 0 | } |
1501 | | |
1502 | | |
1503 | | |
1504 | | UnoControlFixedHyperlinkModel::UnoControlFixedHyperlinkModel( const Reference< XComponentContext >& rxContext ) |
1505 | 0 | :UnoControlModel( rxContext ) |
1506 | 0 | { |
1507 | 0 | UNO_CONTROL_MODEL_REGISTER_PROPERTIES<VCLXFixedHyperlink>(); |
1508 | 0 | } Unexecuted instantiation: UnoControlFixedHyperlinkModel::UnoControlFixedHyperlinkModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: UnoControlFixedHyperlinkModel::UnoControlFixedHyperlinkModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
1509 | | |
1510 | | OUString UnoControlFixedHyperlinkModel::getServiceName() |
1511 | 0 | { |
1512 | 0 | return u"com.sun.star.awt.UnoControlFixedHyperlinkModel"_ustr; |
1513 | 0 | } |
1514 | | |
1515 | | uno::Any UnoControlFixedHyperlinkModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const |
1516 | 0 | { |
1517 | 0 | if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) |
1518 | 0 | { |
1519 | 0 | return uno::Any( u"com.sun.star.awt.UnoControlFixedHyperlink"_ustr ); |
1520 | 0 | } |
1521 | 0 | else if ( nPropId == BASEPROPERTY_BORDER ) |
1522 | 0 | { |
1523 | 0 | return uno::Any(sal_Int16(0)); |
1524 | 0 | } |
1525 | 0 | else if ( nPropId == BASEPROPERTY_URL ) |
1526 | 0 | { |
1527 | 0 | return uno::Any( OUString() ); |
1528 | 0 | } |
1529 | | |
1530 | 0 | return UnoControlModel::ImplGetDefaultValue( nPropId ); |
1531 | 0 | } |
1532 | | |
1533 | | ::cppu::IPropertyArrayHelper& UnoControlFixedHyperlinkModel::getInfoHelper() |
1534 | 0 | { |
1535 | 0 | static UnoPropertyArrayHelper aHelper( ImplGetPropertyIds() ); |
1536 | 0 | return aHelper; |
1537 | 0 | } |
1538 | | |
1539 | | // beans::XMultiPropertySet |
1540 | | uno::Reference< beans::XPropertySetInfo > UnoControlFixedHyperlinkModel::getPropertySetInfo( ) |
1541 | 0 | { |
1542 | 0 | static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); |
1543 | 0 | return xInfo; |
1544 | 0 | } |
1545 | | |
1546 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
1547 | | stardiv_Toolkit_UnoControlFixedHyperlinkModel_get_implementation( |
1548 | | css::uno::XComponentContext *context, |
1549 | | css::uno::Sequence<css::uno::Any> const &) |
1550 | 0 | { |
1551 | 0 | return cppu::acquire(new UnoControlFixedHyperlinkModel(context)); |
1552 | 0 | } |
1553 | | |
1554 | | |
1555 | | |
1556 | | UnoFixedHyperlinkControl::UnoFixedHyperlinkControl() |
1557 | 0 | :maActionListeners( *this ) |
1558 | 0 | { |
1559 | 0 | maComponentInfos.nWidth = 100; |
1560 | 0 | maComponentInfos.nHeight = 12; |
1561 | 0 | } |
1562 | | |
1563 | | OUString UnoFixedHyperlinkControl::GetComponentServiceName() const |
1564 | 0 | { |
1565 | 0 | return u"fixedhyperlink"_ustr; |
1566 | 0 | } |
1567 | | |
1568 | | // uno::XInterface |
1569 | | uno::Any UnoFixedHyperlinkControl::queryAggregation( const uno::Type & rType ) |
1570 | 0 | { |
1571 | 0 | uno::Any aRet = ::cppu::queryInterface( rType, |
1572 | 0 | static_cast< awt::XFixedHyperlink* >(this), |
1573 | 0 | static_cast< awt::XLayoutConstrains* >(this) ); |
1574 | 0 | return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType )); |
1575 | 0 | } |
1576 | | |
1577 | | IMPL_IMPLEMENTATION_ID( UnoFixedHyperlinkControl ) |
1578 | | |
1579 | | // lang::XTypeProvider |
1580 | | css::uno::Sequence< css::uno::Type > UnoFixedHyperlinkControl::getTypes() |
1581 | 0 | { |
1582 | 0 | static const ::cppu::OTypeCollection aTypeList( |
1583 | 0 | cppu::UnoType<css::lang::XTypeProvider>::get(), |
1584 | 0 | cppu::UnoType<awt::XFixedHyperlink>::get(), |
1585 | 0 | cppu::UnoType<awt::XLayoutConstrains>::get(), |
1586 | 0 | UnoControlBase::getTypes() |
1587 | 0 | ); |
1588 | 0 | return aTypeList.getTypes(); |
1589 | 0 | } |
1590 | | |
1591 | | sal_Bool UnoFixedHyperlinkControl::isTransparent() |
1592 | 0 | { |
1593 | 0 | return true; |
1594 | 0 | } |
1595 | | |
1596 | | void UnoFixedHyperlinkControl::setText( const OUString& Text ) |
1597 | 0 | { |
1598 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), uno::Any(Text), true ); |
1599 | 0 | } |
1600 | | |
1601 | | OUString UnoFixedHyperlinkControl::getText() |
1602 | 0 | { |
1603 | 0 | return ImplGetPropertyValue_UString( BASEPROPERTY_LABEL ); |
1604 | 0 | } |
1605 | | |
1606 | | void UnoFixedHyperlinkControl::setURL( const OUString& URL ) |
1607 | 0 | { |
1608 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_URL ), uno::Any(URL), true ); |
1609 | 0 | } |
1610 | | |
1611 | | OUString UnoFixedHyperlinkControl::getURL( ) |
1612 | 0 | { |
1613 | 0 | return ImplGetPropertyValue_UString( BASEPROPERTY_URL ); |
1614 | 0 | } |
1615 | | |
1616 | | void UnoFixedHyperlinkControl::setAlignment( sal_Int16 nAlign ) |
1617 | 0 | { |
1618 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ), uno::Any(nAlign), true ); |
1619 | 0 | } |
1620 | | |
1621 | | sal_Int16 UnoFixedHyperlinkControl::getAlignment() |
1622 | 0 | { |
1623 | 0 | sal_Int16 nAlign = 0; |
1624 | 0 | if ( mxModel.is() ) |
1625 | 0 | { |
1626 | 0 | uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ) ); |
1627 | 0 | aVal >>= nAlign; |
1628 | 0 | } |
1629 | 0 | return nAlign; |
1630 | 0 | } |
1631 | | |
1632 | | awt::Size UnoFixedHyperlinkControl::getMinimumSize( ) |
1633 | 0 | { |
1634 | 0 | return Impl_getMinimumSize(); |
1635 | 0 | } |
1636 | | |
1637 | | awt::Size UnoFixedHyperlinkControl::getPreferredSize( ) |
1638 | 0 | { |
1639 | 0 | return Impl_getPreferredSize(); |
1640 | 0 | } |
1641 | | |
1642 | | awt::Size UnoFixedHyperlinkControl::calcAdjustedSize( const awt::Size& rNewSize ) |
1643 | 0 | { |
1644 | 0 | return Impl_calcAdjustedSize( rNewSize ); |
1645 | 0 | } |
1646 | | |
1647 | | void UnoFixedHyperlinkControl::dispose() |
1648 | 0 | { |
1649 | 0 | lang::EventObject aEvt; |
1650 | 0 | aEvt.Source = getXWeak(); |
1651 | 0 | maActionListeners.disposeAndClear( aEvt ); |
1652 | 0 | UnoControlBase::dispose(); |
1653 | 0 | } |
1654 | | |
1655 | | void UnoFixedHyperlinkControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) |
1656 | 0 | { |
1657 | 0 | UnoControlBase::createPeer( rxToolkit, rParentPeer ); |
1658 | |
|
1659 | 0 | uno::Reference < awt::XFixedHyperlink > xFixedHyperlink( getPeer(), uno::UNO_QUERY ); |
1660 | 0 | if ( maActionListeners.getLength() ) |
1661 | 0 | xFixedHyperlink->addActionListener( &maActionListeners ); |
1662 | 0 | } |
1663 | | |
1664 | | void UnoFixedHyperlinkControl::addActionListener(const uno::Reference< awt::XActionListener > & l) |
1665 | 0 | { |
1666 | 0 | maActionListeners.addInterface( l ); |
1667 | 0 | if( getPeer().is() && maActionListeners.getLength() == 1 ) |
1668 | 0 | { |
1669 | 0 | uno::Reference < awt::XFixedHyperlink > xFixedHyperlink( getPeer(), uno::UNO_QUERY ); |
1670 | 0 | xFixedHyperlink->addActionListener( &maActionListeners ); |
1671 | 0 | } |
1672 | 0 | } |
1673 | | |
1674 | | void UnoFixedHyperlinkControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) |
1675 | 0 | { |
1676 | 0 | if( getPeer().is() && maActionListeners.getLength() == 1 ) |
1677 | 0 | { |
1678 | 0 | uno::Reference < awt::XFixedHyperlink > xFixedHyperlink( getPeer(), uno::UNO_QUERY ); |
1679 | 0 | xFixedHyperlink->removeActionListener( &maActionListeners ); |
1680 | 0 | } |
1681 | 0 | maActionListeners.removeInterface( l ); |
1682 | 0 | } |
1683 | | |
1684 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
1685 | | stardiv_Toolkit_UnoFixedHyperlinkControl_get_implementation( |
1686 | | css::uno::XComponentContext *, |
1687 | | css::uno::Sequence<css::uno::Any> const &) |
1688 | 0 | { |
1689 | 0 | return cppu::acquire(new UnoFixedHyperlinkControl()); |
1690 | 0 | } |
1691 | | |
1692 | | |
1693 | | |
1694 | | UnoControlFixedTextModel::UnoControlFixedTextModel( const Reference< XComponentContext >& rxContext ) |
1695 | 0 | :UnoControlModel( rxContext ) |
1696 | 0 | { |
1697 | 0 | UNO_CONTROL_MODEL_REGISTER_PROPERTIES<VCLXFixedText>(); |
1698 | 0 | } Unexecuted instantiation: UnoControlFixedTextModel::UnoControlFixedTextModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: UnoControlFixedTextModel::UnoControlFixedTextModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
1699 | | |
1700 | | OUString UnoControlFixedTextModel::getServiceName() |
1701 | 0 | { |
1702 | 0 | return u"stardiv.vcl.controlmodel.FixedText"_ustr; |
1703 | 0 | } |
1704 | | |
1705 | | uno::Any UnoControlFixedTextModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const |
1706 | 0 | { |
1707 | 0 | if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) |
1708 | 0 | { |
1709 | 0 | return uno::Any( u"stardiv.vcl.control.FixedText"_ustr ); |
1710 | 0 | } |
1711 | 0 | else if ( nPropId == BASEPROPERTY_BORDER ) |
1712 | 0 | { |
1713 | 0 | return uno::Any(sal_Int16(0)); |
1714 | 0 | } |
1715 | | |
1716 | 0 | return UnoControlModel::ImplGetDefaultValue( nPropId ); |
1717 | 0 | } |
1718 | | |
1719 | | ::cppu::IPropertyArrayHelper& UnoControlFixedTextModel::getInfoHelper() |
1720 | 0 | { |
1721 | 0 | static UnoPropertyArrayHelper aHelper( ImplGetPropertyIds() ); |
1722 | 0 | return aHelper; |
1723 | 0 | } |
1724 | | |
1725 | | // beans::XMultiPropertySet |
1726 | | uno::Reference< beans::XPropertySetInfo > UnoControlFixedTextModel::getPropertySetInfo( ) |
1727 | 0 | { |
1728 | 0 | static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); |
1729 | 0 | return xInfo; |
1730 | 0 | } |
1731 | | |
1732 | | OUString UnoControlFixedTextModel::getImplementationName() |
1733 | 0 | { |
1734 | 0 | return u"stardiv.Toolkit.UnoControlFixedTextModel"_ustr; |
1735 | 0 | } |
1736 | | |
1737 | | css::uno::Sequence<OUString> |
1738 | | UnoControlFixedTextModel::getSupportedServiceNames() |
1739 | 0 | { |
1740 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlFixedTextModel"_ustr, u"stardiv.vcl.controlmodel.FixedText"_ustr }; |
1741 | 0 | return comphelper::concatSequences( UnoControlModel::getSupportedServiceNames(), vals ); |
1742 | 0 | } |
1743 | | |
1744 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
1745 | | stardiv_Toolkit_UnoControlFixedTextModel_get_implementation( |
1746 | | css::uno::XComponentContext *context, |
1747 | | css::uno::Sequence<css::uno::Any> const &) |
1748 | 0 | { |
1749 | 0 | return cppu::acquire(new UnoControlFixedTextModel(context)); |
1750 | 0 | } |
1751 | | |
1752 | | |
1753 | | |
1754 | | UnoFixedTextControl::UnoFixedTextControl() |
1755 | 0 | { |
1756 | 0 | maComponentInfos.nWidth = 100; |
1757 | 0 | maComponentInfos.nHeight = 12; |
1758 | 0 | } |
1759 | | |
1760 | | OUString UnoFixedTextControl::GetComponentServiceName() const |
1761 | 0 | { |
1762 | 0 | return u"fixedtext"_ustr; |
1763 | 0 | } |
1764 | | |
1765 | | // uno::XInterface |
1766 | | uno::Any UnoFixedTextControl::queryAggregation( const uno::Type & rType ) |
1767 | 0 | { |
1768 | 0 | uno::Any aRet = ::cppu::queryInterface( rType, |
1769 | 0 | static_cast< awt::XFixedText* >(this), |
1770 | 0 | static_cast< awt::XLayoutConstrains* >(this) ); |
1771 | 0 | return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType )); |
1772 | 0 | } |
1773 | | |
1774 | | IMPL_IMPLEMENTATION_ID( UnoFixedTextControl ) |
1775 | | |
1776 | | // lang::XTypeProvider |
1777 | | css::uno::Sequence< css::uno::Type > UnoFixedTextControl::getTypes() |
1778 | 0 | { |
1779 | 0 | static const ::cppu::OTypeCollection aTypeList( |
1780 | 0 | cppu::UnoType<css::lang::XTypeProvider>::get(), |
1781 | 0 | cppu::UnoType<awt::XFixedText>::get(), |
1782 | 0 | cppu::UnoType<awt::XLayoutConstrains>::get(), |
1783 | 0 | UnoControlBase::getTypes() |
1784 | 0 | ); |
1785 | 0 | return aTypeList.getTypes(); |
1786 | 0 | } |
1787 | | |
1788 | | sal_Bool UnoFixedTextControl::isTransparent() |
1789 | 0 | { |
1790 | 0 | return true; |
1791 | 0 | } |
1792 | | |
1793 | | void UnoFixedTextControl::setText( const OUString& Text ) |
1794 | 0 | { |
1795 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), uno::Any(Text), true ); |
1796 | 0 | } |
1797 | | |
1798 | | OUString UnoFixedTextControl::getText() |
1799 | 0 | { |
1800 | 0 | return ImplGetPropertyValue_UString( BASEPROPERTY_LABEL ); |
1801 | 0 | } |
1802 | | |
1803 | | void UnoFixedTextControl::setAlignment( sal_Int16 nAlign ) |
1804 | 0 | { |
1805 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ), uno::Any(nAlign), true ); |
1806 | 0 | } |
1807 | | |
1808 | | sal_Int16 UnoFixedTextControl::getAlignment() |
1809 | 0 | { |
1810 | 0 | sal_Int16 nAlign = 0; |
1811 | 0 | if ( mxModel.is() ) |
1812 | 0 | { |
1813 | 0 | uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ) ); |
1814 | 0 | aVal >>= nAlign; |
1815 | 0 | } |
1816 | 0 | return nAlign; |
1817 | 0 | } |
1818 | | |
1819 | | awt::Size UnoFixedTextControl::getMinimumSize( ) |
1820 | 0 | { |
1821 | 0 | return Impl_getMinimumSize(); |
1822 | 0 | } |
1823 | | |
1824 | | awt::Size UnoFixedTextControl::getPreferredSize( ) |
1825 | 0 | { |
1826 | 0 | return Impl_getPreferredSize(); |
1827 | 0 | } |
1828 | | |
1829 | | awt::Size UnoFixedTextControl::calcAdjustedSize( const awt::Size& rNewSize ) |
1830 | 0 | { |
1831 | 0 | return Impl_calcAdjustedSize( rNewSize ); |
1832 | 0 | } |
1833 | | |
1834 | | OUString UnoFixedTextControl::getImplementationName() |
1835 | 0 | { |
1836 | 0 | return u"stardiv.Toolkit.UnoFixedTextControl"_ustr; |
1837 | 0 | } |
1838 | | |
1839 | | css::uno::Sequence<OUString> UnoFixedTextControl::getSupportedServiceNames() |
1840 | 0 | { |
1841 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlFixedText"_ustr, u"stardiv.vcl.control.FixedText"_ustr }; |
1842 | 0 | return comphelper::concatSequences( UnoControlBase::getSupportedServiceNames(), vals ); |
1843 | 0 | } |
1844 | | |
1845 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
1846 | | stardiv_Toolkit_UnoFixedTextControl_get_implementation( |
1847 | | css::uno::XComponentContext *, |
1848 | | css::uno::Sequence<css::uno::Any> const &) |
1849 | 0 | { |
1850 | 0 | return cppu::acquire(new UnoFixedTextControl()); |
1851 | 0 | } |
1852 | | |
1853 | | |
1854 | | |
1855 | | UnoControlGroupBoxModel::UnoControlGroupBoxModel( const Reference< XComponentContext >& rxContext ) |
1856 | 0 | :UnoControlModel( rxContext ) |
1857 | 0 | { |
1858 | 0 | ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); |
1859 | 0 | ImplRegisterProperty( BASEPROPERTY_ENABLED ); |
1860 | 0 | ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE ); |
1861 | 0 | ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); |
1862 | 0 | ImplRegisterProperty( BASEPROPERTY_HELPTEXT ); |
1863 | 0 | ImplRegisterProperty( BASEPROPERTY_HELPURL ); |
1864 | 0 | ImplRegisterProperty( BASEPROPERTY_LABEL ); |
1865 | 0 | ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); |
1866 | 0 | ImplRegisterProperty( BASEPROPERTY_WRITING_MODE ); |
1867 | 0 | ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE ); |
1868 | 0 | } Unexecuted instantiation: UnoControlGroupBoxModel::UnoControlGroupBoxModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: UnoControlGroupBoxModel::UnoControlGroupBoxModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
1869 | | |
1870 | | OUString UnoControlGroupBoxModel::getServiceName() |
1871 | 0 | { |
1872 | 0 | return u"stardiv.vcl.controlmodel.GroupBox"_ustr; |
1873 | 0 | } |
1874 | | |
1875 | | uno::Any UnoControlGroupBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const |
1876 | 0 | { |
1877 | 0 | if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) |
1878 | 0 | { |
1879 | 0 | return uno::Any(u"stardiv.vcl.control.GroupBox"_ustr ); |
1880 | 0 | } |
1881 | 0 | return UnoControlModel::ImplGetDefaultValue( nPropId ); |
1882 | 0 | } |
1883 | | |
1884 | | ::cppu::IPropertyArrayHelper& UnoControlGroupBoxModel::getInfoHelper() |
1885 | 0 | { |
1886 | 0 | static UnoPropertyArrayHelper aHelper( ImplGetPropertyIds() ); |
1887 | 0 | return aHelper; |
1888 | 0 | } |
1889 | | |
1890 | | // beans::XMultiPropertySet |
1891 | | uno::Reference< beans::XPropertySetInfo > UnoControlGroupBoxModel::getPropertySetInfo( ) |
1892 | 0 | { |
1893 | 0 | static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); |
1894 | 0 | return xInfo; |
1895 | 0 | } |
1896 | | |
1897 | | OUString UnoControlGroupBoxModel::getImplementationName() |
1898 | 0 | { |
1899 | 0 | return u"stardiv.Toolkit.UnoControlGroupBoxModel"_ustr; |
1900 | 0 | } |
1901 | | |
1902 | | css::uno::Sequence<OUString> UnoControlGroupBoxModel::getSupportedServiceNames() |
1903 | 0 | { |
1904 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlGroupBoxModel"_ustr, u"stardiv.vcl.controlmodel.GroupBox"_ustr }; |
1905 | 0 | return comphelper::concatSequences( UnoControlModel::getSupportedServiceNames(), vals ); |
1906 | 0 | } |
1907 | | |
1908 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
1909 | | stardiv_Toolkit_UnoControlGroupBoxModel_get_implementation( |
1910 | | css::uno::XComponentContext *context, |
1911 | | css::uno::Sequence<css::uno::Any> const &) |
1912 | 0 | { |
1913 | 0 | return cppu::acquire(new UnoControlGroupBoxModel(context)); |
1914 | 0 | } |
1915 | | |
1916 | | |
1917 | | |
1918 | | UnoGroupBoxControl::UnoGroupBoxControl() |
1919 | 0 | { |
1920 | 0 | maComponentInfos.nWidth = 100; |
1921 | 0 | maComponentInfos.nHeight = 100; |
1922 | 0 | } |
1923 | | |
1924 | | OUString UnoGroupBoxControl::GetComponentServiceName() const |
1925 | 0 | { |
1926 | 0 | return u"groupbox"_ustr; |
1927 | 0 | } |
1928 | | |
1929 | | sal_Bool UnoGroupBoxControl::isTransparent() |
1930 | 0 | { |
1931 | 0 | return true; |
1932 | 0 | } |
1933 | | |
1934 | | OUString UnoGroupBoxControl::getImplementationName() |
1935 | 0 | { |
1936 | 0 | return u"stardiv.Toolkit.UnoGroupBoxControl"_ustr; |
1937 | 0 | } |
1938 | | |
1939 | | css::uno::Sequence<OUString> UnoGroupBoxControl::getSupportedServiceNames() |
1940 | 0 | { |
1941 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlGroupBox"_ustr, u"stardiv.vcl.control.GroupBox"_ustr }; |
1942 | 0 | return comphelper::concatSequences( UnoControlBase::getSupportedServiceNames(), vals ); |
1943 | 0 | } |
1944 | | |
1945 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
1946 | | stardiv_Toolkit_UnoGroupBoxControl_get_implementation( |
1947 | | css::uno::XComponentContext *, |
1948 | | css::uno::Sequence<css::uno::Any> const &) |
1949 | 0 | { |
1950 | 0 | return cppu::acquire(new UnoGroupBoxControl()); |
1951 | 0 | } |
1952 | | |
1953 | | |
1954 | | // = UnoControlListBoxModel_Data |
1955 | | |
1956 | | namespace { |
1957 | | |
1958 | | struct ListItem |
1959 | | { |
1960 | | OUString ItemText; |
1961 | | OUString ItemImageURL; |
1962 | | Any ItemData; |
1963 | | |
1964 | | ListItem() |
1965 | 0 | { |
1966 | 0 | } |
1967 | | |
1968 | | explicit ListItem( OUString i_ItemText ) |
1969 | 0 | :ItemText(std::move( i_ItemText )) |
1970 | 0 | { |
1971 | 0 | } |
1972 | | }; |
1973 | | |
1974 | | } |
1975 | | |
1976 | | typedef beans::Pair< OUString, OUString > UnoListItem; |
1977 | | |
1978 | | namespace { |
1979 | | |
1980 | | struct StripItemData |
1981 | | { |
1982 | | UnoListItem operator()( const ListItem& i_rItem ) |
1983 | 0 | { |
1984 | 0 | return UnoListItem( i_rItem.ItemText, i_rItem.ItemImageURL ); |
1985 | 0 | } |
1986 | | }; |
1987 | | |
1988 | | } |
1989 | | |
1990 | | struct UnoControlListBoxModel_Data |
1991 | | { |
1992 | | explicit UnoControlListBoxModel_Data( UnoControlListBoxModel& i_rAntiImpl ) |
1993 | 0 | :m_bSettingLegacyProperty( false ) |
1994 | 0 | ,m_rAntiImpl( i_rAntiImpl ) |
1995 | 0 | { |
1996 | 0 | } |
1997 | | |
1998 | 0 | sal_Int32 getItemCount() const { return sal_Int32( m_aListItems.size() ); } |
1999 | | |
2000 | | const ListItem& getItem( const sal_Int32 i_nIndex ) const |
2001 | 0 | { |
2002 | 0 | if ( ( i_nIndex < 0 ) || ( o3tl::make_unsigned(i_nIndex) >= m_aListItems.size() ) ) |
2003 | 0 | throw IndexOutOfBoundsException( OUString(), m_rAntiImpl ); |
2004 | 0 | return m_aListItems[ i_nIndex ]; |
2005 | 0 | } |
2006 | | |
2007 | | ListItem& getItem( const sal_Int32 i_nIndex ) |
2008 | 0 | { |
2009 | 0 | return const_cast< ListItem& >( static_cast< const UnoControlListBoxModel_Data* >( this )->getItem( i_nIndex ) ); |
2010 | 0 | } |
2011 | | |
2012 | | ListItem& insertItem( const sal_Int32 i_nIndex ) |
2013 | 0 | { |
2014 | 0 | if ( ( i_nIndex < 0 ) || ( o3tl::make_unsigned(i_nIndex) > m_aListItems.size() ) ) |
2015 | 0 | throw IndexOutOfBoundsException( OUString(), m_rAntiImpl ); |
2016 | 0 | return *m_aListItems.insert( m_aListItems.begin() + i_nIndex, ListItem() ); |
2017 | 0 | } |
2018 | | |
2019 | | Sequence< UnoListItem > getAllItems() const |
2020 | 0 | { |
2021 | 0 | Sequence< UnoListItem > aItems( sal_Int32( m_aListItems.size() ) ); |
2022 | 0 | ::std::transform( m_aListItems.begin(), m_aListItems.end(), aItems.getArray(), StripItemData() ); |
2023 | 0 | return aItems; |
2024 | 0 | } |
2025 | | |
2026 | | void copyItems( const UnoControlListBoxModel_Data& i_copySource ) |
2027 | 0 | { |
2028 | 0 | m_aListItems = i_copySource.m_aListItems; |
2029 | 0 | } |
2030 | | |
2031 | | void setAllItems( ::std::vector< ListItem >&& i_rItems ) |
2032 | 0 | { |
2033 | 0 | m_aListItems = std::move(i_rItems); |
2034 | 0 | } |
2035 | | |
2036 | | void removeItem( const sal_Int32 i_nIndex ) |
2037 | 0 | { |
2038 | 0 | if ( ( i_nIndex < 0 ) || ( o3tl::make_unsigned(i_nIndex) >= m_aListItems.size() ) ) |
2039 | 0 | throw IndexOutOfBoundsException( OUString(), m_rAntiImpl ); |
2040 | 0 | m_aListItems.erase( m_aListItems.begin() + i_nIndex ); |
2041 | 0 | } |
2042 | | |
2043 | | void removeAllItems() |
2044 | 0 | { |
2045 | 0 | std::vector<ListItem>().swap(m_aListItems); |
2046 | 0 | } |
2047 | | |
2048 | | public: |
2049 | | bool m_bSettingLegacyProperty; |
2050 | | |
2051 | | private: |
2052 | | UnoControlListBoxModel& m_rAntiImpl; |
2053 | | ::std::vector< ListItem > m_aListItems; |
2054 | | }; |
2055 | | |
2056 | | |
2057 | | // = UnoControlListBoxModel |
2058 | | |
2059 | | |
2060 | | UnoControlListBoxModel::UnoControlListBoxModel( const Reference< XComponentContext >& rxContext, ConstructorMode const i_mode ) |
2061 | 0 | :UnoControlListBoxModel_Base( rxContext ) |
2062 | 0 | ,m_xData( new UnoControlListBoxModel_Data( *this ) ) |
2063 | 0 | { |
2064 | 0 | if ( i_mode == ConstructDefault ) |
2065 | 0 | { |
2066 | 0 | UNO_CONTROL_MODEL_REGISTER_PROPERTIES<VCLXListBox>(); |
2067 | 0 | } |
2068 | 0 | } Unexecuted instantiation: UnoControlListBoxModel::UnoControlListBoxModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, UnoControlListBoxModel::ConstructorMode) Unexecuted instantiation: UnoControlListBoxModel::UnoControlListBoxModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, UnoControlListBoxModel::ConstructorMode) |
2069 | | |
2070 | | UnoControlListBoxModel::UnoControlListBoxModel( const UnoControlListBoxModel& i_rSource ) |
2071 | 0 | :UnoControlListBoxModel_Base( i_rSource ) |
2072 | 0 | ,m_xData( new UnoControlListBoxModel_Data( *this ) ) |
2073 | 0 | { |
2074 | 0 | m_xData->copyItems( *i_rSource.m_xData ); |
2075 | 0 | } Unexecuted instantiation: UnoControlListBoxModel::UnoControlListBoxModel(UnoControlListBoxModel const&) Unexecuted instantiation: UnoControlListBoxModel::UnoControlListBoxModel(UnoControlListBoxModel const&) |
2076 | | UnoControlListBoxModel::~UnoControlListBoxModel() |
2077 | 0 | { |
2078 | 0 | } |
2079 | | |
2080 | | OUString UnoControlListBoxModel::getImplementationName() |
2081 | 0 | { |
2082 | 0 | return u"stardiv.Toolkit.UnoControlListBoxModel"_ustr; |
2083 | 0 | } |
2084 | | |
2085 | | css::uno::Sequence<OUString> UnoControlListBoxModel::getSupportedServiceNames() |
2086 | 0 | { |
2087 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlListBoxModel"_ustr, u"stardiv.vcl.controlmodel.ListBox"_ustr }; |
2088 | 0 | return comphelper::concatSequences( UnoControlModel::getSupportedServiceNames(), vals ); |
2089 | 0 | } |
2090 | | |
2091 | | OUString UnoControlListBoxModel::getServiceName() |
2092 | 0 | { |
2093 | 0 | return u"stardiv.vcl.controlmodel.ListBox"_ustr; |
2094 | 0 | } |
2095 | | |
2096 | | |
2097 | | uno::Any UnoControlListBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const |
2098 | 0 | { |
2099 | 0 | if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) |
2100 | 0 | { |
2101 | 0 | return uno::Any( u"stardiv.vcl.control.ListBox"_ustr ); |
2102 | 0 | } |
2103 | 0 | return UnoControlModel::ImplGetDefaultValue( nPropId ); |
2104 | 0 | } |
2105 | | |
2106 | | |
2107 | | ::cppu::IPropertyArrayHelper& UnoControlListBoxModel::getInfoHelper() |
2108 | 0 | { |
2109 | 0 | static UnoPropertyArrayHelper aHelper( ImplGetPropertyIds() ); |
2110 | 0 | return aHelper; |
2111 | 0 | } |
2112 | | |
2113 | | |
2114 | | // beans::XMultiPropertySet |
2115 | | uno::Reference< beans::XPropertySetInfo > UnoControlListBoxModel::getPropertySetInfo( ) |
2116 | 0 | { |
2117 | 0 | static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); |
2118 | 0 | return xInfo; |
2119 | 0 | } |
2120 | | |
2121 | | |
2122 | | namespace |
2123 | | { |
2124 | | struct CreateListItem |
2125 | | { |
2126 | | ListItem operator()( const OUString& i_rItemText ) |
2127 | 0 | { |
2128 | 0 | return ListItem( i_rItemText ); |
2129 | 0 | } |
2130 | | }; |
2131 | | } |
2132 | | |
2133 | | |
2134 | | void UnoControlListBoxModel::setFastPropertyValue_NoBroadcast( std::unique_lock<std::mutex>& rGuard, sal_Int32 nHandle, const uno::Any& rValue ) |
2135 | 0 | { |
2136 | 0 | UnoControlModel::setFastPropertyValue_NoBroadcast( rGuard, nHandle, rValue ); |
2137 | |
|
2138 | 0 | if ( nHandle != BASEPROPERTY_STRINGITEMLIST ) |
2139 | 0 | return; |
2140 | | |
2141 | | // reset selection |
2142 | 0 | uno::Sequence<sal_Int16> aSeq; |
2143 | 0 | setDependentFastPropertyValue( rGuard, BASEPROPERTY_SELECTEDITEMS, uno::Any(aSeq) ); |
2144 | |
|
2145 | 0 | if ( m_xData->m_bSettingLegacyProperty ) |
2146 | 0 | return; |
2147 | | |
2148 | | // synchronize the legacy StringItemList property with our list items |
2149 | 0 | Sequence< OUString > aStringItemList; |
2150 | 0 | Any aPropValue; |
2151 | 0 | getFastPropertyValue( rGuard, aPropValue, BASEPROPERTY_STRINGITEMLIST ); |
2152 | 0 | OSL_VERIFY( aPropValue >>= aStringItemList ); |
2153 | |
|
2154 | 0 | ::std::vector< ListItem > aItems( aStringItemList.getLength() ); |
2155 | 0 | ::std::transform( |
2156 | 0 | std::cbegin(aStringItemList), |
2157 | 0 | std::cend(aStringItemList), |
2158 | 0 | aItems.begin(), |
2159 | 0 | CreateListItem() |
2160 | 0 | ); |
2161 | 0 | m_xData->setAllItems( std::move(aItems) ); |
2162 | | |
2163 | | // since an XItemListListener does not have a "all items modified" or some such method, |
2164 | | // we simulate this by notifying removal of all items, followed by insertion of all new |
2165 | | // items |
2166 | 0 | lang::EventObject aEvent; |
2167 | 0 | aEvent.Source = *this; |
2168 | 0 | m_aItemListListeners.notifyEach( rGuard, &XItemListListener::itemListChanged, aEvent ); |
2169 | | // TODO: OPropertySetHelper calls into this method with the mutex locked ... |
2170 | | // which is wrong for the above notifications ... |
2171 | 0 | } |
2172 | | |
2173 | | |
2174 | | void UnoControlListBoxModel::ImplNormalizePropertySequence( const sal_Int32 _nCount, sal_Int32* _pHandles, |
2175 | | uno::Any* _pValues, sal_Int32* _pValidHandles ) const |
2176 | 0 | { |
2177 | | // dependencies we know: |
2178 | | // BASEPROPERTY_STRINGITEMLIST->BASEPROPERTY_SELECTEDITEMS |
2179 | 0 | ImplEnsureHandleOrder( _nCount, _pHandles, _pValues, BASEPROPERTY_STRINGITEMLIST, BASEPROPERTY_SELECTEDITEMS ); |
2180 | | // BASEPROPERTY_STRINGITEMLIST->BASEPROPERTY_TYPEDITEMLIST |
2181 | 0 | ImplEnsureHandleOrder( _nCount, _pHandles, _pValues, BASEPROPERTY_STRINGITEMLIST, BASEPROPERTY_TYPEDITEMLIST ); |
2182 | |
|
2183 | 0 | UnoControlModel::ImplNormalizePropertySequence( _nCount, _pHandles, _pValues, _pValidHandles ); |
2184 | 0 | } |
2185 | | |
2186 | | |
2187 | | ::sal_Int32 SAL_CALL UnoControlListBoxModel::getItemCount() |
2188 | 0 | { |
2189 | 0 | std::unique_lock aGuard( m_aMutex ); |
2190 | 0 | return m_xData->getItemCount(); |
2191 | 0 | } |
2192 | | |
2193 | | |
2194 | | void SAL_CALL UnoControlListBoxModel::insertItem( ::sal_Int32 i_nPosition, const OUString& i_rItemText, const OUString& i_rItemImageURL ) |
2195 | 0 | { |
2196 | 0 | std::unique_lock aGuard( m_aMutex ); |
2197 | | // SYNCHRONIZED -----> |
2198 | 0 | ListItem& rItem( m_xData->insertItem( i_nPosition ) ); |
2199 | 0 | rItem.ItemText = i_rItemText; |
2200 | 0 | rItem.ItemImageURL = i_rItemImageURL; |
2201 | |
|
2202 | 0 | impl_handleInsert( aGuard, i_nPosition, i_rItemText, i_rItemImageURL ); |
2203 | | // <----- SYNCHRONIZED |
2204 | 0 | } |
2205 | | |
2206 | | |
2207 | | void SAL_CALL UnoControlListBoxModel::insertItemText( ::sal_Int32 i_nPosition, const OUString& i_rItemText ) |
2208 | 0 | { |
2209 | 0 | std::unique_lock aGuard( m_aMutex ); |
2210 | | // SYNCHRONIZED -----> |
2211 | 0 | ListItem& rItem( m_xData->insertItem( i_nPosition ) ); |
2212 | 0 | rItem.ItemText = i_rItemText; |
2213 | |
|
2214 | 0 | impl_handleInsert( aGuard, i_nPosition, i_rItemText, ::std::optional< OUString >() ); |
2215 | | // <----- SYNCHRONIZED |
2216 | 0 | } |
2217 | | |
2218 | | |
2219 | | void SAL_CALL UnoControlListBoxModel::insertItemImage( ::sal_Int32 i_nPosition, const OUString& i_rItemImageURL ) |
2220 | 0 | { |
2221 | 0 | std::unique_lock aGuard( m_aMutex ); |
2222 | | // SYNCHRONIZED -----> |
2223 | 0 | ListItem& rItem( m_xData->insertItem( i_nPosition ) ); |
2224 | 0 | rItem.ItemImageURL = i_rItemImageURL; |
2225 | |
|
2226 | 0 | impl_handleInsert( aGuard, i_nPosition, ::std::optional< OUString >(), i_rItemImageURL ); |
2227 | | // <----- SYNCHRONIZED |
2228 | 0 | } |
2229 | | |
2230 | | |
2231 | | void SAL_CALL UnoControlListBoxModel::removeItem( ::sal_Int32 i_nPosition ) |
2232 | 0 | { |
2233 | 0 | std::unique_lock aGuard( m_aMutex ); |
2234 | | // SYNCHRONIZED -----> |
2235 | 0 | m_xData->removeItem( i_nPosition ); |
2236 | |
|
2237 | 0 | impl_handleRemove( i_nPosition, aGuard ); |
2238 | | // <----- SYNCHRONIZED |
2239 | 0 | } |
2240 | | |
2241 | | |
2242 | | void SAL_CALL UnoControlListBoxModel::removeAllItems( ) |
2243 | 0 | { |
2244 | 0 | std::unique_lock aGuard( m_aMutex ); |
2245 | | // SYNCHRONIZED -----> |
2246 | 0 | m_xData->removeAllItems(); |
2247 | |
|
2248 | 0 | impl_handleRemove( -1, aGuard ); |
2249 | | // <----- SYNCHRONIZED |
2250 | 0 | } |
2251 | | |
2252 | | |
2253 | | void SAL_CALL UnoControlListBoxModel::setItemText( ::sal_Int32 i_nPosition, const OUString& i_rItemText ) |
2254 | 0 | { |
2255 | 0 | std::unique_lock aGuard( m_aMutex ); |
2256 | | // SYNCHRONIZED -----> |
2257 | 0 | ListItem& rItem( m_xData->getItem( i_nPosition ) ); |
2258 | 0 | rItem.ItemText = i_rItemText; |
2259 | |
|
2260 | 0 | impl_handleModify( i_nPosition, i_rItemText, ::std::optional< OUString >(), aGuard ); |
2261 | | // <----- SYNCHRONIZED |
2262 | 0 | } |
2263 | | |
2264 | | |
2265 | | void SAL_CALL UnoControlListBoxModel::setItemImage( ::sal_Int32 i_nPosition, const OUString& i_rItemImageURL ) |
2266 | 0 | { |
2267 | 0 | std::unique_lock aGuard( m_aMutex ); |
2268 | | // SYNCHRONIZED -----> |
2269 | 0 | ListItem& rItem( m_xData->getItem( i_nPosition ) ); |
2270 | 0 | rItem.ItemImageURL = i_rItemImageURL; |
2271 | |
|
2272 | 0 | impl_handleModify( i_nPosition, ::std::optional< OUString >(), i_rItemImageURL, aGuard ); |
2273 | | // <----- SYNCHRONIZED |
2274 | 0 | } |
2275 | | |
2276 | | |
2277 | | void SAL_CALL UnoControlListBoxModel::setItemTextAndImage( ::sal_Int32 i_nPosition, const OUString& i_rItemText, const OUString& i_rItemImageURL ) |
2278 | 0 | { |
2279 | 0 | std::unique_lock aGuard( m_aMutex ); |
2280 | | // SYNCHRONIZED -----> |
2281 | 0 | ListItem& rItem( m_xData->getItem( i_nPosition ) ); |
2282 | 0 | rItem.ItemText = i_rItemText; |
2283 | 0 | rItem.ItemImageURL = i_rItemImageURL; |
2284 | |
|
2285 | 0 | impl_handleModify( i_nPosition, i_rItemText, i_rItemImageURL, aGuard ); |
2286 | | // <----- SYNCHRONIZED |
2287 | 0 | } |
2288 | | |
2289 | | |
2290 | | void SAL_CALL UnoControlListBoxModel::setItemData( ::sal_Int32 i_nPosition, const Any& i_rDataValue ) |
2291 | 0 | { |
2292 | 0 | std::unique_lock aGuard( m_aMutex ); |
2293 | 0 | ListItem& rItem( m_xData->getItem( i_nPosition ) ); |
2294 | 0 | rItem.ItemData = i_rDataValue; |
2295 | 0 | } |
2296 | | |
2297 | | |
2298 | | OUString SAL_CALL UnoControlListBoxModel::getItemText( ::sal_Int32 i_nPosition ) |
2299 | 0 | { |
2300 | 0 | std::unique_lock aGuard( m_aMutex ); |
2301 | 0 | const ListItem& rItem( m_xData->getItem( i_nPosition ) ); |
2302 | 0 | return rItem.ItemText; |
2303 | 0 | } |
2304 | | |
2305 | | |
2306 | | OUString SAL_CALL UnoControlListBoxModel::getItemImage( ::sal_Int32 i_nPosition ) |
2307 | 0 | { |
2308 | 0 | std::unique_lock aGuard( m_aMutex ); |
2309 | 0 | const ListItem& rItem( m_xData->getItem( i_nPosition ) ); |
2310 | 0 | return rItem.ItemImageURL; |
2311 | 0 | } |
2312 | | |
2313 | | |
2314 | | beans::Pair< OUString, OUString > SAL_CALL UnoControlListBoxModel::getItemTextAndImage( ::sal_Int32 i_nPosition ) |
2315 | 0 | { |
2316 | 0 | std::unique_lock aGuard( m_aMutex ); |
2317 | 0 | const ListItem& rItem( m_xData->getItem( i_nPosition ) ); |
2318 | 0 | return beans::Pair< OUString, OUString >( rItem.ItemText, rItem.ItemImageURL ); |
2319 | 0 | } |
2320 | | |
2321 | | |
2322 | | Any SAL_CALL UnoControlListBoxModel::getItemData( ::sal_Int32 i_nPosition ) |
2323 | 0 | { |
2324 | 0 | std::unique_lock aGuard( m_aMutex ); |
2325 | 0 | const ListItem& rItem( m_xData->getItem( i_nPosition ) ); |
2326 | 0 | return rItem.ItemData; |
2327 | 0 | } |
2328 | | |
2329 | | |
2330 | | Sequence< beans::Pair< OUString, OUString > > SAL_CALL UnoControlListBoxModel::getAllItems( ) |
2331 | 0 | { |
2332 | 0 | std::unique_lock aGuard( m_aMutex ); |
2333 | 0 | return m_xData->getAllItems(); |
2334 | 0 | } |
2335 | | |
2336 | | |
2337 | | void SAL_CALL UnoControlListBoxModel::addItemListListener( const uno::Reference< awt::XItemListListener >& i_Listener ) |
2338 | 0 | { |
2339 | 0 | std::unique_lock aGuard( m_aMutex ); |
2340 | 0 | if ( i_Listener.is() ) |
2341 | 0 | m_aItemListListeners.addInterface( aGuard, i_Listener ); |
2342 | 0 | } |
2343 | | |
2344 | | |
2345 | | void SAL_CALL UnoControlListBoxModel::removeItemListListener( const uno::Reference< awt::XItemListListener >& i_Listener ) |
2346 | 0 | { |
2347 | 0 | std::unique_lock aGuard( m_aMutex ); |
2348 | 0 | if ( i_Listener.is() ) |
2349 | 0 | m_aItemListListeners.removeInterface( aGuard, i_Listener ); |
2350 | 0 | } |
2351 | | |
2352 | | |
2353 | | void UnoControlListBoxModel::impl_getStringItemList( std::unique_lock<std::mutex>& rGuard, ::std::vector< OUString >& o_rStringItems ) const |
2354 | 0 | { |
2355 | 0 | Sequence< OUString > aStringItemList; |
2356 | 0 | Any aPropValue; |
2357 | 0 | getFastPropertyValue( rGuard, aPropValue, BASEPROPERTY_STRINGITEMLIST ); |
2358 | 0 | OSL_VERIFY( aPropValue >>= aStringItemList ); |
2359 | |
|
2360 | 0 | comphelper::sequenceToContainer(o_rStringItems, aStringItemList); |
2361 | 0 | } |
2362 | | |
2363 | | |
2364 | | void UnoControlListBoxModel::impl_setStringItemList( std::unique_lock<std::mutex>& rGuard, const ::std::vector< OUString >& i_rStringItems ) |
2365 | 0 | { |
2366 | 0 | Sequence< OUString > aStringItems( comphelper::containerToSequence(i_rStringItems) ); |
2367 | 0 | m_xData->m_bSettingLegacyProperty = true; |
2368 | 0 | try |
2369 | 0 | { |
2370 | 0 | setFastPropertyValueImpl( rGuard, BASEPROPERTY_STRINGITEMLIST, uno::Any( aStringItems ) ); |
2371 | 0 | } |
2372 | 0 | catch( const Exception& ) |
2373 | 0 | { |
2374 | 0 | m_xData->m_bSettingLegacyProperty = false; |
2375 | 0 | throw; |
2376 | 0 | } |
2377 | 0 | m_xData->m_bSettingLegacyProperty = false; |
2378 | 0 | } |
2379 | | |
2380 | | |
2381 | | void UnoControlListBoxModel::impl_handleInsert( std::unique_lock<std::mutex>& rGuard, |
2382 | | const sal_Int32 i_nItemPosition, |
2383 | | const ::std::optional< OUString >& i_rItemText, |
2384 | | const ::std::optional< OUString >& i_rItemImageURL ) |
2385 | 0 | { |
2386 | | // SYNCHRONIZED -----> |
2387 | | // sync with legacy StringItemList property |
2388 | 0 | ::std::vector< OUString > aStringItems; |
2389 | 0 | impl_getStringItemList( rGuard, aStringItems ); |
2390 | 0 | OSL_ENSURE( o3tl::make_unsigned( i_nItemPosition ) <= aStringItems.size(), "UnoControlListBoxModel::impl_handleInsert" ); |
2391 | 0 | if ( o3tl::make_unsigned( i_nItemPosition ) <= aStringItems.size() ) |
2392 | 0 | { |
2393 | 0 | const OUString sItemText( !!i_rItemText ? *i_rItemText : OUString() ); |
2394 | 0 | aStringItems.insert( aStringItems.begin() + i_nItemPosition, sItemText ); |
2395 | 0 | } |
2396 | |
|
2397 | 0 | impl_setStringItemList( rGuard, aStringItems ); |
2398 | | |
2399 | | // notify ItemListListeners |
2400 | 0 | impl_notifyItemListEvent( rGuard, i_nItemPosition, i_rItemText, i_rItemImageURL, &XItemListListener::listItemInserted ); |
2401 | 0 | } |
2402 | | |
2403 | | |
2404 | | void UnoControlListBoxModel::impl_handleRemove( |
2405 | | const sal_Int32 i_nItemPosition, |
2406 | | std::unique_lock<std::mutex>& i_rClearBeforeNotify ) |
2407 | 0 | { |
2408 | | // SYNCHRONIZED -----> |
2409 | 0 | const bool bAllItems = ( i_nItemPosition < 0 ); |
2410 | | // sync with legacy StringItemList property |
2411 | 0 | ::std::vector< OUString > aStringItems; |
2412 | 0 | impl_getStringItemList( i_rClearBeforeNotify, aStringItems ); |
2413 | 0 | if ( !bAllItems ) |
2414 | 0 | { |
2415 | 0 | OSL_ENSURE( o3tl::make_unsigned( i_nItemPosition ) < aStringItems.size(), "UnoControlListBoxModel::impl_handleRemove" ); |
2416 | 0 | if ( o3tl::make_unsigned( i_nItemPosition ) < aStringItems.size() ) |
2417 | 0 | { |
2418 | 0 | aStringItems.erase( aStringItems.begin() + i_nItemPosition ); |
2419 | 0 | } |
2420 | 0 | } |
2421 | 0 | else |
2422 | 0 | { |
2423 | 0 | aStringItems.resize(0); |
2424 | 0 | } |
2425 | |
|
2426 | 0 | impl_setStringItemList( i_rClearBeforeNotify, aStringItems ); |
2427 | | |
2428 | | // notify ItemListListeners |
2429 | 0 | if ( bAllItems ) |
2430 | 0 | { |
2431 | 0 | EventObject aEvent( *this ); |
2432 | 0 | m_aItemListListeners.notifyEach( i_rClearBeforeNotify, &XItemListListener::allItemsRemoved, aEvent ); |
2433 | 0 | } |
2434 | 0 | else |
2435 | 0 | { |
2436 | 0 | impl_notifyItemListEvent( i_rClearBeforeNotify, i_nItemPosition, ::std::optional< OUString >(), ::std::optional< OUString >(), |
2437 | 0 | &XItemListListener::listItemRemoved ); |
2438 | 0 | } |
2439 | 0 | } |
2440 | | |
2441 | | |
2442 | | void UnoControlListBoxModel::impl_handleModify( |
2443 | | const sal_Int32 i_nItemPosition, const ::std::optional< OUString >& i_rItemText, |
2444 | | const ::std::optional< OUString >& i_rItemImageURL, |
2445 | | std::unique_lock<std::mutex>& i_rClearBeforeNotify ) |
2446 | 0 | { |
2447 | | // SYNCHRONIZED -----> |
2448 | 0 | if ( !!i_rItemText ) |
2449 | 0 | { |
2450 | | // sync with legacy StringItemList property |
2451 | 0 | ::std::vector< OUString > aStringItems; |
2452 | 0 | impl_getStringItemList( i_rClearBeforeNotify, aStringItems ); |
2453 | 0 | OSL_ENSURE( o3tl::make_unsigned( i_nItemPosition ) < aStringItems.size(), "UnoControlListBoxModel::impl_handleModify" ); |
2454 | 0 | if ( o3tl::make_unsigned( i_nItemPosition ) < aStringItems.size() ) |
2455 | 0 | { |
2456 | 0 | aStringItems[ i_nItemPosition] = *i_rItemText; |
2457 | 0 | } |
2458 | |
|
2459 | 0 | impl_setStringItemList( i_rClearBeforeNotify, aStringItems ); |
2460 | 0 | } |
2461 | | |
2462 | | // notify ItemListListeners |
2463 | 0 | impl_notifyItemListEvent( i_rClearBeforeNotify, i_nItemPosition, i_rItemText, i_rItemImageURL, &XItemListListener::listItemModified ); |
2464 | 0 | } |
2465 | | |
2466 | | |
2467 | | void UnoControlListBoxModel::impl_notifyItemListEvent( |
2468 | | std::unique_lock<std::mutex>& rGuard, |
2469 | | const sal_Int32 i_nItemPosition, const ::std::optional< OUString >& i_rItemText, |
2470 | | const ::std::optional< OUString >& i_rItemImageURL, |
2471 | | void ( SAL_CALL XItemListListener::*NotificationMethod )( const ItemListEvent& ) ) |
2472 | 0 | { |
2473 | 0 | ItemListEvent aEvent; |
2474 | 0 | aEvent.Source = *this; |
2475 | 0 | aEvent.ItemPosition = i_nItemPosition; |
2476 | 0 | if ( !!i_rItemText ) |
2477 | 0 | { |
2478 | 0 | aEvent.ItemText.IsPresent = true; |
2479 | 0 | aEvent.ItemText.Value = *i_rItemText; |
2480 | 0 | } |
2481 | 0 | if ( !!i_rItemImageURL ) |
2482 | 0 | { |
2483 | 0 | aEvent.ItemImageURL.IsPresent = true; |
2484 | 0 | aEvent.ItemImageURL.Value = *i_rItemImageURL; |
2485 | 0 | } |
2486 | |
|
2487 | 0 | m_aItemListListeners.notifyEach( rGuard, NotificationMethod, aEvent ); |
2488 | 0 | } |
2489 | | |
2490 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
2491 | | stardiv_Toolkit_UnoControlListBoxModel_get_implementation( |
2492 | | css::uno::XComponentContext *context, |
2493 | | css::uno::Sequence<css::uno::Any> const &) |
2494 | 0 | { |
2495 | 0 | return cppu::acquire(new UnoControlListBoxModel(context)); |
2496 | 0 | } |
2497 | | |
2498 | | |
2499 | | |
2500 | | UnoListBoxControl::UnoListBoxControl() |
2501 | 0 | :maActionListeners( *this ) |
2502 | 0 | ,maItemListeners( *this ) |
2503 | 0 | { |
2504 | 0 | maComponentInfos.nWidth = 100; |
2505 | 0 | maComponentInfos.nHeight = 12; |
2506 | 0 | } |
2507 | | |
2508 | | OUString UnoListBoxControl::GetComponentServiceName() const |
2509 | 0 | { |
2510 | 0 | return u"listbox"_ustr; |
2511 | 0 | } |
2512 | | |
2513 | | OUString UnoListBoxControl::getImplementationName() |
2514 | 0 | { |
2515 | 0 | return u"stardiv.Toolkit.UnoListBoxControl"_ustr; |
2516 | 0 | } |
2517 | | |
2518 | | css::uno::Sequence<OUString> UnoListBoxControl::getSupportedServiceNames() |
2519 | 0 | { |
2520 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlListBox"_ustr, u"stardiv.vcl.control.ListBox"_ustr }; |
2521 | 0 | return comphelper::concatSequences( UnoControlBase::getSupportedServiceNames(), vals); |
2522 | 0 | } |
2523 | | |
2524 | | void UnoListBoxControl::dispose() |
2525 | 0 | { |
2526 | 0 | lang::EventObject aEvt; |
2527 | 0 | aEvt.Source = getXWeak(); |
2528 | 0 | maActionListeners.disposeAndClear( aEvt ); |
2529 | 0 | maItemListeners.disposeAndClear( aEvt ); |
2530 | 0 | UnoControl::dispose(); |
2531 | 0 | } |
2532 | | |
2533 | | void UnoListBoxControl::ImplUpdateSelectedItemsProperty() |
2534 | 0 | { |
2535 | 0 | if ( getPeer().is() ) |
2536 | 0 | { |
2537 | 0 | uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY ); |
2538 | 0 | DBG_ASSERT( xListBox.is(), "XListBox?" ); |
2539 | |
|
2540 | 0 | uno::Sequence<sal_Int16> aSeq = xListBox->getSelectedItemsPos(); |
2541 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ), uno::Any(aSeq), false ); |
2542 | 0 | } |
2543 | 0 | } |
2544 | | |
2545 | | void UnoListBoxControl::updateFromModel() |
2546 | 0 | { |
2547 | 0 | UnoControlBase::updateFromModel(); |
2548 | |
|
2549 | 0 | Reference< XItemListListener > xItemListListener( getPeer(), UNO_QUERY ); |
2550 | 0 | ENSURE_OR_RETURN_VOID( xItemListListener.is(), "UnoListBoxControl::updateFromModel: a peer which is no ItemListListener?!" ); |
2551 | |
|
2552 | 0 | EventObject aEvent( getModel() ); |
2553 | 0 | xItemListListener->itemListChanged( aEvent ); |
2554 | | |
2555 | | // notify the change of the SelectedItems property, again. While our base class, in updateFromModel, |
2556 | | // already did this, our peer(s) can only legitimately set the selection after they have the string |
2557 | | // item list, which we just notified with the itemListChanged call. |
2558 | 0 | const OUString& sSelectedItemsPropName( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ) ); |
2559 | 0 | ImplSetPeerProperty( sSelectedItemsPropName, ImplGetPropertyValue( sSelectedItemsPropName ) ); |
2560 | 0 | } |
2561 | | |
2562 | | void UnoListBoxControl::ImplSetPeerProperty( const OUString& rPropName, const uno::Any& rVal ) |
2563 | 0 | { |
2564 | 0 | if ( rPropName == GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ) |
2565 | | // do not forward this to our peer. We are a XItemListListener at our model, and changes in the string item |
2566 | | // list (which is a legacy property) will, later, arrive as changes in the ItemList. Those latter changes |
2567 | | // will be forwarded to the peer, which will update itself accordingly. |
2568 | 0 | return; |
2569 | | |
2570 | 0 | UnoControl::ImplSetPeerProperty( rPropName, rVal ); |
2571 | 0 | } |
2572 | | |
2573 | | void UnoListBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) |
2574 | 0 | { |
2575 | 0 | UnoControl::createPeer( rxToolkit, rParentPeer ); |
2576 | |
|
2577 | 0 | uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY ); |
2578 | 0 | xListBox->addItemListener( this ); |
2579 | |
|
2580 | 0 | if ( maActionListeners.getLength() ) |
2581 | 0 | xListBox->addActionListener( &maActionListeners ); |
2582 | 0 | } |
2583 | | |
2584 | | void UnoListBoxControl::addActionListener(const uno::Reference< awt::XActionListener > & l) |
2585 | 0 | { |
2586 | 0 | maActionListeners.addInterface( l ); |
2587 | 0 | if( getPeer().is() && maActionListeners.getLength() == 1 ) |
2588 | 0 | { |
2589 | 0 | uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY ); |
2590 | 0 | xListBox->addActionListener( &maActionListeners ); |
2591 | 0 | } |
2592 | 0 | } |
2593 | | |
2594 | | void UnoListBoxControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) |
2595 | 0 | { |
2596 | 0 | if( getPeer().is() && maActionListeners.getLength() == 1 ) |
2597 | 0 | { |
2598 | 0 | uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY ); |
2599 | 0 | xListBox->removeActionListener( &maActionListeners ); |
2600 | 0 | } |
2601 | 0 | maActionListeners.removeInterface( l ); |
2602 | 0 | } |
2603 | | |
2604 | | void UnoListBoxControl::addItemListener(const uno::Reference < awt::XItemListener > & l) |
2605 | 0 | { |
2606 | 0 | maItemListeners.addInterface( l ); |
2607 | 0 | } |
2608 | | |
2609 | | void UnoListBoxControl::removeItemListener(const uno::Reference < awt::XItemListener > & l) |
2610 | 0 | { |
2611 | 0 | maItemListeners.removeInterface( l ); |
2612 | 0 | } |
2613 | | |
2614 | | void UnoListBoxControl::addItem( const OUString& aItem, sal_Int16 nPos ) |
2615 | 0 | { |
2616 | 0 | uno::Sequence<OUString> aSeq { aItem }; |
2617 | 0 | addItems( aSeq, nPos ); |
2618 | 0 | } |
2619 | | |
2620 | | void UnoListBoxControl::addItems( const uno::Sequence< OUString>& aItems, sal_Int16 nPos ) |
2621 | 0 | { |
2622 | 0 | uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ); |
2623 | 0 | uno::Sequence< OUString> aSeq; |
2624 | 0 | aVal >>= aSeq; |
2625 | 0 | sal_uInt16 nNewItems = static_cast<sal_uInt16>(aItems.getLength()); |
2626 | 0 | sal_uInt16 nOldLen = static_cast<sal_uInt16>(aSeq.getLength()); |
2627 | 0 | sal_uInt16 nNewLen = nOldLen + nNewItems; |
2628 | |
|
2629 | 0 | uno::Sequence< OUString> aNewSeq( nNewLen ); |
2630 | |
|
2631 | 0 | if ( ( nPos < 0 ) || ( nPos > nOldLen ) ) |
2632 | 0 | nPos = nOldLen; |
2633 | | |
2634 | | // Items before the Paste-Position |
2635 | 0 | auto it = std::copy(std::cbegin(aSeq), std::next(std::cbegin(aSeq), nPos), aNewSeq.getArray()); |
2636 | | |
2637 | | // New Items |
2638 | 0 | it = std::copy(aItems.begin(), aItems.end(), it); |
2639 | | |
2640 | | // Rest of old Items |
2641 | 0 | std::copy(std::next(std::cbegin(aSeq), nPos), std::cend(aSeq), it); |
2642 | |
|
2643 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), uno::Any(aNewSeq), true ); |
2644 | 0 | } |
2645 | | |
2646 | | void UnoListBoxControl::removeItems( sal_Int16 nPos, sal_Int16 nCount ) |
2647 | 0 | { |
2648 | 0 | uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ); |
2649 | 0 | uno::Sequence< OUString> aSeq; |
2650 | 0 | aVal >>= aSeq; |
2651 | 0 | sal_uInt16 nOldLen = static_cast<sal_uInt16>(aSeq.getLength()); |
2652 | 0 | if ( !(nOldLen && ( nPos < nOldLen )) ) |
2653 | 0 | return; |
2654 | | |
2655 | 0 | if ( nCount > ( nOldLen-nPos ) ) |
2656 | 0 | nCount = nOldLen-nPos; |
2657 | |
|
2658 | 0 | sal_uInt16 nNewLen = nOldLen - nCount; |
2659 | |
|
2660 | 0 | uno::Sequence< OUString> aNewSeq( nNewLen ); |
2661 | | |
2662 | | // Items before the Remove-Position |
2663 | 0 | auto it = std::copy(std::cbegin(aSeq), std::next(std::cbegin(aSeq), nPos), aNewSeq.getArray()); |
2664 | | |
2665 | | // Rest of Items |
2666 | 0 | std::copy(std::next(std::cbegin(aSeq), nPos + nCount), std::cend(aSeq), it); |
2667 | |
|
2668 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), uno::Any(aNewSeq), true ); |
2669 | 0 | } |
2670 | | |
2671 | | sal_Int16 UnoListBoxControl::getItemCount() |
2672 | 0 | { |
2673 | 0 | uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ); |
2674 | 0 | uno::Sequence< OUString> aSeq; |
2675 | 0 | aVal >>= aSeq; |
2676 | 0 | return static_cast<sal_Int16>(aSeq.getLength()); |
2677 | 0 | } |
2678 | | |
2679 | | OUString UnoListBoxControl::getItem( sal_Int16 nPos ) |
2680 | 0 | { |
2681 | 0 | OUString aItem; |
2682 | 0 | uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ); |
2683 | 0 | uno::Sequence< OUString> aSeq; |
2684 | 0 | aVal >>= aSeq; |
2685 | 0 | if ( nPos < aSeq.getLength() ) |
2686 | 0 | aItem = aSeq[nPos]; |
2687 | 0 | return aItem; |
2688 | 0 | } |
2689 | | |
2690 | | uno::Sequence< OUString> UnoListBoxControl::getItems() |
2691 | 0 | { |
2692 | 0 | uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ); |
2693 | 0 | uno::Sequence< OUString> aSeq; |
2694 | 0 | aVal >>= aSeq; |
2695 | 0 | return aSeq; |
2696 | 0 | } |
2697 | | |
2698 | | sal_Int16 UnoListBoxControl::getSelectedItemPos() |
2699 | 0 | { |
2700 | 0 | sal_Int16 n = -1; |
2701 | 0 | if ( getPeer().is() ) |
2702 | 0 | { |
2703 | 0 | uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY ); |
2704 | 0 | n = xListBox->getSelectedItemPos(); |
2705 | 0 | } |
2706 | 0 | return n; |
2707 | 0 | } |
2708 | | |
2709 | | uno::Sequence<sal_Int16> UnoListBoxControl::getSelectedItemsPos() |
2710 | 0 | { |
2711 | 0 | uno::Sequence<sal_Int16> aSeq; |
2712 | 0 | if ( getPeer().is() ) |
2713 | 0 | { |
2714 | 0 | uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY ); |
2715 | 0 | aSeq = xListBox->getSelectedItemsPos(); |
2716 | 0 | } |
2717 | 0 | return aSeq; |
2718 | 0 | } |
2719 | | |
2720 | | OUString UnoListBoxControl::getSelectedItem() |
2721 | 0 | { |
2722 | 0 | OUString aItem; |
2723 | 0 | if ( getPeer().is() ) |
2724 | 0 | { |
2725 | 0 | uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY ); |
2726 | 0 | aItem = xListBox->getSelectedItem(); |
2727 | 0 | } |
2728 | 0 | return aItem; |
2729 | 0 | } |
2730 | | |
2731 | | uno::Sequence< OUString> UnoListBoxControl::getSelectedItems() |
2732 | 0 | { |
2733 | 0 | uno::Sequence< OUString> aSeq; |
2734 | 0 | if ( getPeer().is() ) |
2735 | 0 | { |
2736 | 0 | uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY ); |
2737 | 0 | aSeq = xListBox->getSelectedItems(); |
2738 | 0 | } |
2739 | 0 | return aSeq; |
2740 | 0 | } |
2741 | | |
2742 | | void UnoListBoxControl::selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) |
2743 | 0 | { |
2744 | 0 | if ( getPeer().is() ) |
2745 | 0 | { |
2746 | 0 | uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY ); |
2747 | 0 | xListBox->selectItemPos( nPos, bSelect ); |
2748 | 0 | } |
2749 | 0 | ImplUpdateSelectedItemsProperty(); |
2750 | 0 | } |
2751 | | |
2752 | | void UnoListBoxControl::selectItemsPos( const uno::Sequence<sal_Int16>& aPositions, sal_Bool bSelect ) |
2753 | 0 | { |
2754 | 0 | if ( getPeer().is() ) |
2755 | 0 | { |
2756 | 0 | uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY ); |
2757 | 0 | xListBox->selectItemsPos( aPositions, bSelect ); |
2758 | 0 | } |
2759 | 0 | ImplUpdateSelectedItemsProperty(); |
2760 | 0 | } |
2761 | | |
2762 | | void UnoListBoxControl::selectItem( const OUString& aItem, sal_Bool bSelect ) |
2763 | 0 | { |
2764 | 0 | if ( getPeer().is() ) |
2765 | 0 | { |
2766 | 0 | uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY ); |
2767 | 0 | xListBox->selectItem( aItem, bSelect ); |
2768 | 0 | } |
2769 | 0 | ImplUpdateSelectedItemsProperty(); |
2770 | 0 | } |
2771 | | |
2772 | | void UnoListBoxControl::makeVisible( sal_Int16 nEntry ) |
2773 | 0 | { |
2774 | 0 | if ( getPeer().is() ) |
2775 | 0 | { |
2776 | 0 | uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY ); |
2777 | 0 | xListBox->makeVisible( nEntry ); |
2778 | 0 | } |
2779 | 0 | } |
2780 | | |
2781 | | void UnoListBoxControl::setDropDownLineCount( sal_Int16 nLines ) |
2782 | 0 | { |
2783 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LINECOUNT ), uno::Any(nLines), true ); |
2784 | 0 | } |
2785 | | |
2786 | | sal_Int16 UnoListBoxControl::getDropDownLineCount() |
2787 | 0 | { |
2788 | 0 | return ImplGetPropertyValue_INT16( BASEPROPERTY_LINECOUNT ); |
2789 | 0 | } |
2790 | | |
2791 | | sal_Bool UnoListBoxControl::isMutipleMode() |
2792 | 0 | { |
2793 | 0 | return ImplGetPropertyValue_BOOL( BASEPROPERTY_MULTISELECTION ); |
2794 | 0 | } |
2795 | | |
2796 | | void UnoListBoxControl::setMultipleMode( sal_Bool bMulti ) |
2797 | 0 | { |
2798 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTISELECTION ), uno::Any(bMulti), true ); |
2799 | 0 | } |
2800 | | |
2801 | | void UnoListBoxControl::itemStateChanged( const awt::ItemEvent& rEvent ) |
2802 | 0 | { |
2803 | 0 | ImplUpdateSelectedItemsProperty(); |
2804 | 0 | if ( maItemListeners.getLength() ) |
2805 | 0 | { |
2806 | 0 | try |
2807 | 0 | { |
2808 | 0 | maItemListeners.itemStateChanged( rEvent ); |
2809 | 0 | } |
2810 | 0 | catch( const Exception& ) |
2811 | 0 | { |
2812 | 0 | TOOLS_WARN_EXCEPTION( "toolkit", "UnoListBoxControl::itemStateChanged"); |
2813 | 0 | } |
2814 | 0 | } |
2815 | 0 | } |
2816 | | |
2817 | | awt::Size UnoListBoxControl::getMinimumSize( ) |
2818 | 0 | { |
2819 | 0 | return Impl_getMinimumSize(); |
2820 | 0 | } |
2821 | | |
2822 | | awt::Size UnoListBoxControl::getPreferredSize( ) |
2823 | 0 | { |
2824 | 0 | return Impl_getPreferredSize(); |
2825 | 0 | } |
2826 | | |
2827 | | awt::Size UnoListBoxControl::calcAdjustedSize( const awt::Size& rNewSize ) |
2828 | 0 | { |
2829 | 0 | return Impl_calcAdjustedSize( rNewSize ); |
2830 | 0 | } |
2831 | | |
2832 | | awt::Size UnoListBoxControl::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) |
2833 | 0 | { |
2834 | 0 | return Impl_getMinimumSize( nCols, nLines ); |
2835 | 0 | } |
2836 | | |
2837 | | void UnoListBoxControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) |
2838 | 0 | { |
2839 | 0 | Impl_getColumnsAndLines( nCols, nLines ); |
2840 | 0 | } |
2841 | | |
2842 | | sal_Bool SAL_CALL UnoListBoxControl::setModel( const uno::Reference< awt::XControlModel >& i_rModel ) |
2843 | 0 | { |
2844 | 0 | ::osl::MutexGuard aGuard( GetMutex() ); |
2845 | |
|
2846 | 0 | const Reference< XItemList > xOldItems( getModel(), UNO_QUERY ); |
2847 | 0 | OSL_ENSURE( xOldItems.is() || !getModel().is(), "UnoListBoxControl::setModel: illegal old model!" ); |
2848 | 0 | const Reference< XItemList > xNewItems( i_rModel, UNO_QUERY ); |
2849 | 0 | OSL_ENSURE( xNewItems.is() || !i_rModel.is(), "UnoListBoxControl::setModel: illegal new model!" ); |
2850 | |
|
2851 | 0 | if ( !UnoListBoxControl_Base::setModel( i_rModel ) ) |
2852 | 0 | return false; |
2853 | | |
2854 | 0 | if ( xOldItems.is() ) |
2855 | 0 | xOldItems->removeItemListListener( this ); |
2856 | 0 | if ( xNewItems.is() ) |
2857 | 0 | xNewItems->addItemListListener( this ); |
2858 | |
|
2859 | 0 | return true; |
2860 | 0 | } |
2861 | | |
2862 | | void SAL_CALL UnoListBoxControl::listItemInserted( const awt::ItemListEvent& i_rEvent ) |
2863 | 0 | { |
2864 | 0 | const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY ); |
2865 | 0 | OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemInserted: invalid peer!" ); |
2866 | 0 | if ( xPeerListener.is() ) |
2867 | 0 | xPeerListener->listItemInserted( i_rEvent ); |
2868 | 0 | } |
2869 | | |
2870 | | void SAL_CALL UnoListBoxControl::listItemRemoved( const awt::ItemListEvent& i_rEvent ) |
2871 | 0 | { |
2872 | 0 | const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY ); |
2873 | 0 | OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemRemoved: invalid peer!" ); |
2874 | 0 | if ( xPeerListener.is() ) |
2875 | 0 | xPeerListener->listItemRemoved( i_rEvent ); |
2876 | 0 | } |
2877 | | |
2878 | | void SAL_CALL UnoListBoxControl::listItemModified( const awt::ItemListEvent& i_rEvent ) |
2879 | 0 | { |
2880 | 0 | const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY ); |
2881 | 0 | OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemModified: invalid peer!" ); |
2882 | 0 | if ( xPeerListener.is() ) |
2883 | 0 | xPeerListener->listItemModified( i_rEvent ); |
2884 | 0 | } |
2885 | | |
2886 | | void SAL_CALL UnoListBoxControl::allItemsRemoved( const lang::EventObject& i_rEvent ) |
2887 | 0 | { |
2888 | 0 | const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY ); |
2889 | 0 | OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::allItemsRemoved: invalid peer!" ); |
2890 | 0 | if ( xPeerListener.is() ) |
2891 | 0 | xPeerListener->allItemsRemoved( i_rEvent ); |
2892 | 0 | } |
2893 | | |
2894 | | void SAL_CALL UnoListBoxControl::itemListChanged( const lang::EventObject& i_rEvent ) |
2895 | 0 | { |
2896 | 0 | const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY ); |
2897 | 0 | OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::itemListChanged: invalid peer!" ); |
2898 | 0 | if ( xPeerListener.is() ) |
2899 | 0 | xPeerListener->itemListChanged( i_rEvent ); |
2900 | 0 | } |
2901 | | |
2902 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
2903 | | stardiv_Toolkit_UnoListBoxControl_get_implementation( |
2904 | | css::uno::XComponentContext *, |
2905 | | css::uno::Sequence<css::uno::Any> const &) |
2906 | 0 | { |
2907 | 0 | return cppu::acquire(new UnoListBoxControl()); |
2908 | 0 | } |
2909 | | |
2910 | | |
2911 | | |
2912 | | UnoControlComboBoxModel::UnoControlComboBoxModel( const Reference< XComponentContext >& rxContext ) |
2913 | 0 | :UnoControlListBoxModel( rxContext, ConstructWithoutProperties ) |
2914 | 0 | { |
2915 | 0 | UNO_CONTROL_MODEL_REGISTER_PROPERTIES<VCLXComboBox>(); |
2916 | 0 | } Unexecuted instantiation: UnoControlComboBoxModel::UnoControlComboBoxModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: UnoControlComboBoxModel::UnoControlComboBoxModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
2917 | | |
2918 | | OUString UnoControlComboBoxModel::getImplementationName() |
2919 | 0 | { |
2920 | 0 | return u"stardiv.Toolkit.UnoControlComboBoxModel"_ustr; |
2921 | 0 | } |
2922 | | |
2923 | | css::uno::Sequence<OUString> UnoControlComboBoxModel::getSupportedServiceNames() |
2924 | 0 | { |
2925 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlComboBoxModel"_ustr, u"stardiv.vcl.controlmodel.ComboBox"_ustr }; |
2926 | 0 | return comphelper::concatSequences( UnoControlModel::getSupportedServiceNames(), vals); |
2927 | 0 | } |
2928 | | |
2929 | | uno::Reference< beans::XPropertySetInfo > UnoControlComboBoxModel::getPropertySetInfo( ) |
2930 | 0 | { |
2931 | 0 | static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); |
2932 | 0 | return xInfo; |
2933 | 0 | } |
2934 | | |
2935 | | ::cppu::IPropertyArrayHelper& UnoControlComboBoxModel::getInfoHelper() |
2936 | 0 | { |
2937 | 0 | static UnoPropertyArrayHelper aHelper( ImplGetPropertyIds() ); |
2938 | 0 | return aHelper; |
2939 | 0 | } |
2940 | | |
2941 | | |
2942 | | OUString UnoControlComboBoxModel::getServiceName() |
2943 | 0 | { |
2944 | 0 | return u"stardiv.vcl.controlmodel.ComboBox"_ustr; |
2945 | 0 | } |
2946 | | |
2947 | | void UnoControlComboBoxModel::setFastPropertyValue_NoBroadcast( std::unique_lock<std::mutex>& rGuard, sal_Int32 nHandle, const uno::Any& rValue ) |
2948 | 0 | { |
2949 | 0 | UnoControlModel::setFastPropertyValue_NoBroadcast( rGuard, nHandle, rValue ); |
2950 | |
|
2951 | 0 | if (nHandle != BASEPROPERTY_STRINGITEMLIST || m_xData->m_bSettingLegacyProperty) |
2952 | 0 | return; |
2953 | | |
2954 | | // synchronize the legacy StringItemList property with our list items |
2955 | 0 | Sequence< OUString > aStringItemList; |
2956 | 0 | Any aPropValue; |
2957 | 0 | getFastPropertyValue( rGuard, aPropValue, BASEPROPERTY_STRINGITEMLIST ); |
2958 | 0 | OSL_VERIFY( aPropValue >>= aStringItemList ); |
2959 | |
|
2960 | 0 | ::std::vector< ListItem > aItems( aStringItemList.getLength() ); |
2961 | 0 | ::std::transform( |
2962 | 0 | std::cbegin(aStringItemList), |
2963 | 0 | std::cend(aStringItemList), |
2964 | 0 | aItems.begin(), |
2965 | 0 | CreateListItem() |
2966 | 0 | ); |
2967 | 0 | m_xData->setAllItems( std::move(aItems) ); |
2968 | | |
2969 | | // since an XItemListListener does not have a "all items modified" or some such method, |
2970 | | // we simulate this by notifying removal of all items, followed by insertion of all new |
2971 | | // items |
2972 | 0 | lang::EventObject aEvent; |
2973 | 0 | aEvent.Source = *this; |
2974 | 0 | m_aItemListListeners.notifyEach( rGuard, &XItemListListener::itemListChanged, aEvent ); |
2975 | 0 | } |
2976 | | |
2977 | | uno::Any UnoControlComboBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const |
2978 | 0 | { |
2979 | 0 | if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) |
2980 | 0 | { |
2981 | 0 | return uno::Any( u"stardiv.vcl.control.ComboBox"_ustr ); |
2982 | 0 | } |
2983 | 0 | return UnoControlModel::ImplGetDefaultValue( nPropId ); |
2984 | 0 | } |
2985 | | |
2986 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
2987 | | stardiv_Toolkit_UnoControlComboBoxModel_get_implementation( |
2988 | | css::uno::XComponentContext *context, |
2989 | | css::uno::Sequence<css::uno::Any> const &) |
2990 | 0 | { |
2991 | 0 | return cppu::acquire(new UnoControlComboBoxModel(context)); |
2992 | 0 | } |
2993 | | |
2994 | | |
2995 | | |
2996 | | UnoComboBoxControl::UnoComboBoxControl() |
2997 | 0 | :maActionListeners( *this ) |
2998 | 0 | ,maItemListeners( *this ) |
2999 | 0 | { |
3000 | 0 | maComponentInfos.nWidth = 100; |
3001 | 0 | maComponentInfos.nHeight = 12; |
3002 | 0 | } |
3003 | | |
3004 | | OUString UnoComboBoxControl::getImplementationName() |
3005 | 0 | { |
3006 | 0 | return u"stardiv.Toolkit.UnoComboBoxControl"_ustr; |
3007 | 0 | } |
3008 | | |
3009 | | css::uno::Sequence<OUString> UnoComboBoxControl::getSupportedServiceNames() |
3010 | 0 | { |
3011 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlComboBox"_ustr, u"stardiv.vcl.control.ComboBox"_ustr }; |
3012 | 0 | return comphelper::concatSequences( UnoEditControl::getSupportedServiceNames(), vals); |
3013 | 0 | } |
3014 | | |
3015 | | OUString UnoComboBoxControl::GetComponentServiceName() const |
3016 | 0 | { |
3017 | 0 | return u"combobox"_ustr; |
3018 | 0 | } |
3019 | | |
3020 | | void UnoComboBoxControl::dispose() |
3021 | 0 | { |
3022 | 0 | lang::EventObject aEvt; |
3023 | 0 | aEvt.Source = getXWeak(); |
3024 | 0 | maActionListeners.disposeAndClear( aEvt ); |
3025 | 0 | maItemListeners.disposeAndClear( aEvt ); |
3026 | 0 | UnoControl::dispose(); |
3027 | 0 | } |
3028 | | uno::Any UnoComboBoxControl::queryAggregation( const uno::Type & rType ) |
3029 | 0 | { |
3030 | 0 | uno::Any aRet = ::cppu::queryInterface( rType, |
3031 | 0 | static_cast< awt::XComboBox* >(this) ); |
3032 | 0 | if ( !aRet.hasValue() ) |
3033 | 0 | { |
3034 | 0 | aRet = ::cppu::queryInterface( rType, |
3035 | 0 | static_cast< awt::XItemListener* >(this) ); |
3036 | 0 | if ( !aRet.hasValue() ) |
3037 | 0 | { |
3038 | 0 | aRet = ::cppu::queryInterface( rType, |
3039 | 0 | static_cast< awt::XItemListListener* >(this) ); |
3040 | 0 | } |
3041 | 0 | } |
3042 | 0 | return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType )); |
3043 | 0 | } |
3044 | | |
3045 | | IMPL_IMPLEMENTATION_ID( UnoComboBoxControl ) |
3046 | | |
3047 | | // lang::XTypeProvider |
3048 | | css::uno::Sequence< css::uno::Type > UnoComboBoxControl::getTypes() |
3049 | 0 | { |
3050 | 0 | static const ::cppu::OTypeCollection aTypeList( |
3051 | 0 | cppu::UnoType<awt::XComboBox>::get(), |
3052 | 0 | cppu::UnoType<awt::XItemListener>::get(), |
3053 | 0 | cppu::UnoType<awt::XItemListListener>::get(), |
3054 | 0 | UnoEditControl::getTypes() |
3055 | 0 | ); |
3056 | 0 | return aTypeList.getTypes(); |
3057 | 0 | } |
3058 | | |
3059 | | void UnoComboBoxControl::updateFromModel() |
3060 | 0 | { |
3061 | 0 | UnoEditControl::updateFromModel(); |
3062 | |
|
3063 | 0 | Reference< XItemListListener > xItemListListener( getPeer(), UNO_QUERY ); |
3064 | 0 | ENSURE_OR_RETURN_VOID( xItemListListener.is(), "UnoComboBoxControl::updateFromModel: a peer which is no ItemListListener?!" ); |
3065 | |
|
3066 | 0 | EventObject aEvent( getModel() ); |
3067 | 0 | xItemListListener->itemListChanged( aEvent ); |
3068 | 0 | } |
3069 | | void UnoComboBoxControl::ImplSetPeerProperty( const OUString& rPropName, const uno::Any& rVal ) |
3070 | 0 | { |
3071 | 0 | if ( rPropName == GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ) |
3072 | | // do not forward this to our peer. We are a XItemListListener at our model, and changes in the string item |
3073 | | // list (which is a legacy property) will, later, arrive as changes in the ItemList. Those latter changes |
3074 | | // will be forwarded to the peer, which will update itself accordingly. |
3075 | 0 | return; |
3076 | | |
3077 | 0 | UnoEditControl::ImplSetPeerProperty( rPropName, rVal ); |
3078 | 0 | } |
3079 | | void UnoComboBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) |
3080 | 0 | { |
3081 | 0 | UnoEditControl::createPeer( rxToolkit, rParentPeer ); |
3082 | |
|
3083 | 0 | uno::Reference < awt::XComboBox > xComboBox( getPeer(), uno::UNO_QUERY ); |
3084 | 0 | if ( maActionListeners.getLength() ) |
3085 | 0 | xComboBox->addActionListener( &maActionListeners ); |
3086 | 0 | if ( maItemListeners.getLength() ) |
3087 | 0 | xComboBox->addItemListener( &maItemListeners ); |
3088 | 0 | } |
3089 | | |
3090 | | void UnoComboBoxControl::addActionListener(const uno::Reference< awt::XActionListener > & l) |
3091 | 0 | { |
3092 | 0 | maActionListeners.addInterface( l ); |
3093 | 0 | if( getPeer().is() && maActionListeners.getLength() == 1 ) |
3094 | 0 | { |
3095 | 0 | uno::Reference < awt::XComboBox > xComboBox( getPeer(), uno::UNO_QUERY ); |
3096 | 0 | xComboBox->addActionListener( &maActionListeners ); |
3097 | 0 | } |
3098 | 0 | } |
3099 | | |
3100 | | void UnoComboBoxControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) |
3101 | 0 | { |
3102 | 0 | if( getPeer().is() && maActionListeners.getLength() == 1 ) |
3103 | 0 | { |
3104 | 0 | uno::Reference < awt::XComboBox > xComboBox( getPeer(), uno::UNO_QUERY ); |
3105 | 0 | xComboBox->removeActionListener( &maActionListeners ); |
3106 | 0 | } |
3107 | 0 | maActionListeners.removeInterface( l ); |
3108 | 0 | } |
3109 | | |
3110 | | void UnoComboBoxControl::addItemListener(const uno::Reference < awt::XItemListener > & l) |
3111 | 0 | { |
3112 | 0 | maItemListeners.addInterface( l ); |
3113 | 0 | if( getPeer().is() && maItemListeners.getLength() == 1 ) |
3114 | 0 | { |
3115 | 0 | uno::Reference < awt::XComboBox > xComboBox( getPeer(), uno::UNO_QUERY ); |
3116 | 0 | xComboBox->addItemListener( &maItemListeners ); |
3117 | 0 | } |
3118 | 0 | } |
3119 | | |
3120 | | void UnoComboBoxControl::removeItemListener(const uno::Reference < awt::XItemListener > & l) |
3121 | 0 | { |
3122 | 0 | if( getPeer().is() && maItemListeners.getLength() == 1 ) |
3123 | 0 | { |
3124 | | // This call is prettier than creating a Ref and calling query |
3125 | 0 | uno::Reference < awt::XComboBox > xComboBox( getPeer(), uno::UNO_QUERY ); |
3126 | 0 | xComboBox->removeItemListener( &maItemListeners ); |
3127 | 0 | } |
3128 | 0 | maItemListeners.removeInterface( l ); |
3129 | 0 | } |
3130 | | void UnoComboBoxControl::itemStateChanged( const awt::ItemEvent& rEvent ) |
3131 | 0 | { |
3132 | 0 | if ( maItemListeners.getLength() ) |
3133 | 0 | { |
3134 | 0 | try |
3135 | 0 | { |
3136 | 0 | maItemListeners.itemStateChanged( rEvent ); |
3137 | 0 | } |
3138 | 0 | catch( const Exception& ) |
3139 | 0 | { |
3140 | 0 | TOOLS_WARN_EXCEPTION( "toolkit", "UnoComboBoxControl::itemStateChanged"); |
3141 | 0 | } |
3142 | 0 | } |
3143 | 0 | } |
3144 | | sal_Bool SAL_CALL UnoComboBoxControl::setModel( const uno::Reference< awt::XControlModel >& i_rModel ) |
3145 | 0 | { |
3146 | 0 | ::osl::MutexGuard aGuard( GetMutex() ); |
3147 | |
|
3148 | 0 | const Reference< XItemList > xOldItems( getModel(), UNO_QUERY ); |
3149 | 0 | OSL_ENSURE( xOldItems.is() || !getModel().is(), "UnoComboBoxControl::setModel: illegal old model!" ); |
3150 | 0 | const Reference< XItemList > xNewItems( i_rModel, UNO_QUERY ); |
3151 | 0 | OSL_ENSURE( xNewItems.is() || !i_rModel.is(), "UnoComboBoxControl::setModel: illegal new model!" ); |
3152 | |
|
3153 | 0 | if ( !UnoEditControl::setModel( i_rModel ) ) |
3154 | 0 | return false; |
3155 | | |
3156 | 0 | if ( xOldItems.is() ) |
3157 | 0 | xOldItems->removeItemListListener( this ); |
3158 | 0 | if ( xNewItems.is() ) |
3159 | 0 | xNewItems->addItemListListener( this ); |
3160 | |
|
3161 | 0 | return true; |
3162 | 0 | } |
3163 | | |
3164 | | void SAL_CALL UnoComboBoxControl::listItemInserted( const awt::ItemListEvent& i_rEvent ) |
3165 | 0 | { |
3166 | 0 | const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY ); |
3167 | 0 | OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::listItemInserted: invalid peer!" ); |
3168 | 0 | if ( xPeerListener.is() ) |
3169 | 0 | xPeerListener->listItemInserted( i_rEvent ); |
3170 | 0 | } |
3171 | | |
3172 | | void SAL_CALL UnoComboBoxControl::listItemRemoved( const awt::ItemListEvent& i_rEvent ) |
3173 | 0 | { |
3174 | 0 | const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY ); |
3175 | 0 | OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::listItemRemoved: invalid peer!" ); |
3176 | 0 | if ( xPeerListener.is() ) |
3177 | 0 | xPeerListener->listItemRemoved( i_rEvent ); |
3178 | 0 | } |
3179 | | |
3180 | | void SAL_CALL UnoComboBoxControl::listItemModified( const awt::ItemListEvent& i_rEvent ) |
3181 | 0 | { |
3182 | 0 | const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY ); |
3183 | 0 | OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::listItemModified: invalid peer!" ); |
3184 | 0 | if ( xPeerListener.is() ) |
3185 | 0 | xPeerListener->listItemModified( i_rEvent ); |
3186 | 0 | } |
3187 | | |
3188 | | void SAL_CALL UnoComboBoxControl::allItemsRemoved( const lang::EventObject& i_rEvent ) |
3189 | 0 | { |
3190 | 0 | const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY ); |
3191 | 0 | OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::allItemsRemoved: invalid peer!" ); |
3192 | 0 | if ( xPeerListener.is() ) |
3193 | 0 | xPeerListener->allItemsRemoved( i_rEvent ); |
3194 | 0 | } |
3195 | | |
3196 | | void SAL_CALL UnoComboBoxControl::itemListChanged( const lang::EventObject& i_rEvent ) |
3197 | 0 | { |
3198 | 0 | const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY ); |
3199 | 0 | OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::itemListChanged: invalid peer!" ); |
3200 | 0 | if ( xPeerListener.is() ) |
3201 | 0 | xPeerListener->itemListChanged( i_rEvent ); |
3202 | 0 | } |
3203 | | |
3204 | | void UnoComboBoxControl::addItem( const OUString& aItem, sal_Int16 nPos ) |
3205 | 0 | { |
3206 | 0 | uno::Sequence<OUString> aSeq { aItem }; |
3207 | 0 | addItems( aSeq, nPos ); |
3208 | 0 | } |
3209 | | |
3210 | | void UnoComboBoxControl::addItems( const uno::Sequence< OUString>& aItems, sal_Int16 nPos ) |
3211 | 0 | { |
3212 | 0 | uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ); |
3213 | 0 | uno::Sequence< OUString> aSeq; |
3214 | 0 | aVal >>= aSeq; |
3215 | 0 | sal_uInt16 nNewItems = static_cast<sal_uInt16>(aItems.getLength()); |
3216 | 0 | sal_uInt16 nOldLen = static_cast<sal_uInt16>(aSeq.getLength()); |
3217 | 0 | sal_uInt16 nNewLen = nOldLen + nNewItems; |
3218 | |
|
3219 | 0 | uno::Sequence< OUString> aNewSeq( nNewLen ); |
3220 | |
|
3221 | 0 | if ( ( nPos < 0 ) || ( nPos > nOldLen ) ) |
3222 | 0 | nPos = nOldLen; |
3223 | | |
3224 | | // items before the insert position |
3225 | 0 | auto it = std::copy(std::cbegin(aSeq), std::next(std::cbegin(aSeq), nPos), aNewSeq.getArray()); |
3226 | | |
3227 | | // New items |
3228 | 0 | it = std::copy(aItems.begin(), aItems.end(), it); |
3229 | | |
3230 | | // remainder of old items |
3231 | 0 | std::copy(std::next(std::cbegin(aSeq), nPos), std::cend(aSeq), it); |
3232 | |
|
3233 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), Any(aNewSeq), true ); |
3234 | 0 | } |
3235 | | |
3236 | | void UnoComboBoxControl::removeItems( sal_Int16 nPos, sal_Int16 nCount ) |
3237 | 0 | { |
3238 | 0 | uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ); |
3239 | 0 | uno::Sequence< OUString> aSeq; |
3240 | 0 | aVal >>= aSeq; |
3241 | 0 | sal_uInt16 nOldLen = static_cast<sal_uInt16>(aSeq.getLength()); |
3242 | 0 | if ( !nOldLen || ( nPos >= nOldLen ) ) |
3243 | 0 | return; |
3244 | | |
3245 | 0 | if ( nCount > ( nOldLen-nPos ) ) |
3246 | 0 | nCount = nOldLen-nPos; |
3247 | |
|
3248 | 0 | sal_uInt16 nNewLen = nOldLen - nCount; |
3249 | |
|
3250 | 0 | uno::Sequence< OUString> aNewSeq( nNewLen ); |
3251 | | |
3252 | | // items before the deletion position |
3253 | 0 | auto it = std::copy(std::cbegin(aSeq), std::next(std::cbegin(aSeq), nPos), aNewSeq.getArray()); |
3254 | | |
3255 | | // remainder of old items |
3256 | 0 | std::copy(std::next(std::cbegin(aSeq), nPos + nCount), std::cend(aSeq), it); |
3257 | |
|
3258 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), uno::Any(aNewSeq), true ); |
3259 | 0 | } |
3260 | | |
3261 | | sal_Int16 UnoComboBoxControl::getItemCount() |
3262 | 0 | { |
3263 | 0 | uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ); |
3264 | 0 | uno::Sequence< OUString> aSeq; |
3265 | 0 | aVal >>= aSeq; |
3266 | 0 | return static_cast<sal_Int16>(aSeq.getLength()); |
3267 | 0 | } |
3268 | | |
3269 | | OUString UnoComboBoxControl::getItem( sal_Int16 nPos ) |
3270 | 0 | { |
3271 | 0 | OUString aItem; |
3272 | 0 | uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ); |
3273 | 0 | uno::Sequence< OUString> aSeq; |
3274 | 0 | aVal >>= aSeq; |
3275 | 0 | if ( nPos < aSeq.getLength() ) |
3276 | 0 | aItem = aSeq[nPos]; |
3277 | 0 | return aItem; |
3278 | 0 | } |
3279 | | |
3280 | | uno::Sequence< OUString> UnoComboBoxControl::getItems() |
3281 | 0 | { |
3282 | 0 | uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ); |
3283 | 0 | uno::Sequence< OUString> aSeq; |
3284 | 0 | aVal >>= aSeq; |
3285 | 0 | return aSeq; |
3286 | 0 | } |
3287 | | |
3288 | | void UnoComboBoxControl::setDropDownLineCount( sal_Int16 nLines ) |
3289 | 0 | { |
3290 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LINECOUNT ), uno::Any(nLines), true ); |
3291 | 0 | } |
3292 | | |
3293 | | sal_Int16 UnoComboBoxControl::getDropDownLineCount() |
3294 | 0 | { |
3295 | 0 | return ImplGetPropertyValue_INT16( BASEPROPERTY_LINECOUNT ); |
3296 | 0 | } |
3297 | | |
3298 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
3299 | | stardiv_Toolkit_UnoComboBoxControl_get_implementation( |
3300 | | css::uno::XComponentContext *, |
3301 | | css::uno::Sequence<css::uno::Any> const &) |
3302 | 0 | { |
3303 | 0 | return cppu::acquire(new UnoComboBoxControl()); |
3304 | 0 | } |
3305 | | |
3306 | | |
3307 | | // UnoSpinFieldControl |
3308 | | |
3309 | | UnoSpinFieldControl::UnoSpinFieldControl() |
3310 | 0 | :maSpinListeners( *this ) |
3311 | 0 | { |
3312 | 0 | mbRepeat = false; |
3313 | 0 | } |
3314 | | |
3315 | | // uno::XInterface |
3316 | | uno::Any UnoSpinFieldControl::queryAggregation( const uno::Type & rType ) |
3317 | 0 | { |
3318 | 0 | uno::Any aRet = ::cppu::queryInterface( rType, |
3319 | 0 | static_cast< awt::XSpinField* >(this) ); |
3320 | 0 | return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType )); |
3321 | 0 | } |
3322 | | |
3323 | | IMPL_IMPLEMENTATION_ID( UnoSpinFieldControl ) |
3324 | | |
3325 | | // lang::XTypeProvider |
3326 | | css::uno::Sequence< css::uno::Type > UnoSpinFieldControl::getTypes() |
3327 | 0 | { |
3328 | 0 | static const ::cppu::OTypeCollection aTypeList( |
3329 | 0 | cppu::UnoType<css::lang::XTypeProvider>::get(), |
3330 | 0 | cppu::UnoType<awt::XSpinField>::get(), |
3331 | 0 | UnoEditControl::getTypes() |
3332 | 0 | ); |
3333 | 0 | return aTypeList.getTypes(); |
3334 | 0 | } |
3335 | | |
3336 | | void UnoSpinFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) |
3337 | 0 | { |
3338 | 0 | UnoEditControl::createPeer( rxToolkit, rParentPeer ); |
3339 | |
|
3340 | 0 | uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY ); |
3341 | 0 | xField->enableRepeat( mbRepeat ); |
3342 | 0 | if ( maSpinListeners.getLength() ) |
3343 | 0 | xField->addSpinListener( &maSpinListeners ); |
3344 | 0 | } |
3345 | | |
3346 | | // css::awt::XSpinField |
3347 | | void UnoSpinFieldControl::addSpinListener( const css::uno::Reference< css::awt::XSpinListener >& l ) |
3348 | 0 | { |
3349 | 0 | maSpinListeners.addInterface( l ); |
3350 | 0 | if( getPeer().is() && maSpinListeners.getLength() == 1 ) |
3351 | 0 | { |
3352 | 0 | uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY ); |
3353 | 0 | xField->addSpinListener( &maSpinListeners ); |
3354 | 0 | } |
3355 | 0 | } |
3356 | | |
3357 | | void UnoSpinFieldControl::removeSpinListener( const css::uno::Reference< css::awt::XSpinListener >& l ) |
3358 | 0 | { |
3359 | 0 | if( getPeer().is() && maSpinListeners.getLength() == 1 ) |
3360 | 0 | { |
3361 | 0 | uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY ); |
3362 | 0 | xField->removeSpinListener( &maSpinListeners ); |
3363 | 0 | } |
3364 | 0 | maSpinListeners.removeInterface( l ); |
3365 | 0 | } |
3366 | | |
3367 | | void UnoSpinFieldControl::up() |
3368 | 0 | { |
3369 | 0 | uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY ); |
3370 | 0 | if ( xField.is() ) |
3371 | 0 | xField->up(); |
3372 | 0 | } |
3373 | | |
3374 | | void UnoSpinFieldControl::down() |
3375 | 0 | { |
3376 | 0 | uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY ); |
3377 | 0 | if ( xField.is() ) |
3378 | 0 | xField->down(); |
3379 | 0 | } |
3380 | | |
3381 | | void UnoSpinFieldControl::first() |
3382 | 0 | { |
3383 | 0 | uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY ); |
3384 | 0 | if ( xField.is() ) |
3385 | 0 | xField->first(); |
3386 | 0 | } |
3387 | | |
3388 | | void UnoSpinFieldControl::last() |
3389 | 0 | { |
3390 | 0 | uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY ); |
3391 | 0 | if ( xField.is() ) |
3392 | 0 | xField->last(); |
3393 | 0 | } |
3394 | | |
3395 | | void UnoSpinFieldControl::enableRepeat( sal_Bool bRepeat ) |
3396 | 0 | { |
3397 | 0 | mbRepeat = bRepeat; |
3398 | |
|
3399 | 0 | uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY ); |
3400 | 0 | if ( xField.is() ) |
3401 | 0 | xField->enableRepeat( bRepeat ); |
3402 | 0 | } |
3403 | | |
3404 | | |
3405 | | |
3406 | | UnoControlDateFieldModel::UnoControlDateFieldModel( const Reference< XComponentContext >& rxContext ) |
3407 | 0 | :UnoControlModel( rxContext ) |
3408 | 0 | { |
3409 | 0 | UNO_CONTROL_MODEL_REGISTER_PROPERTIES<VCLXDateField>(); |
3410 | 0 | } Unexecuted instantiation: UnoControlDateFieldModel::UnoControlDateFieldModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: UnoControlDateFieldModel::UnoControlDateFieldModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
3411 | | |
3412 | | OUString UnoControlDateFieldModel::getServiceName() |
3413 | 0 | { |
3414 | 0 | return u"stardiv.vcl.controlmodel.DateField"_ustr; |
3415 | 0 | } |
3416 | | |
3417 | | uno::Any UnoControlDateFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const |
3418 | 0 | { |
3419 | 0 | if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) |
3420 | 0 | { |
3421 | 0 | return uno::Any( u"stardiv.vcl.control.DateField"_ustr ); |
3422 | 0 | } |
3423 | 0 | return UnoControlModel::ImplGetDefaultValue( nPropId ); |
3424 | 0 | } |
3425 | | |
3426 | | |
3427 | | ::cppu::IPropertyArrayHelper& UnoControlDateFieldModel::getInfoHelper() |
3428 | 0 | { |
3429 | 0 | static UnoPropertyArrayHelper aHelper( ImplGetPropertyIds() ); |
3430 | 0 | return aHelper; |
3431 | 0 | } |
3432 | | |
3433 | | // beans::XMultiPropertySet |
3434 | | uno::Reference< beans::XPropertySetInfo > UnoControlDateFieldModel::getPropertySetInfo( ) |
3435 | 0 | { |
3436 | 0 | static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); |
3437 | 0 | return xInfo; |
3438 | 0 | } |
3439 | | |
3440 | | OUString UnoControlDateFieldModel::getImplementationName() |
3441 | 0 | { |
3442 | 0 | return u"stardiv.Toolkit.UnoControlDateFieldModel"_ustr; |
3443 | 0 | } |
3444 | | |
3445 | | css::uno::Sequence<OUString> |
3446 | | UnoControlDateFieldModel::getSupportedServiceNames() |
3447 | 0 | { |
3448 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlDateFieldModel"_ustr, u"stardiv.vcl.controlmodel.DateField"_ustr }; |
3449 | 0 | return comphelper::concatSequences( UnoControlModel::getSupportedServiceNames(), vals ); |
3450 | 0 | } |
3451 | | |
3452 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
3453 | | stardiv_Toolkit_UnoControlDateFieldModel_get_implementation( |
3454 | | css::uno::XComponentContext *context, |
3455 | | css::uno::Sequence<css::uno::Any> const &) |
3456 | 0 | { |
3457 | 0 | return cppu::acquire(new UnoControlDateFieldModel(context)); |
3458 | 0 | } |
3459 | | |
3460 | | |
3461 | | |
3462 | | UnoDateFieldControl::UnoDateFieldControl() |
3463 | 0 | { |
3464 | 0 | mnFirst = util::Date( 1, 1, 1900 ); |
3465 | 0 | mnLast = util::Date( 31, 12, 2200 ); |
3466 | 0 | mbLongFormat = TRISTATE_INDET; |
3467 | 0 | } |
3468 | | |
3469 | | OUString UnoDateFieldControl::GetComponentServiceName() const |
3470 | 0 | { |
3471 | 0 | return u"datefield"_ustr; |
3472 | 0 | } |
3473 | | |
3474 | | // uno::XInterface |
3475 | | uno::Any UnoDateFieldControl::queryAggregation( const uno::Type & rType ) |
3476 | 0 | { |
3477 | 0 | uno::Any aRet = ::cppu::queryInterface( rType, |
3478 | 0 | static_cast< awt::XDateField* >(this) ); |
3479 | 0 | return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType )); |
3480 | 0 | } |
3481 | | |
3482 | | IMPL_IMPLEMENTATION_ID( UnoDateFieldControl ) |
3483 | | |
3484 | | // lang::XTypeProvider |
3485 | | css::uno::Sequence< css::uno::Type > UnoDateFieldControl::getTypes() |
3486 | 0 | { |
3487 | 0 | static const ::cppu::OTypeCollection aTypeList( |
3488 | 0 | cppu::UnoType<css::lang::XTypeProvider>::get(), |
3489 | 0 | cppu::UnoType<awt::XDateField>::get(), |
3490 | 0 | UnoSpinFieldControl::getTypes() |
3491 | 0 | ); |
3492 | 0 | return aTypeList.getTypes(); |
3493 | 0 | } |
3494 | | |
3495 | | void UnoDateFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) |
3496 | 0 | { |
3497 | 0 | UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer ); |
3498 | |
|
3499 | 0 | uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY ); |
3500 | 0 | xField->setFirst( mnFirst ); |
3501 | 0 | xField->setLast( mnLast ); |
3502 | 0 | if ( mbLongFormat != TRISTATE_INDET ) |
3503 | 0 | xField->setLongFormat( mbLongFormat != TRISTATE_FALSE); |
3504 | 0 | } |
3505 | | |
3506 | | |
3507 | | void UnoDateFieldControl::textChanged( const awt::TextEvent& e ) |
3508 | 0 | { |
3509 | 0 | uno::Reference< awt::XVclWindowPeer > xPeer( getPeer(), uno::UNO_QUERY ); |
3510 | | |
3511 | | // also change the text property (#i25106#) |
3512 | 0 | if ( xPeer.is() ) |
3513 | 0 | { |
3514 | 0 | const OUString& sTextPropertyName = GetPropertyName( BASEPROPERTY_TEXT ); |
3515 | 0 | ImplSetPropertyValue( sTextPropertyName, xPeer->getProperty( sTextPropertyName ), false ); |
3516 | 0 | } |
3517 | | |
3518 | | // re-calc the Date property |
3519 | 0 | uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY ); |
3520 | 0 | uno::Any aValue; |
3521 | 0 | if ( xField->isEmpty() ) |
3522 | 0 | { |
3523 | | // the field says it's empty |
3524 | 0 | bool bEnforceFormat = true; |
3525 | 0 | if ( xPeer.is() ) |
3526 | 0 | xPeer->getProperty( GetPropertyName( BASEPROPERTY_ENFORCE_FORMAT ) ) >>= bEnforceFormat; |
3527 | 0 | if ( !bEnforceFormat ) |
3528 | 0 | { |
3529 | | // and it also says that it is currently accepting invalid inputs, without |
3530 | | // forcing it to a valid date |
3531 | 0 | uno::Reference< awt::XTextComponent > xText( xPeer, uno::UNO_QUERY ); |
3532 | 0 | if ( xText.is() && xText->getText().getLength() ) |
3533 | | // and in real, the text of the peer is *not* empty |
3534 | | // -> simulate an invalid date, which is different from "no date" |
3535 | 0 | aValue <<= util::Date(); |
3536 | 0 | } |
3537 | 0 | } |
3538 | 0 | else |
3539 | 0 | aValue <<= xField->getDate(); |
3540 | |
|
3541 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATE ), aValue, false ); |
3542 | | |
3543 | | // multiplex the event |
3544 | 0 | if ( GetTextListeners().getLength() ) |
3545 | 0 | GetTextListeners().textChanged( e ); |
3546 | 0 | } |
3547 | | |
3548 | | void UnoDateFieldControl::setDate( const util::Date& Date ) |
3549 | 0 | { |
3550 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATE ), uno::Any(Date), true ); |
3551 | 0 | } |
3552 | | |
3553 | | util::Date UnoDateFieldControl::getDate() |
3554 | 0 | { |
3555 | 0 | return ImplGetPropertyValue_Date( BASEPROPERTY_DATE ); |
3556 | 0 | } |
3557 | | |
3558 | | void UnoDateFieldControl::setMin( const util::Date& Date ) |
3559 | 0 | { |
3560 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATEMIN ), uno::Any(Date), true ); |
3561 | 0 | } |
3562 | | |
3563 | | util::Date UnoDateFieldControl::getMin() |
3564 | 0 | { |
3565 | 0 | return ImplGetPropertyValue_Date( BASEPROPERTY_DATEMIN ); |
3566 | 0 | } |
3567 | | |
3568 | | void UnoDateFieldControl::setMax( const util::Date& Date ) |
3569 | 0 | { |
3570 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATEMAX ), uno::Any(Date), true ); |
3571 | 0 | } |
3572 | | |
3573 | | util::Date UnoDateFieldControl::getMax() |
3574 | 0 | { |
3575 | 0 | return ImplGetPropertyValue_Date( BASEPROPERTY_DATEMAX ); |
3576 | 0 | } |
3577 | | |
3578 | | void UnoDateFieldControl::setFirst( const util::Date& Date ) |
3579 | 0 | { |
3580 | 0 | mnFirst = Date; |
3581 | 0 | if ( getPeer().is() ) |
3582 | 0 | { |
3583 | 0 | uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY ); |
3584 | 0 | xField->setFirst( Date ); |
3585 | 0 | } |
3586 | 0 | } |
3587 | | |
3588 | | util::Date UnoDateFieldControl::getFirst() |
3589 | 0 | { |
3590 | 0 | return mnFirst; |
3591 | 0 | } |
3592 | | |
3593 | | void UnoDateFieldControl::setLast( const util::Date& Date ) |
3594 | 0 | { |
3595 | 0 | mnLast = Date; |
3596 | 0 | if ( getPeer().is() ) |
3597 | 0 | { |
3598 | 0 | uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY ); |
3599 | 0 | xField->setLast( Date ); |
3600 | 0 | } |
3601 | 0 | } |
3602 | | |
3603 | | util::Date UnoDateFieldControl::getLast() |
3604 | 0 | { |
3605 | 0 | return mnLast; |
3606 | 0 | } |
3607 | | |
3608 | | void UnoDateFieldControl::setLongFormat( sal_Bool bLong ) |
3609 | 0 | { |
3610 | 0 | mbLongFormat = bLong ? TRISTATE_TRUE : TRISTATE_FALSE; |
3611 | 0 | if ( getPeer().is() ) |
3612 | 0 | { |
3613 | 0 | uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY ); |
3614 | 0 | xField->setLongFormat( bLong ); |
3615 | 0 | } |
3616 | 0 | } |
3617 | | |
3618 | | sal_Bool UnoDateFieldControl::isLongFormat() |
3619 | 0 | { |
3620 | 0 | return mbLongFormat == TRISTATE_TRUE; |
3621 | 0 | } |
3622 | | |
3623 | | void UnoDateFieldControl::setEmpty() |
3624 | 0 | { |
3625 | 0 | if ( getPeer().is() ) |
3626 | 0 | { |
3627 | 0 | uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY ); |
3628 | 0 | xField->setEmpty(); |
3629 | 0 | } |
3630 | 0 | } |
3631 | | |
3632 | | sal_Bool UnoDateFieldControl::isEmpty() |
3633 | 0 | { |
3634 | 0 | bool bEmpty = false; |
3635 | 0 | if ( getPeer().is() ) |
3636 | 0 | { |
3637 | 0 | uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY ); |
3638 | 0 | bEmpty = xField->isEmpty(); |
3639 | 0 | } |
3640 | 0 | return bEmpty; |
3641 | 0 | } |
3642 | | |
3643 | | void UnoDateFieldControl::setStrictFormat( sal_Bool bStrict ) |
3644 | 0 | { |
3645 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), uno::Any(bStrict), true ); |
3646 | 0 | } |
3647 | | |
3648 | | sal_Bool UnoDateFieldControl::isStrictFormat() |
3649 | 0 | { |
3650 | 0 | return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT ); |
3651 | 0 | } |
3652 | | |
3653 | | OUString UnoDateFieldControl::getImplementationName() |
3654 | 0 | { |
3655 | 0 | return u"stardiv.Toolkit.UnoDateFieldControl"_ustr; |
3656 | 0 | } |
3657 | | |
3658 | | css::uno::Sequence<OUString> UnoDateFieldControl::getSupportedServiceNames() |
3659 | 0 | { |
3660 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlDateField"_ustr, u"stardiv.vcl.control.DateField"_ustr }; |
3661 | 0 | return comphelper::concatSequences( UnoSpinFieldControl::getSupportedServiceNames(), vals ); |
3662 | 0 | } |
3663 | | |
3664 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
3665 | | stardiv_Toolkit_UnoDateFieldControl_get_implementation( |
3666 | | css::uno::XComponentContext *, |
3667 | | css::uno::Sequence<css::uno::Any> const &) |
3668 | 0 | { |
3669 | 0 | return cppu::acquire(new UnoDateFieldControl()); |
3670 | 0 | } |
3671 | | |
3672 | | |
3673 | | |
3674 | | UnoControlTimeFieldModel::UnoControlTimeFieldModel( const Reference< XComponentContext >& rxContext ) |
3675 | 0 | :UnoControlModel( rxContext ) |
3676 | 0 | { |
3677 | 0 | UNO_CONTROL_MODEL_REGISTER_PROPERTIES<VCLXTimeField>(); |
3678 | 0 | } Unexecuted instantiation: UnoControlTimeFieldModel::UnoControlTimeFieldModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: UnoControlTimeFieldModel::UnoControlTimeFieldModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
3679 | | |
3680 | | OUString UnoControlTimeFieldModel::getServiceName() |
3681 | 0 | { |
3682 | 0 | return u"stardiv.vcl.controlmodel.TimeField"_ustr; |
3683 | 0 | } |
3684 | | |
3685 | | uno::Any UnoControlTimeFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const |
3686 | 0 | { |
3687 | 0 | if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) |
3688 | 0 | { |
3689 | 0 | return uno::Any( u"stardiv.vcl.control.TimeField"_ustr ); |
3690 | 0 | } |
3691 | 0 | return UnoControlModel::ImplGetDefaultValue( nPropId ); |
3692 | 0 | } |
3693 | | |
3694 | | |
3695 | | ::cppu::IPropertyArrayHelper& UnoControlTimeFieldModel::getInfoHelper() |
3696 | 0 | { |
3697 | 0 | static UnoPropertyArrayHelper aHelper( ImplGetPropertyIds() ); |
3698 | 0 | return aHelper; |
3699 | 0 | } |
3700 | | |
3701 | | // beans::XMultiPropertySet |
3702 | | uno::Reference< beans::XPropertySetInfo > UnoControlTimeFieldModel::getPropertySetInfo( ) |
3703 | 0 | { |
3704 | 0 | static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); |
3705 | 0 | return xInfo; |
3706 | 0 | } |
3707 | | |
3708 | | OUString UnoControlTimeFieldModel::getImplementationName() |
3709 | 0 | { |
3710 | 0 | return u"stardiv.Toolkit.UnoControlTimeFieldModel"_ustr; |
3711 | 0 | } |
3712 | | |
3713 | | css::uno::Sequence<OUString> |
3714 | | UnoControlTimeFieldModel::getSupportedServiceNames() |
3715 | 0 | { |
3716 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlTimeFieldModel"_ustr, u"stardiv.vcl.controlmodel.TimeField"_ustr }; |
3717 | 0 | return comphelper::concatSequences( UnoControlModel::getSupportedServiceNames(), vals ); |
3718 | 0 | } |
3719 | | |
3720 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
3721 | | stardiv_Toolkit_UnoControlTimeFieldModel_get_implementation( |
3722 | | css::uno::XComponentContext *context, |
3723 | | css::uno::Sequence<css::uno::Any> const &) |
3724 | 0 | { |
3725 | 0 | return cppu::acquire(new UnoControlTimeFieldModel(context)); |
3726 | 0 | } |
3727 | | |
3728 | | |
3729 | | |
3730 | | UnoTimeFieldControl::UnoTimeFieldControl() |
3731 | 0 | { |
3732 | 0 | mnFirst = util::Time( 0, 0, 0, 0, false ); |
3733 | 0 | mnLast = util::Time( 999999999, 59, 59, 23, false ); |
3734 | 0 | } |
3735 | | |
3736 | | OUString UnoTimeFieldControl::GetComponentServiceName() const |
3737 | 0 | { |
3738 | 0 | return u"timefield"_ustr; |
3739 | 0 | } |
3740 | | |
3741 | | // uno::XInterface |
3742 | | uno::Any UnoTimeFieldControl::queryAggregation( const uno::Type & rType ) |
3743 | 0 | { |
3744 | 0 | uno::Any aRet = ::cppu::queryInterface( rType, |
3745 | 0 | static_cast< awt::XTimeField* >(this) ); |
3746 | 0 | return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType )); |
3747 | 0 | } |
3748 | | |
3749 | | IMPL_IMPLEMENTATION_ID( UnoTimeFieldControl ) |
3750 | | |
3751 | | // lang::XTypeProvider |
3752 | | css::uno::Sequence< css::uno::Type > UnoTimeFieldControl::getTypes() |
3753 | 0 | { |
3754 | 0 | static const ::cppu::OTypeCollection aTypeList( |
3755 | 0 | cppu::UnoType<css::lang::XTypeProvider>::get(), |
3756 | 0 | cppu::UnoType<awt::XTimeField>::get(), |
3757 | 0 | UnoSpinFieldControl::getTypes() |
3758 | 0 | ); |
3759 | 0 | return aTypeList.getTypes(); |
3760 | 0 | } |
3761 | | |
3762 | | void UnoTimeFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) |
3763 | 0 | { |
3764 | 0 | UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer ); |
3765 | |
|
3766 | 0 | uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY ); |
3767 | 0 | xField->setFirst( mnFirst ); |
3768 | 0 | xField->setLast( mnLast ); |
3769 | 0 | } |
3770 | | |
3771 | | void UnoTimeFieldControl::textChanged( const awt::TextEvent& e ) |
3772 | 0 | { |
3773 | | // also change the text property (#i25106#) |
3774 | 0 | uno::Reference< awt::XVclWindowPeer > xPeer( getPeer(), uno::UNO_QUERY ); |
3775 | 0 | const OUString& sTextPropertyName = GetPropertyName( BASEPROPERTY_TEXT ); |
3776 | 0 | ImplSetPropertyValue( sTextPropertyName, xPeer->getProperty( sTextPropertyName ), false ); |
3777 | | |
3778 | | // re-calc the Time property |
3779 | 0 | uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY ); |
3780 | 0 | uno::Any aValue; |
3781 | 0 | if ( !xField->isEmpty() ) |
3782 | 0 | aValue <<= xField->getTime(); |
3783 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIME ), aValue, false ); |
3784 | | |
3785 | | // multiplex the event |
3786 | 0 | if ( GetTextListeners().getLength() ) |
3787 | 0 | GetTextListeners().textChanged( e ); |
3788 | 0 | } |
3789 | | |
3790 | | void UnoTimeFieldControl::setTime( const util::Time& Time ) |
3791 | 0 | { |
3792 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIME ), Any(Time), true ); |
3793 | 0 | } |
3794 | | |
3795 | | util::Time UnoTimeFieldControl::getTime() |
3796 | 0 | { |
3797 | 0 | return ImplGetPropertyValue_Time( BASEPROPERTY_TIME ); |
3798 | 0 | } |
3799 | | |
3800 | | void UnoTimeFieldControl::setMin( const util::Time& Time ) |
3801 | 0 | { |
3802 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIMEMIN ), uno::Any(Time), true ); |
3803 | 0 | } |
3804 | | |
3805 | | util::Time UnoTimeFieldControl::getMin() |
3806 | 0 | { |
3807 | 0 | return ImplGetPropertyValue_Time( BASEPROPERTY_TIMEMIN ); |
3808 | 0 | } |
3809 | | |
3810 | | void UnoTimeFieldControl::setMax( const util::Time& Time ) |
3811 | 0 | { |
3812 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIMEMAX ), uno::Any(Time), true ); |
3813 | 0 | } |
3814 | | |
3815 | | util::Time UnoTimeFieldControl::getMax() |
3816 | 0 | { |
3817 | 0 | return ImplGetPropertyValue_Time( BASEPROPERTY_TIMEMAX ); |
3818 | 0 | } |
3819 | | |
3820 | | void UnoTimeFieldControl::setFirst( const util::Time& Time ) |
3821 | 0 | { |
3822 | 0 | mnFirst = Time; |
3823 | 0 | if ( getPeer().is() ) |
3824 | 0 | { |
3825 | 0 | uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY ); |
3826 | 0 | xField->setFirst( mnFirst ); |
3827 | 0 | } |
3828 | 0 | } |
3829 | | |
3830 | | util::Time UnoTimeFieldControl::getFirst() |
3831 | 0 | { |
3832 | 0 | return mnFirst; |
3833 | 0 | } |
3834 | | |
3835 | | void UnoTimeFieldControl::setLast( const util::Time& Time ) |
3836 | 0 | { |
3837 | 0 | mnLast = Time; |
3838 | 0 | if ( getPeer().is() ) |
3839 | 0 | { |
3840 | 0 | uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY ); |
3841 | 0 | xField->setFirst( mnLast ); |
3842 | 0 | } |
3843 | 0 | } |
3844 | | |
3845 | | util::Time UnoTimeFieldControl::getLast() |
3846 | 0 | { |
3847 | 0 | return mnLast; |
3848 | 0 | } |
3849 | | |
3850 | | void UnoTimeFieldControl::setEmpty() |
3851 | 0 | { |
3852 | 0 | if ( getPeer().is() ) |
3853 | 0 | { |
3854 | 0 | uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY ); |
3855 | 0 | xField->setEmpty(); |
3856 | 0 | } |
3857 | 0 | } |
3858 | | |
3859 | | sal_Bool UnoTimeFieldControl::isEmpty() |
3860 | 0 | { |
3861 | 0 | bool bEmpty = false; |
3862 | 0 | if ( getPeer().is() ) |
3863 | 0 | { |
3864 | 0 | uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY ); |
3865 | 0 | bEmpty = xField->isEmpty(); |
3866 | 0 | } |
3867 | 0 | return bEmpty; |
3868 | 0 | } |
3869 | | |
3870 | | void UnoTimeFieldControl::setStrictFormat( sal_Bool bStrict ) |
3871 | 0 | { |
3872 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), uno::Any(bStrict), true ); |
3873 | 0 | } |
3874 | | |
3875 | | sal_Bool UnoTimeFieldControl::isStrictFormat() |
3876 | 0 | { |
3877 | 0 | return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT ); |
3878 | 0 | } |
3879 | | |
3880 | | OUString UnoTimeFieldControl::getImplementationName() |
3881 | 0 | { |
3882 | 0 | return u"stardiv.Toolkit.UnoTimeFieldControl"_ustr; |
3883 | 0 | } |
3884 | | |
3885 | | css::uno::Sequence<OUString> UnoTimeFieldControl::getSupportedServiceNames() |
3886 | 0 | { |
3887 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlTimeField"_ustr, u"stardiv.vcl.control.TimeField"_ustr }; |
3888 | 0 | return comphelper::concatSequences( UnoSpinFieldControl::getSupportedServiceNames(), vals ); |
3889 | 0 | } |
3890 | | |
3891 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
3892 | | stardiv_Toolkit_UnoTimeFieldControl_get_implementation( |
3893 | | css::uno::XComponentContext *, |
3894 | | css::uno::Sequence<css::uno::Any> const &) |
3895 | 0 | { |
3896 | 0 | return cppu::acquire(new UnoTimeFieldControl()); |
3897 | 0 | } |
3898 | | |
3899 | | |
3900 | | |
3901 | | UnoControlNumericFieldModel::UnoControlNumericFieldModel( const Reference< XComponentContext >& rxContext ) |
3902 | 0 | :UnoControlModel( rxContext ) |
3903 | 0 | { |
3904 | 0 | UNO_CONTROL_MODEL_REGISTER_PROPERTIES<VCLXNumericField>(); |
3905 | 0 | } Unexecuted instantiation: UnoControlNumericFieldModel::UnoControlNumericFieldModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: UnoControlNumericFieldModel::UnoControlNumericFieldModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
3906 | | |
3907 | | OUString UnoControlNumericFieldModel::getServiceName() |
3908 | 0 | { |
3909 | 0 | return u"stardiv.vcl.controlmodel.NumericField"_ustr; |
3910 | 0 | } |
3911 | | |
3912 | | uno::Any UnoControlNumericFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const |
3913 | 0 | { |
3914 | 0 | if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) |
3915 | 0 | { |
3916 | 0 | return uno::Any( u"stardiv.vcl.control.NumericField"_ustr ); |
3917 | 0 | } |
3918 | 0 | return UnoControlModel::ImplGetDefaultValue( nPropId ); |
3919 | 0 | } |
3920 | | |
3921 | | |
3922 | | ::cppu::IPropertyArrayHelper& UnoControlNumericFieldModel::getInfoHelper() |
3923 | 0 | { |
3924 | 0 | static UnoPropertyArrayHelper aHelper( ImplGetPropertyIds() ); |
3925 | 0 | return aHelper; |
3926 | 0 | } |
3927 | | |
3928 | | // beans::XMultiPropertySet |
3929 | | uno::Reference< beans::XPropertySetInfo > UnoControlNumericFieldModel::getPropertySetInfo( ) |
3930 | 0 | { |
3931 | 0 | static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); |
3932 | 0 | return xInfo; |
3933 | 0 | } |
3934 | | |
3935 | | OUString UnoControlNumericFieldModel::getImplementationName() |
3936 | 0 | { |
3937 | 0 | return u"stardiv.Toolkit.UnoControlNumericFieldModel"_ustr; |
3938 | 0 | } |
3939 | | |
3940 | | css::uno::Sequence<OUString> |
3941 | | UnoControlNumericFieldModel::getSupportedServiceNames() |
3942 | 0 | { |
3943 | 0 | const css::uno::Sequence<OUString> vals { u"stardiv.vcl.controlmodel.NumericField"_ustr, u"com.sun.star.awt.UnoControlNumericFieldModel"_ustr }; |
3944 | 0 | return comphelper::concatSequences( UnoControlModel::getSupportedServiceNames(), vals ); |
3945 | 0 | } |
3946 | | |
3947 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
3948 | | stardiv_Toolkit_UnoControlNumericFieldModel_get_implementation( |
3949 | | css::uno::XComponentContext *context, |
3950 | | css::uno::Sequence<css::uno::Any> const &) |
3951 | 0 | { |
3952 | 0 | return cppu::acquire(new UnoControlNumericFieldModel(context)); |
3953 | 0 | } |
3954 | | |
3955 | | |
3956 | | |
3957 | | UnoNumericFieldControl::UnoNumericFieldControl() |
3958 | 0 | { |
3959 | 0 | mnFirst = 0; |
3960 | 0 | mnLast = 0x7FFFFFFF; |
3961 | 0 | } |
3962 | | |
3963 | | OUString UnoNumericFieldControl::GetComponentServiceName() const |
3964 | 0 | { |
3965 | 0 | return u"numericfield"_ustr; |
3966 | 0 | } |
3967 | | |
3968 | | // uno::XInterface |
3969 | | uno::Any UnoNumericFieldControl::queryAggregation( const uno::Type & rType ) |
3970 | 0 | { |
3971 | 0 | uno::Any aRet = ::cppu::queryInterface( rType, |
3972 | 0 | static_cast< awt::XNumericField* >(this) ); |
3973 | 0 | return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType )); |
3974 | 0 | } |
3975 | | |
3976 | | IMPL_IMPLEMENTATION_ID( UnoNumericFieldControl ) |
3977 | | |
3978 | | // lang::XTypeProvider |
3979 | | css::uno::Sequence< css::uno::Type > UnoNumericFieldControl::getTypes() |
3980 | 0 | { |
3981 | 0 | static const ::cppu::OTypeCollection aTypeList( |
3982 | 0 | cppu::UnoType<css::lang::XTypeProvider>::get(), |
3983 | 0 | cppu::UnoType<awt::XNumericField>::get(), |
3984 | 0 | UnoSpinFieldControl::getTypes() |
3985 | 0 | ); |
3986 | 0 | return aTypeList.getTypes(); |
3987 | 0 | } |
3988 | | |
3989 | | void UnoNumericFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) |
3990 | 0 | { |
3991 | 0 | UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer ); |
3992 | |
|
3993 | 0 | uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY ); |
3994 | 0 | xField->setFirst( mnFirst ); |
3995 | 0 | xField->setLast( mnLast ); |
3996 | 0 | } |
3997 | | |
3998 | | void UnoNumericFieldControl::textChanged( const awt::TextEvent& e ) |
3999 | 0 | { |
4000 | 0 | uno::Reference<awt::XVclWindowPeer> xPeer(getPeer(), UNO_QUERY); |
4001 | 0 | const OUString& sPropertyName = GetPropertyName(BASEPROPERTY_VALUE_DOUBLE); |
4002 | | // tdf#168788 for consistency with UnoFormattedFieldControl, use getProperty |
4003 | | // instead of getValue so an empty string can be represented as empty Any |
4004 | 0 | ImplSetPropertyValue(sPropertyName, xPeer->getProperty(sPropertyName), false); |
4005 | |
|
4006 | 0 | if ( GetTextListeners().getLength() ) |
4007 | 0 | GetTextListeners().textChanged( e ); |
4008 | 0 | } |
4009 | | |
4010 | | void UnoNumericFieldControl::setValue( double Value ) |
4011 | 0 | { |
4012 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), uno::Any(Value), true ); |
4013 | 0 | } |
4014 | | |
4015 | | double UnoNumericFieldControl::getValue() |
4016 | 0 | { |
4017 | 0 | return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUE_DOUBLE ); |
4018 | 0 | } |
4019 | | |
4020 | | void UnoNumericFieldControl::setMin( double Value ) |
4021 | 0 | { |
4022 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMIN_DOUBLE ), uno::Any(Value), true ); |
4023 | 0 | } |
4024 | | |
4025 | | double UnoNumericFieldControl::getMin() |
4026 | 0 | { |
4027 | 0 | return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMIN_DOUBLE ); |
4028 | 0 | } |
4029 | | |
4030 | | void UnoNumericFieldControl::setMax( double Value ) |
4031 | 0 | { |
4032 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMAX_DOUBLE ), uno::Any(Value), true ); |
4033 | 0 | } |
4034 | | |
4035 | | double UnoNumericFieldControl::getMax() |
4036 | 0 | { |
4037 | 0 | return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMAX_DOUBLE ); |
4038 | 0 | } |
4039 | | |
4040 | | void UnoNumericFieldControl::setFirst( double Value ) |
4041 | 0 | { |
4042 | 0 | mnFirst = Value; |
4043 | 0 | if ( getPeer().is() ) |
4044 | 0 | { |
4045 | 0 | uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY ); |
4046 | 0 | xField->setFirst( mnFirst ); |
4047 | 0 | } |
4048 | 0 | } |
4049 | | |
4050 | | double UnoNumericFieldControl::getFirst() |
4051 | 0 | { |
4052 | 0 | return mnFirst; |
4053 | 0 | } |
4054 | | |
4055 | | void UnoNumericFieldControl::setLast( double Value ) |
4056 | 0 | { |
4057 | 0 | mnLast = Value; |
4058 | 0 | if ( getPeer().is() ) |
4059 | 0 | { |
4060 | 0 | uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY ); |
4061 | 0 | xField->setLast( mnLast ); |
4062 | 0 | } |
4063 | 0 | } |
4064 | | |
4065 | | double UnoNumericFieldControl::getLast() |
4066 | 0 | { |
4067 | 0 | return mnLast; |
4068 | 0 | } |
4069 | | |
4070 | | void UnoNumericFieldControl::setStrictFormat( sal_Bool bStrict ) |
4071 | 0 | { |
4072 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), uno::Any(bStrict), true ); |
4073 | 0 | } |
4074 | | |
4075 | | sal_Bool UnoNumericFieldControl::isStrictFormat() |
4076 | 0 | { |
4077 | 0 | return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT ); |
4078 | 0 | } |
4079 | | |
4080 | | OUString UnoNumericFieldControl::getImplementationName() |
4081 | 0 | { |
4082 | 0 | return u"stardiv.Toolkit.UnoNumericFieldControl"_ustr; |
4083 | 0 | } |
4084 | | |
4085 | | css::uno::Sequence<OUString> UnoNumericFieldControl::getSupportedServiceNames() |
4086 | 0 | { |
4087 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlNumericField"_ustr, u"stardiv.vcl.control.NumericField"_ustr }; |
4088 | 0 | return comphelper::concatSequences( UnoSpinFieldControl::getSupportedServiceNames(), vals ); |
4089 | 0 | } |
4090 | | |
4091 | | void UnoNumericFieldControl::setSpinSize( double Digits ) |
4092 | 0 | { |
4093 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUESTEP_DOUBLE ), uno::Any(Digits), true ); |
4094 | 0 | } |
4095 | | |
4096 | | double UnoNumericFieldControl::getSpinSize() |
4097 | 0 | { |
4098 | 0 | return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUESTEP_DOUBLE ); |
4099 | 0 | } |
4100 | | |
4101 | | void UnoNumericFieldControl::setDecimalDigits( sal_Int16 Digits ) |
4102 | 0 | { |
4103 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DECIMALACCURACY ), uno::Any(Digits), true ); |
4104 | 0 | } |
4105 | | |
4106 | | sal_Int16 UnoNumericFieldControl::getDecimalDigits() |
4107 | 0 | { |
4108 | 0 | return ImplGetPropertyValue_INT16( BASEPROPERTY_DECIMALACCURACY ); |
4109 | 0 | } |
4110 | | |
4111 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
4112 | | stardiv_Toolkit_UnoNumericFieldControl_get_implementation( |
4113 | | css::uno::XComponentContext *, |
4114 | | css::uno::Sequence<css::uno::Any> const &) |
4115 | 0 | { |
4116 | 0 | return cppu::acquire(new UnoNumericFieldControl()); |
4117 | 0 | } |
4118 | | |
4119 | | UnoControlCurrencyFieldModel::UnoControlCurrencyFieldModel( const Reference< XComponentContext >& rxContext ) |
4120 | 0 | :UnoControlModel( rxContext ) |
4121 | 0 | { |
4122 | 0 | UNO_CONTROL_MODEL_REGISTER_PROPERTIES<SVTXCurrencyField>(); |
4123 | 0 | } Unexecuted instantiation: UnoControlCurrencyFieldModel::UnoControlCurrencyFieldModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: UnoControlCurrencyFieldModel::UnoControlCurrencyFieldModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
4124 | | |
4125 | | OUString UnoControlCurrencyFieldModel::getServiceName() |
4126 | 0 | { |
4127 | 0 | return u"stardiv.vcl.controlmodel.CurrencyField"_ustr; |
4128 | 0 | } |
4129 | | |
4130 | | uno::Any UnoControlCurrencyFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const |
4131 | 0 | { |
4132 | 0 | if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) |
4133 | 0 | { |
4134 | 0 | return uno::Any( u"stardiv.vcl.control.CurrencyField"_ustr ); |
4135 | 0 | } |
4136 | 0 | if ( nPropId == BASEPROPERTY_CURSYM_POSITION ) |
4137 | 0 | { |
4138 | 0 | return uno::Any(false); |
4139 | 0 | } |
4140 | | |
4141 | 0 | return UnoControlModel::ImplGetDefaultValue( nPropId ); |
4142 | 0 | } |
4143 | | |
4144 | | ::cppu::IPropertyArrayHelper& UnoControlCurrencyFieldModel::getInfoHelper() |
4145 | 0 | { |
4146 | 0 | static UnoPropertyArrayHelper aHelper( ImplGetPropertyIds() ); |
4147 | 0 | return aHelper; |
4148 | 0 | } |
4149 | | |
4150 | | // beans::XMultiPropertySet |
4151 | | uno::Reference< beans::XPropertySetInfo > UnoControlCurrencyFieldModel::getPropertySetInfo( ) |
4152 | 0 | { |
4153 | 0 | static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); |
4154 | 0 | return xInfo; |
4155 | 0 | } |
4156 | | |
4157 | | OUString UnoControlCurrencyFieldModel::getImplementationName() |
4158 | 0 | { |
4159 | 0 | return u"stardiv.Toolkit.UnoControlCurrencyFieldModel"_ustr; |
4160 | 0 | } |
4161 | | |
4162 | | css::uno::Sequence<OUString> |
4163 | | UnoControlCurrencyFieldModel::getSupportedServiceNames() |
4164 | 0 | { |
4165 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlCurrencyFieldModel"_ustr, u"stardiv.vcl.controlmodel.CurrencyField"_ustr }; |
4166 | 0 | return comphelper::concatSequences( UnoControlModel::getSupportedServiceNames(), vals ); |
4167 | 0 | } |
4168 | | |
4169 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
4170 | | stardiv_Toolkit_UnoControlCurrencyFieldModel_get_implementation( |
4171 | | css::uno::XComponentContext *context, |
4172 | | css::uno::Sequence<css::uno::Any> const &) |
4173 | 0 | { |
4174 | 0 | return cppu::acquire(new UnoControlCurrencyFieldModel(context)); |
4175 | 0 | } |
4176 | | |
4177 | | |
4178 | | |
4179 | | UnoCurrencyFieldControl::UnoCurrencyFieldControl() |
4180 | 0 | { |
4181 | 0 | mnFirst = 0; |
4182 | 0 | mnLast = 0x7FFFFFFF; |
4183 | 0 | } |
4184 | | |
4185 | | OUString UnoCurrencyFieldControl::GetComponentServiceName() const |
4186 | 0 | { |
4187 | 0 | return u"longcurrencyfield"_ustr; |
4188 | 0 | } |
4189 | | |
4190 | | // uno::XInterface |
4191 | | uno::Any UnoCurrencyFieldControl::queryAggregation( const uno::Type & rType ) |
4192 | 0 | { |
4193 | 0 | uno::Any aRet = ::cppu::queryInterface( rType, |
4194 | 0 | static_cast< awt::XCurrencyField* >(this) ); |
4195 | 0 | return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType )); |
4196 | 0 | } |
4197 | | |
4198 | | IMPL_IMPLEMENTATION_ID( UnoCurrencyFieldControl ) |
4199 | | |
4200 | | // lang::XTypeProvider |
4201 | | css::uno::Sequence< css::uno::Type > UnoCurrencyFieldControl::getTypes() |
4202 | 0 | { |
4203 | 0 | static const ::cppu::OTypeCollection aTypeList( |
4204 | 0 | cppu::UnoType<css::lang::XTypeProvider>::get(), |
4205 | 0 | cppu::UnoType<awt::XCurrencyField>::get(), |
4206 | 0 | UnoSpinFieldControl::getTypes() |
4207 | 0 | ); |
4208 | 0 | return aTypeList.getTypes(); |
4209 | 0 | } |
4210 | | |
4211 | | void UnoCurrencyFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) |
4212 | 0 | { |
4213 | 0 | UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer ); |
4214 | |
|
4215 | 0 | uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY ); |
4216 | 0 | xField->setFirst( mnFirst ); |
4217 | 0 | xField->setLast( mnLast ); |
4218 | 0 | } |
4219 | | |
4220 | | void UnoCurrencyFieldControl::textChanged( const awt::TextEvent& e ) |
4221 | 0 | { |
4222 | 0 | uno::Reference<awt::XVclWindowPeer> xPeer(getPeer(), UNO_QUERY); |
4223 | 0 | const OUString& sPropertyName = GetPropertyName(BASEPROPERTY_VALUE_DOUBLE); |
4224 | | // tdf#168788 for consistency with UnoFormattedFieldControl, use getProperty |
4225 | | // instead of getValue so an empty string can be represented as empty Any |
4226 | 0 | ImplSetPropertyValue(sPropertyName, xPeer->getProperty(sPropertyName), false); |
4227 | |
|
4228 | 0 | if ( GetTextListeners().getLength() ) |
4229 | 0 | GetTextListeners().textChanged( e ); |
4230 | 0 | } |
4231 | | |
4232 | | void UnoCurrencyFieldControl::setValue( double Value ) |
4233 | 0 | { |
4234 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), Any(Value), true ); |
4235 | 0 | } |
4236 | | |
4237 | | double UnoCurrencyFieldControl::getValue() |
4238 | 0 | { |
4239 | 0 | return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUE_DOUBLE ); |
4240 | 0 | } |
4241 | | |
4242 | | void UnoCurrencyFieldControl::setMin( double Value ) |
4243 | 0 | { |
4244 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMIN_DOUBLE ), uno::Any(Value), true ); |
4245 | 0 | } |
4246 | | |
4247 | | double UnoCurrencyFieldControl::getMin() |
4248 | 0 | { |
4249 | 0 | return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMIN_DOUBLE ); |
4250 | 0 | } |
4251 | | |
4252 | | void UnoCurrencyFieldControl::setMax( double Value ) |
4253 | 0 | { |
4254 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMAX_DOUBLE ), uno::Any(Value), true ); |
4255 | 0 | } |
4256 | | |
4257 | | double UnoCurrencyFieldControl::getMax() |
4258 | 0 | { |
4259 | 0 | return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMAX_DOUBLE ); |
4260 | 0 | } |
4261 | | |
4262 | | void UnoCurrencyFieldControl::setFirst( double Value ) |
4263 | 0 | { |
4264 | 0 | mnFirst = Value; |
4265 | 0 | if ( getPeer().is() ) |
4266 | 0 | { |
4267 | 0 | uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY ); |
4268 | 0 | xField->setFirst( mnFirst ); |
4269 | 0 | } |
4270 | 0 | } |
4271 | | |
4272 | | double UnoCurrencyFieldControl::getFirst() |
4273 | 0 | { |
4274 | 0 | return mnFirst; |
4275 | 0 | } |
4276 | | |
4277 | | void UnoCurrencyFieldControl::setLast( double Value ) |
4278 | 0 | { |
4279 | 0 | mnLast = Value; |
4280 | 0 | if ( getPeer().is() ) |
4281 | 0 | { |
4282 | 0 | uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY ); |
4283 | 0 | xField->setLast( mnLast ); |
4284 | 0 | } |
4285 | 0 | } |
4286 | | |
4287 | | double UnoCurrencyFieldControl::getLast() |
4288 | 0 | { |
4289 | 0 | return mnLast; |
4290 | 0 | } |
4291 | | |
4292 | | void UnoCurrencyFieldControl::setStrictFormat( sal_Bool bStrict ) |
4293 | 0 | { |
4294 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), uno::Any(bStrict), true ); |
4295 | 0 | } |
4296 | | |
4297 | | sal_Bool UnoCurrencyFieldControl::isStrictFormat() |
4298 | 0 | { |
4299 | 0 | return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT ); |
4300 | 0 | } |
4301 | | |
4302 | | OUString UnoCurrencyFieldControl::getImplementationName() |
4303 | 0 | { |
4304 | 0 | return u"stardiv.Toolkit.UnoCurrencyFieldControl"_ustr; |
4305 | 0 | } |
4306 | | |
4307 | | css::uno::Sequence<OUString> |
4308 | | UnoCurrencyFieldControl::getSupportedServiceNames() |
4309 | 0 | { |
4310 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlCurrencyField"_ustr, u"stardiv.vcl.control.CurrencyField"_ustr }; |
4311 | 0 | return comphelper::concatSequences( UnoSpinFieldControl::getSupportedServiceNames(), vals ); |
4312 | 0 | } |
4313 | | |
4314 | | void UnoCurrencyFieldControl::setSpinSize( double Digits ) |
4315 | 0 | { |
4316 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUESTEP_DOUBLE ), uno::Any(Digits), true ); |
4317 | 0 | } |
4318 | | |
4319 | | double UnoCurrencyFieldControl::getSpinSize() |
4320 | 0 | { |
4321 | 0 | return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUESTEP_DOUBLE ); |
4322 | 0 | } |
4323 | | |
4324 | | void UnoCurrencyFieldControl::setDecimalDigits( sal_Int16 Digits ) |
4325 | 0 | { |
4326 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DECIMALACCURACY ), uno::Any(Digits), true ); |
4327 | 0 | } |
4328 | | |
4329 | | sal_Int16 UnoCurrencyFieldControl::getDecimalDigits() |
4330 | 0 | { |
4331 | 0 | return ImplGetPropertyValue_INT16( BASEPROPERTY_DECIMALACCURACY ); |
4332 | 0 | } |
4333 | | |
4334 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
4335 | | stardiv_Toolkit_UnoCurrencyFieldControl_get_implementation( |
4336 | | css::uno::XComponentContext *, |
4337 | | css::uno::Sequence<css::uno::Any> const &) |
4338 | 0 | { |
4339 | 0 | return cppu::acquire(new UnoCurrencyFieldControl()); |
4340 | 0 | } |
4341 | | |
4342 | | |
4343 | | |
4344 | | UnoControlPatternFieldModel::UnoControlPatternFieldModel( const Reference< XComponentContext >& rxContext ) |
4345 | 0 | :UnoControlModel( rxContext ) |
4346 | 0 | { |
4347 | 0 | UNO_CONTROL_MODEL_REGISTER_PROPERTIES<VCLXPatternField>(); |
4348 | 0 | } Unexecuted instantiation: UnoControlPatternFieldModel::UnoControlPatternFieldModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: UnoControlPatternFieldModel::UnoControlPatternFieldModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
4349 | | |
4350 | | OUString UnoControlPatternFieldModel::getServiceName() |
4351 | 0 | { |
4352 | 0 | return u"stardiv.vcl.controlmodel.PatternField"_ustr; |
4353 | 0 | } |
4354 | | |
4355 | | uno::Any UnoControlPatternFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const |
4356 | 0 | { |
4357 | 0 | if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) |
4358 | 0 | { |
4359 | 0 | return uno::Any( u"stardiv.vcl.control.PatternField"_ustr ); |
4360 | 0 | } |
4361 | 0 | return UnoControlModel::ImplGetDefaultValue( nPropId ); |
4362 | 0 | } |
4363 | | |
4364 | | ::cppu::IPropertyArrayHelper& UnoControlPatternFieldModel::getInfoHelper() |
4365 | 0 | { |
4366 | 0 | static UnoPropertyArrayHelper aHelper( ImplGetPropertyIds() ); |
4367 | 0 | return aHelper; |
4368 | 0 | } |
4369 | | |
4370 | | // beans::XMultiPropertySet |
4371 | | uno::Reference< beans::XPropertySetInfo > UnoControlPatternFieldModel::getPropertySetInfo( ) |
4372 | 0 | { |
4373 | 0 | static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); |
4374 | 0 | return xInfo; |
4375 | 0 | } |
4376 | | |
4377 | | OUString UnoControlPatternFieldModel::getImplementationName() |
4378 | 0 | { |
4379 | 0 | return u"stardiv.Toolkit.UnoControlPatternFieldModel"_ustr; |
4380 | 0 | } |
4381 | | |
4382 | | css::uno::Sequence<OUString> |
4383 | | UnoControlPatternFieldModel::getSupportedServiceNames() |
4384 | 0 | { |
4385 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlPatternFieldModel"_ustr, u"stardiv.vcl.controlmodel.PatternField"_ustr }; |
4386 | 0 | return comphelper::concatSequences( UnoControlModel::getSupportedServiceNames(), vals ); |
4387 | 0 | } |
4388 | | |
4389 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
4390 | | stardiv_Toolkit_UnoControlPatternFieldModel_get_implementation( |
4391 | | css::uno::XComponentContext *context, |
4392 | | css::uno::Sequence<css::uno::Any> const &) |
4393 | 0 | { |
4394 | 0 | return cppu::acquire(new UnoControlPatternFieldModel(context)); |
4395 | 0 | } |
4396 | | |
4397 | | |
4398 | | |
4399 | | UnoPatternFieldControl::UnoPatternFieldControl() |
4400 | 0 | { |
4401 | 0 | } |
4402 | | |
4403 | | OUString UnoPatternFieldControl::GetComponentServiceName() const |
4404 | 0 | { |
4405 | 0 | return u"patternfield"_ustr; |
4406 | 0 | } |
4407 | | |
4408 | | void UnoPatternFieldControl::ImplSetPeerProperty( const OUString& rPropName, const uno::Any& rVal ) |
4409 | 0 | { |
4410 | 0 | sal_uInt16 nType = GetPropertyId( rPropName ); |
4411 | 0 | if ( ( nType == BASEPROPERTY_TEXT ) || ( nType == BASEPROPERTY_EDITMASK ) || ( nType == BASEPROPERTY_LITERALMASK ) ) |
4412 | 0 | { |
4413 | | // These masks cannot be set consecutively |
4414 | 0 | OUString Text = ImplGetPropertyValue_UString( BASEPROPERTY_TEXT ); |
4415 | 0 | OUString EditMask = ImplGetPropertyValue_UString( BASEPROPERTY_EDITMASK ); |
4416 | 0 | OUString LiteralMask = ImplGetPropertyValue_UString( BASEPROPERTY_LITERALMASK ); |
4417 | |
|
4418 | 0 | uno::Reference < awt::XPatternField > xPF( getPeer(), uno::UNO_QUERY ); |
4419 | 0 | if (xPF.is()) |
4420 | 0 | { |
4421 | | // same comment as in UnoControl::ImplSetPeerProperty - see there |
4422 | 0 | ImplCheckLocalize( Text ); |
4423 | 0 | xPF->setString( Text ); |
4424 | 0 | xPF->setMasks( EditMask, LiteralMask ); |
4425 | 0 | } |
4426 | 0 | } |
4427 | 0 | else |
4428 | 0 | UnoSpinFieldControl::ImplSetPeerProperty( rPropName, rVal ); |
4429 | 0 | } |
4430 | | |
4431 | | |
4432 | | // uno::XInterface |
4433 | | uno::Any UnoPatternFieldControl::queryAggregation( const uno::Type & rType ) |
4434 | 0 | { |
4435 | 0 | uno::Any aRet = ::cppu::queryInterface( rType, |
4436 | 0 | static_cast< awt::XPatternField* >(this) ); |
4437 | 0 | return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType )); |
4438 | 0 | } |
4439 | | |
4440 | | IMPL_IMPLEMENTATION_ID( UnoPatternFieldControl ) |
4441 | | |
4442 | | // lang::XTypeProvider |
4443 | | css::uno::Sequence< css::uno::Type > UnoPatternFieldControl::getTypes() |
4444 | 0 | { |
4445 | 0 | static const ::cppu::OTypeCollection aTypeList( |
4446 | 0 | cppu::UnoType<css::lang::XTypeProvider>::get(), |
4447 | 0 | cppu::UnoType<awt::XPatternField>::get(), |
4448 | 0 | UnoSpinFieldControl::getTypes() |
4449 | 0 | ); |
4450 | 0 | return aTypeList.getTypes(); |
4451 | 0 | } |
4452 | | |
4453 | | void UnoPatternFieldControl::setString( const OUString& rString ) |
4454 | 0 | { |
4455 | 0 | setText( rString ); |
4456 | 0 | } |
4457 | | |
4458 | | OUString UnoPatternFieldControl::getString() |
4459 | 0 | { |
4460 | 0 | return getText(); |
4461 | 0 | } |
4462 | | |
4463 | | void UnoPatternFieldControl::setMasks( const OUString& EditMask, const OUString& LiteralMask ) |
4464 | 0 | { |
4465 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_EDITMASK ), uno::Any(EditMask), true ); |
4466 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LITERALMASK ), uno::Any(LiteralMask), true ); |
4467 | 0 | } |
4468 | | |
4469 | | void UnoPatternFieldControl::getMasks( OUString& EditMask, OUString& LiteralMask ) |
4470 | 0 | { |
4471 | 0 | EditMask = ImplGetPropertyValue_UString( BASEPROPERTY_EDITMASK ); |
4472 | 0 | LiteralMask = ImplGetPropertyValue_UString( BASEPROPERTY_LITERALMASK ); |
4473 | 0 | } |
4474 | | |
4475 | | void UnoPatternFieldControl::setStrictFormat( sal_Bool bStrict ) |
4476 | 0 | { |
4477 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), uno::Any(bStrict), true ); |
4478 | 0 | } |
4479 | | |
4480 | | sal_Bool UnoPatternFieldControl::isStrictFormat() |
4481 | 0 | { |
4482 | 0 | return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT ); |
4483 | 0 | } |
4484 | | |
4485 | | OUString UnoPatternFieldControl::getImplementationName() |
4486 | 0 | { |
4487 | 0 | return u"stardiv.Toolkit.UnoPatternFieldControl"_ustr; |
4488 | 0 | } |
4489 | | |
4490 | | css::uno::Sequence<OUString> UnoPatternFieldControl::getSupportedServiceNames() |
4491 | 0 | { |
4492 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlPatternField"_ustr, u"stardiv.vcl.control.PatternField"_ustr }; |
4493 | 0 | return comphelper::concatSequences( UnoSpinFieldControl::getSupportedServiceNames(), vals ); |
4494 | 0 | } |
4495 | | |
4496 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
4497 | | stardiv_Toolkit_UnoPatternFieldControl_get_implementation( |
4498 | | css::uno::XComponentContext *, |
4499 | | css::uno::Sequence<css::uno::Any> const &) |
4500 | 0 | { |
4501 | 0 | return cppu::acquire(new UnoPatternFieldControl()); |
4502 | 0 | } |
4503 | | |
4504 | | |
4505 | | |
4506 | | UnoControlProgressBarModel::UnoControlProgressBarModel( const Reference< XComponentContext >& rxContext ) |
4507 | 0 | :UnoControlModel( rxContext ) |
4508 | 0 | { |
4509 | 0 | ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); |
4510 | 0 | ImplRegisterProperty( BASEPROPERTY_BORDER ); |
4511 | 0 | ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR ); |
4512 | 0 | ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); |
4513 | 0 | ImplRegisterProperty( BASEPROPERTY_ENABLED ); |
4514 | 0 | ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE ); |
4515 | 0 | ImplRegisterProperty( BASEPROPERTY_FILLCOLOR ); |
4516 | 0 | ImplRegisterProperty( BASEPROPERTY_HELPTEXT ); |
4517 | 0 | ImplRegisterProperty( BASEPROPERTY_HELPURL ); |
4518 | 0 | ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); |
4519 | 0 | ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE ); |
4520 | 0 | ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE_MAX ); |
4521 | 0 | ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE_MIN ); |
4522 | 0 | } Unexecuted instantiation: UnoControlProgressBarModel::UnoControlProgressBarModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: UnoControlProgressBarModel::UnoControlProgressBarModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
4523 | | |
4524 | | OUString UnoControlProgressBarModel::getServiceName( ) |
4525 | 0 | { |
4526 | 0 | return u"stardiv.vcl.controlmodel.ProgressBar"_ustr; |
4527 | 0 | } |
4528 | | |
4529 | | uno::Any UnoControlProgressBarModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const |
4530 | 0 | { |
4531 | 0 | if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) |
4532 | 0 | { |
4533 | 0 | return uno::Any( u"stardiv.vcl.control.ProgressBar"_ustr ); |
4534 | 0 | } |
4535 | | |
4536 | 0 | return UnoControlModel::ImplGetDefaultValue( nPropId ); |
4537 | 0 | } |
4538 | | |
4539 | | ::cppu::IPropertyArrayHelper& UnoControlProgressBarModel::getInfoHelper() |
4540 | 0 | { |
4541 | 0 | static UnoPropertyArrayHelper aHelper( ImplGetPropertyIds() ); |
4542 | 0 | return aHelper; |
4543 | 0 | } |
4544 | | |
4545 | | // beans::XMultiPropertySet |
4546 | | uno::Reference< beans::XPropertySetInfo > UnoControlProgressBarModel::getPropertySetInfo( ) |
4547 | 0 | { |
4548 | 0 | static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); |
4549 | 0 | return xInfo; |
4550 | 0 | } |
4551 | | |
4552 | | OUString UnoControlProgressBarModel::getImplementationName() |
4553 | 0 | { |
4554 | 0 | return u"stardiv.Toolkit.UnoControlProgressBarModel"_ustr; |
4555 | 0 | } |
4556 | | |
4557 | | css::uno::Sequence<OUString> |
4558 | | UnoControlProgressBarModel::getSupportedServiceNames() |
4559 | 0 | { |
4560 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlProgressBarModel"_ustr, u"stardiv.vcl.controlmodel.ProgressBar"_ustr }; |
4561 | 0 | return comphelper::concatSequences( UnoControlModel::getSupportedServiceNames(), vals ); |
4562 | 0 | } |
4563 | | |
4564 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
4565 | | stardiv_Toolkit_UnoControlProgressBarModel_get_implementation( |
4566 | | css::uno::XComponentContext *context, |
4567 | | css::uno::Sequence<css::uno::Any> const &) |
4568 | 0 | { |
4569 | 0 | return cppu::acquire(new UnoControlProgressBarModel(context)); |
4570 | 0 | } |
4571 | | |
4572 | | |
4573 | | |
4574 | | UnoProgressBarControl::UnoProgressBarControl() |
4575 | 0 | { |
4576 | 0 | } |
4577 | | |
4578 | | OUString UnoProgressBarControl::GetComponentServiceName() const |
4579 | 0 | { |
4580 | 0 | return u"ProgressBar"_ustr; |
4581 | 0 | } |
4582 | | |
4583 | | // uno::XInterface |
4584 | | uno::Any UnoProgressBarControl::queryAggregation( const uno::Type & rType ) |
4585 | 0 | { |
4586 | 0 | uno::Any aRet = ::cppu::queryInterface( rType, |
4587 | 0 | static_cast< awt::XProgressBar* >(this) ); |
4588 | 0 | return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType )); |
4589 | 0 | } |
4590 | | |
4591 | | IMPL_IMPLEMENTATION_ID( UnoProgressBarControl ) |
4592 | | |
4593 | | // lang::XTypeProvider |
4594 | | css::uno::Sequence< css::uno::Type > UnoProgressBarControl::getTypes() |
4595 | 0 | { |
4596 | 0 | static const ::cppu::OTypeCollection aTypeList( |
4597 | 0 | cppu::UnoType<css::lang::XTypeProvider>::get(), |
4598 | 0 | cppu::UnoType<awt::XProgressBar>::get(), |
4599 | 0 | UnoControlBase::getTypes() |
4600 | 0 | ); |
4601 | 0 | return aTypeList.getTypes(); |
4602 | 0 | } |
4603 | | |
4604 | | // css::awt::XProgressBar |
4605 | | void UnoProgressBarControl::setForegroundColor( sal_Int32 nColor ) |
4606 | 0 | { |
4607 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_FILLCOLOR ), uno::Any(nColor), true ); |
4608 | 0 | } |
4609 | | |
4610 | | void UnoProgressBarControl::setBackgroundColor( sal_Int32 nColor ) |
4611 | 0 | { |
4612 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_BACKGROUNDCOLOR ), uno::Any(nColor), true ); |
4613 | 0 | } |
4614 | | |
4615 | | void UnoProgressBarControl::setValue( sal_Int32 nValue ) |
4616 | 0 | { |
4617 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_PROGRESSVALUE ), uno::Any(nValue), true ); |
4618 | 0 | } |
4619 | | |
4620 | | void UnoProgressBarControl::setRange( sal_Int32 nMin, sal_Int32 nMax ) |
4621 | 0 | { |
4622 | 0 | uno::Any aMin; |
4623 | 0 | uno::Any aMax; |
4624 | |
|
4625 | 0 | if ( nMin < nMax ) |
4626 | 0 | { |
4627 | | // take correct min and max |
4628 | 0 | aMin <<= nMin; |
4629 | 0 | aMax <<= nMax; |
4630 | 0 | } |
4631 | 0 | else |
4632 | 0 | { |
4633 | | // change min and max |
4634 | 0 | aMin <<= nMax; |
4635 | 0 | aMax <<= nMin; |
4636 | 0 | } |
4637 | |
|
4638 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_PROGRESSVALUE_MIN ), aMin, true ); |
4639 | 0 | ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_PROGRESSVALUE_MAX ), aMax, true ); |
4640 | 0 | } |
4641 | | |
4642 | | sal_Int32 UnoProgressBarControl::getValue() |
4643 | 0 | { |
4644 | 0 | return ImplGetPropertyValue_INT32( BASEPROPERTY_PROGRESSVALUE ); |
4645 | 0 | } |
4646 | | |
4647 | | OUString UnoProgressBarControl::getImplementationName() |
4648 | 0 | { |
4649 | 0 | return u"stardiv.Toolkit.UnoProgressBarControl"_ustr; |
4650 | 0 | } |
4651 | | |
4652 | | css::uno::Sequence<OUString> UnoProgressBarControl::getSupportedServiceNames() |
4653 | 0 | { |
4654 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlProgressBar"_ustr, u"stardiv.vcl.control.ProgressBar"_ustr }; |
4655 | 0 | return comphelper::concatSequences( UnoControlBase::getSupportedServiceNames(), vals ); |
4656 | 0 | } |
4657 | | |
4658 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
4659 | | stardiv_Toolkit_UnoProgressBarControl_get_implementation( |
4660 | | css::uno::XComponentContext *, |
4661 | | css::uno::Sequence<css::uno::Any> const &) |
4662 | 0 | { |
4663 | 0 | return cppu::acquire(new UnoProgressBarControl()); |
4664 | 0 | } |
4665 | | |
4666 | | |
4667 | | |
4668 | | UnoControlFixedLineModel::UnoControlFixedLineModel( const Reference< XComponentContext >& rxContext ) |
4669 | 0 | :UnoControlModel( rxContext ) |
4670 | 0 | { |
4671 | 0 | ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); |
4672 | 0 | ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); |
4673 | 0 | ImplRegisterProperty( BASEPROPERTY_ENABLED ); |
4674 | 0 | ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE ); |
4675 | 0 | ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); |
4676 | 0 | ImplRegisterProperty( BASEPROPERTY_HELPTEXT ); |
4677 | 0 | ImplRegisterProperty( BASEPROPERTY_HELPURL ); |
4678 | 0 | ImplRegisterProperty( BASEPROPERTY_LABEL ); |
4679 | 0 | ImplRegisterProperty( BASEPROPERTY_ORIENTATION ); |
4680 | 0 | ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); |
4681 | 0 | } Unexecuted instantiation: UnoControlFixedLineModel::UnoControlFixedLineModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: UnoControlFixedLineModel::UnoControlFixedLineModel(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
4682 | | |
4683 | | OUString UnoControlFixedLineModel::getServiceName( ) |
4684 | 0 | { |
4685 | 0 | return u"stardiv.vcl.controlmodel.FixedLine"_ustr; |
4686 | 0 | } |
4687 | | |
4688 | | uno::Any UnoControlFixedLineModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const |
4689 | 0 | { |
4690 | 0 | if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) |
4691 | 0 | { |
4692 | 0 | return uno::Any( u"stardiv.vcl.control.FixedLine"_ustr ); |
4693 | 0 | } |
4694 | 0 | return UnoControlModel::ImplGetDefaultValue( nPropId ); |
4695 | 0 | } |
4696 | | |
4697 | | ::cppu::IPropertyArrayHelper& UnoControlFixedLineModel::getInfoHelper() |
4698 | 0 | { |
4699 | 0 | static UnoPropertyArrayHelper aHelper( ImplGetPropertyIds() ); |
4700 | 0 | return aHelper; |
4701 | 0 | } |
4702 | | |
4703 | | // beans::XMultiPropertySet |
4704 | | uno::Reference< beans::XPropertySetInfo > UnoControlFixedLineModel::getPropertySetInfo( ) |
4705 | 0 | { |
4706 | 0 | static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); |
4707 | 0 | return xInfo; |
4708 | 0 | } |
4709 | | |
4710 | | OUString UnoControlFixedLineModel::getImplementationName() |
4711 | 0 | { |
4712 | 0 | return u"stardiv.Toolkit.UnoControlFixedLineModel"_ustr; |
4713 | 0 | } |
4714 | | |
4715 | | css::uno::Sequence<OUString> |
4716 | | UnoControlFixedLineModel::getSupportedServiceNames() |
4717 | 0 | { |
4718 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlFixedLineModel"_ustr, u"stardiv.vcl.controlmodel.FixedLine"_ustr }; |
4719 | 0 | return comphelper::concatSequences( UnoControlModel::getSupportedServiceNames(), vals ); |
4720 | 0 | } |
4721 | | |
4722 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
4723 | | stardiv_Toolkit_UnoControlFixedLineModel_get_implementation( |
4724 | | css::uno::XComponentContext *context, |
4725 | | css::uno::Sequence<css::uno::Any> const &) |
4726 | 0 | { |
4727 | 0 | return cppu::acquire(new UnoControlFixedLineModel(context)); |
4728 | 0 | } |
4729 | | |
4730 | | |
4731 | | |
4732 | | UnoFixedLineControl::UnoFixedLineControl() |
4733 | 0 | { |
4734 | 0 | maComponentInfos.nWidth = 100; // ?? |
4735 | 0 | maComponentInfos.nHeight = 100; // ?? |
4736 | 0 | } |
4737 | | |
4738 | | OUString UnoFixedLineControl::GetComponentServiceName() const |
4739 | 0 | { |
4740 | 0 | return u"FixedLine"_ustr; |
4741 | 0 | } |
4742 | | |
4743 | | sal_Bool UnoFixedLineControl::isTransparent() |
4744 | 0 | { |
4745 | 0 | return true; |
4746 | 0 | } |
4747 | | |
4748 | | OUString UnoFixedLineControl::getImplementationName() |
4749 | 0 | { |
4750 | 0 | return u"stardiv.Toolkit.UnoFixedLineControl"_ustr; |
4751 | 0 | } |
4752 | | |
4753 | | css::uno::Sequence<OUString> UnoFixedLineControl::getSupportedServiceNames() |
4754 | 0 | { |
4755 | 0 | const css::uno::Sequence<OUString> vals { u"com.sun.star.awt.UnoControlFixedLine"_ustr, u"stardiv.vcl.control.FixedLine"_ustr }; |
4756 | 0 | return comphelper::concatSequences( UnoControlBase::getSupportedServiceNames(), vals ); |
4757 | 0 | } |
4758 | | |
4759 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * |
4760 | | stardiv_Toolkit_UnoFixedLineControl_get_implementation( |
4761 | | css::uno::XComponentContext *, |
4762 | | css::uno::Sequence<css::uno::Any> const &) |
4763 | 0 | { |
4764 | 0 | return cppu::acquire(new UnoFixedLineControl()); |
4765 | 0 | } |
4766 | | |
4767 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |