[Libreoffice-commits] core.git: oox/source sw/qa
Vinaya Mandke
vinaya.mandke at synerzip.com
Tue Jul 15 02:54:12 PDT 2014
oox/source/shape/ShapeContextHandler.cxx | 14 +++++++++++++-
sw/qa/extras/ooxmlexport/data/fdo81031.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 16 ++++++++++++++++
3 files changed, 29 insertions(+), 1 deletion(-)
New commits:
commit 0d5b053436eebac00948e95d64a87e150d195c07
Author: Vinaya Mandke <vinaya.mandke at synerzip.com>
Date: Tue Jul 8 15:32:29 2014 +0530
DOCX FILEOPEN VML Shape (image) is lost on import fdo#81031
ShapeContextHandler::getDrawingShapeContext mxDrawingShapeContext is set once and never reset.
So in a file which has numPicBullets and vml shapes in document.xml there is a problem.
First the fragment path is set as word/numbering.xml.
But when msRelationFragmentPath changes to word/document.xml,
mxDrawingShapeContext is not reset and hence the relationships are not resolved.
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/10180
Change-Id: I4a1401103797972731257145430f2048b94a04bc
diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx
index 53a6927..4ed6298 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -205,7 +205,19 @@ ShapeContextHandler::getDrawingShapeContext()
(new oox::vml::DrawingFragment
( *mxFilterBase, msRelationFragmentPath, *mpDrawing )));
}
-
+ else
+ {
+ // Reset the handler if fragment path has changed
+ OUString sHandlerFragmentPath = dynamic_cast<ContextHandler *>(mxDrawingFragmentHandler.get())->getFragmentPath();
+ if ( !msRelationFragmentPath.equals(sHandlerFragmentPath) )
+ {
+ mxDrawingFragmentHandler.clear();
+ mxDrawingFragmentHandler.set
+ (dynamic_cast<ContextHandler *>
+ (new oox::vml::DrawingFragment
+ ( *mxFilterBase, msRelationFragmentPath, *mpDrawing )));
+ }
+ }
return mxDrawingFragmentHandler;
}
diff --git a/sw/qa/extras/ooxmlexport/data/fdo81031.docx b/sw/qa/extras/ooxmlexport/data/fdo81031.docx
new file mode 100644
index 0000000..d80111d
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo81031.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 0c530fb..7dd37a2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -9,6 +9,8 @@
#include <swmodeltestbase.hxx>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/drawing/LineJoint.hpp>
@@ -3783,6 +3785,20 @@ DECLARE_OOXMLEXPORT_TEST(testFooterBodyDistance, "footer-body-distance.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:br", 1);
}
+DECLARE_OOXMLEXPORT_TEST(testfdo81031, "fdo81031.docx")
+{
+ // vml image was not rendered
+ // As there are also numPicBullets in the file,
+ // the fragmentPath was not changed hence relationships were not resolved.
+
+ uno::Reference<drawing::XShape> image = getShape(1);
+ uno::Reference<beans::XPropertySet> xImage(image, uno::UNO_QUERY);
+ uno::Reference<graphic::XGraphic> xGraphic = getProperty<uno::Reference<graphic::XGraphic> >(xImage, "Graphic");
+ uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(381), xBitmap->getSize().Width );
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(148), xBitmap->getSize().Height );
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list