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