]> git.lyx.org Git - lyx.git/blobdiff - src/buffer.h
More fixes to insettabular/text (and some missing features added).
[lyx.git] / src / buffer.h
index 1404bfc90b204e3366ad5d01b32a1e7383dc672d..3a6465b3b1c3f8d3d9dcd4405be075ddf29130dc 100644 (file)
@@ -38,6 +38,7 @@ class LyXRC;
 class TeXErrors;
 class LaTeXFeatures;
 class auto_mem_buffer;
+class Language;
 
 ///
 struct DEPCLEAN {
@@ -106,7 +107,7 @@ public:
        ///
        void redraw() {
                users->redraw(); 
-               users->fitCursor(); 
+               users->fitCursor(users->text); 
                //users->updateScrollbar();
        }
 
@@ -150,7 +151,11 @@ public:
        
        ///
        void writeFileAscii(string const & , int);
-       
+       ///
+       void writeFileAscii(std::ostream &, int);
+       ///
+       string const asciiParagraph(LyXParagraph const *,
+                                   unsigned int linelen) const;
        ///
        void makeLaTeXFile(string const & filename,
                           string const & original_path,
@@ -161,14 +166,10 @@ public:
        void latexParagraphs(std::ostream & os, LyXParagraph * par,
                             LyXParagraph * endpar, TexRow & texrow) const;
 
-       ///
-       int runLaTeX();
-
-        ///
-        int runLiterate();
-
         ///
-        int buildProgram();
+       void SimpleDocBookOnePar(std::ostream &, string & extra,
+                                LyXParagraph * par, int & desc_on,
+                                int depth) const ;
 
        ///
        int runChktex();
@@ -181,16 +182,13 @@ public:
                             bool nice, bool only_body = false);
 
        /// returns the main language for the buffer (document)
-       string GetLanguage() const {
+       Language const * GetLanguage() const {
                return params.language;
        }
        
        ///
        bool isLyxClean() const { return lyx_clean; }
        
-        ///
-        bool isNwClean() const { return nw_clean; }
-       
        ///
        bool isBakClean() const { return bak_clean; }
        
@@ -208,18 +206,12 @@ public:
                bak_clean = true;
        }
 
-        ///
-        void markNwClean() { nw_clean = true; }
-       
        ///
        void markBakClean() { bak_clean = true; }
        
        ///
        void markDepClean(string const & name);
        
-        ///
-        void markNwDirty() { nw_clean = false; }
-
        ///
        void setUnnamed(bool flag=true) { unnamed = flag; }
 
@@ -232,7 +224,6 @@ public:
                        lyx_clean = false;
                        updateTitles();
                }
