Kaydet (Commit) 6e3bbbdf authored tarafından Noel Grandin's avatar Noel Grandin

convert FONTLIST_FONTNAMETYPE constants to scoped enum

and move them inside the module, since they are not used anywhere else

Change-Id: I63a629c8a497f5fb832f5287c260df7eb15fed3a
üst cd23e6d3
...@@ -128,9 +128,6 @@ FontList. ...@@ -128,9 +128,6 @@ FontList.
#define FONTLIST_FONTINFO_NOTFOUND ((sal_uInt16)0xFFFF) #define FONTLIST_FONTINFO_NOTFOUND ((sal_uInt16)0xFFFF)
#define FONTLIST_FONTNAMETYPE_PRINTER ((sal_uInt16)0x0001)
#define FONTLIST_FONTNAMETYPE_SCREEN ((sal_uInt16)0x0002)
class SVT_DLLPUBLIC FontList class SVT_DLLPUBLIC FontList
{ {
private: private:
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <svtools/svtools.hrc> #include <svtools/svtools.hrc>
#include <svtools/svtresid.hxx> #include <svtools/svtresid.hxx>
#include <svtools/ctrltool.hxx> #include <svtools/ctrltool.hxx>
#include <o3tl/typed_flags_set.hxx>
// Standard Fontgroessen fuer scalierbare Fonts // Standard Fontgroessen fuer scalierbare Fonts
const sal_IntPtr FontList::aStdSizeAry[] = const sal_IntPtr FontList::aStdSizeAry[] =
...@@ -87,6 +88,17 @@ public: ...@@ -87,6 +88,17 @@ public:
OutputDevice* GetDevice() const { return mpDevice; } OutputDevice* GetDevice() const { return mpDevice; }
}; };
enum class FontListFontNameType
{
NONE = 0x00,
PRINTER = 0x01,
SCREEN = 0x02,
};
namespace o3tl
{
template<> struct typed_flags<FontListFontNameType> : is_typed_flags<FontListFontNameType, 0x3> {};
}
class ImplFontListNameInfo class ImplFontListNameInfo
{ {
friend class FontList; friend class FontList;
...@@ -94,12 +106,12 @@ class ImplFontListNameInfo ...@@ -94,12 +106,12 @@ class ImplFontListNameInfo
private: private:
OUString maSearchName; OUString maSearchName;
ImplFontListFontInfo* mpFirst; ImplFontListFontInfo* mpFirst;
sal_uInt16 mnType; FontListFontNameType mnType;
ImplFontListNameInfo(const OUString& rSearchName) ImplFontListNameInfo(const OUString& rSearchName)
: maSearchName(rSearchName) : maSearchName(rSearchName)
, mpFirst(NULL) , mpFirst(NULL)
, mnType(0) , mnType(FontListFontNameType::NONE)
{ {
} }
}; };
...@@ -231,11 +243,11 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, bool bAll, ...@@ -231,11 +243,11 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, bool bAll,
{ {
rtl_TextEncoding eSystemEncoding = osl_getThreadTextEncoding(); rtl_TextEncoding eSystemEncoding = osl_getThreadTextEncoding();
sal_uInt16 nType; FontListFontNameType nType;
if ( pDevice->GetOutDevType() != OUTDEV_PRINTER ) if ( pDevice->GetOutDevType() != OUTDEV_PRINTER )
nType = FONTLIST_FONTNAMETYPE_SCREEN; nType = FontListFontNameType::SCREEN;
else else
nType = FONTLIST_FONTNAMETYPE_PRINTER; nType = FontListFontNameType::PRINTER;
// inquire all fonts from the device // inquire all fonts from the device
int n = pDevice->GetDevFontCount(); int n = pDevice->GetDevFontCount();
...@@ -487,8 +499,8 @@ OUString FontList::GetFontMapText( const vcl::FontInfo& rInfo ) const ...@@ -487,8 +499,8 @@ OUString FontList::GetFontMapText( const vcl::FontInfo& rInfo ) const
} }
// search for synthetic style // search for synthetic style
sal_uInt16 nType = pData->mnType; FontListFontNameType nType = pData->mnType;
const OUString& rStyleName = rInfo.GetStyleName(); const OUString& rStyleName = rInfo.GetStyleName();
if (!rStyleName.isEmpty()) if (!rStyleName.isEmpty())
{ {
bool bNotSynthetic = false; bool bNotSynthetic = false;
...@@ -516,14 +528,14 @@ OUString FontList::GetFontMapText( const vcl::FontInfo& rInfo ) const ...@@ -516,14 +528,14 @@ OUString FontList::GetFontMapText( const vcl::FontInfo& rInfo ) const
} }
// Only Printer-Font? // Only Printer-Font?
if ( (nType & (FONTLIST_FONTNAMETYPE_PRINTER | FONTLIST_FONTNAMETYPE_SCREEN)) == FONTLIST_FONTNAMETYPE_PRINTER ) if ( nType == FontListFontNameType::PRINTER )
{ {
if (maMapPrinterOnly.isEmpty()) if (maMapPrinterOnly.isEmpty())
const_cast<FontList*>(this)->maMapPrinterOnly = SVT_RESSTR(STR_SVT_FONTMAP_PRINTERONLY); const_cast<FontList*>(this)->maMapPrinterOnly = SVT_RESSTR(STR_SVT_FONTMAP_PRINTERONLY);
return maMapPrinterOnly; return maMapPrinterOnly;
} }
// Only Screen-Font? // Only Screen-Font?
else if ( (nType & (FONTLIST_FONTNAMETYPE_PRINTER | FONTLIST_FONTNAMETYPE_SCREEN)) == FONTLIST_FONTNAMETYPE_SCREEN else if ( nType == FontListFontNameType::SCREEN
&& rInfo.GetType() == TYPE_RASTER ) && rInfo.GetType() == TYPE_RASTER )
{ {
if (maMapScreenOnly.isEmpty()) if (maMapScreenOnly.isEmpty())
......
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