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 :
20 : #ifndef INCLUDED_UNOTOOLS_FONTCVT_HXX
21 : #define INCLUDED_UNOTOOLS_FONTCVT_HXX
22 :
23 : #include <unotools/unotoolsdllapi.h>
24 : #include <rtl/ustring.hxx>
25 : #include <tools/solar.h>
26 : #include <o3tl/typed_flags_set.hxx>
27 :
28 : // - FontToSubsFont -
29 :
30 : enum class FontToSubsFontFlags
31 : {
32 : IMPORT = 0x01,
33 : EXPORT = 0x02,
34 : ONLYOLDSOSYMBOLFONTS = 0x04,
35 : };
36 : namespace o3tl
37 : {
38 : template<> struct typed_flags<FontToSubsFontFlags> : is_typed_flags<FontToSubsFontFlags, 0x07> {};
39 : }
40 :
41 : typedef void* FontToSubsFontConverter;
42 : UNOTOOLS_DLLPUBLIC FontToSubsFontConverter CreateFontToSubsFontConverter( const OUString& rFontName, FontToSubsFontFlags nFlags );
43 : UNOTOOLS_DLLPUBLIC void DestroyFontToSubsFontConverter( FontToSubsFontConverter hConverter );
44 : UNOTOOLS_DLLPUBLIC sal_Unicode ConvertFontToSubsFontChar( FontToSubsFontConverter hConverter, sal_Unicode c );
45 : UNOTOOLS_DLLPUBLIC OUString GetFontToSubsFontName( FontToSubsFontConverter hConverter );
46 :
47 : // - StarSymbolToMSMultiFont -
48 :
49 236 : class UNOTOOLS_DLLPUBLIC StarSymbolToMSMultiFont
50 : {
51 : public:
52 : //Returns the name of the best windows symbol font which this char can be
53 : //mapped to. Sets rChar to the correct position for that font. If no
54 : //match found, then no name is returned, and rChar is unchanged. If you
55 : //want to convert a string, you don't want to use this.
56 : virtual OUString ConvertChar(sal_Unicode &rChar) = 0;
57 :
58 : //Starts converting the string at position rIndex. It converts as much of
59 : //the string that can be converted to the same symbol font and returns the
60 : //name of that font. rIndex is modified to the last index that was
61 : //converted. Typically you call if continuously until rIndex ==
62 : //rString.Len() and handle each section as separate 8bit strings using
63 : //separate fonts. Will return an empty string for a continuous section
64 : //that has no possible mapping.
65 : virtual OUString ConvertString(OUString &rString, sal_Int32 &rIndex) = 0;
66 236 : virtual ~StarSymbolToMSMultiFont() {}
67 : };
68 :
69 : //with bPerfect set the converter will only try and convert symbols which have
70 : //perfect mappings to the windows symbols fonts. With it not set, it will
71 : //allow somewhat more dubious transformations that are nevertheless
72 : //recognizably similar. Even in this mode there will be characters that fail.
73 : //The users of this might want to make a distinction between failed characters
74 : //which were inside and those outside the unicode private area.
75 : UNOTOOLS_DLLPUBLIC StarSymbolToMSMultiFont *CreateStarSymbolToMSMultiFont(bool bPerfectOnly=false);
76 :
77 : #endif // INCLUDED_UNOTOOLS_FONTCVT_HXX
78 :
79 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|