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 <drawinglayer/attribute/fontattribute.hxx>
21 #include <rtl/instance.hxx>
22 #include <rtl/ustring.hxx>
26 namespace drawinglayer
30 class ImpFontAttribute
34 OUString maFamilyName
; // Font Family Name
35 OUString maStyleName
; // Font Style Name
36 sal_uInt16 mnWeight
; // Font weight
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;
48 const OUString
& rFamilyName
,
49 const OUString
& rStyleName
,
58 : maFamilyName(rFamilyName
),
59 maStyleName(rStyleName
),
62 mbVertical(bVertical
),
66 mbBiDiStrong(bBiDiStrong
),
67 mbMonospaced(bMonospaced
)
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());
114 struct theGlobalDefault
:
115 public rtl::Static
< FontAttribute::ImplType
, theGlobalDefault
> {};
118 FontAttribute::FontAttribute(
119 const OUString
& rFamilyName
,
120 const OUString
& rStyleName
,
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
;
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: */