Revert "tdf#115639: Align right/center with trailing spaces the same"

.. as MS PowerPoint"
This reverts commit 1da3a3cb74a415a76fa547ef0c8f61780e260e7f.
It was a bad solution for the problem.

Change-Id: I6f6fecb7c74a884fbfb04c6e7204eb8bf347a272
Reviewed-on: https://gerrit.libreoffice.org/63473
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx
index ad56407..6d600b4 100644
--- a/editeng/qa/unit/core-test.cxx
+++ b/editeng/qa/unit/core-test.cxx
@@ -33,7 +33,6 @@
#include <svl/srchitem.hxx>
#include <editeng/fontitem.hxx>
#include <editeng/fhgtitem.hxx>
#include <editeng/adjustitem.hxx>

#include <com/sun/star/text/textfield/Type.hpp>

@@ -100,9 +99,6 @@ public:

    void testTransliterate();

    /// Test HoriAlignIgnoreTrailingWhitespace compatibility flag
    void testHoriAlignIgnoreTrailingWhitespace();

    DECL_STATIC_LINK( Test, CalcFieldValueHdl, EditFieldInfo*, void );

    CPPUNIT_TEST_SUITE(Test);
@@ -125,7 +121,6 @@ public:
    CPPUNIT_TEST(testSectionAttributes);
    CPPUNIT_TEST(testLargeParaCopyPaste);
    CPPUNIT_TEST(testTransliterate);
    CPPUNIT_TEST(testHoriAlignIgnoreTrailingWhitespace);
    CPPUNIT_TEST_SUITE_END();

private:
@@ -1843,145 +1838,6 @@ void Test::testTransliterate()
    CPPUNIT_ASSERT_EQUAL(OUString("One (Two) Three"), aEditEngine.GetText());
}

