mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
Embedding: merge lyx::EmbeddedFiles to lyx::support::EmbeddedFileList
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22448 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b99297b2c2
commit
b5153b3d26
@ -192,7 +192,7 @@ public:
|
||||
map<string, ErrorList> errorLists;
|
||||
|
||||
/// all embedded files of this buffer
|
||||
EmbeddedFiles embedded_files;
|
||||
EmbeddedFileList embedded_files;
|
||||
|
||||
/// timestamp and checksum used to test if the file has been externally
|
||||
/// modified. (Used to properly enable 'File->Revert to saved', bug 4114).
|
||||
@ -366,13 +366,13 @@ TocBackend & Buffer::tocBackend() const
|
||||
}
|
||||
|
||||
|
||||
EmbeddedFiles & Buffer::embeddedFiles()
|
||||
EmbeddedFileList & Buffer::embeddedFiles()
|
||||
{
|
||||
return d->embedded_files;
|
||||
}
|
||||
|
||||
|
||||
EmbeddedFiles const & Buffer::embeddedFiles() const
|
||||
EmbeddedFileList const & Buffer::embeddedFiles() const
|
||||
{
|
||||
return d->embedded_files;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
namespace lyx {
|
||||
|
||||
class BufferParams;
|
||||
class EmbeddedFiles;
|
||||
class EmbeddedFileList;
|
||||
class DocIterator;
|
||||
class ErrorItem;
|
||||
class ErrorList;
|
||||
@ -57,7 +57,6 @@ class WorkAreaManager;
|
||||
|
||||
namespace support {
|
||||
class FileName;
|
||||
class EmbeddedFileList;
|
||||
}
|
||||
|
||||
/** The buffer object.
|
||||
@ -304,7 +303,7 @@ public:
|
||||
void updateBibfilesCache() const;
|
||||
/// Return the cache with all bibfiles in use (including bibfiles
|
||||
/// of loaded child documents).
|
||||
support::EmbeddedFileList const & getBibfilesCache() const;
|
||||
EmbeddedFileList const & getBibfilesCache() const;
|
||||
///
|
||||
void getLabelList(std::vector<docstring> &) const;
|
||||
|
||||
@ -405,8 +404,8 @@ public:
|
||||
TocBackend & tocBackend() const;
|
||||
|
||||
//@{
|
||||
EmbeddedFiles & embeddedFiles();
|
||||
EmbeddedFiles const & embeddedFiles() const;
|
||||
EmbeddedFileList & embeddedFiles();
|
||||
EmbeddedFileList const & embeddedFiles() const;
|
||||
bool embedded() const;
|
||||
//@}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file EmbeddedFiles.cpp
|
||||
* \file EmbeddedFileList.cpp
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
@ -306,7 +306,7 @@ bool operator!=(EmbeddedFile const & lhs, EmbeddedFile const & rhs)
|
||||
}
|
||||
|
||||
|
||||
void EmbeddedFiles::enable(bool flag, Buffer & buffer)
|
||||
void EmbeddedFileList::enable(bool flag, Buffer & buffer)
|
||||
{
|
||||
if (buffer.embedded() == flag)
|
||||
return;
|
||||
@ -347,7 +347,7 @@ void EmbeddedFiles::enable(bool flag, Buffer & buffer)
|
||||
}
|
||||
|
||||
|
||||
void EmbeddedFiles::registerFile(EmbeddedFile const & file,
|
||||
void EmbeddedFileList::registerFile(EmbeddedFile const & file,
|
||||
Inset const * inset, Buffer const & buffer)
|
||||
{
|
||||
BOOST_ASSERT(!buffer.embedded() || file.availableFile().exists());
|
||||
@ -376,7 +376,7 @@ void EmbeddedFiles::registerFile(EmbeddedFile const & file,
|
||||
}
|
||||
|
||||
|
||||
void EmbeddedFiles::update(Buffer const & buffer)
|
||||
void EmbeddedFileList::update(Buffer const & buffer)
|
||||
{
|
||||
clear();
|
||||
|
||||
@ -385,7 +385,7 @@ void EmbeddedFiles::update(Buffer const & buffer)
|
||||
}
|
||||
|
||||
|
||||
bool EmbeddedFiles::writeFile(DocFileName const & filename, Buffer const & buffer)
|
||||
bool EmbeddedFileList::writeFile(DocFileName const & filename, Buffer const & buffer)
|
||||
{
|
||||
// file in the temporary path has the content
|
||||
string const content = FileName(addName(buffer.temppath(),
|
||||
|
@ -167,7 +167,7 @@ bool operator==(EmbeddedFile const & lhs, EmbeddedFile const & rhs);
|
||||
bool operator!=(EmbeddedFile const & lhs, EmbeddedFile const & rhs);
|
||||
|
||||
|
||||
class EmbeddedFiles : public std::vector<EmbeddedFile> {
|
||||
class EmbeddedFileList : public std::vector<EmbeddedFile> {
|
||||
public:
|
||||
/// set buffer params embedded flag. Files will be updated or extracted
|
||||
/// if such an operation fails, enable will fail.
|
||||
|
@ -970,10 +970,10 @@ void GuiDocument::updateEmbeddedFileList()
|
||||
{
|
||||
embeddedFilesModule->filesLW->clear();
|
||||
// add current embedded files
|
||||
EmbeddedFiles & files = buffer().embeddedFiles();
|
||||
EmbeddedFileList & files = buffer().embeddedFiles();
|
||||
files.update(buffer());
|
||||
EmbeddedFiles::iterator fit = files.begin();
|
||||
EmbeddedFiles::iterator fit_end = files.end();
|
||||
EmbeddedFileList::iterator fit = files.begin();
|
||||
EmbeddedFileList::iterator fit_end = files.end();
|
||||
for (; fit != fit_end; ++fit) {
|
||||
QString label = toqstr(fit->relFilename(buffer().filePath()));
|
||||
if (fit->refCount() > 1)
|
||||
|
@ -51,7 +51,7 @@ class ParIterator;
|
||||
class Text;
|
||||
class TocList;
|
||||
class EmbeddedFile;
|
||||
class EmbeddedFiles;
|
||||
class EmbeddedFileList;
|
||||
|
||||
|
||||
namespace graphics { class PreviewLoader; }
|
||||
@ -357,7 +357,7 @@ public:
|
||||
/// pit is the ParConstIterator of the paragraph containing the inset
|
||||
virtual void addToToc(TocList &, Buffer const &, ParConstIterator const &) const {}
|
||||
/// report files that can be embedded with the lyx file
|
||||
virtual void registerEmbeddedFiles(Buffer const &, EmbeddedFiles &) const {}
|
||||
virtual void registerEmbeddedFiles(Buffer const &, EmbeddedFileList &) const {}
|
||||
/// use embedded or external file after the embedding status of a file is changed
|
||||
virtual void updateEmbeddedFile(Buffer const &, EmbeddedFile const &) {}
|
||||
/// Fill keys with BibTeX information
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "BufferParams.h"
|
||||
#include "DispatchResult.h"
|
||||
#include "support/debug.h"
|
||||
#include "EmbeddedFiles.h"
|
||||
#include "Encoding.h"
|
||||
#include "FuncRequest.h"
|
||||
#include "support/gettext.h"
|
||||
@ -29,7 +30,6 @@
|
||||
|
||||
#include "support/ExceptionMessage.h"
|
||||
#include "support/docstream.h"
|
||||
#include "support/FileNameList.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "support/os.h"
|
||||
@ -805,7 +805,7 @@ void InsetBibtex::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
void InsetBibtex::registerEmbeddedFiles(Buffer const & buffer, EmbeddedFiles & files) const
|
||||
void InsetBibtex::registerEmbeddedFiles(Buffer const & buffer, EmbeddedFileList & files) const
|
||||
{
|
||||
EmbeddedFileList const dbs = getFiles(buffer);
|
||||
for (vector<EmbeddedFile>::const_iterator it = dbs.begin();
|
||||
@ -822,7 +822,7 @@ void InsetBibtex::updateEmbeddedFile(Buffer const & buf, EmbeddedFile const & fi
|
||||
|
||||
bool first = true;
|
||||
EmbeddedFileList dbs = getFiles(buf);
|
||||
for (vector<EmbeddedFile>::iterator it = dbs.begin();
|
||||
for (EmbeddedFileList::iterator it = dbs.begin();
|
||||
it != dbs.end(); ++ it) {
|
||||
// update from file
|
||||
if (it->absFilename() == file.absFilename())
|
||||
|
@ -18,9 +18,7 @@
|
||||
|
||||
namespace lyx {
|
||||
|
||||
namespace support {
|
||||
class EmbeddedFileList;
|
||||
}
|
||||
|
||||
|
||||
/** Used to insert BibTeX's information
|
||||
@ -43,7 +41,7 @@ public:
|
||||
virtual void fillWithBibKeys(Buffer const &,
|
||||
BiblioInfo &, InsetIterator const &) const;
|
||||
///
|
||||
support::EmbeddedFileList const getFiles(Buffer const &) const;
|
||||
EmbeddedFileList const getFiles(Buffer const &) const;
|
||||
///
|
||||
bool addDatabase(std::string const &);
|
||||
///
|
||||
@ -58,7 +56,7 @@ public:
|
||||
static bool isCompatibleCommand(std::string const & s)
|
||||
{ return s == "bibtex"; }
|
||||
///
|
||||
void registerEmbeddedFiles(Buffer const &, EmbeddedFiles &) const;
|
||||
void registerEmbeddedFiles(Buffer const &, EmbeddedFileList &) const;
|
||||
///
|
||||
void updateEmbeddedFile(Buffer const & buf, EmbeddedFile const & file);
|
||||
|
||||
|
@ -18,12 +18,12 @@
|
||||
#include "support/debug.h"
|
||||
#include "DispatchResult.h"
|
||||
#include "support/gettext.h"
|
||||
#include "EmbeddedFiles.h"
|
||||
#include "FuncRequest.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
#include "support/docstream.h"
|
||||
#include "support/FileNameList.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -144,10 +144,10 @@ docstring const getComplexLabel(Buffer const & buffer,
|
||||
|
||||
BiblioInfo biblist;
|
||||
|
||||
support::EmbeddedFileList const & bibfilesCache = buffer.getBibfilesCache();
|
||||
EmbeddedFileList const & bibfilesCache = buffer.getBibfilesCache();
|
||||
// compare the cached timestamps with the actual ones.
|
||||
bool changed = false;
|
||||
for (support::EmbeddedFileList::const_iterator it = bibfilesCache.begin();
|
||||
for (EmbeddedFileList::const_iterator it = bibfilesCache.begin();
|
||||
it != bibfilesCache.end(); ++ it) {
|
||||
FileName const f = *it;
|
||||
time_t lastw = f.lastModified();
|
||||
|
@ -497,7 +497,7 @@ bool InsetExternal::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
|
||||
|
||||
void InsetExternal::registerEmbeddedFiles(Buffer const & buffer,
|
||||
EmbeddedFiles & files) const
|
||||
EmbeddedFileList & files) const
|
||||
{
|
||||
files.registerFile(params_.filename, this, buffer);
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ public:
|
||||
///
|
||||
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
|
||||
/// external file can be embedded
|
||||
void registerEmbeddedFiles(Buffer const &, EmbeddedFiles &) const;
|
||||
void registerEmbeddedFiles(Buffer const &, EmbeddedFileList &) const;
|
||||
///
|
||||
void updateEmbeddedFile(Buffer const &, EmbeddedFile const &);
|
||||
|
||||
|
@ -217,7 +217,7 @@ bool InsetGraphics::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
|
||||
|
||||
void InsetGraphics::registerEmbeddedFiles(Buffer const & buffer,
|
||||
EmbeddedFiles & files) const
|
||||
EmbeddedFileList & files) const
|
||||
{
|
||||
files.registerFile(params().filename, this, buffer);
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
///
|
||||
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
|
||||
/// all graphics can be embedded
|
||||
void registerEmbeddedFiles(Buffer const &, EmbeddedFiles &) const;
|
||||
void registerEmbeddedFiles(Buffer const &, EmbeddedFileList &) const;
|
||||
///
|
||||
void updateEmbeddedFile(Buffer const &, EmbeddedFile const &);
|
||||
/// Force inset into LTR environment if surroundings are RTL?
|
||||
|
@ -899,7 +899,7 @@ void InsetInclude::updateLabels(Buffer const & buffer, ParIterator const &)
|
||||
|
||||
|
||||
void InsetInclude::registerEmbeddedFiles(Buffer const & buffer,
|
||||
EmbeddedFiles & files) const
|
||||
EmbeddedFileList & files) const
|
||||
{
|
||||
files.registerFile(includedFilename(buffer, params()), this, buffer);
|
||||
}
|
||||
|
@ -30,10 +30,6 @@ class Dimension;
|
||||
class LaTeXFeatures;
|
||||
class RenderMonitoredPreview;
|
||||
|
||||
namespace support {
|
||||
class EmbeddedFileList;
|
||||
}
|
||||
|
||||
/// for including tex/lyx files
|
||||
class InsetInclude : public InsetCommand {
|
||||
public:
|
||||
@ -74,7 +70,7 @@ public:
|
||||
* Return an empty vector if the child doc is not loaded.
|
||||
* \param buffer the Buffer containing this inset.
|
||||
*/
|
||||
support::EmbeddedFileList const &
|
||||
EmbeddedFileList const &
|
||||
getBibfilesCache(Buffer const & buffer) const;
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
@ -96,7 +92,7 @@ public:
|
||||
///
|
||||
void updateLabels(Buffer const & buffer, ParIterator const &);
|
||||
/// child document can be embedded
|
||||
void registerEmbeddedFiles(Buffer const &, EmbeddedFiles &) const;
|
||||
void registerEmbeddedFiles(Buffer const &, EmbeddedFileList &) const;
|
||||
///
|
||||
void updateEmbeddedFile(Buffer const & buf, EmbeddedFile const & file);
|
||||
///
|
||||
|
@ -13,7 +13,6 @@
|
||||
#define FILENAMELIST_H
|
||||
|
||||
#include "support/FileName.h"
|
||||
#include "EmbeddedFiles.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -29,10 +28,6 @@ class FileNameList: public std::vector<FileName>
|
||||
{
|
||||
};
|
||||
|
||||
class EmbeddedFileList: public std::vector<EmbeddedFile>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace support
|
||||
} // namespace lyx
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user