sw/source/filter/ww8/ww8par.cxx                             |   80 ---------
 sw/source/filter/ww8/ww8par.hxx                             |    3 
 sw/source/filter/ww8/ww8par2.cxx                            |    2 
 sw/source/filter/ww8/ww8par6.cxx                            |   47 +----
 sw/source/filter/ww8/ww8struc.hxx                           |    1 
 writerfilter/CppunitTest_writerfilter_rtftok.mk             |    1 
 writerfilter/qa/cppunittests/rtftok/data/floating-table.rtf |   10 +
 writerfilter/qa/cppunittests/rtftok/rtfdispatchflag.cxx     |   70 ++++++++
 writerfilter/source/rtftok/rtfdispatchflag.cxx              |   97 ++++++++++++
 writerfilter/source/rtftok/rtfdispatchvalue.cxx             |   66 ++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.hxx              |    5 
 11 files changed, 262 insertions(+), 120 deletions(-)

New commits:
commit 10b4b470238a92b5477f0a99ef65356032276163
Author:     Miklos Vajna <[email protected]>
AuthorDate: Fri Apr 21 07:05:26 2023 +0200
Commit:     Miklos Vajna <[email protected]>
CommitDate: Wed Apr 26 11:06:41 2023 +0200

    sw floatable: teach the RTF import about SwFormatFlySplit
    
    - if the document has no \nobrkwrptbl, then ignore all floating table
      control word for now
    
    - map the rest of the RTF control words to OOXML attributes under the
      NS_ooxml::LN_CT_TblPrBase_tblpPr sprm:
    
     - \tpv{para,mrg,pg} -> NS_ooxml::LN_CT_TblPPr_vertAnchor
    
     - \tph{col,mrg,pg} -> NS_ooxml::LN_CT_TblPPr_horzAnchor
    
     - \tposy -> NS_ooxml::LN_CT_TblPPr_tblpY
    
     - \tposy{c,b} -> NS_ooxml::LN_CT_TblPPr_tblpYSpec
    
     - \tposx -> NS_ooxml::LN_CT_TblPPr_tblpX
    
     - \tposx{c,r} -> NS_ooxml::LN_CT_TblPPr_tblpXSpec
    
     - \tdfrmtxtLeft -> NS_ooxml::LN_CT_TblPPr_leftFromText
    
     - \tdfrmtxtRight -> NS_ooxml::LN_CT_TblPPr_rightFromText
    
     - \tdfrmtxtTop -> NS_ooxml::LN_CT_TblPPr_topFromText
    
     - \tdfrmtxtBottom -> NS_ooxml::LN_CT_TblPPr_bottomFromText
    
    (cherry picked from commit 05425f73bfa41d3f7591461e2ad0beb4fafc39b4)
    
    Change-Id: I0b30d0eba8c1b7b6d3497334c958146717d06552
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150900
    Tested-by: Miklos Vajna <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/writerfilter/CppunitTest_writerfilter_rtftok.mk 
b/writerfilter/CppunitTest_writerfilter_rtftok.mk
index 990aa6596d3d..2c91cbb8cb2f 100644
--- a/writerfilter/CppunitTest_writerfilter_rtftok.mk
+++ b/writerfilter/CppunitTest_writerfilter_rtftok.mk
@@ -16,6 +16,7 @@ $(eval $(call 
gb_CppunitTest_use_externals,writerfilter_rtftok,\
 ))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,writerfilter_rtftok, \
+    writerfilter/qa/cppunittests/rtftok/rtfdispatchflag \
     writerfilter/qa/cppunittests/rtftok/rtfdispatchsymbol \
     writerfilter/qa/cppunittests/rtftok/rtfdispatchvalue \
     writerfilter/qa/cppunittests/rtftok/rtfdocumentimpl \
diff --git a/writerfilter/qa/cppunittests/rtftok/data/floating-table.rtf 
b/writerfilter/qa/cppunittests/rtftok/data/floating-table.rtf
new file mode 100644
index 000000000000..b88664139070
--- /dev/null
+++ b/writerfilter/qa/cppunittests/rtftok/data/floating-table.rtf
@@ -0,0 +1,10 @@
+{\rtf1
+\paperw12240\paperh6203\margl1440\margr1440\margt1440\margb1440\nobrkwrptbl
+\pard\plain First paragraph\par
+\pard\plain\intbl A1\cell
+\pard\plain\trowd\trrh1812\tpvpara\tphcol\tposy10\tposx20\tdfrmtxtLeft30\tdfrmtxtRight40\cellx3828\row
+\pard\plain\intbl A2\cell
+\pard\plain\trowd\trrh1812\tpvpara\tphcol\tposy10\tposx20\tdfrmtxtLeft30\tdfrmtxtRight40\cellx3828\row
+\pard\plain Second paragraph.
+\par
+}
diff --git a/writerfilter/qa/cppunittests/rtftok/rtfdispatchflag.cxx 
b/writerfilter/qa/cppunittests/rtftok/rtfdispatchflag.cxx
new file mode 100644
index 000000000000..810dc750d7d7
--- /dev/null
+++ b/writerfilter/qa/cppunittests/rtftok/rtfdispatchflag.cxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/text/RelOrientation.hpp>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+/// Tests for writerfilter/source/rtftok/rtfdispatchflag.cxx.
+class Test : public UnoApiTest
+{
+public:
+    Test()
+        : UnoApiTest("/writerfilter/qa/cppunittests/rtftok/data/")
+    {
+    }
+};
+
+CPPUNIT_TEST_FIXTURE(Test, testFloatingTable)
+{
+    // Given a document with a floating table, when importing that document:
+    loadFromURL(u"floating-table.rtf");
+
+    // Then make sure the floating table is there & has the expected 
properties:
+    uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+    uno::Reference<drawing::XDrawPage> xDrawPage = 
xDrawPageSupplier->getDrawPage();
+    // Without the accompanying fix in place, this test would have failed with:
+    // An uncaught exception of type 
com.sun.star.lang.IndexOutOfBoundsException
+    // i.e. the table was not floating / was not in a fly frame.
+    uno::Reference<beans::XPropertySet> xFrame(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
+    bool bIsSplitAllowed{};
+    xFrame->getPropertyValue("IsSplitAllowed") >>= bIsSplitAllowed;
+    CPPUNIT_ASSERT(bIsSplitAllowed);
+    sal_Int16 nVertOrientRelation{};
+    xFrame->getPropertyValue("VertOrientRelation") >>= nVertOrientRelation;
+    CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, nVertOrientRelation);
+    sal_Int16 nHoriOrientRelation{};
+    xFrame->getPropertyValue("HoriOrientRelation") >>= nHoriOrientRelation;
+    CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, nHoriOrientRelation);
+    sal_Int32 nVertOrientPosition{};
+    xFrame->getPropertyValue("VertOrientPosition") >>= nVertOrientPosition;
+    sal_Int32 nExpected = o3tl::convert(10, o3tl::Length::twip, 
o3tl::Length::mm100);
+    CPPUNIT_ASSERT_EQUAL(nExpected, nVertOrientPosition);
+    sal_Int32 nHoriOrientPosition{};
+    xFrame->getPropertyValue("HoriOrientPosition") >>= nHoriOrientPosition;
+    nExpected = o3tl::convert(20, o3tl::Length::twip, o3tl::Length::mm100);
+    CPPUNIT_ASSERT_EQUAL(nExpected, nHoriOrientPosition);
+    sal_Int32 nLeftMargin{};
+    xFrame->getPropertyValue("LeftMargin") >>= nLeftMargin;
+    nExpected = o3tl::convert(30, o3tl::Length::twip, o3tl::Length::mm100);
+    CPPUNIT_ASSERT_EQUAL(nExpected, nLeftMargin);
+    sal_Int32 nRightMargin{};
+    xFrame->getPropertyValue("RightMargin") >>= nRightMargin;
+    nExpected = o3tl::convert(40, o3tl::Length::twip, o3tl::Length::mm100);
+    CPPUNIT_ASSERT_EQUAL(nExpected, nRightMargin);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx 
b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index 0ef4f21729d6..bc3c3037e16d 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -32,6 +32,93 @@ using namespace com::sun::star;
 
 namespace writerfilter::rtftok
 {
+bool RTFDocumentImpl::dispatchFloatingTableFlag(RTFKeyword nKeyword)
+{
+    if (!m_bBreakWrappedTables)
+    {
+        return false;
+    }
+
+    // Positioned Wrapped Tables
+    OUString aParam;
+    switch (nKeyword)
+    {
+        case RTFKeyword::TPVPARA:
+            aParam = "text";
+            break;
+        case RTFKeyword::TPVMRG:
+            aParam = "margin";
+            break;
+        case RTFKeyword::TPVPG:
+            aParam = "page";
+            break;
+        default:
+            break;
+    }
+    if (!aParam.isEmpty())
+    {
+        putNestedAttribute(m_aStates.top().getTableRowSprms(), 
NS_ooxml::LN_CT_TblPrBase_tblpPr,
+                           NS_ooxml::LN_CT_TblPPr_vertAnchor, new 
RTFValue(aParam));
+        return true;
+    }
+    switch (nKeyword)
+    {
+        case RTFKeyword::TPHCOL:
+            aParam = "text";
+            break;
+        case RTFKeyword::TPHMRG:
+            aParam = "margin";
+            break;
+        case RTFKeyword::TPHPG:
+            aParam = "page";
+            break;
+        default:
+            break;
+    }
+    if (!aParam.isEmpty())
+    {
+        putNestedAttribute(m_aStates.top().getTableRowSprms(), 
NS_ooxml::LN_CT_TblPrBase_tblpPr,
+                           NS_ooxml::LN_CT_TblPPr_horzAnchor, new 
RTFValue(aParam));
+        return true;
+    }
+    switch (nKeyword)
+    {
+        case RTFKeyword::TPOSYC:
+            aParam = "center";
+            break;
+        case RTFKeyword::TPOSYB:
+            aParam = "bottom";
+            break;
+        default:
+            break;
+    }
+    if (!aParam.isEmpty())
+    {
+        putNestedAttribute(m_aStates.top().getTableRowSprms(), 
NS_ooxml::LN_CT_TblPrBase_tblpPr,
+                           NS_ooxml::LN_CT_TblPPr_tblpYSpec, new 
RTFValue(aParam));
+        return true;
+    }
+    switch (nKeyword)
+    {
+        case RTFKeyword::TPOSXC:
+            aParam = "center";
+            break;
+        case RTFKeyword::TPOSXR:
+            aParam = "right";
+            break;
+        default:
+            break;
+    }
+    if (!aParam.isEmpty())
+    {
+        putNestedAttribute(m_aStates.top().getTableRowSprms(), 
NS_ooxml::LN_CT_TblPrBase_tblpPr,
+                           NS_ooxml::LN_CT_TblPPr_tblpXSpec, new 
RTFValue(aParam));
+        return true;
+    }
+
+    return false;
+}
+
 RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
 {
     setNeedSect(true);
@@ -442,6 +529,11 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
         return RTFError::OK;
     }
 
+    if (dispatchFloatingTableFlag(nKeyword))
+    {
+        return RTFError::OK;
+    }
+
     switch (nKeyword)
     {
         case RTFKeyword::FNIL:
@@ -1243,6 +1335,11 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword 
nKeyword)
                 m_aStates.top().setFieldLocked(true);
         }
         break;
+        case RTFKeyword::NOBRKWRPTBL:
+        {
+            m_bBreakWrappedTables = true;
+        }
+        break;
         default:
         {
             SAL_INFO("writerfilter", "TODO handle flag '" << 
keywordToString(nKeyword) << "'");
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx 
b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index a56d8e00d819..f580ec69c5e9 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -1823,6 +1823,72 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword 
nKeyword, int nParam)
             }
         }
         break;
+        case RTFKeyword::TPOSY:
+        {
+            if (!m_bBreakWrappedTables)
+            {
+                break;
+            }
+
+            putNestedAttribute(m_aStates.top().getTableRowSprms(), 
NS_ooxml::LN_CT_TblPrBase_tblpPr,
+                               NS_ooxml::LN_CT_TblPPr_tblpY, new 
RTFValue(nParam));
+        }
+        break;
+        case RTFKeyword::TPOSX:
+        {
+            if (!m_bBreakWrappedTables)
+            {
+                break;
+            }
+
+            putNestedAttribute(m_aStates.top().getTableRowSprms(), 
NS_ooxml::LN_CT_TblPrBase_tblpPr,
+                               NS_ooxml::LN_CT_TblPPr_tblpX, new 
RTFValue(nParam));
+        }
+        break;
+        case RTFKeyword::TDFRMTXTLEFT:
+        {
+            if (!m_bBreakWrappedTables)
+            {
+                break;
+            }
+
+            putNestedAttribute(m_aStates.top().getTableRowSprms(), 
NS_ooxml::LN_CT_TblPrBase_tblpPr,
+                               NS_ooxml::LN_CT_TblPPr_leftFromText, new 
RTFValue(nParam));
+        }
+        break;
+        case RTFKeyword::TDFRMTXTRIGHT:
+        {
+            if (!m_bBreakWrappedTables)
+            {
+                break;
+            }
+
+            putNestedAttribute(m_aStates.top().getTableRowSprms(), 
NS_ooxml::LN_CT_TblPrBase_tblpPr,
+                               NS_ooxml::LN_CT_TblPPr_rightFromText, new 
RTFValue(nParam));
+        }
+        break;
+        case RTFKeyword::TDFRMTXTTOP:
+        {
+            if (!m_bBreakWrappedTables)
+            {
+                break;
+            }
+
+            putNestedAttribute(m_aStates.top().getTableRowSprms(), 
NS_ooxml::LN_CT_TblPrBase_tblpPr,
+                               NS_ooxml::LN_CT_TblPPr_topFromText, new 
RTFValue(nParam));
+        }
+        break;
+        case RTFKeyword::TDFRMTXTBOTTOM:
+        {
+            if (!m_bBreakWrappedTables)
+            {
+                break;
+            }
+
+            putNestedAttribute(m_aStates.top().getTableRowSprms(), 
NS_ooxml::LN_CT_TblPrBase_tblpPr,
+                               NS_ooxml::LN_CT_TblPPr_bottomFromText, new 
RTFValue(nParam));
+        }
+        break;
         default:
         {
             SAL_INFO("writerfilter", "TODO handle value '" << 
keywordToString(nKeyword) << "'");
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 71ecd06c8cd8..bf1ff2c30611 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -701,6 +701,8 @@ public:
     // RTFListener
     RTFError dispatchDestination(RTFKeyword nKeyword) override;
     RTFError dispatchFlag(RTFKeyword nKeyword) override;
+    /// Dispatches flags related to Positioned Wrapped Tables.
+    bool dispatchFloatingTableFlag(RTFKeyword nKeyword);
     RTFError dispatchSymbol(RTFKeyword nKeyword) override;
     RTFError dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam) 
override;
     RTFError dispatchValue(RTFKeyword nKeyword, int nParam) override;
@@ -989,6 +991,9 @@ private:
 
     /// Are we after a \cell, but before a \row?
     bool m_bAfterCellBeforeRow;
+
+    /// Floating tables are single-page by default.
+    bool m_bBreakWrappedTables = false;
 };
 } // namespace writerfilter::rtftok
 
commit e450cc5dcc84fb77ac8d655303c01ef795507be0
Author:     Miklos Vajna <[email protected]>
AuthorDate: Thu Apr 20 13:41:47 2023 +0200
Commit:     Miklos Vajna <[email protected]>
CommitDate: Wed Apr 26 11:06:33 2023 +0200

    sw floattable: remove no longer needed DOC import heuristics
    
    Now that IsFlySplitAllowed() is true, bNoFly and related code in can go
    in sw/source/filter/ww8/.
    
    (cherry picked from commit 6e8a89b762d625adc10227402de506c7a632e073)
    
    Change-Id: I5c3eb4002151af3436c596ccca72d5de7ec690dd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150743
    Tested-by: Miklos Vajna <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index b5733757216a..d751ec873b1e 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2573,86 +2573,6 @@ void SwWW8ImplReader::EndSpecial()
     OSL_ENSURE(!m_nInTable, "unclosed table!");
 }
 
