diff --git a/sw/qa/extras/uiwriter/data/placeholder-bold-cs.fodt b/sw/qa/extras/uiwriter/data/placeholder-bold-cs.fodt
new file mode 100644
index 000000000000..25f610ad92e0
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/placeholder-bold-cs.fodt
@@ -0,0 +1,115 @@
+
+
+ 2024-08-08T18:32:28.4200828172024-08-08T18:33:51.021911316PT1M27S1ZetaOffice/7.4.8.0.0$Linux_X86_64 LibreOffice_project/ab7057b1137e2241f51e62b58a0c605ec9a4b29c
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Test <replaceme>test
+
+
+
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index a030ad9c10f8..d169f76dbe09 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -11,6 +11,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -18,6 +19,7 @@
#include
#include
#include
+#include
#include
#include
@@ -86,6 +88,48 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testPlaceholderHTMLPaste)
getProperty(getRun(getParagraph(4), 1, u" test"_ustr), u"CharWeight"_ustr));
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testPlaceholderHTMLInsert)
+{
+ createSwDoc("placeholder-bold-cs.fodt");
+
+ // select placeholder field
+ uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference xCursor{ xTextDocument->getText()->createTextCursor() };
+ xCursor->gotoStart(false);
+ xCursor->goRight(5, false);
+ xCursor->goRight(1, true);
+
+ sal_Int8 const html[] = "AAA
BBB
CCC
";
+ uno::Reference xStream{ new comphelper::MemoryInputStream{ html,
+ sizeof(html) } };
+
+ // insert HTML file
+ uno::Sequence aPropertyValues = comphelper::InitPropertySequence(
+ { { "InputStream", uno::Any(xStream) },
+ { "Hidden", uno::Any(true) },
+ { "FilterName", uno::Any(u"HTML (StarWriter)"_ustr) } });
+
+ uno::Reference xDocInsert{ xCursor, uno::UNO_QUERY };
+ xDocInsert->insertDocumentFromURL("private:stream", aPropertyValues);
+
+ CPPUNIT_ASSERT_EQUAL(int(4), getParagraphs());
+
+ CPPUNIT_ASSERT_EQUAL(
+ awt::FontWeight::NORMAL,
+ getProperty(getRun(getParagraph(1), 1, u"Test "_ustr), u"CharWeight"_ustr));
+ CPPUNIT_ASSERT_EQUAL(
+ awt::FontWeight::BOLD,
+ getProperty(getRun(getParagraph(1), 2, u"AAA"_ustr), u"CharWeight"_ustr));
+ CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD,
+ getProperty(getParagraph(2), u"CharWeight"_ustr));
+ CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD,
+ getProperty(getParagraph(3), u"CharWeight"_ustr));
+ CPPUNIT_ASSERT_EQUAL(
+ awt::FontWeight::NORMAL,
+ getProperty(getRun(getParagraph(4), 1, u" test"_ustr), u"CharWeight"_ustr));
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf151974)
{
createSwDoc("tdf151974.odt");
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index e838e2868fa8..fb0ed452336f 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -580,11 +580,11 @@ SvParserState SwHTMLParser::CallParser()
aInsertionRangePam.Move( fnMoveBackward );
m_xDoc->getIDocumentRedlineAccess().SplitRedline( aInsertionRangePam );
- if (SwAttrSet const*const pAttrs = pPos->GetNode().GetTextNode()->GetpSwAttrSet())
+ ::std::unique_ptr pSet{new SfxItemSet(m_xDoc->GetAttrPool(),
+ svl::Items)};
+ if (pPos->GetNode().GetTextNode()->GetParaAttr(*pSet, 0, 0, false, false))
{
- m_pTargetCharAttrs.reset(new SfxItemSet(*pAttrs->GetPool(),
- svl::Items));
- m_pTargetCharAttrs->Put(*pAttrs);
+ m_pTargetCharAttrs = std::move(pSet);
}
m_xDoc->SetTextFormatColl( *m_pPam,