-               nw_clean = false;
                bak_clean = false;
                DEPCLEAN * tmp = dep_clean;
                while (tmp) {
@@ -247,10 +238,10 @@ public:
        /** A transformed version of the file name, adequate for LaTeX  
            The path is stripped if no_path is true (default)
        */
-       string getLatexName(bool no_path = true) const;
+       string const getLatexName(bool no_path = true) const;
 
        /// Change name of buffer. Updates "read-only" flag.
-       void fileName(string const & newfile);
+       void setFileName(string const & newfile);
 
        /// Name of the document's parent
        void setParentName(string const &);
@@ -288,9 +279,9 @@ public:
        void validate(LaTeXFeatures &) const;
 
        ///
-       string getIncludeonlyList(char delim = ',');
+       string const getIncludeonlyList(char delim = ',');
        ///
-       std::vector<std::pair<string,string> > getBibkeyList();
+       std::vector<std::pair<string,string> > const getBibkeyList();
        ///
        struct TocItem {
                ///
@@ -312,9 +303,9 @@ public:
                TOC_LOA
        };
        ///
-       std::vector<std::vector<TocItem> > getTocList();
+       std::vector<std::vector<TocItem> > const getTocList();
        ///
-       std::vector<string> getLabelList();
+       std::vector<string> const getLabelList();
 
        /** This will clearly have to change later. Later we can have more
            than one user per buffer. */
@@ -357,16 +348,16 @@ private:
 #ifndef NEW_INSETS
         ///
         void linuxDocHandleFootnote(std::ostream & os,
-                                   LyXParagraph * & par, int const depth);
+                                   LyXParagraph * & par, int depth);
 #endif
         ///
        void DocBookHandleCaption(std::ostream & os, string & inner_tag,
-                                 int const depth, int desc_on,
+                                 int depth, int desc_on,
                                  LyXParagraph * & par);
 #ifndef NEW_INSETS
         ///
        void DocBookHandleFootnote(std::ostream & os,
-                                  LyXParagraph * & par, int const depth);
+                                  LyXParagraph * & par, int depth);
 #endif
        ///
         void sgmlOpenTag(std::ostream & os, int depth,
@@ -375,21 +366,18 @@ private:
         void sgmlCloseTag(std::ostream & os, int depth,
                          string const & latexname) const;
        ///
-       void LinuxDocError(LyXParagraph * par, int pos, char const * message);
+       void LinuxDocError(LyXParagraph * par, int pos,
+                          string const & message);
         ///
        void SimpleLinuxDocOnePar(std::ostream & os, LyXParagraph * par,
-                                 int desc_on, int const depth);
-        ///
-       void SimpleDocBookOnePar(std::ostream &, string & extra,
-                                LyXParagraph * par, int & desc_on,
-                                int const depth);
+                                 int desc_on, int depth);
 
        /// LinuxDoc.
-       void push_tag(std::ostream & os, char const * tag,
+       void push_tag(std::ostream & os, string const & tag,
                      int & pos, char stack[5][3]);
        
        /// LinuxDoc.
-       void pop_tag(std::ostream & os, char const * tag,
+       void pop_tag(std::ostream & os, string const & tag,
                     int & pos, char stack[5][3]);
 
        /// is save needed
@@ -398,9 +386,6 @@ private:
        /// is autosave needed
        mutable bool bak_clean;
        
-        /// do we need to run weave/tangle
-        bool nw_clean;
-
        /// is this a unnamed file (New...)
        bool unnamed;
 
@@ -429,6 +414,13 @@ public:
        ///
        class inset_iterator {
        public:
+               typedef std::input_iterator_tag iterator_category;
+               typedef Inset value_type;
+               typedef ptrdiff_t difference_type;
+               typedef Inset * pointer;
+               typedef Inset & reference;
+               
+               
                ///
                inset_iterator() : par(0) /*, it(0)*/ {}
                //
@@ -439,7 +431,7 @@ public:
                inset_iterator(LyXParagraph * paragraph,
                               LyXParagraph::size_type pos);
                ///
-               inset_iterator & operator++() {
+               inset_iterator & operator++() { // prefix ++
                        if (par) {
                                ++it;
                                if (it == par->inset_iterator_end()) {
@@ -450,19 +442,32 @@ public:
                        return *this;
                }
                ///
-               Inset * operator*() {return *it; }
+               inset_iterator operator++(int) { // postfix ++
+                       inset_iterator tmp(par, it.getPos());
+                       if (par) {
+                               ++it;
+                               if (it == par->inset_iterator_end()) {
+                                       par = par->next;
+                                       SetParagraph();
+                               }
+                       }
+                       return tmp;
+               }
+               ///
+               Inset * operator*() { return *it; }
+               
                ///
                LyXParagraph * getPar() { return par; }
                ///
-               LyXParagraph::size_type getPos() {return it.getPos(); }
+               LyXParagraph::size_type getPos() const { return it.getPos(); }
                ///
                friend
                bool operator==(inset_iterator const & iter1,
                                inset_iterator const & iter2);
-               ///
-               friend
-               bool operator!=(inset_iterator const & iter1,
-                               inset_iterator const & iter2);
+               //
+               //friend
+               //bool operator!=(inset_iterator const & iter1,
+               //              inset_iterator const & iter2);
        private:
                ///
                void SetParagraph();