1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <svx/svxids.hrc>
23 #include <vcl/font.hxx>
24 #include <editeng/fontitem.hxx>
25 #include <editeng/fhgtitem.hxx>
26 #include <editeng/wghtitem.hxx>
27 #include <editeng/udlnitem.hxx>
28 #include <editeng/crossedoutitem.hxx>
29 #include <editeng/postitem.hxx>
30 #include <editeng/contouritem.hxx>
31 #include <editeng/shdditem.hxx>
34 #include <editeng/bulletitem.hxx>
35 #include <editeng/brushitem.hxx>
36 #include <vcl/graph.hxx>
37 #include <svl/itemset.hxx>
38 #include <svl/itempool.hxx>
39 #include <editeng/numitem.hxx>
40 #include <editeng/eeitem.hxx>
42 #include <bulmaper.hxx>
44 #define GetWhich(nSlot) rSet.GetPool()->GetWhich( nSlot )
46 void SdBulletMapper::MapFontsInNumRule( SvxNumRule
& aNumRule
, const SfxItemSet
& rSet
)
48 const sal_uInt16 nCount
= aNumRule
.GetLevelCount();
49 for( sal_uInt16 nLevel
= 0; nLevel
< nCount
; nLevel
++ )
51 const SvxNumberFormat
& rSrcLevel
= aNumRule
.GetLevel(nLevel
);
52 SvxNumberFormat
aNewLevel( rSrcLevel
);
54 if(rSrcLevel
.GetNumberingType() != css::style::NumberingType::CHAR_SPECIAL
&&
55 rSrcLevel
.GetNumberingType() != css::style::NumberingType::NUMBER_NONE
)
57 // if enumeration instead bullet is chosen, adjust bullet font to template font
59 // to be implemented if module supports CJK
62 const SvxFontItem
& rFItem
=
63 static_cast<const SvxFontItem
&>(rSet
.Get(GetWhich( sal_uInt16(SID_ATTR_CHAR_FONT
) )));
64 aMyFont
.SetFamily(rFItem
.GetFamily());
65 aMyFont
.SetFamilyName(rFItem
.GetFamilyName());
66 aMyFont
.SetCharSet(rFItem
.GetCharSet());
67 aMyFont
.SetPitch(rFItem
.GetPitch());
69 const SvxFontHeightItem
& rFHItem
=
70 static_cast<const SvxFontHeightItem
&>(rSet
.Get(GetWhich( sal_uInt16(SID_ATTR_CHAR_FONTHEIGHT
) )));
71 aMyFont
.SetFontSize(Size(0, rFHItem
.GetHeight()));
73 const SvxWeightItem
& rWItem
=
74 static_cast<const SvxWeightItem
&>(rSet
.Get(GetWhich( sal_uInt16(SID_ATTR_CHAR_WEIGHT
) )));
75 aMyFont
.SetWeight(rWItem
.GetWeight());
77 const SvxPostureItem
& rPItem
=
78 static_cast<const SvxPostureItem
&>(rSet
.Get(GetWhich( sal_uInt16(SID_ATTR_CHAR_POSTURE
) )));
79 aMyFont
.SetItalic(rPItem
.GetPosture());
81 const SvxUnderlineItem
& rUItem
= static_cast<const SvxUnderlineItem
&>(rSet
.Get(GetWhich(SID_ATTR_CHAR_UNDERLINE
)));
82 aMyFont
.SetUnderline(rUItem
.GetLineStyle());
84 const SvxOverlineItem
& rOItem
= static_cast<const SvxOverlineItem
&>(rSet
.Get(GetWhich(SID_ATTR_CHAR_OVERLINE
)));
85 aMyFont
.SetOverline(rOItem
.GetLineStyle());
87 const SvxCrossedOutItem
& rCOItem
= static_cast<const SvxCrossedOutItem
&>(rSet
.Get(GetWhich(SID_ATTR_CHAR_STRIKEOUT
)));
88 aMyFont
.SetStrikeout(rCOItem
.GetStrikeout());
90 const SvxContourItem
& rCItem
= static_cast<const SvxContourItem
&>(rSet
.Get(GetWhich(SID_ATTR_CHAR_CONTOUR
)));
91 aMyFont
.SetOutline(rCItem
.GetValue());
93 const SvxShadowedItem
& rSItem
= static_cast<const SvxShadowedItem
&>(rSet
.Get(GetWhich(SID_ATTR_CHAR_SHADOWED
)));
94 aMyFont
.SetShadow(rSItem
.GetValue());
96 aNewLevel
.SetBulletFont(&aMyFont
);
97 aNumRule
.SetLevel(nLevel
, aNewLevel
);
99 else if( rSrcLevel
.GetNumberingType() == css::style::NumberingType::CHAR_SPECIAL
)
101 aNewLevel
.SetPrefix("");
102 aNewLevel
.SetSuffix("");
103 aNumRule
.SetLevel(nLevel
, aNewLevel
);
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */