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

Sebastian Sauer mail at dipe.org
Sun May 15 21:24:23 BST 2011


On Sunday 15 May 2011 21:52:07 C. Boemann wrote:
> On Sunday 15 May 2011 21:36:48 Sebastian Sauer wrote:
> > 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%252F
> > im ages%252F9%252F91%252F%25305%25308IG3- SlidesNotesHandouts.odt
> > http://www.zagge.de/anchor/110407/wiki.services.openoffice.org%252Fw%252F
> > im ages%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();
> >  
> >  }
> > 
> > _______________________________________________
> > calligra-devel mailing list
> > calligra-devel at kde.org
> > https://mail.kde.org/mailman/listinfo/calligra-devel
> 
> i think it's should be
> 
> qMax(0, d->rootAreaList.indexOf(area) - 1)
> 
> as a change on one page might allow it to fit on the previous page

Done & committed.

> it should also be possible to calc something similar for the last page to
> loop

Why for the last page?. Guess we also need a more clever toc now that only 
updates under some conditions....



More information about the calligra-devel mailing list