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_sd.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #ifdef SD_DLLIMPLEMENTATION 32*cdf0e10cSrcweir #undef SD_DLLIMPLEMENTATION 33*cdf0e10cSrcweir #endif 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #ifndef _SVX_SVXIDS_HRC 36*cdf0e10cSrcweir #include <svx/svxids.hrc> 37*cdf0e10cSrcweir #endif 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir //-> Fonts & Items 40*cdf0e10cSrcweir #include <vcl/font.hxx> 41*cdf0e10cSrcweir #include <editeng/fontitem.hxx> 42*cdf0e10cSrcweir #include <editeng/fhgtitem.hxx> 43*cdf0e10cSrcweir #include <editeng/wghtitem.hxx> 44*cdf0e10cSrcweir #include <editeng/udlnitem.hxx> 45*cdf0e10cSrcweir #include <editeng/crsditem.hxx> 46*cdf0e10cSrcweir #include <editeng/postitem.hxx> 47*cdf0e10cSrcweir #include <editeng/cntritem.hxx> 48*cdf0e10cSrcweir #include <editeng/shdditem.hxx> 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir //<- Fonts & Items 51*cdf0e10cSrcweir #include <editeng/bulitem.hxx> 52*cdf0e10cSrcweir #include <editeng/brshitem.hxx> 53*cdf0e10cSrcweir #include <vcl/graph.hxx> 54*cdf0e10cSrcweir #include <svl/itemset.hxx> 55*cdf0e10cSrcweir #include <svl/itempool.hxx> 56*cdf0e10cSrcweir #include <editeng/numitem.hxx> 57*cdf0e10cSrcweir #include <editeng/eeitem.hxx> 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir #include "bulmaper.hxx" 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir #define GetWhich(nSlot) rSet.GetPool()->GetWhich( nSlot ) 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir /* #i35937# 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir void SdBulletMapper::PreMapNumBulletForDialog( SfxItemSet& rSet ) 67*cdf0e10cSrcweir { 68*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( EE_PARA_NUMBULLET, sal_False ) ) 69*cdf0e10cSrcweir { 70*cdf0e10cSrcweir SvxNumRule* pRule = ((SvxNumBulletItem*)rSet.GetItem( EE_PARA_NUMBULLET ))->GetNumRule(); 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir if(pRule && pRule->GetNumRuleType() == SVX_RULETYPE_PRESENTATION_NUMBERING) 73*cdf0e10cSrcweir { 74*cdf0e10cSrcweir // 10er Bullet Item auf 9er Item mappen 75*cdf0e10cSrcweir SvxNumRule aNewRule( pRule->GetFeatureFlags(), 9, sal_False, SVX_RULETYPE_PRESENTATION_NUMBERING ); 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir for( sal_uInt16 i = 0; i < 9; i++ ) 78*cdf0e10cSrcweir aNewRule.SetLevel(i, pRule->GetLevel(i)); 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir rSet.Put( SvxNumBulletItem( aNewRule, EE_PARA_NUMBULLET ) ); 81*cdf0e10cSrcweir } 82*cdf0e10cSrcweir } 83*cdf0e10cSrcweir } 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir void SdBulletMapper::PostMapNumBulletForDialog( SfxItemSet& rSet ) 86*cdf0e10cSrcweir { 87*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( EE_PARA_NUMBULLET, sal_False ) ) 88*cdf0e10cSrcweir { 89*cdf0e10cSrcweir SvxNumRule* pRule = ((SvxNumBulletItem*)rSet.GetItem( EE_PARA_NUMBULLET ))->GetNumRule(); 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir if(pRule) 92*cdf0e10cSrcweir { 93*cdf0e10cSrcweir pRule->UnLinkGraphics(); 94*cdf0e10cSrcweir if(pRule->GetNumRuleType() == SVX_RULETYPE_PRESENTATION_NUMBERING) 95*cdf0e10cSrcweir { 96*cdf0e10cSrcweir // 9er Bullet Item auf 10er Item mappen 97*cdf0e10cSrcweir SvxNumRule aNewRule( pRule->GetFeatureFlags(), 10, sal_False, SVX_RULETYPE_PRESENTATION_NUMBERING ); 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir for( sal_uInt16 i = 0; i < 9; i++ ) 100*cdf0e10cSrcweir aNewRule.SetLevel(i, pRule->GetLevel(i)); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir rSet.Put( SvxNumBulletItem( aNewRule, EE_PARA_NUMBULLET ) ); 103*cdf0e10cSrcweir } 104*cdf0e10cSrcweir } 105*cdf0e10cSrcweir } 106*cdf0e10cSrcweir } 107*cdf0e10cSrcweir */ 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir void SdBulletMapper::MapFontsInNumRule( SvxNumRule& aNumRule, const SfxItemSet& rSet ) 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir const sal_uInt16 nCount = aNumRule.GetLevelCount(); 112*cdf0e10cSrcweir for( sal_uInt16 nLevel = 0; nLevel < nCount; nLevel++ ) 113*cdf0e10cSrcweir { 114*cdf0e10cSrcweir const SvxNumberFormat& rSrcLevel = aNumRule.GetLevel(nLevel); 115*cdf0e10cSrcweir SvxNumberFormat aNewLevel( rSrcLevel ); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir if(rSrcLevel.GetNumberingType() != com::sun::star::style::NumberingType::CHAR_SPECIAL && 118*cdf0e10cSrcweir rSrcLevel.GetNumberingType() != com::sun::star::style::NumberingType::NUMBER_NONE ) 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir // wenn Aufzaehlung statt Bullet gewaehlt wurde, wird der Bullet-Font 121*cdf0e10cSrcweir // dem Vorlagen-Font angeglichen 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir // to be implemented if module supports CJK 124*cdf0e10cSrcweir long nFontID = SID_ATTR_CHAR_FONT; 125*cdf0e10cSrcweir long nFontHeightID = SID_ATTR_CHAR_FONTHEIGHT; 126*cdf0e10cSrcweir long nWeightID = SID_ATTR_CHAR_WEIGHT; 127*cdf0e10cSrcweir long nPostureID = SID_ATTR_CHAR_POSTURE; 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir if( 0 ) 130*cdf0e10cSrcweir { 131*cdf0e10cSrcweir nFontID = EE_CHAR_FONTINFO_CJK; 132*cdf0e10cSrcweir nFontHeightID = EE_CHAR_FONTHEIGHT_CJK; 133*cdf0e10cSrcweir nWeightID = EE_CHAR_WEIGHT_CJK; 134*cdf0e10cSrcweir nPostureID = EE_CHAR_ITALIC_CJK; 135*cdf0e10cSrcweir } 136*cdf0e10cSrcweir else if( 0 ) 137*cdf0e10cSrcweir { 138*cdf0e10cSrcweir nFontID = EE_CHAR_FONTINFO_CTL; 139*cdf0e10cSrcweir nFontHeightID = EE_CHAR_FONTHEIGHT_CTL; 140*cdf0e10cSrcweir nWeightID = EE_CHAR_WEIGHT_CTL; 141*cdf0e10cSrcweir nPostureID = EE_CHAR_ITALIC_CTL; 142*cdf0e10cSrcweir } 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir Font aMyFont; 145*cdf0e10cSrcweir const SvxFontItem& rFItem = 146*cdf0e10cSrcweir (SvxFontItem&)rSet.Get(GetWhich( (sal_uInt16)nFontID )); 147*cdf0e10cSrcweir aMyFont.SetFamily(rFItem.GetFamily()); 148*cdf0e10cSrcweir aMyFont.SetName(rFItem.GetFamilyName()); 149*cdf0e10cSrcweir aMyFont.SetCharSet(rFItem.GetCharSet()); 150*cdf0e10cSrcweir aMyFont.SetPitch(rFItem.GetPitch()); 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir const SvxFontHeightItem& rFHItem = 153*cdf0e10cSrcweir (SvxFontHeightItem&)rSet.Get(GetWhich( (sal_uInt16)nFontHeightID )); 154*cdf0e10cSrcweir aMyFont.SetSize(Size(0, rFHItem.GetHeight())); 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir const SvxWeightItem& rWItem = 157*cdf0e10cSrcweir (SvxWeightItem&)rSet.Get(GetWhich( (sal_uInt16)nWeightID )); 158*cdf0e10cSrcweir aMyFont.SetWeight(rWItem.GetWeight()); 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir const SvxPostureItem& rPItem = 161*cdf0e10cSrcweir (SvxPostureItem&)rSet.Get(GetWhich( (sal_uInt16)nPostureID )); 162*cdf0e10cSrcweir aMyFont.SetItalic(rPItem.GetPosture()); 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir const SvxUnderlineItem& rUItem = (SvxUnderlineItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_UNDERLINE)); 165*cdf0e10cSrcweir aMyFont.SetUnderline(rUItem.GetLineStyle()); 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir const SvxOverlineItem& rOItem = (SvxOverlineItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_OVERLINE)); 168*cdf0e10cSrcweir aMyFont.SetOverline(rOItem.GetLineStyle()); 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir const SvxCrossedOutItem& rCOItem = (SvxCrossedOutItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_STRIKEOUT)); 171*cdf0e10cSrcweir aMyFont.SetStrikeout(rCOItem.GetStrikeout()); 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir const SvxContourItem& rCItem = (SvxContourItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_CONTOUR)); 174*cdf0e10cSrcweir aMyFont.SetOutline(rCItem.GetValue()); 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir const SvxShadowedItem& rSItem = (SvxShadowedItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_SHADOWED)); 177*cdf0e10cSrcweir aMyFont.SetShadow(rSItem.GetValue()); 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir aNewLevel.SetBulletFont(&aMyFont); 180*cdf0e10cSrcweir // aNewLevel.SetBulletRelSize( 75 ); 181*cdf0e10cSrcweir aNumRule.SetLevel(nLevel, aNewLevel ); 182*cdf0e10cSrcweir } 183*cdf0e10cSrcweir else if( rSrcLevel.GetNumberingType() == com::sun::star::style::NumberingType::CHAR_SPECIAL ) 184*cdf0e10cSrcweir { 185*cdf0e10cSrcweir String aEmpty; 186*cdf0e10cSrcweir aNewLevel.SetPrefix( aEmpty ); 187*cdf0e10cSrcweir aNewLevel.SetSuffix( aEmpty ); 188*cdf0e10cSrcweir aNumRule.SetLevel(nLevel, aNewLevel ); 189*cdf0e10cSrcweir } 190*cdf0e10cSrcweir } 191*cdf0e10cSrcweir } 192