diff options
Diffstat (limited to 'filter')
-rw-r--r-- | filter/inc/filter/msfilter/util.hxx | 11 | ||||
-rw-r--r-- | filter/source/msfilter/util.cxx | 39 |
2 files changed, 50 insertions, 0 deletions
diff --git a/filter/inc/filter/msfilter/util.hxx b/filter/inc/filter/msfilter/util.hxx index ff5220900748..d772a24f9841 100644 --- a/filter/inc/filter/msfilter/util.hxx +++ b/filter/inc/filter/msfilter/util.hxx @@ -59,6 +59,17 @@ to find it, unfortunately :-( */ MSFILTER_DLLPUBLIC rtl::OString DateTimeToOString( const DateTime& rDateTime ); +/// Given a cBullet in encoding r_ioChrSet and fontname r_ioFontName return a +/// suitable new Bullet and change r_ioChrSet and r_ioFontName to form the +/// best-fit replacement in terms of default available MSOffice symbol +/// fonts. +/// +/// Set bDisableUnicodeSupport when exporting to 8bit encodings +/// +/// Used to map from [Open|Star]Symbol to some Windows font or other. +MSFILTER_DLLPUBLIC sal_Unicode bestFitOpenSymbolToMSFont(sal_Unicode cBullet, + rtl_TextEncoding& r_ioChrSet, rtl::OUString& r_ioFontName, bool bDisableUnicodeSupport = false); + } } diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx index adfe49222955..ddb9f1409a16 100644 --- a/filter/source/msfilter/util.cxx +++ b/filter/source/msfilter/util.cxx @@ -28,6 +28,8 @@ #include <rtl/ustring.hxx> #include <rtl/strbuf.hxx> +#include <unotools/fontcvt.hxx> +#include <unotools/fontdefs.hxx> #include <vcl/svapp.hxx> #include <filter/msfilter/util.hxx> @@ -140,6 +142,43 @@ rtl::OString DateTimeToOString( const DateTime& rDateTime ) return aBuffer.makeStringAndClear(); } +sal_Unicode bestFitOpenSymbolToMSFont(sal_Unicode cChar, + rtl_TextEncoding& rChrSet, rtl::OUString& rFontName, bool bDisableUnicodeSupport) +{ + StarSymbolToMSMultiFont *pConvert = CreateStarSymbolToMSMultiFont(); + rtl::OUString sFont = pConvert->ConvertChar(cChar); + delete pConvert; + if (!sFont.isEmpty()) + { + cChar = static_cast< sal_Unicode >(cChar | 0xF000); + rFontName = sFont; + rChrSet = RTL_TEXTENCODING_SYMBOL; + } + else if (!bDisableUnicodeSupport && (cChar < 0xE000 || cChar > 0xF8FF)) + { + /* + Ok we can't fit into a known windows unicode font, but + we are not in the private area, so we are a + standardized symbol, so turn off the symbol bit and + let words own font substitution kick in + */ + rChrSet = RTL_TEXTENCODING_UNICODE; + xub_StrLen nIndex = 0; + rFontName = ::GetNextFontToken(rFontName, nIndex); + } + else + { + /* + Well we don't have an available substition, and we're + in our private area, so give up and show a standard + bullet symbol + */ + rFontName = "Wingdings"; + cChar = static_cast< sal_Unicode >(0x6C); + } + return cChar; +} + } } |