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 <i18npool/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 :
36 93109 : class EDITENG_DLLPUBLIC SvxFont : public Font
37 : {
38 : LanguageType eLang; // Language
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
43 :
44 : public:
45 : SvxFont();
46 : SvxFont( const Font &rFont );
47 : SvxFont( const SvxFont &rFont );
48 :
49 : // Methods for Superscript/Subscript
50 44215 : inline short GetEscapement() const { return nEsc; }
51 63129 : inline void SetEscapement( const short nNewEsc ) { nEsc = nNewEsc; }
52 :
53 40483 : inline sal_uInt8 GetPropr() const { return nPropr; }
54 65897 : inline void SetPropr( const sal_uInt8 nNewPropr ) { nPropr = nNewPropr; }
55 0 : inline void SetProprRel( const sal_uInt8 nNewPropr )
56 0 : { SetPropr( (sal_uInt8)( (long)nNewPropr * (long)nPropr / 100L ) ); }
57 :
58 : // Kerning
59 21697 : inline short GetFixKerning() const { return nKern; }
60 65374 : inline void SetFixKerning( const short nNewKern ) { nKern = nNewKern; }
61 :
62 7228 : inline SvxCaseMap GetCaseMap() const { return eCaseMap; }
63 2658 : inline void SetCaseMap( const SvxCaseMap eNew ) { eCaseMap = eNew; }
64 :
65 32101 : inline LanguageType GetLanguage() const { return eLang; }
66 73595 : inline void SetLanguage( const LanguageType eNewLan )
67 73595 : { eLang = eNewLan; Font::SetLanguage(eNewLan); }
68 :
69 : // Is-Methods:
70 30779 : inline sal_Bool IsCaseMap() const { return SVX_CASEMAP_NOT_MAPPED != eCaseMap; }
71 1267 : inline sal_Bool IsCapital() const { return SVX_CASEMAP_KAPITAELCHEN == eCaseMap; }
72 29540 : inline sal_Bool IsKern() const { return 0 != nKern; }
73 5671 : inline sal_Bool IsEsc() const { return 0 != nEsc; }
74 :
75 : // Consider Upper case, Lower case letters etc.
76 : OUString CalcCaseMap(const OUString &rTxt) const;
77 :
78 : // Handle upper case letters
79 : void DoOnCapitals( SvxDoCapitals &rDo,
80 : const sal_uInt16 nPartLen = USHRT_MAX ) const;
81 :
82 : void SetPhysFont( OutputDevice *pOut ) const;
83 : Font ChgPhysFont( OutputDevice *pOut ) const;
84 :
85 : Size GetCapitalSize( const OutputDevice *pOut, const String &rTxt,
86 : const sal_uInt16 nIdx, const sal_uInt16 nLen) const;
87 : void DrawCapital( OutputDevice *pOut, const Point &rPos, const String &rTxt,
88 : const sal_uInt16 nIdx, const sal_uInt16 nLen ) const;
89 :
90 : Size GetPhysTxtSize( const OutputDevice *pOut, const String &rTxt,
91 : const sal_uInt16 nIdx, const sal_uInt16 nLen ) const;
92 :
93 : Size GetPhysTxtSize( const OutputDevice *pOut, const String &rTxt );
94 :
95 : Size GetTxtSize( const OutputDevice *pOut, const String &rTxt,
96 : const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ) const;
97 :
98 : void QuickDrawText( OutputDevice *pOut, const Point &rPos, const String &rTxt,
99 : const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN, const sal_Int32* pDXArray = NULL ) const;
100 :
101 : Size QuickGetTextSize( const OutputDevice *pOut, const String &rTxt,
102 : const sal_uInt16 nIdx, const sal_uInt16 nLen, sal_Int32* pDXArray = NULL ) const;
103 :
104 : void DrawPrev( OutputDevice* pOut, Printer* pPrinter,
105 : const Point &rPos, const String &rTxt,
106 : const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ) const;
107 :
108 : static void DrawArrow( OutputDevice &rOut, const Rectangle& rRect,
109 : const Size& rSize, const Color& rCol, sal_Bool bLeft );
110 : SvxFont& operator=( const SvxFont& rFont );
111 : SvxFont& operator=( const Font& rFont );
112 : };
113 :
114 : #endif // #ifndef _SVX_SVXFONT_HXX
115 :
116 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|