]> git.lyx.org Git - lyx.git/blobdiff - src/buffer.C
*** empty log message ***
[lyx.git] / src / buffer.C
index 67d895c460b4c7c1058202fdde62755e360440dd..de3fd4f81aea03605af530dc237748e8d67784ae 100644 (file)
 #include "converter.h"
 #include "BufferView.h"
 #include "ParagraphParameters.h"
+#include "iterators.h"
 
 using std::ostream;
 using std::ofstream;
@@ -299,12 +300,12 @@ std::stack<ErtComp> ert_stack;
 ErtComp ert_comp;
 #endif
 
-} // anon
-
-
 #warning And _why_ is this here? (Lgb)
 int unknown_layouts;
 
+} // anon
+
+
 // candidate for move to BufferView
 // (at least some parts in the beginning of the func)
 //
@@ -2718,7 +2719,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
 }
 
 
-void Buffer::docBookHandleCaption(ostream & os, string & inner_tag,
+void Buffer::docbookHandleCaption(ostream & os, string & inner_tag,
                                  Paragraph::depth_type depth, int desc_on,
                                  Paragraph * & par)
 {
@@ -3339,7 +3340,7 @@ void Buffer::simpleDocBookOnePar(ostream & os, string & extra,
                if (c == Paragraph::META_INSET) {
                        Inset * inset = par->getInset(i);
                        ostringstream ost;
-                       inset->docBook(this, ost);
+                       inset->docbook(this, ost);
                        string tmp_out = ost.str().c_str();
 
                        //
@@ -3573,10 +3574,21 @@ Buffer::Lists const Buffer::getLists() const
 {
        Lists l;
        Paragraph * par = paragraph;
+
+#if 1
+       std::pair<bool, LyXTextClassList::size_type> const tmp =
+               textclasslist.NumberOfLayout(params.textclass, "Caption");
+       bool const found = tmp.first;
+       LyXTextClassList::size_type const cap = tmp.second;
+       
+#else
+       // This is the prefered way to to this, but boost::tie can break
+       // some compilers
        bool found;
        LyXTextClassList::size_type cap;
        boost::tie(found, cap) = textclasslist
                .NumberOfLayout(params.textclass, "Caption");
+#endif
 
        while (par) {
                char const labeltype =
@@ -3753,22 +3765,19 @@ void Buffer::redraw()
 void Buffer::changeLanguage(Language const * from, Language const * to)
 {
 
-       Paragraph * par = paragraph;
-       while (par) {
-               par->changeLanguage(params, from, to);
-               par = par->next();
-       }
+       ParIterator end = par_iterator_end();
+       for (ParIterator it = par_iterator_begin(); it != end; ++it)
+               (*it)->changeLanguage(params, from, to);
 }
 
 
 bool Buffer::isMultiLingual()
 {
-       Paragraph * par = paragraph;
-       while (par) {
-               if (par->isMultiLingual(params))
+       ParIterator end = par_iterator_end();
+       for (ParIterator it = par_iterator_begin(); it != end; ++it)
+               if ((*it)->isMultiLingual(params))
                        return true;
-               par = par->next();
-       }
+
        return false;
 }
 
@@ -3829,3 +3838,15 @@ Paragraph * Buffer::getParFromID(int id) const
        }
        return 0;
 }
+
+
+ParIterator Buffer::par_iterator_begin()
+{
+        return ParIterator(paragraph);
+}
+
+
+ParIterator Buffer::par_iterator_end()
+{
+        return ParIterator();
+}