LibreOffice Module sd (master) 1
bulmaper.cxx
Go to the documentation of this file.
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#include <editeng/editids.hrc>
21
22//-> Fonts & Items
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>
29#include <editeng/postitem.hxx>
31#include <editeng/shdditem.hxx>
32
33//<- Fonts & Items
34#include <svl/itemset.hxx>
35#include <svl/itempool.hxx>
36#include <editeng/numitem.hxx>
37
38#include <bulmaper.hxx>
39
40#define GetWhich(nSlot) rSet.GetPool()->GetWhich( nSlot )
41
43{
44 const sal_uInt16 nCount = aNumRule.GetLevelCount();
45 for( sal_uInt16 nLevel = 0; nLevel < nCount; nLevel++ )
46 {
47 const SvxNumberFormat& rSrcLevel = aNumRule.GetLevel(nLevel);
48 SvxNumberFormat aNewLevel( rSrcLevel );
49
50 if(rSrcLevel.GetNumberingType() != css::style::NumberingType::CHAR_SPECIAL &&
51 rSrcLevel.GetNumberingType() != css::style::NumberingType::NUMBER_NONE )
52 {
53 // if enumeration instead bullet is chosen, adjust bullet font to template font
54
55 // to be implemented if module supports CJK
56
57 vcl::Font aMyFont;
58 const SvxFontItem& rFItem = rSet.Get(GetWhich( SID_ATTR_CHAR_FONT ));
59 aMyFont.SetFamily(rFItem.GetFamily());
60 aMyFont.SetFamilyName(rFItem.GetFamilyName());
61 aMyFont.SetCharSet(rFItem.GetCharSet());
62 aMyFont.SetPitch(rFItem.GetPitch());
63
64 const SvxFontHeightItem& rFHItem = rSet.Get(GetWhich( SID_ATTR_CHAR_FONTHEIGHT ));
65 aMyFont.SetFontSize(Size(0, rFHItem.GetHeight()));
66
67 const SvxWeightItem& rWItem = rSet.Get(GetWhich( SID_ATTR_CHAR_WEIGHT ));
68 aMyFont.SetWeight(rWItem.GetWeight());
69
70 const SvxPostureItem& rPItem = rSet.Get(GetWhich(SID_ATTR_CHAR_POSTURE));
71 aMyFont.SetItalic(rPItem.GetPosture());
72
73 const SvxUnderlineItem& rUItem = rSet.Get(GetWhich(SID_ATTR_CHAR_UNDERLINE));
74 aMyFont.SetUnderline(rUItem.GetLineStyle());
75
76 const SvxOverlineItem& rOItem = rSet.Get(GetWhich(SID_ATTR_CHAR_OVERLINE));
77 aMyFont.SetOverline(rOItem.GetLineStyle());
78
79 const SvxCrossedOutItem& rCOItem = rSet.Get(GetWhich(SID_ATTR_CHAR_STRIKEOUT));
80 aMyFont.SetStrikeout(rCOItem.GetStrikeout());
81
82 const SvxContourItem& rCItem = rSet.Get(GetWhich(SID_ATTR_CHAR_CONTOUR));
83 aMyFont.SetOutline(rCItem.GetValue());
84
85 const SvxShadowedItem& rSItem = rSet.Get(GetWhich(SID_ATTR_CHAR_SHADOWED));
86 aMyFont.SetShadow(rSItem.GetValue());
87
88 aNewLevel.SetBulletFont(&aMyFont);
89 aNumRule.SetLevel(nLevel, aNewLevel );
90 }
91 else if( rSrcLevel.GetNumberingType() == css::style::NumberingType::CHAR_SPECIAL )
92 {
93 aNewLevel.SetListFormat("", "", nLevel);
94 aNumRule.SetLevel(nLevel, aNewLevel );
95 }
96 }
97}
98
99/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define GetWhich(nSlot)
Definition: bulmaper.cxx:40
static void MapFontsInNumRule(SvxNumRule &aNumRule, const SfxItemSet &rSet)
Definition: bulmaper.cxx:42
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
FontStrikeout GetStrikeout() const
sal_uInt32 GetHeight() const
FontFamily GetFamily() const
FontPitch GetPitch() const
rtl_TextEncoding GetCharSet() const
const OUString & GetFamilyName() const
sal_uInt16 GetLevelCount() const
const SvxNumberFormat & GetLevel(sal_uInt16 nLevel) const
void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat &rFmt, bool bIsValid=true)
void SetBulletFont(const vcl::Font *pFont)
void SetListFormat(const OUString &rPrefix, const OUString &rSuffix, int nLevel)
SvxNumType GetNumberingType() const
FontItalic GetPosture() const
FontLineStyle GetLineStyle() const
FontWeight GetWeight() const
void SetFontSize(const Size &)
void SetOutline(bool bOutline)
void SetPitch(FontPitch ePitch)
void SetItalic(FontItalic)
void SetWeight(FontWeight)
void SetFamily(FontFamily)
void SetUnderline(FontLineStyle)
void SetCharSet(rtl_TextEncoding)
void SetOverline(FontLineStyle)
void SetFamilyName(const OUString &rFamilyName)
void SetShadow(bool bShadow)
void SetStrikeout(FontStrikeout)
int nCount
static SfxItemSet & rSet