]> git.lyx.org Git - lyx.git/blobdiff - src/Text.cpp
de.po
[lyx.git] / src / Text.cpp
index 70f8eaa4723fb229dda2f96ac794bba2ef393f9b..98cedccf9c93d213532b2387c72a739c08153e72 100644 (file)
@@ -288,6 +288,35 @@ Font const Text::outerFont(pit_type par_offset) const
 }
 
 
+int Text::getEndLabel(pit_type p) const
+{
+       pit_type pit = p;
+       depth_type par_depth = pars_[p].getDepth();
+       while (pit != pit_type(pars_.size())) {
+               Layout const & layout = pars_[pit].layout();
+               int const endlabeltype = layout.endlabeltype;
+
+               if (endlabeltype != END_LABEL_NO_LABEL) {
+                       if (p + 1 == pit_type(pars_.size()))
+                               return endlabeltype;
+
+                       depth_type const next_depth =
+                               pars_[p + 1].getDepth();
+                       if (par_depth > next_depth ||
+                           (par_depth == next_depth && layout != pars_[p + 1].layout()))
+                               return endlabeltype;
+                       break;
+               }
+               if (par_depth == 0)
+                       break;
+               pit = outerHook(pit);
+               if (pit != pit_type(pars_.size()))
+                       par_depth = pars_[pit].getDepth();
+       }
+       return END_LABEL_NO_LABEL;
+}
+
+
 static void acceptOrRejectChanges(ParagraphList & pars,
        BufferParams const & bparams, Text::ChangeOp op)
 {
@@ -2047,7 +2076,7 @@ docstring Text::getPossibleLabel(DocIterator const & cur) const
        // We need a unique label
        docstring label = text;
        int i = 1;
-       while (cur.buffer()->insetLabel(label)) {
+       while (cur.buffer()->activeLabel(label)) {
                        label = text + '-' + convert<docstring>(i);
                        ++i;
                }