From ba8f6ca5b3f7710a27928add8e29c725d9f40901 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Sat, 13 Aug 2022 12:29:12 -0400 Subject: tdf#77964 doc import: 0x1 placeholder is for AS_CHAR It looks like MS always provides an sprm that confirms this, but Kingsoft was saving without that sprm. Something similar ought to be done for ImportOLE, but it doesn't have a ready option for specifying that, so I just left it because I don't care about OLE. Change-Id: I0ae304a08b381c8c29f3db24f791f25f5e33b0c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138234 Tested-by: Jenkins Reviewed-by: Justin Luth --- sw/qa/extras/ww8export/data/tdf77964.doc | Bin 0 -> 248320 bytes sw/qa/extras/ww8export/ww8export4.cxx | 7 +++++++ sw/source/filter/ww8/ww8par.cxx | 8 +++++++- 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 sw/qa/extras/ww8export/data/tdf77964.doc diff --git a/sw/qa/extras/ww8export/data/tdf77964.doc b/sw/qa/extras/ww8export/data/tdf77964.doc new file mode 100644 index 000000000000..6ef50ab15834 Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf77964.doc differ diff --git a/sw/qa/extras/ww8export/ww8export4.cxx b/sw/qa/extras/ww8export/ww8export4.cxx index 91b9477a996f..bc0d51ff529e 100644 --- a/sw/qa/extras/ww8export/ww8export4.cxx +++ b/sw/qa/extras/ww8export/ww8export4.cxx @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -48,6 +49,12 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf148360) assertXPath(pLayout, "/root/page[1]/body/txt[1]/Text[2]", "nType", "PortionType::Text"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf77964) +{ + loadAndReload("tdf77964.doc"); + // both images were loading as AT_PARA instead of AS_CHAR. Image2 visually had text wrapping. + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, getProperty(getShapeByName(u"Image2"), "AnchorType")); +} CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index d7e2d418d47b..f9d5a4e76b54 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -3727,7 +3727,13 @@ bool SwWW8ImplReader::ReadChar(tools::Long nPosCp, tools::Long nCpOfs) if (m_bObj) pResult = ImportOle(); else if (m_bSpec) - pResult = ImportGraf(); + { + SwFrameFormat* pAsCharFlyFormat = m_rDoc.GetDfltFrameFormat(); + SwFormatAnchor aAnchor(RndStdIds::FLY_AS_CHAR); + pAsCharFlyFormat->SetFormatAttr(aAnchor); + pResult = ImportGraf(nullptr, pAsCharFlyFormat); + } + // If we have a bad 0x1 insert a space instead. if (!pResult) -- cgit