tdf#158783 sw: add some asserts for calling SelectTextAttr() ...
... with mismatched point node and SwTextAttr. Unfortunately SwTextAttr
doesn't have a member that points to the node, just half of its
subclasses do...
Change-Id: I78193ac47a9287f01b236b71934053299d0ffb23
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161928
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 1ca95f7..41437f0 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -2218,6 +2218,7 @@ bool SwCursorShell::SelectTextModel( const sal_Int32 nStart,
SwCursorSaveState aSaveState( *m_pCurrentCursor );
SwPosition& rPos = *m_pCurrentCursor->GetPoint();
assert(nEnd <= rPos.GetNode().GetTextNode()->Len());
m_pCurrentCursor->DeleteMark();
rPos.SetContent(nStart);
m_pCurrentCursor->SetMark();
@@ -2292,7 +2293,9 @@ bool SwCursorShell::SelectTextAttr( sal_uInt16 nWhich,
return false;
const sal_Int32* pEnd = pTextAttr->End();
bool bRet = SelectTextModel(pTextAttr->GetStart(), (pEnd ? *pEnd : pTextAttr->GetStart() + 1));
sal_Int32 const nEnd(pEnd ? *pEnd : pTextAttr->GetStart() + 1);
assert(nEnd <= m_pCurrentCursor->GetPoint()->GetNode().GetTextNode()->Len());
bool bRet = SelectTextModel(pTextAttr->GetStart(), nEnd);
return bRet;
}
diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index 39443f7..a0a8a2f 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -923,6 +923,7 @@ void SwIndexMarkPane::UpdateDialog()
m_xKey1DCB->set_sensitive(bEnable);
m_xKey2DCB->set_sensitive(bEnable);
assert(pMark->GetTextTOXMark()->GetTextNode() == m_pSh->GetCursor_()->GetPoint()->GetNode());
m_pSh->SelectTextAttr( RES_TXTATR_TOXMARK, pMark->GetTextTOXMark() );
// we need the point at the start of the attribute
m_pSh->SwapPam();