void Test::testHoriAlignIgnoreTrailingWhitespace()
{
    // Create EditEngine's instance
    EditEngine aEditEngine(mpItemPool);

    // Get EditDoc for current EditEngine's instance
    EditDoc &rDoc = aEditEngine.GetEditDoc();

    // Initially no text should be there
    CPPUNIT_ASSERT_EQUAL(sal_uLong(0), rDoc.GetTextLen());
    CPPUNIT_ASSERT_EQUAL(OUString(), rDoc.GetParaAsString(sal_Int32(0)));

    // Set initial text
    OUString aText = "Some text    ";
    sal_Int32 aTextLen = aText.getLength();
    aEditEngine.SetText(aText);

    // Assert changes - text insertion
    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(aTextLen), rDoc.GetTextLen());
    CPPUNIT_ASSERT_EQUAL(aText, rDoc.GetParaAsString(static_cast<sal_Int32>(0)));

    // First test case: center alignment with compatibility option enabled
    {
        aEditEngine.SetHoriAlignIgnoreTrailingWhitespace(true);
        std::unique_ptr<SfxItemSet> pSet(new SfxItemSet(aEditEngine.GetEmptyItemSet()));
        pSet->Put(SvxAdjustItem( SvxAdjust::Center, EE_PARA_JUST ));
        CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(1), pSet->Count());

        // Select all paragraphs and apply changes
        ESelection aSelection(0, 0, 0, aTextLen);
        aEditEngine.QuickSetAttribs(*pSet, aSelection);

        // Use a one line paragraph
        aEditEngine.SetPaperSize(Size(10000, 6000));
        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), aEditEngine.GetLineCount(0));

        // Check horizontal position
        ParaPortion* pParaPortion = aEditEngine.GetParaPortions()[0];
        EditLine* pLine = &pParaPortion->GetLines()[0];
        CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<long>(4527), pLine->GetStartPosX(), 100);
    }

    // Second test case: center alignment with compatibility option disabled
    {
        aEditEngine.SetHoriAlignIgnoreTrailingWhitespace(false);
        std::unique_ptr<SfxItemSet> pSet(new SfxItemSet(aEditEngine.GetEmptyItemSet()));
        pSet->Put(SvxAdjustItem( SvxAdjust::Center, EE_PARA_JUST ));
        CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(1), pSet->Count());

        // Select all paragraphs and apply changes
        ESelection aSelection(0, 0, 0, aTextLen);
        aEditEngine.QuickSetAttribs(*pSet, aSelection);

        // Use a one line paragraph
        aEditEngine.SetPaperSize(Size(10000, 6000));
        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), aEditEngine.GetLineCount(0));

        // Check horizontal position
        ParaPortion* pParaPortion = aEditEngine.GetParaPortions()[0];
        EditLine* pLine = &pParaPortion->GetLines()[0];
        CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<long>(4407), pLine->GetStartPosX(), 100);
    }

    // Third test case: right alignment with compatibility option enabled
    {
        aEditEngine.SetHoriAlignIgnoreTrailingWhitespace(true);
        std::unique_ptr<SfxItemSet> pSet(new SfxItemSet(aEditEngine.GetEmptyItemSet()));
        pSet->Put(SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ));
        CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(1), pSet->Count());

        // Select all paragraphs and apply changes
        ESelection aSelection(0, 0, 0, aTextLen);
        aEditEngine.QuickSetAttribs(*pSet, aSelection);

        // Use a one line paragraph
        aEditEngine.SetPaperSize(Size(10000, 6000));
        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), aEditEngine.GetLineCount(0));

        // Check horizontal position
        ParaPortion* pParaPortion = aEditEngine.GetParaPortions()[0];
        EditLine* pLine = &pParaPortion->GetLines()[0];
        CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<long>(9054), pLine->GetStartPosX(), 100);
    }

    // Fourth test case: right alignment with compatibility option disabled
    {
        aEditEngine.SetHoriAlignIgnoreTrailingWhitespace(false);
        std::unique_ptr<SfxItemSet> pSet(new SfxItemSet(aEditEngine.GetEmptyItemSet()));
        pSet->Put(SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ));
        CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(1), pSet->Count());

        // Select all paragraphs and apply changes
        ESelection aSelection(0, 0, 0, aTextLen);
        aEditEngine.QuickSetAttribs(*pSet, aSelection);

        // Use a one line paragraph
        aEditEngine.SetPaperSize(Size(10000, 6000));
        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), aEditEngine.GetLineCount(0));

        // Check horizontal position
        ParaPortion* pParaPortion = aEditEngine.GetParaPortions()[0];
        EditLine* pLine = &pParaPortion->GetLines()[0];
        CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<long>(8815), pLine->GetStartPosX(), 100);
    }

    // Test multiple paragraph case
    {
        // Set initial text
        aText = "Some text    \nMore Text   ";
        aTextLen = aText.getLength();
        aEditEngine.SetText(aText);

        // Assert changes - text insertion
        CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(aTextLen - 1), rDoc.GetTextLen());
        CPPUNIT_ASSERT_EQUAL(OUString("Some text    "), rDoc.GetParaAsString(static_cast<sal_Int32>(0)));
        CPPUNIT_ASSERT_EQUAL(OUString("More Text   "), rDoc.GetParaAsString(static_cast<sal_Int32>(1)));

        aEditEngine.SetHoriAlignIgnoreTrailingWhitespace(true);
        std::unique_ptr<SfxItemSet> pSet(new SfxItemSet(aEditEngine.GetEmptyItemSet()));
        pSet->Put(SvxAdjustItem( SvxAdjust::Center, EE_PARA_JUST ));
        CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(1), pSet->Count());

        // Select all paragraphs and apply changes
        ESelection aSelection(0, 0, 0, aTextLen);
        aEditEngine.QuickSetAttribs(*pSet, aSelection);

        // Get one line paragraphs
        aEditEngine.SetPaperSize(Size(10000, 6000));
        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), aEditEngine.GetLineCount(0));
        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), aEditEngine.GetLineCount(1));

        // Check horizontal position
        ParaPortion* pParaPortion = aEditEngine.GetParaPortions()[0];
        CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<long>(4527), pParaPortion->GetLines()[0].GetStartPosX(), 100);
        pParaPortion = aEditEngine.GetParaPortions()[1];
        CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<long>(8815), pParaPortion->GetLines()[0].GetStartPosX(), 100);
    }
}

