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,
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 /*************************************************************************
57 * Font manager related classes header file
58 * LwpFontTableEntry, LwpFontTable, LwpFontNameEntry,
59 * LwpFontAttrEntry, LwpFontNameManager,LwpFontAttrManager,
61 ************************************************************************/
62 /*************************************************************************
65 ************************************************************************/
70 #include "lwpheader.hxx"
71 #include "lwpobjstrm.hxx"
72 #include "lwpatomholder.hxx"
73 #include "lwpcolor.hxx"
74 #include "lwpbasetype.hxx"
76 #include "xfilter/xffont.hxx"
77 #include "xfilter/xftextstyle.hxx"
79 class LwpFontTableEntry
82 LwpFontTableEntry(){};
83 ~LwpFontTableEntry(){};
85 void Read(LwpObjectStream
*pStrm
);
86 OUString
GetFaceName();
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;
101 void Read(LwpObjectStream
*pStrm
);
102 OUString
GetFaceName(sal_uInt16 index
); //index: start from 1
103 // void RegisterFontDecls();
106 LwpFontTableEntry
* m_pFontEntries
;
110 class LwpFontNameEntry
113 LwpFontNameEntry(){};
114 ~LwpFontNameEntry(){};
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();
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
;
130 LwpColor m_BackColor
;
131 //Data of LwpFontNameEntry
132 sal_uInt16 m_nFaceName
; //CFontTableID
133 sal_uInt16 m_nAltFaceName
; //CFontTableID
143 ALL_BITS
= (POINTSIZE
| COLOR
| OVERSTRIKE
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
158 LwpFontNameManager();
159 ~LwpFontNameManager();
160 OUString
GetNameByIndex(sal_uInt16 index
);
163 LwpFontNameEntry
* m_pFontNames
;
164 LwpFontTable m_FontTbl
;
167 void Read(LwpObjectStream
*pStrm
);
168 void Override(sal_uInt16 index
, XFFont
* pFont
);
171 class LwpFontAttrEntry
174 LwpFontAttrEntry(){};
175 ~LwpFontAttrEntry(){};
177 void Read(LwpObjectStream
*pStrm
);
178 void Override(XFFont
*pFont
);
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
;
193 SUPERSCRIPT
= 0x0100,
198 ALL_ATTRS
= BOLD
| ITALIC
| STRIKETHRU
199 | SUPERSCRIPT
| SUBSCRIPT
213 UNDER_WORD_SINGLE
= 4,
214 UNDER_WORD_DOUBLE
= 5,
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
237 LwpFontAttrManager():m_pFontAttrs(NULL
){};
238 ~LwpFontAttrManager();
240 void Read(LwpObjectStream
*pStrm
);
241 void Override(sal_uInt16 index
, XFFont
*pFont
);
244 LwpFontAttrEntry
* m_pFontAttrs
;
253 LwpFontNameManager m_FNMgr
;
254 LwpFontAttrManager m_AttrMgr
;
255 sal_uInt32 m_nDlfTxtStyleFontID
;
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);
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
);