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 <toolkit/awt/vclxwindows.hxx>
30 : : #include <com/sun/star/awt/ScrollBarOrientation.hpp>
31 : : #include <com/sun/star/graphic/GraphicProvider.hpp>
32 : : #include <com/sun/star/graphic/XGraphicProvider.hpp>
33 : : #include <toolkit/helper/vclunohelper.hxx>
34 : : #include <toolkit/helper/macros.hxx>
35 : : #include <toolkit/helper/property.hxx>
36 : : #include <toolkit/helper/convert.hxx>
37 : : #include <toolkit/helper/imagealign.hxx>
38 : : #include <toolkit/helper/accessibilityclient.hxx>
39 : : #include <toolkit/helper/fixedhyperbase.hxx>
40 : : #include <toolkit/helper/tkresmgr.hxx>
41 : : #include <cppuhelper/typeprovider.hxx>
42 : : #include <com/sun/star/awt/VisualEffect.hpp>
43 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
44 : : #include <com/sun/star/system/XSystemShellExecute.hpp>
45 : : #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
46 : : #include <com/sun/star/resource/XStringResourceResolver.hpp>
47 : : #include <com/sun/star/awt/ImageScaleMode.hpp>
48 : : #include <com/sun/star/awt/XItemList.hpp>
49 : : #include <comphelper/componentcontext.hxx>
50 : : #include <comphelper/namedvaluecollection.hxx>
51 : : #include <comphelper/processfactory.hxx>
52 : :
53 : : #include <vcl/button.hxx>
54 : : #include <vcl/lstbox.hxx>
55 : : #include <vcl/combobox.hxx>
56 : : #include <vcl/field.hxx>
57 : : #include <vcl/longcurr.hxx>
58 : : #include <vcl/imgctrl.hxx>
59 : : #include <vcl/dialog.hxx>
60 : : #include <vcl/msgbox.hxx>
61 : : #include <vcl/scrbar.hxx>
62 : : #include <vcl/svapp.hxx>
63 : : #include <vcl/tabpage.hxx>
64 : : #include <vcl/tabctrl.hxx>
65 : : #include <tools/diagnose_ex.h>
66 : :
67 : : #include <boost/bind.hpp>
68 : : #include <boost/function.hpp>
69 : :
70 : : using ::com::sun::star::uno::Any;
71 : : using ::com::sun::star::uno::Reference;
72 : : using ::com::sun::star::uno::makeAny;
73 : : using ::com::sun::star::uno::RuntimeException;
74 : : using ::com::sun::star::lang::EventObject;
75 : : using ::com::sun::star::awt::ItemListEvent;
76 : : using ::com::sun::star::awt::XItemList;
77 : : using ::com::sun::star::graphic::XGraphic;
78 : : using ::com::sun::star::graphic::XGraphicProvider;
79 : :
80 : : using namespace ::com::sun::star;
81 : : using namespace ::com::sun::star::awt::VisualEffect;
82 : : namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode;
83 : :
84 : 0 : static double ImplCalcLongValue( double nValue, sal_uInt16 nDigits )
85 : : {
86 : 0 : double n = nValue;
87 [ # # ]: 0 : for ( sal_uInt16 d = 0; d < nDigits; d++ )
88 : 0 : n *= 10;
89 : 0 : return n;
90 : : }
91 : :
92 : 0 : static double ImplCalcDoubleValue( double nValue, sal_uInt16 nDigits )
93 : : {
94 : 0 : double n = nValue;
95 [ # # ]: 0 : for ( sal_uInt16 d = 0; d < nDigits; d++ )
96 : 0 : n /= 10;
97 : 0 : return n;
98 : : }
99 : :
100 : : namespace toolkit
101 : : {
102 : : /** sets the "face color" for button like controls (scroll bar, spin button)
103 : : */
104 : 4 : void setButtonLikeFaceColor( Window* _pWindow, const ::com::sun::star::uno::Any& _rColorValue )
105 : : {
106 [ + - ]: 4 : AllSettings aSettings = _pWindow->GetSettings();
107 [ + - ]: 4 : StyleSettings aStyleSettings = aSettings.GetStyleSettings();
108 : :
109 [ + - ]: 4 : if ( !_rColorValue.hasValue() )
110 : : {
111 [ + - ]: 4 : const StyleSettings& aAppStyle = Application::GetSettings().GetStyleSettings();
112 [ + - ]: 4 : aStyleSettings.SetFaceColor( aAppStyle.GetFaceColor( ) );
113 [ + - ]: 4 : aStyleSettings.SetCheckedColor( aAppStyle.GetCheckedColor( ) );
114 [ + - ]: 4 : aStyleSettings.SetLightBorderColor( aAppStyle.GetLightBorderColor() );
115 [ + - ]: 4 : aStyleSettings.SetLightColor( aAppStyle.GetLightColor() );
116 [ + - ]: 4 : aStyleSettings.SetShadowColor( aAppStyle.GetShadowColor() );
117 [ + - ]: 4 : aStyleSettings.SetDarkShadowColor( aAppStyle.GetDarkShadowColor() );
118 : : }
119 : : else
120 : : {
121 : 0 : sal_Int32 nBackgroundColor = 0;
122 : 0 : _rColorValue >>= nBackgroundColor;
123 [ # # ]: 0 : aStyleSettings.SetFaceColor( nBackgroundColor );
124 : :
125 : : // for the real background (everything except the buttons and the thumb),
126 : : // use an average between the desired color and "white"
127 : 0 : Color aWhite( COL_WHITE );
128 : 0 : Color aBackground( nBackgroundColor );
129 [ # # ]: 0 : aBackground.SetRed( ( aBackground.GetRed() + aWhite.GetRed() ) / 2 );
130 [ # # ]: 0 : aBackground.SetGreen( ( aBackground.GetGreen() + aWhite.GetGreen() ) / 2 );
131 [ # # ]: 0 : aBackground.SetBlue( ( aBackground.GetBlue() + aWhite.GetBlue() ) / 2 );
132 [ # # ]: 0 : aStyleSettings.SetCheckedColor( aBackground );
133 : :
134 [ # # ]: 0 : sal_Int32 nBackgroundLuminance = Color( nBackgroundColor ).GetLuminance();
135 [ # # ]: 0 : sal_Int32 nWhiteLuminance = Color( COL_WHITE ).GetLuminance();
136 : :
137 : 0 : Color aLightShadow( nBackgroundColor );
138 [ # # ]: 0 : aLightShadow.IncreaseLuminance( (sal_uInt8)( ( nWhiteLuminance - nBackgroundLuminance ) * 2 / 3 ) );
139 [ # # ]: 0 : aStyleSettings.SetLightBorderColor( aLightShadow );
140 : :
141 : 0 : Color aLight( nBackgroundColor );
142 [ # # ]: 0 : aLight.IncreaseLuminance( (sal_uInt8)( ( nWhiteLuminance - nBackgroundLuminance ) * 1 / 3 ) );
143 [ # # ]: 0 : aStyleSettings.SetLightColor( aLight );
144 : :
145 : 0 : Color aShadow( nBackgroundColor );
146 [ # # ]: 0 : aShadow.DecreaseLuminance( (sal_uInt8)( nBackgroundLuminance * 1 / 3 ) );
147 [ # # ]: 0 : aStyleSettings.SetShadowColor( aShadow );
148 : :
149 : 0 : Color aDarkShadow( nBackgroundColor );
150 [ # # ]: 0 : aDarkShadow.DecreaseLuminance( (sal_uInt8)( nBackgroundLuminance * 2 / 3 ) );
151 [ # # ]: 0 : aStyleSettings.SetDarkShadowColor( aDarkShadow );
152 : : }
153 : :
154 [ + - ]: 4 : aSettings.SetStyleSettings( aStyleSettings );
155 [ + - ][ + - ]: 4 : _pWindow->SetSettings( aSettings, sal_True );
[ + - ]
156 : 4 : }
157 : :
158 : 0 : Any getButtonLikeFaceColor( const Window* _pWindow )
159 : : {
160 : 0 : sal_Int32 nBackgroundColor = _pWindow->GetSettings().GetStyleSettings().GetFaceColor().GetColor();
161 [ # # ]: 0 : return makeAny( nBackgroundColor );
162 : : }
163 : :
164 : 729 : static void adjustBooleanWindowStyle( const Any& _rValue, Window* _pWindow, WinBits _nBits, sal_Bool _bInverseSemantics )
165 : : {
166 [ + - ]: 729 : WinBits nStyle = _pWindow->GetStyle();
167 : 729 : sal_Bool bValue( sal_False );
168 : 729 : OSL_VERIFY( _rValue >>= bValue );
169 [ + + ]: 729 : if ( bValue != _bInverseSemantics )
170 : 228 : nStyle |= _nBits;
171 : : else
172 : 501 : nStyle &= ~_nBits;
173 [ + - ]: 729 : _pWindow->SetStyle( nStyle );
174 : 729 : }
175 : :
176 : 96 : static void setVisualEffect( const Any& _rValue, Window* _pWindow )
177 : : {
178 [ + - ]: 96 : AllSettings aSettings = _pWindow->GetSettings();
179 [ + - ]: 96 : StyleSettings aStyleSettings = aSettings.GetStyleSettings();
180 : :
181 : 96 : sal_Int16 nStyle = LOOK3D;
182 : 96 : OSL_VERIFY( _rValue >>= nStyle );
183 [ + + ]: 96 : switch ( nStyle )
184 : : {
185 : : case FLAT:
186 [ + - ]: 20 : aStyleSettings.SetOptions( aStyleSettings.GetOptions() & ~STYLE_OPTION_MONO );
187 : 20 : break;
188 : : case LOOK3D:
189 : : default:
190 [ + - ]: 76 : aStyleSettings.SetOptions( aStyleSettings.GetOptions() | STYLE_OPTION_MONO );
191 : : }
192 [ + - ]: 96 : aSettings.SetStyleSettings( aStyleSettings );
193 [ + - ][ + - ]: 96 : _pWindow->SetSettings( aSettings );
[ + - ]
194 : 96 : }
195 : :
196 : 0 : static Any getVisualEffect( Window* _pWindow )
197 : : {
198 : 0 : Any aEffect;
199 : :
200 [ # # ]: 0 : StyleSettings aStyleSettings = _pWindow->GetSettings().GetStyleSettings();
201 [ # # ]: 0 : if ( (aStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
202 [ # # ]: 0 : aEffect <<= (sal_Int16)FLAT;
203 : : else
204 [ # # ]: 0 : aEffect <<= (sal_Int16)LOOK3D;
205 [ # # ]: 0 : return aEffect;
206 : : }
207 : : }
208 : :
209 : : // ----------------------------------------------------
210 : : // class VCLXGraphicControl
211 : : // ----------------------------------------------------
212 : :
213 : 192 : void VCLXGraphicControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
214 : : {
215 : 192 : VCLXWindow::ImplGetPropertyIds( rIds );
216 : 192 : }
217 : :
218 : 129 : void VCLXGraphicControl::ImplSetNewImage()
219 : : {
220 : : OSL_PRECOND( GetWindow(), "VCLXGraphicControl::ImplSetNewImage: window is required to be not-NULL!" );
221 : 129 : Button* pButton = static_cast< Button* >( GetWindow() );
222 : 129 : pButton->SetModeImage( GetImage() );
223 : 129 : }
224 : :
225 : 159 : void VCLXGraphicControl::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, short Flags ) throw(::com::sun::star::uno::RuntimeException)
226 : : {
227 [ + - ]: 159 : SolarMutexGuard aGuard;
228 : :
229 [ + - ]: 159 : if ( GetWindow() )
230 : : {
231 [ + - ]: 159 : Size aOldSize = GetWindow()->GetSizePixel();
232 [ + - ]: 159 : VCLXWindow::setPosSize( X, Y, Width, Height, Flags );
233 [ + + ][ - + ]: 159 : if ( ( aOldSize.Width() != Width ) || ( aOldSize.Height() != Height ) )
[ + + ]
234 [ + - ]: 159 : ImplSetNewImage();
235 [ + - ]: 159 : }
236 : 159 : }
237 : :
238 : 8371 : void VCLXGraphicControl::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
239 : : {
240 [ + - ]: 8371 : SolarMutexGuard aGuard;
241 : :
242 : 8371 : Button* pButton = static_cast< Button* >( GetWindow() );
243 [ - + ]: 8371 : if ( !pButton )
244 : 8371 : return;
245 [ + - ]: 8371 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
246 [ + + + + ]: 8371 : switch ( nPropType )
247 : : {
248 : : case BASEPROPERTY_GRAPHIC:
249 : : {
250 : 144 : Reference< XGraphic > xGraphic;
251 [ + - ]: 144 : OSL_VERIFY( Value >>= xGraphic );
252 [ + - ][ + - ]: 144 : maImage = Image( xGraphic );
[ + - ]
253 [ + - ]: 144 : ImplSetNewImage();
254 : : }
255 : 144 : break;
256 : :
257 : : case BASEPROPERTY_IMAGEALIGN:
258 : : {
259 [ + - ]: 52 : WindowType eType = GetWindow()->GetType();
260 [ - + ][ # # ]: 52 : if ( ( eType == WINDOW_PUSHBUTTON )
[ # # ]
261 : : || ( eType == WINDOW_RADIOBUTTON )
262 : : || ( eType == WINDOW_CHECKBOX )
263 : : )
264 : : {
265 : 52 : sal_Int16 nAlignment = sal_Int16();
266 [ + - ]: 52 : if ( Value >>= nAlignment )
267 [ + - ]: 52 : pButton->SetImageAlign( static_cast< ImageAlign >( nAlignment ) );
268 : : }
269 : : }
270 : 52 : break;
271 : : case BASEPROPERTY_IMAGEPOSITION:
272 : : {
273 [ + - ]: 148 : WindowType eType = GetWindow()->GetType();
274 [ + + ][ + + ]: 148 : if ( ( eType == WINDOW_PUSHBUTTON )
[ + - ]
275 : : || ( eType == WINDOW_RADIOBUTTON )
276 : : || ( eType == WINDOW_CHECKBOX )
277 : : )
278 : : {
279 : 148 : sal_Int16 nImagePosition = 2;
280 : 148 : OSL_VERIFY( Value >>= nImagePosition );
281 [ + - ][ + - ]: 148 : pButton->SetImageAlign( ::toolkit::translateImagePosition( nImagePosition ) );
282 : : }
283 : : }
284 : 148 : break;
285 : : default:
286 [ + - ]: 8027 : VCLXWindow::setProperty( PropertyName, Value );
287 : 8371 : break;
288 [ + - ][ + - ]: 8371 : }
289 : : }
290 : :
291 : 0 : ::com::sun::star::uno::Any VCLXGraphicControl::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
292 : : {
293 [ # # ]: 0 : SolarMutexGuard aGuard;
294 : :
295 : 0 : ::com::sun::star::uno::Any aProp;
296 [ # # ]: 0 : if ( !GetWindow() )
297 : : return aProp;
298 : :
299 [ # # ]: 0 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
300 [ # # # # ]: 0 : switch ( nPropType )
301 : : {
302 : : case BASEPROPERTY_GRAPHIC:
303 [ # # ][ # # ]: 0 : aProp <<= maImage.GetXGraphic();
304 : 0 : break;
305 : : case BASEPROPERTY_IMAGEALIGN:
306 : : {
307 [ # # ]: 0 : WindowType eType = GetWindow()->GetType();
308 [ # # ][ # # ]: 0 : if ( ( eType == WINDOW_PUSHBUTTON )
[ # # ]
309 : : || ( eType == WINDOW_RADIOBUTTON )
310 : : || ( eType == WINDOW_CHECKBOX )
311 : : )
312 : : {
313 [ # # ][ # # ]: 0 : aProp <<= ::toolkit::getCompatibleImageAlign( static_cast< Button* >( GetWindow() )->GetImageAlign() );
[ # # ]
314 : : }
315 : : }
316 : 0 : break;
317 : : case BASEPROPERTY_IMAGEPOSITION:
318 : : {
319 [ # # ]: 0 : WindowType eType = GetWindow()->GetType();
320 [ # # ][ # # ]: 0 : if ( ( eType == WINDOW_PUSHBUTTON )
[ # # ]
321 : : || ( eType == WINDOW_RADIOBUTTON )
322 : : || ( eType == WINDOW_CHECKBOX )
323 : : )
324 : : {
325 [ # # ][ # # ]: 0 : aProp <<= ::toolkit::translateImagePosition( static_cast< Button* >( GetWindow() )->GetImageAlign() );
[ # # ]
326 : : }
327 : : }
328 : 0 : break;
329 : : default:
330 : : {
331 [ # # ][ # # ]: 0 : aProp <<= VCLXWindow::getProperty( PropertyName );
332 : : }
333 : 0 : break;
334 : : }
335 [ # # ]: 0 : return aProp;
336 : : }
337 : :
338 : : //--------------------------------------------------------------------
339 : : // class VCLXButton
340 : : // ----------------------------------------------------
341 : :
342 : 69 : void VCLXButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
343 : : {
344 : : PushPropertyIds( rIds,
345 : : BASEPROPERTY_BACKGROUNDCOLOR,
346 : : BASEPROPERTY_DEFAULTBUTTON,
347 : : BASEPROPERTY_DEFAULTCONTROL,
348 : : BASEPROPERTY_ENABLED,
349 : : BASEPROPERTY_ENABLEVISIBLE,
350 : : BASEPROPERTY_FONTDESCRIPTOR,
351 : : BASEPROPERTY_GRAPHIC,
352 : : BASEPROPERTY_HELPTEXT,
353 : : BASEPROPERTY_HELPURL,
354 : : BASEPROPERTY_IMAGEALIGN,
355 : : BASEPROPERTY_IMAGEPOSITION,
356 : : BASEPROPERTY_IMAGEURL,
357 : : BASEPROPERTY_LABEL,
358 : : BASEPROPERTY_PRINTABLE,
359 : : BASEPROPERTY_PUSHBUTTONTYPE,
360 : : BASEPROPERTY_REPEAT,
361 : : BASEPROPERTY_REPEAT_DELAY,
362 : : BASEPROPERTY_STATE,
363 : : BASEPROPERTY_TABSTOP,
364 : : BASEPROPERTY_TOGGLE,
365 : : BASEPROPERTY_FOCUSONCLICK,
366 : : BASEPROPERTY_MULTILINE,
367 : : BASEPROPERTY_ALIGN,
368 : : BASEPROPERTY_VERTICALALIGN,
369 : : BASEPROPERTY_WRITING_MODE,
370 : : BASEPROPERTY_CONTEXT_WRITING_MODE,
371 : : BASEPROPERTY_REFERENCE_DEVICE,
372 : 69 : 0);
373 : 69 : VCLXGraphicControl::ImplGetPropertyIds( rIds );
374 : 69 : }
375 : :
376 : 88 : VCLXButton::VCLXButton()
377 : : :maActionListeners( *this )
378 [ + - ][ + - ]: 88 : ,maItemListeners( *this )
379 : : {
380 : 88 : }
381 : :
382 [ + - ][ + - ]: 88 : VCLXButton::~VCLXButton()
383 : : {
384 [ - + ]: 176 : }
385 : :
386 : 32 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXButton::CreateAccessibleContext()
387 : : {
388 : 32 : return getAccessibleFactory().createAccessibleContext( this );
389 : : }
390 : :
391 : 176 : void VCLXButton::dispose() throw(::com::sun::star::uno::RuntimeException)
392 : : {
393 [ + - ]: 176 : SolarMutexGuard aGuard;
394 : :
395 [ + - ]: 176 : ::com::sun::star::lang::EventObject aObj;
396 [ + - ]: 176 : aObj.Source = (::cppu::OWeakObject*)this;
397 [ + - ]: 176 : maActionListeners.disposeAndClear( aObj );
398 [ + - ]: 176 : maItemListeners.disposeAndClear( aObj );
399 [ + - ][ + - ]: 176 : VCLXGraphicControl::dispose();
[ + - ]
400 : 176 : }
401 : :
402 : 50 : void VCLXButton::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l )throw(::com::sun::star::uno::RuntimeException)
403 : : {
404 [ + - ]: 50 : SolarMutexGuard aGuard;
405 [ + - ][ + - ]: 50 : maActionListeners.addInterface( l );
406 : 50 : }
407 : :
408 : 2 : void VCLXButton::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
409 : : {
410 [ + - ]: 2 : SolarMutexGuard aGuard;
411 [ + - ][ + - ]: 2 : maActionListeners.removeInterface( l );
412 : 2 : }
413 : :
414 : 56 : void VCLXButton::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l )throw(::com::sun::star::uno::RuntimeException)
415 : : {
416 [ + - ]: 56 : SolarMutexGuard aGuard;
417 [ + - ][ + - ]: 56 : maItemListeners.addInterface( l );
418 : 56 : }
419 : :
420 : 0 : void VCLXButton::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
421 : : {
422 [ # # ]: 0 : SolarMutexGuard aGuard;
423 [ # # ][ # # ]: 0 : maItemListeners.removeInterface( l );
424 : 0 : }
425 : :
426 : 0 : void VCLXButton::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException)
427 : : {
428 [ # # ]: 0 : SolarMutexGuard aGuard;
429 : :
430 : 0 : Window* pWindow = GetWindow();
431 [ # # ]: 0 : if ( pWindow )
432 [ # # ][ # # ]: 0 : pWindow->SetText( rLabel );
[ # # ][ # # ]
433 : 0 : }
434 : :
435 : 60 : void VCLXButton::setActionCommand( const ::rtl::OUString& rCommand ) throw(::com::sun::star::uno::RuntimeException)
436 : : {
437 [ + - ]: 60 : SolarMutexGuard aGuard;
438 : :
439 [ + - ]: 60 : maActionCommand = rCommand;
440 : 60 : }
441 : :
442 : 8 : ::com::sun::star::awt::Size VCLXButton::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
443 : : {
444 [ + - ]: 8 : SolarMutexGuard aGuard;
445 : :
446 : 8 : Size aSz;
447 : 8 : PushButton* pButton = (PushButton*) GetWindow();
448 [ + - ]: 8 : if ( pButton )
449 [ + - ]: 8 : aSz = pButton->CalcMinimumSize();
450 [ + - ]: 8 : return AWTSize(aSz);
451 : : }
452 : :
453 : 4 : ::com::sun::star::awt::Size VCLXButton::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
454 : : {
455 : 4 : ::com::sun::star::awt::Size aSz = getMinimumSize();
456 : 4 : aSz.Width += 16;
457 : 4 : aSz.Height += 10;
458 : 4 : return aSz;
459 : : }
460 : :
461 : 4 : ::com::sun::star::awt::Size VCLXButton::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
462 : : {
463 [ + - ]: 4 : SolarMutexGuard aGuard;
464 : :
465 : 4 : Size aSz = VCLSize(rNewSize);
466 : 4 : PushButton* pButton = (PushButton*) GetWindow();
467 [ + - ]: 4 : if ( pButton )
468 : : {
469 [ + - ]: 4 : Size aMinSz = pButton->CalcMinimumSize();
470 : : // no text, thus image
471 [ + - ][ + - ]: 4 : if ( !pButton->GetText().Len() )
[ + - ]
472 : : {
473 [ - + ]: 4 : if ( aSz.Width() < aMinSz.Width() )
474 : 0 : aSz.Width() = aMinSz.Width();
475 [ - + ]: 4 : if ( aSz.Height() < aMinSz.Height() )
476 : 0 : aSz.Height() = aMinSz.Height();
477 : : }
478 : : else
479 : : {
480 [ # # ][ # # ]: 0 : if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) )
[ # # ]
481 : 0 : aSz.Height() = aMinSz.Height();
482 : : else
483 : 4 : aSz = aMinSz;
484 : : }
485 : : }
486 [ + - ]: 4 : return AWTSize(aSz);
487 : : }
488 : :
489 : 3024 : void VCLXButton::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
490 : : {
491 [ + - ]: 3024 : SolarMutexGuard aGuard;
492 : :
493 : 3024 : Button* pButton = (Button*)GetWindow();
494 [ + - ]: 3024 : if ( pButton )
495 : : {
496 [ + - ]: 3024 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
497 [ + + + + : 3024 : switch ( nPropType )
+ ]
498 : : {
499 : : case BASEPROPERTY_FOCUSONCLICK:
500 [ + - ]: 52 : ::toolkit::adjustBooleanWindowStyle( Value, pButton, WB_NOPOINTERFOCUS, sal_True );
501 : 52 : break;
502 : :
503 : : case BASEPROPERTY_TOGGLE:
504 [ + - ]: 52 : ::toolkit::adjustBooleanWindowStyle( Value, pButton, WB_TOGGLE, sal_False );
505 : 52 : break;
506 : :
507 : : case BASEPROPERTY_DEFAULTBUTTON:
508 : : {
509 [ + - ]: 52 : WinBits nStyle = pButton->GetStyle() | WB_DEFBUTTON;
510 : 52 : sal_Bool b = sal_Bool();
511 [ + - ][ + - ]: 52 : if ( ( Value >>= b ) && !b )
[ + - ]
512 : 52 : nStyle &= ~WB_DEFBUTTON;
513 [ + - ]: 52 : pButton->SetStyle( nStyle );
514 : : }
515 : 52 : break;
516 : : case BASEPROPERTY_STATE:
517 : : {
518 [ + - ][ + - ]: 52 : if ( GetWindow()->GetType() == WINDOW_PUSHBUTTON )
519 : : {
520 : 52 : sal_Int16 n = sal_Int16();
521 [ + - ]: 52 : if ( Value >>= n )
522 [ + - ]: 52 : ((PushButton*)pButton)->SetState( (TriState)n );
523 : : }
524 : : }
525 : 52 : break;
526 : : default:
527 : : {
528 [ + - ]: 3024 : VCLXGraphicControl::setProperty( PropertyName, Value );
529 : : }
530 : : }
531 [ + - ]: 3024 : }
532 : 3024 : }
533 : :
534 : 0 : ::com::sun::star::uno::Any VCLXButton::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
535 : : {
536 [ # # ]: 0 : SolarMutexGuard aGuard;
537 : :
538 : 0 : ::com::sun::star::uno::Any aProp;
539 : 0 : Button* pButton = (Button*)GetWindow();
540 [ # # ]: 0 : if ( pButton )
541 : : {
542 [ # # ]: 0 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
543 [ # # # # : 0 : switch ( nPropType )
# ]
544 : : {
545 : : case BASEPROPERTY_FOCUSONCLICK:
546 [ # # ][ # # ]: 0 : aProp <<= (sal_Bool)( ( pButton->GetStyle() & WB_NOPOINTERFOCUS ) == 0 );
547 : 0 : break;
548 : :
549 : : case BASEPROPERTY_TOGGLE:
550 [ # # ][ # # ]: 0 : aProp <<= (sal_Bool)( ( pButton->GetStyle() & WB_TOGGLE ) != 0 );
551 : 0 : break;
552 : :
553 : : case BASEPROPERTY_DEFAULTBUTTON:
554 : : {
555 [ # # ][ # # ]: 0 : aProp <<= (sal_Bool) ( ( pButton->GetStyle() & WB_DEFBUTTON ) ? sal_True : sal_False );
[ # # ]
556 : : }
557 : 0 : break;
558 : : case BASEPROPERTY_STATE:
559 : : {
560 [ # # ][ # # ]: 0 : if ( GetWindow()->GetType() == WINDOW_PUSHBUTTON )
561 : : {
562 [ # # ]: 0 : aProp <<= (sal_Int16)((PushButton*)pButton)->GetState();
563 : : }
564 : : }
565 : 0 : break;
566 : : default:
567 : : {
568 [ # # ][ # # ]: 0 : aProp <<= VCLXGraphicControl::getProperty( PropertyName );
569 : : }
570 : : }
571 : : }
572 [ # # ]: 0 : return aProp;
573 : : }
574 : :
575 : 398 : void VCLXButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
576 : : {
577 [ + - + ]: 398 : switch ( rVclWindowEvent.GetId() )
578 : : {
579 : : case VCLEVENT_BUTTON_CLICK:
580 : : {
581 [ + - ]: 2 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
582 : : // since we call listeners below, there is a potential that we will be destroyed
583 : : // during the listener call. To prevent the resulting crashs, we keep us
584 : : // alive as long as we're here
585 : :
586 [ + - ][ + - ]: 2 : if ( maActionListeners.getLength() )
587 : : {
588 [ + - ]: 2 : ::com::sun::star::awt::ActionEvent aEvent;
589 [ + - ]: 2 : aEvent.Source = (::cppu::OWeakObject*)this;
590 : 2 : aEvent.ActionCommand = maActionCommand;
591 : :
592 : : Callback aCallback = ::boost::bind(
593 : : &ActionListenerMultiplexer::actionPerformed,
594 : : &maActionListeners,
595 : : aEvent
596 [ + - ][ + - ]: 2 : );
[ + - ][ + - ]
[ + - ]
597 [ + - ][ + - ]: 2 : ImplExecuteAsyncWithoutSolarLock( aCallback );
[ + - ]
598 : 2 : }
599 : : }
600 : 2 : break;
601 : :
602 : : case VCLEVENT_PUSHBUTTON_TOGGLE:
603 : : {
604 [ # # ]: 0 : PushButton& rButton = dynamic_cast< PushButton& >( *rVclWindowEvent.GetWindow() );
605 : :
606 [ # # ]: 0 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
607 [ # # ][ # # ]: 0 : if ( maItemListeners.getLength() )
608 : : {
609 [ # # ]: 0 : ::com::sun::star::awt::ItemEvent aEvent;
610 [ # # ]: 0 : aEvent.Source = (::cppu::OWeakObject*)this;
611 [ # # ]: 0 : aEvent.Selected = ( rButton.GetState() == STATE_CHECK ) ? 1 : 0;
612 [ # # ][ # # ]: 0 : maItemListeners.itemStateChanged( aEvent );
613 : 0 : }
614 : : }
615 : 0 : break;
616 : :
617 : : default:
618 : 396 : VCLXGraphicControl::ProcessWindowEvent( rVclWindowEvent );
619 : 396 : break;
620 : : }
621 : 398 : }
622 : :
623 : : // ----------------------------------------------------
624 : : // class VCLXImageControl
625 : : // ----------------------------------------------------
626 : :
627 : 46 : void VCLXImageControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
628 : : {
629 : : PushPropertyIds( rIds,
630 : : BASEPROPERTY_BACKGROUNDCOLOR,
631 : : BASEPROPERTY_BORDER,
632 : : BASEPROPERTY_BORDERCOLOR,
633 : : BASEPROPERTY_DEFAULTCONTROL,
634 : : BASEPROPERTY_ENABLED,
635 : : BASEPROPERTY_ENABLEVISIBLE,
636 : : BASEPROPERTY_GRAPHIC,
637 : : BASEPROPERTY_HELPTEXT,
638 : : BASEPROPERTY_HELPURL,
639 : : BASEPROPERTY_IMAGEURL,
640 : : BASEPROPERTY_PRINTABLE,
641 : : BASEPROPERTY_SCALEIMAGE,
642 : : BASEPROPERTY_IMAGE_SCALE_MODE,
643 : : BASEPROPERTY_TABSTOP,
644 : : BASEPROPERTY_WRITING_MODE,
645 : : BASEPROPERTY_CONTEXT_WRITING_MODE,
646 : 46 : 0);
647 : 46 : VCLXGraphicControl::ImplGetPropertyIds( rIds );
648 : 46 : }
649 : :
650 : 22 : VCLXImageControl::VCLXImageControl()
651 : : {
652 : 22 : }
653 : :
654 : 21 : VCLXImageControl::~VCLXImageControl()
655 : : {
656 [ - + ]: 42 : }
657 : :
658 : 30 : void VCLXImageControl::ImplSetNewImage()
659 : : {
660 : : OSL_PRECOND( GetWindow(), "VCLXImageControl::ImplSetNewImage: window is required to be not-NULL!" );
661 : 30 : ImageControl* pControl = static_cast< ImageControl* >( GetWindow() );
662 : 30 : pControl->SetImage( GetImage() );
663 : 30 : }
664 : :
665 : 18 : ::com::sun::star::awt::Size VCLXImageControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
666 : : {
667 [ + - ]: 18 : SolarMutexGuard aGuard;
668 : :
669 [ + - ]: 18 : Size aSz = GetImage().GetSizePixel();
670 [ + - ]: 18 : aSz = ImplCalcWindowSize( aSz );
671 : :
672 [ + - ]: 18 : return AWTSize(aSz);
673 : : }
674 : :
675 : 6 : ::com::sun::star::awt::Size VCLXImageControl::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
676 : : {
677 : 6 : return getMinimumSize();
678 : : }
679 : :
680 : 6 : ::com::sun::star::awt::Size VCLXImageControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
681 : : {
682 [ + - ]: 6 : SolarMutexGuard aGuard;
683 : :
684 : 6 : ::com::sun::star::awt::Size aSz = rNewSize;
685 [ + - ]: 6 : ::com::sun::star::awt::Size aMinSz = getMinimumSize();
686 [ - + ]: 6 : if ( aSz.Width < aMinSz.Width )
687 : 0 : aSz.Width = aMinSz.Width;
688 [ - + ]: 6 : if ( aSz.Height < aMinSz.Height )
689 : 0 : aSz.Height = aMinSz.Height;
690 [ + - ]: 6 : return aSz;
691 : : }
692 : :
693 : 924 : void VCLXImageControl::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
694 : : {
695 [ + - ]: 924 : SolarMutexGuard aGuard;
696 : :
697 : 924 : ImageControl* pImageControl = (ImageControl*)GetWindow();
698 : :
699 [ + - ]: 924 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
700 [ + + + ]: 924 : switch ( nPropType )
701 : : {
702 : : case BASEPROPERTY_IMAGE_SCALE_MODE:
703 : : {
704 : 54 : sal_Int16 nScaleMode( ImageScaleMode::Anisotropic );
705 [ + - ][ + - ]: 54 : if ( pImageControl && ( Value >>= nScaleMode ) )
[ + - ]
706 : : {
707 [ + - ]: 54 : pImageControl->SetScaleMode( nScaleMode );
708 : : }
709 : : }
710 : 54 : break;
711 : :
712 : : case BASEPROPERTY_SCALEIMAGE:
713 : : {
714 : : // this is for compatibility only, nowadays, the ImageScaleMode property should be used
715 : 54 : sal_Bool bScaleImage = sal_False;
716 [ + - ][ + - ]: 54 : if ( pImageControl && ( Value >>= bScaleImage ) )
[ + - ]
717 : : {
718 [ + + ][ + - ]: 54 : pImageControl->SetScaleMode( bScaleImage ? ImageScaleMode::Anisotropic : ImageScaleMode::None );
719 : : }
720 : : }
721 : 54 : break;
722 : :
723 : : default:
724 [ + - ]: 816 : VCLXGraphicControl::setProperty( PropertyName, Value );
725 : 816 : break;
726 [ + - ]: 924 : }
727 : 924 : }
728 : :
729 : 0 : ::com::sun::star::uno::Any VCLXImageControl::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
730 : : {
731 [ # # ]: 0 : SolarMutexGuard aGuard;
732 : :
733 : 0 : ::com::sun::star::uno::Any aProp;
734 : 0 : ImageControl* pImageControl = (ImageControl*)GetWindow();
735 [ # # ]: 0 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
736 : :
737 [ # # # ]: 0 : switch ( nPropType )
738 : : {
739 : : case BASEPROPERTY_IMAGE_SCALE_MODE:
740 [ # # ][ # # ]: 0 : aProp <<= ( pImageControl ? pImageControl->GetScaleMode() : ImageScaleMode::Anisotropic );
741 : 0 : break;
742 : :
743 : : case BASEPROPERTY_SCALEIMAGE:
744 [ # # ][ # # ]: 0 : aProp <<= ( pImageControl && pImageControl->GetScaleMode() != ImageScaleMode::None ) ? sal_True : sal_False;
[ # # ]
745 : 0 : break;
746 : :
747 : : default:
748 [ # # ]: 0 : aProp = VCLXGraphicControl::getProperty( PropertyName );
749 : 0 : break;
750 : : }
751 [ # # ]: 0 : return aProp;
752 : : }
753 : :
754 : : // ----------------------------------------------------
755 : : // class VCLXCheckBox
756 : : // ----------------------------------------------------
757 : :
758 : :
759 : 35 : void VCLXCheckBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
760 : : {
761 : : PushPropertyIds( rIds,
762 : : BASEPROPERTY_DEFAULTCONTROL,
763 : : BASEPROPERTY_ENABLED,
764 : : BASEPROPERTY_ENABLEVISIBLE,
765 : : BASEPROPERTY_FONTDESCRIPTOR,
766 : : BASEPROPERTY_GRAPHIC,
767 : : BASEPROPERTY_HELPTEXT,
768 : : BASEPROPERTY_HELPURL,
769 : : BASEPROPERTY_IMAGEPOSITION,
770 : : BASEPROPERTY_IMAGEURL,
771 : : BASEPROPERTY_LABEL,
772 : : BASEPROPERTY_PRINTABLE,
773 : : BASEPROPERTY_STATE,
774 : : BASEPROPERTY_TABSTOP,
775 : : BASEPROPERTY_TRISTATE,
776 : : BASEPROPERTY_VISUALEFFECT,
777 : : BASEPROPERTY_MULTILINE,
778 : : BASEPROPERTY_BACKGROUNDCOLOR,
779 : : BASEPROPERTY_ALIGN,
780 : : BASEPROPERTY_VERTICALALIGN,
781 : : BASEPROPERTY_WRITING_MODE,
782 : : BASEPROPERTY_CONTEXT_WRITING_MODE,
783 : : BASEPROPERTY_REFERENCE_DEVICE,
784 : 35 : 0);
785 : 35 : VCLXGraphicControl::ImplGetPropertyIds( rIds );
786 : 35 : }
787 : :
788 [ + - ][ + - ]: 34 : VCLXCheckBox::VCLXCheckBox() : maActionListeners( *this ), maItemListeners( *this )
[ + - ]
789 : : {
790 : 34 : }
791 : :
792 : : // ::com::sun::star::uno::XInterface
793 : 4463 : ::com::sun::star::uno::Any VCLXCheckBox::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
794 : : {
795 : : ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
796 : : (static_cast< ::com::sun::star::awt::XButton* >(this)),
797 [ + - ]: 4463 : (static_cast< ::com::sun::star::awt::XCheckBox* >(this)) );
798 [ + + ][ + - ]: 4463 : return (aRet.hasValue() ? aRet : VCLXGraphicControl::queryInterface( rType ));
799 : : }
800 : :
801 : : // ::com::sun::star::lang::XTypeProvider
802 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_START( VCLXCheckBox )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
803 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XButton>* ) NULL ),
804 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCheckBox>* ) NULL ),
805 : : VCLXGraphicControl::getTypes()
806 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_END
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
807 : :
808 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXCheckBox::CreateAccessibleContext()
809 : : {
810 : 0 : return getAccessibleFactory().createAccessibleContext( this );
811 : : }
812 : :
813 : 68 : void VCLXCheckBox::dispose() throw(::com::sun::star::uno::RuntimeException)
814 : : {
815 [ + - ]: 68 : SolarMutexGuard aGuard;
816 : :
817 [ + - ]: 68 : ::com::sun::star::lang::EventObject aObj;
818 [ + - ]: 68 : aObj.Source = (::cppu::OWeakObject*)this;
819 [ + - ]: 68 : maItemListeners.disposeAndClear( aObj );
820 [ + - ][ + - ]: 68 : VCLXGraphicControl::dispose();
[ + - ]
821 : 68 : }
822 : :
823 : 38 : void VCLXCheckBox::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
824 : : {
825 [ + - ]: 38 : SolarMutexGuard aGuard;
826 [ + - ][ + - ]: 38 : maItemListeners.addInterface( l );
827 : 38 : }
828 : :
829 : 0 : void VCLXCheckBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
830 : : {
831 [ # # ]: 0 : SolarMutexGuard aGuard;
832 [ # # ][ # # ]: 0 : maItemListeners.removeInterface( l );
833 : 0 : }
834 : :
835 : 0 : void VCLXCheckBox::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l )throw(::com::sun::star::uno::RuntimeException)
836 : : {
837 [ # # ]: 0 : SolarMutexGuard aGuard;
838 [ # # ][ # # ]: 0 : maActionListeners.addInterface( l );
839 : 0 : }
840 : :
841 : 0 : void VCLXCheckBox::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
842 : : {
843 [ # # ]: 0 : SolarMutexGuard aGuard;
844 [ # # ][ # # ]: 0 : maActionListeners.removeInterface( l );
845 : 0 : }
846 : :
847 : 38 : void VCLXCheckBox::setActionCommand( const ::rtl::OUString& rCommand ) throw(::com::sun::star::uno::RuntimeException)
848 : : {
849 [ + - ]: 38 : SolarMutexGuard aGuard;
850 [ + - ]: 38 : maActionCommand = rCommand;
851 : 38 : }
852 : :
853 : 0 : void VCLXCheckBox::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException)
854 : : {
855 [ # # ]: 0 : SolarMutexGuard aGuard;
856 : :
857 : 0 : Window* pWindow = GetWindow();
858 [ # # ]: 0 : if ( pWindow )
859 [ # # ][ # # ]: 0 : pWindow->SetText( rLabel );
[ # # ][ # # ]
860 : 0 : }
861 : :
862 : 62 : void VCLXCheckBox::setState( short n ) throw(::com::sun::star::uno::RuntimeException)
863 : : {
864 [ + - ]: 62 : SolarMutexGuard aGuard;
865 : :
866 : 62 : CheckBox* pCheckBox = (CheckBox*)GetWindow();
867 [ + - ]: 62 : if ( pCheckBox)
868 : : {
869 : : TriState eState;
870 [ + + + + ]: 62 : switch ( n )
871 : : {
872 : 14 : case 0: eState = STATE_NOCHECK; break;
873 : 10 : case 1: eState = STATE_CHECK; break;
874 : 12 : case 2: eState = STATE_DONTKNOW; break;
875 : 26 : default: eState = STATE_NOCHECK;
876 : : }
877 [ + - ]: 62 : pCheckBox->SetState( eState );
878 : :
879 : : // #105198# call C++ click listeners (needed for accessibility)
880 : : // pCheckBox->GetClickHdl().Call( pCheckBox );
881 : :
882 : : // #107218# Call same virtual methods and listeners like VCL would do after user interaction
883 [ + - ]: 62 : SetSynthesizingVCLEvent( sal_True );
884 [ + - ]: 62 : pCheckBox->Toggle();
885 [ + - ]: 62 : pCheckBox->Click();
886 [ + - ]: 62 : SetSynthesizingVCLEvent( sal_False );
887 [ + - ]: 62 : }
888 : 62 : }
889 : :
890 : 0 : short VCLXCheckBox::getState() throw(::com::sun::star::uno::RuntimeException)
891 : : {
892 [ # # ]: 0 : SolarMutexGuard aGuard;
893 : :
894 : 0 : short nState = -1;
895 : 0 : CheckBox* pCheckBox = (CheckBox*)GetWindow();
896 [ # # ]: 0 : if ( pCheckBox )
897 : : {
898 [ # # # # ]: 0 : switch ( pCheckBox->GetState() )
899 : : {
900 : 0 : case STATE_NOCHECK: nState = 0; break;
901 : 0 : case STATE_CHECK: nState = 1; break;
902 : 0 : case STATE_DONTKNOW: nState = 2; break;
903 : : default: OSL_FAIL( "VCLXCheckBox::getState(): unknown TriState!" );
904 : : }
905 : : }
906 : :
907 [ # # ]: 0 : return nState;
908 : : }
909 : :
910 : 0 : void VCLXCheckBox::enableTriState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException)
911 : : {
912 [ # # ]: 0 : SolarMutexGuard aGuard;
913 : :
914 : 0 : CheckBox* pCheckBox = (CheckBox*)GetWindow();
915 [ # # ]: 0 : if ( pCheckBox)
916 [ # # ][ # # ]: 0 : pCheckBox->EnableTriState( b );
917 : 0 : }
918 : :
919 : 8 : ::com::sun::star::awt::Size VCLXCheckBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
920 : : {
921 [ + - ]: 8 : SolarMutexGuard aGuard;
922 : :
923 : 8 : Size aSz;
924 : 8 : CheckBox* pCheckBox = (CheckBox*) GetWindow();
925 [ + - ]: 8 : if ( pCheckBox )
926 [ + - ]: 8 : aSz = pCheckBox->CalcMinimumSize();
927 [ + - ]: 8 : return AWTSize(aSz);
928 : : }
929 : :
930 : 4 : ::com::sun::star::awt::Size VCLXCheckBox::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
931 : : {
932 : 4 : return getMinimumSize();
933 : : }
934 : :
935 : 4 : ::com::sun::star::awt::Size VCLXCheckBox::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
936 : : {
937 [ + - ]: 4 : SolarMutexGuard aGuard;
938 : :
939 : 4 : Size aSz = VCLSize(rNewSize);
940 : 4 : CheckBox* pCheckBox = (CheckBox*) GetWindow();
941 [ + - ]: 4 : if ( pCheckBox )
942 : : {
943 [ + - ]: 4 : Size aMinSz = pCheckBox->CalcMinimumSize();
944 [ + - ][ - + ]: 4 : if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) )
[ - + ]
945 : 0 : aSz.Height() = aMinSz.Height();
946 : : else
947 : 4 : aSz = aMinSz;
948 : : }
949 [ + - ]: 4 : return AWTSize(aSz);
950 : : }
951 : :
952 : 2503 : void VCLXCheckBox::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
953 : : {
954 [ + - ]: 2503 : SolarMutexGuard aGuard;
955 : :
956 : 2503 : CheckBox* pCheckBox = (CheckBox*)GetWindow();
957 [ + - ]: 2503 : if ( pCheckBox )
958 : : {
959 [ + - ]: 2503 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
960 [ + + + + ]: 2503 : switch ( nPropType )
961 : : {
962 : : case BASEPROPERTY_VISUALEFFECT:
963 [ + - ]: 48 : ::toolkit::setVisualEffect( Value, pCheckBox );
964 : 48 : break;
965 : :
966 : : case BASEPROPERTY_TRISTATE:
967 : : {
968 : 52 : sal_Bool b = sal_Bool();
969 [ + - ]: 52 : if ( Value >>= b )
970 [ + - ]: 52 : pCheckBox->EnableTriState( b );
971 : : }
972 : 52 : break;
973 : : case BASEPROPERTY_STATE:
974 : : {
975 : 62 : sal_Int16 n = sal_Int16();
976 [ + - ]: 62 : if ( Value >>= n )
977 [ + - ]: 62 : setState( n );
978 : : }
979 : 62 : break;
980 : : default:
981 : : {
982 [ + - ]: 2503 : VCLXGraphicControl::setProperty( PropertyName, Value );
983 : : }
984 : : }
985 [ + - ]: 2503 : }
986 : 2503 : }
987 : :
988 : 0 : ::com::sun::star::uno::Any VCLXCheckBox::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
989 : : {
990 [ # # ]: 0 : SolarMutexGuard aGuard;
991 : :
992 : 0 : ::com::sun::star::uno::Any aProp;
993 : 0 : CheckBox* pCheckBox = (CheckBox*)GetWindow();
994 [ # # ]: 0 : if ( pCheckBox )
995 : : {
996 [ # # ]: 0 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
997 [ # # # # ]: 0 : switch ( nPropType )
998 : : {
999 : : case BASEPROPERTY_VISUALEFFECT:
1000 [ # # ]: 0 : aProp = ::toolkit::getVisualEffect( pCheckBox );
1001 : 0 : break;
1002 : : case BASEPROPERTY_TRISTATE:
1003 [ # # ]: 0 : aProp <<= (sal_Bool)pCheckBox->IsTriStateEnabled();
1004 : 0 : break;
1005 : : case BASEPROPERTY_STATE:
1006 [ # # ]: 0 : aProp <<= (sal_Int16)pCheckBox->GetState();
1007 : 0 : break;
1008 : : default:
1009 : : {
1010 [ # # ][ # # ]: 0 : aProp <<= VCLXGraphicControl::getProperty( PropertyName );
1011 : : }
1012 : : }
1013 : : }
1014 [ # # ]: 0 : return aProp;
1015 : : }
1016 : :
1017 : 516 : void VCLXCheckBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
1018 : : {
1019 [ - + ]: 516 : switch ( rVclWindowEvent.GetId() )
1020 : : {
1021 : : case VCLEVENT_CHECKBOX_TOGGLE:
1022 : : {
1023 [ # # ]: 0 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
1024 : : // since we call listeners below, there is a potential that we will be destroyed
1025 : : // in during the listener call. To prevent the resulting crashs, we keep us
1026 : : // alive as long as we're here
1027 : :
1028 : 0 : CheckBox* pCheckBox = (CheckBox*)GetWindow();
1029 [ # # ]: 0 : if ( pCheckBox )
1030 : : {
1031 [ # # ][ # # ]: 0 : if ( maItemListeners.getLength() )
1032 : : {
1033 [ # # ]: 0 : ::com::sun::star::awt::ItemEvent aEvent;
1034 [ # # ]: 0 : aEvent.Source = (::cppu::OWeakObject*)this;
1035 : 0 : aEvent.Highlighted = sal_False;
1036 : 0 : aEvent.Selected = pCheckBox->GetState();
1037 [ # # ][ # # ]: 0 : maItemListeners.itemStateChanged( aEvent );
1038 : : }
1039 [ # # ][ # # ]: 0 : if ( !IsSynthesizingVCLEvent() && maActionListeners.getLength() )
[ # # ][ # # ]
[ # # ]
1040 : : {
1041 [ # # ]: 0 : ::com::sun::star::awt::ActionEvent aEvent;
1042 [ # # ]: 0 : aEvent.Source = (::cppu::OWeakObject*)this;
1043 : 0 : aEvent.ActionCommand = maActionCommand;
1044 [ # # ][ # # ]: 0 : maActionListeners.actionPerformed( aEvent );
1045 : : }
1046 : 0 : }
1047 : : }
1048 : 0 : break;
1049 : :
1050 : : default:
1051 : 516 : VCLXGraphicControl::ProcessWindowEvent( rVclWindowEvent );
1052 : 516 : break;
1053 : : }
1054 : 516 : }
1055 : :
1056 : : // ----------------------------------------------------
1057 : : // class VCLXRadioButton
1058 : : // ----------------------------------------------------
1059 : 42 : void VCLXRadioButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
1060 : : {
1061 : : PushPropertyIds( rIds,
1062 : : BASEPROPERTY_DEFAULTCONTROL,
1063 : : BASEPROPERTY_ENABLED,
1064 : : BASEPROPERTY_ENABLEVISIBLE,
1065 : : BASEPROPERTY_FONTDESCRIPTOR,
1066 : : BASEPROPERTY_GRAPHIC,
1067 : : BASEPROPERTY_HELPTEXT,
1068 : : BASEPROPERTY_HELPURL,
1069 : : BASEPROPERTY_IMAGEPOSITION,
1070 : : BASEPROPERTY_IMAGEURL,
1071 : : BASEPROPERTY_LABEL,
1072 : : BASEPROPERTY_PRINTABLE,
1073 : : BASEPROPERTY_STATE,
1074 : : BASEPROPERTY_TABSTOP,
1075 : : BASEPROPERTY_VISUALEFFECT,
1076 : : BASEPROPERTY_MULTILINE,
1077 : : BASEPROPERTY_BACKGROUNDCOLOR,
1078 : : BASEPROPERTY_ALIGN,
1079 : : BASEPROPERTY_VERTICALALIGN,
1080 : : BASEPROPERTY_WRITING_MODE,
1081 : : BASEPROPERTY_CONTEXT_WRITING_MODE,
1082 : : BASEPROPERTY_REFERENCE_DEVICE,
1083 : : BASEPROPERTY_GROUPNAME,
1084 : 42 : 0);
1085 : 42 : VCLXGraphicControl::ImplGetPropertyIds( rIds );
1086 : 42 : }
1087 : :
1088 : :
1089 [ + - ][ + - ]: 34 : VCLXRadioButton::VCLXRadioButton() : maItemListeners( *this ), maActionListeners( *this )
[ + - ]
1090 : : {
1091 : 34 : }
1092 : :
1093 : : // ::com::sun::star::uno::XInterface
1094 : 4917 : ::com::sun::star::uno::Any VCLXRadioButton::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
1095 : : {
1096 : : ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
1097 : : (static_cast< ::com::sun::star::awt::XRadioButton* >(this)),
1098 [ + - ]: 4917 : (static_cast< ::com::sun::star::awt::XButton* >(this)) );
1099 [ + + ][ + - ]: 4917 : return (aRet.hasValue() ? aRet : VCLXGraphicControl::queryInterface( rType ));
1100 : : }
1101 : :
1102 : : // ::com::sun::star::lang::XTypeProvider
1103 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_START( VCLXRadioButton )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
1104 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRadioButton>* ) NULL ),
1105 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XButton>* ) NULL ),
1106 : : VCLXGraphicControl::getTypes()
1107 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_END
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1108 : :
1109 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXRadioButton::CreateAccessibleContext()
1110 : : {
1111 : 0 : return getAccessibleFactory().createAccessibleContext( this );
1112 : : }
1113 : :
1114 : 68 : void VCLXRadioButton::dispose() throw(::com::sun::star::uno::RuntimeException)
1115 : : {
1116 [ + - ]: 68 : SolarMutexGuard aGuard;
1117 : :
1118 [ + - ]: 68 : ::com::sun::star::lang::EventObject aObj;
1119 [ + - ]: 68 : aObj.Source = (::cppu::OWeakObject*)this;
1120 [ + - ]: 68 : maItemListeners.disposeAndClear( aObj );
1121 [ + - ][ + - ]: 68 : VCLXGraphicControl::dispose();
[ + - ]
1122 : 68 : }
1123 : :
1124 : 2546 : void VCLXRadioButton::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
1125 : : {
1126 [ + - ]: 2546 : SolarMutexGuard aGuard;
1127 : :
1128 : 2546 : RadioButton* pButton = (RadioButton*)GetWindow();
1129 [ + - ]: 2546 : if ( pButton )
1130 : : {
1131 [ + - ]: 2546 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
1132 [ + + + + ]: 2546 : switch ( nPropType )
1133 : : {
1134 : : case BASEPROPERTY_VISUALEFFECT:
1135 [ + - ]: 48 : ::toolkit::setVisualEffect( Value, pButton );
1136 : 48 : break;
1137 : :
1138 : : case BASEPROPERTY_STATE:
1139 : : {
1140 : 62 : sal_Int16 n = sal_Int16();
1141 [ + - ]: 62 : if ( Value >>= n )
1142 : : {
1143 [ + + ]: 62 : sal_Bool b = n ? sal_True : sal_False;
1144 [ + + ]: 62 : if ( pButton->IsRadioCheckEnabled() )
1145 [ + - ]: 28 : pButton->Check( b );
1146 : : else
1147 [ + - ]: 34 : pButton->SetState( b );
1148 : : }
1149 : : }
1150 : 62 : break;
1151 : : case BASEPROPERTY_AUTOTOGGLE:
1152 : : {
1153 : 38 : sal_Bool b = sal_Bool();
1154 [ + - ]: 38 : if ( Value >>= b )
1155 : 38 : pButton->EnableRadioCheck( b );
1156 : : }
1157 : 38 : break;
1158 : : default:
1159 : : {
1160 [ + - ]: 2546 : VCLXGraphicControl::setProperty( PropertyName, Value );
1161 : : }
1162 : : }
1163 [ + - ]: 2546 : }
1164 : 2546 : }
1165 : :
1166 : 0 : ::com::sun::star::uno::Any VCLXRadioButton::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
1167 : : {
1168 [ # # ]: 0 : SolarMutexGuard aGuard;
1169 : :
1170 : 0 : ::com::sun::star::uno::Any aProp;
1171 : 0 : RadioButton* pButton = (RadioButton*)GetWindow();
1172 [ # # ]: 0 : if ( pButton )
1173 : : {
1174 [ # # ]: 0 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
1175 [ # # # # ]: 0 : switch ( nPropType )
1176 : : {
1177 : : case BASEPROPERTY_VISUALEFFECT:
1178 [ # # ]: 0 : aProp = ::toolkit::getVisualEffect( pButton );
1179 : 0 : break;
1180 : : case BASEPROPERTY_STATE:
1181 [ # # ][ # # ]: 0 : aProp <<= (sal_Int16) ( pButton->IsChecked() ? 1 : 0 );
1182 : 0 : break;
1183 : : case BASEPROPERTY_AUTOTOGGLE:
1184 [ # # ]: 0 : aProp <<= (sal_Bool) pButton->IsRadioCheckEnabled();
1185 : 0 : break;
1186 : : default:
1187 : : {
1188 [ # # ][ # # ]: 0 : aProp <<= VCLXGraphicControl::getProperty( PropertyName );
1189 : : }
1190 : : }
1191 : : }
1192 [ # # ]: 0 : return aProp;
1193 : : }
1194 : :
1195 : 38 : void VCLXRadioButton::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1196 : : {
1197 [ + - ]: 38 : SolarMutexGuard aGuard;
1198 [ + - ][ + - ]: 38 : maItemListeners.addInterface( l );
1199 : 38 : }
1200 : :
1201 : 0 : void VCLXRadioButton::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1202 : : {
1203 [ # # ]: 0 : SolarMutexGuard aGuard;
1204 [ # # ][ # # ]: 0 : maItemListeners.removeInterface( l );
1205 : 0 : }
1206 : :
1207 : 0 : void VCLXRadioButton::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l )throw(::com::sun::star::uno::RuntimeException)
1208 : : {
1209 [ # # ]: 0 : SolarMutexGuard aGuard;
1210 [ # # ][ # # ]: 0 : maActionListeners.addInterface( l );
1211 : 0 : }
1212 : :
1213 : 0 : void VCLXRadioButton::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1214 : : {
1215 [ # # ]: 0 : SolarMutexGuard aGuard;
1216 [ # # ][ # # ]: 0 : maActionListeners.removeInterface( l );
1217 : 0 : }
1218 : :
1219 : 0 : void VCLXRadioButton::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException)
1220 : : {
1221 [ # # ]: 0 : SolarMutexGuard aGuard;
1222 : :
1223 : 0 : Window* pWindow = GetWindow();
1224 [ # # ]: 0 : if ( pWindow )
1225 [ # # ][ # # ]: 0 : pWindow->SetText( rLabel );
[ # # ][ # # ]
1226 : 0 : }
1227 : :
1228 : 38 : void VCLXRadioButton::setActionCommand( const ::rtl::OUString& rCommand ) throw(::com::sun::star::uno::RuntimeException)
1229 : : {
1230 [ + - ]: 38 : SolarMutexGuard aGuard;
1231 [ + - ]: 38 : maActionCommand = rCommand;
1232 : 38 : }
1233 : :
1234 : 0 : void VCLXRadioButton::setState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException)
1235 : : {
1236 [ # # ]: 0 : SolarMutexGuard aGuard;
1237 : :
1238 : 0 : RadioButton* pRadioButton = (RadioButton*)GetWindow();
1239 [ # # ]: 0 : if ( pRadioButton)
1240 : : {
1241 [ # # ]: 0 : pRadioButton->Check( b );
1242 : : // #102717# item listeners are called, but not C++ click listeners in StarOffice code => call click hdl
1243 : : // But this is needed in old code because Accessibility API uses it.
1244 : : // pRadioButton->GetClickHdl().Call( pRadioButton );
1245 : :
1246 : : // #107218# Call same virtual methods and listeners like VCL would do after user interaction
1247 [ # # ]: 0 : SetSynthesizingVCLEvent( sal_True );
1248 [ # # ]: 0 : pRadioButton->Click();
1249 [ # # ]: 0 : SetSynthesizingVCLEvent( sal_False );
1250 [ # # ]: 0 : }
1251 : 0 : }
1252 : :
1253 : 0 : sal_Bool VCLXRadioButton::getState() throw(::com::sun::star::uno::RuntimeException)
1254 : : {
1255 [ # # ]: 0 : SolarMutexGuard aGuard;
1256 : :
1257 : 0 : RadioButton* pRadioButton = (RadioButton*)GetWindow();
1258 [ # # ][ # # ]: 0 : return pRadioButton ? pRadioButton->IsChecked() : sal_False;
1259 : : }
1260 : :
1261 : 8 : ::com::sun::star::awt::Size VCLXRadioButton::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
1262 : : {
1263 [ + - ]: 8 : SolarMutexGuard aGuard;
1264 : :
1265 : 8 : Size aSz;
1266 : 8 : RadioButton* pRadioButton = (RadioButton*) GetWindow();
1267 [ + - ]: 8 : if ( pRadioButton )
1268 [ + - ]: 8 : aSz = pRadioButton->CalcMinimumSize();
1269 [ + - ]: 8 : return AWTSize(aSz);
1270 : : }
1271 : :
1272 : 4 : ::com::sun::star::awt::Size VCLXRadioButton::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
1273 : : {
1274 : 4 : return getMinimumSize();
1275 : : }
1276 : :
1277 : 4 : ::com::sun::star::awt::Size VCLXRadioButton::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
1278 : : {
1279 [ + - ]: 4 : SolarMutexGuard aGuard;
1280 : :
1281 : 4 : Size aSz = VCLSize(rNewSize);
1282 : 4 : RadioButton* pRadioButton = (RadioButton*) GetWindow();
1283 [ + - ]: 4 : if ( pRadioButton )
1284 : : {
1285 [ + - ]: 4 : Size aMinSz = pRadioButton->CalcMinimumSize();
1286 [ + - ][ - + ]: 4 : if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) )
[ - + ]
1287 : 0 : aSz.Height() = aMinSz.Height();
1288 : : else
1289 : 4 : aSz = aMinSz;
1290 : : }
1291 [ + - ]: 4 : return AWTSize(aSz);
1292 : : }
1293 : :
1294 : 574 : void VCLXRadioButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
1295 : : {
1296 [ + - ]: 574 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
1297 : : // since we call listeners below, there is a potential that we will be destroyed
1298 : : // in during the listener call. To prevent the resulting crashs, we keep us
1299 : : // alive as long as we're here
1300 : :
1301 [ - - + ]: 574 : switch ( rVclWindowEvent.GetId() )
1302 : : {
1303 : : case VCLEVENT_BUTTON_CLICK:
1304 [ # # ][ # # ]: 0 : if ( !IsSynthesizingVCLEvent() && maActionListeners.getLength() )
[ # # ][ # # ]
[ # # ]
1305 : : {
1306 [ # # ]: 0 : ::com::sun::star::awt::ActionEvent aEvent;
1307 [ # # ]: 0 : aEvent.Source = (::cppu::OWeakObject*)this;
1308 : 0 : aEvent.ActionCommand = maActionCommand;
1309 [ # # ][ # # ]: 0 : maActionListeners.actionPerformed( aEvent );
1310 : : }
1311 [ # # ]: 0 : ImplClickedOrToggled( sal_False );
1312 : 0 : break;
1313 : :
1314 : : case VCLEVENT_RADIOBUTTON_TOGGLE:
1315 [ # # ]: 0 : ImplClickedOrToggled( sal_True );
1316 : 0 : break;
1317 : :
1318 : : default:
1319 [ + - ]: 574 : VCLXGraphicControl::ProcessWindowEvent( rVclWindowEvent );
1320 : 574 : break;
1321 : 574 : }
1322 : 574 : }
1323 : :
1324 : 0 : void VCLXRadioButton::ImplClickedOrToggled( sal_Bool bToggled )
1325 : : {
1326 : : // In the formulars, RadioChecked is not enabled, call itemStateChanged only for click
1327 : : // In the dialog editor, RadioChecked is enabled, call itemStateChanged only for bToggled
1328 : 0 : RadioButton* pRadioButton = (RadioButton*)GetWindow();
1329 [ # # ][ # # ]: 0 : if ( pRadioButton && ( pRadioButton->IsRadioCheckEnabled() == bToggled ) && ( bToggled || pRadioButton->IsStateChanged() ) && maItemListeners.getLength() )
[ # # ][ # # ]
[ # # ][ # # ]
1330 : : {
1331 [ # # ]: 0 : ::com::sun::star::awt::ItemEvent aEvent;
1332 [ # # ]: 0 : aEvent.Source = (::cppu::OWeakObject*)this;
1333 : 0 : aEvent.Highlighted = sal_False;
1334 : 0 : aEvent.Selected = pRadioButton->IsChecked();
1335 [ # # ][ # # ]: 0 : maItemListeners.itemStateChanged( aEvent );
1336 : : }
1337 : 0 : }
1338 : :
1339 : : // ----------------------------------------------------
1340 : : // class VCLXSpinField
1341 : : // ----------------------------------------------------
1342 : 0 : void VCLXSpinField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
1343 : : {
1344 : : PushPropertyIds( rIds,
1345 : : BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
1346 : 0 : 0 );
1347 : 0 : VCLXEdit::ImplGetPropertyIds( rIds );
1348 : 0 : }
1349 : :
1350 [ + - ][ + - ]: 303 : VCLXSpinField::VCLXSpinField() : maSpinListeners( *this )
1351 : : {
1352 : 303 : }
1353 : :
1354 : : // ::com::sun::star::uno::XInterface
1355 : 30191 : ::com::sun::star::uno::Any VCLXSpinField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
1356 : : {
1357 : : ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
1358 [ + - ]: 30191 : (static_cast< ::com::sun::star::awt::XSpinField* >(this)) );
1359 [ + + ][ + - ]: 30191 : return (aRet.hasValue() ? aRet : VCLXEdit::queryInterface( rType ));
1360 : : }
1361 : :
1362 : : // ::com::sun::star::lang::XTypeProvider
1363 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_START( VCLXSpinField )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
1364 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinField>* ) NULL ),
1365 : : VCLXEdit::getTypes()
1366 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_END
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1367 : :
1368 : 22 : void VCLXSpinField::addSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1369 : : {
1370 [ + - ]: 22 : SolarMutexGuard aGuard;
1371 [ + - ][ + - ]: 22 : maSpinListeners.addInterface( l );
1372 : 22 : }
1373 : :
1374 : 22 : void VCLXSpinField::removeSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1375 : : {
1376 [ + - ]: 22 : SolarMutexGuard aGuard;
1377 [ + - ][ + - ]: 22 : maSpinListeners.removeInterface( l );
1378 : 22 : }
1379 : :
1380 : 44 : void VCLXSpinField::up() throw(::com::sun::star::uno::RuntimeException)
1381 : : {
1382 [ + - ]: 44 : SolarMutexGuard aGuard;
1383 : :
1384 : 44 : SpinField* pSpinField = (SpinField*) GetWindow();
1385 [ + - ]: 44 : if ( pSpinField )
1386 [ + - ][ + - ]: 44 : pSpinField->Up();
1387 : 44 : }
1388 : :
1389 : 22 : void VCLXSpinField::down() throw(::com::sun::star::uno::RuntimeException)
1390 : : {
1391 [ + - ]: 22 : SolarMutexGuard aGuard;
1392 : :
1393 : 22 : SpinField* pSpinField = (SpinField*) GetWindow();
1394 [ + - ]: 22 : if ( pSpinField )
1395 [ + - ][ + - ]: 22 : pSpinField->Down();
1396 : 22 : }
1397 : :
1398 : 22 : void VCLXSpinField::first() throw(::com::sun::star::uno::RuntimeException)
1399 : : {
1400 [ + - ]: 22 : SolarMutexGuard aGuard;
1401 : :
1402 : 22 : SpinField* pSpinField = (SpinField*) GetWindow();
1403 [ + - ]: 22 : if ( pSpinField )
1404 [ + - ][ + - ]: 22 : pSpinField->First();
1405 : 22 : }
1406 : :
1407 : 22 : void VCLXSpinField::last() throw(::com::sun::star::uno::RuntimeException)
1408 : : {
1409 [ + - ]: 22 : SolarMutexGuard aGuard;
1410 : :
1411 : 22 : SpinField* pSpinField = (SpinField*) GetWindow();
1412 [ + - ]: 22 : if ( pSpinField )
1413 [ + - ][ + - ]: 22 : pSpinField->Last();
1414 : 22 : }
1415 : :
1416 : 240 : void VCLXSpinField::enableRepeat( sal_Bool bRepeat ) throw(::com::sun::star::uno::RuntimeException)
1417 : : {
1418 [ + - ]: 240 : SolarMutexGuard aGuard;
1419 : :
1420 : 240 : Window* pWindow = GetWindow();
1421 [ + - ]: 240 : if ( pWindow )
1422 : : {
1423 [ + - ]: 240 : WinBits nStyle = pWindow->GetStyle();
1424 [ + + ]: 240 : if ( bRepeat )
1425 : 22 : nStyle |= WB_REPEAT;
1426 : : else
1427 : 218 : nStyle &= ~WB_REPEAT;
1428 [ + - ]: 240 : pWindow->SetStyle( nStyle );
1429 [ + - ]: 240 : }
1430 : 240 : }
1431 : :
1432 : 5067 : void VCLXSpinField::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
1433 : : {
1434 [ + + ]: 5067 : switch ( rVclWindowEvent.GetId() )
1435 : : {
1436 : : case VCLEVENT_SPINFIELD_UP:
1437 : : case VCLEVENT_SPINFIELD_DOWN:
1438 : : case VCLEVENT_SPINFIELD_FIRST:
1439 : : case VCLEVENT_SPINFIELD_LAST:
1440 : : {
1441 [ + - ]: 110 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
1442 : : // since we call listeners below, there is a potential that we will be destroyed
1443 : : // in during the listener call. To prevent the resulting crashs, we keep us
1444 : : // alive as long as we're here
1445 : :
1446 [ + - ][ + + ]: 110 : if ( maSpinListeners.getLength() )
1447 : : {
1448 [ + - ]: 88 : ::com::sun::star::awt::SpinEvent aEvent;
1449 [ + - ]: 88 : aEvent.Source = (::cppu::OWeakObject*)this;
1450 [ + + + + : 88 : switch ( rVclWindowEvent.GetId() )
- ]
1451 : : {
1452 [ + - ]: 22 : case VCLEVENT_SPINFIELD_UP: maSpinListeners.up( aEvent );
1453 : 22 : break;
1454 [ + - ]: 22 : case VCLEVENT_SPINFIELD_DOWN: maSpinListeners.down( aEvent );
1455 : 22 : break;
1456 [ + - ]: 22 : case VCLEVENT_SPINFIELD_FIRST: maSpinListeners.first( aEvent );
1457 : 22 : break;
1458 [ + - ]: 22 : case VCLEVENT_SPINFIELD_LAST: maSpinListeners.last( aEvent );
1459 : 22 : break;
1460 [ + - ]: 88 : }
1461 : :
1462 : 110 : }
1463 : : }
1464 : 110 : break;
1465 : :
1466 : : default:
1467 : 4957 : VCLXEdit::ProcessWindowEvent( rVclWindowEvent );
1468 : 4957 : break;
1469 : : }
1470 : 5067 : }
1471 : :
1472 : :
1473 : : // ----------------------------------------------------
1474 : : // class VCLXListBox
1475 : : // ----------------------------------------------------
1476 : 23 : void VCLXListBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
1477 : : {
1478 : : PushPropertyIds( rIds,
1479 : : BASEPROPERTY_BACKGROUNDCOLOR,
1480 : : BASEPROPERTY_BORDER,
1481 : : BASEPROPERTY_BORDERCOLOR,
1482 : : BASEPROPERTY_DEFAULTCONTROL,
1483 : : BASEPROPERTY_DROPDOWN,
1484 : : BASEPROPERTY_ENABLED,
1485 : : BASEPROPERTY_ENABLEVISIBLE,
1486 : : BASEPROPERTY_FONTDESCRIPTOR,
1487 : : BASEPROPERTY_HELPTEXT,
1488 : : BASEPROPERTY_HELPURL,
1489 : : BASEPROPERTY_LINECOUNT,
1490 : : BASEPROPERTY_MULTISELECTION,
1491 : : BASEPROPERTY_MULTISELECTION_SIMPLEMODE,
1492 : : BASEPROPERTY_ITEM_SEPARATOR_POS,
1493 : : BASEPROPERTY_PRINTABLE,
1494 : : BASEPROPERTY_SELECTEDITEMS,
1495 : : BASEPROPERTY_STRINGITEMLIST,
1496 : : BASEPROPERTY_TABSTOP,
1497 : : BASEPROPERTY_READONLY,
1498 : : BASEPROPERTY_ALIGN,
1499 : : BASEPROPERTY_WRITING_MODE,
1500 : : BASEPROPERTY_CONTEXT_WRITING_MODE,
1501 : : BASEPROPERTY_REFERENCE_DEVICE,
1502 : : BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
1503 : 23 : 0);
1504 : 23 : VCLXWindow::ImplGetPropertyIds( rIds );
1505 : 23 : }
1506 : :
1507 : :
1508 : 336 : VCLXListBox::VCLXListBox()
1509 : : : maActionListeners( *this ),
1510 [ + - ][ + - ]: 336 : maItemListeners( *this )
1511 : : {
1512 : 336 : }
1513 : :
1514 : 380 : void VCLXListBox::dispose() throw(::com::sun::star::uno::RuntimeException)
1515 : : {
1516 [ + - ]: 380 : SolarMutexGuard aGuard;
1517 : :
1518 [ + - ]: 380 : ::com::sun::star::lang::EventObject aObj;
1519 [ + - ]: 380 : aObj.Source = (::cppu::OWeakObject*)this;
1520 [ + - ]: 380 : maItemListeners.disposeAndClear( aObj );
1521 [ + - ]: 380 : maActionListeners.disposeAndClear( aObj );
1522 [ + - ][ + - ]: 380 : VCLXWindow::dispose();
[ + - ]
1523 : 380 : }
1524 : :
1525 : 40 : void VCLXListBox::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1526 : : {
1527 [ + - ]: 40 : SolarMutexGuard aGuard;
1528 [ + - ][ + - ]: 40 : maItemListeners.addInterface( l );
1529 : 40 : }
1530 : :
1531 : 0 : void VCLXListBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1532 : : {
1533 [ # # ]: 0 : SolarMutexGuard aGuard;
1534 [ # # ][ # # ]: 0 : maItemListeners.removeInterface( l );
1535 : 0 : }
1536 : :
1537 : 2 : void VCLXListBox::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1538 : : {
1539 [ + - ]: 2 : SolarMutexGuard aGuard;
1540 [ + - ][ + - ]: 2 : maActionListeners.addInterface( l );
1541 : 2 : }
1542 : :
1543 : 0 : void VCLXListBox::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1544 : : {
1545 [ # # ]: 0 : SolarMutexGuard aGuard;
1546 [ # # ][ # # ]: 0 : maActionListeners.removeInterface( l );
1547 : 0 : }
1548 : :
1549 : 0 : void VCLXListBox::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
1550 : : {
1551 [ # # ]: 0 : SolarMutexGuard aGuard;
1552 : :
1553 : 0 : ListBox* pBox = (ListBox*) GetWindow();
1554 [ # # ]: 0 : if ( pBox )
1555 [ # # ][ # # ]: 0 : pBox->InsertEntry( aItem, nPos );
[ # # ][ # # ]
1556 : 0 : }
1557 : :
1558 : 0 : void VCLXListBox::addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
1559 : : {
1560 [ # # ]: 0 : SolarMutexGuard aGuard;
1561 : :
1562 : 0 : ListBox* pBox = (ListBox*) GetWindow();
1563 [ # # ]: 0 : if ( pBox )
1564 : : {
1565 : 0 : sal_uInt16 nP = nPos;
1566 : 0 : const ::rtl::OUString* pItems = aItems.getConstArray();
1567 : 0 : const ::rtl::OUString* pItemsEnd = aItems.getConstArray() + aItems.getLength();
1568 [ # # ]: 0 : while ( pItems != pItemsEnd )
1569 : : {
1570 [ # # ]: 0 : if ( (sal_uInt16)nP == 0xFFFF )
1571 : : {
1572 : : OSL_FAIL( "VCLXListBox::addItems: too many entries!" );
1573 : : // skip remaining entries, list cannot hold them, anyway
1574 : 0 : break;
1575 : : }
1576 : :
1577 [ # # ][ # # ]: 0 : pBox->InsertEntry( *pItems++, nP++ );
[ # # ]
1578 : : }
1579 [ # # ]: 0 : }
1580 : 0 : }
1581 : :
1582 : 0 : void VCLXListBox::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException)
1583 : : {
1584 [ # # ]: 0 : SolarMutexGuard aGuard;
1585 : :
1586 : 0 : ListBox* pBox = (ListBox*) GetWindow();
1587 [ # # ]: 0 : if ( pBox )
1588 : : {
1589 [ # # ]: 0 : for ( sal_uInt16 n = nCount; n; )
1590 [ # # ]: 0 : pBox->RemoveEntry( nPos + (--n) );
1591 [ # # ]: 0 : }
1592 : 0 : }
1593 : :
1594 : 0 : sal_Int16 VCLXListBox::getItemCount() throw(::com::sun::star::uno::RuntimeException)
1595 : : {
1596 [ # # ]: 0 : SolarMutexGuard aGuard;
1597 : :
1598 : 0 : ListBox* pBox = (ListBox*) GetWindow();
1599 [ # # ][ # # ]: 0 : return pBox ? pBox->GetEntryCount() : 0;
[ # # ]
1600 : : }
1601 : :
1602 : 0 : ::rtl::OUString VCLXListBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
1603 : : {
1604 [ # # ]: 0 : SolarMutexGuard aGuard;
1605 : :
1606 [ # # ]: 0 : String aItem;
1607 : 0 : ListBox* pBox = (ListBox*) GetWindow();
1608 [ # # ]: 0 : if ( pBox )
1609 [ # # ][ # # ]: 0 : aItem = pBox->GetEntry( nPos );
[ # # ]
1610 [ # # ][ # # ]: 0 : return aItem;
[ # # ]
1611 : : }
1612 : :
1613 : 0 : ::com::sun::star::uno::Sequence< ::rtl::OUString> VCLXListBox::getItems() throw(::com::sun::star::uno::RuntimeException)
1614 : : {
1615 [ # # ]: 0 : SolarMutexGuard aGuard;
1616 : :
1617 [ # # ]: 0 : ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
1618 : 0 : ListBox* pBox = (ListBox*) GetWindow();
1619 [ # # ]: 0 : if ( pBox )
1620 : : {
1621 [ # # ]: 0 : sal_uInt16 nEntries = pBox->GetEntryCount();
1622 [ # # ][ # # ]: 0 : aSeq = ::com::sun::star::uno::Sequence< ::rtl::OUString>( nEntries );
[ # # ]
1623 [ # # ]: 0 : for ( sal_uInt16 n = nEntries; n; )
1624 : : {
1625 : 0 : --n;
1626 [ # # ][ # # ]: 0 : aSeq.getArray()[n] = ::rtl::OUString( pBox->GetEntry( n ) );
[ # # ][ # # ]
1627 : : }
1628 : : }
1629 [ # # ]: 0 : return aSeq;
1630 : : }
1631 : :
1632 : 2 : sal_Int16 VCLXListBox::getSelectedItemPos() throw(::com::sun::star::uno::RuntimeException)
1633 : : {
1634 [ + - ]: 2 : SolarMutexGuard aGuard;
1635 : :
1636 : 2 : ListBox* pBox = (ListBox*) GetWindow();
1637 [ + - ][ + - ]: 2 : return pBox ? pBox->GetSelectEntryPos() : 0;
[ + - ]
1638 : : }
1639 : :
1640 : 98 : ::com::sun::star::uno::Sequence<sal_Int16> VCLXListBox::getSelectedItemsPos() throw(::com::sun::star::uno::RuntimeException)
1641 : : {
1642 [ + - ]: 98 : SolarMutexGuard aGuard;
1643 : :
1644 [ + - ]: 98 : ::com::sun::star::uno::Sequence<sal_Int16> aSeq;
1645 : 98 : ListBox* pBox = (ListBox*) GetWindow();
1646 [ + - ]: 98 : if ( pBox )
1647 : : {
1648 [ + - ]: 98 : sal_uInt16 nSelEntries = pBox->GetSelectEntryCount();
1649 [ + - ][ + - ]: 98 : aSeq = ::com::sun::star::uno::Sequence<sal_Int16>( nSelEntries );
[ + - ]
1650 [ + + ]: 190 : for ( sal_uInt16 n = 0; n < nSelEntries; n++ )
1651 [ + - ][ + - ]: 92 : aSeq.getArray()[n] = pBox->GetSelectEntryPos( n );
1652 : : }
1653 [ + - ]: 98 : return aSeq;
1654 : : }
1655 : :
1656 : 2 : ::rtl::OUString VCLXListBox::getSelectedItem() throw(::com::sun::star::uno::RuntimeException)
1657 : : {
1658 [ + - ]: 2 : SolarMutexGuard aGuard;
1659 : :
1660 [ + - ]: 2 : String aItem;
1661 : 2 : ListBox* pBox = (ListBox*) GetWindow();
1662 [ + - ]: 2 : if ( pBox )
1663 [ + - ][ + - ]: 2 : aItem = pBox->GetSelectEntry();
[ + - ]
1664 [ + - ][ + - ]: 2 : return aItem;
[ + - ]
1665 : : }
1666 : :
1667 : 2 : ::com::sun::star::uno::Sequence< ::rtl::OUString> VCLXListBox::getSelectedItems() throw(::com::sun::star::uno::RuntimeException)
1668 : : {
1669 [ + - ]: 2 : SolarMutexGuard aGuard;
1670 : :
1671 [ + - ]: 2 : ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
1672 : 2 : ListBox* pBox = (ListBox*) GetWindow();
1673 [ + - ]: 2 : if ( pBox )
1674 : : {
1675 [ + - ]: 2 : sal_uInt16 nSelEntries = pBox->GetSelectEntryCount();
1676 [ + - ][ + - ]: 2 : aSeq = ::com::sun::star::uno::Sequence< ::rtl::OUString>( nSelEntries );
[ + - ]
1677 [ + + ]: 6 : for ( sal_uInt16 n = 0; n < nSelEntries; n++ )
1678 [ + - ][ + - ]: 4 : aSeq.getArray()[n] = ::rtl::OUString( pBox->GetSelectEntry( n ) );
[ + - ][ + - ]
1679 : : }
1680 [ + - ]: 2 : return aSeq;
1681 : : }
1682 : :
1683 : 38 : void VCLXListBox::selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException)
1684 : : {
1685 [ + - ]: 38 : SolarMutexGuard aGuard;
1686 : :
1687 : 38 : ListBox* pBox = (ListBox*) GetWindow();
1688 [ + - ][ + + ]: 38 : if ( pBox && ( pBox->IsEntryPosSelected( nPos ) != bSelect ) )
[ + + ][ + - ]
1689 : : {
1690 [ + - ]: 20 : pBox->SelectEntryPos( nPos, bSelect );
1691 : :
1692 : : // VCL doesn't call select handler after API call.
1693 : : // ImplCallItemListeners();
1694 : :
1695 : : // #107218# Call same listeners like VCL would do after user interaction
1696 [ + - ]: 20 : SetSynthesizingVCLEvent( sal_True );
1697 [ + - ]: 20 : pBox->Select();
1698 [ + - ]: 20 : SetSynthesizingVCLEvent( sal_False );
1699 [ + - ]: 38 : }
1700 : 38 : }
1701 : :
1702 : 100 : void VCLXListBox::selectItemsPos( const ::com::sun::star::uno::Sequence<sal_Int16>& aPositions, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException)
1703 : : {
1704 [ + - ]: 100 : SolarMutexGuard aGuard;
1705 : :
1706 : 100 : ListBox* pBox = (ListBox*) GetWindow();
1707 [ + - ]: 100 : if ( pBox )
1708 : : {
1709 : 100 : sal_Bool bChanged = sal_False;
1710 [ + + ]: 358 : for ( sal_uInt16 n = (sal_uInt16)aPositions.getLength(); n; )
1711 : : {
1712 : 258 : sal_uInt16 nPos = (sal_uInt16) aPositions.getConstArray()[--n];
1713 [ + - ][ + - ]: 258 : if ( pBox->IsEntryPosSelected( nPos ) != bSelect )
1714 : : {
1715 [ + - ]: 258 : pBox->SelectEntryPos( nPos, bSelect );
1716 : 258 : bChanged = sal_True;
1717 : : }
1718 : : }
1719 : :
1720 [ + - ]: 100 : if ( bChanged )
1721 : : {
1722 : : // VCL doesn't call select handler after API call.
1723 : : // ImplCallItemListeners();
1724 : :
1725 : : // #107218# Call same listeners like VCL would do after user interaction
1726 [ + - ]: 100 : SetSynthesizingVCLEvent( sal_True );
1727 [ + - ]: 100 : pBox->Select();
1728 [ + - ]: 100 : SetSynthesizingVCLEvent( sal_False );
1729 : : }
1730 [ + - ]: 100 : }
1731 : 100 : }
1732 : :
1733 : 4 : void VCLXListBox::selectItem( const ::rtl::OUString& rItemText, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException)
1734 : : {
1735 [ + - ]: 4 : SolarMutexGuard aGuard;
1736 : :
1737 : 4 : ListBox* pBox = (ListBox*) GetWindow();
1738 [ + - ]: 4 : if ( pBox )
1739 : : {
1740 [ + - ]: 4 : String aItemText( rItemText );
1741 [ + - ][ + - ]: 4 : selectItemPos( pBox->GetEntryPos( aItemText ), bSelect );
[ + - ]
1742 [ + - ]: 4 : }
1743 : 4 : }
1744 : :
1745 : :
1746 : 0 : void VCLXListBox::setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
1747 : : {
1748 [ # # ]: 0 : SolarMutexGuard aGuard;
1749 : :
1750 : 0 : ListBox* pBox = (ListBox*) GetWindow();
1751 [ # # ]: 0 : if ( pBox )
1752 [ # # ][ # # ]: 0 : pBox->SetDropDownLineCount( nLines );
1753 : 0 : }
1754 : :
1755 : 0 : sal_Int16 VCLXListBox::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException)
1756 : : {
1757 [ # # ]: 0 : SolarMutexGuard aGuard;
1758 : :
1759 : 0 : sal_Int16 nLines = 0;
1760 : 0 : ListBox* pBox = (ListBox*) GetWindow();
1761 [ # # ]: 0 : if ( pBox )
1762 [ # # ]: 0 : nLines = pBox->GetDropDownLineCount();
1763 [ # # ]: 0 : return nLines;
1764 : : }
1765 : :
1766 : 0 : sal_Bool VCLXListBox::isMutipleMode() throw(::com::sun::star::uno::RuntimeException)
1767 : : {
1768 [ # # ]: 0 : SolarMutexGuard aGuard;
1769 : :
1770 : 0 : sal_Bool bMulti = sal_False;
1771 : 0 : ListBox* pBox = (ListBox*) GetWindow();
1772 [ # # ]: 0 : if ( pBox )
1773 [ # # ]: 0 : bMulti = pBox->IsMultiSelectionEnabled();
1774 [ # # ]: 0 : return bMulti;
1775 : : }
1776 : :
1777 : 0 : void VCLXListBox::setMultipleMode( sal_Bool bMulti ) throw(::com::sun::star::uno::RuntimeException)
1778 : : {
1779 [ # # ]: 0 : SolarMutexGuard aGuard;
1780 : :
1781 : 0 : ListBox* pBox = (ListBox*) GetWindow();
1782 [ # # ]: 0 : if ( pBox )
1783 [ # # ][ # # ]: 0 : pBox->EnableMultiSelection( bMulti );
1784 : 0 : }
1785 : :
1786 : 2 : void VCLXListBox::makeVisible( sal_Int16 nEntry ) throw(::com::sun::star::uno::RuntimeException)
1787 : : {
1788 [ + - ]: 2 : SolarMutexGuard aGuard;
1789 : :
1790 : 2 : ListBox* pBox = (ListBox*) GetWindow();
1791 [ + - ]: 2 : if ( pBox )
1792 [ + - ][ + - ]: 2 : pBox->SetTopEntry( nEntry );
1793 : 2 : }
1794 : :
1795 : 29470 : void VCLXListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
1796 : : {
1797 [ + - ]: 29470 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
1798 : : // since we call listeners below, there is a potential that we will be destroyed
1799 : : // in during the listener call. To prevent the resulting crashs, we keep us
1800 : : // alive as long as we're here
1801 : :
1802 [ + - + ]: 29470 : switch ( rVclWindowEvent.GetId() )
1803 : : {
1804 : : case VCLEVENT_LISTBOX_SELECT:
1805 : : {
1806 : 46 : ListBox* pListBox = (ListBox*)GetWindow();
1807 : :
1808 [ + - ]: 46 : if( pListBox )
1809 : : {
1810 [ + - ][ + + ]: 46 : sal_Bool bDropDown = ( pListBox->GetStyle() & WB_DROPDOWN ) ? sal_True : sal_False;
1811 [ + + ][ + - ]: 46 : if ( bDropDown && !IsSynthesizingVCLEvent() && maActionListeners.getLength() )
[ - + ][ # # ]
[ # # ][ - + ]
1812 : : {
1813 : : // Call ActionListener on DropDown event
1814 [ # # ]: 0 : ::com::sun::star::awt::ActionEvent aEvent;
1815 [ # # ]: 0 : aEvent.Source = (::cppu::OWeakObject*)this;
1816 [ # # ][ # # ]: 0 : aEvent.ActionCommand = pListBox->GetSelectEntry();
[ # # ]
1817 [ # # ][ # # ]: 0 : maActionListeners.actionPerformed( aEvent );
1818 : : }
1819 : :
1820 [ + - ][ + + ]: 46 : if ( maItemListeners.getLength() )
1821 : : {
1822 [ + - ]: 26 : ImplCallItemListeners();
1823 : : }
1824 : : }
1825 : : }
1826 : 46 : break;
1827 : :
1828 : : case VCLEVENT_LISTBOX_DOUBLECLICK:
1829 [ # # ][ # # ]: 0 : if ( GetWindow() && maActionListeners.getLength() )
[ # # ][ # # ]
1830 : : {
1831 [ # # ]: 0 : ::com::sun::star::awt::ActionEvent aEvent;
1832 [ # # ]: 0 : aEvent.Source = (::cppu::OWeakObject*)this;
1833 [ # # ][ # # ]: 0 : aEvent.ActionCommand = ((ListBox*)GetWindow())->GetSelectEntry();
[ # # ]
1834 [ # # ][ # # ]: 0 : maActionListeners.actionPerformed( aEvent );
1835 : : }
1836 : 0 : break;
1837 : :
1838 : : default:
1839 [ + - ]: 29424 : VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
1840 : 29424 : break;
1841 : 29470 : }
1842 : 29470 : }
1843 : :
1844 : 6 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXListBox::CreateAccessibleContext()
1845 : : {
1846 [ + - ]: 6 : SolarMutexGuard aGuard;
1847 : :
1848 [ + - ][ + - ]: 6 : return getAccessibleFactory().createAccessibleContext( this );
[ + - ]
1849 : : }
1850 : :
1851 : 3105 : void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
1852 : : {
1853 [ + - ]: 3105 : SolarMutexGuard aGuard;
1854 : :
1855 : 3105 : ListBox* pListBox = (ListBox*)GetWindow();
1856 [ + - ]: 3105 : if ( pListBox )
1857 : : {
1858 [ + - ]: 3105 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
1859 [ + + + + : 3105 : switch ( nPropType )
+ - + + ]
1860 : : {
1861 : : case BASEPROPERTY_ITEM_SEPARATOR_POS:
1862 : : {
1863 : 38 : sal_Int16 nSeparatorPos(0);
1864 [ - + ]: 38 : if ( Value >>= nSeparatorPos )
1865 [ # # ]: 0 : pListBox->SetSeparatorPos( nSeparatorPos );
1866 : : }
1867 : 38 : break;
1868 : : case BASEPROPERTY_READONLY:
1869 : : {
1870 : 54 : sal_Bool b = sal_Bool();
1871 [ + - ]: 54 : if ( Value >>= b )
1872 [ + - ]: 54 : pListBox->SetReadOnly( b);
1873 : : }
1874 : 54 : break;
1875 : : case BASEPROPERTY_MULTISELECTION:
1876 : : {
1877 : 56 : sal_Bool b = sal_Bool();
1878 [ + - ]: 56 : if ( Value >>= b )
1879 [ + - ]: 56 : pListBox->EnableMultiSelection( b );
1880 : : }
1881 : 56 : break;
1882 : : case BASEPROPERTY_MULTISELECTION_SIMPLEMODE:
1883 [ + - ]: 52 : ::toolkit::adjustBooleanWindowStyle( Value, pListBox, WB_SIMPLEMODE, sal_False );
1884 : 52 : break;
1885 : : case BASEPROPERTY_LINECOUNT:
1886 : : {
1887 : 48 : sal_Int16 n = sal_Int16();
1888 [ + - ]: 48 : if ( Value >>= n )
1889 [ + - ]: 48 : pListBox->SetDropDownLineCount( n );
1890 : : }
1891 : 48 : break;
1892 : : case BASEPROPERTY_STRINGITEMLIST:
1893 : : {
1894 [ # # ]: 0 : ::com::sun::star::uno::Sequence< ::rtl::OUString> aItems;
1895 [ # # ][ # # ]: 0 : if ( Value >>= aItems )
1896 : : {
1897 [ # # ]: 0 : pListBox->Clear();
1898 [ # # ]: 0 : addItems( aItems, 0 );
1899 [ # # ]: 0 : }
1900 : : }
1901 : 0 : break;
1902 : : case BASEPROPERTY_SELECTEDITEMS:
1903 : : {
1904 [ + - ]: 154 : ::com::sun::star::uno::Sequence<sal_Int16> aItems;
1905 [ + - ][ + - ]: 154 : if ( Value >>= aItems )
1906 : : {
1907 [ + - ][ + + ]: 344 : for ( sal_uInt16 n = pListBox->GetEntryCount(); n; )
1908 [ + - ]: 190 : pListBox->SelectEntryPos( --n, sal_False );
1909 : :
1910 [ + + ]: 154 : if ( aItems.getLength() )
1911 [ + - ]: 94 : selectItemsPos( aItems, sal_True );
1912 : : else
1913 [ + - ]: 60 : pListBox->SetNoSelection();
1914 : :
1915 [ + - ][ + - ]: 154 : if ( !pListBox->GetSelectEntryCount() )
1916 [ + - ]: 154 : pListBox->SetTopEntry( 0 );
1917 [ + - ]: 154 : }
1918 : : }
1919 : 154 : break;
1920 : : default:
1921 : : {
1922 [ + - ]: 3105 : VCLXWindow::setProperty( PropertyName, Value );
1923 : : }
1924 : : }
1925 [ + - ]: 3105 : }
1926 : 3105 : }
1927 : :
1928 : 0 : ::com::sun::star::uno::Any VCLXListBox::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
1929 : : {
1930 [ # # ]: 0 : SolarMutexGuard aGuard;
1931 : :
1932 : 0 : ::com::sun::star::uno::Any aProp;
1933 : 0 : ListBox* pListBox = (ListBox*)GetWindow();
1934 [ # # ]: 0 : if ( pListBox )
1935 : : {
1936 [ # # ]: 0 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
1937 [ # # # # : 0 : switch ( nPropType )
# # # ]
1938 : : {
1939 : : case BASEPROPERTY_ITEM_SEPARATOR_POS:
1940 [ # # ][ # # ]: 0 : aProp <<= sal_Int16( pListBox->GetSeparatorPos() );
1941 : 0 : break;
1942 : : case BASEPROPERTY_READONLY:
1943 : : {
1944 [ # # ][ # # ]: 0 : aProp <<= (sal_Bool) pListBox->IsReadOnly();
1945 : : }
1946 : 0 : break;
1947 : : case BASEPROPERTY_MULTISELECTION:
1948 : : {
1949 [ # # ][ # # ]: 0 : aProp <<= (sal_Bool) pListBox->IsMultiSelectionEnabled();
1950 : : }
1951 : 0 : break;
1952 : : case BASEPROPERTY_MULTISELECTION_SIMPLEMODE:
1953 : : {
1954 [ # # ][ # # ]: 0 : aProp <<= (sal_Bool)( ( pListBox->GetStyle() & WB_SIMPLEMODE ) == 0 );
1955 : : }
1956 : 0 : break;
1957 : : case BASEPROPERTY_LINECOUNT:
1958 : : {
1959 [ # # ][ # # ]: 0 : aProp <<= (sal_Int16) pListBox->GetDropDownLineCount();
1960 : : }
1961 : 0 : break;
1962 : : case BASEPROPERTY_STRINGITEMLIST:
1963 : : {
1964 [ # # ]: 0 : sal_uInt16 nItems = pListBox->GetEntryCount();
1965 [ # # ]: 0 : ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( nItems );
1966 [ # # ]: 0 : ::rtl::OUString* pStrings = aSeq.getArray();
1967 [ # # ]: 0 : for ( sal_uInt16 n = 0; n < nItems; n++ )
1968 [ # # ][ # # ]: 0 : pStrings[n] = pListBox->GetEntry( n );
[ # # ]
1969 [ # # ][ # # ]: 0 : aProp <<= aSeq;
1970 : :
1971 : : }
1972 : 0 : break;
1973 : : default:
1974 : : {
1975 [ # # ][ # # ]: 0 : aProp <<= VCLXWindow::getProperty( PropertyName );
1976 : : }
1977 : : }
1978 : : }
1979 [ # # ]: 0 : return aProp;
1980 : : }
1981 : :
1982 : 2 : ::com::sun::star::awt::Size VCLXListBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
1983 : : {
1984 [ + - ]: 2 : SolarMutexGuard aGuard;
1985 : :
1986 : 2 : Size aSz;
1987 : 2 : ListBox* pListBox = (ListBox*) GetWindow();
1988 [ + - ]: 2 : if ( pListBox )
1989 [ + - ]: 2 : aSz = pListBox->CalcMinimumSize();
1990 [ + - ]: 2 : return AWTSize(aSz);
1991 : : }
1992 : :
1993 : 2 : ::com::sun::star::awt::Size VCLXListBox::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
1994 : : {
1995 [ + - ]: 2 : SolarMutexGuard aGuard;
1996 : :
1997 : 2 : Size aSz;
1998 : 2 : ListBox* pListBox = (ListBox*) GetWindow();
1999 [ + - ]: 2 : if ( pListBox )
2000 : : {
2001 [ + - ]: 2 : aSz = pListBox->CalcMinimumSize();
2002 [ + - ][ - + ]: 2 : if ( pListBox->GetStyle() & WB_DROPDOWN )
2003 : 0 : aSz.Height() += 4;
2004 : : }
2005 [ + - ]: 2 : return AWTSize(aSz);
2006 : : }
2007 : :
2008 : 2 : ::com::sun::star::awt::Size VCLXListBox::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
2009 : : {
2010 [ + - ]: 2 : SolarMutexGuard aGuard;
2011 : :
2012 : 2 : Size aSz = VCLSize(rNewSize);
2013 : 2 : ListBox* pListBox = (ListBox*) GetWindow();
2014 [ + - ]: 2 : if ( pListBox )
2015 [ + - ]: 2 : aSz = pListBox->CalcAdjustedSize( aSz );
2016 [ + - ]: 2 : return AWTSize(aSz);
2017 : : }
2018 : :
2019 : 2 : ::com::sun::star::awt::Size VCLXListBox::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
2020 : : {
2021 [ + - ]: 2 : SolarMutexGuard aGuard;
2022 : :
2023 : 2 : Size aSz;
2024 : 2 : ListBox* pListBox = (ListBox*) GetWindow();
2025 [ + - ]: 2 : if ( pListBox )
2026 [ + - ]: 2 : aSz = pListBox->CalcSize( nCols, nLines );
2027 [ + - ]: 2 : return AWTSize(aSz);
2028 : : }
2029 : :
2030 : 2 : void VCLXListBox::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
2031 : : {
2032 [ + - ]: 2 : SolarMutexGuard aGuard;
2033 : :
2034 : 2 : nCols = nLines = 0;
2035 : 2 : ListBox* pListBox = (ListBox*) GetWindow();
2036 [ + - ]: 2 : if ( pListBox )
2037 : : {
2038 : : sal_uInt16 nC, nL;
2039 [ + - ]: 2 : pListBox->GetMaxVisColumnsAndLines( nC, nL );
2040 : 2 : nCols = nC;
2041 : 2 : nLines = nL;
2042 [ + - ]: 2 : }
2043 : 2 : }
2044 : :
2045 : 26 : void VCLXListBox::ImplCallItemListeners()
2046 : : {
2047 : 26 : ListBox* pListBox = (ListBox*) GetWindow();
2048 [ + - ][ + - ]: 26 : if ( pListBox && maItemListeners.getLength() )
[ + - ]
2049 : : {
2050 [ + - ]: 26 : ::com::sun::star::awt::ItemEvent aEvent;
2051 [ + - ]: 26 : aEvent.Source = (::cppu::OWeakObject*)this;
2052 : 26 : aEvent.Highlighted = sal_False;
2053 : :
2054 : : // Set to 0xFFFF on multiple selection, selected entry ID otherwise
2055 [ + - ][ + + ]: 26 : aEvent.Selected = (pListBox->GetSelectEntryCount() == 1 ) ? pListBox->GetSelectEntryPos() : 0xFFFF;
[ + - ]
2056 : :
2057 [ + - ][ + - ]: 26 : maItemListeners.itemStateChanged( aEvent );
2058 : : }
2059 : 26 : }
2060 : : namespace
2061 : : {
2062 : 202 : Image lcl_getImageFromURL( const ::rtl::OUString& i_rImageURL )
2063 : : {
2064 [ + - ]: 202 : if ( i_rImageURL.isEmpty() )
2065 : 202 : return Image();
2066 : :
2067 : : try
2068 : : {
2069 [ # # ]: 0 : Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
2070 [ # # ]: 0 : Reference< XGraphicProvider > xProvider(graphic::GraphicProvider::create(xContext));
2071 [ # # ]: 0 : ::comphelper::NamedValueCollection aMediaProperties;
2072 [ # # ]: 0 : aMediaProperties.put( "URL", i_rImageURL );
2073 [ # # ][ # # ]: 0 : Reference< XGraphic > xGraphic = xProvider->queryGraphic( aMediaProperties.getPropertyValues() );
[ # # ][ # # ]
2074 [ # # ][ # # ]: 202 : return Image( xGraphic );
[ # # ]
2075 : : }
2076 : 0 : catch( const uno::Exception& )
2077 : : {
2078 : : DBG_UNHANDLED_EXCEPTION();
2079 : : }
2080 : 0 : return Image();
2081 : : }
2082 : : }
2083 : 0 : void SAL_CALL VCLXListBox::listItemInserted( const ItemListEvent& i_rEvent ) throw (RuntimeException)
2084 : : {
2085 [ # # ]: 0 : SolarMutexGuard aGuard;
2086 : :
2087 [ # # ]: 0 : ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
2088 : :
2089 [ # # ]: 0 : ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemInserted: no ListBox?!" );
2090 [ # # ][ # # ]: 0 : ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition <= sal_Int32( pListBox->GetEntryCount() ) ),
[ # # ][ # # ]
2091 : : "VCLXListBox::listItemInserted: illegal (inconsistent) item position!" );
2092 : : pListBox->InsertEntry(
2093 : : i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString(),
2094 : : i_rEvent.ItemImageURL.IsPresent ? TkResMgr::getImageFromURL( i_rEvent.ItemImageURL.Value ) : Image(),
2095 [ # # ][ # # ]: 0 : i_rEvent.ItemPosition );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
2096 : : }
2097 : :
2098 : 0 : void SAL_CALL VCLXListBox::listItemRemoved( const ItemListEvent& i_rEvent ) throw (RuntimeException)
2099 : : {
2100 [ # # ]: 0 : SolarMutexGuard aGuard;
2101 : :
2102 [ # # ]: 0 : ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
2103 : :
2104 [ # # ]: 0 : ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemRemoved: no ListBox?!" );
2105 [ # # ][ # # ]: 0 : ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pListBox->GetEntryCount() ) ),
[ # # ][ # # ]
2106 : : "VCLXListBox::listItemRemoved: illegal (inconsistent) item position!" );
2107 : :
2108 [ # # ][ # # ]: 0 : pListBox->RemoveEntry( i_rEvent.ItemPosition );
[ # # ]
2109 : : }
2110 : :
2111 : 0 : void SAL_CALL VCLXListBox::listItemModified( const ItemListEvent& i_rEvent ) throw (RuntimeException)
2112 : : {
2113 [ # # ]: 0 : SolarMutexGuard aGuard;
2114 : :
2115 [ # # ]: 0 : ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
2116 : :
2117 [ # # ]: 0 : ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
2118 [ # # ][ # # ]: 0 : ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pListBox->GetEntryCount() ) ),
[ # # ][ # # ]
2119 : : "VCLXListBox::listItemModified: illegal (inconsistent) item position!" );
2120 : :
2121 : : // VCL's ListBox does not support changing an entry's text or image, so remove and re-insert
2122 : :
2123 [ # # ][ # # ]: 0 : const ::rtl::OUString sNewText = i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString( pListBox->GetEntry( i_rEvent.ItemPosition ) );
[ # # ][ # # ]
[ # # ][ # # ]
2124 [ # # ][ # # ]: 0 : const Image aNewImage( i_rEvent.ItemImageURL.IsPresent ? TkResMgr::getImageFromURL( i_rEvent.ItemImageURL.Value ) : pListBox->GetEntryImage( i_rEvent.ItemPosition ) );
[ # # ]
2125 : :
2126 [ # # ]: 0 : pListBox->RemoveEntry( i_rEvent.ItemPosition );
2127 [ # # ][ # # ]: 0 : pListBox->InsertEntry( sNewText, aNewImage, i_rEvent.ItemPosition );
[ # # ][ # # ]
[ # # ][ # # ]
2128 : : }
2129 : :
2130 : 0 : void SAL_CALL VCLXListBox::allItemsRemoved( const EventObject& i_rEvent ) throw (RuntimeException)
2131 : : {
2132 [ # # ]: 0 : SolarMutexGuard aGuard;
2133 : :
2134 [ # # ]: 0 : ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
2135 [ # # ]: 0 : ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
2136 : :
2137 [ # # ][ # # ]: 0 : pListBox->Clear();
2138 : :
2139 [ # # ]: 0 : (void)i_rEvent;
2140 : : }
2141 : :
2142 : 70 : void SAL_CALL VCLXListBox::itemListChanged( const EventObject& i_rEvent ) throw (RuntimeException)
2143 : : {
2144 [ + - ]: 70 : SolarMutexGuard aGuard;
2145 : :
2146 [ - + ]: 70 : ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
2147 [ - + ]: 140 : ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
2148 : :
2149 [ + - ]: 70 : pListBox->Clear();
2150 : :
2151 [ + - ]: 70 : uno::Reference< beans::XPropertySet > xPropSet( i_rEvent.Source, uno::UNO_QUERY_THROW );
2152 [ + - ][ + - ]: 70 : uno::Reference< beans::XPropertySetInfo > xPSI( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW );
[ + - ]
2153 : 70 : uno::Reference< resource::XStringResourceResolver > xStringResourceResolver;
2154 [ + - ][ - + ]: 70 : if ( xPSI->hasPropertyByName( ::rtl::OUString( "ResourceResolver" ) ) )
[ + - ]
2155 : : {
2156 : : xStringResourceResolver.set(
2157 [ # # ]: 0 : xPropSet->getPropertyValue( ::rtl::OUString( "ResourceResolver" ) ),
2158 : : uno::UNO_QUERY
2159 [ # # ][ # # ]: 0 : );
2160 : : }
2161 : :
2162 : :
2163 [ + - ]: 70 : Reference< XItemList > xItemList( i_rEvent.Source, uno::UNO_QUERY_THROW );
2164 [ + - ][ + - ]: 70 : uno::Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > aItems = xItemList->getAllItems();
2165 [ + + ]: 174 : for ( sal_Int32 i=0; i<aItems.getLength(); ++i )
2166 : : {
2167 [ + - ]: 104 : ::rtl::OUString aLocalizationKey( aItems[i].First );
2168 [ # # ][ # # ]: 104 : if ( xStringResourceResolver.is() && !aLocalizationKey.isEmpty() && aLocalizationKey[0] == '&' )
[ - + ][ - + ]
2169 : : {
2170 [ # # ][ # # ]: 0 : aLocalizationKey = xStringResourceResolver->resolveString(aLocalizationKey.copy( 1 ));
2171 : : }
2172 [ + - ][ + - ]: 104 : pListBox->InsertEntry( aLocalizationKey, lcl_getImageFromURL( aItems[i].Second ) );
[ + - ][ + - ]
[ + - ][ + - ]
2173 [ + - ][ + - ]: 174 : }
[ + - ]
2174 : : }
2175 : :
2176 : 6 : void SAL_CALL VCLXListBox::disposing( const EventObject& i_rEvent ) throw (RuntimeException)
2177 : : {
2178 : : // just disambiguate
2179 : 6 : VCLXWindow::disposing( i_rEvent );
2180 : 6 : }
2181 : :
2182 : : // ----------------------------------------------------
2183 : : // class VCLXMessageBox
2184 : : // ----------------------------------------------------
2185 : :
2186 : 0 : void VCLXMessageBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
2187 : : {
2188 : 0 : VCLXTopWindow::ImplGetPropertyIds( rIds );
2189 : 0 : }
2190 : :
2191 [ # # ]: 0 : VCLXMessageBox::VCLXMessageBox()
2192 : : {
2193 : 0 : }
2194 : :
2195 [ # # ]: 0 : VCLXMessageBox::~VCLXMessageBox()
2196 : : {
2197 [ # # ]: 0 : }
2198 : :
2199 : : // ::com::sun::star::uno::XInterface
2200 : 0 : ::com::sun::star::uno::Any VCLXMessageBox::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
2201 : : {
2202 : : ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
2203 [ # # ]: 0 : (static_cast< ::com::sun::star::awt::XMessageBox* >(this)) );
2204 [ # # ][ # # ]: 0 : return (aRet.hasValue() ? aRet : VCLXTopWindow::queryInterface( rType ));
2205 : : }
2206 : :
2207 : : // ::com::sun::star::lang::XTypeProvider
2208 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_START( VCLXMessageBox )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
2209 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMessageBox>* ) NULL ),
2210 : : VCLXTopWindow::getTypes()
2211 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_END
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
2212 : :
2213 : 0 : void VCLXMessageBox::setCaptionText( const ::rtl::OUString& rText ) throw(::com::sun::star::uno::RuntimeException)
2214 : : {
2215 [ # # ]: 0 : SolarMutexGuard aGuard;
2216 : :
2217 : 0 : Window* pWindow = GetWindow();
2218 [ # # ]: 0 : if ( pWindow )
2219 [ # # ][ # # ]: 0 : pWindow->SetText( rText );
[ # # ][ # # ]
2220 : 0 : }
2221 : :
2222 : 0 : ::rtl::OUString VCLXMessageBox::getCaptionText() throw(::com::sun::star::uno::RuntimeException)
2223 : : {
2224 [ # # ]: 0 : SolarMutexGuard aGuard;
2225 : :
2226 [ # # ]: 0 : String aText;
2227 : 0 : Window* pWindow = GetWindow();
2228 [ # # ]: 0 : if ( pWindow )
2229 [ # # ][ # # ]: 0 : aText = pWindow->GetText();
[ # # ]
2230 [ # # ][ # # ]: 0 : return aText;
[ # # ]
2231 : : }
2232 : :
2233 : 0 : void VCLXMessageBox::setMessageText( const ::rtl::OUString& rText ) throw(::com::sun::star::uno::RuntimeException)
2234 : : {
2235 [ # # ]: 0 : SolarMutexGuard aGuard;
2236 : :
2237 : 0 : MessBox* pBox = (MessBox*)GetWindow();
2238 [ # # ]: 0 : if ( pBox )
2239 [ # # ][ # # ]: 0 : pBox->SetMessText( rText );
[ # # ][ # # ]
2240 : 0 : }
2241 : :
2242 : 0 : ::rtl::OUString VCLXMessageBox::getMessageText() throw(::com::sun::star::uno::RuntimeException)
2243 : : {
2244 [ # # ]: 0 : SolarMutexGuard aGuard;
2245 : :
2246 : 0 : ::rtl::OUString aText;
2247 : 0 : MessBox* pBox = (MessBox*)GetWindow();
2248 [ # # ]: 0 : if ( pBox )
2249 [ # # ]: 0 : aText = pBox->GetMessText();
2250 [ # # ]: 0 : return aText;
2251 : : }
2252 : :
2253 : 0 : sal_Int16 VCLXMessageBox::execute() throw(::com::sun::star::uno::RuntimeException)
2254 : : {
2255 [ # # ]: 0 : SolarMutexGuard aGuard;
2256 : :
2257 : 0 : MessBox* pBox = (MessBox*)GetWindow();
2258 [ # # ][ # # ]: 0 : return pBox ? pBox->Execute() : 0;
[ # # ]
2259 : : }
2260 : :
2261 : 0 : ::com::sun::star::awt::Size SAL_CALL VCLXMessageBox::getMinimumSize() throw(::com::sun::star::uno::RuntimeException)
2262 : : {
2263 [ # # ]: 0 : SolarMutexGuard aGuard;
2264 [ # # ]: 0 : return ::com::sun::star::awt::Size( 250, 100 );
2265 : : }
2266 : :
2267 : : // ----------------------------------------------------
2268 : : // class VCLXDialog
2269 : : // ----------------------------------------------------
2270 : 0 : void VCLXDialog::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
2271 : : {
2272 : 0 : VCLXTopWindow::ImplGetPropertyIds( rIds );
2273 : 0 : }
2274 : :
2275 [ + - ]: 2 : VCLXDialog::VCLXDialog()
2276 : : {
2277 : : OSL_TRACE("XDialog created");
2278 : 2 : }
2279 : :
2280 [ + - ]: 2 : VCLXDialog::~VCLXDialog()
2281 : : {
2282 : : #ifndef __SUNPRO_CC
2283 : : OSL_TRACE ("%s", __FUNCTION__);
2284 : : #endif
2285 [ - + ]: 4 : }
2286 : :
2287 : : // ::com::sun::star::uno::XInterface
2288 : 54 : ::com::sun::star::uno::Any VCLXDialog::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
2289 : : {
2290 : : ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
2291 : : (static_cast< ::com::sun::star::document::XVbaMethodParameter* >(this)),
2292 : : (static_cast< ::com::sun::star::awt::XDialog2* >(this)),
2293 [ + - ]: 54 : (static_cast< ::com::sun::star::awt::XDialog* >(this)) );
2294 [ - + ][ + - ]: 54 : return (aRet.hasValue() ? aRet : VCLXTopWindow::queryInterface( rType ));
2295 : : }
2296 : :
2297 : : // ::com::sun::star::lang::XTypeProvider
2298 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_START( VCLXDialog )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
2299 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::document::XVbaMethodParameter>* ) NULL ),
2300 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog2>* ) NULL ),
2301 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog>* ) NULL ),
2302 : : VCLXTopWindow::getTypes()
2303 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_END
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
2304 : :
2305 : 0 : void SAL_CALL VCLXDialog::endDialog( ::sal_Int32 i_result ) throw (RuntimeException)
2306 : : {
2307 [ # # ]: 0 : SolarMutexGuard aGuard;
2308 : :
2309 [ # # ]: 0 : Dialog* pDialog = dynamic_cast< Dialog* >( GetWindow() );
2310 [ # # ]: 0 : if ( pDialog )
2311 [ # # ][ # # ]: 0 : pDialog->EndDialog( i_result );
2312 : 0 : }
2313 : :
2314 : 0 : void SAL_CALL VCLXDialog::setHelpId( const ::rtl::OUString& rId ) throw (RuntimeException)
2315 : : {
2316 [ # # ]: 0 : SolarMutexGuard aGuard;
2317 : :
2318 : 0 : Window* pWindow = GetWindow();
2319 [ # # ]: 0 : if ( pWindow )
2320 [ # # ][ # # ]: 0 : pWindow->SetHelpId( rtl::OUStringToOString( rId, RTL_TEXTENCODING_UTF8 ) );
[ # # ]
2321 : 0 : }
2322 : :
2323 : 0 : void VCLXDialog::setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException)
2324 : : {
2325 [ # # ]: 0 : SolarMutexGuard aGuard;
2326 : :
2327 : 0 : Window* pWindow = GetWindow();
2328 [ # # ]: 0 : if ( pWindow )
2329 [ # # ][ # # ]: 0 : pWindow->SetText( Title );
[ # # ][ # # ]
2330 : 0 : }
2331 : :
2332 : 0 : ::rtl::OUString VCLXDialog::getTitle() throw(::com::sun::star::uno::RuntimeException)
2333 : : {
2334 [ # # ]: 0 : SolarMutexGuard aGuard;
2335 : :
2336 : 0 : ::rtl::OUString aTitle;
2337 : 0 : Window* pWindow = GetWindow();
2338 [ # # ]: 0 : if ( pWindow )
2339 [ # # ][ # # ]: 0 : aTitle = pWindow->GetText();
[ # # ]
2340 [ # # ]: 0 : return aTitle;
2341 : : }
2342 : :
2343 : 0 : sal_Int16 VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException)
2344 : : {
2345 [ # # ]: 0 : SolarMutexGuard aGuard;
2346 : :
2347 : 0 : sal_Int16 nRet = 0;
2348 [ # # ]: 0 : if ( GetWindow() )
2349 : : {
2350 : 0 : Dialog* pDlg = (Dialog*) GetWindow();
2351 [ # # ]: 0 : Window* pParent = pDlg->GetWindow( WINDOW_PARENTOVERLAP );
2352 : 0 : Window* pOldParent = NULL;
2353 : 0 : Window* pSetParent = NULL;
2354 [ # # ][ # # ]: 0 : if ( pParent && !pParent->IsReallyVisible() )
[ # # ][ # # ]
2355 : : {
2356 [ # # ]: 0 : pOldParent = pDlg->GetParent();
2357 [ # # ]: 0 : Window* pFrame = pDlg->GetWindow( WINDOW_FRAME );
2358 [ # # ]: 0 : if( pFrame != pDlg )
2359 : : {
2360 [ # # ]: 0 : pDlg->SetParent( pFrame );
2361 : 0 : pSetParent = pFrame;
2362 : : }
2363 : : }
2364 : :
2365 [ # # ]: 0 : nRet = pDlg->Execute();
2366 : :
2367 : : // set the parent back only in case no new parent was set from outside
2368 : : // in other words, revert only own changes
2369 [ # # ][ # # ]: 0 : if ( pOldParent && pDlg->GetParent() == pSetParent )
[ # # ][ # # ]
2370 [ # # ]: 0 : pDlg->SetParent( pOldParent );
2371 : : }
2372 [ # # ]: 0 : return nRet;
2373 : : }
2374 : :
2375 : 0 : void VCLXDialog::endExecute() throw(::com::sun::star::uno::RuntimeException)
2376 : : {
2377 : 0 : endDialog(0);
2378 : 0 : }
2379 : :
2380 : 0 : void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException)
2381 : : {
2382 [ # # ]: 0 : SolarMutexGuard aGuard;
2383 : 0 : Window* pWindow = GetWindow();
2384 : :
2385 [ # # ]: 0 : if ( pWindow )
2386 : : {
2387 [ # # ][ # # ]: 0 : OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
2388 [ # # ]: 0 : if ( !pDev )
2389 [ # # ]: 0 : pDev = pWindow->GetParent();
2390 : :
2391 [ # # ][ # # ]: 0 : Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() );
2392 [ # # ]: 0 : Point aPos = pDev->PixelToLogic( Point( nX, nY ) );
2393 : :
2394 [ # # ]: 0 : pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS );
2395 [ # # ]: 0 : }
2396 : 0 : }
2397 : :
2398 : 0 : ::com::sun::star::awt::DeviceInfo VCLXDialog::getInfo() throw(::com::sun::star::uno::RuntimeException)
2399 : : {
2400 [ # # ]: 0 : ::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo();
2401 : :
2402 [ # # ]: 0 : SolarMutexGuard aGuard;
2403 : 0 : Dialog* pDlg = (Dialog*) GetWindow();
2404 [ # # ]: 0 : if ( pDlg )
2405 [ # # ]: 0 : pDlg->GetDrawWindowBorder( aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset );
2406 : :
2407 [ # # ]: 0 : return aInfo;
2408 : : }
2409 : :
2410 : : // ::com::sun::star::document::XVbaMethodParameter
2411 : 0 : void SAL_CALL VCLXDialog::setVbaMethodParameter(
2412 : : const ::rtl::OUString& PropertyName,
2413 : : const ::com::sun::star::uno::Any& Value )
2414 : : throw(::com::sun::star::uno::RuntimeException)
2415 : : {
2416 [ # # ]: 0 : if (rtl::OUString("Cancel") == PropertyName)
2417 : : {
2418 [ # # ]: 0 : SolarMutexGuard aGuard;
2419 [ # # ]: 0 : if ( GetWindow() )
2420 : : {
2421 : 0 : sal_Int8 nCancel = 0;
2422 : 0 : Value >>= nCancel;
2423 : :
2424 : 0 : Dialog* pDlg = (Dialog*) GetWindow();
2425 : 0 : pDlg->SetCloseFlag(nCancel);
2426 [ # # ]: 0 : }
2427 : : }
2428 : 0 : }
2429 : :
2430 : 0 : ::com::sun::star::uno::Any SAL_CALL VCLXDialog::getVbaMethodParameter(
2431 : : const ::rtl::OUString& /*PropertyName*/ )
2432 : : throw(::com::sun::star::uno::RuntimeException)
2433 : : {
2434 [ # # ]: 0 : SolarMutexGuard aGuard;
2435 : :
2436 : 0 : ::com::sun::star::uno::Any aRet;
2437 [ # # ]: 0 : return aRet;
2438 : : }
2439 : :
2440 : 94 : void SAL_CALL VCLXDialog::setProperty(
2441 : : const ::rtl::OUString& PropertyName,
2442 : : const ::com::sun::star::uno::Any& Value )
2443 : : throw(::com::sun::star::uno::RuntimeException)
2444 : : {
2445 [ + - ]: 94 : SolarMutexGuard aGuard;
2446 : :
2447 : 94 : Dialog* pDialog = (Dialog*)GetWindow();
2448 [ + - ]: 94 : if ( pDialog )
2449 : : {
2450 : 94 : sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
2451 : :
2452 [ + - ]: 94 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
2453 [ + + ]: 94 : switch ( nPropType )
2454 : : {
2455 : : case BASEPROPERTY_GRAPHIC:
2456 : : {
2457 : 2 : Reference< XGraphic > xGraphic;
2458 [ + - ][ - + ]: 2 : if (( Value >>= xGraphic ) && xGraphic.is() )
[ - + ][ + - ]
2459 : : {
2460 [ # # ]: 0 : Image aImage( xGraphic );
2461 : :
2462 [ # # ][ # # ]: 0 : Wallpaper aWallpaper( aImage.GetBitmapEx());
[ # # ]
2463 [ # # ]: 0 : aWallpaper.SetStyle( WALLPAPER_SCALE );
2464 [ # # ][ # # ]: 0 : pDialog->SetBackground( aWallpaper );
[ # # ]
2465 : : }
2466 [ + - ][ + - ]: 2 : else if ( bVoid || !xGraphic.is() )
[ + - ]
2467 : : {
2468 [ + - ]: 2 : Color aColor = pDialog->GetControlBackground().GetColor();
2469 [ - + ]: 2 : if ( aColor == COL_AUTO )
2470 : 0 : aColor = pDialog->GetSettings().GetStyleSettings().GetDialogColor();
2471 : :
2472 [ + - ]: 2 : Wallpaper aWallpaper( aColor );
2473 [ + - ][ + - ]: 2 : pDialog->SetBackground( aWallpaper );
2474 : 2 : }
2475 : : }
2476 : 2 : break;
2477 : :
2478 : : default:
2479 : : {
2480 [ + - ]: 94 : VCLXWindow::setProperty( PropertyName, Value );
2481 : : }
2482 : : }
2483 [ + - ]: 94 : }
2484 : 94 : }
2485 : :
2486 : :
2487 : : // ----------------------------------------------------
2488 : : // class VCLXTabPage
2489 : : // ----------------------------------------------------
2490 [ # # ][ # # ]: 0 : VCLXMultiPage::VCLXMultiPage() : maTabListeners( *this ), mTabId( 1 )
2491 : : {
2492 : : OSL_TRACE("VCLXMultiPage::VCLXMultiPage()" );
2493 : 0 : }
2494 : :
2495 : 0 : void VCLXMultiPage::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
2496 : : {
2497 : : PushPropertyIds( rIds,
2498 : : BASEPROPERTY_BACKGROUNDCOLOR,
2499 : : BASEPROPERTY_DEFAULTCONTROL,
2500 : : BASEPROPERTY_ENABLED,
2501 : : BASEPROPERTY_MULTIPAGEVALUE,
2502 : : BASEPROPERTY_ENABLEVISIBLE,
2503 : : BASEPROPERTY_FONTDESCRIPTOR,
2504 : : BASEPROPERTY_GRAPHIC,
2505 : : BASEPROPERTY_HELPTEXT,
2506 : : BASEPROPERTY_HELPURL,
2507 : : BASEPROPERTY_IMAGEALIGN,
2508 : : BASEPROPERTY_IMAGEPOSITION,
2509 : : BASEPROPERTY_IMAGEURL,
2510 : : BASEPROPERTY_PRINTABLE,
2511 : : BASEPROPERTY_TABSTOP,
2512 : : BASEPROPERTY_FOCUSONCLICK,
2513 : 0 : 0);
2514 : 0 : VCLXContainer::ImplGetPropertyIds( rIds );
2515 : 0 : }
2516 : :
2517 [ # # ][ # # ]: 0 : VCLXMultiPage::~VCLXMultiPage()
2518 : : {
2519 [ # # ]: 0 : }
2520 : 0 : void SAL_CALL VCLXMultiPage::dispose() throw(::com::sun::star::uno::RuntimeException)
2521 : : {
2522 [ # # ]: 0 : SolarMutexGuard aGuard;
2523 : :
2524 [ # # ]: 0 : ::com::sun::star::lang::EventObject aObj;
2525 [ # # ]: 0 : aObj.Source = (::cppu::OWeakObject*)this;
2526 [ # # ]: 0 : maTabListeners.disposeAndClear( aObj );
2527 [ # # ][ # # ]: 0 : VCLXContainer::dispose();
[ # # ]
2528 : 0 : }
2529 : 0 : ::com::sun::star::uno::Any SAL_CALL VCLXMultiPage::queryInterface(const ::com::sun::star::uno::Type & rType )
2530 : : throw(::com::sun::star::uno::RuntimeException)
2531 : : {
2532 [ # # ]: 0 : uno::Any aRet = ::cppu::queryInterface( rType, static_cast< awt::XSimpleTabController*>( this ) );
2533 : :
2534 [ # # ][ # # ]: 0 : return ( aRet.hasValue() ? aRet : VCLXContainer::queryInterface( rType ) );
2535 : : }
2536 : :
2537 : : // ::com::sun::star::lang::XTypeProvider
2538 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_START( VCLXMultiPage )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
2539 : : VCLXContainer::getTypes()
2540 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_END
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
2541 : :
2542 : : // ::com::sun::star::awt::XView
2543 : 0 : void SAL_CALL VCLXMultiPage::draw( sal_Int32 nX, sal_Int32 nY )
2544 : : throw(::com::sun::star::uno::RuntimeException)
2545 : : {
2546 [ # # ]: 0 : SolarMutexGuard aGuard;
2547 : 0 : Window* pWindow = GetWindow();
2548 : :
2549 [ # # ]: 0 : if ( pWindow )
2550 : : {
2551 [ # # ][ # # ]: 0 : OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
2552 [ # # ]: 0 : if ( !pDev )
2553 [ # # ]: 0 : pDev = pWindow->GetParent();
2554 : :
2555 [ # # ][ # # ]: 0 : Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() );
2556 [ # # ]: 0 : Point aPos = pDev->PixelToLogic( Point( nX, nY ) );
2557 : :
2558 [ # # ]: 0 : pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS );
2559 [ # # ]: 0 : }
2560 : 0 : }
2561 : :
2562 : : // ::com::sun::star::awt::XDevice,
2563 : 0 : ::com::sun::star::awt::DeviceInfo SAL_CALL VCLXMultiPage::getInfo()
2564 : : throw(::com::sun::star::uno::RuntimeException)
2565 : : {
2566 : 0 : ::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo();
2567 : 0 : return aInfo;
2568 : : }
2569 : :
2570 : 0 : uno::Any SAL_CALL VCLXMultiPage::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
2571 : : {
2572 [ # # ]: 0 : SolarMutexGuard aGuard;
2573 : : OSL_TRACE(" **** VCLXMultiPage::getProperty( %s )",
2574 : : rtl::OUStringToOString( PropertyName,
2575 : : RTL_TEXTENCODING_UTF8 ).getStr() );
2576 : 0 : ::com::sun::star::uno::Any aProp;
2577 [ # # ]: 0 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
2578 [ # # ]: 0 : switch ( nPropType )
2579 : : {
2580 : :
2581 : : case BASEPROPERTY_MULTIPAGEVALUE:
2582 : : {
2583 [ # # ][ # # ]: 0 : aProp <<= getActiveTabID();
2584 : : }
2585 : 0 : break;
2586 : : default:
2587 [ # # ][ # # ]: 0 : aProp <<= VCLXContainer::getProperty( PropertyName );
2588 : : }
2589 [ # # ]: 0 : return aProp;
2590 : : }
2591 : :
2592 : 0 : void SAL_CALL VCLXMultiPage::setProperty(
2593 : : const ::rtl::OUString& PropertyName,
2594 : : const ::com::sun::star::uno::Any& Value )
2595 : : throw(::com::sun::star::uno::RuntimeException)
2596 : : {
2597 [ # # ]: 0 : SolarMutexGuard aGuard;
2598 : : OSL_TRACE(" **** VCLXMultiPage::setProperty( %s )", rtl::OUStringToOString( PropertyName, RTL_TEXTENCODING_UTF8 ).getStr() );
2599 : :
2600 : 0 : TabControl* pTabControl = (TabControl*)GetWindow();
2601 [ # # ]: 0 : if ( pTabControl )
2602 : : {
2603 : 0 : sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
2604 : :
2605 [ # # ]: 0 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
2606 [ # # # ]: 0 : switch ( nPropType )
2607 : : {
2608 : : case BASEPROPERTY_MULTIPAGEVALUE:
2609 : : {
2610 : : OSL_TRACE("***MULTIPAGE VALUE");
2611 : 0 : sal_Int32 nId(0);
2612 : 0 : Value >>= nId;
2613 : : // when the multipage is created we attempt to set the activepage
2614 : : // but no pages created
2615 [ # # ][ # # ]: 0 : if ( nId && nId <= getWindows().getLength() )
[ # # ][ # # ]
[ # # # # ]
[ # # ]
2616 [ # # ]: 0 : activateTab( nId );
2617 : : }
2618 : : case BASEPROPERTY_GRAPHIC:
2619 : : {
2620 : 0 : Reference< XGraphic > xGraphic;
2621 [ # # ][ # # ]: 0 : if (( Value >>= xGraphic ) && xGraphic.is() )
[ # # ][ # # ]
2622 : : {
2623 [ # # ]: 0 : Image aImage( xGraphic );
2624 : :
2625 [ # # ][ # # ]: 0 : Wallpaper aWallpaper( aImage.GetBitmapEx());
[ # # ]
2626 [ # # ]: 0 : aWallpaper.SetStyle( WALLPAPER_SCALE );
2627 [ # # ][ # # ]: 0 : pTabControl->SetBackground( aWallpaper );
[ # # ]
2628 : : }
2629 [ # # ][ # # ]: 0 : else if ( bVoid || !xGraphic.is() )
[ # # ]
2630 : : {
2631 [ # # ]: 0 : Color aColor = pTabControl->GetControlBackground().GetColor();
2632 [ # # ]: 0 : if ( aColor == COL_AUTO )
2633 : 0 : aColor = pTabControl->GetSettings().GetStyleSettings().GetDialogColor();
2634 : :
2635 [ # # ]: 0 : Wallpaper aWallpaper( aColor );
2636 [ # # ][ # # ]: 0 : pTabControl->SetBackground( aWallpaper );
2637 : 0 : }
2638 : : }
2639 : 0 : break;
2640 : :
2641 : : default:
2642 : : {
2643 [ # # ]: 0 : VCLXContainer::setProperty( PropertyName, Value );
2644 : : }
2645 : : }
2646 [ # # ]: 0 : }
2647 : 0 : }
2648 : :
2649 : 0 : TabControl *VCLXMultiPage::getTabControl() const throw (uno::RuntimeException)
2650 : : {
2651 [ # # ]: 0 : TabControl *pTabControl = dynamic_cast< TabControl* >( GetWindow() );
2652 [ # # ]: 0 : if ( pTabControl )
2653 : 0 : return pTabControl;
2654 [ # # ]: 0 : throw uno::RuntimeException();
2655 : : }
2656 : 0 : sal_Int32 SAL_CALL VCLXMultiPage::insertTab() throw (uno::RuntimeException)
2657 : : {
2658 [ # # ]: 0 : TabControl *pTabControl = getTabControl();
2659 [ # # ][ # # ]: 0 : TabPage* pTab = new TabPage( pTabControl );
2660 : 0 : rtl::OUString title ("");
2661 [ # # ]: 0 : return static_cast< sal_Int32 >( insertTab( pTab, title ) );
2662 : : }
2663 : :
2664 : 0 : sal_uInt16 VCLXMultiPage::insertTab( TabPage* pPage, rtl::OUString& sTitle )
2665 : : {
2666 : 0 : TabControl *pTabControl = getTabControl();
2667 : 0 : sal_uInt16 id = sal::static_int_cast< sal_uInt16 >( mTabId++ );
2668 [ # # ]: 0 : pTabControl->InsertPage( id, sTitle, TAB_APPEND );
2669 : 0 : pTabControl->SetTabPage( id, pPage );
2670 : 0 : return id;
2671 : : }
2672 : :
2673 : 0 : void SAL_CALL VCLXMultiPage::removeTab( sal_Int32 ID ) throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
2674 : : {
2675 : 0 : TabControl *pTabControl = getTabControl();
2676 [ # # ]: 0 : if ( pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( ID ) ) == NULL )
2677 [ # # ]: 0 : throw lang::IndexOutOfBoundsException();
2678 : 0 : pTabControl->RemovePage( sal::static_int_cast< sal_uInt16 >( ID ) );
2679 : 0 : }
2680 : :
2681 : 0 : void SAL_CALL VCLXMultiPage::activateTab( sal_Int32 ID ) throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
2682 : : {
2683 : 0 : TabControl *pTabControl = getTabControl();
2684 : : OSL_TRACE("Attempting to activate tab %d, active tab is %d, numtabs is %d", ID, getActiveTabID(), getWindows().getLength() );
2685 [ # # ]: 0 : if ( pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( ID ) ) == NULL )
2686 [ # # ]: 0 : throw lang::IndexOutOfBoundsException();
2687 : 0 : pTabControl->SelectTabPage( sal::static_int_cast< sal_uInt16 >( ID ) );
2688 : 0 : }
2689 : :
2690 : 0 : sal_Int32 SAL_CALL VCLXMultiPage::getActiveTabID() throw (uno::RuntimeException)
2691 : : {
2692 : 0 : return getTabControl()->GetCurPageId( );
2693 : : }
2694 : :
2695 : 0 : void SAL_CALL VCLXMultiPage::addTabListener( const uno::Reference< awt::XTabListener >& xListener ) throw (uno::RuntimeException)
2696 : : {
2697 [ # # ]: 0 : SolarMutexGuard aGuard;
2698 [ # # ][ # # ]: 0 : maTabListeners.addInterface( xListener );
2699 : 0 : }
2700 : :
2701 : 0 : void SAL_CALL VCLXMultiPage::removeTabListener( const uno::Reference< awt::XTabListener >& xListener ) throw (uno::RuntimeException)
2702 : : {
2703 [ # # ]: 0 : SolarMutexGuard aGuard;
2704 [ # # ][ # # ]: 0 : maTabListeners.addInterface( xListener );
2705 : 0 : }
2706 : :
2707 : 0 : void SAL_CALL VCLXMultiPage::setTabProps( sal_Int32 ID, const uno::Sequence< beans::NamedValue >& Properties ) throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
2708 : : {
2709 [ # # ]: 0 : SolarMutexGuard aGuard;
2710 [ # # ]: 0 : TabControl *pTabControl = getTabControl();
2711 [ # # ][ # # ]: 0 : if ( pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( ID ) ) == NULL )
2712 [ # # ]: 0 : throw lang::IndexOutOfBoundsException();
2713 : :
2714 [ # # ]: 0 : for (sal_Int32 i = 0; i < Properties.getLength(); ++i)
2715 : : {
2716 : 0 : const rtl::OUString &name = Properties[i].Name;
2717 : 0 : const uno::Any &value = Properties[i].Value;
2718 : :
2719 [ # # ]: 0 : if (name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Title")))
2720 : : {
2721 [ # # ]: 0 : rtl::OUString title = value.get<rtl::OUString>();
2722 [ # # ][ # # ]: 0 : pTabControl->SetPageText( sal::static_int_cast< sal_uInt16 >( ID ), title );
[ # # ]
2723 : : }
2724 [ # # ]: 0 : }
2725 : 0 : }
2726 : :
2727 : 0 : uno::Sequence< beans::NamedValue > SAL_CALL VCLXMultiPage::getTabProps( sal_Int32 ID )
2728 : : throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
2729 : : {
2730 [ # # ]: 0 : SolarMutexGuard aGuard;
2731 [ # # ]: 0 : TabControl *pTabControl = getTabControl();
2732 [ # # ][ # # ]: 0 : if ( pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( ID ) ) == NULL )
2733 [ # # ]: 0 : throw lang::IndexOutOfBoundsException();
2734 : :
2735 : : #define ADD_PROP( seq, i, name, val ) { \
2736 : : beans::NamedValue value; \
2737 : : value.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( name ) ); \
2738 : : value.Value = uno::makeAny( val ); \
2739 : : seq[i] = value; \
2740 : : }
2741 : :
2742 [ # # ]: 0 : uno::Sequence< beans::NamedValue > props( 2 );
2743 [ # # ][ # # ]: 0 : ADD_PROP( props, 0, "Title", rtl::OUString( pTabControl->GetPageText( sal::static_int_cast< sal_uInt16 >( ID ) ) ) );
[ # # ][ # # ]
[ # # ][ # # ]
2744 [ # # ][ # # ]: 0 : ADD_PROP( props, 1, "Position", pTabControl->GetPagePos( sal::static_int_cast< sal_uInt16 >( ID ) ) );
[ # # ][ # # ]
2745 : : #undef ADD_PROP
2746 [ # # ]: 0 : return props;
2747 : : }
2748 : 0 : void VCLXMultiPage::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
2749 : : {
2750 [ # # ]: 0 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
2751 [ # # # ]: 0 : switch ( rVclWindowEvent.GetId() )
2752 : : {
2753 : : case VCLEVENT_TABPAGE_DEACTIVATE:
2754 : : {
2755 : 0 : sal_uLong nPageID = (sal_uLong)( rVclWindowEvent.GetData() );
2756 [ # # ]: 0 : maTabListeners.deactivated( nPageID );
2757 : 0 : break;
2758 : :
2759 : : }
2760 : : case VCLEVENT_TABPAGE_ACTIVATE:
2761 : : {
2762 : 0 : sal_uLong nPageID = (sal_uLong)( rVclWindowEvent.GetData() );
2763 [ # # ]: 0 : maTabListeners.activated( nPageID );
2764 : 0 : break;
2765 : : }
2766 : : default:
2767 [ # # ]: 0 : VCLXContainer::ProcessWindowEvent( rVclWindowEvent );
2768 : 0 : break;
2769 : 0 : };
2770 : 0 : }
2771 : :
2772 : : // ----------------------------------------------------
2773 : : // class VCLXTabPage
2774 : : // ----------------------------------------------------
2775 : 0 : VCLXTabPage::VCLXTabPage()
2776 : : {
2777 : 0 : }
2778 : :
2779 : 0 : void VCLXTabPage::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
2780 : : {
2781 : : PushPropertyIds( rIds,
2782 : : BASEPROPERTY_BACKGROUNDCOLOR,
2783 : : BASEPROPERTY_DEFAULTCONTROL,
2784 : : BASEPROPERTY_ENABLED,
2785 : : BASEPROPERTY_ENABLEVISIBLE,
2786 : : BASEPROPERTY_FONTDESCRIPTOR,
2787 : : BASEPROPERTY_GRAPHIC,
2788 : : BASEPROPERTY_HELPTEXT,
2789 : : BASEPROPERTY_HELPURL,
2790 : : BASEPROPERTY_IMAGEALIGN,
2791 : : BASEPROPERTY_IMAGEPOSITION,
2792 : : BASEPROPERTY_IMAGEURL,
2793 : : BASEPROPERTY_PRINTABLE,
2794 : : BASEPROPERTY_TABSTOP,
2795 : : BASEPROPERTY_FOCUSONCLICK,
2796 : 0 : 0);
2797 : 0 : VCLXContainer::ImplGetPropertyIds( rIds );
2798 : 0 : }
2799 : :
2800 : 0 : VCLXTabPage::~VCLXTabPage()
2801 : : {
2802 [ # # ]: 0 : }
2803 : :
2804 : 0 : ::com::sun::star::uno::Any SAL_CALL VCLXTabPage::queryInterface(const ::com::sun::star::uno::Type & rType )
2805 : : throw(::com::sun::star::uno::RuntimeException)
2806 : : {
2807 : 0 : return VCLXContainer::queryInterface( rType );
2808 : : }
2809 : :
2810 : : // ::com::sun::star::lang::XTypeProvider
2811 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_START( VCLXTabPage )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
2812 : : VCLXContainer::getTypes()
2813 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_END
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
2814 : :
2815 : : // ::com::sun::star::awt::XView
2816 : 0 : void SAL_CALL VCLXTabPage::draw( sal_Int32 nX, sal_Int32 nY )
2817 : : throw(::com::sun::star::uno::RuntimeException)
2818 : : {
2819 [ # # ]: 0 : SolarMutexGuard aGuard;
2820 : 0 : Window* pWindow = GetWindow();
2821 : :
2822 [ # # ]: 0 : if ( pWindow )
2823 : : {
2824 [ # # ][ # # ]: 0 : OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
2825 [ # # ]: 0 : if ( !pDev )
2826 [ # # ]: 0 : pDev = pWindow->GetParent();
2827 : :
2828 [ # # ][ # # ]: 0 : Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() );
2829 [ # # ]: 0 : Point aPos = pDev->PixelToLogic( Point( nX, nY ) );
2830 : :
2831 [ # # ]: 0 : pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS );
2832 [ # # ]: 0 : }
2833 : 0 : }
2834 : :
2835 : : // ::com::sun::star::awt::XDevice,
2836 : 0 : ::com::sun::star::awt::DeviceInfo SAL_CALL VCLXTabPage::getInfo()
2837 : : throw(::com::sun::star::uno::RuntimeException)
2838 : : {
2839 : 0 : ::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo();
2840 : 0 : return aInfo;
2841 : : }
2842 : :
2843 : 0 : void SAL_CALL VCLXTabPage::setProperty(
2844 : : const ::rtl::OUString& PropertyName,
2845 : : const ::com::sun::star::uno::Any& Value )
2846 : : throw(::com::sun::star::uno::RuntimeException)
2847 : : {
2848 [ # # ]: 0 : SolarMutexGuard aGuard;
2849 : :
2850 : 0 : TabPage* pTabPage = (TabPage*)GetWindow();
2851 [ # # ]: 0 : if ( pTabPage )
2852 : : {
2853 : 0 : sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
2854 : :
2855 [ # # ]: 0 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
2856 [ # # # ]: 0 : switch ( nPropType )
2857 : : {
2858 : : case BASEPROPERTY_GRAPHIC:
2859 : : {
2860 : 0 : Reference< XGraphic > xGraphic;
2861 [ # # ][ # # ]: 0 : if (( Value >>= xGraphic ) && xGraphic.is() )
[ # # ][ # # ]
2862 : : {
2863 [ # # ]: 0 : Image aImage( xGraphic );
2864 : :
2865 [ # # ][ # # ]: 0 : Wallpaper aWallpaper( aImage.GetBitmapEx());
[ # # ]
2866 [ # # ]: 0 : aWallpaper.SetStyle( WALLPAPER_SCALE );
2867 [ # # ][ # # ]: 0 : pTabPage->SetBackground( aWallpaper );
[ # # ]
2868 : : }
2869 [ # # ][ # # ]: 0 : else if ( bVoid || !xGraphic.is() )
[ # # ]
2870 : : {
2871 [ # # ]: 0 : Color aColor = pTabPage->GetControlBackground().GetColor();
2872 [ # # ]: 0 : if ( aColor == COL_AUTO )
2873 : 0 : aColor = pTabPage->GetSettings().GetStyleSettings().GetDialogColor();
2874 : :
2875 [ # # ]: 0 : Wallpaper aWallpaper( aColor );
2876 [ # # ][ # # ]: 0 : pTabPage->SetBackground( aWallpaper );
2877 : 0 : }
2878 : : }
2879 : 0 : break;
2880 : : case BASEPROPERTY_TITLE:
2881 : : {
2882 : 0 : ::rtl::OUString sTitle;
2883 [ # # ]: 0 : if ( Value >>= sTitle )
2884 : : {
2885 [ # # ][ # # ]: 0 : pTabPage->SetText(sTitle);
[ # # ]
2886 : 0 : }
2887 : : }
2888 : 0 : break;
2889 : :
2890 : : default:
2891 : : {
2892 [ # # ]: 0 : VCLXContainer::setProperty( PropertyName, Value );
2893 : : }
2894 : : }
2895 [ # # ]: 0 : }
2896 : 0 : }
2897 : :
2898 : 0 : TabPage *VCLXTabPage::getTabPage() const throw (uno::RuntimeException)
2899 : : {
2900 [ # # ]: 0 : TabPage *pTabPage = dynamic_cast< TabPage* >( GetWindow() );
2901 [ # # ]: 0 : if ( pTabPage )
2902 : 0 : return pTabPage;
2903 [ # # ]: 0 : throw uno::RuntimeException();
2904 : : }
2905 : :
2906 : : // ----------------------------------------------------
2907 : : // class VCLXFixedHyperlink
2908 : : // ----------------------------------------------------
2909 : :
2910 : 0 : VCLXFixedHyperlink::VCLXFixedHyperlink() :
2911 : :
2912 [ # # ][ # # ]: 0 : maActionListeners( *this )
2913 : :
2914 : : {
2915 : 0 : }
2916 : :
2917 [ # # ][ # # ]: 0 : VCLXFixedHyperlink::~VCLXFixedHyperlink()
2918 : : {
2919 [ # # ]: 0 : }
2920 : :
2921 : : // ::com::sun::star::uno::XInterface
2922 : 0 : ::com::sun::star::uno::Any VCLXFixedHyperlink::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
2923 : : {
2924 : : ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
2925 [ # # ]: 0 : (static_cast< ::com::sun::star::awt::XFixedHyperlink* >(this)) );
2926 [ # # ][ # # ]: 0 : return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
2927 : : }
2928 : :
2929 : 0 : void VCLXFixedHyperlink::dispose() throw(::com::sun::star::uno::RuntimeException)
2930 : : {
2931 [ # # ]: 0 : SolarMutexGuard aGuard;
2932 : :
2933 [ # # ]: 0 : ::com::sun::star::lang::EventObject aObj;
2934 [ # # ]: 0 : aObj.Source = (::cppu::OWeakObject*)this;
2935 [ # # ]: 0 : maActionListeners.disposeAndClear( aObj );
2936 [ # # ][ # # ]: 0 : VCLXWindow::dispose();
[ # # ]
2937 : 0 : }
2938 : :
2939 : : // ::com::sun::star::lang::XTypeProvider
2940 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_START( VCLXFixedHyperlink )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
2941 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedHyperlink>* ) NULL ),
2942 : : VCLXWindow::getTypes()
2943 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_END
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
2944 : :
2945 : 0 : void VCLXFixedHyperlink::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
2946 : : {
2947 [ # # ]: 0 : switch ( rVclWindowEvent.GetId() )
2948 : : {
2949 : : case VCLEVENT_BUTTON_CLICK:
2950 : : {
2951 [ # # ]: 0 : if ( maActionListeners.getLength() )
2952 : : {
2953 [ # # ]: 0 : ::com::sun::star::awt::ActionEvent aEvent;
2954 [ # # ]: 0 : aEvent.Source = (::cppu::OWeakObject*)this;
2955 [ # # ][ # # ]: 0 : maActionListeners.actionPerformed( aEvent );
2956 : : }
2957 : : else
2958 : : {
2959 : : // open the URL
2960 : 0 : ::rtl::OUString sURL;
2961 : 0 : ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
2962 [ # # ]: 0 : if ( pBase )
2963 [ # # ][ # # ]: 0 : sURL = pBase->GetURL();
[ # # ]
2964 : : Reference< ::com::sun::star::system::XSystemShellExecute > xSystemShellExecute(
2965 [ # # ][ # # ]: 0 : ::comphelper::getProcessServiceFactory()->createInstance(
2966 [ # # ][ # # ]: 0 : ::rtl::OUString("com.sun.star.system.SystemShellExecute")), uno::UNO_QUERY );
2967 [ # # ][ # # ]: 0 : if ( !sURL.isEmpty() && xSystemShellExecute.is() )
[ # # ]
2968 : : {
2969 : : try
2970 : : {
2971 : : // start browser
2972 [ # # ]: 0 : xSystemShellExecute->execute(
2973 [ # # ][ # # ]: 0 : sURL, ::rtl::OUString(), ::com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY );
2974 : : }
2975 [ # # ]: 0 : catch( uno::Exception& )
2976 : : {
2977 : : }
2978 : 0 : }
2979 : : }
2980 : : }
2981 : :
2982 : : default:
2983 : 0 : VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
2984 : 0 : break;
2985 : : }
2986 : 0 : }
2987 : :
2988 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXFixedHyperlink::CreateAccessibleContext()
2989 : : {
2990 : 0 : return getAccessibleFactory().createAccessibleContext( this );
2991 : : }
2992 : :
2993 : 0 : void VCLXFixedHyperlink::setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException)
2994 : : {
2995 [ # # ]: 0 : SolarMutexGuard aGuard;
2996 : :
2997 : 0 : ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
2998 [ # # ]: 0 : if ( pBase )
2999 [ # # ][ # # ]: 0 : pBase->SetDescription( Text );
[ # # ][ # # ]
3000 : 0 : }
3001 : :
3002 : 0 : ::rtl::OUString VCLXFixedHyperlink::getText() throw(::com::sun::star::uno::RuntimeException)
3003 : : {
3004 [ # # ]: 0 : SolarMutexGuard aGuard;
3005 : :
3006 : 0 : ::rtl::OUString aText;
3007 : 0 : Window* pWindow = GetWindow();
3008 [ # # ]: 0 : if ( pWindow )
3009 [ # # ][ # # ]: 0 : aText = pWindow->GetText();
[ # # ]
3010 [ # # ]: 0 : return aText;
3011 : : }
3012 : :
3013 : 0 : void VCLXFixedHyperlink::setURL( const ::rtl::OUString& URL ) throw(::com::sun::star::uno::RuntimeException)
3014 : : {
3015 [ # # ]: 0 : SolarMutexGuard aGuard;
3016 : :
3017 : 0 : ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
3018 [ # # ]: 0 : if ( pBase )
3019 [ # # ][ # # ]: 0 : pBase->SetURL( URL );
[ # # ][ # # ]
3020 : 0 : }
3021 : :
3022 : 0 : ::rtl::OUString VCLXFixedHyperlink::getURL( ) throw(::com::sun::star::uno::RuntimeException)
3023 : : {
3024 [ # # ]: 0 : SolarMutexGuard aGuard;
3025 : :
3026 : 0 : ::rtl::OUString aText;
3027 : 0 : ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
3028 [ # # ]: 0 : if ( pBase )
3029 [ # # ][ # # ]: 0 : aText = pBase->GetURL();
[ # # ]
3030 [ # # ]: 0 : return aText;
3031 : : }
3032 : :
3033 : 0 : void VCLXFixedHyperlink::setAlignment( short nAlign ) throw(::com::sun::star::uno::RuntimeException)
3034 : : {
3035 [ # # ]: 0 : SolarMutexGuard aGuard;
3036 : :
3037 : 0 : Window* pWindow = GetWindow();
3038 [ # # ]: 0 : if ( pWindow )
3039 : : {
3040 : 0 : WinBits nNewBits = 0;
3041 [ # # ]: 0 : if ( nAlign == ::com::sun::star::awt::TextAlign::LEFT )
3042 : 0 : nNewBits = WB_LEFT;
3043 [ # # ]: 0 : else if ( nAlign == ::com::sun::star::awt::TextAlign::CENTER )
3044 : 0 : nNewBits = WB_CENTER;
3045 : : else
3046 : 0 : nNewBits = WB_RIGHT;
3047 : :
3048 [ # # ]: 0 : WinBits nStyle = pWindow->GetStyle();
3049 : 0 : nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT);
3050 [ # # ]: 0 : pWindow->SetStyle( nStyle | nNewBits );
3051 [ # # ]: 0 : }
3052 : 0 : }
3053 : :
3054 : 0 : short VCLXFixedHyperlink::getAlignment() throw(::com::sun::star::uno::RuntimeException)
3055 : : {
3056 [ # # ]: 0 : SolarMutexGuard aGuard;
3057 : :
3058 : 0 : short nAlign = 0;
3059 : 0 : Window* pWindow = GetWindow();
3060 [ # # ]: 0 : if ( pWindow )
3061 : : {
3062 [ # # ]: 0 : WinBits nStyle = pWindow->GetStyle();
3063 [ # # ]: 0 : if ( nStyle & WB_LEFT )
3064 : 0 : nAlign = ::com::sun::star::awt::TextAlign::LEFT;
3065 [ # # ]: 0 : else if ( nStyle & WB_CENTER )
3066 : 0 : nAlign = ::com::sun::star::awt::TextAlign::CENTER;
3067 : : else
3068 : 0 : nAlign = ::com::sun::star::awt::TextAlign::RIGHT;
3069 : : }
3070 [ # # ]: 0 : return nAlign;
3071 : : }
3072 : :
3073 : 0 : void VCLXFixedHyperlink::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l )throw(::com::sun::star::uno::RuntimeException)
3074 : : {
3075 [ # # ]: 0 : SolarMutexGuard aGuard;
3076 [ # # ][ # # ]: 0 : maActionListeners.addInterface( l );
3077 : 0 : }
3078 : :
3079 : 0 : void VCLXFixedHyperlink::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3080 : : {
3081 [ # # ]: 0 : SolarMutexGuard aGuard;
3082 [ # # ][ # # ]: 0 : maActionListeners.removeInterface( l );
3083 : 0 : }
3084 : :
3085 : 0 : ::com::sun::star::awt::Size VCLXFixedHyperlink::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
3086 : : {
3087 [ # # ]: 0 : SolarMutexGuard aGuard;
3088 : :
3089 : 0 : Size aSz;
3090 : 0 : FixedText* pFixedText = (FixedText*)GetWindow();
3091 [ # # ]: 0 : if ( pFixedText )
3092 [ # # ]: 0 : aSz = pFixedText->CalcMinimumSize();
3093 [ # # ]: 0 : return AWTSize(aSz);
3094 : : }
3095 : :
3096 : 0 : ::com::sun::star::awt::Size VCLXFixedHyperlink::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
3097 : : {
3098 : 0 : return getMinimumSize();
3099 : : }
3100 : :
3101 : 0 : ::com::sun::star::awt::Size VCLXFixedHyperlink::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
3102 : : {
3103 [ # # ]: 0 : SolarMutexGuard aGuard;
3104 : :
3105 : 0 : ::com::sun::star::awt::Size aSz = rNewSize;
3106 [ # # ]: 0 : ::com::sun::star::awt::Size aMinSz = getMinimumSize();
3107 [ # # ]: 0 : if ( aSz.Height != aMinSz.Height )
3108 : 0 : aSz.Height = aMinSz.Height;
3109 : :
3110 [ # # ]: 0 : return aSz;
3111 : : }
3112 : :
3113 : 0 : void VCLXFixedHyperlink::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
3114 : : {
3115 [ # # ]: 0 : SolarMutexGuard aGuard;
3116 : :
3117 : 0 : ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
3118 [ # # ]: 0 : if ( pBase )
3119 : : {
3120 [ # # ]: 0 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
3121 [ # # # ]: 0 : switch ( nPropType )
3122 : : {
3123 : : case BASEPROPERTY_LABEL:
3124 : : {
3125 : 0 : ::rtl::OUString sNewLabel;
3126 [ # # ]: 0 : if ( Value >>= sNewLabel )
3127 [ # # ][ # # ]: 0 : pBase->SetDescription( sNewLabel );
[ # # ]
3128 : 0 : break;
3129 : : }
3130 : :
3131 : : case BASEPROPERTY_URL:
3132 : : {
3133 : 0 : ::rtl::OUString sNewURL;
3134 [ # # ]: 0 : if ( Value >>= sNewURL )
3135 [ # # ][ # # ]: 0 : pBase->SetURL( sNewURL );
[ # # ]
3136 : 0 : break;
3137 : : }
3138 : :
3139 : : default:
3140 : : {
3141 [ # # ]: 0 : VCLXWindow::setProperty( PropertyName, Value );
3142 : : }
3143 : : }
3144 [ # # ]: 0 : }
3145 : 0 : }
3146 : :
3147 : 0 : ::com::sun::star::uno::Any VCLXFixedHyperlink::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
3148 : : {
3149 [ # # ]: 0 : SolarMutexGuard aGuard;
3150 : :
3151 : 0 : ::com::sun::star::uno::Any aProp;
3152 : 0 : ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
3153 [ # # ]: 0 : if ( pBase )
3154 : : {
3155 [ # # ]: 0 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
3156 [ # # ]: 0 : switch ( nPropType )
3157 : : {
3158 : : case BASEPROPERTY_URL:
3159 : : {
3160 [ # # ][ # # ]: 0 : aProp = makeAny( ::rtl::OUString( pBase->GetURL() ) );
[ # # ][ # # ]
3161 : 0 : break;
3162 : : }
3163 : :
3164 : : default:
3165 : : {
3166 [ # # ][ # # ]: 0 : aProp <<= VCLXWindow::getProperty( PropertyName );
3167 : : }
3168 : : }
3169 : : }
3170 [ # # ]: 0 : return aProp;
3171 : : }
3172 : :
3173 : 0 : void VCLXFixedHyperlink::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
3174 : : {
3175 : : PushPropertyIds( rIds,
3176 : : BASEPROPERTY_ALIGN,
3177 : : BASEPROPERTY_BACKGROUNDCOLOR,
3178 : : BASEPROPERTY_BORDER,
3179 : : BASEPROPERTY_BORDERCOLOR,
3180 : : BASEPROPERTY_DEFAULTCONTROL,
3181 : : BASEPROPERTY_ENABLED,
3182 : : BASEPROPERTY_ENABLEVISIBLE,
3183 : : BASEPROPERTY_FONTDESCRIPTOR,
3184 : : BASEPROPERTY_HELPTEXT,
3185 : : BASEPROPERTY_HELPURL,
3186 : : BASEPROPERTY_LABEL,
3187 : : BASEPROPERTY_MULTILINE,
3188 : : BASEPROPERTY_NOLABEL,
3189 : : BASEPROPERTY_PRINTABLE,
3190 : : BASEPROPERTY_TABSTOP,
3191 : : BASEPROPERTY_VERTICALALIGN,
3192 : : BASEPROPERTY_URL,
3193 : : BASEPROPERTY_WRITING_MODE,
3194 : : BASEPROPERTY_CONTEXT_WRITING_MODE,
3195 : 0 : 0);
3196 : 0 : VCLXWindow::ImplGetPropertyIds( rIds );
3197 : 0 : }
3198 : :
3199 : : // ----------------------------------------------------
3200 : : // class VCLXFixedText
3201 : : // ----------------------------------------------------
3202 : 155 : void VCLXFixedText::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
3203 : : {
3204 : : PushPropertyIds( rIds,
3205 : : BASEPROPERTY_ALIGN,
3206 : : BASEPROPERTY_BACKGROUNDCOLOR,
3207 : : BASEPROPERTY_BORDER,
3208 : : BASEPROPERTY_BORDERCOLOR,
3209 : : BASEPROPERTY_DEFAULTCONTROL,
3210 : : BASEPROPERTY_ENABLED,
3211 : : BASEPROPERTY_ENABLEVISIBLE,
3212 : : BASEPROPERTY_FONTDESCRIPTOR,
3213 : : BASEPROPERTY_HELPTEXT,
3214 : : BASEPROPERTY_HELPURL,
3215 : : BASEPROPERTY_LABEL,
3216 : : BASEPROPERTY_MULTILINE,
3217 : : BASEPROPERTY_NOLABEL,
3218 : : BASEPROPERTY_PRINTABLE,
3219 : : BASEPROPERTY_TABSTOP,
3220 : : BASEPROPERTY_VERTICALALIGN,
3221 : : BASEPROPERTY_WRITING_MODE,
3222 : : BASEPROPERTY_CONTEXT_WRITING_MODE,
3223 : : BASEPROPERTY_REFERENCE_DEVICE,
3224 : 155 : 0);
3225 : 155 : VCLXWindow::ImplGetPropertyIds( rIds );
3226 : 155 : }
3227 : :
3228 [ + - ]: 4 : VCLXFixedText::VCLXFixedText()
3229 : : {
3230 : 4 : }
3231 : :
3232 [ + - ]: 4 : VCLXFixedText::~VCLXFixedText()
3233 : : {
3234 [ - + ]: 8 : }
3235 : :
3236 : : // ::com::sun::star::uno::XInterface
3237 : 167 : ::com::sun::star::uno::Any VCLXFixedText::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
3238 : : {
3239 : : ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
3240 [ + - ]: 167 : (static_cast< ::com::sun::star::awt::XFixedText* >(this)) );
3241 [ - + ][ + - ]: 167 : return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
3242 : : }
3243 : :
3244 : : // ::com::sun::star::lang::XTypeProvider
3245 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_START( VCLXFixedText )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
3246 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedText>* ) NULL ),
3247 : : VCLXWindow::getTypes()
3248 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_END
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
3249 : :
3250 : 2 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXFixedText::CreateAccessibleContext()
3251 : : {
3252 : 2 : return getAccessibleFactory().createAccessibleContext( this );
3253 : : }
3254 : :
3255 : 0 : void VCLXFixedText::setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException)
3256 : : {
3257 [ # # ]: 0 : SolarMutexGuard aGuard;
3258 : :
3259 : 0 : Window* pWindow = GetWindow();
3260 [ # # ]: 0 : if ( pWindow )
3261 [ # # ][ # # ]: 0 : pWindow->SetText( Text );
[ # # ][ # # ]
3262 : 0 : }
3263 : :
3264 : 0 : ::rtl::OUString VCLXFixedText::getText() throw(::com::sun::star::uno::RuntimeException)
3265 : : {
3266 [ # # ]: 0 : SolarMutexGuard aGuard;
3267 : :
3268 : 0 : ::rtl::OUString aText;
3269 : 0 : Window* pWindow = GetWindow();
3270 [ # # ]: 0 : if ( pWindow )
3271 [ # # ][ # # ]: 0 : aText = pWindow->GetText();
[ # # ]
3272 [ # # ]: 0 : return aText;
3273 : : }
3274 : :
3275 : 0 : void VCLXFixedText::setAlignment( short nAlign ) throw(::com::sun::star::uno::RuntimeException)
3276 : : {
3277 [ # # ]: 0 : SolarMutexGuard aGuard;
3278 : :
3279 : 0 : Window* pWindow = GetWindow();
3280 [ # # ]: 0 : if ( pWindow )
3281 : : {
3282 : 0 : WinBits nNewBits = 0;
3283 [ # # ]: 0 : if ( nAlign == ::com::sun::star::awt::TextAlign::LEFT )
3284 : 0 : nNewBits = WB_LEFT;
3285 [ # # ]: 0 : else if ( nAlign == ::com::sun::star::awt::TextAlign::CENTER )
3286 : 0 : nNewBits = WB_CENTER;
3287 : : else
3288 : 0 : nNewBits = WB_RIGHT;
3289 : :
3290 [ # # ]: 0 : WinBits nStyle = pWindow->GetStyle();
3291 : 0 : nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT);
3292 [ # # ]: 0 : pWindow->SetStyle( nStyle | nNewBits );
3293 [ # # ]: 0 : }
3294 : 0 : }
3295 : :
3296 : 0 : short VCLXFixedText::getAlignment() throw(::com::sun::star::uno::RuntimeException)
3297 : : {
3298 [ # # ]: 0 : SolarMutexGuard aGuard;
3299 : :
3300 : 0 : short nAlign = 0;
3301 : 0 : Window* pWindow = GetWindow();
3302 [ # # ]: 0 : if ( pWindow )
3303 : : {
3304 [ # # ]: 0 : WinBits nStyle = pWindow->GetStyle();
3305 [ # # ]: 0 : if ( nStyle & WB_LEFT )
3306 : 0 : nAlign = ::com::sun::star::awt::TextAlign::LEFT;
3307 [ # # ]: 0 : else if ( nStyle & WB_CENTER )
3308 : 0 : nAlign = ::com::sun::star::awt::TextAlign::CENTER;
3309 : : else
3310 : 0 : nAlign = ::com::sun::star::awt::TextAlign::RIGHT;
3311 : : }
3312 [ # # ]: 0 : return nAlign;
3313 : : }
3314 : :
3315 : 4 : ::com::sun::star::awt::Size VCLXFixedText::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
3316 : : {
3317 [ + - ]: 4 : SolarMutexGuard aGuard;
3318 : :
3319 : 4 : Size aSz;
3320 : 4 : FixedText* pFixedText = (FixedText*)GetWindow();
3321 [ + - ]: 4 : if ( pFixedText )
3322 [ + - ]: 4 : aSz = pFixedText->CalcMinimumSize();
3323 [ + - ]: 4 : return AWTSize(aSz);
3324 : : }
3325 : :
3326 : 2 : ::com::sun::star::awt::Size VCLXFixedText::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
3327 : : {
3328 : 2 : return getMinimumSize();
3329 : : }
3330 : :
3331 : 2 : ::com::sun::star::awt::Size VCLXFixedText::calcAdjustedSize( const ::com::sun::star::awt::Size& rMaxSize ) throw(::com::sun::star::uno::RuntimeException)
3332 : : {
3333 [ + - ]: 2 : SolarMutexGuard aGuard;
3334 : :
3335 [ + - ]: 2 : Size aAdjustedSize( VCLUnoHelper::ConvertToVCLSize( rMaxSize ) );
3336 : 2 : FixedText* pFixedText = (FixedText*)GetWindow();
3337 [ + - ]: 2 : if ( pFixedText )
3338 [ + - ]: 2 : aAdjustedSize = pFixedText->CalcMinimumSize( rMaxSize.Width );
3339 [ + - ][ + - ]: 2 : return VCLUnoHelper::ConvertToAWTSize( aAdjustedSize );
3340 : : }
3341 : :
3342 : : // ----------------------------------------------------
3343 : : // class VCLXScrollBar
3344 : : // ----------------------------------------------------
3345 : 20 : void VCLXScrollBar::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
3346 : : {
3347 : : PushPropertyIds( rIds,
3348 : : BASEPROPERTY_BACKGROUNDCOLOR,
3349 : : BASEPROPERTY_BLOCKINCREMENT,
3350 : : BASEPROPERTY_BORDER,
3351 : : BASEPROPERTY_BORDERCOLOR,
3352 : : BASEPROPERTY_DEFAULTCONTROL,
3353 : : BASEPROPERTY_ENABLED,
3354 : : BASEPROPERTY_ENABLEVISIBLE,
3355 : : BASEPROPERTY_HELPTEXT,
3356 : : BASEPROPERTY_HELPURL,
3357 : : BASEPROPERTY_LINEINCREMENT,
3358 : : BASEPROPERTY_LIVE_SCROLL,
3359 : : BASEPROPERTY_ORIENTATION,
3360 : : BASEPROPERTY_PRINTABLE,
3361 : : BASEPROPERTY_REPEAT_DELAY,
3362 : : BASEPROPERTY_SCROLLVALUE,
3363 : : BASEPROPERTY_SCROLLVALUE_MAX,
3364 : : BASEPROPERTY_SCROLLVALUE_MIN,
3365 : : BASEPROPERTY_SYMBOL_COLOR,
3366 : : BASEPROPERTY_TABSTOP,
3367 : : BASEPROPERTY_VISIBLESIZE,
3368 : : BASEPROPERTY_WRITING_MODE,
3369 : : BASEPROPERTY_CONTEXT_WRITING_MODE,
3370 : 20 : 0);
3371 : 20 : VCLXWindow::ImplGetPropertyIds( rIds );
3372 : 20 : }
3373 : :
3374 [ + - ][ + - ]: 39 : VCLXScrollBar::VCLXScrollBar() : maAdjustmentListeners( *this )
3375 : : {
3376 : 39 : }
3377 : :
3378 : : // ::com::sun::star::uno::XInterface
3379 : 349 : ::com::sun::star::uno::Any VCLXScrollBar::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
3380 : : {
3381 : : ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
3382 [ + - ]: 349 : (static_cast< ::com::sun::star::awt::XScrollBar* >(this)) );
3383 [ + + ][ + - ]: 349 : return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
3384 : : }
3385 : :
3386 : : // ::com::sun::star::lang::XTypeProvider
3387 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_START( VCLXScrollBar )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
3388 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XScrollBar>* ) NULL ),
3389 : : VCLXWindow::getTypes()
3390 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_END
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
3391 : :
3392 : 32 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXScrollBar::CreateAccessibleContext()
3393 : : {
3394 : 32 : return getAccessibleFactory().createAccessibleContext( this );
3395 : : }
3396 : :
3397 : : // ::com::sun::star::lang::XComponent
3398 : 78 : void VCLXScrollBar::dispose() throw(::com::sun::star::uno::RuntimeException)
3399 : : {
3400 [ + - ]: 78 : SolarMutexGuard aGuard;
3401 : :
3402 [ + - ]: 78 : ::com::sun::star::lang::EventObject aObj;
3403 [ + - ]: 78 : aObj.Source = (::cppu::OWeakObject*)this;
3404 [ + - ]: 78 : maAdjustmentListeners.disposeAndClear( aObj );
3405 [ + - ][ + - ]: 78 : VCLXWindow::dispose();
[ + - ]
3406 : 78 : }
3407 : :
3408 : : // ::com::sun::star::awt::XScrollbar
3409 : 4 : void VCLXScrollBar::addAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3410 : : {
3411 [ + - ]: 4 : SolarMutexGuard aGuard;
3412 [ + - ][ + - ]: 4 : maAdjustmentListeners.addInterface( l );
3413 : 4 : }
3414 : :
3415 : 0 : void VCLXScrollBar::removeAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3416 : : {
3417 [ # # ]: 0 : SolarMutexGuard aGuard;
3418 [ # # ][ # # ]: 0 : maAdjustmentListeners.removeInterface( l );
3419 : 0 : }
3420 : :
3421 : 0 : void VCLXScrollBar::setValue( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3422 : : {
3423 [ # # ]: 0 : SolarMutexGuard aGuard;
3424 : :
3425 : 0 : ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3426 [ # # ]: 0 : if ( pScrollBar )
3427 [ # # ][ # # ]: 0 : pScrollBar->DoScroll( n );
3428 : 0 : }
3429 : :
3430 : 0 : void VCLXScrollBar::setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException)
3431 : : {
3432 [ # # ]: 0 : SolarMutexGuard aGuard;
3433 : :
3434 : 0 : ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3435 [ # # ]: 0 : if ( pScrollBar )
3436 : : {
3437 [ # # ]: 0 : pScrollBar->SetVisibleSize( nVisible );
3438 [ # # ]: 0 : pScrollBar->SetRangeMax( nMax );
3439 [ # # ]: 0 : pScrollBar->DoScroll( nValue );
3440 [ # # ]: 0 : }
3441 : 0 : }
3442 : :
3443 : 0 : sal_Int32 VCLXScrollBar::getValue() throw(::com::sun::star::uno::RuntimeException)
3444 : : {
3445 [ # # ]: 0 : SolarMutexGuard aGuard;
3446 : :
3447 : 0 : ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3448 [ # # ][ # # ]: 0 : return pScrollBar ? pScrollBar->GetThumbPos() : 0;
3449 : : }
3450 : :
3451 : 2 : void VCLXScrollBar::setMaximum( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3452 : : {
3453 [ + - ]: 2 : SolarMutexGuard aGuard;
3454 : :
3455 : 2 : ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3456 [ + - ]: 2 : if ( pScrollBar )
3457 [ + - ][ + - ]: 2 : pScrollBar->SetRangeMax( n );
3458 : 2 : }
3459 : :
3460 : 0 : sal_Int32 VCLXScrollBar::getMaximum() throw(::com::sun::star::uno::RuntimeException)
3461 : : {
3462 [ # # ]: 0 : SolarMutexGuard aGuard;
3463 : :
3464 : 0 : ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3465 [ # # ][ # # ]: 0 : return pScrollBar ? pScrollBar->GetRangeMax() : 0;
3466 : : }
3467 : :
3468 : 2 : void VCLXScrollBar::setMinimum( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3469 : : {
3470 [ + - ]: 2 : SolarMutexGuard aGuard;
3471 : :
3472 : 2 : ScrollBar* pScrollBar = static_cast< ScrollBar* >( GetWindow() );
3473 [ + - ]: 2 : if ( pScrollBar )
3474 [ + - ][ + - ]: 2 : pScrollBar->SetRangeMin( n );
3475 : 2 : }
3476 : :
3477 : 0 : sal_Int32 VCLXScrollBar::getMinimum() throw(::com::sun::star::uno::RuntimeException)
3478 : : {
3479 [ # # ]: 0 : SolarMutexGuard aGuard;
3480 : :
3481 : 0 : ScrollBar* pScrollBar = static_cast< ScrollBar* >( GetWindow() );
3482 [ # # ][ # # ]: 0 : return pScrollBar ? pScrollBar->GetRangeMin() : 0;
3483 : : }
3484 : :
3485 : 2 : void VCLXScrollBar::setLineIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3486 : : {
3487 [ + - ]: 2 : SolarMutexGuard aGuard;
3488 : :
3489 : 2 : ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3490 [ + - ]: 2 : if ( pScrollBar )
3491 [ + - ]: 2 : pScrollBar->SetLineSize( n );
3492 : 2 : }
3493 : :
3494 : 0 : sal_Int32 VCLXScrollBar::getLineIncrement() throw(::com::sun::star::uno::RuntimeException)
3495 : : {
3496 [ # # ]: 0 : SolarMutexGuard aGuard;
3497 : :
3498 : 0 : ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3499 [ # # ][ # # ]: 0 : return pScrollBar ? pScrollBar->GetLineSize() : 0;
3500 : : }
3501 : :
3502 : 2 : void VCLXScrollBar::setBlockIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3503 : : {
3504 [ + - ]: 2 : SolarMutexGuard aGuard;
3505 : :
3506 : 2 : ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3507 [ + - ]: 2 : if ( pScrollBar )
3508 [ + - ]: 2 : pScrollBar->SetPageSize( n );
3509 : 2 : }
3510 : :
3511 : 0 : sal_Int32 VCLXScrollBar::getBlockIncrement() throw(::com::sun::star::uno::RuntimeException)
3512 : : {
3513 [ # # ]: 0 : SolarMutexGuard aGuard;
3514 : :
3515 : 0 : ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3516 [ # # ][ # # ]: 0 : return pScrollBar ? pScrollBar->GetPageSize() : 0;
3517 : : }
3518 : :
3519 : 0 : void VCLXScrollBar::setVisibleSize( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3520 : : {
3521 [ # # ]: 0 : SolarMutexGuard aGuard;
3522 : :
3523 : 0 : ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3524 [ # # ]: 0 : if ( pScrollBar )
3525 [ # # ][ # # ]: 0 : pScrollBar->SetVisibleSize( n );
3526 : 0 : }
3527 : :
3528 : 0 : sal_Int32 VCLXScrollBar::getVisibleSize() throw(::com::sun::star::uno::RuntimeException)
3529 : : {
3530 [ # # ]: 0 : SolarMutexGuard aGuard;
3531 : :
3532 : 0 : ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3533 [ # # ][ # # ]: 0 : return pScrollBar ? pScrollBar->GetVisibleSize() : 0;
3534 : : }
3535 : :
3536 : 2 : void VCLXScrollBar::setOrientation( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3537 : : {
3538 [ + - ]: 2 : SolarMutexGuard aGuard;
3539 : :
3540 : 2 : Window* pWindow = GetWindow();
3541 [ + - ]: 2 : if ( pWindow )
3542 : : {
3543 [ + - ]: 2 : WinBits nStyle = pWindow->GetStyle();
3544 : 2 : nStyle &= ~(WB_HORZ|WB_VERT);
3545 [ + - ]: 2 : if ( n == ::com::sun::star::awt::ScrollBarOrientation::HORIZONTAL )
3546 : 2 : nStyle |= WB_HORZ;
3547 : : else
3548 : 0 : nStyle |= WB_VERT;
3549 : :
3550 [ + - ]: 2 : pWindow->SetStyle( nStyle );
3551 [ + - ]: 2 : pWindow->Resize();
3552 [ + - ]: 2 : }
3553 : 2 : }
3554 : :
3555 : 49 : sal_Int32 VCLXScrollBar::getOrientation() throw(::com::sun::star::uno::RuntimeException)
3556 : : {
3557 [ + - ]: 49 : SolarMutexGuard aGuard;
3558 : :
3559 : 49 : sal_Int32 n = 0;
3560 : 49 : Window* pWindow = GetWindow();
3561 [ + - ]: 49 : if ( pWindow )
3562 : : {
3563 [ + - ]: 49 : WinBits nStyle = pWindow->GetStyle();
3564 [ + + ]: 49 : if ( nStyle & WB_HORZ )
3565 : 19 : n = ::com::sun::star::awt::ScrollBarOrientation::HORIZONTAL;
3566 : : else
3567 : 30 : n = ::com::sun::star::awt::ScrollBarOrientation::VERTICAL;
3568 : : }
3569 [ + - ]: 49 : return n;
3570 : :
3571 : : }
3572 : :
3573 : : // ::com::sun::star::awt::VclWindowPeer
3574 : 60 : void VCLXScrollBar::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
3575 : : {
3576 [ + - ]: 60 : SolarMutexGuard aGuard;
3577 : :
3578 : 60 : ScrollBar* pScrollBar = (ScrollBar*)GetWindow();
3579 [ + - ]: 60 : if ( pScrollBar )
3580 : : {
3581 : 60 : sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
3582 : :
3583 [ + - ]: 60 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
3584 [ + + + + : 60 : switch ( nPropType )
+ + + +
+ ]
3585 : : {
3586 : : case BASEPROPERTY_LIVE_SCROLL:
3587 : : {
3588 : 2 : sal_Bool bDo = sal_False;
3589 [ + - ]: 2 : if ( !bVoid )
3590 : : {
3591 : 2 : OSL_VERIFY( Value >>= bDo );
3592 : : }
3593 [ + - ]: 2 : AllSettings aSettings( pScrollBar->GetSettings() );
3594 [ + - ]: 2 : StyleSettings aStyle( aSettings.GetStyleSettings() );
3595 : 2 : sal_uLong nDragOptions = aStyle.GetDragFullOptions();
3596 [ - + ]: 2 : if ( bDo )
3597 : 0 : nDragOptions |= DRAGFULL_OPTION_SCROLL;
3598 : : else
3599 : 2 : nDragOptions &= ~DRAGFULL_OPTION_SCROLL;
3600 [ + - ]: 2 : aStyle.SetDragFullOptions( nDragOptions );
3601 [ + - ]: 2 : aSettings.SetStyleSettings( aStyle );
3602 [ + - ][ + - ]: 2 : pScrollBar->SetSettings( aSettings );
[ + - ]
3603 : : }
3604 : 2 : break;
3605 : :
3606 : : case BASEPROPERTY_SCROLLVALUE:
3607 : : {
3608 [ - + ]: 2 : if ( !bVoid )
3609 : : {
3610 : 0 : sal_Int32 n = 0;
3611 [ # # ]: 0 : if ( Value >>= n )
3612 [ # # ]: 0 : setValue( n );
3613 : : }
3614 : : }
3615 : 2 : break;
3616 : : case BASEPROPERTY_SCROLLVALUE_MAX:
3617 : : case BASEPROPERTY_SCROLLVALUE_MIN:
3618 : : {
3619 [ + - ]: 4 : if ( !bVoid )
3620 : : {
3621 : 4 : sal_Int32 n = 0;
3622 [ + - ]: 4 : if ( Value >>= n )
3623 : : {
3624 [ + + ]: 4 : if ( nPropType == BASEPROPERTY_SCROLLVALUE_MAX )
3625 [ + - ]: 2 : setMaximum( n );
3626 : : else
3627 [ + - ]: 4 : setMinimum( n );
3628 : : }
3629 : : }
3630 : : }
3631 : 4 : break;
3632 : : case BASEPROPERTY_LINEINCREMENT:
3633 : : {
3634 [ + - ]: 2 : if ( !bVoid )
3635 : : {
3636 : 2 : sal_Int32 n = 0;
3637 [ + - ]: 2 : if ( Value >>= n )
3638 [ + - ]: 2 : setLineIncrement( n );
3639 : : }
3640 : : }
3641 : 2 : break;
3642 : : case BASEPROPERTY_BLOCKINCREMENT:
3643 : : {
3644 [ + - ]: 2 : if ( !bVoid )
3645 : : {
3646 : 2 : sal_Int32 n = 0;
3647 [ + - ]: 2 : if ( Value >>= n )
3648 [ + - ]: 2 : setBlockIncrement( n );
3649 : : }
3650 : : }
3651 : 2 : break;
3652 : : case BASEPROPERTY_VISIBLESIZE:
3653 : : {
3654 [ - + ]: 2 : if ( !bVoid )
3655 : : {
3656 : 0 : sal_Int32 n = 0;
3657 [ # # ]: 0 : if ( Value >>= n )
3658 [ # # ]: 0 : setVisibleSize( n );
3659 : : }
3660 : : }
3661 : 2 : break;
3662 : : case BASEPROPERTY_ORIENTATION:
3663 : : {
3664 [ + - ]: 2 : if ( !bVoid )
3665 : : {
3666 : 2 : sal_Int32 n = 0;
3667 [ + - ]: 2 : if ( Value >>= n )
3668 [ + - ]: 2 : setOrientation( n );
3669 : : }
3670 : : }
3671 : 2 : break;
3672 : :
3673 : : case BASEPROPERTY_BACKGROUNDCOLOR:
3674 : : {
3675 : : // the default implementation of the base class doesn't work here, since our
3676 : : // interpretation for this property is slightly different
3677 [ + - ]: 2 : ::toolkit::setButtonLikeFaceColor( pScrollBar, Value);
3678 : : }
3679 : 2 : break;
3680 : :
3681 : : default:
3682 : : {
3683 [ + - ]: 60 : VCLXWindow::setProperty( PropertyName, Value );
3684 : : }
3685 : : }
3686 [ + - ]: 60 : }
3687 : 60 : }
3688 : :
3689 : 0 : ::com::sun::star::uno::Any VCLXScrollBar::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
3690 : : {
3691 [ # # ]: 0 : SolarMutexGuard aGuard;
3692 : :
3693 : 0 : ::com::sun::star::uno::Any aProp;
3694 : 0 : ScrollBar* pScrollBar = (ScrollBar*)GetWindow();
3695 [ # # ]: 0 : if ( pScrollBar )
3696 : : {
3697 [ # # ]: 0 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
3698 : :
3699 [ # # # # : 0 : switch ( nPropType )
# # # # #
# ]
3700 : : {
3701 : : case BASEPROPERTY_LIVE_SCROLL:
3702 : : {
3703 [ # # ]: 0 : aProp <<= (sal_Bool)( 0 != ( pScrollBar->GetSettings().GetStyleSettings().GetDragFullOptions() & DRAGFULL_OPTION_SCROLL ) );
3704 : : }
3705 : 0 : break;
3706 : : case BASEPROPERTY_SCROLLVALUE:
3707 : : {
3708 [ # # ][ # # ]: 0 : aProp <<= (sal_Int32) getValue();
3709 : : }
3710 : 0 : break;
3711 : : case BASEPROPERTY_SCROLLVALUE_MAX:
3712 : : {
3713 [ # # ][ # # ]: 0 : aProp <<= (sal_Int32) getMaximum();
3714 : : }
3715 : 0 : break;
3716 : : case BASEPROPERTY_SCROLLVALUE_MIN:
3717 : : {
3718 [ # # ][ # # ]: 0 : aProp <<= (sal_Int32) getMinimum();
3719 : : }
3720 : 0 : break;
3721 : : case BASEPROPERTY_LINEINCREMENT:
3722 : : {
3723 [ # # ][ # # ]: 0 : aProp <<= (sal_Int32) getLineIncrement();
3724 : : }
3725 : 0 : break;
3726 : : case BASEPROPERTY_BLOCKINCREMENT:
3727 : : {
3728 [ # # ][ # # ]: 0 : aProp <<= (sal_Int32) getBlockIncrement();
3729 : : }
3730 : 0 : break;
3731 : : case BASEPROPERTY_VISIBLESIZE:
3732 : : {
3733 [ # # ][ # # ]: 0 : aProp <<= (sal_Int32) getVisibleSize();
3734 : : }
3735 : 0 : break;
3736 : : case BASEPROPERTY_ORIENTATION:
3737 : : {
3738 [ # # ][ # # ]: 0 : aProp <<= (sal_Int32) getOrientation();
3739 : : }
3740 : 0 : break;
3741 : : case BASEPROPERTY_BACKGROUNDCOLOR:
3742 : : {
3743 : : // the default implementation of the base class doesn't work here, since our
3744 : : // interpretation for this property is slightly different
3745 [ # # ]: 0 : aProp = ::toolkit::getButtonLikeFaceColor( pScrollBar );
3746 : : }
3747 : 0 : break;
3748 : :
3749 : : default:
3750 : : {
3751 [ # # ][ # # ]: 0 : aProp <<= VCLXWindow::getProperty( PropertyName );
3752 : : }
3753 : : }
3754 : : }
3755 [ # # ]: 0 : return aProp;
3756 : : }
3757 : :
3758 : 113 : void VCLXScrollBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
3759 : : {
3760 [ + + ]: 113 : switch ( rVclWindowEvent.GetId() )
3761 : : {
3762 : : case VCLEVENT_SCROLLBAR_SCROLL:
3763 : : {
3764 [ + - ]: 4 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
3765 : : // since we call listeners below, there is a potential that we will be destroyed
3766 : : // in during the listener call. To prevent the resulting crashs, we keep us
3767 : : // alive as long as we're here
3768 : :
3769 [ + - ][ - + ]: 4 : if ( maAdjustmentListeners.getLength() )
3770 : : {
3771 : 0 : ScrollBar* pScrollBar = (ScrollBar*)GetWindow();
3772 : :
3773 [ # # ]: 0 : if( pScrollBar )
3774 : : {
3775 [ # # ]: 0 : ::com::sun::star::awt::AdjustmentEvent aEvent;
3776 [ # # ]: 0 : aEvent.Source = (::cppu::OWeakObject*)this;
3777 : 0 : aEvent.Value = pScrollBar->GetThumbPos();
3778 : :
3779 : : // set adjustment type
3780 : 0 : ScrollType aType = pScrollBar->GetType();
3781 [ # # ][ # # ]: 0 : if ( aType == SCROLL_LINEUP || aType == SCROLL_LINEDOWN )
3782 : : {
3783 : 0 : aEvent.Type = ::com::sun::star::awt::AdjustmentType_ADJUST_LINE;
3784 : : }
3785 [ # # ][ # # ]: 0 : else if ( aType == SCROLL_PAGEUP || aType == SCROLL_PAGEDOWN )
3786 : : {
3787 : 0 : aEvent.Type = ::com::sun::star::awt::AdjustmentType_ADJUST_PAGE;
3788 : : }
3789 [ # # ]: 0 : else if ( aType == SCROLL_DRAG )
3790 : : {
3791 : 0 : aEvent.Type = ::com::sun::star::awt::AdjustmentType_ADJUST_ABS;
3792 : : }
3793 : :
3794 [ # # ][ # # ]: 0 : maAdjustmentListeners.adjustmentValueChanged( aEvent );
3795 : : }
3796 : 4 : }
3797 : : }
3798 : 4 : break;
3799 : :
3800 : : default:
3801 : 109 : VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
3802 : 109 : break;
3803 : : }
3804 : 113 : }
3805 : :
3806 : 0 : ::com::sun::star::awt::Size SAL_CALL VCLXScrollBar::implGetMinimumSize( Window* p ) throw(::com::sun::star::uno::RuntimeException)
3807 : : {
3808 : 0 : long n = p->GetSettings().GetStyleSettings().GetScrollBarSize();
3809 : 0 : return ::com::sun::star::awt::Size( n, n );
3810 : : }
3811 : :
3812 : 0 : ::com::sun::star::awt::Size SAL_CALL VCLXScrollBar::getMinimumSize() throw(::com::sun::star::uno::RuntimeException)
3813 : : {
3814 [ # # ]: 0 : SolarMutexGuard aGuard;
3815 [ # # ]: 0 : return implGetMinimumSize( GetWindow() );
3816 : : }
3817 : :
3818 : :
3819 : : // ----------------------------------------------------
3820 : : // class VCLXEdit
3821 : : // ----------------------------------------------------
3822 : :
3823 : 16 : void VCLXEdit::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
3824 : : {
3825 : : PushPropertyIds( rIds,
3826 : : BASEPROPERTY_ALIGN,
3827 : : BASEPROPERTY_BACKGROUNDCOLOR,
3828 : : BASEPROPERTY_BORDER,
3829 : : BASEPROPERTY_BORDERCOLOR,
3830 : : BASEPROPERTY_DEFAULTCONTROL,
3831 : : BASEPROPERTY_ECHOCHAR,
3832 : : BASEPROPERTY_ENABLED,
3833 : : BASEPROPERTY_ENABLEVISIBLE,
3834 : : BASEPROPERTY_FONTDESCRIPTOR,
3835 : : BASEPROPERTY_HARDLINEBREAKS,
3836 : : BASEPROPERTY_HELPTEXT,
3837 : : BASEPROPERTY_HELPURL,
3838 : : BASEPROPERTY_HSCROLL,
3839 : : BASEPROPERTY_LINE_END_FORMAT,
3840 : : BASEPROPERTY_MAXTEXTLEN,
3841 : : BASEPROPERTY_MULTILINE,
3842 : : BASEPROPERTY_PRINTABLE,
3843 : : BASEPROPERTY_READONLY,
3844 : : BASEPROPERTY_TABSTOP,
3845 : : BASEPROPERTY_TEXT,
3846 : : BASEPROPERTY_VSCROLL,
3847 : : BASEPROPERTY_HIDEINACTIVESELECTION,
3848 : : BASEPROPERTY_PAINTTRANSPARENT,
3849 : : BASEPROPERTY_AUTOHSCROLL,
3850 : : BASEPROPERTY_AUTOVSCROLL,
3851 : : BASEPROPERTY_VERTICALALIGN,
3852 : : BASEPROPERTY_WRITING_MODE,
3853 : : BASEPROPERTY_CONTEXT_WRITING_MODE,
3854 : 16 : 0);
3855 : 16 : VCLXWindow::ImplGetPropertyIds( rIds );
3856 : 16 : }
3857 : :
3858 [ + - ][ + - ]: 3347 : VCLXEdit::VCLXEdit() : maTextListeners( *this )
3859 : : {
3860 : 3347 : }
3861 : :
3862 : : // ::com::sun::star::uno::XInterface
3863 : 55752 : ::com::sun::star::uno::Any VCLXEdit::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
3864 : : {
3865 : : ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
3866 : : (static_cast< ::com::sun::star::awt::XTextComponent* >(this)),
3867 : : (static_cast< ::com::sun::star::awt::XTextEditField* >(this)),
3868 [ + - ]: 55752 : (static_cast< ::com::sun::star::awt::XTextLayoutConstrains* >(this)) );
3869 [ + + ][ + - ]: 55752 : return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
3870 : : }
3871 : :
3872 : : // ::com::sun::star::lang::XTypeProvider
3873 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_START( VCLXEdit )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
3874 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent>* ) NULL ),
3875 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextEditField>* ) NULL ),
3876 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ),
3877 : : VCLXWindow::getTypes()
3878 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_END
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
3879 : :
3880 : 12 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXEdit::CreateAccessibleContext()
3881 : : {
3882 : 12 : return getAccessibleFactory().createAccessibleContext( this );
3883 : : }
3884 : :
3885 : 3698 : void VCLXEdit::dispose() throw(::com::sun::star::uno::RuntimeException)
3886 : : {
3887 [ + - ]: 3698 : SolarMutexGuard aGuard;
3888 : :
3889 [ + - ]: 3698 : ::com::sun::star::lang::EventObject aObj;
3890 [ + - ]: 3698 : aObj.Source = (::cppu::OWeakObject*)this;
3891 [ + - ]: 3698 : maTextListeners.disposeAndClear( aObj );
3892 [ + - ][ + - ]: 3698 : VCLXWindow::dispose();
[ + - ]
3893 : 3698 : }
3894 : :
3895 : 349 : void VCLXEdit::addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3896 : : {
3897 [ + - ]: 349 : SolarMutexGuard aGuard;
3898 [ + - ][ + - ]: 349 : GetTextListeners().addInterface( l );
3899 : 349 : }
3900 : :
3901 : 0 : void VCLXEdit::removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3902 : : {
3903 [ # # ]: 0 : SolarMutexGuard aGuard;
3904 [ # # ][ # # ]: 0 : GetTextListeners().removeInterface( l );
3905 : 0 : }
3906 : :
3907 : 557 : void VCLXEdit::setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
3908 : : {
3909 [ + - ]: 557 : SolarMutexGuard aGuard;
3910 : :
3911 : 557 : Edit* pEdit = (Edit*)GetWindow();
3912 [ + - ]: 557 : if ( pEdit )
3913 : : {
3914 [ + - ][ + - ]: 557 : pEdit->SetText( aText );
[ + - ]
3915 : :
3916 : : // #107218# Call same listeners like VCL would do after user interaction
3917 [ + - ]: 557 : SetSynthesizingVCLEvent( sal_True );
3918 [ + - ]: 557 : pEdit->SetModifyFlag();
3919 [ + - ]: 557 : pEdit->Modify();
3920 [ + - ]: 557 : SetSynthesizingVCLEvent( sal_False );
3921 [ + - ]: 557 : }
3922 : 557 : }
3923 : :
3924 : 0 : void VCLXEdit::insertText( const ::com::sun::star::awt::Selection& rSel, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
3925 : : {
3926 [ # # ]: 0 : SolarMutexGuard aGuard;
3927 : :
3928 : 0 : Edit* pEdit = (Edit*)GetWindow();
3929 [ # # ]: 0 : if ( pEdit )
3930 : : {
3931 [ # # ]: 0 : pEdit->SetSelection( Selection( rSel.Min, rSel.Max ) );
3932 [ # # ][ # # ]: 0 : pEdit->ReplaceSelected( aText );
[ # # ]
3933 : :
3934 : : // #107218# Call same listeners like VCL would do after user interaction
3935 [ # # ]: 0 : SetSynthesizingVCLEvent( sal_True );
3936 [ # # ]: 0 : pEdit->SetModifyFlag();
3937 [ # # ]: 0 : pEdit->Modify();
3938 [ # # ]: 0 : SetSynthesizingVCLEvent( sal_False );
3939 [ # # ]: 0 : }
3940 : 0 : }
3941 : :
3942 : 48 : ::rtl::OUString VCLXEdit::getText() throw(::com::sun::star::uno::RuntimeException)
3943 : : {
3944 [ + - ]: 48 : SolarMutexGuard aGuard;
3945 : :
3946 : 48 : ::rtl::OUString aText;
3947 : 48 : Window* pWindow = GetWindow();
3948 [ + - ]: 48 : if ( pWindow )
3949 [ + - ][ + - ]: 48 : aText = pWindow->GetText();
[ + - ]
3950 [ + - ]: 48 : return aText;
3951 : : }
3952 : :
3953 : 30 : ::rtl::OUString VCLXEdit::getSelectedText() throw(::com::sun::star::uno::RuntimeException)
3954 : : {
3955 [ + - ]: 30 : SolarMutexGuard aGuard;
3956 : :
3957 : 30 : ::rtl::OUString aText;
3958 : 30 : Edit* pEdit = (Edit*) GetWindow();
3959 [ + - ]: 30 : if ( pEdit)
3960 [ + - ][ + - ]: 30 : aText = pEdit->GetSelected();
[ + - ]
3961 [ + - ]: 30 : return aText;
3962 : :
3963 : : }
3964 : :
3965 : 120 : void VCLXEdit::setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException)
3966 : : {
3967 [ + - ]: 120 : SolarMutexGuard aGuard;
3968 : :
3969 : 120 : Edit* pEdit = (Edit*) GetWindow();
3970 [ + - ]: 120 : if ( pEdit )
3971 [ + - ][ + - ]: 120 : pEdit->SetSelection( Selection( aSelection.Min, aSelection.Max ) );
3972 : 120 : }
3973 : :
3974 : 114 : ::com::sun::star::awt::Selection VCLXEdit::getSelection() throw(::com::sun::star::uno::RuntimeException)
3975 : : {
3976 [ + - ]: 114 : SolarMutexGuard aGuard;
3977 : :
3978 : 114 : Selection aSel;
3979 : 114 : Edit* pEdit = (Edit*) GetWindow();
3980 [ + - ]: 114 : if ( pEdit )
3981 [ + - ]: 114 : aSel = pEdit->GetSelection();
3982 [ + - ]: 114 : return ::com::sun::star::awt::Selection( aSel.Min(), aSel.Max() );
3983 : : }
3984 : :
3985 : 18 : sal_Bool VCLXEdit::isEditable() throw(::com::sun::star::uno::RuntimeException)
3986 : : {
3987 [ + - ]: 18 : SolarMutexGuard aGuard;
3988 : :
3989 : 18 : Edit* pEdit = (Edit*) GetWindow();
3990 [ + - ][ + - ]: 18 : return ( pEdit && !pEdit->IsReadOnly() && pEdit->IsEnabled() ) ? sal_True : sal_False;
[ + - ][ + - ]
[ + - ][ + - ]
3991 : : }
3992 : :
3993 : 32 : void VCLXEdit::setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException)
3994 : : {
3995 [ + - ]: 32 : SolarMutexGuard aGuard;
3996 : :
3997 : 32 : Edit* pEdit = (Edit*) GetWindow();
3998 [ + - ]: 32 : if ( pEdit )
3999 [ + - ][ + - ]: 32 : pEdit->SetReadOnly( !bEditable );
4000 : 32 : }
4001 : :
4002 : :
4003 : 32 : void VCLXEdit::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException)
4004 : : {
4005 [ + - ]: 32 : SolarMutexGuard aGuard;
4006 : :
4007 : 32 : Edit* pEdit = (Edit*) GetWindow();
4008 [ + - ]: 32 : if ( pEdit )
4009 [ + - ][ + - ]: 32 : pEdit->SetMaxTextLen( nLen );
4010 : 32 : }
4011 : :
4012 : 0 : sal_Int16 VCLXEdit::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException)
4013 : : {
4014 [ # # ]: 0 : SolarMutexGuard aGuard;
4015 : :
4016 : 0 : Edit* pEdit = (Edit*) GetWindow();
4017 [ # # ][ # # ]: 0 : return pEdit ? pEdit->GetMaxTextLen() : 0;
[ # # ]
4018 : : }
4019 : :
4020 : 0 : void VCLXEdit::setEchoChar( sal_Unicode cEcho ) throw(::com::sun::star::uno::RuntimeException)
4021 : : {
4022 [ # # ]: 0 : SolarMutexGuard aGuard;
4023 : :
4024 : 0 : Edit* pEdit = (Edit*) GetWindow();
4025 [ # # ]: 0 : if ( pEdit )
4026 [ # # ][ # # ]: 0 : pEdit->SetEchoChar( cEcho );
4027 : 0 : }
4028 : :
4029 : 28569 : void VCLXEdit::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
4030 : : {
4031 [ + - ]: 28569 : SolarMutexGuard aGuard;
4032 : :
4033 : 28569 : Edit* pEdit = (Edit*)GetWindow();
4034 [ + - ]: 28569 : if ( pEdit )
4035 : : {
4036 [ + - ]: 28569 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
4037 [ + + + + : 28569 : switch ( nPropType )
+ ]
4038 : : {
4039 : : case BASEPROPERTY_HIDEINACTIVESELECTION:
4040 [ + - ]: 421 : ::toolkit::adjustBooleanWindowStyle( Value, pEdit, WB_NOHIDESELECTION, sal_True );
4041 [ + + ]: 421 : if ( pEdit->GetSubEdit() )
4042 [ + - ]: 152 : ::toolkit::adjustBooleanWindowStyle( Value, pEdit->GetSubEdit(), WB_NOHIDESELECTION, sal_True );
4043 : 421 : break;
4044 : :
4045 : : case BASEPROPERTY_READONLY:
4046 : : {
4047 : 481 : sal_Bool b = sal_Bool();
4048 [ + - ]: 481 : if ( Value >>= b )
4049 [ + - ]: 481 : pEdit->SetReadOnly( b );
4050 : : }
4051 : 481 : break;
4052 : : case BASEPROPERTY_ECHOCHAR:
4053 : : {
4054 : 109 : sal_Int16 n = sal_Int16();
4055 [ + - ]: 109 : if ( Value >>= n )
4056 [ + - ]: 109 : pEdit->SetEchoChar( n );
4057 : : }
4058 : 109 : break;
4059 : : case BASEPROPERTY_MAXTEXTLEN:
4060 : : {
4061 : 231 : sal_Int16 n = sal_Int16();
4062 [ + - ]: 231 : if ( Value >>= n )
4063 [ + - ]: 231 : pEdit->SetMaxTextLen( n );
4064 : : }
4065 : 231 : break;
4066 : : default:
4067 : : {
4068 [ + - ]: 28569 : VCLXWindow::setProperty( PropertyName, Value );
4069 : : }
4070 : : }
4071 [ + - ]: 28569 : }
4072 : 28569 : }
4073 : :
4074 : 96 : ::com::sun::star::uno::Any VCLXEdit::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
4075 : : {
4076 [ + - ]: 96 : SolarMutexGuard aGuard;
4077 : :
4078 : 96 : ::com::sun::star::uno::Any aProp;
4079 : 96 : Edit* pEdit = (Edit*)GetWindow();
4080 [ + - ]: 96 : if ( pEdit )
4081 : : {
4082 [ + - ]: 96 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
4083 [ - - - - : 96 : switch ( nPropType )
+ ]
4084 : : {
4085 : : case BASEPROPERTY_HIDEINACTIVESELECTION:
4086 [ # # ][ # # ]: 0 : aProp <<= (sal_Bool)( ( pEdit->GetStyle() & WB_NOHIDESELECTION ) == 0 );
4087 : 0 : break;
4088 : : case BASEPROPERTY_READONLY:
4089 [ # # ][ # # ]: 0 : aProp <<= (sal_Bool) pEdit->IsReadOnly();
4090 : 0 : break;
4091 : : case BASEPROPERTY_ECHOCHAR:
4092 [ # # ]: 0 : aProp <<= (sal_Int16) pEdit->GetEchoChar();
4093 : 0 : break;
4094 : : case BASEPROPERTY_MAXTEXTLEN:
4095 [ # # ][ # # ]: 0 : aProp <<= (sal_Int16) pEdit->GetMaxTextLen();
4096 : 0 : break;
4097 : : default:
4098 : : {
4099 [ + - ]: 96 : aProp = VCLXWindow::getProperty( PropertyName );
4100 : : }
4101 : : }
4102 : : }
4103 [ + - ]: 96 : return aProp;
4104 : : }
4105 : :
4106 : 52 : ::com::sun::star::awt::Size VCLXEdit::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
4107 : : {
4108 [ + - ]: 52 : SolarMutexGuard aGuard;
4109 : :
4110 : 52 : Size aSz;
4111 : 52 : Edit* pEdit = (Edit*) GetWindow();
4112 [ + - ]: 52 : if ( pEdit )
4113 [ + - ]: 52 : aSz = pEdit->CalcMinimumSize();
4114 [ + - ]: 52 : return AWTSize(aSz);
4115 : : }
4116 : :
4117 : 26 : ::com::sun::star::awt::Size VCLXEdit::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
4118 : : {
4119 [ + - ]: 26 : SolarMutexGuard aGuard;
4120 : :
4121 : 26 : Size aSz;
4122 : 26 : Edit* pEdit = (Edit*) GetWindow();
4123 [ + - ]: 26 : if ( pEdit )
4124 : : {
4125 [ + - ]: 26 : aSz = pEdit->CalcMinimumSize();
4126 : 26 : aSz.Height() += 4;
4127 : : }
4128 [ + - ]: 26 : return AWTSize(aSz);
4129 : : }
4130 : :
4131 : 26 : ::com::sun::star::awt::Size VCLXEdit::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
4132 : : {
4133 [ + - ]: 26 : SolarMutexGuard aGuard;
4134 : :
4135 : 26 : ::com::sun::star::awt::Size aSz = rNewSize;
4136 [ + - ]: 26 : ::com::sun::star::awt::Size aMinSz = getMinimumSize();
4137 [ + - ]: 26 : if ( aSz.Height != aMinSz.Height )
4138 : 26 : aSz.Height = aMinSz.Height;
4139 : :
4140 [ + - ]: 26 : return aSz;
4141 : : }
4142 : :
4143 : 26 : ::com::sun::star::awt::Size VCLXEdit::getMinimumSize( sal_Int16 nCols, sal_Int16 ) throw(::com::sun::star::uno::RuntimeException)
4144 : : {
4145 [ + - ]: 26 : SolarMutexGuard aGuard;
4146 : :
4147 : 26 : Size aSz;
4148 : 26 : Edit* pEdit = (Edit*) GetWindow();
4149 [ + - ]: 26 : if ( pEdit )
4150 : : {
4151 [ - + ]: 26 : if ( nCols )
4152 [ # # ]: 0 : aSz = pEdit->CalcSize( nCols );
4153 : : else
4154 [ + - ]: 26 : aSz = pEdit->CalcMinimumSize();
4155 : : }
4156 [ + - ]: 26 : return AWTSize(aSz);
4157 : : }
4158 : :
4159 : 26 : void VCLXEdit::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
4160 : : {
4161 [ + - ]: 26 : SolarMutexGuard aGuard;
4162 : :
4163 : 26 : nLines = 1;
4164 : 26 : nCols = 0;
4165 : 26 : Edit* pEdit = (Edit*) GetWindow();
4166 [ + - ]: 26 : if ( pEdit )
4167 [ + - ][ + - ]: 26 : nCols = pEdit->GetMaxVisChars();
4168 : 26 : }
4169 : :
4170 : 144082 : void VCLXEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
4171 : : {
4172 [ + + ]: 144082 : switch ( rVclWindowEvent.GetId() )
4173 : : {
4174 : : case VCLEVENT_EDIT_MODIFY:
4175 : : {
4176 [ + - ]: 328 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
4177 : : // since we call listeners below, there is a potential that we will be destroyed
4178 : : // during the listener call. To prevent the resulting crashs, we keep us
4179 : : // alive as long as we're here
4180 : :
4181 [ + - ][ + - ]: 328 : if ( GetTextListeners().getLength() )
4182 : : {
4183 [ + - ]: 328 : ::com::sun::star::awt::TextEvent aEvent;
4184 [ + - ]: 328 : aEvent.Source = (::cppu::OWeakObject*)this;
4185 [ + - ][ + - ]: 328 : GetTextListeners().textChanged( aEvent );
4186 : 328 : }
4187 : : }
4188 : 328 : break;
4189 : :
4190 : : default:
4191 : 143754 : VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
4192 : 143754 : break;
4193 : : }
4194 : 144082 : }
4195 : :
4196 : : // ----------------------------------------------------
4197 : : // class VCLXComboBox
4198 : : // ----------------------------------------------------
4199 : :
4200 : 27 : void VCLXComboBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
4201 : : {
4202 : : PushPropertyIds( rIds,
4203 : : BASEPROPERTY_AUTOCOMPLETE,
4204 : : BASEPROPERTY_BACKGROUNDCOLOR,
4205 : : BASEPROPERTY_BORDER,
4206 : : BASEPROPERTY_BORDERCOLOR,
4207 : : BASEPROPERTY_DEFAULTCONTROL,
4208 : : BASEPROPERTY_DROPDOWN,
4209 : : BASEPROPERTY_ENABLED,
4210 : : BASEPROPERTY_ENABLEVISIBLE,
4211 : : BASEPROPERTY_FONTDESCRIPTOR,
4212 : : BASEPROPERTY_HELPTEXT,
4213 : : BASEPROPERTY_HELPURL,
4214 : : BASEPROPERTY_LINECOUNT,
4215 : : BASEPROPERTY_MAXTEXTLEN,
4216 : : BASEPROPERTY_PRINTABLE,
4217 : : BASEPROPERTY_READONLY,
4218 : : BASEPROPERTY_STRINGITEMLIST,
4219 : : BASEPROPERTY_TABSTOP,
4220 : : BASEPROPERTY_TEXT,
4221 : : BASEPROPERTY_HIDEINACTIVESELECTION,
4222 : : BASEPROPERTY_ALIGN,
4223 : : BASEPROPERTY_WRITING_MODE,
4224 : : BASEPROPERTY_CONTEXT_WRITING_MODE,
4225 : : BASEPROPERTY_REFERENCE_DEVICE,
4226 : : BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
4227 : 27 : 0);
4228 : : // no, don't call VCLXEdit here - it has properties which we do *not* want to have at at combo box
4229 : : // #i92690# / 2008-08-12 / frank.schoenheit@sun.com
4230 : : // VCLXEdit::ImplGetPropertyIds( rIds );
4231 : 27 : VCLXWindow::ImplGetPropertyIds( rIds );
4232 : 27 : }
4233 : :
4234 : 2929 : VCLXComboBox::VCLXComboBox()
4235 [ + - ][ + - ]: 2929 : : maActionListeners( *this ), maItemListeners( *this )
4236 : : {
4237 : 2929 : }
4238 : :
4239 [ + - ][ + - ]: 2892 : VCLXComboBox::~VCLXComboBox()
4240 : : {
4241 : : #ifndef __SUNPRO_CC
4242 : : OSL_TRACE ("%s", __FUNCTION__);
4243 : : #endif
4244 [ - + ]: 5784 : }
4245 : :
4246 : 10 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXComboBox::CreateAccessibleContext()
4247 : : {
4248 [ + - ]: 10 : SolarMutexGuard aGuard;
4249 : :
4250 [ + - ][ + - ]: 10 : return getAccessibleFactory().createAccessibleContext( this );
[ + - ]
4251 : : }
4252 : :
4253 : 2977 : void VCLXComboBox::dispose() throw(::com::sun::star::uno::RuntimeException)
4254 : : {
4255 [ + - ]: 2977 : SolarMutexGuard aGuard;
4256 : :
4257 [ + - ]: 2977 : ::com::sun::star::lang::EventObject aObj;
4258 [ + - ]: 2977 : aObj.Source = (::cppu::OWeakObject*)this;
4259 [ + - ]: 2977 : maItemListeners.disposeAndClear( aObj );
4260 [ + - ]: 2977 : maActionListeners.disposeAndClear( aObj );
4261 [ + - ][ + - ]: 2977 : VCLXEdit::dispose();
[ + - ]
4262 : 2977 : }
4263 : :
4264 : :
4265 : 4 : void VCLXComboBox::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
4266 : : {
4267 [ + - ]: 4 : SolarMutexGuard aGuard;
4268 [ + - ][ + - ]: 4 : maItemListeners.addInterface( l );
4269 : 4 : }
4270 : :
4271 : 0 : void VCLXComboBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
4272 : : {
4273 [ # # ]: 0 : SolarMutexGuard aGuard;
4274 [ # # ][ # # ]: 0 : maItemListeners.removeInterface( l );
4275 : 0 : }
4276 : :
4277 : 4 : void VCLXComboBox::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
4278 : : {
4279 [ + - ]: 4 : SolarMutexGuard aGuard;
4280 [ + - ][ + - ]: 4 : maActionListeners.addInterface( l );
4281 : 4 : }
4282 : :
4283 : 0 : void VCLXComboBox::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
4284 : : {
4285 [ # # ]: 0 : SolarMutexGuard aGuard;
4286 [ # # ][ # # ]: 0 : maActionListeners.removeInterface( l );
4287 : 0 : }
4288 : :
4289 : 0 : void VCLXComboBox::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
4290 : : {
4291 [ # # ]: 0 : SolarMutexGuard aGuard;
4292 : :
4293 : 0 : ComboBox* pBox = (ComboBox*) GetWindow();
4294 [ # # ]: 0 : if ( pBox )
4295 [ # # ][ # # ]: 0 : pBox->InsertEntry( aItem, nPos );
[ # # ][ # # ]
4296 : 0 : }
4297 : :
4298 : 0 : void VCLXComboBox::addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
4299 : : {
4300 [ # # ]: 0 : SolarMutexGuard aGuard;
4301 : :
4302 : 0 : ComboBox* pBox = (ComboBox*) GetWindow();
4303 [ # # ]: 0 : if ( pBox )
4304 : : {
4305 : 0 : sal_uInt16 nP = nPos;
4306 [ # # ]: 0 : for ( sal_uInt16 n = 0; n < aItems.getLength(); n++ )
4307 : : {
4308 [ # # ][ # # ]: 0 : pBox->InsertEntry( aItems.getConstArray()[n], nP );
[ # # ]
4309 [ # # ]: 0 : if ( nP == 0xFFFF )
4310 : : {
4311 : : OSL_FAIL( "VCLXComboBox::addItems: too many entries!" );
4312 : : // skip remaining entries, list cannot hold them, anyway
4313 : 0 : break;
4314 : : }
4315 : : }
4316 [ # # ]: 0 : }
4317 : 0 : }
4318 : :
4319 : 0 : void VCLXComboBox::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException)
4320 : : {
4321 [ # # ]: 0 : SolarMutexGuard aGuard;
4322 : :
4323 : 0 : ComboBox* pBox = (ComboBox*) GetWindow();
4324 [ # # ]: 0 : if ( pBox )
4325 : : {
4326 [ # # ]: 0 : for ( sal_uInt16 n = nCount; n; )
4327 [ # # ]: 0 : pBox->RemoveEntry( nPos + (--n) );
4328 [ # # ]: 0 : }
4329 : 0 : }
4330 : :
4331 : 0 : sal_Int16 VCLXComboBox::getItemCount() throw(::com::sun::star::uno::RuntimeException)
4332 : : {
4333 [ # # ]: 0 : SolarMutexGuard aGuard;
4334 : :
4335 : 0 : ComboBox* pBox = (ComboBox*) GetWindow();
4336 [ # # ][ # # ]: 0 : return pBox ? pBox->GetEntryCount() : 0;
[ # # ]
4337 : : }
4338 : :
4339 : 0 : ::rtl::OUString VCLXComboBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
4340 : : {
4341 [ # # ]: 0 : SolarMutexGuard aGuard;
4342 : :
4343 : 0 : ::rtl::OUString aItem;
4344 : 0 : ComboBox* pBox = (ComboBox*) GetWindow();
4345 [ # # ]: 0 : if ( pBox )
4346 [ # # ][ # # ]: 0 : aItem = pBox->GetEntry( nPos );
[ # # ]
4347 [ # # ]: 0 : return aItem;
4348 : : }
4349 : :
4350 : 0 : ::com::sun::star::uno::Sequence< ::rtl::OUString> VCLXComboBox::getItems() throw(::com::sun::star::uno::RuntimeException)
4351 : : {
4352 [ # # ]: 0 : SolarMutexGuard aGuard;
4353 : :
4354 [ # # ]: 0 : ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
4355 : 0 : ComboBox* pBox = (ComboBox*) GetWindow();
4356 [ # # ]: 0 : if ( pBox )
4357 : : {
4358 [ # # ]: 0 : sal_uInt16 nEntries = pBox->GetEntryCount();
4359 [ # # ][ # # ]: 0 : aSeq = ::com::sun::star::uno::Sequence< ::rtl::OUString>( nEntries );
[ # # ]
4360 [ # # ]: 0 : for ( sal_uInt16 n = nEntries; n; )
4361 : : {
4362 : 0 : --n;
4363 [ # # ][ # # ]: 0 : aSeq.getArray()[n] = pBox->GetEntry( n );
[ # # ][ # # ]
4364 : : }
4365 : : }
4366 [ # # ]: 0 : return aSeq;
4367 : : }
4368 : :
4369 : 0 : void VCLXComboBox::setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
4370 : : {
4371 [ # # ]: 0 : SolarMutexGuard aGuard;
4372 : :
4373 : 0 : ComboBox* pBox = (ComboBox*) GetWindow();
4374 [ # # ]: 0 : if ( pBox )
4375 [ # # ][ # # ]: 0 : pBox->SetDropDownLineCount( nLines );
4376 : 0 : }
4377 : :
4378 : 0 : sal_Int16 VCLXComboBox::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException)
4379 : : {
4380 [ # # ]: 0 : SolarMutexGuard aGuard;
4381 : :
4382 : 0 : sal_Int16 nLines = 0;
4383 : 0 : ComboBox* pBox = (ComboBox*) GetWindow();
4384 [ # # ]: 0 : if ( pBox )
4385 [ # # ]: 0 : nLines = pBox->GetDropDownLineCount();
4386 [ # # ]: 0 : return nLines;
4387 : : }
4388 : :
4389 : 3080 : void VCLXComboBox::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
4390 : : {
4391 [ + - ]: 3080 : SolarMutexGuard aGuard;
4392 : :
4393 : 3080 : ComboBox* pComboBox = (ComboBox*)GetWindow();
4394 [ + - ]: 3080 : if ( pComboBox )
4395 : : {
4396 [ + - ]: 3080 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
4397 [ + + - + ]: 3080 : switch ( nPropType )
4398 : : {
4399 : : case BASEPROPERTY_LINECOUNT:
4400 : : {
4401 : 52 : sal_Int16 n = sal_Int16();
4402 [ + - ]: 52 : if ( Value >>= n )
4403 [ + - ]: 52 : pComboBox->SetDropDownLineCount( n );
4404 : : }
4405 : 52 : break;
4406 : : case BASEPROPERTY_AUTOCOMPLETE:
4407 : : {
4408 : 56 : sal_Int16 n = sal_Int16();
4409 [ - + ]: 56 : if ( Value >>= n )
4410 [ # # ]: 0 : pComboBox->EnableAutocomplete( n != 0 );
4411 : : }
4412 : 56 : break;
4413 : : case BASEPROPERTY_STRINGITEMLIST:
4414 : : {
4415 [ # # ]: 0 : ::com::sun::star::uno::Sequence< ::rtl::OUString> aItems;
4416 [ # # ][ # # ]: 0 : if ( Value >>= aItems )
4417 : : {
4418 [ # # ]: 0 : pComboBox->Clear();
4419 [ # # ]: 0 : addItems( aItems, 0 );
4420 [ # # ]: 0 : }
4421 : : }
4422 : 0 : break;
4423 : : default:
4424 : : {
4425 [ + - ]: 2972 : VCLXEdit::setProperty( PropertyName, Value );
4426 : :
4427 : : // #109385# SetBorderStyle is not virtual
4428 [ + + ]: 2972 : if ( nPropType == BASEPROPERTY_BORDER )
4429 : : {
4430 : 40 : sal_uInt16 nBorder = sal_uInt16();
4431 [ + - ][ + - ]: 40 : if ( (Value >>= nBorder) && nBorder != 0 )
[ + - ]
4432 [ + - ]: 3080 : pComboBox->SetBorderStyle( nBorder );
4433 : : }
4434 : : }
4435 : : }
4436 [ + - ]: 3080 : }
4437 : 3080 : }
4438 : :
4439 : 0 : ::com::sun::star::uno::Any VCLXComboBox::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
4440 : : {
4441 [ # # ]: 0 : SolarMutexGuard aGuard;
4442 : :
4443 : 0 : ::com::sun::star::uno::Any aProp;
4444 : 0 : ComboBox* pComboBox = (ComboBox*)GetWindow();
4445 [ # # ]: 0 : if ( pComboBox )
4446 : : {
4447 [ # # ]: 0 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
4448 [ # # # # ]: 0 : switch ( nPropType )
4449 : : {
4450 : : case BASEPROPERTY_LINECOUNT:
4451 : : {
4452 [ # # ][ # # ]: 0 : aProp <<= (sal_Int16) pComboBox->GetDropDownLineCount();
4453 : : }
4454 : 0 : break;
4455 : : case BASEPROPERTY_AUTOCOMPLETE:
4456 : : {
4457 [ # # ][ # # ]: 0 : aProp <<= (sal_Bool) pComboBox->IsAutocompleteEnabled();
4458 : : }
4459 : 0 : break;
4460 : : case BASEPROPERTY_STRINGITEMLIST:
4461 : : {
4462 [ # # ]: 0 : sal_uInt16 nItems = pComboBox->GetEntryCount();
4463 [ # # ]: 0 : ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( nItems );
4464 [ # # ]: 0 : ::rtl::OUString* pStrings = aSeq.getArray();
4465 [ # # ]: 0 : for ( sal_uInt16 n = 0; n < nItems; n++ )
4466 [ # # ][ # # ]: 0 : pStrings[n] = pComboBox->GetEntry( n );
[ # # ]
4467 [ # # ][ # # ]: 0 : aProp <<= aSeq;
4468 : :
4469 : : }
4470 : 0 : break;
4471 : : default:
4472 : : {
4473 [ # # ][ # # ]: 0 : aProp <<= VCLXEdit::getProperty( PropertyName );
4474 : : }
4475 : : }
4476 : : }
4477 [ # # ]: 0 : return aProp;
4478 : : }
4479 : :
4480 : 137920 : void VCLXComboBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
4481 : : {
4482 [ + - ]: 137920 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
4483 : : // since we call listeners below, there is a potential that we will be destroyed
4484 : : // during the listener call. To prevent the resulting crashs, we keep us
4485 : : // alive as long as we're here
4486 : :
4487 [ - - + ]: 137920 : switch ( rVclWindowEvent.GetId() )
4488 : : {
4489 : : case VCLEVENT_COMBOBOX_SELECT:
4490 [ # # ][ # # ]: 0 : if ( maItemListeners.getLength() )
4491 : : {
4492 : 0 : ComboBox* pComboBox = (ComboBox*)GetWindow();
4493 [ # # ]: 0 : if( pComboBox )
4494 : : {
4495 [ # # ][ # # ]: 0 : if ( !pComboBox->IsTravelSelect() )
4496 : : {
4497 [ # # ]: 0 : ::com::sun::star::awt::ItemEvent aEvent;
4498 [ # # ]: 0 : aEvent.Source = (::cppu::OWeakObject*)this;
4499 : 0 : aEvent.Highlighted = sal_False;
4500 : :
4501 : : // Set to 0xFFFF on multiple selection, selected entry ID otherwise
4502 [ # # ][ # # ]: 0 : aEvent.Selected = pComboBox->GetEntryPos( pComboBox->GetText() );
[ # # ]
4503 : :
4504 [ # # ][ # # ]: 0 : maItemListeners.itemStateChanged( aEvent );
4505 : : }
4506 : : }
4507 : : }
4508 : 0 : break;
4509 : :
4510 : : case VCLEVENT_COMBOBOX_DOUBLECLICK:
4511 [ # # ][ # # ]: 0 : if ( maActionListeners.getLength() )
4512 : : {
4513 [ # # ]: 0 : ::com::sun::star::awt::ActionEvent aEvent;
4514 [ # # ]: 0 : aEvent.Source = (::cppu::OWeakObject*)this;
4515 : : // aEvent.ActionCommand = ...;
4516 [ # # ][ # # ]: 0 : maActionListeners.actionPerformed( aEvent );
4517 : : }
4518 : 0 : break;
4519 : :
4520 : : default:
4521 [ + - ]: 137920 : VCLXEdit::ProcessWindowEvent( rVclWindowEvent );
4522 : 137920 : break;
4523 : 137920 : }
4524 : 137920 : }
4525 : :
4526 : 4 : ::com::sun::star::awt::Size VCLXComboBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
4527 : : {
4528 [ + - ]: 4 : SolarMutexGuard aGuard;
4529 : :
4530 : 4 : Size aSz;
4531 : 4 : ComboBox* pComboBox = (ComboBox*) GetWindow();
4532 [ + - ]: 4 : if ( pComboBox )
4533 [ + - ]: 4 : aSz = pComboBox->CalcMinimumSize();
4534 [ + - ]: 4 : return AWTSize(aSz);
4535 : : }
4536 : :
4537 : 4 : ::com::sun::star::awt::Size VCLXComboBox::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
4538 : : {
4539 [ + - ]: 4 : SolarMutexGuard aGuard;
4540 : :
4541 : 4 : Size aSz;
4542 : 4 : ComboBox* pComboBox = (ComboBox*) GetWindow();
4543 [ + - ]: 4 : if ( pComboBox )
4544 : : {
4545 [ + - ]: 4 : aSz = pComboBox->CalcMinimumSize();
4546 [ + - ][ - + ]: 4 : if ( pComboBox->GetStyle() & WB_DROPDOWN )
4547 : 0 : aSz.Height() += 4;
4548 : : }
4549 [ + - ]: 4 : return AWTSize(aSz);
4550 : : }
4551 : :
4552 : 4 : ::com::sun::star::awt::Size VCLXComboBox::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
4553 : : {
4554 [ + - ]: 4 : SolarMutexGuard aGuard;
4555 : :
4556 : 4 : Size aSz = VCLSize(rNewSize);
4557 : 4 : ComboBox* pComboBox = (ComboBox*) GetWindow();
4558 [ + - ]: 4 : if ( pComboBox )
4559 [ + - ]: 4 : aSz = pComboBox->CalcAdjustedSize( aSz );
4560 [ + - ]: 4 : return AWTSize(aSz);
4561 : : }
4562 : :
4563 : 4 : ::com::sun::star::awt::Size VCLXComboBox::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
4564 : : {
4565 [ + - ]: 4 : SolarMutexGuard aGuard;
4566 : :
4567 : 4 : Size aSz;
4568 : 4 : ComboBox* pComboBox = (ComboBox*) GetWindow();
4569 [ + - ]: 4 : if ( pComboBox )
4570 [ + - ]: 4 : aSz = pComboBox->CalcSize( nCols, nLines );
4571 [ + - ]: 4 : return AWTSize(aSz);
4572 : : }
4573 : :
4574 : 4 : void VCLXComboBox::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
4575 : : {
4576 [ + - ]: 4 : SolarMutexGuard aGuard;
4577 : :
4578 : 4 : nCols = nLines = 0;
4579 : 4 : ComboBox* pComboBox = (ComboBox*) GetWindow();
4580 [ + - ]: 4 : if ( pComboBox )
4581 : : {
4582 : : sal_uInt16 nC, nL;
4583 [ + - ]: 4 : pComboBox->GetMaxVisColumnsAndLines( nC, nL );
4584 : 4 : nCols = nC;
4585 : 4 : nLines = nL;
4586 [ + - ]: 4 : }
4587 : 4 : }
4588 : 0 : void SAL_CALL VCLXComboBox::listItemInserted( const ItemListEvent& i_rEvent ) throw (RuntimeException)
4589 : : {
4590 [ # # ]: 0 : SolarMutexGuard aGuard;
4591 : :
4592 [ # # ]: 0 : ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
4593 : :
4594 [ # # ]: 0 : ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemInserted: no ComboBox?!" );
4595 [ # # ][ # # ]: 0 : ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition <= sal_Int32( pComboBox->GetEntryCount() ) ),
[ # # ][ # # ]
4596 : : "VCLXComboBox::listItemInserted: illegal (inconsistent) item position!" );
4597 : : pComboBox->InsertEntry(
4598 : : i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString(),
4599 : : i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : Image(),
4600 [ # # ][ # # ]: 0 : i_rEvent.ItemPosition );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
4601 : : }
4602 : :
4603 : 0 : void SAL_CALL VCLXComboBox::listItemRemoved( const ItemListEvent& i_rEvent ) throw (RuntimeException)
4604 : : {
4605 [ # # ]: 0 : SolarMutexGuard aGuard;
4606 : :
4607 [ # # ]: 0 : ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
4608 : :
4609 [ # # ]: 0 : ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemRemoved: no ComboBox?!" );
4610 [ # # ][ # # ]: 0 : ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pComboBox->GetEntryCount() ) ),
[ # # ][ # # ]
4611 : : "VCLXComboBox::listItemRemoved: illegal (inconsistent) item position!" );
4612 : :
4613 [ # # ][ # # ]: 0 : pComboBox->RemoveEntry( i_rEvent.ItemPosition );
[ # # ]
4614 : : }
4615 : :
4616 : 0 : void SAL_CALL VCLXComboBox::listItemModified( const ItemListEvent& i_rEvent ) throw (RuntimeException)
4617 : : {
4618 [ # # ]: 0 : SolarMutexGuard aGuard;
4619 : :
4620 [ # # ]: 0 : ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
4621 : :
4622 [ # # ]: 0 : ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" );
4623 [ # # ][ # # ]: 0 : ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pComboBox->GetEntryCount() ) ),
[ # # ][ # # ]
4624 : : "VCLXComboBox::listItemModified: illegal (inconsistent) item position!" );
4625 : :
4626 : : // VCL's ComboBox does not support changing an entry's text or image, so remove and re-insert
4627 : :
4628 [ # # ][ # # ]: 0 : const ::rtl::OUString sNewText = i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString( pComboBox->GetEntry( i_rEvent.ItemPosition ) );
[ # # ][ # # ]
[ # # ][ # # ]
4629 [ # # ][ # # ]: 0 : const Image aNewImage( i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : pComboBox->GetEntryImage( i_rEvent.ItemPosition ) );
[ # # ]
4630 : :
4631 [ # # ]: 0 : pComboBox->RemoveEntry( i_rEvent.ItemPosition );
4632 [ # # ][ # # ]: 0 : pComboBox->InsertEntry( sNewText, aNewImage, i_rEvent.ItemPosition );
[ # # ][ # # ]
[ # # ][ # # ]
4633 : : }
4634 : :
4635 : 0 : void SAL_CALL VCLXComboBox::allItemsRemoved( const EventObject& i_rEvent ) throw (RuntimeException)
4636 : : {
4637 [ # # ]: 0 : SolarMutexGuard aGuard;
4638 : :
4639 [ # # ]: 0 : ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
4640 [ # # ]: 0 : ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" );
4641 : :
4642 [ # # ][ # # ]: 0 : pComboBox->Clear();
4643 : :
4644 [ # # ]: 0 : (void)i_rEvent;
4645 : : }
4646 : :
4647 : 74 : void SAL_CALL VCLXComboBox::itemListChanged( const EventObject& i_rEvent ) throw (RuntimeException)
4648 : : {
4649 [ + - ]: 74 : SolarMutexGuard aGuard;
4650 : :
4651 [ - + ]: 74 : ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
4652 [ - + ]: 148 : ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" );
4653 : :
4654 [ + - ]: 74 : pComboBox->Clear();
4655 : :
4656 [ + - ]: 74 : uno::Reference< beans::XPropertySet > xPropSet( i_rEvent.Source, uno::UNO_QUERY_THROW );
4657 [ + - ][ + - ]: 74 : uno::Reference< beans::XPropertySetInfo > xPSI( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW );
[ + - ]
4658 : : // bool localize = xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) );
4659 : 74 : uno::Reference< resource::XStringResourceResolver > xStringResourceResolver;
4660 [ + - ][ - + ]: 74 : if ( xPSI->hasPropertyByName( ::rtl::OUString( "ResourceResolver" ) ) )
[ + - ]
4661 : : {
4662 : : xStringResourceResolver.set(
4663 [ # # ]: 0 : xPropSet->getPropertyValue( ::rtl::OUString( "ResourceResolver" ) ),
4664 : : uno::UNO_QUERY
4665 [ # # ][ # # ]: 0 : );
4666 : : }
4667 : :
4668 : :
4669 [ + - ]: 74 : Reference< XItemList > xItemList( i_rEvent.Source, uno::UNO_QUERY_THROW );
4670 [ + - ][ + - ]: 74 : uno::Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > aItems = xItemList->getAllItems();
4671 [ + + ]: 172 : for ( sal_Int32 i=0; i<aItems.getLength(); ++i )
4672 : : {
4673 [ + - ]: 98 : ::rtl::OUString aLocalizationKey( aItems[i].First );
4674 [ # # ][ # # ]: 98 : if ( xStringResourceResolver.is() && !aLocalizationKey.isEmpty() && aLocalizationKey[0] == '&' )
[ - + ][ - + ]
4675 : : {
4676 [ # # ][ # # ]: 0 : aLocalizationKey = xStringResourceResolver->resolveString(aLocalizationKey.copy( 1 ));
4677 : : }
4678 [ + - ][ + - ]: 98 : pComboBox->InsertEntry( aLocalizationKey, lcl_getImageFromURL( aItems[i].Second ) );
[ + - ][ + - ]
[ + - ][ + - ]
4679 [ + - ][ + - ]: 172 : }
[ + - ]
4680 : : }
4681 : 10 : void SAL_CALL VCLXComboBox::disposing( const EventObject& i_rEvent ) throw (RuntimeException)
4682 : : {
4683 : : // just disambiguate
4684 : 10 : VCLXEdit::disposing( i_rEvent );
4685 : 10 : }
4686 : :
4687 : : // ----------------------------------------------------
4688 : : // class VCLXFormattedSpinField
4689 : : // ----------------------------------------------------
4690 : 143 : void VCLXFormattedSpinField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
4691 : : {
4692 : : // Interestingly in the UnoControl API this is
4693 : : // - not derived from XEdit ultimately, (correct ?) - so cut this here ...
4694 : : // VCLXSpinField::ImplGetPropertyIds( rIds );
4695 : 143 : VCLXWindow::ImplGetPropertyIds( rIds );
4696 : 143 : }
4697 : :
4698 : 233 : VCLXFormattedSpinField::VCLXFormattedSpinField()
4699 : : {
4700 : 233 : }
4701 : :
4702 : 229 : VCLXFormattedSpinField::~VCLXFormattedSpinField()
4703 : : {
4704 [ - + ]: 229 : }
4705 : :
4706 : 0 : void VCLXFormattedSpinField::setStrictFormat( sal_Bool bStrict )
4707 : : {
4708 [ # # ]: 0 : SolarMutexGuard aGuard;
4709 : :
4710 : 0 : FormatterBase* pFormatter = GetFormatter();
4711 [ # # ]: 0 : if ( pFormatter )
4712 [ # # ][ # # ]: 0 : pFormatter->SetStrictFormat( bStrict );
4713 : 0 : }
4714 : :
4715 : 0 : sal_Bool VCLXFormattedSpinField::isStrictFormat()
4716 : : {
4717 : 0 : FormatterBase* pFormatter = GetFormatter();
4718 [ # # ]: 0 : return pFormatter ? pFormatter->IsStrictFormat() : sal_False;
4719 : : }
4720 : :
4721 : :
4722 : 7839 : void VCLXFormattedSpinField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
4723 : : {
4724 [ + - ]: 7839 : SolarMutexGuard aGuard;
4725 : :
4726 : 7839 : FormatterBase* pFormatter = GetFormatter();
4727 [ + - ]: 7839 : if ( pFormatter )
4728 : : {
4729 [ + - ]: 7839 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
4730 [ + + + ]: 7839 : switch ( nPropType )
4731 : : {
4732 : : case BASEPROPERTY_SPIN:
4733 : : {
4734 : 88 : sal_Bool b = sal_Bool();
4735 [ + - ]: 88 : if ( Value >>= b )
4736 : : {
4737 [ + - ]: 88 : WinBits nStyle = GetWindow()->GetStyle() | WB_SPIN;
4738 [ + + ]: 88 : if ( !b )
4739 : 60 : nStyle &= ~WB_SPIN;
4740 [ + - ]: 88 : GetWindow()->SetStyle( nStyle );
4741 : : }
4742 : : }
4743 : 88 : break;
4744 : : case BASEPROPERTY_STRICTFORMAT:
4745 : : {
4746 : 166 : sal_Bool b = sal_Bool();
4747 [ + - ]: 166 : if ( Value >>= b )
4748 : : {
4749 [ + - ]: 166 : pFormatter->SetStrictFormat( b );
4750 : : }
4751 : : }
4752 : 166 : break;
4753 : : default:
4754 : : {
4755 [ + - ]: 7839 : VCLXSpinField::setProperty( PropertyName, Value );
4756 : : }
4757 : : }
4758 [ + - ]: 7839 : }
4759 : 7839 : }
4760 : :
4761 : 84 : ::com::sun::star::uno::Any VCLXFormattedSpinField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
4762 : : {
4763 [ + - ]: 84 : SolarMutexGuard aGuard;
4764 : :
4765 : 84 : ::com::sun::star::uno::Any aProp;
4766 : 84 : FormatterBase* pFormatter = GetFormatter();
4767 [ + - ]: 84 : if ( pFormatter )
4768 : : {
4769 [ + - ]: 84 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
4770 [ - - + ]: 84 : switch ( nPropType )
4771 : : {
4772 : : case BASEPROPERTY_TABSTOP:
4773 : : {
4774 [ # # ][ # # ]: 0 : aProp <<= (sal_Bool) ( ( GetWindow()->GetStyle() & WB_SPIN ) ? sal_True : sal_False );
[ # # ]
4775 : : }
4776 : 0 : break;
4777 : : case BASEPROPERTY_STRICTFORMAT:
4778 : : {
4779 [ # # ]: 0 : aProp <<= (sal_Bool) pFormatter->IsStrictFormat();
4780 : : }
4781 : 0 : break;
4782 : : default:
4783 : : {
4784 [ + - ][ + - ]: 84 : aProp <<= VCLXSpinField::getProperty( PropertyName );
4785 : : }
4786 : : }
4787 : : }
4788 [ + - ]: 84 : return aProp;
4789 : : }
4790 : :
4791 : :
4792 : : // ----------------------------------------------------
4793 : : // class VCLXDateField
4794 : : // ----------------------------------------------------
4795 : :
4796 : 39 : void VCLXDateField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
4797 : : {
4798 : : PushPropertyIds( rIds,
4799 : : BASEPROPERTY_ALIGN,
4800 : : BASEPROPERTY_BACKGROUNDCOLOR,
4801 : : BASEPROPERTY_BORDER,
4802 : : BASEPROPERTY_BORDERCOLOR,
4803 : : BASEPROPERTY_DATE,
4804 : : BASEPROPERTY_DATEMAX,
4805 : : BASEPROPERTY_DATEMIN,
4806 : : BASEPROPERTY_DATESHOWCENTURY,
4807 : : BASEPROPERTY_DEFAULTCONTROL,
4808 : : BASEPROPERTY_DROPDOWN,
4809 : : BASEPROPERTY_ENABLED,
4810 : : BASEPROPERTY_ENABLEVISIBLE,
4811 : : BASEPROPERTY_EXTDATEFORMAT,
4812 : : BASEPROPERTY_FONTDESCRIPTOR,
4813 : : BASEPROPERTY_HELPTEXT,
4814 : : BASEPROPERTY_HELPURL,
4815 : : BASEPROPERTY_PRINTABLE,
4816 : : BASEPROPERTY_READONLY,
4817 : : BASEPROPERTY_REPEAT,
4818 : : BASEPROPERTY_REPEAT_DELAY,
4819 : : BASEPROPERTY_SPIN,
4820 : : BASEPROPERTY_STRICTFORMAT,
4821 : : BASEPROPERTY_TABSTOP,
4822 : : BASEPROPERTY_ENFORCE_FORMAT,
4823 : : BASEPROPERTY_TEXT,
4824 : : BASEPROPERTY_HIDEINACTIVESELECTION,
4825 : : BASEPROPERTY_VERTICALALIGN,
4826 : : BASEPROPERTY_WRITING_MODE,
4827 : : BASEPROPERTY_CONTEXT_WRITING_MODE,
4828 : : BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
4829 : 39 : 0);
4830 : 39 : VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
4831 : 39 : }
4832 : :
4833 [ + - ]: 54 : VCLXDateField::VCLXDateField()
4834 : : {
4835 : 54 : }
4836 : :
4837 [ + - ]: 54 : VCLXDateField::~VCLXDateField()
4838 : : {
4839 [ - + ]: 54 : }
4840 : :
4841 : : // ::com::sun::star::uno::XInterface
4842 : 5899 : ::com::sun::star::uno::Any VCLXDateField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
4843 : : {
4844 : : ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
4845 [ + - ]: 5899 : (static_cast< ::com::sun::star::awt::XDateField* >(this)) );
4846 [ + + ][ + - ]: 5899 : return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
4847 : : }
4848 : :
4849 : : // ::com::sun::star::lang::XTypeProvider
4850 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_START( VCLXDateField )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
4851 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDateField>* ) NULL ),
4852 : : VCLXFormattedSpinField::getTypes()
4853 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_END
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
4854 : :
4855 : 4200 : void VCLXDateField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
4856 : : {
4857 [ + - ]: 4200 : SolarMutexGuard aGuard;
4858 : :
4859 [ + - ]: 4200 : if ( GetWindow() )
4860 : : {
4861 : 4200 : sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
4862 : :
4863 [ + - ]: 4200 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
4864 [ + + + + : 4200 : switch ( nPropType )
+ + + ]
4865 : : {
4866 : : case BASEPROPERTY_DATE:
4867 : : {
4868 [ + + ]: 74 : if ( bVoid )
4869 : : {
4870 : 32 : ((DateField*)GetWindow())->EnableEmptyFieldValue( sal_True );
4871 [ + - ]: 32 : ((DateField*)GetWindow())->SetEmptyFieldValue();
4872 : : }
4873 : : else
4874 : : {
4875 : 42 : sal_Int32 n = 0;
4876 [ + - ]: 42 : if ( Value >>= n )
4877 [ + - ]: 42 : setDate( n );
4878 : : }
4879 : : }
4880 : 74 : break;
4881 : : case BASEPROPERTY_DATEMIN:
4882 : : {
4883 : 74 : sal_Int32 n = 0;
4884 [ + - ]: 74 : if ( Value >>= n )
4885 [ + - ]: 74 : setMin( n );
4886 : : }
4887 : 74 : break;
4888 : : case BASEPROPERTY_DATEMAX:
4889 : : {
4890 : 74 : sal_Int32 n = 0;
4891 [ + - ]: 74 : if ( Value >>= n )
4892 [ + - ]: 74 : setMax( n );
4893 : : }
4894 : 74 : break;
4895 : : case BASEPROPERTY_EXTDATEFORMAT:
4896 : : {
4897 : 71 : sal_Int16 n = sal_Int16();
4898 [ + - ]: 71 : if ( Value >>= n )
4899 [ + - ]: 71 : ((DateField*)GetWindow())->SetExtDateFormat( (ExtDateFieldFormat) n );
4900 : : }
4901 : 71 : break;
4902 : : case BASEPROPERTY_DATESHOWCENTURY:
4903 : : {
4904 : 56 : sal_Bool b = sal_Bool();
4905 [ + + ]: 56 : if ( Value >>= b )
4906 [ + - ]: 12 : ((DateField*)GetWindow())->SetShowDateCentury( b );
4907 : : }
4908 : 56 : break;
4909 : : case BASEPROPERTY_ENFORCE_FORMAT:
4910 : : {
4911 : 72 : sal_Bool bEnforce( sal_True );
4912 : 72 : OSL_VERIFY( Value >>= bEnforce );
4913 : 72 : static_cast< DateField* >( GetWindow() )->EnforceValidValue( bEnforce );
4914 : : }
4915 : 72 : break;
4916 : : default:
4917 : : {
4918 [ + - ]: 4200 : VCLXFormattedSpinField::setProperty( PropertyName, Value );
4919 : : }
4920 : : }
4921 [ + - ]: 4200 : }
4922 : 4200 : }
4923 : :
4924 : 56 : ::com::sun::star::uno::Any VCLXDateField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
4925 : : {
4926 [ + - ]: 56 : SolarMutexGuard aGuard;
4927 : :
4928 : 56 : ::com::sun::star::uno::Any aProp;
4929 : 56 : FormatterBase* pFormatter = GetFormatter();
4930 [ + - ]: 56 : if ( pFormatter )
4931 : : {
4932 [ + - ]: 56 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
4933 [ - - - - : 56 : switch ( nPropType )
+ + ]
4934 : : {
4935 : : case BASEPROPERTY_DATE:
4936 : : {
4937 [ # # ][ # # ]: 0 : aProp <<= (sal_Int32) getDate();
4938 : : }
4939 : 0 : break;
4940 : : case BASEPROPERTY_DATEMIN:
4941 : : {
4942 [ # # ][ # # ]: 0 : aProp <<= (sal_Int32) getMin();
4943 : : }
4944 : 0 : break;
4945 : : case BASEPROPERTY_DATEMAX:
4946 : : {
4947 [ # # ][ # # ]: 0 : aProp <<= (sal_Int32) getMax();
4948 : : }
4949 : 0 : break;
4950 : : case BASEPROPERTY_DATESHOWCENTURY:
4951 : : {
4952 [ # # ]: 0 : aProp <<= ((DateField*)GetWindow())->IsShowDateCentury();
4953 : : }
4954 : 0 : break;
4955 : : case BASEPROPERTY_ENFORCE_FORMAT:
4956 : : {
4957 [ + - ]: 8 : aProp <<= (sal_Bool)static_cast< DateField* >( GetWindow() )->IsEnforceValidValue( );
4958 : : }
4959 : 8 : break;
4960 : : default:
4961 : : {
4962 [ + - ][ + - ]: 56 : aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
4963 : : }
4964 : : }
4965 : : }
4966 [ + - ]: 56 : return aProp;
4967 : : }
4968 : :
4969 : :
4970 : 42 : void VCLXDateField::setDate( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
4971 : : {
4972 [ + - ]: 42 : SolarMutexGuard aGuard;
4973 : :
4974 : 42 : DateField* pDateField = (DateField*) GetWindow();
4975 [ + - ]: 42 : if ( pDateField )
4976 : : {
4977 [ + - ]: 42 : pDateField->SetDate( nDate );
4978 : :
4979 : : // #107218# Call same listeners like VCL would do after user interaction
4980 [ + - ]: 42 : SetSynthesizingVCLEvent( sal_True );
4981 [ + - ]: 42 : pDateField->SetModifyFlag();
4982 [ + - ]: 42 : pDateField->Modify();
4983 [ + - ]: 42 : SetSynthesizingVCLEvent( sal_False );
4984 [ + - ]: 42 : }
4985 : 42 : }
4986 : :
4987 : 40 : sal_Int32 VCLXDateField::getDate() throw(::com::sun::star::uno::RuntimeException)
4988 : : {
4989 [ + - ]: 40 : SolarMutexGuard aGuard;
4990 : :
4991 : 40 : sal_Int32 nDate = 0;
4992 : 40 : DateField* pDateField = (DateField*) GetWindow();
4993 [ + - ]: 40 : if ( pDateField )
4994 [ + - ]: 40 : nDate = pDateField->GetDate().GetDate();
4995 : :
4996 [ + - ]: 40 : return nDate;
4997 : : }
4998 : :
4999 : 74 : void VCLXDateField::setMin( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
5000 : : {
5001 [ + - ]: 74 : SolarMutexGuard aGuard;
5002 : :
5003 : 74 : DateField* pDateField = (DateField*) GetWindow();
5004 [ + - ]: 74 : if ( pDateField )
5005 [ + - ][ + - ]: 74 : pDateField->SetMin( nDate );
5006 : 74 : }
5007 : :
5008 : 0 : sal_Int32 VCLXDateField::getMin() throw(::com::sun::star::uno::RuntimeException)
5009 : : {
5010 [ # # ]: 0 : SolarMutexGuard aGuard;
5011 : :
5012 : 0 : sal_Int32 nDate = 0;
5013 : 0 : DateField* pDateField = (DateField*) GetWindow();
5014 [ # # ]: 0 : if ( pDateField )
5015 : 0 : nDate = pDateField->GetMin().GetDate();
5016 : :
5017 [ # # ]: 0 : return nDate;
5018 : : }
5019 : :
5020 : 74 : void VCLXDateField::setMax( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
5021 : : {
5022 [ + - ]: 74 : SolarMutexGuard aGuard;
5023 : :
5024 : 74 : DateField* pDateField = (DateField*) GetWindow();
5025 [ + - ]: 74 : if ( pDateField )
5026 [ + - ][ + - ]: 74 : pDateField->SetMax( nDate );
5027 : 74 : }
5028 : :
5029 : 0 : sal_Int32 VCLXDateField::getMax() throw(::com::sun::star::uno::RuntimeException)
5030 : : {
5031 [ # # ]: 0 : SolarMutexGuard aGuard;
5032 : :
5033 : 0 : sal_Int32 nDate = 0;
5034 : 0 : DateField* pDateField = (DateField*) GetWindow();
5035 [ # # ]: 0 : if ( pDateField )
5036 : 0 : nDate = pDateField->GetMax().GetDate();
5037 : :
5038 [ # # ]: 0 : return nDate;
5039 : : }
5040 : :
5041 : 62 : void VCLXDateField::setFirst( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
5042 : : {
5043 [ + - ]: 62 : SolarMutexGuard aGuard;
5044 : :
5045 : 62 : DateField* pDateField = (DateField*) GetWindow();
5046 [ + - ]: 62 : if ( pDateField )
5047 [ + - ]: 62 : pDateField->SetFirst( nDate );
5048 : 62 : }
5049 : :
5050 : 0 : sal_Int32 VCLXDateField::getFirst() throw(::com::sun::star::uno::RuntimeException)
5051 : : {
5052 [ # # ]: 0 : SolarMutexGuard aGuard;
5053 : :
5054 : 0 : sal_Int32 nDate = 0;
5055 : 0 : DateField* pDateField = (DateField*) GetWindow();
5056 [ # # ]: 0 : if ( pDateField )
5057 : 0 : nDate = pDateField->GetFirst().GetDate();
5058 : :
5059 [ # # ]: 0 : return nDate;
5060 : : }
5061 : :
5062 : 62 : void VCLXDateField::setLast( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
5063 : : {
5064 [ + - ]: 62 : SolarMutexGuard aGuard;
5065 : :
5066 : 62 : DateField* pDateField = (DateField*) GetWindow();
5067 [ + - ]: 62 : if ( pDateField )
5068 [ + - ]: 62 : pDateField->SetLast( nDate );
5069 : 62 : }
5070 : :
5071 : 0 : sal_Int32 VCLXDateField::getLast() throw(::com::sun::star::uno::RuntimeException)
5072 : : {
5073 [ # # ]: 0 : SolarMutexGuard aGuard;
5074 : :
5075 : 0 : sal_Int32 nDate = 0;
5076 : 0 : DateField* pDateField = (DateField*) GetWindow();
5077 [ # # ]: 0 : if ( pDateField )
5078 : 0 : nDate = pDateField->GetLast().GetDate();
5079 : :
5080 [ # # ]: 0 : return nDate;
5081 : : }
5082 : :
5083 : 8 : void VCLXDateField::setLongFormat( sal_Bool bLong ) throw(::com::sun::star::uno::RuntimeException)
5084 : : {
5085 [ + - ]: 8 : SolarMutexGuard aGuard;
5086 : :
5087 : 8 : DateField* pDateField = (DateField*) GetWindow();
5088 [ + - ]: 8 : if ( pDateField )
5089 [ + - ][ + - ]: 8 : pDateField->SetLongFormat( bLong );
5090 : 8 : }
5091 : :
5092 : 0 : sal_Bool VCLXDateField::isLongFormat() throw(::com::sun::star::uno::RuntimeException)
5093 : : {
5094 [ # # ]: 0 : SolarMutexGuard aGuard;
5095 : :
5096 : 0 : DateField* pDateField = (DateField*) GetWindow();
5097 [ # # ][ # # ]: 0 : return pDateField ? pDateField->IsLongFormat() : sal_False;
5098 : : }
5099 : :
5100 : 4 : void VCLXDateField::setEmpty() throw(::com::sun::star::uno::RuntimeException)
5101 : : {
5102 [ + - ]: 4 : SolarMutexGuard aGuard;
5103 : :
5104 : 4 : DateField* pDateField = (DateField*) GetWindow();
5105 [ + - ]: 4 : if ( pDateField )
5106 : : {
5107 [ + - ]: 4 : pDateField->SetEmptyDate();
5108 : :
5109 : : // #107218# Call same listeners like VCL would do after user interaction
5110 [ + - ]: 4 : SetSynthesizingVCLEvent( sal_True );
5111 [ + - ]: 4 : pDateField->SetModifyFlag();
5112 [ + - ]: 4 : pDateField->Modify();
5113 [ + - ]: 4 : SetSynthesizingVCLEvent( sal_False );
5114 [ + - ]: 4 : }
5115 : 4 : }
5116 : :
5117 : 52 : sal_Bool VCLXDateField::isEmpty() throw(::com::sun::star::uno::RuntimeException)
5118 : : {
5119 [ + - ]: 52 : SolarMutexGuard aGuard;
5120 : :
5121 : 52 : DateField* pDateField = (DateField*) GetWindow();
5122 [ + - ][ + - ]: 52 : return pDateField ? pDateField->IsEmptyDate() : sal_False;
[ + - ]
5123 : : }
5124 : :
5125 : 0 : void VCLXDateField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
5126 : : {
5127 : 0 : VCLXFormattedSpinField::setStrictFormat( bStrict );
5128 : 0 : }
5129 : :
5130 : 0 : sal_Bool VCLXDateField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
5131 : : {
5132 : 0 : return VCLXFormattedSpinField::isStrictFormat();
5133 : : }
5134 : :
5135 : :
5136 : : // ----------------------------------------------------
5137 : : // class VCLXTimeField
5138 : : // ----------------------------------------------------
5139 : :
5140 : 27 : void VCLXTimeField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
5141 : : {
5142 : : PushPropertyIds( rIds,
5143 : : BASEPROPERTY_ALIGN,
5144 : : BASEPROPERTY_BACKGROUNDCOLOR,
5145 : : BASEPROPERTY_BORDER,
5146 : : BASEPROPERTY_BORDERCOLOR,
5147 : : BASEPROPERTY_DEFAULTCONTROL,
5148 : : BASEPROPERTY_ENABLED,
5149 : : BASEPROPERTY_ENABLEVISIBLE,
5150 : : BASEPROPERTY_EXTTIMEFORMAT,
5151 : : BASEPROPERTY_FONTDESCRIPTOR,
5152 : : BASEPROPERTY_HELPTEXT,
5153 : : BASEPROPERTY_HELPURL,
5154 : : BASEPROPERTY_PRINTABLE,
5155 : : BASEPROPERTY_READONLY,
5156 : : BASEPROPERTY_REPEAT,
5157 : : BASEPROPERTY_REPEAT_DELAY,
5158 : : BASEPROPERTY_SPIN,
5159 : : BASEPROPERTY_STRICTFORMAT,
5160 : : BASEPROPERTY_TABSTOP,
5161 : : BASEPROPERTY_TIME,
5162 : : BASEPROPERTY_TIMEMAX,
5163 : : BASEPROPERTY_TIMEMIN,
5164 : : BASEPROPERTY_ENFORCE_FORMAT,
5165 : : BASEPROPERTY_TEXT,
5166 : : BASEPROPERTY_HIDEINACTIVESELECTION,
5167 : : BASEPROPERTY_VERTICALALIGN,
5168 : : BASEPROPERTY_WRITING_MODE,
5169 : : BASEPROPERTY_CONTEXT_WRITING_MODE,
5170 : : BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
5171 : 27 : 0);
5172 : 27 : VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
5173 : 27 : }
5174 : :
5175 [ + - ]: 34 : VCLXTimeField::VCLXTimeField()
5176 : : {
5177 : 34 : }
5178 : :
5179 [ + - ]: 34 : VCLXTimeField::~VCLXTimeField()
5180 : : {
5181 [ - + ]: 68 : }
5182 : :
5183 : : // ::com::sun::star::uno::XInterface
5184 : 5624 : ::com::sun::star::uno::Any VCLXTimeField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
5185 : : {
5186 : : ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
5187 [ + - ]: 5624 : (static_cast< ::com::sun::star::awt::XTimeField* >(this)) );
5188 [ + + ][ + - ]: 5624 : return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
5189 : : }
5190 : :
5191 : : // ::com::sun::star::lang::XTypeProvider
5192 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_START( VCLXTimeField )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
5193 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTimeField>* ) NULL ),
5194 : : VCLXFormattedSpinField::getTypes()
5195 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_END
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
5196 : :
5197 : 12 : void VCLXTimeField::setTime( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
5198 : : {
5199 [ + - ]: 12 : SolarMutexGuard aGuard;
5200 : :
5201 : 12 : TimeField* pTimeField = (TimeField*) GetWindow();
5202 [ + - ]: 12 : if ( pTimeField )
5203 : : {
5204 [ + - ]: 12 : pTimeField->SetTime( nTime );
5205 : :
5206 : : // #107218# Call same listeners like VCL would do after user interaction
5207 [ + - ]: 12 : SetSynthesizingVCLEvent( sal_True );
5208 [ + - ]: 12 : pTimeField->SetModifyFlag();
5209 [ + - ]: 12 : pTimeField->Modify();
5210 [ + - ]: 12 : SetSynthesizingVCLEvent( sal_False );
5211 [ + - ]: 12 : }
5212 : 12 : }
5213 : :
5214 : 32 : sal_Int32 VCLXTimeField::getTime() throw(::com::sun::star::uno::RuntimeException)
5215 : : {
5216 [ + - ]: 32 : SolarMutexGuard aGuard;
5217 : :
5218 : 32 : sal_Int32 nTime = 0;
5219 : 32 : TimeField* pTimeField = (TimeField*) GetWindow();
5220 [ + - ]: 32 : if ( pTimeField )
5221 [ + - ]: 32 : nTime = pTimeField->GetTime().GetTime();
5222 : :
5223 [ + - ]: 32 : return nTime;
5224 : : }
5225 : :
5226 : 58 : void VCLXTimeField::setMin( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
5227 : : {
5228 [ + - ]: 58 : SolarMutexGuard aGuard;
5229 : :
5230 : 58 : TimeField* pTimeField = (TimeField*) GetWindow();
5231 [ + - ]: 58 : if ( pTimeField )
5232 [ + - ][ + - ]: 58 : pTimeField->SetMin( nTime );
5233 : 58 : }
5234 : :
5235 : 0 : sal_Int32 VCLXTimeField::getMin() throw(::com::sun::star::uno::RuntimeException)
5236 : : {
5237 [ # # ]: 0 : SolarMutexGuard aGuard;
5238 : :
5239 : 0 : sal_Int32 nTime = 0;
5240 : 0 : TimeField* pTimeField = (TimeField*) GetWindow();
5241 [ # # ]: 0 : if ( pTimeField )
5242 : 0 : nTime = pTimeField->GetMin().GetTime();
5243 : :
5244 [ # # ]: 0 : return nTime;
5245 : : }
5246 : :
5247 : 58 : void VCLXTimeField::setMax( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
5248 : : {
5249 [ + - ]: 58 : SolarMutexGuard aGuard;
5250 : :
5251 : 58 : TimeField* pTimeField = (TimeField*) GetWindow();
5252 [ + - ]: 58 : if ( pTimeField )
5253 [ + - ][ + - ]: 58 : pTimeField->SetMax( nTime );
5254 : 58 : }
5255 : :
5256 : 0 : sal_Int32 VCLXTimeField::getMax() throw(::com::sun::star::uno::RuntimeException)
5257 : : {
5258 [ # # ]: 0 : SolarMutexGuard aGuard;
5259 : :
5260 : 0 : sal_Int32 nTime = 0;
5261 : 0 : TimeField* pTimeField = (TimeField*) GetWindow();
5262 [ # # ]: 0 : if ( pTimeField )
5263 : 0 : nTime = pTimeField->GetMax().GetTime();
5264 : :
5265 [ # # ]: 0 : return nTime;
5266 : : }
5267 : :
5268 : 46 : void VCLXTimeField::setFirst( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
5269 : : {
5270 [ + - ]: 46 : SolarMutexGuard aGuard;
5271 : :
5272 : 46 : TimeField* pTimeField = (TimeField*) GetWindow();
5273 [ + - ]: 46 : if ( pTimeField )
5274 [ + - ][ + - ]: 46 : pTimeField->SetFirst( nTime );
5275 : 46 : }
5276 : :
5277 : 0 : sal_Int32 VCLXTimeField::getFirst() throw(::com::sun::star::uno::RuntimeException)
5278 : : {
5279 [ # # ]: 0 : SolarMutexGuard aGuard;
5280 : :
5281 : 0 : sal_Int32 nTime = 0;
5282 : 0 : TimeField* pTimeField = (TimeField*) GetWindow();
5283 [ # # ]: 0 : if ( pTimeField )
5284 [ # # ]: 0 : nTime = pTimeField->GetFirst().GetTime();
5285 : :
5286 [ # # ]: 0 : return nTime;
5287 : : }
5288 : :
5289 : 38 : void VCLXTimeField::setLast( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
5290 : : {
5291 [ + - ]: 38 : SolarMutexGuard aGuard;
5292 : :
5293 : 38 : TimeField* pTimeField = (TimeField*) GetWindow();
5294 [ + - ]: 38 : if ( pTimeField )
5295 [ + - ][ + - ]: 38 : pTimeField->SetLast( nTime );
5296 : 38 : }
5297 : :
5298 : 0 : sal_Int32 VCLXTimeField::getLast() throw(::com::sun::star::uno::RuntimeException)
5299 : : {
5300 [ # # ]: 0 : SolarMutexGuard aGuard;
5301 : :
5302 : 0 : sal_Int32 nTime = 0;
5303 : 0 : TimeField* pTimeField = (TimeField*) GetWindow();
5304 [ # # ]: 0 : if ( pTimeField )
5305 [ # # ]: 0 : nTime = pTimeField->GetLast().GetTime();
5306 : :
5307 [ # # ]: 0 : return nTime;
5308 : : }
5309 : :
5310 : 4 : void VCLXTimeField::setEmpty() throw(::com::sun::star::uno::RuntimeException)
5311 : : {
5312 [ + - ]: 4 : SolarMutexGuard aGuard;
5313 : :
5314 : 4 : TimeField* pTimeField = (TimeField*) GetWindow();
5315 [ + - ]: 4 : if ( pTimeField )
5316 [ + - ][ + - ]: 4 : pTimeField->SetEmptyTime();
5317 : 4 : }
5318 : :
5319 : 40 : sal_Bool VCLXTimeField::isEmpty() throw(::com::sun::star::uno::RuntimeException)
5320 : : {
5321 [ + - ]: 40 : SolarMutexGuard aGuard;
5322 : :
5323 : 40 : TimeField* pTimeField = (TimeField*) GetWindow();
5324 [ + - ][ + - ]: 40 : return pTimeField ? pTimeField->IsEmptyTime() : sal_False;
[ + - ]
5325 : : }
5326 : :
5327 : 0 : void VCLXTimeField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
5328 : : {
5329 : 0 : VCLXFormattedSpinField::setStrictFormat( bStrict );
5330 : 0 : }
5331 : :
5332 : 0 : sal_Bool VCLXTimeField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
5333 : : {
5334 : 0 : return VCLXFormattedSpinField::isStrictFormat();
5335 : : }
5336 : :
5337 : :
5338 : 2704 : void VCLXTimeField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
5339 : : {
5340 [ + - ]: 2704 : SolarMutexGuard aGuard;
5341 : :
5342 [ + - ]: 2704 : if ( GetWindow() )
5343 : : {
5344 : 2704 : sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
5345 : :
5346 [ + - ]: 2704 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
5347 [ + + + + : 2704 : switch ( nPropType )
+ + ]
5348 : : {
5349 : : case BASEPROPERTY_TIME:
5350 : : {
5351 [ + + ]: 42 : if ( bVoid )
5352 : : {
5353 : 30 : ((TimeField*)GetWindow())->EnableEmptyFieldValue( sal_True );
5354 [ + - ]: 30 : ((TimeField*)GetWindow())->SetEmptyFieldValue();
5355 : : }
5356 : : else
5357 : : {
5358 : 12 : sal_Int32 n = 0;
5359 [ + - ]: 12 : if ( Value >>= n )
5360 [ + - ]: 12 : setTime( n );
5361 : : }
5362 : : }
5363 : 42 : break;
5364 : : case BASEPROPERTY_TIMEMIN:
5365 : : {
5366 : 58 : sal_Int32 n = 0;
5367 [ + - ]: 58 : if ( Value >>= n )
5368 [ + - ]: 58 : setMin( n );
5369 : : }
5370 : 58 : break;
5371 : : case BASEPROPERTY_TIMEMAX:
5372 : : {
5373 : 58 : sal_Int32 n = 0;
5374 [ + - ]: 58 : if ( Value >>= n )
5375 [ + - ]: 58 : setMax( n );
5376 : : }
5377 : 58 : break;
5378 : : case BASEPROPERTY_EXTTIMEFORMAT:
5379 : : {
5380 : 50 : sal_Int16 n = sal_Int16();
5381 [ + - ]: 50 : if ( Value >>= n )
5382 [ + - ]: 50 : ((TimeField*)GetWindow())->SetExtFormat( (ExtTimeFieldFormat) n );
5383 : : }
5384 : 50 : break;
5385 : : case BASEPROPERTY_ENFORCE_FORMAT:
5386 : : {
5387 : 52 : sal_Bool bEnforce( sal_True );
5388 : 52 : OSL_VERIFY( Value >>= bEnforce );
5389 : 52 : static_cast< TimeField* >( GetWindow() )->EnforceValidValue( bEnforce );
5390 : : }
5391 : 52 : break;
5392 : : default:
5393 : : {
5394 [ + - ]: 2704 : VCLXFormattedSpinField::setProperty( PropertyName, Value );
5395 : : }
5396 : : }
5397 [ + - ]: 2704 : }
5398 : 2704 : }
5399 : :
5400 : 36 : ::com::sun::star::uno::Any VCLXTimeField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
5401 : : {
5402 [ + - ]: 36 : SolarMutexGuard aGuard;
5403 : :
5404 : 36 : ::com::sun::star::uno::Any aProp;
5405 [ + - ]: 36 : if ( GetWindow() )
5406 : : {
5407 [ + - ]: 36 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
5408 [ - - - - : 36 : switch ( nPropType )
+ ]
5409 : : {
5410 : : case BASEPROPERTY_TIME:
5411 : : {
5412 [ # # ][ # # ]: 0 : aProp <<= (sal_Int32) getTime();
5413 : : }
5414 : 0 : break;
5415 : : case BASEPROPERTY_TIMEMIN:
5416 : : {
5417 [ # # ][ # # ]: 0 : aProp <<= (sal_Int32) getMin();
5418 : : }
5419 : 0 : break;
5420 : : case BASEPROPERTY_TIMEMAX:
5421 : : {
5422 [ # # ][ # # ]: 0 : aProp <<= (sal_Int32) getMax();
5423 : : }
5424 : 0 : break;
5425 : : case BASEPROPERTY_ENFORCE_FORMAT:
5426 : : {
5427 [ # # ]: 0 : aProp <<= (sal_Bool)static_cast< TimeField* >( GetWindow() )->IsEnforceValidValue( );
5428 : : }
5429 : 0 : break;
5430 : : default:
5431 : : {
5432 [ + - ][ + - ]: 36 : aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
5433 : : }
5434 : : }
5435 : : }
5436 [ + - ]: 36 : return aProp;
5437 : : }
5438 : :
5439 : : // ----------------------------------------------------
5440 : : // class VCLXNumericField
5441 : : // ----------------------------------------------------
5442 : :
5443 : 27 : void VCLXNumericField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
5444 : : {
5445 : : PushPropertyIds( rIds,
5446 : : BASEPROPERTY_ALIGN,
5447 : : BASEPROPERTY_BACKGROUNDCOLOR,
5448 : : BASEPROPERTY_BORDER,
5449 : : BASEPROPERTY_BORDERCOLOR,
5450 : : BASEPROPERTY_DECIMALACCURACY,
5451 : : BASEPROPERTY_DEFAULTCONTROL,
5452 : : BASEPROPERTY_ENABLED,
5453 : : BASEPROPERTY_ENABLEVISIBLE,
5454 : : BASEPROPERTY_FONTDESCRIPTOR,
5455 : : BASEPROPERTY_HELPTEXT,
5456 : : BASEPROPERTY_HELPURL,
5457 : : BASEPROPERTY_NUMSHOWTHOUSANDSEP,
5458 : : BASEPROPERTY_PRINTABLE,
5459 : : BASEPROPERTY_READONLY,
5460 : : BASEPROPERTY_REPEAT,
5461 : : BASEPROPERTY_REPEAT_DELAY,
5462 : : BASEPROPERTY_SPIN,
5463 : : BASEPROPERTY_STRICTFORMAT,
5464 : : BASEPROPERTY_TABSTOP,
5465 : : BASEPROPERTY_VALUEMAX_DOUBLE,
5466 : : BASEPROPERTY_VALUEMIN_DOUBLE,
5467 : : BASEPROPERTY_VALUESTEP_DOUBLE,
5468 : : BASEPROPERTY_VALUE_DOUBLE,
5469 : : BASEPROPERTY_ENFORCE_FORMAT,
5470 : : BASEPROPERTY_HIDEINACTIVESELECTION,
5471 : : BASEPROPERTY_VERTICALALIGN,
5472 : : BASEPROPERTY_WRITING_MODE,
5473 : : BASEPROPERTY_CONTEXT_WRITING_MODE,
5474 : : BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
5475 : 27 : 0);
5476 : 27 : VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
5477 : 27 : }
5478 : :
5479 [ + - ]: 129 : VCLXNumericField::VCLXNumericField()
5480 : : {
5481 : 129 : }
5482 : :
5483 [ + - ]: 125 : VCLXNumericField::~VCLXNumericField()
5484 : : {
5485 [ - + ]: 250 : }
5486 : :
5487 : : // ::com::sun::star::uno::XInterface
5488 : 516 : ::com::sun::star::uno::Any VCLXNumericField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
5489 : : {
5490 : : ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
5491 [ + - ]: 516 : (static_cast< ::com::sun::star::awt::XNumericField* >(this)) );
5492 [ - + ][ + - ]: 516 : return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
5493 : : }
5494 : :
5495 : : // ::com::sun::star::lang::XTypeProvider
5496 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_START( VCLXNumericField )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
5497 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XNumericField>* ) NULL ),
5498 : : VCLXFormattedSpinField::getTypes()
5499 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_END
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
5500 : :
5501 : 0 : void VCLXNumericField::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException)
5502 : : {
5503 [ # # ]: 0 : SolarMutexGuard aGuard;
5504 : :
5505 : 0 : NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5506 [ # # ]: 0 : if ( pNumericFormatter )
5507 : : {
5508 : : // shift long value using decimal digits
5509 : : // (e.g., input 105 using 2 digits returns 1,05)
5510 : : // Thus, to set a value of 1,05, insert 105 and 2 digits
5511 : : pNumericFormatter->SetValue(
5512 [ # # ][ # # ]: 0 : (long)ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) );
5513 : :
5514 : : // #107218# Call same listeners like VCL would do after user interaction
5515 : 0 : Edit* pEdit = (Edit*)GetWindow();
5516 [ # # ]: 0 : if ( pEdit )
5517 : : {
5518 [ # # ]: 0 : SetSynthesizingVCLEvent( sal_True );
5519 [ # # ]: 0 : pEdit->SetModifyFlag();
5520 [ # # ]: 0 : pEdit->Modify();
5521 [ # # ]: 0 : SetSynthesizingVCLEvent( sal_False );
5522 : : }
5523 [ # # ]: 0 : }
5524 : 0 : }
5525 : :
5526 : 0 : double VCLXNumericField::getValue() throw(::com::sun::star::uno::RuntimeException)
5527 : : {
5528 [ # # ]: 0 : SolarMutexGuard aGuard;
5529 : :
5530 : 0 : NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5531 : : return pNumericFormatter
5532 [ # # ][ # # ]: 0 : ? ImplCalcDoubleValue( (double)pNumericFormatter->GetValue(), pNumericFormatter->GetDecimalDigits() )
5533 [ # # ][ # # ]: 0 : : 0;
5534 : : }
5535 : :
5536 : 0 : void VCLXNumericField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException)
5537 : : {
5538 [ # # ]: 0 : SolarMutexGuard aGuard;
5539 : :
5540 : 0 : NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5541 [ # # ]: 0 : if ( pNumericFormatter )
5542 : : pNumericFormatter->SetMin(
5543 [ # # ][ # # ]: 0 : (long)ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) );
[ # # ]
5544 : 0 : }
5545 : :
5546 : 0 : double VCLXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException)
5547 : : {
5548 [ # # ]: 0 : SolarMutexGuard aGuard;
5549 : :
5550 : 0 : NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5551 : : return pNumericFormatter
5552 [ # # ]: 0 : ? ImplCalcDoubleValue( (double)pNumericFormatter->GetMin(), pNumericFormatter->GetDecimalDigits() )
5553 [ # # ][ # # ]: 0 : : 0;
5554 : : }
5555 : :
5556 : 0 : void VCLXNumericField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException)
5557 : : {
5558 [ # # ]: 0 : SolarMutexGuard aGuard;
5559 : :
5560 : 0 : NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5561 [ # # ]: 0 : if ( pNumericFormatter )
5562 : : pNumericFormatter->SetMax(
5563 [ # # ][ # # ]: 0 : (long)ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) );
[ # # ]
5564 : 0 : }
5565 : :
5566 : 0 : double VCLXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException)
5567 : : {
5568 [ # # ]: 0 : SolarMutexGuard aGuard;
5569 : :
5570 : 0 : NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5571 : : return pNumericFormatter
5572 [ # # ]: 0 : ? ImplCalcDoubleValue( (double)pNumericFormatter->GetMax(), pNumericFormatter->GetDecimalDigits() )
5573 [ # # ][ # # ]: 0 : : 0;
5574 : : }
5575 : :
5576 : 0 : void VCLXNumericField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException)
5577 : : {
5578 [ # # ]: 0 : SolarMutexGuard aGuard;
5579 : :
5580 : 0 : NumericField* pNumericField = (NumericField*) GetWindow();
5581 [ # # ]: 0 : if ( pNumericField )
5582 : : pNumericField->SetFirst(
5583 [ # # ][ # # ]: 0 : (long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
5584 : 0 : }
5585 : :
5586 : 0 : double VCLXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeException)
5587 : : {
5588 [ # # ]: 0 : SolarMutexGuard aGuard;
5589 : :
5590 : 0 : NumericField* pNumericField = (NumericField*) GetWindow();
5591 : : return pNumericField
5592 [ # # ]: 0 : ? ImplCalcDoubleValue( (double)pNumericField->GetFirst(), pNumericField->GetDecimalDigits() )
5593 [ # # ][ # # ]: 0 : : 0;
5594 : : }
5595 : :
5596 : 0 : void VCLXNumericField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException)
5597 : : {
5598 [ # # ]: 0 : SolarMutexGuard aGuard;
5599 : :
5600 : 0 : NumericField* pNumericField = (NumericField*) GetWindow();
5601 [ # # ]: 0 : if ( pNumericField )
5602 : : pNumericField->SetLast(
5603 [ # # ][ # # ]: 0 : (long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
5604 : 0 : }
5605 : :
5606 : 0 : double VCLXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException)
5607 : : {
5608 [ # # ]: 0 : SolarMutexGuard aGuard;
5609 : :
5610 : 0 : NumericField* pNumericField = (NumericField*) GetWindow();
5611 : : return pNumericField
5612 [ # # ]: 0 : ? ImplCalcDoubleValue( (double)pNumericField->GetLast(), pNumericField->GetDecimalDigits() )
5613 [ # # ][ # # ]: 0 : : 0;
5614 : : }
5615 : :
5616 : 0 : void VCLXNumericField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
5617 : : {
5618 : 0 : VCLXFormattedSpinField::setStrictFormat( bStrict );
5619 : 0 : }
5620 : :
5621 : 0 : sal_Bool VCLXNumericField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
5622 : : {
5623 : 0 : return VCLXFormattedSpinField::isStrictFormat();
5624 : : }
5625 : :
5626 : :
5627 : 0 : void VCLXNumericField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException)
5628 : : {
5629 [ # # ]: 0 : SolarMutexGuard aGuard;
5630 : :
5631 : 0 : NumericField* pNumericField = (NumericField*) GetWindow();
5632 [ # # ]: 0 : if ( pNumericField )
5633 : : pNumericField->SetSpinSize(
5634 [ # # ][ # # ]: 0 : (long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
5635 : 0 : }
5636 : :
5637 : 0 : double VCLXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
5638 : : {
5639 [ # # ]: 0 : SolarMutexGuard aGuard;
5640 : :
5641 : 0 : NumericField* pNumericField = (NumericField*) GetWindow();
5642 : : return pNumericField
5643 [ # # ]: 0 : ? ImplCalcDoubleValue( (double)pNumericField->GetSpinSize(), pNumericField->GetDecimalDigits() )
5644 [ # # ][ # # ]: 0 : : 0;
5645 : : }
5646 : :
5647 : 0 : void VCLXNumericField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException)
5648 : : {
5649 [ # # ]: 0 : SolarMutexGuard aGuard;
5650 : :
5651 : 0 : NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5652 [ # # ]: 0 : if ( pNumericFormatter )
5653 : : {
5654 [ # # ]: 0 : double n = getValue();
5655 [ # # ]: 0 : pNumericFormatter->SetDecimalDigits( Value );
5656 [ # # ]: 0 : setValue( n );
5657 [ # # ]: 0 : }
5658 : 0 : }
5659 : :
5660 : 0 : sal_Int16 VCLXNumericField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
5661 : : {
5662 [ # # ]: 0 : SolarMutexGuard aGuard;
5663 : :
5664 : 0 : NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5665 [ # # ][ # # ]: 0 : return pNumericFormatter ? pNumericFormatter->GetDecimalDigits() : 0;
[ # # ]
5666 : : }
5667 : :
5668 : 0 : void VCLXNumericField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
5669 : : {
5670 [ # # ]: 0 : SolarMutexGuard aGuard;
5671 : :
5672 [ # # ]: 0 : if ( GetWindow() )
5673 : : {
5674 : 0 : sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
5675 : :
5676 [ # # ]: 0 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
5677 [ # # # # : 0 : switch ( nPropType )
# # # ]
5678 : : {
5679 : : case BASEPROPERTY_VALUE_DOUBLE:
5680 : : {
5681 [ # # ]: 0 : if ( bVoid )
5682 : : {
5683 : 0 : ((NumericField*)GetWindow())->EnableEmptyFieldValue( sal_True );
5684 [ # # ]: 0 : ((NumericField*)GetWindow())->SetEmptyFieldValue();
5685 : : }
5686 : : else
5687 : : {
5688 : 0 : double d = 0;
5689 [ # # ]: 0 : if ( Value >>= d )
5690 [ # # ]: 0 : setValue( d );
5691 : : }
5692 : : }
5693 : 0 : break;
5694 : : case BASEPROPERTY_VALUEMIN_DOUBLE:
5695 : : {
5696 : 0 : double d = 0;
5697 [ # # ]: 0 : if ( Value >>= d )
5698 [ # # ]: 0 : setMin( d );
5699 : : }
5700 : 0 : break;
5701 : : case BASEPROPERTY_VALUEMAX_DOUBLE:
5702 : : {
5703 : 0 : double d = 0;
5704 [ # # ]: 0 : if ( Value >>= d )
5705 [ # # ]: 0 : setMax( d );
5706 : : }
5707 : 0 : break;
5708 : : case BASEPROPERTY_VALUESTEP_DOUBLE:
5709 : : {
5710 : 0 : double d = 0;
5711 [ # # ]: 0 : if ( Value >>= d )
5712 [ # # ]: 0 : setSpinSize( d );
5713 : : }
5714 : 0 : break;
5715 : : case BASEPROPERTY_DECIMALACCURACY:
5716 : : {
5717 : 0 : sal_Int16 n = sal_Int16();
5718 [ # # ]: 0 : if ( Value >>= n )
5719 [ # # ]: 0 : setDecimalDigits( n );
5720 : : }
5721 : 0 : break;
5722 : : case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
5723 : : {
5724 : 0 : sal_Bool b = sal_Bool();
5725 [ # # ]: 0 : if ( Value >>= b )
5726 [ # # ]: 0 : ((NumericField*)GetWindow())->SetUseThousandSep( b );
5727 : : }
5728 : 0 : break;
5729 : : default:
5730 : : {
5731 [ # # ]: 0 : VCLXFormattedSpinField::setProperty( PropertyName, Value );
5732 : : }
5733 : : }
5734 [ # # ]: 0 : }
5735 : 0 : }
5736 : :
5737 : 0 : ::com::sun::star::uno::Any VCLXNumericField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
5738 : : {
5739 [ # # ]: 0 : SolarMutexGuard aGuard;
5740 : :
5741 : 0 : ::com::sun::star::uno::Any aProp;
5742 : 0 : FormatterBase* pFormatter = GetFormatter();
5743 [ # # ]: 0 : if ( pFormatter )
5744 : : {
5745 [ # # ]: 0 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
5746 [ # # # # : 0 : switch ( nPropType )
# # ]
5747 : : {
5748 : : case BASEPROPERTY_VALUE_DOUBLE:
5749 : : {
5750 [ # # ][ # # ]: 0 : aProp <<= (double) getValue();
5751 : : }
5752 : 0 : break;
5753 : : case BASEPROPERTY_VALUEMIN_DOUBLE:
5754 : : {
5755 [ # # ][ # # ]: 0 : aProp <<= (double) getMin();
5756 : : }
5757 : 0 : break;
5758 : : case BASEPROPERTY_VALUEMAX_DOUBLE:
5759 : : {
5760 [ # # ][ # # ]: 0 : aProp <<= (double) getMax();
5761 : : }
5762 : 0 : break;
5763 : : case BASEPROPERTY_VALUESTEP_DOUBLE:
5764 : : {
5765 [ # # ][ # # ]: 0 : aProp <<= (double) getSpinSize();
5766 : : }
5767 : 0 : break;
5768 : : case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
5769 : : {
5770 [ # # ]: 0 : aProp <<= (sal_Bool) ((NumericField*)GetWindow())->IsUseThousandSep();
5771 : : }
5772 : 0 : break;
5773 : : default:
5774 : : {
5775 [ # # ][ # # ]: 0 : aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
5776 : : }
5777 : : }
5778 : : }
5779 [ # # ]: 0 : return aProp;
5780 : : }
5781 : :
5782 : :
5783 : : // ----------------------------------------------------
5784 : : // class VCLXMetricField
5785 : : // ----------------------------------------------------
5786 : :
5787 : 0 : void VCLXMetricField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
5788 : : {
5789 : : PushPropertyIds( rIds,
5790 : : BASEPROPERTY_ALIGN,
5791 : : BASEPROPERTY_BACKGROUNDCOLOR,
5792 : : BASEPROPERTY_BORDER,
5793 : : BASEPROPERTY_BORDERCOLOR,
5794 : : BASEPROPERTY_DECIMALACCURACY,
5795 : : BASEPROPERTY_DEFAULTCONTROL,
5796 : : BASEPROPERTY_ENABLED,
5797 : : BASEPROPERTY_ENABLEVISIBLE,
5798 : : BASEPROPERTY_FONTDESCRIPTOR,
5799 : : BASEPROPERTY_HELPTEXT,
5800 : : BASEPROPERTY_HELPURL,
5801 : : BASEPROPERTY_NUMSHOWTHOUSANDSEP,
5802 : : BASEPROPERTY_PRINTABLE,
5803 : : BASEPROPERTY_READONLY,
5804 : : BASEPROPERTY_REPEAT,
5805 : : BASEPROPERTY_REPEAT_DELAY,
5806 : : BASEPROPERTY_SPIN,
5807 : : BASEPROPERTY_STRICTFORMAT,
5808 : : BASEPROPERTY_TABSTOP,
5809 : : BASEPROPERTY_ENFORCE_FORMAT,
5810 : : BASEPROPERTY_HIDEINACTIVESELECTION,
5811 : : BASEPROPERTY_UNIT,
5812 : : BASEPROPERTY_CUSTOMUNITTEXT,
5813 : : BASEPROPERTY_WRITING_MODE,
5814 : : BASEPROPERTY_CONTEXT_WRITING_MODE,
5815 : : BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
5816 : 0 : 0);
5817 : 0 : VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
5818 : 0 : }
5819 : :
5820 [ # # ]: 0 : VCLXMetricField::VCLXMetricField()
5821 : : {
5822 : 0 : }
5823 : :
5824 [ # # ]: 0 : VCLXMetricField::~VCLXMetricField()
5825 : : {
5826 [ # # ]: 0 : }
5827 : :
5828 : 0 : MetricFormatter *VCLXMetricField::GetMetricFormatter() throw(::com::sun::star::uno::RuntimeException)
5829 : : {
5830 : 0 : MetricFormatter *pFormatter = (MetricFormatter *) GetFormatter();
5831 [ # # ]: 0 : if (!pFormatter)
5832 [ # # ]: 0 : throw ::com::sun::star::uno::RuntimeException();
5833 : 0 : return pFormatter;
5834 : : }
5835 : :
5836 : 0 : MetricField *VCLXMetricField::GetMetricField() throw(::com::sun::star::uno::RuntimeException)
5837 : : {
5838 : 0 : MetricField *pField = (MetricField *) GetWindow();
5839 [ # # ]: 0 : if (!pField)
5840 [ # # ]: 0 : throw ::com::sun::star::uno::RuntimeException();
5841 : 0 : return pField;
5842 : : }
5843 : :
5844 : : // ::com::sun::star::uno::XInterface
5845 : 0 : ::com::sun::star::uno::Any VCLXMetricField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
5846 : : {
5847 : : ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
5848 [ # # ]: 0 : (static_cast< ::com::sun::star::awt::XMetricField* >(this)) );
5849 [ # # ][ # # ]: 0 : return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
5850 : : }
5851 : :
5852 : : // ::com::sun::star::lang::XTypeProvider
5853 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_START( VCLXMetricField )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
5854 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMetricField>* ) NULL ),
5855 : : VCLXFormattedSpinField::getTypes()
5856 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_END
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
5857 : :
5858 : : // FIXME: later ...
5859 : : #define MetricUnitUnoToVcl(a) ((FieldUnit)(a))
5860 : :
5861 : : #define METRIC_MAP_PAIR(method,parent) \
5862 : : sal_Int64 VCLXMetricField::get##method( sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException) \
5863 : : { \
5864 : : SolarMutexGuard aGuard; \
5865 : : return GetMetric##parent()->Get##method( MetricUnitUnoToVcl( nUnit ) ); \
5866 : : } \
5867 : : void VCLXMetricField::set##method( sal_Int64 nValue, sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException) \
5868 : : { \
5869 : : SolarMutexGuard aGuard; \
5870 : : GetMetric##parent()->Set##method( nValue, MetricUnitUnoToVcl( nUnit ) ); \
5871 : : }
5872 : :
5873 [ # # ][ # # ]: 0 : METRIC_MAP_PAIR(Min, Formatter)
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
5874 [ # # ][ # # ]: 0 : METRIC_MAP_PAIR(Max, Formatter)
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
5875 [ # # ][ # # ]: 0 : METRIC_MAP_PAIR(First, Field)
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
5876 [ # # ][ # # ]: 0 : METRIC_MAP_PAIR(Last, Field)
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
5877 : :
5878 : : #undef METRIC_MAP_PAIR
5879 : :
5880 : 0 : ::sal_Int64 VCLXMetricField::getValue( ::sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException)
5881 : : {
5882 [ # # ]: 0 : SolarMutexGuard aGuard;
5883 [ # # ][ # # ]: 0 : return GetMetricFormatter()->GetValue( MetricUnitUnoToVcl( nUnit ) );
[ # # ]
5884 : : }
5885 : :
5886 : 0 : ::sal_Int64 VCLXMetricField::getCorrectedValue( ::sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException)
5887 : : {
5888 [ # # ]: 0 : SolarMutexGuard aGuard;
5889 [ # # ][ # # ]: 0 : return GetMetricFormatter()->GetCorrectedValue( MetricUnitUnoToVcl( nUnit ) );
[ # # ]
5890 : : }
5891 : :
5892 : : // FIXME: acute cut/paste evilness - move this to the parent Edit class ?
5893 : 0 : void VCLXMetricField::CallListeners()
5894 : : {
5895 : : // #107218# Call same listeners like VCL would do after user interaction
5896 : 0 : Edit* pEdit = (Edit*)GetWindow();
5897 [ # # ]: 0 : if ( pEdit )
5898 : : {
5899 : 0 : SetSynthesizingVCLEvent( sal_True );
5900 : 0 : pEdit->SetModifyFlag();
5901 : 0 : pEdit->Modify();
5902 : 0 : SetSynthesizingVCLEvent( sal_False );
5903 : : }
5904 : 0 : }
5905 : :
5906 : 0 : void VCLXMetricField::setValue( ::sal_Int64 Value, ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException)
5907 : : {
5908 [ # # ]: 0 : SolarMutexGuard aGuard;
5909 [ # # ][ # # ]: 0 : GetMetricFormatter()->SetValue( Value, MetricUnitUnoToVcl( Unit ) );
5910 [ # # ][ # # ]: 0 : CallListeners();
5911 : 0 : }
5912 : :
5913 : 0 : void VCLXMetricField::setUserValue( ::sal_Int64 Value, ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException)
5914 : : {
5915 [ # # ]: 0 : SolarMutexGuard aGuard;
5916 [ # # ][ # # ]: 0 : GetMetricFormatter()->SetUserValue( Value, MetricUnitUnoToVcl( Unit ) );
5917 [ # # ][ # # ]: 0 : CallListeners();
5918 : 0 : }
5919 : :
5920 : 0 : void VCLXMetricField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
5921 : : {
5922 : 0 : VCLXFormattedSpinField::setStrictFormat( bStrict );
5923 : 0 : }
5924 : :
5925 : 0 : sal_Bool VCLXMetricField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
5926 : : {
5927 : 0 : return VCLXFormattedSpinField::isStrictFormat();
5928 : : }
5929 : :
5930 : 0 : void VCLXMetricField::setSpinSize( sal_Int64 Value ) throw(::com::sun::star::uno::RuntimeException)
5931 : : {
5932 [ # # ]: 0 : SolarMutexGuard aGuard;
5933 [ # # ][ # # ]: 0 : GetMetricField()->SetSpinSize( Value );
5934 : 0 : }
5935 : :
5936 : 0 : sal_Int64 VCLXMetricField::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
5937 : : {
5938 [ # # ]: 0 : SolarMutexGuard aGuard;
5939 [ # # ][ # # ]: 0 : return GetMetricField()->GetSpinSize();
5940 : : }
5941 : :
5942 : 0 : void VCLXMetricField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException)
5943 : : {
5944 [ # # ]: 0 : SolarMutexGuard aGuard;
5945 [ # # ][ # # ]: 0 : GetMetricFormatter()->SetDecimalDigits( Value );
[ # # ]
5946 : 0 : }
5947 : :
5948 : 0 : sal_Int16 VCLXMetricField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
5949 : : {
5950 [ # # ]: 0 : SolarMutexGuard aGuard;
5951 : :
5952 : 0 : NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5953 [ # # ][ # # ]: 0 : return pNumericFormatter ? pNumericFormatter->GetDecimalDigits() : 0;
[ # # ]
5954 : : }
5955 : :
5956 : 0 : void VCLXMetricField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
5957 : : {
5958 [ # # ]: 0 : SolarMutexGuard aGuard;
5959 : :
5960 [ # # ]: 0 : if ( GetWindow() )
5961 : : {
5962 [ # # ]: 0 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
5963 [ # # # # : 0 : switch ( nPropType )
# ]
5964 : : {
5965 : : case BASEPROPERTY_DECIMALACCURACY:
5966 : : {
5967 : 0 : sal_Int16 n = 0;
5968 [ # # ]: 0 : if ( Value >>= n )
5969 [ # # ]: 0 : setDecimalDigits( n );
5970 : : break;
5971 : : }
5972 : : case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
5973 : : {
5974 : 0 : sal_Bool b = sal_False;
5975 [ # # ]: 0 : if ( Value >>= b )
5976 [ # # ]: 0 : ((NumericField*)GetWindow())->SetUseThousandSep( b );
5977 : : }
5978 : 0 : break;
5979 : : case BASEPROPERTY_UNIT:
5980 : : {
5981 : 0 : sal_uInt16 nVal = 0;
5982 [ # # ]: 0 : if ( Value >>= nVal )
5983 [ # # ]: 0 : ((MetricField*)GetWindow())->SetUnit( (FieldUnit) nVal );
5984 : : break;
5985 : : }
5986 : : case BASEPROPERTY_CUSTOMUNITTEXT:
5987 : : {
5988 : 0 : rtl::OUString aStr;
5989 [ # # ]: 0 : if ( Value >>= aStr )
5990 [ # # ][ # # ]: 0 : ((MetricField*)GetWindow())->SetCustomUnitText( aStr );
[ # # ]
5991 : 0 : break;
5992 : : }
5993 : : default:
5994 : : {
5995 [ # # ]: 0 : VCLXFormattedSpinField::setProperty( PropertyName, Value );
5996 : 0 : break;
5997 : : }
5998 : : }
5999 [ # # ]: 0 : }
6000 : 0 : }
6001 : :
6002 : 0 : ::com::sun::star::uno::Any VCLXMetricField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
6003 : : {
6004 [ # # ]: 0 : SolarMutexGuard aGuard;
6005 : :
6006 : 0 : ::com::sun::star::uno::Any aProp;
6007 : 0 : FormatterBase* pFormatter = GetFormatter();
6008 [ # # ]: 0 : if ( pFormatter )
6009 : : {
6010 [ # # ]: 0 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
6011 [ # # # # ]: 0 : switch ( nPropType )
6012 : : {
6013 : : case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
6014 [ # # ]: 0 : aProp <<= (sal_Bool) ((NumericField*)GetWindow())->IsUseThousandSep();
6015 : 0 : break;
6016 : : case BASEPROPERTY_UNIT:
6017 [ # # ]: 0 : aProp <<= (sal_uInt16) ((MetricField*)GetWindow())->GetUnit();
6018 : 0 : break;
6019 : : case BASEPROPERTY_CUSTOMUNITTEXT:
6020 [ # # ][ # # ]: 0 : aProp <<= rtl::OUString (((MetricField*)GetWindow())->GetCustomUnitText());
6021 : 0 : break;
6022 : : default:
6023 : : {
6024 [ # # ][ # # ]: 0 : aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
6025 : 0 : break;
6026 : : }
6027 : : }
6028 : : }
6029 [ # # ]: 0 : return aProp;
6030 : : }
6031 : :
6032 : :
6033 : : // ----------------------------------------------------
6034 : : // class VCLXCurrencyField
6035 : : // ----------------------------------------------------
6036 : :
6037 : 25 : void VCLXCurrencyField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
6038 : : {
6039 : : PushPropertyIds( rIds,
6040 : : BASEPROPERTY_ALIGN,
6041 : : BASEPROPERTY_BACKGROUNDCOLOR,
6042 : : BASEPROPERTY_BORDER,
6043 : : BASEPROPERTY_BORDERCOLOR,
6044 : : BASEPROPERTY_CURRENCYSYMBOL,
6045 : : BASEPROPERTY_CURSYM_POSITION,
6046 : : BASEPROPERTY_DECIMALACCURACY,
6047 : : BASEPROPERTY_DEFAULTCONTROL,
6048 : : BASEPROPERTY_ENABLED,
6049 : : BASEPROPERTY_ENABLEVISIBLE,
6050 : : BASEPROPERTY_FONTDESCRIPTOR,
6051 : : BASEPROPERTY_HELPTEXT,
6052 : : BASEPROPERTY_HELPURL,
6053 : : BASEPROPERTY_NUMSHOWTHOUSANDSEP,
6054 : : BASEPROPERTY_PRINTABLE,
6055 : : BASEPROPERTY_READONLY,
6056 : : BASEPROPERTY_REPEAT,
6057 : : BASEPROPERTY_REPEAT_DELAY,
6058 : : BASEPROPERTY_SPIN,
6059 : : BASEPROPERTY_STRICTFORMAT,
6060 : : BASEPROPERTY_TABSTOP,
6061 : : BASEPROPERTY_VALUEMAX_DOUBLE,
6062 : : BASEPROPERTY_VALUEMIN_DOUBLE,
6063 : : BASEPROPERTY_VALUESTEP_DOUBLE,
6064 : : BASEPROPERTY_VALUE_DOUBLE,
6065 : : BASEPROPERTY_ENFORCE_FORMAT,
6066 : : BASEPROPERTY_HIDEINACTIVESELECTION,
6067 : : BASEPROPERTY_VERTICALALIGN,
6068 : : BASEPROPERTY_WRITING_MODE,
6069 : : BASEPROPERTY_CONTEXT_WRITING_MODE,
6070 : : BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
6071 : 25 : 0);
6072 : 25 : VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
6073 : 25 : }
6074 : :
6075 [ # # ]: 0 : VCLXCurrencyField::VCLXCurrencyField()
6076 : : {
6077 : 0 : }
6078 : :
6079 [ # # ]: 0 : VCLXCurrencyField::~VCLXCurrencyField()
6080 : : {
6081 [ # # ]: 0 : }
6082 : :
6083 : : // ::com::sun::star::uno::XInterface
6084 : 0 : ::com::sun::star::uno::Any VCLXCurrencyField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
6085 : : {
6086 : : ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
6087 [ # # ]: 0 : (static_cast< ::com::sun::star::awt::XCurrencyField* >(this)) );
6088 [ # # ][ # # ]: 0 : return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
6089 : : }
6090 : :
6091 : : // ::com::sun::star::lang::XTypeProvider
6092 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_START( VCLXCurrencyField )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
6093 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCurrencyField>* ) NULL ),
6094 : : VCLXFormattedSpinField::getTypes()
6095 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_END
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
6096 : :
6097 : 0 : void VCLXCurrencyField::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException)
6098 : : {
6099 [ # # ]: 0 : SolarMutexGuard aGuard;
6100 : :
6101 : 0 : LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
6102 [ # # ]: 0 : if ( pCurrencyFormatter )
6103 : : {
6104 : : // shift long value using decimal digits
6105 : : // (e.g., input 105 using 2 digits returns 1,05)
6106 : : // Thus, to set a value of 1,05, insert 105 and 2 digits
6107 : : pCurrencyFormatter->SetValue(
6108 [ # # ][ # # ]: 0 : ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) );
[ # # ]
6109 : :
6110 : : // #107218# Call same listeners like VCL would do after user interaction
6111 : 0 : Edit* pEdit = (Edit*)GetWindow();
6112 [ # # ]: 0 : if ( pEdit )
6113 : : {
6114 [ # # ]: 0 : SetSynthesizingVCLEvent( sal_True );
6115 [ # # ]: 0 : pEdit->SetModifyFlag();
6116 [ # # ]: 0 : pEdit->Modify();
6117 [ # # ]: 0 : SetSynthesizingVCLEvent( sal_False );
6118 : : }
6119 [ # # ]: 0 : }
6120 : 0 : }
6121 : :
6122 : 0 : double VCLXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeException)
6123 : : {
6124 [ # # ]: 0 : SolarMutexGuard aGuard;
6125 : :
6126 : 0 : LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
6127 : : return pCurrencyFormatter
6128 [ # # ][ # # ]: 0 : ? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetValue(), pCurrencyFormatter->GetDecimalDigits() )
[ # # ][ # # ]
[ # # ]
6129 [ # # ][ # # ]: 0 : : 0;
6130 : : }
6131 : :
6132 : 0 : void VCLXCurrencyField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException)
6133 : : {
6134 [ # # ]: 0 : SolarMutexGuard aGuard;
6135 : :
6136 : 0 : LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
6137 [ # # ]: 0 : if ( pCurrencyFormatter )
6138 : : pCurrencyFormatter->SetMin(
6139 [ # # ][ # # ]: 0 : ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) );
[ # # ][ # # ]
6140 : 0 : }
6141 : :
6142 : 0 : double VCLXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException)
6143 : : {
6144 [ # # ]: 0 : SolarMutexGuard aGuard;
6145 : :
6146 : 0 : LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
6147 : : return pCurrencyFormatter
6148 [ # # ][ # # ]: 0 : ? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetMin(), pCurrencyFormatter->GetDecimalDigits() )
[ # # ][ # # ]
[ # # ]
6149 [ # # ][ # # ]: 0 : : 0;
6150 : : }
6151 : :
6152 : 0 : void VCLXCurrencyField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException)
6153 : : {
6154 [ # # ]: 0 : SolarMutexGuard aGuard;
6155 : :
6156 : 0 : LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
6157 [ # # ]: 0 : if ( pCurrencyFormatter )
6158 : : pCurrencyFormatter->SetMax(
6159 [ # # ][ # # ]: 0 : ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) );
[ # # ][ # # ]
6160 : 0 : }
6161 : :
6162 : 0 : double VCLXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException)
6163 : : {
6164 [ # # ]: 0 : SolarMutexGuard aGuard;
6165 : :
6166 : 0 : LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
6167 : : return pCurrencyFormatter
6168 [ # # ][ # # ]: 0 : ? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetMax(), pCurrencyFormatter->GetDecimalDigits() )
[ # # ][ # # ]
[ # # ]
6169 [ # # ][ # # ]: 0 : : 0;
6170 : : }
6171 : :
6172 : 0 : void VCLXCurrencyField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException)
6173 : : {
6174 [ # # ]: 0 : SolarMutexGuard aGuard;
6175 : :
6176 : 0 : LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
6177 [ # # ]: 0 : if ( pCurrencyField )
6178 : : pCurrencyField->SetFirst(
6179 [ # # ][ # # ]: 0 : ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
[ # # ][ # # ]
6180 : 0 : }
6181 : :
6182 : 0 : double VCLXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeException)
6183 : : {
6184 [ # # ]: 0 : SolarMutexGuard aGuard;
6185 : :
6186 : 0 : LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
6187 : : return pCurrencyField
6188 [ # # ][ # # ]: 0 : ? ImplCalcDoubleValue( (double)pCurrencyField->GetFirst(), pCurrencyField->GetDecimalDigits() )
[ # # ][ # # ]
[ # # ]
6189 [ # # ][ # # ]: 0 : : 0;
6190 : : }
6191 : :
6192 : 0 : void VCLXCurrencyField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException)
6193 : : {
6194 [ # # ]: 0 : SolarMutexGuard aGuard;
6195 : :
6196 : 0 : LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
6197 [ # # ]: 0 : if ( pCurrencyField )
6198 : : pCurrencyField->SetLast(
6199 [ # # ][ # # ]: 0 : ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
[ # # ][ # # ]
6200 : 0 : }
6201 : :
6202 : 0 : double VCLXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeException)
6203 : : {
6204 [ # # ]: 0 : SolarMutexGuard aGuard;
6205 : :
6206 : 0 : LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
6207 : : return pCurrencyField
6208 [ # # ][ # # ]: 0 : ? ImplCalcDoubleValue( (double)pCurrencyField->GetLast(), pCurrencyField->GetDecimalDigits() )
[ # # ][ # # ]
[ # # ]
6209 [ # # ][ # # ]: 0 : : 0;
6210 : : }
6211 : :
6212 : 0 : void VCLXCurrencyField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException)
6213 : : {
6214 [ # # ]: 0 : SolarMutexGuard aGuard;
6215 : :
6216 : 0 : LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
6217 [ # # ]: 0 : if ( pCurrencyField )
6218 : : pCurrencyField->SetSpinSize(
6219 [ # # ][ # # ]: 0 : ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
[ # # ][ # # ]
6220 : 0 : }
6221 : :
6222 : 0 : double VCLXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
6223 : : {
6224 [ # # ]: 0 : SolarMutexGuard aGuard;
6225 : :
6226 : 0 : LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
6227 : : return pCurrencyField
6228 [ # # ][ # # ]: 0 : ? ImplCalcDoubleValue( (double)pCurrencyField->GetSpinSize(), pCurrencyField->GetDecimalDigits() )
[ # # ][ # # ]
[ # # ]
6229 [ # # ][ # # ]: 0 : : 0;
6230 : : }
6231 : :
6232 : 0 : void VCLXCurrencyField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
6233 : : {
6234 : 0 : VCLXFormattedSpinField::setStrictFormat( bStrict );
6235 : 0 : }
6236 : :
6237 : 0 : sal_Bool VCLXCurrencyField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
6238 : : {
6239 : 0 : return VCLXFormattedSpinField::isStrictFormat();
6240 : : }
6241 : :
6242 : :
6243 : 0 : void VCLXCurrencyField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException)
6244 : : {
6245 [ # # ]: 0 : SolarMutexGuard aGuard;
6246 : :
6247 : 0 : LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
6248 [ # # ]: 0 : if ( pCurrencyFormatter )
6249 : : {
6250 [ # # ]: 0 : double n = getValue();
6251 [ # # ]: 0 : pCurrencyFormatter->SetDecimalDigits( Value );
6252 [ # # ]: 0 : setValue( n );
6253 [ # # ]: 0 : }
6254 : 0 : }
6255 : :
6256 : 0 : sal_Int16 VCLXCurrencyField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
6257 : : {
6258 [ # # ]: 0 : SolarMutexGuard aGuard;
6259 : :
6260 : 0 : LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
6261 [ # # ][ # # ]: 0 : return pCurrencyFormatter ? pCurrencyFormatter->GetDecimalDigits() : 0;
[ # # ]
6262 : : }
6263 : :
6264 : 0 : void VCLXCurrencyField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
6265 : : {
6266 [ # # ]: 0 : SolarMutexGuard aGuard;
6267 : :
6268 [ # # ]: 0 : if ( GetWindow() )
6269 : : {
6270 : 0 : sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
6271 : :
6272 [ # # ]: 0 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
6273 [ # # # # : 0 : switch ( nPropType )
# # # # ]
6274 : : {
6275 : : case BASEPROPERTY_VALUE_DOUBLE:
6276 : : {
6277 [ # # ]: 0 : if ( bVoid )
6278 : : {
6279 : 0 : ((LongCurrencyField*)GetWindow())->EnableEmptyFieldValue( sal_True );
6280 [ # # ]: 0 : ((LongCurrencyField*)GetWindow())->SetEmptyFieldValue();
6281 : : }
6282 : : else
6283 : : {
6284 : 0 : double d = 0;
6285 [ # # ]: 0 : if ( Value >>= d )
6286 [ # # ]: 0 : setValue( d );
6287 : : }
6288 : : }
6289 : 0 : break;
6290 : : case BASEPROPERTY_VALUEMIN_DOUBLE:
6291 : : {
6292 : 0 : double d = 0;
6293 [ # # ]: 0 : if ( Value >>= d )
6294 [ # # ]: 0 : setMin( d );
6295 : : }
6296 : 0 : break;
6297 : : case BASEPROPERTY_VALUEMAX_DOUBLE:
6298 : : {
6299 : 0 : double d = 0;
6300 [ # # ]: 0 : if ( Value >>= d )
6301 [ # # ]: 0 : setMax( d );
6302 : : }
6303 : 0 : break;
6304 : : case BASEPROPERTY_VALUESTEP_DOUBLE:
6305 : : {
6306 : 0 : double d = 0;
6307 [ # # ]: 0 : if ( Value >>= d )
6308 [ # # ]: 0 : setSpinSize( d );
6309 : : }
6310 : 0 : break;
6311 : : case BASEPROPERTY_DECIMALACCURACY:
6312 : : {
6313 : 0 : sal_Int16 n = sal_Int16();
6314 [ # # ]: 0 : if ( Value >>= n )
6315 [ # # ]: 0 : setDecimalDigits( n );
6316 : : }
6317 : 0 : break;
6318 : : case BASEPROPERTY_CURRENCYSYMBOL:
6319 : : {
6320 : 0 : ::rtl::OUString aString;
6321 [ # # ]: 0 : if ( Value >>= aString )
6322 [ # # ][ # # ]: 0 : ((LongCurrencyField*)GetWindow())->SetCurrencySymbol( aString );
[ # # ]
6323 : : }
6324 : 0 : break;
6325 : : case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
6326 : : {
6327 : 0 : sal_Bool b = sal_Bool();
6328 [ # # ]: 0 : if ( Value >>= b )
6329 [ # # ]: 0 : ((LongCurrencyField*)GetWindow())->SetUseThousandSep( b );
6330 : : }
6331 : 0 : break;
6332 : : default:
6333 : : {
6334 [ # # ]: 0 : VCLXFormattedSpinField::setProperty( PropertyName, Value );
6335 : : }
6336 : : }
6337 [ # # ]: 0 : }
6338 : 0 : }
6339 : :
6340 : 0 : ::com::sun::star::uno::Any VCLXCurrencyField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
6341 : : {
6342 [ # # ]: 0 : SolarMutexGuard aGuard;
6343 : :
6344 : 0 : ::com::sun::star::uno::Any aProp;
6345 : 0 : FormatterBase* pFormatter = GetFormatter();
6346 [ # # ]: 0 : if ( pFormatter )
6347 : : {
6348 [ # # ]: 0 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
6349 [ # # # # : 0 : switch ( nPropType )
# # # ]
6350 : : {
6351 : : case BASEPROPERTY_VALUE_DOUBLE:
6352 : : {
6353 [ # # ][ # # ]: 0 : aProp <<= (double) getValue();
6354 : : }
6355 : 0 : break;
6356 : : case BASEPROPERTY_VALUEMIN_DOUBLE:
6357 : : {
6358 [ # # ][ # # ]: 0 : aProp <<= (double) getMin();
6359 : : }
6360 : 0 : break;
6361 : : case BASEPROPERTY_VALUEMAX_DOUBLE:
6362 : : {
6363 [ # # ][ # # ]: 0 : aProp <<= (double) getMax();
6364 : : }
6365 : 0 : break;
6366 : : case BASEPROPERTY_VALUESTEP_DOUBLE:
6367 : : {
6368 [ # # ][ # # ]: 0 : aProp <<= (double) getSpinSize();
6369 : : }
6370 : 0 : break;
6371 : : case BASEPROPERTY_CURRENCYSYMBOL:
6372 : : {
6373 [ # # ][ # # ]: 0 : aProp <<= ::rtl::OUString( ((LongCurrencyField*)GetWindow())->GetCurrencySymbol() );
[ # # ][ # # ]
6374 : : }
6375 : 0 : break;
6376 : : case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
6377 : : {
6378 [ # # ]: 0 : aProp <<= (sal_Bool) ((LongCurrencyField*)GetWindow())->IsUseThousandSep();
6379 : : }
6380 : 0 : break;
6381 : : default:
6382 : : {
6383 [ # # ][ # # ]: 0 : aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
6384 : : }
6385 : : }
6386 : : }
6387 [ # # ]: 0 : return aProp;
6388 : : }
6389 : :
6390 : : // ----------------------------------------------------
6391 : : // class VCLXPatternField
6392 : : // ----------------------------------------------------
6393 : :
6394 : 25 : void VCLXPatternField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
6395 : : {
6396 : : PushPropertyIds( rIds,
6397 : : BASEPROPERTY_ALIGN,
6398 : : BASEPROPERTY_BACKGROUNDCOLOR,
6399 : : BASEPROPERTY_BORDER,
6400 : : BASEPROPERTY_BORDERCOLOR,
6401 : : BASEPROPERTY_DEFAULTCONTROL,
6402 : : BASEPROPERTY_EDITMASK,
6403 : : BASEPROPERTY_ENABLED,
6404 : : BASEPROPERTY_ENABLEVISIBLE,
6405 : : BASEPROPERTY_FONTDESCRIPTOR,
6406 : : BASEPROPERTY_HELPTEXT,
6407 : : BASEPROPERTY_HELPURL,
6408 : : BASEPROPERTY_LITERALMASK,
6409 : : BASEPROPERTY_MAXTEXTLEN,
6410 : : BASEPROPERTY_PRINTABLE,
6411 : : BASEPROPERTY_READONLY,
6412 : : BASEPROPERTY_STRICTFORMAT,
6413 : : BASEPROPERTY_TABSTOP,
6414 : : BASEPROPERTY_TEXT,
6415 : : BASEPROPERTY_HIDEINACTIVESELECTION,
6416 : : BASEPROPERTY_VERTICALALIGN,
6417 : : BASEPROPERTY_WRITING_MODE,
6418 : : BASEPROPERTY_CONTEXT_WRITING_MODE,
6419 : : BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
6420 : 25 : 0);
6421 : 25 : VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
6422 : 25 : }
6423 : :
6424 [ + - ]: 16 : VCLXPatternField::VCLXPatternField()
6425 : : {
6426 : 16 : }
6427 : :
6428 [ + - ]: 16 : VCLXPatternField::~VCLXPatternField()
6429 : : {
6430 [ - + ]: 32 : }
6431 : :
6432 : : // ::com::sun::star::uno::XInterface
6433 : 5746 : ::com::sun::star::uno::Any VCLXPatternField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
6434 : : {
6435 : : ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
6436 [ + - ]: 5746 : (static_cast< ::com::sun::star::awt::XPatternField* >(this)) );
6437 [ + + ][ + - ]: 5746 : return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
6438 : : }
6439 : :
6440 : : // ::com::sun::star::lang::XTypeProvider
6441 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_START( VCLXPatternField )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
6442 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPatternField>* ) NULL ),
6443 : : VCLXFormattedSpinField::getTypes()
6444 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_END
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
6445 : :
6446 : 160 : void VCLXPatternField::setMasks( const ::rtl::OUString& EditMask, const ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException)
6447 : : {
6448 [ + - ]: 160 : SolarMutexGuard aGuard;
6449 : :
6450 : 160 : PatternField* pPatternField = (PatternField*) GetWindow();
6451 [ + - ]: 160 : if ( pPatternField )
6452 : : {
6453 [ + - ][ + - ]: 160 : pPatternField->SetMask( rtl::OUStringToOString(EditMask, RTL_TEXTENCODING_ASCII_US), LiteralMask );
[ + - ][ + - ]
6454 [ + - ]: 160 : }
6455 : 160 : }
6456 : :
6457 : 0 : void VCLXPatternField::getMasks( ::rtl::OUString& EditMask, ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException)
6458 : : {
6459 [ # # ]: 0 : SolarMutexGuard aGuard;
6460 : :
6461 : 0 : PatternField* pPatternField = (PatternField*) GetWindow();
6462 [ # # ]: 0 : if ( pPatternField )
6463 : : {
6464 [ # # ]: 0 : EditMask = rtl::OStringToOUString(pPatternField->GetEditMask(), RTL_TEXTENCODING_ASCII_US);
6465 [ # # ]: 0 : LiteralMask = pPatternField->GetLiteralMask();
6466 [ # # ]: 0 : }
6467 : 0 : }
6468 : :
6469 : 160 : void VCLXPatternField::setString( const ::rtl::OUString& Str ) throw(::com::sun::star::uno::RuntimeException)
6470 : : {
6471 [ + - ]: 160 : SolarMutexGuard aGuard;
6472 : :
6473 : 160 : PatternField* pPatternField = (PatternField*) GetWindow();
6474 [ + - ]: 160 : if ( pPatternField )
6475 : : {
6476 [ + - ][ + - ]: 160 : pPatternField->SetString( Str );
[ + - ]
6477 [ + - ]: 160 : }
6478 : 160 : }
6479 : :
6480 : 0 : ::rtl::OUString VCLXPatternField::getString() throw(::com::sun::star::uno::RuntimeException)
6481 : : {
6482 [ # # ]: 0 : SolarMutexGuard aGuard;
6483 : :
6484 : 0 : ::rtl::OUString aString;
6485 : 0 : PatternField* pPatternField = (PatternField*) GetWindow();
6486 [ # # ]: 0 : if ( pPatternField )
6487 [ # # ][ # # ]: 0 : aString = pPatternField->GetString();
[ # # ]
6488 [ # # ]: 0 : return aString;
6489 : : }
6490 : :
6491 : 0 : void VCLXPatternField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
6492 : : {
6493 : 0 : VCLXFormattedSpinField::setStrictFormat( bStrict );
6494 : 0 : }
6495 : :
6496 : 0 : sal_Bool VCLXPatternField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
6497 : : {
6498 : 0 : return VCLXFormattedSpinField::isStrictFormat();
6499 : : }
6500 : :
6501 : 1616 : void VCLXPatternField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
6502 : : {
6503 [ + - ]: 1616 : SolarMutexGuard aGuard;
6504 : :
6505 [ + - ]: 1616 : if ( GetWindow() )
6506 : : {
6507 [ + - ]: 1616 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
6508 [ - + ]: 1616 : switch ( nPropType )
6509 : : {
6510 : : case BASEPROPERTY_EDITMASK:
6511 : : case BASEPROPERTY_LITERALMASK:
6512 : : {
6513 : 0 : ::rtl::OUString aString;
6514 [ # # ]: 0 : if ( Value >>= aString )
6515 : : {
6516 : 0 : ::rtl::OUString aEditMask, aLiteralMask;
6517 [ # # ]: 0 : getMasks( aEditMask, aLiteralMask );
6518 [ # # ]: 0 : if ( nPropType == BASEPROPERTY_EDITMASK )
6519 : 0 : aEditMask = aString;
6520 : : else
6521 : 0 : aLiteralMask = aString;
6522 [ # # ]: 0 : setMasks( aEditMask, aLiteralMask );
6523 : 0 : }
6524 : : }
6525 : 0 : break;
6526 : : default:
6527 : : {
6528 [ + - ]: 1616 : VCLXFormattedSpinField::setProperty( PropertyName, Value );
6529 : : }
6530 : : }
6531 [ + - ]: 1616 : }
6532 : 1616 : }
6533 : :
6534 : 0 : ::com::sun::star::uno::Any VCLXPatternField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
6535 : : {
6536 [ # # ]: 0 : SolarMutexGuard aGuard;
6537 : :
6538 : 0 : ::com::sun::star::uno::Any aProp;
6539 [ # # ]: 0 : if ( GetWindow() )
6540 : : {
6541 [ # # ]: 0 : sal_uInt16 nPropType = GetPropertyId( PropertyName );
6542 [ # # ]: 0 : switch ( nPropType )
6543 : : {
6544 : : case BASEPROPERTY_EDITMASK:
6545 : : case BASEPROPERTY_LITERALMASK:
6546 : : {
6547 : 0 : ::rtl::OUString aEditMask, aLiteralMask;
6548 [ # # ]: 0 : getMasks( aEditMask, aLiteralMask );
6549 [ # # ]: 0 : if ( nPropType == BASEPROPERTY_EDITMASK )
6550 [ # # ]: 0 : aProp <<= aEditMask;
6551 : : else
6552 [ # # ]: 0 : aProp <<= aLiteralMask;
6553 : : }
6554 : 0 : break;
6555 : : default:
6556 : : {
6557 [ # # ][ # # ]: 0 : aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
6558 : : }
6559 : : }
6560 : : }
6561 [ # # ]: 0 : return aProp;
6562 : : }
6563 : :
6564 : : // ----------------------------------------------------
6565 : : // class VCLXToolBox
6566 : : // ----------------------------------------------------
6567 : 3723 : VCLXToolBox::VCLXToolBox()
6568 : : {
6569 : 3723 : }
6570 : :
6571 : 3393 : VCLXToolBox::~VCLXToolBox()
6572 : : {
6573 [ - + ]: 6786 : }
6574 : :
6575 : 30 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXToolBox::CreateAccessibleContext()
6576 : : {
6577 : 30 : return getAccessibleFactory().createAccessibleContext( this );
6578 : : }
6579 : :
6580 : : // ----------------------------------------------------
6581 : : // class VCLXFrame
6582 : : // ----------------------------------------------------
6583 : 0 : VCLXFrame::VCLXFrame()
6584 : : {
6585 : 0 : }
6586 : :
6587 : 0 : void VCLXFrame::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
6588 : : {
6589 : : PushPropertyIds( rIds,
6590 : : BASEPROPERTY_BACKGROUNDCOLOR,
6591 : : BASEPROPERTY_DEFAULTCONTROL,
6592 : : BASEPROPERTY_ENABLED,
6593 : : BASEPROPERTY_ENABLEVISIBLE,
6594 : : BASEPROPERTY_FONTDESCRIPTOR,
6595 : : BASEPROPERTY_GRAPHIC,
6596 : : BASEPROPERTY_HELPTEXT,
6597 : : BASEPROPERTY_HELPURL,
6598 : : BASEPROPERTY_PRINTABLE,
6599 : : BASEPROPERTY_LABEL,
6600 : 0 : 0);
6601 : 0 : VCLXContainer::ImplGetPropertyIds( rIds );
6602 : 0 : }
6603 : :
6604 : 0 : VCLXFrame::~VCLXFrame()
6605 : : {
6606 [ # # ]: 0 : }
6607 : :
6608 : 0 : ::com::sun::star::uno::Any SAL_CALL VCLXFrame::queryInterface(const ::com::sun::star::uno::Type & rType )
6609 : : throw(::com::sun::star::uno::RuntimeException)
6610 : : {
6611 : 0 : return VCLXContainer::queryInterface( rType );
6612 : : }
6613 : :
6614 : : // ::com::sun::star::lang::XTypeProvider
6615 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_START( VCLXFrame )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
6616 : : VCLXContainer::getTypes()
6617 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_END
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
6618 : :
6619 : : // ::com::sun::star::awt::XView
6620 : 0 : void SAL_CALL VCLXFrame::draw( sal_Int32 nX, sal_Int32 nY )
6621 : : throw(::com::sun::star::uno::RuntimeException)
6622 : : {
6623 [ # # ]: 0 : SolarMutexGuard aGuard;
6624 : 0 : Window* pWindow = GetWindow();
6625 : :
6626 [ # # ]: 0 : if ( pWindow )
6627 : : {
6628 [ # # ][ # # ]: 0 : OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
6629 [ # # ]: 0 : if ( !pDev )
6630 [ # # ]: 0 : pDev = pWindow->GetParent();
6631 : :
6632 [ # # ][ # # ]: 0 : Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() );
6633 [ # # ]: 0 : Point aPos = pDev->PixelToLogic( Point( nX, nY ) );
6634 : :
6635 [ # # ]: 0 : pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS );
6636 [ # # ]: 0 : }
6637 : 0 : }
6638 : :
6639 : : // ::com::sun::star::awt::XDevice,
6640 : 0 : ::com::sun::star::awt::DeviceInfo SAL_CALL VCLXFrame::getInfo()
6641 : : throw(::com::sun::star::uno::RuntimeException)
6642 : : {
6643 : 0 : ::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo();
6644 : 0 : return aInfo;
6645 : : }
6646 : :
6647 : 0 : void SAL_CALL VCLXFrame::setProperty(
6648 : : const ::rtl::OUString& PropertyName,
6649 : : const ::com::sun::star::uno::Any& Value )
6650 : : throw(::com::sun::star::uno::RuntimeException)
6651 : : {
6652 [ # # ]: 0 : SolarMutexGuard aGuard;
6653 : :
6654 : : #if OSL_DEBUG_LEVEL > 0
6655 : : sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
6656 : : (void)bVoid;
6657 : : #endif
6658 : :
6659 [ # # ][ # # ]: 0 : VCLXContainer::setProperty( PropertyName, Value );
6660 : 0 : }
6661 : :
6662 : 0 : void VCLXFrame::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
6663 : : {
6664 [ # # ]: 0 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
6665 [ # # ]: 0 : VCLXContainer::ProcessWindowEvent( rVclWindowEvent );
6666 [ + - ][ + - ]: 843 : }
6667 : :
6668 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|