-bool SwWW8ImplReader::FloatingTableConversion(WW8PLCFx_Cp_FKP* pPap)
-{
-    // This is ww8 version of the code deciding if the table needs to be
-    // in a floating frame.
-
-    // Note that this is just a list of heuristics till sw core can have a
-    // table that is floating and can span over multiple pages at the same
-    // time.
-
-    // If the floating table is in a header or footer, then it won't be a
-    // multi-page one, so can always do the conversion.
-    if (m_bIsHeader || m_bIsFooter)
-    {
-        return true;
-    }
-
-    bool bResult = true;
-
-    SprmResult aRes = pPap->HasSprm(NS_sprm::TDefTable::val);
-    if (nullptr != aRes.pSprm)
-    {
-        bResult = false;
-        WW8TabBandDesc aDesc;
-        aDesc.ReadDef(false, aRes.pSprm, aRes.nRemainingData);
-        int nTextAreaWidth = m_aSectionManager.GetTextAreaWidth();
-        int nTableWidth = aDesc.nCenter[aDesc.nWwCols] - aDesc.nCenter[0];
-
-        // It seems Word has a limit here, so that in case the table width is 
quite
-        // close to the text area width, then it won't perform a wrapping, 
even in
-        // case the content (e.g. an empty paragraph) would fit. The magic 
constant
-        // here represents this limit.
-        const int nMagicNumber = 469;
-
-        // If the table is wider than the text area, then don't create a fly
-        // for the table: no wrapping will be performed anyway, but multi-page
-        // tables will be broken.
-        if ((nTableWidth + nMagicNumber) < nTextAreaWidth)
-            bResult = true;
-
-        // If there are columns, do create a fly, as the flow of the columns
-        // would otherwise restrict the table.
-        if (!bResult && (m_aSectionManager.CurrentSectionColCount() >= 2))
-            bResult = true;
-    }
-
-    if (bResult)
-    {
-        WW8PLCFxSave1 aSave;
-        pPap->Save(aSave);
-        if (SearchTableEnd(pPap))
-        {
-            // Table is considered to be imported into a fly frame and we
-            // know where the end of the table is.
-            bool bIsUnicode;
-            WW8_FC nFc = m_xSBase->WW8Cp2Fc(pPap->Where(), &bIsUnicode);
-            sal_uInt64 nPos = m_pStrm->Tell();
-            m_pStrm->Seek(nFc);
-            sal_uInt16 nUChar = 0;
-            if (bIsUnicode)
-                m_pStrm->ReadUInt16(nUChar);
-            else
-            {
-                sal_uInt8 nChar = 0;
-                m_pStrm->ReadUChar(nChar);
-                nUChar = nChar;
-            }
-            m_pStrm->Seek(nPos);
-            if (nUChar == 0xc)
-                // The pap after the table starts with a page break, so
-                // there will be no wrapping around the float-table.
-                // Request no fly in this case, so the table can properly
-                // be a multi-page one if necessary.
-                bResult = false;
-        }
-        pPap->Restore(aSave);
-    }
-
-    return bResult;
-}
-
 bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp)
 {
     // Frame/Table/Anl
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 8297a184aee2..94baf8c186c3 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1820,7 +1820,7 @@ public:     // really private, but can only be done public
 
     void Read_TabRowEnd(        sal_uInt16, const sal_uInt8* pData, short nLen 
);
     void Read_TabCellEnd(        sal_uInt16, const sal_uInt8* pData, short 
nLen );
-    bool ParseTabPos(WW8_TablePos *aTabPos, WW8PLCFx_Cp_FKP* pPap);
+    static bool ParseTabPos(WW8_TablePos *aTabPos, WW8PLCFx_Cp_FKP* pPap);
     void Read_Shade(            sal_uInt16, const sal_uInt8* pData, short nLen 
);
     void Read_ANLevelNo(        sal_uInt16, const sal_uInt8* pData, short nLen 
);
     void Read_ANLevelDesc(      sal_uInt16, const sal_uInt8* pData, short nLen 
);
@@ -1914,7 +1914,6 @@ public:     // really private, but can only be done public
     bool SearchRowEnd(WW8PLCFx_Cp_FKP* pPap,WW8_CP &rStartCp, int nLevel) 
const;
     /// Seek to the end of the table with pPap, returns true on success.
     bool SearchTableEnd(WW8PLCFx_Cp_FKP* pPap) const;
-    bool FloatingTableConversion(WW8PLCFx_Cp_FKP* pPap);
 
     const WW8Fib& GetFib() const    { return *m_xWwFib; }
     SwDoc& GetDoc() const           { return m_rDoc; }
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 8b842557e8e4..863ca7d6370b 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2067,7 +2067,7 @@ WW8TabDesc::WW8TabDesc(SwWW8ImplReader* pIoClass, WW8_CP 
nStartCp) :
         //Get the end of row new table positioning data
         WW8_CP nMyStartCp=nStartCp;
         if (m_pIo->SearchRowEnd(pPap, nMyStartCp, m_pIo->m_nInTable))
-            if (m_pIo->ParseTabPos(&aTabPos, pPap))
+            if (SwWW8ImplReader::ParseTabPos(&aTabPos, pPap))
                 pTabPos = &aTabPos;
 
         //Move back to this cell
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 4e30b9b1cf67..718df35b73a8 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -2459,22 +2459,6 @@ bool SwWW8ImplReader::IsDropCap() const
     return false;
 }
 
