[Libreoffice-commits] .: 2 commits - writerperfect/source
Fridrich Strba
fridrich at kemper.freedesktop.org
Tue Oct 25 14:17:06 PDT 2011
writerperfect/source/filter/InternalHandler.hxx | 3
writerperfect/source/filter/ListStyle.cxx | 9 +-
writerperfect/source/filter/OdgGenerator.cxx | 85 ++++++++++++++++++++----
writerperfect/source/filter/PageSpan.cxx | 11 +--
writerperfect/source/filter/Style.hxx | 8 --
5 files changed, 84 insertions(+), 32 deletions(-)
New commits:
commit 494c6b5524dad78f2eeb48a3b979a11bc8413984
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date: Tue Oct 25 23:16:32 2011 +0200
Realy not need to make this one depend on boost
diff --git a/writerperfect/source/filter/InternalHandler.hxx b/writerperfect/source/filter/InternalHandler.hxx
index a7b58f9..bb756be 100644
--- a/writerperfect/source/filter/InternalHandler.hxx
+++ b/writerperfect/source/filter/InternalHandler.hxx
@@ -29,9 +29,8 @@
#include <libwpd/WPXString.h>
#include "DocumentElement.hxx"
#include "OdfDocumentHandler.hxx"
-#include <boost/noncopyable.hpp>
-class InternalHandler : public OdfDocumentHandler, private boost::noncopyable
+class InternalHandler : public OdfDocumentHandler
{
public:
InternalHandler(std::vector<DocumentElement *> *elements);
diff --git a/writerperfect/source/filter/ListStyle.cxx b/writerperfect/source/filter/ListStyle.cxx
index 9b705f5..0b56cef 100644
--- a/writerperfect/source/filter/ListStyle.cxx
+++ b/writerperfect/source/filter/ListStyle.cxx
@@ -136,11 +136,10 @@ void UnorderedListLevelStyle::write(OdfDocumentHandler *pHandler, int iLevel) co
ListStyle::ListStyle(const char *psName, const int iListID) :
Style(psName),
- miNumListLevels(0),
miListID(iListID)
{
for (int i=0; i<WP6_NUM_LIST_LEVELS; ++i)
- mppListLevels[i] = NULL;
+ mppListLevels[i] = 0;
}
@@ -156,7 +155,7 @@ ListStyle::~ListStyle()
bool ListStyle::isListLevelDefined(int iLevel) const
{
- if (mppListLevels[iLevel] == NULL)
+ if (!mppListLevels[iLevel])
return false;
return true;
@@ -167,7 +166,7 @@ void ListStyle::setListLevel(int iLevel, ListLevelStyle *iListLevelStyle)
// can't uncomment this next line without adding some extra logic.
// figure out which is best: use the initial message, or constantly
// update?
- if (mppListLevels[iLevel] == NULL)
+ if (!mppListLevels[iLevel])
mppListLevels[iLevel] = iListLevelStyle;
}
@@ -179,7 +178,7 @@ void ListStyle::write(OdfDocumentHandler *pHandler) const
for (int i=0; i<WP6_NUM_LIST_LEVELS; ++i)
{
- if (mppListLevels[i] != NULL)
+ if (mppListLevels[i])
mppListLevels[i]->write(pHandler, i);
}
diff --git a/writerperfect/source/filter/PageSpan.cxx b/writerperfect/source/filter/PageSpan.cxx
index 54161a5..cb7da97 100644
--- a/writerperfect/source/filter/PageSpan.cxx
+++ b/writerperfect/source/filter/PageSpan.cxx
@@ -26,19 +26,16 @@
/* "This product is not manufactured, approved, or supported by
* Corel Corporation or Corel Corporation Limited."
*/
-
-#include <stdlib.h>
-
#include "FilterInternal.hxx"
#include "PageSpan.hxx"
#include "DocumentElement.hxx"
PageSpan::PageSpan(const WPXPropertyList &xPropList) :
mxPropList(xPropList),
- mpHeaderContent(NULL),
- mpFooterContent(NULL),
- mpHeaderLeftContent(NULL),
- mpFooterLeftContent(NULL)
+ mpHeaderContent(0),
+ mpFooterContent(0),
+ mpHeaderLeftContent(0),
+ mpFooterLeftContent(0)
{
}
diff --git a/writerperfect/source/filter/Style.hxx b/writerperfect/source/filter/Style.hxx
index 6126e26..2dd41a4 100644
--- a/writerperfect/source/filter/Style.hxx
+++ b/writerperfect/source/filter/Style.hxx
@@ -28,16 +28,14 @@
#ifndef _STYLE_H
#define _STYLE_H
-#include <cstdlib>
#include <libwpd/libwpd.h>
#include "libwriterperfect_filter.hxx"
#include "DocumentElement.hxx"
-#include <boost/noncopyable.hpp>
-class TopLevelElementStyle : private boost::noncopyable
+class TopLevelElementStyle
{
public:
- TopLevelElementStyle() : mpsMasterPageName(NULL) { }
+ TopLevelElementStyle() : mpsMasterPageName(0) {}
virtual ~TopLevelElementStyle()
{
if (mpsMasterPageName) delete mpsMasterPageName;
@@ -73,7 +71,7 @@ private:
WPXString msName;
};
-class StyleManager : private boost::noncopyable
+class StyleManager
{
public:
StyleManager() {}
commit 04eecf30557e54080d128ed8cd69889ef8eaa3c7
Author: Tibby Lickle <tibbylickle at gmail.com>
Date: Tue Oct 25 23:04:44 2011 +0200
Added line marker support
Signed-off-by: Fridrich Å trba <fridrich.strba at bluewin.ch>
diff --git a/writerperfect/source/filter/OdgGenerator.cxx b/writerperfect/source/filter/OdgGenerator.cxx
index 68f77c1..2d2beea 100644
--- a/writerperfect/source/filter/OdgGenerator.cxx
+++ b/writerperfect/source/filter/OdgGenerator.cxx
@@ -218,11 +218,7 @@ static WPXString doubleToString(const double value)
{
WPXString tempString;
tempString.sprintf("%.4f", value);
-#ifndef __ANDROID__
std::string decimalPoint(localeconv()->decimal_point);
-#else
- std::string decimalPoint(".");
-#endif
if ((decimalPoint.size() == 0) || (decimalPoint == "."))
return tempString;
std::string stringValue(tempString.cstr());
@@ -249,6 +245,7 @@ public:
// graphics styles
std::vector<DocumentElement *> mGraphicsStrokeDashStyles;
std::vector<DocumentElement *> mGraphicsGradientStyles;
+ std::vector<DocumentElement *> mGraphicsMarkerStyles;
std::vector<DocumentElement *> mGraphicsAutomaticStyles;
// page styles
@@ -268,7 +265,10 @@ public:
::WPXPropertyList mxStyle;
::WPXPropertyListVector mxGradient;
+ ::WPXPropertyListVector mxMarker;
int miGradientIndex;
+ int miStartMarkerIndex;
+ int miEndMarkerIndex;
int miDashIndex;
int miGraphicsStyleIndex;
int miPageIndex;
@@ -293,9 +293,11 @@ OdgGeneratorPrivate::OdgGeneratorPrivate(OdfDocumentHandler *pHandler, const Odf
mSpanManager(),
mFontManager(),
mpHandler(pHandler),
- mxStyle(),
- mxGradient(),
+ mxStyle(), mxGradient(),
+ mxMarker(),
miGradientIndex(1),
+ miStartMarkerIndex(1),
+ miEndMarkerIndex(1),
miDashIndex(1),
miGraphicsStyleIndex(1),
miPageIndex(1),
@@ -316,7 +318,7 @@ OdgGeneratorPrivate::~OdgGeneratorPrivate()
for (std::vector<DocumentElement *>::iterator iterBody = mBodyElements.begin(); iterBody != mBodyElements.end(); ++iterBody)
{
delete (*iterBody);
- (*iterBody) = NULL;
+ (*iterBody) = 0;
}
for (std::vector<DocumentElement *>::iterator iterGraphicsAutomaticStyles = mGraphicsAutomaticStyles.begin();
@@ -337,6 +339,12 @@ OdgGeneratorPrivate::~OdgGeneratorPrivate()
delete((*iterGraphicsGradientStyles));
}
+ for (std::vector<DocumentElement *>::iterator iterGraphicsMarkerStyles = mGraphicsMarkerStyles.begin();
+ iterGraphicsMarkerStyles != mGraphicsMarkerStyles.end(); ++iterGraphicsMarkerStyles)
+ {
+ delete((*iterGraphicsMarkerStyles));
+ }
+
for (std::vector<DocumentElement *>::iterator iterPageAutomaticStyles = mPageAutomaticStyles.begin();
iterPageAutomaticStyles != mPageAutomaticStyles.end(); ++iterPageAutomaticStyles)
{
@@ -442,6 +450,11 @@ OdgGenerator::~OdgGenerator()
(*iterGraphicsGradientStyles)->write(mpImpl->mpHandler);
}
+ for (std::vector<DocumentElement *>::const_iterator iterGraphicsMarkerStyles = mpImpl->mGraphicsMarkerStyles.begin();
+ iterGraphicsMarkerStyles != mpImpl->mGraphicsMarkerStyles.end(); ++iterGraphicsMarkerStyles)
+ {
+ (*iterGraphicsMarkerStyles)->write(mpImpl->mpHandler);
+ }
mpImpl->mpHandler->endElement("office:styles");
}
@@ -990,6 +1003,31 @@ void OdgGeneratorPrivate::_writeGraphicsStyle()
mGraphicsStrokeDashStyles.push_back(new TagCloseElement("draw:stroke-dash"));
}
+ if (mxStyle["draw:marker-start-path"])
+ {
+ WPXString sValue;
+ TagOpenElement *pDrawMarkerElement = new TagOpenElement("draw:marker");
+ sValue.sprintf("StartMarker_%i", miStartMarkerIndex);
+ pDrawMarkerElement->addAttribute("draw:name", sValue);
+ if (mxStyle["draw:marker-start-viewbox"])
+ pDrawMarkerElement->addAttribute("svg:viewBox", mxStyle["draw:marker-start-viewbox"]->getStr());
+ pDrawMarkerElement->addAttribute("svg:d", mxStyle["draw:marker-start-path"]->getStr());
+ mGraphicsMarkerStyles.push_back(pDrawMarkerElement);
+ mGraphicsMarkerStyles.push_back(new TagCloseElement("draw:marker"));
+ }
+ if(mxStyle["draw:marker-end-path"])
+ {
+ WPXString sValue;
+ TagOpenElement *pDrawMarkerElement = new TagOpenElement("draw:marker");
+ sValue.sprintf("EndMarker_%i", miEndMarkerIndex);
+ pDrawMarkerElement->addAttribute("draw:name", sValue);
+ if (mxStyle["draw:marker-end-viewbox"])
+ pDrawMarkerElement->addAttribute("svg:viewBox", mxStyle["draw:marker-end-viewbox"]->getStr());
+ pDrawMarkerElement->addAttribute("svg:d", mxStyle["draw:marker-end-path"]->getStr());
+ mGraphicsMarkerStyles.push_back(pDrawMarkerElement);
+ mGraphicsMarkerStyles.push_back(new TagCloseElement("draw:marker"));
+ }
+
if(mxStyle["draw:fill"] && mxStyle["draw:fill"]->getStr() == "gradient")
{
bUseOpacityGradient = true;
@@ -1086,7 +1124,8 @@ void OdgGeneratorPrivate::_writeGraphicsStyle()
// Work around a mess in LibreOffice where both opacities of 100% are interpreted as complete transparency
// Nevertheless, when one is different, immediately, they are interpreted correctly
- if (!(mxStyle["libwpg:start-opacity"] && mxStyle["libwpg:end-opacity"]) || (mxStyle["libwpg:start-opacity"]->getDouble() == 1.0 && mxStyle["libwpg:end-opacity"]->getDouble() == 1.0))
+ if (!(mxStyle["libwpg:start-opacity"] && mxStyle["libwpg:end-opacity"])
+ || (mxStyle["libwpg:start-opacity"]->getDouble() == 1.0 && mxStyle["libwpg:end-opacity"]->getDouble() == 1.0))
{
delete pDrawOpacityElement;
bUseOpacityGradient = false;
@@ -1215,6 +1254,26 @@ void OdgGeneratorPrivate::_writeGraphicsStyle()
}
}
+
+ if(mxStyle["draw:marker-start-path"])
+ {
+ sValue.sprintf("StartMarker_%i", miStartMarkerIndex++);
+ pStyleGraphicsPropertiesElement->addAttribute("draw:marker-start", sValue);
+ if (mxStyle["draw:marker-start-width"])
+ pStyleGraphicsPropertiesElement->addAttribute("draw:marker-start-width", mxStyle["draw:marker-start-width"]->getStr());
+ else
+ pStyleGraphicsPropertiesElement->addAttribute("draw:marker-start-width", "0.118in");
+ }
+ if (mxStyle["draw:marker-end-path"])
+ {
+ sValue.sprintf("EndMarker_%i", miEndMarkerIndex++);
+ pStyleGraphicsPropertiesElement->addAttribute("draw:marker-end", sValue);
+ if (mxStyle["draw:marker-end-width"])
+ pStyleGraphicsPropertiesElement->addAttribute("draw:marker-end-width", mxStyle["draw:marker-end-width"]->getStr());
+ else
+ pStyleGraphicsPropertiesElement->addAttribute("draw:marker-end-width", "0.118in");
+ }
+
mGraphicsAutomaticStyles.push_back(pStyleGraphicsPropertiesElement);
mGraphicsAutomaticStyles.push_back(new TagCloseElement("style:graphic-properties"));
@@ -1222,7 +1281,7 @@ void OdgGeneratorPrivate::_writeGraphicsStyle()
miGraphicsStyleIndex++;
}
-void OdgGenerator::startEmbeddedGraphics(WPXPropertyList const &)
+void OdgGenerator::startEmbeddedGraphics(const WPXPropertyList &)
{
}
@@ -1230,7 +1289,7 @@ void OdgGenerator::endEmbeddedGraphics()
{
}
-void OdgGenerator::startTextObject(WPXPropertyList const &propList, WPXPropertyListVector const &)
+void OdgGenerator::startTextObject(const WPXPropertyList &propList, const WPXPropertyListVector &)
{
TagOpenElement *pDrawFrameOpenElement = new TagOpenElement("draw:frame");
TagOpenElement *pStyleStyleOpenElement = new TagOpenElement("style:style");
@@ -1350,7 +1409,7 @@ void OdgGenerator::endTextObject()
}
}
-void OdgGenerator::startTextLine(WPXPropertyList const &propList)
+void OdgGenerator::startTextLine(const WPXPropertyList &propList)
{
WPXPropertyList finalPropList(propList);
finalPropList.insert("style:parent-style-name", "Standard");
@@ -1368,7 +1427,7 @@ void OdgGenerator::endTextLine()
mpImpl->mBodyElements.push_back(new TagCloseElement("text:p"));
}
-void OdgGenerator::startTextSpan(WPXPropertyList const &propList)
+void OdgGenerator::startTextSpan(const WPXPropertyList &propList)
{
if (propList["style:font-name"])
mpImpl->mFontManager.findOrAdd(propList["style:font-name"]->getStr().cstr());
@@ -1385,7 +1444,7 @@ void OdgGenerator::endTextSpan()
mpImpl->mBodyElements.push_back(new TagCloseElement("text:span"));
}
-void OdgGenerator::insertText(WPXString const &text)
+void OdgGenerator::insertText(const WPXString &text)
{
DocumentElement *pText = new TextElement(text);
mpImpl->mBodyElements.push_back(pText);
More information about the Libreoffice-commits
mailing list