sw/qa/extras/ww8export/data/tdf77964.doc |binary
 sw/qa/extras/ww8export/ww8export4.cxx    |    7 +++++++
 sw/source/filter/ww8/ww8par.cxx          |    8 +++++++-
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit ba8f6ca5b3f7710a27928add8e29c725d9f40901
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Sat Aug 13 12:29:12 2022 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Sun Aug 14 04:37:37 2022 +0200

    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 <jl...@mail.com>

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 <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)

Reply via email to