update dev300-m57
[ooovba.git] / lotuswordpro / source / filter / lwpfont.hxx
blob8e38ad223fcaf31d8ce59632ef5fbd6df8a486ff
1 /*************************************************************************
3 * The Contents of this file are made available subject to the terms of
4 * either of the following licenses
6 * - GNU Lesser General Public License Version 2.1
7 * - Sun Industry Standards Source License Version 1.1
9 * Sun Microsystems Inc., October, 2000
11 * GNU Lesser General Public License Version 2.1
12 * =============================================
13 * Copyright 2000 by Sun Microsystems, Inc.
14 * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License version 2.1, as published by the Free Software Foundation.
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * MA 02111-1307 USA
31 * Sun Industry Standards Source License Version 1.1
32 * =================================================
33 * The contents of this file are subject to the Sun Industry Standards
34 * Source License Version 1.1 (the "License"); You may not use this file
35 * except in compliance with the License. You may obtain a copy of the
36 * License at http://www.openoffice.org/license.html.
38 * Software provided under this License is provided on an "AS IS" basis,
39 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
40 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
41 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
42 * See the License for the specific provisions governing your rights and
43 * obligations concerning the Software.
45 * The Initial Developer of the Original Code is: IBM Corporation
47 * Copyright: 2008 by IBM Corporation
49 * All Rights Reserved.
51 * Contributor(s): _______________________________________
54 ************************************************************************/
55 /*************************************************************************
56 * @file
57 * Font manager related classes header file
58 * LwpFontTableEntry, LwpFontTable, LwpFontNameEntry,
59 * LwpFontAttrEntry, LwpFontNameManager,LwpFontAttrManager,
60 * LwpFontManager
61 ************************************************************************/
62 /*************************************************************************
63 * Change History
64 Jan 2005 Created
65 ************************************************************************/
67 #ifndef _LWPFONT_HXX
68 #define _LWPFONT_HXX
70 #include "lwpheader.hxx"
71 #include "lwpobjstrm.hxx"
72 #include "lwpatomholder.hxx"
73 #include "lwpcolor.hxx"
74 #include "lwpbasetype.hxx"
75 #include "lwpobj.hxx"
76 #include "xfilter/xffont.hxx"
77 #include "xfilter/xftextstyle.hxx"
79 class LwpFontTableEntry
81 public:
82 LwpFontTableEntry(){};
83 ~LwpFontTableEntry(){};
84 public:
85 void Read(LwpObjectStream *pStrm);
86 OUString GetFaceName();
87 private:
88 LwpAtomHolder m_WindowsFaceName; //font face name under windows
89 LwpAtomHolder m_FaceName; //font face name
90 void RegisterFontDecl();
91 //Not useful now, so skip
92 //LwpPanoseNumber m_PanoseNumber;
95 class LwpFontTable
97 public:
98 LwpFontTable();
99 ~LwpFontTable();
100 public:
101 void Read(LwpObjectStream *pStrm);
102 OUString GetFaceName(sal_uInt16 index); //index: start from 1
103 // void RegisterFontDecls();
104 private:
105 sal_uInt16 m_nCount;
106 LwpFontTableEntry* m_pFontEntries;
110 class LwpFontNameEntry
112 public:
113 LwpFontNameEntry(){};
114 ~LwpFontNameEntry(){};
115 public:
116 void Read(LwpObjectStream *pStrm);
117 inline sal_uInt16 GetFaceID(){return m_nFaceName;};
118 inline sal_uInt16 GetAltFaceID(){return m_nAltFaceName;};
119 void Override(XFFont* pFont);
120 inline BOOL IsFaceNameOverridden();
121 inline BOOL IsAltFaceNameOverridden();
122 private:
123 //Data of CFontDescriptionOverrideBase
124 sal_uInt8 m_nOverrideBits;
125 sal_uInt8 m_nApplyBits;
126 sal_uInt32 m_nPointSize;
127 sal_uInt16 m_nOverstrike;
128 sal_uInt16 m_nTightness;
129 LwpColor m_Color;
130 LwpColor m_BackColor;
131 //Data of LwpFontNameEntry
132 sal_uInt16 m_nFaceName; //CFontTableID
133 sal_uInt16 m_nAltFaceName; //CFontTableID
134 enum
136 POINTSIZE = 0x01,
137 COLOR = 0x02,
138 OVERSTRIKE = 0x04,
139 TIGHTNESS = 0x08,
140 FACENAME = 0x10,
141 BKCOLOR = 0x20,
142 ALTFACENAME = 0x40,
143 ALL_BITS = (POINTSIZE | COLOR | OVERSTRIKE
144 | ALTFACENAME
145 | TIGHTNESS | FACENAME | BKCOLOR)
148 inline BOOL IsPointSizeOverridden();
149 inline BOOL IsColorOverridden();
150 inline BOOL IsBackgroundColorOverridden();
151 inline BOOL IsTightnessOverridden();
152 inline BOOL IsAnythingOverridden();
155 class LwpFontNameManager
157 public:
158 LwpFontNameManager();
159 ~LwpFontNameManager();
160 OUString GetNameByIndex(sal_uInt16 index);
161 private:
162 sal_uInt16 m_nCount;
163 LwpFontNameEntry* m_pFontNames;
164 LwpFontTable m_FontTbl;
166 public:
167 void Read(LwpObjectStream *pStrm);
168 void Override(sal_uInt16 index, XFFont* pFont);
171 class LwpFontAttrEntry
173 public:
174 LwpFontAttrEntry(){};
175 ~LwpFontAttrEntry(){};
176 public:
177 void Read(LwpObjectStream *pStrm);
178 void Override(XFFont*pFont);
179 private:
180 sal_uInt16 m_nAttrBits;
181 sal_uInt16 m_nAttrOverrideBits;
182 sal_uInt16 m_nAttrApplyBits;
183 sal_uInt8 m_nAttrOverrideBits2;
184 sal_uInt8 m_nAttrApplyBits2;
185 sal_uInt8 m_nCase;
186 sal_uInt8 m_nUnder;
187 enum
189 BOLD = 0x0001,
190 ITALIC = 0x0002,
191 STRIKETHRU = 0x0004,
193 SUPERSCRIPT = 0x0100,
194 SUBSCRIPT = 0x0200,
196 SMALLCAPS = 0x0400,
198 ALL_ATTRS = BOLD | ITALIC | STRIKETHRU
199 | SUPERSCRIPT | SUBSCRIPT
200 | SMALLCAPS,
202 CASE_DONTCARE = 0,
203 CASE_NORMAL = 1,
204 CASE_UPPER = 2,
205 CASE_LOWER = 3,
206 CASE_INITCAPS = 4,
207 CASE_STYLE = 7,
209 UNDER_DONTCARE = 0,
210 UNDER_OFF = 1,
211 UNDER_SINGLE = 2,
212 UNDER_DOUBLE = 3,
213 UNDER_WORD_SINGLE = 4,
214 UNDER_WORD_DOUBLE = 5,
215 UNDER_STYLE = 7,
217 CASE = 0x01,
218 UNDER = 0x02,
219 ALL_ATTRS2 = CASE | UNDER
221 BOOL Is(sal_uInt16 Attr);
222 BOOL IsBoldOverridden();
223 BOOL IsItalicOverridden();
224 BOOL IsStrikeThruOverridden();
225 BOOL IsSmallCapsOverridden();
226 BOOL IsSuperOverridden();
227 BOOL IsSubOverridden();
228 BOOL IsSuperSubOverridden();
229 BOOL IsUnderlineOverridden();
230 BOOL IsCaseOverridden();
234 class LwpFontAttrManager
236 public:
237 LwpFontAttrManager():m_pFontAttrs(NULL){};
238 ~LwpFontAttrManager();
239 public:
240 void Read(LwpObjectStream *pStrm);
241 void Override(sal_uInt16 index, XFFont*pFont);
242 private:
243 sal_uInt16 m_nCount;
244 LwpFontAttrEntry* m_pFontAttrs;
247 class LwpFontManager
249 public:
250 LwpFontManager(){};
251 ~LwpFontManager(){};
252 private:
253 LwpFontNameManager m_FNMgr;
254 LwpFontAttrManager m_AttrMgr;
255 sal_uInt32 m_nDlfTxtStyleFontID;
257 public:
258 void Read(LwpObjectStream *pStrm);
259 XFFont* CreateOverrideFont(sal_uInt32 fontID, sal_uInt32 overID);
260 XFFont* CreateFont(sal_uInt32 fontID);
261 OUString GetNameByID(sal_uInt32 fontID);
262 //void AddStyle(LwpObjectID styleObjID, sal_uInt32 fontID, OUString styleName);
263 //void AddStyle(LwpObjectID styleObjID, sal_uInt32 fontID, OUString styleName, XFTextStyle* pStyle);
264 //OUString GetOverrideStyle(sal_uInt32 fontID, sal_uInt32 overID);
266 private:
267 void Override(sal_uInt32 fontID, XFFont* pFont);
268 inline sal_uInt16 GetFontNameIndex(sal_uInt32 fontID);
269 inline sal_uInt16 GetFontAttrIndex(sal_uInt32 fontID);
270 void SetDfltFont(XFFont* pFont);
273 sal_uInt16 LwpFontManager::GetFontNameIndex(sal_uInt32 fontID)
275 return static_cast<sal_uInt16>((fontID>>16)&0xFFFF);
278 sal_uInt16 LwpFontManager::GetFontAttrIndex(sal_uInt32 fontID)
280 return static_cast<sal_uInt16>(fontID);
283 #endif