1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _UNOTOOLS_FONTCVT_HXX 29 #define _UNOTOOLS_FONTCVT_HXX 30 31 #include <unotools/unotoolsdllapi.h> 32 #include <tools/string.hxx> 33 34 // ------------------ 35 // - FontToSubsFont - 36 // ------------------ 37 38 #define FONTTOSUBSFONT_IMPORT ((sal_uLong)0x00000001) 39 #define FONTTOSUBSFONT_EXPORT ((sal_uLong)0x00000002) 40 #define FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ((sal_uLong)0x00000004) 41 42 typedef void* FontToSubsFontConverter; 43 UNOTOOLS_DLLPUBLIC FontToSubsFontConverter CreateFontToSubsFontConverter( const String& rFontName, sal_uLong nFlags ); 44 UNOTOOLS_DLLPUBLIC void DestroyFontToSubsFontConverter( FontToSubsFontConverter hConverter ); 45 UNOTOOLS_DLLPUBLIC sal_Unicode ConvertFontToSubsFontChar( FontToSubsFontConverter hConverter, sal_Unicode c ); 46 UNOTOOLS_DLLPUBLIC String GetFontToSubsFontName( FontToSubsFontConverter hConverter ); 47 48 // --------------------------- 49 // - StarSymbolToMSMultiFont - 50 // --------------------------- 51 52 class UNOTOOLS_DLLPUBLIC StarSymbolToMSMultiFont 53 { 54 public: 55 //Returns the name of the best windows symbol font which this char can be 56 //mapped to. Sets rChar to the correct position for that font. If no 57 //match found, then no name is returned, and rChar is unchanged. If you 58 //want to convert a string, you don't want to use this. 59 virtual String ConvertChar(sal_Unicode &rChar) = 0; 60 61 //Starts converting the string at position rIndex. It converts as much of 62 //the string that can be converted to the same symbol font and returns the 63 //name of that font. rIndex is modified to the last index that was 64 //converted. Typically you call if continously until rIndex == 65 //rString.Len() and handle each section as seperate 8bit strings using 66 //seperate fonts. Will return an empty string for a continous section 67 //that has no possible mapping. 68 virtual String ConvertString(String &rString, xub_StrLen &rIndex) = 0; 69 virtual ~StarSymbolToMSMultiFont() {} 70 }; 71 72 //with bPerfect set the converter will only try and convert symbols which have 73 //perfect mappings to the windows symbols fonts. With it not set, it will 74 //allow somewhat more dubious transformations that are nevertheless 75 //recognizably similiar. Even in this mode there will be characters that fail. 76 //The users of this might want to make a distinction between failed characters 77 //which were inside and those outside the unicode private area. 78 UNOTOOLS_DLLPUBLIC StarSymbolToMSMultiFont *CreateStarSymbolToMSMultiFont(bool bPerfectOnly=false); 79 #endif // _UNOTOOLS_FONTCVT_HXX 80