Kaydet (Commit) 6a5dbe73 authored tarafından Luboš Luňák's avatar Luboš Luňák

do not iterate over all bookmarks in SwTxtNode::Update()

3f987218 introduced new API for fast finding of marks to a specific text node,
so use that (code itself based on cb46aaf2).
This makes mailmerge faster (since it can create a huge document, and especially
with the change to use UNO bookmarks to mark starts of MM documents inside
the larger single document there can be a large number of marks).

Change-Id: I30ec69acf423e9a62fae5f5492ed8744cb727a56
üst 123e49d6
......@@ -1067,12 +1067,19 @@ void SwTxtNode::Update(
{
bool bAtLeastOneBookmarkMoved = false;
bool bAtLeastOneExpandedBookmarkAtInsertionPosition = false;
const IDocumentMarkAccess* const pMarkAccess = getIDocumentMarkAccess();
for ( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin();
ppMark != pMarkAccess->getAllMarksEnd();
++ppMark )
{
const ::sw::mark::IMark* const pMark = ppMark->get();
// A text node already knows its marks via its SwIndexes.
std::set<const sw::mark::IMark*> aSeenMarks;
const SwIndex* next;
for (const SwIndex* pIndex = GetFirstIndex(); pIndex; pIndex = next )
{
next = pIndex->GetNext();
const sw::mark::IMark* pMark = pIndex->GetMark();
if (!pMark)
continue;
// Only handle bookmarks once, if they start and end at this node as well.
if (aSeenMarks.find(pMark) != aSeenMarks.end())
continue;
aSeenMarks.insert(pMark);
const SwPosition* pEnd = &pMark->GetMarkEnd();
SwIndex & rEndIdx = const_cast<SwIndex&>(pEnd->nContent);
if( this == &pEnd->nNode.GetNode() &&
......
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