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/crossedoutitem.hxx>
30 : #include <editeng/postitem.hxx>
31 : #include <editeng/contouritem.hxx>
32 : #include <editeng/shdditem.hxx>
33 :
34 : //<- Fonts & Items
35 : #include <editeng/bulletitem.hxx>
36 : #include <editeng/brushitem.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 : // if enumeration instead bullet is chosen, adjust bullet font to template font
60 :
61 : // to be implemented if module supports CJK
62 0 : long nFontID = SID_ATTR_CHAR_FONT;
63 0 : long nFontHeightID = SID_ATTR_CHAR_FONTHEIGHT;
64 0 : long nWeightID = SID_ATTR_CHAR_WEIGHT;
65 0 : long nPostureID = SID_ATTR_CHAR_POSTURE;
66 :
67 0 : Font aMyFont;
68 : const SvxFontItem& rFItem =
69 0 : (SvxFontItem&)rSet.Get(GetWhich( (sal_uInt16)nFontID ));
70 0 : aMyFont.SetFamily(rFItem.GetFamily());
71 0 : aMyFont.SetName(rFItem.GetFamilyName());
72 0 : aMyFont.SetCharSet(rFItem.GetCharSet());
73 0 : aMyFont.SetPitch(rFItem.GetPitch());
74 :
75 : const SvxFontHeightItem& rFHItem =
76 0 : (SvxFontHeightItem&)rSet.Get(GetWhich( (sal_uInt16)nFontHeightID ));
77 0 : aMyFont.SetSize(Size(0, rFHItem.GetHeight()));
78 :
79 : const SvxWeightItem& rWItem =
80 0 : (SvxWeightItem&)rSet.Get(GetWhich( (sal_uInt16)nWeightID ));
81 0 : aMyFont.SetWeight(rWItem.GetWeight());
82 :
83 : const SvxPostureItem& rPItem =
84 0 : (SvxPostureItem&)rSet.Get(GetWhich( (sal_uInt16)nPostureID ));
85 0 : aMyFont.SetItalic(rPItem.GetPosture());
86 :
87 0 : const SvxUnderlineItem& rUItem = (SvxUnderlineItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_UNDERLINE));
88 0 : aMyFont.SetUnderline(rUItem.GetLineStyle());
89 :
90 0 : const SvxOverlineItem& rOItem = (SvxOverlineItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_OVERLINE));
91 0 : aMyFont.SetOverline(rOItem.GetLineStyle());
92 :
93 0 : const SvxCrossedOutItem& rCOItem = (SvxCrossedOutItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_STRIKEOUT));
94 0 : aMyFont.SetStrikeout(rCOItem.GetStrikeout());
95 :
96 0 : const SvxContourItem& rCItem = (SvxContourItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_CONTOUR));
97 0 : aMyFont.SetOutline(rCItem.GetValue());
98 :
99 0 : const SvxShadowedItem& rSItem = (SvxShadowedItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_SHADOWED));
100 0 : aMyFont.SetShadow(rSItem.GetValue());
101 :
102 0 : aNewLevel.SetBulletFont(&aMyFont);
103 0 : aNumRule.SetLevel(nLevel, aNewLevel );
104 : }
105 0 : else if( rSrcLevel.GetNumberingType() == com::sun::star::style::NumberingType::CHAR_SPECIAL )
106 : {
107 0 : aNewLevel.SetPrefix("");
108 0 : aNewLevel.SetSuffix("");
109 0 : aNumRule.SetLevel(nLevel, aNewLevel );
110 : }
111 0 : }
112 0 : }
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|