LCOV - code coverage report
Current view: top level - chart2/source/controller/itemsetwrapper - CharacterPropertyItemConverter.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 255 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 10 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "CharacterPropertyItemConverter.hxx"
      21             : #include "SchWhichPairs.hxx"
      22             : #include "macros.hxx"
      23             : #include "ItemPropertyMap.hxx"
      24             : #include "RelativeSizeHelper.hxx"
      25             : #include <editeng/memberids.hrc>
      26             : #include <editeng/eeitem.hxx>
      27             : #include <editeng/udlnitem.hxx>
      28             : #include <editeng/fontitem.hxx>
      29             : #include <editeng/crossedoutitem.hxx>
      30             : #include <editeng/postitem.hxx>
      31             : #include <editeng/wghtitem.hxx>
      32             : #include <editeng/fhgtitem.hxx>
      33             : #include <svl/stritem.hxx>
      34             : 
      35             : #include <com/sun/star/beans/XPropertyState.hpp>
      36             : #include <com/sun/star/chart2/XFormattedString.hpp>
      37             : 
      38             : using namespace ::com::sun::star;
      39             : 
      40             : namespace chart { namespace wrapper {
      41             : 
      42             : namespace {
      43             : 
      44           0 : ItemPropertyMapType & lcl_GetCharacterPropertyPropertyMap()
      45             : {
      46             :     static ItemPropertyMapType aCharacterPropertyMap(
      47             :         MakeItemPropertyMap
      48             :         IPM_MAP_ENTRY( EE_CHAR_COLOR, "CharColor", 0 )
      49           0 :         IPM_MAP_ENTRY( EE_CHAR_LANGUAGE, "CharLocale", MID_LANG_LOCALE )
      50           0 :         IPM_MAP_ENTRY( EE_CHAR_LANGUAGE_CJK, "CharLocaleAsian", MID_LANG_LOCALE )
      51           0 :         IPM_MAP_ENTRY( EE_CHAR_LANGUAGE_CTL, "CharLocaleComplex", MID_LANG_LOCALE )
      52             : 
      53           0 :         IPM_MAP_ENTRY( EE_CHAR_STRIKEOUT, "CharStrikeout", MID_CROSS_OUT )
      54           0 :         IPM_MAP_ENTRY( EE_CHAR_WLM, "CharWordMode", 0 )
      55           0 :         IPM_MAP_ENTRY( EE_CHAR_SHADOW, "CharShadowed", 0 )
      56           0 :         IPM_MAP_ENTRY( EE_CHAR_RELIEF, "CharRelief", 0 )
      57           0 :         IPM_MAP_ENTRY( EE_CHAR_OUTLINE, "CharContoured", 0 )
      58           0 :         IPM_MAP_ENTRY( EE_CHAR_EMPHASISMARK, "CharEmphasis", 0 )
      59             : 
      60           0 :         IPM_MAP_ENTRY( EE_PARA_WRITINGDIR, "WritingMode", 0 )
      61             : 
      62           0 :         IPM_MAP_ENTRY( EE_PARA_ASIANCJKSPACING, "ParaIsCharacterDistance", 0 )
      63           0 :         );
      64             : 
      65           0 :     return aCharacterPropertyMap;
      66             : }
      67             : } // anonymous namespace
      68             : 
      69           0 : CharacterPropertyItemConverter::CharacterPropertyItemConverter(
      70             :     const uno::Reference< beans::XPropertySet > & rPropertySet,
      71             :     SfxItemPool& rItemPool ) :
      72           0 :         ItemConverter( rPropertySet, rItemPool )
      73           0 : {}
      74             : 
      75           0 : CharacterPropertyItemConverter::CharacterPropertyItemConverter(
      76             :     const uno::Reference< beans::XPropertySet > & rPropertySet,
      77             :     SfxItemPool& rItemPool,
      78             :     const awt::Size* pRefSize,
      79             :     const OUString & rRefSizePropertyName,
      80             :     const uno::Reference< beans::XPropertySet > & rRefSizePropSet ) :
      81             :         ItemConverter( rPropertySet, rItemPool ),
      82             :         m_aRefSizePropertyName( rRefSizePropertyName ),
      83           0 :         m_xRefSizePropSet( rRefSizePropSet.is() ? rRefSizePropSet : rPropertySet )
      84             : {
      85           0 :     if (pRefSize)
      86           0 :         m_pRefSize.reset(*pRefSize);
      87           0 : }
      88             : 
      89           0 : CharacterPropertyItemConverter::~CharacterPropertyItemConverter()
      90           0 : {}
      91             : 
      92           0 : const sal_uInt16 * CharacterPropertyItemConverter::GetWhichPairs() const
      93             : {
      94           0 :     return nCharacterPropertyWhichPairs;
      95             : }
      96             : 
      97           0 : bool CharacterPropertyItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const
      98             : {
      99           0 :     ItemPropertyMapType & rMap( lcl_GetCharacterPropertyPropertyMap());
     100           0 :     ItemPropertyMapType::const_iterator aIt( rMap.find( nWhichId ));
     101             : 
     102           0 :     if( aIt == rMap.end())
     103           0 :         return false;
     104             : 
     105           0 :     rOutProperty =(*aIt).second;
     106           0 :     return true;
     107             : }
     108             : 
     109           0 : void CharacterPropertyItemConverter::FillSpecialItem(
     110             :     sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
     111             :     throw( uno::Exception )
     112             : {
     113           0 :     switch( nWhichId )
     114             :     {
     115             :         case EE_CHAR_FONTINFO:
     116             :         case EE_CHAR_FONTINFO_CJK:
     117             :         case EE_CHAR_FONTINFO_CTL:
     118             :         {
     119           0 :             OUString aPostfix;
     120           0 :             if( nWhichId == EE_CHAR_FONTINFO_CJK )
     121           0 :                 aPostfix = "Asian";
     122           0 :             else if( nWhichId == EE_CHAR_FONTINFO_CTL )
     123           0 :                 aPostfix = "Complex";
     124             : 
     125           0 :             SvxFontItem aItem( nWhichId );
     126             : 
     127           0 :             aItem.PutValue( GetPropertySet()->getPropertyValue( "CharFontName" + aPostfix),
     128           0 :                             MID_FONT_FAMILY_NAME );
     129           0 :             aItem.PutValue( GetPropertySet()->getPropertyValue( "CharFontFamily" + aPostfix),
     130           0 :                             MID_FONT_FAMILY );
     131           0 :             aItem.PutValue( GetPropertySet()->getPropertyValue( "CharFontStyleName" + aPostfix),
     132           0 :                             MID_FONT_STYLE_NAME );
     133           0 :             aItem.PutValue( GetPropertySet()->getPropertyValue( "CharFontCharSet" + aPostfix),
     134           0 :                             MID_FONT_CHAR_SET );
     135           0 :             aItem.PutValue( GetPropertySet()->getPropertyValue( "CharFontPitch" + aPostfix),
     136           0 :                             MID_FONT_PITCH );
     137             : 
     138           0 :             rOutItemSet.Put( aItem );
     139             :         }
     140           0 :         break;
     141             : 
     142             :         case EE_CHAR_UNDERLINE:
     143             :         {
     144           0 :             SvxUnderlineItem aItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE);
     145           0 :             bool bModified = false;
     146             : 
     147           0 :             uno::Any aValue( GetPropertySet()->getPropertyValue( "CharUnderline" ));
     148           0 :             if( aValue.hasValue())
     149             :             {
     150           0 :                 aItem.PutValue( aValue, MID_TL_STYLE );
     151           0 :                 bModified = true;
     152             :             }
     153             : 
     154           0 :             aValue = GetPropertySet()->getPropertyValue( "CharUnderlineHasColor" );
     155           0 :             if( aValue.hasValue() &&
     156           0 :                 ( *static_cast< const sal_Bool * >( aValue.getValue()) != sal_False ))
     157             :             {
     158           0 :                 aItem.PutValue( aValue, MID_TL_HASCOLOR );
     159           0 :                 bModified = true;
     160             :             }
     161             : 
     162           0 :             aValue = GetPropertySet()->getPropertyValue( "CharUnderlineColor" );
     163           0 :             if( aValue.hasValue())
     164             :             {
     165           0 :                 aItem.PutValue( aValue, MID_TL_COLOR );
     166           0 :                 bModified = true;
     167             :             }
     168             : 
     169           0 :             if( bModified )
     170           0 :                 rOutItemSet.Put( aItem );
     171             :         }
     172           0 :         break;
     173             : 
     174             :         case EE_CHAR_OVERLINE:
     175             :         {
     176           0 :             SvxOverlineItem aItem( UNDERLINE_NONE, EE_CHAR_OVERLINE );
     177           0 :             bool bModified = false;
     178             : 
     179           0 :             uno::Any aValue( GetPropertySet()->getPropertyValue( "CharOverline" ) );
     180           0 :             if ( aValue.hasValue() )
     181             :             {
     182           0 :                 aItem.PutValue( aValue, MID_TL_STYLE );
     183           0 :                 bModified = true;
     184             :             }
     185             : 
     186           0 :             aValue = GetPropertySet()->getPropertyValue( "CharOverlineHasColor" );
     187           0 :             if ( aValue.hasValue() &&
     188           0 :                  ( *static_cast< const sal_Bool* >( aValue.getValue() ) != sal_False ) )
     189             :             {
     190           0 :                 aItem.PutValue( aValue, MID_TL_HASCOLOR );
     191           0 :                 bModified = true;
     192             :             }
     193             : 
     194           0 :             aValue = GetPropertySet()->getPropertyValue( "CharOverlineColor" );
     195           0 :             if ( aValue.hasValue() )
     196             :             {
     197           0 :                 aItem.PutValue( aValue, MID_TL_COLOR );
     198           0 :                 bModified = true;
     199             :             }
     200             : 
     201           0 :             if ( bModified )
     202             :             {
     203           0 :                 rOutItemSet.Put( aItem );
     204           0 :             }
     205             :         }
     206           0 :         break;
     207             : 
     208             :         case EE_CHAR_ITALIC:
     209             :         case EE_CHAR_ITALIC_CJK:
     210             :         case EE_CHAR_ITALIC_CTL:
     211             :         {
     212           0 :             OUString aPostfix;
     213           0 :             if( nWhichId == EE_CHAR_ITALIC_CJK )
     214           0 :                 aPostfix = "Asian";
     215           0 :             else if( nWhichId == EE_CHAR_ITALIC_CTL )
     216           0 :                 aPostfix = "Complex";
     217             : 
     218           0 :             SvxPostureItem aItem( ITALIC_NONE, nWhichId );
     219             : 
     220           0 :             uno::Any aValue( GetPropertySet()->getPropertyValue( "CharPosture" + aPostfix));
     221           0 :             if( aValue.hasValue())
     222             :             {
     223           0 :                 aItem.PutValue( aValue, MID_POSTURE );
     224           0 :                 rOutItemSet.Put( aItem );
     225           0 :             }
     226             :         }
     227           0 :         break;
     228             : 
     229             :         case EE_CHAR_WEIGHT:
     230             :         case EE_CHAR_WEIGHT_CJK:
     231             :         case EE_CHAR_WEIGHT_CTL:
     232             :         {
     233           0 :             OUString aPostfix;
     234           0 :             if( nWhichId == EE_CHAR_WEIGHT_CJK )
     235           0 :                 aPostfix = "Asian";
     236           0 :             else if( nWhichId == EE_CHAR_WEIGHT_CTL )
     237           0 :                 aPostfix = "Complex";
     238             : 
     239           0 :             SvxWeightItem aItem( WEIGHT_NORMAL, nWhichId );
     240             : 
     241           0 :             uno::Any aValue( GetPropertySet()->getPropertyValue( "CharWeight" + aPostfix));
     242           0 :             if( aValue.hasValue())
     243             :             {
     244           0 :                 aItem.PutValue( aValue, MID_WEIGHT );
     245           0 :                 rOutItemSet.Put( aItem );
     246           0 :             }
     247             :         }
     248           0 :         break;
     249             : 
     250             :         case EE_CHAR_FONTHEIGHT:
     251             :         case EE_CHAR_FONTHEIGHT_CJK:
     252             :         case EE_CHAR_FONTHEIGHT_CTL:
     253             :         {
     254           0 :             OUString aPostfix;
     255           0 :             if( nWhichId == EE_CHAR_FONTHEIGHT_CJK )
     256           0 :                 aPostfix = "Asian";
     257           0 :             else if( nWhichId == EE_CHAR_FONTHEIGHT_CTL )
     258           0 :                 aPostfix = "Complex";
     259             : 
     260           0 :             SvxFontHeightItem aItem( 240, 100, nWhichId );
     261             : 
     262             :             try
     263             :             {
     264           0 :                 uno::Any aValue( GetPropertySet()->getPropertyValue( "CharHeight" + aPostfix ));
     265             :                 float fHeight;
     266           0 :                 if( aValue >>= fHeight )
     267             :                 {
     268           0 :                     if (m_pRefSize)
     269             :                     {
     270           0 :                         awt::Size aOldRefSize;
     271           0 :                         if( GetRefSizePropertySet()->getPropertyValue( m_aRefSizePropertyName ) >>= aOldRefSize )
     272             :                         {
     273             :                             // calculate font height in view
     274             :                             fHeight = static_cast< float >(
     275           0 :                                 RelativeSizeHelper::calculate( fHeight, aOldRefSize, *m_pRefSize ));
     276           0 :                             aValue <<= fHeight;
     277             :                         }
     278             :                     }
     279             : 
     280           0 :                     aItem.PutValue( aValue, MID_FONTHEIGHT );
     281           0 :                     rOutItemSet.Put( aItem );
     282           0 :                 }
     283             :             }
     284           0 :             catch( const uno::Exception & ex )
     285             :             {
     286             :                 ASSERT_EXCEPTION( ex );
     287           0 :             }
     288             :         }
     289           0 :         break;
     290             : 
     291             :         case SID_CHAR_DLG_PREVIEW_STRING:
     292             :         {
     293           0 :             uno::Reference< chart2::XFormattedString > xFormattedString( GetPropertySet(), uno::UNO_QUERY );
     294           0 :             if( xFormattedString.is() )
     295             :             {
     296           0 :                 OUString aString = xFormattedString->getString();
     297           0 :                 rOutItemSet.Put( SfxStringItem( nWhichId, aString ) );
     298             :             }
     299             :             else
     300           0 :                 rOutItemSet.Put( SfxStringItem( nWhichId, OUString("") ) );
     301             :         }
     302           0 :         break;
     303             : 
     304             :         case EE_PARA_FORBIDDENRULES:
     305             :         case EE_PARA_HANGINGPUNCTUATION:
     306           0 :             rOutItemSet.DisableItem( nWhichId );
     307           0 :             break;
     308             :     }
     309           0 : }
     310             : 
     311           0 : bool CharacterPropertyItemConverter::ApplySpecialItem(
     312             :     sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
     313             :     throw( uno::Exception )
     314             : {
     315           0 :     bool bChanged = false;
     316           0 :     uno::Any aValue;
     317             : 
     318           0 :     switch( nWhichId )
     319             :     {
     320             :         case EE_CHAR_FONTINFO:
     321             :         case EE_CHAR_FONTINFO_CJK:
     322             :         case EE_CHAR_FONTINFO_CTL:
     323             :         {
     324           0 :             OUString aPostfix;
     325           0 :             if( nWhichId == EE_CHAR_FONTINFO_CJK )
     326           0 :                 aPostfix = "Asian";
     327           0 :             else if( nWhichId == EE_CHAR_FONTINFO_CTL )
     328           0 :                 aPostfix = "Complex";
     329             : 
     330             :             const SvxFontItem & rItem =
     331             :                 static_cast< const SvxFontItem & >(
     332           0 :                     rItemSet.Get( nWhichId ));
     333             : 
     334           0 :             if( rItem.QueryValue( aValue, MID_FONT_FAMILY_NAME ))
     335             :             {
     336           0 :                 if( aValue != GetPropertySet()->getPropertyValue( "CharFontName" + aPostfix ))
     337             :                 {
     338           0 :                     GetPropertySet()->setPropertyValue( "CharFontName" + aPostfix, aValue );
     339           0 :                     bChanged = true;
     340             :                 }
     341             :             }
     342           0 :             if( rItem.QueryValue( aValue, MID_FONT_FAMILY ))
     343             :             {
     344           0 :                 if( aValue != GetPropertySet()->getPropertyValue( "CharFontFamily" + aPostfix ))
     345             :                 {
     346           0 :                     GetPropertySet()->setPropertyValue( "CharFontFamily" + aPostfix, aValue );
     347           0 :                     bChanged = true;
     348             :                 }
     349             :             }
     350           0 :             if( rItem.QueryValue( aValue, MID_FONT_STYLE_NAME ))
     351             :             {
     352           0 :                 if( aValue != GetPropertySet()->getPropertyValue( "CharFontStyleName" + aPostfix ))
     353             :                 {
     354           0 :                     GetPropertySet()->setPropertyValue( "CharFontStyleName" + aPostfix, aValue );
     355           0 :                     bChanged = true;
     356             :                 }
     357             :             }
     358           0 :             if( rItem.QueryValue( aValue, MID_FONT_CHAR_SET ))
     359             :             {
     360           0 :                 if( aValue != GetPropertySet()->getPropertyValue( "CharFontCharSet" + aPostfix ))
     361             :                 {
     362           0 :                     GetPropertySet()->setPropertyValue( "CharFontCharSet" + aPostfix, aValue );
     363           0 :                     bChanged = true;
     364             :                 }
     365             :             }
     366           0 :             if( rItem.QueryValue( aValue, MID_FONT_PITCH ))
     367             :             {
     368           0 :                 if( aValue != GetPropertySet()->getPropertyValue( "CharFontPitch" + aPostfix ))
     369             :                 {
     370           0 :                     GetPropertySet()->setPropertyValue( "CharFontPitch" + aPostfix, aValue );
     371           0 :                     bChanged = true;
     372             :                 }
     373           0 :             }
     374             :         }
     375           0 :         break;
     376             : 
     377             :         case EE_CHAR_UNDERLINE:
     378             :         {
     379             :             const SvxUnderlineItem & rItem =
     380             :                static_cast< const SvxUnderlineItem & >(
     381           0 :                     rItemSet.Get( nWhichId ));
     382             : 
     383           0 :             if( rItem.QueryValue( aValue, MID_TL_STYLE ))
     384             :             {
     385           0 :                 if( aValue != GetPropertySet()->getPropertyValue( "CharUnderline" ))
     386             :                 {
     387           0 :                     GetPropertySet()->setPropertyValue( "CharUnderline" , aValue );
     388           0 :                     bChanged = true;
     389             :                 }
     390             :             }
     391             : 
     392           0 :             if( rItem.QueryValue( aValue, MID_TL_COLOR ))
     393             :             {
     394           0 :                 if( aValue != GetPropertySet()->getPropertyValue( "CharUnderlineColor" ))
     395             :                 {
     396           0 :                     GetPropertySet()->setPropertyValue( "CharUnderlineColor" , aValue );
     397           0 :                     bChanged = true;
     398             :                 }
     399             :             }
     400             : 
     401           0 :             if( rItem.QueryValue( aValue, MID_TL_HASCOLOR ))
     402             :             {
     403           0 :                 if( aValue != GetPropertySet()->getPropertyValue( "CharUnderlineHasColor" ))
     404             :                 {
     405           0 :                     GetPropertySet()->setPropertyValue( "CharUnderlineHasColor" , aValue );
     406           0 :                     bChanged = true;
     407             :                 }
     408             :             }
     409             :         }
     410           0 :         break;
     411             : 
     412             :         case EE_CHAR_OVERLINE:
     413             :         {
     414           0 :             const SvxOverlineItem& rItem = static_cast< const SvxOverlineItem & >( rItemSet.Get( nWhichId ) );
     415             : 
     416           0 :             if ( rItem.QueryValue( aValue, MID_TL_STYLE ) )
     417             :             {
     418           0 :                 if ( aValue != GetPropertySet()->getPropertyValue( "CharOverline" ) )
     419             :                 {
     420           0 :                     GetPropertySet()->setPropertyValue( "CharOverline" , aValue );
     421           0 :                     bChanged = true;
     422             :                 }
     423             :             }
     424             : 
     425           0 :             if ( rItem.QueryValue( aValue, MID_TL_COLOR ) )
     426             :             {
     427           0 :                 if ( aValue != GetPropertySet()->getPropertyValue( "CharOverlineColor" ) )
     428             :                 {
     429           0 :                     GetPropertySet()->setPropertyValue( "CharOverlineColor" , aValue );
     430           0 :                     bChanged = true;
     431             :                 }
     432             :             }
     433             : 
     434           0 :             if ( rItem.QueryValue( aValue, MID_TL_HASCOLOR ) )
     435             :             {
     436           0 :                 if ( aValue != GetPropertySet()->getPropertyValue( "CharOverlineHasColor" ) )
     437             :                 {
     438           0 :                     GetPropertySet()->setPropertyValue( "CharOverlineHasColor" , aValue );
     439           0 :                     bChanged = true;
     440             :                 }
     441             :             }
     442             :         }
     443           0 :         break;
     444             : 
     445             :         case EE_CHAR_ITALIC:
     446             :         case EE_CHAR_ITALIC_CJK:
     447             :         case EE_CHAR_ITALIC_CTL:
     448             :         {
     449           0 :             OUString aPostfix;
     450           0 :             if( nWhichId == EE_CHAR_ITALIC_CJK )
     451           0 :                 aPostfix = "Asian";
     452           0 :             else if( nWhichId == EE_CHAR_ITALIC_CTL )
     453           0 :                 aPostfix = "Complex";
     454             : 
     455             :             const SvxPostureItem & rItem =
     456             :                 static_cast< const SvxPostureItem & >(
     457           0 :                     rItemSet.Get( nWhichId ));
     458             : 
     459           0 :             if( rItem.QueryValue( aValue, MID_POSTURE ))
     460             :             {
     461           0 :                 if( aValue != GetPropertySet()->getPropertyValue( "CharPosture" + aPostfix))
     462             :                 {
     463           0 :                     GetPropertySet()->setPropertyValue( "CharPosture" + aPostfix, aValue );
     464           0 :                     bChanged = true;
     465             :                 }
     466           0 :             }
     467             :         }
     468           0 :         break;
     469             : 
     470             :         case EE_CHAR_WEIGHT:
     471             :         case EE_CHAR_WEIGHT_CJK:
     472             :         case EE_CHAR_WEIGHT_CTL:
     473             :         {
     474           0 :             OUString aPostfix;
     475           0 :             if( nWhichId == EE_CHAR_WEIGHT_CJK )
     476           0 :                 aPostfix = "Asian" ;
     477           0 :             else if( nWhichId == EE_CHAR_WEIGHT_CTL )
     478           0 :                 aPostfix = "Complex";
     479             : 
     480             :             const SvxWeightItem & rItem =
     481             :                 static_cast< const SvxWeightItem & >(
     482           0 :                     rItemSet.Get( nWhichId ));
     483             : 
     484           0 :             if( rItem.QueryValue( aValue, MID_WEIGHT ))
     485             :             {
     486           0 :                 if( aValue != GetPropertySet()->getPropertyValue( "CharWeight" + aPostfix))
     487             :                 {
     488           0 :                     GetPropertySet()->setPropertyValue( "CharWeight" + aPostfix, aValue );
     489           0 :                     bChanged = true;
     490             :                 }
     491           0 :             }
     492             :         }
     493           0 :         break;
     494             : 
     495             :         case EE_CHAR_FONTHEIGHT:
     496             :         case EE_CHAR_FONTHEIGHT_CJK:
     497             :         case EE_CHAR_FONTHEIGHT_CTL:
     498             :         {
     499           0 :             OUString aPostfix;
     500           0 :             if( nWhichId == EE_CHAR_FONTHEIGHT_CJK )
     501           0 :                 aPostfix = "Asian";
     502           0 :             else if( nWhichId == EE_CHAR_FONTHEIGHT_CTL )
     503           0 :                 aPostfix = "Complex";
     504             : 
     505             :             const SvxFontHeightItem & rItem =
     506             :                 static_cast< const SvxFontHeightItem & >(
     507           0 :                     rItemSet.Get( nWhichId ));
     508             : 
     509             :             try
     510             :             {
     511           0 :                 if( rItem.QueryValue( aValue, MID_FONTHEIGHT ) )
     512             :                 {
     513           0 :                     bool bSetValue = false;
     514           0 :                     if( aValue != GetPropertySet()->getPropertyValue( "CharHeight" + aPostfix ))
     515           0 :                         bSetValue = true;
     516             :                     else
     517             :                     {
     518           0 :                         if (m_pRefSize)
     519             :                         {
     520           0 :                             awt::Size aNewRefSize = *m_pRefSize;
     521           0 :                             awt::Size aOldRefSize;
     522           0 :                             if( GetRefSizePropertySet()->getPropertyValue( m_aRefSizePropertyName ) >>= aOldRefSize )
     523             :                             {
     524           0 :                                 if( aNewRefSize.Width != aOldRefSize.Width
     525           0 :                                     || aNewRefSize.Height != aOldRefSize.Height )
     526           0 :                                     bSetValue = true;
     527             :                             }
     528             :                         }
     529             :                     }
     530           0 :                     if( bSetValue )
     531             :                     {
     532             :                         // set new reference size only if there was a reference size before (auto-scaling on)
     533           0 :                         if (m_pRefSize && GetRefSizePropertySet()->getPropertyValue( m_aRefSizePropertyName ).hasValue())
     534             :                         {
     535           0 :                             GetRefSizePropertySet()->setPropertyValue(
     536           0 :                                 m_aRefSizePropertyName, uno::makeAny(*m_pRefSize));
     537             :                         }
     538             : 
     539           0 :                         GetPropertySet()->setPropertyValue( "CharHeight" + aPostfix, aValue );
     540           0 :                         bChanged = true;
     541             :                     }
     542             :                 }
     543             :             }
     544           0 :             catch( const uno::Exception & ex )
     545             :             {
     546             :                 ASSERT_EXCEPTION( ex );
     547           0 :             }
     548             :         }
     549           0 :         break;
     550             :     }
     551             : 
     552           0 :     return bChanged;
     553             : }
     554             : 
     555           0 : uno::Reference<beans::XPropertySet> CharacterPropertyItemConverter::GetRefSizePropertySet() const
     556             : {
     557           0 :     return m_xRefSizePropSet;
     558             : }
     559             : 
     560             : }}
     561             : 
     562             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11