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 .
24 : aBaseSize(0, o3tl::convert(12, o3tl::Length::pt
, SmO3tlLengthUnit()))
26 eHorAlign
= SmHorAlign::Center
;
28 bIsTextmode
= bIsRightToLeft
= bScaleNormalBrackets
= false;
30 vSize
[SIZ_TEXT
] = 100;
31 vSize
[SIZ_INDEX
] = 60;
33 vSize
[SIZ_OPERATOR
] = 100;
34 vSize
[SIZ_LIMITS
] = 60;
36 vDist
[DIS_HORIZONTAL
] = 10;
37 vDist
[DIS_VERTICAL
] = 5;
39 vDist
[DIS_SUPERSCRIPT
] =
40 vDist
[DIS_SUBSCRIPT
] = 20;
41 vDist
[DIS_NUMERATOR
] =
42 vDist
[DIS_DENOMINATOR
] = 0;
43 vDist
[DIS_FRACTION
] = 10;
44 vDist
[DIS_STROKEWIDTH
] = 5;
45 vDist
[DIS_UPPERLIMIT
] =
46 vDist
[DIS_LOWERLIMIT
] = 0;
47 vDist
[DIS_BRACKETSIZE
] =
48 vDist
[DIS_BRACKETSPACE
] = 5;
49 vDist
[DIS_MATRIXROW
] = 3;
50 vDist
[DIS_MATRIXCOL
] = 30;
51 vDist
[DIS_ORNAMENTSIZE
] =
52 vDist
[DIS_ORNAMENTSPACE
] = 0;
53 vDist
[DIS_OPERATORSIZE
] = 50;
54 vDist
[DIS_OPERATORSPACE
] = 20;
55 vDist
[DIS_LEFTSPACE
] =
56 vDist
[DIS_RIGHTSPACE
] = 0;
58 vDist
[DIS_BOTTOMSPACE
] =
59 vDist
[DIS_NORMALBRACKETSIZE
] = 0;
65 vFont
[FNT_SERIF
] = SmFace(FNTNAME_TIMES
, aBaseSize
);
66 vFont
[FNT_SANS
] = SmFace(FNTNAME_HELV
, aBaseSize
);
67 vFont
[FNT_FIXED
] = SmFace(FNTNAME_COUR
, aBaseSize
);
68 vFont
[FNT_MATH
] = SmFace(FNTNAME_MATH
, aBaseSize
);
70 vFont
[FNT_MATH
].SetCharSet( RTL_TEXTENCODING_UNICODE
);
72 vFont
[FNT_VARIABLE
].SetItalic(ITALIC_NORMAL
);
73 vFont
[FNT_FUNCTION
].SetItalic(ITALIC_NONE
);
74 vFont
[FNT_NUMBER
] .SetItalic(ITALIC_NONE
);
75 vFont
[FNT_TEXT
] .SetItalic(ITALIC_NONE
);
76 vFont
[FNT_SERIF
] .SetItalic(ITALIC_NONE
);
77 vFont
[FNT_SANS
] .SetItalic(ITALIC_NONE
);
78 vFont
[FNT_FIXED
] .SetItalic(ITALIC_NONE
);
80 for ( sal_uInt16 i
= FNT_BEGIN
; i
<= FNT_END
; i
++ )
82 SmFace
&rFace
= vFont
[i
];
83 rFace
.SetTransparent( true );
84 rFace
.SetAlignment( ALIGN_BASELINE
);
85 rFace
.SetColor( COL_AUTO
);
86 bDefaultFont
[i
] = false;
91 void SmFormat::SetFont(sal_uInt16 nIdent
, const SmFace
&rFont
, bool bDefault
)
93 vFont
[nIdent
] = rFont
;
94 vFont
[nIdent
].SetTransparent( true );
95 vFont
[nIdent
].SetAlignment( ALIGN_BASELINE
);
97 bDefaultFont
[nIdent
] = bDefault
;
100 SmFormat
& SmFormat::operator = (const SmFormat
&rFormat
)
102 SetBaseSize(rFormat
.GetBaseSize());
103 SetHorAlign(rFormat
.GetHorAlign());
104 SetTextmode(rFormat
.IsTextmode());
105 SetRightToLeft(rFormat
.IsRightToLeft());
106 SetGreekCharStyle(rFormat
.GetGreekCharStyle());
107 SetScaleNormalBrackets(rFormat
.IsScaleNormalBrackets());
110 for (i
= FNT_BEGIN
; i
<= FNT_END
; i
++)
112 SetFont(i
, rFormat
.GetFont(i
));
113 SetDefaultFont(i
, rFormat
.IsDefaultFont(i
));
115 for (i
= SIZ_BEGIN
; i
<= SIZ_END
; i
++)
116 SetRelSize(i
, rFormat
.GetRelSize(i
));
117 for (i
= DIS_BEGIN
; i
<= DIS_END
; i
++)
118 SetDistance(i
, rFormat
.GetDistance(i
));
124 bool SmFormat::operator == (const SmFormat
&rFormat
) const
126 bool bRes
= aBaseSize
== rFormat
.aBaseSize
&&
127 eHorAlign
== rFormat
.eHorAlign
&&
128 nGreekCharStyle
== rFormat
.nGreekCharStyle
&&
129 bIsTextmode
== rFormat
.bIsTextmode
&&
130 bIsRightToLeft
== rFormat
.bIsRightToLeft
&&
131 bScaleNormalBrackets
== rFormat
.bScaleNormalBrackets
;
134 for (i
= 0; i
<= SIZ_END
&& bRes
; ++i
)
136 if (vSize
[i
] != rFormat
.vSize
[i
])
139 for (i
= 0; i
<= DIS_END
&& bRes
; ++i
)
141 if (vDist
[i
] != rFormat
.vDist
[i
])
144 for (i
= 0; i
<= FNT_END
&& bRes
; ++i
)
146 if (vFont
[i
] != rFormat
.vFont
[i
] ||
147 bDefaultFont
[i
] != rFormat
.bDefaultFont
[i
])
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */