sd/qa/unit/data/tdf169813_prevent_unintended_dashed_line.svg |    1 
 sd/qa/unit/uiimpress.cxx                                     |   28 +++++++++++
 svx/source/svdraw/svdfmtf.cxx                                |    9 +--
 3 files changed, 34 insertions(+), 4 deletions(-)

New commits:
commit d7e4c02cfb7b133fff06251e844d0694f4e3c457
Author:     Andreas Heinisch <[email protected]>
AuthorDate: Sun Dec 28 12:36:01 2025 +0100
Commit:     Andreas Heinisch <[email protected]>
CommitDate: Sun Jan 4 11:52:48 2026 +0100

    tdf#169813 - Reset default dash option during GDIMetaFileImport
    
    Prevent default constructor dash settings from affecting non-dashed
    line segements.
    
    Change-Id: I082f03a2a0fc92f8f319e6e82e496c6ee72386b6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196264
    Tested-by: Jenkins
    Reviewed-by: Andreas Heinisch <[email protected]>

diff --git a/sd/qa/unit/data/tdf169813_prevent_unintended_dashed_line.svg 
b/sd/qa/unit/data/tdf169813_prevent_unintended_dashed_line.svg
new file mode 100644
index 000000000000..cfb8e90299a2
--- /dev/null
+++ b/sd/qa/unit/data/tdf169813_prevent_unintended_dashed_line.svg
@@ -0,0 +1 @@
+<svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg";><polyline 
points="50,40 150,30" fill="none" stroke="#000" stroke-width="2.73" 
stroke-linejoin="bevel"/><path d="m100 40 8.835-1.78v11.5"/></svg>
diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index 215af8589928..638e367ca2da 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -507,6 +507,34 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, 
testTdf155211_dashed_line)
     CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_DASH, rStyleItem.GetValue());
 }
 
+CPPUNIT_TEST_FIXTURE(SdUiImpressTest, 
testTdf169813_prevent_unintended_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"tdf169813_prevent_unintended_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(3);
+    const XLineStyleItem& rStyleItem = pObject->GetMergedItem(XATTR_LINESTYLE);
+    // tdf#169813: Without the fix in place, this test would have failed with
+    // - Expected: 0 (LineStyle_NONE)
+    // - Actual  : 2 (LineStyle_DASH)
+    CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_NONE, rStyleItem.GetValue());
+}
+
 CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf162455)
 {
     createSdImpressDoc();
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index 19a8cc8268d8..69a7dfcd36dd 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -88,7 +88,6 @@ ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport(
     mnLineWidth(0),
     maLineJoin(basegfx::B2DLineJoin::NONE),
     maLineCap(css::drawing::LineCap_BUTT),
-    maDash(css::drawing::DashStyle_RECT, 0, 0, 0, 0, 0),
     mbMov(false),
     mbSize(false),
     maOfs(0, 0),
@@ -367,7 +366,7 @@ void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* 
pObj, bool bForceTextAttr
         }
         else
         {
-            mpLineAttr->Put(XLineDashItem(OUString(), 
XDash(css::drawing::DashStyle_RECT)));
+            mpLineAttr->Put(XLineDashItem(OUString(), XDash()));
         }
     }
     else
@@ -695,7 +694,8 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaLineAction const 
& rAct)
     SetAttributes(pPath.get());
     mnLineWidth = 0;
     maLineJoin = basegfx::B2DLineJoin::NONE;
-    maDash = XDash();
+    // tdf#169813 - reset default dash options
+    maDash = XDash(css::drawing::DashStyle_RECT, 0, 0, 0, 0, 0);
     InsertObj(pPath.get(), false);
 }
 
@@ -943,7 +943,8 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaPolyLineAction 
const & rAct )
     SetAttributes(pPath.get());
     mnLineWidth = 0;
     maLineJoin = basegfx::B2DLineJoin::NONE;
-    maDash = XDash();
+    // tdf#169813 - reset default dash options
+    maDash = XDash(css::drawing::DashStyle_RECT, 0, 0, 0, 0, 0);
     InsertObj(pPath.get(), false);
 }
 

Reply via email to