#include "Mover.h"
#include "OutputParams.h"
#include "sgml.h"
+#include "EmbeddedFiles.h"
#include "frontends/alert.h"
}
+void InsetGraphics::registerEmbeddedFiles(Buffer const &,
+ EmbeddedFiles & files) const
+{
+ files.registerFile(params().filename.absFilename(),
+ false, this);
+}
+
+
void InsetGraphics::edit(Cursor & cur, bool)
{
InsetGraphicsMailer(*this).showDialog(&cur.bv());
void InsetGraphics::write(Buffer const & buf, ostream & os) const
{
os << "Graphics\n";
- params().Write(os, buf.filePath());
+ params().Write(os, buf);
}
else
LYXERR(Debug::GRAPHICS) << "Not a Graphics inset!" << endl;
+ // InsetGraphics is read, with filename in params_. We do not know if this file actually
+ // exists or is embedded so we need to get the 'availableFile' from buf.embeddedFiles()
+ if (buf.embeddedFiles().enabled()) {
+ EmbeddedFiles::EmbeddedFileList::const_iterator it =
+ buf.embeddedFiles().find(params_.filename.toFilesystemEncoding());
+ if (it != buf.embeddedFiles().end())
+ // using available file, embedded or external, depending on file availability and
+ // embedding status.
+ params_.filename = DocFileName(it->availableFile(&buf));
+ }
graphic_->update(params().as_grfxParams());
}
{
ostringstream data;
data << name_ << ' ';
- params.Write(data, buffer.filePath());
+ params.Write(data, buffer);
data << "\\end_inset\n";
return data.str();
}