Kaydet (Commit) 7ea2597a authored tarafından Oliver-Rainer Wittmann's avatar Oliver-Rainer Wittmann Kaydeden (comit) Caolán McNamara

Resolves: #i125055# follow-up of fix for #i124338#

adjust condition to trigger sort of bookmarks in order to avoid serious
performance decrease

Kudos to Ariel for his analysis

(cherry picked from commit 6895a55d)

Change-Id: Ic72b0a07556ec85a6ee2568f814b8bcfaaabe42e
(cherry picked from commit 61df5e69)
üst e6d6a59f
......@@ -1056,6 +1056,8 @@ void SwTxtNode::Update(
// Bookmarks must never grow to either side, when editing (directly) to the left or right (#i29942#)!
// And a bookmark with same start and end must remain to the left of the inserted text (used in XML import).
{
bool bAtLeastOneBookmarkMoved = false;
bool bAtLeastOneExpandedBookmarkAtInsertionPosition = false;
const IDocumentMarkAccess* const pMarkAccess = getIDocumentMarkAccess();
for ( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin();
ppMark != pMarkAccess->getAllMarksEnd();
......@@ -1063,14 +1065,28 @@ void SwTxtNode::Update(
{
const ::sw::mark::IMark* const pMark = ppMark->get();
const SwPosition* pEnd = &pMark->GetMarkEnd();
SwIndex & rIdx = const_cast<SwIndex&>(pEnd->nContent);
SwIndex & rEndIdx = const_cast<SwIndex&>(pEnd->nContent);
if( this == &pEnd->nNode.GetNode() &&
rPos.GetIndex() == rIdx.GetIndex() )
rPos.GetIndex() == rEndIdx.GetIndex() )
{
rIdx.Assign( &aTmpIdxReg, rIdx.GetIndex() );
bSortMarks = true;
rEndIdx.Assign( &aTmpIdxReg, rEndIdx.GetIndex() );
bAtLeastOneBookmarkMoved = true;
}
else if ( !bAtLeastOneExpandedBookmarkAtInsertionPosition )
{
if ( pMark->IsExpanded() )
{
const SwPosition* pStart = &pMark->GetMarkStart();
if ( this == &pStart->nNode.GetNode()
&& rPos.GetIndex() == pStart->nContent.GetIndex() )
{
bAtLeastOneExpandedBookmarkAtInsertionPosition = true;
}
}
}
}
bSortMarks = bAtLeastOneBookmarkMoved && bAtLeastOneExpandedBookmarkAtInsertionPosition;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment