[Libreoffice-commits] core.git: Branch 'private/mst/sw_redlinehide' - 21 commits - sw/source

Michael Stahl Michael.Stahl at cib.de
Fri May 18 16:53:48 UTC 2018


 sw/source/core/crsr/callnk.cxx                  |    5 +
 sw/source/core/crsr/swcrsr.cxx                  |    7 +-
 sw/source/core/crsr/trvlfnfl.cxx                |    9 +--
 sw/source/core/doc/doc.cxx                      |    3 -
 sw/source/core/doc/doctxm.cxx                   |    5 +
 sw/source/core/docnode/ndtbl.cxx                |    4 +
 sw/source/core/layout/dbg_lay.cxx               |    2 
 sw/source/core/text/EnhancedPDFExportHelper.cxx |    4 -
 sw/source/core/text/frmcrsr.cxx                 |   52 ++++++++---------
 sw/source/core/text/frmform.cxx                 |   12 +++-
 sw/source/core/text/frmpaint.cxx                |   21 ++++---
 sw/source/core/text/inftxt.cxx                  |   10 +--
 sw/source/core/text/inftxt.hxx                  |    3 -
 sw/source/core/text/itrcrsr.cxx                 |   13 ++--
 sw/source/core/text/itrform2.cxx                |   16 ++---
 sw/source/core/text/itrform2.hxx                |    2 
 sw/source/core/text/itrpaint.cxx                |    2 
 sw/source/core/text/itrpaint.hxx                |    2 
 sw/source/core/text/itrtxt.cxx                  |    6 +-
 sw/source/core/text/porfld.cxx                  |   10 +--
 sw/source/core/text/porrst.cxx                  |   17 +++--
 sw/source/core/text/portxt.cxx                  |   72 +++++++++++-------------
 sw/source/core/text/txtfld.cxx                  |   67 ++++++++++++----------
 sw/source/core/text/txtfly.cxx                  |    6 +-
 sw/source/core/text/txtftn.cxx                  |    2 
 sw/source/core/text/txttab.cxx                  |   18 +++---
 sw/source/core/text/widorp.cxx                  |   10 +--
 sw/source/core/text/xmldump.cxx                 |   22 +++++++
 28 files changed, 224 insertions(+), 178 deletions(-)

New commits:
commit 971775337e826709b6872de6da395e3b431a8e19
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 18:45:54 2018 +0200

    sw_redlinehide: odd conversion in SwNodes::TextToTable()
    
    Change-Id: I0afe1bed882b8256b58aeaeaa0f3331fe5c1c680

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 890e9b3952f8..0ee58e56b96e 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1036,8 +1036,10 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
                 {
                     if (rText[nChPos] == cCh)
                     {
+                        // sw_redlinehide: no idea if this makes any sense...
+                        TextFrameIndex const nPos(aFInfo.GetFrame()->MapModelToView(pTextNd, nChPos));
                         aPosArr.push_back( static_cast<sal_uInt16>(
-                                        aFInfo.GetCharPos( nChPos+1, false )) );
+                            aFInfo.GetCharPos(nPos+TextFrameIndex(1), false)) );
                     }
                 }
 
commit b318a323a9b991be9bfc63e15cda011f2d2c9677
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 18:45:04 2018 +0200

    sw_redlinehide: trivial conversions in doc.cxx,doctxm.cxx
    
    Change-Id: Ic8737c8d06ca7d43241b39f4ad60d78eedcb42bb

diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 9f4a08b7bd42..5d57fb70d4fd 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -519,10 +519,11 @@ sal_uInt16 PostItField_::GetPageNo(
     //Probably only once. For the page number we don't select a random one,
     //but the PostIt's first occurrence in the selected area.
     rVirtPgNo = 0;
-    const sal_Int32 nPos = GetContent();
     SwIterator<SwTextFrame,SwTextNode> aIter( GetTextField()->GetTextNode() );
     for( SwTextFrame* pFrame = aIter.First(); pFrame;  pFrame = aIter.Next() )
     {
+        TextFrameIndex const nPos = pFrame->MapModelToView(
+                &GetTextField()->GetTextNode(), GetContent());
         if( pFrame->GetOfst() > nPos ||
             (pFrame->HasFollow() && pFrame->GetFollow()->GetOfst() <= nPos) )
             continue;
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 34cdce1fee6c..46871bcf2a7d 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1589,8 +1589,11 @@ void SwTOXBaseSection::UpdatePageNum()
                     {
                         // find the right one
                         SwTextFrame* pNext;
+                        TextFrameIndex const nPos(static_cast<SwTextFrame*>(pFrame)
+                            ->MapModelToView(static_cast<SwTextNode const*>(rTOXSource.pNd),
+                                rTOXSource.nPos));
                         while( nullptr != ( pNext = static_cast<SwTextFrame*>(pFrame->GetFollow()) )
-                                && rTOXSource.nPos >= pNext->GetOfst() )
+                                && nPos >= pNext->GetOfst())
                             pFrame = pNext;
                     }
 
commit 3c982083875fe662b4fca00c284c951d65502512
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 18:27:40 2018 +0200

    sw_redlinehide: trivial conversions callnk.cxx,swcrsr.cxx,trvlfnfl.cxx
    
    Change-Id: Ice8d5b3356ac8fa84439eaf0b785ae56c2de9274

diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx
index 0fb524de83fe..205f65394de6 100644
--- a/sw/source/core/crsr/callnk.cxx
+++ b/sw/source/core/crsr/callnk.cxx
@@ -227,9 +227,12 @@ long SwCallLink::getLayoutFrame( const SwRootFrame* pRoot, SwTextNode const & rN
     if ( pFrame && !pFrame->IsHiddenNow() )
     {
         if( pFrame->HasFollow() )
+        {
+            TextFrameIndex const nPos(pFrame->MapModelToView(&rNd, nCntPos));
             while( nullptr != ( pNext = pFrame->GetFollow() ) &&
-                    nCntPos >= pNext->GetOfst() )
+                    nPos >= pNext->GetOfst())
                 pFrame = pNext;
+        }
 
         return pFrame->getFrameArea().Left();
     }
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 8c426cdf7de4..e84731cd9795 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -1581,9 +1581,12 @@ SwCursor::DoSetBidiLevelLeftRight(
             {
                 sal_uInt8 nCursorLevel = GetCursorBidiLevel();
                 bool bForward = ! io_rbLeft;
-                const_cast<SwTextFrame*>(static_cast<const SwTextFrame*>(pSttFrame))->PrepareVisualMove( nPos, nCursorLevel,
+                SwTextFrame *const pTF(const_cast<SwTextFrame*>(
+                            static_cast<const SwTextFrame*>(pSttFrame)));
+                TextFrameIndex nTFIndex(pTF->MapModelToViewPos(*GetPoint()));
+                pTF->PrepareVisualMove( nTFIndex, nCursorLevel,
                                                          bForward, bInsertCursor );
-                rIdx = nPos;
+                *GetPoint() = pTF->MapViewToModelPos(nTFIndex);
                 SetCursorBidiLevel( nCursorLevel );
                 io_rbLeft = ! bForward;
             }
diff --git a/sw/source/core/crsr/trvlfnfl.cxx b/sw/source/core/crsr/trvlfnfl.cxx
index a46eb7c367b5..8b03a46069c8 100644
--- a/sw/source/core/crsr/trvlfnfl.cxx
+++ b/sw/source/core/crsr/trvlfnfl.cxx
@@ -99,11 +99,10 @@ bool SwCursorShell::GotoFootnoteText()
                                                         (pFrame)->ContainsContent();
                         if( pCnt )
                         {
-                            const SwContentNode* pNode = pCnt->GetNode();
-                            GetCursor_()->GetPoint()->nNode = *pNode;
-                            GetCursor_()->GetPoint()->nContent.Assign(
-                                const_cast<SwContentNode*>(pNode),
-                                static_cast<const SwTextFrame*>(pCnt)->GetOfst() );
+                            SwTextFrame const*const pTF(
+                                    static_cast<const SwTextFrame*>(pCnt));
+                            *GetCursor_()->GetPoint() =
+                                    pTF->MapViewToModelPos(pTF->GetOfst());
                             UpdateCursor( SwCursorShell::SCROLLWIN |
                                 SwCursorShell::CHKRANGE | SwCursorShell::READONLY );
                             bRet = true;
commit a445ffd2755c1dfeb025f736bf9ba9f009ae9236
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 18:25:40 2018 +0200

    sw_redlinehide: trivial conversions in EnhancedPDFExportHelper.cxx
    
    Change-Id: I1365c06d4ff50c9dd537f43dd47d119e0dbf0e78

diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index a8d460ad3f9e..f116dd6cfa9e 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -615,7 +615,7 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType )
         {
             OSL_ENSURE( pFrame->IsTextFrame(), "Frame type <-> tag attribute mismatch" );
             const SvxLRSpaceItem &rSpace =
-                static_cast<const SwTextFrame*>(pFrame)->GetTextNode()->GetSwAttrSet().GetLRSpace();
+                static_cast<const SwTextFrame*>(pFrame)->GetTextNodeForParaProps()->GetSwAttrSet().GetLRSpace();
             nVal =  rSpace.GetTextFirstLineOfst();
             if ( 0 != nVal )
                 mpPDFExtOutDevData->SetStructureAttributeNumerical( vcl::PDFWriter::TextIndent, nVal );
@@ -624,7 +624,7 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType )
         if ( bTextAlign )
         {
             OSL_ENSURE( pFrame->IsTextFrame(), "Frame type <-> tag attribute mismatch" );
-            const SwAttrSet& aSet = static_cast<const SwTextFrame*>(pFrame)->GetTextNode()->GetSwAttrSet();
+            const SwAttrSet& aSet = static_cast<const SwTextFrame*>(pFrame)->GetTextNodeForParaProps()->GetSwAttrSet();
             const SvxAdjust nAdjust = aSet.GetAdjust().GetAdjust();
             if ( SvxAdjust::Block == nAdjust || SvxAdjust::Center == nAdjust ||
                  (  (pFrame->IsRightToLeft() && SvxAdjust::Left == nAdjust) ||
diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx
index 1ccfd5fbecc0..6dba5849218b 100644
--- a/sw/source/core/text/txtftn.cxx
+++ b/sw/source/core/text/txtftn.cxx
@@ -928,7 +928,7 @@ SwNumberPortion *SwTextFormatter::NewFootnoteNumPortion( SwTextFormatInfo const
     const SwAttrSet& rSet = pInfo->GetCharFormat(*pDoc)->GetAttrSet();
 
     const SwAttrSet* pParSet = &rInf.GetCharAttr();
-    const IDocumentSettingAccess* pIDSA = m_pFrame->GetTextNode()->getIDocumentSettingAccess();
+    const IDocumentSettingAccess* pIDSA = &pDoc->getIDocumentSettingAccess();
     SwFont *pNumFnt = new SwFont( pParSet, pIDSA );
 
     // #i37142#
commit 1019013440f0b3eb12b9e2b4f41e753577d5c70c
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 18:00:17 2018 +0200

    sw_redlinehide: SwTextFrame::LeftMargin()/RightMargin():
    
    The callers apparently pass in only pams that point to the node already,
    so just assert the precondition instead of this nonsense of assigning
    nNode but not nContent.
    
    Change-Id: I78f6d425ebe156a9ac89ffa134d71c0bec7fc9cb

diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index a97ec384ef32..fe0ef8f78f63 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -670,8 +670,7 @@ bool SwTextFrame::GetCursorOfst(SwPosition* pPos, Point& rPoint,
 
 bool SwTextFrame::LeftMargin(SwPaM *pPam) const
 {
-    if( &pPam->GetNode() != GetNode() )
-        pPam->GetPoint()->nNode = *const_cast<SwTextFrame*>(this)->GetTextNode();
+    assert(&pPam->GetNode() == GetNode() || GetMergedPara());
 
     SwTextFrame *pFrame = GetAdjFrameAtPos( const_cast<SwTextFrame*>(this), *pPam->GetPoint(),
                                      SwTextCursor::IsRightMargin() );
@@ -705,8 +704,7 @@ bool SwTextFrame::LeftMargin(SwPaM *pPam) const
 
 bool SwTextFrame::RightMargin(SwPaM *pPam, bool bAPI) const
 {
-    if( &pPam->GetNode() != GetNode() )
-        pPam->GetPoint()->nNode = *const_cast<SwTextFrame*>(this)->GetTextNode();
+    assert(&pPam->GetNode() == GetNode() || GetMergedPara());
 
     SwTextFrame *pFrame = GetAdjFrameAtPos( const_cast<SwTextFrame*>(this), *pPam->GetPoint(),
                                      SwTextCursor::IsRightMargin() );
commit 06629e62e9e65b45a3f5ff2ff4067d8cc5387a20
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 18:00:00 2018 +0200

    sw_redlinehide: trivial conversions in frmcrsr.cxx
    
    Change-Id: I15e6fc1eecebab0c497eda66c74633651fa446a6

diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index 882595ac4a2c..a97ec384ef32 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -65,15 +65,16 @@ SwTextFrame *GetAdjFrameAtPos( SwTextFrame *pFrame, const SwPosition &rPos,
                           const bool bRightMargin, const bool bNoScroll = true )
 {
     // RightMargin in the last master line
-    const sal_Int32 nOffset = rPos.nContent.GetIndex();
+    TextFrameIndex const nOffset = pFrame->MapModelToViewPos(rPos);
     SwTextFrame *pFrameAtPos = pFrame;
     if( !bNoScroll || pFrame->GetFollow() )
     {
         pFrameAtPos = pFrame->GetFrameAtPos( rPos );
-        if (rPos < pFrameAtPos->MapViewToModelPos(pFrameAtPos->GetOfst()) &&
+        if (nOffset < pFrameAtPos->GetOfst() &&
             !pFrameAtPos->IsFollow() )
         {
-            TextFrameIndex nNew = pFrameAtPos->MapModelToViewPos(rPos);
+            assert(pFrameAtPos->MapModelToViewPos(rPos) == nOffset);
+            TextFrameIndex nNew(nOffset);
             if (nNew < TextFrameIndex(MIN_OFFSET_STEP))
                 nNew = TextFrameIndex(0);
             else
@@ -213,7 +214,7 @@ bool SwTextFrame::GetCharRect( SwRect& rOrig, const SwPosition &rPos,
     if ( pFrame->IsEmpty() || ! aRectFnSet.GetHeight(pFrame->getFramePrintArea()) )
     {
         Point aPnt1 = pFrame->getFrameArea().Pos() + pFrame->getFramePrintArea().Pos();
-        SwTextNode* pTextNd = const_cast<SwTextFrame*>(this)->GetTextNode();
+        SwTextNode const*const pTextNd(GetTextNodeForParaProps());
         short nFirstOffset;
         pTextNd->GetFirstLineOfsWithNum( nFirstOffset );
 
@@ -290,7 +291,7 @@ bool SwTextFrame::GetCharRect( SwRect& rOrig, const SwPosition &rPos,
                 aRectFnSet.GetBottom(rOrig) == nUpperMaxY &&
                 pFrame->GetOfst() < nOffset &&
                 !pFrame->IsFollow() && !bNoScroll &&
-                pFrame->GetTextNode()->GetText().getLength() != nNextOfst)
+                TextFrameIndex(pFrame->GetText().getLength()) != nNextOfst)
             {
                 bGoOn = sw_ChangeOffset( pFrame, nNextOfst );
             }
@@ -571,9 +572,7 @@ bool SwTextFrame::GetCursorOfst_(SwPosition* pPos, const Point& rPoint,
 
     if ( IsEmpty() )
     {
-        SwTextNode* pTextNd = const_cast<SwTextFrame*>(this)->GetTextNode();
-        pPos->nNode = *pTextNd;
-        pPos->nContent.Assign( pTextNd, 0 );
+        *pPos = MapViewToModelPos(TextFrameIndex(0));
         if( pCMS && pCMS->m_bFieldInfo )
         {
             SwTwips nDiff = rPoint.X() - getFrameArea().Left() - getFramePrintArea().Left();
@@ -612,15 +611,14 @@ bool SwTextFrame::GetCursorOfst_(SwPosition* pPos, const Point& rPoint,
     // In such cases, pPos must not be calculated.
         if (TextFrameIndex(COMPLETE_STRING) != nOffset)
         {
-            SwTextNode* pTextNd = const_cast<SwTextFrame*>(this)->GetTextNode();
             *pPos = MapViewToModelPos(nOffset);
             if( pFillData )
             {
-                if (pTextNd->GetText().getLength() > nOffset ||
+                if (TextFrameIndex(GetText().getLength()) > nOffset ||
                     rPoint.Y() < getFrameArea().Top() )
                     pFillData->bInner = true;
                 pFillData->bFirstLine = aLine.GetLineNr() < 2;
-                if (pTextNd->GetText().getLength())
+                if (GetText().getLength())
                 {
                     pFillData->bEmpty = false;
                     pFillData->nLineWidth = aLine.GetCurr()->Width();
@@ -1336,10 +1334,9 @@ void SwTextFrame::FillCursorPos( SwFillData& rFill ) const
                 rFill.bColumn = true;
                 if( rFill.pPos )
                 {
-                    SwTextNode* pTextNd = const_cast<SwTextFrame*>(static_cast<const SwTextFrame*>(pFrame))->GetTextNode();
-                    rFill.pPos->nNode = *pTextNd;
-                    rFill.pPos->nContent.Assign(
-                            pTextNd, pTextNd->GetText().getLength());
+                    SwTextFrame const*const pTextFrame(static_cast<const SwTextFrame*>(pFrame));
+                    *rFill.pPos = pTextFrame->MapViewToModelPos(
+                            TextFrameIndex(pTextFrame->GetText().getLength()));
                 }
                 if( nNextCol )
                 {
@@ -1354,19 +1351,22 @@ void SwTextFrame::FillCursorPos( SwFillData& rFill ) const
         }
     }
     SwFont *pFnt;
-    SwTextFormatColl* pColl = GetTextNode()->GetTextColl();
-    SwTwips nFirst = GetTextNode()->GetSwAttrSet().GetULSpace().GetLower();
+    SwTextFormatColl* pColl = GetTextNodeForParaProps()->GetTextColl();
+    SwTwips nFirst = GetTextNodeForParaProps()->GetSwAttrSet().GetULSpace().GetLower();
     SwTwips nDiff = rFill.Y() - getFrameArea().Bottom();
     if( nDiff < nFirst )
         nDiff = -1;
     else
         pColl = &pColl->GetNextTextFormatColl();
-    SwAttrSet aSet( const_cast<SwDoc*>(GetTextNode()->GetDoc())->GetAttrPool(), aTextFormatCollSetRange );
+    SwAttrSet aSet(const_cast<SwDoc&>(GetDoc()).GetAttrPool(), aTextFormatCollSetRange );
     const SwAttrSet* pSet = &pColl->GetAttrSet();
     SwViewShell *pSh = getRootFrame()->GetCurrShell();
-    if( GetTextNode()->HasSwAttrSet() )
+    if (GetTextNodeForParaProps()->HasSwAttrSet())
     {
-        aSet.Put( *GetTextNode()->GetpSwAttrSet() );
+        // sw_redlinehide: pSet is mostly used for para props, but there are
+        // accesses to char props via pFnt - why does it use only the node's
+        // props for this, and not hints?
+        aSet.Put( *GetTextNodeForParaProps()->GetpSwAttrSet() );
         aSet.SetParent( pSet );
         pSet = &aSet;
         pFnt = new SwFont( pSet, GetNode()->getIDocumentSettingAccess() );
@@ -1379,7 +1379,7 @@ void SwTextFrame::FillCursorPos( SwFillData& rFill ) const
     }
     OutputDevice* pOut = pSh->GetOut();
     if( !pSh->GetViewOptions()->getBrowseMode() || pSh->GetViewOptions()->IsPrtFormat() )
-        pOut = GetTextNode()->getIDocumentDeviceAccess().getReferenceDevice( true );
+        pOut = GetDoc().getIDocumentDeviceAccess().getReferenceDevice( true );
 
     pFnt->SetFntChg( true );
     pFnt->ChgPhysFnt( pSh, *pOut );
@@ -1430,7 +1430,7 @@ void SwTextFrame::FillCursorPos( SwFillData& rFill ) const
                 rRect.Top( rRect.Top() + nFirst );
             rRect.Height( nLineHeight );
             SwTwips nLeft = rFill.Left() + rLRSpace.GetLeft() +
-                            GetTextNode()->GetLeftMarginWithNum();
+                            GetTextNodeForParaProps()->GetLeftMarginWithNum();
             SwTwips nRight = rFill.Right() - rLRSpace.GetRight();
             SwTwips nCenter = ( nLeft + nRight ) / 2;
             rRect.Left( nLeft );
@@ -1503,7 +1503,7 @@ void SwTextFrame::FillCursorPos( SwFillData& rFill ) const
                 else if( rFill.X() > nLeft )
                 {
                     SwTwips nTextLeft = rFill.Left() + rLRSpace.GetTextLeft() +
-                                    GetTextNode()->GetLeftMarginWithNum( true );
+                        GetTextNodeForParaProps()->GetLeftMarginWithNum(true);
                     rFill.nLineWidth += rFill.bFirstLine ? nLeft : nTextLeft;
                     SwTwips nLeftTab;
                     SwTwips nRightTab = nLeft;
commit 58a75546d17405ccc62e29d2313fb029b87291a1
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 16:18:42 2018 +0200

    sw_redlinehide: trivial conversions in porfld.cxx
    
    Change-Id: Ic124bc328482f4c28a92cb0a83bd1f5c5cd9d3a2

diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index bd1ebe840ef5..da26149b1725 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -366,13 +366,13 @@ bool SwFieldPortion::Format( SwTextFormatInfo &rInf )
         {
             // aExpand has not yet been shortened; the new Ofst is a
             // result of nRest
-            sal_Int32 nNextOfst = m_aExpand.getLength() - nRest;
+            TextFrameIndex nNextOfst = TextFrameIndex(m_aExpand.getLength()) - nRest;
 
             if ( IsQuoVadisPortion() )
-                nNextOfst = nNextOfst + static_cast<SwQuoVadisPortion*>(this)->GetContText().getLength();
+                nNextOfst = nNextOfst + TextFrameIndex(static_cast<SwQuoVadisPortion*>(this)->GetContText().getLength());
 
-            OUString aNew( m_aExpand.copy( nNextOfst ) );
-            m_aExpand = m_aExpand.copy( 0, nNextOfst );
+            OUString aNew( m_aExpand.copy(sal_Int32(nNextOfst)) );
+            m_aExpand = m_aExpand.copy(0, sal_Int32(nNextOfst));
 
             // These characters should not be contained in the follow
             // field portion. They are handled via the HookChar mechanism.
@@ -551,7 +551,7 @@ bool SwNumberPortion::Format( SwTextFormatInfo &rInf )
 
         if ( !mbLabelAlignmentPosAndSpaceModeActive )
         {
-            if ( !rInf.GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) &&
+            if (!rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) &&
                  // #i32902#
                  !IsFootnoteNumPortion() )
             {
commit f6b82458770a91323267aeaa1a5f667cd0d9acba
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 16:09:32 2018 +0200

    sw_redlinehide: trivial conversions in portxt.cxx
    
    Change-Id: I88206586f89f9a799ee23b1d48922e06f74953f2

diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 971d5816bce7..785935e151ec 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -225,8 +225,8 @@ void SwTextPortion::BreakCut( SwTextFormatInfo &rInf, const SwTextGuess &rGuess
     // Special case 1: The word is larger than the line
     // We truncate ...
     const sal_uInt16 nLineWidth = static_cast<sal_uInt16>(rInf.Width() - rInf.X());
-    sal_Int32 nLen = rGuess.CutPos() - rInf.GetIdx();
-    if (nLen > 0)
+    TextFrameIndex nLen = rGuess.CutPos() - rInf.GetIdx();
+    if (nLen > TextFrameIndex(0))
     {
         // special case: guess does not always provide the correct
         // width, only in common cases.
@@ -254,12 +254,12 @@ void SwTextPortion::BreakCut( SwTextFormatInfo &rInf, const SwTextGuess &rGuess
     // special case: first character does not fit to line
     else if ( rGuess.CutPos() == rInf.GetLineStart() )
     {
-        SetLen( 1 );
+        SetLen( TextFrameIndex(1) );
         Width( nLineWidth );
     }
     else
     {
-        SetLen( 0 );
+        SetLen( TextFrameIndex(0) );
         Width( 0 );
     }
 }
@@ -269,7 +269,7 @@ void SwTextPortion::BreakUnderflow( SwTextFormatInfo &rInf )
     Truncate();
     Height( 0 );
     Width( 0 );
-    SetLen( 0 );
+    SetLen( TextFrameIndex(0) );
     SetAscent( 0 );
     rInf.SetUnderflow( this );
 }
@@ -295,12 +295,12 @@ bool SwTextPortion::Format_( SwTextFormatInfo &rInf )
             SwTextGuess aGuess;
             // check for alternative spelling left from the soft hyphen
             // this should usually be true but
-            aGuess.AlternativeSpelling( rInf, rInf.GetSoftHyphPos() - 1 );
+            aGuess.AlternativeSpelling(rInf, rInf.GetSoftHyphPos() - TextFrameIndex(1));
             bFull = CreateHyphen( rInf, aGuess );
             OSL_ENSURE( bFull, "Problem with hyphenation!!!" );
         }
         rInf.ChgHyph( bHyph );
-        rInf.SetSoftHyphPos( 0 );
+        rInf.SetSoftHyphPos( TextFrameIndex(0) );
         return bFull;
     }
 
@@ -347,7 +347,7 @@ bool SwTextPortion::Format_( SwTextFormatInfo &rInf )
         Insert( aGuess.ReleaseHangingPortion() );
     }
     // breakPos >= index
-    else if ( aGuess.BreakPos() >= rInf.GetIdx() && aGuess.BreakPos() != COMPLETE_STRING )
+    else if (aGuess.BreakPos() >= rInf.GetIdx() && aGuess.BreakPos() != TextFrameIndex(COMPLETE_STRING))
     {
         // case B1
         if( aGuess.HyphWord().is() && aGuess.BreakPos() > rInf.GetLineStart()
@@ -372,7 +372,7 @@ bool SwTextPortion::Format_( SwTextFormatInfo &rInf )
 
                     rInf.IsOtherThanFootnoteInside() ) ||
                   ( rInf.GetLast() &&
-                    rInf.GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::TAB_COMPAT) &&
+                    rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_COMPAT) &&
                     rInf.GetLast()->InTabGrp() &&
                     rInf.GetLineStart() + rInf.GetLast()->GetLen() < rInf.GetIdx() &&
                     aGuess.BreakPos() == rInf.GetIdx()  &&
@@ -405,7 +405,7 @@ bool SwTextPortion::Format_( SwTextFormatInfo &rInf )
 
             OSL_ENSURE( aGuess.BreakStart() >= aGuess.FieldDiff(),
                     "Trouble with expanded field portions during line break" );
-            const sal_Int32 nRealStart = aGuess.BreakStart() - aGuess.FieldDiff();
+            TextFrameIndex const nRealStart = aGuess.BreakStart() - aGuess.FieldDiff();
             if( aGuess.BreakPos() < nRealStart && !InExpGrp() )
             {
                 SwHolePortion *pNew = new SwHolePortion( *this );
@@ -420,11 +420,12 @@ bool SwTextPortion::Format_( SwTextFormatInfo &rInf )
     else
     {
         bool bFirstPor = rInf.GetLineStart() == rInf.GetIdx();
-        if( aGuess.BreakPos() != COMPLETE_STRING &&
+        if (aGuess.BreakPos() != TextFrameIndex(COMPLETE_STRING) &&
             aGuess.BreakPos() != rInf.GetLineStart() &&
             ( !bFirstPor || rInf.GetFly() || rInf.GetLast()->IsFlyPortion() ||
               rInf.IsFirstMulti() ) &&
-            ( !rInf.GetLast()->IsBlankPortion() || SwBlankPortion::MayUnderflow( rInf, rInf.GetIdx()-1, true )))
+            ( !rInf.GetLast()->IsBlankPortion() ||
+              SwBlankPortion::MayUnderflow(rInf, rInf.GetIdx() - TextFrameIndex(1), true)))
         {       // case C1 (former BreakUnderflow())
             BreakUnderflow( rInf );
         }
@@ -442,7 +443,7 @@ bool SwTextPortion::Format( SwTextFormatInfo &rInf )
     {
         Height( 0 );
         Width( 0 );
-        SetLen( 0 );
+        SetLen( TextFrameIndex(0) );
         SetAscent( 0 );
         SetPortion( nullptr );  // ????
         return true;
@@ -469,14 +470,15 @@ void SwTextPortion::FormatEOL( SwTextFormatInfo &rInf )
         ( !GetPortion() || ( GetPortion()->IsKernPortion() &&
           !GetPortion()->GetPortion() ) ) &&
         GetLen() &&
-        rInf.GetIdx() < rInf.GetText().getLength() &&
-        1 < rInf.GetIdx() && ' ' == rInf.GetChar( rInf.GetIdx() - 1 ) &&
+        rInf.GetIdx() < TextFrameIndex(rInf.GetText().getLength()) &&
+        TextFrameIndex(1) < rInf.GetIdx() &&
+        ' ' == rInf.GetChar(rInf.GetIdx() - TextFrameIndex(1)) &&
         !rInf.GetLast()->IsHolePortion()) )
         return;
 
     // calculate number of blanks
-    sal_Int32 nX = rInf.GetIdx() - 1;
-    sal_Int32 nHoleLen = 1;
+    TextFrameIndex nX(rInf.GetIdx() - TextFrameIndex(1));
+    TextFrameIndex nHoleLen(1);
     while( nX && nHoleLen < GetLen() && CH_BLANK == rInf.GetChar( --nX ) )
         nHoleLen++;
 
@@ -486,7 +488,7 @@ void SwTextPortion::FormatEOL( SwTextFormatInfo &rInf )
     if( nHoleLen == GetLen() )
         nBlankSize = Width();
     else
-        nBlankSize = nHoleLen * rInf.GetTextSize(OUString(' ')).Width();
+        nBlankSize = sal_Int32(nHoleLen) * rInf.GetTextSize(OUString(' ')).Width();
     Width( Width() - nBlankSize );
     rInf.X( rInf.X() - nBlankSize );
     SetLen( GetLen() - nHoleLen );
@@ -521,14 +523,16 @@ SwPosSize SwTextPortion::GetTextSize( const SwTextSizeInfo &rInf ) const
 
 void SwTextPortion::Paint( const SwTextPaintInfo &rInf ) const
 {
-    if (rInf.OnWin() && 1==rInf.GetLen() && CH_TXT_ATR_FIELDEND==rInf.GetText()[rInf.GetIdx()])
+    if (rInf.OnWin() && TextFrameIndex(1) == rInf.GetLen()
+        && CH_TXT_ATR_FIELDEND == rInf.GetText()[sal_Int32(rInf.GetIdx())])
     {
         assert(false); // this is some debugging only code
         rInf.DrawBackBrush( *this );
         const OUString aText(CH_TXT_ATR_SUBST_FIELDEND);
         rInf.DrawText( aText, *this, 0, aText.getLength() );
     }
-    else if (rInf.OnWin() && 1==rInf.GetLen() && CH_TXT_ATR_FIELDSTART==rInf.GetText()[rInf.GetIdx()])
+    else if (rInf.OnWin() && TextFrameIndex(1) == rInf.GetLen()
+        && CH_TXT_ATR_FIELDSTART == rInf.GetText()[sal_Int32(rInf.GetIdx())])
     {
         assert(false); // this is some debugging only code
         rInf.DrawBackBrush( *this );
@@ -576,7 +580,7 @@ TextFrameIndex SwTextPortion::GetSpaceCnt(const SwTextSizeInfo &rInf,
     {
         SwTextGridItem const*const pGrid(GetGridItem(rInf.GetTextFrame()->FindPageFrame()));
         if (pGrid && GRID_LINES_CHARS == pGrid->GetGridType() && pGrid->IsSnapToChars())
-            return 0;
+            return TextFrameIndex(0);
     }
 
     if ( InExpGrp() )
@@ -690,14 +694,14 @@ void SwTextInputFieldPortion::Paint( const SwTextPaintInfo &rInf ) const
 
 bool SwTextInputFieldPortion::GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const
 {
-    sal_Int32 nIdx = rInf.GetIdx();
-    sal_Int32 nLen = rInf.GetLen();
+    sal_Int32 nIdx(rInf.GetIdx());
+    sal_Int32 nLen(rInf.GetLen());
     if ( rInf.GetChar( rInf.GetIdx() ) == CH_TXT_ATR_INPUTFIELDSTART )
     {
         ++nIdx;
         --nLen;
     }
-    if ( rInf.GetChar( rInf.GetIdx() + rInf.GetLen() - 1 ) == CH_TXT_ATR_INPUTFIELDEND )
+    if (rInf.GetChar(rInf.GetIdx() + rInf.GetLen() - TextFrameIndex(1)) == CH_TXT_ATR_INPUTFIELDEND)
     {
         --nLen;
     }
@@ -709,7 +713,7 @@ bool SwTextInputFieldPortion::GetExpText( const SwTextSizeInfo &rInf, OUString &
 SwPosSize SwTextInputFieldPortion::GetTextSize( const SwTextSizeInfo &rInf ) const
 {
     SwTextSlot aFormatText( &rInf, this, true, false );
-    if ( rInf.GetLen() == 0 )
+    if (rInf.GetLen() == TextFrameIndex(0))
     {
         return SwPosSize( 0, 0 );
     }
@@ -720,7 +724,7 @@ SwPosSize SwTextInputFieldPortion::GetTextSize( const SwTextSizeInfo &rInf ) con
 SwHolePortion::SwHolePortion( const SwTextPortion &rPor )
     : nBlankWidth( 0 )
 {
-    SetLen( 1 );
+    SetLen( TextFrameIndex(1) );
     Height( rPor.Height() );
     SetAscent( rPor.GetAscent() );
     SetWhichPor( POR_HOLE );
@@ -783,19 +787,16 @@ bool SwFieldMarkPortion::Format( SwTextFormatInfo & )
 
 void SwFieldFormCheckboxPortion::Paint( const SwTextPaintInfo& rInf ) const
 {
-    SwTextNode* pNd = const_cast<SwTextNode*>(rInf.GetTextFrame()->GetTextNode());
-    const SwDoc *doc=pNd->GetDoc();
-    SwIndex aIndex( pNd, rInf.GetIdx() );
-    SwPosition aPosition(*pNd, aIndex);
+    SwPosition const aPosition(rInf.GetTextFrame()->MapViewToModelPos(rInf.GetIdx()));
 
-    IFieldmark* pBM = doc->getIDocumentMarkAccess( )->getFieldmarkFor( aPosition );
+    IFieldmark const*const pBM = rInf.GetTextFrame()->GetDoc().getIDocumentMarkAccess()->getFieldmarkFor( aPosition );
 
     OSL_ENSURE(pBM && pBM->GetFieldname( ) == ODF_FORMCHECKBOX,
         "Where is my form field bookmark???");
 
     if (pBM && pBM->GetFieldname( ) == ODF_FORMCHECKBOX)
     {
-        const ICheckboxFieldmark* pCheckboxFm = dynamic_cast< ICheckboxFieldmark* >(pBM);
+        const ICheckboxFieldmark* pCheckboxFm = dynamic_cast<ICheckboxFieldmark const*>(pBM);
         bool bChecked = pCheckboxFm && pCheckboxFm->IsChecked();
         rInf.DrawCheckBox(*this, bChecked);
     }
@@ -803,11 +804,8 @@ void SwFieldFormCheckboxPortion::Paint( const SwTextPaintInfo& rInf ) const
 
 bool SwFieldFormCheckboxPortion::Format( SwTextFormatInfo & rInf )
 {
-    SwTextNode *pNd = rInf.GetTextFrame(  )->GetTextNode(  );
-    const SwDoc *doc = pNd->GetDoc(  );
-    SwIndex aIndex( pNd, rInf.GetIdx(  ) );
-    SwPosition aPosition( *pNd, aIndex );
-    IFieldmark *pBM = doc->getIDocumentMarkAccess( )->getFieldmarkFor( aPosition );
+    SwPosition const aPosition(rInf.GetTextFrame()->MapViewToModelPos(rInf.GetIdx()));
+    IFieldmark const*const pBM = rInf.GetTextFrame()->GetDoc().getIDocumentMarkAccess()->getFieldmarkFor( aPosition );
     OSL_ENSURE(pBM && pBM->GetFieldname( ) == ODF_FORMCHECKBOX, "Where is my form field bookmark???");
     if (pBM && pBM->GetFieldname( ) == ODF_FORMCHECKBOX)
     {
commit eda4bba58cf36c2151cb0e6e07de0e0779b6ccef
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 15:32:28 2018 +0200

    sw_redlinehide: trivial node conversions in widorp.cxx
    
    Change-Id: I58e9b241e543e72be410d88f640635e9dbe42ff0

diff --git a/sw/source/core/text/widorp.cxx b/sw/source/core/text/widorp.cxx
index 6ffc9324853e..b87396701d8d 100644
--- a/sw/source/core/text/widorp.cxx
+++ b/sw/source/core/text/widorp.cxx
@@ -67,8 +67,8 @@ SwTextFrameBreak::SwTextFrameBreak( SwTextFrame *pNewFrame, const SwTwips nRst )
         const SwSectionFrame* const pSct = m_pFrame->FindSctFrame();
         m_bKeep = pSct->Lower()->IsColumnFrame() && !pSct->MoveAllowed( m_pFrame );
     }
-    m_bKeep = m_bKeep || !m_pFrame->GetTextNode()->GetSwAttrSet().GetSplit().GetValue() ||
-        m_pFrame->GetTextNode()->GetSwAttrSet().GetKeep().GetValue();
+    m_bKeep = m_bKeep || !m_pFrame->GetTextNodeForParaProps()->GetSwAttrSet().GetSplit().GetValue() ||
+        m_pFrame->GetTextNodeForParaProps()->GetSwAttrSet().GetKeep().GetValue();
     m_bBreak = false;
 
     if( !m_nRstHeight && !m_pFrame->IsFollow() && m_pFrame->IsInFootnote() && m_pFrame->HasPara() )
@@ -241,11 +241,11 @@ WidowsAndOrphans::WidowsAndOrphans( SwTextFrame *pNewFrame, const SwTwips nRst,
         // nevertheless the paragraph can request lines from the Master
         // because of the Orphan rule.
         if( m_pFrame->IsFollow() )
-            nWidLines = m_pFrame->GetTextNode()->GetSwAttrSet().GetWidows().GetValue();
+            nWidLines = m_pFrame->GetTextNodeForParaProps()->GetSwAttrSet().GetWidows().GetValue();
     }
     else
     {
-        const SwAttrSet& rSet = m_pFrame->GetTextNode()->GetSwAttrSet();
+        const SwAttrSet& rSet = m_pFrame->GetTextNodeForParaProps()->GetSwAttrSet();
         const SvxOrphansItem  &rOrph = rSet.GetOrphans();
         if ( rOrph.GetValue() > 1 )
             nOrphLines = rOrph.GetValue();
@@ -511,7 +511,7 @@ bool WidowsAndOrphans::WouldFit( SwTextMargin &rLine, SwTwips &rMaxHeight, bool
         // because we are just in the middle of calculating the break.
         // In Ctor of WidowsAndOrphans the nWidLines are only calced for
         // Follows from the AttrSet - so we catch up now:
-        const SwAttrSet& rSet = m_pFrame->GetTextNode()->GetSwAttrSet();
+        const SwAttrSet& rSet = m_pFrame->GetTextNodeForParaProps()->GetSwAttrSet();
         nWidLines = rSet.GetWidows().GetValue();
     }
 
commit 959230b07c5feddadaa85297ef408e46390c196a
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 15:31:37 2018 +0200

    sw_redlinehide: trivial node conversions in porrst.cxx
    
    Change-Id: Idecf55238d42b3ec89278cfb792afe72471b0793

diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx
index 5d85adbf3c6d..5631e8434ce0 100644
--- a/sw/source/core/text/porrst.cxx
+++ b/sw/source/core/text/porrst.cxx
@@ -224,7 +224,7 @@ SwTwips SwTextFrame::EmptyHeight() const
     OSL_ENSURE( ! IsVertical() || ! IsSwapped(),"SwTextFrame::EmptyHeight with swapped frame" );
 
     SwFont *pFnt;
-    const SwTextNode& rTextNode = *GetTextNode();
+    const SwTextNode& rTextNode = *GetTextNodeForParaProps();
     const IDocumentSettingAccess* pIDSA = rTextNode.getIDocumentSettingAccess();
     SwViewShell *pSh = getRootFrame()->GetCurrShell();
     if ( rTextNode.HasSwAttrSet() )
@@ -256,8 +256,8 @@ SwTwips SwTextFrame::EmptyHeight() const
         if( SwRedlineTable::npos != nRedlPos )
         {
             SwAttrHandler aAttrHandler;
-            aAttrHandler.Init(  GetTextNode()->GetSwAttrSet(),
-                               *GetTextNode()->getIDocumentSettingAccess() );
+            aAttrHandler.Init(rTextNode.GetSwAttrSet(),
+                              *rTextNode.getIDocumentSettingAccess());
             SwRedlineItr aRedln( rTextNode, *pFnt, aAttrHandler,
                                  nRedlPos, SwRedlineItr::Mode::Show);
         }
@@ -284,12 +284,13 @@ bool SwTextFrame::FormatEmpty()
 
     bool bCollapse = EmptyHeight( ) == 1 && IsCollapse( );
 
-    if ( HasFollow() || GetTextNode()->GetpSwpHints() ||
-        nullptr != GetTextNode()->GetNumRule() ||
+    // sw_redlinehide: just disable FormatEmpty optimisation for now
+    if (HasFollow() || GetMergedPara() || GetTextNodeFirst()->GetpSwpHints() ||
+        nullptr != GetTextNodeForParaProps()->GetNumRule() ||
         GetTextNode()->HasHiddenCharAttribute( true ) ||
          IsInFootnote() || ( HasPara() && GetPara()->IsPrepMustFit() ) )
         return false;
-    const SwAttrSet& aSet = GetTextNode()->GetSwAttrSet();
+    const SwAttrSet& aSet = GetTextNodeForParaProps()->GetSwAttrSet();
     const SvxAdjust nAdjust = aSet.GetAdjust().GetAdjust();
     if( !bCollapse && ( ( ( ! IsRightToLeft() && ( SvxAdjust::Left != nAdjust ) ) ||
           (   IsRightToLeft() && ( SvxAdjust::Right != nAdjust ) ) ) ||
@@ -310,7 +311,7 @@ bool SwTextFrame::FormatEmpty()
 
     SwTwips nHeight = EmptyHeight();
 
-    if ( GetTextNode()->GetSwAttrSet().GetParaGrid().GetValue() &&
+    if (aSet.GetParaGrid().GetValue() &&
             IsInDocBody() )
     {
         SwTextGridItem const*const pGrid(GetGridItem(FindPageFrame()));
@@ -386,7 +387,7 @@ bool SwTextFrame::FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff )
                             OutputDevice *pOut = nullptr;
                             if( !pSh || !pSh->GetViewOptions()->getBrowseMode() ||
                                 pSh->GetViewOptions()->IsPrtFormat() )
-                                pOut = GetTextNode()->getIDocumentDeviceAccess().getReferenceDevice( true );
+                                pOut = GetDoc().getIDocumentDeviceAccess().getReferenceDevice( true );
 
                             if( pSh && !pOut )
                                 pOut = pSh->GetWin();
commit 3163fe3be3ab383786dc1505552ed836a0a1d382
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 15:09:04 2018 +0200

    sw_redlinehide: convert SwTextFrame::MakePos() which has...
    
    ... and odd LOKit notification loop that looks a bit unoptimised.
    
    Change-Id: I9b510f1bc8c295bb9b871ce5cc6060dbd8b96bcb

diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index f6cb776baf15..40ed097b1200 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -351,14 +351,20 @@ void SwTextFrame::MakePos()
     // Inform LOK clients about change in position of redlines (if any)
     if(comphelper::LibreOfficeKit::isActive())
     {
-        const SwTextNode& rTextNode = *GetTextNode();
-        const SwRedlineTable& rTable = rTextNode.getIDocumentRedlineAccess().GetRedlineTable();
+        SwTextNode const* pTextNode = GetTextNodeFirst();
+        const SwRedlineTable& rTable = pTextNode->getIDocumentRedlineAccess().GetRedlineTable();
         for (SwRedlineTable::size_type nRedlnPos = 0; nRedlnPos < rTable.size(); ++nRedlnPos)
         {
             SwRangeRedline* pRedln = rTable[nRedlnPos];
-            if (rTextNode.GetIndex() == pRedln->GetPoint()->nNode.GetNode().GetIndex())
+            if (pTextNode->GetIndex() == pRedln->GetPoint()->nNode.GetNode().GetIndex())
             {
                 pRedln->MaybeNotifyRedlinePositionModification(getFrameArea().Top());
+                if (GetMergedPara()
+                    && pRedln->GetType() == nsRedlineType_t::REDLINE_DELETE
+                    && pRedln->GetPoint()->nNode != pRedln->GetMark()->nNode)
+                {
+                    pTextNode = pRedln->End()->nNode.GetNode().GetTextNode();
+                }
             }
         }
     }
commit 6ec3fd209f9a2b646a36d436d2345b8ff79d5df6
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 14:49:39 2018 +0200

    sw_redlinehide: trivial node conversions in headers
    
    Change-Id: I74607928dbc8e07df0bba8f3179797735f37a92a

diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index c0bf6f7aa46c..40bf57ebcebb 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -776,7 +776,8 @@ inline TextFrameIndex SwTextFormatInfo::GetReformatStart() const
 
 inline const SwAttrSet& SwTextFormatInfo::GetCharAttr() const
 {
-    return GetTextFrame()->GetTextNode()->GetSwAttrSet();
+    // sw_redlinehide: this is used for numbering/footnote number portions, so:
+    return GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet();
 }
 
 inline void SwTextFormatInfo::SetParaFootnote()
diff --git a/sw/source/core/text/itrform2.hxx b/sw/source/core/text/itrform2.hxx
index 8071c42455c9..bf9a6c8af749 100644
--- a/sw/source/core/text/itrform2.hxx
+++ b/sw/source/core/text/itrform2.hxx
@@ -152,7 +152,7 @@ public:
 
     void CtorInitTextFormatter( SwTextFrame *pFrame, SwTextFormatInfo *pInf );
     SwTextFormatter(SwTextFrame *pTextFrame, SwTextFormatInfo *pTextFormatInf)
-        : SwTextPainter(pTextFrame->GetTextNode())
+        : SwTextPainter(pTextFrame->GetTextNodeFirst())
         , bUnclipped(false)
     {
         CtorInitTextFormatter( pTextFrame, pTextFormatInf );
diff --git a/sw/source/core/text/itrpaint.hxx b/sw/source/core/text/itrpaint.hxx
index b9d3f03e974b..aa8807af1b0c 100644
--- a/sw/source/core/text/itrpaint.hxx
+++ b/sw/source/core/text/itrpaint.hxx
@@ -40,7 +40,7 @@ protected:
 
 public:
     SwTextPainter(SwTextFrame *pTextFrame, SwTextPaintInfo *pTextPaintInf)
-        : SwTextCursor(pTextFrame->GetTextNode())
+        : SwTextCursor(pTextFrame->GetTextNodeFirst())
     {
         CtorInitTextPainter( pTextFrame, pTextPaintInf );
     }
commit 63e7d9f1d5dd673d2c467b7690a670b4210d6e1b
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 14:47:36 2018 +0200

    sw_redlinehide: trivial node conversions in txtfly.cxx,txttab.cxx
    
    Change-Id: I6da08994e2f3f23f583f41bfc5ac6c4f6e5a5112

diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index d15a398ffa43..0d698da79ab9 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -802,7 +802,7 @@ bool SwTextFly::GetTop( const SwAnchoredObject* _pAnchoredObj,
             // object position and former text wrapping is applied.
             // This condition is typically for documents imported from the
             // OpenOffice.org file format.
-            const IDocumentSettingAccess* pIDSA = pCurrFrame->GetTextNode()->getIDocumentSettingAccess();
+            const IDocumentSettingAccess* pIDSA = &pCurrFrame->GetDoc().getIDocumentSettingAccess();
             if ( (  pIDSA->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ||
                    !pIDSA->get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) ) &&
                  ::FindContext( pTmp, SwFrameType::None ) == ::FindContext( pCurrFrame, SwFrameType::None ) )
@@ -855,7 +855,7 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList()
     // --> #108724# Page header/footer content doesn't have to wrap around
     //              floating screen objects
     const bool bFooterHeader = nullptr != pCurrFrame->FindFooterOrHeader();
-    const IDocumentSettingAccess* pIDSA = pCurrFrame->GetTextNode()->getIDocumentSettingAccess();
+    const IDocumentSettingAccess* pIDSA = &pCurrFrame->GetDoc().getIDocumentSettingAccess();
     // #i40155# - check, if frame is marked not to wrap
     const bool bWrapAllowed = ( pIDSA->get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) ||
                                     ( !pCurrFrame->IsInFootnote() && !bFooterHeader ) );
@@ -886,7 +886,7 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList()
         const long nLeft = aRectFnSet.GetLeft(aRect) + 1;
         const bool bR2L = pCurrFrame->IsRightToLeft();
 
-        const IDocumentDrawModelAccess& rIDDMA = pCurrFrame->GetTextNode()->getIDocumentDrawModelAccess();
+        const IDocumentDrawModelAccess& rIDDMA = pCurrFrame->GetDoc().getIDocumentDrawModelAccess();
 
         for( size_t i = 0; i < nCount; ++i )
         {
diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx
index 90bbe6d552ce..3c32608813c3 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -23,6 +23,7 @@
 #include <editeng/tstpitem.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <IDocumentSettingAccess.hxx>
+#include <doc.hxx>
 #include <frmatr.hxx>
 #include <SwPortionHandler.hxx>
 
@@ -76,7 +77,7 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto
 
         // #i91133#
         const bool bTabsRelativeToIndent =
-            m_pFrame->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::TABS_RELATIVE_TO_INDENT);
+            m_pFrame->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TABS_RELATIVE_TO_INDENT);
         const SwTwips nTabLeft = bRTL
                                  ? m_pFrame->getFrameArea().Right() -
                                    ( bTabsRelativeToIndent ? GetTabLeft() : 0 )
@@ -168,7 +169,7 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto
                        : ( ( nCount + 1 ) * nDefTabDist );
 
             // --> FME 2004-09-21 #117919 Minimum tab stop width is 1 or 51 twips:
-            const SwTwips nMinimumTabWidth = m_pFrame->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::TAB_COMPAT) ? 0 : 50;
+            const SwTwips nMinimumTabWidth = m_pFrame->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_COMPAT) ? 0 : 50;
             if( (  bRTL && nTabLeft - nNextPos >= nCurrentAbsPos - nMinimumTabWidth ) ||
                  ( !bRTL && nNextPos + nTabLeft <= nCurrentAbsPos + nMinimumTabWidth  ) )
             {
@@ -229,7 +230,7 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto
                       !pTabStop ||
                       nNextPos != m_aLineInf.GetListTabStopPosition() ) ||
                     // compatibility option TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
-                    m_pFrame->GetTextNode()->getIDocumentSettingAccess()->
+                    m_pFrame->GetDoc().getIDocumentSettingAccess().
                         get(DocumentSettingId::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST);
                 if ( bTabAtLeftMarginAllowed )
                 {
@@ -322,9 +323,10 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf )
     // Here we settle down ...
     SetFix( static_cast<sal_uInt16>(rInf.X()) );
 
-    const bool bTabCompat = rInf.GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::TAB_COMPAT);
-    const bool bTabOverflow = rInf.GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::TAB_OVERFLOW);
-    const bool bTabOverMargin = rInf.GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::TAB_OVER_MARGIN);
+    IDocumentSettingAccess const& rIDSA(rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess());
+    const bool bTabCompat = rIDSA.get(DocumentSettingId::TAB_COMPAT);
+    const bool bTabOverflow = rIDSA.get(DocumentSettingId::TAB_OVERFLOW);
+    const bool bTabOverMargin = rIDSA.get(DocumentSettingId::TAB_OVER_MARGIN);
 
     // The minimal width of a tab is one blank at least.
     // #i37686# In compatibility mode, the minimum width
@@ -437,7 +439,7 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf )
 
 bool SwTabPortion::PostFormat( SwTextFormatInfo &rInf )
 {
-    const bool bTabOverMargin = rInf.GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::TAB_OVER_MARGIN);
+    const bool bTabOverMargin = rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_OVER_MARGIN);
     // If the tab position is larger than the right margin, it gets scaled down by default.
     // However, if compat mode enabled, we allow tabs to go over the margin: the rest of the paragraph is not broken into lines.
     const sal_uInt16 nRight = bTabOverMargin ? GetTabPos() : std::min(GetTabPos(), rInf.Width());
@@ -451,7 +453,7 @@ bool SwTabPortion::PostFormat( SwTextFormatInfo &rInf )
     }
 
     const sal_uInt16 nWhich = GetWhichPor();
-    const bool bTabCompat = rInf.GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::TAB_COMPAT);
+    const bool bTabCompat = rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_COMPAT);
 
     if ( bTabOverMargin && POR_TABLEFT == nWhich )
     {
commit fcde9e4442c4b7d29270c2749863ff84fc37878a
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 14:28:22 2018 +0200

    sw_redlinehide: trivial node conversions in inftxt.cxx
    
    Change-Id: Ic823676c3a6a752aa90b9bccc6d425d982a075ce

diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index e850ade21484..4a0aef64c070 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1291,7 +1291,7 @@ void SwTextPaintInfo::DrawViewOpt( const SwLinePortion &rPor,
                  && !GetOpt().IsReadonly()
                  && SwViewOption::IsFieldShadings()
                  && ( POR_NUMBER != nWhich
-                      || m_pFrame->GetTextNode()->HasMarkedLabel())) // #i27615#
+                      || m_pFrame->GetTextNodeForParaProps()->HasMarkedLabel())) // #i27615#
             {
                 bDraw = true;
             }
@@ -1362,7 +1362,7 @@ const PropertyValues & SwTextFormatInfo::GetHyphValues() const
 
 bool SwTextFormatInfo::InitHyph( const bool bAutoHyphen )
 {
-    const SwAttrSet& rAttrSet = GetTextFrame()->GetTextNode()->GetSwAttrSet();
+    const SwAttrSet& rAttrSet = GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet();
     SetHanging( rAttrSet.GetHangingPunctuation().GetValue() );
     SetScriptSpace( rAttrSet.GetScriptSpace().GetValue() );
     SetForbiddenChars( rAttrSet.GetForbiddenRule().GetValue() );
@@ -1447,7 +1447,7 @@ bool SwTextFormatInfo::IsHyphenate() const
 
 const SwFormatDrop *SwTextFormatInfo::GetDropFormat() const
 {
-    const SwFormatDrop *pDrop = &GetTextFrame()->GetTextNode()->GetSwAttrSet().GetDrop();
+    const SwFormatDrop *pDrop = &GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet().GetDrop();
     if( 1 >= pDrop->GetLines() ||
         ( !pDrop->GetChars() && !pDrop->GetWholeWord() ) )
         pDrop = nullptr;
@@ -1582,7 +1582,7 @@ TextFrameIndex SwTextFormatInfo::ScanPortionEnd(TextFrameIndex const nStart,
     const sal_Unicode cThousandSep2 = ',' == cTabDec ? '.' : '\'';
 
     bool bNumFound = false;
-    const bool bTabCompat = GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::TAB_COMPAT);
+    const bool bTabCompat = GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_COMPAT);
 
     for( ; i < nEnd; ++i )
     {
@@ -1693,7 +1693,7 @@ SwTwips SwTextFormatInfo::GetLineWidth()
 {
     SwTwips nLineWidth = Width() - X();
 
-    const bool bTabOverMargin = GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(
+    const bool bTabOverMargin = GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
         DocumentSettingId::TAB_OVER_MARGIN);
     if (!bTabOverMargin)
         return nLineWidth;
commit 7ccb32c7d7d9c0e1c9104f66257c2ce2ea0604f2
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 14:21:21 2018 +0200

    sw_redlinehide: trivial node conversions in itrcrsr.cxx
    
    Change-Id: Id47d46cf376391c7156f3f1eea5d5a48e09367b2

diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 44c9212ff233..fb1e7fba9cb2 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -19,6 +19,7 @@
 
 #include <hintids.hxx>
 #include <ndtxt.hxx>
+#include <doc.hxx>
 #include <frmfmt.hxx>
 #include <paratr.hxx>
 #include <flyfrm.hxx>
@@ -164,13 +165,13 @@ void SwTextMargin::CtorInitTextMargin( SwTextFrame *pNewFrame, SwTextSizeInfo *p
 
     m_pInf = pNewInf;
     GetInfo().SetFont( GetFnt() );
-    const SwTextNode *pNode = m_pFrame->GetTextNode();
+    const SwTextNode *const pNode = m_pFrame->GetTextNodeForParaProps();
 
-    const SvxLRSpaceItem &rSpace = m_pFrame->GetTextNode()->GetSwAttrSet().GetLRSpace();
+    const SvxLRSpaceItem &rSpace = pNode->GetSwAttrSet().GetLRSpace();
     // #i95907#
     // #i111284#
     const bool bListLevelIndentsApplicableAndLabelAlignmentActive(
-        AreListLevelIndentsApplicableAndLabelAlignmentActive( *(m_pFrame->GetTextNode()) ) );
+        AreListLevelIndentsApplicableAndLabelAlignmentActive( *(m_pFrame->GetTextNodeForParaProps()) ) );
 
     // Carefully adjust the text formatting ranges.
 
@@ -248,7 +249,7 @@ void SwTextMargin::CtorInitTextMargin( SwTextFrame *pNewFrame, SwTextSizeInfo *p
             rSpace.IsAutoFirst() )
         {
             nFirstLineOfs = GetFnt()->GetSize( GetFnt()->GetActual() ).Height();
-            LanguageType aLang = pNode->GetLang( 0, 1, css::i18n::ScriptType::ASIAN);
+            LanguageType aLang = m_pFrame->GetTextNode()->GetLang( 0, 1, css::i18n::ScriptType::ASIAN);
             if (aLang != LANGUAGE_KOREAN && aLang != LANGUAGE_JAPANESE)
                 nFirstLineOfs<<=1;
 
@@ -325,7 +326,7 @@ void SwTextMargin::CtorInitTextMargin( SwTextFrame *pNewFrame, SwTextSizeInfo *p
         if( nFirst >= nRight )
             nFirst = nRight - 1;
     }
-    const SvxAdjustItem& rAdjust = m_pFrame->GetTextNode()->GetSwAttrSet().GetAdjust();
+    const SvxAdjustItem& rAdjust = m_pFrame->GetTextNodeForParaProps()->GetSwAttrSet().GetAdjust();
     nAdjust = rAdjust.GetAdjust();
 
     // left is left and right is right
@@ -1214,7 +1215,7 @@ bool SwTextCursor::GetCharRect( SwRect* pOrig, TextFrameIndex const nOfst,
         pCMS->m_p2Lines->aPortion.Pos().AdjustY(aCharPos.Y() );
     }
 
-    const bool bTabOverMargin = GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::TAB_OVER_MARGIN);
+    const bool bTabOverMargin = GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_OVER_MARGIN);
     // Make sure the cursor respects the right margin, unless in compat mode, where the tab size has priority over the margin size.
     if( pOrig->Left() > nTmpRight && !bTabOverMargin)
         pOrig->Pos().setX( nTmpRight );
commit f721de8abdc8f285e5bbc08d6288562f493c3843
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 14:10:15 2018 +0200

    sw_redlinehide: trivial node conversions in itrform2.cxx/itrpaint.cxx
    
    Change-Id: I25fcfb14dee92a9072608fe741f0cf335a749688

diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 260cf6705154..86e59b0effdf 100755
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -1103,7 +1103,7 @@ SwLinePortion *SwTextFormatter::WhichFirstPortion(SwTextFormatInfo &rInf)
                      "Rotated number portion trouble" );
 
             // If we're in the follow, then of course not
-            if( GetTextFrame()->GetTextNode()->GetNumRule() )
+            if (GetTextFrame()->GetTextNodeForParaProps()->GetNumRule())
                 pPor = static_cast<SwLinePortion*>(NewNumberPortion( rInf ));
             rInf.SetNumDone( true );
         }
@@ -1124,7 +1124,7 @@ SwLinePortion *SwTextFormatter::WhichFirstPortion(SwTextFormatInfo &rInf)
         // 10. Decimal tab portion at the beginning of each line in table cells
         if ( !pPor && !m_pCurr->GetPortion() &&
              GetTextFrame()->IsInTab() &&
-             GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::TAB_COMPAT) )
+             GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_COMPAT))
         {
             pPor = NewTabPortion( rInf, true );
         }
@@ -1255,8 +1255,8 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
                 else if ( SwMultiCreatorId::Ruby == pCreate->nId )
                 {
                     pTmp = new SwRubyPortion( *pCreate, *rInf.GetFont(),
-                                              *GetTextFrame()->GetTextNode()->getIDocumentSettingAccess(),
-                                              nEnd, TextFrameIndex(0), rInf );
+                          GetTextFrame()->GetDoc().getIDocumentSettingAccess(),
+                          nEnd, TextFrameIndex(0), rInf );
                 }
                 else if( SwMultiCreatorId::Rotate == pCreate->nId )
                     pTmp = new SwRotatedPortion( *pCreate, nEnd,
@@ -1334,7 +1334,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
                     // We have a decimal tab portion in the line and the next character has to be
                     // aligned at the tab stop position. We store the width from the beginning of
                     // the tab stop portion up to the portion containing the decimal separator:
-                  if ( GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::TAB_COMPAT) /*rInf.GetVsh()->IsTabCompat();*/ &&
+                  if (GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_COMPAT) /*rInf.GetVsh()->IsTabCompat();*/ &&
                          POR_TABDECIMAL == pLastTabPortion->GetWhichPor() )
                     {
                         OSL_ENSURE( rInf.X() >= pLastTabPortion->GetFix(), "Decimal tab stop position cannot be calculated" );
@@ -1604,7 +1604,7 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos)
     // In case of compat mode, it's possible that a tab portion is wider after
     // formatting than before. If this is the case, we also have to make sure
     // the SwLineLayout is wider as well.
-    if (GetInfo().GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::TAB_OVER_MARGIN))
+    if (GetInfo().GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_OVER_MARGIN))
     {
         sal_uInt16 nSum = 0;
         SwLinePortion* pPor = m_pCurr->GetFirstPortion();
@@ -1736,7 +1736,7 @@ void SwTextFormatter::CalcRealHeight( bool bNewLine )
                     // shrink first line of paragraph too on spacing < 100%
                     if (IsParaLine() &&
                         pSpace->GetInterLineSpaceRule() == SvxInterLineSpaceRule::Prop
-                        && GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::PROP_LINE_SPACING_SHRINKS_FIRST_LINE))
+                        && GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::PROP_LINE_SPACING_SHRINKS_FIRST_LINE))
                     {
                         long nTmp = pSpace->GetPropLineSpace();
                         // Word will render < 50% too but it's just not readable
@@ -2284,7 +2284,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
     // tdf#116486: consider also the upper margin from getFramePrintArea because intersections
     //             with this additional space should lead to repositioning of paragraphs
     //             For compatibility we grab a related compat flag:
-    if ( GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS) )
+    if (GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS))
     {
         const long nUpper = m_pFrame->getFramePrintArea().Top();
         // Increase the rectangle
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 2a73d47cf0af..295765d7f809 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -162,7 +162,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
     SwTwips nMaxRight = std::min( rPaint.Right(), Right() );
     const SwTwips nTmpLeft = GetInfo().X();
     //compatibility setting: allow tabstop text to exceed right margin
-    if( GetInfo().GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::TAB_OVER_MARGIN) )
+    if (GetInfo().GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_OVER_MARGIN))
     {
         SwLinePortion* pPorIter = pPor;
         while( pPorIter )
commit ec06b387a873af77b0d5068c8de07e41981e7bb8
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 13:58:10 2018 +0200

    sw_redlinehide: trivial node conversions in frmpaint.cxx
    
    Change-Id: I8ef3d0ca495d65d72506763fd10c137d53cfc47a

diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index 1ba4b8588d91..9d9107053399 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -126,9 +126,9 @@ SwExtraPainter::SwExtraPainter( const SwTextFrame *pFrame, SwViewShell *pVwSh,
         */
         nDivider = !rLineInf.GetDivider().isEmpty() ? rLineInf.GetDividerCountBy() : 0;
         nX = pFrame->getFrameArea().Left();
-        SwCharFormat* pFormat = rLineInf.GetCharFormat( const_cast<IDocumentStylePoolAccess&>(pFrame->GetNode()->getIDocumentStylePoolAccess()) );
+        SwCharFormat* pFormat = rLineInf.GetCharFormat( const_cast<IDocumentStylePoolAccess&>(pFrame->GetDoc().getIDocumentStylePoolAccess()) );
         OSL_ENSURE( pFormat, "PaintExtraData without CharFormat" );
-        pFnt.reset( new SwFont( &pFormat->GetAttrSet(), pFrame->GetTextNode()->getIDocumentSettingAccess() ) );
+        pFnt.reset( new SwFont(&pFormat->GetAttrSet(), &pFrame->GetDoc().getIDocumentSettingAccess()) );
         pFnt->Invalidate();
         pFnt->ChgPhysFnt( pSh, *pSh->GetOut() );
         pFnt->SetVertical( 0, pFrame->IsVertical() );
@@ -286,9 +286,9 @@ void SwTextFrame::PaintExtraData( const SwRect &rRect ) const
     if( getFrameArea().Top() > rRect.Bottom() || getFrameArea().Bottom() < rRect.Top() )
         return;
 
-    const SwTextNode& rTextNode = *GetTextNode();
-    const IDocumentRedlineAccess& rIDRA = rTextNode.getIDocumentRedlineAccess();
-    const SwLineNumberInfo &rLineInf = rTextNode.GetDoc()->GetLineNumberInfo();
+    SwDoc const& rDoc(GetDoc());
+    const IDocumentRedlineAccess& rIDRA = rDoc.getIDocumentRedlineAccess();
+    const SwLineNumberInfo &rLineInf = rDoc.GetLineNumberInfo();
     const SwFormatLineNumber &rLineNum = GetAttrSet()->GetLineNumber();
     bool bLineNum = !IsInTab() && rLineInf.IsPaintLineNumbers() &&
                ( !IsInFly() || rLineInf.IsCountInFlys() ) && rLineNum.IsCount();
@@ -387,8 +387,11 @@ void SwTextFrame::PaintExtraData( const SwRect &rRect ) const
     }
     else
     {
-        if ( SwRedlineTable::npos == rIDRA.GetRedlinePos(rTextNode, USHRT_MAX) )
+        if (!GetMergedPara() &&
+            SwRedlineTable::npos == rIDRA.GetRedlinePos(*GetTextNodeFirst(), USHRT_MAX))
+        {
             bRedLine = false;
+        }
 
         if( bLineNum && rLineInf.IsCountBlankLines() &&
             ( aExtra.HasNumber() || aExtra.HasDivider() ) )
@@ -464,7 +467,7 @@ bool SwTextFrame::PaintEmpty( const SwRect &rRect, bool bCheck ) const
         else if( pSh->GetWin() )
         {
             SwFont *pFnt;
-            const SwTextNode& rTextNode = *GetTextNode();
+            const SwTextNode& rTextNode = *GetTextNodeForParaProps();
             if ( rTextNode.HasSwAttrSet() )
             {
                 const SwAttrSet *pAttrSet = &( rTextNode.GetSwAttrSet() );
@@ -509,7 +512,7 @@ bool SwTextFrame::PaintEmpty( const SwRect &rRect, bool bCheck ) const
                 Point aPos = getFrameArea().Pos() + getFramePrintArea().Pos();
 
                 const SvxLRSpaceItem &rSpace =
-                    GetTextNode()->GetSwAttrSet().GetLRSpace();
+                    GetTextNodeForParaProps()->GetSwAttrSet().GetLRSpace();
 
                 if ( rSpace.GetTextFirstLineOfst() > 0 )
                     aPos.AdjustX(rSpace.GetTextFirstLineOfst() );
@@ -525,7 +528,7 @@ bool SwTextFrame::PaintEmpty( const SwRect &rRect, bool bCheck ) const
 
                 aPos.AdjustY(pFnt->GetAscent( pSh, *pSh->GetOut() ) );
 
-                if ( GetTextNode()->GetSwAttrSet().GetParaGrid().GetValue() &&
+                if (GetTextNodeForParaProps()->GetSwAttrSet().GetParaGrid().GetValue() &&
                      IsInDocBody() )
                 {
                     SwTextGridItem const*const pGrid(GetGridItem(FindPageFrame()));
commit 44b1d4f664a2fb4266479abed7e67e685d158de6
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 13:37:30 2018 +0200

    sw_redlinehide: trivial node conversion in itrtxt.cxx
    
    Change-Id: I9b23edb5463d9483ba33b4d569414ff5ac723d17

diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx
index cfd4d092ba6e..53c1c7c91b2b 100644
--- a/sw/source/core/text/itrtxt.cxx
+++ b/sw/source/core/text/itrtxt.cxx
@@ -35,11 +35,11 @@
 
 void SwTextIter::CtorInitTextIter( SwTextFrame *pNewFrame, SwTextInfo *pNewInf )
 {
-    SwTextNode *pNode = pNewFrame->GetTextNode();
-
     assert(pNewFrame->GetPara());
 
-    CtorInitAttrIter( *pNode, pNewFrame->GetPara()->GetScriptInfo(), pNewFrame );
+    CtorInitAttrIter( *pNewFrame->GetTextNodeFirst(), pNewFrame->GetPara()->GetScriptInfo(), pNewFrame );
+
+    SwTextNode const*const pNode = pNewFrame->GetTextNodeForParaProps();
 
     m_pFrame = pNewFrame;
     m_pInf = pNewInf;
commit f15df2167477761783d25e97f83f107b70cf8ac4
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 13:21:15 2018 +0200

    sw_redlinehide: dump the MergedPara to layout.xml
    
    Change-Id: I211a92823e7b949fe55e50e6b172a0883056a189

diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx
index 6db1895b80e8..11d332f5187e 100755
--- a/sw/source/core/layout/dbg_lay.cxx
+++ b/sw/source/core/layout/dbg_lay.cxx
@@ -775,7 +775,7 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, DbgAction n
     {
         aOut.append(" ");
         while (aOut.getLength() < 140) aOut.append(" ");
-        const OUString& text = static_cast<const SwTextFrame*>(pFrame)->GetTextNode()->GetText();
+        const OUString& text = static_cast<const SwTextFrame*>(pFrame)->GetText();
         OString o = OUStringToOString(text, RTL_TEXTENCODING_ASCII_US);
         aOut.append(o);
     }
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 0f951cd6f033..d29d7abdbd7a 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -328,6 +328,26 @@ void SwFrame::dumpAsXml( xmlTextWriterPtr writer ) const
             xmlTextWriterEndElement(writer);
         }
 
+        if (IsTextFrame())
+        {
+            const SwTextFrame *pTextFrame = static_cast<const SwTextFrame *>(this);
+            sw::MergedPara const*const pMerged(pTextFrame->GetMergedPara());
+            if (pMerged)
+            {
+                xmlTextWriterStartElement( writer, BAD_CAST( "merged" ) );
+                xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "paraPropsNodeIndex" ), "%" SAL_PRIuUINTPTR, pMerged->pParaPropsNode->GetIndex() );
+                for (auto const& e : pMerged->extents)
+                {
+                    xmlTextWriterStartElement( writer, BAD_CAST( "extent" ) );
+                    xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "txtNodeIndex" ), "%" SAL_PRIuUINTPTR, e.pNode->GetIndex() );
+                    xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "start" ), "%" SAL_PRIdINT32, e.nStart );
+                    xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "end" ), "%" SAL_PRIdINT32, e.nEnd );
+                    xmlTextWriterEndElement( writer );
+                }
+                xmlTextWriterEndElement( writer );
+            }
+        }
+
         xmlTextWriterStartElement( writer, BAD_CAST( "infos" ) );
         dumpInfosAsXml( writer );
         xmlTextWriterEndElement( writer );
@@ -426,7 +446,7 @@ void SwFrame::dumpAsXmlAttributes( xmlTextWriterPtr writer ) const
     if ( IsTextFrame(  ) )
     {
         const SwTextFrame *pTextFrame = static_cast<const SwTextFrame *>(this);
-        const SwTextNode *pTextNode = pTextFrame->GetTextNode();
+        const SwTextNode *pTextNode = pTextFrame->GetTextNodeFirst();
         xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "txtNodeIndex" ), TMP_FORMAT, pTextNode->GetIndex() );
     }
     if (IsHeaderFrame() || IsFooterFrame())
commit d6196611d067bd747e74e8a6442349de8d15e912
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 12:56:31 2018 +0200

    sw_redlinehide: convert checkApplyParagraphMarkFormatToNumbering()
    
    Put in an early exit too; for whatever reason this is only interested in
    empty hints at the end of the text...
    
    Change-Id: Ief9112ab9f610a8507707b3dcc11de4c26f75ec9

diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index a5011dee2212..9ba37a923740 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -418,47 +418,52 @@ SwLinePortion *SwTextFormatter::NewExtraPortion( SwTextFormatInfo &rInf )
  */
 static void checkApplyParagraphMarkFormatToNumbering( SwFont* pNumFnt, SwTextFormatInfo& rInf, const IDocumentSettingAccess* pIDSA )
 {
-    SwTextNode* node = rInf.GetTextFrame()->GetTextNode();
     if( !pIDSA->get(DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING ))
         return;
-    if( SwpHints* hints = node->GetpSwpHints())
+    TextFrameIndex const nTextLen(rInf.GetTextFrame()->GetText().getLength());
+    SwTextNode const* pNode(nullptr);
+    sw::MergedAttrIterReverse iter(*rInf.GetTextFrame());
+    for (SwTextAttr const* pHint = iter.PrevAttr(&pNode); pHint;
+         pHint = iter.PrevAttr(&pNode))
     {
-        for( size_t i = 0; i < hints->Count(); ++i )
+        TextFrameIndex const nHintStart(
+            rInf.GetTextFrame()->MapModelToView(pNode, pHint->GetStart()));
+        if (nHintStart < nTextLen)
+        {
+            break; // only those at para end are interesting
+        }
+        // Formatting for the paragraph mark is set to apply only to the
+        // (non-existent) extra character at end of the text node.
+        if (pHint->Which() == RES_TXTATR_AUTOFMT
+            && pHint->GetStart() == *pHint->End())
         {
-            SwTextAttr* hint = hints->Get( i );
-            // Formatting for the paragraph mark is set to apply only to the (non-existent) extra character
-            // the at end of the txt node.
-            if( hint->Which() == RES_TXTATR_AUTOFMT && hint->GetEnd() != nullptr
-                && hint->GetStart() == *hint->GetEnd() && hint->GetStart() == node->Len())
+            std::shared_ptr<SfxItemSet> pSet(pHint->GetAutoFormat().GetStyleHandle());
+
+            // Check each item and in case it should be ignored, then clear it.
+            std::unique_ptr<SfxItemSet> pCleanedSet;
+            if (pSet.get())
             {
-                std::shared_ptr<SfxItemSet> pSet(hint->GetAutoFormat().GetStyleHandle());
+                pCleanedSet = pSet->Clone();
 
-                // Check each item and in case it should be ignored, then clear it.
-                std::unique_ptr<SfxItemSet> pCleanedSet;
-                if (pSet.get())
+                SfxItemIter aIter(*pSet);
+                const SfxPoolItem* pItem = aIter.GetCurItem();
+                while (true)
                 {
-                    pCleanedSet = pSet->Clone();
+                    if (SwTextNode::IsIgnoredCharFormatForNumbering(pItem->Which()))
+                        pCleanedSet->ClearItem(pItem->Which());
 
-                    SfxItemIter aIter(*pSet);
-                    const SfxPoolItem* pItem = aIter.GetCurItem();
-                    while (true)
-                    {
-                        if (SwTextNode::IsIgnoredCharFormatForNumbering(pItem->Which()))
-                            pCleanedSet->ClearItem(pItem->Which());
+                    if (aIter.IsAtEnd())
+                        break;
 
-                        if (aIter.IsAtEnd())
-                            break;
-
-                        pItem = aIter.NextItem();
-                    }
+                    pItem = aIter.NextItem();
                 }
+            }
 
-                // Highlightcolor also needed to be untouched, but we can't have that just by clearing the item
-                Color nSaveHighlight = pNumFnt->GetHighlightColor();
+            // Highlightcolor also needed to be untouched, but we can't have that just by clearing the item
+            Color nSaveHighlight = pNumFnt->GetHighlightColor();
 
-                pNumFnt->SetDiffFnt(pCleanedSet.get(), pIDSA);
-                pNumFnt->SetHighlightColor(nSaveHighlight);
-            }
+            pNumFnt->SetDiffFnt(pCleanedSet.get(), pIDSA);
+            pNumFnt->SetHighlightColor(nSaveHighlight);
         }
     }
 }
commit 300f40c39deec917e90eb560ce51d7c1b35f77aa
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Fri May 18 12:54:24 2018 +0200

    sw_redlinehide: trivial conversions in txtfld.cxx
    
    Change-Id: I1b8d05a6d274f3826d99dd3f064f90232c54b384

diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index f1d5ef9f0dca..a5011dee2212 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -279,7 +279,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf,
         if( !bName )
         {
             pTmpFnt = new SwFont( *m_pFont );
-            pTmpFnt->SetDiffFnt( &pChFormat->GetAttrSet(), m_pFrame->GetTextNode()->getIDocumentSettingAccess() );
+            pTmpFnt->SetDiffFnt(&pChFormat->GetAttrSet(), &m_pFrame->GetDoc().getIDocumentSettingAccess());
         }
         {
             OUString const aStr( bName
@@ -471,7 +471,7 @@ SwNumberPortion *SwTextFormatter::NewNumberPortion( SwTextFormatInfo &rInf ) con
         return nullptr;
 
     SwNumberPortion *pRet = nullptr;
-    const SwTextNode* pTextNd = GetTextFrame()->GetTextNode();
+    const SwTextNode *const pTextNd = GetTextFrame()->GetTextNodeForParaProps();
     const SwNumRule* pNumRule = pTextNd->GetNumRule();
 
     // Has a "valid" number?


More information about the Libreoffice-commits mailing list