In KoTextDocumentLayout::documentChanged update only following pages (fixes loop)

Sebastian Sauer mail at dipe.org
Sun May 15 20:36:48 BST 2011


Hi,

please see following patch for libs/textlayout/KoTextDocumentLayout.cpp to 
prevent doing full relayouts just cause we update the page-variable.

This fixes the infinite loop with the 
http://www.zagge.de/anchor/110407/wiki.services.openoffice.org%252Fw%252Fimages%252F9%252F91%252F%25305%25308IG3-
SlidesNotesHandouts.odt
http://www.zagge.de/anchor/110407/wiki.services.openoffice.org%252Fw%252Fimages%252Fe%252Fe6%252F%25303%25304CG-
ChartsAndGraphs.odt

Ok to commit (will remove the #if 0-part + add dox before)?

diff --git a/libs/textlayout/KoTextDocumentLayout.cpp 
b/libs/textlayout/KoTextDocumentLayout.cpp
index 71f7b91..0a5ec61 100644
--- a/libs/textlayout/KoTextDocumentLayout.cpp
+++ b/libs/textlayout/KoTextDocumentLayout.cpp
@@ -245,12 +245,21 @@ void KoTextDocumentLayout::documentChanged(int position, 
int charsRemoved, int c
         from = block.position() + block.length();
     }

+#if 0
 //TODO FIXME make corresponding root area as dirty and then do layout
 // right now we are just marking all as dirty
     foreach (KoTextLayoutRootArea *rootArea, d->rootAreaList) {
         if (!rootArea->isDirty())
             rootArea->setDirty();
     }
+#else
+    KoTextLayoutRootArea *area = rootAreaForPosition(position);
+    if (!area)
+        return;
+    for(int i = qMax(0, d->rootAreaList.indexOf(area)); i < d-
>rootAreaList.count(); ++i)
+        d->rootAreaList[i]->setDirty();
+#endif
+
     emitLayoutIsDirty();
 }
 



More information about the calligra-devel mailing list