CPPUNIT_TEST_SUITE_REGISTRATION(Test);

}
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 4d69891..b866706 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2815,11 +2815,6 @@ bool EditEngine::IsPageOverflow() {
    return pImpEditEngine->IsPageOverflow();
}

void EditEngine::SetHoriAlignIgnoreTrailingWhitespace(bool bEnabled)
{
    pImpEditEngine->SetHoriAlignIgnoreTrailingWhitespace(bEnabled);
}

EFieldInfo::EFieldInfo()
{
}
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 4a5daed..d5e7fdd 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -533,7 +533,6 @@ private:
    bool            bFirstWordCapitalization:1;   // specifies if auto-correction should capitalize the first word or not
    bool            mbLastTryMerge:1;
    bool            mbReplaceLeadingSingleQuotationMark:1;
    bool            mbHoriAlignIgnoreTrailingWhitespace:1;

    bool            mbNbspRunNext;  // can't be a bitfield as it is passed as bool&

@@ -824,9 +823,9 @@ public:
    sal_uInt32      CalcTextHeight( sal_uInt32* pHeightNTP );
    sal_uInt32      GetTextHeight() const;
    sal_uInt32      GetTextHeightNTP() const;
    sal_uInt32      CalcTextWidth( bool bIgnoreExtraSpace );
    sal_uInt32      CalcTextWidth( bool bIgnoreExtraSpace);
    sal_uInt32      CalcParaWidth( sal_Int32 nParagraph, bool bIgnoreExtraSpace );
    sal_uInt32      CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, bool bIgnoreExtraSpace, bool bIgnoreTrailingWhiteSpaces = false );
    sal_uInt32      CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, bool bIgnoreExtraSpace);
    sal_Int32       GetLineCount( sal_Int32 nParagraph ) const;
    sal_Int32       GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const;
    void            GetLineBoundaries( /*out*/sal_Int32& rStart, /*out*/sal_Int32& rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const;
@@ -1053,10 +1052,6 @@ public:
    bool            IsNbspRunNext() const { return mbNbspRunNext; }

    void Dispose();

    // tdf#115639 compatibility flag
    void SetHoriAlignIgnoreTrailingWhitespace(bool bEnabled) { mbHoriAlignIgnoreTrailingWhitespace = bEnabled; }
    bool IsHoriAlignIgnoreTrailingWhitespace() const { return mbHoriAlignIgnoreTrailingWhitespace; }
};

inline EPaM ImpEditEngine::CreateEPaM( const EditPaM& rPaM )
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 2ddf104..6f3a855 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -104,7 +104,6 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) :
    bFirstWordCapitalization(true),
    mbLastTryMerge(false),
    mbReplaceLeadingSingleQuotationMark(true),
    mbHoriAlignIgnoreTrailingWhitespace(false),
    mbNbspRunNext(false)
{
    pEditEngine         = pEE;
@@ -3166,7 +3165,7 @@ sal_uInt32 ImpEditEngine::CalcParaWidth( sal_Int32 nPara, bool bIgnoreExtraSpace
    return static_cast<sal_uInt32>(nMaxWidth);
}

sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, bool bIgnoreExtraSpace, bool bIgnoreTrailingWhiteSpaces )
sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, bool bIgnoreExtraSpace )
{
    sal_Int32 nPara = GetEditDoc().GetPos( pPortion->GetNode() );

@@ -3195,7 +3194,7 @@ sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine,
            break;
            case PortionKind::TEXT:
            {
                if ( (( eJustification != SvxAdjust::Block ) || ( !bIgnoreExtraSpace )) && !bIgnoreTrailingWhiteSpaces )
                if ( ( eJustification != SvxAdjust::Block ) || ( !bIgnoreExtraSpace ) )
                {
                    nWidth += rTextPortion.GetSize().Width();
                }
@@ -3205,10 +3204,7 @@ sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine,
                    SeekCursor( pPortion->GetNode(), nPos+1, aTmpFont );
                    aTmpFont.SetPhysFont( GetRefDevice() );
                    ImplInitDigitMode(GetRefDevice(), aTmpFont.GetLanguage());
                    if (bIgnoreTrailingWhiteSpaces)
                        nWidth += aTmpFont.QuickGetTextSize( GetRefDevice(), pPortion->GetNode()->GetString().trim(), nPos, rTextPortion.GetLen() ).Width();
                    else
                        nWidth += aTmpFont.QuickGetTextSize( GetRefDevice(), pPortion->GetNode()->GetString(), nPos, rTextPortion.GetLen() ).Width();
                    nWidth += aTmpFont.QuickGetTextSize( GetRefDevice(), pPortion->GetNode()->GetString(), nPos, rTextPortion.GetLen() ).Width();
                }
            }
            break;
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index d339261..a2496b6 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -1487,11 +1487,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
        {
            case SvxAdjust::Center:
            {
                long n;
                if(IsHoriAlignIgnoreTrailingWhitespace())
                    n = ( nMaxLineWidth - CalcLineWidth( pParaPortion, pLine, false, true ) ) / 2;
                else
                    n = ( nMaxLineWidth - aTextSize.Width() ) / 2;
                long n = ( nMaxLineWidth - aTextSize.Width() ) / 2;
                n += nStartX;  // Indentation is kept.
                pLine->SetStartPosX( n );
            }
@@ -1500,11 +1496,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
            {
                // For automatically wrapped lines, which has a blank at the end
                // the blank must not be displayed!
                long n;
                if(IsHoriAlignIgnoreTrailingWhitespace())
                    n = nMaxLineWidth - CalcLineWidth( pParaPortion, pLine, false, true );
                else
                    n = nMaxLineWidth - aTextSize.Width();
                long n = nMaxLineWidth - aTextSize.Width();
                n += nStartX;  // Indentation is kept.
                pLine->SetStartPosX( n );
            }
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 51e0a5f..60d0c10 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -366,11 +366,6 @@ sal_Int32 Outliner::GetBulletsNumberingStatus() const
           : 2;
}

void Outliner::SetHoriAlignIgnoreTrailingWhitespace(bool bEnabled)
{
    pEditEngine->SetHoriAlignIgnoreTrailingWhitespace( bEnabled );
}

std::unique_ptr<OutlinerParaObject> Outliner::CreateParaObject( sal_Int32 nStartPara, sal_Int32 nCount ) const
{
    if ( static_cast<sal_uLong>(nStartPara) + nCount >
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index 3803822..9ef5008 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -623,9 +623,6 @@ public:
    sal_Int32 GetOverflowingLineNum() const;
    void ClearOverflowingParaNum();
    bool IsPageOverflow();

    // tdf#115639 compatibility flag
    void SetHoriAlignIgnoreTrailingWhitespace(bool bEnabled);
};

#endif // INCLUDED_EDITENG_EDITENG_HXX
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 7e17dab..68b13a3 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -987,9 +987,6 @@ public:

    // convenient method to determine the bullets/numbering status for all paragraphs
    sal_Int32 GetBulletsNumberingStatus() const;

    // tdf#115639 compatibility flag
    void SetHoriAlignIgnoreTrailingWhitespace(bool bEnabled);
};

#endif
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index d081125..8cb3c6c 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -588,10 +588,6 @@ public:
    void SetAnchoredTextOverflowLegacy(bool bEnabled);
    bool IsAnchoredTextOverflowLegacy() const;

    // tdf#115639 compatibility flag
    void SetHoriAlignIgnoreTrailingWhitespace(bool bEnabled);
    bool IsHoriAlignIgnoreTrailingWhitespace() const;

    void ReformatAllTextObjects();

    std::unique_ptr<SdrOutliner> createOutliner( OutlinerMode nOutlinerMode );
diff --git a/sd/qa/unit/data/odp/tdf115639.odp b/sd/qa/unit/data/odp/tdf115639.odp
deleted file mode 100644
index b732e4e..0000000
--- a/sd/qa/unit/data/odp/tdf115639.odp
+++ /dev/null
Binary files differ
diff --git a/sd/qa/unit/data/ppt/tdf115639.ppt b/sd/qa/unit/data/ppt/tdf115639.ppt
deleted file mode 100644
index dade453..0000000
--- a/sd/qa/unit/data/ppt/tdf115639.ppt
+++ /dev/null
Binary files differ
diff --git a/sd/qa/unit/data/pptx/tdf115639.pptx b/sd/qa/unit/data/pptx/tdf115639.pptx
deleted file mode 100644
index 7e00b60c..0000000
--- a/sd/qa/unit/data/pptx/tdf115639.pptx
+++ /dev/null
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 356cc99..7323fd3 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -180,7 +180,6 @@ public:
    void testTdf115394();
    void testTdf115394PPT();
    void testTdf51340();
    void testTdf115639();
    void testTdf116899();
    void testTdf77747();
    void testTdf116266();
@@ -267,7 +266,6 @@ public:
    CPPUNIT_TEST(testTdf115394);
    CPPUNIT_TEST(testTdf115394PPT);
    CPPUNIT_TEST(testTdf51340);
    CPPUNIT_TEST(testTdf115639);
    CPPUNIT_TEST(testTdf116899);
    CPPUNIT_TEST(testTdf77747);
    CPPUNIT_TEST(testTdf116266);
@@ -2462,36 +2460,6 @@ void SdImportTest::testTdf51340()
    xDocShRef->DoClose();
}

void SdImportTest::testTdf115639()
{
    // Check whether the new compatibility option is loaded correctly
    // For PPTX we have the flag enabled by default
    {
        sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf115639.pptx"), PPTX);
        SdDrawDocument *pDoc = xDocShRef->GetDoc();
        CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
        CPPUNIT_ASSERT( pDoc->IsHoriAlignIgnoreTrailingWhitespace() );
    }

    // For PPT we have the flag enabled by default
    {
        sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/ppt/tdf115639.ppt"), PPT);
        SdDrawDocument *pDoc = xDocShRef->GetDoc();
        CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
        CPPUNIT_ASSERT( pDoc->IsHoriAlignIgnoreTrailingWhitespace() );
        xDocShRef->DoClose();
    }

    // For ODP we have the flag disabled by default
    {
        sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf115639.odp"), ODP);
        SdDrawDocument *pDoc = xDocShRef->GetDoc();
        CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
        CPPUNIT_ASSERT( !pDoc->IsHoriAlignIgnoreTrailingWhitespace() );
        xDocShRef->DoClose();
    }
}

void SdImportTest::testTdf116899()
{
    // This is a PPT created in Impress and roundtripped in PP, the key times become [1, -1] in PP,
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index 672181e..465ccf4 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -409,14 +409,6 @@ bool DrawDocShell::ImportFrom(SfxMedium &rMedium,
        mpDoc->SetSummationOfParagraphs();
    }

    // Set this flag for MSO formats
    if (aFilterName.startsWith("MS PowerPoint 97") ||
        aFilterName.startsWith("Impress MS PowerPoint 2007 XML") ||
        aFilterName.startsWith("Impress Office Open XML"))
    {
        mpDoc->SetHoriAlignIgnoreTrailingWhitespace(true);
    }

    const bool bRet = SfxObjectShell::ImportFrom(rMedium, xInsertPosition);

    SfxItemSet* pSet = rMedium.GetItemSet();
@@ -512,14 +504,6 @@ bool DrawDocShell::ConvertFrom( SfxMedium& rMedium )
        bRet = SdGRFFilter( rMedium, *this ).Import();
    }

    // Set this flag for MSO formats
    if (aFilterName.startsWith("MS PowerPoint 97") ||
        aFilterName.startsWith("Impress MS PowerPoint 2007 XML") ||
        aFilterName.startsWith("Impress Office Open XML"))
    {
        mpDoc->SetHoriAlignIgnoreTrailingWhitespace(true);
    }

    FinishedLoading();

    // tell SFX to change viewshell when in preview mode
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 5cb9542..ed25f27 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -224,7 +224,6 @@ SdOutliner::SdOutliner( SdDrawDocument* pDoc, OutlinerMode nMode )
        SetHyphenator( xHyphenator );

    SetDefaultLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
    SetHoriAlignIgnoreTrailingWhitespace( pDoc->IsHoriAlignIgnoreTrailingWhitespace() );
}

/// Nothing spectacular in the destructor.
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index 7d182d2..46efe26 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -345,7 +345,6 @@ std::unique_ptr<SdrOutliner> SdrMakeOutliner(OutlinerMode nOutlinerMode, SdrMode
    pOutl->SetAsianCompressionMode(rModel.GetCharCompressType());
    pOutl->SetKernAsianPunctuation(rModel.IsKernAsianPunctuation());
    pOutl->SetAddExtLeading(rModel.IsAddExtLeading());
    pOutl->SetHoriAlignIgnoreTrailingWhitespace(rModel.IsHoriAlignIgnoreTrailingWhitespace());
    return pOutl;
}

diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 95167af..be9cc53 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -94,7 +94,6 @@ struct SdrModelImpl
    SdrUndoFactory* mpUndoFactory;

    bool mbAnchoredTextOverflowLegacy; // tdf#99729 compatibility flag
    bool mbHoriAlignIgnoreTrailingWhitespace; // tdf#115639 compatibility flag
};


@@ -107,7 +106,6 @@ void SdrModel::ImpCtor(
    mpImpl->mpUndoManager=nullptr;
    mpImpl->mpUndoFactory=nullptr;
    mpImpl->mbAnchoredTextOverflowLegacy = false;
    mpImpl->mbHoriAlignIgnoreTrailingWhitespace = false;
    mbInDestruction = false;
    aObjUnit=SdrEngineDefaults::GetMapFraction();
    eObjUnit=SdrEngineDefaults::GetMapUnit();
@@ -1844,17 +1842,6 @@ bool SdrModel::IsAnchoredTextOverflowLegacy() const
    return mpImpl->mbAnchoredTextOverflowLegacy;
}

void SdrModel::SetHoriAlignIgnoreTrailingWhitespace(bool bEnabled)
{
    mpImpl->mbHoriAlignIgnoreTrailingWhitespace = bEnabled;
    pDrawOutliner->SetHoriAlignIgnoreTrailingWhitespace(bEnabled);
}

bool SdrModel::IsHoriAlignIgnoreTrailingWhitespace() const
{
    return mpImpl->mbHoriAlignIgnoreTrailingWhitespace;
}

void SdrModel::ReformatAllTextObjects()
{
    ImpReformatAllTextObjects();
@@ -1898,13 +1885,6 @@ void SdrModel::ReadUserDataSequenceValue(const css::beans::PropertyValue* pValue
            mpImpl->mbAnchoredTextOverflowLegacy = bBool;
        }
    }
    if (pValue->Name == "HoriAlignIgnoreTrailingWhitespace")
    {
        if (pValue->Value >>= bBool)
        {
            SetHoriAlignIgnoreTrailingWhitespace(bBool);
        }
    }
}

template <typename T>
@@ -1917,8 +1897,6 @@ void SdrModel::WriteUserDataSequence(css::uno::Sequence < css::beans::PropertyVa
{
    std::vector< std::pair< OUString, Any > > aUserData;
    addPair(aUserData, "AnchoredTextOverflowLegacy", IsAnchoredTextOverflowLegacy());
    if (IsHoriAlignIgnoreTrailingWhitespace())
        addPair(aUserData, "HoriAlignIgnoreTrailingWhitespace", IsHoriAlignIgnoreTrailingWhitespace());

    const sal_Int32 nOldLength = rValues.getLength();
    rValues.realloc(nOldLength + aUserData.size());