/src/libreoffice/include/editeng/svxfont.hxx
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | #ifndef INCLUDED_EDITENG_SVXFONT_HXX |
20 | | #define INCLUDED_EDITENG_SVXFONT_HXX |
21 | | |
22 | | #include <sal/config.h> |
23 | | |
24 | | #include <span> |
25 | | |
26 | | #include <editeng/svxenum.hxx> |
27 | | #include <tools/long.hxx> |
28 | | #include <vcl/font.hxx> |
29 | | #include <vcl/kernarray.hxx> |
30 | | #include <editeng/editengdllapi.h> |
31 | | #include <tools/poly.hxx> |
32 | | |
33 | | // Percentage of height of lower case small capital letters compared to upper case letters |
34 | | // See i#1526# for full explanation |
35 | 0 | #define SMALL_CAPS_PERCENTAGE 80 |
36 | | |
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 |
44 | | { |
45 | | SvxCaseMap eCaseMap; // Text Markup |
46 | | short nEsc; // Degree of Superscript/Subscript |
47 | | sal_uInt8 nPropr; // Degree of reduction of the font height |
48 | | |
49 | | public: |
50 | | SvxFont(); |
51 | | SvxFont( const vcl::Font &rFont ); |
52 | | SvxFont( const SvxFont &rFont ); |
53 | | |
54 | | // Methods for Superscript/Subscript |
55 | 40.8M | short GetEscapement() const { return nEsc; } |
56 | 4.29k | 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); |
59 | | |
60 | 32.7M | sal_uInt8 GetPropr() const { return nPropr; } |
61 | 28.4M | void SetPropr( const sal_uInt8 nNewPropr ) { nPropr = nNewPropr; } |
62 | | void SetProprRel( const sal_uInt8 nNewPropr ) |
63 | 0 | { SetPropr( static_cast<sal_uInt8>( static_cast<tools::Long>(nNewPropr) * static_cast<tools::Long>(nPropr) / 100 ) ); } |
64 | | |
65 | 23.9M | SvxCaseMap GetCaseMap() const { return eCaseMap; } |
66 | 27.4M | void SetCaseMap( const SvxCaseMap eNew ) { eCaseMap = eNew; } |
67 | | |
68 | | // Is-Methods: |
69 | 17.5M | bool IsCaseMap() const { return SvxCaseMap::NotMapped != eCaseMap; } |
70 | 23.8M | bool IsCapital() const { return SvxCaseMap::SmallCaps == eCaseMap; } |
71 | 8.65M | bool IsEsc() const { return 0 != nEsc; } |
72 | | |
73 | | // Consider Upper case, Lower case letters etc. |
74 | | OUString CalcCaseMap(const OUString &rTxt) const; |
75 | | |
76 | | // Handle upper case letters |
77 | | void DoOnCapitals(SvxDoCapitals &rDo) const; |
78 | | |
79 | | void SetPhysFont(OutputDevice& rOut) const; |
80 | | vcl::Font ChgPhysFont(OutputDevice& rOut) const; |
81 | | |
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 | | KernArraySpan pDXArray, |
86 | | std::span<const sal_Bool> pKashidaArray, |
87 | | const sal_Int32 nIdx, const sal_Int32 nLen ) const; |
88 | | |
89 | | Size GetPhysTxtSize( const OutputDevice *pOut, const OUString &rTxt, |
90 | | const sal_Int32 nIdx, const sal_Int32 nLen ) const; |
91 | | |
92 | | Size GetPhysTxtSize( const OutputDevice *pOut ); |
93 | | |
94 | | Size GetTextSize(const OutputDevice& rOut, const OUString &rTxt, |
95 | | const sal_Int32 nIdx = 0, const sal_Int32 nLen = SAL_MAX_INT32) const; |
96 | | |
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 | | KernArraySpan pDXArray = {}, |
100 | | std::span<const sal_Bool> pKashidaArray = {} ) const; |
101 | | |
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; |
105 | | |
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; |
109 | | |
110 | | static tools::Polygon DrawArrow( OutputDevice &rOut, const tools::Rectangle& rRect, |
111 | | const Size& rSize, const Color& rCol, bool bLeftOrTop, |
112 | | bool bVertical ); |
113 | | |
114 | | SvxFont& operator=( const SvxFont& rFont ); |
115 | | SvxFont& operator=( const Font& rFont ); |
116 | | |
117 | | // returns true if the SvxFont's own properties are equal (the SvxFont portion of an operator==) |
118 | | bool SvxFontSubsetEquals(const SvxFont& rFont) const; |
119 | | }; |
120 | | |
121 | | #endif // INCLUDED_EDITENG_SVXFONT_HXX |
122 | | |
123 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |