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 <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 <cppuhelper/queryinterface.hxx>
33 #include <comphelper/processfactory.hxx>
34 #include <toolkit/helper/convert.hxx>
35 #include <toolkit/helper/property.hxx>
36 #include <svtools/fmtfield.hxx>
37 #include <svl/numuno.hxx>
38 #include <svtools/calendar.hxx>
39 #include <svtools/treelistbox.hxx>
40 #include "treecontrolpeer.hxx"
41 #include "svtxgridcontrol.hxx"
42 #include <table/tablecontrol.hxx>
46 static void lcl_setWinBits( vcl::Window
* _pWindow
, WinBits _nBits
, bool _bSet
)
48 WinBits nStyle
= _pWindow
->GetStyle();
53 _pWindow
->SetStyle( nStyle
);
58 // help function for the toolkit...
63 SAL_DLLPUBLIC_EXPORT
vcl::Window
* CreateWindow( VCLXWindow
** ppNewComp
, const ::com::sun::star::awt::WindowDescriptor
* pDescriptor
, vcl::Window
* pParent
, WinBits nWinBits
)
65 vcl::Window
* pWindow
= NULL
;
66 OUString
aServiceName( pDescriptor
->WindowServiceName
);
67 if ( aServiceName
.equalsIgnoreAsciiCase( "MultiLineEdit" ) )
71 pWindow
= VclPtr
<MultiLineEdit
>::Create( pParent
, nWinBits
|WB_IGNORETAB
);
72 static_cast< MultiLineEdit
* >( pWindow
)->DisableSelectionOnFocus();
73 *ppNewComp
= new VCLXMultiLineEdit
;
81 else if ( aServiceName
.equalsIgnoreAsciiCase( "FileControl" ) )
85 pWindow
= VclPtr
<FileControl
>::Create( pParent
, nWinBits
);
86 *ppNewComp
= new VCLXFileControl
;
94 else if (aServiceName
.equalsIgnoreAsciiCase("FormattedField") )
96 pWindow
= VclPtr
<FormattedField
>::Create( pParent
, nWinBits
);
97 *ppNewComp
= new SVTXFormattedField
;
99 else if (aServiceName
.equalsIgnoreAsciiCase("NumericField") )
101 pWindow
= VclPtr
<DoubleNumericField
>::Create( pParent
, nWinBits
);
102 *ppNewComp
= new SVTXNumericField
;
104 else if (aServiceName
.equalsIgnoreAsciiCase("LongCurrencyField") )
106 pWindow
= VclPtr
<DoubleCurrencyField
>::Create( pParent
, nWinBits
);
107 *ppNewComp
= new SVTXCurrencyField
;
109 else if (aServiceName
.equalsIgnoreAsciiCase("datefield") )
111 pWindow
= VclPtr
<CalendarField
>::Create( pParent
, nWinBits
);
112 static_cast<CalendarField
*>(pWindow
)->EnableToday();
113 static_cast<CalendarField
*>(pWindow
)->EnableNone();
114 static_cast<CalendarField
*>(pWindow
)->EnableEmptyFieldValue( true );
115 SVTXDateField
* newComp
= new SVTXDateField
;
116 *ppNewComp
= newComp
;
117 newComp
->SetFormatter( (FormatterBase
*)static_cast<DateField
*>(pWindow
) );
119 else if (aServiceName
.equalsIgnoreAsciiCase("roadmap") )
121 pWindow
= VclPtr
< ::svt::ORoadmap
>::Create( pParent
, WB_TABSTOP
);
122 *ppNewComp
= new SVTXRoadmap
;
124 else if ( aServiceName
.equalsIgnoreAsciiCase( "ProgressBar" ) )
128 pWindow
= VclPtr
<ProgressBar
>::Create( pParent
, nWinBits
);
129 *ppNewComp
= new VCLXProgressBar
;
137 else if ( aServiceName
.equalsIgnoreAsciiCase( "Tree" ) )
139 TreeControlPeer
* pPeer
= new TreeControlPeer
;
141 pWindow
= pPeer
->createVclControl( pParent
, nWinBits
);
143 else if ( aServiceName
.equalsIgnoreAsciiCase( "FixedHyperlink" ) )
147 pWindow
= VclPtr
<FixedHyperlink
>::Create( pParent
, nWinBits
);
148 *ppNewComp
= new VCLXFixedHyperlink
;
156 else if ( aServiceName
.equalsIgnoreAsciiCase( "Grid" ) )
160 pWindow
= VclPtr
< ::svt::table::TableControl
>::Create(pParent
, nWinBits
);
161 *ppNewComp
= new SVTXGridControl
;
175 // class VCLXMultiLineEdit
177 VCLXMultiLineEdit::VCLXMultiLineEdit()
178 :maTextListeners( *this )
179 ,meLineEndType( LINEEND_LF
) // default behavior before introducing this property: LF (unix-like)
183 VCLXMultiLineEdit::~VCLXMultiLineEdit()
187 ::com::sun::star::uno::Any
VCLXMultiLineEdit::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
189 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
190 (static_cast< ::com::sun::star::awt::XTextComponent
* >(this)),
191 (static_cast< ::com::sun::star::awt::XTextArea
* >(this)),
192 (static_cast< ::com::sun::star::awt::XTextLayoutConstrains
* >(this)),
193 (static_cast< ::com::sun::star::lang::XTypeProvider
* >(this)) );
194 return (aRet
.hasValue() ? aRet
: VCLXWindow::queryInterface( rType
));
197 // ::com::sun::star::lang::XTypeProvider
198 IMPL_XTYPEPROVIDER_START( VCLXMultiLineEdit
)
199 cppu::UnoType
<com::sun::star::awt::XTextComponent
>::get(),
200 cppu::UnoType
<com::sun::star::awt::XTextArea
>::get(),
201 cppu::UnoType
<com::sun::star::awt::XTextLayoutConstrains
>::get(),
202 VCLXWindow::getTypes()
203 IMPL_XTYPEPROVIDER_END
205 void VCLXMultiLineEdit::addTextListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextListener
> & l
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
207 maTextListeners
.addInterface( l
);
210 void VCLXMultiLineEdit::removeTextListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextListener
> & l
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
212 maTextListeners
.removeInterface( l
);
215 void VCLXMultiLineEdit::setText( const OUString
& aText
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
217 SolarMutexGuard aGuard
;
219 VclPtr
< MultiLineEdit
> pEdit
= GetAs
< MultiLineEdit
>();
222 pEdit
->SetText( aText
);
224 // #107218# Call same listeners like VCL would do after user interaction
225 SetSynthesizingVCLEvent( true );
226 pEdit
->SetModifyFlag();
228 SetSynthesizingVCLEvent( false );
232 void VCLXMultiLineEdit::insertText( const ::com::sun::star::awt::Selection
& rSel
, const OUString
& aText
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
234 SolarMutexGuard aGuard
;
236 VclPtr
< MultiLineEdit
> pEdit
= GetAs
< MultiLineEdit
>();
239 setSelection( rSel
);
240 pEdit
->ReplaceSelected( aText
);
244 OUString
VCLXMultiLineEdit::getText() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
246 SolarMutexGuard aGuard
;
249 VclPtr
< MultiLineEdit
> pEdit
= GetAs
< MultiLineEdit
>();
251 aText
= pEdit
->GetText( meLineEndType
);
255 OUString
VCLXMultiLineEdit::getSelectedText() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
257 SolarMutexGuard aGuard
;
260 VclPtr
< MultiLineEdit
> pMultiLineEdit
= GetAs
< MultiLineEdit
>();
262 aText
= pMultiLineEdit
->GetSelected( meLineEndType
);
267 void VCLXMultiLineEdit::setSelection( const ::com::sun::star::awt::Selection
& aSelection
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
269 SolarMutexGuard aGuard
;
271 VclPtr
< MultiLineEdit
> pMultiLineEdit
= GetAs
< MultiLineEdit
>();
272 if ( pMultiLineEdit
)
274 pMultiLineEdit
->SetSelection( Selection( aSelection
.Min
, aSelection
.Max
) );
278 ::com::sun::star::awt::Selection
VCLXMultiLineEdit::getSelection() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
280 SolarMutexGuard aGuard
;
282 ::com::sun::star::awt::Selection aSel
;
283 VclPtr
< MultiLineEdit
> pMultiLineEdit
= GetAs
< MultiLineEdit
>();
284 if ( pMultiLineEdit
)
286 aSel
.Min
= pMultiLineEdit
->GetSelection().Min();
287 aSel
.Max
= pMultiLineEdit
->GetSelection().Max();
292 sal_Bool
VCLXMultiLineEdit::isEditable() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
294 SolarMutexGuard aGuard
;
296 VclPtr
< MultiLineEdit
> pMultiLineEdit
= GetAs
< MultiLineEdit
>();
297 return ( pMultiLineEdit
&& !pMultiLineEdit
->IsReadOnly() && pMultiLineEdit
->IsEnabled() ) ? sal_True
: sal_False
;
300 void VCLXMultiLineEdit::setEditable( sal_Bool bEditable
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
302 SolarMutexGuard aGuard
;
304 VclPtr
< MultiLineEdit
> pMultiLineEdit
= GetAs
< MultiLineEdit
>();
305 if ( pMultiLineEdit
)
306 pMultiLineEdit
->SetReadOnly( !bEditable
);
309 void VCLXMultiLineEdit::setMaxTextLen( sal_Int16 nLen
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
311 SolarMutexGuard aGuard
;
313 VclPtr
< MultiLineEdit
> pMultiLineEdit
= GetAs
< MultiLineEdit
>();
314 if ( pMultiLineEdit
)
315 pMultiLineEdit
->SetMaxTextLen( nLen
);
318 sal_Int16
VCLXMultiLineEdit::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
320 SolarMutexGuard aGuard
;
322 VclPtr
< MultiLineEdit
> pMultiLineEdit
= GetAs
< MultiLineEdit
>();
323 return pMultiLineEdit
? (sal_Int16
)pMultiLineEdit
->GetMaxTextLen() : (sal_Int16
)0;
326 OUString
VCLXMultiLineEdit::getTextLines() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
328 SolarMutexGuard aGuard
;
331 VclPtr
< MultiLineEdit
> pEdit
= GetAs
< MultiLineEdit
>();
333 aText
= pEdit
->GetTextLines( meLineEndType
);
337 ::com::sun::star::awt::Size
VCLXMultiLineEdit::getMinimumSize() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
339 SolarMutexGuard aGuard
;
341 ::com::sun::star::awt::Size aSz
;
342 VclPtr
< MultiLineEdit
> pEdit
= GetAs
< MultiLineEdit
>();
344 aSz
= AWTSize(pEdit
->CalcMinimumSize());
348 ::com::sun::star::awt::Size
VCLXMultiLineEdit::getPreferredSize() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
350 return getMinimumSize();
353 ::com::sun::star::awt::Size
VCLXMultiLineEdit::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
355 SolarMutexGuard aGuard
;
357 ::com::sun::star::awt::Size aSz
= rNewSize
;
358 VclPtr
< MultiLineEdit
> pEdit
= GetAs
< MultiLineEdit
>();
360 aSz
= AWTSize(pEdit
->CalcAdjustedSize( VCLSize(rNewSize
)));
364 ::com::sun::star::awt::Size
VCLXMultiLineEdit::getMinimumSize( sal_Int16 nCols
, sal_Int16 nLines
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
366 SolarMutexGuard aGuard
;
368 ::com::sun::star::awt::Size aSz
;
369 VclPtr
< MultiLineEdit
> pEdit
= GetAs
< MultiLineEdit
>();
371 aSz
= AWTSize(pEdit
->CalcBlockSize( nCols
, nLines
));
375 void VCLXMultiLineEdit::getColumnsAndLines( sal_Int16
& nCols
, sal_Int16
& nLines
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
377 SolarMutexGuard aGuard
;
380 VclPtr
< MultiLineEdit
> pEdit
= GetAs
< MultiLineEdit
>();
384 pEdit
->GetMaxVisColumnsAndLines( nC
, nL
);
390 void VCLXMultiLineEdit::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
392 switch ( rVclWindowEvent
.GetId() )
394 case VCLEVENT_EDIT_MODIFY
:
396 if ( maTextListeners
.getLength() )
398 ::com::sun::star::awt::TextEvent aEvent
;
399 aEvent
.Source
= (::cppu::OWeakObject
*)this;
400 maTextListeners
.textChanged( aEvent
);
406 VCLXWindow::ProcessWindowEvent( rVclWindowEvent
);
412 void VCLXMultiLineEdit::setProperty( const OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
414 SolarMutexGuard aGuard
;
416 VclPtr
< MultiLineEdit
> pMultiLineEdit
= GetAs
< MultiLineEdit
>();
417 if ( pMultiLineEdit
)
419 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
422 case BASEPROPERTY_LINE_END_FORMAT
:
424 sal_Int16 nLineEndType
= ::com::sun::star::awt::LineEndFormat::LINE_FEED
;
425 OSL_VERIFY( Value
>>= nLineEndType
);
426 switch ( nLineEndType
)
428 case ::com::sun::star::awt::LineEndFormat::CARRIAGE_RETURN
: meLineEndType
= LINEEND_CR
; break;
429 case ::com::sun::star::awt::LineEndFormat::LINE_FEED
: meLineEndType
= LINEEND_LF
; break;
430 case ::com::sun::star::awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED
: meLineEndType
= LINEEND_CRLF
; break;
431 default: OSL_FAIL( "VCLXMultiLineEdit::setProperty: invalid line end value!" ); break;
436 case BASEPROPERTY_READONLY
:
440 pMultiLineEdit
->SetReadOnly( b
);
443 case BASEPROPERTY_MAXTEXTLEN
:
445 sal_Int16 n
= sal_Int16();
447 pMultiLineEdit
->SetMaxTextLen( n
);
450 case BASEPROPERTY_HIDEINACTIVESELECTION
:
455 pMultiLineEdit
->EnableFocusSelectionHide( b
);
456 lcl_setWinBits( pMultiLineEdit
, WB_NOHIDESELECTION
, !b
);
462 VCLXWindow::setProperty( PropertyName
, Value
);
468 ::com::sun::star::uno::Any
VCLXMultiLineEdit::getProperty( const OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
470 SolarMutexGuard aGuard
;
472 ::com::sun::star::uno::Any aProp
;
473 VclPtr
< MultiLineEdit
> pMultiLineEdit
= GetAs
< MultiLineEdit
>();
474 if ( pMultiLineEdit
)
476 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
479 case BASEPROPERTY_LINE_END_FORMAT
:
481 sal_Int16 nLineEndType
= ::com::sun::star::awt::LineEndFormat::LINE_FEED
;
482 switch ( meLineEndType
)
484 case LINEEND_CR
: nLineEndType
= ::com::sun::star::awt::LineEndFormat::CARRIAGE_RETURN
; break;
485 case LINEEND_LF
: nLineEndType
= ::com::sun::star::awt::LineEndFormat::LINE_FEED
; break;
486 case LINEEND_CRLF
: nLineEndType
= ::com::sun::star::awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED
; break;
487 default: OSL_FAIL( "VCLXMultiLineEdit::getProperty: invalid line end value!" ); break;
489 aProp
<<= nLineEndType
;
493 case BASEPROPERTY_READONLY
:
495 aProp
<<= pMultiLineEdit
->IsReadOnly();
498 case BASEPROPERTY_MAXTEXTLEN
:
500 aProp
<<= (sal_Int16
) pMultiLineEdit
->GetMaxTextLen();
505 aProp
<<= VCLXWindow::getProperty( PropertyName
);
512 void SAL_CALL
VCLXMultiLineEdit::setFocus( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
514 SolarMutexGuard aGuard
;
516 // don't grab the focus if we already have it. Reason is that the only thing which the edit
517 // does is forwarding the focus to it's text window. This text window then does a "select all".
518 // So if the text window already has the focus, and we give the focus to the multi line
519 // edit, then all which happens is that everything is selected.
521 if ( GetWindow() && !GetWindow()->HasChildPathFocus() )
522 GetWindow()->GrabFocus();
525 void VCLXMultiLineEdit::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
527 PushPropertyIds( rIds
,
528 // FIXME: elide duplication ?
529 BASEPROPERTY_LINE_END_FORMAT
,
530 BASEPROPERTY_READONLY
,
531 BASEPROPERTY_MAXTEXTLEN
,
532 BASEPROPERTY_HIDEINACTIVESELECTION
,
534 VCLXWindow::ImplGetPropertyIds( rIds
, true );
538 // class VCLXFileControl
540 VCLXFileControl::VCLXFileControl() : maTextListeners( *this )
544 VCLXFileControl::~VCLXFileControl()
546 VclPtr
< FileControl
> pControl
= GetAs
< FileControl
>();
548 pControl
->GetEdit().SetModifyHdl( Link
<>() );
551 ::com::sun::star::uno::Any
VCLXFileControl::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
553 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
554 (static_cast< ::com::sun::star::awt::XTextComponent
* >(this)),
555 (static_cast< ::com::sun::star::awt::XTextLayoutConstrains
* >(this)),
556 (static_cast< ::com::sun::star::lang::XTypeProvider
* >(this)) );
557 return (aRet
.hasValue() ? aRet
: VCLXWindow::queryInterface( rType
));
560 // ::com::sun::star::lang::XTypeProvider
561 IMPL_XTYPEPROVIDER_START( VCLXFileControl
)
562 cppu::UnoType
<com::sun::star::awt::XTextComponent
>::get(),
563 cppu::UnoType
<com::sun::star::awt::XTextLayoutConstrains
>::get(),
564 VCLXWindow::getTypes()
565 IMPL_XTYPEPROVIDER_END
567 void SAL_CALL
VCLXFileControl::setProperty( const OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
569 SolarMutexGuard aGuard
;
571 VclPtr
< FileControl
> pControl
= GetAs
< FileControl
>();
574 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
577 case BASEPROPERTY_HIDEINACTIVESELECTION
:
580 OSL_VERIFY( Value
>>= bValue
);
582 lcl_setWinBits( pControl
, WB_NOHIDESELECTION
, !bValue
);
583 lcl_setWinBits( &pControl
->GetEdit(), WB_NOHIDESELECTION
, !bValue
);
588 VCLXWindow::setProperty( PropertyName
, Value
);
594 void VCLXFileControl::SetWindow( const VclPtr
< vcl::Window
> &pWindow
)
596 VclPtr
< FileControl
> pPrevFileControl
= GetAsDynamic
< FileControl
>();
597 if ( pPrevFileControl
)
598 pPrevFileControl
->SetEditModifyHdl( Link
<>() );
600 FileControl
* pNewFileControl
= dynamic_cast<FileControl
*>( pWindow
.get() );
601 if ( pNewFileControl
)
602 pNewFileControl
->SetEditModifyHdl( LINK( this, VCLXFileControl
, ModifyHdl
) );
604 VCLXWindow::SetWindow( pWindow
);
607 void VCLXFileControl::addTextListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextListener
> & l
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
609 maTextListeners
.addInterface( l
);
612 void VCLXFileControl::removeTextListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextListener
> & l
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
614 maTextListeners
.removeInterface( l
);
617 void VCLXFileControl::setText( const OUString
& aText
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
619 SolarMutexGuard aGuard
;
621 vcl::Window
* pWindow
= GetWindow();
624 pWindow
->SetText( aText
);
626 // also in Java a textChanged is triggered, not in VCL.
627 // ::com::sun::star::awt::Toolkit should be JAVA-compliant...
632 void VCLXFileControl::insertText( const ::com::sun::star::awt::Selection
& rSel
, const OUString
& aText
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
634 SolarMutexGuard aGuard
;
636 VclPtr
< FileControl
> pFileControl
= GetAs
< FileControl
>();
639 pFileControl
->GetEdit().SetSelection( Selection( rSel
.Min
, rSel
.Max
) );
640 pFileControl
->GetEdit().ReplaceSelected( aText
);
644 OUString
VCLXFileControl::getText() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
646 SolarMutexGuard aGuard
;
649 vcl::Window
* pWindow
= GetWindow();
651 aText
= pWindow
->GetText();
655 OUString
VCLXFileControl::getSelectedText() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
657 SolarMutexGuard aGuard
;
660 VclPtr
< FileControl
> pFileControl
= GetAs
< FileControl
>();
662 aText
= pFileControl
->GetEdit().GetSelected();
667 void VCLXFileControl::setSelection( const ::com::sun::star::awt::Selection
& aSelection
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
669 SolarMutexGuard aGuard
;
671 VclPtr
< FileControl
> pFileControl
= GetAs
< FileControl
>();
673 pFileControl
->GetEdit().SetSelection( Selection( aSelection
.Min
, aSelection
.Max
) );
676 ::com::sun::star::awt::Selection
VCLXFileControl::getSelection() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
678 SolarMutexGuard aGuard
;
680 ::com::sun::star::awt::Selection aSel
;
681 VclPtr
< FileControl
> pFileControl
= GetAs
< FileControl
>();
684 aSel
.Min
= pFileControl
->GetEdit().GetSelection().Min();
685 aSel
.Max
= pFileControl
->GetEdit().GetSelection().Max();
690 sal_Bool
VCLXFileControl::isEditable() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
692 SolarMutexGuard aGuard
;
694 VclPtr
< FileControl
> pFileControl
= GetAs
< FileControl
>();
695 return ( pFileControl
&& !pFileControl
->GetEdit().IsReadOnly() && pFileControl
->GetEdit().IsEnabled() ) ? sal_True
: sal_False
;
698 void VCLXFileControl::setEditable( sal_Bool bEditable
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
700 SolarMutexGuard aGuard
;
702 VclPtr
< FileControl
> pFileControl
= GetAs
< FileControl
>();
704 pFileControl
->GetEdit().SetReadOnly( !bEditable
);
707 void VCLXFileControl::setMaxTextLen( sal_Int16 nLen
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
709 SolarMutexGuard aGuard
;
711 VclPtr
< FileControl
> pFileControl
= GetAs
< FileControl
>();
713 pFileControl
->GetEdit().SetMaxTextLen( nLen
);
716 sal_Int16
VCLXFileControl::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
718 SolarMutexGuard aGuard
;
720 VclPtr
< FileControl
> pFileControl
= GetAs
< FileControl
>();
721 return pFileControl
? pFileControl
->GetEdit().GetMaxTextLen() : 0;
725 IMPL_LINK_NOARG(VCLXFileControl
, ModifyHdl
)
727 ::com::sun::star::awt::TextEvent aEvent
;
728 aEvent
.Source
= (::cppu::OWeakObject
*)this;
729 maTextListeners
.textChanged( aEvent
);
734 ::com::sun::star::awt::Size
VCLXFileControl::getMinimumSize() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
736 SolarMutexGuard aGuard
;
738 ::com::sun::star::awt::Size aSz
;
739 VclPtr
< FileControl
> pControl
= GetAs
< FileControl
>();
742 Size aTmpSize
= pControl
->GetEdit().CalcMinimumSize();
743 aTmpSize
.Width() += pControl
->GetButton().CalcMinimumSize().Width();
744 aSz
= AWTSize(pControl
->CalcWindowSize( aTmpSize
));
749 ::com::sun::star::awt::Size
VCLXFileControl::getPreferredSize() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
751 ::com::sun::star::awt::Size aSz
= getMinimumSize();
756 ::com::sun::star::awt::Size
VCLXFileControl::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
758 SolarMutexGuard aGuard
;
760 ::com::sun::star::awt::Size aSz
=rNewSize
;
761 VclPtr
< FileControl
> pControl
= GetAs
< FileControl
>();
764 ::com::sun::star::awt::Size aMinSz
= getMinimumSize();
765 if ( aSz
.Height
!= aMinSz
.Height
)
766 aSz
.Height
= aMinSz
.Height
;
771 ::com::sun::star::awt::Size
VCLXFileControl::getMinimumSize( sal_Int16 nCols
, sal_Int16
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
773 SolarMutexGuard aGuard
;
775 ::com::sun::star::awt::Size aSz
;
776 VclPtr
< FileControl
> pControl
= GetAs
< FileControl
>();
779 aSz
= AWTSize(pControl
->GetEdit().CalcSize( nCols
));
780 aSz
.Width
+= pControl
->GetButton().CalcMinimumSize().Width();
785 void VCLXFileControl::getColumnsAndLines( sal_Int16
& nCols
, sal_Int16
& nLines
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
787 SolarMutexGuard aGuard
;
791 VclPtr
< FileControl
> pControl
= GetAs
< FileControl
>();
793 nCols
= pControl
->GetEdit().GetMaxVisChars();
796 void VCLXFileControl::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
798 PushPropertyIds( rIds
,
799 // FIXME: elide duplication ?
800 BASEPROPERTY_HIDEINACTIVESELECTION
,
802 VCLXWindow::ImplGetPropertyIds( rIds
, true );
807 // class SVTXFormattedField
810 SVTXFormattedField::SVTXFormattedField()
811 :m_pCurrentSupplier(NULL
)
812 ,bIsStandardSupplier(true)
813 ,nKeyToSetDelayed(-1)
818 SVTXFormattedField::~SVTXFormattedField()
820 if (m_pCurrentSupplier
)
822 m_pCurrentSupplier
->release();
823 m_pCurrentSupplier
= NULL
;
828 void SVTXFormattedField::SetWindow( const VclPtr
< vcl::Window
> &_pWindow
)
830 VCLXSpinField::SetWindow(_pWindow
);
831 if (GetAs
< FormattedField
>())
832 GetAs
< FormattedField
>()->SetAutoColor(true);
836 void SVTXFormattedField::setProperty( const OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
838 SolarMutexGuard aGuard
;
840 FormattedField
* pField
= GetAs
< FormattedField
>();
843 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
846 case BASEPROPERTY_ENFORCE_FORMAT
:
848 bool bEnable( true );
849 if ( Value
>>= bEnable
)
850 pField
->EnableNotANumber( !bEnable
);
854 case BASEPROPERTY_EFFECTIVE_MIN
:
855 case BASEPROPERTY_VALUEMIN_DOUBLE
:
859 case BASEPROPERTY_EFFECTIVE_MAX
:
860 case BASEPROPERTY_VALUEMAX_DOUBLE
:
864 case BASEPROPERTY_EFFECTIVE_DEFAULT
:
865 SetDefaultValue(Value
);
868 case BASEPROPERTY_TREATASNUMBER
:
876 case BASEPROPERTY_FORMATSSUPPLIER
:
877 if (!Value
.hasValue())
878 setFormatsSupplier(::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
> (NULL
));
881 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
> xNFS
;
882 if ( Value
>>= xNFS
)
883 setFormatsSupplier(xNFS
);
886 case BASEPROPERTY_FORMATKEY
:
887 if (!Value
.hasValue())
897 case BASEPROPERTY_EFFECTIVE_VALUE
:
898 case BASEPROPERTY_VALUE_DOUBLE
:
900 const ::com::sun::star::uno::TypeClass rTC
= Value
.getValueType().getTypeClass();
901 if (rTC
!= ::com::sun::star::uno::TypeClass_STRING
)
903 if (rTC
!= ::com::sun::star::uno::TypeClass_DOUBLE
)
905 if (Value
.hasValue())
907 // try if it is something converitble
908 sal_Int32 nValue
= 0;
909 if (!(Value
>>= nValue
))
910 throw ::com::sun::star::lang::IllegalArgumentException();
911 SetValue(::com::sun::star::uno::makeAny((double)nValue
));
918 case BASEPROPERTY_VALUESTEP_DOUBLE
:
922 pField
->SetSpinSize( d
);
927 pField
->SetSpinSize( n
);
931 case BASEPROPERTY_DECIMALACCURACY
:
935 pField
->SetDecimalDigits( (sal_uInt16
)n
);
938 case BASEPROPERTY_NUMSHOWTHOUSANDSEP
:
942 pField
->SetThousandsSep( b
);
947 VCLXSpinField::setProperty( PropertyName
, Value
);
950 if (BASEPROPERTY_TEXTCOLOR
== nPropType
)
951 { // after setting a new text color, think again about the AutoColor flag of the control
952 // 17.05.2001 - 86859 - frank.schoenheit@germany.sun.com
953 pField
->SetAutoColor(!Value
.hasValue());
957 VCLXSpinField::setProperty( PropertyName
, Value
);
961 ::com::sun::star::uno::Any
SVTXFormattedField::getProperty( const OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
963 SolarMutexGuard aGuard
;
965 ::com::sun::star::uno::Any aReturn
;
967 FormattedField
* pField
= GetAs
< FormattedField
>();
970 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
973 case BASEPROPERTY_EFFECTIVE_MIN
:
974 case BASEPROPERTY_VALUEMIN_DOUBLE
:
975 aReturn
<<= GetMinValue();
978 case BASEPROPERTY_EFFECTIVE_MAX
:
979 case BASEPROPERTY_VALUEMAX_DOUBLE
:
980 aReturn
<<= GetMaxValue();
983 case BASEPROPERTY_EFFECTIVE_DEFAULT
:
984 aReturn
<<= GetDefaultValue();
987 case BASEPROPERTY_TREATASNUMBER
:
988 aReturn
<<= GetTreatAsNumber();
991 case BASEPROPERTY_EFFECTIVE_VALUE
:
992 case BASEPROPERTY_VALUE_DOUBLE
:
993 aReturn
<<= GetValue();
996 case BASEPROPERTY_VALUESTEP_DOUBLE
:
997 aReturn
<<= pField
->GetSpinSize();
1000 case BASEPROPERTY_DECIMALACCURACY
:
1001 aReturn
<<= pField
->GetDecimalDigits();
1004 case BASEPROPERTY_FORMATSSUPPLIER
:
1006 if (!bIsStandardSupplier
)
1008 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
> xSupplier
= getFormatsSupplier();
1009 aReturn
<<= xSupplier
;
1014 case BASEPROPERTY_FORMATKEY
:
1016 if (!bIsStandardSupplier
)
1017 aReturn
<<= getFormatKey();
1022 aReturn
<<= VCLXSpinField::getProperty(PropertyName
);
1028 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
> SVTXFormattedField::getFormatsSupplier() const
1030 return ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
> (m_pCurrentSupplier
);
1033 ::com::sun::star::uno::Any
SVTXFormattedField::convertEffectiveValue(const ::com::sun::star::uno::Any
& rValue
)
1035 ::com::sun::star::uno::Any aReturn
;
1037 FormattedField
* pField
= GetAs
< FormattedField
>();
1041 switch (rValue
.getValueType().getTypeClass())
1043 case ::com::sun::star::uno::TypeClass_DOUBLE
:
1044 if (pField
->TreatingAsNumber())
1052 SvNumberFormatter
* pFormatter
= pField
->GetFormatter();
1054 pFormatter
= pField
->StandardFormatter();
1055 // should never fail
1060 OUString sConverted
;
1061 pFormatter
->GetOutputString(d
, 0, sConverted
, &pDum
);
1062 aReturn
<<= sConverted
;
1065 case ::com::sun::star::uno::TypeClass_STRING
:
1069 if (pField
->TreatingAsNumber())
1071 SvNumberFormatter
* pFormatter
= pField
->GetFormatter();
1073 pFormatter
= pField
->StandardFormatter();
1076 sal_uInt32
nTestFormat(0);
1077 if (!pFormatter
->IsNumberFormat(aStr
, nTestFormat
, dVal
))
1093 void SVTXFormattedField::SetMinValue(const ::com::sun::star::uno::Any
& rValue
)
1095 FormattedField
* pField
= GetAs
< FormattedField
>();
1099 switch (rValue
.getValueType().getTypeClass())
1102 case ::com::sun::star::uno::TypeClass_DOUBLE
:
1106 pField
->SetMinValue(d
);
1110 DBG_ASSERT(rValue
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
, "SVTXFormattedField::SetMinValue : invalid argument (an exception will be thrown) !");
1111 if ( rValue
.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID
)
1114 throw ::com::sun::star::lang::IllegalArgumentException();
1116 pField
->ClearMinValue();
1122 ::com::sun::star::uno::Any
SVTXFormattedField::GetMinValue()
1124 FormattedField
* pField
= GetAs
< FormattedField
>();
1125 if (!pField
|| !pField
->HasMinValue())
1126 return ::com::sun::star::uno::Any();
1128 ::com::sun::star::uno::Any aReturn
;
1129 aReturn
<<= pField
->GetMinValue();
1134 void SVTXFormattedField::SetMaxValue(const ::com::sun::star::uno::Any
& rValue
)
1136 FormattedField
* pField
= GetAs
< FormattedField
>();
1140 switch (rValue
.getValueType().getTypeClass())
1143 case ::com::sun::star::uno::TypeClass_DOUBLE
:
1147 pField
->SetMaxValue(d
);
1151 if (rValue
.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID
)
1154 throw ::com::sun::star::lang::IllegalArgumentException();
1156 pField
->ClearMaxValue();
1162 ::com::sun::star::uno::Any
SVTXFormattedField::GetMaxValue()
1164 FormattedField
* pField
= GetAs
< FormattedField
>();
1165 if (!pField
|| !pField
->HasMaxValue())
1166 return ::com::sun::star::uno::Any();
1168 ::com::sun::star::uno::Any aReturn
;
1169 aReturn
<<= pField
->GetMaxValue();
1174 void SVTXFormattedField::SetDefaultValue(const ::com::sun::star::uno::Any
& rValue
)
1176 FormattedField
* pField
= GetAs
< FormattedField
>();
1180 ::com::sun::star::uno::Any aConverted
= convertEffectiveValue(rValue
);
1182 switch (aConverted
.getValueType().getTypeClass())
1185 case ::com::sun::star::uno::TypeClass_DOUBLE
:
1189 pField
->SetDefaultValue(d
);
1192 case ::com::sun::star::uno::TypeClass_STRING
:
1195 aConverted
>>= aStr
;
1196 pField
->SetDefaultText( aStr
);
1200 pField
->EnableEmptyField(true);
1201 // nur noch void erlaubt
1207 ::com::sun::star::uno::Any
SVTXFormattedField::GetDefaultValue()
1209 FormattedField
* pField
= GetAs
< FormattedField
>();
1210 if (!pField
|| pField
->IsEmptyFieldEnabled())
1211 return ::com::sun::star::uno::Any();
1213 ::com::sun::star::uno::Any aReturn
;
1214 if (pField
->TreatingAsNumber())
1215 aReturn
<<= pField
->GetDefaultValue();
1217 aReturn
<<= OUString( pField
->GetDefaultText() );
1222 bool SVTXFormattedField::GetTreatAsNumber()
1224 FormattedField
* pField
= GetAs
< FormattedField
>();
1226 return pField
->TreatingAsNumber();
1232 void SVTXFormattedField::SetTreatAsNumber(bool bSet
)
1234 FormattedField
* pField
= GetAs
< FormattedField
>();
1236 pField
->TreatAsNumber(bSet
);
1240 ::com::sun::star::uno::Any
SVTXFormattedField::GetValue()
1242 FormattedField
* pField
= GetAs
< FormattedField
>();
1244 return ::com::sun::star::uno::Any();
1246 ::com::sun::star::uno::Any aReturn
;
1247 if (!pField
->TreatingAsNumber())
1249 OUString sText
= pField
->GetTextValue();
1254 if (!pField
->GetText().isEmpty()) // empty is returned as void by default
1255 aReturn
<<= pField
->GetValue();
1262 void SVTXFormattedField::SetValue(const ::com::sun::star::uno::Any
& rValue
)
1264 FormattedField
* pField
= GetAs
< FormattedField
>();
1268 if (!rValue
.hasValue())
1270 pField
->SetText("");
1274 if (rValue
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_DOUBLE
)
1278 pField
->SetValue(d
);
1282 DBG_ASSERT(rValue
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_STRING
, "SVTXFormattedField::SetValue : invalid argument !");
1286 if (!pField
->TreatingAsNumber())
1287 pField
->SetTextFormatted(sText
);
1289 pField
->SetTextValue(sText
);
1292 // NotifyTextListeners();
1298 void SVTXFormattedField::setFormatsSupplier(const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
> & xSupplier
)
1300 FormattedField
* pField
= GetAs
< FormattedField
>();
1302 SvNumberFormatsSupplierObj
* pNew
= NULL
;
1303 if (!xSupplier
.is())
1307 pNew
= new SvNumberFormatsSupplierObj(pField
->StandardFormatter());
1308 bIsStandardSupplier
= true;
1313 pNew
= SvNumberFormatsSupplierObj::getImplementation(xSupplier
);
1314 bIsStandardSupplier
= false;
1318 return; // TODO : how to process ?
1320 if (m_pCurrentSupplier
)
1321 m_pCurrentSupplier
->release();
1322 m_pCurrentSupplier
= pNew
;
1323 m_pCurrentSupplier
->acquire();
1326 // save the actual value
1327 ::com::sun::star::uno::Any aCurrent
= GetValue();
1328 pField
->SetFormatter(m_pCurrentSupplier
->GetNumberFormatter(), false);
1329 if (nKeyToSetDelayed
!= -1)
1331 pField
->SetFormatKey(nKeyToSetDelayed
);
1332 nKeyToSetDelayed
= -1;
1335 NotifyTextListeners();
1340 sal_Int32
SVTXFormattedField::getFormatKey() const
1342 FormattedField
* pField
= GetAs
< FormattedField
>();
1343 return pField
? pField
->GetFormatKey() : 0;
1347 void SVTXFormattedField::setFormatKey(sal_Int32 nKey
)
1349 FormattedField
* pField
= GetAs
< FormattedField
>();
1352 if (pField
->GetFormatter())
1353 pField
->SetFormatKey(nKey
);
1356 // probably I am in a block, in which first the key and next the formatter will be set,
1357 // initially this happens quite certain, as the properties are set in alphabettic sequence,
1358 // and the FormatsSupplier is processed before the FormatKey
1359 nKeyToSetDelayed
= nKey
;
1361 NotifyTextListeners();
1366 void SVTXFormattedField::NotifyTextListeners()
1368 if ( GetTextListeners().getLength() )
1370 ::com::sun::star::awt::TextEvent aEvent
;
1371 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1372 GetTextListeners().textChanged( aEvent
);
1376 void SVTXFormattedField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
1378 PushPropertyIds( rIds
,
1379 // FIXME: elide duplication ?
1380 BASEPROPERTY_EFFECTIVE_MIN
,
1381 BASEPROPERTY_VALUEMIN_DOUBLE
,
1382 BASEPROPERTY_EFFECTIVE_MAX
,
1383 BASEPROPERTY_VALUEMAX_DOUBLE
,
1384 BASEPROPERTY_EFFECTIVE_DEFAULT
,
1385 BASEPROPERTY_TREATASNUMBER
,
1386 BASEPROPERTY_EFFECTIVE_VALUE
,
1387 BASEPROPERTY_VALUE_DOUBLE
,
1388 BASEPROPERTY_VALUESTEP_DOUBLE
,
1389 BASEPROPERTY_DECIMALACCURACY
,
1390 BASEPROPERTY_FORMATSSUPPLIER
,
1391 BASEPROPERTY_NUMSHOWTHOUSANDSEP
,
1392 BASEPROPERTY_FORMATKEY
,
1393 BASEPROPERTY_TREATASNUMBER
,
1394 BASEPROPERTY_ENFORCE_FORMAT
,
1396 VCLXWindow::ImplGetPropertyIds( rIds
, true );
1397 VCLXSpinField::ImplGetPropertyIds( rIds
);
1402 // class SVTXRoadmap
1404 using namespace svt
;
1406 SVTXRoadmap::SVTXRoadmap() : maItemListeners( *this )
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
= GetAs
< svt::ORoadmap
>();
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
, std::exception
)
1442 SolarMutexGuard aGuard
;
1443 ::svt::ORoadmap
* pField
= GetAs
< svt::ORoadmap
>();
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 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
, std::exception
)
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
, std::exception
)
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
= 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
, std::exception
)
1516 SolarMutexGuard aGuard
;
1517 ::svt::ORoadmap
* pField
= GetAs
< svt::ORoadmap
>();
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
, std::exception
)
1529 SolarMutexGuard aGuard
;
1530 ::svt::ORoadmap
* pField
= GetAs
< svt::ORoadmap
>();
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
, std::exception
)
1541 SolarMutexGuard aGuard
;
1542 ::svt::ORoadmap
* pField
= GetAs
< svt::ORoadmap
>();
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
);
1555 void SVTXRoadmap::setProperty( const OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1557 SolarMutexGuard aGuard
;
1559 ::svt::ORoadmap
* pField
= GetAs
< svt::ORoadmap
>();
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
);
1610 ::com::sun::star::uno::Any
SVTXRoadmap::getProperty( const OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1612 SolarMutexGuard aGuard
;
1614 ::com::sun::star::uno::Any aReturn
;
1616 ::svt::ORoadmap
* pField
= GetAs
< svt::ORoadmap
>();
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 VclPtr
< ::svt::ORoadmap
> pButton
= GetAs
< ::svt::ORoadmap
>();
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
);
1659 // class SVTXNumericField
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
, std::exception
)
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 cppu::UnoType
<com::sun::star::awt::XNumericField
>::get(),
1680 SVTXFormattedField::getTypes()
1681 IMPL_XTYPEPROVIDER_END
1684 void SVTXNumericField::setValue( double Value
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1686 SolarMutexGuard aGuard
;
1688 FormattedField
* pField
= GetAs
< FormattedField
>();
1690 pField
->SetValue( Value
);
1693 double SVTXNumericField::getValue() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1695 SolarMutexGuard aGuard
;
1697 FormattedField
* pField
= GetAs
< FormattedField
>();
1698 return pField
? pField
->GetValue() : 0;
1701 void SVTXNumericField::setMin( double Value
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1703 SolarMutexGuard aGuard
;
1705 FormattedField
* pField
= GetAs
< FormattedField
>();
1707 pField
->SetMinValue( Value
);
1710 double SVTXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1712 SolarMutexGuard aGuard
;
1714 FormattedField
* pField
= GetAs
< FormattedField
>();
1715 return pField
? pField
->GetMinValue() : 0;
1718 void SVTXNumericField::setMax( double Value
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1720 SolarMutexGuard aGuard
;
1722 FormattedField
* pField
= GetAs
< FormattedField
>();
1724 pField
->SetMaxValue( Value
);
1727 double SVTXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1729 SolarMutexGuard aGuard
;
1731 FormattedField
* pField
= GetAs
< FormattedField
>();
1732 return pField
? pField
->GetMaxValue() : 0;
1735 void SVTXNumericField::setFirst( double Value
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1737 SolarMutexGuard aGuard
;
1739 FormattedField
* pField
= GetAs
< FormattedField
>();
1741 pField
->SetSpinFirst( Value
);
1744 double SVTXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1746 SolarMutexGuard aGuard
;
1748 FormattedField
* pField
= GetAs
< FormattedField
>();
1749 return pField
? pField
->GetSpinFirst() : 0;
1752 void SVTXNumericField::setLast( double Value
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1754 SolarMutexGuard aGuard
;
1756 FormattedField
* pField
= GetAs
< FormattedField
>();
1758 pField
->SetSpinLast( Value
);
1761 double SVTXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1763 SolarMutexGuard aGuard
;
1765 FormattedField
* pField
= GetAs
< FormattedField
>();
1766 return pField
? pField
->GetSpinLast() : 0;
1769 void SVTXNumericField::setSpinSize( double Value
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1771 SolarMutexGuard aGuard
;
1773 FormattedField
* pField
= GetAs
< FormattedField
>();
1775 pField
->SetSpinSize( Value
);
1778 double SVTXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1780 SolarMutexGuard aGuard
;
1782 FormattedField
* pField
= GetAs
< FormattedField
>();
1783 return pField
? pField
->GetSpinSize() : 0;
1786 void SVTXNumericField::setDecimalDigits( sal_Int16 Value
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1788 SolarMutexGuard aGuard
;
1790 FormattedField
* pField
= GetAs
< FormattedField
>();
1792 pField
->SetDecimalDigits( Value
);
1795 sal_Int16
SVTXNumericField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1797 SolarMutexGuard aGuard
;
1799 FormattedField
* pField
= GetAs
< FormattedField
>();
1800 return pField
? pField
->GetDecimalDigits() : 0;
1803 void SVTXNumericField::setStrictFormat( sal_Bool bStrict
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1805 SolarMutexGuard aGuard
;
1807 FormattedField
* pField
= GetAs
< FormattedField
>();
1809 pField
->SetStrictFormat( bStrict
);
1812 sal_Bool
SVTXNumericField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1814 SolarMutexGuard aGuard
;
1816 FormattedField
* pField
= GetAs
< FormattedField
>();
1817 return pField
? pField
->IsStrictFormat() : sal_False
;
1820 void SVTXNumericField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
1822 SVTXFormattedField::ImplGetPropertyIds( rIds
);
1826 // class SVTXCurrencyField
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
, std::exception
)
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 cppu::UnoType
<com::sun::star::awt::XCurrencyField
>::get(),
1847 SVTXFormattedField::getTypes()
1848 IMPL_XTYPEPROVIDER_END
1850 void SVTXCurrencyField::setValue( double Value
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1852 SolarMutexGuard aGuard
;
1854 FormattedField
* pField
= GetAs
< FormattedField
>();
1856 pField
->SetValue( Value
);
1859 double SVTXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1861 SolarMutexGuard aGuard
;
1863 FormattedField
* pField
= GetAs
< FormattedField
>();
1864 return pField
? pField
->GetValue() : 0;
1867 void SVTXCurrencyField::setMin( double Value
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1869 SolarMutexGuard aGuard
;
1871 FormattedField
* pField
= GetAs
< FormattedField
>();
1873 pField
->SetMinValue( Value
);
1876 double SVTXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1878 SolarMutexGuard aGuard
;
1880 FormattedField
* pField
= GetAs
< FormattedField
>();
1881 return pField
? pField
->GetMinValue() : 0;
1884 void SVTXCurrencyField::setMax( double Value
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1886 SolarMutexGuard aGuard
;
1888 FormattedField
* pField
= GetAs
< FormattedField
>();
1890 pField
->SetMaxValue( Value
);
1893 double SVTXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1895 SolarMutexGuard aGuard
;
1897 FormattedField
* pField
= GetAs
< FormattedField
>();
1898 return pField
? pField
->GetMaxValue() : 0;
1901 void SVTXCurrencyField::setFirst( double Value
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1903 SolarMutexGuard aGuard
;
1905 FormattedField
* pField
= GetAs
< FormattedField
>();
1907 pField
->SetSpinFirst( Value
);
1910 double SVTXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1912 SolarMutexGuard aGuard
;
1914 FormattedField
* pField
= GetAs
< FormattedField
>();
1915 return pField
? pField
->GetSpinFirst() : 0;
1918 void SVTXCurrencyField::setLast( double Value
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1920 SolarMutexGuard aGuard
;
1922 FormattedField
* pField
= GetAs
< FormattedField
>();
1924 pField
->SetSpinLast( Value
);
1927 double SVTXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1929 SolarMutexGuard aGuard
;
1931 FormattedField
* pField
= GetAs
< FormattedField
>();
1932 return pField
? pField
->GetSpinLast() : 0;
1935 void SVTXCurrencyField::setSpinSize( double Value
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1937 SolarMutexGuard aGuard
;
1939 FormattedField
* pField
= GetAs
< FormattedField
>();
1941 pField
->SetSpinSize( Value
);
1944 double SVTXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1946 SolarMutexGuard aGuard
;
1948 FormattedField
* pField
= GetAs
< FormattedField
>();
1949 return pField
? pField
->GetSpinSize() : 0;
1952 void SVTXCurrencyField::setDecimalDigits( sal_Int16 Value
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1954 SolarMutexGuard aGuard
;
1956 FormattedField
* pField
= GetAs
< FormattedField
>();
1958 pField
->SetDecimalDigits( Value
);
1961 sal_Int16
SVTXCurrencyField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1963 SolarMutexGuard aGuard
;
1965 FormattedField
* pField
= GetAs
< FormattedField
>();
1966 return pField
? pField
->GetDecimalDigits() : 0;
1969 void SVTXCurrencyField::setStrictFormat( sal_Bool bStrict
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1971 SolarMutexGuard aGuard
;
1973 FormattedField
* pField
= GetAs
< FormattedField
>();
1975 pField
->SetStrictFormat( bStrict
);
1978 sal_Bool
SVTXCurrencyField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1980 SolarMutexGuard aGuard
;
1982 FormattedField
* pField
= GetAs
< FormattedField
>();
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
, std::exception
)
1988 SolarMutexGuard aGuard
;
1990 VclPtr
< DoubleCurrencyField
> pField
= GetAs
< DoubleCurrencyField
>();
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
, std::exception
)
2021 SolarMutexGuard aGuard
;
2023 ::com::sun::star::uno::Any aReturn
;
2025 VclPtr
< DoubleCurrencyField
> pField
= GetAs
< DoubleCurrencyField
>();
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
);
2059 // class VCLXProgressBar
2062 VCLXProgressBar::VCLXProgressBar()
2069 VCLXProgressBar::~VCLXProgressBar()
2073 void VCLXProgressBar::ImplUpdateValue()
2075 VclPtr
< ProgressBar
> pProgressBar
= GetAs
< ProgressBar
>();
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
, std::exception
)
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 cppu::UnoType
<com::sun::star::awt::XProgressBar
>::get(),
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
, std::exception
)
2142 SolarMutexGuard aGuard
;
2144 vcl::Window
* pWindow
= GetWindow();
2147 Color
aColor( nColor
);
2148 pWindow
->SetControlForeground( aColor
);
2152 void VCLXProgressBar::setBackgroundColor( sal_Int32 nColor
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
2154 SolarMutexGuard aGuard
;
2156 vcl::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
, std::exception
)
2168 SolarMutexGuard aGuard
;
2174 void VCLXProgressBar::setRange( sal_Int32 nMin
, sal_Int32 nMax
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
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
, std::exception
)
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
, std::exception
)
2204 SolarMutexGuard aGuard
;
2206 VclPtr
< ProgressBar
> pProgressBar
= GetAs
< ProgressBar
>();
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 vcl::Window
* pWindow
= GetWindow();
2235 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
, std::exception
)
2262 SolarMutexGuard aGuard
;
2264 ::com::sun::star::uno::Any aProp
;
2265 VclPtr
< ProgressBar
> pProgressBar
= GetAs
< ProgressBar
>();
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 );
2307 // class SVTXDateField
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
, std::exception
)
2320 VCLXDateField::setProperty( PropertyName
, Value
);
2322 // some properties need to be forwarded to the sub edit, too
2324 VclPtr
< Edit
> pSubEdit
= GetWindow() ? static_cast< Edit
* >( GetWindow().get() )->GetSubEdit() : NULL
;
2328 switch ( GetPropertyId( PropertyName
) )
2330 case BASEPROPERTY_TEXTLINECOLOR
:
2331 if ( !Value
.hasValue() )
2332 pSubEdit
->SetTextLineColor();
2335 sal_Int32 nColor
= 0;
2336 if ( Value
>>= nColor
)
2337 pSubEdit
->SetTextLineColor( Color( nColor
) );
2343 void SVTXDateField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
2345 PushPropertyIds( rIds
,
2346 BASEPROPERTY_TEXTLINECOLOR
,
2348 VCLXDateField::ImplGetPropertyIds( rIds
);
2351 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */