LibreOffice Module lotuswordpro (master) 1
xffont.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*************************************************************************
3 *
4 * The Contents of this file are made available subject to the terms of
5 * either of the following licenses
6 *
7 * - GNU Lesser General Public License Version 2.1
8 * - Sun Industry Standards Source License Version 1.1
9 *
10 * Sun Microsystems Inc., October, 2000
11 *
12 * GNU Lesser General Public License Version 2.1
13 * =============================================
14 * Copyright 2000 by Sun Microsystems, Inc.
15 * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 *
17 * This library is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public
19 * License version 2.1, as published by the Free Software Foundation.
20 *
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
25 *
26 * You should have received a copy of the GNU Lesser General Public
27 * License along with this library; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 *
31 *
32 * Sun Industry Standards Source License Version 1.1
33 * =================================================
34 * The contents of this file are subject to the Sun Industry Standards
35 * Source License Version 1.1 (the "License"); You may not use this file
36 * except in compliance with the License. You may obtain a copy of the
37 * License at http://www.openoffice.org/license.html.
38 *
39 * Software provided under this License is provided on an "AS IS" basis,
40 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
41 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
42 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
43 * See the License for the specific provisions governing your rights and
44 * obligations concerning the Software.
45 *
46 * The Initial Developer of the Original Code is: IBM Corporation
47 *
48 * Copyright: 2008 by IBM Corporation
49 *
50 * All Rights Reserved.
51 *
52 * Contributor(s): _______________________________________
53 *
54 *
55 ************************************************************************/
56/*************************************************************************
57 * @file
58 * Font object to serial to xml filter.
59 ************************************************************************/
60#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFONT_HXX
61#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFONT_HXX
62
63#include <sal/config.h>
64
66
67#include <xfilter/ixfstream.hxx>
68#include <xfilter/xfcolor.hxx>
69#include <xfilter/xfdefs.hxx>
70
71#define XFFONT_FLAG_NAME 0X00000001
72#define XFFONT_FLAG_NAME_ASIA 0X00000002
73#define XFFONT_FLAG_NAME_COMPLEX 0X00000004
74
75#define XFFONT_FLAG_SIZE 0X00000008
76#define XFFONT_FLAG_SIZE_ASIA 0X00000010
77#define XFFONT_FLAG_SIZE_COMPLEX 0X00000020
78
79#define XFFONT_FLAG_ITALIC 0X00000040
80#define XFFONT_FLAG_ITALIC_ASIA 0X00000080
81#define XFFONT_FLAG_ITALIC_COMPLEX 0X00000100
82
83#define XFFONT_FLAG_BOLD 0X00000200
84#define XFFONT_FLAG_BOLD_ASIA 0X00000400
85#define XFFONT_FLAG_BOLD_COMPLEX 0X00000800
86
87#define XFFONT_FLAG_UNDERLINE 0X00001000
88#define XFFONT_FLAG_UNDERLINECOLOR 0X00002000
89
90#define XFFONT_FLAG_POSITION 0X00004000
91#define XFFONT_FLAG_SCALE 0X00008000
92#define XFFONT_FLAG_CHARSPACE 0x00010000
93
94#define XFFONT_FLAG_COLOR 0x00020000
95#define XFFONT_FLAG_BGCOLOR 0x00040000
96
97#define XFFONT_FLAG_CROSSOUT 0x00080000
98#define XFFONT_FLAG_RELIEF 0x00100000
99#define XFFONT_FLAG_TRANSFORM 0x00200000
100#define XFFONT_FLAG_EMPHASIZE 0x00400000
101#define XFFONT_FLAG_OUTLINE 0x00800000
102#define XFFONT_FLAG_SHADOW 0x01000000
103#define XFFONT_FLAG_BLINK 0x02000000
104#define XFFONT_FLAG_WIDTHSCALE 0x04000000
105
120{
121public:
122 XFFont();
123
124public:
128 void SetFontName(const OUString& name);
129
133 void SetFontNameAsia(const OUString& name);
134
138 void SetFontNameComplex(const OUString& name);
139
143 void SetFontSize(sal_Int16 size);
144
148 void SetFontSizeAsia(sal_Int16 size);
149
153 void SetFontSizeComplex(sal_Int16 size);
154
158 void SetItalic(bool italic);
159
163 void SetItalicAsia(bool italic);
164
168 void SetItalicComplex(bool italic);
169
173 void SetBold(bool bold);
174
178 void SetBoldAsia(bool bold);
179
183 void SetBoldComplex(bool bold);
184
188 void SetUnderline(enumXFUnderline underline,bool wordByWord=false);
189
194
198 void SetTransform(enumXFTransform transform);
199
203 void SetPosition(bool bUpperScript = true, sal_Int16 pos = 33, sal_Int16 scale = 58);
204
208 void SetColor(XFColor const & color);
209
213 void SetBackColor(XFColor const & color);
215
216 //getter:
218
219 sal_Int16 GetFontSize() const;
220 const XFColor& GetColor() const;
221
222 void ToXml(IXFStream *pStrm);
223
224 friend bool operator==(XFFont const & f1, XFFont const & f2);
225 friend bool operator!=(XFFont const & f1, XFFont const & f2);
226 friend class XFFontFactory;
227private:
228 virtual ~XFFont() override {}
229
233 sal_Int16 m_nFontSize;
243
248 sal_Int16 m_nPosition;
249 sal_Int16 m_nScale;
252 //The flag defines which variable will be functional
253 sal_uInt32 m_nFlag;
255};
256
257inline void XFFont::SetFontName(const OUString& name)
258{
261
264}
265
266inline void XFFont::SetFontNameAsia(const OUString& name)
267{
270}
271
272inline void XFFont::SetFontNameComplex(const OUString& name)
273{
276}
277
278inline void XFFont::SetFontSize(sal_Int16 size)
279{
282
285}
286
287inline void XFFont::SetFontSizeAsia(sal_Int16 size)
288{
291}
292
293inline void XFFont::SetFontSizeComplex(sal_Int16 size)
294{
297}
298
299//---------Italic:
300inline void XFFont::SetItalic(bool italic)
301{
304
307}
308
309inline void XFFont::SetItalicAsia(bool italic)
310{
313}
314
315inline void XFFont::SetItalicComplex(bool italic)
316{
319}
320
321//--------Bold
322inline void XFFont::SetBold(bool bold)
323{
324 m_bBold = bold;
328}
329
330inline void XFFont::SetBoldAsia(bool bold)
331{
334}
335
336inline void XFFont::SetBoldComplex(bool bold)
337{
340}
341
342//--------Underline:
343inline void XFFont::SetUnderline(enumXFUnderline underline, bool wordByWord)
344{
346 m_bWordByWord = wordByWord;
348}
349
351{
353 m_bWordByWord = false;
355}
356
358{
359 m_eTransform = transform;
361}
362
363inline void XFFont::SetPosition(bool bUpperScript, sal_Int16 pos, sal_Int16 scale)
364{
365 assert(pos>=0&&pos<=100);
366 assert(scale>0&&scale<=100);
369 m_nScale = scale;
370 if( bUpperScript )
371 {
372 if( m_nPosition <0 )
374 }
375 else
376 {
377 if( m_nPosition >0 )
379 }
380}
381
382inline void XFFont::SetColor(XFColor const & color)
383{
385 m_aColor = color;
386}
387
389{
390 m_bTransparent = false;
393}
394
396{
397 m_bTransparent = true;
399}
400
402{
403 return m_eTransform;
404}
405
406inline sal_Int16 XFFont::GetFontSize() const
407{
408 return m_nFontSize;
409}
410
411inline const XFColor& XFFont::GetColor() const
412{
413 return m_aColor;
414}
415
416#endif
417
418/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Stream wrapper for sax writer.
Definition: ixfstream.hxx:72
Color object.
Definition: xfcolor.hxx:70
Font factory.
@descr The font struct of openoffice xml filter.
Definition: xffont.hxx:120
sal_Int16 GetFontSize() const
Definition: xffont.hxx:406
void SetFontNameAsia(const OUString &name)
@descr Set font name for asia locale.
Definition: xffont.hxx:266
enumXFTransform GetTransform() const
Definition: xffont.hxx:401
enumXFTransform m_eTransform
Definition: xffont.hxx:246
bool m_bWordByWord
Definition: xffont.hxx:247
XFFont()
Definition: xffont.cxx:64
bool m_bItalic
Definition: xffont.hxx:236
sal_Int16 m_nPosition
Definition: xffont.hxx:248
void SetBoldComplex(bool bold)
@descr Set font bold for complex locale.
Definition: xffont.hxx:336
bool m_bItalicAsia
Definition: xffont.hxx:237
void SetBoldAsia(bool bold)
@descr Set font bold for asia locale.
Definition: xffont.hxx:330
void SetBold(bool bold)
@descr Set font bold.
Definition: xffont.hxx:322
sal_Int16 m_nScale
Definition: xffont.hxx:249
friend bool operator!=(XFFont const &f1, XFFont const &f2)
Definition: xffont.cxx:187
XFColor m_aBackColor
Definition: xffont.hxx:251
OUString m_strFontNameComplex
Definition: xffont.hxx:232
bool m_bBoldComplex
Definition: xffont.hxx:241
void SetBackColorTransparent()
Definition: xffont.hxx:395
void SetFontSizeComplex(sal_Int16 size)
@descr Set font size for BIDI locale.
Definition: xffont.hxx:293
void SetFontNameComplex(const OUString &name)
@descr Set font name for BIDI locale.
Definition: xffont.hxx:272
void SetFontSizeAsia(sal_Int16 size)
@descr Set font size for asia locale.
Definition: xffont.hxx:287
OUString m_strFontName
Definition: xffont.hxx:230
sal_Int16 m_nFontSize
Definition: xffont.hxx:233
void SetPosition(bool bUpperScript=true, sal_Int16 pos=33, sal_Int16 scale=58)
@descr Set upper script or lower script.
Definition: xffont.hxx:363
enumXFCrossout m_eCrossout
Definition: xffont.hxx:245
void SetBackColor(XFColor const &color)
@descr Set font background color.
Definition: xffont.hxx:388
void SetFontName(const OUString &name)
@descr Set font name.
Definition: xffont.hxx:257
void SetItalicComplex(bool italic)
@descr Set whether font is italic for BIDI locale.
Definition: xffont.hxx:315
sal_Int16 m_nFontSizeAsia
Definition: xffont.hxx:234
XFColor m_aColor
Definition: xffont.hxx:250
void SetCrossout(enumXFCrossout cross)
@descr Set crossout.
Definition: xffont.hxx:350
void SetFontSize(sal_Int16 size)
@descr Set font size.
Definition: xffont.hxx:278
bool m_bTransparent
Definition: xffont.hxx:254
void SetTransform(enumXFTransform transform)
@descr Set font transform type,pls refer to enumXFTransform.
Definition: xffont.hxx:357
OUString m_strFontNameAsia
Definition: xffont.hxx:231
sal_uInt32 m_nFlag
Definition: xffont.hxx:253
void SetUnderline(enumXFUnderline underline, bool wordByWord=false)
@descr Set underline style.
Definition: xffont.hxx:343
sal_Int16 m_nFontSizeComplex
Definition: xffont.hxx:235
void SetItalicAsia(bool italic)
@descr Set whether font is italic for asia locale.
Definition: xffont.hxx:309
void SetColor(XFColor const &color)
@descr Set font color.
Definition: xffont.hxx:382
bool m_bBoldAsia
Definition: xffont.hxx:240
virtual ~XFFont() override
Definition: xffont.hxx:228
bool m_bBold
Definition: xffont.hxx:239
enumXFUnderline m_eUnderline
Definition: xffont.hxx:244
bool m_bItalicComplex
Definition: xffont.hxx:238
friend bool operator==(XFFont const &f1, XFFont const &f2)
Definition: xffont.cxx:103
const XFColor & GetColor() const
Definition: xffont.hxx:411
XFColor m_aUnderlineColor
Definition: xffont.hxx:242
void SetItalic(bool italic)
@descr Set whether font is italic.
Definition: xffont.hxx:300
void ToXml(IXFStream *pStrm)
Definition: xffont.cxx:192
const char * name
bold
B3DVector cross(const B3DVector &rVecA, const B3DVector &rVecB)
size
sal_Int32 scale
size_t pos
enumXFCrossout
Definition: xfdefs.hxx:144
enumXFUnderline
Definition: xfdefs.hxx:115
enumXFTransform
Definition: xfdefs.hxx:154
#define XFFONT_FLAG_ITALIC
Definition: xffont.hxx:79
#define XFFONT_FLAG_SIZE_COMPLEX
Definition: xffont.hxx:77
#define XFFONT_FLAG_SIZE_ASIA
Definition: xffont.hxx:76
#define XFFONT_FLAG_BOLD_COMPLEX
Definition: xffont.hxx:85
#define XFFONT_FLAG_UNDERLINE
Definition: xffont.hxx:87
#define XFFONT_FLAG_POSITION
Definition: xffont.hxx:90
#define XFFONT_FLAG_SIZE
Definition: xffont.hxx:75
#define XFFONT_FLAG_BOLD
Definition: xffont.hxx:83
#define XFFONT_FLAG_CROSSOUT
Definition: xffont.hxx:97
#define XFFONT_FLAG_BOLD_ASIA
Definition: xffont.hxx:84
#define XFFONT_FLAG_NAME_ASIA
Definition: xffont.hxx:72
#define XFFONT_FLAG_NAME_COMPLEX
Definition: xffont.hxx:73
#define XFFONT_FLAG_BGCOLOR
Definition: xffont.hxx:95
#define XFFONT_FLAG_ITALIC_ASIA
Definition: xffont.hxx:80
#define XFFONT_FLAG_COLOR
Definition: xffont.hxx:94
#define XFFONT_FLAG_TRANSFORM
Definition: xffont.hxx:99
#define XFFONT_FLAG_NAME
Definition: xffont.hxx:71
#define XFFONT_FLAG_ITALIC_COMPLEX
Definition: xffont.hxx:81