]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.h
Provide option to force a local language switch where a global is not allowed (fixes...
[lyx.git] / src / Buffer.h
index 62e03a4652a8418b7666a4f44c63a8bd81ab06a6..3ed3a95c40597c230a888752e06c3a10557e1976 100644 (file)
@@ -84,7 +84,7 @@ typedef std::set<Buffer *> CloneList;
 
 
 /** The buffer object.
- * This is the buffer object. It contains all the informations about
+ * This is the buffer object. It contains all the information about
  * a document loaded into LyX.
  * The buffer object owns the Text (wrapped in an InsetText), which
  * contains the individual paragraphs of the document.
@@ -141,7 +141,7 @@ public:
        /// isExternallyModified()
        /**
         * timestamp is fast but inaccurate. For example, the granularity
-        * of timestamp on a FAT filesystem is 2 second. Also, various operations
+        * of timestamp on a FAT filesystem is 2 seconds. Also, various operations
         * may touch the timestamp of a file even when its content is unchanged.
         *
         * checksum is accurate but slow, which can be a problem when it is
@@ -168,8 +168,11 @@ public:
        /// Destructor
        ~Buffer();
 
-       ///
-       Buffer * clone() const;
+       /// Clones the entire structure of which this Buffer is part, starting
+       /// with the master and cloning all the children, too.
+       Buffer * cloneFromMaster() const;
+       /// Just clones this single Buffer. For autosave.
+       Buffer * cloneBufferOnly() const;
        ///
        bool isClone() const;
 
@@ -222,7 +225,8 @@ public:
        /// read a new document from a string
        bool readString(std::string const &);
        /// Reloads the LyX file
-       ReadStatus reload();
+       /// \param clearUndo if false, leave alone the undo stack.
+       ReadStatus reload(bool clearUndo = true);
 //FIXME: The following function should be private
 //private:
        /// read the header, returns number of unknown tokens
@@ -232,7 +236,7 @@ private:
        ///
        typedef std::map<Buffer const *, Buffer *> BufferMap;
        ///
-       void clone(BufferMap &, CloneList *) const;
+       void cloneWithChildren(BufferMap &, CloneList *) const;
        /// save timestamp and checksum of the given file.
        void saveCheckSum() const;
        /// read a new file
@@ -242,8 +246,7 @@ private:
        /// \return \c true if file is not completely read.
        bool readDocument(Lexer &);
        /// Try to extract the file from a version control container
-       /// before reading if the file cannot be found. This is only
-       /// implemented for RCS.
+       /// before reading if the file cannot be found.
        /// \sa LyXVC::file_not_found_hook
        ReadStatus extractFromVC();
        /// Reads the first tag of a LyX File and
@@ -291,6 +294,7 @@ public:
        enum OutputWhat {
                FullSource,
                OnlyBody,
+               IncludedFile,
                OnlyPreamble,
                CurrentParagraph
        };
@@ -375,6 +379,8 @@ public:
        /// automatically saved, nor it needs to trigger any "do you want to save ?" question.
        bool isInternal() const;
 
+       void setInternal(bool flag);
+
        /// Mark this buffer as dirty.
        void markDirty();
 
@@ -582,7 +588,8 @@ public:
        /// get source code (latex/docbook) for some paragraphs, or all paragraphs
        /// including preamble
        void getSourceCode(odocstream & os, std::string const format,
-                          pit_type par_begin, pit_type par_end, OutputWhat output) const;
+                          pit_type par_begin, pit_type par_end, OutputWhat output,
+                          bool master) const;
 
        /// Access to error list.
        /// This method is used only for GUI visualisation of Buffer related
@@ -642,6 +649,8 @@ private:
                bool includeall) const;
        ///
        ExportStatus preview(std::string const & format, bool includeall = false) const;
+       ///
+       void setMathFlavor(OutputParams & op) const;
 
 public:
        ///
@@ -683,6 +692,18 @@ public:
                WordLangTuple & word_lang, docstring_list & suggestions) const;
        ///
        void checkChildBuffers();
+       ///
+       void checkMasterBuffer();
+
+       /// compute statistics between \p from and \p to
+       /// \p from initial position
+       /// \p to points to the end position
+       /// \p skipNoOutput if notes etc. should be ignored
+       void updateStatistics(DocIterator & from, DocIterator & to,
+                                                 bool skipNoOutput = true) const;
+       /// statistics accessor functions
+       int wordCount() const;
+       int charCount(bool with_blanks) const;
 
 private:
        class MarkAsExporting;