summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-12-17 12:29:03 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-12-17 12:33:20 +0000
commit268352b13d54ac4195246f6fc75a9f490b8a4dea (patch)
treee6de7949a96efb7896b5add07938785cfef13188 /svtools
parentd684056f9a7e75fa73439277bdda16aec2da0e46 (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 (cherry picked from commit b53a329a7fef6262e437f8de0a771633a731704b)
Diffstat (limited to 'svtools')
-rw-r--r--svtools/inc/svtools/ctrltool.hxx11
-rw-r--r--svtools/source/control/ctrltool.cxx97
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,