xref: /AOO41X/main/svl/inc/svl/sfontitm.hxx (revision 39a19a47feaddbaa21988da8c7bf801707fd3d48)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SFONTITM_HXX
25 #define _SFONTITM_HXX
26 
27 #include <tools/color.hxx>
28 #include <tools/gen.hxx>
29 #include <i18npool/lang.h>
30 #include <svl/poolitem.hxx>
31 
32 //============================================================================
33 class SfxFontItem: public SfxPoolItem
34 {
35     XubString m_aName;
36     XubString m_aStyleName;
37     Size m_aSize;
38     Color m_aColor;
39     Color m_aFillColor;
40     rtl_TextEncoding m_nCharSet;
41     LanguageType m_nLanguage;
42     sal_Int16 m_nFamily;
43     sal_Int16 m_nPitch;
44     sal_Int16 m_nWeight;
45     sal_Int16 m_nWidthType;
46     sal_Int16 m_nItalic;
47     sal_Int16 m_nUnderline;
48     sal_Int16 m_nStrikeout;
49     sal_Int16 m_nOrientation;
50     unsigned m_bWordLine: 1;
51     unsigned m_bOutline: 1;
52     unsigned m_bShadow: 1;
53     unsigned m_bKerning: 1;
54     unsigned m_bHasFont: 1;
55     unsigned m_bHasColor: 1;
56     unsigned m_bHasFillColor: 1;
57 
58 public:
59     TYPEINFO();
60 
61     inline SfxFontItem(sal_uInt16 nWhich);
62 
63     virtual int operator ==(const SfxPoolItem & rItem) const;
64 
65     virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const;
66 
67     virtual SvStream & Store(SvStream & rStream, sal_uInt16) const;
68 
Clone(SfxItemPool * =0) const69     virtual SfxPoolItem * Clone(SfxItemPool * = 0) const
70     { return new SfxFontItem(*this); }
71 
hasFont() const72     sal_Bool hasFont() const { return m_bHasFont; }
73 
hasColor() const74     sal_Bool hasColor() const { return m_bHasColor; }
75 
hasFillColor() const76     sal_Bool hasFillColor() const { return m_bHasFillColor; }
77 
getName() const78     const XubString & getName() const { return m_aName; }
79 
getStyleName() const80     const XubString & getStyleName() const { return m_aStyleName; }
81 
getSize() const82     const Size & getSize() const { return m_aSize; }
83 
getColor() const84     const Color & getColor() const { return m_aColor; }
85 
getFillColor() const86     const Color & getFillColor() const { return m_aFillColor; }
87 
getCharSet() const88     rtl_TextEncoding getCharSet() const { return m_nCharSet; }
89 
getLanguage() const90     LanguageType getLanguage() const { return m_nLanguage; }
91 
getFamily() const92     sal_Int16 getFamily() const { return m_nFamily; }
93 
getPitch() const94     sal_Int16 getPitch() const { return m_nPitch; }
95 
getWeight() const96     sal_Int16 getWeight() const { return m_nWeight; }
97 
getWidthType() const98     sal_Int16 getWidthType() const { return m_nWidthType; }
99 
getItalic() const100     sal_Int16 getItalic() const { return m_nItalic; }
101 
getUnderline() const102     sal_Int16 getUnderline() const { return m_nUnderline; }
103 
getStrikeout() const104     sal_Int16 getStrikeout() const { return m_nStrikeout; }
105 
getOrientation() const106     sal_Int16 getOrientation() const { return m_nOrientation; }
107 
getWordLine() const108     sal_Bool getWordLine() const { return m_bWordLine; }
109 
getOutline() const110     sal_Bool getOutline() const { return m_bOutline; }
111 
getShadow() const112     sal_Bool getShadow() const { return m_bShadow; }
113 
getKerning() const114     sal_Bool getKerning() const { return m_bKerning; }
115 
116     inline void setFont(sal_Int16 nTheFamily, const XubString & rTheName,
117                         const XubString & rTheStyleName, sal_Int16 nThePitch,
118                         rtl_TextEncoding nTheCharSet);
119 
120     inline void setWeight(sal_Int16 nTheWeight);
121 
122     inline void setItalic(sal_Int16 nTheItalic);
123 
124     inline void setHeight(sal_Int32 nHeight);
125 
126     inline void setColor(const Color & rTheColor);
127 
128     inline void setFillColor(const Color & rTheFillColor);
129 
130     inline void setUnderline(sal_Int16 nTheUnderline);
131 
132     inline void setStrikeout(sal_Int16 nTheStrikeout);
133 
134     inline void setOutline(sal_Bool bTheOutline);
135 
136     inline void setShadow(sal_Bool bTheShadow);
137 
138     inline void setLanguage(LanguageType nTheLanguage);
139 };
140 
SfxFontItem(sal_uInt16 which)141 inline SfxFontItem::SfxFontItem(sal_uInt16 which):
142     SfxPoolItem(which),
143     m_nCharSet(RTL_TEXTENCODING_DONTKNOW),
144     m_nLanguage(LANGUAGE_DONTKNOW),
145     m_nFamily(0), // FAMILY_DONTKNOW
146     m_nPitch(0), // PITCH_DONTKNOW
147     m_nWeight(0), // WEIGHT_DONTKNOW
148     m_nWidthType(0), // WIDTH_DONTKNOW
149     m_nItalic(3), // ITALIC_DONTKNOW
150     m_nUnderline(4), // UNDERLINE_DONTKNOW
151     m_nStrikeout(3), // STRIKEOUT_DONTKNOW
152     m_nOrientation(0),
153     m_bWordLine(sal_False),
154     m_bOutline(sal_False),
155     m_bShadow(sal_False),
156     m_bKerning(sal_False),
157     m_bHasFont(sal_False),
158     m_bHasColor(sal_False),
159     m_bHasFillColor(sal_False)
160 {}
161 
setFont(sal_Int16 nTheFamily,const XubString & rTheName,const XubString & rTheStyleName,sal_Int16 nThePitch,rtl_TextEncoding nTheCharSet)162 inline void SfxFontItem::setFont(sal_Int16 nTheFamily,
163                                  const XubString & rTheName,
164                                  const XubString & rTheStyleName,
165                                  sal_Int16 nThePitch,
166                                  rtl_TextEncoding nTheCharSet)
167 {
168     m_nFamily = nTheFamily;
169     m_aName = rTheName;
170     m_aStyleName = rTheStyleName;
171     m_nPitch = nThePitch;
172     m_nCharSet = nTheCharSet;
173     m_bHasFont = sal_True;
174 }
175 
setWeight(sal_Int16 nTheWeight)176 inline void SfxFontItem::setWeight(sal_Int16 nTheWeight)
177 {
178     m_nWeight = nTheWeight;
179     m_bHasFont = sal_True;
180 }
181 
setItalic(sal_Int16 nTheItalic)182 inline void SfxFontItem::setItalic(sal_Int16 nTheItalic)
183 {
184     m_nItalic = nTheItalic;
185     m_bHasFont = sal_True;
186 }
187 
setHeight(sal_Int32 nHeight)188 inline void SfxFontItem::setHeight(sal_Int32 nHeight)
189 {
190     m_aSize.setHeight(nHeight);
191     m_bHasFont = sal_True;
192 }
193 
setColor(const Color & rTheColor)194 inline void SfxFontItem::setColor(const Color & rTheColor)
195 {
196     m_aColor = rTheColor;
197     m_bHasColor = sal_True;
198 }
199 
setFillColor(const Color & rTheFillColor)200 inline void SfxFontItem::setFillColor(const Color & rTheFillColor)
201 {
202     m_aFillColor = rTheFillColor;
203     m_bHasFillColor = sal_True;
204 }
205 
setUnderline(sal_Int16 nTheUnderline)206 inline void SfxFontItem::setUnderline(sal_Int16 nTheUnderline)
207 {
208     m_nUnderline = nTheUnderline;
209     m_bHasFont = sal_True;
210 }
211 
setStrikeout(sal_Int16 nTheStrikeout)212 inline void SfxFontItem::setStrikeout(sal_Int16 nTheStrikeout)
213 {
214     m_nStrikeout = nTheStrikeout;
215     m_bHasFont = sal_True;
216 }
217 
setOutline(sal_Bool bTheOutline)218 inline void SfxFontItem::setOutline(sal_Bool bTheOutline)
219 {
220     m_bOutline = bTheOutline;
221     m_bHasFont = sal_True;
222 }
223 
setShadow(sal_Bool bTheShadow)224 inline void SfxFontItem::setShadow(sal_Bool bTheShadow)
225 {
226     m_bShadow = bTheShadow;
227     m_bHasFont = sal_True;
228 }
229 
setLanguage(LanguageType nTheLanguage)230 inline void SfxFontItem::setLanguage(LanguageType nTheLanguage)
231 {
232     m_nLanguage = nTheLanguage;
233     m_bHasFont = sal_True;
234 }
235 
236 #endif // _SFONTITM_HXX
237 
238