bump product version to 4.1.6.2
[LibreOffice.git] / sd / source / ui / func / bulmaper.cxx
blob091fb525f6284c4e2e013601af5771b7f3b302e2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
21 #include <svx/svxids.hrc>
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>
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>
43 #include "bulmaper.hxx"
46 #define GetWhich(nSlot) rSet.GetPool()->GetWhich( nSlot )
48 void SdBulletMapper::MapFontsInNumRule( SvxNumRule& aNumRule, const SfxItemSet& rSet )
50 const sal_uInt16 nCount = aNumRule.GetLevelCount();
51 for( sal_uInt16 nLevel = 0; nLevel < nCount; nLevel++ )
53 const SvxNumberFormat& rSrcLevel = aNumRule.GetLevel(nLevel);
54 SvxNumberFormat aNewLevel( rSrcLevel );
56 if(rSrcLevel.GetNumberingType() != com::sun::star::style::NumberingType::CHAR_SPECIAL &&
57 rSrcLevel.GetNumberingType() != com::sun::star::style::NumberingType::NUMBER_NONE )
59 // if enumeration instead bullet is chosen, adjust bullet font to template font
61 // to be implemented if module supports CJK
62 long nFontID = SID_ATTR_CHAR_FONT;
63 long nFontHeightID = SID_ATTR_CHAR_FONTHEIGHT;
64 long nWeightID = SID_ATTR_CHAR_WEIGHT;
65 long nPostureID = SID_ATTR_CHAR_POSTURE;
67 Font aMyFont;
68 const SvxFontItem& rFItem =
69 (SvxFontItem&)rSet.Get(GetWhich( (sal_uInt16)nFontID ));
70 aMyFont.SetFamily(rFItem.GetFamily());
71 aMyFont.SetName(rFItem.GetFamilyName());
72 aMyFont.SetCharSet(rFItem.GetCharSet());
73 aMyFont.SetPitch(rFItem.GetPitch());
75 const SvxFontHeightItem& rFHItem =
76 (SvxFontHeightItem&)rSet.Get(GetWhich( (sal_uInt16)nFontHeightID ));
77 aMyFont.SetSize(Size(0, rFHItem.GetHeight()));
79 const SvxWeightItem& rWItem =
80 (SvxWeightItem&)rSet.Get(GetWhich( (sal_uInt16)nWeightID ));
81 aMyFont.SetWeight(rWItem.GetWeight());
83 const SvxPostureItem& rPItem =
84 (SvxPostureItem&)rSet.Get(GetWhich( (sal_uInt16)nPostureID ));
85 aMyFont.SetItalic(rPItem.GetPosture());
87 const SvxUnderlineItem& rUItem = (SvxUnderlineItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_UNDERLINE));
88 aMyFont.SetUnderline(rUItem.GetLineStyle());
90 const SvxOverlineItem& rOItem = (SvxOverlineItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_OVERLINE));
91 aMyFont.SetOverline(rOItem.GetLineStyle());
93 const SvxCrossedOutItem& rCOItem = (SvxCrossedOutItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_STRIKEOUT));
94 aMyFont.SetStrikeout(rCOItem.GetStrikeout());
96 const SvxContourItem& rCItem = (SvxContourItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_CONTOUR));
97 aMyFont.SetOutline(rCItem.GetValue());
99 const SvxShadowedItem& rSItem = (SvxShadowedItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_SHADOWED));
100 aMyFont.SetShadow(rSItem.GetValue());
102 aNewLevel.SetBulletFont(&aMyFont);
103 aNumRule.SetLevel(nLevel, aNewLevel );
105 else if( rSrcLevel.GetNumberingType() == com::sun::star::style::NumberingType::CHAR_SPECIAL )
107 String aEmpty;
108 aNewLevel.SetPrefix( aEmpty );
109 aNewLevel.SetSuffix( aEmpty );
110 aNumRule.SetLevel(nLevel, aNewLevel );
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */