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 :
21 : #include <svx/svxids.hrc>
22 :
23 : //-> Fonts & Items
24 : #include <vcl/font.hxx>
25 : #include <editeng/fontitem.hxx>
26 : #include <editeng/fhgtitem.hxx>
27 : #include <editeng/wghtitem.hxx>
28 : #include <editeng/udlnitem.hxx>
29 : #include <editeng/crsditem.hxx>
30 : #include <editeng/postitem.hxx>
31 : #include <editeng/cntritem.hxx>
32 : #include <editeng/shdditem.hxx>
33 :
34 : //<- Fonts & Items
35 : #include <editeng/bulitem.hxx>
36 : #include <editeng/brshitem.hxx>
37 : #include <vcl/graph.hxx>
38 : #include <svl/itemset.hxx>
39 : #include <svl/itempool.hxx>
40 : #include <editeng/numitem.hxx>
41 : #include <editeng/eeitem.hxx>
42 :
43 : #include "bulmaper.hxx"
44 :
45 :
46 : #define GetWhich(nSlot) rSet.GetPool()->GetWhich( nSlot )
47 :
48 0 : void SdBulletMapper::MapFontsInNumRule( SvxNumRule& aNumRule, const SfxItemSet& rSet )
49 : {
50 0 : const sal_uInt16 nCount = aNumRule.GetLevelCount();
51 0 : for( sal_uInt16 nLevel = 0; nLevel < nCount; nLevel++ )
52 : {
53 0 : const SvxNumberFormat& rSrcLevel = aNumRule.GetLevel(nLevel);
54 0 : SvxNumberFormat aNewLevel( rSrcLevel );
55 :
56 0 : if(rSrcLevel.GetNumberingType() != com::sun::star::style::NumberingType::CHAR_SPECIAL &&
57 0 : rSrcLevel.GetNumberingType() != com::sun::star::style::NumberingType::NUMBER_NONE )
58 : {
59 : // wenn Aufzaehlung statt Bullet gewaehlt wurde, wird der Bullet-Font
60 : // dem Vorlagen-Font angeglichen
61 :
62 : // to be implemented if module supports CJK
63 0 : long nFontID = SID_ATTR_CHAR_FONT;
64 0 : long nFontHeightID = SID_ATTR_CHAR_FONTHEIGHT;
65 0 : long nWeightID = SID_ATTR_CHAR_WEIGHT;
66 0 : long nPostureID = SID_ATTR_CHAR_POSTURE;
67 :
68 0 : Font aMyFont;
69 : const SvxFontItem& rFItem =
70 0 : (SvxFontItem&)rSet.Get(GetWhich( (sal_uInt16)nFontID ));
71 0 : aMyFont.SetFamily(rFItem.GetFamily());
72 0 : aMyFont.SetName(rFItem.GetFamilyName());
73 0 : aMyFont.SetCharSet(rFItem.GetCharSet());
74 0 : aMyFont.SetPitch(rFItem.GetPitch());
75 :
76 : const SvxFontHeightItem& rFHItem =
77 0 : (SvxFontHeightItem&)rSet.Get(GetWhich( (sal_uInt16)nFontHeightID ));
78 0 : aMyFont.SetSize(Size(0, rFHItem.GetHeight()));
79 :
80 : const SvxWeightItem& rWItem =
81 0 : (SvxWeightItem&)rSet.Get(GetWhich( (sal_uInt16)nWeightID ));
82 0 : aMyFont.SetWeight(rWItem.GetWeight());
83 :
84 : const SvxPostureItem& rPItem =
85 0 : (SvxPostureItem&)rSet.Get(GetWhich( (sal_uInt16)nPostureID ));
86 0 : aMyFont.SetItalic(rPItem.GetPosture());
87 :
88 0 : const SvxUnderlineItem& rUItem = (SvxUnderlineItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_UNDERLINE));
89 0 : aMyFont.SetUnderline(rUItem.GetLineStyle());
90 :
91 0 : const SvxOverlineItem& rOItem = (SvxOverlineItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_OVERLINE));
92 0 : aMyFont.SetOverline(rOItem.GetLineStyle());
93 :
94 0 : const SvxCrossedOutItem& rCOItem = (SvxCrossedOutItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_STRIKEOUT));
95 0 : aMyFont.SetStrikeout(rCOItem.GetStrikeout());
96 :
97 0 : const SvxContourItem& rCItem = (SvxContourItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_CONTOUR));
98 0 : aMyFont.SetOutline(rCItem.GetValue());
99 :
100 0 : const SvxShadowedItem& rSItem = (SvxShadowedItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_SHADOWED));
101 0 : aMyFont.SetShadow(rSItem.GetValue());
102 :
103 0 : aNewLevel.SetBulletFont(&aMyFont);
104 0 : aNumRule.SetLevel(nLevel, aNewLevel );
105 : }
106 0 : else if( rSrcLevel.GetNumberingType() == com::sun::star::style::NumberingType::CHAR_SPECIAL )
107 : {
108 0 : String aEmpty;
109 0 : aNewLevel.SetPrefix( aEmpty );
110 0 : aNewLevel.SetSuffix( aEmpty );
111 0 : aNumRule.SetLevel(nLevel, aNewLevel );
112 : }
113 0 : }
114 0 : }
115 :
116 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|