diff options
author | Noel Grandin <noel@peralex.com> | 2015-05-04 14:57:27 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-05-06 09:01:27 +0200 |
commit | 78706545a6df37ccc57c21190f51e9081180ac70 (patch) | |
tree | 15c0618a2310ac9154891c360d3282152e19a7ff | |
parent | 60e659ae355d073b05b3b9c8d2ac3bdc5f76020d (diff) |
convert FONTTOSUBSFONT constants to scoped enum
Change-Id: I994bfc76d709d01406404991dbfbd49b15bd03f4
-rw-r--r-- | editeng/source/editeng/editobj.cxx | 8 | ||||
-rw-r--r-- | editeng/source/items/numitem.cxx | 2 | ||||
-rw-r--r-- | include/unotools/fontcvt.hxx | 17 | ||||
-rw-r--r-- | unotools/source/misc/fontcvt.cxx | 19 | ||||
-rw-r--r-- | xmloff/source/core/xmlimp.cxx | 4 |
5 files changed, 32 insertions, 18 deletions
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index d5ccaa67ebbd..c4f3afca1338 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -1160,7 +1160,7 @@ void EditTextObjectImpl::StoreData( SvStream& rOStream ) const } // Convert StarSymbol back to StarBats - FontToSubsFontConverter hConv = CreateFontToSubsFontConverter( rFontItem.GetFamilyName(), FONTTOSUBSFONT_EXPORT | FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ); + FontToSubsFontConverter hConv = CreateFontToSubsFontConverter( rFontItem.GetFamilyName(), FontToSubsFontFlags::EXPORT | FontToSubsFontFlags::ONLYOLDSOSYMBOLFONTS ); if ( hConv ) { // Don't create a new Attrib with StarBats font, MBR changed the @@ -1184,7 +1184,7 @@ void EditTextObjectImpl::StoreData( SvStream& rOStream ) const FontToSubsFontConverter hConv = NULL; if (rC.GetParaAttribs().GetItemState( EE_CHAR_FONTINFO ) == SfxItemState::SET) { - hConv = CreateFontToSubsFontConverter( static_cast<const SvxFontItem&>(rC.GetParaAttribs().Get( EE_CHAR_FONTINFO )).GetFamilyName(), FONTTOSUBSFONT_EXPORT | FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ); + hConv = CreateFontToSubsFontConverter( static_cast<const SvxFontItem&>(rC.GetParaAttribs().Get( EE_CHAR_FONTINFO )).GetFamilyName(), FontToSubsFontFlags::EXPORT | FontToSubsFontFlags::ONLYOLDSOSYMBOLFONTS ); } if ( hConv ) { @@ -1411,7 +1411,7 @@ void EditTextObjectImpl::CreateData( SvStream& rIStream ) } // Convert StarMath and StarBats to StarSymbol - FontToSubsFontConverter hConv = CreateFontToSubsFontConverter( rFontItem.GetFamilyName(), FONTTOSUBSFONT_IMPORT | FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ); + FontToSubsFontConverter hConv = CreateFontToSubsFontConverter( rFontItem.GetFamilyName(), FontToSubsFontFlags::IMPORT | FontToSubsFontFlags::ONLYOLDSOSYMBOLFONTS ); if ( hConv ) { SvxFontItem aNewFontItem( rFontItem ); @@ -1444,7 +1444,7 @@ void EditTextObjectImpl::CreateData( SvStream& rIStream ) if ( pC->GetParaAttribs().GetItemState( EE_CHAR_FONTINFO ) == SfxItemState::SET ) { const SvxFontItem& rFontItem = static_cast<const SvxFontItem&>(pC->GetParaAttribs().Get( EE_CHAR_FONTINFO )); - FontToSubsFontConverter hConv = CreateFontToSubsFontConverter( rFontItem.GetFamilyName(), FONTTOSUBSFONT_IMPORT | FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ); + FontToSubsFontConverter hConv = CreateFontToSubsFontConverter( rFontItem.GetFamilyName(), FontToSubsFontFlags::IMPORT | FontToSubsFontFlags::ONLYOLDSOSYMBOLFONTS ); if ( hConv ) { SvxFontItem aNewFontItem( rFontItem ); diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index 13073d5d74b9..2bf5ba832b70 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -697,7 +697,7 @@ SvStream& SvxNumRule::Store( SvStream &rStream ) if(!pConverter) pConverter = CreateFontToSubsFontConverter(aFmts[i]->GetBulletFont()->GetName(), - FONTTOSUBSFONT_EXPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS); + FontToSubsFontFlags::EXPORT|FontToSubsFontFlags::ONLYOLDSOSYMBOLFONTS); } aFmts[i]->Store(rStream, pConverter); } diff --git a/include/unotools/fontcvt.hxx b/include/unotools/fontcvt.hxx index 5b8c0c9167cb..6e51a9a6b554 100644 --- a/include/unotools/fontcvt.hxx +++ b/include/unotools/fontcvt.hxx @@ -23,15 +23,23 @@ #include <unotools/unotoolsdllapi.h> #include <rtl/ustring.hxx> #include <tools/solar.h> +#include <o3tl/typed_flags_set.hxx> // - FontToSubsFont - -#define FONTTOSUBSFONT_IMPORT ((sal_uLong)0x00000001) -#define FONTTOSUBSFONT_EXPORT ((sal_uLong)0x00000002) -#define FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ((sal_uLong)0x00000004) +enum class FontToSubsFontFlags +{ + IMPORT = 0x01, + EXPORT = 0x02, + ONLYOLDSOSYMBOLFONTS = 0x04, +}; +namespace o3tl +{ + template<> struct typed_flags<FontToSubsFontFlags> : is_typed_flags<FontToSubsFontFlags, 0x07> {}; +} typedef void* FontToSubsFontConverter; -UNOTOOLS_DLLPUBLIC FontToSubsFontConverter CreateFontToSubsFontConverter( const OUString& rFontName, sal_uLong nFlags ); +UNOTOOLS_DLLPUBLIC FontToSubsFontConverter CreateFontToSubsFontConverter( const OUString& rFontName, FontToSubsFontFlags nFlags ); UNOTOOLS_DLLPUBLIC void DestroyFontToSubsFontConverter( FontToSubsFontConverter hConverter ); UNOTOOLS_DLLPUBLIC sal_Unicode ConvertFontToSubsFontChar( FontToSubsFontConverter hConverter, sal_Unicode c ); UNOTOOLS_DLLPUBLIC OUString GetFontToSubsFontName( FontToSubsFontConverter hConverter ); @@ -65,6 +73,7 @@ public: //The users of this might want to make a distinction between failed characters //which were inside and those outside the unicode private area. UNOTOOLS_DLLPUBLIC StarSymbolToMSMultiFont *CreateStarSymbolToMSMultiFont(bool bPerfectOnly=false); + #endif // INCLUDED_UNOTOOLS_FONTCVT_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/misc/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx index e1db618d65c0..a154e0529a08 100644 --- a/unotools/source/misc/fontcvt.cxx +++ b/unotools/source/misc/fontcvt.cxx @@ -1455,29 +1455,34 @@ const ConvertChar* ConvertChar::GetRecodeData( const OUString& rOrgFontName, con return pCvt; } -FontToSubsFontConverter CreateFontToSubsFontConverter( const OUString& rOrgName, sal_uLong nFlags ) +FontToSubsFontConverter CreateFontToSubsFontConverter( const OUString& rOrgName, FontToSubsFontFlags nFlags ) { const ConvertChar* pCvt = NULL; OUString aName = GetEnglishSearchFontName( rOrgName ); - if ( nFlags & FONTTOSUBSFONT_IMPORT ) + if ( nFlags & FontToSubsFontFlags::IMPORT ) { int nEntries = SAL_N_ELEMENTS(aStarSymbolRecodeTable); - if ( nFlags & FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ) // only StarMath+StarBats + if ( nFlags & FontToSubsFontFlags::ONLYOLDSOSYMBOLFONTS ) // only StarMath+StarBats nEntries = 2; for( int i = 0; i < nEntries; ++i ) { const RecodeTable& r = aStarSymbolRecodeTable[i]; if( aName.equalsAscii( r.pOrgName ) ) - { pCvt = &r.aCvt; break; } + { + pCvt = &r.aCvt; + break; + } } } else { - // TODO: FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS - if( aName == "starsymbol" ) pCvt = &aImplStarSymbolCvt; - else if( aName == "opensymbol" ) pCvt = &aImplStarSymbolCvt; + // TODO: FontToSubsFontFlags::ONLYOLDSOSYMBOLFONTS + if( aName == "starsymbol" ) + pCvt = &aImplStarSymbolCvt; + else if( aName == "opensymbol" ) + pCvt = &aImplStarSymbolCvt; } return (FontToSubsFontConverter)pCvt; diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 9ac5a7a327e0..339e5ddb4b34 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -1739,7 +1739,7 @@ sal_Unicode SvXMLImport::ConvStarBatsCharToStarSymbol( sal_Unicode c ) { OUString sStarBats( "StarBats" ); mpImpl->hBatsFontConv = CreateFontToSubsFontConverter( sStarBats, - FONTTOSUBSFONT_IMPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ); + FontToSubsFontFlags::IMPORT|FontToSubsFontFlags::ONLYOLDSOSYMBOLFONTS ); SAL_WARN_IF( !mpImpl->hBatsFontConv, "xmloff.core", "Got no symbol font converter" ); } if( mpImpl->hBatsFontConv ) @@ -1757,7 +1757,7 @@ sal_Unicode SvXMLImport::ConvStarMathCharToStarSymbol( sal_Unicode c ) { OUString sStarMath( "StarMath" ); mpImpl->hMathFontConv = CreateFontToSubsFontConverter( sStarMath, - FONTTOSUBSFONT_IMPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ); + FontToSubsFontFlags::IMPORT|FontToSubsFontFlags::ONLYOLDSOSYMBOLFONTS ); SAL_WARN_IF( !mpImpl->hMathFontConv, "xmloff.core", "Got no symbol font converter" ); } if( mpImpl->hMathFontConv ) |