LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/svtools/source/uno - unoiface.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 341 1211 28.2 %
Date: 2013-07-09 Functions: 47 167 28.1 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : 
      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>
      42             : 
      43             : namespace
      44             : {
      45          13 :     static void lcl_setWinBits( Window* _pWindow, WinBits _nBits, sal_Bool _bSet )
      46             :     {
      47          13 :         WinBits nStyle = _pWindow->GetStyle();
      48          13 :         if ( _bSet )
      49          11 :             nStyle |= _nBits;
      50             :         else
      51           2 :             nStyle &= ~_nBits;
      52          13 :         _pWindow->SetStyle( nStyle );
      53          13 :     }
      54             : }
      55             : 
      56             : //  ----------------------------------------------------
      57             : //  help function for the toolkit...
      58             : //  ----------------------------------------------------
      59             : 
      60             : extern "C" {
      61             : 
      62       10308 : SAL_DLLPUBLIC_EXPORT Window* CreateWindow( VCLXWindow** ppNewComp, const ::com::sun::star::awt::WindowDescriptor* pDescriptor, Window* pParent, WinBits nWinBits )
      63             : {
      64       10308 :     Window* pWindow = NULL;
      65       10308 :     String aServiceName( pDescriptor->WindowServiceName );
      66       10308 :     if ( aServiceName.EqualsIgnoreCaseAscii( "MultiLineEdit" ) )
      67             :     {
      68          11 :         if ( pParent )
      69             :         {
      70          11 :             pWindow = new MultiLineEdit( pParent, nWinBits|WB_IGNORETAB);
      71          11 :             static_cast< MultiLineEdit* >( pWindow )->DisableSelectionOnFocus();
      72          11 :             *ppNewComp = new VCLXMultiLineEdit;
      73             :         }
      74             :         else
      75             :         {
      76           0 :             *ppNewComp = NULL;
      77           0 :             return NULL;
      78             :         }
      79             :     }
      80       10297 :     else if ( aServiceName.EqualsIgnoreCaseAscii( "FileControl" ) )
      81             :     {
      82           0 :         if ( pParent )
      83             :         {
      84           0 :             pWindow = new FileControl( pParent, nWinBits );
      85           0 :             *ppNewComp = new VCLXFileControl;
      86             :         }
      87             :         else
      88             :         {
      89           0 :             *ppNewComp = NULL;
      90           0 :             return NULL;
      91             :         }
      92             :     }
      93       10297 :     else if (aServiceName.EqualsIgnoreCaseAscii("FormattedField") )
      94             :     {
      95           1 :         pWindow = new FormattedField( pParent, nWinBits );
      96           1 :         *ppNewComp = new SVTXFormattedField;
      97             :     }
      98       10296 :     else if (aServiceName.EqualsIgnoreCaseAscii("NumericField") )
      99             :     {
     100          17 :         pWindow = new DoubleNumericField( pParent, nWinBits );
     101          17 :         *ppNewComp = new SVTXNumericField;
     102             :     }
     103       10279 :     else if (aServiceName.EqualsIgnoreCaseAscii("LongCurrencyField") )
     104             :     {
     105          17 :         pWindow = new DoubleCurrencyField( pParent, nWinBits );
     106          17 :         *ppNewComp = new SVTXCurrencyField;
     107             :     }
     108       10262 :     else if (aServiceName.EqualsIgnoreCaseAscii("datefield") )
     109             :     {
     110          27 :         pWindow = new CalendarField( pParent, nWinBits);
     111          27 :         static_cast<CalendarField*>(pWindow)->EnableToday();
     112          27 :         static_cast<CalendarField*>(pWindow)->EnableNone();
     113          27 :         static_cast<CalendarField*>(pWindow)->EnableEmptyFieldValue( sal_True );
     114          27 :         *ppNewComp = new SVTXDateField;
     115          27 :         ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(DateField*)pWindow );
     116             :     }
     117       10235 :     else if (aServiceName.EqualsIgnoreCaseAscii("roadmap") )
     118             :     {
     119           0 :         pWindow = new ::svt::ORoadmap( pParent, WB_TABSTOP );
     120           0 :         *ppNewComp = new SVTXRoadmap;
     121             :     }
     122       10235 :     else if ( aServiceName.EqualsIgnoreCaseAscii( "ProgressBar" ) )
     123             :     {
     124           0 :         if ( pParent )
     125             :         {
     126           0 :             pWindow = new ProgressBar( pParent, nWinBits );
     127           0 :             *ppNewComp = new VCLXProgressBar;
     128             :         }
     129             :         else
     130             :         {
     131           0 :             *ppNewComp = NULL;
     132           0 :             return NULL;
     133             :         }
     134             :     }
     135       10235 :     else if ( aServiceName.EqualsIgnoreCaseAscii( "Tree" ) )
     136             :     {
     137           0 :         TreeControlPeer* pPeer = new TreeControlPeer;
     138           0 :         *ppNewComp = pPeer;
     139           0 :         pWindow = pPeer->createVclControl( pParent, nWinBits );
     140             :     }
     141       10235 :     else if ( aServiceName.EqualsIgnoreCaseAscii( "FixedHyperlink" ) )
     142             :     {
     143           0 :         if ( pParent )
     144             :         {
     145           0 :             pWindow = new FixedHyperlink( pParent, nWinBits );
     146           0 :             *ppNewComp = new VCLXFixedHyperlink;
     147             :         }
     148             :         else
     149             :         {
     150           0 :             *ppNewComp = NULL;
     151           0 :             return NULL;
     152             :         }
     153             :     }
     154       10235 :     else if ( aServiceName.EqualsIgnoreCaseAscii( "Grid" ) )
     155             :     {
     156           1 :         if ( pParent )
     157             :         {
     158           1 :             pWindow = new ::svt::table::TableControl(pParent, nWinBits);
     159           1 :             *ppNewComp = new SVTXGridControl;
     160             :         }
     161             :         else
     162             :         {
     163           0 :             *ppNewComp = NULL;
     164           0 :             return NULL;
     165             :         }
     166             :     }
     167       10308 :     return pWindow;
     168             : }
     169             : 
     170             : }   // extern "C"
     171             : 
     172             : //  ----------------------------------------------------
     173             : //  class VCLXMultiLineEdit
     174             : //  ----------------------------------------------------
     175          11 : VCLXMultiLineEdit::VCLXMultiLineEdit()
     176             :     :maTextListeners( *this )
     177          11 :     ,meLineEndType( LINEEND_LF )    // default behavior before introducing this property: LF (unix-like)
     178             : {
     179          11 : }
     180             : 
     181          22 : VCLXMultiLineEdit::~VCLXMultiLineEdit()
     182             : {
     183          22 : }
     184             : 
     185         502 : ::com::sun::star::uno::Any VCLXMultiLineEdit::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
     186             : {
     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         502 :                                         (static_cast< ::com::sun::star::lang::XTypeProvider* >(this)) );
     192         502 :     return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
     193             : }
     194             : 
     195             : // ::com::sun::star::lang::XTypeProvider
     196           0 : IMPL_XTYPEPROVIDER_START( VCLXMultiLineEdit )
     197           0 :     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent>* ) NULL ),
     198           0 :     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextArea>* ) NULL ),
     199           0 :     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ),
     200             :     VCLXWindow::getTypes()
     201           0 : IMPL_XTYPEPROVIDER_END
     202             : 
     203          11 : void VCLXMultiLineEdit::addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
     204             : {
     205          11 :     maTextListeners.addInterface( l );
     206          11 : }
     207             : 
     208           0 : void VCLXMultiLineEdit::removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
     209             : {
     210           0 :     maTextListeners.removeInterface( l );
     211           0 : }
     212             : 
     213          16 : void VCLXMultiLineEdit::setText( const OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
     214             : {
     215          16 :     SolarMutexGuard aGuard;
     216             : 
     217          16 :     MultiLineEdit* pEdit = (MultiLineEdit*)GetWindow();
     218          16 :     if ( pEdit )
     219             :     {
     220          16 :         pEdit->SetText( aText );
     221             : 
     222             :         // #107218# Call same listeners like VCL would do after user interaction
     223          16 :         SetSynthesizingVCLEvent( sal_True );
     224          16 :         pEdit->SetModifyFlag();
     225          16 :         pEdit->Modify();
     226          16 :         SetSynthesizingVCLEvent( sal_False );
     227          16 :     }
     228          16 : }
     229             : 
     230           0 : void VCLXMultiLineEdit::insertText( const ::com::sun::star::awt::Selection& rSel, const OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
     231             : {
     232           0 :     SolarMutexGuard aGuard;
     233             : 
     234           0 :     MultiLineEdit* pEdit = (MultiLineEdit*)GetWindow();
     235           0 :     if ( pEdit )
     236             :     {
     237           0 :         setSelection( rSel );
     238           0 :         pEdit->ReplaceSelected( aText );
     239           0 :     }
     240           0 : }
     241             : 
     242           0 : OUString VCLXMultiLineEdit::getText() throw(::com::sun::star::uno::RuntimeException)
     243             : {
     244           0 :     SolarMutexGuard aGuard;
     245             : 
     246           0 :     OUString aText;
     247           0 :     MultiLineEdit* pEdit = (MultiLineEdit*)GetWindow();
     248           0 :     if ( pEdit )
     249           0 :         aText = pEdit->GetText( meLineEndType );
     250           0 :     return aText;
     251             : }
     252             : 
     253           0 : OUString VCLXMultiLineEdit::getSelectedText() throw(::com::sun::star::uno::RuntimeException)
     254             : {
     255           0 :     SolarMutexGuard aGuard;
     256             : 
     257           0 :     OUString aText;
     258           0 :     MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
     259           0 :     if ( pMultiLineEdit)
     260           0 :         aText = pMultiLineEdit->GetSelected( meLineEndType );
     261           0 :     return aText;
     262             : 
     263             : }
     264             : 
     265           0 : void VCLXMultiLineEdit::setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException)
     266             : {
     267           0 :     SolarMutexGuard aGuard;
     268             : 
     269           0 :     MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
     270           0 :     if ( pMultiLineEdit )
     271             :     {
     272           0 :         pMultiLineEdit->SetSelection( Selection( aSelection.Min, aSelection.Max ) );
     273           0 :     }
     274           0 : }
     275             : 
     276           0 : ::com::sun::star::awt::Selection VCLXMultiLineEdit::getSelection() throw(::com::sun::star::uno::RuntimeException)
     277             : {
     278           0 :     SolarMutexGuard aGuard;
     279             : 
     280           0 :     ::com::sun::star::awt::Selection aSel;
     281           0 :     MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
     282           0 :     if ( pMultiLineEdit )
     283             :     {
     284           0 :         aSel.Min = pMultiLineEdit->GetSelection().Min();
     285           0 :         aSel.Max = pMultiLineEdit->GetSelection().Max();
     286             :     }
     287           0 :     return aSel;
     288             : }
     289             : 
     290           0 : sal_Bool VCLXMultiLineEdit::isEditable() throw(::com::sun::star::uno::RuntimeException)
     291             : {
     292           0 :     SolarMutexGuard aGuard;
     293             : 
     294           0 :     MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
     295           0 :     return ( pMultiLineEdit && !pMultiLineEdit->IsReadOnly() && pMultiLineEdit->IsEnabled() ) ? sal_True : sal_False;
     296             : }
     297             : 
     298           0 : void VCLXMultiLineEdit::setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException)
     299             : {
     300           0 :     SolarMutexGuard aGuard;
     301             : 
     302           0 :     MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
     303           0 :     if ( pMultiLineEdit )
     304           0 :         pMultiLineEdit->SetReadOnly( !bEditable );
     305           0 : }
     306             : 
     307           0 : void VCLXMultiLineEdit::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException)
     308             : {
     309           0 :     SolarMutexGuard aGuard;
     310             : 
     311           0 :     MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
     312           0 :     if ( pMultiLineEdit )
     313           0 :         pMultiLineEdit->SetMaxTextLen( nLen );
     314           0 : }
     315             : 
     316           0 : sal_Int16 VCLXMultiLineEdit::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException)
     317             : {
     318           0 :     SolarMutexGuard aGuard;
     319             : 
     320           0 :     MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
     321           0 :     return pMultiLineEdit ? (sal_Int16)pMultiLineEdit->GetMaxTextLen() : (sal_Int16)0;
     322             : }
     323             : 
     324           0 : OUString VCLXMultiLineEdit::getTextLines() throw(::com::sun::star::uno::RuntimeException)
     325             : {
     326           0 :     SolarMutexGuard aGuard;
     327             : 
     328           0 :     OUString aText;
     329           0 :     MultiLineEdit* pEdit = (MultiLineEdit*)GetWindow();
     330           0 :     if ( pEdit )
     331           0 :         aText = pEdit->GetTextLines( meLineEndType );
     332           0 :     return aText;
     333             : }
     334             : 
     335           0 : ::com::sun::star::awt::Size VCLXMultiLineEdit::getMinimumSize() throw(::com::sun::star::uno::RuntimeException)
     336             : {
     337           0 :     SolarMutexGuard aGuard;
     338             : 
     339           0 :     ::com::sun::star::awt::Size aSz;
     340           0 :     MultiLineEdit* pEdit = (MultiLineEdit*) GetWindow();
     341           0 :     if ( pEdit )
     342           0 :         aSz = AWTSize(pEdit->CalcMinimumSize());
     343           0 :     return aSz;
     344             : }
     345             : 
     346           0 : ::com::sun::star::awt::Size VCLXMultiLineEdit::getPreferredSize() throw(::com::sun::star::uno::RuntimeException)
     347             : {
     348           0 :     return getMinimumSize();
     349             : }
     350             : 
     351           0 : ::com::sun::star::awt::Size VCLXMultiLineEdit::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
     352             : {
     353           0 :     SolarMutexGuard aGuard;
     354             : 
     355           0 :     ::com::sun::star::awt::Size aSz = rNewSize;
     356           0 :     MultiLineEdit* pEdit = (MultiLineEdit*) GetWindow();
     357           0 :     if ( pEdit )
     358           0 :         aSz = AWTSize(pEdit->CalcAdjustedSize( VCLSize(rNewSize )));
     359           0 :     return aSz;
     360             : }
     361             : 
     362           0 : ::com::sun::star::awt::Size VCLXMultiLineEdit::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
     363             : {
     364           0 :     SolarMutexGuard aGuard;
     365             : 
     366           0 :     ::com::sun::star::awt::Size aSz;
     367           0 :     MultiLineEdit* pEdit = (MultiLineEdit*) GetWindow();
     368           0 :     if ( pEdit )
     369           0 :         aSz = AWTSize(pEdit->CalcSize( nCols, nLines ));
     370           0 :     return aSz;
     371             : }
     372             : 
     373           0 : void VCLXMultiLineEdit::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
     374             : {
     375           0 :     SolarMutexGuard aGuard;
     376             : 
     377           0 :     nCols = nLines = 0;
     378           0 :     MultiLineEdit* pEdit = (MultiLineEdit*) GetWindow();
     379           0 :     if ( pEdit )
     380             :     {
     381             :         sal_uInt16 nC, nL;
     382           0 :         pEdit->GetMaxVisColumnsAndLines( nC, nL );
     383           0 :         nCols = nC;
     384           0 :         nLines = nL;
     385           0 :     }
     386           0 : }
     387             : 
     388          75 : void VCLXMultiLineEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
     389             : {
     390          75 :     switch ( rVclWindowEvent.GetId() )
     391             :     {
     392             :         case VCLEVENT_EDIT_MODIFY:
     393             :         {
     394           0 :             if ( maTextListeners.getLength() )
     395             :             {
     396           0 :                 ::com::sun::star::awt::TextEvent aEvent;
     397           0 :                 aEvent.Source = (::cppu::OWeakObject*)this;
     398           0 :                 maTextListeners.textChanged( aEvent );
     399             :             }
     400             :         }
     401           0 :         break;
     402             :         default:
     403             :         {
     404          75 :             VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
     405             :         }
     406          75 :         break;
     407             :     }
     408          75 : }
     409             : 
     410        1407 : void VCLXMultiLineEdit::setProperty( const OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
     411             : {
     412        1407 :     SolarMutexGuard aGuard;
     413             : 
     414        1407 :     MultiLineEdit* pMultiLineEdit = (MultiLineEdit*)GetWindow();
     415        1407 :     if ( pMultiLineEdit )
     416             :     {
     417        1407 :         sal_uInt16 nPropType = GetPropertyId( PropertyName );
     418        1407 :         switch ( nPropType )
     419             :         {
     420             :             case BASEPROPERTY_LINE_END_FORMAT:
     421             :             {
     422          11 :                 sal_Int16 nLineEndType = ::com::sun::star::awt::LineEndFormat::LINE_FEED;
     423          11 :                 OSL_VERIFY( Value >>= nLineEndType );
     424          11 :                 switch ( nLineEndType )
     425             :                 {
     426           0 :                 case ::com::sun::star::awt::LineEndFormat::CARRIAGE_RETURN:           meLineEndType = LINEEND_CR; break;
     427           0 :                 case ::com::sun::star::awt::LineEndFormat::LINE_FEED:                 meLineEndType = LINEEND_LF; break;
     428          11 :                 case ::com::sun::star::awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED: meLineEndType = LINEEND_CRLF; break;
     429           0 :                 default: OSL_FAIL( "VCLXMultiLineEdit::setProperty: invalid line end value!" ); break;
     430             :                 }
     431             :             }
     432          11 :             break;
     433             : 
     434             :             case BASEPROPERTY_READONLY:
     435             :             {
     436          13 :                 sal_Bool b = sal_Bool();
     437          13 :                 if ( Value >>= b )
     438          13 :                     pMultiLineEdit->SetReadOnly( b );
     439             :             }
     440          13 :             break;
     441             :             case BASEPROPERTY_MAXTEXTLEN:
     442             :             {
     443          13 :                 sal_Int16 n = sal_Int16();
     444          13 :                 if ( Value >>= n )
     445          13 :                     pMultiLineEdit->SetMaxTextLen( n );
     446             :             }
     447          13 :             break;
     448             :             case BASEPROPERTY_HIDEINACTIVESELECTION:
     449             :             {
     450          13 :                 sal_Bool b = sal_Bool();
     451          13 :                 if ( Value >>= b )
     452             :                 {
     453          13 :                     pMultiLineEdit->EnableFocusSelectionHide( b );
     454          13 :                     lcl_setWinBits( pMultiLineEdit, WB_NOHIDESELECTION, !b );
     455             :                 }
     456             :             }
     457          13 :             break;
     458             :             default:
     459             :             {
     460        1357 :                 VCLXWindow::setProperty( PropertyName, Value );
     461             :             }
     462             :         }
     463        1407 :     }
     464        1407 : }
     465             : 
     466           0 : ::com::sun::star::uno::Any VCLXMultiLineEdit::getProperty( const OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
     467             : {
     468           0 :     SolarMutexGuard aGuard;
     469             : 
     470           0 :     ::com::sun::star::uno::Any aProp;
     471           0 :     MultiLineEdit* pMultiLineEdit = (MultiLineEdit*)GetWindow();
     472           0 :     if ( pMultiLineEdit )
     473             :     {
     474           0 :         sal_uInt16 nPropType = GetPropertyId( PropertyName );
     475           0 :         switch ( nPropType )
     476             :         {
     477             :             case BASEPROPERTY_LINE_END_FORMAT:
     478             :             {
     479           0 :                 sal_Int16 nLineEndType = ::com::sun::star::awt::LineEndFormat::LINE_FEED;
     480           0 :                 switch ( meLineEndType )
     481             :                 {
     482           0 :                 case LINEEND_CR:   nLineEndType = ::com::sun::star::awt::LineEndFormat::CARRIAGE_RETURN; break;
     483           0 :                 case LINEEND_LF:   nLineEndType = ::com::sun::star::awt::LineEndFormat::LINE_FEED; break;
     484           0 :                 case LINEEND_CRLF: nLineEndType = ::com::sun::star::awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED; break;
     485           0 :                 default: OSL_FAIL( "VCLXMultiLineEdit::getProperty: invalid line end value!" ); break;
     486             :                 }
     487           0 :                 aProp <<= nLineEndType;
     488             :             }
     489           0 :             break;
     490             : 
     491             :             case BASEPROPERTY_READONLY:
     492             :             {
     493           0 :                 aProp <<= pMultiLineEdit->IsReadOnly();
     494             :             }
     495           0 :             break;
     496             :             case BASEPROPERTY_MAXTEXTLEN:
     497             :             {
     498           0 :                 aProp <<= (sal_Int16) pMultiLineEdit->GetMaxTextLen();
     499             :             }
     500           0 :             break;
     501             :             default:
     502             :             {
     503           0 :                 aProp <<= VCLXWindow::getProperty( PropertyName );
     504             :             }
     505             :         }
     506             :     }
     507           0 :     return aProp;
     508             : }
     509             : 
     510           0 : void SAL_CALL VCLXMultiLineEdit::setFocus(  ) throw(::com::sun::star::uno::RuntimeException)
     511             : {
     512           0 :     SolarMutexGuard aGuard;
     513             : 
     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.
     518             :     // #i27072#
     519           0 :     if ( GetWindow() && !GetWindow()->HasChildPathFocus() )
     520           0 :         GetWindow()->GrabFocus();
     521           0 : }
     522             : 
     523           0 : void VCLXMultiLineEdit::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
     524             : {
     525             :     PushPropertyIds( rIds,
     526             :                      // FIXME: elide duplication ?
     527             :                      BASEPROPERTY_LINE_END_FORMAT,
     528             :                      BASEPROPERTY_READONLY,
     529             :                      BASEPROPERTY_MAXTEXTLEN,
     530             :                      BASEPROPERTY_HIDEINACTIVESELECTION,
     531           0 :                      0);
     532           0 :     VCLXWindow::ImplGetPropertyIds( rIds, true );
     533             : 
     534           0 : }
     535             : //  ----------------------------------------------------
     536             : //  class VCLXFileControl
     537             : //  ----------------------------------------------------
     538           0 : VCLXFileControl::VCLXFileControl() : maTextListeners( *this )
     539             : {
     540           0 : }
     541             : 
     542           0 : VCLXFileControl::~VCLXFileControl()
     543             : {
     544           0 :     FileControl* pControl = (FileControl*) GetWindow();
     545           0 :     if ( pControl )
     546           0 :         pControl->GetEdit().SetModifyHdl( Link() );
     547           0 : }
     548             : 
     549           0 : ::com::sun::star::uno::Any VCLXFileControl::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
     550             : {
     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           0 :                                         (static_cast< ::com::sun::star::lang::XTypeProvider* >(this)) );
     555           0 :     return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
     556             : }
     557             : 
     558             : // ::com::sun::star::lang::XTypeProvider
     559           0 : IMPL_XTYPEPROVIDER_START( VCLXFileControl )
     560           0 :     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent>* ) NULL ),
     561           0 :     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ),
     562             :     VCLXWindow::getTypes()
     563           0 : IMPL_XTYPEPROVIDER_END
     564             : 
     565           0 : void SAL_CALL VCLXFileControl::setProperty( const OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
     566             : {
     567           0 :     SolarMutexGuard aGuard;
     568             : 
     569           0 :     FileControl* pControl = (FileControl*)GetWindow();
     570           0 :     if ( pControl )
     571             :     {
     572           0 :         sal_uInt16 nPropType = GetPropertyId( PropertyName );
     573           0 :         switch ( nPropType )
     574             :         {
     575             :         case BASEPROPERTY_HIDEINACTIVESELECTION:
     576             :         {
     577           0 :             sal_Bool bValue( sal_False );
     578           0 :             OSL_VERIFY( Value >>= bValue );
     579             : 
     580           0 :             lcl_setWinBits( pControl, WB_NOHIDESELECTION, !bValue );
     581           0 :             lcl_setWinBits( &pControl->GetEdit(), WB_NOHIDESELECTION, !bValue );
     582             :         }
     583           0 :         break;
     584             : 
     585             :         default:
     586           0 :             VCLXWindow::setProperty( PropertyName, Value );
     587           0 :             break;
     588             :         }
     589           0 :     }
     590           0 : }
     591             : 
     592           0 : void VCLXFileControl::SetWindow( Window* pWindow )
     593             : {
     594           0 :     FileControl* pPrevFileControl = dynamic_cast<FileControl*>( GetWindow() );
     595           0 :     if ( pPrevFileControl )
     596           0 :         pPrevFileControl->GetEdit().SetModifyHdl( Link() );
     597             : 
     598           0 :     FileControl* pNewFileControl = dynamic_cast<FileControl*>( pWindow );
     599           0 :     if ( pNewFileControl )
     600           0 :         pNewFileControl->GetEdit().SetModifyHdl( LINK( this, VCLXFileControl, ModifyHdl ) );
     601             : 
     602           0 :     VCLXWindow::SetWindow( pWindow );
     603           0 : }
     604             : 
     605           0 : void VCLXFileControl::addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
     606             : {
     607           0 :     maTextListeners.addInterface( l );
     608           0 : }
     609             : 
     610           0 : void VCLXFileControl::removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
     611             : {
     612           0 :     maTextListeners.removeInterface( l );
     613           0 : }
     614             : 
     615           0 : void VCLXFileControl::setText( const OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
     616             : {
     617           0 :     SolarMutexGuard aGuard;
     618             : 
     619           0 :     Window* pWindow = GetWindow();
     620           0 :     if ( pWindow )
     621             :     {
     622           0 :         pWindow->SetText( aText );
     623             : 
     624             :         // In JAVA wird auch ein textChanged ausgeloest, in VCL nicht.
     625             :         // ::com::sun::star::awt::Toolkit soll JAVA-komform sein...
     626           0 :         ModifyHdl( NULL );
     627           0 :     }
     628           0 : }
     629             : 
     630           0 : void VCLXFileControl::insertText( const ::com::sun::star::awt::Selection& rSel, const OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
     631             : {
     632           0 :     SolarMutexGuard aGuard;
     633             : 
     634           0 :     FileControl* pFileControl = (FileControl*) GetWindow();
     635           0 :     if ( pFileControl )
     636             :     {
     637           0 :         pFileControl->GetEdit().SetSelection( Selection( rSel.Min, rSel.Max ) );
     638           0 :         pFileControl->GetEdit().ReplaceSelected( aText );
     639           0 :     }
     640           0 : }
     641             : 
     642           0 : OUString VCLXFileControl::getText() throw(::com::sun::star::uno::RuntimeException)
     643             : {
     644           0 :     SolarMutexGuard aGuard;
     645             : 
     646           0 :     OUString aText;
     647           0 :     Window* pWindow = GetWindow();
     648           0 :     if ( pWindow )
     649           0 :         aText = pWindow->GetText();
     650           0 :     return aText;
     651             : }
     652             : 
     653           0 : OUString VCLXFileControl::getSelectedText() throw(::com::sun::star::uno::RuntimeException)
     654             : {
     655           0 :     SolarMutexGuard aGuard;
     656             : 
     657           0 :     OUString aText;
     658           0 :     FileControl* pFileControl = (FileControl*) GetWindow();
     659           0 :     if ( pFileControl)
     660           0 :         aText = pFileControl->GetEdit().GetSelected();
     661           0 :     return aText;
     662             : 
     663             : }
     664             : 
     665           0 : void VCLXFileControl::setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException)
     666             : {
     667           0 :     SolarMutexGuard aGuard;
     668             : 
     669           0 :     FileControl* pFileControl = (FileControl*) GetWindow();
     670           0 :     if ( pFileControl )
     671           0 :         pFileControl->GetEdit().SetSelection( Selection( aSelection.Min, aSelection.Max ) );
     672           0 : }
     673             : 
     674           0 : ::com::sun::star::awt::Selection VCLXFileControl::getSelection() throw(::com::sun::star::uno::RuntimeException)
     675             : {
     676           0 :     SolarMutexGuard aGuard;
     677             : 
     678           0 :     ::com::sun::star::awt::Selection aSel;
     679           0 :     FileControl* pFileControl = (FileControl*) GetWindow();
     680           0 :     if ( pFileControl )
     681             :     {
     682           0 :         aSel.Min = pFileControl->GetEdit().GetSelection().Min();
     683           0 :         aSel.Max = pFileControl->GetEdit().GetSelection().Max();
     684             :     }
     685           0 :     return aSel;
     686             : }
     687             : 
     688           0 : sal_Bool VCLXFileControl::isEditable() throw(::com::sun::star::uno::RuntimeException)
     689             : {
     690           0 :     SolarMutexGuard aGuard;
     691             : 
     692           0 :     FileControl* pFileControl = (FileControl*) GetWindow();
     693           0 :     return ( pFileControl && !pFileControl->GetEdit().IsReadOnly() && pFileControl->GetEdit().IsEnabled() ) ? sal_True : sal_False;
     694             : }
     695             : 
     696           0 : void VCLXFileControl::setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException)
     697             : {
     698           0 :     SolarMutexGuard aGuard;
     699             : 
     700           0 :     FileControl* pFileControl = (FileControl*) GetWindow();
     701           0 :     if ( pFileControl )
     702           0 :         pFileControl->GetEdit().SetReadOnly( !bEditable );
     703           0 : }
     704             : 
     705           0 : void VCLXFileControl::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException)
     706             : {
     707           0 :     SolarMutexGuard aGuard;
     708             : 
     709           0 :     FileControl* pFileControl = (FileControl*) GetWindow();
     710           0 :     if ( pFileControl )
     711           0 :         pFileControl->GetEdit().SetMaxTextLen( nLen );
     712           0 : }
     713             : 
     714           0 : sal_Int16 VCLXFileControl::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException)
     715             : {
     716           0 :     SolarMutexGuard aGuard;
     717             : 
     718           0 :     FileControl* pFileControl = (FileControl*) GetWindow();
     719           0 :     return pFileControl ? pFileControl->GetEdit().GetMaxTextLen() : 0;
     720             : }
     721             : 
     722             : 
     723           0 : IMPL_LINK_NOARG(VCLXFileControl, ModifyHdl)
     724             : {
     725           0 :     ::com::sun::star::awt::TextEvent aEvent;
     726           0 :     aEvent.Source = (::cppu::OWeakObject*)this;
     727           0 :     maTextListeners.textChanged( aEvent );
     728             : 
     729           0 :     return 1;
     730             : }
     731             : 
     732           0 : ::com::sun::star::awt::Size VCLXFileControl::getMinimumSize() throw(::com::sun::star::uno::RuntimeException)
     733             : {
     734           0 :     SolarMutexGuard aGuard;
     735             : 
     736           0 :     ::com::sun::star::awt::Size aSz;
     737           0 :     FileControl* pControl = (FileControl*) GetWindow();
     738           0 :     if ( pControl )
     739             :     {
     740           0 :         Size aTmpSize = pControl->GetEdit().CalcMinimumSize();
     741           0 :         aTmpSize.Width() += pControl->GetButton().CalcMinimumSize().Width();
     742           0 :         aSz = AWTSize(pControl->CalcWindowSize( aTmpSize ));
     743             :     }
     744           0 :     return aSz;
     745             : }
     746             : 
     747           0 : ::com::sun::star::awt::Size VCLXFileControl::getPreferredSize() throw(::com::sun::star::uno::RuntimeException)
     748             : {
     749           0 :     ::com::sun::star::awt::Size aSz = getMinimumSize();
     750           0 :     aSz.Height += 4;
     751           0 :     return aSz;
     752             : }
     753             : 
     754           0 : ::com::sun::star::awt::Size VCLXFileControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
     755             : {
     756           0 :     SolarMutexGuard aGuard;
     757             : 
     758           0 :     ::com::sun::star::awt::Size aSz =rNewSize;
     759           0 :     FileControl* pControl = (FileControl*) GetWindow();
     760           0 :     if ( pControl )
     761             :     {
     762           0 :         ::com::sun::star::awt::Size aMinSz = getMinimumSize();
     763           0 :         if ( aSz.Height != aMinSz.Height )
     764           0 :             aSz.Height = aMinSz.Height;
     765             :     }
     766           0 :     return aSz;
     767             : }
     768             : 
     769           0 : ::com::sun::star::awt::Size VCLXFileControl::getMinimumSize( sal_Int16 nCols, sal_Int16 ) throw(::com::sun::star::uno::RuntimeException)
     770             : {
     771           0 :     SolarMutexGuard aGuard;
     772             : 
     773           0 :     ::com::sun::star::awt::Size aSz;
     774           0 :     FileControl* pControl = (FileControl*) GetWindow();
     775           0 :     if ( pControl )
     776             :     {
     777           0 :         aSz = AWTSize(pControl->GetEdit().CalcSize( nCols ));
     778           0 :         aSz.Width += pControl->GetButton().CalcMinimumSize().Width();
     779             :     }
     780           0 :     return aSz;
     781             : }
     782             : 
     783           0 : void VCLXFileControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
     784             : {
     785           0 :     SolarMutexGuard aGuard;
     786             : 
     787           0 :     nCols = 0;
     788           0 :     nLines = 1;
     789           0 :     FileControl* pControl = (FileControl*) GetWindow();
     790           0 :     if ( pControl )
     791           0 :         nCols = (sal_Int16) pControl->GetEdit().GetMaxVisChars();
     792           0 : }
     793             : 
     794           0 : void VCLXFileControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
     795             : {
     796             :     PushPropertyIds( rIds,
     797             :                      // FIXME: elide duplication ?
     798             :                      BASEPROPERTY_HIDEINACTIVESELECTION,
     799           0 :                      0);
     800           0 :     VCLXWindow::ImplGetPropertyIds( rIds, true );
     801           0 : }
     802             : 
     803             : 
     804             : //  ----------------------------------------------------
     805             : //  class SVTXFormattedField
     806             : //  ----------------------------------------------------
     807             : // --------------------------------------------------------------------------------------
     808          35 : SVTXFormattedField::SVTXFormattedField()
     809             :     :m_pCurrentSupplier(NULL)
     810             :     ,bIsStandardSupplier(sal_True)
     811          35 :     ,nKeyToSetDelayed(-1)
     812             : {
     813          35 : }
     814             : 
     815             : // --------------------------------------------------------------------------------------
     816          71 : SVTXFormattedField::~SVTXFormattedField()
     817             : {
     818          35 :     if (m_pCurrentSupplier)
     819             :     {
     820           1 :         m_pCurrentSupplier->release();
     821           1 :         m_pCurrentSupplier = NULL;
     822             :     }
     823          36 : }
     824             : 
     825             : // --------------------------------------------------------------------------------------
     826         105 : void SVTXFormattedField::SetWindow( Window* _pWindow )
     827             : {
     828         105 :     VCLXSpinField::SetWindow(_pWindow);
     829         105 :     if (GetFormattedField())
     830          35 :         GetFormattedField()->SetAutoColor(sal_True);
     831         105 : }
     832             : 
     833             : // --------------------------------------------------------------------------------------
     834        2997 : void SVTXFormattedField::setProperty( const OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
     835             : {
     836        2997 :     SolarMutexGuard aGuard;
     837             : 
     838        2997 :     FormattedField* pField = GetFormattedField();
     839        2997 :     if ( pField )
     840             :     {
     841        2997 :         sal_uInt16 nPropType = GetPropertyId( PropertyName );
     842        2997 :         switch (nPropType)
     843             :         {
     844             :             case BASEPROPERTY_ENFORCE_FORMAT:
     845             :             {
     846          53 :                 sal_Bool bEnable( sal_True );
     847          53 :                 if ( Value >>= bEnable )
     848          53 :                     pField->EnableNotANumber( !bEnable );
     849             :             }
     850          53 :             break;
     851             : 
     852             :             case BASEPROPERTY_EFFECTIVE_MIN:
     853             :             case BASEPROPERTY_VALUEMIN_DOUBLE:
     854          59 :                 SetMinValue(Value);
     855          59 :                 break;
     856             : 
     857             :             case BASEPROPERTY_EFFECTIVE_MAX:
     858             :             case BASEPROPERTY_VALUEMAX_DOUBLE:
     859          59 :                 SetMaxValue(Value);
     860          59 :                 break;
     861             : 
     862             :             case BASEPROPERTY_EFFECTIVE_DEFAULT:
     863           1 :                 SetDefaultValue(Value);
     864           1 :                 break;
     865             : 
     866             :             case BASEPROPERTY_TREATASNUMBER:
     867             :             {
     868           1 :                 sal_Bool b = sal_Bool();
     869           1 :                 if ( Value >>= b )
     870           1 :                     SetTreatAsNumber(b);
     871             :             }
     872           1 :             break;
     873             : 
     874             :             case BASEPROPERTY_FORMATSSUPPLIER:
     875           1 :                 if (!Value.hasValue())
     876           0 :                     setFormatsSupplier(::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > (NULL));
     877             :                 else
     878             :                 {
     879           1 :                     ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > xNFS;
     880           1 :                     if ( Value >>= xNFS )
     881           1 :                         setFormatsSupplier(xNFS);
     882             :                 }
     883           1 :                 break;
     884             :             case BASEPROPERTY_FORMATKEY:
     885           1 :                 if (!Value.hasValue())
     886           1 :                     setFormatKey(0);
     887             :                 else
     888             :                 {
     889           0 :                     sal_Int32 n = 0;
     890           0 :                     if ( Value >>= n )
     891           0 :                         setFormatKey(n);
     892             :                 }
     893           1 :                 break;
     894             : 
     895             :             case BASEPROPERTY_EFFECTIVE_VALUE:
     896             :             case BASEPROPERTY_VALUE_DOUBLE:
     897             :             {
     898          41 :                 const ::com::sun::star::uno::TypeClass rTC = Value.getValueType().getTypeClass();
     899          41 :                 if (rTC != ::com::sun::star::uno::TypeClass_STRING)
     900             :                     // no string
     901          41 :                     if (rTC != ::com::sun::star::uno::TypeClass_DOUBLE)
     902             :                         // no double
     903          31 :                         if (Value.hasValue())
     904             :                         {   // but a value
     905             :                             // try if it is something converitble
     906           0 :                             sal_Int32 nValue = 0;
     907           0 :                             if (!(Value >>= nValue))
     908           0 :                                 throw ::com::sun::star::lang::IllegalArgumentException();
     909           0 :                             SetValue(::com::sun::star::uno::makeAny((double)nValue));
     910           0 :                             break;
     911             :                         }
     912             : 
     913          41 :                 SetValue(Value);
     914             :             }
     915          41 :             break;
     916             :             case BASEPROPERTY_VALUESTEP_DOUBLE:
     917             :             {
     918          58 :                 double d = 0.0;
     919          58 :                 if ( Value >>= d )
     920          58 :                      pField->SetSpinSize( d );
     921             :                 else
     922             :                 {
     923           0 :                     sal_Int32 n = 0;
     924           0 :                     if ( Value >>= n )
     925           0 :                          pField->SetSpinSize( n );
     926             :                 }
     927             :             }
     928          58 :             break;
     929             :             case BASEPROPERTY_DECIMALACCURACY:
     930             :             {
     931          54 :                 sal_Int32 n = 0;
     932          54 :                 if ( Value >>= n )
     933          54 :                      pField->SetDecimalDigits( (sal_uInt16)n );
     934             :             }
     935          54 :             break;
     936             :             case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
     937             :             {
     938          50 :                     sal_Bool b = sal_Bool();
     939          50 :                     if ( Value >>= b )
     940          50 :                      pField->SetThousandsSep( b );
     941             :             }
     942          50 :             break;
     943             : 
     944             :             default:
     945        2619 :                 VCLXSpinField::setProperty( PropertyName, Value );
     946             :         }
     947             : 
     948        2997 :         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          35 :             pField->SetAutoColor(!Value.hasValue());
     952             :         }
     953             :     }
     954             :     else
     955           0 :         VCLXSpinField::setProperty( PropertyName, Value );
     956        2997 : }
     957             : 
     958             : // --------------------------------------------------------------------------------------
     959          12 : ::com::sun::star::uno::Any SVTXFormattedField::getProperty( const OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
     960             : {
     961          12 :     SolarMutexGuard aGuard;
     962             : 
     963          12 :     ::com::sun::star::uno::Any aReturn;
     964             : 
     965          12 :     FormattedField* pField = GetFormattedField();
     966          12 :     if ( pField )
     967             :     {
     968          12 :         sal_uInt16 nPropType = GetPropertyId( PropertyName );
     969          12 :         switch (nPropType)
     970             :         {
     971             :             case BASEPROPERTY_EFFECTIVE_MIN:
     972             :             case BASEPROPERTY_VALUEMIN_DOUBLE:
     973           0 :                 aReturn <<= GetMinValue();
     974           0 :                 break;
     975             : 
     976             :             case BASEPROPERTY_EFFECTIVE_MAX:
     977             :             case BASEPROPERTY_VALUEMAX_DOUBLE:
     978           0 :                 aReturn <<= GetMaxValue();
     979           0 :                 break;
     980             : 
     981             :             case BASEPROPERTY_EFFECTIVE_DEFAULT:
     982           0 :                 aReturn <<= GetDefaultValue();
     983           0 :                 break;
     984             : 
     985             :             case BASEPROPERTY_TREATASNUMBER:
     986           0 :                 aReturn <<= GetTreatAsNumber();
     987           0 :                 break;
     988             : 
     989             :             case BASEPROPERTY_EFFECTIVE_VALUE:
     990             :             case BASEPROPERTY_VALUE_DOUBLE:
     991           6 :                 aReturn <<= GetValue();
     992           6 :                 break;
     993             : 
     994             :             case BASEPROPERTY_VALUESTEP_DOUBLE:
     995           0 :                 aReturn <<= pField->GetSpinSize();
     996           0 :                 break;
     997             : 
     998             :             case BASEPROPERTY_DECIMALACCURACY:
     999           0 :                 aReturn <<= pField->GetDecimalDigits();
    1000           0 :                 break;
    1001             : 
    1002             :             case BASEPROPERTY_FORMATSSUPPLIER:
    1003             :             {
    1004           0 :                 if (!bIsStandardSupplier)
    1005             :                 {   // ansonsten void
    1006           0 :                     ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >  xSupplier = getFormatsSupplier();
    1007           0 :                     aReturn <<= xSupplier;
    1008             :                 }
    1009             :             }
    1010           0 :             break;
    1011             : 
    1012             :             case BASEPROPERTY_FORMATKEY:
    1013             :             {
    1014           0 :                 if (!bIsStandardSupplier)
    1015           0 :                     aReturn <<= getFormatKey();
    1016             :             }
    1017           0 :             break;
    1018             : 
    1019             :             default:
    1020           6 :                 aReturn <<= VCLXSpinField::getProperty(PropertyName);
    1021             :         }
    1022             :     }
    1023          12 :     return aReturn;
    1024             : }
    1025             : 
    1026             : // --------------------------------------------------------------------------------------
    1027           1 : ::com::sun::star::uno::Any SVTXFormattedField::convertEffectiveValue(const ::com::sun::star::uno::Any& rValue)
    1028             : {
    1029           1 :     ::com::sun::star::uno::Any aReturn;
    1030             : 
    1031           1 :     FormattedField* pField = GetFormattedField();
    1032           1 :     if (!pField)
    1033           0 :         return aReturn;
    1034             : 
    1035           1 :     switch (rValue.getValueType().getTypeClass())
    1036             :     {
    1037             :         case ::com::sun::star::uno::TypeClass_DOUBLE:
    1038           0 :             if (pField->TreatingAsNumber())
    1039             :             {
    1040           0 :                 double d = 0.0;
    1041           0 :                 rValue >>= d;
    1042           0 :                 aReturn <<= d;
    1043             :             }
    1044             :             else
    1045             :             {
    1046           0 :                 SvNumberFormatter* pFormatter = pField->GetFormatter();
    1047           0 :                 if (!pFormatter)
    1048           0 :                     pFormatter = pField->StandardFormatter();
    1049             :                     // should never fail
    1050             : 
    1051             :                 Color* pDum;
    1052           0 :                 double d = 0.0;
    1053           0 :                 rValue >>= d;
    1054           0 :                 OUString sConverted;
    1055           0 :                 pFormatter->GetOutputString(d, 0, sConverted, &pDum);
    1056           0 :                 aReturn <<= sConverted;
    1057             :             }
    1058           0 :             break;
    1059             :         case ::com::sun::star::uno::TypeClass_STRING:
    1060             :         {
    1061           0 :             OUString aStr;
    1062           0 :             rValue >>= aStr;
    1063           0 :             String sValue = aStr;
    1064           0 :             if (pField->TreatingAsNumber())
    1065             :             {
    1066           0 :                 SvNumberFormatter* pFormatter = pField->GetFormatter();
    1067           0 :                 if (!pFormatter)
    1068           0 :                     pFormatter = pField->StandardFormatter();
    1069             : 
    1070             :                 double dVal;
    1071           0 :                 sal_uInt32 nTestFormat(0);
    1072           0 :                 if (!pFormatter->IsNumberFormat(sValue, nTestFormat, dVal))
    1073           0 :                     aReturn.clear();
    1074           0 :                 aReturn <<=dVal;
    1075             :             }
    1076             :             else
    1077           0 :                 aReturn <<= aStr;
    1078             :         }
    1079           0 :         break;
    1080             :         default:
    1081           1 :             aReturn.clear();
    1082           1 :             break;
    1083             :     }
    1084           1 :     return aReturn;
    1085             : }
    1086             : 
    1087             : // --------------------------------------------------------------------------------------
    1088          59 : void SVTXFormattedField::SetMinValue(const ::com::sun::star::uno::Any& rValue)
    1089             : {
    1090          59 :     FormattedField* pField = GetFormattedField();
    1091          59 :     if (!pField)
    1092          59 :         return;
    1093             : 
    1094          59 :     switch (rValue.getValueType().getTypeClass())
    1095             : 
    1096             :     {
    1097             :         case ::com::sun::star::uno::TypeClass_DOUBLE:
    1098             :         {
    1099          58 :             double d = 0.0;
    1100          58 :             rValue >>= d;
    1101          58 :             pField->SetMinValue(d);
    1102             :         }
    1103          58 :             break;
    1104             :         default:
    1105             :             DBG_ASSERT(rValue.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID, "SVTXFormattedField::SetMinValue : invalid argument (an exception will be thrown) !");
    1106           1 :             if ( rValue.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID )
    1107             : 
    1108             :             {
    1109           0 :                 throw ::com::sun::star::lang::IllegalArgumentException();
    1110             :             }
    1111           1 :             pField->ClearMinValue();
    1112           1 :             break;
    1113             :     }
    1114             : }
    1115             : 
    1116             : // --------------------------------------------------------------------------------------
    1117           0 : ::com::sun::star::uno::Any SVTXFormattedField::GetMinValue()
    1118             : {
    1119           0 :     FormattedField* pField = GetFormattedField();
    1120           0 :     if (!pField || !pField->HasMinValue())
    1121           0 :         return ::com::sun::star::uno::Any();
    1122             : 
    1123           0 :     ::com::sun::star::uno::Any aReturn;
    1124           0 :     aReturn <<= pField->GetMinValue();
    1125           0 :     return aReturn;
    1126             : }
    1127             : 
    1128             : // --------------------------------------------------------------------------------------
    1129          59 : void SVTXFormattedField::SetMaxValue(const ::com::sun::star::uno::Any& rValue)
    1130             : {
    1131          59 :     FormattedField* pField = GetFormattedField();
    1132          59 :     if (!pField)
    1133          59 :         return;
    1134             : 
    1135          59 :     switch (rValue.getValueType().getTypeClass())
    1136             : 
    1137             :     {
    1138             :         case ::com::sun::star::uno::TypeClass_DOUBLE:
    1139             :         {
    1140          58 :             double d = 0.0;
    1141          58 :             rValue >>= d;
    1142          58 :             pField->SetMaxValue(d);
    1143             :         }
    1144          58 :             break;
    1145             :         default:
    1146           1 :             if (rValue.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID)
    1147             : 
    1148             :             {
    1149           0 :                 throw ::com::sun::star::lang::IllegalArgumentException();
    1150             :             }
    1151           1 :             pField->ClearMaxValue();
    1152           1 :             break;
    1153             :     }
    1154             : }
    1155             : 
    1156             : // --------------------------------------------------------------------------------------
    1157           0 : ::com::sun::star::uno::Any SVTXFormattedField::GetMaxValue()
    1158             : {
    1159           0 :     FormattedField* pField = GetFormattedField();
    1160           0 :     if (!pField || !pField->HasMaxValue())
    1161           0 :         return ::com::sun::star::uno::Any();
    1162             : 
    1163           0 :     ::com::sun::star::uno::Any aReturn;
    1164           0 :     aReturn <<= pField->GetMaxValue();
    1165           0 :     return aReturn;
    1166             : }
    1167             : 
    1168             : // --------------------------------------------------------------------------------------
    1169           1 : void SVTXFormattedField::SetDefaultValue(const ::com::sun::star::uno::Any& rValue)
    1170             : {
    1171           1 :     FormattedField* pField = GetFormattedField();
    1172           1 :     if (!pField)
    1173           1 :         return;
    1174             : 
    1175           1 :     ::com::sun::star::uno::Any aConverted = convertEffectiveValue(rValue);
    1176             : 
    1177           1 :     switch (aConverted.getValueType().getTypeClass())
    1178             : 
    1179             :     {
    1180             :         case ::com::sun::star::uno::TypeClass_DOUBLE:
    1181             :         {
    1182           0 :             double d = 0.0;
    1183           0 :             aConverted >>= d;
    1184           0 :             pField->SetDefaultValue(d);
    1185             :         }
    1186           0 :         break;
    1187             :         case ::com::sun::star::uno::TypeClass_STRING:
    1188             :         {
    1189           0 :             OUString aStr;
    1190           0 :             aConverted >>= aStr;
    1191           0 :             pField->SetDefaultText( aStr );
    1192             :         }
    1193           0 :         break;
    1194             :         default:
    1195           1 :             pField->EnableEmptyField(sal_True);
    1196             :                 // nur noch void erlaubt
    1197           1 :             break;
    1198           1 :     }
    1199             : }
    1200             : 
    1201             : // --------------------------------------------------------------------------------------
    1202           0 : ::com::sun::star::uno::Any SVTXFormattedField::GetDefaultValue()
    1203             : {
    1204           0 :     FormattedField* pField = GetFormattedField();
    1205           0 :     if (!pField || pField->IsEmptyFieldEnabled())
    1206           0 :         return ::com::sun::star::uno::Any();
    1207             : 
    1208           0 :     ::com::sun::star::uno::Any aReturn;
    1209           0 :     if (pField->TreatingAsNumber())
    1210           0 :         aReturn <<= pField->GetDefaultValue();
    1211             :     else
    1212           0 :         aReturn <<= OUString( pField->GetDefaultText() );
    1213           0 :     return aReturn;
    1214             : }
    1215             : 
    1216             : // --------------------------------------------------------------------------------------
    1217           0 : sal_Bool SVTXFormattedField::GetTreatAsNumber()
    1218             : {
    1219           0 :     FormattedField* pField = GetFormattedField();
    1220           0 :     if (pField)
    1221           0 :         return pField->TreatingAsNumber();
    1222             : 
    1223           0 :     return sal_True;
    1224             : }
    1225             : 
    1226             : // --------------------------------------------------------------------------------------
    1227           1 : void SVTXFormattedField::SetTreatAsNumber(sal_Bool bSet)
    1228             : {
    1229           1 :     FormattedField* pField = GetFormattedField();
    1230           1 :     if (pField)
    1231           1 :         pField->TreatAsNumber(bSet);
    1232           1 : }
    1233             : 
    1234             : // --------------------------------------------------------------------------------------
    1235           7 : ::com::sun::star::uno::Any SVTXFormattedField::GetValue()
    1236             : {
    1237           7 :     FormattedField* pField = GetFormattedField();
    1238           7 :     if (!pField)
    1239           0 :         return ::com::sun::star::uno::Any();
    1240             : 
    1241           7 :     ::com::sun::star::uno::Any aReturn;
    1242           7 :     if (!pField->TreatingAsNumber())
    1243             :     {
    1244           0 :         OUString sText = pField->GetTextValue();
    1245           0 :         aReturn <<= sText;
    1246             :     }
    1247             :     else
    1248             :     {
    1249           7 :         if (!pField->GetText().isEmpty())    // empty wird erst mal standardmaessig als void nach draussen gereicht
    1250           6 :             aReturn <<= pField->GetValue();
    1251             :     }
    1252             : 
    1253           7 :     return aReturn;
    1254             : }
    1255             : 
    1256             : // --------------------------------------------------------------------------------------
    1257          42 : void SVTXFormattedField::SetValue(const ::com::sun::star::uno::Any& rValue)
    1258             : {
    1259          42 :     FormattedField* pField = GetFormattedField();
    1260          42 :     if (!pField)
    1261          42 :         return;
    1262             : 
    1263          42 :     if (!rValue.hasValue())
    1264             :     {
    1265          32 :         pField->SetText(String());
    1266             :     }
    1267             :     else
    1268             :     {
    1269          10 :         if (rValue.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_DOUBLE )
    1270             :         {
    1271          10 :             double d = 0.0;
    1272          10 :             rValue >>= d;
    1273          10 :             pField->SetValue(d);
    1274             :         }
    1275             :         else
    1276             :         {
    1277             :             DBG_ASSERT(rValue.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_STRING, "SVTXFormattedField::SetValue : invalid argument !");
    1278             : 
    1279           0 :             OUString sText;
    1280           0 :             rValue >>= sText;
    1281           0 :             String aStr( sText );
    1282           0 :             if (!pField->TreatingAsNumber())
    1283           0 :                 pField->SetTextFormatted(aStr);
    1284             :             else
    1285           0 :                 pField->SetTextValue(aStr);
    1286             :         }
    1287             :     }
    1288             : //  NotifyTextListeners();
    1289             : }
    1290             : 
    1291             : // --------------------------------------------------------------------------------------
    1292           0 : ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >  SVTXFormattedField::getFormatsSupplier(void) const
    1293             : {
    1294           0 :     return ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > ((::com::sun::star::util::XNumberFormatsSupplier*)m_pCurrentSupplier);
    1295             : }
    1296             : 
    1297             : // --------------------------------------------------------------------------------------
    1298           1 : void SVTXFormattedField::setFormatsSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xSupplier)
    1299             : {
    1300           1 :     FormattedField* pField = GetFormattedField();
    1301             : 
    1302           1 :     SvNumberFormatsSupplierObj* pNew = NULL;
    1303           1 :     if (!xSupplier.is())
    1304             :     {
    1305           0 :         if (pField)
    1306             :         {
    1307           0 :             pNew = new SvNumberFormatsSupplierObj(pField->StandardFormatter());
    1308           0 :             bIsStandardSupplier = sal_True;
    1309             :         }
    1310             :     }
    1311             :     else
    1312             :     {
    1313           1 :         pNew = SvNumberFormatsSupplierObj::getImplementation(xSupplier);
    1314           1 :         bIsStandardSupplier = sal_False;
    1315             :     }
    1316             : 
    1317           1 :     if (!pNew)
    1318           1 :         return;     // TODO : wie das behandeln ?
    1319             : 
    1320           1 :     if (m_pCurrentSupplier)
    1321           0 :         m_pCurrentSupplier->release();
    1322           1 :     m_pCurrentSupplier = pNew;
    1323           1 :     m_pCurrentSupplier->acquire();
    1324           1 :     if (pField)
    1325             :     {
    1326             :         // den aktuellen Value mit hinueberretten
    1327           1 :         ::com::sun::star::uno::Any aCurrent = GetValue();
    1328           1 :         pField->SetFormatter(m_pCurrentSupplier->GetNumberFormatter(), sal_False);
    1329           1 :         if (nKeyToSetDelayed != -1)
    1330             :         {
    1331           1 :             pField->SetFormatKey(nKeyToSetDelayed);
    1332           1 :             nKeyToSetDelayed = -1;
    1333             :         }
    1334           1 :         SetValue(aCurrent);
    1335           1 :         NotifyTextListeners();
    1336             :     }
    1337             : }
    1338             : 
    1339             : // --------------------------------------------------------------------------------------
    1340           0 : sal_Int32 SVTXFormattedField::getFormatKey(void) const
    1341             : {
    1342           0 :     FormattedField* pField = GetFormattedField();
    1343           0 :     return pField ? pField->GetFormatKey() : 0;
    1344             : }
    1345             : 
    1346             : // --------------------------------------------------------------------------------------
    1347           1 : void SVTXFormattedField::setFormatKey(sal_Int32 nKey)
    1348             : {
    1349           1 :     FormattedField* pField = GetFormattedField();
    1350           1 :     if (pField)
    1351             :     {
    1352           1 :         if (pField->GetFormatter())
    1353           0 :             pField->SetFormatKey(nKey);
    1354             :         else
    1355             :         {   // Wahrscheinlich bin ich gerade in einem Block, in dem erst der Key und dann der Formatter gesetzt
    1356             :             // wird, das passiert initial mit ziemlicher Sicherheit, da die Properties in alphabetischer Reihenfolge
    1357             :             // gesetzt werden, und der FormatsSupplier nun mal vor dem FormatKey kommt
    1358           1 :             nKeyToSetDelayed = nKey;
    1359             :         }
    1360           1 :         NotifyTextListeners();
    1361             :     }
    1362           1 : }
    1363             : 
    1364             : // --------------------------------------------------------------------------------------
    1365           2 : void SVTXFormattedField::NotifyTextListeners()
    1366             : {
    1367           2 :     if ( GetTextListeners().getLength() )
    1368             :     {
    1369           0 :         ::com::sun::star::awt::TextEvent aEvent;
    1370           0 :         aEvent.Source = (::cppu::OWeakObject*)this;
    1371           0 :         GetTextListeners().textChanged( aEvent );
    1372             :     }
    1373           2 : }
    1374             : 
    1375           0 : void SVTXFormattedField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
    1376             : {
    1377             :     PushPropertyIds( rIds,
    1378             :                      // FIXME: elide duplication ?
    1379             :                      BASEPROPERTY_EFFECTIVE_MIN,
    1380             :                      BASEPROPERTY_VALUEMIN_DOUBLE,
    1381             :                      BASEPROPERTY_EFFECTIVE_MAX,
    1382             :                      BASEPROPERTY_VALUEMAX_DOUBLE,
    1383             :                      BASEPROPERTY_EFFECTIVE_DEFAULT,
    1384             :                      BASEPROPERTY_TREATASNUMBER,
    1385             :                      BASEPROPERTY_EFFECTIVE_VALUE,
    1386             :                      BASEPROPERTY_VALUE_DOUBLE,
    1387             :                      BASEPROPERTY_VALUESTEP_DOUBLE,
    1388             :                      BASEPROPERTY_DECIMALACCURACY,
    1389             :                      BASEPROPERTY_FORMATSSUPPLIER,
    1390             :                      BASEPROPERTY_NUMSHOWTHOUSANDSEP,
    1391             :                      BASEPROPERTY_FORMATKEY,
    1392             :                      BASEPROPERTY_TREATASNUMBER,
    1393             :                      BASEPROPERTY_ENFORCE_FORMAT,
    1394           0 :                      0);
    1395           0 :     VCLXWindow::ImplGetPropertyIds( rIds, true );
    1396           0 :     VCLXSpinField::ImplGetPropertyIds( rIds );
    1397           0 : }
    1398             : 
    1399             : 
    1400             : //  ----------------------------------------------------
    1401             : //  class SVTXRoadmap
    1402             : //  ----------------------------------------------------
    1403             : 
    1404             : using namespace svt;
    1405             : 
    1406             : // --------------------------------------------------------------------------------------
    1407           0 : SVTXRoadmap::SVTXRoadmap() : maItemListeners( *this )
    1408             : {
    1409           0 : }
    1410             : 
    1411             : // --------------------------------------------------------------------------------------
    1412           0 : SVTXRoadmap::~SVTXRoadmap()
    1413             : {
    1414           0 : }
    1415             : 
    1416           0 : void SVTXRoadmap::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
    1417             : {
    1418           0 :     switch ( rVclWindowEvent.GetId() )
    1419             :     {
    1420             :         case VCLEVENT_ROADMAP_ITEMSELECTED:
    1421             :         {
    1422           0 :             SolarMutexGuard aGuard;
    1423           0 :             ::svt::ORoadmap* pField = GetRoadmap();
    1424           0 :             if ( pField )
    1425             :             {
    1426           0 :                 sal_Int16 CurItemID = pField->GetCurrentRoadmapItemID();
    1427           0 :                 ::com::sun::star::awt::ItemEvent aEvent;
    1428           0 :                 aEvent.Selected = CurItemID;
    1429           0 :                 aEvent.Highlighted = CurItemID;
    1430           0 :                 aEvent.ItemId = CurItemID;
    1431           0 :                 maItemListeners.itemStateChanged( aEvent );
    1432           0 :             }
    1433             :         }
    1434           0 :         break;
    1435             :         default:
    1436           0 :             SVTXRoadmap_Base::ProcessWindowEvent( rVclWindowEvent );
    1437           0 :             break;
    1438             :     }
    1439           0 : }
    1440             : 
    1441             : 
    1442           0 : void SVTXRoadmap::propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException)
    1443             : {
    1444           0 :     SolarMutexGuard aGuard;
    1445           0 :     ::svt::ORoadmap* pField = GetRoadmap();
    1446           0 :     if ( pField )
    1447             :     {
    1448           0 :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xRoadmapItem;
    1449           0 :         xRoadmapItem = evt.Source;
    1450           0 :         sal_Int32 nID = 0;
    1451           0 :         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropertySet( xRoadmapItem, ::com::sun::star::uno::UNO_QUERY );
    1452           0 :         ::com::sun::star::uno::Any aValue = xPropertySet->getPropertyValue("ID");
    1453           0 :         aValue >>= nID;
    1454             : 
    1455           0 :         ::com::sun::star::uno::Any rVal = evt.NewValue;
    1456           0 :         evt.NewValue >>= rVal;
    1457           0 :         OUString sPropertyName = evt.PropertyName;
    1458           0 :         if ( sPropertyName == "Enabled" )
    1459             :         {
    1460           0 :             sal_Bool bEnable = false;
    1461           0 :             evt.NewValue >>= bEnable;
    1462           0 :             pField->EnableRoadmapItem( (RoadmapTypes::ItemId)nID , bEnable );
    1463             :         }
    1464           0 :         else if ( sPropertyName == "Label" )
    1465             :         {
    1466           0 :             OUString sLabel;
    1467           0 :             evt.NewValue >>= sLabel;
    1468           0 :             pField->ChangeRoadmapItemLabel( (RoadmapTypes::ItemId)nID , sLabel );
    1469             :         }
    1470           0 :         else if  ( sPropertyName == "ID" )
    1471             :         {
    1472           0 :             sal_Int32 nNewID = 0;
    1473           0 :             evt.NewValue >>= nNewID;
    1474           0 :             evt.OldValue >>= nID;
    1475           0 :             pField->ChangeRoadmapItemID( (RoadmapTypes::ItemId)nID, (RoadmapTypes::ItemId)nNewID );
    1476           0 :         }
    1477             :     //    else
    1478             :             // Todo: handle Interactive appropriately
    1479           0 :     }
    1480           0 : }
    1481             : 
    1482             : 
    1483           0 : void SVTXRoadmap::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw (::com::sun::star::uno::RuntimeException)
    1484             : {
    1485           0 :     maItemListeners.addInterface( l );
    1486           0 : }
    1487             : 
    1488           0 : void SVTXRoadmap::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw (::com::sun::star::uno::RuntimeException)
    1489             : {
    1490           0 :     maItemListeners.removeInterface( l );
    1491           0 : }
    1492             : 
    1493           0 : RMItemData SVTXRoadmap::GetRMItemData( const ::com::sun::star::container::ContainerEvent& _rEvent )
    1494             : {
    1495           0 :     RMItemData aCurRMItemData;
    1496           0 :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xRoadmapItem;
    1497           0 :     _rEvent.Element >>= xRoadmapItem;
    1498           0 :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropertySet( xRoadmapItem, ::com::sun::star::uno::UNO_QUERY );
    1499           0 :     if ( xPropertySet.is() )
    1500             :     {
    1501           0 :         ::com::sun::star::uno::Any aValue = xPropertySet->getPropertyValue("Label");
    1502           0 :         aValue >>= aCurRMItemData.Label;
    1503           0 :         aValue = xPropertySet->getPropertyValue("ID");
    1504           0 :         aValue >>= aCurRMItemData.n_ID;
    1505           0 :         aValue = xPropertySet->getPropertyValue("Enabled");
    1506           0 :         aValue >>= aCurRMItemData.b_Enabled;
    1507             :     }
    1508             :     else
    1509             :     {
    1510           0 :         aCurRMItemData.b_Enabled = sal_False;
    1511           0 :         aCurRMItemData.n_ID = 0;
    1512             :     }
    1513           0 :     return aCurRMItemData;
    1514             : }
    1515             : 
    1516           0 : void SVTXRoadmap::elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent )throw(::com::sun::star::uno::RuntimeException)
    1517             : {
    1518           0 :     SolarMutexGuard aGuard;
    1519           0 :     ::svt::ORoadmap* pField = GetRoadmap();
    1520           0 :     if ( pField )
    1521             :     {
    1522           0 :         RMItemData CurItemData = GetRMItemData(  _rEvent );
    1523           0 :         sal_Int32 InsertIndex = 0;
    1524           0 :         _rEvent.Accessor >>= InsertIndex;
    1525           0 :         pField->InsertRoadmapItem( InsertIndex, CurItemData.Label, (RoadmapTypes::ItemId)CurItemData.n_ID, CurItemData.b_Enabled );
    1526           0 :     }
    1527           0 : }
    1528             : 
    1529           0 : void SVTXRoadmap::elementRemoved( const ::com::sun::star::container::ContainerEvent& _rEvent )throw(::com::sun::star::uno::RuntimeException)
    1530             : {
    1531           0 :     SolarMutexGuard aGuard;
    1532           0 :     ::svt::ORoadmap* pField = GetRoadmap();
    1533           0 :     if ( pField )
    1534             :     {
    1535           0 :         sal_Int32 DelIndex = 0;
    1536           0 :         _rEvent.Accessor >>= DelIndex;
    1537           0 :         pField->DeleteRoadmapItem(DelIndex);
    1538           0 :     }
    1539           0 : }
    1540             : 
    1541           0 : void SVTXRoadmap::elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent )throw(::com::sun::star::uno::RuntimeException)
    1542             : {
    1543           0 :     SolarMutexGuard aGuard;
    1544           0 :     ::svt::ORoadmap* pField = GetRoadmap();
    1545           0 :     if ( pField )
    1546             :     {
    1547           0 :         RMItemData CurItemData = GetRMItemData(  _rEvent );
    1548           0 :         sal_Int32 ReplaceIndex = 0;
    1549           0 :         _rEvent.Accessor >>= ReplaceIndex;
    1550           0 :         pField->ReplaceRoadmapItem( ReplaceIndex, CurItemData.Label, (RoadmapTypes::ItemId)CurItemData.n_ID, CurItemData.b_Enabled );
    1551           0 :     }
    1552           0 : }
    1553             : 
    1554             : 
    1555             : 
    1556             : // --------------------------------------------------------------------------------------
    1557           0 : void SVTXRoadmap::setProperty( const OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
    1558             : {
    1559           0 :     SolarMutexGuard aGuard;
    1560             : 
    1561           0 :     ::svt::ORoadmap* pField = GetRoadmap();
    1562           0 :     if ( pField )
    1563             :     {
    1564           0 :         sal_uInt16 nPropType = GetPropertyId( PropertyName );
    1565           0 :         switch (nPropType)
    1566             :         {
    1567             :             case BASEPROPERTY_COMPLETE:
    1568             :             {
    1569           0 :                 sal_Bool b = false;
    1570           0 :                 Value >>= b;
    1571           0 :                 pField->SetRoadmapComplete( b);
    1572             :             }
    1573           0 :             break;
    1574             : 
    1575             :             case BASEPROPERTY_ACTIVATED:
    1576             :             {
    1577           0 :                    sal_Bool b = false;
    1578           0 :                 Value >>= b;
    1579           0 :                 pField->SetRoadmapInteractive( b);
    1580             :             }
    1581           0 :             break;
    1582             : 
    1583             :             case BASEPROPERTY_CURRENTITEMID:
    1584             :             {
    1585           0 :                    sal_Int32 nId = 0;
    1586           0 :                 Value >>= nId;
    1587           0 :                 pField->SelectRoadmapItemByID( (RoadmapTypes::ItemId)nId );
    1588             :             }
    1589           0 :             break;
    1590             : 
    1591             :             case BASEPROPERTY_TEXT:
    1592             :             {
    1593           0 :                    OUString aStr;
    1594           0 :                 Value >>= aStr;
    1595           0 :                 pField->SetText( aStr );
    1596           0 :                 pField->Invalidate();
    1597             :             }
    1598           0 :             break;
    1599             : 
    1600             :             default:
    1601           0 :                 SVTXRoadmap_Base::setProperty( PropertyName, Value );
    1602           0 :                 break;
    1603             :         }
    1604             : 
    1605             :     }
    1606             :     else
    1607           0 :         SVTXRoadmap_Base::setProperty( PropertyName, Value );
    1608           0 : }
    1609             : 
    1610             : 
    1611             : // --------------------------------------------------------------------------------------
    1612           0 : ::com::sun::star::uno::Any SVTXRoadmap::getProperty( const OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
    1613             : {
    1614           0 :     SolarMutexGuard aGuard;
    1615             : 
    1616           0 :     ::com::sun::star::uno::Any aReturn;
    1617             : 
    1618           0 :     ::svt::ORoadmap* pField = GetRoadmap();
    1619           0 :     if ( pField )
    1620             :     {
    1621           0 :         sal_uInt16 nPropType = GetPropertyId( PropertyName );
    1622           0 :         switch (nPropType)
    1623             :         {
    1624             :             case BASEPROPERTY_COMPLETE:
    1625           0 :                 aReturn <<= pField->IsRoadmapComplete();
    1626           0 :                 break;
    1627             :             case BASEPROPERTY_ACTIVATED:
    1628           0 :                 aReturn <<= pField->IsRoadmapInteractive();
    1629           0 :                 break;
    1630             :             case BASEPROPERTY_CURRENTITEMID:
    1631           0 :                 aReturn <<= pField->GetCurrentRoadmapItemID();
    1632           0 :                 break;
    1633             :             default:
    1634           0 :                 aReturn = SVTXRoadmap_Base::getProperty(PropertyName);
    1635           0 :                 break;
    1636             :         }
    1637             :     }
    1638           0 :     return aReturn;
    1639             : }
    1640             : 
    1641           0 : void SVTXRoadmap::ImplSetNewImage()
    1642             : {
    1643             :     OSL_PRECOND( GetWindow(), "SVTXRoadmap::ImplSetNewImage: window is required to be not-NULL!" );
    1644           0 :     ::svt::ORoadmap* pButton = static_cast< ::svt::ORoadmap* >( GetWindow() );
    1645           0 :     pButton->SetRoadmapBitmap( GetImage().GetBitmapEx() );
    1646           0 : }
    1647             : 
    1648           0 : void SVTXRoadmap::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
    1649             : {
    1650             :     PushPropertyIds( rIds,
    1651             :                      BASEPROPERTY_COMPLETE,
    1652             :                      BASEPROPERTY_ACTIVATED,
    1653             :                      BASEPROPERTY_CURRENTITEMID,
    1654             :                      BASEPROPERTY_TEXT,
    1655           0 :                      0);
    1656           0 :     VCLXWindow::ImplGetPropertyIds( rIds, true );
    1657           0 :     VCLXGraphicControl::ImplGetPropertyIds( rIds );
    1658           0 : }
    1659             : 
    1660             : //  ----------------------------------------------------
    1661             : //  class SVTXNumericField
    1662             : //  ----------------------------------------------------
    1663          17 : SVTXNumericField::SVTXNumericField()
    1664             : {
    1665          17 : }
    1666             : 
    1667          34 : SVTXNumericField::~SVTXNumericField()
    1668             : {
    1669          34 : }
    1670             : 
    1671        3053 : ::com::sun::star::uno::Any SVTXNumericField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
    1672             : {
    1673             :     ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
    1674             :                                         (static_cast< ::com::sun::star::awt::XNumericField* >(this)),
    1675        3053 :                                         (static_cast< ::com::sun::star::lang::XTypeProvider* >(this)) );
    1676        3053 :     return (aRet.hasValue() ? aRet : SVTXFormattedField::queryInterface( rType ));
    1677             : }
    1678             : 
    1679             : // ::com::sun::star::lang::XTypeProvider
    1680           0 : IMPL_XTYPEPROVIDER_START( SVTXNumericField )
    1681           0 :     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XNumericField>* ) NULL ),
    1682             :     SVTXFormattedField::getTypes()
    1683           0 : IMPL_XTYPEPROVIDER_END
    1684             : 
    1685             : 
    1686           0 : void SVTXNumericField::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException)
    1687             : {
    1688           0 :     SolarMutexGuard aGuard;
    1689             : 
    1690           0 :     FormattedField* pField = GetFormattedField();
    1691           0 :     if ( pField )
    1692           0 :         pField->SetValue( Value );
    1693           0 : }
    1694             : 
    1695         106 : double SVTXNumericField::getValue() throw(::com::sun::star::uno::RuntimeException)
    1696             : {
    1697         106 :     SolarMutexGuard aGuard;
    1698             : 
    1699         106 :     FormattedField* pField = GetFormattedField();
    1700         106 :     return pField ? pField->GetValue() : 0;
    1701             : }
    1702             : 
    1703           0 : void SVTXNumericField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException)
    1704             : {
    1705           0 :     SolarMutexGuard aGuard;
    1706             : 
    1707           0 :     FormattedField* pField = GetFormattedField();
    1708           0 :     if ( pField )
    1709           0 :         pField->SetMinValue( Value );
    1710           0 : }
    1711             : 
    1712           0 : double SVTXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException)
    1713             : {
    1714           0 :     SolarMutexGuard aGuard;
    1715             : 
    1716           0 :     FormattedField* pField = GetFormattedField();
    1717           0 :     return pField ? pField->GetMinValue() : 0;
    1718             : }
    1719             : 
    1720           0 : void SVTXNumericField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException)
    1721             : {
    1722           0 :     SolarMutexGuard aGuard;
    1723             : 
    1724           0 :     FormattedField* pField = GetFormattedField();
    1725           0 :     if ( pField )
    1726           0 :         pField->SetMaxValue( Value );
    1727           0 : }
    1728             : 
    1729           0 : double SVTXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException)
    1730             : {
    1731           0 :     SolarMutexGuard aGuard;
    1732             : 
    1733           0 :     FormattedField* pField = GetFormattedField();
    1734           0 :     return pField ? pField->GetMaxValue() : 0;
    1735             : }
    1736             : 
    1737          21 : void SVTXNumericField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException)
    1738             : {
    1739          21 :     SolarMutexGuard aGuard;
    1740             : 
    1741          21 :     FormattedField* pField = GetFormattedField();
    1742          21 :     if ( pField )
    1743          21 :         pField->SetSpinFirst( Value );
    1744          21 : }
    1745             : 
    1746           0 : double SVTXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeException)
    1747             : {
    1748           0 :     SolarMutexGuard aGuard;
    1749             : 
    1750           0 :     FormattedField* pField = GetFormattedField();
    1751           0 :     return pField ? pField->GetSpinFirst() : 0;
    1752             : }
    1753             : 
    1754          21 : void SVTXNumericField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException)
    1755             : {
    1756          21 :     SolarMutexGuard aGuard;
    1757             : 
    1758          21 :     FormattedField* pField = GetFormattedField();
    1759          21 :     if ( pField )
    1760          21 :         pField->SetSpinLast( Value );
    1761          21 : }
    1762             : 
    1763           0 : double SVTXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException)
    1764             : {
    1765           0 :     SolarMutexGuard aGuard;
    1766             : 
    1767           0 :     FormattedField* pField = GetFormattedField();
    1768           0 :     return pField ? pField->GetSpinLast() : 0;
    1769             : }
    1770             : 
    1771           0 : void SVTXNumericField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException)
    1772             : {
    1773           0 :     SolarMutexGuard aGuard;
    1774             : 
    1775           0 :     FormattedField* pField = GetFormattedField();
    1776           0 :     if ( pField )
    1777           0 :         pField->SetSpinSize( Value );
    1778           0 : }
    1779             : 
    1780           0 : double SVTXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
    1781             : {
    1782           0 :     SolarMutexGuard aGuard;
    1783             : 
    1784           0 :     FormattedField* pField = GetFormattedField();
    1785           0 :     return pField ? pField->GetSpinSize() : 0;
    1786             : }
    1787             : 
    1788           0 : void SVTXNumericField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException)
    1789             : {
    1790           0 :     SolarMutexGuard aGuard;
    1791             : 
    1792           0 :     FormattedField* pField = GetFormattedField();
    1793           0 :     if ( pField )
    1794           0 :         pField->SetDecimalDigits( Value );
    1795           0 : }
    1796             : 
    1797           0 : sal_Int16 SVTXNumericField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
    1798             : {
    1799           0 :     SolarMutexGuard aGuard;
    1800             : 
    1801           0 :     FormattedField* pField = GetFormattedField();
    1802           0 :     return pField ? pField->GetDecimalDigits() : 0;
    1803             : }
    1804             : 
    1805           0 : void SVTXNumericField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
    1806             : {
    1807           0 :     SolarMutexGuard aGuard;
    1808             : 
    1809           0 :     FormattedField* pField = GetFormattedField();
    1810           0 :     if ( pField )
    1811           0 :         pField->SetStrictFormat( bStrict );
    1812           0 : }
    1813             : 
    1814           0 : sal_Bool SVTXNumericField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
    1815             : {
    1816           0 :     SolarMutexGuard aGuard;
    1817             : 
    1818           0 :     FormattedField* pField = GetFormattedField();
    1819           0 :     return pField ? pField->IsStrictFormat() : sal_False;
    1820             : }
    1821             : 
    1822           0 : void SVTXNumericField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
    1823             : {
    1824           0 :     SVTXFormattedField::ImplGetPropertyIds( rIds );
    1825           0 : }
    1826             : 
    1827             : //  ----------------------------------------------------
    1828             : //  class SVTXCurrencyField
    1829             : //  ----------------------------------------------------
    1830          17 : SVTXCurrencyField::SVTXCurrencyField()
    1831             : {
    1832          17 : }
    1833             : 
    1834          34 : SVTXCurrencyField::~SVTXCurrencyField()
    1835             : {
    1836          34 : }
    1837             : 
    1838        3433 : ::com::sun::star::uno::Any SVTXCurrencyField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
    1839             : {
    1840             :     ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
    1841             :                                         (static_cast< ::com::sun::star::awt::XCurrencyField* >(this)),
    1842        3433 :                                         (static_cast< ::com::sun::star::lang::XTypeProvider* >(this)) );
    1843        3433 :     return (aRet.hasValue() ? aRet : SVTXFormattedField::queryInterface( rType ));
    1844             : }
    1845             : 
    1846             : // ::com::sun::star::lang::XTypeProvider
    1847           0 : IMPL_XTYPEPROVIDER_START( SVTXCurrencyField )
    1848           0 :     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCurrencyField>* ) NULL ),
    1849             :     SVTXFormattedField::getTypes()
    1850           0 : IMPL_XTYPEPROVIDER_END
    1851             : 
    1852           0 : void SVTXCurrencyField::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException)
    1853             : {
    1854           0 :     SolarMutexGuard aGuard;
    1855             : 
    1856           0 :     FormattedField* pField = GetFormattedField();
    1857           0 :     if ( pField )
    1858           0 :         pField->SetValue( Value );
    1859           0 : }
    1860             : 
    1861          90 : double SVTXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeException)
    1862             : {
    1863          90 :     SolarMutexGuard aGuard;
    1864             : 
    1865          90 :     FormattedField* pField = GetFormattedField();
    1866          90 :     return pField ? pField->GetValue() : 0;
    1867             : }
    1868             : 
    1869           0 : void SVTXCurrencyField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException)
    1870             : {
    1871           0 :     SolarMutexGuard aGuard;
    1872             : 
    1873           0 :     FormattedField* pField = GetFormattedField();
    1874           0 :     if ( pField )
    1875           0 :         pField->SetMinValue( Value );
    1876           0 : }
    1877             : 
    1878           0 : double SVTXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException)
    1879             : {
    1880           0 :     SolarMutexGuard aGuard;
    1881             : 
    1882           0 :     FormattedField* pField = GetFormattedField();
    1883           0 :     return pField ? pField->GetMinValue() : 0;
    1884             : }
    1885             : 
    1886           0 : void SVTXCurrencyField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException)
    1887             : {
    1888           0 :     SolarMutexGuard aGuard;
    1889             : 
    1890           0 :     FormattedField* pField = GetFormattedField();
    1891           0 :     if ( pField )
    1892           0 :         pField->SetMaxValue( Value );
    1893           0 : }
    1894             : 
    1895           0 : double SVTXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException)
    1896             : {
    1897           0 :     SolarMutexGuard aGuard;
    1898             : 
    1899           0 :     FormattedField* pField = GetFormattedField();
    1900           0 :     return pField ? pField->GetMaxValue() : 0;
    1901             : }
    1902             : 
    1903          21 : void SVTXCurrencyField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException)
    1904             : {
    1905          21 :     SolarMutexGuard aGuard;
    1906             : 
    1907          21 :     FormattedField* pField = GetFormattedField();
    1908          21 :     if ( pField )
    1909          21 :         pField->SetSpinFirst( Value );
    1910          21 : }
    1911             : 
    1912           0 : double SVTXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeException)
    1913             : {
    1914           0 :     SolarMutexGuard aGuard;
    1915             : 
    1916           0 :     FormattedField* pField = GetFormattedField();
    1917           0 :     return pField ? pField->GetSpinFirst() : 0;
    1918             : }
    1919             : 
    1920          21 : void SVTXCurrencyField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException)
    1921             : {
    1922          21 :     SolarMutexGuard aGuard;
    1923             : 
    1924          21 :     FormattedField* pField = GetFormattedField();
    1925          21 :     if ( pField )
    1926          21 :         pField->SetSpinLast( Value );
    1927          21 : }
    1928             : 
    1929           0 : double SVTXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeException)
    1930             : {
    1931           0 :     SolarMutexGuard aGuard;
    1932             : 
    1933           0 :     FormattedField* pField = GetFormattedField();
    1934           0 :     return pField ? pField->GetSpinLast() : 0;
    1935             : }
    1936             : 
    1937           0 : void SVTXCurrencyField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException)
    1938             : {
    1939           0 :     SolarMutexGuard aGuard;
    1940             : 
    1941           0 :     FormattedField* pField = GetFormattedField();
    1942           0 :     if ( pField )
    1943           0 :         pField->SetSpinSize( Value );
    1944           0 : }
    1945             : 
    1946           0 : double SVTXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
    1947             : {
    1948           0 :     SolarMutexGuard aGuard;
    1949             : 
    1950           0 :     FormattedField* pField = GetFormattedField();
    1951           0 :     return pField ? pField->GetSpinSize() : 0;
    1952             : }
    1953             : 
    1954           0 : void SVTXCurrencyField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException)
    1955             : {
    1956           0 :     SolarMutexGuard aGuard;
    1957             : 
    1958           0 :     FormattedField* pField = GetFormattedField();
    1959           0 :     if ( pField )
    1960           0 :         pField->SetDecimalDigits( Value );
    1961           0 : }
    1962             : 
    1963           0 : sal_Int16 SVTXCurrencyField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
    1964             : {
    1965           0 :     SolarMutexGuard aGuard;
    1966             : 
    1967           0 :     FormattedField* pField = GetFormattedField();
    1968           0 :     return pField ? pField->GetDecimalDigits() : 0;
    1969             : }
    1970             : 
    1971           0 : void SVTXCurrencyField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
    1972             : {
    1973           0 :     SolarMutexGuard aGuard;
    1974             : 
    1975           0 :     FormattedField* pField = GetFormattedField();
    1976           0 :     if ( pField )
    1977           0 :         pField->SetStrictFormat( bStrict );
    1978           0 : }
    1979             : 
    1980           0 : sal_Bool SVTXCurrencyField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
    1981             : {
    1982           0 :     SolarMutexGuard aGuard;
    1983             : 
    1984           0 :     FormattedField* pField = GetFormattedField();
    1985           0 :     return pField ? pField->IsStrictFormat() : sal_False;
    1986             : }
    1987             : 
    1988        1554 : void SVTXCurrencyField::setProperty( const OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
    1989             : {
    1990        1554 :     SolarMutexGuard aGuard;
    1991             : 
    1992        3108 :     ::com::sun::star::uno::Any aReturn;
    1993             : 
    1994        1554 :     DoubleCurrencyField* pField = (DoubleCurrencyField*)GetFormattedField();
    1995        1554 :     if ( pField )
    1996             :     {
    1997        1554 :         sal_uInt16 nPropType = GetPropertyId( PropertyName );
    1998        1554 :         switch (nPropType)
    1999             :         {
    2000             :             case BASEPROPERTY_CURRENCYSYMBOL:
    2001             :             {
    2002          25 :                 OUString aStr;
    2003          25 :                 Value >>= aStr;
    2004          25 :                 pField->setCurrencySymbol( aStr );
    2005             :             }
    2006          25 :             break;
    2007             :             case BASEPROPERTY_CURSYM_POSITION:
    2008             :             {
    2009          25 :                 sal_Bool b = false;
    2010          25 :                 Value >>= b;
    2011          25 :                 pField->setPrependCurrSym(b);
    2012             :             }
    2013          25 :             break;
    2014             : 
    2015             :             default:
    2016        1504 :                 SVTXFormattedField::setProperty(PropertyName, Value);
    2017             :         }
    2018             :     }
    2019             :     else
    2020        1554 :         SVTXFormattedField::setProperty(PropertyName, Value);
    2021        1554 : }
    2022             : 
    2023           0 : ::com::sun::star::uno::Any SVTXCurrencyField::getProperty( const OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
    2024             : {
    2025           0 :     SolarMutexGuard aGuard;
    2026             : 
    2027           0 :     ::com::sun::star::uno::Any aReturn;
    2028             : 
    2029           0 :     DoubleCurrencyField* pField = (DoubleCurrencyField*)GetFormattedField();
    2030           0 :     if ( pField )
    2031             :     {
    2032           0 :         sal_uInt16 nPropType = GetPropertyId( PropertyName );
    2033           0 :         switch (nPropType)
    2034             :         {
    2035             :             case BASEPROPERTY_CURRENCYSYMBOL:
    2036             :             {
    2037           0 :                 aReturn <<= OUString( pField->getCurrencySymbol() );
    2038             :             }
    2039           0 :             break;
    2040             :             case BASEPROPERTY_CURSYM_POSITION:
    2041             :             {
    2042           0 :                 aReturn <<= pField->getPrependCurrSym();
    2043             :             }
    2044           0 :             break;
    2045             :             default:
    2046           0 :                 return SVTXFormattedField::getProperty(PropertyName);
    2047             :         }
    2048             :     }
    2049           0 :     return SVTXFormattedField::getProperty(PropertyName);
    2050             : }
    2051             : 
    2052           0 : void SVTXCurrencyField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
    2053             : {
    2054             :     PushPropertyIds( rIds,
    2055             :                      BASEPROPERTY_CURRENCYSYMBOL,
    2056             :                      BASEPROPERTY_CURSYM_POSITION,
    2057           0 :                      0);
    2058           0 :     SVTXFormattedField::ImplGetPropertyIds( rIds );
    2059           0 : }
    2060             : 
    2061             : 
    2062             : //  ----------------------------------------------------
    2063             : //  class VCLXProgressBar
    2064             : //  ----------------------------------------------------
    2065             : 
    2066           0 : VCLXProgressBar::VCLXProgressBar()
    2067             :             :m_nValue(0)
    2068             :             ,m_nValueMin(0)
    2069           0 :             ,m_nValueMax(100)
    2070             : {
    2071           0 : }
    2072             : 
    2073           0 : VCLXProgressBar::~VCLXProgressBar()
    2074             : {
    2075           0 : }
    2076             : 
    2077           0 : void VCLXProgressBar::ImplUpdateValue()
    2078             : {
    2079           0 :     ProgressBar* pProgressBar = (ProgressBar*) GetWindow();
    2080           0 :     if ( pProgressBar )
    2081             :     {
    2082             :         sal_Int32 nVal;
    2083             :         sal_Int32 nValMin;
    2084             :         sal_Int32 nValMax;
    2085             : 
    2086             :         // check min and max
    2087           0 :         if (m_nValueMin < m_nValueMax)
    2088             :         {
    2089           0 :             nValMin = m_nValueMin;
    2090           0 :             nValMax = m_nValueMax;
    2091             :         }
    2092             :         else
    2093             :         {
    2094           0 :             nValMin = m_nValueMax;
    2095           0 :             nValMax = m_nValueMin;
    2096             :         }
    2097             : 
    2098             :         // check value
    2099           0 :         if (m_nValue < nValMin)
    2100             :         {
    2101           0 :             nVal = nValMin;
    2102             :         }
    2103           0 :         else if (m_nValue > nValMax)
    2104             :         {
    2105           0 :             nVal = nValMax;
    2106             :         }
    2107             :         else
    2108             :         {
    2109           0 :             nVal = m_nValue;
    2110             :         }
    2111             : 
    2112             :         // calculate percent
    2113             :         sal_Int32 nPercent;
    2114           0 :         if (nValMin != nValMax)
    2115             :         {
    2116           0 :             nPercent = 100 * (nVal - nValMin) / (nValMax - nValMin);
    2117             :         }
    2118             :         else
    2119             :         {
    2120           0 :             nPercent = 0;
    2121             :         }
    2122             : 
    2123             :         // set progressbar value
    2124           0 :         pProgressBar->SetValue( (sal_uInt16) nPercent );
    2125             :     }
    2126           0 : }
    2127             : 
    2128             : // ::com::sun::star::uno::XInterface
    2129           0 : ::com::sun::star::uno::Any VCLXProgressBar::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
    2130             : {
    2131             :     ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
    2132             :                                         (static_cast< ::com::sun::star::awt::XProgressBar* >(this)),
    2133           0 :                                         (static_cast< ::com::sun::star::lang::XTypeProvider* >(this)) );
    2134           0 :     return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
    2135             : }
    2136             : 
    2137             : // ::com::sun::star::lang::XTypeProvider
    2138           0 : IMPL_XTYPEPROVIDER_START( VCLXProgressBar )
    2139           0 :     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XProgressBar>* ) NULL ),
    2140             :     VCLXWindow::getTypes()
    2141           0 : IMPL_XTYPEPROVIDER_END
    2142             : 
    2143             : // ::com::sun::star::awt::XProgressBar
    2144           0 : void VCLXProgressBar::setForegroundColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
    2145             : {
    2146           0 :     SolarMutexGuard aGuard;
    2147             : 
    2148           0 :     Window* pWindow = GetWindow();
    2149           0 :     if ( pWindow )
    2150             :     {
    2151           0 :         Color aColor( nColor );
    2152           0 :         pWindow->SetControlForeground( aColor );
    2153           0 :     }
    2154           0 : }
    2155             : 
    2156           0 : void VCLXProgressBar::setBackgroundColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
    2157             : {
    2158           0 :     SolarMutexGuard aGuard;
    2159             : 
    2160           0 :     Window* pWindow = GetWindow();
    2161           0 :     if ( pWindow )
    2162             :     {
    2163           0 :         Color aColor( nColor );
    2164           0 :         pWindow->SetBackground( aColor );
    2165           0 :         pWindow->SetControlBackground( aColor );
    2166           0 :         pWindow->Invalidate();
    2167           0 :     }
    2168           0 : }
    2169             : 
    2170           0 : void VCLXProgressBar::setValue( sal_Int32 nValue ) throw(::com::sun::star::uno::RuntimeException)
    2171             : {
    2172           0 :     SolarMutexGuard aGuard;
    2173             : 
    2174           0 :     m_nValue = nValue;
    2175           0 :     ImplUpdateValue();
    2176           0 : }
    2177             : 
    2178           0 : void VCLXProgressBar::setRange( sal_Int32 nMin, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException )
    2179             : {
    2180           0 :     SolarMutexGuard aGuard;
    2181             : 
    2182           0 :     if ( nMin < nMax )
    2183             :     {
    2184             :         // take correct min and max
    2185           0 :         m_nValueMin = nMin;
    2186           0 :         m_nValueMax = nMax;
    2187             :     }
    2188             :     else
    2189             :     {
    2190             :         // change min and max
    2191           0 :         m_nValueMin = nMax;
    2192           0 :         m_nValueMax = nMin;
    2193             :     }
    2194             : 
    2195           0 :     ImplUpdateValue();
    2196           0 : }
    2197             : 
    2198           0 : sal_Int32 VCLXProgressBar::getValue() throw(::com::sun::star::uno::RuntimeException)
    2199             : {
    2200           0 :     SolarMutexGuard aGuard;
    2201             : 
    2202           0 :     return m_nValue;
    2203             : }
    2204             : 
    2205             : // ::com::sun::star::awt::VclWindowPeer
    2206           0 : void VCLXProgressBar::setProperty( const OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
    2207             : {
    2208           0 :     SolarMutexGuard aGuard;
    2209             : 
    2210           0 :     ProgressBar* pProgressBar = (ProgressBar*)GetWindow();
    2211           0 :     if ( pProgressBar )
    2212             :     {
    2213           0 :         sal_uInt16 nPropType = GetPropertyId( PropertyName );
    2214           0 :         switch ( nPropType )
    2215             :         {
    2216             :             case BASEPROPERTY_PROGRESSVALUE:
    2217             :             {
    2218           0 :                 if ( Value >>= m_nValue )
    2219           0 :                     ImplUpdateValue();
    2220             :             }
    2221           0 :             break;
    2222             :             case BASEPROPERTY_PROGRESSVALUE_MIN:
    2223             :             {
    2224           0 :                 if ( Value >>= m_nValueMin )
    2225           0 :                     ImplUpdateValue();
    2226             :             }
    2227           0 :             break;
    2228             :             case BASEPROPERTY_PROGRESSVALUE_MAX:
    2229             :             {
    2230           0 :                 if ( Value >>= m_nValueMax )
    2231           0 :                     ImplUpdateValue();
    2232             :             }
    2233           0 :             break;
    2234             :             case BASEPROPERTY_FILLCOLOR:
    2235             :             {
    2236           0 :                 Window* pWindow = GetWindow();
    2237           0 :                 if ( pWindow )
    2238             :                 {
    2239           0 :                     sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
    2240             : 
    2241           0 :                     if ( bVoid )
    2242             :                     {
    2243           0 :                         pWindow->SetControlForeground();
    2244             :                     }
    2245             :                     else
    2246             :                     {
    2247           0 :                         sal_Int32 nColor = 0;
    2248           0 :                         if ( Value >>= nColor )
    2249             :                         {
    2250           0 :                             Color aColor( nColor );
    2251           0 :                             pWindow->SetControlForeground( aColor );
    2252             :                         }
    2253             :                     }
    2254             :                 }
    2255             :             }
    2256           0 :             break;
    2257             :             default:
    2258           0 :                 VCLXWindow::setProperty( PropertyName, Value );
    2259           0 :                 break;
    2260             :         }
    2261           0 :     }
    2262           0 : }
    2263             : 
    2264           0 : ::com::sun::star::uno::Any VCLXProgressBar::getProperty( const OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
    2265             : {
    2266           0 :     SolarMutexGuard aGuard;
    2267             : 
    2268           0 :     ::com::sun::star::uno::Any aProp;
    2269           0 :     ProgressBar* pProgressBar = (ProgressBar*)GetWindow();
    2270           0 :     if ( pProgressBar )
    2271             :     {
    2272           0 :         sal_uInt16 nPropType = GetPropertyId( PropertyName );
    2273           0 :         switch ( nPropType )
    2274             :         {
    2275             :             case BASEPROPERTY_PROGRESSVALUE:
    2276             :             {
    2277           0 :                  aProp <<= m_nValue;
    2278             :             }
    2279           0 :             break;
    2280             :             case BASEPROPERTY_PROGRESSVALUE_MIN:
    2281             :             {
    2282           0 :                  aProp <<= m_nValueMin;
    2283             :             }
    2284           0 :             break;
    2285             :             case BASEPROPERTY_PROGRESSVALUE_MAX:
    2286             :             {
    2287           0 :                  aProp <<= m_nValueMax;
    2288             :             }
    2289           0 :             break;
    2290             :             default:
    2291           0 :                 aProp <<= VCLXWindow::getProperty( PropertyName );
    2292           0 :                 break;
    2293             :         }
    2294             :     }
    2295           0 :     return aProp;
    2296             : }
    2297             : 
    2298           0 : void VCLXProgressBar::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
    2299             : {
    2300             :     PushPropertyIds( rIds,
    2301             :                      BASEPROPERTY_PROGRESSVALUE,
    2302             :                      BASEPROPERTY_PROGRESSVALUE_MIN,
    2303             :                      BASEPROPERTY_PROGRESSVALUE_MAX,
    2304             :                      BASEPROPERTY_FILLCOLOR,
    2305           0 :                      0);
    2306           0 :     VCLXWindow::ImplGetPropertyIds( rIds, true );
    2307           0 : }
    2308             : 
    2309             : 
    2310             : //  ----------------------------------------------------
    2311             : //  class SVTXDateField
    2312             : //  ----------------------------------------------------
    2313          27 : SVTXDateField::SVTXDateField()
    2314          27 :     :VCLXDateField()
    2315             : {
    2316          27 : }
    2317             : 
    2318          54 : SVTXDateField::~SVTXDateField()
    2319             : {
    2320          54 : }
    2321             : 
    2322        2177 : void SAL_CALL SVTXDateField::setProperty( const OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException)
    2323             : {
    2324        2177 :     VCLXDateField::setProperty( PropertyName, Value );
    2325             : 
    2326             :     // some properties need to be forwarded to the sub edit, too
    2327        2177 :     Edit* pSubEdit = GetWindow() ? static_cast< Edit* >( GetWindow() )->GetSubEdit() : NULL;
    2328        2177 :     if ( !pSubEdit )
    2329        3132 :         return;
    2330             : 
    2331        1222 :     switch ( GetPropertyId( PropertyName ) )
    2332             :     {
    2333             :     case BASEPROPERTY_TEXTLINECOLOR:
    2334          14 :         if ( !Value.hasValue() )
    2335          14 :             pSubEdit->SetTextLineColor();
    2336             :         else
    2337             :         {
    2338           0 :             sal_Int32 nColor = 0;
    2339           0 :             if ( Value >>= nColor )
    2340           0 :                 pSubEdit->SetTextLineColor( Color( nColor ) );
    2341             :         }
    2342          14 :         break;
    2343             :     }
    2344             : }
    2345             : 
    2346           0 : void SVTXDateField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
    2347             : {
    2348             :     PushPropertyIds( rIds,
    2349             :                      BASEPROPERTY_TEXTLINECOLOR,
    2350           0 :                      0);
    2351           0 :     VCLXDateField::ImplGetPropertyIds( rIds );
    2352         465 : }
    2353             : 
    2354             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10