summaryrefslogtreecommitdiff
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
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)
-rw-r--r--cui/source/inc/chardlg.hxx1
-rw-r--r--cui/source/tabpages/chardlg.cxx9
-rw-r--r--cui/uiconfig/ui/charnamepage.ui15
-rw-r--r--svtools/inc/svtools/ctrltool.hxx11
-rw-r--r--svtools/source/control/ctrltool.cxx97
5 files changed, 127 insertions, 6 deletions
diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx
index c5b075db638e..587161d5efe4 100644
--- a/cui/source/inc/chardlg.hxx
+++ b/cui/source/inc/chardlg.hxx
@@ -48,6 +48,7 @@ class SvxCharBasePage : public SfxTabPage
{
protected:
SvxFontPrevWindow* m_pPreviewWin;
+ FixedText* m_pFontTypeFT;
sal_Bool m_bPreviewBackgroundToCharacter;
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 4beeaebc24dc..f412fd346f4b 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -365,6 +365,7 @@ SvxCharNamePage::SvxCharNamePage( Window* pParent, const SfxItemSet& rInSet )
m_pCTLFrame->Show(bShowCTL);
get(m_pPreviewWin, "preview");
+ get(m_pFontTypeFT, "fontinfo");
m_pWestFontLanguageLB->SetLanguageList(LANG_LIST_WESTERN, sal_True, sal_False, sal_True);
m_pEastFontLanguageLB->SetLanguageList(LANG_LIST_CJK, sal_True, sal_False, sal_True);
@@ -537,13 +538,15 @@ void SvxCharNamePage::UpdatePreview_Impl()
// Font
const FontList* pFontList = GetFontList();
- calcFontInfo(rFont,this,m_pWestFontNameLB,m_pWestFontStyleLB,m_pWestFontSizeLB,m_pWestFontLanguageLB,pFontList,GetWhich( SID_ATTR_CHAR_FONT ),GetWhich( SID_ATTR_CHAR_FONTHEIGHT ));
+ FontInfo aFontInfo =
+ calcFontInfo(rFont,this,m_pWestFontNameLB,m_pWestFontStyleLB,m_pWestFontSizeLB,m_pWestFontLanguageLB,pFontList,GetWhich( SID_ATTR_CHAR_FONT ),GetWhich( SID_ATTR_CHAR_FONTHEIGHT ));
calcFontInfo(rCJKFont,this,m_pEastFontNameLB,m_pEastFontStyleLB,m_pEastFontSizeLB,m_pEastFontLanguageLB,pFontList,GetWhich( SID_ATTR_CHAR_CJK_FONT ),GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT ));
calcFontInfo(rCTLFont,this,m_pCTLFontNameLB,m_pCTLFontStyleLB,m_pCTLFontSizeLB,m_pCTLFontLanguageLB,pFontList,GetWhich( SID_ATTR_CHAR_CTL_FONT ),GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT ));
m_pPreviewWin->Invalidate();
+ m_pFontTypeFT->SetText( pFontList->GetFontMapText( aFontInfo ) );
}
// -----------------------------------------------------------------------
@@ -819,6 +822,10 @@ void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp
}
}
+ if ( Western == eLangGrp )
+ m_pFontTypeFT->SetText( pFontList->GetFontMapText(
+ pFontList->Get( pNameBox->GetText(), pStyleBox->GetText() ) ) );
+
// save these settings
pNameBox->SaveValue();
pStyleBox->SaveValue();
diff --git a/cui/uiconfig/ui/charnamepage.ui b/cui/uiconfig/ui/charnamepage.ui
index eab5b32ccec7..df934e35831c 100644
--- a/cui/uiconfig/ui/charnamepage.ui
+++ b/cui/uiconfig/ui/charnamepage.ui
@@ -5,6 +5,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
+ <property name="spacing">6</property>
<child>
<object class="GtkFrame" id="simple">
<property name="can_focus">False</property>
@@ -623,6 +624,18 @@
</packing>
</child>
<child>
+ <object class="GtkLabel" id="fontinfo">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkFrame" id="frame4">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -657,7 +670,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
- <property name="position">4</property>
+ <property name="position">5</property>
</packing>
</child>
</object>
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,