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