1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_sd.hxx" 26 27 #ifdef SD_DLLIMPLEMENTATION 28 #undef SD_DLLIMPLEMENTATION 29 #endif 30 31 #ifndef _SVX_SVXIDS_HRC 32 #include <svx/svxids.hrc> 33 #endif 34 35 //-> Fonts & Items 36 #include <vcl/font.hxx> 37 #include <editeng/fontitem.hxx> 38 #include <editeng/fhgtitem.hxx> 39 #include <editeng/wghtitem.hxx> 40 #include <editeng/udlnitem.hxx> 41 #include <editeng/crsditem.hxx> 42 #include <editeng/postitem.hxx> 43 #include <editeng/cntritem.hxx> 44 #include <editeng/shdditem.hxx> 45 46 //<- Fonts & Items 47 #include <editeng/bulitem.hxx> 48 #include <editeng/brshitem.hxx> 49 #include <vcl/graph.hxx> 50 #include <svl/itemset.hxx> 51 #include <svl/itempool.hxx> 52 #include <editeng/numitem.hxx> 53 #include <editeng/eeitem.hxx> 54 55 #include "bulmaper.hxx" 56 57 58 #define GetWhich(nSlot) rSet.GetPool()->GetWhich( nSlot ) 59 60 /* #i35937# 61 62 void SdBulletMapper::PreMapNumBulletForDialog( SfxItemSet& rSet ) 63 { 64 if( SFX_ITEM_SET == rSet.GetItemState( EE_PARA_NUMBULLET, sal_False ) ) 65 { 66 SvxNumRule* pRule = ((SvxNumBulletItem*)rSet.GetItem( EE_PARA_NUMBULLET ))->GetNumRule(); 67 68 if(pRule && pRule->GetNumRuleType() == SVX_RULETYPE_PRESENTATION_NUMBERING) 69 { 70 // 10er Bullet Item auf 9er Item mappen 71 SvxNumRule aNewRule( pRule->GetFeatureFlags(), 9, sal_False, SVX_RULETYPE_PRESENTATION_NUMBERING ); 72 73 for( sal_uInt16 i = 0; i < 9; i++ ) 74 aNewRule.SetLevel(i, pRule->GetLevel(i)); 75 76 rSet.Put( SvxNumBulletItem( aNewRule, EE_PARA_NUMBULLET ) ); 77 } 78 } 79 } 80 81 void SdBulletMapper::PostMapNumBulletForDialog( SfxItemSet& rSet ) 82 { 83 if( SFX_ITEM_SET == rSet.GetItemState( EE_PARA_NUMBULLET, sal_False ) ) 84 { 85 SvxNumRule* pRule = ((SvxNumBulletItem*)rSet.GetItem( EE_PARA_NUMBULLET ))->GetNumRule(); 86 87 if(pRule) 88 { 89 pRule->UnLinkGraphics(); 90 if(pRule->GetNumRuleType() == SVX_RULETYPE_PRESENTATION_NUMBERING) 91 { 92 // 9er Bullet Item auf 10er Item mappen 93 SvxNumRule aNewRule( pRule->GetFeatureFlags(), 10, sal_False, SVX_RULETYPE_PRESENTATION_NUMBERING ); 94 95 for( sal_uInt16 i = 0; i < 9; i++ ) 96 aNewRule.SetLevel(i, pRule->GetLevel(i)); 97 98 rSet.Put( SvxNumBulletItem( aNewRule, EE_PARA_NUMBULLET ) ); 99 } 100 } 101 } 102 } 103 */ 104 105 void SdBulletMapper::MapFontsInNumRule( SvxNumRule& aNumRule, const SfxItemSet& rSet ) 106 { 107 const sal_uInt16 nCount = aNumRule.GetLevelCount(); 108 for( sal_uInt16 nLevel = 0; nLevel < nCount; nLevel++ ) 109 { 110 const SvxNumberFormat& rSrcLevel = aNumRule.GetLevel(nLevel); 111 SvxNumberFormat aNewLevel( rSrcLevel ); 112 113 if(rSrcLevel.GetNumberingType() != com::sun::star::style::NumberingType::CHAR_SPECIAL && 114 rSrcLevel.GetNumberingType() != com::sun::star::style::NumberingType::NUMBER_NONE ) 115 { 116 // wenn Aufzaehlung statt Bullet gewaehlt wurde, wird der Bullet-Font 117 // dem Vorlagen-Font angeglichen 118 119 // to be implemented if module supports CJK 120 long nFontID = SID_ATTR_CHAR_FONT; 121 long nFontHeightID = SID_ATTR_CHAR_FONTHEIGHT; 122 long nWeightID = SID_ATTR_CHAR_WEIGHT; 123 long nPostureID = SID_ATTR_CHAR_POSTURE; 124 125 if( 0 ) 126 { 127 nFontID = EE_CHAR_FONTINFO_CJK; 128 nFontHeightID = EE_CHAR_FONTHEIGHT_CJK; 129 nWeightID = EE_CHAR_WEIGHT_CJK; 130 nPostureID = EE_CHAR_ITALIC_CJK; 131 } 132 else if( 0 ) 133 { 134 nFontID = EE_CHAR_FONTINFO_CTL; 135 nFontHeightID = EE_CHAR_FONTHEIGHT_CTL; 136 nWeightID = EE_CHAR_WEIGHT_CTL; 137 nPostureID = EE_CHAR_ITALIC_CTL; 138 } 139 140 Font aMyFont; 141 const SvxFontItem& rFItem = 142 (SvxFontItem&)rSet.Get(GetWhich( (sal_uInt16)nFontID )); 143 aMyFont.SetFamily(rFItem.GetFamily()); 144 aMyFont.SetName(rFItem.GetFamilyName()); 145 aMyFont.SetCharSet(rFItem.GetCharSet()); 146 aMyFont.SetPitch(rFItem.GetPitch()); 147 148 const SvxFontHeightItem& rFHItem = 149 (SvxFontHeightItem&)rSet.Get(GetWhich( (sal_uInt16)nFontHeightID )); 150 aMyFont.SetSize(Size(0, rFHItem.GetHeight())); 151 152 const SvxWeightItem& rWItem = 153 (SvxWeightItem&)rSet.Get(GetWhich( (sal_uInt16)nWeightID )); 154 aMyFont.SetWeight(rWItem.GetWeight()); 155 156 const SvxPostureItem& rPItem = 157 (SvxPostureItem&)rSet.Get(GetWhich( (sal_uInt16)nPostureID )); 158 aMyFont.SetItalic(rPItem.GetPosture()); 159 160 const SvxUnderlineItem& rUItem = (SvxUnderlineItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_UNDERLINE)); 161 aMyFont.SetUnderline(rUItem.GetLineStyle()); 162 163 const SvxOverlineItem& rOItem = (SvxOverlineItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_OVERLINE)); 164 aMyFont.SetOverline(rOItem.GetLineStyle()); 165 166 const SvxCrossedOutItem& rCOItem = (SvxCrossedOutItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_STRIKEOUT)); 167 aMyFont.SetStrikeout(rCOItem.GetStrikeout()); 168 169 const SvxContourItem& rCItem = (SvxContourItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_CONTOUR)); 170 aMyFont.SetOutline(rCItem.GetValue()); 171 172 const SvxShadowedItem& rSItem = (SvxShadowedItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_SHADOWED)); 173 aMyFont.SetShadow(rSItem.GetValue()); 174 175 aNewLevel.SetBulletFont(&aMyFont); 176 // aNewLevel.SetBulletRelSize( 75 ); 177 aNumRule.SetLevel(nLevel, aNewLevel ); 178 } 179 else if( rSrcLevel.GetNumberingType() == com::sun::star::style::NumberingType::CHAR_SPECIAL ) 180 { 181 String aEmpty; 182 aNewLevel.SetPrefix( aEmpty ); 183 aNewLevel.SetSuffix( aEmpty ); 184 aNumRule.SetLevel(nLevel, aNewLevel ); 185 } 186 } 187 } 188