oox/source/drawingml/lineproperties.cxx | 2 +- oox/source/export/drawingml.cxx | 2 +- sd/qa/unit/data/pptx/tdf126741.pptx |binary sd/qa/unit/export-tests-ooxml2.cxx | 30 ++++++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-)
New commits: commit e2b16c5660a8f3f72c1d1ba74ce565e8628b3dbb Author: nd101 <f...@nd.com.cn> AuthorDate: Wed Aug 14 16:07:22 2019 +0800 Commit: Regina Henschel <rb.hensc...@t-online.de> CommitDate: Fri Aug 23 13:20:08 2019 +0200 tdf#126741 - fix dash dot dot line style import problem, for pptx To make it consistent with MS PowerPoint, make the dash dot dot line start with dash instead of dots. Based on Regina Henschel's technical analysis and code pointers, but only make change to the lgDashDotDot case and leave everything else untouched. Change-Id: Ide533a562005c617eca9d556a63b6aec39017e93 Reviewed-on: https://gerrit.libreoffice.org/77443 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.hensc...@t-online.de> diff --git a/oox/source/drawingml/lineproperties.cxx b/oox/source/drawingml/lineproperties.cxx index a7ea2396e65d..1139273a1831 100644 --- a/oox/source/drawingml/lineproperties.cxx +++ b/oox/source/drawingml/lineproperties.cxx @@ -67,7 +67,7 @@ void lclConvertPresetDash(LineDash& orLineDash, sal_Int32 nPresetDash, sal_Int32 case XML_lgDash: lclSetDashData( orLineDash, 0, 0, 1, 8, 3 ); break; case XML_lgDashDot: lclSetDashData( orLineDash, 1, 1, 1, 8, 3 ); break; - case XML_lgDashDotDot: lclSetDashData( orLineDash, 2, 1, 1, 8, 3 ); break; + case XML_lgDashDotDot: lclSetDashData( orLineDash, 1, 8, 2, 1, 3 ); break; case XML_sysDot: lclSetDashData( orLineDash, 1, 1, 0, 0, 1 ); break; case XML_sysDash: lclSetDashData( orLineDash, 0, 0, 1, 3, 1 ); break; diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 6f975a298e50..27dd7e5b2a16 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -897,7 +897,7 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet, Referenc { mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, "lgDashDot"); } - else if (aLineDash.Dots == 2 && relDotLen == 1 && aLineDash.Dashes == 1 && relDashLen == 8 && relDistance == 3) + else if (aLineDash.Dots == 1 && relDotLen == 8 && aLineDash.Dashes == 2 && relDashLen == 1 && relDistance == 3) { mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, "lgDashDotDot"); } diff --git a/sd/qa/unit/data/pptx/tdf126741.pptx b/sd/qa/unit/data/pptx/tdf126741.pptx new file mode 100644 index 000000000000..ca74d1c34914 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf126741.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index d17122744fdb..dc1c4246ff35 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -39,6 +39,8 @@ #include <svx/svdomedia.hxx> #include <svx/svdoole2.hxx> #include <svx/xflclit.hxx> +#include <svx/xlineit0.hxx> +#include <svx/xlndsit.hxx> #include <animations/animationnodehelper.hxx> #include <unotools/mediadescriptor.hxx> #include <rtl/ustring.hxx> @@ -216,6 +218,7 @@ public: void testTdf125360_2(); void testTdf125551(); void testTdf126234(); + void testTdf126741(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); @@ -309,6 +312,7 @@ public: CPPUNIT_TEST(testTdf125360_2); CPPUNIT_TEST(testTdf125551); CPPUNIT_TEST(testTdf126234); + CPPUNIT_TEST(testTdf126741); CPPUNIT_TEST_SUITE_END(); @@ -2508,6 +2512,32 @@ void SdOOXMLExportTest2::testTdf126234() xDocShRef->DoClose(); } +void SdOOXMLExportTest2::testTdf126741() +{ + sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf126741.pptx"), PPTX ); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + + // dash dot dot line style import fix + const SdrPage *pPage = GetPage( 1, xDocShRef ); + SdrObject *const pObj = pPage->GetObj(0); + CPPUNIT_ASSERT(pObj); + + const XLineStyleItem& rStyleItem = dynamic_cast<const XLineStyleItem&>( + pObj->GetMergedItem(XATTR_LINESTYLE)); + const XLineDashItem& rDashItem = dynamic_cast<const XLineDashItem&>( + pObj->GetMergedItem(XATTR_LINEDASH)); + + CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_DASH, rStyleItem.GetValue()); + CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), rDashItem.GetDashValue().GetDots()); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(280), rDashItem.GetDashValue().GetDotLen()); + CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), rDashItem.GetDashValue().GetDashes()); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(35), rDashItem.GetDashValue().GetDashLen()); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(105), rDashItem.GetDashValue().GetDistance()); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits