bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / editeng / svxfont.hxx
blobcf8862da0a9d678703ca15384dc63babfcfee614
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 <vcl/font.hxx>
24 #include <editeng/editengdllapi.h>
26 // Percentage of height of lower case small capital letters compared to upper case letters
27 // See i#1526# for full explanation
28 #define SMALL_CAPS_PERCENTAGE 80
30 class SvxDoCapitals;
31 class OutputDevice;
32 class Printer;
33 class Point;
34 namespace tools { class Rectangle; }
35 class Size;
37 class EDITENG_DLLPUBLIC SvxFont : public vcl::Font
39 SvxCaseMap eCaseMap; // Text Markup
40 short nEsc; // Degree of Superscript/Subscript
41 sal_uInt8 nPropr; // Degree of reduction of the font height
42 short nKern; // Kerning in Pt
44 public:
45 SvxFont();
46 SvxFont( const vcl::Font &rFont );
47 SvxFont( const SvxFont &rFont );
49 // Methods for Superscript/Subscript
50 short GetEscapement() const { return nEsc; }
51 void SetEscapement( const short nNewEsc ) { nEsc = nNewEsc; }
53 sal_uInt8 GetPropr() const { return nPropr; }
54 void SetPropr( const sal_uInt8 nNewPropr ) { nPropr = nNewPropr; }
55 void SetProprRel( const sal_uInt8 nNewPropr )
56 { SetPropr( static_cast<sal_uInt8>( static_cast<long>(nNewPropr) * static_cast<long>(nPropr) / 100L ) ); }
58 // Kerning
59 short GetFixKerning() const { return nKern; }
60 void SetFixKerning( const short nNewKern ) { nKern = nNewKern; }
62 SvxCaseMap GetCaseMap() const { return eCaseMap; }
63 void SetCaseMap( const SvxCaseMap eNew ) { eCaseMap = eNew; }
65 // Is-Methods:
66 bool IsCaseMap() const { return SvxCaseMap::NotMapped != eCaseMap; }
67 bool IsCapital() const { return SvxCaseMap::SmallCaps == eCaseMap; }
68 bool IsKern() const { return 0 != nKern; }
69 bool IsEsc() const { return 0 != nEsc; }
71 // Consider Upper case, Lower case letters etc.
72 OUString CalcCaseMap(const OUString &rTxt) const;
74 // Handle upper case letters
75 void DoOnCapitals(SvxDoCapitals &rDo) const;
77 void SetPhysFont( OutputDevice *pOut ) const;
78 vcl::Font ChgPhysFont( OutputDevice *pOut ) const;
80 Size GetCapitalSize( const OutputDevice *pOut, const OUString &rTxt,
81 const sal_Int32 nIdx, const sal_Int32 nLen) const;
82 void DrawCapital( OutputDevice *pOut, const Point &rPos, const OUString &rTxt,
83 const sal_Int32 nIdx, const sal_Int32 nLen ) const;
85 Size GetPhysTxtSize( const OutputDevice *pOut, const OUString &rTxt,
86 const sal_Int32 nIdx, const sal_Int32 nLen ) const;
88 Size GetPhysTxtSize( const OutputDevice *pOut );
90 Size GetTextSize( const OutputDevice *pOut, const OUString &rTxt,
91 const sal_Int32 nIdx = 0, const sal_Int32 nLen = SAL_MAX_INT32 ) const;
93 void QuickDrawText( OutputDevice *pOut, const Point &rPos, const OUString &rTxt,
94 const sal_Int32 nIdx = 0, const sal_Int32 nLen = SAL_MAX_INT32, const long* pDXArray = nullptr ) const;
96 Size QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt,
97 const sal_Int32 nIdx, const sal_Int32 nLen, long* pDXArray = nullptr ) const;
99 void DrawPrev( OutputDevice* pOut, Printer* pPrinter,
100 const Point &rPos, const OUString &rTxt,
101 const sal_Int32 nIdx = 0, const sal_Int32 nLen = SAL_MAX_INT32 ) const;
103 static void DrawArrow( OutputDevice &rOut, const tools::Rectangle& rRect,
104 const Size& rSize, const Color& rCol, bool bLeft );
105 SvxFont& operator=( const SvxFont& rFont );
106 SvxFont& operator=( const Font& rFont );
109 #endif // INCLUDED_EDITENG_SVXFONT_HXX
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */