diff options
author | Noel Grandin <noel@peralex.com> | 2015-05-19 13:12:35 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-05-20 09:52:09 +0200 |
commit | 49e13aa41895e8562d83cff189ab6a78d5d902aa (patch) | |
tree | 4c20a5e23a8f24b055df17d7c1075d4996b34995 /vcl | |
parent | 456c379ffd8683cd8c22969268900787cf1ac28e (diff) |
convert FONT_SUBSTITUTE constants to scoped enum
Change-Id: I8312f0117f33349218a09ccdfea946c66ceb1b3e
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/outdev.h | 10 | ||||
-rw-r--r-- | vcl/source/outdev/font.cxx | 12 |
2 files changed, 12 insertions, 10 deletions
diff --git a/vcl/inc/outdev.h b/vcl/inc/outdev.h index eae0c597a03b..7d4479825667 100644 --- a/vcl/inc/outdev.h +++ b/vcl/inc/outdev.h @@ -36,6 +36,8 @@ class VirtualDevice; class ImplGetDevFontList; class GetDevSizeList; class PhysicalFontCollection; +enum class AddFontSubstituteFlags; + // an ImplGetDevFontList is created by an PhysicalFontCollection // it becomes invalid when original PhysicalFontCollection is modified class ImplGetDevFontList @@ -90,9 +92,9 @@ struct ImplFontSubstEntry OUString maReplaceName; OUString maSearchName; OUString maSearchReplaceName; - sal_uInt16 mnFlags; + AddFontSubstituteFlags mnFlags; - ImplFontSubstEntry( const OUString& rFontName, const OUString& rSubstFontName, sal_uInt16 nSubstFlags ); + ImplFontSubstEntry( const OUString& rFontName, const OUString& rSubstFontName, AddFontSubstituteFlags nSubstFlags ); }; class ImplDirectFontSubstitution @@ -102,13 +104,13 @@ private: typedef std::list<ImplFontSubstEntry> FontSubstList; FontSubstList maFontSubstList; public: - void AddFontSubstitute( const OUString& rFontName, const OUString& rSubstName, sal_uInt16 nFlags ); + void AddFontSubstitute( const OUString& rFontName, const OUString& rSubstName, AddFontSubstituteFlags nFlags ); void RemoveFontSubstitute( int nIndex ); int GetFontSubstituteCount() const { return maFontSubstList.size(); }; bool Empty() const { return maFontSubstList.empty(); } void Clear() { maFontSubstList.clear(); } - bool FindFontSubstitute( OUString& rSubstName, const OUString& rFontName, sal_uInt16 nFlags ) const; + bool FindFontSubstitute( OUString& rSubstName, const OUString& rFontName, AddFontSubstituteFlags nFlags ) const; }; // PreMatchFontSubstitution diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 94d312721674..05ff359e2d71 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -687,7 +687,7 @@ void OutputDevice::EndFontSubstitution() void OutputDevice::AddFontSubstitute( const OUString& rFontName, const OUString& rReplaceFontName, - sal_uInt16 nFlags ) + AddFontSubstituteFlags nFlags ) { ImplDirectFontSubstitution*& rpSubst = ImplGetSVData()->maGDIData.mpDirectFontSubst; if( !rpSubst ) @@ -697,13 +697,13 @@ void OutputDevice::AddFontSubstitute( const OUString& rFontName, } void ImplDirectFontSubstitution::AddFontSubstitute( const OUString& rFontName, - const OUString& rSubstFontName, sal_uInt16 nFlags ) + const OUString& rSubstFontName, AddFontSubstituteFlags nFlags ) { maFontSubstList.push_back( ImplFontSubstEntry( rFontName, rSubstFontName, nFlags ) ); } ImplFontSubstEntry::ImplFontSubstEntry( const OUString& rFontName, - const OUString& rSubstFontName, sal_uInt16 nSubstFlags ) + const OUString& rSubstFontName, AddFontSubstituteFlags nSubstFlags ) : maName( rFontName ) , maReplaceName( rSubstFontName ) , mnFlags( nSubstFlags ) @@ -737,14 +737,14 @@ sal_uInt16 OutputDevice::GetFontSubstituteCount() } bool ImplDirectFontSubstitution::FindFontSubstitute( OUString& rSubstName, - const OUString& rSearchName, sal_uInt16 nFlags ) const + const OUString& rSearchName, AddFontSubstituteFlags nFlags ) const { // TODO: get rid of O(N) searches FontSubstList::const_iterator it = maFontSubstList.begin(); for(; it != maFontSubstList.end(); ++it ) { const ImplFontSubstEntry& rEntry = *it; - if( ((rEntry.mnFlags & nFlags) || !nFlags) + if( ((rEntry.mnFlags & nFlags) || nFlags == AddFontSubstituteFlags::NONE) && (rEntry.maSearchName == rSearchName) ) { rSubstName = rEntry.maSearchReplaceName; @@ -764,7 +764,7 @@ void ImplFontSubstitute( OUString& rFontName ) // apply user-configurable font replacement (eg, from the list in Tools->Options) const ImplDirectFontSubstitution* pSubst = ImplGetSVData()->maGDIData.mpDirectFontSubst; - if( pSubst && pSubst->FindFontSubstitute( aSubstFontName, rFontName, FONT_SUBSTITUTE_ALWAYS ) ) + if( pSubst && pSubst->FindFontSubstitute( aSubstFontName, rFontName, AddFontSubstituteFlags::ALWAYS ) ) { rFontName = aSubstFontName; return; |