diff options
author | Noel Grandin <noel@peralex.com> | 2015-05-04 15:34:50 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-05-06 09:01:28 +0200 |
commit | 9b37c2176e4da7575398c15921e3466208f19847 (patch) | |
tree | fa2d103b3829c5a128a9058632c8c9224ca7abd7 | |
parent | 78706545a6df37ccc57c21190f51e9081180ac70 (diff) |
convert SUBSFONT_ to scoped enum
Change-Id: Ic66191ac4cdfa753dc784e7bd1a6dd20f50def6b
-rw-r--r-- | include/unotools/fontdefs.hxx | 18 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/excel/xltools.cxx | 2 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-text.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/writerwordglue.cxx | 2 | ||||
-rw-r--r-- | unotools/source/misc/fontdefs.cxx | 12 |
6 files changed, 24 insertions, 16 deletions
diff --git a/include/unotools/fontdefs.hxx b/include/unotools/fontdefs.hxx index e0601063ac4b..763f7bf995af 100644 --- a/include/unotools/fontdefs.hxx +++ b/include/unotools/fontdefs.hxx @@ -24,6 +24,7 @@ #include <tools/solar.h> #include <rtl/ustring.hxx> #include <rtl/ustrbuf.hxx> +#include <o3tl/typed_flags_set.hxx> namespace utl { class FontSubstConfiguration; @@ -32,12 +33,19 @@ namespace utl { // - SubsFontName - -#define SUBSFONT_ONLYONE ((sal_uLong)0x00000001) -#define SUBSFONT_MS ((sal_uLong)0x00000002) -#define SUBSFONT_PS ((sal_uLong)0x00000004) -#define SUBSFONT_HTML ((sal_uLong)0x00000008) +enum class SubsFontFlags +{ + ONLYONE = 0x01, + MS = 0x02, + PS = 0x04, + HTML = 0x08, +}; +namespace o3tl +{ + template<> struct typed_flags<SubsFontFlags> : is_typed_flags<SubsFontFlags, 0x0f> {}; +} -UNOTOOLS_DLLPUBLIC OUString GetSubsFontName( const OUString& rName, sal_uLong nFlags ); +UNOTOOLS_DLLPUBLIC OUString GetSubsFontName( const OUString& rName, SubsFontFlags nFlags ); UNOTOOLS_DLLPUBLIC void AddTokenFontName( OUString& rName, const OUString& rNewToken ); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 484c90b51519..da55e0f9f0e3 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1368,7 +1368,7 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, bool bIsFiel OUString usTypeface; mAny >>= usTypeface; - OUString aSubstName( GetSubsFontName( usTypeface, SUBSFONT_ONLYONE | SUBSFONT_MS ) ); + OUString aSubstName( GetSubsFontName( usTypeface, SubsFontFlags::ONLYONE | SubsFontFlags::MS ) ); mpFS->singleElementNS( XML_a, XML_latin, XML_typeface, USS(aSubstName.getLength() ? aSubstName : usTypeface), @@ -1384,7 +1384,7 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, bool bIsFiel OUString usTypeface; mAny >>= usTypeface; - OUString aSubstName( GetSubsFontName( usTypeface, SUBSFONT_ONLYONE | SUBSFONT_MS ) ); + OUString aSubstName( GetSubsFontName( usTypeface, SubsFontFlags::ONLYONE | SubsFontFlags::MS ) ); mpFS->singleElementNS( XML_a, bComplex ? XML_cs : XML_ea, XML_typeface, USS(aSubstName.getLength() ? aSubstName : usTypeface), diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx index b2bcc251d97e..4dde77c93c87 100644 --- a/sc/source/filter/excel/xltools.cxx +++ b/sc/source/filter/excel/xltools.cxx @@ -444,7 +444,7 @@ sal_uInt16 XclTools::GetXclCodePage( rtl_TextEncoding eTextEnc ) OUString XclTools::GetXclFontName( const OUString& rFontName ) { // substitute with MS fonts - OUString aNewName = GetSubsFontName(rFontName, SUBSFONT_ONLYONE | SUBSFONT_MS); + OUString aNewName = GetSubsFontName(rFontName, SubsFontFlags::ONLYONE | SubsFontFlags::MS); return aNewName.isEmpty() ? rFontName : aNewName; } diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx index bcf2a3772391..cfbf7a6f61e3 100644 --- a/sd/source/filter/eppt/pptx-text.cxx +++ b/sd/source/filter/eppt/pptx-text.cxx @@ -1381,7 +1381,7 @@ FontCollectionEntry::~FontCollectionEntry() void FontCollectionEntry::ImplInit( const OUString& rName ) { - OUString aSubstName( GetSubsFontName( rName, SUBSFONT_ONLYONE | SUBSFONT_MS ) ); + OUString aSubstName( GetSubsFontName( rName, SubsFontFlags::ONLYONE | SubsFontFlags::MS ) ); if ( !aSubstName.isEmpty() ) { Name = aSubstName; diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index 9778834013e2..876e2d90ddfb 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -317,7 +317,7 @@ namespace myImplHelpers { if (IsStarSymbol(rFont)) return OUString("Arial Unicode MS"); - return GetSubsFontName(rFont, SUBSFONT_ONLYONE | SUBSFONT_MS); + return GetSubsFontName(rFont, SubsFontFlags::ONLYONE | SubsFontFlags::MS); } //Utility to remove entries before a given starting position diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx index 9d3e2c7ec375..81b402b8f619 100644 --- a/unotools/source/misc/fontdefs.cxx +++ b/unotools/source/misc/fontdefs.cxx @@ -512,7 +512,7 @@ void AddTokenFontName( OUString& rName, const OUString& rNewToken ) ImplAppendFontToken( rName, rNewToken ); } -OUString GetSubsFontName( const OUString& rName, sal_uLong nFlags ) +OUString GetSubsFontName( const OUString& rName, SubsFontFlags nFlags ) { OUString aName; @@ -521,7 +521,7 @@ OUString GetSubsFontName( const OUString& rName, sal_uLong nFlags ) GetNextFontToken( rName, nIndex ) ); // #93662# do not try to replace StarSymbol with MS only font - if( nFlags == (SUBSFONT_MS|SUBSFONT_ONLYONE) + if( nFlags == (SubsFontFlags::MS|SubsFontFlags::ONLYONE) && ( aOrgName == "starsymbol" || aOrgName == "opensymbol" ) ) return aName; @@ -535,15 +535,15 @@ OUString GetSubsFontName( const OUString& rName, sal_uLong nFlags ) switch( i ) { case 0: - if( nFlags & SUBSFONT_MS && pAttr->MSSubstitutions.size() ) + if( nFlags & SubsFontFlags::MS && pAttr->MSSubstitutions.size() ) pVector = &pAttr->MSSubstitutions; break; case 1: - if( nFlags & SUBSFONT_PS && pAttr->PSSubstitutions.size() ) + if( nFlags & SubsFontFlags::PS && pAttr->PSSubstitutions.size() ) pVector = &pAttr->PSSubstitutions; break; case 2: - if( nFlags & SUBSFONT_HTML && pAttr->HTMLSubstitutions.size() ) + if( nFlags & SubsFontFlags::HTML && pAttr->HTMLSubstitutions.size() ) pVector = &pAttr->HTMLSubstitutions; break; } @@ -553,7 +553,7 @@ OUString GetSubsFontName( const OUString& rName, sal_uLong nFlags ) if( ! ImplIsFontToken( rName, *it ) ) { ImplAppendFontToken( aName, *it ); - if( nFlags & SUBSFONT_ONLYONE ) + if( nFlags & SubsFontFlags::ONLYONE ) { i = 4; break; |