nss: upgrade to release 3.73
[LibreOffice.git] / include / editeng / svxfont.hxx
blobc8e8c6670b12c8e8cbcc46f15a97e9acaf9b221d
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 <editeng/svxenum.hxx>
23 #include <tools/long.hxx>
24 #include <vcl/font.hxx>
25 #include <editeng/editengdllapi.h>
27 // Percentage of height of lower case small capital letters compared to upper case letters
28 // See i#1526# for full explanation
29 #define SMALL_CAPS_PERCENTAGE 80
31 class SvxDoCapitals;
32 class OutputDevice;
33 class Printer;
34 class Point;
35 namespace tools { class Rectangle; }
36 class Size;
38 class EDITENG_DLLPUBLIC SvxFont : public vcl::Font
40 SvxCaseMap eCaseMap; // Text Markup
41 short nEsc; // Degree of Superscript/Subscript
42 sal_uInt8 nPropr; // Degree of reduction of the font height
43 short nKern; // Kerning in Pt
45 public:
46 SvxFont();
47 SvxFont( const vcl::Font &rFont );
48 SvxFont( const SvxFont &rFont );
50 // Methods for Superscript/Subscript
51 short GetEscapement() const { return nEsc; }
52 void SetEscapement( const short nNewEsc ) { nEsc = nNewEsc; }
53 // set specific values instead of automatic, and ensure valid value. Depends on nPropr being set already.
54 void SetNonAutoEscapement(short nNewEsc, const OutputDevice* pOutDev = nullptr);
56 sal_uInt8 GetPropr() const { return nPropr; }
57 void SetPropr( const sal_uInt8 nNewPropr ) { nPropr = nNewPropr; }
58 void SetProprRel( const sal_uInt8 nNewPropr )
59 { SetPropr( static_cast<sal_uInt8>( static_cast<tools::Long>(nNewPropr) * static_cast<tools::Long>(nPropr) / 100 ) ); }
61 // Kerning
62 short GetFixKerning() const { return nKern; }
63 void SetFixKerning( const short nNewKern ) { nKern = nNewKern; }
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 IsKern() const { return 0 != nKern; }
72 bool IsEsc() const { return 0 != nEsc; }
74 // Consider Upper case, Lower case letters etc.
75 OUString CalcCaseMap(const OUString &rTxt) const;
77 // Handle upper case letters
78 void DoOnCapitals(SvxDoCapitals &rDo) const;
80 void SetPhysFont( OutputDevice *pOut ) const;
81 vcl::Font ChgPhysFont( OutputDevice *pOut ) const;
83 Size GetCapitalSize( const OutputDevice *pOut, const OUString &rTxt,
84 const sal_Int32 nIdx, const sal_Int32 nLen) const;
85 void DrawCapital( OutputDevice *pOut, const Point &rPos, const OUString &rTxt,
86 const sal_Int32 nIdx, const sal_Int32 nLen ) const;
88 Size GetPhysTxtSize( const OutputDevice *pOut, const OUString &rTxt,
89 const sal_Int32 nIdx, const sal_Int32 nLen ) const;
91 Size GetPhysTxtSize( const OutputDevice *pOut );
93 Size GetTextSize( const OutputDevice *pOut, const OUString &rTxt,
94 const sal_Int32 nIdx = 0, const sal_Int32 nLen = SAL_MAX_INT32 ) const;
96 void QuickDrawText( OutputDevice *pOut, const Point &rPos, const OUString &rTxt,
97 const sal_Int32 nIdx = 0, const sal_Int32 nLen = SAL_MAX_INT32, const tools::Long* pDXArray = nullptr ) const;
99 Size QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt,
100 const sal_Int32 nIdx, const sal_Int32 nLen, tools::Long* pDXArray = nullptr ) const;
102 void DrawPrev( OutputDevice* pOut, Printer* pPrinter,
103 const Point &rPos, const OUString &rTxt,
104 const sal_Int32 nIdx = 0, const sal_Int32 nLen = SAL_MAX_INT32 ) const;
106 static void DrawArrow( OutputDevice &rOut, const tools::Rectangle& rRect,
107 const Size& rSize, const Color& rCol, bool bLeft );
108 SvxFont& operator=( const SvxFont& rFont );
109 SvxFont& operator=( const Font& rFont );
112 #endif // INCLUDED_EDITENG_SVXFONT_HXX
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */