1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sfontitm.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #ifndef _TOOLS_COLOR_HXX
35 #include <tools/color.hxx>
38 #include <tools/gen.hxx>
40 #ifndef INCLUDED_I18NPOOL_LANG_H
41 #include <i18npool/lang.h>
44 #ifndef _SFXPOOLITEM_HXX
45 #include <bf_svtools/poolitem.hxx>
51 //============================================================================
52 class SfxFontItem
: public SfxPoolItem
55 XubString m_aStyleName
;
59 rtl_TextEncoding m_nCharSet
;
60 LanguageType m_nLanguage
;
64 sal_Int16 m_nWidthType
;
66 sal_Int16 m_nUnderline
;
67 sal_Int16 m_nStrikeout
;
68 sal_Int16 m_nOrientation
;
69 unsigned m_bWordLine
: 1;
70 unsigned m_bOutline
: 1;
71 unsigned m_bShadow
: 1;
72 unsigned m_bKerning
: 1;
73 unsigned m_bHasFont
: 1;
74 unsigned m_bHasColor
: 1;
75 unsigned m_bHasFillColor
: 1;
80 inline SfxFontItem(USHORT nWhich
);
82 virtual int operator ==(const SfxPoolItem
& rItem
) const;
84 virtual SfxPoolItem
* Create(SvStream
& rStream
, USHORT
) const;
86 virtual SvStream
& Store(SvStream
& rStream
, USHORT
) const;
88 virtual SfxPoolItem
* Clone(SfxItemPool
* = 0) const
89 { return new SfxFontItem(*this); }
91 sal_Bool
hasFont() const { return m_bHasFont
; }
93 sal_Bool
hasColor() const { return m_bHasColor
; }
95 sal_Bool
hasFillColor() const { return m_bHasFillColor
; }
97 const XubString
& getName() const { return m_aName
; }
99 const XubString
& getStyleName() const { return m_aStyleName
; }
101 const Size
& getSize() const { return m_aSize
; }
103 const Color
& getColor() const { return m_aColor
; }
105 const Color
& getFillColor() const { return m_aFillColor
; }
107 rtl_TextEncoding
getCharSet() const { return m_nCharSet
; }
109 LanguageType
getLanguage() const { return m_nLanguage
; }
111 sal_Int16
getFamily() const { return m_nFamily
; }
113 sal_Int16
getPitch() const { return m_nPitch
; }
115 sal_Int16
getWeight() const { return m_nWeight
; }
117 sal_Int16
getWidthType() const { return m_nWidthType
; }
119 sal_Int16
getItalic() const { return m_nItalic
; }
121 sal_Int16
getUnderline() const { return m_nUnderline
; }
123 sal_Int16
getStrikeout() const { return m_nStrikeout
; }
125 sal_Int16
getOrientation() const { return m_nOrientation
; }
127 sal_Bool
getWordLine() const { return m_bWordLine
; }
129 sal_Bool
getOutline() const { return m_bOutline
; }
131 sal_Bool
getShadow() const { return m_bShadow
; }
133 sal_Bool
getKerning() const { return m_bKerning
; }
135 inline void setFont(sal_Int16 nTheFamily
, const XubString
& rTheName
,
136 const XubString
& rTheStyleName
, sal_Int16 nThePitch
,
137 rtl_TextEncoding nTheCharSet
);
139 inline void setWeight(sal_Int16 nTheWeight
);
141 inline void setItalic(sal_Int16 nTheItalic
);
143 inline void setHeight(sal_Int32 nHeight
);
145 inline void setColor(const Color
& rTheColor
);
147 inline void setFillColor(const Color
& rTheFillColor
);
149 inline void setUnderline(sal_Int16 nTheUnderline
);
151 inline void setStrikeout(sal_Int16 nTheStrikeout
);
153 inline void setOutline(sal_Bool bTheOutline
);
155 inline void setShadow(sal_Bool bTheShadow
);
157 inline void setLanguage(LanguageType nTheLanguage
);
160 inline SfxFontItem::SfxFontItem(USHORT which
):
162 m_nCharSet(RTL_TEXTENCODING_DONTKNOW
),
163 m_nLanguage(LANGUAGE_DONTKNOW
),
164 m_nFamily(0), // FAMILY_DONTKNOW
165 m_nPitch(0), // PITCH_DONTKNOW
166 m_nWeight(0), // WEIGHT_DONTKNOW
167 m_nWidthType(0), // WIDTH_DONTKNOW
168 m_nItalic(3), // ITALIC_DONTKNOW
169 m_nUnderline(4), // UNDERLINE_DONTKNOW
170 m_nStrikeout(3), // STRIKEOUT_DONTKNOW
172 m_bWordLine(sal_False
),
173 m_bOutline(sal_False
),
174 m_bShadow(sal_False
),
175 m_bKerning(sal_False
),
176 m_bHasFont(sal_False
),
177 m_bHasColor(sal_False
),
178 m_bHasFillColor(sal_False
)
181 inline void SfxFontItem::setFont(sal_Int16 nTheFamily
,
182 const XubString
& rTheName
,
183 const XubString
& rTheStyleName
,
185 rtl_TextEncoding nTheCharSet
)
187 m_nFamily
= nTheFamily
;
189 m_aStyleName
= rTheStyleName
;
190 m_nPitch
= nThePitch
;
191 m_nCharSet
= nTheCharSet
;
192 m_bHasFont
= sal_True
;
195 inline void SfxFontItem::setWeight(sal_Int16 nTheWeight
)
197 m_nWeight
= nTheWeight
;
198 m_bHasFont
= sal_True
;
201 inline void SfxFontItem::setItalic(sal_Int16 nTheItalic
)
203 m_nItalic
= nTheItalic
;
204 m_bHasFont
= sal_True
;
207 inline void SfxFontItem::setHeight(sal_Int32 nHeight
)
209 m_aSize
.setHeight(nHeight
);
210 m_bHasFont
= sal_True
;
213 inline void SfxFontItem::setColor(const Color
& rTheColor
)
215 m_aColor
= rTheColor
;
216 m_bHasColor
= sal_True
;
219 inline void SfxFontItem::setFillColor(const Color
& rTheFillColor
)
221 m_aFillColor
= rTheFillColor
;
222 m_bHasFillColor
= sal_True
;
225 inline void SfxFontItem::setUnderline(sal_Int16 nTheUnderline
)
227 m_nUnderline
= nTheUnderline
;
228 m_bHasFont
= sal_True
;
231 inline void SfxFontItem::setStrikeout(sal_Int16 nTheStrikeout
)
233 m_nStrikeout
= nTheStrikeout
;
234 m_bHasFont
= sal_True
;
237 inline void SfxFontItem::setOutline(sal_Bool bTheOutline
)
239 m_bOutline
= bTheOutline
;
240 m_bHasFont
= sal_True
;
243 inline void SfxFontItem::setShadow(sal_Bool bTheShadow
)
245 m_bShadow
= bTheShadow
;
246 m_bHasFont
= sal_True
;
249 inline void SfxFontItem::setLanguage(LanguageType nTheLanguage
)
251 m_nLanguage
= nTheLanguage
;
252 m_bHasFont
= sal_True
;
257 #endif // _SFONTITM_HXX