summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornd101 <Fong@nd.com.cn>2019-08-14 16:07:22 +0800
committerRegina Henschel <rb.henschel@t-online.de>2019-08-23 13:20:08 +0200
commite2b16c5660a8f3f72c1d1ba74ce565e8628b3dbb (patch)
tree985db65cf79ed2e813480823c1b1baa206ff2d32
parent54b47a81fdba4fb42f7f5eaee65292014567cd29 (diff)
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.henschel@t-online.de>
-rw-r--r--oox/source/drawingml/lineproperties.cxx2
-rw-r--r--oox/source/export/drawingml.cxx2
-rw-r--r--sd/qa/unit/data/pptx/tdf126741.pptxbin0 -> 32437 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml2.cxx30
4 files changed, 32 insertions, 2 deletions
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
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf126741.pptx
Binary files 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();