[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - oox/qa oox/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Wed Aug 19 10:59:54 UTC 2020
oox/qa/unit/data/graphic-stroke.pptx |binary
oox/qa/unit/vml.cxx | 32 +++++++++++++++++++++++++++
oox/source/drawingml/graphicshapecontext.cxx | 2 +
oox/source/vml/vmlshape.cxx | 15 ++++++++++++
4 files changed, 49 insertions(+)
New commits:
commit 0bd854d18da7aa65a1d7141c1ee18056d20462fb
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Aug 18 17:43:57 2020 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Aug 19 12:59:16 2020 +0200
tdf#132555 PPTX VML import: handle stroke properties of image shapes
ComplexShape::implConvertAndInsert() returns early in the graphic object
shape case, so stroke model is not applied at all.
Also fix a problem in ShapeBase::finalizeFragmentImport(), where the
shape type had no stroke, but the shape itself had, and the later should
win.
The warning in OleObjectGraphicDataContext::onCreateContext() now points
out that <mc:AlternateContent> is ignored as a child of <a:graphicData>,
which probably should be addressed at some stage, but it's not required
to fix the missing stroke.
(cherry picked from commit b2d834d6727626f070bb4dde3e1c65da1169f729)
Change-Id: I4ab43b4c6d40d9f43caad22b85f5b885fa8b4ef1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100971
Tested-by: Jenkins
Reviewed-by: Gülşah Köse <gulsah.kose at collabora.com>
diff --git a/oox/qa/unit/data/graphic-stroke.pptx b/oox/qa/unit/data/graphic-stroke.pptx
new file mode 100644
index 000000000000..f4465476fcc6
Binary files /dev/null and b/oox/qa/unit/data/graphic-stroke.pptx differ
diff --git a/oox/qa/unit/vml.cxx b/oox/qa/unit/vml.cxx
index 089d61085b74..d43d2d5645ae 100644
--- a/oox/qa/unit/vml.cxx
+++ b/oox/qa/unit/vml.cxx
@@ -11,8 +11,10 @@
#include <unotest/macros_test.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
using namespace ::com::sun::star;
@@ -109,6 +111,36 @@ CPPUNIT_TEST_FIXTURE(OoxVmlTest, testShapeNonAutosizeWithText)
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(5398), xShape->getSize().Width);
}
+CPPUNIT_TEST_FIXTURE(OoxVmlTest, testGraphicStroke)
+{
+ load("graphic-stroke.pptx");
+ uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY);
+
+ uno::Reference<beans::XPropertySet> xShape;
+ for (sal_Int32 i = 0; i < xDrawPage->getCount(); ++i)
+ {
+ uno::Reference<lang::XServiceInfo> xInfo(xDrawPage->getByIndex(i), uno::UNO_QUERY);
+ if (!xInfo->supportsService("com.sun.star.drawing.GraphicObjectShape"))
+ {
+ continue;
+ }
+
+ xShape.set(xInfo, uno::UNO_QUERY);
+ break;
+ }
+ CPPUNIT_ASSERT(xShape.is());
+
+ drawing::LineStyle eLineStyle{};
+ xShape->getPropertyValue("LineStyle") >>= eLineStyle;
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1
+ // - Actual : 0
+ // i.e. line style was NONE, not SOLID.
+ CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_SOLID, eLineStyle);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx
index 39a090bf43c4..61d96b583c67 100644
--- a/oox/source/drawingml/graphicshapecontext.cxx
+++ b/oox/source/drawingml/graphicshapecontext.cxx
@@ -226,6 +226,8 @@ ContextHandlerRef OleObjectGraphicDataContext::onCreateContext( sal_Int32 nEleme
return new GraphicShapeContext( *this, mpMasterShapePtr, mpShapePtr );
break;
}
+ SAL_WARN("oox", "OleObjectGraphicDataContext::onCreateContext: unhandled element: "
+ << getBaseToken(nElement));
return nullptr;
}
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 8313d6d5cffc..a1e5744db8da 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -293,7 +293,15 @@ void ShapeBase::finalizeFragmentImport()
if (aType[ 0 ] == '#')
aType = aType.copy(1);
if( const ShapeType* pShapeType = mrDrawing.getShapes().getShapeTypeById( aType ) )
+ {
+ // Make sure that the stroke props from maTypeModel have priority over the stroke props from
+ // the shape type.
+ StrokeModel aMergedStrokeModel;
+ aMergedStrokeModel.assignUsed(pShapeType->getTypeModel().maStrokeModel);
+ aMergedStrokeModel.assignUsed(maTypeModel.maStrokeModel);
maTypeModel.assignUsed( pShapeType->getTypeModel() );
+ maTypeModel.maStrokeModel = aMergedStrokeModel;
+ }
else {
// Temporary fix, shapetype not found if referenced from different substream
// FIXME: extend scope of ShapeContainer to store all shapetypes from the document
@@ -1347,6 +1355,13 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes
// AS_CHARACTER shape: vertical orientation default is bottom, MSO default is top.
if ( maTypeModel.maPosition != "absolute" && maTypeModel.maPosition != "relative" )
PropertySet( xShape ).setAnyProperty( PROP_VertOrient, makeAny(text::VertOrientation::TOP));
+
+ // Apply stroke props from the type model.
+ oox::drawingml::ShapePropertyMap aPropMap(mrDrawing.getFilter().getModelObjectHelper());
+ const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
+ maTypeModel.maStrokeModel.pushToPropMap(aPropMap, rGraphicHelper);
+ PropertySet(xShape).setProperties(aPropMap);
+
return xShape;
}
More information about the Libreoffice-commits
mailing list