]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetfloat.C
Make it compile when USE_BOOST_FORMAT is unset
[lyx.git] / src / insets / insetfloat.C
index 328e3566799fcea6fa50427642257635be08eb36..75a6746df9a33bd9a80e8be472d59b0e669e8044 100644 (file)
@@ -1,12 +1,13 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file insetfloat.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
+ * \author Jürgen Vigna
+ * \author Lars Gullik Bjønnes
  *
- *          Copyright 1998-2001 The LyX Team.
- *
- * ====================================================== */
-
+ * Full author contact details are available in file CREDITS
+ */
 #include <config.h>
 
 #ifdef __GNUG__
@@ -29,6 +30,7 @@
 #include "frontends/LyXView.h"
 #include "frontends/Dialogs.h"
 #include "lyxlex.h"
+#include "iterators.h"
 
 using std::ostream;
 using std::endl;
@@ -239,7 +241,8 @@ int InsetFloat::latex(Buffer const * buf,
        if (!floatPlacement_.empty()
            && floatPlacement_ != def_placement) {
                placement = floatPlacement_;
-       } else if (!buf_placement.empty()
+       } else if (floatPlacement_.empty() 
+                  && !buf_placement.empty()
                   && buf_placement != def_placement) {
                placement = buf_placement;
        }
@@ -337,11 +340,13 @@ bool InsetFloat::wide() const
 
 void InsetFloat::addToToc(toc::TocList & toclist, Buffer const * buf) const
 {
-       // Now find the caption in the float...
-       // We now tranverse the paragraphs of
-       // the inset...
-       Paragraph * tmp = inset.paragraph();
-       while (tmp) {
+       ParIterator pit(inset.paragraph());
+       ParIterator end;
+
+       // Find a caption layout in one of the (child inset's) pars
+       for (; pit != end; ++pit) {
+               Paragraph * tmp = *pit;
                if (tmp->layout()->name() == caplayout) {
                        string const str =
                                tostr(toclist[type()].size() + 1)
@@ -349,6 +354,5 @@ void InsetFloat::addToToc(toc::TocList & toclist, Buffer const * buf) const
                        toc::TocItem const item(tmp, 0 , str);
                        toclist[type()].push_back(item);
                }
-               tmp = tmp->next();
        }
 }