// 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
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; }
bool valid() const { return valid_; }
void validate() { valid_ = true; }
void invalidate() { valid_ = false; }
+ ///
+ bool extract(Buffer const * buf) const;
private:
/// filename in zip file
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_;
///