sd/qa/unit/data/tdf155211_dashed_line.svg | 4 ++++ sd/qa/unit/uiimpress.cxx | 30 ++++++++++++++++++++++++++++++ svx/source/svdraw/svdfmtf.cxx | 2 ++ 3 files changed, 36 insertions(+)
New commits: commit 8546b081d668a90799a4c7357e7534adaa7730ce Author: Andreas Heinisch <andreas.heini...@yahoo.de> AuthorDate: Wed Dec 18 09:29:33 2024 +0100 Commit: Andreas Heinisch <andreas.heini...@yahoo.de> CommitDate: Thu Dec 19 11:36:28 2024 +0100 tdf#155211 - Change line style from solid to dashed Change line style from solid to dashed during GDI meta file import, if there exist dashed line properties. Change-Id: Ia5b88bd8513929969aed67b17494541da83b29d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178708 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heini...@yahoo.de> diff --git a/sd/qa/unit/data/tdf155211_dashed_line.svg b/sd/qa/unit/data/tdf155211_dashed_line.svg new file mode 100644 index 000000000000..fb0fc96159ad --- /dev/null +++ b/sd/qa/unit/data/tdf155211_dashed_line.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg width="200" height="100" xmlns="http://www.w3.org/2000/svg"> + <line x1="10" y1="50" x2="190" y2="50" stroke="black" stroke-width="2" stroke-dasharray="5,5" /> +</svg> diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx index a66c008f4db4..6d7c772afa15 100644 --- a/sd/qa/unit/uiimpress.cxx +++ b/sd/qa/unit/uiimpress.cxx @@ -13,6 +13,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/drawing/LineStyle.hpp> #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/XDrawView.hpp> #include <com/sun/star/drawing/XDrawPage.hpp> @@ -30,6 +31,7 @@ #include <svx/svxids.hrc> #include <svx/svdoashp.hxx> #include <svx/svdotable.hxx> +#include <svx/xlineit0.hxx> #include <svx/xfillit0.hxx> #include <svx/xflclit.hxx> #include <svx/xflgrit.hxx> @@ -346,6 +348,34 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf143412) CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pActualPage->GetObjCount()); } +CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf155211_dashed_line) +{ + createSdImpressDoc(); + + auto pXImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get()); + sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); + + SdPage* pActualPage = pViewShell->GetActualPage(); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), pActualPage->GetObjCount()); + + OUString aImageURL = createFileURL(u"tdf155211_dashed_line.svg"); + uno::Sequence<beans::PropertyValue> aArgs(comphelper::InitPropertySequence({ + { "FileName", uno::Any(aImageURL) }, + })); + dispatchCommand(mxComponent, u".uno:InsertGraphic"_ustr, aArgs); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pActualPage->GetObjCount()); + + // split the (auto-selected) svg + dispatchCommand(mxComponent, u".uno:Break"_ustr, {}); + + SdrObject* pObject = pActualPage->GetObj(2); + const XLineStyleItem& rStyleItem = pObject->GetMergedItem(XATTR_LINESTYLE); + // tdf#115162: Without the fix in place, this test would have failed with + // - Expected: 2 (LineStyle_DASH) + // - Actual : 1 (LineStyle_SOLID) + CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_DASH, rStyleItem.GetValue()); +} + CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf162455) { createSdImpressDoc(); diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index bcfc50453210..a79fb3a2f2a1 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -361,6 +361,8 @@ void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr if(((maDash.GetDots() && maDash.GetDotLen()) || (maDash.GetDashes() && maDash.GetDashLen())) && maDash.GetDistance()) { mpLineAttr->Put(XLineDashItem(OUString(), maDash)); + // tdf#155211 - change line style to dashed + mpLineAttr->Put(XLineStyleItem(drawing::LineStyle_DASH)); } else {