summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--filter/inc/filter/msfilter/util.hxx11
-rw-r--r--filter/source/msfilter/util.cxx39
-rw-r--r--oox/source/export/drawingml.cxx58
-rw-r--r--sd/source/filter/eppt/pptx-text.cxx49
-rw-r--r--sw/source/filter/ww8/wrtw8num.cxx44
5 files changed, 66 insertions, 135 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;
+}
+
}
}
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index aae83ab0f669..c4396fe996fc 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -66,15 +66,15 @@
#include <com/sun/star/text/XTextRange.hpp>
#include <tools/stream.hxx>
#include <tools/string.hxx>
-#include <vcl/cvtgrf.hxx>
-#include <unotools/fontcvt.hxx>
#include <unotools/fontdefs.hxx>
+#include <vcl/cvtgrf.hxx>
#include <vcl/graph.hxx>
#include <svtools/grfmgr.hxx>
#include <rtl/strbuf.hxx>
#include <sfx2/app.hxx>
#include <svl/languageoptions.hxx>
#include <filter/msfilter/escherex.hxx>
+#include <filter/msfilter/util.hxx>
#include <editeng/svxenum.hxx>
using namespace ::com::sun::star;
@@ -1427,59 +1427,17 @@ void DrawingML::WriteConnectorConnections( EscherConnectorListEntry& rConnectorE
FSEND );
}
-// from sw/source/filter/ww8/wrtw8num.cxx for default bullets to export to MS intact
-static void lcl_SubstituteBullet(String& rNumStr, rtl_TextEncoding& rChrSet, String& rFontName)
-{
- sal_Unicode cChar = rNumStr.GetChar(0);
- StarSymbolToMSMultiFont *pConvert = CreateStarSymbolToMSMultiFont();
- String sFont = pConvert->ConvertChar(cChar);
- delete pConvert;
- if (sFont.Len())
- {
- rNumStr = static_cast< sal_Unicode >(cChar | 0xF000);
- rFontName = sFont;
- rChrSet = RTL_TEXTENCODING_SYMBOL;
- }
- else if ( (rNumStr.GetChar(0) < 0xE000 || rNumStr.GetChar(0) > 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.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Wingdings"));
- rNumStr = static_cast< sal_Unicode >(0x6C);
- }
-}
-
sal_Unicode DrawingML::SubstituteBullet( sal_Unicode cBulletId, ::com::sun::star::awt::FontDescriptor& rFontDesc )
{
- String sNumStr = cBulletId;
-
if ( rFontDesc.Name.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("starsymbol")) ||
- rFontDesc.Name.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("opensymbol")) ) {
- String sFontName = rFontDesc.Name;
- rtl_TextEncoding aCharSet = rFontDesc.CharSet;
-
- lcl_SubstituteBullet( sNumStr, aCharSet, sFontName );
-
- rFontDesc.Name = sFontName;
- rFontDesc.CharSet = aCharSet;
+ rFontDesc.Name.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("opensymbol")) )
+ {
+ rtl_TextEncoding eCharSet = rFontDesc.CharSet;
+ cBulletId = msfilter::util::bestFitOpenSymbolToMSFont(cBulletId, eCharSet, rFontDesc.Name);
+ rFontDesc.CharSet = eCharSet;
}
- return sNumStr.GetChar( 0 );
+ return cBulletId;
}
sax_fastparser::FSHelperPtr DrawingML::CreateOutputStream (
diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx
index 5f9a08c222cf..f264c7c4c8c1 100644
--- a/sd/source/filter/eppt/pptx-text.cxx
+++ b/sd/source/filter/eppt/pptx-text.cxx
@@ -48,11 +48,11 @@
#include <comphelper/processfactory.hxx>
#include <editeng/svxenum.hxx>
#include <editeng/frmdir.hxx>
+#include <filter/msfilter/util.hxx>
#include <i18nutil/scripttypedetector.hxx>
#include <sfx2/app.hxx>
#include <svl/languageoptions.hxx>
#include <oox/export/drawingml.hxx> // for SubstituteBullet
-#include <unotools/fontcvt.hxx>
#include <vcl/metric.hxx>
#include <vcl/outdev.hxx>
#include <vcl/virdev.hxx>
@@ -746,43 +746,6 @@ void ParagraphObj::CalculateGraphicBulletSize( sal_uInt16 nFontHeight )
}
}
-// from sw/source/filter/ww8/wrtw8num.cxx for default bullets to export to MS intact
-static void lcl_SubstituteBullet(rtl::OUString& rNumStr, rtl_TextEncoding& rChrSet, rtl::OUString& rFontName)
-{
- sal_Unicode cChar = rNumStr[0];
- StarSymbolToMSMultiFont *pConvert = CreateStarSymbolToMSMultiFont();
- rtl::OUString sFont = pConvert->ConvertChar(cChar);
- delete pConvert;
- if (!sFont.isEmpty())
- {
- rNumStr = rtl::OUString(static_cast< sal_Unicode >(cChar | 0xF000));
- rFontName = sFont;
- rChrSet = RTL_TEXTENCODING_SYMBOL;
- }
- else if ( (rNumStr[0] < 0xE000 || rNumStr[0] > 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";
- rNumStr = rtl::OUString(static_cast< sal_Unicode >(0x6C));
- }
-}
-
void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int16 nNumberingDepth, sal_Bool bIsBullet, sal_Bool bGetPropStateValue )
{
::com::sun::star::uno::Any aAny;
@@ -930,16 +893,12 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int1
case SVX_NUM_CHAR_SPECIAL : // Bullet
{
- if ( aFontDesc.Name.equals("starsymbol") || aFontDesc.Name.equals("opensymbol") )
+ if ( aFontDesc.Name.equals("starsymbol") || aFontDesc.Name.equals("opensymbol") )
{
- rtl::OUString sFontName(aFontDesc.Name);
- rtl::OUString sNumStr(cBulletId);
rtl_TextEncoding eChrSet = aFontDesc.CharSet;
- lcl_SubstituteBullet(sNumStr,eChrSet,sFontName);
- aFontDesc.Name = sFontName;
- cBulletId = sNumStr[ 0 ];
+ cBulletId = msfilter::util::bestFitOpenSymbolToMSFont(cBulletId, eChrSet, aFontDesc.Name);
aFontDesc.CharSet = eChrSet;
- }
+ }
if ( !aFontDesc.Name.isEmpty() )
{
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index 5e22ae0fb08d..2ac82b1e1992 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -693,48 +693,12 @@ void WW8Export::BuildAnlvBulletBase(WW8_ANLV& rAnlv, sal_uInt8*& rpCh,
void MSWordExportBase::SubstituteBullet( String& rNumStr,
rtl_TextEncoding& rChrSet, String& rFontName ) const
{
- StarSymbolToMSMultiFont *pConvert = 0;
-
if (!bSubstituteBullets)
return;
-
- if (!pConvert)
- {
- pConvert = CreateStarSymbolToMSMultiFont();
- }
- sal_Unicode cChar = rNumStr.GetChar(0);
- String sFont = pConvert->ConvertChar(cChar);
-
- if (sFont.Len())
- {
- rNumStr = static_cast< sal_Unicode >(cChar | 0xF000);
- rFontName = sFont;
- rChrSet = RTL_TEXTENCODING_SYMBOL;
- }
- else if ( SupportsUnicode() &&
- (rNumStr.GetChar(0) < 0xE000 || rNumStr.GetChar(0) > 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.ASSIGN_CONST_ASC("Wingdings");
- rNumStr = static_cast< sal_Unicode >(0x6C);
- }
- delete pConvert;
+ rtl::OUString sFontName = rFontName;
+ rNumStr.SetChar(0, msfilter::util::bestFitOpenSymbolToMSFont(rNumStr.GetChar(0),
+ rChrSet, sFontName, !SupportsUnicode()));
+ rFontName = sFontName;
}
static void SwWw8_InsertAnlText( const String& rStr, sal_uInt8*& rpCh,