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 .
23 #include <tools/color.hxx>
24 #include <tools/gen.hxx>
25 #include <i18nlangtag/lang.h>
26 #include <svl/poolitem.hxx>
28 //============================================================================
29 class SfxFontItem
: public SfxPoolItem
32 XubString m_aStyleName
;
36 rtl_TextEncoding m_nCharSet
;
37 LanguageType m_nLanguage
;
41 sal_Int16 m_nWidthType
;
43 sal_Int16 m_nUnderline
;
44 sal_Int16 m_nStrikeout
;
45 sal_Int16 m_nOrientation
;
46 unsigned m_bWordLine
: 1;
47 unsigned m_bOutline
: 1;
48 unsigned m_bShadow
: 1;
49 unsigned m_bKerning
: 1;
50 unsigned m_bHasFont
: 1;
51 unsigned m_bHasColor
: 1;
52 unsigned m_bHasFillColor
: 1;
57 inline SfxFontItem(sal_uInt16 nWhich
);
59 virtual int operator ==(const SfxPoolItem
& rItem
) const;
61 virtual SfxPoolItem
* Create(SvStream
& rStream
, sal_uInt16
) const;
62 virtual SvStream
& Store(SvStream
& rStream
, sal_uInt16
) const;
64 virtual SfxPoolItem
* Clone(SfxItemPool
* = 0) const
65 { return new SfxFontItem(*this); }
67 sal_Bool
hasFont() const { return m_bHasFont
; }
68 sal_Bool
hasColor() const { return m_bHasColor
; }
69 sal_Bool
hasFillColor() const { return m_bHasFillColor
; }
71 const XubString
& getName() const { return m_aName
; }
72 const XubString
& getStyleName() const { return m_aStyleName
; }
74 const Size
& getSize() const { return m_aSize
; }
75 const Color
& getColor() const { return m_aColor
; }
76 const Color
& getFillColor() const { return m_aFillColor
; }
78 rtl_TextEncoding
getCharSet() const { return m_nCharSet
; }
80 LanguageType
getLanguage() const { return m_nLanguage
; }
82 sal_Int16
getFamily() const { return m_nFamily
; }
83 sal_Int16
getPitch() const { return m_nPitch
; }
84 sal_Int16
getWeight() const { return m_nWeight
; }
85 sal_Int16
getWidthType() const { return m_nWidthType
; }
86 sal_Int16
getItalic() const { return m_nItalic
; }
87 sal_Int16
getUnderline() const { return m_nUnderline
; }
88 sal_Int16
getStrikeout() const { return m_nStrikeout
; }
89 sal_Int16
getOrientation() const { return m_nOrientation
; }
90 sal_Bool
getWordLine() const { return m_bWordLine
; }
91 sal_Bool
getOutline() const { return m_bOutline
; }
92 sal_Bool
getShadow() const { return m_bShadow
; }
93 sal_Bool
getKerning() const { return m_bKerning
; }
95 inline void setFont(sal_Int16 nTheFamily
, const XubString
& rTheName
,
96 const XubString
& rTheStyleName
, sal_Int16 nThePitch
,
97 rtl_TextEncoding nTheCharSet
);
98 inline void setWeight(sal_Int16 nTheWeight
);
99 inline void setItalic(sal_Int16 nTheItalic
);
100 inline void setHeight(sal_Int32 nHeight
);
101 inline void setColor(const Color
& rTheColor
);
102 inline void setFillColor(const Color
& rTheFillColor
);
103 inline void setUnderline(sal_Int16 nTheUnderline
);
104 inline void setStrikeout(sal_Int16 nTheStrikeout
);
105 inline void setOutline(sal_Bool bTheOutline
);
106 inline void setShadow(sal_Bool bTheShadow
);
107 inline void setLanguage(LanguageType nTheLanguage
);
110 inline SfxFontItem::SfxFontItem(sal_uInt16 which
):
112 m_nCharSet(RTL_TEXTENCODING_DONTKNOW
),
113 m_nLanguage(LANGUAGE_DONTKNOW
),
114 m_nFamily(0), // FAMILY_DONTKNOW
115 m_nPitch(0), // PITCH_DONTKNOW
116 m_nWeight(0), // WEIGHT_DONTKNOW
117 m_nWidthType(0), // WIDTH_DONTKNOW
118 m_nItalic(3), // ITALIC_DONTKNOW
119 m_nUnderline(4), // UNDERLINE_DONTKNOW
120 m_nStrikeout(3), // STRIKEOUT_DONTKNOW
122 m_bWordLine(sal_False
),
123 m_bOutline(sal_False
),
124 m_bShadow(sal_False
),
125 m_bKerning(sal_False
),
126 m_bHasFont(sal_False
),
127 m_bHasColor(sal_False
),
128 m_bHasFillColor(sal_False
)
131 inline void SfxFontItem::setFont(sal_Int16 nTheFamily
,
132 const XubString
& rTheName
,
133 const XubString
& rTheStyleName
,
135 rtl_TextEncoding nTheCharSet
)
137 m_nFamily
= nTheFamily
;
139 m_aStyleName
= rTheStyleName
;
140 m_nPitch
= nThePitch
;
141 m_nCharSet
= nTheCharSet
;
142 m_bHasFont
= sal_True
;
145 inline void SfxFontItem::setWeight(sal_Int16 nTheWeight
)
147 m_nWeight
= nTheWeight
;
148 m_bHasFont
= sal_True
;
151 inline void SfxFontItem::setItalic(sal_Int16 nTheItalic
)
153 m_nItalic
= nTheItalic
;
154 m_bHasFont
= sal_True
;
157 inline void SfxFontItem::setHeight(sal_Int32 nHeight
)
159 m_aSize
.setHeight(nHeight
);
160 m_bHasFont
= sal_True
;
163 inline void SfxFontItem::setColor(const Color
& rTheColor
)
165 m_aColor
= rTheColor
;
166 m_bHasColor
= sal_True
;
169 inline void SfxFontItem::setFillColor(const Color
& rTheFillColor
)
171 m_aFillColor
= rTheFillColor
;
172 m_bHasFillColor
= sal_True
;
175 inline void SfxFontItem::setUnderline(sal_Int16 nTheUnderline
)
177 m_nUnderline
= nTheUnderline
;
178 m_bHasFont
= sal_True
;
181 inline void SfxFontItem::setStrikeout(sal_Int16 nTheStrikeout
)
183 m_nStrikeout
= nTheStrikeout
;
184 m_bHasFont
= sal_True
;
187 inline void SfxFontItem::setOutline(sal_Bool bTheOutline
)
189 m_bOutline
= bTheOutline
;
190 m_bHasFont
= sal_True
;
193 inline void SfxFontItem::setShadow(sal_Bool bTheShadow
)
195 m_bShadow
= bTheShadow
;
196 m_bHasFont
= sal_True
;
199 inline void SfxFontItem::setLanguage(LanguageType nTheLanguage
)
201 m_nLanguage
= nTheLanguage
;
202 m_bHasFont
= sal_True
;
205 #endif // _SFONTITM_HXX
207 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */