Line data Source code
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 _SVX_SVXFONT_HXX
20 : #define _SVX_SVXFONT_HXX
21 :
22 : #include <limits.h> // USHRT_MAX
23 : #include <editeng/svxenum.hxx>
24 : #include <i18nlangtag/lang.h>
25 : #include <vcl/font.hxx>
26 : #include "editeng/editengdllapi.h"
27 :
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
31 :
32 : class SvxDoCapitals;
33 : class OutputDevice;
34 : class Printer;
35 : class Point;
36 : class Rectangle;
37 : class Size;
38 :
39 1287310 : class EDITENG_DLLPUBLIC SvxFont : public Font
40 : {
41 : LanguageType eLang; // Language
42 : SvxCaseMap eCaseMap; // Text Markup
43 : short nEsc; // Degree of Superscript/Subscript
44 : sal_uInt8 nPropr; // Degree of reduction of the font height
45 : short nKern; // Kerning in Pt
46 :
47 : public:
48 : SvxFont();
49 : SvxFont( const Font &rFont );
50 : SvxFont( const SvxFont &rFont );
51 :
52 : // Methods for Superscript/Subscript
53 867866 : inline short GetEscapement() const { return nEsc; }
54 845310 : inline void SetEscapement( const short nNewEsc ) { nEsc = nNewEsc; }
55 :
56 706665 : inline sal_uInt8 GetPropr() const { return nPropr; }
57 882305 : inline void SetPropr( const sal_uInt8 nNewPropr ) { nPropr = nNewPropr; }
58 0 : inline void SetProprRel( const sal_uInt8 nNewPropr )
59 0 : { SetPropr( (sal_uInt8)( (long)nNewPropr * (long)nPropr / 100L ) ); }
60 :
61 : // Kerning
62 458407 : inline short GetFixKerning() const { return nKern; }
63 853104 : inline void SetFixKerning( const short nNewKern ) { nKern = nNewKern; }
64 :
65 148646 : inline SvxCaseMap GetCaseMap() const { return eCaseMap; }
66 27495 : inline void SetCaseMap( const SvxCaseMap eNew ) { eCaseMap = eNew; }
67 :
68 607780 : inline LanguageType GetLanguage() const { return eLang; }
69 1024999 : inline void SetLanguage( const LanguageType eNewLan )
70 1024999 : { eLang = eNewLan; Font::SetLanguage(eNewLan); }
71 :
72 : // Is-Methods:
73 567626 : inline sal_Bool IsCaseMap() const { return SVX_CASEMAP_NOT_MAPPED != eCaseMap; }
74 56473 : inline sal_Bool IsCapital() const { return SVX_CASEMAP_KAPITAELCHEN == eCaseMap; }
75 512646 : inline sal_Bool IsKern() const { return 0 != nKern; }
76 111716 : inline sal_Bool IsEsc() const { return 0 != nEsc; }
77 :
78 : // Consider Upper case, Lower case letters etc.
79 : OUString CalcCaseMap(const OUString &rTxt) const;
80 :
81 : // Handle upper case letters
82 : void DoOnCapitals( SvxDoCapitals &rDo,
83 : const sal_uInt16 nPartLen = USHRT_MAX ) const;
84 :
85 : void SetPhysFont( OutputDevice *pOut ) const;
86 : Font ChgPhysFont( OutputDevice *pOut ) const;
87 :
88 : Size GetCapitalSize( const OutputDevice *pOut, const String &rTxt,
89 : const sal_uInt16 nIdx, const sal_uInt16 nLen) const;
90 : void DrawCapital( OutputDevice *pOut, const Point &rPos, const String &rTxt,
91 : const sal_uInt16 nIdx, const sal_uInt16 nLen ) const;
92 :
93 : Size GetPhysTxtSize( const OutputDevice *pOut, const String &rTxt,
94 : const sal_uInt16 nIdx, const sal_uInt16 nLen ) const;
95 :
96 : Size GetPhysTxtSize( const OutputDevice *pOut, const String &rTxt );
97 :
98 : Size GetTxtSize( const OutputDevice *pOut, const String &rTxt,
99 : const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ) const;
100 :
101 : void QuickDrawText( OutputDevice *pOut, const Point &rPos, const String &rTxt,
102 : const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN, const sal_Int32* pDXArray = NULL ) const;
103 :
104 : Size QuickGetTextSize( const OutputDevice *pOut, const String &rTxt,
105 : const sal_uInt16 nIdx, const sal_uInt16 nLen, sal_Int32* pDXArray = NULL ) const;
106 :
107 : void DrawPrev( OutputDevice* pOut, Printer* pPrinter,
108 : const Point &rPos, const String &rTxt,
109 : const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ) const;
110 :
111 : static void DrawArrow( OutputDevice &rOut, const Rectangle& rRect,
112 : const Size& rSize, const Color& rCol, sal_Bool bLeft );
113 : SvxFont& operator=( const SvxFont& rFont );
114 : SvxFont& operator=( const Font& rFont );
115 : };
116 :
117 : #endif // #ifndef _SVX_SVXFONT_HXX
118 :
119 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|