LCOV - code coverage report
Current view: top level - forms/source/component - formcontrolfont.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 212 258 82.2 %
Date: 2014-11-03 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        4511 :         Any lcl_extractFontDescriptorAggregate( sal_Int32 _nHandle, const FontDescriptor& _rFont )
      46             :         {
      47        4511 :             Any aValue;
      48        4511 :             switch ( _nHandle )
      49             :             {
      50             :             case PROPERTY_ID_FONT_NAME:
      51         306 :                 aValue <<= _rFont.Name;
      52         306 :                 break;
      53             : 
      54             :             case PROPERTY_ID_FONT_STYLENAME:
      55         303 :                 aValue <<= _rFont.StyleName;
      56         303 :                 break;
      57             : 
      58             :             case PROPERTY_ID_FONT_FAMILY:
      59         305 :                 aValue <<= (sal_Int16)_rFont.Family;
      60         305 :                 break;
      61             : 
      62             :             case PROPERTY_ID_FONT_CHARSET:
      63         303 :                 aValue <<= (sal_Int16)_rFont.CharSet;
      64         303 :                 break;
      65             : 
      66             :             case PROPERTY_ID_FONT_CHARWIDTH:
      67         244 :                 aValue <<= _rFont.CharacterWidth;
      68         244 :                 break;
      69             : 
      70             :             case PROPERTY_ID_FONT_KERNING:
      71         244 :                 aValue <<= _rFont.Kerning;
      72         244 :                 break;
      73             : 
      74             :             case PROPERTY_ID_FONT_ORIENTATION:
      75         244 :                 aValue <<= _rFont.Orientation;
      76         244 :                 break;
      77             : 
      78             :             case PROPERTY_ID_FONT_PITCH:
      79         244 :                 aValue <<= _rFont.Pitch;
      80         244 :                 break;
      81             : 
      82             :             case PROPERTY_ID_FONT_TYPE:
      83         244 :                 aValue <<= _rFont.Type;
      84         244 :                 break;
      85             : 
      86             :             case PROPERTY_ID_FONT_WIDTH:
      87         244 :                 aValue <<= _rFont.Width;
      88         244 :                 break;
      89             : 
      90             :             case PROPERTY_ID_FONT_HEIGHT:
      91         305 :                 aValue <<= (float)( _rFont.Height );
      92         305 :                 break;
      93             : 
      94             :             case PROPERTY_ID_FONT_WEIGHT:
      95         306 :                 aValue <<= (float)_rFont.Weight;
      96         306 :                 break;
      97             : 
      98             :             case PROPERTY_ID_FONT_SLANT:
      99         305 :                 aValue = makeAny(_rFont.Slant);
     100         305 :                 break;
     101             : 
     102             :             case PROPERTY_ID_FONT_UNDERLINE:
     103         306 :                 aValue <<= (sal_Int16)_rFont.Underline;
     104         306 :                 break;
     105             : 
     106             :             case PROPERTY_ID_FONT_STRIKEOUT:
     107         305 :                 aValue <<= (sal_Int16)_rFont.Strikeout;
     108         305 :                 break;
     109             : 
     110             :             case PROPERTY_ID_FONT_WORDLINEMODE:
     111         303 :                 aValue = makeAny( _rFont.WordLineMode );
     112         303 :                 break;
     113             : 
     114             :             default:
     115             :                 OSL_FAIL( "lcl_extractFontDescriptorAggregate: invalid handle!" );
     116           0 :                 break;
     117             :             }
     118        4511 :             return aValue;
     119             :         }
     120             :     }
     121             : 
     122         254 :     FontControlModel::FontControlModel( bool _bToolkitCompatibleDefaults )
     123             :         :m_nFontRelief( css::awt::FontRelief::NONE )
     124             :         ,m_nFontEmphasis( FontEmphasisMark::NONE )
     125         254 :         ,m_bToolkitCompatibleDefaults( _bToolkitCompatibleDefaults )
     126             :     {
     127         254 :     }
     128             : 
     129             : 
     130           8 :     FontControlModel::FontControlModel( const FontControlModel* _pOriginal )
     131             :     {
     132           8 :         m_aFont = _pOriginal->m_aFont;
     133           8 :         m_nFontRelief = _pOriginal->m_nFontRelief;
     134           8 :         m_nFontEmphasis = _pOriginal->m_nFontEmphasis;
     135           8 :         m_aTextLineColor = _pOriginal->m_aTextLineColor;
     136           8 :         m_aTextColor = _pOriginal->m_aTextColor;
     137           8 :         m_bToolkitCompatibleDefaults = _pOriginal->m_bToolkitCompatibleDefaults;
     138           8 :     }
     139             : 
     140             : 
     141       11252 :     bool FontControlModel::isFontRelatedProperty( sal_Int32 _nPropertyHandle ) const
     142             :     {
     143       11252 :         return isFontAggregateProperty( _nPropertyHandle )
     144        6223 :             || ( _nPropertyHandle == PROPERTY_ID_FONT )
     145        5098 :             || ( _nPropertyHandle == PROPERTY_ID_FONTEMPHASISMARK )
     146        4405 :             || ( _nPropertyHandle == PROPERTY_ID_FONTRELIEF )
     147        3716 :             || ( _nPropertyHandle == PROPERTY_ID_TEXTLINECOLOR )
     148       14679 :             || ( _nPropertyHandle == PROPERTY_ID_TEXTCOLOR );
     149             :     }
     150             : 
     151             : 
     152       11773 :     bool FontControlModel::isFontAggregateProperty( sal_Int32 _nPropertyHandle ) const
     153             :     {
     154             :         return ( _nPropertyHandle == PROPERTY_ID_FONT_CHARWIDTH )
     155       11501 :             || ( _nPropertyHandle == PROPERTY_ID_FONT_ORIENTATION )
     156       11229 :             || ( _nPropertyHandle == PROPERTY_ID_FONT_WIDTH )
     157       10957 :             || ( _nPropertyHandle == PROPERTY_ID_FONT_NAME )
     158       10581 :             || ( _nPropertyHandle == PROPERTY_ID_FONT_STYLENAME )
     159       10234 :             || ( _nPropertyHandle == PROPERTY_ID_FONT_FAMILY )
     160        9874 :             || ( _nPropertyHandle == PROPERTY_ID_FONT_CHARSET )
     161        9507 :             || ( _nPropertyHandle == PROPERTY_ID_FONT_HEIGHT )
     162        9132 :             || ( _nPropertyHandle == PROPERTY_ID_FONT_WEIGHT )
     163        8762 :             || ( _nPropertyHandle == PROPERTY_ID_FONT_SLANT )
     164        8409 :             || ( _nPropertyHandle == PROPERTY_ID_FONT_UNDERLINE )
     165        8055 :             || ( _nPropertyHandle == PROPERTY_ID_FONT_STRIKEOUT )
     166        7702 :             || ( _nPropertyHandle == PROPERTY_ID_FONT_WORDLINEMODE )
     167        7359 :             || ( _nPropertyHandle == PROPERTY_ID_FONT_PITCH )
     168        7075 :             || ( _nPropertyHandle == PROPERTY_ID_FONT_KERNING )
     169       18576 :             || ( _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         236 :     void FontControlModel::describeFontRelatedProperties( Sequence< Property >& /* [out] */ _rProps ) const
     190             :     {
     191         236 :         sal_Int32 nPos = _rProps.getLength();
     192         236 :         _rProps.realloc( nPos + 21 );
     193         236 :         Property* pProperties = _rProps.getArray();
     194             : 
     195         236 :         DECL_PROP2      ( FONT,               FontDescriptor,   BOUND, MAYBEDEFAULT );
     196         236 :         DECL_PROP2      ( FONTEMPHASISMARK,   sal_Int16,        BOUND, MAYBEDEFAULT );
     197         236 :         DECL_PROP2      ( FONTRELIEF,         sal_Int16,        BOUND, MAYBEDEFAULT );
     198         236 :         DECL_PROP3      ( TEXTCOLOR,          sal_Int32,        BOUND, MAYBEDEFAULT, MAYBEVOID );
     199         236 :         DECL_PROP3      ( TEXTLINECOLOR,      sal_Int32,        BOUND, MAYBEDEFAULT, MAYBEVOID );
     200             : 
     201         236 :         DECL_PROP1      ( FONT_CHARWIDTH,     float,            MAYBEDEFAULT );
     202         236 :         DECL_BOOL_PROP1 ( FONT_KERNING,                         MAYBEDEFAULT );
     203         236 :         DECL_PROP1      ( FONT_ORIENTATION,   float,            MAYBEDEFAULT );
     204         236 :         DECL_PROP1      ( FONT_PITCH,         sal_Int16,        MAYBEDEFAULT );
     205         236 :         DECL_PROP1      ( FONT_TYPE,          sal_Int16,        MAYBEDEFAULT );
     206         236 :         DECL_PROP1      ( FONT_WIDTH,         sal_Int16,        MAYBEDEFAULT );
     207         236 :         DECL_PROP1      ( FONT_NAME,          OUString,  MAYBEDEFAULT );
     208         236 :         DECL_PROP1      ( FONT_STYLENAME,     OUString,  MAYBEDEFAULT );
     209         236 :         DECL_PROP1      ( FONT_FAMILY,        sal_Int16,        MAYBEDEFAULT );
     210         236 :         DECL_PROP1      ( FONT_CHARSET,       sal_Int16,        MAYBEDEFAULT );
     211         236 :         DECL_PROP1      ( FONT_HEIGHT,        float,            MAYBEDEFAULT );
     212         236 :         DECL_PROP1      ( FONT_WEIGHT,        float,            MAYBEDEFAULT );
     213         236 :         DECL_PROP1      ( FONT_SLANT,         sal_Int16,        MAYBEDEFAULT );
     214         236 :         DECL_PROP1      ( FONT_UNDERLINE,     sal_Int16,        MAYBEDEFAULT );
     215         236 :         DECL_PROP1      ( FONT_STRIKEOUT,     sal_Int16,        MAYBEDEFAULT );
     216         236 :         DECL_BOOL_PROP1 ( FONT_WORDLINEMODE,                    MAYBEDEFAULT );
     217         236 :     }
     218             : 
     219             : 
     220        6528 :     void FontControlModel::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const
     221             :     {
     222        6528 :         switch( _nHandle )
     223             :         {
     224             :         case PROPERTY_ID_TEXTCOLOR:
     225         285 :             _rValue = m_aTextColor;
     226         285 :             break;
     227             : 
     228             :         case PROPERTY_ID_FONTEMPHASISMARK:
     229         483 :             _rValue <<= m_nFontEmphasis;
     230         483 :             break;
     231             : 
     232             :         case PROPERTY_ID_FONTRELIEF:
     233         481 :             _rValue <<= m_nFontRelief;
     234         481 :             break;
     235             : 
     236             :         case PROPERTY_ID_TEXTLINECOLOR:
     237         283 :             _rValue = m_aTextLineColor;
     238         283 :             break;
     239             : 
     240             :         case PROPERTY_ID_FONT:
     241         485 :             _rValue = makeAny( m_aFont );
     242         485 :             break;
     243             : 
     244             :         default:
     245        4511 :             _rValue = lcl_extractFontDescriptorAggregate( _nHandle, m_aFont );
     246        4511 :             break;
     247             :         }
     248        6528 :     }
     249             : 
     250             : 
     251        1079 :     bool FontControlModel::convertFastPropertyValue( Any& _rConvertedValue, Any& _rOldValue,
     252             :                 sal_Int32 _nHandle, const Any& _rValue ) throw( IllegalArgumentException )
     253             :     {
     254        1079 :         bool bModified = false;
     255        1079 :         switch( _nHandle )
     256             :         {
     257             :         case PROPERTY_ID_TEXTCOLOR:
     258          12 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_aTextColor, cppu::UnoType<sal_Int32>::get() );
     259          12 :             break;
     260             : 
     261             :         case PROPERTY_ID_TEXTLINECOLOR:
     262           6 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_aTextLineColor, cppu::UnoType<sal_Int32>::get() );
     263           6 :             break;
     264             : 
     265             :         case PROPERTY_ID_FONTEMPHASISMARK:
     266         181 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_nFontEmphasis );
     267         181 :             break;
     268             : 
     269             :         case PROPERTY_ID_FONTRELIEF:
     270         180 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_nFontRelief );
     271         180 :             break;
     272             : 
     273             :         case PROPERTY_ID_FONT:
     274             :         {
     275         395 :             Any aWorkAroundGccLimitation = makeAny( m_aFont );
     276         395 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, aWorkAroundGccLimitation, ::getCppuType( &m_aFont ) );
     277             :         }
     278         395 :         break;
     279             : 
     280             :         case PROPERTY_ID_FONT_NAME:
     281          26 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_aFont.Name );
     282          26 :             break;
     283             : 
     284             :         case PROPERTY_ID_FONT_STYLENAME:
     285          20 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_aFont.StyleName );
     286          20 :             break;
     287             : 
     288             :         case PROPERTY_ID_FONT_FAMILY:
     289          21 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.Family );
     290          21 :             break;
     291             : 
     292             :         case PROPERTY_ID_FONT_CHARSET:
     293          24 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.CharSet );
     294          24 :             break;
     295             : 
     296             :         case PROPERTY_ID_FONT_CHARWIDTH:
     297          12 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, float( m_aFont.CharacterWidth ) );
     298          12 :             break;
     299             : 
     300             :         case PROPERTY_ID_FONT_KERNING:
     301          12 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_aFont.Kerning );
     302          12 :             break;
     303             : 
     304             :         case PROPERTY_ID_FONT_ORIENTATION:
     305          12 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, float( m_aFont.Orientation ) );
     306          12 :             break;
     307             : 
     308             :         case PROPERTY_ID_FONT_PITCH:
     309          16 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.Pitch );
     310          16 :             break;
     311             : 
     312             :         case PROPERTY_ID_FONT_TYPE:
     313          12 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.Type );
     314          12 :             break;
     315             : 
     316             :         case PROPERTY_ID_FONT_WIDTH:
     317          12 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.Width );
     318          12 :             break;
     319             : 
     320             :         case PROPERTY_ID_FONT_HEIGHT:
     321          26 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, float( m_aFont.Height ) );
     322          26 :             break;
     323             : 
     324             :         case PROPERTY_ID_FONT_WEIGHT:
     325          24 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_aFont.Weight );
     326          24 :             break;
     327             : 
     328             :         case PROPERTY_ID_FONT_SLANT:
     329          24 :             bModified = tryPropertyValueEnum( _rConvertedValue, _rOldValue, _rValue, m_aFont.Slant );
     330          24 :             break;
     331             : 
     332             :         case PROPERTY_ID_FONT_UNDERLINE:
     333          24 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.Underline );
     334          24 :             break;
     335             : 
     336             :         case PROPERTY_ID_FONT_STRIKEOUT:
     337          24 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_aFont.Strikeout );
     338          24 :             break;
     339             : 
     340             :         case PROPERTY_ID_FONT_WORDLINEMODE:
     341          16 :             bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_aFont.WordLineMode );
     342          16 :             break;
     343             : 
     344             :         default:
     345             :             OSL_FAIL( "FontControlModel::convertFastPropertyValue: no font aggregate!" );
     346             :         }
     347        1079 :         return bModified;
     348             :     }
     349             : 
     350             : 
     351         213 :     static void setFastPropertyValue_NoBroadcast_implimpl(
     352             :             FontDescriptor & rFont,
     353             :             sal_Int32 nHandle, const Any& rValue) throw (Exception)
     354             :     {
     355         213 :         switch (nHandle)
     356             :         {
     357             :         case PROPERTY_ID_FONT_NAME:
     358          22 :             rValue >>= rFont.Name;
     359          22 :             break;
     360             : 
     361             :         case PROPERTY_ID_FONT_STYLENAME:
     362          12 :             rValue >>= rFont.StyleName;
     363          12 :             break;
     364             : 
     365             :         case PROPERTY_ID_FONT_FAMILY:
     366          17 :             rValue >>= rFont.Family;
     367          17 :             break;
     368             : 
     369             :         case PROPERTY_ID_FONT_CHARSET:
     370          20 :             rValue >>= rFont.CharSet;
     371          20 :             break;
     372             : 
     373             :         case PROPERTY_ID_FONT_CHARWIDTH:
     374           8 :             rValue >>= rFont.CharacterWidth;
     375           8 :             break;
     376             : 
     377             :         case PROPERTY_ID_FONT_KERNING:
     378           8 :             rValue >>= rFont.Kerning;
     379           8 :             break;
     380             : 
     381             :         case PROPERTY_ID_FONT_ORIENTATION:
     382           8 :             rValue >>= rFont.Orientation;
     383           8 :             break;
     384             : 
     385             :         case PROPERTY_ID_FONT_PITCH:
     386          12 :             rValue >>= rFont.Pitch;
     387          12 :             break;
     388             : 
     389             :         case PROPERTY_ID_FONT_TYPE:
     390           8 :             rValue >>= rFont.Type;
     391           8 :             break;
     392             : 
     393             :         case PROPERTY_ID_FONT_WIDTH:
     394           8 :             rValue >>= rFont.Width;
     395           8 :             break;
     396             : 
     397             :         case PROPERTY_ID_FONT_HEIGHT:
     398             :         {
     399          22 :             float nHeight = 0;
     400          22 :             rValue >>= nHeight;
     401          22 :             rFont.Height = (sal_Int16)nHeight;
     402             :         }
     403          22 :         break;
     404             : 
     405             :         case PROPERTY_ID_FONT_WEIGHT:
     406          20 :             rValue >>= rFont.Weight;
     407          20 :             break;
     408             : 
     409             :         case PROPERTY_ID_FONT_SLANT:
     410          12 :             rValue >>= rFont.Slant;
     411          12 :             break;
     412             : 
     413             :         case PROPERTY_ID_FONT_UNDERLINE:
     414          12 :             rValue >>= rFont.Underline;
     415          12 :             break;
     416             : 
     417             :         case PROPERTY_ID_FONT_STRIKEOUT:
     418          12 :             rValue >>= rFont.Strikeout;
     419          12 :             break;
     420             : 
     421             :         case PROPERTY_ID_FONT_WORDLINEMODE:
     422             :         {
     423          12 :             bool bWordLineMode = false;
     424          12 :             rValue >>= bWordLineMode;
     425          12 :             rFont.WordLineMode = bWordLineMode;
     426             :         }
     427          12 :         break;
     428             : 
     429             :         default:
     430             :             assert(false); // isFontAggregateProperty
     431             :         }
     432         213 :     }
     433             : 
     434         521 :     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         521 :         if (isFontAggregateProperty(nHandle))
     440             :         {
     441             :             // need to fire a event for PROPERTY_ID_FONT too apparently, so:
     442         213 :             FontDescriptor font(getFont());
     443             : 
     444             :             // first set new value on backup copy
     445         213 :             setFastPropertyValue_NoBroadcast_implimpl(font, nHandle, rValue);
     446             : 
     447             :             // then set that as the actual property - will eventually call
     448             :             // this method recursively again...
     449         213 :             (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         308 :             switch (nHandle)
     460             :             {
     461             :             case PROPERTY_ID_TEXTCOLOR:
     462           6 :                 m_aTextColor = rValue;
     463           6 :                 break;
     464             : 
     465             :             case PROPERTY_ID_TEXTLINECOLOR:
     466           0 :                 m_aTextLineColor = rValue;
     467           0 :                 break;
     468             : 
     469             :             case PROPERTY_ID_FONTEMPHASISMARK:
     470          29 :                 rValue >>= m_nFontEmphasis;
     471          29 :                 break;
     472             : 
     473             :             case PROPERTY_ID_FONTRELIEF:
     474          28 :                 rValue >>= m_nFontRelief;
     475          28 :                 break;
     476             : 
     477             :             case PROPERTY_ID_FONT:
     478         245 :                 rValue >>= m_aFont;
     479         245 :                 break;
     480             : 
     481             :             default:
     482             :                 SAL_WARN("forms.component", "invalid property: " << nHandle);
     483             :             }
     484             :         }
     485         521 :     }
     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.10