Kaydet (Commit) eac87fed authored tarafından Fridrich Štrba's avatar Fridrich Štrba

Syncing with out-of-tree writerperfect

üst 9d1dc25f
...@@ -88,5 +88,4 @@ WPXString FontStyleManager::findOrAdd(const char *psFontFamily) ...@@ -88,5 +88,4 @@ WPXString FontStyleManager::findOrAdd(const char *psFontFamily)
return psFontFamily; return psFontFamily;
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -33,7 +33,7 @@ InternalHandler::InternalHandler(std::vector<DocumentElement *> *elements): ...@@ -33,7 +33,7 @@ InternalHandler::InternalHandler(std::vector<DocumentElement *> *elements):
void InternalHandler::startElement(const char *psName, const WPXPropertyList &xPropList) void InternalHandler::startElement(const char *psName, const WPXPropertyList &xPropList)
{ {
TagOpenElement *element = new TagOpenElement(psName); TagOpenElement *element = new TagOpenElement(psName);
WPXPropertyList::Iter i(xPropList); WPXPropertyList::Iter i(xPropList);
for (i.rewind(); i.next(); ) for (i.rewind(); i.next(); )
{ {
......
...@@ -561,10 +561,16 @@ void OdtGenerator::openSection(const WPXPropertyList &propList, const WPXPropert ...@@ -561,10 +561,16 @@ void OdtGenerator::openSection(const WPXPropertyList &propList, const WPXPropert
int iNumColumns = columns.count(); int iNumColumns = columns.count();
double fSectionMarginLeft = 0.0; double fSectionMarginLeft = 0.0;
double fSectionMarginRight = 0.0; double fSectionMarginRight = 0.0;
double fSectionSpaceAfter = 0.0;
if (propList["fo:margin-left"]) if (propList["fo:margin-left"])
fSectionMarginLeft = propList["fo:margin-left"]->getDouble(); fSectionMarginLeft = propList["fo:margin-left"]->getDouble();
if (propList["fo:margin-right"]) if (propList["fo:margin-right"])
fSectionMarginRight = propList["fo:margin-right"]->getDouble(); fSectionMarginRight = propList["fo:margin-right"]->getDouble();
if (propList["fo:margin-bottom"])
fSectionSpaceAfter = propList["fo:margin-bottom"]->getDouble();
else if (propList["libwpd:margin-bottom"])
fSectionSpaceAfter = propList["libwpd:margin-bottom"]->getDouble();
if (iNumColumns > 1 || fSectionMarginLeft != 0 || fSectionMarginRight != 0) if (iNumColumns > 1 || fSectionMarginLeft != 0 || fSectionMarginRight != 0)
{ {
......
...@@ -200,21 +200,23 @@ void ParagraphStyleManager::write(OdfDocumentHandler *pHandler) const ...@@ -200,21 +200,23 @@ void ParagraphStyleManager::write(OdfDocumentHandler *pHandler) const
} }
} }
WPXString ParagraphStyleManager::getKey(const WPXPropertyList &xPropList, const WPXPropertyListVector &tabStops) const WPXString ParagraphStyleManager::getKey(WPXPropertyList const &xPropList, WPXPropertyListVector const &tabStops) const
{ {
WPXString sKey = propListToStyleKey(xPropList); WPXString sKey = propListToStyleKey(xPropList);
WPXString sTabStops; WPXString sTabStops;
sTabStops.sprintf("[num-tab-stops:%i]", tabStops.count()); sTabStops.sprintf("[num-tab-stops:%i]", tabStops.count());
WPXPropertyListVector::Iter i(tabStops); WPXPropertyListVector::Iter i(tabStops);
for (i.rewind(); i.next(); ) for (i.rewind(); i.next();)
{
sTabStops.append(propListToStyleKey(i())); sTabStops.append(propListToStyleKey(i()));
}
sKey.append(sTabStops); sKey.append(sTabStops);
return sKey; return sKey;
} }
WPXString ParagraphStyleManager::findOrAdd (const WPXPropertyList &propList, const WPXPropertyListVector &tabStops) WPXString ParagraphStyleManager::findOrAdd(WPXPropertyList const &propList, WPXPropertyListVector const &tabStops)
{ {
WPXString hashKey = getKey(propList, tabStops); WPXString hashKey = getKey(propList, tabStops);
std::map<WPXString, ParagraphStyle *, ltstr>::const_iterator iter = mHash.find(hashKey); std::map<WPXString, ParagraphStyle *, ltstr>::const_iterator iter = mHash.find(hashKey);
...@@ -226,7 +228,8 @@ WPXString ParagraphStyleManager::findOrAdd (const WPXPropertyList &propList, con ...@@ -226,7 +228,8 @@ WPXString ParagraphStyleManager::findOrAdd (const WPXPropertyList &propList, con
WPXString sName; WPXString sName;
sName.sprintf("S%i", mHash.size()); sName.sprintf("S%i", mHash.size());
ParagraphStyle *pStyle = new ParagraphStyle(propList, tabStops, sName); ParagraphStyle *pStyle =
new ParagraphStyle(propList, tabStops, sName);
mHash[hashKey] = pStyle; mHash[hashKey] = pStyle;
return sName; return sName;
} }
...@@ -235,7 +238,9 @@ void SpanStyleManager::clean() ...@@ -235,7 +238,9 @@ void SpanStyleManager::clean()
{ {
for (std::map<WPXString, SpanStyle *, ltstr>::iterator iter = mHash.begin(); for (std::map<WPXString, SpanStyle *, ltstr>::iterator iter = mHash.begin();
iter != mHash.end(); ++iter) iter != mHash.end(); ++iter)
{
delete(iter->second); delete(iter->second);
}
mHash.clear(); mHash.clear();
} }
...@@ -243,10 +248,12 @@ void SpanStyleManager::write(OdfDocumentHandler *pHandler) const ...@@ -243,10 +248,12 @@ void SpanStyleManager::write(OdfDocumentHandler *pHandler) const
{ {
for (std::map<WPXString, SpanStyle *, ltstr>::const_iterator iter = mHash.begin(); for (std::map<WPXString, SpanStyle *, ltstr>::const_iterator iter = mHash.begin();
iter != mHash.end(); ++iter) iter != mHash.end(); ++iter)
iter->second->write(pHandler); {
(iter->second)->write(pHandler);
}
} }
WPXString SpanStyleManager::findOrAdd(const WPXPropertyList &propList) WPXString SpanStyleManager::findOrAdd(WPXPropertyList const &propList)
{ {
WPXString hashKey = propListToStyleKey(propList); WPXString hashKey = propListToStyleKey(propList);
std::map<WPXString, SpanStyle *, ltstr>::const_iterator iter = mHash.find(hashKey); std::map<WPXString, SpanStyle *, ltstr>::const_iterator iter = mHash.find(hashKey);
......
...@@ -80,7 +80,7 @@ public: ...@@ -80,7 +80,7 @@ public:
/* create a new style if it does not exists. In all case, returns the name of the style /* create a new style if it does not exists. In all case, returns the name of the style
Note: using S%i as new name*/ Note: using S%i as new name*/
WPXString findOrAdd(WPXPropertyList const &xPropList, WPXPropertyListVector const &tabStops); WPXString findOrAdd(const WPXPropertyList &xPropList, const WPXPropertyListVector &tabStops);
virtual void clean(); virtual void clean();
virtual void write(OdfDocumentHandler *) const; virtual void write(OdfDocumentHandler *) const;
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* libwriterperfect_filter.hxx: define basic functions for libwriterperfect/fileter /* libwriterperfect_filter.hxx: define basic functions for libwriterperfect/fileter
* *
* Copyright (C) 2002-2004 William Lachance (wrlach@gmail.com) * Copyright (C) 2002-2004 William Lachance (wrlach@gmail.com)
...@@ -44,4 +45,4 @@ WPXString propListToStyleKey(const WPXPropertyList &xPropList) ...@@ -44,4 +45,4 @@ WPXString propListToStyleKey(const WPXPropertyList &xPropList)
return sKey; return sKey;
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* libwriterperfect_filter.hxx: define basic functions for libwriterperfect/fileter /* libwriterperfect_filter.hxx: define basic functions for libwriterperfect/fileter
* *
* Copyright (C) 2002-2003 William Lachance (wrlach@gmail.com) * Copyright (C) 2002-2003 William Lachance (wrlach@gmail.com)
...@@ -42,5 +43,6 @@ struct ltstr ...@@ -42,5 +43,6 @@ struct ltstr
} }
}; };
#endif #endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment