]> git.lyx.org Git - lyx.git/blobdiff - src/EmbeddedFiles.h
Transfer current_font and real_current_font from Text to Cursor.
[lyx.git] / src / EmbeddedFiles.h
index 7fdabbe1bc42b578db6a464a64f7da17bd483bd3..132c84927c6025bb153c136c1b43701824166153 100644 (file)
@@ -137,7 +137,8 @@ public:
                // to generate output, and be embedded to the saved lyx file.
                // Otherwise, embedded version will be used.
                AUTO,
-               // Always use embedded version.
+               // Always use embedded version. The file will be embedded even
+               // if the file is no longer referred by the document.
                EMBEDDED,
                // Do not embed this file, always use external version.
                EXTERNAL
@@ -150,10 +151,13 @@ public:
        std::string inzipName() const { return inzip_name_; }
        /// embedded file, equals to temppath()/inzipName()
        std::string embeddedFile(Buffer const * buf) const;
+       /// embeddedFile() or absFilename() depending on status_ and 
+       /// file availability
+       std::string availableFile(Buffer const * buf) const;
 
        /// paragraph id
        void setParIter(ParConstIterator const & pit);
-       int const parID() const { return par_it_->id(); }
+       int const parID() const;
 
        /// embedding status of this file
        bool embedded() const { return status_ != EXTERNAL; }
@@ -169,6 +173,8 @@ public:
        bool valid() const { return valid_; }
        void validate() { valid_ = true; }
        void invalidate() {     valid_ = false; }
+       ///
+       bool extract(Buffer const * buf) const;
 
 private:
        /// filename in zip file
@@ -211,19 +217,23 @@ public:
 
        void clear() { file_list_.clear(); }
 
+       ///
+       EmbeddedFile & operator[](size_t idx) { return *(file_list_.begin() + idx); }
+       EmbeddedFile const & operator[](size_t idx) const { return *(file_list_.begin() + idx); }
        ///
        EmbeddedFileList::iterator begin() { return file_list_.begin(); }
        EmbeddedFileList::iterator end() { return file_list_.end(); }
        EmbeddedFileList::const_iterator begin() const { return file_list_.begin(); }
        EmbeddedFileList::const_iterator end() const { return file_list_.end(); }
-
+       ///
+       bool extractAll() const;
        ///
        friend std::istream & operator>> (std::istream & is, EmbeddedFiles &);
 
        friend std::ostream & operator<< (std::ostream & os, EmbeddedFiles const &);
 private:
-       /// if a inzip name already exists
-       bool validInzipName(std::string const & name);
+       /// get a unique inzip name
+       std::string const getInzipName(std::string const & name);
        /// list of embedded files
        EmbeddedFileList file_list_;
        ///