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 @@
#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 );
......
......@@ -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),
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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
......
......@@ -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;
......
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