tdf#154363 sd: fix line connectors regression of mirrored shapes
caused by commitcbf66ec3e6(tdf#89449 PPTX import: fix line connectors). Note: partial revert of commit9ab16e2738"oox: fix crash in lcl_GetGluePointId by removing unused code". Change-Id: Icc45c93c4fa3a22c0f34866ccb64ea6b9037d936 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149676 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org>
This commit is contained in:
committed by
László Németh
parent
b77775de1a
commit
b7c542b508
@@ -1640,17 +1640,38 @@ static void lcl_GetConnectorAdjustValue(const Reference<XShape>& xShape, tools::
|
||||
}
|
||||
}
|
||||
|
||||
static sal_Int32 lcl_GetGluePointId(sal_Int32 nGluePointId)
|
||||
static sal_Int32 lcl_GetGluePointId(const Reference<XShape>& xShape, sal_Int32 nGluePointId)
|
||||
{
|
||||
if (nGluePointId > 3)
|
||||
return nGluePointId - 4;
|
||||
else
|
||||
{
|
||||
// change id of the bounding box (1 <-> 3)
|
||||
if (nGluePointId == 1)
|
||||
return 3; // Right
|
||||
else if (nGluePointId == 3)
|
||||
return 1; // Left
|
||||
bool bFlipH = false;
|
||||
bool bFlipV = false;
|
||||
Reference<XPropertySet> xShapeProps(xShape, UNO_QUERY);
|
||||
if (xShapeProps->getPropertySetInfo()->hasPropertyByName("CustomShapeGeometry"))
|
||||
{
|
||||
Sequence<PropertyValue> aGeometrySeq;
|
||||
xShapeProps->getPropertyValue("CustomShapeGeometry") >>= aGeometrySeq;
|
||||
for (int i = 0; i < aGeometrySeq.getLength(); i++)
|
||||
{
|
||||
const PropertyValue& rProp = aGeometrySeq[i];
|
||||
if (rProp.Name == "MirroredX")
|
||||
rProp.Value >>= bFlipH;
|
||||
|
||||
if (rProp.Name == "MirroredY")
|
||||
rProp.Value >>= bFlipV;
|
||||
}
|
||||
}
|
||||
|
||||
if ((!bFlipH && !bFlipV) || (bFlipH && bFlipV))
|
||||
{
|
||||
// change id of the bounding box (1 <-> 3)
|
||||
if (nGluePointId == 1)
|
||||
nGluePointId = 3; // Right
|
||||
else if (nGluePointId == 3)
|
||||
nGluePointId = 1; // Left
|
||||
}
|
||||
}
|
||||
|
||||
return nGluePointId;
|
||||
@@ -1708,12 +1729,12 @@ ShapeExport& ShapeExport::WriteConnectorShape( const Reference< XShape >& xShape
|
||||
if (GetProperty(rXPropSet, "StartGluePointIndex"))
|
||||
mAny >>= nStartGlueId;
|
||||
if (nStartGlueId != -1)
|
||||
nStartGlueId = lcl_GetGluePointId(nStartGlueId);
|
||||
nStartGlueId = lcl_GetGluePointId(rXShapeA, nStartGlueId);
|
||||
|
||||
if (GetProperty(rXPropSet, "EndGluePointIndex"))
|
||||
mAny >>= nEndGlueId;
|
||||
if (nEndGlueId != -1)
|
||||
nEndGlueId = lcl_GetGluePointId(nEndGlueId);
|
||||
nEndGlueId = lcl_GetGluePointId(rXShapeB, nEndGlueId);
|
||||
|
||||
// Position is relative to group in Word, but relative to anchor of group in API.
|
||||
if (GetDocumentType() == DOCUMENT_DOCX && !mbUserShapes && m_xParent.is())
|
||||
|
||||
@@ -659,11 +659,16 @@ void SlidePersist::createConnectorShapeConnection()
|
||||
nGlueId += 4;
|
||||
else
|
||||
{
|
||||
// change id of the left and right glue points of the bounding box (1 <-> 3)
|
||||
if (nGlueId == 1)
|
||||
nGlueId = 3; // Right
|
||||
else if (nGlueId == 3)
|
||||
nGlueId = 1; // Left
|
||||
bool bFlipH = pShape->second->getFlipH();
|
||||
bool bFlipV = pShape->second->getFlipV();
|
||||
if ((!bFlipH && !bFlipV) || (bFlipH && bFlipV))
|
||||
{
|
||||
// change id of the left and right glue points of the bounding box (1 <-> 3)
|
||||
if (nGlueId == 1)
|
||||
nGlueId = 3; // Right
|
||||
else if (nGlueId == 3)
|
||||
nGlueId = 1; // Left
|
||||
}
|
||||
}
|
||||
|
||||
bool bStart = aConnectorShapeProperties[j].mbStartShape;
|
||||
|
||||
Binary file not shown.
@@ -191,6 +191,30 @@ CPPUNIT_TEST_FIXTURE(SdImportTest, testDocumentLayout)
|
||||
}
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(SdImportTest, testTdf154363)
|
||||
{
|
||||
sal_Int32 nGlueId;
|
||||
createSdImpressDoc("pptx/tdf154363.pptx");
|
||||
{
|
||||
uno::Reference<beans::XPropertySet> xConnector1(getShapeFromPage(1, 0), uno::UNO_SET_THROW);
|
||||
uno::Reference<beans::XPropertySet> xConnector2(getShapeFromPage(3, 0), uno::UNO_SET_THROW);
|
||||
nGlueId = xConnector1->getPropertyValue("StartGluePointIndex").get<sal_Int32>();
|
||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), nGlueId);
|
||||
nGlueId = xConnector2->getPropertyValue("EndGluePointIndex").get<sal_Int32>();
|
||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), nGlueId);
|
||||
}
|
||||
|
||||
saveAndReload("Impress MS PowerPoint 2007 XML");
|
||||
{
|
||||
uno::Reference<beans::XPropertySet> xConnector1(getShapeFromPage(1, 0), uno::UNO_SET_THROW);
|
||||
uno::Reference<beans::XPropertySet> xConnector2(getShapeFromPage(3, 0), uno::UNO_SET_THROW);
|
||||
nGlueId = xConnector1->getPropertyValue("StartGluePointIndex").get<sal_Int32>();
|
||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), nGlueId);
|
||||
nGlueId = xConnector2->getPropertyValue("EndGluePointIndex").get<sal_Int32>();
|
||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), nGlueId);
|
||||
}
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(SdImportTest, testTdf153466)
|
||||
{
|
||||
createSdImpressDoc("pptx/tdf153466.pptx");
|
||||
|
||||
Reference in New Issue
Block a user