1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <tools/debug.hxx>
22 #include <vcl/fixedhyper.hxx>
23 #include <vcl/prgsbar.hxx>
24 #include <vcl/svapp.hxx>
25 #include <svtools/svmedit.hxx>
26 #include <unoiface.hxx>
27 #include <svtools/filectrl.hxx>
28 #include <svtools/roadmap.hxx>
29 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
30 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
31 #include <com/sun/star/awt/LineEndFormat.hpp>
32 #include <comphelper/processfactory.hxx>
33 #include <toolkit/helper/convert.hxx>
34 #include <toolkit/helper/property.hxx>
35 #include <svtools/fmtfield.hxx>
36 #include <svl/numuno.hxx>
37 #include <svtools/calendar.hxx>
38 #include <svtools/treelistbox.hxx>
39 #include "treecontrolpeer.hxx"
40 #include "svtxgridcontrol.hxx"
41 #include <svtools/table/tablecontrol.hxx>
45 static void lcl_setWinBits( Window
* _pWindow
, WinBits _nBits
, sal_Bool _bSet
)
47 WinBits nStyle
= _pWindow
->GetStyle();
52 _pWindow
->SetStyle( nStyle
);
56 // ----------------------------------------------------
57 // help function for the toolkit...
58 // ----------------------------------------------------
62 SAL_DLLPUBLIC_EXPORT Window
* CreateWindow( VCLXWindow
** ppNewComp
, const ::com::sun::star::awt::WindowDescriptor
* pDescriptor
, Window
* pParent
, WinBits nWinBits
)
64 Window
* pWindow
= NULL
;
65 String
aServiceName( pDescriptor
->WindowServiceName
);
66 if ( aServiceName
.EqualsIgnoreCaseAscii( "MultiLineEdit" ) )
70 pWindow
= new MultiLineEdit( pParent
, nWinBits
|WB_IGNORETAB
);
71 static_cast< MultiLineEdit
* >( pWindow
)->DisableSelectionOnFocus();
72 *ppNewComp
= new VCLXMultiLineEdit
;
80 else if ( aServiceName
.EqualsIgnoreCaseAscii( "FileControl" ) )
84 pWindow
= new FileControl( pParent
, nWinBits
);
85 *ppNewComp
= new VCLXFileControl
;
93 else if (aServiceName
.EqualsIgnoreCaseAscii("FormattedField") )
95 pWindow
= new FormattedField( pParent
, nWinBits
);
96 *ppNewComp
= new SVTXFormattedField
;
98 else if (aServiceName
.EqualsIgnoreCaseAscii("NumericField") )
100 pWindow
= new DoubleNumericField( pParent
, nWinBits
);
101 *ppNewComp
= new SVTXNumericField
;
103 else if (aServiceName
.EqualsIgnoreCaseAscii("LongCurrencyField") )
105 pWindow
= new DoubleCurrencyField( pParent
, nWinBits
);
106 *ppNewComp
= new SVTXCurrencyField
;
108 else if (aServiceName
.EqualsIgnoreCaseAscii("datefield") )
110 pWindow
= new CalendarField( pParent
, nWinBits
);
111 static_cast<CalendarField
*>(pWindow
)->EnableToday();
112 static_cast<CalendarField
*>(pWindow
)->EnableNone();
113 static_cast<CalendarField
*>(pWindow
)->EnableEmptyFieldValue( sal_True
);
114 *ppNewComp
= new SVTXDateField
;
115 ((VCLXFormattedSpinField
*)*ppNewComp
)->SetFormatter( (FormatterBase
*)(DateField
*)pWindow
);
117 else if (aServiceName
.EqualsIgnoreCaseAscii("roadmap") )
119 pWindow
= new ::svt::ORoadmap( pParent
, WB_TABSTOP
);
120 *ppNewComp
= new SVTXRoadmap
;
122 else if ( aServiceName
.EqualsIgnoreCaseAscii( "ProgressBar" ) )
126 pWindow
= new ProgressBar( pParent
, nWinBits
);
127 *ppNewComp
= new VCLXProgressBar
;
135 else if ( aServiceName
.EqualsIgnoreCaseAscii( "Tree" ) )
137 TreeControlPeer
* pPeer
= new TreeControlPeer
;
139 pWindow
= pPeer
->createVclControl( pParent
, nWinBits
);
141 else if ( aServiceName
.EqualsIgnoreCaseAscii( "FixedHyperlink" ) )
145 pWindow
= new FixedHyperlink( pParent
, nWinBits
);
146 *ppNewComp
= new VCLXFixedHyperlink
;
154 else if ( aServiceName
.EqualsIgnoreCaseAscii( "Grid" ) )
158 pWindow
= new ::svt::table::TableControl(pParent
, nWinBits
);
159 *ppNewComp
= new SVTXGridControl
;
172 // ----------------------------------------------------
173 // class VCLXMultiLineEdit
174 // ----------------------------------------------------
175 VCLXMultiLineEdit::VCLXMultiLineEdit()
176 :maTextListeners( *this )
177 ,meLineEndType( LINEEND_LF
) // default behavior before introducing this property: LF (unix-like)
181 VCLXMultiLineEdit::~VCLXMultiLineEdit()
185 ::com::sun::star::uno::Any
VCLXMultiLineEdit::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
187 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
188 (static_cast< ::com::sun::star::awt::XTextComponent
* >(this)),
189 (static_cast< ::com::sun::star::awt::XTextArea
* >(this)),
190 (static_cast< ::com::sun::star::awt::XTextLayoutConstrains
* >(this)),
191 (static_cast< ::com::sun::star::lang::XTypeProvider
* >(this)) );
192 return (aRet
.hasValue() ? aRet
: VCLXWindow::queryInterface( rType
));
195 // ::com::sun::star::lang::XTypeProvider
196 IMPL_XTYPEPROVIDER_START( VCLXMultiLineEdit
)
197 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextComponent
>* ) NULL
),
198 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextArea
>* ) NULL
),
199 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextLayoutConstrains
>* ) NULL
),
200 VCLXWindow::getTypes()
201 IMPL_XTYPEPROVIDER_END
203 void VCLXMultiLineEdit::addTextListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
205 maTextListeners
.addInterface( l
);
208 void VCLXMultiLineEdit::removeTextListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
210 maTextListeners
.removeInterface( l
);
213 void VCLXMultiLineEdit::setText( const OUString
& aText
) throw(::com::sun::star::uno::RuntimeException
)
215 SolarMutexGuard aGuard
;
217 MultiLineEdit
* pEdit
= (MultiLineEdit
*)GetWindow();
220 pEdit
->SetText( aText
);
222 // #107218# Call same listeners like VCL would do after user interaction
223 SetSynthesizingVCLEvent( sal_True
);
224 pEdit
->SetModifyFlag();
226 SetSynthesizingVCLEvent( sal_False
);
230 void VCLXMultiLineEdit::insertText( const ::com::sun::star::awt::Selection
& rSel
, const OUString
& aText
) throw(::com::sun::star::uno::RuntimeException
)
232 SolarMutexGuard aGuard
;
234 MultiLineEdit
* pEdit
= (MultiLineEdit
*)GetWindow();
237 setSelection( rSel
);
238 pEdit
->ReplaceSelected( aText
);
242 OUString
VCLXMultiLineEdit::getText() throw(::com::sun::star::uno::RuntimeException
)
244 SolarMutexGuard aGuard
;
247 MultiLineEdit
* pEdit
= (MultiLineEdit
*)GetWindow();
249 aText
= pEdit
->GetText( meLineEndType
);
253 OUString
VCLXMultiLineEdit::getSelectedText() throw(::com::sun::star::uno::RuntimeException
)
255 SolarMutexGuard aGuard
;
258 MultiLineEdit
* pMultiLineEdit
= (MultiLineEdit
*) GetWindow();
260 aText
= pMultiLineEdit
->GetSelected( meLineEndType
);
265 void VCLXMultiLineEdit::setSelection( const ::com::sun::star::awt::Selection
& aSelection
) throw(::com::sun::star::uno::RuntimeException
)
267 SolarMutexGuard aGuard
;
269 MultiLineEdit
* pMultiLineEdit
= (MultiLineEdit
*) GetWindow();
270 if ( pMultiLineEdit
)
272 pMultiLineEdit
->SetSelection( Selection( aSelection
.Min
, aSelection
.Max
) );
276 ::com::sun::star::awt::Selection
VCLXMultiLineEdit::getSelection() throw(::com::sun::star::uno::RuntimeException
)
278 SolarMutexGuard aGuard
;
280 ::com::sun::star::awt::Selection aSel
;
281 MultiLineEdit
* pMultiLineEdit
= (MultiLineEdit
*) GetWindow();
282 if ( pMultiLineEdit
)
284 aSel
.Min
= pMultiLineEdit
->GetSelection().Min();
285 aSel
.Max
= pMultiLineEdit
->GetSelection().Max();
290 sal_Bool
VCLXMultiLineEdit::isEditable() throw(::com::sun::star::uno::RuntimeException
)
292 SolarMutexGuard aGuard
;
294 MultiLineEdit
* pMultiLineEdit
= (MultiLineEdit
*) GetWindow();
295 return ( pMultiLineEdit
&& !pMultiLineEdit
->IsReadOnly() && pMultiLineEdit
->IsEnabled() ) ? sal_True
: sal_False
;
298 void VCLXMultiLineEdit::setEditable( sal_Bool bEditable
) throw(::com::sun::star::uno::RuntimeException
)
300 SolarMutexGuard aGuard
;
302 MultiLineEdit
* pMultiLineEdit
= (MultiLineEdit
*) GetWindow();
303 if ( pMultiLineEdit
)
304 pMultiLineEdit
->SetReadOnly( !bEditable
);
307 void VCLXMultiLineEdit::setMaxTextLen( sal_Int16 nLen
) throw(::com::sun::star::uno::RuntimeException
)
309 SolarMutexGuard aGuard
;
311 MultiLineEdit
* pMultiLineEdit
= (MultiLineEdit
*) GetWindow();
312 if ( pMultiLineEdit
)
313 pMultiLineEdit
->SetMaxTextLen( nLen
);
316 sal_Int16
VCLXMultiLineEdit::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException
)
318 SolarMutexGuard aGuard
;
320 MultiLineEdit
* pMultiLineEdit
= (MultiLineEdit
*) GetWindow();
321 return pMultiLineEdit
? (sal_Int16
)pMultiLineEdit
->GetMaxTextLen() : (sal_Int16
)0;
324 OUString
VCLXMultiLineEdit::getTextLines() throw(::com::sun::star::uno::RuntimeException
)
326 SolarMutexGuard aGuard
;
329 MultiLineEdit
* pEdit
= (MultiLineEdit
*)GetWindow();
331 aText
= pEdit
->GetTextLines( meLineEndType
);
335 ::com::sun::star::awt::Size
VCLXMultiLineEdit::getMinimumSize() throw(::com::sun::star::uno::RuntimeException
)
337 SolarMutexGuard aGuard
;
339 ::com::sun::star::awt::Size aSz
;
340 MultiLineEdit
* pEdit
= (MultiLineEdit
*) GetWindow();
342 aSz
= AWTSize(pEdit
->CalcMinimumSize());
346 ::com::sun::star::awt::Size
VCLXMultiLineEdit::getPreferredSize() throw(::com::sun::star::uno::RuntimeException
)
348 return getMinimumSize();
351 ::com::sun::star::awt::Size
VCLXMultiLineEdit::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
353 SolarMutexGuard aGuard
;
355 ::com::sun::star::awt::Size aSz
= rNewSize
;
356 MultiLineEdit
* pEdit
= (MultiLineEdit
*) GetWindow();
358 aSz
= AWTSize(pEdit
->CalcAdjustedSize( VCLSize(rNewSize
)));
362 ::com::sun::star::awt::Size
VCLXMultiLineEdit::getMinimumSize( sal_Int16 nCols
, sal_Int16 nLines
) throw(::com::sun::star::uno::RuntimeException
)
364 SolarMutexGuard aGuard
;
366 ::com::sun::star::awt::Size aSz
;
367 MultiLineEdit
* pEdit
= (MultiLineEdit
*) GetWindow();
369 aSz
= AWTSize(pEdit
->CalcSize( nCols
, nLines
));
373 void VCLXMultiLineEdit::getColumnsAndLines( sal_Int16
& nCols
, sal_Int16
& nLines
) throw(::com::sun::star::uno::RuntimeException
)
375 SolarMutexGuard aGuard
;
378 MultiLineEdit
* pEdit
= (MultiLineEdit
*) GetWindow();
382 pEdit
->GetMaxVisColumnsAndLines( nC
, nL
);
388 void VCLXMultiLineEdit::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
390 switch ( rVclWindowEvent
.GetId() )
392 case VCLEVENT_EDIT_MODIFY
:
394 if ( maTextListeners
.getLength() )
396 ::com::sun::star::awt::TextEvent aEvent
;
397 aEvent
.Source
= (::cppu::OWeakObject
*)this;
398 maTextListeners
.textChanged( aEvent
);
404 VCLXWindow::ProcessWindowEvent( rVclWindowEvent
);
410 void VCLXMultiLineEdit::setProperty( const OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
412 SolarMutexGuard aGuard
;
414 MultiLineEdit
* pMultiLineEdit
= (MultiLineEdit
*)GetWindow();
415 if ( pMultiLineEdit
)
417 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
420 case BASEPROPERTY_LINE_END_FORMAT
:
422 sal_Int16 nLineEndType
= ::com::sun::star::awt::LineEndFormat::LINE_FEED
;
423 OSL_VERIFY( Value
>>= nLineEndType
);
424 switch ( nLineEndType
)
426 case ::com::sun::star::awt::LineEndFormat::CARRIAGE_RETURN
: meLineEndType
= LINEEND_CR
; break;
427 case ::com::sun::star::awt::LineEndFormat::LINE_FEED
: meLineEndType
= LINEEND_LF
; break;
428 case ::com::sun::star::awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED
: meLineEndType
= LINEEND_CRLF
; break;
429 default: OSL_FAIL( "VCLXMultiLineEdit::setProperty: invalid line end value!" ); break;
434 case BASEPROPERTY_READONLY
:
436 sal_Bool b
= sal_Bool();
438 pMultiLineEdit
->SetReadOnly( b
);
441 case BASEPROPERTY_MAXTEXTLEN
:
443 sal_Int16 n
= sal_Int16();
445 pMultiLineEdit
->SetMaxTextLen( n
);
448 case BASEPROPERTY_HIDEINACTIVESELECTION
:
450 sal_Bool b
= sal_Bool();
453 pMultiLineEdit
->EnableFocusSelectionHide( b
);
454 lcl_setWinBits( pMultiLineEdit
, WB_NOHIDESELECTION
, !b
);
460 VCLXWindow::setProperty( PropertyName
, Value
);
466 ::com::sun::star::uno::Any
VCLXMultiLineEdit::getProperty( const OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
468 SolarMutexGuard aGuard
;
470 ::com::sun::star::uno::Any aProp
;
471 MultiLineEdit
* pMultiLineEdit
= (MultiLineEdit
*)GetWindow();
472 if ( pMultiLineEdit
)
474 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
477 case BASEPROPERTY_LINE_END_FORMAT
:
479 sal_Int16 nLineEndType
= ::com::sun::star::awt::LineEndFormat::LINE_FEED
;
480 switch ( meLineEndType
)
482 case LINEEND_CR
: nLineEndType
= ::com::sun::star::awt::LineEndFormat::CARRIAGE_RETURN
; break;
483 case LINEEND_LF
: nLineEndType
= ::com::sun::star::awt::LineEndFormat::LINE_FEED
; break;
484 case LINEEND_CRLF
: nLineEndType
= ::com::sun::star::awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED
; break;
485 default: OSL_FAIL( "VCLXMultiLineEdit::getProperty: invalid line end value!" ); break;
487 aProp
<<= nLineEndType
;
491 case BASEPROPERTY_READONLY
:
493 aProp
<<= pMultiLineEdit
->IsReadOnly();
496 case BASEPROPERTY_MAXTEXTLEN
:
498 aProp
<<= (sal_Int16
) pMultiLineEdit
->GetMaxTextLen();
503 aProp
<<= VCLXWindow::getProperty( PropertyName
);
510 void SAL_CALL
VCLXMultiLineEdit::setFocus( ) throw(::com::sun::star::uno::RuntimeException
)
512 SolarMutexGuard aGuard
;
514 // don't grab the focus if we already have it. Reason is that the only thing which the edit
515 // does is forwarding the focus to it's text window. This text window then does a "select all".
516 // So if the text window already has the focus, and we give the focus to the multi line
517 // edit, then all which happens is that everything is selected.
519 if ( GetWindow() && !GetWindow()->HasChildPathFocus() )
520 GetWindow()->GrabFocus();
523 void VCLXMultiLineEdit::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
525 PushPropertyIds( rIds
,
526 // FIXME: elide duplication ?
527 BASEPROPERTY_LINE_END_FORMAT
,
528 BASEPROPERTY_READONLY
,
529 BASEPROPERTY_MAXTEXTLEN
,
530 BASEPROPERTY_HIDEINACTIVESELECTION
,
532 VCLXWindow::ImplGetPropertyIds( rIds
, true );
535 // ----------------------------------------------------
536 // class VCLXFileControl
537 // ----------------------------------------------------
538 VCLXFileControl::VCLXFileControl() : maTextListeners( *this )
542 VCLXFileControl::~VCLXFileControl()
544 FileControl
* pControl
= (FileControl
*) GetWindow();
546 pControl
->GetEdit().SetModifyHdl( Link() );
549 ::com::sun::star::uno::Any
VCLXFileControl::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
551 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
552 (static_cast< ::com::sun::star::awt::XTextComponent
* >(this)),
553 (static_cast< ::com::sun::star::awt::XTextLayoutConstrains
* >(this)),
554 (static_cast< ::com::sun::star::lang::XTypeProvider
* >(this)) );
555 return (aRet
.hasValue() ? aRet
: VCLXWindow::queryInterface( rType
));
558 // ::com::sun::star::lang::XTypeProvider
559 IMPL_XTYPEPROVIDER_START( VCLXFileControl
)
560 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextComponent
>* ) NULL
),
561 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextLayoutConstrains
>* ) NULL
),
562 VCLXWindow::getTypes()
563 IMPL_XTYPEPROVIDER_END
565 void SAL_CALL
VCLXFileControl::setProperty( const OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
567 SolarMutexGuard aGuard
;
569 FileControl
* pControl
= (FileControl
*)GetWindow();
572 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
575 case BASEPROPERTY_HIDEINACTIVESELECTION
:
577 sal_Bool
bValue( sal_False
);
578 OSL_VERIFY( Value
>>= bValue
);
580 lcl_setWinBits( pControl
, WB_NOHIDESELECTION
, !bValue
);
581 lcl_setWinBits( &pControl
->GetEdit(), WB_NOHIDESELECTION
, !bValue
);
586 VCLXWindow::setProperty( PropertyName
, Value
);
592 void VCLXFileControl::SetWindow( Window
* pWindow
)
594 FileControl
* pPrevFileControl
= dynamic_cast<FileControl
*>( GetWindow() );
595 if ( pPrevFileControl
)
596 pPrevFileControl
->GetEdit().SetModifyHdl( Link() );
598 FileControl
* pNewFileControl
= dynamic_cast<FileControl
*>( pWindow
);
599 if ( pNewFileControl
)
600 pNewFileControl
->GetEdit().SetModifyHdl( LINK( this, VCLXFileControl
, ModifyHdl
) );
602 VCLXWindow::SetWindow( pWindow
);
605 void VCLXFileControl::addTextListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
607 maTextListeners
.addInterface( l
);
610 void VCLXFileControl::removeTextListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
612 maTextListeners
.removeInterface( l
);
615 void VCLXFileControl::setText( const OUString
& aText
) throw(::com::sun::star::uno::RuntimeException
)
617 SolarMutexGuard aGuard
;
619 Window
* pWindow
= GetWindow();
622 pWindow
->SetText( aText
);
624 // In JAVA wird auch ein textChanged ausgeloest, in VCL nicht.
625 // ::com::sun::star::awt::Toolkit soll JAVA-komform sein...
630 void VCLXFileControl::insertText( const ::com::sun::star::awt::Selection
& rSel
, const OUString
& aText
) throw(::com::sun::star::uno::RuntimeException
)
632 SolarMutexGuard aGuard
;
634 FileControl
* pFileControl
= (FileControl
*) GetWindow();
637 pFileControl
->GetEdit().SetSelection( Selection( rSel
.Min
, rSel
.Max
) );
638 pFileControl
->GetEdit().ReplaceSelected( aText
);
642 OUString
VCLXFileControl::getText() throw(::com::sun::star::uno::RuntimeException
)
644 SolarMutexGuard aGuard
;
647 Window
* pWindow
= GetWindow();
649 aText
= pWindow
->GetText();
653 OUString
VCLXFileControl::getSelectedText() throw(::com::sun::star::uno::RuntimeException
)
655 SolarMutexGuard aGuard
;
658 FileControl
* pFileControl
= (FileControl
*) GetWindow();
660 aText
= pFileControl
->GetEdit().GetSelected();
665 void VCLXFileControl::setSelection( const ::com::sun::star::awt::Selection
& aSelection
) throw(::com::sun::star::uno::RuntimeException
)
667 SolarMutexGuard aGuard
;
669 FileControl
* pFileControl
= (FileControl
*) GetWindow();
671 pFileControl
->GetEdit().SetSelection( Selection( aSelection
.Min
, aSelection
.Max
) );
674 ::com::sun::star::awt::Selection
VCLXFileControl::getSelection() throw(::com::sun::star::uno::RuntimeException
)
676 SolarMutexGuard aGuard
;
678 ::com::sun::star::awt::Selection aSel
;
679 FileControl
* pFileControl
= (FileControl
*) GetWindow();
682 aSel
.Min
= pFileControl
->GetEdit().GetSelection().Min();
683 aSel
.Max
= pFileControl
->GetEdit().GetSelection().Max();
688 sal_Bool
VCLXFileControl::isEditable() throw(::com::sun::star::uno::RuntimeException
)
690 SolarMutexGuard aGuard
;
692 FileControl
* pFileControl
= (FileControl
*) GetWindow();
693 return ( pFileControl
&& !pFileControl
->GetEdit().IsReadOnly() && pFileControl
->GetEdit().IsEnabled() ) ? sal_True
: sal_False
;
696 void VCLXFileControl::setEditable( sal_Bool bEditable
) throw(::com::sun::star::uno::RuntimeException
)
698 SolarMutexGuard aGuard
;
700 FileControl
* pFileControl
= (FileControl
*) GetWindow();
702 pFileControl
->GetEdit().SetReadOnly( !bEditable
);
705 void VCLXFileControl::setMaxTextLen( sal_Int16 nLen
) throw(::com::sun::star::uno::RuntimeException
)
707 SolarMutexGuard aGuard
;
709 FileControl
* pFileControl
= (FileControl
*) GetWindow();
711 pFileControl
->GetEdit().SetMaxTextLen( nLen
);
714 sal_Int16
VCLXFileControl::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException
)
716 SolarMutexGuard aGuard
;
718 FileControl
* pFileControl
= (FileControl
*) GetWindow();
719 return pFileControl
? pFileControl
->GetEdit().GetMaxTextLen() : 0;
723 IMPL_LINK_NOARG(VCLXFileControl
, ModifyHdl
)
725 ::com::sun::star::awt::TextEvent aEvent
;
726 aEvent
.Source
= (::cppu::OWeakObject
*)this;
727 maTextListeners
.textChanged( aEvent
);
732 ::com::sun::star::awt::Size
VCLXFileControl::getMinimumSize() throw(::com::sun::star::uno::RuntimeException
)
734 SolarMutexGuard aGuard
;
736 ::com::sun::star::awt::Size aSz
;
737 FileControl
* pControl
= (FileControl
*) GetWindow();
740 Size aTmpSize
= pControl
->GetEdit().CalcMinimumSize();
741 aTmpSize
.Width() += pControl
->GetButton().CalcMinimumSize().Width();
742 aSz
= AWTSize(pControl
->CalcWindowSize( aTmpSize
));
747 ::com::sun::star::awt::Size
VCLXFileControl::getPreferredSize() throw(::com::sun::star::uno::RuntimeException
)
749 ::com::sun::star::awt::Size aSz
= getMinimumSize();
754 ::com::sun::star::awt::Size
VCLXFileControl::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
756 SolarMutexGuard aGuard
;
758 ::com::sun::star::awt::Size aSz
=rNewSize
;
759 FileControl
* pControl
= (FileControl
*) GetWindow();
762 ::com::sun::star::awt::Size aMinSz
= getMinimumSize();
763 if ( aSz
.Height
!= aMinSz
.Height
)
764 aSz
.Height
= aMinSz
.Height
;
769 ::com::sun::star::awt::Size
VCLXFileControl::getMinimumSize( sal_Int16 nCols
, sal_Int16
) throw(::com::sun::star::uno::RuntimeException
)
771 SolarMutexGuard aGuard
;
773 ::com::sun::star::awt::Size aSz
;
774 FileControl
* pControl
= (FileControl
*) GetWindow();
777 aSz
= AWTSize(pControl
->GetEdit().CalcSize( nCols
));
778 aSz
.Width
+= pControl
->GetButton().CalcMinimumSize().Width();
783 void VCLXFileControl::getColumnsAndLines( sal_Int16
& nCols
, sal_Int16
& nLines
) throw(::com::sun::star::uno::RuntimeException
)
785 SolarMutexGuard aGuard
;
789 FileControl
* pControl
= (FileControl
*) GetWindow();
791 nCols
= (sal_Int16
) pControl
->GetEdit().GetMaxVisChars();
794 void VCLXFileControl::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
796 PushPropertyIds( rIds
,
797 // FIXME: elide duplication ?
798 BASEPROPERTY_HIDEINACTIVESELECTION
,
800 VCLXWindow::ImplGetPropertyIds( rIds
, true );
804 // ----------------------------------------------------
805 // class SVTXFormattedField
806 // ----------------------------------------------------
807 // --------------------------------------------------------------------------------------
808 SVTXFormattedField::SVTXFormattedField()
809 :m_pCurrentSupplier(NULL
)
810 ,bIsStandardSupplier(sal_True
)
811 ,nKeyToSetDelayed(-1)
815 // --------------------------------------------------------------------------------------
816 SVTXFormattedField::~SVTXFormattedField()
818 if (m_pCurrentSupplier
)
820 m_pCurrentSupplier
->release();
821 m_pCurrentSupplier
= NULL
;
825 // --------------------------------------------------------------------------------------
826 void SVTXFormattedField::SetWindow( Window
* _pWindow
)
828 VCLXSpinField::SetWindow(_pWindow
);
829 if (GetFormattedField())
830 GetFormattedField()->SetAutoColor(sal_True
);
833 // --------------------------------------------------------------------------------------
834 void SVTXFormattedField::setProperty( const OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
836 SolarMutexGuard aGuard
;
838 FormattedField
* pField
= GetFormattedField();
841 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
844 case BASEPROPERTY_ENFORCE_FORMAT
:
846 sal_Bool
bEnable( sal_True
);
847 if ( Value
>>= bEnable
)
848 pField
->EnableNotANumber( !bEnable
);
852 case BASEPROPERTY_EFFECTIVE_MIN
:
853 case BASEPROPERTY_VALUEMIN_DOUBLE
:
857 case BASEPROPERTY_EFFECTIVE_MAX
:
858 case BASEPROPERTY_VALUEMAX_DOUBLE
:
862 case BASEPROPERTY_EFFECTIVE_DEFAULT
:
863 SetDefaultValue(Value
);
866 case BASEPROPERTY_TREATASNUMBER
:
868 sal_Bool b
= sal_Bool();
874 case BASEPROPERTY_FORMATSSUPPLIER
:
875 if (!Value
.hasValue())
876 setFormatsSupplier(::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
> (NULL
));
879 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
> xNFS
;
880 if ( Value
>>= xNFS
)
881 setFormatsSupplier(xNFS
);
884 case BASEPROPERTY_FORMATKEY
:
885 if (!Value
.hasValue())
895 case BASEPROPERTY_EFFECTIVE_VALUE
:
896 case BASEPROPERTY_VALUE_DOUBLE
:
898 const ::com::sun::star::uno::TypeClass rTC
= Value
.getValueType().getTypeClass();
899 if (rTC
!= ::com::sun::star::uno::TypeClass_STRING
)
901 if (rTC
!= ::com::sun::star::uno::TypeClass_DOUBLE
)
903 if (Value
.hasValue())
905 // try if it is something converitble
906 sal_Int32 nValue
= 0;
907 if (!(Value
>>= nValue
))
908 throw ::com::sun::star::lang::IllegalArgumentException();
909 SetValue(::com::sun::star::uno::makeAny((double)nValue
));
916 case BASEPROPERTY_VALUESTEP_DOUBLE
:
920 pField
->SetSpinSize( d
);
925 pField
->SetSpinSize( n
);
929 case BASEPROPERTY_DECIMALACCURACY
:
933 pField
->SetDecimalDigits( (sal_uInt16
)n
);
936 case BASEPROPERTY_NUMSHOWTHOUSANDSEP
:
938 sal_Bool b
= sal_Bool();
940 pField
->SetThousandsSep( b
);
945 VCLXSpinField::setProperty( PropertyName
, Value
);
948 if (BASEPROPERTY_TEXTCOLOR
== nPropType
)
949 { // after setting a new text color, think again about the AutoColor flag of the control
950 // 17.05.2001 - 86859 - frank.schoenheit@germany.sun.com
951 pField
->SetAutoColor(!Value
.hasValue());
955 VCLXSpinField::setProperty( PropertyName
, Value
);
958 // --------------------------------------------------------------------------------------
959 ::com::sun::star::uno::Any
SVTXFormattedField::getProperty( const OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
961 SolarMutexGuard aGuard
;
963 ::com::sun::star::uno::Any aReturn
;
965 FormattedField
* pField
= GetFormattedField();
968 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
971 case BASEPROPERTY_EFFECTIVE_MIN
:
972 case BASEPROPERTY_VALUEMIN_DOUBLE
:
973 aReturn
<<= GetMinValue();
976 case BASEPROPERTY_EFFECTIVE_MAX
:
977 case BASEPROPERTY_VALUEMAX_DOUBLE
:
978 aReturn
<<= GetMaxValue();
981 case BASEPROPERTY_EFFECTIVE_DEFAULT
:
982 aReturn
<<= GetDefaultValue();
985 case BASEPROPERTY_TREATASNUMBER
:
986 aReturn
<<= GetTreatAsNumber();
989 case BASEPROPERTY_EFFECTIVE_VALUE
:
990 case BASEPROPERTY_VALUE_DOUBLE
:
991 aReturn
<<= GetValue();
994 case BASEPROPERTY_VALUESTEP_DOUBLE
:
995 aReturn
<<= pField
->GetSpinSize();
998 case BASEPROPERTY_DECIMALACCURACY
:
999 aReturn
<<= pField
->GetDecimalDigits();
1002 case BASEPROPERTY_FORMATSSUPPLIER
:
1004 if (!bIsStandardSupplier
)
1006 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
> xSupplier
= getFormatsSupplier();
1007 aReturn
<<= xSupplier
;
1012 case BASEPROPERTY_FORMATKEY
:
1014 if (!bIsStandardSupplier
)
1015 aReturn
<<= getFormatKey();
1020 aReturn
<<= VCLXSpinField::getProperty(PropertyName
);
1026 // --------------------------------------------------------------------------------------
1027 ::com::sun::star::uno::Any
SVTXFormattedField::convertEffectiveValue(const ::com::sun::star::uno::Any
& rValue
)
1029 ::com::sun::star::uno::Any aReturn
;
1031 FormattedField
* pField
= GetFormattedField();
1035 switch (rValue
.getValueType().getTypeClass())
1037 case ::com::sun::star::uno::TypeClass_DOUBLE
:
1038 if (pField
->TreatingAsNumber())
1046 SvNumberFormatter
* pFormatter
= pField
->GetFormatter();
1048 pFormatter
= pField
->StandardFormatter();
1049 // should never fail
1055 pFormatter
->GetOutputString(d
, 0, sConverted
, &pDum
);
1056 aReturn
<<= OUString( sConverted
);
1059 case ::com::sun::star::uno::TypeClass_STRING
:
1063 String sValue
= aStr
;
1064 if (pField
->TreatingAsNumber())
1066 SvNumberFormatter
* pFormatter
= pField
->GetFormatter();
1068 pFormatter
= pField
->StandardFormatter();
1071 sal_uInt32
nTestFormat(0);
1072 if (!pFormatter
->IsNumberFormat(sValue
, nTestFormat
, dVal
))
1087 // --------------------------------------------------------------------------------------
1088 void SVTXFormattedField::SetMinValue(const ::com::sun::star::uno::Any
& rValue
)
1090 FormattedField
* pField
= GetFormattedField();
1094 switch (rValue
.getValueType().getTypeClass())
1097 case ::com::sun::star::uno::TypeClass_DOUBLE
:
1101 pField
->SetMinValue(d
);
1105 DBG_ASSERT(rValue
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
, "SVTXFormattedField::SetMinValue : invalid argument (an exception will be thrown) !");
1106 if ( rValue
.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID
)
1109 throw ::com::sun::star::lang::IllegalArgumentException();
1111 pField
->ClearMinValue();
1116 // --------------------------------------------------------------------------------------
1117 ::com::sun::star::uno::Any
SVTXFormattedField::GetMinValue()
1119 FormattedField
* pField
= GetFormattedField();
1120 if (!pField
|| !pField
->HasMinValue())
1121 return ::com::sun::star::uno::Any();
1123 ::com::sun::star::uno::Any aReturn
;
1124 aReturn
<<= pField
->GetMinValue();
1128 // --------------------------------------------------------------------------------------
1129 void SVTXFormattedField::SetMaxValue(const ::com::sun::star::uno::Any
& rValue
)
1131 FormattedField
* pField
= GetFormattedField();
1135 switch (rValue
.getValueType().getTypeClass())
1138 case ::com::sun::star::uno::TypeClass_DOUBLE
:
1142 pField
->SetMaxValue(d
);
1146 if (rValue
.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID
)
1149 throw ::com::sun::star::lang::IllegalArgumentException();
1151 pField
->ClearMaxValue();
1156 // --------------------------------------------------------------------------------------
1157 ::com::sun::star::uno::Any
SVTXFormattedField::GetMaxValue()
1159 FormattedField
* pField
= GetFormattedField();
1160 if (!pField
|| !pField
->HasMaxValue())
1161 return ::com::sun::star::uno::Any();
1163 ::com::sun::star::uno::Any aReturn
;
1164 aReturn
<<= pField
->GetMaxValue();
1168 // --------------------------------------------------------------------------------------
1169 void SVTXFormattedField::SetDefaultValue(const ::com::sun::star::uno::Any
& rValue
)
1171 FormattedField
* pField
= GetFormattedField();
1175 ::com::sun::star::uno::Any aConverted
= convertEffectiveValue(rValue
);
1177 switch (aConverted
.getValueType().getTypeClass())
1180 case ::com::sun::star::uno::TypeClass_DOUBLE
:
1184 pField
->SetDefaultValue(d
);
1187 case ::com::sun::star::uno::TypeClass_STRING
:
1190 aConverted
>>= aStr
;
1191 pField
->SetDefaultText( aStr
);
1195 pField
->EnableEmptyField(sal_True
);
1196 // nur noch void erlaubt
1201 // --------------------------------------------------------------------------------------
1202 ::com::sun::star::uno::Any
SVTXFormattedField::GetDefaultValue()
1204 FormattedField
* pField
= GetFormattedField();
1205 if (!pField
|| pField
->IsEmptyFieldEnabled())
1206 return ::com::sun::star::uno::Any();
1208 ::com::sun::star::uno::Any aReturn
;
1209 if (pField
->TreatingAsNumber())
1210 aReturn
<<= pField
->GetDefaultValue();
1212 aReturn
<<= OUString( pField
->GetDefaultText() );
1216 // --------------------------------------------------------------------------------------
1217 sal_Bool
SVTXFormattedField::GetTreatAsNumber()
1219 FormattedField
* pField
= GetFormattedField();
1221 return pField
->TreatingAsNumber();
1226 // --------------------------------------------------------------------------------------
1227 void SVTXFormattedField::SetTreatAsNumber(sal_Bool bSet
)
1229 FormattedField
* pField
= GetFormattedField();
1231 pField
->TreatAsNumber(bSet
);
1234 // --------------------------------------------------------------------------------------
1235 ::com::sun::star::uno::Any
SVTXFormattedField::GetValue()
1237 FormattedField
* pField
= GetFormattedField();
1239 return ::com::sun::star::uno::Any();
1241 ::com::sun::star::uno::Any aReturn
;
1242 if (!pField
->TreatingAsNumber())
1244 OUString sText
= pField
->GetTextValue();
1249 if (!pField
->GetText().isEmpty()) // empty wird erst mal standardmaessig als void nach draussen gereicht
1250 aReturn
<<= pField
->GetValue();
1256 // --------------------------------------------------------------------------------------
1257 void SVTXFormattedField::SetValue(const ::com::sun::star::uno::Any
& rValue
)
1259 FormattedField
* pField
= GetFormattedField();
1263 if (!rValue
.hasValue())
1265 pField
->SetText(String());
1269 if (rValue
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_DOUBLE
)
1273 pField
->SetValue(d
);
1277 DBG_ASSERT(rValue
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_STRING
, "SVTXFormattedField::SetValue : invalid argument !");
1281 String
aStr( sText
);
1282 if (!pField
->TreatingAsNumber())
1283 pField
->SetTextFormatted(aStr
);
1285 pField
->SetTextValue(aStr
);
1288 // NotifyTextListeners();
1291 // --------------------------------------------------------------------------------------
1292 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
> SVTXFormattedField::getFormatsSupplier(void) const
1294 return ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
> ((::com::sun::star::util::XNumberFormatsSupplier
*)m_pCurrentSupplier
);
1297 // --------------------------------------------------------------------------------------
1298 void SVTXFormattedField::setFormatsSupplier(const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
> & xSupplier
)
1300 FormattedField
* pField
= GetFormattedField();
1302 SvNumberFormatsSupplierObj
* pNew
= NULL
;
1303 if (!xSupplier
.is())
1307 pNew
= new SvNumberFormatsSupplierObj(pField
->StandardFormatter());
1308 bIsStandardSupplier
= sal_True
;
1313 pNew
= SvNumberFormatsSupplierObj::getImplementation(xSupplier
);
1314 bIsStandardSupplier
= sal_False
;
1318 return; // TODO : wie das behandeln ?
1320 if (m_pCurrentSupplier
)
1321 m_pCurrentSupplier
->release();
1322 m_pCurrentSupplier
= pNew
;
1323 m_pCurrentSupplier
->acquire();
1326 // den aktuellen Value mit hinueberretten
1327 ::com::sun::star::uno::Any aCurrent
= GetValue();
1328 pField
->SetFormatter(m_pCurrentSupplier
->GetNumberFormatter(), sal_False
);
1329 if (nKeyToSetDelayed
!= -1)
1331 pField
->SetFormatKey(nKeyToSetDelayed
);
1332 nKeyToSetDelayed
= -1;
1335 NotifyTextListeners();
1339 // --------------------------------------------------------------------------------------
1340 sal_Int32
SVTXFormattedField::getFormatKey(void) const
1342 FormattedField
* pField
= GetFormattedField();
1343 return pField
? pField
->GetFormatKey() : 0;
1346 // --------------------------------------------------------------------------------------
1347 void SVTXFormattedField::setFormatKey(sal_Int32 nKey
)
1349 FormattedField
* pField
= GetFormattedField();
1352 if (pField
->GetFormatter())
1353 pField
->SetFormatKey(nKey
);
1355 { // Wahrscheinlich bin ich gerade in einem Block, in dem erst der Key und dann der Formatter gesetzt
1356 // wird, das passiert initial mit ziemlicher Sicherheit, da die Properties in alphabetischer Reihenfolge
1357 // gesetzt werden, und der FormatsSupplier nun mal vor dem FormatKey kommt
1358 nKeyToSetDelayed
= nKey
;
1360 NotifyTextListeners();
1364 // --------------------------------------------------------------------------------------
1365 void SVTXFormattedField::NotifyTextListeners()
1367 if ( GetTextListeners().getLength() )
1369 ::com::sun::star::awt::TextEvent aEvent
;
1370 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1371 GetTextListeners().textChanged( aEvent
);
1375 void SVTXFormattedField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
1377 PushPropertyIds( rIds
,
1378 // FIXME: elide duplication ?
1379 BASEPROPERTY_EFFECTIVE_MIN
,
1380 BASEPROPERTY_VALUEMIN_DOUBLE
,
1381 BASEPROPERTY_EFFECTIVE_MAX
,
1382 BASEPROPERTY_VALUEMAX_DOUBLE
,
1383 BASEPROPERTY_EFFECTIVE_DEFAULT
,
1384 BASEPROPERTY_TREATASNUMBER
,
1385 BASEPROPERTY_EFFECTIVE_VALUE
,
1386 BASEPROPERTY_VALUE_DOUBLE
,
1387 BASEPROPERTY_VALUESTEP_DOUBLE
,
1388 BASEPROPERTY_DECIMALACCURACY
,
1389 BASEPROPERTY_FORMATSSUPPLIER
,
1390 BASEPROPERTY_NUMSHOWTHOUSANDSEP
,
1391 BASEPROPERTY_FORMATKEY
,
1392 BASEPROPERTY_TREATASNUMBER
,
1393 BASEPROPERTY_ENFORCE_FORMAT
,
1395 VCLXWindow::ImplGetPropertyIds( rIds
, true );
1396 VCLXSpinField::ImplGetPropertyIds( rIds
);
1400 // ----------------------------------------------------
1401 // class SVTXRoadmap
1402 // ----------------------------------------------------
1404 using namespace svt
;
1406 // --------------------------------------------------------------------------------------
1407 SVTXRoadmap::SVTXRoadmap() : maItemListeners( *this )
1411 // --------------------------------------------------------------------------------------
1412 SVTXRoadmap::~SVTXRoadmap()
1416 void SVTXRoadmap::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
1418 switch ( rVclWindowEvent
.GetId() )
1420 case VCLEVENT_ROADMAP_ITEMSELECTED
:
1422 SolarMutexGuard aGuard
;
1423 ::svt::ORoadmap
* pField
= GetRoadmap();
1426 sal_Int16 CurItemID
= pField
->GetCurrentRoadmapItemID();
1427 ::com::sun::star::awt::ItemEvent aEvent
;
1428 aEvent
.Selected
= CurItemID
;
1429 aEvent
.Highlighted
= CurItemID
;
1430 aEvent
.ItemId
= CurItemID
;
1431 maItemListeners
.itemStateChanged( aEvent
);
1436 SVTXRoadmap_Base::ProcessWindowEvent( rVclWindowEvent
);
1442 void SVTXRoadmap::propertyChange( const ::com::sun::star::beans::PropertyChangeEvent
& evt
) throw (::com::sun::star::uno::RuntimeException
)
1444 SolarMutexGuard aGuard
;
1445 ::svt::ORoadmap
* pField
= GetRoadmap();
1448 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> xRoadmapItem
;
1449 xRoadmapItem
= evt
.Source
;
1451 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> xPropertySet( xRoadmapItem
, ::com::sun::star::uno::UNO_QUERY
);
1452 ::com::sun::star::uno::Any aValue
= xPropertySet
->getPropertyValue(OUString( "ID" ));
1455 ::com::sun::star::uno::Any rVal
= evt
.NewValue
;
1456 evt
.NewValue
>>= rVal
;
1457 OUString sPropertyName
= evt
.PropertyName
;
1458 if ( sPropertyName
== "Enabled" )
1460 sal_Bool bEnable
= false;
1461 evt
.NewValue
>>= bEnable
;
1462 pField
->EnableRoadmapItem( (RoadmapTypes::ItemId
)nID
, bEnable
);
1464 else if ( sPropertyName
== "Label" )
1467 evt
.NewValue
>>= sLabel
;
1468 pField
->ChangeRoadmapItemLabel( (RoadmapTypes::ItemId
)nID
, sLabel
);
1470 else if ( sPropertyName
== "ID" )
1472 sal_Int32 nNewID
= 0;
1473 evt
.NewValue
>>= nNewID
;
1474 evt
.OldValue
>>= nID
;
1475 pField
->ChangeRoadmapItemID( (RoadmapTypes::ItemId
)nID
, (RoadmapTypes::ItemId
)nNewID
);
1478 // Todo: handle Interactive appropriately
1483 void SVTXRoadmap::addItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
>& l
) throw (::com::sun::star::uno::RuntimeException
)
1485 maItemListeners
.addInterface( l
);
1488 void SVTXRoadmap::removeItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
>& l
) throw (::com::sun::star::uno::RuntimeException
)
1490 maItemListeners
.removeInterface( l
);
1493 RMItemData
SVTXRoadmap::GetRMItemData( const ::com::sun::star::container::ContainerEvent
& _rEvent
)
1495 RMItemData aCurRMItemData
;
1496 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> xRoadmapItem
;
1497 _rEvent
.Element
>>= xRoadmapItem
;
1498 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> xPropertySet( xRoadmapItem
, ::com::sun::star::uno::UNO_QUERY
);
1499 if ( xPropertySet
.is() )
1501 ::com::sun::star::uno::Any aValue
= xPropertySet
->getPropertyValue(OUString( "Label" ));
1502 aValue
>>= aCurRMItemData
.Label
;
1503 aValue
= xPropertySet
->getPropertyValue(OUString( "ID" ));
1504 aValue
>>= aCurRMItemData
.n_ID
;
1505 aValue
= xPropertySet
->getPropertyValue(OUString( "Enabled" ));
1506 aValue
>>= aCurRMItemData
.b_Enabled
;
1508 return aCurRMItemData
;
1511 void SVTXRoadmap::elementInserted( const ::com::sun::star::container::ContainerEvent
& _rEvent
)throw(::com::sun::star::uno::RuntimeException
)
1513 SolarMutexGuard aGuard
;
1514 ::svt::ORoadmap
* pField
= GetRoadmap();
1517 RMItemData CurItemData
= GetRMItemData( _rEvent
);
1518 sal_Int32 InsertIndex
= 0;
1519 _rEvent
.Accessor
>>= InsertIndex
;
1520 pField
->InsertRoadmapItem( InsertIndex
, CurItemData
.Label
, (RoadmapTypes::ItemId
)CurItemData
.n_ID
, CurItemData
.b_Enabled
);
1524 void SVTXRoadmap::elementRemoved( const ::com::sun::star::container::ContainerEvent
& _rEvent
)throw(::com::sun::star::uno::RuntimeException
)
1526 SolarMutexGuard aGuard
;
1527 ::svt::ORoadmap
* pField
= GetRoadmap();
1530 sal_Int32 DelIndex
= 0;
1531 _rEvent
.Accessor
>>= DelIndex
;
1532 pField
->DeleteRoadmapItem(DelIndex
);
1536 void SVTXRoadmap::elementReplaced( const ::com::sun::star::container::ContainerEvent
& _rEvent
)throw(::com::sun::star::uno::RuntimeException
)
1538 SolarMutexGuard aGuard
;
1539 ::svt::ORoadmap
* pField
= GetRoadmap();
1542 RMItemData CurItemData
= GetRMItemData( _rEvent
);
1543 sal_Int32 ReplaceIndex
= 0;
1544 _rEvent
.Accessor
>>= ReplaceIndex
;
1545 pField
->ReplaceRoadmapItem( ReplaceIndex
, CurItemData
.Label
, (RoadmapTypes::ItemId
)CurItemData
.n_ID
, CurItemData
.b_Enabled
);
1551 // --------------------------------------------------------------------------------------
1552 void SVTXRoadmap::setProperty( const OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
1554 SolarMutexGuard aGuard
;
1556 ::svt::ORoadmap
* pField
= GetRoadmap();
1559 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1562 case BASEPROPERTY_COMPLETE
:
1566 pField
->SetRoadmapComplete( b
);
1570 case BASEPROPERTY_ACTIVATED
:
1574 pField
->SetRoadmapInteractive( b
);
1578 case BASEPROPERTY_CURRENTITEMID
:
1582 pField
->SelectRoadmapItemByID( (RoadmapTypes::ItemId
)nId
);
1586 case BASEPROPERTY_TEXT
:
1590 pField
->SetText( aStr
);
1591 pField
->Invalidate();
1596 SVTXRoadmap_Base::setProperty( PropertyName
, Value
);
1602 SVTXRoadmap_Base::setProperty( PropertyName
, Value
);
1606 // --------------------------------------------------------------------------------------
1607 ::com::sun::star::uno::Any
SVTXRoadmap::getProperty( const OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
1609 SolarMutexGuard aGuard
;
1611 ::com::sun::star::uno::Any aReturn
;
1613 ::svt::ORoadmap
* pField
= GetRoadmap();
1616 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1619 case BASEPROPERTY_COMPLETE
:
1620 aReturn
<<= pField
->IsRoadmapComplete();
1622 case BASEPROPERTY_ACTIVATED
:
1623 aReturn
<<= pField
->IsRoadmapInteractive();
1625 case BASEPROPERTY_CURRENTITEMID
:
1626 aReturn
<<= pField
->GetCurrentRoadmapItemID();
1629 aReturn
= SVTXRoadmap_Base::getProperty(PropertyName
);
1636 void SVTXRoadmap::ImplSetNewImage()
1638 OSL_PRECOND( GetWindow(), "SVTXRoadmap::ImplSetNewImage: window is required to be not-NULL!" );
1639 ::svt::ORoadmap
* pButton
= static_cast< ::svt::ORoadmap
* >( GetWindow() );
1640 pButton
->SetRoadmapBitmap( GetImage().GetBitmapEx() );
1643 void SVTXRoadmap::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
1645 PushPropertyIds( rIds
,
1646 BASEPROPERTY_COMPLETE
,
1647 BASEPROPERTY_ACTIVATED
,
1648 BASEPROPERTY_CURRENTITEMID
,
1651 VCLXWindow::ImplGetPropertyIds( rIds
, true );
1652 VCLXGraphicControl::ImplGetPropertyIds( rIds
);
1655 // ----------------------------------------------------
1656 // class SVTXNumericField
1657 // ----------------------------------------------------
1658 SVTXNumericField::SVTXNumericField()
1662 SVTXNumericField::~SVTXNumericField()
1666 ::com::sun::star::uno::Any
SVTXNumericField::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
1668 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
1669 (static_cast< ::com::sun::star::awt::XNumericField
* >(this)),
1670 (static_cast< ::com::sun::star::lang::XTypeProvider
* >(this)) );
1671 return (aRet
.hasValue() ? aRet
: SVTXFormattedField::queryInterface( rType
));
1674 // ::com::sun::star::lang::XTypeProvider
1675 IMPL_XTYPEPROVIDER_START( SVTXNumericField
)
1676 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XNumericField
>* ) NULL
),
1677 SVTXFormattedField::getTypes()
1678 IMPL_XTYPEPROVIDER_END
1681 void SVTXNumericField::setValue( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1683 SolarMutexGuard aGuard
;
1685 FormattedField
* pField
= GetFormattedField();
1687 pField
->SetValue( Value
);
1690 double SVTXNumericField::getValue() throw(::com::sun::star::uno::RuntimeException
)
1692 SolarMutexGuard aGuard
;
1694 FormattedField
* pField
= GetFormattedField();
1695 return pField
? pField
->GetValue() : 0;
1698 void SVTXNumericField::setMin( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1700 SolarMutexGuard aGuard
;
1702 FormattedField
* pField
= GetFormattedField();
1704 pField
->SetMinValue( Value
);
1707 double SVTXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException
)
1709 SolarMutexGuard aGuard
;
1711 FormattedField
* pField
= GetFormattedField();
1712 return pField
? pField
->GetMinValue() : 0;
1715 void SVTXNumericField::setMax( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1717 SolarMutexGuard aGuard
;
1719 FormattedField
* pField
= GetFormattedField();
1721 pField
->SetMaxValue( Value
);
1724 double SVTXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException
)
1726 SolarMutexGuard aGuard
;
1728 FormattedField
* pField
= GetFormattedField();
1729 return pField
? pField
->GetMaxValue() : 0;
1732 void SVTXNumericField::setFirst( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1734 SolarMutexGuard aGuard
;
1736 FormattedField
* pField
= GetFormattedField();
1738 pField
->SetSpinFirst( Value
);
1741 double SVTXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeException
)
1743 SolarMutexGuard aGuard
;
1745 FormattedField
* pField
= GetFormattedField();
1746 return pField
? pField
->GetSpinFirst() : 0;
1749 void SVTXNumericField::setLast( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1751 SolarMutexGuard aGuard
;
1753 FormattedField
* pField
= GetFormattedField();
1755 pField
->SetSpinLast( Value
);
1758 double SVTXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException
)
1760 SolarMutexGuard aGuard
;
1762 FormattedField
* pField
= GetFormattedField();
1763 return pField
? pField
->GetSpinLast() : 0;
1766 void SVTXNumericField::setSpinSize( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1768 SolarMutexGuard aGuard
;
1770 FormattedField
* pField
= GetFormattedField();
1772 pField
->SetSpinSize( Value
);
1775 double SVTXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeException
)
1777 SolarMutexGuard aGuard
;
1779 FormattedField
* pField
= GetFormattedField();
1780 return pField
? pField
->GetSpinSize() : 0;
1783 void SVTXNumericField::setDecimalDigits( sal_Int16 Value
) throw(::com::sun::star::uno::RuntimeException
)
1785 SolarMutexGuard aGuard
;
1787 FormattedField
* pField
= GetFormattedField();
1789 pField
->SetDecimalDigits( Value
);
1792 sal_Int16
SVTXNumericField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException
)
1794 SolarMutexGuard aGuard
;
1796 FormattedField
* pField
= GetFormattedField();
1797 return pField
? pField
->GetDecimalDigits() : 0;
1800 void SVTXNumericField::setStrictFormat( sal_Bool bStrict
) throw(::com::sun::star::uno::RuntimeException
)
1802 SolarMutexGuard aGuard
;
1804 FormattedField
* pField
= GetFormattedField();
1806 pField
->SetStrictFormat( bStrict
);
1809 sal_Bool
SVTXNumericField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException
)
1811 SolarMutexGuard aGuard
;
1813 FormattedField
* pField
= GetFormattedField();
1814 return pField
? pField
->IsStrictFormat() : sal_False
;
1817 void SVTXNumericField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
1819 SVTXFormattedField::ImplGetPropertyIds( rIds
);
1822 // ----------------------------------------------------
1823 // class SVTXCurrencyField
1824 // ----------------------------------------------------
1825 SVTXCurrencyField::SVTXCurrencyField()
1829 SVTXCurrencyField::~SVTXCurrencyField()
1833 ::com::sun::star::uno::Any
SVTXCurrencyField::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
1835 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
1836 (static_cast< ::com::sun::star::awt::XCurrencyField
* >(this)),
1837 (static_cast< ::com::sun::star::lang::XTypeProvider
* >(this)) );
1838 return (aRet
.hasValue() ? aRet
: SVTXFormattedField::queryInterface( rType
));
1841 // ::com::sun::star::lang::XTypeProvider
1842 IMPL_XTYPEPROVIDER_START( SVTXCurrencyField
)
1843 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XCurrencyField
>* ) NULL
),
1844 SVTXFormattedField::getTypes()
1845 IMPL_XTYPEPROVIDER_END
1847 void SVTXCurrencyField::setValue( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1849 SolarMutexGuard aGuard
;
1851 FormattedField
* pField
= GetFormattedField();
1853 pField
->SetValue( Value
);
1856 double SVTXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeException
)
1858 SolarMutexGuard aGuard
;
1860 FormattedField
* pField
= GetFormattedField();
1861 return pField
? pField
->GetValue() : 0;
1864 void SVTXCurrencyField::setMin( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1866 SolarMutexGuard aGuard
;
1868 FormattedField
* pField
= GetFormattedField();
1870 pField
->SetMinValue( Value
);
1873 double SVTXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException
)
1875 SolarMutexGuard aGuard
;
1877 FormattedField
* pField
= GetFormattedField();
1878 return pField
? pField
->GetMinValue() : 0;
1881 void SVTXCurrencyField::setMax( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1883 SolarMutexGuard aGuard
;
1885 FormattedField
* pField
= GetFormattedField();
1887 pField
->SetMaxValue( Value
);
1890 double SVTXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException
)
1892 SolarMutexGuard aGuard
;
1894 FormattedField
* pField
= GetFormattedField();
1895 return pField
? pField
->GetMaxValue() : 0;
1898 void SVTXCurrencyField::setFirst( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1900 SolarMutexGuard aGuard
;
1902 FormattedField
* pField
= GetFormattedField();
1904 pField
->SetSpinFirst( Value
);
1907 double SVTXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeException
)
1909 SolarMutexGuard aGuard
;
1911 FormattedField
* pField
= GetFormattedField();
1912 return pField
? pField
->GetSpinFirst() : 0;
1915 void SVTXCurrencyField::setLast( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1917 SolarMutexGuard aGuard
;
1919 FormattedField
* pField
= GetFormattedField();
1921 pField
->SetSpinLast( Value
);
1924 double SVTXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeException
)
1926 SolarMutexGuard aGuard
;
1928 FormattedField
* pField
= GetFormattedField();
1929 return pField
? pField
->GetSpinLast() : 0;
1932 void SVTXCurrencyField::setSpinSize( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1934 SolarMutexGuard aGuard
;
1936 FormattedField
* pField
= GetFormattedField();
1938 pField
->SetSpinSize( Value
);
1941 double SVTXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeException
)
1943 SolarMutexGuard aGuard
;
1945 FormattedField
* pField
= GetFormattedField();
1946 return pField
? pField
->GetSpinSize() : 0;
1949 void SVTXCurrencyField::setDecimalDigits( sal_Int16 Value
) throw(::com::sun::star::uno::RuntimeException
)
1951 SolarMutexGuard aGuard
;
1953 FormattedField
* pField
= GetFormattedField();
1955 pField
->SetDecimalDigits( Value
);
1958 sal_Int16
SVTXCurrencyField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException
)
1960 SolarMutexGuard aGuard
;
1962 FormattedField
* pField
= GetFormattedField();
1963 return pField
? pField
->GetDecimalDigits() : 0;
1966 void SVTXCurrencyField::setStrictFormat( sal_Bool bStrict
) throw(::com::sun::star::uno::RuntimeException
)
1968 SolarMutexGuard aGuard
;
1970 FormattedField
* pField
= GetFormattedField();
1972 pField
->SetStrictFormat( bStrict
);
1975 sal_Bool
SVTXCurrencyField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException
)
1977 SolarMutexGuard aGuard
;
1979 FormattedField
* pField
= GetFormattedField();
1980 return pField
? pField
->IsStrictFormat() : sal_False
;
1983 void SVTXCurrencyField::setProperty( const OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
1985 SolarMutexGuard aGuard
;
1987 ::com::sun::star::uno::Any aReturn
;
1989 DoubleCurrencyField
* pField
= (DoubleCurrencyField
*)GetFormattedField();
1992 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1995 case BASEPROPERTY_CURRENCYSYMBOL
:
1999 pField
->setCurrencySymbol( aStr
);
2002 case BASEPROPERTY_CURSYM_POSITION
:
2006 pField
->setPrependCurrSym(b
);
2011 SVTXFormattedField::setProperty(PropertyName
, Value
);
2015 SVTXFormattedField::setProperty(PropertyName
, Value
);
2018 ::com::sun::star::uno::Any
SVTXCurrencyField::getProperty( const OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
2020 SolarMutexGuard aGuard
;
2022 ::com::sun::star::uno::Any aReturn
;
2024 DoubleCurrencyField
* pField
= (DoubleCurrencyField
*)GetFormattedField();
2027 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2030 case BASEPROPERTY_CURRENCYSYMBOL
:
2032 aReturn
<<= OUString( pField
->getCurrencySymbol() );
2035 case BASEPROPERTY_CURSYM_POSITION
:
2037 aReturn
<<= pField
->getPrependCurrSym();
2041 return SVTXFormattedField::getProperty(PropertyName
);
2044 return SVTXFormattedField::getProperty(PropertyName
);
2047 void SVTXCurrencyField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
2049 PushPropertyIds( rIds
,
2050 BASEPROPERTY_CURRENCYSYMBOL
,
2051 BASEPROPERTY_CURSYM_POSITION
,
2053 SVTXFormattedField::ImplGetPropertyIds( rIds
);
2057 // ----------------------------------------------------
2058 // class VCLXProgressBar
2059 // ----------------------------------------------------
2061 VCLXProgressBar::VCLXProgressBar()
2068 VCLXProgressBar::~VCLXProgressBar()
2072 void VCLXProgressBar::ImplUpdateValue()
2074 ProgressBar
* pProgressBar
= (ProgressBar
*) GetWindow();
2081 // check min and max
2082 if (m_nValueMin
< m_nValueMax
)
2084 nValMin
= m_nValueMin
;
2085 nValMax
= m_nValueMax
;
2089 nValMin
= m_nValueMax
;
2090 nValMax
= m_nValueMin
;
2094 if (m_nValue
< nValMin
)
2098 else if (m_nValue
> nValMax
)
2107 // calculate percent
2109 if (nValMin
!= nValMax
)
2111 nPercent
= 100 * (nVal
- nValMin
) / (nValMax
- nValMin
);
2118 // set progressbar value
2119 pProgressBar
->SetValue( (sal_uInt16
) nPercent
);
2123 // ::com::sun::star::uno::XInterface
2124 ::com::sun::star::uno::Any
VCLXProgressBar::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
2126 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
2127 (static_cast< ::com::sun::star::awt::XProgressBar
* >(this)),
2128 (static_cast< ::com::sun::star::lang::XTypeProvider
* >(this)) );
2129 return (aRet
.hasValue() ? aRet
: VCLXWindow::queryInterface( rType
));
2132 // ::com::sun::star::lang::XTypeProvider
2133 IMPL_XTYPEPROVIDER_START( VCLXProgressBar
)
2134 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XProgressBar
>* ) NULL
),
2135 VCLXWindow::getTypes()
2136 IMPL_XTYPEPROVIDER_END
2138 // ::com::sun::star::awt::XProgressBar
2139 void VCLXProgressBar::setForegroundColor( sal_Int32 nColor
) throw(::com::sun::star::uno::RuntimeException
)
2141 SolarMutexGuard aGuard
;
2143 Window
* pWindow
= GetWindow();
2146 Color
aColor( nColor
);
2147 pWindow
->SetControlForeground( aColor
);
2151 void VCLXProgressBar::setBackgroundColor( sal_Int32 nColor
) throw(::com::sun::star::uno::RuntimeException
)
2153 SolarMutexGuard aGuard
;
2155 Window
* pWindow
= GetWindow();
2158 Color
aColor( nColor
);
2159 pWindow
->SetBackground( aColor
);
2160 pWindow
->SetControlBackground( aColor
);
2161 pWindow
->Invalidate();
2165 void VCLXProgressBar::setValue( sal_Int32 nValue
) throw(::com::sun::star::uno::RuntimeException
)
2167 SolarMutexGuard aGuard
;
2173 void VCLXProgressBar::setRange( sal_Int32 nMin
, sal_Int32 nMax
) throw(::com::sun::star::uno::RuntimeException
)
2175 SolarMutexGuard aGuard
;
2179 // take correct min and max
2185 // change min and max
2193 sal_Int32
VCLXProgressBar::getValue() throw(::com::sun::star::uno::RuntimeException
)
2195 SolarMutexGuard aGuard
;
2200 // ::com::sun::star::awt::VclWindowPeer
2201 void VCLXProgressBar::setProperty( const OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
2203 SolarMutexGuard aGuard
;
2205 ProgressBar
* pProgressBar
= (ProgressBar
*)GetWindow();
2208 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2209 switch ( nPropType
)
2211 case BASEPROPERTY_PROGRESSVALUE
:
2213 if ( Value
>>= m_nValue
)
2217 case BASEPROPERTY_PROGRESSVALUE_MIN
:
2219 if ( Value
>>= m_nValueMin
)
2223 case BASEPROPERTY_PROGRESSVALUE_MAX
:
2225 if ( Value
>>= m_nValueMax
)
2229 case BASEPROPERTY_FILLCOLOR
:
2231 Window
* pWindow
= GetWindow();
2234 sal_Bool bVoid
= Value
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
;
2238 pWindow
->SetControlForeground();
2242 sal_Int32 nColor
= 0;
2243 if ( Value
>>= nColor
)
2245 Color
aColor( nColor
);
2246 pWindow
->SetControlForeground( aColor
);
2253 VCLXWindow::setProperty( PropertyName
, Value
);
2259 ::com::sun::star::uno::Any
VCLXProgressBar::getProperty( const OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
2261 SolarMutexGuard aGuard
;
2263 ::com::sun::star::uno::Any aProp
;
2264 ProgressBar
* pProgressBar
= (ProgressBar
*)GetWindow();
2267 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2268 switch ( nPropType
)
2270 case BASEPROPERTY_PROGRESSVALUE
:
2275 case BASEPROPERTY_PROGRESSVALUE_MIN
:
2277 aProp
<<= m_nValueMin
;
2280 case BASEPROPERTY_PROGRESSVALUE_MAX
:
2282 aProp
<<= m_nValueMax
;
2286 aProp
<<= VCLXWindow::getProperty( PropertyName
);
2293 void VCLXProgressBar::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
2295 PushPropertyIds( rIds
,
2296 BASEPROPERTY_PROGRESSVALUE
,
2297 BASEPROPERTY_PROGRESSVALUE_MIN
,
2298 BASEPROPERTY_PROGRESSVALUE_MAX
,
2299 BASEPROPERTY_FILLCOLOR
,
2301 VCLXWindow::ImplGetPropertyIds( rIds
, true );
2305 // ----------------------------------------------------
2306 // class SVTXDateField
2307 // ----------------------------------------------------
2308 SVTXDateField::SVTXDateField()
2313 SVTXDateField::~SVTXDateField()
2317 void SAL_CALL
SVTXDateField::setProperty( const OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
2319 VCLXDateField::setProperty( PropertyName
, Value
);
2321 // some properties need to be forwarded to the sub edit, too
2322 Edit
* pSubEdit
= GetWindow() ? static_cast< Edit
* >( GetWindow() )->GetSubEdit() : NULL
;
2326 switch ( GetPropertyId( PropertyName
) )
2328 case BASEPROPERTY_TEXTLINECOLOR
:
2329 if ( !Value
.hasValue() )
2330 pSubEdit
->SetTextLineColor();
2333 sal_Int32 nColor
= 0;
2334 if ( Value
>>= nColor
)
2335 pSubEdit
->SetTextLineColor( Color( nColor
) );
2341 void SVTXDateField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
2343 PushPropertyIds( rIds
,
2344 BASEPROPERTY_TEXTLINECOLOR
,
2346 VCLXDateField::ImplGetPropertyIds( rIds
);
2349 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */