diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-05-14 17:42:39 +0200 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-06-08 21:51:26 +0200 |
commit | 305591728395e3e32279b88a633d7852f0d98017 (patch) | |
tree | bde1029a032d7318b37e6c655ef449e50ffd6631 /sw | |
parent | b179f8ef41fa7ea26d09689cc2fa91d3908b63a5 (diff) |
sw_redlinehide: add MergedPara member to SwAttrIter
Change-Id: I304c333bb6aaca8933606b662743a1642c655de5
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/text/itratr.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/text/redlnitr.cxx | 32 |
2 files changed, 28 insertions, 8 deletions
diff --git a/sw/source/core/text/itratr.hxx b/sw/source/core/text/itratr.hxx index f1cc15dafae6..de11a6e170ef 100644 --- a/sw/source/core/text/itratr.hxx +++ b/sw/source/core/text/itratr.hxx @@ -24,6 +24,7 @@ #include <swfont.hxx> #include "porlay.hxx" +namespace sw { struct MergedPara; } class OutputDevice; class SwFont; class SwpHints; @@ -61,6 +62,7 @@ private: o3tl::enumarray<SwFontScript, sal_uInt16> m_aFontIdx; /// input: the current text node const SwTextNode* m_pTextNode; + sw::MergedPara const* m_pMergedPara; /// the 1st one, for reset const SwTextNode* m_pFirstTextNode; /// from view (text frame) index to current node index @@ -86,6 +88,7 @@ protected: , m_nPosition(0) , m_nPropFont(0) , m_pTextNode(pTextNode) + , m_pMergedPara(nullptr) , m_pFirstTextNode(pTextNode) , m_nCurrentIndexOffset(0) { @@ -98,6 +101,7 @@ public: /// SwTextFrame in certain special cases via this ctor here SwAttrIter( SwTextNode& rTextNode, SwScriptInfo& rScrInf ) : m_pViewShell(nullptr), m_pFont(nullptr), m_pHints(nullptr), m_pScriptInfo(nullptr), m_pLastOut(nullptr), m_nChgCnt(0), m_pRedline(nullptr),m_nPropFont(0), m_pTextNode(&rTextNode) + , m_pMergedPara(nullptr) , m_pFirstTextNode(&rTextNode) , m_nCurrentIndexOffset(0) { CtorInitAttrIter( rTextNode, rScrInf ); } diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx index 2363515cea8d..e8da906c0d42 100644 --- a/sw/source/core/text/redlnitr.cxx +++ b/sw/source/core/text/redlnitr.cxx @@ -132,7 +132,6 @@ void SwAttrIter::CtorInitAttrIter(SwTextNode & rTextNode, // set font to vertical if frame layout is vertical bool bVertLayout = false; bool bRTL = false; - sw::MergedPara const* pMerged(nullptr); if ( pFrame ) { if ( pFrame->IsVertical() ) @@ -141,7 +140,7 @@ void SwAttrIter::CtorInitAttrIter(SwTextNode & rTextNode, m_pFont->SetVertical( m_pFont->GetOrientation(), true ); } bRTL = pFrame->IsRightToLeft(); - pMerged = pFrame->GetMergedPara(); + m_pMergedPara = pFrame->GetMergedPara(); } // Initialize the default attribute of the attribute handler @@ -199,10 +198,10 @@ void SwAttrIter::CtorInitAttrIter(SwTextNode & rTextNode, // the node. It's not clear whether there can be more than 1 PaM in the // Ring, and this code doesn't handle that case; neither did the old code. const SwExtTextInput* pExtInp = pDoc->GetExtTextInput( rTextNode ); - if (!pExtInp && pMerged) + if (!pExtInp && m_pMergedPara) { SwTextNode const* pNode(&rTextNode); - for (auto const& rExtent : pMerged->extents) + for (auto const& rExtent : m_pMergedPara->extents) { if (rExtent.pNode != pNode) { @@ -214,16 +213,33 @@ void SwAttrIter::CtorInitAttrIter(SwTextNode & rTextNode, } } const bool bShow = IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineFlags() ); - if (pExtInp || pMerged || bShow) + if (pExtInp || m_pMergedPara || bShow) { - const SwRedlineTable::size_type nRedlPos = rIDRA.GetRedlinePos( rTextNode, USHRT_MAX ); - if (pExtInp || pMerged || SwRedlineTable::npos != nRedlPos) + SwRedlineTable::size_type nRedlPos = rIDRA.GetRedlinePos( rTextNode, USHRT_MAX ); + if (SwRedlineTable::npos == nRedlPos && m_pMergedPara) + { + SwTextNode const* pNode(&rTextNode); + for (auto const& rExtent : m_pMergedPara->extents) + { // note: have to search because extents based only on Delete + if (rExtent.pNode != pNode) + { + pNode = rExtent.pNode; + nRedlPos = rIDRA.GetRedlinePos(*pNode, USHRT_MAX); + if (SwRedlineTable::npos != nRedlPos) + break; + } + } + // TODO this is true initially but after delete ops it may be false... need to delete m_pMerged somewhere? + // assert(SwRedlineTable::npos != nRedlPos); + assert(SwRedlineTable::npos != nRedlPos || m_pMergedPara->extents.size() <= 1); + } + if (pExtInp || m_pMergedPara || SwRedlineTable::npos != nRedlPos) { const std::vector<ExtTextInputAttr> *pArr = nullptr; if( pExtInp ) { pArr = &pExtInp->GetAttrs(); - Seek( 0 ); + Seek( TextFrameIndex(0) ); } m_pRedline = new SwRedlineItr( rTextNode, *m_pFont, m_aAttrHandler, nRedlPos, |