LCOV - code coverage report
Current view: top level - libreoffice/forms/source/component - formcontrolfont.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 130 231 56.3 %
Date: 2012-12-27 Functions: 8 12 66.7 %
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 "formcontrolfont.hxx"
      21             : #include "property.hrc"
      22             : #include "property.hxx"
      23             : #include <comphelper/property.hxx>
      24             : #include <comphelper/types.hxx>
      25             : #include <tools/color.hxx>
      26             : #include <toolkit/helper/emptyfontdescriptor.hxx>
      27             : #include <com/sun/star/awt/FontRelief.hpp>
      28             : #include <com/sun/star/awt/FontEmphasisMark.hpp>
      29             : 
      30             : //.........................................................................
      31             : namespace frm
      32             : {
      33             : //.........................................................................
      34             : 
      35             :     using namespace ::comphelper;
      36             :     using namespace ::com::sun::star::uno;
      37             :     using namespace ::com::sun::star::awt;
      38             :     using namespace ::com::sun::star::lang;
      39             :     using namespace ::com::sun::star::beans;
      40             : 
      41             :     //------------------------------------------------------------------------------
      42             :     namespace
      43             :     {
      44          54 :         Any lcl_extractFontDescriptorAggregate( sal_Int32 _nHandle, const FontDescriptor& _rFont )
      45             :         {
      46          54 :             Any aValue;
      47          54 :             switch ( _nHandle )
      48             :             {
      49             :             case PROPERTY_ID_FONT_NAME:
      50           4 :                 aValue <<= _rFont.Name;
      51           4 :                 break;
      52             : 
      53             :             case PROPERTY_ID_FONT_STYLENAME:
      54           3 :                 aValue <<= _rFont.StyleName;
      55           3 :                 break;
      56             : 
      57             :             case PROPERTY_ID_FONT_FAMILY:
      58           3 :                 aValue <<= (sal_Int16)_rFont.Family;
      59           3 :                 break;
      60             : 
      61             :             case PROPERTY_ID_FONT_CHARSET:
      62           3 :                 aValue <<= (sal_Int16)_rFont.CharSet;
      63           3 :                 break;
      64             : 
      65             :             case PROPERTY_ID_FONT_CHARWIDTH:
      66           3 :                 aValue <<= _rFont.CharacterWidth;
      67           3 :                 break;
      68             : 
      69             :             case PROPERTY_ID_FONT_KERNING:
      70           3 :                 aValue <<= _rFont.Kerning;
      71           3 :                 break;
      72             : 
      73             :             case PROPERTY_ID_FONT_ORIENTATION:
      74           3 :                 aValue <<= _rFont.Orientation;
      75           3 :                 break;
      76             : 
      77             :             case PROPERTY_ID_FONT_PITCH:
      78           3 :                 aValue <<= _rFont.Pitch;
      79           3 :                 break;
      80             : 
      81             :             case PROPERTY_ID_FONT_TYPE:
      82           3 :                 aValue <<= _rFont.Type;
      83           3 :                 break;
      84             : 
      85             :             case PROPERTY_ID_FONT_WIDTH:
      86           3 :                 aValue <<= _rFont.Width;
      87           3 :                 break;
      88             : 
      89             :             case PROPERTY_ID_FONT_HEIGHT:
      90           4 :                 aValue <<= (float)( _rFont.Height );
      91           4 :                 break;
      92             : 
      93             :             case PROPERTY_ID_FONT_WEIGHT:
      94           4 :                 aValue <<= (float)_rFont.Weight;
      95           4 :                 break;
      96             : 
      97             :             case PROPERTY_ID_FONT_SLANT:
      98           4 :                 aValue = makeAny(_rFont.Slant);
      99           4 :                 break;
     100             : 
     101             :             case PROPERTY_ID_FONT_UNDERLINE:
     102           4 :                 aValue <<= (sal_Int16)_rFont.Underline;
     103           4 :                 break;
     104             : 
     105             :             case PROPERTY_ID_FONT_STRIKEOUT:
     106           4 :                 aValue <<= (sal_Int16)_rFont.Strikeout;
     107           4 :                 break;
     108             : 
     109             :             case PROPERTY_ID_FONT_WORDLINEMODE:
     110           3 :                 aValue = makeAny( (sal_Bool)_rFont.WordLineMode );
     111           3 :                 break;
     112             : 
     113             :             default:
     114             :                 OSL_FAIL( "lcl_extractFontDescriptorAggregate: invalid handle!" );
     115           0 :                 break;
     116             :             }
     117          54 :             return aValue;
     118             :         }
     119             :     }
     120             : 
     121             :     //=====================================================================
     122             :     //= FontControlModel
     123             :     //=====================================================================
     124             :     //---------------------------------------------------------------------
     125           2 :     FontControlModel::FontControlModel( bool _bToolkitCompatibleDefaults )
     126             :         :m_nFontRelief( FontRelief::NONE )
     127             :         ,m_nFontEmphasis( FontEmphasisMark::NONE )
     128           2 :         ,m_bToolkitCompatibleDefaults( _bToolkitCompatibleDefaults )
     129             :     {
     130           2 :     }
     131             : 
     132             :     //---------------------------------------------------------------------
     133           0 :     FontControlModel::FontControlModel( const FontControlModel* _pOriginal )
     134             :     {
     135           0 :         m_aFont = _pOriginal->m_aFont;
     136           0 :         m_nFontRelief = _pOriginal->m_nFontRelief;
     137           0 :         m_nFontEmphasis = _pOriginal->m_nFontEmphasis;
     138           0 :         m_aTextLineColor = _pOriginal->m_aTextLineColor;
     139           0 :         m_aTextColor = _pOriginal->m_aTextColor;
     140           0 :         m_bToolkitCompatibleDefaults = _pOriginal->m_bToolkitCompatibleDefaults;
     141           0 :     }
     142             : 
     143             :     //---------------------------------------------------------------------
     144          96 :     bool FontControlModel::isFontRelatedProperty( sal_Int32 _nPropertyHandle ) const
     145             :     {
     146          96 :         return isFontAggregateProperty( _nPropertyHandle )
     147             :             || ( _nPropertyHandle == PROPERTY_ID_FONT )
     148             :             || ( _nPropertyHandle == PROPERTY_ID_FONTEMPHASISMARK )
     149             :             || ( _nPropertyHandle == PROPERTY_ID_FONTRELIEF )
     150             :             || ( _nPropertyHandle == PROPERTY_ID_TEXTLINECOLOR )
     151          96 :             || ( _nPropertyHandle == PROPERTY_ID_TEXTCOLOR );
     152             :     }
     153             : 
     154             :     //---------------------------------------------------------------------
     155         106 :     bool FontControlModel::isFontAggregateProperty( sal_Int32 _nPropertyHandle ) const
     156             :     {
     157             :         return ( _nPropertyHandle == PROPERTY_ID_FONT_CHARWIDTH )
     158             :             || ( _nPropertyHandle == PROPERTY_ID_FONT_ORIENTATION )
     159             :             || ( _nPropertyHandle == PROPERTY_ID_FONT_WIDTH )
     160             :             || ( _nPropertyHandle == PROPERTY_ID_FONT_NAME )
     161             :             || ( _nPropertyHandle == PROPERTY_ID_FONT_STYLENAME )
     162             :             || ( _nPropertyHandle == PROPERTY_ID_FONT_FAMILY )
     163             :             || ( _nPropertyHandle == PROPERTY_ID_FONT_CHARSET )
     164             :             || ( _nPropertyHandle == PROPERTY_ID_FONT_HEIGHT )
     165             :             || ( _nPropertyHandle == PROPERTY_ID_FONT_WEIGHT )
     166             :             || ( _nPropertyHandle == PROPERTY_ID_FONT_SLANT )
     167             :             || ( _nPropertyHandle == PROPERTY_ID_FONT_UNDERLINE )
     168             :             || ( _nPropertyHandle == PROPERTY_ID_FONT_STRIKEOUT )
     169             :             || ( _nPropertyHandle == PROPERTY_ID_FONT_WORDLINEMODE )
     170             :             || ( _nPropertyHandle == PROPERTY_ID_FONT_PITCH )
     171             :             || ( _nPropertyHandle == PROPERTY_ID_FONT_KERNING )
     172         106 :             || ( _nPropertyHandle == PROPERTY_ID_FONT_TYPE );
     173             :     }
     174             : 
     175             :     //---------------------------------------------------------------------
     176           0 :     sal_Int32 FontControlModel::getTextColor( ) const
     177             :     {
     178           0 :         sal_Int32 nColor = COL_TRANSPARENT;
     179           0 :         m_aTextColor >>= nColor;
     180           0 :         return nColor;
     181             :     }
     182             : 
     183             :     //---------------------------------------------------------------------
     184           0 :     sal_Int32 FontControlModel::getTextLineColor( ) const
     185             :     {
     186           0 :         sal_Int32 nColor = COL_TRANSPARENT;
     187           0 :         m_aTextLineColor >>= nColor;
     188           0 :         return nColor;
     189             :     }
     190             : 
     191             :     //------------------------------------------------------------------------------
     192           2 :     void FontControlModel::describeFontRelatedProperties( Sequence< Property >& /* [out] */ _rProps ) const
     193             :     {
     194           2 :         sal_Int32 nPos = _rProps.getLength();
     195           2 :         _rProps.realloc( nPos + 21 );
     196           2 :         Property* pProperties = _rProps.getArray();
     197             : 
     198           2 :         DECL_PROP2      ( FONT,               FontDescriptor,   BOUND, MAYBEDEFAULT );
     199           2 :         DECL_PROP2      ( FONTEMPHASISMARK,   sal_Int16,        BOUND, MAYBEDEFAULT );
     200           2 :         DECL_PROP2      ( FONTRELIEF,         sal_Int16,        BOUND, MAYBEDEFAULT );
     201           2 :         DECL_PROP3      ( TEXTCOLOR,          sal_Int32,        BOUND, MAYBEDEFAULT, MAYBEVOID );
     202           2 :         DECL_PROP3      ( TEXTLINECOLOR,      sal_Int32,        BOUND, MAYBEDEFAULT, MAYBEVOID );
     203             : 
     204           2 :         DECL_PROP1      ( FONT_CHARWIDTH,     float,            MAYBEDEFAULT );
     205           2 :         DECL_BOOL_PROP1 ( FONT_KERNING,                         MAYBEDEFAULT );
     206           2 :         DECL_PROP1      ( FONT_ORIENTATION,   float,            MAYBEDEFAULT );
     207           2 :         DECL_PROP1      ( FONT_PITCH,         sal_Int16,        MAYBEDEFAULT );
     208           2 :         DECL_PROP1      ( FONT_TYPE,          sal_Int16,        MAYBEDEFAULT );
     209           2 :         DECL_PROP1      ( FONT_WIDTH,         sal_Int16,        MAYBEDEFAULT );
     210           2 :         DECL_PROP1      ( FONT_NAME,          ::rtl::OUString,  MAYBEDEFAULT );
     211           2 :         DECL_PROP1      ( FONT_STYLENAME,     ::rtl::OUString,  MAYBEDEFAULT );
     212           2 :         DECL_PROP1      ( FONT_FAMILY,        sal_Int16,        MAYBEDEFAULT );
     213           2 :         DECL_PROP1      ( FONT_CHARSET,       sal_Int16,        MAYBEDEFAULT );
     214           2 :         DECL_PROP1      ( FONT_HEIGHT,        float,            MAYBEDEFAULT );
     215           2 :         DECL_PROP1      ( FONT_WEIGHT,        float,            MAYBEDEFAULT );
     216           2 :         DECL_PROP1      ( FONT_SLANT,         sal_Int16,        MAYBEDEFAULT );
     217           2 :         DECL_PROP1      ( FONT_UNDERLINE,     sal_Int16,        MAYBEDEFAULT );
     218           2 :         DECL_PROP1      ( FONT_STRIKEOUT,     sal_Int16,        MAYBEDEFAULT );
     219           2 :         DECL_BOOL_PROP1 ( FONT_WORDLINEMODE,                    MAYBEDEFAULT );
     220           2 :     }
     221             : 
     222             :     //---------------------------------------------------------------------
     223          69 :     void FontControlModel::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const
     224             :     {
     225          69 :         switch( _nHandle )
     226             :         {
     227             :         case PROPERTY_ID_TEXTCOLOR:
     228           3 :             _rValue = m_aTextColor;
     229           3 :             break;
     230             : 
     231             :         case PROPERTY_ID_FONTEMPHASISMARK:
     232           3 :             _rValue <<= m_nFontEmphasis;
     233           3 :             break;
     234             : 
     235             :         case PROPERTY_ID_FONTRELIEF:
     236           3 :             _rValue <<= m_nFontRelief;
     237           3 :             break;
     238             : 
     239             :         case PROPERTY_ID_TEXTLINECOLOR:
     240           3 :             _rValue = m_aTextLineColor;
     241           3 :             break;
     242             : 
     243             :         case PROPERTY_ID_FONT:
     244           3 :             _rValue = makeAny( m_aFont );
     245           3 :             break;
     246             : 
     247             :         default:
     248          54 :             _rValue = lcl_extractFontDescriptorAggregate( _nHandle, m_aFont );
     249          54 :             break;
     250             :         }
     251          69 :     }
     252             : 
     253             :     //---------------------------------------------------------------------
     254          17 :     sal_Bool FontControlModel::convertFastPropertyValue( Any& _rConvertedValue, Any& _rOldValue,
     255             :                 sal_Int32 _nHandle, const Any& _rValue ) throw( IllegalArgumentException )
     256             :     {
     257          17 :         sal_Bool bModified = sal_False;
     258          17 :         switch( _nHandle )
     259             :         {
     260             :         case PROPERTY_ID_TEXTCOLOR:
     261           1 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_aTextColor, ::getCppuType( static_cast< const sal_Int32* >( NULL ) ) );
     262           1 :             break;
     263             : 
     264             :         case PROPERTY_ID_TEXTLINECOLOR:
     265           0 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_aTextLineColor, ::getCppuType( static_cast< sal_Int32* >( NULL ) ) );
     266           0 :             break;
     267             : 
     268             :         case PROPERTY_ID_FONTEMPHASISMARK:
     269           0 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_nFontEmphasis );
     270           0 :             break;
     271             : 
     272             :         case PROPERTY_ID_FONTRELIEF:
     273           0 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_nFontRelief );
     274           0 :             break;
     275             : 
     276             :         case PROPERTY_ID_FONT:
     277             :         {
     278           0 :             Any aWorkAroundGccLimitation = makeAny( m_aFont );
     279           0 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, aWorkAroundGccLimitation, ::getCppuType( &m_aFont ) );
     280             :         }
     281           0 :         break;
     282             : 
     283             :         case PROPERTY_ID_FONT_NAME:
     284           2 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_aFont.Name );
     285           2 :             break;
     286             : 
     287             :         case PROPERTY_ID_FONT_STYLENAME:
     288           1 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_aFont.StyleName );
     289           1 :             break;
     290             : 
     291             :         case PROPERTY_ID_FONT_FAMILY:
     292           1 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.Family );
     293           1 :             break;
     294             : 
     295             :         case PROPERTY_ID_FONT_CHARSET:
     296           1 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.CharSet );
     297           1 :             break;
     298             : 
     299             :         case PROPERTY_ID_FONT_CHARWIDTH:
     300           0 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, float( m_aFont.CharacterWidth ) );
     301           0 :             break;
     302             : 
     303             :         case PROPERTY_ID_FONT_KERNING:
     304           0 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.Kerning );
     305           0 :             break;
     306             : 
     307             :         case PROPERTY_ID_FONT_ORIENTATION:
     308           0 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, float( m_aFont.Orientation ) );
     309           0 :             break;
     310             : 
     311             :         case PROPERTY_ID_FONT_PITCH:
     312           1 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.Pitch );
     313           1 :             break;
     314             : 
     315             :         case PROPERTY_ID_FONT_TYPE:
     316           0 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.Type );
     317           0 :             break;
     318             : 
     319             :         case PROPERTY_ID_FONT_WIDTH:
     320           0 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.Width );
     321           0 :             break;
     322             : 
     323             :         case PROPERTY_ID_FONT_HEIGHT:
     324           2 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, float( m_aFont.Height ) );
     325           2 :             break;
     326             : 
     327             :         case PROPERTY_ID_FONT_WEIGHT:
     328           2 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_aFont.Weight );
     329           2 :             break;
     330             : 
     331             :         case PROPERTY_ID_FONT_SLANT:
     332           2 :             bModified = tryPropertyValueEnum( _rConvertedValue, _rOldValue, _rValue, m_aFont.Slant );
     333           2 :             break;
     334             : 
     335             :         case PROPERTY_ID_FONT_UNDERLINE:
     336           2 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.Underline );
     337           2 :             break;
     338             : 
     339             :         case PROPERTY_ID_FONT_STRIKEOUT:
     340           2 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.Strikeout );
     341           2 :             break;
     342             : 
     343             :         case PROPERTY_ID_FONT_WORDLINEMODE:
     344           0 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Bool)m_aFont.WordLineMode );
     345           0 :             break;
     346             : 
     347             :         default:
     348             :             OSL_FAIL( "FontControlModel::convertFastPropertyValue: no font aggregate!" );
     349             :         }
     350          17 :         return bModified;
     351             :     }
     352             : 
     353             :     //------------------------------------------------------------------------------
     354          10 :     void FontControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue ) throw ( Exception )
     355             :     {
     356          10 :         switch( _nHandle )
     357             :         {
     358             :         case PROPERTY_ID_TEXTCOLOR:
     359           1 :             m_aTextColor = _rValue;
     360           1 :             break;
     361             : 
     362             :         case PROPERTY_ID_TEXTLINECOLOR:
     363           0 :             m_aTextLineColor = _rValue;
     364           0 :             break;
     365             : 
     366             :         case PROPERTY_ID_FONTEMPHASISMARK:
     367           0 :             _rValue >>= m_nFontEmphasis;
     368           0 :             break;
     369             : 
     370             :         case PROPERTY_ID_FONTRELIEF:
     371           0 :             _rValue >>= m_nFontRelief;
     372           0 :             break;
     373             : 
     374             :         case PROPERTY_ID_FONT:
     375           0 :             _rValue >>= m_aFont;
     376           0 :             break;
     377             : 
     378             :         case PROPERTY_ID_FONT_NAME:
     379           2 :             _rValue >>= m_aFont.Name;
     380           2 :             break;
     381             : 
     382             :         case PROPERTY_ID_FONT_STYLENAME:
     383           0 :             _rValue >>= m_aFont.StyleName;
     384           0 :             break;
     385             : 
     386             :         case PROPERTY_ID_FONT_FAMILY:
     387           1 :             _rValue >>= m_aFont.Family;
     388           1 :             break;
     389             : 
     390             :         case PROPERTY_ID_FONT_CHARSET:
     391           1 :             _rValue >>= m_aFont.CharSet;
     392           1 :             break;
     393             : 
     394             :         case PROPERTY_ID_FONT_CHARWIDTH:
     395           0 :             _rValue >>= m_aFont.CharacterWidth;
     396           0 :             break;
     397             : 
     398             :         case PROPERTY_ID_FONT_KERNING:
     399           0 :             _rValue >>= m_aFont.Kerning;
     400           0 :             break;
     401             : 
     402             :         case PROPERTY_ID_FONT_ORIENTATION:
     403           0 :             _rValue >>= m_aFont.Orientation;
     404           0 :             break;
     405             : 
     406             :         case PROPERTY_ID_FONT_PITCH:
     407           1 :             _rValue >>= m_aFont.Pitch;
     408           1 :             break;
     409             : 
     410             :         case PROPERTY_ID_FONT_TYPE:
     411           0 :             _rValue >>= m_aFont.Type;
     412           0 :             break;
     413             : 
     414             :         case PROPERTY_ID_FONT_WIDTH:
     415           0 :             _rValue >>= m_aFont.Width;
     416           0 :             break;
     417             : 
     418             :         case PROPERTY_ID_FONT_HEIGHT:
     419             :         {
     420           2 :             float nHeight = 0;
     421           2 :             _rValue >>= nHeight;
     422           2 :             m_aFont.Height = (sal_Int16)nHeight;
     423             :         }
     424           2 :         break;
     425             : 
     426             :         case PROPERTY_ID_FONT_WEIGHT:
     427           2 :             _rValue >>= m_aFont.Weight;
     428           2 :             break;
     429             : 
     430             :         case PROPERTY_ID_FONT_SLANT:
     431           0 :             _rValue >>= m_aFont.Slant;
     432           0 :             break;
     433             : 
     434             :         case PROPERTY_ID_FONT_UNDERLINE:
     435           0 :             _rValue >>= m_aFont.Underline;
     436           0 :             break;
     437             : 
     438             :         case PROPERTY_ID_FONT_STRIKEOUT:
     439           0 :             _rValue >>= m_aFont.Strikeout;
     440           0 :             break;
     441             : 
     442             :         case PROPERTY_ID_FONT_WORDLINEMODE:
     443             :         {
     444           0 :             sal_Bool bWordLineMode = sal_False;
     445           0 :             _rValue >>= bWordLineMode;
     446           0 :             m_aFont.WordLineMode = bWordLineMode;
     447             :         }
     448           0 :         break;
     449             : 
     450             :         default:
     451             :             OSL_FAIL( "FontControlModel::setFastPropertyValue_NoBroadcast: invalid property!" );
     452             :         }
     453          10 :     }
     454             : 
     455             :     //------------------------------------------------------------------------------
     456           0 :     Any FontControlModel::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const
     457             :     {
     458           0 :         Any aReturn;
     459             :         // some defaults which are the same, not matter if we have toolkit-compatible
     460             :         // defaults or not
     461           0 :         bool bHandled = false;
     462           0 :         switch( _nHandle )
     463             :         {
     464             :         case PROPERTY_ID_TEXTCOLOR:
     465             :         case PROPERTY_ID_TEXTLINECOLOR:
     466             :             // void
     467           0 :             bHandled = true;
     468           0 :             break;
     469             : 
     470             :         case PROPERTY_ID_FONTEMPHASISMARK:
     471           0 :             aReturn <<= FontEmphasisMark::NONE;
     472           0 :             bHandled = true;
     473           0 :             break;
     474             : 
     475             :         case PROPERTY_ID_FONTRELIEF:
     476           0 :             aReturn <<= FontRelief::NONE;
     477           0 :             bHandled = true;
     478           0 :             break;
     479             :         }
     480           0 :         if ( bHandled )
     481           0 :             return aReturn;
     482             : 
     483           0 :         if ( m_bToolkitCompatibleDefaults )
     484             :         {
     485           0 :             EmptyFontDescriptor aEmpty;
     486           0 :             if ( PROPERTY_ID_FONT == _nHandle )
     487           0 :                 return makeAny( (FontDescriptor)aEmpty );
     488           0 :             return lcl_extractFontDescriptorAggregate( _nHandle, aEmpty );
     489             :         }
     490             : 
     491           0 :         switch( _nHandle )
     492             :         {
     493             :         case PROPERTY_ID_FONT:
     494           0 :             aReturn <<= ::comphelper::getDefaultFont();
     495           0 :             break;
     496             : 
     497             :         case PROPERTY_ID_FONT_WORDLINEMODE:
     498           0 :             aReturn = makeBoolAny(sal_False);
     499             : 
     500             :         case PROPERTY_ID_FONT_NAME:
     501             :         case PROPERTY_ID_FONT_STYLENAME:
     502           0 :             aReturn <<= ::rtl::OUString();
     503             : 
     504             :         case PROPERTY_ID_FONT_FAMILY:
     505             :         case PROPERTY_ID_FONT_CHARSET:
     506             :         case PROPERTY_ID_FONT_SLANT:
     507             :         case PROPERTY_ID_FONT_UNDERLINE:
     508             :         case PROPERTY_ID_FONT_STRIKEOUT:
     509           0 :             aReturn <<= (sal_Int16)1;
     510           0 :             break;
     511             : 
     512             :         case PROPERTY_ID_FONT_KERNING:
     513           0 :             aReturn = makeBoolAny(sal_False);
     514           0 :             break;
     515             : 
     516             :         case PROPERTY_ID_FONT_PITCH:
     517             :         case PROPERTY_ID_FONT_TYPE:
     518             :         case PROPERTY_ID_FONT_WIDTH:
     519           0 :             aReturn <<= (sal_Int16)0;
     520           0 :             break;
     521             : 
     522             :         case PROPERTY_ID_FONT_HEIGHT:
     523             :         case PROPERTY_ID_FONT_WEIGHT:
     524             :         case PROPERTY_ID_FONT_CHARWIDTH:
     525             :         case PROPERTY_ID_FONT_ORIENTATION:
     526           0 :             aReturn <<= (float)0;
     527           0 :             break;
     528             : 
     529             :         default:
     530             :             OSL_FAIL( "FontControlModel::getPropertyDefaultByHandle: invalid property!" );
     531             :         }
     532             : 
     533           0 :         return aReturn;
     534             :     }
     535             : 
     536             : //.........................................................................
     537             : }   // namespace frm
     538             : //.........................................................................
     539             : 
     540             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10