xref: /trunk/main/unotools/inc/unotools/fontdefs.hxx (revision bae3752e)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _UNOTOOLS_FONTDEFS_HXX
24 #define _UNOTOOLS_FONTDEFS_HXX
25 
26 #include <unotools/unotoolsdllapi.h>
27 #include <sal/types.h>
28 #include <tools/string.hxx>
29 
30 namespace utl {
31   class FontSubstConfiguration;
32   struct FontNameAttr;
33 }
34 
35 // ----------------
36 // - SubsFontName -
37 // ----------------
38 
39 #define SUBSFONT_ONLYONE    ((sal_uLong)0x00000001)
40 #define SUBSFONT_MS         ((sal_uLong)0x00000002)
41 #define SUBSFONT_PS         ((sal_uLong)0x00000004)
42 #define SUBSFONT_HTML       ((sal_uLong)0x00000008)
43 
44 UNOTOOLS_DLLPUBLIC String GetSubsFontName( const String& rName, sal_uLong nFlags );
45 
46 // -----------------
47 // - FontTokenName -
48 // -----------------
49 
50 UNOTOOLS_DLLPUBLIC String GetFontToken( const String& rName, xub_StrLen nToken, xub_StrLen& rIndex );
GetFontToken(const String & rName,xub_StrLen nToken)51 inline String GetFontToken( const String& rName, xub_StrLen nToken )
52 {
53     xub_StrLen nTempIndex = 0;
54     return GetFontToken( rName, nToken, nTempIndex );
55 }
56 
57 UNOTOOLS_DLLPUBLIC void AddTokenFontName( String& rName, const String& rNewToken );
58 
59 struct UNOTOOLS_DLLPUBLIC FontNameHash { int operator()(const String&) const; };
60 
61 // ---------------
62 // - ConvertChar -
63 // ---------------
64 
65 class UNOTOOLS_DLLPUBLIC ConvertChar
66 {
67 public:
68     const sal_Unicode*  mpCvtTab;
69     const char*         mpSubsFontName;
70     sal_Unicode         (*mpCvtFunc)( sal_Unicode );
71 	sal_Unicode			RecodeChar( sal_Unicode c ) const;
72 	void				RecodeString( String& rStra, xub_StrLen nIndex, xub_StrLen nLen ) const;
73 	static const ConvertChar* GetRecodeData( const String& rOrgFontName, const String& rMapFontName );
74 };
75 
76 
77 // Default-Font
78 #define DEFAULTFONT_SANS_UNICODE        ((sal_uInt16)1)
79 #define DEFAULTFONT_SANS                ((sal_uInt16)2)
80 #define DEFAULTFONT_SERIF               ((sal_uInt16)3)
81 #define DEFAULTFONT_FIXED               ((sal_uInt16)4)
82 #define DEFAULTFONT_SYMBOL              ((sal_uInt16)5)
83 #define DEFAULTFONT_UI_SANS             ((sal_uInt16)1000)
84 #define DEFAULTFONT_UI_FIXED            ((sal_uInt16)1001)
85 #define DEFAULTFONT_LATIN_TEXT          ((sal_uInt16)2000)
86 #define DEFAULTFONT_LATIN_PRESENTATION  ((sal_uInt16)2001)
87 #define DEFAULTFONT_LATIN_SPREADSHEET   ((sal_uInt16)2002)
88 #define DEFAULTFONT_LATIN_HEADING       ((sal_uInt16)2003)
89 #define DEFAULTFONT_LATIN_DISPLAY       ((sal_uInt16)2004)
90 #define DEFAULTFONT_LATIN_FIXED         ((sal_uInt16)2005)
91 #define DEFAULTFONT_CJK_TEXT            ((sal_uInt16)3000)
92 #define DEFAULTFONT_CJK_PRESENTATION    ((sal_uInt16)3001)
93 #define DEFAULTFONT_CJK_SPREADSHEET     ((sal_uInt16)3002)
94 #define DEFAULTFONT_CJK_HEADING         ((sal_uInt16)3003)
95 #define DEFAULTFONT_CJK_DISPLAY         ((sal_uInt16)3004)
96 #define DEFAULTFONT_CTL_TEXT            ((sal_uInt16)4000)
97 #define DEFAULTFONT_CTL_PRESENTATION    ((sal_uInt16)4001)
98 #define DEFAULTFONT_CTL_SPREADSHEET     ((sal_uInt16)4002)
99 #define DEFAULTFONT_CTL_HEADING         ((sal_uInt16)4003)
100 #define DEFAULTFONT_CTL_DISPLAY         ((sal_uInt16)4004)
101 
102 UNOTOOLS_DLLPUBLIC String GetNextFontToken( const String& rTokenStr, xub_StrLen& rIndex );
103 
104 UNOTOOLS_DLLPUBLIC void GetEnglishSearchFontName( String& rName );
105 
106 #endif
107