diff options
author | Justin Luth <jluth@mail.com> | 2022-08-13 12:29:12 -0400 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2022-08-14 04:37:37 +0200 |
commit | ba8f6ca5b3f7710a27928add8e29c725d9f40901 (patch) | |
tree | 72c7631afd1eaa1c3c52091c3c50447209d56151 | |
parent | df3b7599f5ad92337a495224f53a1299cc82e97e (diff) |
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 <jluth@mail.com>
-rw-r--r-- | sw/qa/extras/ww8export/data/tdf77964.doc | bin | 0 -> 248320 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export4.cxx | 7 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 8 |
3 files changed, 14 insertions, 1 deletions
diff --git a/sw/qa/extras/ww8export/data/tdf77964.doc b/sw/qa/extras/ww8export/data/tdf77964.doc Binary files differnew file mode 100644 index 000000000000..6ef50ab15834 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf77964.doc 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 <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/text/TextContentAnchorType.hpp> #include <com/sun/star/text/XTextDocument.hpp> #include <comphelper/sequenceashashmap.hxx> @@ -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<text::TextContentAnchorType>(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) |