[Libreoffice-commits] .: 3 commits - libvisio/libvisio-0.0.6-crash.patch libvisio/makefile.mk writerperfect/source
Fridrich Strba
fridrich at kemper.freedesktop.org
Sat Sep 3 07:54:22 PDT 2011
libvisio/libvisio-0.0.6-crash.patch | 26 +++++++
libvisio/makefile.mk | 2
writerperfect/source/filter/OdgGenerator.cxx | 93 +++++++++++++++++++++++++--
3 files changed, 115 insertions(+), 6 deletions(-)
New commits:
commit 41201afceaa83df369ac0213f047f43061c448ae
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date: Sat Sep 3 16:50:32 2011 +0200
Actually show some text
diff --git a/writerperfect/source/filter/OdgGenerator.cxx b/writerperfect/source/filter/OdgGenerator.cxx
index 4cc81b0..a002ea6 100644
--- a/writerperfect/source/filter/OdgGenerator.cxx
+++ b/writerperfect/source/filter/OdgGenerator.cxx
@@ -715,7 +715,6 @@ void OdgGeneratorPrivate::_drawPolySomething(const ::WPXPropertyListVector& vert
WPXString sValue;
sValue.sprintf("gr%i", miGraphicsStyleIndex-1);
pDrawLineElement->addAttribute("draw:style-name", sValue);
- pDrawLineElement->addAttribute("draw:text-style-name", "P1");
pDrawLineElement->addAttribute("draw:layer", "layout");
pDrawLineElement->addAttribute("svg:x1", vertices[0]["svg:x"]->getStr());
pDrawLineElement->addAttribute("svg:y1", vertices[0]["svg:y"]->getStr());
@@ -820,7 +819,6 @@ void OdgGeneratorPrivate::_drawPath(const WPXPropertyListVector& path)
TagOpenElement *pDrawPathElement = new TagOpenElement("draw:path");
sValue.sprintf("gr%i", miGraphicsStyleIndex-1);
pDrawPathElement->addAttribute("draw:style-name", sValue);
- pDrawPathElement->addAttribute("draw:text-style-name", "P1");
pDrawPathElement->addAttribute("draw:layer", "layout");
sValue = doubleToString(px); sValue.append("in");
pDrawPathElement->addAttribute("svg:x", sValue);
@@ -1196,6 +1194,7 @@ void OdgGenerator::startTextObject(WPXPropertyList const &propList, WPXPropertyL
mpImpl->mGraphicsAutomaticStyles.push_back(pStyleStyleOpenElement);
pDrawFrameOpenElement->addAttribute("draw:style-name", sValue);
+ pDrawFrameOpenElement->addAttribute("draw:layer", "layout");
TagOpenElement *pStyleGraphicPropertiesOpenElement = new TagOpenElement("style:graphic-properties");
pStyleGraphicPropertiesOpenElement->addAttribute("draw:stroke", "none");
@@ -1212,9 +1211,10 @@ void OdgGenerator::startTextObject(WPXPropertyList const &propList, WPXPropertyL
{
if (!propList["fo:min-width"])
{
- pDrawFrameOpenElement->addAttribute("fo:min-width", "0in");
- pStyleGraphicPropertiesOpenElement->addAttribute("fo:min-width", "0in");
+ pDrawFrameOpenElement->addAttribute("fo:min-width", "1in");
+ pStyleGraphicPropertiesOpenElement->addAttribute("fo:min-width", "1in");
}
+ pDrawFrameOpenElement->addAttribute("svg:width", "10in");
}
else
{
@@ -1273,12 +1273,12 @@ void OdgGenerator::endTextLine()
void OdgGenerator::startTextSpan(WPXPropertyList const&)
{
- mpImpl->mBodyElements.push_back(new TagOpenElement("text:s"));
+// mpImpl->mBodyElements.push_back(new TagOpenElement("text:s"));
}
void OdgGenerator::endTextSpan()
{
- mpImpl->mBodyElements.push_back(new TagCloseElement("text:s"));
+// mpImpl->mBodyElements.push_back(new TagCloseElement("text:s"));
}
void OdgGenerator::insertText(WPXString const &text)
commit fd9905e99cc46c54753eb6f79940952a35256add
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date: Sat Sep 3 15:59:27 2011 +0200
Initial work on text implementation
diff --git a/writerperfect/source/filter/OdgGenerator.cxx b/writerperfect/source/filter/OdgGenerator.cxx
index e4404e8..4cc81b0 100644
--- a/writerperfect/source/filter/OdgGenerator.cxx
+++ b/writerperfect/source/filter/OdgGenerator.cxx
@@ -260,6 +260,10 @@ public:
double mfHeight, mfMaxHeight;
const OdfStreamType mxStreamType;
+
+ bool mbIsTextBox;
+ bool mbIsTextLine;
+ bool mbIsTextOnPath;
};
OdgGeneratorPrivate::OdgGeneratorPrivate(OdfDocumentHandler *pHandler, const OdfStreamType streamType):
@@ -272,7 +276,10 @@ OdgGeneratorPrivate::OdgGeneratorPrivate(OdfDocumentHandler *pHandler, const Odf
mfMaxWidth(0.0),
mfHeight(0.0),
mfMaxHeight(0.0),
- mxStreamType(streamType)
+ mxStreamType(streamType),
+ mbIsTextBox(false),
+ mbIsTextLine(false),
+ mbIsTextOnPath(false)
{
}
@@ -1176,31 +1183,107 @@ void OdgGenerator::endEmbeddedGraphics()
{
}
-void OdgGenerator::startTextObject(WPXPropertyList const&, WPXPropertyListVector const&)
+void OdgGenerator::startTextObject(WPXPropertyList const &propList, WPXPropertyListVector const &propListVec)
{
+ TagOpenElement *pDrawFrameOpenElement = new TagOpenElement("draw:frame");
+ TagOpenElement *pStyleStyleOpenElement = new TagOpenElement("style:style");
+
+ WPXString sValue;
+ sValue.sprintf("gr%i", mpImpl->miGraphicsStyleIndex++);
+ pStyleStyleOpenElement->addAttribute("style:name", sValue);
+ pStyleStyleOpenElement->addAttribute("style:family", "graphic");
+ pStyleStyleOpenElement->addAttribute("style:parent-style-name", "standard");
+ mpImpl->mGraphicsAutomaticStyles.push_back(pStyleStyleOpenElement);
+
+ pDrawFrameOpenElement->addAttribute("draw:style-name", sValue);
+
+ TagOpenElement *pStyleGraphicPropertiesOpenElement = new TagOpenElement("style:graphic-properties");
+ pStyleGraphicPropertiesOpenElement->addAttribute("draw:stroke", "none");
+ pStyleGraphicPropertiesOpenElement->addAttribute("svg:stroke-color", "#000000");
+ pStyleGraphicPropertiesOpenElement->addAttribute("draw:fill", "none");
+ pStyleGraphicPropertiesOpenElement->addAttribute("draw:fill-color", "#ffffff");
+
+ if (propList["svg:x"])
+ pDrawFrameOpenElement->addAttribute("svg:x", propList["svg:x"]->getStr());
+ if (propList["svg:y"])
+ pDrawFrameOpenElement->addAttribute("svg:y", propList["svg:y"]->getStr());
+
+ if (!propList["svg:width"] && !propList["svg:height"])
+ {
+ if (!propList["fo:min-width"])
+ {
+ pDrawFrameOpenElement->addAttribute("fo:min-width", "0in");
+ pStyleGraphicPropertiesOpenElement->addAttribute("fo:min-width", "0in");
+ }
+ }
+ else
+ {
+ if(propList["svg:width"])
+ pDrawFrameOpenElement->addAttribute("svg:width", propList["svg:width"]->getStr());
+ if(propList["svg:height"])
+ pDrawFrameOpenElement->addAttribute("svg:height", propList["svg:height"]->getStr());
+ }
+ if (propList["fo:min-width"])
+ {
+ pDrawFrameOpenElement->addAttribute("fo:min-width", propList["fo:min-width"]->getStr());
+ pStyleGraphicPropertiesOpenElement->addAttribute("fo:min-width", propList["fo:min-width"]->getStr());
+ }
+ if (propList["fo:min-height"])
+ {
+ pDrawFrameOpenElement->addAttribute("fo:min-height", propList["fo:min-height"]->getStr());
+ pStyleGraphicPropertiesOpenElement->addAttribute("fo:min-height", propList["fo:min-height"]->getStr());
+ }
+ if (propList["fo:max-width"])
+ {
+ pDrawFrameOpenElement->addAttribute("fo:max-width", propList["fo:max-height"]->getStr());
+ pStyleGraphicPropertiesOpenElement->addAttribute("fo:max-width", propList["fo:max-width"]->getStr());
+ }
+ if (propList["fo:max-height"])
+ {
+ pDrawFrameOpenElement->addAttribute("fo:max-height", propList["fo:max-height"]->getStr());
+ pStyleGraphicPropertiesOpenElement->addAttribute("fo:max-height", propList["fo:max-height"]->getStr());
+ }
+ mpImpl->mBodyElements.push_back(pDrawFrameOpenElement);
+ mpImpl->mBodyElements.push_back(new TagOpenElement("draw:text-box"));
+ mpImpl->mGraphicsAutomaticStyles.push_back(pStyleGraphicPropertiesOpenElement);
+ mpImpl->mGraphicsAutomaticStyles.push_back(new TagCloseElement("style:graphic-properties"));
+ mpImpl->mGraphicsAutomaticStyles.push_back(new TagCloseElement("style:style"));
+ mpImpl->mbIsTextBox = true;
}
void OdgGenerator::endTextObject()
{
+ if (mpImpl->mbIsTextBox)
+ {
+ mpImpl->mBodyElements.push_back(new TagCloseElement("draw:text-box"));
+ mpImpl->mBodyElements.push_back(new TagCloseElement("draw:frame"));
+ mpImpl->mbIsTextBox = false;
+ }
}
void OdgGenerator::startTextLine(WPXPropertyList const&)
{
+ mpImpl->mBodyElements.push_back(new TagOpenElement("text:p"));
}
void OdgGenerator::endTextLine()
{
+ mpImpl->mBodyElements.push_back(new TagCloseElement("text:p"));
}
void OdgGenerator::startTextSpan(WPXPropertyList const&)
{
+ mpImpl->mBodyElements.push_back(new TagOpenElement("text:s"));
}
void OdgGenerator::endTextSpan()
{
+ mpImpl->mBodyElements.push_back(new TagCloseElement("text:s"));
}
-void OdgGenerator::insertText(WPXString const&)
+void OdgGenerator::insertText(WPXString const &text)
{
+ DocumentElement *pText = new TextElement(text);
+ mpImpl->mBodyElements.push_back(pText);
}
commit 76048bba1cc3635b558813688020f68220934549
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date: Sat Sep 3 00:19:03 2011 +0200
Add a patch to prevent some null pointer crash
diff --git a/libvisio/libvisio-0.0.6-crash.patch b/libvisio/libvisio-0.0.6-crash.patch
new file mode 100644
index 0000000..c1384cb
--- /dev/null
+++ b/libvisio/libvisio-0.0.6-crash.patch
@@ -0,0 +1,26 @@
+--- misc/libvisio-0.0.6/src/lib/VSDXContentCollector.cpp 2011-08-31 11:10:40.000000000 +0200
++++ misc/build/libvisio-0.0.6/src/lib/VSDXContentCollector.cpp 2011-09-03 00:15:39.134916000 +0200
+@@ -893,7 +893,13 @@
+
+ // Get stencil geometry so as to find stencil NURBS data ID
+ VSDXGeometryListElement * element = m_stencilShape->m_geometries[m_currentGeometryCount-1].getElement(id);
+- dataID = dynamic_cast<VSDXNURBSTo2*>(element)->m_dataID;
++ VSDXNURBSTo2* tmpElement = dynamic_cast<VSDXNURBSTo2*>(element);
++ if (!tmpElement)
++ {
++ _handleLevelChange(level);
++ return;
++ }
++ dataID = tmpElement->m_dataID;
+ iter = m_stencilShape->m_nurbsData.find(dataID);
+ }
+ else // No stencils involved, directly get dataID and fill in missing parts
+@@ -903,7 +909,7 @@
+
+ if (iter != m_NURBSData.end())
+ {
+- data = iter->second;
++ data = iter->second;;
+ data.knots.push_back(knot);
+ data.knots.push_back(data.lastKnot);
+ data.knots.insert(data.knots.begin(), knotPrev);
diff --git a/libvisio/makefile.mk b/libvisio/makefile.mk
index 611bbaa..29ca54b 100644
--- a/libvisio/makefile.mk
+++ b/libvisio/makefile.mk
@@ -58,7 +58,7 @@ TARFILE_NAME=libvisio-0.0.6
TARFILE_MD5=8c50b6c3e4b323013164f4a6d8d74dc6
PATCH_FILES=\
- libvisio-0.0.6.patch
+ libvisio-0.0.6.patch libvisio-0.0.6-crash.patch
BUILD_ACTION=dmake $(MFLAGS) $(CALLMACROS)
More information about the Libreoffice-commits
mailing list