Kaydet (Commit) 9b37c217 authored tarafından Noel Grandin's avatar Noel Grandin

convert SUBSFONT_ to scoped enum

Change-Id: Ic66191ac4cdfa753dc784e7bd1a6dd20f50def6b
üst 78706545
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <tools/solar.h> #include <tools/solar.h>
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
#include <o3tl/typed_flags_set.hxx>
namespace utl { namespace utl {
class FontSubstConfiguration; class FontSubstConfiguration;
...@@ -32,12 +33,19 @@ namespace utl { ...@@ -32,12 +33,19 @@ namespace utl {
// - SubsFontName - // - SubsFontName -
#define SUBSFONT_ONLYONE ((sal_uLong)0x00000001) enum class SubsFontFlags
#define SUBSFONT_MS ((sal_uLong)0x00000002) {
#define SUBSFONT_PS ((sal_uLong)0x00000004) ONLYONE = 0x01,
#define SUBSFONT_HTML ((sal_uLong)0x00000008) 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 ); UNOTOOLS_DLLPUBLIC void AddTokenFontName( OUString& rName, const OUString& rNewToken );
......
...@@ -1368,7 +1368,7 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, bool bIsFiel ...@@ -1368,7 +1368,7 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, bool bIsFiel
OUString usTypeface; OUString usTypeface;
mAny >>= 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, mpFS->singleElementNS( XML_a, XML_latin,
XML_typeface, USS(aSubstName.getLength() ? aSubstName : usTypeface), XML_typeface, USS(aSubstName.getLength() ? aSubstName : usTypeface),
...@@ -1384,7 +1384,7 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, bool bIsFiel ...@@ -1384,7 +1384,7 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, bool bIsFiel
OUString usTypeface; OUString usTypeface;
mAny >>= 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, mpFS->singleElementNS( XML_a, bComplex ? XML_cs : XML_ea,
XML_typeface, USS(aSubstName.getLength() ? aSubstName : usTypeface), XML_typeface, USS(aSubstName.getLength() ? aSubstName : usTypeface),
......
...@@ -444,7 +444,7 @@ sal_uInt16 XclTools::GetXclCodePage( rtl_TextEncoding eTextEnc ) ...@@ -444,7 +444,7 @@ sal_uInt16 XclTools::GetXclCodePage( rtl_TextEncoding eTextEnc )
OUString XclTools::GetXclFontName( const OUString& rFontName ) OUString XclTools::GetXclFontName( const OUString& rFontName )
{ {
// substitute with MS fonts // 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; return aNewName.isEmpty() ? rFontName : aNewName;
} }
......
...@@ -1381,7 +1381,7 @@ FontCollectionEntry::~FontCollectionEntry() ...@@ -1381,7 +1381,7 @@ FontCollectionEntry::~FontCollectionEntry()
void FontCollectionEntry::ImplInit( const OUString& rName ) 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() ) if ( !aSubstName.isEmpty() )
{ {
Name = aSubstName; Name = aSubstName;
......
...@@ -317,7 +317,7 @@ namespace myImplHelpers ...@@ -317,7 +317,7 @@ namespace myImplHelpers
{ {
if (IsStarSymbol(rFont)) if (IsStarSymbol(rFont))
return OUString("Arial Unicode MS"); 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 //Utility to remove entries before a given starting position
......
...@@ -512,7 +512,7 @@ void AddTokenFontName( OUString& rName, const OUString& rNewToken ) ...@@ -512,7 +512,7 @@ void AddTokenFontName( OUString& rName, const OUString& rNewToken )
ImplAppendFontToken( rName, rNewToken ); ImplAppendFontToken( rName, rNewToken );
} }
OUString GetSubsFontName( const OUString& rName, sal_uLong nFlags ) OUString GetSubsFontName( const OUString& rName, SubsFontFlags nFlags )
{ {
OUString aName; OUString aName;
...@@ -521,7 +521,7 @@ OUString GetSubsFontName( const OUString& rName, sal_uLong nFlags ) ...@@ -521,7 +521,7 @@ OUString GetSubsFontName( const OUString& rName, sal_uLong nFlags )
GetNextFontToken( rName, nIndex ) ); GetNextFontToken( rName, nIndex ) );
// #93662# do not try to replace StarSymbol with MS only font // #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 == "starsymbol"
|| aOrgName == "opensymbol" ) ) || aOrgName == "opensymbol" ) )
return aName; return aName;
...@@ -535,15 +535,15 @@ OUString GetSubsFontName( const OUString& rName, sal_uLong nFlags ) ...@@ -535,15 +535,15 @@ OUString GetSubsFontName( const OUString& rName, sal_uLong nFlags )
switch( i ) switch( i )
{ {
case 0: case 0:
if( nFlags & SUBSFONT_MS && pAttr->MSSubstitutions.size() ) if( nFlags & SubsFontFlags::MS && pAttr->MSSubstitutions.size() )
pVector = &pAttr->MSSubstitutions; pVector = &pAttr->MSSubstitutions;
break; break;
case 1: case 1:
if( nFlags & SUBSFONT_PS && pAttr->PSSubstitutions.size() ) if( nFlags & SubsFontFlags::PS && pAttr->PSSubstitutions.size() )
pVector = &pAttr->PSSubstitutions; pVector = &pAttr->PSSubstitutions;
break; break;
case 2: case 2:
if( nFlags & SUBSFONT_HTML && pAttr->HTMLSubstitutions.size() ) if( nFlags & SubsFontFlags::HTML && pAttr->HTMLSubstitutions.size() )
pVector = &pAttr->HTMLSubstitutions; pVector = &pAttr->HTMLSubstitutions;
break; break;
} }
...@@ -553,7 +553,7 @@ OUString GetSubsFontName( const OUString& rName, sal_uLong nFlags ) ...@@ -553,7 +553,7 @@ OUString GetSubsFontName( const OUString& rName, sal_uLong nFlags )
if( ! ImplIsFontToken( rName, *it ) ) if( ! ImplIsFontToken( rName, *it ) )
{ {
ImplAppendFontToken( aName, *it ); ImplAppendFontToken( aName, *it );
if( nFlags & SUBSFONT_ONLYONE ) if( nFlags & SubsFontFlags::ONLYONE )
{ {
i = 4; i = 4;
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment