1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
23 #include <editeng/svxenum.hxx>
24 #include <i18nlangtag/lang.h>
25 #include <vcl/font.hxx>
26 #include <editeng/editengdllapi.h>
28 // Percentage of height of lower case small capital letters compared to upper case letters
29 // See i#1526# for full explanation
30 #define SMALL_CAPS_PERCENTAGE 80
39 class EDITENG_DLLPUBLIC SvxFont
: public vcl::Font
41 SvxCaseMap eCaseMap
; // Text Markup
42 short nEsc
; // Degree of Superscript/Subscript
43 sal_uInt8 nPropr
; // Degree of reduction of the font height
44 short nKern
; // Kerning in Pt
48 SvxFont( const vcl::Font
&rFont
);
49 SvxFont( const SvxFont
&rFont
);
51 // Methods for Superscript/Subscript
52 inline short GetEscapement() const { return nEsc
; }
53 inline void SetEscapement( const short nNewEsc
) { nEsc
= nNewEsc
; }
55 inline sal_uInt8
GetPropr() const { return nPropr
; }
56 inline void SetPropr( const sal_uInt8 nNewPropr
) { nPropr
= nNewPropr
; }
57 inline void SetProprRel( const sal_uInt8 nNewPropr
)
58 { SetPropr( (sal_uInt8
)( (long)nNewPropr
* (long)nPropr
/ 100L ) ); }
61 inline short GetFixKerning() const { return nKern
; }
62 inline void SetFixKerning( const short nNewKern
) { nKern
= nNewKern
; }
64 inline SvxCaseMap
GetCaseMap() const { return eCaseMap
; }
65 inline void SetCaseMap( const SvxCaseMap eNew
) { eCaseMap
= eNew
; }
68 inline bool IsCaseMap() const { return SVX_CASEMAP_NOT_MAPPED
!= eCaseMap
; }
69 inline bool IsCapital() const { return SVX_CASEMAP_KAPITAELCHEN
== eCaseMap
; }
70 inline bool IsKern() const { return 0 != nKern
; }
71 inline 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
*pOut
) const;
80 vcl::Font
ChgPhysFont( OutputDevice
*pOut
) const;
82 Size
GetCapitalSize( const OutputDevice
*pOut
, const OUString
&rTxt
,
83 const sal_Int32 nIdx
, const sal_Int32 nLen
) const;
84 void DrawCapital( OutputDevice
*pOut
, const Point
&rPos
, const OUString
&rTxt
,
85 const sal_Int32 nIdx
, const sal_Int32 nLen
) const;
87 Size
GetPhysTxtSize( const OutputDevice
*pOut
, const OUString
&rTxt
,
88 const sal_Int32 nIdx
, const sal_Int32 nLen
) const;
90 Size
GetPhysTxtSize( const OutputDevice
*pOut
, const OUString
&rTxt
);
92 Size
GetTextSize( const OutputDevice
*pOut
, const OUString
&rTxt
,
93 const sal_Int32 nIdx
= 0, const sal_Int32 nLen
= SAL_MAX_INT32
) const;
95 void QuickDrawText( OutputDevice
*pOut
, const Point
&rPos
, const OUString
&rTxt
,
96 const sal_Int32 nIdx
= 0, const sal_Int32 nLen
= SAL_MAX_INT32
, const long* pDXArray
= NULL
) const;
98 Size
QuickGetTextSize( const OutputDevice
*pOut
, const OUString
&rTxt
,
99 const sal_Int32 nIdx
, const sal_Int32 nLen
, long* pDXArray
= NULL
) const;
101 void DrawPrev( OutputDevice
* pOut
, Printer
* pPrinter
,
102 const Point
&rPos
, const OUString
&rTxt
,
103 const sal_Int32 nIdx
= 0, const sal_Int32 nLen
= SAL_MAX_INT32
) const;
105 static void DrawArrow( OutputDevice
&rOut
, const Rectangle
& rRect
,
106 const Size
& rSize
, const Color
& rCol
, bool bLeft
);
107 SvxFont
& operator=( const SvxFont
& rFont
);
108 SvxFont
& operator=( const Font
& rFont
);
111 #endif // INCLUDED_EDITENG_SVXFONT_HXX
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */