Reintroduce OUString::replaceAt taking an OUString to LIBO_INTERNAL_ONLY
[LibreOffice.git] / include / editeng / svxfont.hxx
blob9061ffe398d29523a734ada1e10f29d333b8dec3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef INCLUDED_EDITENG_SVXFONT_HXX
20 #define INCLUDED_EDITENG_SVXFONT_HXX
22 #include <sal/config.h>
24 #include <span>
26 #include <editeng/svxenum.hxx>
27 #include <tools/long.hxx>
28 #include <vcl/font.hxx>
29 #include <editeng/editengdllapi.h>
30 #include <tools/poly.hxx>
32 // Percentage of height of lower case small capital letters compared to upper case letters
33 // See i#1526# for full explanation
34 #define SMALL_CAPS_PERCENTAGE 80
36 class KernArray;
37 class SvxDoCapitals;
38 class OutputDevice;
39 class Printer;
40 class Point;
41 namespace tools { class Rectangle; }
42 class Size;
43 class EDITENG_DLLPUBLIC SvxFont : public vcl::Font
45 SvxCaseMap eCaseMap; // Text Markup
46 short nEsc; // Degree of Superscript/Subscript
47 sal_uInt8 nPropr; // Degree of reduction of the font height
49 public:
50 SvxFont();
51 SvxFont( const vcl::Font &rFont );
52 SvxFont( const SvxFont &rFont );
54 // Methods for Superscript/Subscript
55 short GetEscapement() const { return nEsc; }
56 void SetEscapement( const short nNewEsc ) { nEsc = nNewEsc; }
57 // set specific values instead of automatic, and ensure valid value. Depends on nPropr being set already.
58 void SetNonAutoEscapement(short nNewEsc, const OutputDevice* pOutDev = nullptr);
60 sal_uInt8 GetPropr() const { return nPropr; }
61 void SetPropr( const sal_uInt8 nNewPropr ) { nPropr = nNewPropr; }
62 void SetProprRel( const sal_uInt8 nNewPropr )
63 { SetPropr( static_cast<sal_uInt8>( static_cast<tools::Long>(nNewPropr) * static_cast<tools::Long>(nPropr) / 100 ) ); }
65 SvxCaseMap GetCaseMap() const { return eCaseMap; }
66 void SetCaseMap( const SvxCaseMap eNew ) { eCaseMap = eNew; }
68 // Is-Methods:
69 bool IsCaseMap() const { return SvxCaseMap::NotMapped != eCaseMap; }
70 bool IsCapital() const { return SvxCaseMap::SmallCaps == eCaseMap; }
71 bool IsEsc() const { return 0 != nEsc; }
73 // Consider Upper case, Lower case letters etc.
74 OUString CalcCaseMap(const OUString &rTxt) const;
76 // Handle upper case letters
77 void DoOnCapitals(SvxDoCapitals &rDo) const;
79 void SetPhysFont(OutputDevice& rOut) const;
80 vcl::Font ChgPhysFont(OutputDevice& rOut) const;
82 Size GetCapitalSize( const OutputDevice *pOut, const OUString &rTxt, KernArray* pDXAry,
83 const sal_Int32 nIdx, const sal_Int32 nLen) const;
84 void DrawCapital( OutputDevice *pOut, const Point &rPos, const OUString &rTxt,
85 std::span<const sal_Int32> pDXArray,
86 std::span<const sal_Bool> pKashidaArray,
87 const sal_Int32 nIdx, const sal_Int32 nLen ) const;
89 Size GetPhysTxtSize( const OutputDevice *pOut, const OUString &rTxt,
90 const sal_Int32 nIdx, const sal_Int32 nLen ) const;
92 Size GetPhysTxtSize( const OutputDevice *pOut );
94 Size GetTextSize(const OutputDevice& rOut, const OUString &rTxt,
95 const sal_Int32 nIdx = 0, const sal_Int32 nLen = SAL_MAX_INT32) const;
97 void QuickDrawText( OutputDevice *pOut, const Point &rPos, const OUString &rTxt,
98 const sal_Int32 nIdx = 0, const sal_Int32 nLen = SAL_MAX_INT32,
99 std::span<const sal_Int32> pDXArray = {},
100 std::span<const sal_Bool> pKashidaArray = {} ) const;
102 Size QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt,
103 const sal_Int32 nIdx, const sal_Int32 nLen,
104 KernArray* pDXArray = nullptr, bool bStacked = false ) const;
106 void DrawPrev( OutputDevice* pOut, Printer* pPrinter,
107 const Point &rPos, const OUString &rTxt,
108 const sal_Int32 nIdx = 0, const sal_Int32 nLen = SAL_MAX_INT32 ) const;
110 static tools::Polygon DrawArrow( OutputDevice &rOut, const tools::Rectangle& rRect,
111 const Size& rSize, const Color& rCol, bool bLeftOrTop,
112 bool bVertical );
114 SvxFont& operator=( const SvxFont& rFont );
115 SvxFont& operator=( const Font& rFont );
117 // returns true if the SvxFont's own properties are equal (the SvxFont portion of an operator==)
118 bool SvxFontSubsetEquals(const SvxFont& rFont) const;
121 #endif // INCLUDED_EDITENG_SVXFONT_HXX
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */