Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _SVX_SVXFONT_HXX
29 : : #define _SVX_SVXFONT_HXX
30 : :
31 : : #include <limits.h> // USHRT_MAX
32 : : #include <editeng/svxenum.hxx>
33 : : #include <i18npool/lang.h>
34 : : #include <vcl/font.hxx>
35 : : #include "editeng/editengdllapi.h"
36 : :
37 : : // Percentage of height of lower case small capital letters compared to upper case letters
38 : : // See i#1526# for full explanation
39 : : #define SMALL_CAPS_PERCENTAGE 80
40 : :
41 : : class SvxDoCapitals;
42 : : class OutputDevice;
43 : : class Printer;
44 : :
45 : 1308818 : class EDITENG_DLLPUBLIC SvxFont : public Font
46 : : {
47 : : LanguageType eLang; // Language
48 : : SvxCaseMap eCaseMap; // Text Markup
49 : : short nEsc; // Degree of Superscript/Subscript
50 : : sal_uInt8 nPropr; // Degree of reduction of the font height
51 : : short nKern; // Kerning in Pt
52 : :
53 : : public:
54 : : SvxFont();
55 : : SvxFont( const Font &rFont );
56 : : SvxFont( const SvxFont &rFont );
57 : :
58 : : // Methods for Superscript/Subscript
59 : 944821 : inline short GetEscapement() const { return nEsc; }
60 : 566944 : inline void SetEscapement( const short nNewEsc ) { nEsc = nNewEsc; }
61 : :
62 : 620246 : inline sal_uInt8 GetPropr() const { return nPropr; }
63 : 590160 : inline void SetPropr( const sal_uInt8 nNewPropr ) { nPropr = nNewPropr; }
64 : 0 : inline void SetProprRel( const sal_uInt8 nNewPropr )
65 : 0 : { SetPropr( (sal_uInt8)( (long)nNewPropr * (long)nPropr / 100L ) ); }
66 : :
67 : : // Kerning
68 : 607601 : inline short GetFixKerning() const { return nKern; }
69 : 579026 : inline void SetFixKerning( const short nNewKern ) { nKern = nNewKern; }
70 : :
71 : 131671 : inline SvxCaseMap GetCaseMap() const { return eCaseMap; }
72 : 29079 : inline void SetCaseMap( const SvxCaseMap eNew ) { eCaseMap = eNew; }
73 : :
74 : 714023 : inline LanguageType GetLanguage() const { return eLang; }
75 : 580296 : inline void SetLanguage( const LanguageType eNewLan )
76 : 580296 : { eLang = eNewLan; Font::SetLanguage(eNewLan); }
77 : :
78 : : // Is-Methods:
79 : 559196 : inline sal_Bool IsCaseMap() const { return SVX_CASEMAP_NOT_MAPPED != eCaseMap; }
80 : 126787 : inline sal_Bool IsCapital() const { return SVX_CASEMAP_KAPITAELCHEN == eCaseMap; }
81 : 434824 : inline sal_Bool IsKern() const { return 0 != nKern; }
82 : 217265 : inline sal_Bool IsEsc() const { return 0 != nEsc; }
83 : :
84 : : // Consider Upper case, Lower case letters etc.
85 : : String CalcCaseMap( const String &rTxt ) const;
86 : :
87 : : // The following section is not needed by anyone, so it can be excluded.
88 : : #ifndef REDUCEDSVXFONT
89 : : // Handle upper case letters
90 : : void DoOnCapitals( SvxDoCapitals &rDo,
91 : : const sal_uInt16 nPartLen = USHRT_MAX ) const;
92 : :
93 : : void SetPhysFont( OutputDevice *pOut ) const;
94 : : Font ChgPhysFont( OutputDevice *pOut ) const;
95 : :
96 : : Size GetCapitalSize( const OutputDevice *pOut, const String &rTxt,
97 : : const sal_uInt16 nIdx, const sal_uInt16 nLen) const;
98 : : void DrawCapital( OutputDevice *pOut, const Point &rPos, const String &rTxt,
99 : : const sal_uInt16 nIdx, const sal_uInt16 nLen ) const;
100 : :
101 : : Size GetPhysTxtSize( const OutputDevice *pOut, const String &rTxt,
102 : : const sal_uInt16 nIdx, const sal_uInt16 nLen ) const;
103 : :
104 : : Size GetPhysTxtSize( const OutputDevice *pOut, const String &rTxt );
105 : :
106 : : Size GetTxtSize( const OutputDevice *pOut, const String &rTxt,
107 : : const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ) const;
108 : :
109 : : void QuickDrawText( OutputDevice *pOut, const Point &rPos, const String &rTxt,
110 : : const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN, const sal_Int32* pDXArray = NULL ) const;
111 : :
112 : : Size QuickGetTextSize( const OutputDevice *pOut, const String &rTxt,
113 : : const sal_uInt16 nIdx, const sal_uInt16 nLen, sal_Int32* pDXArray = NULL ) const;
114 : :
115 : : void DrawPrev( OutputDevice* pOut, Printer* pPrinter,
116 : : const Point &rPos, const String &rTxt,
117 : : const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ) const;
118 : :
119 : : #endif // !REDUCEDSVXFONT
120 : : static void DrawArrow( OutputDevice &rOut, const Rectangle& rRect,
121 : : const Size& rSize, const Color& rCol, sal_Bool bLeft );
122 : : SvxFont& operator=( const SvxFont& rFont );
123 : : SvxFont& operator=( const Font& rFont );
124 : : };
125 : :
126 : : #endif // #ifndef _SVX_SVXFONT_HXX
127 : :
128 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|