[Libreoffice-commits] core.git: filter/source sd/qa svx/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Mar 14 12:31:06 UTC 2019
filter/source/msfilter/msdffimp.cxx | 29 ++++++++++-----
sd/qa/unit/data/ppt/tdf122899_Arc_90_to_91_clockwise.ppt |binary
sd/qa/unit/import-tests.cxx | 29 +++++++++++++++
svx/source/customshapes/EnhancedCustomShapeGeometry.cxx | 4 +-
4 files changed, 52 insertions(+), 10 deletions(-)
New commits:
commit b795e540e4c4d31618a16ca8456476d5651a4d01
Author: Regina Henschel <rb.henschel at t-online.de>
AuthorDate: Fri Mar 8 19:02:13 2019 +0100
Commit: Regina Henschel <rb.henschel at t-online.de>
CommitDate: Thu Mar 14 13:30:41 2019 +0100
tdf#122899 use unsigned integer for mso_sptArc
The path coordinates were read as sal_Int16. But for a
mso_sptArc shape the values are unsigned integer. I correct
it for this shape type only, because I don't know, whether
other places actually need sal_Int16.
The change from 0xa504 to 0xa604 in the defaults means a
change from 'ClockwiseArcTo' to 'ClockwiseArc' so that an
implicit moveto is used, same as in VML command 'wr'.
Change-Id: Ib9c594c15d5a97048595efd644a4a6e8774fcefd
Reviewed-on: https://gerrit.libreoffice.org/68941
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel at t-online.de>
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index edf85fe7cbaa..c7a974008f4b 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -2169,12 +2169,25 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt
}
else
{
- sal_Int16 nTmpA(0), nTmpB(0);
- rIn.ReadInt16( nTmpA )
- .ReadInt16( nTmpB );
-
- nX = nTmpA;
- nY = nTmpB;
+ // The mso-spt19 (arc) uses this. But it needs unsigned integer. I don't
+ // know if other shape types also need it. They can be added as necessary.
+ bool bNeedsUnsigned = rObjData.eShapeType == mso_sptArc;
+ if (bNeedsUnsigned)
+ {
+ sal_uInt16 nTmpA(0), nTmpB(0);
+ rIn.ReadUInt16(nTmpA)
+ .ReadUInt16(nTmpB);
+ nX = nTmpA;
+ nY = nTmpB;
+ }
+ else
+ {
+ sal_Int16 nTmpA(0), nTmpB(0);
+ rIn.ReadInt16( nTmpA )
+ .ReadInt16( nTmpB );
+ nX = nTmpA;
+ nY = nTmpB;
+ }
}
EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( aCoordinates[ i ].First, nX );
EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( aCoordinates[ i ].Second, nY );
@@ -4528,8 +4541,8 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
sal_Int32 nX = 0, nY = 0;
seqCoordinates[ nPtNum ].First.Value >>= nX;
seqCoordinates[ nPtNum ].Second.Value >>= nY;
- aP.setX( nX );
- aP.setY( nY );
+ aP.setX(nX);
+ aP.setY(nY);
aXP[ static_cast<sal_uInt16>(nPtNum) ] = aP;
}
aPolyBoundRect = aXP.GetBoundRect();
diff --git a/sd/qa/unit/data/ppt/tdf122899_Arc_90_to_91_clockwise.ppt b/sd/qa/unit/data/ppt/tdf122899_Arc_90_to_91_clockwise.ppt
new file mode 100644
index 000000000000..9df17e9a8085
Binary files /dev/null and b/sd/qa/unit/data/ppt/tdf122899_Arc_90_to_91_clockwise.ppt differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 58eb86f3a9fa..ef62c5bfecdc 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -25,6 +25,7 @@
#include <editeng/numitem.hxx>
#include <editeng/lrspitem.hxx>
#include <editeng/postitem.hxx>
+#include <editeng/unoprnms.hxx>
#include <svl/style.hxx>
#include <sfx2/sfxsids.hrc>
@@ -195,6 +196,7 @@ public:
void testDescriptionImport();
void testTdf83247();
void testTdf47365();
+ void testTdf122899();
CPPUNIT_TEST_SUITE(SdImportTest);
@@ -282,6 +284,7 @@ public:
CPPUNIT_TEST(testDescriptionImport);
CPPUNIT_TEST(testTdf83247);
CPPUNIT_TEST(testTdf47365);
+ CPPUNIT_TEST(testTdf122899);
CPPUNIT_TEST_SUITE_END();
};
@@ -2696,6 +2699,32 @@ void SdImportTest::testTdf47365()
xDocShRef->DoClose();
}
+void SdImportTest::testTdf122899()
+{
+ // tdf122899 FILEOPEN: ppt: old kind arc from MS Office 97 is broken
+ // Error was, that the path coordinates of a mso_sptArc shape were read as sal_Int16
+ // although they are unsigned 16 bit. This leads to wrong positions of start and end
+ // point and results to a huge shape width in the test document.
+ OUString aSrc="sd/qa/unit/data/ppt/tdf122899_Arc_90_to_91_clockwise.ppt";
+ sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(aSrc), PPT);
+ uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(
+ xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_MESSAGE("Could not get XDrawPagesSupplier", xDrawPagesSupplier.is());
+ uno::Reference<drawing::XDrawPages> xDrawPages(xDrawPagesSupplier->getDrawPages());
+ uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPages->getByIndex(0), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_MESSAGE("Could not get xDrawPage", xDrawPage.is());
+ uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_MESSAGE("Could not get xShape", xShape.is());
+ awt::Rectangle aFrameRect;
+ uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_MESSAGE("Could not get the shape properties", xShapeProps.is());
+ xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_FRAMERECT) >>= aFrameRect;
+ // original width is 9cm, add some tolerance
+ CPPUNIT_ASSERT_LESS(static_cast<sal_Int32>(9020), aFrameRect.Width);
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
index 22533f893eae..ab6d19bcfa07 100644
--- a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
@@ -95,8 +95,8 @@ static const SvxMSDffVertPair mso_sptArcVert[] =
};
static const sal_uInt16 mso_sptArcSegm[] =
{
- 0xa504, 0xab00, 0x0001, 0x6001, 0x8000,
- 0xa504, 0xaa00, 0x8000
+ 0xa604, 0xab00, 0x0001, 0x6001, 0x8000,
+ 0xa604, 0xaa00, 0x8000
};
static const SvxMSDffCalculationData mso_sptArcCalc[] =
{
More information about the Libreoffice-commits
mailing list