sw: fix assertion on exporting novell633099-1.doc to DOC
This asserts because MarkManager::m_vAllMarks is not sorted. info:sw.core:32273:1:sw/source/core/doc/docbm.cxx:286: 1493,39 1493,39 N2sw4mark8BookmarkE _Source_Device_Configuration info:sw.core:32273:1:sw/source/core/doc/docbm.cxx:286: 1493,39 1493,39 N2sw4mark8BookmarkE _Deploying_the_Connector info:sw.core:32273:1:sw/source/core/doc/docbm.cxx:286: 1493,39 1493,39 N2sw4mark8BookmarkE _Setting_up_Connection info:sw.core:32273:1:sw/source/core/doc/docbm.cxx:286: 1493,39 1493,39 N2sw4mark8BookmarkE _Testing_the_Audit info:sw.core:32273:1:sw/source/core/doc/docbm.cxx:286: 1493,0 1493,0 N2sw4mark23CrossRefHeadingBookmarkE __RefHeading___Toc270687978 This happens while called from SwRangeRedline::MoveFromSection; the target paragraph has some normal bookmarks and a CrossRefBookmark all at index 0 before, but the move messes up the sorting. The reason is that SwIndexReg::Update() has a special case HACK to avoid adjusting the content index of CrossRefBookmark away from 0. Prevent the problem by tweaking the bookmark sort function to always sort CrossRefBookmark before other marks in the paragraph. Change-Id: I1373337a9c7e6760fdbe5b634a14c63428a2e73c
This commit is contained in:
@@ -78,7 +78,21 @@ namespace
|
||||
bool lcl_MarkOrderingByStart(const IDocumentMarkAccess::pMark_t& rpFirst,
|
||||
const IDocumentMarkAccess::pMark_t& rpSecond)
|
||||
{
|
||||
return rpFirst->GetMarkStart() < rpSecond->GetMarkStart();
|
||||
auto const& rFirstStart(rpFirst->GetMarkStart());
|
||||
auto const& rSecondStart(rpSecond->GetMarkStart());
|
||||
if (rFirstStart.nNode != rSecondStart.nNode)
|
||||
{
|
||||
return rFirstStart.nNode < rSecondStart.nNode;
|
||||
}
|
||||
if (rFirstStart.nContent != 0 || rSecondStart.nContent != 0)
|
||||
{
|
||||
return rFirstStart.nContent < rSecondStart.nContent;
|
||||
}
|
||||
auto *const pCRFirst (dynamic_cast<::sw::mark::CrossRefBookmark const*>(rpFirst.get()));
|
||||
auto *const pCRSecond(dynamic_cast<::sw::mark::CrossRefBookmark const*>(rpSecond.get()));
|
||||
return ((pCRFirst == nullptr) == (pCRSecond == nullptr))
|
||||
? false // equal
|
||||
: (pCRFirst != nullptr); // cross-ref sorts *before*
|
||||
}
|
||||
|
||||
bool lcl_MarkOrderingByEnd(const IDocumentMarkAccess::pMark_t& rpFirst,
|
||||
|
Reference in New Issue
Block a user