diff options
Diffstat (limited to 'sw/source/core')
-rw-r--r-- | sw/source/core/inc/txtfrm.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/layout/frmtool.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/text/itratr.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/text/itratr.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/text/redlnitr.cxx | 15 | ||||
-rw-r--r-- | sw/source/core/text/txtdrop.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/text/txtfrm.cxx | 16 | ||||
-rw-r--r-- | sw/source/core/txtnode/ndtxt.cxx | 3 |
8 files changed, 35 insertions, 19 deletions
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index 51a71c499662..b9bb1b498496 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -437,6 +437,7 @@ public: /// Returns the text portion we want to edit (for inline see underneath) const OUString& GetText() const; SwTextNode const* GetTextNodeForParaProps() const; + SwTextNode const* GetTextNodeForFirstText() const; SwTextNode * GetTextNodeFirst() { return const_cast<SwTextNode*>(const_cast<SwTextFrame const*>(this)->GetTextNodeFirst()); }; SwTextNode const* GetTextNodeFirst() const; diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 4cf8effa38e2..9790d77241d1 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -1170,10 +1170,6 @@ void AppendObjs(const SwFrameFormats *const pTable, sal_uLong const nIndex, { AppendObjsOfNode(pTable, pNode->GetIndex(), pFrame, pPage, pDoc, &iterFirst, &iter); } - else - { - assert(pMerged->pParaPropsNode == iter->pNode); // first iteration - } pNode = iter->pNode; iterFirst = iter; } diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index 298214fc9ea2..d7d8f7a0aefc 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -204,7 +204,7 @@ bool SwAttrIter::SeekStartAndChgAttrIter( OutputDevice* pOut, const bool bParaFo { assert(m_pMergedPara); m_pTextNode = m_pMergedPara->pFirstNode; - InitFontAndAttrHandler(*m_pTextNode, m_pMergedPara->mergedText, nullptr); + InitFontAndAttrHandler(*m_pMergedPara->pParaPropsNode, *m_pTextNode, m_pMergedPara->mergedText, nullptr); } // reset font to its original state @@ -338,7 +338,7 @@ bool SwAttrIter::Seek(TextFrameIndex const nNewPos) // items at all; it can only apply a previously effective item. // So do this by recreating the font from scratch. // Apply new para items: - InitFontAndAttrHandler(*newPos.first, m_pMergedPara->mergedText, nullptr); + InitFontAndAttrHandler(*m_pMergedPara->pParaPropsNode, *newPos.first, m_pMergedPara->mergedText, nullptr); // reset to next m_pTextNode = newPos.first; m_nStartIndex = 0; @@ -360,7 +360,7 @@ bool SwAttrIter::Seek(TextFrameIndex const nNewPos) m_pTextNode = newPos.first; // sw_redlinehide: hope it's okay to use the current text node // here; the AttrHandler shouldn't care about non-char items - InitFontAndAttrHandler(*m_pTextNode, m_pMergedPara->mergedText, nullptr); + InitFontAndAttrHandler(*m_pMergedPara->pParaPropsNode, *m_pTextNode, m_pMergedPara->mergedText, nullptr); } } if (m_pMergedPara || m_pTextNode->GetpSwpHints()) @@ -1417,8 +1417,7 @@ SwTwips SwTextNode::GetWidthOfLeadingTabs() const { // Only consider master frames: if (!pFrame->IsFollow() && - // sw_redlinehide: paraPropsNode has the first text of the frame - (!pFrame->GetMergedPara() || pFrame->GetMergedPara()->pParaPropsNode == this)) + pFrame->GetTextNodeForFirstText() == this) { SwRectFnSet aRectFnSet(pFrame); SwRect aRect; diff --git a/sw/source/core/text/itratr.hxx b/sw/source/core/text/itratr.hxx index 959436609608..2dddd1265d8c 100644 --- a/sw/source/core/text/itratr.hxx +++ b/sw/source/core/text/itratr.hxx @@ -65,7 +65,8 @@ private: void SeekFwd(sal_Int32 nOldPos, sal_Int32 nNewPos); void SetFnt( SwFont* pNew ) { m_pFont = pNew; } - void InitFontAndAttrHandler(SwTextNode const& rTextNode, + void InitFontAndAttrHandler( + SwTextNode const& rPropsNode, SwTextNode const& rTextNode, OUString const& rText, bool const* pbVertLayout); protected: diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx index 96149b522c63..7f4669290f9c 100644 --- a/sw/source/core/text/redlnitr.cxx +++ b/sw/source/core/text/redlnitr.cxx @@ -218,13 +218,14 @@ CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode, if (extents.empty()) // there was no text anywhere { assert(mergedText.isEmpty()); - pParaPropsNode = &rTextNode; // if every node is empty, the first one wins +// pParaPropsNode = &rTextNode; // if every node is empty, the first one wins } else { assert(!mergedText.isEmpty()); - pParaPropsNode = extents.begin()->pNode; // para props from first node that isn't empty +// pParaPropsNode = extents.begin()->pNode; // para props from first node that isn't empty } + pParaPropsNode = &rTextNode; // well, actually... // keep lists up to date with visible nodes if (pParaPropsNode->IsInList() && !pParaPropsNode->GetNum(rFrame.getRootFrame())) { @@ -299,12 +300,14 @@ CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode, } // namespace sw -void SwAttrIter::InitFontAndAttrHandler(SwTextNode const& rTextNode, +void SwAttrIter::InitFontAndAttrHandler( + SwTextNode const& rPropsNode, + SwTextNode const& rTextNode, OUString const& rText, bool const*const pbVertLayout) { // Build a font matching the default paragraph style: - SwFontAccess aFontAccess( &rTextNode.GetAnyFormatColl(), m_pViewShell ); + SwFontAccess aFontAccess( &rPropsNode.GetAnyFormatColl(), m_pViewShell ); // It is possible that Init is called more than once, e.g., in a // SwTextFrame::FormatOnceMore situation or (since sw_redlinehide) // from SwAttrIter::Seek(); in the latter case SwTextSizeInfo::m_pFnt @@ -395,7 +398,9 @@ void SwAttrIter::CtorInitAttrIter(SwTextNode & rTextNode, if (m_pScriptInfo->GetInvalidityA() != TextFrameIndex(COMPLETE_STRING)) m_pScriptInfo->InitScriptInfo(rTextNode, m_pMergedPara, bRTL); - InitFontAndAttrHandler(rTextNode, + InitFontAndAttrHandler( + m_pMergedPara ? *m_pMergedPara->pParaPropsNode : rTextNode, + rTextNode, m_pMergedPara ? m_pMergedPara->mergedText : rTextNode.GetText(), & bVertLayout); diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx index 7f05cec97066..0582c8ca3d04 100644 --- a/sw/source/core/text/txtdrop.cxx +++ b/sw/source/core/text/txtdrop.cxx @@ -249,8 +249,7 @@ bool SwTextNode::GetDropSize(int& rFontHeight, int& rDropHeight, int& rDropDesce { // Only (master-) text frames can have a drop cap. if (!pLastFrame->IsFollow() && - // sw_redlinehide: paraPropsNode has the first text of the frame - (!pLastFrame->GetMergedPara() || pLastFrame->GetMergedPara()->pParaPropsNode == this)) + pLastFrame->GetTextNodeForFirstText() == this) { if( !pLastFrame->HasPara() ) diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index db6b3d3b28df..485da73d1b09 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -1061,6 +1061,7 @@ TextFrameIndex UpdateMergedParaForDelete(MergedPara & rMerged, // pFirstNode is never updated if (nErased && nErased == nFoundNode) { // all visible text from node was erased +#if 0 if (rMerged.pParaPropsNode == &rNode) { rMerged.pParaPropsNode->RemoveFromListRLHidden(); @@ -1069,6 +1070,7 @@ TextFrameIndex UpdateMergedParaForDelete(MergedPara & rMerged, : rMerged.extents.front().pNode; rMerged.pParaPropsNode->AddToListRLHidden(); } +#endif // NOPE must listen on all non-hidden nodes; particularly on pLastNode rMerged.listener.EndListening(&const_cast<SwTextNode&>(rNode)); } rMerged.mergedText = text.makeStringAndClear(); @@ -1219,7 +1221,21 @@ SwTextNode const* SwTextFrame::GetTextNodeForParaProps() const //nope assert(GetPara()); sw::MergedPara const*const pMerged(GetMergedPara()); if (pMerged) + { + assert(pMerged->pFirstNode == pMerged->pParaPropsNode); // surprising news! return pMerged->pParaPropsNode; + } + else + return static_cast<SwTextNode const*>(SwFrame::GetDep()); +} + +SwTextNode const* SwTextFrame::GetTextNodeForFirstText() const +{ + sw::MergedPara const*const pMerged(GetMergedPara()); + if (pMerged) + return pMerged->extents.empty() + ? pMerged->pFirstNode + : pMerged->extents.front().pNode; else return static_cast<SwTextNode const*>(SwFrame::GetDep()); } diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 71b046aa9225..e1df1ea4dea9 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -4291,8 +4291,7 @@ void SwTextNode::AddToList() { if (pFrame->getRootFrame()->IsHideRedlines()) { - sw::MergedPara const*const pMerged = pFrame->GetMergedPara(); - if (!pMerged || this == pMerged->pParaPropsNode) + if (pFrame->GetTextNodeForParaProps() == this) { AddToListRLHidden(); } |