-namespace
-{
-bool IsFlySplitAllowed()
-{
-    bool bRet
-        = 
officecfg::Office::Writer::Filter::Import::DOC::ImportFloatingTableAsSplitFly::get();
-
-    if (!bRet)
-    {
-        bRet = getenv("SW_DISABLE_FLY_SPLIT") == nullptr;
-    }
-
-    return bRet;
-}
-}
-
 bool SwWW8ImplReader::StartApo(const ApoTestResults &rApo, const WW8_TablePos 
*pTabPos)
 {
     m_xWFlyPara = ConstructApo(rApo, pTabPos);
@@ -2507,28 +2491,20 @@ bool SwWW8ImplReader::StartApo(const ApoTestResults 
&rApo, const WW8_TablePos *p
 
         WW8FlySet aFlySet(*this, m_xWFlyPara.get(), m_xSFlyPara.get(), false);
 
-        // Always map floating tables to split flys when fly split is allowed.
-        if (pTabPos && pTabPos->bNoFly && !IsFlySplitAllowed())
+        // ofz#34749 we shouldn't anchor anything into an 'extra' paragraph 
scheduled for
+        // removal at end of import, but check if that scenario is happening
+        
m_aExtraneousParas.remove_if_present(m_pPaM->GetPointNode().GetTextNode());
+
+        if (pTabPos)
         {
-            m_xSFlyPara->SetFlyFormat(nullptr);
+            // Map a positioned table to a split fly.
+            aFlySet.Put(SwFormatFlySplit(true));
         }
-        else
-        {
-            // ofz#34749 we shouldn't anchor anything into an 'extra' 
paragraph scheduled for
-            // removal at end of import, but check if that scenario is 
happening
-            
m_aExtraneousParas.remove_if_present(m_pPaM->GetPointNode().GetTextNode());
 
-            if (pTabPos && IsFlySplitAllowed())
-            {
-                // Map a positioned table to a split fly.
-                aFlySet.Put(SwFormatFlySplit(true));
-            }
-
-            
m_xSFlyPara->SetFlyFormat(m_rDoc.MakeFlySection(WW8SwFlyPara::eAnchor,
-                                                            
m_pPaM->GetPoint(), &aFlySet));
-            OSL_ENSURE(m_xSFlyPara->GetFlyFormat()->GetAnchor().GetAnchorId() 
==
-                    WW8SwFlyPara::eAnchor, "Not the anchor type requested!");
-        }
+        m_xSFlyPara->SetFlyFormat(m_rDoc.MakeFlySection(WW8SwFlyPara::eAnchor,
+                    m_pPaM->GetPoint(), &aFlySet));
+        OSL_ENSURE(m_xSFlyPara->GetFlyFormat()->GetAnchor().GetAnchorId() ==
+                WW8SwFlyPara::eAnchor, "Not the anchor type requested!");
 
         if (SwFlyFrameFormat* pFlyFormat = m_xSFlyPara->GetFlyFormat())
         {
@@ -5361,7 +5337,6 @@ bool SwWW8ImplReader::ParseTabPos(WW8_TablePos *pTabPos, 
WW8PLCFx_Cp_FKP* pPap)
         aRes = pPap->HasSprm(NS_sprm::TDyaFromTextBottom::val);
         if (aRes.pSprm && aRes.nRemainingData >= 2)
             pTabPos->nLowerMargin = SVBT16ToUInt16(aRes.pSprm);
-        pTabPos->bNoFly = !FloatingTableConversion(pPap);
         bRet = true;
     }
     return bRet;
diff --git a/sw/source/filter/ww8/ww8struc.hxx 
b/sw/source/filter/ww8/ww8struc.hxx
index d13b3744d06c..cdd1fed1da8f 100644
--- a/sw/source/filter/ww8/ww8struc.hxx
+++ b/sw/source/filter/ww8/ww8struc.hxx
@@ -897,7 +897,6 @@ struct WW8_TablePos
     sal_Int16 nLowerMargin;
     sal_uInt8 nTPc;
     sal_uInt8 nPWr;
-    bool bNoFly;
 };
 
 struct WW8_FSPA

Reply via email to