tdf#152046 Revert "tdf#100680 sw DOCX compatibility: fix wrap of as_char flys"

This reverts 7.4 commit 41b012767feb8552b60a68c7be18d80c403304bf,

The premiss of the commit is that as-char flies needed to be handled differently,
and yet at the spot where it was implemented, we have no idea whether we
are even dealing with an as-char fly!!!

As this bug report report shows, it affects paragraphy that don't
have any fly whatsoever, let alone an as-char fly.

Change-Id: I2fedb2d610093933081e861a16a25de2f2716258
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152778
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index f8d9bfa..f14ffb5 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -120,9 +120,6 @@ enum class DocumentSettingId
    // footnoteContainer default position is the page end instead of the column end
    // only if "evenly distributed" is set, and "collected at the end" is not set
    FOOTNOTE_IN_COLUMN_TO_PAGEEND,
    // AsChar anchored flys wrapped differently in ooxml than normally so in case of
    // docx enable this flag. For details see ticket tdf#100680.
    WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML,
    // Should we display follow by symbol for numbered paragraph if numbering exists, but "None"?
    NO_NUMBERING_SHOW_FOLLOWBY,
    // drop cap punctuation: smaller dashes, bullet, asterisks, quotation marks etc.
diff --git a/sw/qa/extras/layout/data/tdf100680.docx b/sw/qa/extras/layout/data/tdf100680.docx
deleted file mode 100644
index c949540..0000000
--- a/sw/qa/extras/layout/data/tdf100680.docx
+++ /dev/null
Binary files differ
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index b4b0049..9daa260c 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -137,14 +137,6 @@ void SwLayoutWriter2::CheckRedlineCharAttributesHidden()
                "portion", "foobaz");
}

CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf100680_as_char_wrap)
{
    createSwDoc("tdf100680.docx");
    auto pDump = parseLayoutDump();
    assertXPath(pDump, "/root/page/header/txt/SwParaPortion/SwLineLayout[3]");
    // If the third line missing that assert will fire, as was before the fix.
}

CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf148897)
{
    createSwDoc("tdf148897.odt");
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index 7eb4f9d..5610f2a 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -106,7 +106,6 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc)
    mbFootnoteInColumnToPageEnd(false),
    mnImagePreferredDPI(0),
    mbAutoFirstLineIndentDisregardLineSpace(true),
    mbWrapAsCharFlysLikeInOOXML(false),
    mbNoNumberingShowFollowBy(false),
    mbDropCapPunctuation(true),
    mbUseVariableWidthNBSP(false)
@@ -254,7 +253,6 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const
        case DocumentSettingId::HYPHENATE_URLS: return mbHyphenateURLs;
        case DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES:
            return mbDoNotBreakWrappedTables;
        case DocumentSettingId::WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML: return mbWrapAsCharFlysLikeInOOXML;
        case DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY: return mbNoNumberingShowFollowBy;
        case DocumentSettingId::DROP_CAP_PUNCTUATION: return mbDropCapPunctuation;
        case DocumentSettingId::USE_VARIABLE_WIDTH_NBSP: return mbUseVariableWidthNBSP;
@@ -444,10 +442,6 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo
            mbDoNotBreakWrappedTables = value;
            break;

        case DocumentSettingId::WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML:
            mbWrapAsCharFlysLikeInOOXML = value;
            break;

        case DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY:
            mbNoNumberingShowFollowBy = value;
            break;
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx
index 54d7f2d..1a6fdf6 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ b/sw/source/core/inc/DocumentSettingManager.hxx
@@ -177,7 +177,6 @@ class DocumentSettingManager final :
    bool mbHyphenateURLs = false;
    bool mbDoNotBreakWrappedTables = false;
    // If this is on as_char flys wrapping will be handled the same like in Word
    bool mbWrapAsCharFlysLikeInOOXML;
    bool mbNoNumberingShowFollowBy;
    bool mbDropCapPunctuation; // tdf#150200, tdf#150438
    bool mbUseVariableWidthNBSP : 1; // tdf#41652
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index ebd281c..99595c1 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -422,11 +422,8 @@ bool SwTextPortion::Format_( SwTextFormatInfo &rInf )
    else
    {
        bool bFirstPor = rInf.GetLineStart() == rInf.GetIdx();
        const bool bBreakLineIfHasFly
            = rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
                DocumentSettingId::WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML);
        if (aGuess.BreakPos() != TextFrameIndex(COMPLETE_STRING) &&
            (aGuess.BreakPos() != rInf.GetLineStart() || bBreakLineIfHasFly) &&
            aGuess.BreakPos() != rInf.GetLineStart() &&
            ( !bFirstPor || rInf.GetFly() || rInf.GetLast()->IsFlyPortion() ||
              rInf.IsFirstMulti() ) &&
            ( !rInf.GetLast()->IsBlankPortion() ||
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index 5273bc0..d544848 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -154,7 +154,6 @@ enum SwDocumentSettingsPropertyHandles
    HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE,
    HANDLE_HYPHENATE_URLS,
    HANDLE_DO_NOT_BREAK_WRAPPED_TABLES,
    HANDLE_WORD_LIKE_WRAP_FOR_AS_CHAR_FLYS,
    HANDLE_NO_NUMBERING_SHOW_FOLLOWBY,
    HANDLE_DROP_CAP_PUNCTUATION,
    HANDLE_USE_VARIABLE_WIDTH_NBSP,
@@ -258,7 +257,6 @@ static rtl::Reference<MasterPropertySetInfo> lcl_createSettingsInfo()
        { OUString("AutoFirstLineIndentDisregardLineSpace"), HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE, cppu::UnoType<bool>::get(), 0 },
        { OUString("HyphenateURLs"), HANDLE_HYPHENATE_URLS, cppu::UnoType<bool>::get(), 0 },
        { OUString("DoNotBreakWrappedTables"), HANDLE_DO_NOT_BREAK_WRAPPED_TABLES, cppu::UnoType<bool>::get(), 0 },
        { OUString("WordLikeWrapForAsCharFlys"), HANDLE_WORD_LIKE_WRAP_FOR_AS_CHAR_FLYS, cppu::UnoType<bool>::get(), 0 },
        { OUString("NoNumberingShowFollowBy"), HANDLE_NO_NUMBERING_SHOW_FOLLOWBY, cppu::UnoType<bool>::get(), 0 },
        { OUString("DropCapPunctuation"), HANDLE_DROP_CAP_PUNCTUATION, cppu::UnoType<bool>::get(), 0 },
        { OUString("UseVariableWidthNBSP"), HANDLE_USE_VARIABLE_WIDTH_NBSP, cppu::UnoType<bool>::get(), 0 },
@@ -1082,14 +1080,6 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
            }
        }
        break;
        case HANDLE_WORD_LIKE_WRAP_FOR_AS_CHAR_FLYS:
        {
            bool bTmp;
            if (rValue >>= bTmp)
                mpDoc->getIDocumentSettingAccess().set(
                    DocumentSettingId::WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML, bTmp);
        }
        break;
        case HANDLE_NO_NUMBERING_SHOW_FOLLOWBY:
        {
            bool bTmp;
@@ -1648,12 +1638,6 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
                DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES);
        }
        break;
        case HANDLE_WORD_LIKE_WRAP_FOR_AS_CHAR_FLYS:
        {
            rValue <<= mpDoc->getIDocumentSettingAccess().get(
                DocumentSettingId::WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML);
        }
        break;
        case HANDLE_NO_NUMBERING_SHOW_FOLLOWBY:
        {
            rValue <<= mpDoc->getIDocumentSettingAccess().get(
diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx
index 1cfb0be..739db52 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -329,7 +329,6 @@ void WriterFilter::setTargetDocument(const uno::Reference<lang::XComponent>& xDo
    xSettings->setPropertyValue("PropLineSpacingShrinksFirstLine", uno::Any(true));
    xSettings->setPropertyValue("DoNotCaptureDrawObjsOnPage", uno::Any(true));
    xSettings->setPropertyValue("DisableOffPagePositioning", uno::Any(true));
    xSettings->setPropertyValue("WordLikeWrapForAsCharFlys", uno::Any(true));
    xSettings->setPropertyValue("DropCapPunctuation", uno::Any(true));
    // rely on default for HyphenateURLs=false
}