Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <svx/svxids.hrc>
31 : :
32 : : //-> Fonts & Items
33 : : #include <vcl/font.hxx>
34 : : #include <editeng/fontitem.hxx>
35 : : #include <editeng/fhgtitem.hxx>
36 : : #include <editeng/wghtitem.hxx>
37 : : #include <editeng/udlnitem.hxx>
38 : : #include <editeng/crsditem.hxx>
39 : : #include <editeng/postitem.hxx>
40 : : #include <editeng/cntritem.hxx>
41 : : #include <editeng/shdditem.hxx>
42 : :
43 : : //<- Fonts & Items
44 : : #include <editeng/bulitem.hxx>
45 : : #include <editeng/brshitem.hxx>
46 : : #include <vcl/graph.hxx>
47 : : #include <svl/itemset.hxx>
48 : : #include <svl/itempool.hxx>
49 : : #include <editeng/numitem.hxx>
50 : : #include <editeng/eeitem.hxx>
51 : :
52 : : #include "bulmaper.hxx"
53 : :
54 : :
55 : : #define GetWhich(nSlot) rSet.GetPool()->GetWhich( nSlot )
56 : :
57 : 0 : void SdBulletMapper::MapFontsInNumRule( SvxNumRule& aNumRule, const SfxItemSet& rSet )
58 : : {
59 : 0 : const sal_uInt16 nCount = aNumRule.GetLevelCount();
60 [ # # ]: 0 : for( sal_uInt16 nLevel = 0; nLevel < nCount; nLevel++ )
61 : : {
62 [ # # ]: 0 : const SvxNumberFormat& rSrcLevel = aNumRule.GetLevel(nLevel);
63 [ # # ]: 0 : SvxNumberFormat aNewLevel( rSrcLevel );
64 : :
65 [ # # # # ]: 0 : if(rSrcLevel.GetNumberingType() != com::sun::star::style::NumberingType::CHAR_SPECIAL &&
[ # # ]
66 : 0 : rSrcLevel.GetNumberingType() != com::sun::star::style::NumberingType::NUMBER_NONE )
67 : : {
68 : : // wenn Aufzaehlung statt Bullet gewaehlt wurde, wird der Bullet-Font
69 : : // dem Vorlagen-Font angeglichen
70 : :
71 : : // to be implemented if module supports CJK
72 : 0 : long nFontID = SID_ATTR_CHAR_FONT;
73 : 0 : long nFontHeightID = SID_ATTR_CHAR_FONTHEIGHT;
74 : 0 : long nWeightID = SID_ATTR_CHAR_WEIGHT;
75 : 0 : long nPostureID = SID_ATTR_CHAR_POSTURE;
76 : :
77 [ # # ]: 0 : Font aMyFont;
78 : : const SvxFontItem& rFItem =
79 [ # # ][ # # ]: 0 : (SvxFontItem&)rSet.Get(GetWhich( (sal_uInt16)nFontID ));
80 [ # # ]: 0 : aMyFont.SetFamily(rFItem.GetFamily());
81 [ # # ][ # # ]: 0 : aMyFont.SetName(rFItem.GetFamilyName());
82 [ # # ]: 0 : aMyFont.SetCharSet(rFItem.GetCharSet());
83 [ # # ]: 0 : aMyFont.SetPitch(rFItem.GetPitch());
84 : :
85 : : const SvxFontHeightItem& rFHItem =
86 [ # # ][ # # ]: 0 : (SvxFontHeightItem&)rSet.Get(GetWhich( (sal_uInt16)nFontHeightID ));
87 [ # # ]: 0 : aMyFont.SetSize(Size(0, rFHItem.GetHeight()));
88 : :
89 : : const SvxWeightItem& rWItem =
90 [ # # ][ # # ]: 0 : (SvxWeightItem&)rSet.Get(GetWhich( (sal_uInt16)nWeightID ));
91 [ # # ]: 0 : aMyFont.SetWeight(rWItem.GetWeight());
92 : :
93 : : const SvxPostureItem& rPItem =
94 [ # # ][ # # ]: 0 : (SvxPostureItem&)rSet.Get(GetWhich( (sal_uInt16)nPostureID ));
95 [ # # ]: 0 : aMyFont.SetItalic(rPItem.GetPosture());
96 : :
97 [ # # ][ # # ]: 0 : const SvxUnderlineItem& rUItem = (SvxUnderlineItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_UNDERLINE));
98 [ # # ]: 0 : aMyFont.SetUnderline(rUItem.GetLineStyle());
99 : :
100 [ # # ][ # # ]: 0 : const SvxOverlineItem& rOItem = (SvxOverlineItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_OVERLINE));
101 [ # # ]: 0 : aMyFont.SetOverline(rOItem.GetLineStyle());
102 : :
103 [ # # ][ # # ]: 0 : const SvxCrossedOutItem& rCOItem = (SvxCrossedOutItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_STRIKEOUT));
104 [ # # ]: 0 : aMyFont.SetStrikeout(rCOItem.GetStrikeout());
105 : :
106 [ # # ][ # # ]: 0 : const SvxContourItem& rCItem = (SvxContourItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_CONTOUR));
107 [ # # ]: 0 : aMyFont.SetOutline(rCItem.GetValue());
108 : :
109 [ # # ][ # # ]: 0 : const SvxShadowedItem& rSItem = (SvxShadowedItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_SHADOWED));
110 [ # # ]: 0 : aMyFont.SetShadow(rSItem.GetValue());
111 : :
112 [ # # ]: 0 : aNewLevel.SetBulletFont(&aMyFont);
113 [ # # ][ # # ]: 0 : aNumRule.SetLevel(nLevel, aNewLevel );
114 : : }
115 [ # # ]: 0 : else if( rSrcLevel.GetNumberingType() == com::sun::star::style::NumberingType::CHAR_SPECIAL )
116 : : {
117 [ # # ]: 0 : String aEmpty;
118 [ # # ]: 0 : aNewLevel.SetPrefix( aEmpty );
119 [ # # ]: 0 : aNewLevel.SetSuffix( aEmpty );
120 [ # # ][ # # ]: 0 : aNumRule.SetLevel(nLevel, aNewLevel );
121 : : }
122 [ # # ]: 0 : }
123 : 0 : }
124 : :
125 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|