]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.h
This optional argument to the InsetCollapsable constructor
[lyx.git] / src / Buffer.h
index c35a2479c0c9cf4f1fa8d6be8be80ee1ce7ee201..4a9e9ae9037bc3d580d5aa5e447680a4a5273369 100644 (file)
 
 namespace lyx {
 
+class BiblioInfo;
 class BufferParams;
-class EmbeddedFileList;
 class DocIterator;
 class ErrorItem;
 class ErrorList;
 class FuncRequest;
 class Inset;
+class InsetRef;
+class InsetLabel;
 class Font;
 class Format;
 class Lexer;
@@ -41,6 +43,7 @@ class LaTeXFeatures;
 class Language;
 class MacroData;
 class MacroNameSet;
+class MacroSet;
 class OutputParams;
 class Paragraph;
 class ParConstIterator;
@@ -58,6 +61,7 @@ class WorkAreaManager;
 
 namespace support {
 class FileName;
+class FileNameList;
 }
 
 /** The buffer object.
@@ -87,14 +91,14 @@ public:
        };
 
 
-       /// Method to check if a file is externally modified, used by 
+       /// Method to check if a file is externally modified, used by
        /// isExternallyModified()
        /**
         * timestamp is fast but inaccurate. For example, the granularity
         * of timestamp on a FAT filesystem is 2 second. 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 
+        * checksum is accurate but slow, which can be a problem when it is
         * frequently used, or used for a large file on a slow (network) file
         * system.
         *
@@ -104,7 +108,7 @@ public:
                checksum_method,  ///< Use file checksum
                timestamp_method, ///< Use timestamp, and checksum if timestamp has changed
        };
-       
+
        /** Constructor
            \param file
            \param b  optional \c false by default
@@ -162,7 +166,7 @@ public:
        /// Write file. Returns \c false if unsuccesful.
        bool writeFile(support::FileName const &) const;
 
-  /// Loads LyX file \c filename into buffer, *  and \return success 
+  /// Loads LyX file \c filename into buffer, *  and \return success
        bool loadLyXFile(support::FileName const & s);
 
        /// Fill in the ErrorList with the TeXErrors
@@ -275,6 +279,9 @@ public:
         */
        Buffer const * masterBuffer() const;
 
+       /// \return true if \p child is a child of this \c Buffer.
+       bool isChild(Buffer * child) const;
+
        /// Is buffer read-only?
        bool isReadonly() const;
 
@@ -302,9 +309,16 @@ public:
        /// Update the cache with all bibfiles in use (including bibfiles
        /// of loaded child documents).
        void updateBibfilesCache() const;
+       ///
+       void invalidateBibinfoCache();
        /// Return the cache with all bibfiles in use (including bibfiles
        /// of loaded child documents).
-       EmbeddedFileList const & getBibfilesCache() const;
+       support::FileNameList const & getBibfilesCache() const;
+       /// \return the bibliography information for this buffer's master,
+       /// or just for it, if it isn't a child.
+       BiblioInfo const & masterBibInfo() const;
+       /// \return the bibliography information for this buffer ONLY.
+       BiblioInfo const & localBibInfo() const;
        ///
        void getLabelList(std::vector<docstring> &) const;
 
@@ -366,12 +380,10 @@ public:
        /// Iterate through the whole buffer and try to resolve macros
        void updateMacroInstances() const;
 
-       /// List macro names of this buffer. the parent and the children
+       /// List macro names of this buffer, the parent and the children
        void listMacroNames(MacroNameSet & macros) const;
-       /// Write out all macros somewhere defined in the parent,
-       /// its parents and its children, which are visible at the beginning 
-       /// of this buffer
-       void writeParentMacros(odocstream & os) const;
+       /// Collect macros of the parent and its children in front of this buffer.
+       void listParentMacros(MacroSet & macros, LaTeXFeatures & features) const;
 
        /// Return macro defined before pos (or in the master buffer)
        MacroData const * getMacro(docstring const & name, DocIterator const & pos, bool global = true) const;
@@ -388,7 +400,7 @@ public:
        /// get source code (latex/docbook) for some paragraphs, or all paragraphs
        /// including preamble
        void getSourceCode(odocstream & os, pit_type par_begin, pit_type par_end,
-               bool full_source);
+               bool full_source) const;
 
        /// Access to error list.
        /// This method is used only for GUI visualisation of Buffer related
@@ -402,17 +414,14 @@ public:
        /// method is const because modifying this backend does not touch
        /// the document contents.
        TocBackend & tocBackend() const;
-       
-       //@{
-       EmbeddedFileList & embeddedFiles();
-       EmbeddedFileList const & embeddedFiles() const;
-       bool embedded() const;
-       //@}
 
+       ///
        Undo & undo();
-       
+
        /// This function is called when the buffer is changed.
        void changed() const;
+       ///
+       void updateTocItem(std::string const &, DocIterator const &) const;
        /// This function is called when the buffer structure is changed.
        void structureChanged() const;
        /// This function is called when some parsing error shows up.
@@ -432,10 +441,6 @@ public:
 
        ///
        void autoSave() const;
-       ///
-       void loadChildDocuments() const;
-       ///
-       void resetChildDocuments(bool close_them) const;
 
        /// return the format of the buffer on a string
        std::string bufferFormat() const;
@@ -451,32 +456,26 @@ public:
        bool isExportable(std::string const & format) const;
        ///
        std::vector<Format const *> exportableFormats(bool only_viewable) const;
-       
+
+       ///
+       typedef std::vector<std::pair<InsetRef *, ParIterator> > References;
+       References & references(docstring const & label);
+       References const & references(docstring const & label) const;
+       void clearReferenceCache() const;
+       void setInsetLabel(docstring const & label, InsetLabel const * il);
+       InsetLabel const * insetLabel(docstring const & label) const;
+
 private:
        /// search for macro in local (buffer) table or in children
        MacroData const * getBufferMacro(docstring const & name,
                                         DocIterator const & pos) const;
-       /** Update macro table in the whole text inset
-           \param it at the start of the text inset)
-       */
-       void updateInsetMacros(DocIterator & it, 
-                              DocIterator & scope) const;
-       /** Update macro table for paragraphs until \c lastpit
+       /** Update macro table starting with position of it
            \param it in some text inset
-           \param lastpit last processed paragraph
        */
-       void updateEnvironmentMacros(DocIterator & it, 
-                                    pit_type lastpit, 
+       void updateMacros(DocIterator & it,
                                     DocIterator & scope) const;
-       /** Update macro table for one paragraph block with 
-           same layout and depth, until \c lastpit
-           \param it in some text inset
-           \param lastpit last processed paragraph
-       */
-       void updateBlockMacros(DocIterator & it, 
-                              DocIterator & scope) const;
 
-       /// 
+       ///
        bool readFileHelper(support::FileName const & s);
        ///
        std::vector<std::string> backends() const;