Branch data Line data Source code
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 : : #ifndef _SFONTITM_HXX
21 : : #define _SFONTITM_HXX
22 : :
23 : : #include <tools/color.hxx>
24 : : #include <tools/gen.hxx>
25 : : #include <i18npool/lang.h>
26 : : #include <svl/poolitem.hxx>
27 : :
28 : : //============================================================================
29 [ # # ][ # # ]: 0 : class SfxFontItem: public SfxPoolItem
[ # # ][ # # ]
[ # # ]
30 : : {
31 : : XubString m_aName;
32 : : XubString m_aStyleName;
33 : : Size m_aSize;
34 : : Color m_aColor;
35 : : Color m_aFillColor;
36 : : rtl_TextEncoding m_nCharSet;
37 : : LanguageType m_nLanguage;
38 : : sal_Int16 m_nFamily;
39 : : sal_Int16 m_nPitch;
40 : : sal_Int16 m_nWeight;
41 : : sal_Int16 m_nWidthType;
42 : : sal_Int16 m_nItalic;
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;
53 : :
54 : : public:
55 : : TYPEINFO();
56 : :
57 : : inline SfxFontItem(sal_uInt16 nWhich);
58 : :
59 : : virtual int operator ==(const SfxPoolItem & rItem) const;
60 : :
61 : : virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const;
62 : : virtual SvStream & Store(SvStream & rStream, sal_uInt16) const;
63 : :
64 : 0 : virtual SfxPoolItem * Clone(SfxItemPool * = 0) const
65 [ # # ]: 0 : { return new SfxFontItem(*this); }
66 : :
67 : : sal_Bool hasFont() const { return m_bHasFont; }
68 : : sal_Bool hasColor() const { return m_bHasColor; }
69 : : sal_Bool hasFillColor() const { return m_bHasFillColor; }
70 : :
71 : : const XubString & getName() const { return m_aName; }
72 : : const XubString & getStyleName() const { return m_aStyleName; }
73 : :
74 : : const Size & getSize() const { return m_aSize; }
75 : : const Color & getColor() const { return m_aColor; }
76 : : const Color & getFillColor() const { return m_aFillColor; }
77 : :
78 : : rtl_TextEncoding getCharSet() const { return m_nCharSet; }
79 : :
80 : : LanguageType getLanguage() const { return m_nLanguage; }
81 : :
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; }
94 : :
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);
108 : : };
109 : :
110 : 0 : inline SfxFontItem::SfxFontItem(sal_uInt16 which):
111 : : SfxPoolItem(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
121 : : m_nOrientation(0),
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 [ # # ][ # # ]: 0 : m_bHasFillColor(sal_False)
129 : 0 : {}
130 : :
131 : : inline void SfxFontItem::setFont(sal_Int16 nTheFamily,
132 : : const XubString & rTheName,
133 : : const XubString & rTheStyleName,
134 : : sal_Int16 nThePitch,
135 : : rtl_TextEncoding nTheCharSet)
136 : : {
137 : : m_nFamily = nTheFamily;
138 : : m_aName = rTheName;
139 : : m_aStyleName = rTheStyleName;
140 : : m_nPitch = nThePitch;
141 : : m_nCharSet = nTheCharSet;
142 : : m_bHasFont = sal_True;
143 : : }
144 : :
145 : : inline void SfxFontItem::setWeight(sal_Int16 nTheWeight)
146 : : {
147 : : m_nWeight = nTheWeight;
148 : : m_bHasFont = sal_True;
149 : : }
150 : :
151 : : inline void SfxFontItem::setItalic(sal_Int16 nTheItalic)
152 : : {
153 : : m_nItalic = nTheItalic;
154 : : m_bHasFont = sal_True;
155 : : }
156 : :
157 : : inline void SfxFontItem::setHeight(sal_Int32 nHeight)
158 : : {
159 : : m_aSize.setHeight(nHeight);
160 : : m_bHasFont = sal_True;
161 : : }
162 : :
163 : : inline void SfxFontItem::setColor(const Color & rTheColor)
164 : : {
165 : : m_aColor = rTheColor;
166 : : m_bHasColor = sal_True;
167 : : }
168 : :
169 : : inline void SfxFontItem::setFillColor(const Color & rTheFillColor)
170 : : {
171 : : m_aFillColor = rTheFillColor;
172 : : m_bHasFillColor = sal_True;
173 : : }
174 : :
175 : : inline void SfxFontItem::setUnderline(sal_Int16 nTheUnderline)
176 : : {
177 : : m_nUnderline = nTheUnderline;
178 : : m_bHasFont = sal_True;
179 : : }
180 : :
181 : : inline void SfxFontItem::setStrikeout(sal_Int16 nTheStrikeout)
182 : : {
183 : : m_nStrikeout = nTheStrikeout;
184 : : m_bHasFont = sal_True;
185 : : }
186 : :
187 : : inline void SfxFontItem::setOutline(sal_Bool bTheOutline)
188 : : {
189 : : m_bOutline = bTheOutline;
190 : : m_bHasFont = sal_True;
191 : : }
192 : :
193 : : inline void SfxFontItem::setShadow(sal_Bool bTheShadow)
194 : : {
195 : : m_bShadow = bTheShadow;
196 : : m_bHasFont = sal_True;
197 : : }
198 : :
199 : : inline void SfxFontItem::setLanguage(LanguageType nTheLanguage)
200 : : {
201 : : m_nLanguage = nTheLanguage;
202 : : m_bHasFont = sal_True;
203 : : }
204 : :
205 : : #endif // _SFONTITM_HXX
206 : :
207 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|