xref: /trunk/main/editeng/inc/editeng/svxfont.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1*4c5491eaSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*4c5491eaSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*4c5491eaSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*4c5491eaSAndrew Rist  * distributed with this work for additional information
6*4c5491eaSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*4c5491eaSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*4c5491eaSAndrew Rist  * "License"); you may not use this file except in compliance
9*4c5491eaSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*4c5491eaSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*4c5491eaSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*4c5491eaSAndrew Rist  * software distributed under the License is distributed on an
15*4c5491eaSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*4c5491eaSAndrew Rist  * KIND, either express or implied.  See the License for the
17*4c5491eaSAndrew Rist  * specific language governing permissions and limitations
18*4c5491eaSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*4c5491eaSAndrew Rist  *************************************************************/
21*4c5491eaSAndrew Rist 
22*4c5491eaSAndrew Rist 
23cdf0e10cSrcweir #ifndef _SVX_SVXFONT_HXX
24cdf0e10cSrcweir #define _SVX_SVXFONT_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <limits.h>     // USHRT_MAX
27cdf0e10cSrcweir #include <editeng/svxenum.hxx>
28cdf0e10cSrcweir #include <i18npool/lang.h>
29cdf0e10cSrcweir #include <vcl/font.hxx>
30cdf0e10cSrcweir #include "editeng/editengdllapi.h"
31cdf0e10cSrcweir 
32cdf0e10cSrcweir class SvxDoCapitals;
33cdf0e10cSrcweir class OutputDevice;
34cdf0e10cSrcweir class Printer;
35cdf0e10cSrcweir 
36cdf0e10cSrcweir class EDITENG_DLLPUBLIC SvxFont : public Font
37cdf0e10cSrcweir {
38cdf0e10cSrcweir     LanguageType eLang;         // Language
39cdf0e10cSrcweir     SvxCaseMap   eCaseMap;      // Textauszeichnung
40cdf0e10cSrcweir     short nEsc;                 // Grad der Hoch-/Tiefstellung
41cdf0e10cSrcweir     sal_uInt8  nPropr;               // Grad der Verkleinerung der Fonthoehe
42cdf0e10cSrcweir     short nKern;                // Kerning in Pt
43cdf0e10cSrcweir 
44cdf0e10cSrcweir public:
45cdf0e10cSrcweir     SvxFont();
46cdf0e10cSrcweir     SvxFont( const Font &rFont );
47cdf0e10cSrcweir     SvxFont( const SvxFont &rFont );
48cdf0e10cSrcweir 
49cdf0e10cSrcweir     // Methoden fuer die Hoch-/Tiefstellung
GetEscapement() const50cdf0e10cSrcweir     inline short GetEscapement() const { return nEsc; }
SetEscapement(const short nNewEsc)51cdf0e10cSrcweir     inline void SetEscapement( const short nNewEsc ) { nEsc = nNewEsc; }
52cdf0e10cSrcweir 
GetPropr() const53cdf0e10cSrcweir     inline sal_uInt8 GetPropr() const { return nPropr; }
SetPropr(const sal_uInt8 nNewPropr)54cdf0e10cSrcweir     inline void SetPropr( const sal_uInt8 nNewPropr ) { nPropr = nNewPropr; }
SetProprRel(const sal_uInt8 nNewPropr)55cdf0e10cSrcweir     inline void SetProprRel( const sal_uInt8 nNewPropr )
56cdf0e10cSrcweir         { SetPropr( (sal_uInt8)( (long)nNewPropr * (long)nPropr / 100L ) ); }
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     // Kerning
GetFixKerning() const59cdf0e10cSrcweir     inline short GetFixKerning() const { return nKern; }
SetFixKerning(const short nNewKern)60cdf0e10cSrcweir     inline void  SetFixKerning( const short nNewKern ) { nKern = nNewKern; }
61cdf0e10cSrcweir 
GetCaseMap() const62cdf0e10cSrcweir     inline SvxCaseMap GetCaseMap() const { return eCaseMap; }
SetCaseMap(const SvxCaseMap eNew)63cdf0e10cSrcweir     inline void    SetCaseMap( const SvxCaseMap eNew ) { eCaseMap = eNew; }
64cdf0e10cSrcweir 
GetLanguage() const65cdf0e10cSrcweir     inline LanguageType GetLanguage() const { return eLang; }
SetLanguage(const LanguageType eNewLan)66cdf0e10cSrcweir     inline void SetLanguage( const LanguageType eNewLan )
67cdf0e10cSrcweir         { eLang = eNewLan;  Font::SetLanguage(eNewLan); }
68cdf0e10cSrcweir 
69cdf0e10cSrcweir     // Is-Methoden:
IsCaseMap() const70cdf0e10cSrcweir     inline sal_Bool IsCaseMap() const { return SVX_CASEMAP_NOT_MAPPED != eCaseMap; }
IsCapital() const71cdf0e10cSrcweir     inline sal_Bool IsCapital() const { return SVX_CASEMAP_KAPITAELCHEN == eCaseMap; }
IsKern() const72cdf0e10cSrcweir     inline sal_Bool IsKern() const { return 0 != nKern; }
IsEsc() const73cdf0e10cSrcweir     inline sal_Bool IsEsc() const { return 0 != nEsc; }
74cdf0e10cSrcweir 
75cdf0e10cSrcweir     // Versalien, Gemeine etc. beruecksichtigen
76cdf0e10cSrcweir     String CalcCaseMap( const String &rTxt ) const;
77cdf0e10cSrcweir 
78cdf0e10cSrcweir // Der folgende Bereich wird nicht von jedem benoetigt, er kann deshalb
79cdf0e10cSrcweir // ausgeklammert werden.
80cdf0e10cSrcweir #ifndef REDUCEDSVXFONT
81cdf0e10cSrcweir     // Kapitaelchenbearbeitung
82cdf0e10cSrcweir     void DoOnCapitals( SvxDoCapitals &rDo,
83cdf0e10cSrcweir                        const sal_uInt16 nPartLen = USHRT_MAX ) const;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     void SetPhysFont( OutputDevice *pOut ) const;
86cdf0e10cSrcweir     Font ChgPhysFont( OutputDevice *pOut ) const;
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     Size GetCapitalSize( const OutputDevice *pOut, const String &rTxt,
89cdf0e10cSrcweir                           const sal_uInt16 nIdx, const sal_uInt16 nLen) const;
90cdf0e10cSrcweir     void DrawCapital( OutputDevice *pOut, const Point &rPos, const String &rTxt,
91cdf0e10cSrcweir                       const sal_uInt16 nIdx, const sal_uInt16 nLen ) const;
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     Size GetPhysTxtSize( const OutputDevice *pOut, const String &rTxt,
94cdf0e10cSrcweir                          const sal_uInt16 nIdx, const sal_uInt16 nLen ) const;
95cdf0e10cSrcweir 
96cdf0e10cSrcweir     Size GetPhysTxtSize( const OutputDevice *pOut, const String &rTxt );
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     Size GetTxtSize( const OutputDevice *pOut, const String &rTxt,
99cdf0e10cSrcweir                       const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN );
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     void DrawText( OutputDevice *pOut, const Point &rPos, const String &rTxt,
102cdf0e10cSrcweir                const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ) const;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir     void QuickDrawText( OutputDevice *pOut, const Point &rPos, const String &rTxt,
105cdf0e10cSrcweir                const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN, const sal_Int32* pDXArray = NULL ) const;
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     Size QuickGetTextSize( const OutputDevice *pOut, const String &rTxt,
108cdf0e10cSrcweir                          const sal_uInt16 nIdx, const sal_uInt16 nLen, sal_Int32* pDXArray = NULL ) const;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     void DrawPrev( OutputDevice* pOut, Printer* pPrinter,
111cdf0e10cSrcweir                    const Point &rPos, const String &rTxt,
112cdf0e10cSrcweir                    const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ) const;
113cdf0e10cSrcweir 
114cdf0e10cSrcweir #endif // !REDUCEDSVXFONT
115cdf0e10cSrcweir     static void DrawArrow( OutputDevice &rOut, const Rectangle& rRect,
116cdf0e10cSrcweir         const Size& rSize, const Color& rCol, sal_Bool bLeft );
117cdf0e10cSrcweir     SvxFont&    operator=( const SvxFont& rFont );
118cdf0e10cSrcweir     SvxFont&    operator=( const Font& rFont );
119cdf0e10cSrcweir };
120cdf0e10cSrcweir 
121cdf0e10cSrcweir #endif // #ifndef   _SVX_SVXFONT_HXX
122