LCOV - code coverage report
Current view: top level - libreoffice/extensions/source/propctrlr - propertyhandler.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 187 0.0 %
Date: 2012-12-17 Functions: 0 39 0.0 %
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             : #include "propertyhandler.hxx"
      21             : #include "formmetadata.hxx"
      22             : #include "formbrowsertools.hxx"
      23             : #include "handlerhelper.hxx"
      24             : #include "formstrings.hxx"
      25             : 
      26             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      27             : #include <com/sun/star/lang/NullPointerException.hpp>
      28             : #include <com/sun/star/util/XModifiable.hpp>
      29             : #include <com/sun/star/script/Converter.hpp>
      30             : 
      31             : #include <tools/debug.hxx>
      32             : #include <unotools/confignode.hxx>
      33             : #include <unotools/localedatawrapper.hxx>
      34             : #include <unotools/syslocale.hxx>
      35             : #include <toolkit/helper/vclunohelper.hxx>
      36             : 
      37             : #include <algorithm>
      38             : 
      39             : //........................................................................
      40             : namespace pcr
      41             : {
      42             : //........................................................................
      43             : 
      44             :     using namespace ::com::sun::star::uno;
      45             :     using namespace ::com::sun::star::awt;
      46             :     using namespace ::com::sun::star::beans;
      47             :     using namespace ::com::sun::star::script;
      48             :     using namespace ::com::sun::star::lang;
      49             :     using namespace ::com::sun::star::util;
      50             :     using namespace ::com::sun::star::frame;
      51             :     using namespace ::com::sun::star::inspection;
      52             :     using namespace ::comphelper;
      53             : 
      54             :     //====================================================================
      55             :     //= PropertyHandler
      56             :     //====================================================================
      57             :     DBG_NAME( PropertyHandler )
      58             :     //--------------------------------------------------------------------
      59           0 :     PropertyHandler::PropertyHandler( const Reference< XComponentContext >& _rxContext )
      60             :         :PropertyHandler_Base( m_aMutex )
      61             :         ,m_bSupportedPropertiesAreKnown( false )
      62             :         ,m_aPropertyListeners( m_aMutex )
      63             :         ,m_aContext( _rxContext )
      64           0 :         ,m_pInfoService  ( new OPropertyInfoService )
      65             :     {
      66             :         DBG_CTOR( PropertyHandler, NULL );
      67             : 
      68           0 :         m_xTypeConverter = Converter::create(_rxContext);
      69           0 :     }
      70             : 
      71             :     //--------------------------------------------------------------------
      72           0 :     PropertyHandler::~PropertyHandler()
      73             :     {
      74             :         DBG_DTOR( PropertyHandler, NULL );
      75           0 :     }
      76             : 
      77             :     //--------------------------------------------------------------------
      78           0 :     void SAL_CALL PropertyHandler::inspect( const Reference< XInterface >& _rxIntrospectee ) throw (RuntimeException, NullPointerException)
      79             :     {
      80           0 :         if ( !_rxIntrospectee.is() )
      81           0 :             throw NullPointerException();
      82             : 
      83           0 :         ::osl::MutexGuard aGuard( m_aMutex );
      84             : 
      85           0 :         Reference< XPropertySet > xNewComponent( _rxIntrospectee, UNO_QUERY );
      86           0 :         if ( xNewComponent == m_xComponent )
      87           0 :             return;
      88             : 
      89             :         // remove all old property change listeners
      90             :         SAL_WNODEPRECATED_DECLARATIONS_PUSH
      91           0 :         ::std::auto_ptr< ::cppu::OInterfaceIteratorHelper > removeListener = m_aPropertyListeners.createIterator();
      92           0 :         ::std::auto_ptr< ::cppu::OInterfaceIteratorHelper > readdListener = m_aPropertyListeners.createIterator();  // will copy the container as needed
      93             :         SAL_WNODEPRECATED_DECLARATIONS_POP
      94           0 :         while ( removeListener->hasMoreElements() )
      95           0 :             removePropertyChangeListener( static_cast< XPropertyChangeListener* >( removeListener->next() ) );
      96             :         OSL_ENSURE( m_aPropertyListeners.empty(), "PropertyHandler::inspect: derived classes are expected to forward the removePropertyChangeListener call to their base class (me)!" );
      97             : 
      98             :         // remember the new component, and give derived classes the chance to react on it
      99           0 :         m_xComponent = xNewComponent;
     100           0 :         onNewComponent();
     101             : 
     102             :         // add the listeners, again
     103           0 :         while ( readdListener->hasMoreElements() )
     104           0 :             addPropertyChangeListener( static_cast< XPropertyChangeListener* >( readdListener->next() ) );
     105             :     }
     106             : 
     107             :     //--------------------------------------------------------------------
     108           0 :     void PropertyHandler::onNewComponent()
     109             :     {
     110           0 :         if ( m_xComponent.is() )
     111           0 :             m_xComponentPropertyInfo = m_xComponent->getPropertySetInfo();
     112             :         else
     113           0 :             m_xComponentPropertyInfo.clear();
     114             : 
     115           0 :         m_bSupportedPropertiesAreKnown = false;
     116           0 :         m_aSupportedProperties.realloc( 0 );
     117           0 :     }
     118             : 
     119             :     //--------------------------------------------------------------------
     120           0 :     Sequence< Property > SAL_CALL PropertyHandler::getSupportedProperties() throw (RuntimeException)
     121             :     {
     122           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     123           0 :         if ( !m_bSupportedPropertiesAreKnown )
     124             :         {
     125           0 :             m_aSupportedProperties = doDescribeSupportedProperties();
     126           0 :             m_bSupportedPropertiesAreKnown = true;
     127             :         }
     128           0 :         return (Sequence< Property >)m_aSupportedProperties;
     129             :     }
     130             : 
     131             :     //--------------------------------------------------------------------
     132           0 :     Sequence< ::rtl::OUString > SAL_CALL PropertyHandler::getSupersededProperties( ) throw (RuntimeException)
     133             :     {
     134           0 :         return Sequence< ::rtl::OUString >();
     135             :     }
     136             : 
     137             :     //--------------------------------------------------------------------
     138           0 :     Sequence< ::rtl::OUString > SAL_CALL PropertyHandler::getActuatingProperties( ) throw (RuntimeException)
     139             :     {
     140           0 :         return Sequence< ::rtl::OUString >();
     141             :     }
     142             : 
     143             :     //--------------------------------------------------------------------
     144           0 :     Any SAL_CALL PropertyHandler::convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rControlValue ) throw (UnknownPropertyException, RuntimeException)
     145             :     {
     146           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     147           0 :         PropertyId nPropId = m_pInfoService->getPropertyId( _rPropertyName );
     148           0 :         Property aProperty( impl_getPropertyFromName_throw( _rPropertyName ) );
     149             : 
     150           0 :         Any aPropertyValue;
     151           0 :         if ( !_rControlValue.hasValue() )
     152             :             // NULL is converted to NULL
     153             :             return aPropertyValue;
     154             : 
     155           0 :         if ( ( m_pInfoService->getPropertyUIFlags( nPropId ) & PROP_FLAG_ENUM ) != 0 )
     156             :         {
     157           0 :             ::rtl::OUString sControlValue;
     158           0 :             OSL_VERIFY( _rControlValue >>= sControlValue );
     159             :             ::rtl::Reference< IPropertyEnumRepresentation > aEnumConversion(
     160           0 :                 new DefaultEnumRepresentation( *m_pInfoService, aProperty.Type, nPropId ) );
     161             :             // TODO/UNOize: cache those converters?
     162           0 :             aEnumConversion->getValueFromDescription( sControlValue, aPropertyValue );
     163             :         }
     164             :         else
     165             :             aPropertyValue = PropertyHandlerHelper::convertToPropertyValue(
     166           0 :                 m_aContext.getContext(),m_xTypeConverter, aProperty, _rControlValue );
     167           0 :         return aPropertyValue;
     168             :     }
     169             : 
     170             :     //--------------------------------------------------------------------
     171           0 :     Any SAL_CALL PropertyHandler::convertToControlValue( const ::rtl::OUString& _rPropertyName, const Any& _rPropertyValue, const Type& _rControlValueType ) throw (UnknownPropertyException, RuntimeException)
     172             :     {
     173           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     174           0 :         PropertyId nPropId = m_pInfoService->getPropertyId( _rPropertyName );
     175             : 
     176           0 :         if ( ( m_pInfoService->getPropertyUIFlags( nPropId ) & PROP_FLAG_ENUM ) != 0 )
     177             :         {
     178             :             DBG_ASSERT( _rControlValueType.getTypeClass() == TypeClass_STRING, "PropertyHandler::convertToControlValue: ENUM, but not STRING?" );
     179             : 
     180             :             ::rtl::Reference< IPropertyEnumRepresentation > aEnumConversion(
     181           0 :                 new DefaultEnumRepresentation( *m_pInfoService, _rPropertyValue.getValueType(), nPropId ) );
     182             :             // TODO/UNOize: cache those converters?
     183           0 :             return makeAny( aEnumConversion->getDescriptionForValue( _rPropertyValue ) );
     184             :         }
     185             : 
     186             :         return PropertyHandlerHelper::convertToControlValue(
     187           0 :             m_aContext.getContext(),m_xTypeConverter, _rPropertyValue, _rControlValueType );
     188             :     }
     189             : 
     190             :     //--------------------------------------------------------------------
     191           0 :     PropertyState SAL_CALL PropertyHandler::getPropertyState( const ::rtl::OUString& /*_rPropertyName*/ ) throw (UnknownPropertyException, RuntimeException)
     192             :     {
     193           0 :         return PropertyState_DIRECT_VALUE;
     194             :     }
     195             : 
     196             :     //--------------------------------------------------------------------
     197           0 :     LineDescriptor SAL_CALL PropertyHandler::describePropertyLine( const ::rtl::OUString& _rPropertyName,
     198             :         const Reference< XPropertyControlFactory >& _rxControlFactory )
     199             :         throw (UnknownPropertyException, NullPointerException, RuntimeException)
     200             :     {
     201           0 :         if ( !_rxControlFactory.is() )
     202           0 :             throw NullPointerException();
     203             : 
     204           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     205           0 :         PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
     206           0 :         const Property& rProperty( impl_getPropertyFromId_throw( nPropId ) );
     207             : 
     208           0 :         LineDescriptor aDescriptor;
     209           0 :         if ( ( m_pInfoService->getPropertyUIFlags( nPropId ) & PROP_FLAG_ENUM ) != 0 )
     210             :         {
     211             :             aDescriptor.Control = PropertyHandlerHelper::createListBoxControl(
     212           0 :                 _rxControlFactory, m_pInfoService->getPropertyEnumRepresentations( nPropId ),
     213           0 :                 PropertyHandlerHelper::requiresReadOnlyControl( rProperty.Attributes ), sal_False );
     214             :         }
     215             :         else
     216           0 :             PropertyHandlerHelper::describePropertyLine( rProperty, aDescriptor, _rxControlFactory );
     217             : 
     218           0 :         aDescriptor.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId( nPropId ) );
     219           0 :         aDescriptor.DisplayName = m_pInfoService->getPropertyTranslation( nPropId );
     220             : 
     221           0 :         if ( ( m_pInfoService->getPropertyUIFlags( nPropId ) & PROP_FLAG_DATA_PROPERTY ) != 0 )
     222           0 :             aDescriptor.Category = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Data" ) );
     223             :         else
     224           0 :             aDescriptor.Category = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "General" ) );
     225           0 :         return aDescriptor;
     226             :     }
     227             : 
     228             :     //--------------------------------------------------------------------
     229           0 :     ::sal_Bool SAL_CALL PropertyHandler::isComposable( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException)
     230             :     {
     231           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     232           0 :         return m_pInfoService->isComposeable( _rPropertyName );
     233             :     }
     234             : 
     235             :     //--------------------------------------------------------------------
     236           0 :     InteractiveSelectionResult SAL_CALL PropertyHandler::onInteractivePropertySelection( const ::rtl::OUString& /*_rPropertyName*/, sal_Bool /*_bPrimary*/, Any& /*_rData*/, const Reference< XObjectInspectorUI >& /*_rxInspectorUI*/ ) throw (UnknownPropertyException, NullPointerException, RuntimeException)
     237             :     {
     238             :         OSL_FAIL( "PropertyHandler::onInteractivePropertySelection: not implemented!" );
     239           0 :         return InteractiveSelectionResult_Cancelled;
     240             :     }
     241             : 
     242             :     //--------------------------------------------------------------------
     243           0 :     void SAL_CALL PropertyHandler::actuatingPropertyChanged( const ::rtl::OUString& /*_rActuatingPropertyName*/, const Any& /*_rNewValue*/, const Any& /*_rOldValue*/, const Reference< XObjectInspectorUI >& /*_rxInspectorUI*/, sal_Bool /*_bFirstTimeInit*/ ) throw (NullPointerException, RuntimeException)
     244             :     {
     245             :         OSL_FAIL( "PropertyHandler::actuatingPropertyChanged: not implemented!" );
     246           0 :     }
     247             : 
     248             :     //--------------------------------------------------------------------
     249           0 :     void SAL_CALL PropertyHandler::addPropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException)
     250             :     {
     251           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     252           0 :         if ( !_rxListener.is() )
     253           0 :             throw NullPointerException();
     254           0 :         m_aPropertyListeners.addListener( _rxListener );
     255           0 :     }
     256             : 
     257             :     //--------------------------------------------------------------------
     258           0 :     void SAL_CALL PropertyHandler::removePropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException)
     259             :     {
     260           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     261           0 :         m_aPropertyListeners.removeListener( _rxListener );
     262           0 :     }
     263             : 
     264             :     //--------------------------------------------------------------------
     265           0 :     sal_Bool SAL_CALL PropertyHandler::suspend( sal_Bool /*_bSuspend*/ ) throw (RuntimeException)
     266             :     {
     267           0 :         return sal_True;
     268             :     }
     269             : 
     270             :     //--------------------------------------------------------------------
     271           0 :     IMPLEMENT_FORWARD_XCOMPONENT( PropertyHandler, PropertyHandler_Base )
     272             :     //--------------------------------------------------------------------
     273           0 :     void SAL_CALL PropertyHandler::disposing()
     274             :     {
     275           0 :         m_xComponent.clear();
     276           0 :         m_aPropertyListeners.clear();
     277           0 :         m_xTypeConverter.clear();
     278           0 :         m_aSupportedProperties.realloc( 0 );
     279           0 :     }
     280             : 
     281             :     //--------------------------------------------------------------------
     282           0 :     void PropertyHandler::firePropertyChange( const ::rtl::OUString& _rPropName, PropertyId _nPropId, const Any& _rOldValue, const Any& _rNewValue ) SAL_THROW(())
     283             :     {
     284           0 :         PropertyChangeEvent aEvent;
     285           0 :         aEvent.Source = m_xComponent;
     286           0 :         aEvent.PropertyHandle = _nPropId;
     287           0 :         aEvent.PropertyName = _rPropName;
     288           0 :         aEvent.OldValue = _rOldValue;
     289           0 :         aEvent.NewValue = _rNewValue;
     290           0 :         m_aPropertyListeners.notify( aEvent, &XPropertyChangeListener::propertyChange );
     291           0 :     }
     292             : 
     293             :     //--------------------------------------------------------------------
     294           0 :     const Property* PropertyHandler::impl_getPropertyFromId_nothrow( PropertyId _nPropId ) const
     295             :     {
     296           0 :         const_cast< PropertyHandler* >( this )->getSupportedProperties();
     297             :         const Property* pFound = ::std::find_if( m_aSupportedProperties.begin(), m_aSupportedProperties.end(),
     298             :             FindPropertyByHandle( _nPropId )
     299           0 :         );
     300           0 :         if ( pFound != m_aSupportedProperties.end() )
     301           0 :             return &(*pFound);
     302           0 :         return NULL;
     303             :     }
     304             : 
     305             :     //--------------------------------------------------------------------
     306           0 :     const Property& PropertyHandler::impl_getPropertyFromId_throw( PropertyId _nPropId ) const
     307             :     {
     308           0 :         const Property* pProperty = impl_getPropertyFromId_nothrow( _nPropId );
     309           0 :         if ( !pProperty )
     310           0 :             throw UnknownPropertyException();
     311             : 
     312           0 :         return *pProperty;
     313             :     }
     314             : 
     315             :     //--------------------------------------------------------------------
     316           0 :     const Property& PropertyHandler::impl_getPropertyFromName_throw( const ::rtl::OUString& _rPropertyName ) const
     317             :     {
     318           0 :         const_cast< PropertyHandler* >( this )->getSupportedProperties();
     319             :         StlSyntaxSequence< Property >::const_iterator pFound = ::std::find_if( m_aSupportedProperties.begin(), m_aSupportedProperties.end(),
     320             :             FindPropertyByName( _rPropertyName )
     321           0 :         );
     322           0 :         if ( pFound == m_aSupportedProperties.end() )
     323           0 :             throw UnknownPropertyException();
     324             : 
     325           0 :         return *pFound;
     326             :     }
     327             : 
     328             :     //--------------------------------------------------------------------
     329           0 :     void PropertyHandler::implAddPropertyDescription( ::std::vector< Property >& _rProperties, const ::rtl::OUString& _rPropertyName, const Type& _rType, sal_Int16 _nAttribs ) const
     330             :     {
     331             :         _rProperties.push_back( Property(
     332             :             _rPropertyName,
     333           0 :             m_pInfoService->getPropertyId( _rPropertyName ),
     334             :             _rType,
     335             :             _nAttribs
     336           0 :         ) );
     337           0 :     }
     338             : 
     339             :     //------------------------------------------------------------------------
     340           0 :     Window* PropertyHandler::impl_getDefaultDialogParent_nothrow() const
     341             :     {
     342           0 :         return PropertyHandlerHelper::getDialogParentWindow( m_aContext );
     343             :     }
     344             : 
     345             :     //------------------------------------------------------------------------
     346           0 :     PropertyId PropertyHandler::impl_getPropertyId_throw( const ::rtl::OUString& _rPropertyName ) const
     347             :     {
     348           0 :         PropertyId nPropId = m_pInfoService->getPropertyId( _rPropertyName );
     349           0 :         if ( nPropId == -1 )
     350           0 :             throw UnknownPropertyException();
     351           0 :         return nPropId;
     352             :     }
     353             : 
     354             :     //------------------------------------------------------------------------
     355           0 :     void PropertyHandler::impl_setContextDocumentModified_nothrow() const
     356             :     {
     357           0 :         Reference< XModifiable > xModifiable( impl_getContextDocument_nothrow(), UNO_QUERY );
     358           0 :         if ( xModifiable.is() )
     359           0 :             xModifiable->setModified( sal_True );
     360           0 :     }
     361             : 
     362             :     //------------------------------------------------------------------------
     363           0 :     bool PropertyHandler::impl_componentHasProperty_throw( const ::rtl::OUString& _rPropName ) const
     364             :     {
     365           0 :         return m_xComponentPropertyInfo.is() && m_xComponentPropertyInfo->hasPropertyByName( _rPropName );
     366             :     }
     367             : 
     368             :     //--------------------------------------------------------------------
     369           0 :     sal_Int16 PropertyHandler::impl_getDocumentMeasurementUnit_throw() const
     370             :     {
     371           0 :         FieldUnit eUnit = FUNIT_NONE;
     372             : 
     373           0 :         Reference< XServiceInfo > xDocumentSI( impl_getContextDocument_nothrow(), UNO_QUERY );
     374             :         OSL_ENSURE( xDocumentSI.is(), "PropertyHandlerHelper::impl_getDocumentMeasurementUnit_throw: No context document - where do I live?" );
     375           0 :         if ( xDocumentSI.is() )
     376             :         {
     377             :             // determine the application type we live in
     378           0 :             ::rtl::OUString sConfigurationLocation;
     379           0 :             ::rtl::OUString sConfigurationProperty;
     380           0 :             if ( xDocumentSI->supportsService( SERVICE_WEB_DOCUMENT ) )
     381             :             {   // writer
     382           0 :                 sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.WriterWeb/Layout/Other" ) );
     383           0 :                 sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MeasureUnit" ) );
     384             :             }
     385           0 :             else if ( xDocumentSI->supportsService( SERVICE_TEXT_DOCUMENT ) )
     386             :             {   // writer
     387           0 :                 sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Writer/Layout/Other" ) );
     388           0 :                 sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MeasureUnit" ) );
     389             :             }
     390           0 :             else if ( xDocumentSI->supportsService( SERVICE_SPREADSHEET_DOCUMENT ) )
     391             :             {   // calc
     392           0 :                 sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Calc/Layout/Other/MeasureUnit" ) );
     393           0 :                 sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) );
     394             :             }
     395           0 :             else if ( xDocumentSI->supportsService( SERVICE_DRAWING_DOCUMENT ) )
     396             :             {
     397           0 :                 sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Draw/Layout/Other/MeasureUnit" ) );
     398           0 :                 sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) );
     399             :             }
     400           0 :             else if ( xDocumentSI->supportsService( SERVICE_PRESENTATION_DOCUMENT ) )
     401             :             {
     402           0 :                 sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Impress/Layout/Other/MeasureUnit" ) );
     403           0 :                 sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) );
     404             :             }
     405             : 
     406             :             // read the measurement unit from the configuration
     407           0 :             if ( !(sConfigurationLocation.isEmpty() || sConfigurationProperty.isEmpty()) )
     408             :             {
     409             :                 ::utl::OConfigurationTreeRoot aConfigTree( ::utl::OConfigurationTreeRoot::createWithServiceFactory(
     410           0 :                     m_aContext.getLegacyServiceFactory(), sConfigurationLocation, -1, ::utl::OConfigurationTreeRoot::CM_READONLY ) );
     411           0 :                 sal_Int32 nUnitAsInt = (sal_Int32)FUNIT_NONE;
     412           0 :                 aConfigTree.getNodeValue( sConfigurationProperty ) >>= nUnitAsInt;
     413             : 
     414             :                 // if this denotes a valid (and accepted) unit, then use it
     415           0 :                 if  ( ( nUnitAsInt > FUNIT_NONE ) && ( nUnitAsInt <= FUNIT_100TH_MM ) )
     416           0 :                     eUnit = static_cast< FieldUnit >( nUnitAsInt );
     417           0 :             }
     418             :         }
     419             : 
     420           0 :         if ( FUNIT_NONE == eUnit )
     421             :         {
     422           0 :             MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
     423           0 :             eUnit = MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH;
     424             :         }
     425             : 
     426           0 :         return VCLUnoHelper::ConvertToMeasurementUnit( eUnit, 1 );
     427             :     }
     428             : 
     429             :     //====================================================================
     430             :     //= PropertyHandlerComponent
     431             :     //====================================================================
     432             :     //------------------------------------------------------------------------
     433           0 :     PropertyHandlerComponent::PropertyHandlerComponent( const Reference< XComponentContext >& _rxContext )
     434           0 :         :PropertyHandler( _rxContext )
     435             :     {
     436           0 :     }
     437             : 
     438             :     //--------------------------------------------------------------------
     439           0 :     IMPLEMENT_FORWARD_XINTERFACE2( PropertyHandlerComponent, PropertyHandler, PropertyHandlerComponent_Base )
     440           0 :     IMPLEMENT_FORWARD_XTYPEPROVIDER2( PropertyHandlerComponent, PropertyHandler, PropertyHandlerComponent_Base )
     441             : 
     442             :     //--------------------------------------------------------------------
     443           0 :     ::sal_Bool SAL_CALL PropertyHandlerComponent::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException)
     444             :     {
     445           0 :         StlSyntaxSequence< ::rtl::OUString > aAllServices( getSupportedServiceNames() );
     446           0 :         return ::std::find( aAllServices.begin(), aAllServices.end(), ServiceName ) != aAllServices.end();
     447             :     }
     448             : 
     449             : //........................................................................
     450             : }   // namespace pcr
     451             : //........................................................................
     452             : 
     453             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10