summaryrefslogtreecommitdiff
path: root/writerperfect
diff options
context:
space:
mode:
authorFridrich Štrba <fridrich.strba@bluewin.ch>2011-09-04 08:08:54 +0200
committerFridrich Štrba <fridrich.strba@bluewin.ch>2011-09-04 08:08:54 +0200
commitedf44ff462599b7df200a75ae72035b32a6ffc0a (patch)
tree41a1a99d48fd5ade237ba9637cee7b341e1f44b8 /writerperfect
parent3cbbdedd655d3a7c7a37d921ee5a821abbab2cf9 (diff)
Output the Font styles in office:font-face-decls
Diffstat (limited to 'writerperfect')
-rw-r--r--writerperfect/source/filter/OdgGenerator.cxx37
1 files changed, 37 insertions, 0 deletions
diff --git a/writerperfect/source/filter/OdgGenerator.cxx b/writerperfect/source/filter/OdgGenerator.cxx
index 3561bd8055f2..795e3acc81d1 100644
--- a/writerperfect/source/filter/OdgGenerator.cxx
+++ b/writerperfect/source/filter/OdgGenerator.cxx
@@ -29,6 +29,7 @@
#include "OdfDocumentHandler.hxx"
#include "FilterInternal.hxx"
#include "TextRunStyle.hxx"
+#include "FontStyle.hxx"
#include <locale.h>
#include <math.h>
#include <string>
@@ -257,6 +258,9 @@ public:
// span styles
std::map<WPXString, SpanStyle *, ltstr> mSpanStyles;
+ // font styles
+ std::map<WPXString, FontStyle *, ltstr> mFontStyles;
+
OdfDocumentHandler *mpHandler;
::WPXPropertyList mxStyle;
@@ -284,6 +288,7 @@ OdgGeneratorPrivate::OdgGeneratorPrivate(OdfDocumentHandler *pHandler, const Odf
mPageMasterStyles(),
mParagraphStyles(),
mSpanStyles(),
+ mFontStyles(),
mpHandler(pHandler),
miGradientIndex(1),
miDashIndex(1),
@@ -350,6 +355,12 @@ OdgGeneratorPrivate::~OdgGeneratorPrivate()
{
delete(iterSpanStyles->second);
}
+
+ for (std::map<WPXString, FontStyle *, ltstr>::iterator iterFont = mFontStyles.begin();
+ iterFont != mFontStyles.end(); iterFont++)
+ {
+ delete(iterFont->second);
+ }
}
@@ -444,6 +455,23 @@ OdgGenerator::~OdgGenerator()
if ((mpImpl->mxStreamType == ODF_FLAT_XML) || (mpImpl->mxStreamType == ODF_CONTENT_XML) || (mpImpl->mxStreamType == ODF_STYLES_XML))
{
+ TagOpenElement("office:font-face-decls").write(mpImpl->mpHandler);
+
+ for (std::map<WPXString, FontStyle *, ltstr>::iterator iterFont = mpImpl->mFontStyles.begin();
+ iterFont != mpImpl->mFontStyles.end(); iterFont++)
+ {
+ iterFont->second->write(mpImpl->mpHandler);
+ }
+
+ 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(mpImpl->mpHandler);
+ TagCloseElement("style:font-face").write(mpImpl->mpHandler);
+
+ TagCloseElement("office:font-face-decls").write(mpImpl->mpHandler);
+
TagOpenElement("office:automatic-styles").write(mpImpl->mpHandler);
}
@@ -1308,6 +1336,8 @@ void OdgGenerator::startTextLine(WPXPropertyList const &propList)
WPXString sKey = propListToStyleKey(*pPersistPropList);
+ pPersistPropList->insert("style:parent-style-name", "Standard");
+
if (mpImpl->mParagraphStyles.find(sKey) == mpImpl->mParagraphStyles.end())
{
WPXString sName;
@@ -1336,6 +1366,13 @@ void OdgGenerator::endTextLine()
void OdgGenerator::startTextSpan(WPXPropertyList const&propList)
{
+ if (propList["style:font-name"])
+ {
+ WPXString sFontName = propList["style:font-name"]->getStr();
+ if (mpImpl->mFontStyles.find(sFontName) == mpImpl->mFontStyles.end())
+ mpImpl->mFontStyles[sFontName] = new FontStyle(sFontName.cstr(), sFontName.cstr());
+ }
+
WPXString sName;
WPXString sSpanHashKey = propListToStyleKey(propList);
if (mpImpl->mSpanStyles.find(sSpanHashKey) == mpImpl->mSpanStyles.end())