diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-12-17 12:29:03 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-12-17 12:29:11 +0000 |
commit | b53a329a7fef6262e437f8de0a771633a731704b (patch) | |
tree | 663855fa51d15c98a4b0c7a02792a69d1af1969a /svtools | |
parent | 151cc93f7363d2dd939be790fad7a5a32748eb30 (diff) |
Resolves: fdo#58373 restore label for font is printer/both or unavailable
I removed it because it only refers to the Western font and not the
two other categories. But apparently there's demand for it, so
better to restore it as misleading as it is for non-Western
Change-Id: I84c0cf858c16a9cadcba8d0c3993f0b0b7ad5a45
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/inc/svtools/ctrltool.hxx | 11 | ||||
-rw-r--r-- | svtools/source/control/ctrltool.cxx | 97 |
2 files changed, 104 insertions, 4 deletions
diff --git a/svtools/inc/svtools/ctrltool.hxx b/svtools/inc/svtools/ctrltool.hxx index 33cd1e99bb9a..b90f1b67a532 100644 --- a/svtools/inc/svtools/ctrltool.hxx +++ b/svtools/inc/svtools/ctrltool.hxx @@ -83,6 +83,13 @@ Name generiert, der dem Anwender praesentiert werden kann. -------------------------------------------------------------------------- +XubString FontList::GetFontMapText( const FontInfo& rInfo ) const; + +Diese Methode gibt einen Matchstring zurueck, der dem Anwender +anzeigen soll, welche Probleme es mit diesem Font geben kann. + +-------------------------------------------------------------------------- + FontInfo FontList::Get( const String& rName, const String& rStyleName ) const; Diese Methode sucht aus dem uebergebenen Namen und dem uebergebenen StyleName @@ -131,6 +138,9 @@ von der FontList, sollte deshalb das Array nicht mehr referenziert werden. #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 { private: @@ -169,6 +179,7 @@ public: OutputDevice* GetDevice() const { return mpDev; } OutputDevice* GetDevice2() const { return mpDev2; } + XubString GetFontMapText( const FontInfo& rInfo ) const; const OUString& GetNormalStr() const { return maNormal; } const OUString& GetItalicStr() const { return maNormalItalic; } diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx index 5861b23d05da..b73fa334cf25 100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -105,12 +105,15 @@ class ImplFontListNameInfo friend class FontList; private: - XubString maSearchName; + OUString maSearchName; ImplFontListFontInfo* mpFirst; + sal_uInt16 mnType; - ImplFontListNameInfo( const XubString& rSearchName ) : - maSearchName( rSearchName ) - {} + ImplFontListNameInfo(const OUString& rSearchName) + : maSearchName( rSearchName ) + , mnType(0) + { + } }; //sort normal to the start @@ -252,6 +255,12 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, sal_Bool bAll, { rtl_TextEncoding eSystemEncoding = osl_getThreadTextEncoding(); + sal_uInt16 nType; + if ( pDevice->GetOutDevType() != OUTDEV_PRINTER ) + nType = FONTLIST_FONTNAMETYPE_SCREEN; + else + nType = FONTLIST_FONTNAMETYPE_PRINTER; + // Alle Fonts vom Device abfragen int n = pDevice->GetDevFontCount(); sal_uInt16 i; @@ -330,6 +339,9 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, sal_Bool bAll, } } } + + if ( pData ) + pData->mnType |= nType; } } @@ -493,6 +505,83 @@ OUString FontList::GetStyleName(const FontInfo& rInfo) const return aStyleName; } +// ----------------------------------------------------------------------- + +XubString FontList::GetFontMapText( const FontInfo& rInfo ) const +{ + if ( !rInfo.GetName().Len() ) + { + XubString aEmptryStr; + return aEmptryStr; + } + + // Search Fontname + ImplFontListNameInfo* pData = ImplFindByName( rInfo.GetName() ); + if ( !pData ) + { + if (maMapNotAvailable.isEmpty()) + ((FontList*)this)->maMapNotAvailable = SVT_RESSTR(STR_SVT_FONTMAP_NOTAVAILABLE); + return maMapNotAvailable; + } + + // search for synthetic style + sal_uInt16 nType = pData->mnType; + const XubString& rStyleName = rInfo.GetStyleName(); + if ( rStyleName.Len() ) + { + sal_Bool bNotSynthetic = sal_False; + sal_Bool bNoneAvailable = sal_False; + FontWeight eWeight = rInfo.GetWeight(); + FontItalic eItalic = rInfo.GetItalic(); + ImplFontListFontInfo* pFontInfo = pData->mpFirst; + while ( pFontInfo ) + { + if ( (eWeight == pFontInfo->GetWeight()) && + (eItalic == pFontInfo->GetItalic()) ) + { + bNotSynthetic = sal_True; + break; + } + + pFontInfo = pFontInfo->mpNext; + } + + if ( bNoneAvailable ) + { + XubString aEmptryStr; + return aEmptryStr; + } + else if ( !bNotSynthetic ) + { + if (maMapStyleNotAvailable.isEmpty()) + ((FontList*)this)->maMapStyleNotAvailable = SVT_RESSTR(STR_SVT_FONTMAP_STYLENOTAVAILABLE); + return maMapStyleNotAvailable; + } + } + + // Only Printer-Font? + if ( (nType & (FONTLIST_FONTNAMETYPE_PRINTER | FONTLIST_FONTNAMETYPE_SCREEN)) == FONTLIST_FONTNAMETYPE_PRINTER ) + { + if (maMapPrinterOnly.isEmpty()) + ((FontList*)this)->maMapPrinterOnly = SVT_RESSTR(STR_SVT_FONTMAP_PRINTERONLY); + return maMapPrinterOnly; + } + // Only Screen-Font? + else if ( (nType & (FONTLIST_FONTNAMETYPE_PRINTER | FONTLIST_FONTNAMETYPE_SCREEN)) == FONTLIST_FONTNAMETYPE_SCREEN + && rInfo.GetType() == TYPE_RASTER ) + { + if (maMapScreenOnly.isEmpty()) + ((FontList*)this)->maMapScreenOnly = SVT_RESSTR(STR_SVT_FONTMAP_SCREENONLY); + return maMapScreenOnly; + } + else + { + if (maMapBoth.isEmpty()) + ((FontList*)this)->maMapBoth = SVT_RESSTR(STR_SVT_FONTMAP_BOTH); + return maMapBoth; + } +} + namespace { FontInfo makeMissing(ImplFontListFontInfo* pFontNameInfo, const rtl::OUString &rName, |