]> git.lyx.org Git - features.git/blobdiff - src/buffer_funcs.cpp
Introduce a labels&references cache at buffer level. This cache uses the already...
[features.git] / src / buffer_funcs.cpp
index eb3eb52349d44c08e501b8823937805974723dcf..1d9d65126320735616aa2cabb2d91e1cf14e9d9a 100644 (file)
@@ -29,7 +29,6 @@
 #include "LayoutPtr.h"
 #include "LyX.h"
 #include "TextClass.h"
-#include "TextClassList.h"
 #include "Paragraph.h"
 #include "paragraph_funcs.h"
 #include "ParagraphList.h"
@@ -201,8 +200,7 @@ int countChars(DocIterator const & from, DocIterator const & to, bool with_blank
                pos_type const pos = dit.pos();
 
                if (pos != dit.lastpos() && !par.isDeleted(pos)) {
-                       if (par.isInset(pos)) {
-                               Inset const * ins = par.getInset(pos);
+                       if (Inset const * ins = par.getInset(pos)) {
                                if (ins->isLetter())
                                        ++chars;
                                else if (with_blanks && ins->isSpace())
@@ -295,7 +293,7 @@ bool needEnumCounterReset(ParIterator const & it)
 // set the label of a paragraph. This includes the counters.
 void setLabel(Buffer const & buf, ParIterator & it)
 {
-       TextClass const & textclass = buf.params().getTextClass();
+       DocumentClass const & textclass = buf.params().documentClass();
        Paragraph & par = it.paragraph();
        LayoutPtr const & layout = par.layout();
        Counters & counters = textclass.counters();
@@ -470,10 +468,9 @@ void updateLabels(Buffer const & buf, ParIterator & parit)
                InsetList::const_iterator end = parit->insetList().end();
                for (; iit != end; ++iit) {
                        parit.pos() = iit->pos;
-                       iit->inset->updateLabels(buf, parit);
+                       iit->inset->updateLabels(parit);
                }
        }
-       
 }
 
 
@@ -483,7 +480,7 @@ void updateLabels(Buffer const & buf, bool childonly)
 {
        Buffer const * const master = buf.masterBuffer();
        // Use the master text class also for child documents
-       TextClass const & textclass = master->params().getTextClass();
+       DocumentClass const & textclass = master->params().documentClass();
 
        if (!childonly) {
                // If this is a child document start with the master
@@ -494,6 +491,7 @@ void updateLabels(Buffer const & buf, bool childonly)
 
                // start over the counters
                textclass.counters().reset();
+               buf.clearReferenceCache();
        }
 
        Buffer & cbuf = const_cast<Buffer &>(buf);