1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include "smdllapi.hxx"
23 #include <svl/hint.hxx>
24 #include <svl/SfxBroadcaster.hxx>
25 #include "utility.hxx"
29 inline constexpr OUString FNTNAME_TIMES
= u
"Times New Roman"_ustr
;
30 inline constexpr OUString FNTNAME_HELV
= u
"Helvetica"_ustr
;
31 inline constexpr OUString FNTNAME_COUR
= u
"Courier"_ustr
;
32 #define FNTNAME_MATH FONTNAME_MATH
35 // symbolic names used as array indices
39 #define SIZ_FUNCTION 2
40 #define SIZ_OPERATOR 3
44 // symbolic names used as array indices
46 #define FNT_VARIABLE 0
47 #define FNT_FUNCTION 1
56 // symbolic names used as array indices
58 #define DIS_HORIZONTAL 0
59 #define DIS_VERTICAL 1
61 #define DIS_SUPERSCRIPT 3
62 #define DIS_SUBSCRIPT 4
63 #define DIS_NUMERATOR 5
64 #define DIS_DENOMINATOR 6
65 #define DIS_FRACTION 7
66 #define DIS_STROKEWIDTH 8
67 #define DIS_UPPERLIMIT 9
68 #define DIS_LOWERLIMIT 10
69 #define DIS_BRACKETSIZE 11
70 #define DIS_BRACKETSPACE 12
71 #define DIS_MATRIXROW 13
72 #define DIS_MATRIXCOL 14
73 #define DIS_ORNAMENTSIZE 15
74 #define DIS_ORNAMENTSPACE 16
75 #define DIS_OPERATORSIZE 17
76 #define DIS_OPERATORSPACE 18
77 #define DIS_LEFTSPACE 19
78 #define DIS_RIGHTSPACE 20
79 #define DIS_TOPSPACE 21
80 #define DIS_BOTTOMSPACE 22
81 #define DIS_NORMALBRACKETSIZE 23
85 enum class SmHorAlign
{
91 class SM_DLLPUBLIC SmFormat final
: public SfxBroadcaster
93 SmFace vFont
[FNT_END
+ 1];
94 bool bDefaultFont
[FNT_END
+ 1];
96 sal_uInt16 vSize
[SIZ_END
+ 1];
97 sal_uInt16 vDist
[DIS_END
+ 1];
99 sal_Int16 nGreekCharStyle
;
102 bScaleNormalBrackets
;
106 SmFormat(const SmFormat
&rFormat
) : SfxBroadcaster() { *this = rFormat
; }
108 const Size
& GetBaseSize() const { return aBaseSize
; }
109 void SetBaseSize(const Size
&rSize
) { aBaseSize
= rSize
; }
111 const SmFace
& GetFont(sal_uInt16 nIdent
) const { return vFont
[nIdent
]; }
112 void SetFont(sal_uInt16 nIdent
, const SmFace
&rFont
, bool bDefault
= false);
113 void SetFontSize(sal_uInt16 nIdent
, const Size
&rSize
) { vFont
[nIdent
].SetSize( rSize
); }
115 void SetDefaultFont(sal_uInt16 nIdent
, bool bVal
) { bDefaultFont
[nIdent
] = bVal
; }
116 bool IsDefaultFont(sal_uInt16 nIdent
) const { return bDefaultFont
[nIdent
]; }
118 sal_uInt16
GetRelSize(sal_uInt16 nIdent
) const { return vSize
[nIdent
]; }
119 void SetRelSize(sal_uInt16 nIdent
, sal_uInt16 nVal
) { vSize
[nIdent
] = nVal
;}
121 sal_uInt16
GetDistance(sal_uInt16 nIdent
) const { return vDist
[nIdent
]; }
122 void SetDistance(sal_uInt16 nIdent
, sal_uInt16 nVal
) { vDist
[nIdent
] = nVal
; }
124 SmHorAlign
GetHorAlign() const { return eHorAlign
; }
125 void SetHorAlign(SmHorAlign eAlign
) { eHorAlign
= eAlign
; }
127 bool IsTextmode() const { return bIsTextmode
; }
128 void SetTextmode(bool bVal
) { bIsTextmode
= bVal
; }
130 bool IsRightToLeft() const { return bIsRightToLeft
; }
131 void SetRightToLeft(bool bVal
) { bIsRightToLeft
= bVal
; }
133 sal_Int16
GetGreekCharStyle() const { return nGreekCharStyle
; }
134 void SetGreekCharStyle(sal_Int16 nVal
) { nGreekCharStyle
= nVal
; }
136 bool IsScaleNormalBrackets() const { return bScaleNormalBrackets
; }
137 void SetScaleNormalBrackets(bool bVal
) { bScaleNormalBrackets
= bVal
; }
139 SmFormat
& operator = (const SmFormat
&rFormat
);
141 bool operator == (const SmFormat
&rFormat
) const;
142 inline bool operator != (const SmFormat
&rFormat
) const;
144 void RequestApplyChanges()
146 Broadcast(SfxHint(SfxHintId::MathFormatChanged
));
151 inline bool SmFormat::operator != (const SmFormat
&rFormat
) const
153 return !(*this == rFormat
);
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */