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