Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/4077
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/77/4077/1
Make use of IsStarSymbol()
Change-Id: I7a2e3a6f11bbaaaff50e8163e4ce3e2583b1d03c
---
M editeng/source/items/textitem.cxx
M include/unotools/fontdefs.hxx
M oox/source/export/drawingml.cxx
M sd/source/filter/eppt/pptx-text.cxx
M sw/source/filter/ww8/writerhelper.cxx
M sw/source/filter/ww8/writerhelper.hxx
M sw/source/filter/ww8/writerwordglue.cxx
M sw/source/filter/ww8/wrtw8num.cxx
M unotools/source/misc/fontcvt.cxx
M unotools/source/misc/fontdefs.cxx
M vcl/generic/fontmanager/fontsubst.cxx
M vcl/generic/glyphs/gcach_ftyp.cxx
M vcl/source/filter/wmf/wmfwr.cxx
M vcl/source/gdi/metaact.cxx
M vcl/source/gdi/outdev3.cxx
15 files changed, 34 insertions(+), 50 deletions(-)
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 51995af..f9f342e 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -373,9 +373,7 @@
SvStream& SvxFontItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
{
- sal_Bool bToBats =
- GetFamilyName().EqualsIgnoreCaseAscii( "StarSymbol", 0, sizeof("StarSymbol")-1 ) ||
- GetFamilyName().EqualsIgnoreCaseAscii( "OpenSymbol", 0, sizeof("OpenSymbol")-1 );
+ sal_Bool bToBats = IsStarSymbol( GetFamilyName() );
rStrm << (sal_uInt8) GetFamily() << (sal_uInt8) GetPitch()
<< (sal_uInt8)(bToBats ? RTL_TEXTENCODING_SYMBOL : GetSOStoreTextEncoding(GetCharSet()));
diff --git a/include/unotools/fontdefs.hxx b/include/unotools/fontdefs.hxx
index 60c37d4..d1bf777 100644
--- a/include/unotools/fontdefs.hxx
+++ b/include/unotools/fontdefs.hxx
@@ -90,6 +90,15 @@
UNOTOOLS_DLLPUBLIC void GetEnglishSearchFontName( OUString& rName );
+/** Determine if the font is the special Star|Open Symbol font
+
+ @param rFontName
+ The FontName to test for being Star|Open Symbol
+
+ @return true if this is Star|Open Symbol
+*/
+UNOTOOLS_DLLPUBLIC bool IsStarSymbol(const OUString &rFontName);
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 6d73d3d..8cbeead 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1483,7 +1483,7 @@
sal_Unicode DrawingML::SubstituteBullet( sal_Unicode cBulletId,
::com::sun::star::awt::FontDescriptor& rFontDesc )
{
- if ( rFontDesc.Name.equalsIgnoreAsciiCase("starsymbol") ||
rFontDesc.Name.equalsIgnoreAsciiCase("opensymbol") )
+ if ( IsStarSymbol(rFontDesc.Name) )
{
rtl_TextEncoding eCharSet = rFontDesc.CharSet;
cBulletId = msfilter::util::bestFitOpenSymbolToMSFont(cBulletId, eCharSet, rFontDesc.Name);
diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx
index 22c713f..e96a03f 100644
--- a/sd/source/filter/eppt/pptx-text.cxx
+++ b/sd/source/filter/eppt/pptx-text.cxx
@@ -884,7 +884,7 @@
case SVX_NUM_CHAR_SPECIAL : // Bullet
{
- if ( aFontDesc.Name.equalsIgnoreAsciiCase("starsymbol") ||
aFontDesc.Name.equalsIgnoreAsciiCase("opensymbol") )
+ if ( IsStarSymbol(aFontDesc.Name) )
{
rtl_TextEncoding eChrSet = aFontDesc.CharSet;
cBulletId = msfilter::util::bestFitOpenSymbolToMSFont(cBulletId,
eChrSet, aFontDesc.Name);
diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx
index 228bc59..664d5aa 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -666,14 +666,6 @@
}
}
- bool IsStarSymbol(const OUString &rFontName)
- {
- sal_Int32 nIndex = 0;
- OUString sFamilyNm(GetNextFontToken(rFontName, nIndex));
- return (sFamilyNm.equalsIgnoreAsciiCase("starsymbol") ||
- sFamilyNm.equalsIgnoreAsciiCase("opensymbol"));
- }
-
Size GetSwappedInSize(const SwNoTxtNode& rNd)
{
Size aGrTwipSz(rNd.GetTwipSize());
diff --git a/sw/source/filter/ww8/writerhelper.hxx b/sw/source/filter/ww8/writerhelper.hxx
index 52bfba7..e411ac8 100644
--- a/sw/source/filter/ww8/writerhelper.hxx
+++ b/sw/source/filter/ww8/writerhelper.hxx
@@ -747,18 +747,6 @@
*/
Polygon PolygonFromPolyPolygon(const PolyPolygon &rPolyPoly);
- /** Determine if the font is the special Star|Open Symbol font
-
- @param rFontName
- The FontName to test for being Star|Open Symbol
-
- @return true if this is Star|Open Symbol
-
- @author
- <a href="mailto:cmc@openoffice.org">Caolán McNamara</a>
- */
- bool IsStarSymbol(const OUString &rFontName);
-
/** Make setting a drawing object's layer in a Writer document easy
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index af662ed..e34b16c 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -317,7 +317,7 @@
String FindBestMSSubstituteFont(const String &rFont)
{
String sRet;
- if (sw::util::IsStarSymbol(rFont))
+ if ( IsStarSymbol(rFont) )
sRet.ASSIGN_CONST_ASC("Arial Unicode MS");
else
sRet = GetSubsFontName(rFont, SUBSFONT_ONLYONE | SUBSFONT_MS);
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index 82c54c1..61ffdee 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -28,6 +28,7 @@
#include <paratr.hxx>
#include <charfmt.hxx>
#include <ndtxt.hxx>
+#include <unotools/fontcfg.hxx>
#include <com/sun/star/i18n/ScriptType.hpp>
#include <doctok/sprmids.hxx>
@@ -385,7 +386,7 @@
sFontName = pBulletFont->GetName();
eFamily = pBulletFont->GetFamily();
- if ( sw::util::IsStarSymbol( sFontName ) )
+ if ( IsStarSymbol(sFontName) )
SubstituteBullet( sNumStr, eChrSet, sFontName );
// #i86652#
@@ -642,7 +643,7 @@
String sFontName = rFont.GetName();
sal_uInt16 nFontId;
- if (sw::util::IsStarSymbol(sFontName))
+ if ( IsStarSymbol(sFontName) )
{
/*
If we are starsymbol then in ww7- mode we will always convert to a
diff --git a/unotools/source/misc/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx
index 93d7f99..2b44624 100644
--- a/unotools/source/misc/fontcvt.cxx
+++ b/unotools/source/misc/fontcvt.cxx
@@ -1354,7 +1354,7 @@
if (!cRetVal && mpSubsFontName)
{
- if (!strcmp(mpSubsFontName, "OpenSymbol") || (!strcmp(mpSubsFontName,
"StarSymbol")))
+ if ( IsStarSymbol( OUString::createFromAscii(mpSubsFontName) ) )
{
cRetVal = 0xE12C;
SAL_WARN( "unotools.misc", "Forcing a bullet substition from 0x" <<
diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx
index 0932c17..b81a5b3 100644
--- a/unotools/source/misc/fontdefs.cxx
+++ b/unotools/source/misc/fontdefs.cxx
@@ -597,4 +597,12 @@
return nHash;
}
+bool IsStarSymbol(const OUString &rFontName)
+{
+ sal_Int32 nIndex = 0;
+ OUString sFamilyNm(GetNextFontToken(rFontName, nIndex));
+ return (sFamilyNm.equalsIgnoreAsciiCase("starsymbol") ||
+ sFamilyNm.equalsIgnoreAsciiCase("opensymbol"));
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/generic/fontmanager/fontsubst.cxx b/vcl/generic/fontmanager/fontsubst.cxx
index 900125b..22b3d83 100644
--- a/vcl/generic/fontmanager/fontsubst.cxx
+++ b/vcl/generic/fontmanager/fontsubst.cxx
@@ -32,6 +32,7 @@
#include "salprn.hxx"
#include "region.h"
+#include <unotools/fontdefs.hxx>
#include <list>
// ===========================================================================
@@ -160,8 +161,7 @@
if( rFontSelData.IsSymbolFont() )
return false;
// StarSymbol is a unicode font, but it still deserves the symbol flag
- if(rFontSelData.maSearchName.startsWithIgnoreAsciiCase( "starsymbol" )
- || rFontSelData.maSearchName.startsWithIgnoreAsciiCase( "opensymbol" ) )
+ if ( IsStarSymbol(rFontSelData.maSearchName) )
return false;
//see fdo#41556 and fdo#47636
@@ -229,8 +229,7 @@
if( rFontSelData.IsSymbolFont() )
return false;
// StarSymbol is a unicode font, but it still deserves the symbol flag
- if(rFontSelData.maSearchName.startsWithIgnoreAsciiCase( "starsymbol" )
- || rFontSelData.maSearchName.startsWithIgnoreAsciiCase( "opensymbol" ) )
+ if ( IsStarSymbol(rFontSelData.maSearchName) )
return false;
const FontSelectPattern aOut = GetFcSubstitute( rFontSelData, rMissingCodes );
diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx
index 0dfab94..cdcfe4c 100644
--- a/vcl/generic/glyphs/gcach_ftyp.cxx
+++ b/vcl/generic/glyphs/gcach_ftyp.cxx
@@ -33,6 +33,7 @@
#include <graphite2/Font.h>
#include <graphite_layout.hxx>
#endif
+#include <unotools/fontdefs.hxx>
#include "tools/poly.hxx"
#include "basegfx/matrix/b2dhommatrix.hxx"
@@ -920,13 +921,8 @@
rTo.mnOrientation = GetFontSelData().mnOrientation;
//Always consider [star]symbol as symbol fonts
- if (
- (rTo.GetFamilyName().equalsIgnoreAsciiCase("OpenSymbol")) ||
- (rTo.GetFamilyName().equalsIgnoreAsciiCase("StarSymbol"))
- )
- {
+ if ( IsStarSymbol( rTo.GetFamilyName() ) )
rTo.SetSymbolFlag( true );
- }
if( maSizeFT )
pFTActivateSize( maSizeFT );
diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx
index 1b862ba..385c3fd 100644
--- a/vcl/source/filter/wmf/wmfwr.cxx
+++ b/vcl/source/filter/wmf/wmfwr.cxx
@@ -394,12 +394,6 @@
WriteRectangle(rRect);
}
-bool IsStarSymbol(const String &rStr)
-{
- return rStr.EqualsIgnoreCaseAscii("starsymbol") ||
- rStr.EqualsIgnoreCaseAscii("opensymbol");
-}
-
void WMFWriter::WMFRecord_Escape( sal_uInt32 nEsc, sal_uInt32 nLen, const sal_Int8* pData )
{
#ifdef OSL_BIGENDIAN
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index ef702cc..417c9d6 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -26,6 +26,7 @@
#include <vcl/metaact.hxx>
#include <vcl/graphictools.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <unotools/fontdefs.hxx>
// ========================================================================
@@ -3437,9 +3438,8 @@
// we change the textencoding to RTL_TEXTENCODING_UNICODE here, which seems
// to be the right way; changing the textencoding at other sources
// is too dangerous at the moment
- if( ( ( maFont.GetName().SearchAscii( "StarSymbol" ) != STRING_NOTFOUND )
- || ( maFont.GetName().SearchAscii( "OpenSymbol" ) != STRING_NOTFOUND ) )
- && ( maFont.GetCharSet() != RTL_TEXTENCODING_UNICODE ) )
+ if ( IsStarSymbol( maFont.GetName() )
+ && ( maFont.GetCharSet() != RTL_TEXTENCODING_UNICODE ) )
{
maFont.SetCharSet( RTL_TEXTENCODING_UNICODE );
}
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 3281557..359b82c 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -695,8 +695,7 @@
{
// StarSymbol is a unicode font, but it still deserves the symbol flag
if( !IsSymbolFont() )
- if( GetFamilyName().startsWithIgnoreAsciiCase( "starsymbol" )
- || GetFamilyName().startsWithIgnoreAsciiCase( "opensymbol" ) )
+ if ( IsStarSymbol( GetFamilyName() ) )
SetSymbolFlag( true );
}
--
To view, visit https://gerrit.libreoffice.org/4077
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7a2e3a6f11bbaaaff50e8163e4ce3e2583b1d03c
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Thomas Arnhold <thomas@arnhold.org>
Context
- [PATCH] Make use of IsStarSymbol() · Thomas Arnhold (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.