update emoji autocorrect entries from po-files
[LibreOffice.git] / drawinglayer / source / attribute / fontattribute.cxx
blob571b29160d4cdf12245ecb711cb5d3cc0df34886
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 .
20 #include <drawinglayer/attribute/fontattribute.hxx>
21 #include <rtl/instance.hxx>
22 #include <rtl/ustring.hxx>
26 namespace drawinglayer
28 namespace attribute
30 class ImpFontAttribute
32 public:
33 /// core data
34 OUString maFamilyName; // Font Family Name
35 OUString maStyleName; // Font Style Name
36 sal_uInt16 mnWeight; // Font weight
38 /// bitfield
39 bool mbSymbol : 1; // Symbol Font Flag
40 bool mbVertical : 1; // Vertical Text Flag
41 bool mbItalic : 1; // Italic Flag
42 bool mbOutline : 1; // Outline Flag
43 bool mbRTL : 1; // RTL Flag
44 bool mbBiDiStrong : 1; // BiDi Flag
45 bool mbMonospaced : 1;
47 ImpFontAttribute(
48 const OUString& rFamilyName,
49 const OUString& rStyleName,
50 sal_uInt16 nWeight,
51 bool bSymbol,
52 bool bVertical,
53 bool bItalic,
54 bool bMonospaced,
55 bool bOutline,
56 bool bRTL,
57 bool bBiDiStrong)
58 : maFamilyName(rFamilyName),
59 maStyleName(rStyleName),
60 mnWeight(nWeight),
61 mbSymbol(bSymbol),
62 mbVertical(bVertical),
63 mbItalic(bItalic),
64 mbOutline(bOutline),
65 mbRTL(bRTL),
66 mbBiDiStrong(bBiDiStrong),
67 mbMonospaced(bMonospaced)
71 ImpFontAttribute()
72 : maFamilyName(),
73 maStyleName(),
74 mnWeight(0),
75 mbSymbol(false),
76 mbVertical(false),
77 mbItalic(false),
78 mbOutline(false),
79 mbRTL(false),
80 mbBiDiStrong(false),
81 mbMonospaced(false)
85 // data read access
86 const OUString& getFamilyName() const { return maFamilyName; }
87 const OUString& getStyleName() const { return maStyleName; }
88 sal_uInt16 getWeight() const { return mnWeight; }
89 bool getSymbol() const { return mbSymbol; }
90 bool getVertical() const { return mbVertical; }
91 bool getItalic() const { return mbItalic; }
92 bool getOutline() const { return mbOutline; }
93 bool getRTL() const { return mbRTL; }
94 bool getBiDiStrong() const { return mbBiDiStrong; }
95 bool getMonospaced() const { return mbMonospaced; }
97 bool operator==(const ImpFontAttribute& rCompare) const
99 return (getFamilyName() == rCompare.getFamilyName()
100 && getStyleName() == rCompare.getStyleName()
101 && getWeight() == rCompare.getWeight()
102 && getSymbol() == rCompare.getSymbol()
103 && getVertical() == rCompare.getVertical()
104 && getItalic() == rCompare.getItalic()
105 && getOutline() == rCompare.getOutline()
106 && getRTL() == rCompare.getRTL()
107 && getBiDiStrong() == rCompare.getBiDiStrong()
108 && getMonospaced() == rCompare.getMonospaced());
112 namespace
114 struct theGlobalDefault :
115 public rtl::Static< FontAttribute::ImplType, theGlobalDefault > {};
118 FontAttribute::FontAttribute(
119 const OUString& rFamilyName,
120 const OUString& rStyleName,
121 sal_uInt16 nWeight,
122 bool bSymbol,
123 bool bVertical,
124 bool bItalic,
125 bool bMonospaced,
126 bool bOutline,
127 bool bRTL,
128 bool bBiDiStrong)
129 : mpFontAttribute(ImpFontAttribute(
130 rFamilyName, rStyleName, nWeight, bSymbol, bVertical, bItalic, bMonospaced, bOutline, bRTL, bBiDiStrong))
134 FontAttribute::FontAttribute()
135 : mpFontAttribute(theGlobalDefault::get())
139 FontAttribute::FontAttribute(const FontAttribute& rCandidate)
140 : mpFontAttribute(rCandidate.mpFontAttribute)
144 FontAttribute::~FontAttribute()
148 FontAttribute& FontAttribute::operator=(const FontAttribute& rCandidate)
150 mpFontAttribute = rCandidate.mpFontAttribute;
151 return *this;
154 bool FontAttribute::operator==(const FontAttribute& rCandidate) const
156 return rCandidate.mpFontAttribute == mpFontAttribute;
159 const OUString& FontAttribute::getFamilyName() const
161 return mpFontAttribute->getFamilyName();
164 const OUString& FontAttribute::getStyleName() const
166 return mpFontAttribute->getStyleName();
169 sal_uInt16 FontAttribute::getWeight() const
171 return mpFontAttribute->getWeight();
174 bool FontAttribute::getSymbol() const
176 return mpFontAttribute->getSymbol();
179 bool FontAttribute::getVertical() const
181 return mpFontAttribute->getVertical();
184 bool FontAttribute::getItalic() const
186 return mpFontAttribute->getItalic();
189 bool FontAttribute::getOutline() const
191 return mpFontAttribute->getOutline();
194 bool FontAttribute::getRTL() const
196 return mpFontAttribute->getRTL();
199 bool FontAttribute::getBiDiStrong() const
201 return mpFontAttribute->getBiDiStrong();
204 bool FontAttribute::getMonospaced() const
206 return mpFontAttribute->getMonospaced();
210 } // end of namespace attribute
211 } // end of namespace drawinglayer
213 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */