sync master with lastest vba changes
[ooovba.git] / starmath / inc / format.hxx
blobeb8e654bf76bf76bd5cf8c88a573e463787ae38e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: format.hxx,v $
10 * $Revision: 1.9 $
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 ************************************************************************/
30 #ifndef FORMAT_HXX
31 #define FORMAT_HXX
34 #include <svtools/smplhint.hxx>
35 #include <svtools/brdcst.hxx>
36 #include "utility.hxx"
37 #include <types.hxx>
40 #define SM_FMT_VERSION_51 ((BYTE) 0x01)
41 #define SM_FMT_VERSION_NOW SM_FMT_VERSION_51
43 #define FNTNAME_TIMES "Times New Roman"
44 #define FNTNAME_HELV "Helvetica"
45 #define FNTNAME_COUR "Courier"
46 #define FNTNAME_MATH FONTNAME_MATH
49 // symbolic names used as array indices
50 #define SIZ_BEGIN 0
51 #define SIZ_TEXT 0
52 #define SIZ_INDEX 1
53 #define SIZ_FUNCTION 2
54 #define SIZ_OPERATOR 3
55 #define SIZ_LIMITS 4
56 #define SIZ_END 4
58 // symbolic names used as array indices
59 #define FNT_BEGIN 0
60 #define FNT_VARIABLE 0
61 #define FNT_FUNCTION 1
62 #define FNT_NUMBER 2
63 #define FNT_TEXT 3
64 #define FNT_SERIF 4
65 #define FNT_SANS 5
66 #define FNT_FIXED 6
67 #define FNT_MATH 7
68 #define FNT_END 7
70 // symbolic names used as array indices
71 #define DIS_BEGIN 0
72 #define DIS_HORIZONTAL 0
73 #define DIS_VERTICAL 1
74 #define DIS_ROOT 2
75 #define DIS_SUPERSCRIPT 3
76 #define DIS_SUBSCRIPT 4
77 #define DIS_NUMERATOR 5
78 #define DIS_DENOMINATOR 6
79 #define DIS_FRACTION 7
80 #define DIS_STROKEWIDTH 8
81 #define DIS_UPPERLIMIT 9
82 #define DIS_LOWERLIMIT 10
83 #define DIS_BRACKETSIZE 11
84 #define DIS_BRACKETSPACE 12
85 #define DIS_MATRIXROW 13
86 #define DIS_MATRIXCOL 14
87 #define DIS_ORNAMENTSIZE 15
88 #define DIS_ORNAMENTSPACE 16
89 #define DIS_OPERATORSIZE 17
90 #define DIS_OPERATORSPACE 18
91 #define DIS_LEFTSPACE 19
92 #define DIS_RIGHTSPACE 20
93 #define DIS_TOPSPACE 21
94 #define DIS_BOTTOMSPACE 22
95 #define DIS_NORMALBRACKETSIZE 23
96 #define DIS_END 23
99 // to be broadcastet on format changes:
100 #define HINT_FORMATCHANGED 10003
102 enum SmHorAlign { AlignLeft, AlignCenter, AlignRight };
104 String GetDefaultFontName( LanguageType nLang, USHORT nIdent );
106 class SmFormat : public SfxBroadcaster
108 SmFace vFont[FNT_END + 1];
109 BOOL bDefaultFont[FNT_END + 1];
110 Size aBaseSize;
111 long nVersion;
112 USHORT vSize[SIZ_END + 1];
113 USHORT vDist[DIS_END + 1];
114 SmHorAlign eHorAlign;
115 BOOL bIsTextmode,
116 bScaleNormalBrackets;
118 public:
119 SmFormat();
120 SmFormat(const SmFormat &rFormat) : SfxBroadcaster() { *this = rFormat; }
122 const Size & GetBaseSize() const { return aBaseSize; }
123 void SetBaseSize(const Size &rSize) { aBaseSize = rSize; }
125 const SmFace & GetFont(USHORT nIdent) const { return vFont[nIdent]; }
126 void SetFont(USHORT nIdent, const SmFace &rFont, BOOL bDefault = FALSE);
127 void SetFontSize(USHORT nIdent, const Size &rSize) { vFont[nIdent].SetSize( rSize ); }
129 void SetDefaultFont(USHORT nIdent, BOOL bVal) { bDefaultFont[nIdent] = bVal; }
130 BOOL IsDefaultFont(USHORT nIdent) const { return bDefaultFont[nIdent]; }
132 USHORT GetRelSize(USHORT nIdent) const { return vSize[nIdent]; }
133 void SetRelSize(USHORT nIdent, USHORT nVal) { vSize[nIdent] = nVal;}
135 USHORT GetDistance(USHORT nIdent) const { return vDist[nIdent]; }
136 void SetDistance(USHORT nIdent, USHORT nVal) { vDist[nIdent] = nVal; }
138 SmHorAlign GetHorAlign() const { return eHorAlign; }
139 void SetHorAlign(SmHorAlign eAlign) { eHorAlign = eAlign; }
141 BOOL IsTextmode() const { return bIsTextmode; }
142 void SetTextmode(BOOL bVal) { bIsTextmode = bVal; }
144 BOOL IsScaleNormalBrackets() const { return bScaleNormalBrackets; }
145 void SetScaleNormalBrackets(BOOL bVal) { bScaleNormalBrackets = bVal; }
147 long GetVersion() const { return nVersion; }
149 //! at time (5.1) use only the lower byte!!!
150 void SetVersion(long nVer) { nVersion = nVer; }
152 SmFormat & operator = (const SmFormat &rFormat);
154 BOOL operator == (const SmFormat &rFormat) const;
155 inline BOOL operator != (const SmFormat &rFormat) const;
157 void RequestApplyChanges() const
159 ((SmFormat *) this)->Broadcast(SfxSimpleHint(HINT_FORMATCHANGED));
164 inline BOOL SmFormat::operator != (const SmFormat &rFormat) const
166 return !(*this == rFormat);
169 #endif