]> git.lyx.org Git - lyx.git/blobdiff - src/buffer.h
remove unused code
[lyx.git] / src / buffer.h
index d46db48035cf00ac64b241f75f931f6f2907a4b2..14ad3ac9f0ae9e4caa3208193d1df49614cdcf39 100644 (file)
 #include "lyxvc.h"
 #include "bufferparams.h"
 #include "texrow.h"
+#include "ParagraphList.h"
 #include "paragraph.h"
 
+#include <boost/scoped_ptr.hpp>
 #include <boost/shared_ptr.hpp>
 
 class BufferView;
+class Counters;
 class LyXRC;
 class TeXErrors;
 class LaTeXFeatures;
 class Language;
 class ParIterator;
 
-// When lyx 1.3.x starts we should enable this
-// btw. we should also test this with 1.2 so that we
-// do not get any surprises. (Lgb)
 #define NO_COMPABILITY 1
 
 ///
@@ -148,7 +148,7 @@ public:
        bool save() const;
 
        /// Write file. Returns \c false if unsuccesful.
-       bool writeFile(string const &, bool) const;
+       bool writeFile(string const &) const;
 
        ///
        void writeFileAscii(string const & , int);
@@ -157,10 +157,18 @@ public:
        ///
        string const asciiParagraph(Paragraph const *, unsigned int linelen,
                                    bool noparbreak = false) const;
-       ///
+       /// Just a wrapper for the method below, first creating the ofstream.
        void makeLaTeXFile(string const & filename,
                           string const & original_path,
-                          bool nice, bool only_body = false);
+                          bool nice,
+                          bool only_body = false,
+                          bool only_preamble = false);
+       ///
+       void makeLaTeXFile(std::ostream & os,
+                          string const & original_path,
+                          bool nice,
+                          bool only_body = false,
+                          bool only_preamble = false);
        /** LaTeX all paragraphs from par to endpar.
            \param \a endpar if == 0 then to the end
        */
@@ -192,15 +200,15 @@ public:
        Language const * getLanguage() const;
        ///
        int runChktex();
-       ///
-       bool isLyxClean() const;
+       /// return true if the main lyx file does not need saving
+       bool isClean() const;
        ///
        bool isBakClean() const;
        ///
        bool isDepClean(string const & name) const;
 
-       ///
-       void markLyxClean() const;
+       /// mark the main lyx file as not needing saving
+       void markClean() const;
 
        ///
        void markBakClean();
@@ -272,24 +280,7 @@ public:
        ///
        std::vector<std::pair<string, string> > const getBibkeyList() const;
        ///
-       struct TocItem {
-               TocItem(Paragraph * p, int d, string const & s)
-                       : par(p), depth(d), str(s) {}
-               ///
-               Paragraph * par;
-               ///
-               int depth;
-               ///
-               string str;
-       };
-       ///
-       typedef std::vector<TocItem> SingleList;
-       ///
-       typedef std::map<string, SingleList> Lists;
-       ///
-       Lists const getLists() const;
-       ///
-       std::vector<string> const getLabelList();
+       std::vector<string> const getLabelList() const;
 
        /** This will clearly have to change later. Later we can have more
            than one user per buffer. */
@@ -313,7 +304,7 @@ public:
            This is a linked list of paragraph, this list holds the
            whole contents of the document.
         */
-       Paragraph * paragraph;
+       ParagraphList paragraphs;
 
        /// LyX version control object.
        LyXVC lyxvc;
@@ -328,6 +319,9 @@ public:
 
        /// Used when typesetting to place errorboxes.
        TexRow texrow;
+       /// Buffer-wide counter array
+       Counters & counters() const;
+       
 private:
        /// is save needed
        mutable bool lyx_clean;
@@ -361,6 +355,9 @@ private:
        */
        BufferView * users;
 
+       /// The pointer is const although its contents may not be
+       boost::scoped_ptr<Counters> const ctrs;
+       
 public:
        ///
        class inset_iterator {
@@ -384,7 +381,7 @@ public:
                inset_iterator & operator++() { // prefix ++
                        if (par) {
                                ++it;
-                               if (it == par->inset_iterator_end()) {
+                               if (it == par->insetlist.end()) {
                                        par = par->next();
                                        setParagraph();
                                }
@@ -396,15 +393,16 @@ public:
                        inset_iterator tmp(par, it.getPos());
                        if (par) {
                                ++it;
-                               if (it == par->inset_iterator_end()) {
+                               if (it == par->insetlist.end()) {
                                        par = par->next();
                                        setParagraph();
                                }
                        }
                        return tmp;
                }
+
                ///
-               Inset * operator*() { return *it; }
+               Inset * operator*() { return it.getInset(); }
 
                ///
                Paragraph * getPar() { return par; }
@@ -420,12 +418,12 @@ public:
                ///
                Paragraph * par;
                ///
-               Paragraph::inset_iterator it;
+               InsetList::iterator it;
        };
 
        ///
        inset_iterator inset_iterator_begin() {
-               return inset_iterator(paragraph);
+               return inset_iterator(&*paragraphs.begin());
        }
        ///
        inset_iterator inset_iterator_end() {
@@ -433,7 +431,7 @@ public:
        }
        ///
        inset_iterator inset_const_iterator_begin() const {
-               return inset_iterator(paragraph);
+               return inset_iterator(&*paragraphs.begin());
        }
        ///
        inset_iterator inset_const_iterator_end() const {
@@ -472,7 +470,7 @@ Language const * Buffer::getLanguage() const
 
 
 inline
-bool Buffer::isLyxClean() const
+bool Buffer::isClean() const
 {
        return lyx_clean;
 }
@@ -486,7 +484,7 @@ bool Buffer::isBakClean() const
 
 
 inline
-void Buffer::markLyxClean() const
+void Buffer::markClean() const
 {
        if (!lyx_clean) {
                lyx_clean = true;
@@ -570,24 +568,6 @@ void Buffer::setParentName(string const & name)
 }
 
 
-///
-inline
-bool operator==(Buffer::TocItem const & a, Buffer::TocItem const & b)
-{
-       return a.par == b.par && a.str == b.str;
-       // No need to compare depth.
-}
-
-
-///
-inline
-bool operator!=(Buffer::TocItem const & a, Buffer::TocItem const & b)
-{
-       return !(a == b);
-       // No need to compare depth.
-}
-
-
 ///
 inline
 bool operator==(Buffer::inset_iterator const & iter1,