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

Generated by: LCOV version 1.11