summaryrefslogtreecommitdiff
path: root/writerperfect/source/filter/FontStyle.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'writerperfect/source/filter/FontStyle.cxx')
-rw-r--r--writerperfect/source/filter/FontStyle.cxx42
1 files changed, 41 insertions, 1 deletions
diff --git a/writerperfect/source/filter/FontStyle.cxx b/writerperfect/source/filter/FontStyle.cxx
index e9a5be195d84..a3f0ef7e8fd7 100644
--- a/writerperfect/source/filter/FontStyle.cxx
+++ b/writerperfect/source/filter/FontStyle.cxx
@@ -44,10 +44,50 @@ void FontStyle::write(OdfDocumentHandler *pHandler) const
TagOpenElement styleOpen("style:font-face");
styleOpen.addAttribute("style:name", getName());
styleOpen.addAttribute("svg:font-family", msFontFamily);
-// styleOpen.addAttribute("style:font-pitch", msFontPitch);
styleOpen.write(pHandler);
TagCloseElement styleClose("style:font-face");
styleClose.write(pHandler);
}
+////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////
+void FontStyleManager::clean()
+{
+ for (std::map<WPXString, FontStyle *, ltstr>::iterator iter = mHash.begin();
+ iter != mHash.end(); iter++) {
+ delete(iter->second);
+ }
+ mHash.clear();
+}
+
+void FontStyleManager::writeFontsDeclaration(OdfDocumentHandler *pHandler) const
+{
+ TagOpenElement("office:font-face-decls").write(pHandler);
+ for (std::map<WPXString, FontStyle *, ltstr>::const_iterator iter = mHash.begin();
+ iter != mHash.end(); iter++)
+ {
+ (iter->second)->write(pHandler);
+ }
+
+ TagOpenElement symbolFontOpen("style:font-face");
+ symbolFontOpen.addAttribute("style:name", "StarSymbol");
+ symbolFontOpen.addAttribute("svg:font-family", "StarSymbol");
+ symbolFontOpen.addAttribute("style:font-charset", "x-symbol");
+ symbolFontOpen.write(pHandler);
+ pHandler->endElement("style:font-face");
+
+ pHandler->endElement("office:font-face-decls");
+}
+
+WPXString FontStyleManager::findOrAdd(const char *psFontFamily)
+{
+ std::map<WPXString, FontStyle *, ltstr>::const_iterator iter = mHash.find(psFontFamily);
+ if (iter!=mHash.end()) return iter->second->getName();
+
+ // ok create a new font
+ mHash[psFontFamily] = new FontStyle(psFontFamily, psFontFamily);
+ return psFontFamily;
+}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */