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 OUString
aServiceName( pDescriptor
->WindowServiceName
);
66 if ( aServiceName
.equalsIgnoreAsciiCase( "MultiLineEdit" ) )
70 pWindow
= new MultiLineEdit( pParent
, nWinBits
|WB_IGNORETAB
);
71 static_cast< MultiLineEdit
* >( pWindow
)->DisableSelectionOnFocus();
72 *ppNewComp
= new VCLXMultiLineEdit
;
80 else if ( aServiceName
.equalsIgnoreAsciiCase( "FileControl" ) )
84 pWindow
= new FileControl( pParent
, nWinBits
);
85 *ppNewComp
= new VCLXFileControl
;
93 else if (aServiceName
.equalsIgnoreAsciiCase("FormattedField") )
95 pWindow
= new FormattedField( pParent
, nWinBits
);
96 *ppNewComp
= new SVTXFormattedField
;
98 else if (aServiceName
.equalsIgnoreAsciiCase("NumericField") )
100 pWindow
= new DoubleNumericField( pParent
, nWinBits
);
101 *ppNewComp
= new SVTXNumericField
;
103 else if (aServiceName
.equalsIgnoreAsciiCase("LongCurrencyField") )
105 pWindow
= new DoubleCurrencyField( pParent
, nWinBits
);
106 *ppNewComp
= new SVTXCurrencyField
;
108 else if (aServiceName
.equalsIgnoreAsciiCase("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
.equalsIgnoreAsciiCase("roadmap") )
119 pWindow
= new ::svt::ORoadmap( pParent
, WB_TABSTOP
);
120 *ppNewComp
= new SVTXRoadmap
;
122 else if ( aServiceName
.equalsIgnoreAsciiCase( "ProgressBar" ) )
126 pWindow
= new ProgressBar( pParent
, nWinBits
);
127 *ppNewComp
= new VCLXProgressBar
;
135 else if ( aServiceName
.equalsIgnoreAsciiCase( "Tree" ) )
137 TreeControlPeer
* pPeer
= new TreeControlPeer
;
139 pWindow
= pPeer
->createVclControl( pParent
, nWinBits
);
141 else if ( aServiceName
.equalsIgnoreAsciiCase( "FixedHyperlink" ) )
145 pWindow
= new FixedHyperlink( pParent
, nWinBits
);
146 *ppNewComp
= new VCLXFixedHyperlink
;
154 else if ( aServiceName
.equalsIgnoreAsciiCase( "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
1054 OUString sConverted
;
1055 pFormatter
->GetOutputString(d
, 0, sConverted
, &pDum
);
1056 aReturn
<<= sConverted
;
1059 case ::com::sun::star::uno::TypeClass_STRING
:
1063 if (pField
->TreatingAsNumber())
1065 SvNumberFormatter
* pFormatter
= pField
->GetFormatter();
1067 pFormatter
= pField
->StandardFormatter();
1070 sal_uInt32
nTestFormat(0);
1071 if (!pFormatter
->IsNumberFormat(aStr
, nTestFormat
, dVal
))
1086 // --------------------------------------------------------------------------------------
1087 void SVTXFormattedField::SetMinValue(const ::com::sun::star::uno::Any
& rValue
)
1089 FormattedField
* pField
= GetFormattedField();
1093 switch (rValue
.getValueType().getTypeClass())
1096 case ::com::sun::star::uno::TypeClass_DOUBLE
:
1100 pField
->SetMinValue(d
);
1104 DBG_ASSERT(rValue
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
, "SVTXFormattedField::SetMinValue : invalid argument (an exception will be thrown) !");
1105 if ( rValue
.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID
)
1108 throw ::com::sun::star::lang::IllegalArgumentException();
1110 pField
->ClearMinValue();
1115 // --------------------------------------------------------------------------------------
1116 ::com::sun::star::uno::Any
SVTXFormattedField::GetMinValue()
1118 FormattedField
* pField
= GetFormattedField();
1119 if (!pField
|| !pField
->HasMinValue())
1120 return ::com::sun::star::uno::Any();
1122 ::com::sun::star::uno::Any aReturn
;
1123 aReturn
<<= pField
->GetMinValue();
1127 // --------------------------------------------------------------------------------------
1128 void SVTXFormattedField::SetMaxValue(const ::com::sun::star::uno::Any
& rValue
)
1130 FormattedField
* pField
= GetFormattedField();
1134 switch (rValue
.getValueType().getTypeClass())
1137 case ::com::sun::star::uno::TypeClass_DOUBLE
:
1141 pField
->SetMaxValue(d
);
1145 if (rValue
.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID
)
1148 throw ::com::sun::star::lang::IllegalArgumentException();
1150 pField
->ClearMaxValue();
1155 // --------------------------------------------------------------------------------------
1156 ::com::sun::star::uno::Any
SVTXFormattedField::GetMaxValue()
1158 FormattedField
* pField
= GetFormattedField();
1159 if (!pField
|| !pField
->HasMaxValue())
1160 return ::com::sun::star::uno::Any();
1162 ::com::sun::star::uno::Any aReturn
;
1163 aReturn
<<= pField
->GetMaxValue();
1167 // --------------------------------------------------------------------------------------
1168 void SVTXFormattedField::SetDefaultValue(const ::com::sun::star::uno::Any
& rValue
)
1170 FormattedField
* pField
= GetFormattedField();
1174 ::com::sun::star::uno::Any aConverted
= convertEffectiveValue(rValue
);
1176 switch (aConverted
.getValueType().getTypeClass())
1179 case ::com::sun::star::uno::TypeClass_DOUBLE
:
1183 pField
->SetDefaultValue(d
);
1186 case ::com::sun::star::uno::TypeClass_STRING
:
1189 aConverted
>>= aStr
;
1190 pField
->SetDefaultText( aStr
);
1194 pField
->EnableEmptyField(sal_True
);
1195 // nur noch void erlaubt
1200 // --------------------------------------------------------------------------------------
1201 ::com::sun::star::uno::Any
SVTXFormattedField::GetDefaultValue()
1203 FormattedField
* pField
= GetFormattedField();
1204 if (!pField
|| pField
->IsEmptyFieldEnabled())
1205 return ::com::sun::star::uno::Any();
1207 ::com::sun::star::uno::Any aReturn
;
1208 if (pField
->TreatingAsNumber())
1209 aReturn
<<= pField
->GetDefaultValue();
1211 aReturn
<<= OUString( pField
->GetDefaultText() );
1215 // --------------------------------------------------------------------------------------
1216 sal_Bool
SVTXFormattedField::GetTreatAsNumber()
1218 FormattedField
* pField
= GetFormattedField();
1220 return pField
->TreatingAsNumber();
1225 // --------------------------------------------------------------------------------------
1226 void SVTXFormattedField::SetTreatAsNumber(sal_Bool bSet
)
1228 FormattedField
* pField
= GetFormattedField();
1230 pField
->TreatAsNumber(bSet
);
1233 // --------------------------------------------------------------------------------------
1234 ::com::sun::star::uno::Any
SVTXFormattedField::GetValue()
1236 FormattedField
* pField
= GetFormattedField();
1238 return ::com::sun::star::uno::Any();
1240 ::com::sun::star::uno::Any aReturn
;
1241 if (!pField
->TreatingAsNumber())
1243 OUString sText
= pField
->GetTextValue();
1248 if (!pField
->GetText().isEmpty()) // empty wird erst mal standardmaessig als void nach draussen gereicht
1249 aReturn
<<= pField
->GetValue();
1255 // --------------------------------------------------------------------------------------
1256 void SVTXFormattedField::SetValue(const ::com::sun::star::uno::Any
& rValue
)
1258 FormattedField
* pField
= GetFormattedField();
1262 if (!rValue
.hasValue())
1264 pField
->SetText("");
1268 if (rValue
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_DOUBLE
)
1272 pField
->SetValue(d
);
1276 DBG_ASSERT(rValue
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_STRING
, "SVTXFormattedField::SetValue : invalid argument !");
1280 if (!pField
->TreatingAsNumber())
1281 pField
->SetTextFormatted(sText
);
1283 pField
->SetTextValue(sText
);
1286 // NotifyTextListeners();
1289 // --------------------------------------------------------------------------------------
1290 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
> SVTXFormattedField::getFormatsSupplier(void) const
1292 return ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
> ((::com::sun::star::util::XNumberFormatsSupplier
*)m_pCurrentSupplier
);
1295 // --------------------------------------------------------------------------------------
1296 void SVTXFormattedField::setFormatsSupplier(const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
> & xSupplier
)
1298 FormattedField
* pField
= GetFormattedField();
1300 SvNumberFormatsSupplierObj
* pNew
= NULL
;
1301 if (!xSupplier
.is())
1305 pNew
= new SvNumberFormatsSupplierObj(pField
->StandardFormatter());
1306 bIsStandardSupplier
= sal_True
;
1311 pNew
= SvNumberFormatsSupplierObj::getImplementation(xSupplier
);
1312 bIsStandardSupplier
= sal_False
;
1316 return; // TODO : wie das behandeln ?
1318 if (m_pCurrentSupplier
)
1319 m_pCurrentSupplier
->release();
1320 m_pCurrentSupplier
= pNew
;
1321 m_pCurrentSupplier
->acquire();
1324 // den aktuellen Value mit hinueberretten
1325 ::com::sun::star::uno::Any aCurrent
= GetValue();
1326 pField
->SetFormatter(m_pCurrentSupplier
->GetNumberFormatter(), sal_False
);
1327 if (nKeyToSetDelayed
!= -1)
1329 pField
->SetFormatKey(nKeyToSetDelayed
);
1330 nKeyToSetDelayed
= -1;
1333 NotifyTextListeners();
1337 // --------------------------------------------------------------------------------------
1338 sal_Int32
SVTXFormattedField::getFormatKey(void) const
1340 FormattedField
* pField
= GetFormattedField();
1341 return pField
? pField
->GetFormatKey() : 0;
1344 // --------------------------------------------------------------------------------------
1345 void SVTXFormattedField::setFormatKey(sal_Int32 nKey
)
1347 FormattedField
* pField
= GetFormattedField();
1350 if (pField
->GetFormatter())
1351 pField
->SetFormatKey(nKey
);
1353 { // Wahrscheinlich bin ich gerade in einem Block, in dem erst der Key und dann der Formatter gesetzt
1354 // wird, das passiert initial mit ziemlicher Sicherheit, da die Properties in alphabetischer Reihenfolge
1355 // gesetzt werden, und der FormatsSupplier nun mal vor dem FormatKey kommt
1356 nKeyToSetDelayed
= nKey
;
1358 NotifyTextListeners();
1362 // --------------------------------------------------------------------------------------
1363 void SVTXFormattedField::NotifyTextListeners()
1365 if ( GetTextListeners().getLength() )
1367 ::com::sun::star::awt::TextEvent aEvent
;
1368 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1369 GetTextListeners().textChanged( aEvent
);
1373 void SVTXFormattedField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
1375 PushPropertyIds( rIds
,
1376 // FIXME: elide duplication ?
1377 BASEPROPERTY_EFFECTIVE_MIN
,
1378 BASEPROPERTY_VALUEMIN_DOUBLE
,
1379 BASEPROPERTY_EFFECTIVE_MAX
,
1380 BASEPROPERTY_VALUEMAX_DOUBLE
,
1381 BASEPROPERTY_EFFECTIVE_DEFAULT
,
1382 BASEPROPERTY_TREATASNUMBER
,
1383 BASEPROPERTY_EFFECTIVE_VALUE
,
1384 BASEPROPERTY_VALUE_DOUBLE
,
1385 BASEPROPERTY_VALUESTEP_DOUBLE
,
1386 BASEPROPERTY_DECIMALACCURACY
,
1387 BASEPROPERTY_FORMATSSUPPLIER
,
1388 BASEPROPERTY_NUMSHOWTHOUSANDSEP
,
1389 BASEPROPERTY_FORMATKEY
,
1390 BASEPROPERTY_TREATASNUMBER
,
1391 BASEPROPERTY_ENFORCE_FORMAT
,
1393 VCLXWindow::ImplGetPropertyIds( rIds
, true );
1394 VCLXSpinField::ImplGetPropertyIds( rIds
);
1398 // ----------------------------------------------------
1399 // class SVTXRoadmap
1400 // ----------------------------------------------------
1402 using namespace svt
;
1404 // --------------------------------------------------------------------------------------
1405 SVTXRoadmap::SVTXRoadmap() : maItemListeners( *this )
1409 // --------------------------------------------------------------------------------------
1410 SVTXRoadmap::~SVTXRoadmap()
1414 void SVTXRoadmap::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
1416 switch ( rVclWindowEvent
.GetId() )
1418 case VCLEVENT_ROADMAP_ITEMSELECTED
:
1420 SolarMutexGuard aGuard
;
1421 ::svt::ORoadmap
* pField
= GetRoadmap();
1424 sal_Int16 CurItemID
= pField
->GetCurrentRoadmapItemID();
1425 ::com::sun::star::awt::ItemEvent aEvent
;
1426 aEvent
.Selected
= CurItemID
;
1427 aEvent
.Highlighted
= CurItemID
;
1428 aEvent
.ItemId
= CurItemID
;
1429 maItemListeners
.itemStateChanged( aEvent
);
1434 SVTXRoadmap_Base::ProcessWindowEvent( rVclWindowEvent
);
1440 void SVTXRoadmap::propertyChange( const ::com::sun::star::beans::PropertyChangeEvent
& evt
) throw (::com::sun::star::uno::RuntimeException
)
1442 SolarMutexGuard aGuard
;
1443 ::svt::ORoadmap
* pField
= GetRoadmap();
1446 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> xRoadmapItem
;
1447 xRoadmapItem
= evt
.Source
;
1449 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> xPropertySet( xRoadmapItem
, ::com::sun::star::uno::UNO_QUERY
);
1450 ::com::sun::star::uno::Any aValue
= xPropertySet
->getPropertyValue("ID");
1453 ::com::sun::star::uno::Any rVal
= evt
.NewValue
;
1454 evt
.NewValue
>>= rVal
;
1455 OUString sPropertyName
= evt
.PropertyName
;
1456 if ( sPropertyName
== "Enabled" )
1458 sal_Bool bEnable
= false;
1459 evt
.NewValue
>>= bEnable
;
1460 pField
->EnableRoadmapItem( (RoadmapTypes::ItemId
)nID
, bEnable
);
1462 else if ( sPropertyName
== "Label" )
1465 evt
.NewValue
>>= sLabel
;
1466 pField
->ChangeRoadmapItemLabel( (RoadmapTypes::ItemId
)nID
, sLabel
);
1468 else if ( sPropertyName
== "ID" )
1470 sal_Int32 nNewID
= 0;
1471 evt
.NewValue
>>= nNewID
;
1472 evt
.OldValue
>>= nID
;
1473 pField
->ChangeRoadmapItemID( (RoadmapTypes::ItemId
)nID
, (RoadmapTypes::ItemId
)nNewID
);
1476 // Todo: handle Interactive appropriately
1481 void SVTXRoadmap::addItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
>& l
) throw (::com::sun::star::uno::RuntimeException
)
1483 maItemListeners
.addInterface( l
);
1486 void SVTXRoadmap::removeItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
>& l
) throw (::com::sun::star::uno::RuntimeException
)
1488 maItemListeners
.removeInterface( l
);
1491 RMItemData
SVTXRoadmap::GetRMItemData( const ::com::sun::star::container::ContainerEvent
& _rEvent
)
1493 RMItemData aCurRMItemData
;
1494 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> xRoadmapItem
;
1495 _rEvent
.Element
>>= xRoadmapItem
;
1496 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> xPropertySet( xRoadmapItem
, ::com::sun::star::uno::UNO_QUERY
);
1497 if ( xPropertySet
.is() )
1499 ::com::sun::star::uno::Any aValue
= xPropertySet
->getPropertyValue("Label");
1500 aValue
>>= aCurRMItemData
.Label
;
1501 aValue
= xPropertySet
->getPropertyValue("ID");
1502 aValue
>>= aCurRMItemData
.n_ID
;
1503 aValue
= xPropertySet
->getPropertyValue("Enabled");
1504 aValue
>>= aCurRMItemData
.b_Enabled
;
1508 aCurRMItemData
.b_Enabled
= sal_False
;
1509 aCurRMItemData
.n_ID
= 0;
1511 return aCurRMItemData
;
1514 void SVTXRoadmap::elementInserted( const ::com::sun::star::container::ContainerEvent
& _rEvent
)throw(::com::sun::star::uno::RuntimeException
)
1516 SolarMutexGuard aGuard
;
1517 ::svt::ORoadmap
* pField
= GetRoadmap();
1520 RMItemData CurItemData
= GetRMItemData( _rEvent
);
1521 sal_Int32 InsertIndex
= 0;
1522 _rEvent
.Accessor
>>= InsertIndex
;
1523 pField
->InsertRoadmapItem( InsertIndex
, CurItemData
.Label
, (RoadmapTypes::ItemId
)CurItemData
.n_ID
, CurItemData
.b_Enabled
);
1527 void SVTXRoadmap::elementRemoved( const ::com::sun::star::container::ContainerEvent
& _rEvent
)throw(::com::sun::star::uno::RuntimeException
)
1529 SolarMutexGuard aGuard
;
1530 ::svt::ORoadmap
* pField
= GetRoadmap();
1533 sal_Int32 DelIndex
= 0;
1534 _rEvent
.Accessor
>>= DelIndex
;
1535 pField
->DeleteRoadmapItem(DelIndex
);
1539 void SVTXRoadmap::elementReplaced( const ::com::sun::star::container::ContainerEvent
& _rEvent
)throw(::com::sun::star::uno::RuntimeException
)
1541 SolarMutexGuard aGuard
;
1542 ::svt::ORoadmap
* pField
= GetRoadmap();
1545 RMItemData CurItemData
= GetRMItemData( _rEvent
);
1546 sal_Int32 ReplaceIndex
= 0;
1547 _rEvent
.Accessor
>>= ReplaceIndex
;
1548 pField
->ReplaceRoadmapItem( ReplaceIndex
, CurItemData
.Label
, (RoadmapTypes::ItemId
)CurItemData
.n_ID
, CurItemData
.b_Enabled
);
1554 // --------------------------------------------------------------------------------------
1555 void SVTXRoadmap::setProperty( const OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
1557 SolarMutexGuard aGuard
;
1559 ::svt::ORoadmap
* pField
= GetRoadmap();
1562 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1565 case BASEPROPERTY_COMPLETE
:
1569 pField
->SetRoadmapComplete( b
);
1573 case BASEPROPERTY_ACTIVATED
:
1577 pField
->SetRoadmapInteractive( b
);
1581 case BASEPROPERTY_CURRENTITEMID
:
1585 pField
->SelectRoadmapItemByID( (RoadmapTypes::ItemId
)nId
);
1589 case BASEPROPERTY_TEXT
:
1593 pField
->SetText( aStr
);
1594 pField
->Invalidate();
1599 SVTXRoadmap_Base::setProperty( PropertyName
, Value
);
1605 SVTXRoadmap_Base::setProperty( PropertyName
, Value
);
1609 // --------------------------------------------------------------------------------------
1610 ::com::sun::star::uno::Any
SVTXRoadmap::getProperty( const OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
1612 SolarMutexGuard aGuard
;
1614 ::com::sun::star::uno::Any aReturn
;
1616 ::svt::ORoadmap
* pField
= GetRoadmap();
1619 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1622 case BASEPROPERTY_COMPLETE
:
1623 aReturn
<<= pField
->IsRoadmapComplete();
1625 case BASEPROPERTY_ACTIVATED
:
1626 aReturn
<<= pField
->IsRoadmapInteractive();
1628 case BASEPROPERTY_CURRENTITEMID
:
1629 aReturn
<<= pField
->GetCurrentRoadmapItemID();
1632 aReturn
= SVTXRoadmap_Base::getProperty(PropertyName
);
1639 void SVTXRoadmap::ImplSetNewImage()
1641 OSL_PRECOND( GetWindow(), "SVTXRoadmap::ImplSetNewImage: window is required to be not-NULL!" );
1642 ::svt::ORoadmap
* pButton
= static_cast< ::svt::ORoadmap
* >( GetWindow() );
1643 pButton
->SetRoadmapBitmap( GetImage().GetBitmapEx() );
1646 void SVTXRoadmap::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
1648 PushPropertyIds( rIds
,
1649 BASEPROPERTY_COMPLETE
,
1650 BASEPROPERTY_ACTIVATED
,
1651 BASEPROPERTY_CURRENTITEMID
,
1654 VCLXWindow::ImplGetPropertyIds( rIds
, true );
1655 VCLXGraphicControl::ImplGetPropertyIds( rIds
);
1658 // ----------------------------------------------------
1659 // class SVTXNumericField
1660 // ----------------------------------------------------
1661 SVTXNumericField::SVTXNumericField()
1665 SVTXNumericField::~SVTXNumericField()
1669 ::com::sun::star::uno::Any
SVTXNumericField::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
1671 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
1672 (static_cast< ::com::sun::star::awt::XNumericField
* >(this)),
1673 (static_cast< ::com::sun::star::lang::XTypeProvider
* >(this)) );
1674 return (aRet
.hasValue() ? aRet
: SVTXFormattedField::queryInterface( rType
));
1677 // ::com::sun::star::lang::XTypeProvider
1678 IMPL_XTYPEPROVIDER_START( SVTXNumericField
)
1679 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XNumericField
>* ) NULL
),
1680 SVTXFormattedField::getTypes()
1681 IMPL_XTYPEPROVIDER_END
1684 void SVTXNumericField::setValue( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1686 SolarMutexGuard aGuard
;
1688 FormattedField
* pField
= GetFormattedField();
1690 pField
->SetValue( Value
);
1693 double SVTXNumericField::getValue() throw(::com::sun::star::uno::RuntimeException
)
1695 SolarMutexGuard aGuard
;
1697 FormattedField
* pField
= GetFormattedField();
1698 return pField
? pField
->GetValue() : 0;
1701 void SVTXNumericField::setMin( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1703 SolarMutexGuard aGuard
;
1705 FormattedField
* pField
= GetFormattedField();
1707 pField
->SetMinValue( Value
);
1710 double SVTXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException
)
1712 SolarMutexGuard aGuard
;
1714 FormattedField
* pField
= GetFormattedField();
1715 return pField
? pField
->GetMinValue() : 0;
1718 void SVTXNumericField::setMax( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1720 SolarMutexGuard aGuard
;
1722 FormattedField
* pField
= GetFormattedField();
1724 pField
->SetMaxValue( Value
);
1727 double SVTXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException
)
1729 SolarMutexGuard aGuard
;
1731 FormattedField
* pField
= GetFormattedField();
1732 return pField
? pField
->GetMaxValue() : 0;
1735 void SVTXNumericField::setFirst( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1737 SolarMutexGuard aGuard
;
1739 FormattedField
* pField
= GetFormattedField();
1741 pField
->SetSpinFirst( Value
);
1744 double SVTXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeException
)
1746 SolarMutexGuard aGuard
;
1748 FormattedField
* pField
= GetFormattedField();
1749 return pField
? pField
->GetSpinFirst() : 0;
1752 void SVTXNumericField::setLast( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1754 SolarMutexGuard aGuard
;
1756 FormattedField
* pField
= GetFormattedField();
1758 pField
->SetSpinLast( Value
);
1761 double SVTXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException
)
1763 SolarMutexGuard aGuard
;
1765 FormattedField
* pField
= GetFormattedField();
1766 return pField
? pField
->GetSpinLast() : 0;
1769 void SVTXNumericField::setSpinSize( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1771 SolarMutexGuard aGuard
;
1773 FormattedField
* pField
= GetFormattedField();
1775 pField
->SetSpinSize( Value
);
1778 double SVTXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeException
)
1780 SolarMutexGuard aGuard
;
1782 FormattedField
* pField
= GetFormattedField();
1783 return pField
? pField
->GetSpinSize() : 0;
1786 void SVTXNumericField::setDecimalDigits( sal_Int16 Value
) throw(::com::sun::star::uno::RuntimeException
)
1788 SolarMutexGuard aGuard
;
1790 FormattedField
* pField
= GetFormattedField();
1792 pField
->SetDecimalDigits( Value
);
1795 sal_Int16
SVTXNumericField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException
)
1797 SolarMutexGuard aGuard
;
1799 FormattedField
* pField
= GetFormattedField();
1800 return pField
? pField
->GetDecimalDigits() : 0;
1803 void SVTXNumericField::setStrictFormat( sal_Bool bStrict
) throw(::com::sun::star::uno::RuntimeException
)
1805 SolarMutexGuard aGuard
;
1807 FormattedField
* pField
= GetFormattedField();
1809 pField
->SetStrictFormat( bStrict
);
1812 sal_Bool
SVTXNumericField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException
)
1814 SolarMutexGuard aGuard
;
1816 FormattedField
* pField
= GetFormattedField();
1817 return pField
? pField
->IsStrictFormat() : sal_False
;
1820 void SVTXNumericField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
1822 SVTXFormattedField::ImplGetPropertyIds( rIds
);
1825 // ----------------------------------------------------
1826 // class SVTXCurrencyField
1827 // ----------------------------------------------------
1828 SVTXCurrencyField::SVTXCurrencyField()
1832 SVTXCurrencyField::~SVTXCurrencyField()
1836 ::com::sun::star::uno::Any
SVTXCurrencyField::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
1838 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
1839 (static_cast< ::com::sun::star::awt::XCurrencyField
* >(this)),
1840 (static_cast< ::com::sun::star::lang::XTypeProvider
* >(this)) );
1841 return (aRet
.hasValue() ? aRet
: SVTXFormattedField::queryInterface( rType
));
1844 // ::com::sun::star::lang::XTypeProvider
1845 IMPL_XTYPEPROVIDER_START( SVTXCurrencyField
)
1846 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XCurrencyField
>* ) NULL
),
1847 SVTXFormattedField::getTypes()
1848 IMPL_XTYPEPROVIDER_END
1850 void SVTXCurrencyField::setValue( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1852 SolarMutexGuard aGuard
;
1854 FormattedField
* pField
= GetFormattedField();
1856 pField
->SetValue( Value
);
1859 double SVTXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeException
)
1861 SolarMutexGuard aGuard
;
1863 FormattedField
* pField
= GetFormattedField();
1864 return pField
? pField
->GetValue() : 0;
1867 void SVTXCurrencyField::setMin( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1869 SolarMutexGuard aGuard
;
1871 FormattedField
* pField
= GetFormattedField();
1873 pField
->SetMinValue( Value
);
1876 double SVTXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException
)
1878 SolarMutexGuard aGuard
;
1880 FormattedField
* pField
= GetFormattedField();
1881 return pField
? pField
->GetMinValue() : 0;
1884 void SVTXCurrencyField::setMax( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1886 SolarMutexGuard aGuard
;
1888 FormattedField
* pField
= GetFormattedField();
1890 pField
->SetMaxValue( Value
);
1893 double SVTXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException
)
1895 SolarMutexGuard aGuard
;
1897 FormattedField
* pField
= GetFormattedField();
1898 return pField
? pField
->GetMaxValue() : 0;
1901 void SVTXCurrencyField::setFirst( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1903 SolarMutexGuard aGuard
;
1905 FormattedField
* pField
= GetFormattedField();
1907 pField
->SetSpinFirst( Value
);
1910 double SVTXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeException
)
1912 SolarMutexGuard aGuard
;
1914 FormattedField
* pField
= GetFormattedField();
1915 return pField
? pField
->GetSpinFirst() : 0;
1918 void SVTXCurrencyField::setLast( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1920 SolarMutexGuard aGuard
;
1922 FormattedField
* pField
= GetFormattedField();
1924 pField
->SetSpinLast( Value
);
1927 double SVTXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeException
)
1929 SolarMutexGuard aGuard
;
1931 FormattedField
* pField
= GetFormattedField();
1932 return pField
? pField
->GetSpinLast() : 0;
1935 void SVTXCurrencyField::setSpinSize( double Value
) throw(::com::sun::star::uno::RuntimeException
)
1937 SolarMutexGuard aGuard
;
1939 FormattedField
* pField
= GetFormattedField();
1941 pField
->SetSpinSize( Value
);
1944 double SVTXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeException
)
1946 SolarMutexGuard aGuard
;
1948 FormattedField
* pField
= GetFormattedField();
1949 return pField
? pField
->GetSpinSize() : 0;
1952 void SVTXCurrencyField::setDecimalDigits( sal_Int16 Value
) throw(::com::sun::star::uno::RuntimeException
)
1954 SolarMutexGuard aGuard
;
1956 FormattedField
* pField
= GetFormattedField();
1958 pField
->SetDecimalDigits( Value
);
1961 sal_Int16
SVTXCurrencyField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException
)
1963 SolarMutexGuard aGuard
;
1965 FormattedField
* pField
= GetFormattedField();
1966 return pField
? pField
->GetDecimalDigits() : 0;
1969 void SVTXCurrencyField::setStrictFormat( sal_Bool bStrict
) throw(::com::sun::star::uno::RuntimeException
)
1971 SolarMutexGuard aGuard
;
1973 FormattedField
* pField
= GetFormattedField();
1975 pField
->SetStrictFormat( bStrict
);
1978 sal_Bool
SVTXCurrencyField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException
)
1980 SolarMutexGuard aGuard
;
1982 FormattedField
* pField
= GetFormattedField();
1983 return pField
? pField
->IsStrictFormat() : sal_False
;
1986 void SVTXCurrencyField::setProperty( const OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
1988 SolarMutexGuard aGuard
;
1990 DoubleCurrencyField
* pField
= (DoubleCurrencyField
*)GetFormattedField();
1993 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1996 case BASEPROPERTY_CURRENCYSYMBOL
:
2000 pField
->setCurrencySymbol( aStr
);
2003 case BASEPROPERTY_CURSYM_POSITION
:
2007 pField
->setPrependCurrSym(b
);
2012 SVTXFormattedField::setProperty(PropertyName
, Value
);
2016 SVTXFormattedField::setProperty(PropertyName
, Value
);
2019 ::com::sun::star::uno::Any
SVTXCurrencyField::getProperty( const OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
2021 SolarMutexGuard aGuard
;
2023 ::com::sun::star::uno::Any aReturn
;
2025 DoubleCurrencyField
* pField
= (DoubleCurrencyField
*)GetFormattedField();
2028 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2031 case BASEPROPERTY_CURRENCYSYMBOL
:
2033 aReturn
<<= OUString( pField
->getCurrencySymbol() );
2036 case BASEPROPERTY_CURSYM_POSITION
:
2038 aReturn
<<= pField
->getPrependCurrSym();
2042 return SVTXFormattedField::getProperty(PropertyName
);
2045 return SVTXFormattedField::getProperty(PropertyName
);
2048 void SVTXCurrencyField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
2050 PushPropertyIds( rIds
,
2051 BASEPROPERTY_CURRENCYSYMBOL
,
2052 BASEPROPERTY_CURSYM_POSITION
,
2054 SVTXFormattedField::ImplGetPropertyIds( rIds
);
2058 // ----------------------------------------------------
2059 // class VCLXProgressBar
2060 // ----------------------------------------------------
2062 VCLXProgressBar::VCLXProgressBar()
2069 VCLXProgressBar::~VCLXProgressBar()
2073 void VCLXProgressBar::ImplUpdateValue()
2075 ProgressBar
* pProgressBar
= (ProgressBar
*) GetWindow();
2082 // check min and max
2083 if (m_nValueMin
< m_nValueMax
)
2085 nValMin
= m_nValueMin
;
2086 nValMax
= m_nValueMax
;
2090 nValMin
= m_nValueMax
;
2091 nValMax
= m_nValueMin
;
2095 if (m_nValue
< nValMin
)
2099 else if (m_nValue
> nValMax
)
2108 // calculate percent
2110 if (nValMin
!= nValMax
)
2112 nPercent
= 100 * (nVal
- nValMin
) / (nValMax
- nValMin
);
2119 // set progressbar value
2120 pProgressBar
->SetValue( (sal_uInt16
) nPercent
);
2124 // ::com::sun::star::uno::XInterface
2125 ::com::sun::star::uno::Any
VCLXProgressBar::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
2127 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
2128 (static_cast< ::com::sun::star::awt::XProgressBar
* >(this)),
2129 (static_cast< ::com::sun::star::lang::XTypeProvider
* >(this)) );
2130 return (aRet
.hasValue() ? aRet
: VCLXWindow::queryInterface( rType
));
2133 // ::com::sun::star::lang::XTypeProvider
2134 IMPL_XTYPEPROVIDER_START( VCLXProgressBar
)
2135 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XProgressBar
>* ) NULL
),
2136 VCLXWindow::getTypes()
2137 IMPL_XTYPEPROVIDER_END
2139 // ::com::sun::star::awt::XProgressBar
2140 void VCLXProgressBar::setForegroundColor( sal_Int32 nColor
) throw(::com::sun::star::uno::RuntimeException
)
2142 SolarMutexGuard aGuard
;
2144 Window
* pWindow
= GetWindow();
2147 Color
aColor( nColor
);
2148 pWindow
->SetControlForeground( aColor
);
2152 void VCLXProgressBar::setBackgroundColor( sal_Int32 nColor
) throw(::com::sun::star::uno::RuntimeException
)
2154 SolarMutexGuard aGuard
;
2156 Window
* pWindow
= GetWindow();
2159 Color
aColor( nColor
);
2160 pWindow
->SetBackground( aColor
);
2161 pWindow
->SetControlBackground( aColor
);
2162 pWindow
->Invalidate();
2166 void VCLXProgressBar::setValue( sal_Int32 nValue
) throw(::com::sun::star::uno::RuntimeException
)
2168 SolarMutexGuard aGuard
;
2174 void VCLXProgressBar::setRange( sal_Int32 nMin
, sal_Int32 nMax
) throw(::com::sun::star::uno::RuntimeException
)
2176 SolarMutexGuard aGuard
;
2180 // take correct min and max
2186 // change min and max
2194 sal_Int32
VCLXProgressBar::getValue() throw(::com::sun::star::uno::RuntimeException
)
2196 SolarMutexGuard aGuard
;
2201 // ::com::sun::star::awt::VclWindowPeer
2202 void VCLXProgressBar::setProperty( const OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
2204 SolarMutexGuard aGuard
;
2206 ProgressBar
* pProgressBar
= (ProgressBar
*)GetWindow();
2209 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2210 switch ( nPropType
)
2212 case BASEPROPERTY_PROGRESSVALUE
:
2214 if ( Value
>>= m_nValue
)
2218 case BASEPROPERTY_PROGRESSVALUE_MIN
:
2220 if ( Value
>>= m_nValueMin
)
2224 case BASEPROPERTY_PROGRESSVALUE_MAX
:
2226 if ( Value
>>= m_nValueMax
)
2230 case BASEPROPERTY_FILLCOLOR
:
2232 Window
* pWindow
= GetWindow();
2235 sal_Bool bVoid
= Value
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
;
2239 pWindow
->SetControlForeground();
2243 sal_Int32 nColor
= 0;
2244 if ( Value
>>= nColor
)
2246 Color
aColor( nColor
);
2247 pWindow
->SetControlForeground( aColor
);
2254 VCLXWindow::setProperty( PropertyName
, Value
);
2260 ::com::sun::star::uno::Any
VCLXProgressBar::getProperty( const OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
2262 SolarMutexGuard aGuard
;
2264 ::com::sun::star::uno::Any aProp
;
2265 ProgressBar
* pProgressBar
= (ProgressBar
*)GetWindow();
2268 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2269 switch ( nPropType
)
2271 case BASEPROPERTY_PROGRESSVALUE
:
2276 case BASEPROPERTY_PROGRESSVALUE_MIN
:
2278 aProp
<<= m_nValueMin
;
2281 case BASEPROPERTY_PROGRESSVALUE_MAX
:
2283 aProp
<<= m_nValueMax
;
2287 aProp
<<= VCLXWindow::getProperty( PropertyName
);
2294 void VCLXProgressBar::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
2296 PushPropertyIds( rIds
,
2297 BASEPROPERTY_PROGRESSVALUE
,
2298 BASEPROPERTY_PROGRESSVALUE_MIN
,
2299 BASEPROPERTY_PROGRESSVALUE_MAX
,
2300 BASEPROPERTY_FILLCOLOR
,
2302 VCLXWindow::ImplGetPropertyIds( rIds
, true );
2306 // ----------------------------------------------------
2307 // class SVTXDateField
2308 // ----------------------------------------------------
2309 SVTXDateField::SVTXDateField()
2314 SVTXDateField::~SVTXDateField()
2318 void SAL_CALL
SVTXDateField::setProperty( const OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
2320 VCLXDateField::setProperty( PropertyName
, Value
);
2322 // some properties need to be forwarded to the sub edit, too
2323 Edit
* pSubEdit
= GetWindow() ? static_cast< Edit
* >( GetWindow() )->GetSubEdit() : NULL
;
2327 switch ( GetPropertyId( PropertyName
) )
2329 case BASEPROPERTY_TEXTLINECOLOR
:
2330 if ( !Value
.hasValue() )
2331 pSubEdit
->SetTextLineColor();
2334 sal_Int32 nColor
= 0;
2335 if ( Value
>>= nColor
)
2336 pSubEdit
->SetTextLineColor( Color( nColor
) );
2342 void SVTXDateField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
2344 PushPropertyIds( rIds
,
2345 BASEPROPERTY_TEXTLINECOLOR
,
2347 VCLXDateField::ImplGetPropertyIds( rIds
);
2350 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */