Skip to content

Commit 3b250f0

Browse files
nd101Xisco Faulí
authored and
Xisco Faulí
committed
tdf#131082 fix missing fill property of grouped shapes
When shapes are grouped together, and fill property is specified at the group level in MSO, it fails to work in IMPRESS. This fix is to set the fill property when it is being imported. Change-Id: I89920e71fc558f54d49ef7b065c549a732bc2b10 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89862 Tested-by: Jenkins Reviewed-by: Xisco Faulí <[email protected]>
1 parent b29fb89 commit 3b250f0

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

oox/qa/unit/data/tdf131082.pptx

25.3 KB
Binary file not shown.

oox/qa/unit/drawingml.cxx

+42
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#include <com/sun/star/beans/XPropertySet.hpp>
1414
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
15+
#include <com/sun/star/drawing/FillStyle.hpp>
16+
#include <com/sun/star/drawing/XShape.hpp>
17+
#include <com/sun/star/text/XText.hpp>
1518
#include <com/sun/star/frame/Desktop.hpp>
1619
#include <com/sun/star/frame/XStorable.hpp>
1720

@@ -20,6 +23,24 @@
2023

2124
using namespace ::com::sun::star;
2225

26+
namespace
27+
{
28+
/// Gets one child of xShape, which one is specified by nIndex.
29+
uno::Reference<drawing::XShape> getChildShape(const uno::Reference<drawing::XShape>& xShape,
30+
sal_Int32 nIndex)
31+
{
32+
uno::Reference<container::XIndexAccess> xGroup(xShape, uno::UNO_QUERY);
33+
CPPUNIT_ASSERT(xGroup.is());
34+
35+
CPPUNIT_ASSERT(xGroup->getCount() > nIndex);
36+
37+
uno::Reference<drawing::XShape> xRet(xGroup->getByIndex(nIndex), uno::UNO_QUERY);
38+
CPPUNIT_ASSERT(xRet.is());
39+
40+
return xRet;
41+
}
42+
}
43+
2344
/// oox drawingml tests.
2445
class OoxDrawingmlTest : public test::BootstrapFixture, public unotest::MacrosTest
2546
{
@@ -87,6 +108,27 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTransparentText)
87108
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(75), nTransparency);
88109
}
89110

111+
CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTdf131082)
112+
{
113+
OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf131082.pptx";
114+
loadAndReload(aURL, "Impress Office Open XML");
115+
116+
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
117+
uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
118+
uno::UNO_QUERY);
119+
120+
uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
121+
uno::Reference<beans::XPropertySet> XPropSet(getChildShape(getChildShape(xShape, 0), 0),
122+
uno::UNO_QUERY);
123+
124+
drawing::FillStyle eFillStyle = drawing::FillStyle_NONE;
125+
XPropSet->getPropertyValue("FillStyle") >>= eFillStyle;
126+
127+
// Without the accompanying fix in place, this test would have failed with:
128+
// with drawing::FillStyle_NONE - 0
129+
CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, eFillStyle);
130+
}
131+
90132
CPPUNIT_PLUGIN_IMPLEMENT();
91133

92134
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

oox/source/drawingml/shape.cxx

+2
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,8 @@ Reference< XShape > const & Shape::createAndInsert(
10371037
mpTablePropertiesPtr->pushToPropSet( rFilterBase, xSet, mpMasterTextListStyle );
10381038

10391039
FillProperties aFillProperties = getActualFillProperties(pTheme, &rShapeOrParentShapeFillProps);
1040+
if (getFillProperties().moFillType.has() && getFillProperties().moFillType.get() == XML_grpFill)
1041+
getFillProperties().assignUsed(aFillProperties);
10401042
if(!bIsCroppedGraphic)
10411043
aFillProperties.pushToPropMap( aShapeProps, rGraphicHelper, mnRotation, nFillPhClr, mbFlipH, mbFlipV );
10421044
LineProperties aLineProperties = getActualLineProperties(pTheme);

0 commit comments

Comments
 (0)