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 INCLUDED_EDITENG_SVXFONT_HXX
20 : #define INCLUDED_EDITENG_SVXFONT_HXX
21 :
22 : #include <limits.h>
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 2830431 : class EDITENG_DLLPUBLIC SvxFont : public vcl::Font
40 : {
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
45 :
46 : public:
47 : SvxFont();
48 : SvxFont( const vcl::Font &rFont );
49 : SvxFont( const SvxFont &rFont );
50 :
51 : // Methods for Superscript/Subscript
52 1449729 : inline short GetEscapement() const { return nEsc; }
53 919501 : inline void SetEscapement( const short nNewEsc ) { nEsc = nNewEsc; }
54 :
55 961741 : inline sal_uInt8 GetPropr() const { return nPropr; }
56 1106523 : inline void SetPropr( const sal_uInt8 nNewPropr ) { nPropr = nNewPropr; }
57 0 : inline void SetProprRel( const sal_uInt8 nNewPropr )
58 0 : { SetPropr( (sal_uInt8)( (long)nNewPropr * (long)nPropr / 100L ) ); }
59 :
60 : // Kerning
61 851556 : inline short GetFixKerning() const { return nKern; }
62 1081426 : inline void SetFixKerning( const short nNewKern ) { nKern = nNewKern; }
63 :
64 172203 : inline SvxCaseMap GetCaseMap() const { return eCaseMap; }
65 1116020 : inline void SetCaseMap( const SvxCaseMap eNew ) { eCaseMap = eNew; }
66 :
67 : // Is-Methods:
68 681382 : inline bool IsCaseMap() const { return SVX_CASEMAP_NOT_MAPPED != eCaseMap; }
69 167376 : inline bool IsCapital() const { return SVX_CASEMAP_KAPITAELCHEN == eCaseMap; }
70 484224 : inline bool IsKern() const { return 0 != nKern; }
71 478377 : inline bool IsEsc() const { return 0 != nEsc; }
72 :
73 : // Consider Upper case, Lower case letters etc.
74 : OUString CalcCaseMap(const OUString &rTxt) const;
75 :
76 : // Handle upper case letters
77 : void DoOnCapitals(SvxDoCapitals &rDo) const;
78 :
79 : void SetPhysFont( OutputDevice *pOut ) const;
80 : vcl::Font ChgPhysFont( OutputDevice *pOut ) const;
81 :
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;
86 :
87 : Size GetPhysTxtSize( const OutputDevice *pOut, const OUString &rTxt,
88 : const sal_Int32 nIdx, const sal_Int32 nLen ) const;
89 :
90 : Size GetPhysTxtSize( const OutputDevice *pOut, const OUString &rTxt );
91 :
92 : Size GetTextSize( const OutputDevice *pOut, const OUString &rTxt,
93 : const sal_Int32 nIdx = 0, const sal_Int32 nLen = SAL_MAX_INT32 ) const;
94 :
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;
97 :
98 : Size QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt,
99 : const sal_Int32 nIdx, const sal_Int32 nLen, long* pDXArray = NULL ) const;
100 :
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;
104 :
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 );
109 : };
110 :
111 : #endif // INCLUDED_EDITENG_SVXFONT_HXX
112 :
113 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|