office-gobmx/starmath/inc/format.hxx
Stephan Bergmann bd6fb0cd3e Extended loplugin:ostr: Rewrite some O[U]StringLiteral -> O[U]String
...in include files.  This is a mix of automatic rewriting in include files and
manual fixups (mostly addressing loplugin:redundantfcast) in source files that
include those.

Change-Id: I1f3cc1e67b9cabd2e9d61a4d9e9a01e587ea35cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158337
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-23 11:04:42 +02:00

156 lines
5.4 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#pragma once
#include "smdllapi.hxx"
#include <svl/hint.hxx>
#include <svl/SfxBroadcaster.hxx>
#include "utility.hxx"
#include "types.hxx"
inline constexpr OUString FNTNAME_TIMES = u"Times New Roman"_ustr;
inline constexpr OUString FNTNAME_HELV = u"Helvetica"_ustr;
inline constexpr OUString FNTNAME_COUR = u"Courier"_ustr;
#define FNTNAME_MATH FONTNAME_MATH
// symbolic names used as array indices
#define SIZ_BEGIN 0
#define SIZ_TEXT 0
#define SIZ_INDEX 1
#define SIZ_FUNCTION 2
#define SIZ_OPERATOR 3
#define SIZ_LIMITS 4
#define SIZ_END 4
// symbolic names used as array indices
#define FNT_BEGIN 0
#define FNT_VARIABLE 0
#define FNT_FUNCTION 1
#define FNT_NUMBER 2
#define FNT_TEXT 3
#define FNT_SERIF 4
#define FNT_SANS 5
#define FNT_FIXED 6
#define FNT_MATH 7
#define FNT_END 7
// symbolic names used as array indices
#define DIS_BEGIN 0
#define DIS_HORIZONTAL 0
#define DIS_VERTICAL 1
#define DIS_ROOT 2
#define DIS_SUPERSCRIPT 3
#define DIS_SUBSCRIPT 4
#define DIS_NUMERATOR 5
#define DIS_DENOMINATOR 6
#define DIS_FRACTION 7
#define DIS_STROKEWIDTH 8
#define DIS_UPPERLIMIT 9
#define DIS_LOWERLIMIT 10
#define DIS_BRACKETSIZE 11
#define DIS_BRACKETSPACE 12
#define DIS_MATRIXROW 13
#define DIS_MATRIXCOL 14
#define DIS_ORNAMENTSIZE 15
#define DIS_ORNAMENTSPACE 16
#define DIS_OPERATORSIZE 17
#define DIS_OPERATORSPACE 18
#define DIS_LEFTSPACE 19
#define DIS_RIGHTSPACE 20
#define DIS_TOPSPACE 21
#define DIS_BOTTOMSPACE 22
#define DIS_NORMALBRACKETSIZE 23
#define DIS_END 23
enum class SmHorAlign {
Left,
Center,
Right
};
class SM_DLLPUBLIC SmFormat final : public SfxBroadcaster
{
SmFace vFont[FNT_END + 1];
bool bDefaultFont[FNT_END + 1];
Size aBaseSize;
sal_uInt16 vSize[SIZ_END + 1];
sal_uInt16 vDist[DIS_END + 1];
SmHorAlign eHorAlign;
sal_Int16 nGreekCharStyle;
bool bIsTextmode,
bIsRightToLeft,
bScaleNormalBrackets;
public:
SmFormat();
SmFormat(const SmFormat &rFormat) : SfxBroadcaster() { *this = rFormat; }
const Size & GetBaseSize() const { return aBaseSize; }
void SetBaseSize(const Size &rSize) { aBaseSize = rSize; }
const SmFace & GetFont(sal_uInt16 nIdent) const { return vFont[nIdent]; }
void SetFont(sal_uInt16 nIdent, const SmFace &rFont, bool bDefault = false);
void SetFontSize(sal_uInt16 nIdent, const Size &rSize) { vFont[nIdent].SetSize( rSize ); }
void SetDefaultFont(sal_uInt16 nIdent, bool bVal) { bDefaultFont[nIdent] = bVal; }
bool IsDefaultFont(sal_uInt16 nIdent) const { return bDefaultFont[nIdent]; }
sal_uInt16 GetRelSize(sal_uInt16 nIdent) const { return vSize[nIdent]; }
void SetRelSize(sal_uInt16 nIdent, sal_uInt16 nVal) { vSize[nIdent] = nVal;}
sal_uInt16 GetDistance(sal_uInt16 nIdent) const { return vDist[nIdent]; }
void SetDistance(sal_uInt16 nIdent, sal_uInt16 nVal) { vDist[nIdent] = nVal; }
SmHorAlign GetHorAlign() const { return eHorAlign; }
void SetHorAlign(SmHorAlign eAlign) { eHorAlign = eAlign; }
bool IsTextmode() const { return bIsTextmode; }
void SetTextmode(bool bVal) { bIsTextmode = bVal; }
bool IsRightToLeft() const { return bIsRightToLeft; }
void SetRightToLeft(bool bVal) { bIsRightToLeft = bVal; }
sal_Int16 GetGreekCharStyle() const { return nGreekCharStyle; }
void SetGreekCharStyle(sal_Int16 nVal) { nGreekCharStyle = nVal; }
bool IsScaleNormalBrackets() const { return bScaleNormalBrackets; }
void SetScaleNormalBrackets(bool bVal) { bScaleNormalBrackets = bVal; }
SmFormat & operator = (const SmFormat &rFormat);
bool operator == (const SmFormat &rFormat) const;
inline bool operator != (const SmFormat &rFormat) const;
void RequestApplyChanges()
{
Broadcast(SfxHint(SfxHintId::MathFormatChanged));
}
};
inline bool SmFormat::operator != (const SmFormat &rFormat) const
{
return !(*this == rFormat);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */