2 * \file InsetInclude.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Richard Heck (conversion to InsetCommand)
8 * \author Bo Peng (embedding stuff)
10 * Full author contact details are available in file CREDITS.
15 #include "InsetInclude.h"
17 #include "LayoutFile.h"
19 #include "buffer_funcs.h"
20 #include "BufferList.h"
21 #include "BufferParams.h"
22 #include "BufferView.h"
24 #include "DispatchResult.h"
25 #include "ErrorList.h"
27 #include "FuncRequest.h"
28 #include "FuncStatus.h"
29 #include "LaTeXFeatures.h"
33 #include "MetricsInfo.h"
34 #include "OutputParams.h"
35 #include "TextClass.h"
36 #include "TocBackend.h"
38 #include "frontends/alert.h"
39 #include "frontends/Painter.h"
41 #include "graphics/PreviewImage.h"
42 #include "graphics/PreviewLoader.h"
44 #include "insets/InsetLabel.h"
45 #include "insets/InsetListingsParams.h"
46 #include "insets/RenderPreview.h"
48 #include "support/debug.h"
49 #include "support/docstream.h"
50 #include "support/ExceptionMessage.h"
51 #include "support/FileNameList.h"
52 #include "support/filetools.h"
53 #include "support/gettext.h"
54 #include "support/lstrings.h" // contains
55 #include "support/lyxalgo.h"
56 #include "support/convert.h"
58 #include <boost/bind.hpp>
61 using namespace lyx::support;
65 namespace Alert = frontend::Alert;
70 docstring const uniqueID()
72 static unsigned int seed = 1000;
73 return "file" + convert<docstring>(++seed);
77 /// the type of inclusion
79 INCLUDE, VERB, INPUT, VERBAST, LISTINGS, NONE
83 Types type(string const & s)
87 if (s == "verbatiminput")
89 if (s == "verbatiminput*")
91 if (s == "lstinputlisting")
99 Types type(InsetCommandParams const & params)
101 return type(params.getCmdName());
105 bool isListings(InsetCommandParams const & params)
107 return type(params) == LISTINGS;
111 bool isVerbatim(InsetCommandParams const & params)
113 Types const t = type(params);
114 return t == VERB || t == VERBAST;
118 bool isInputOrInclude(InsetCommandParams const & params)
120 Types const t = type(params);
121 return t == INPUT || t == INCLUDE;
125 FileName const masterFileName(Buffer const & buffer)
127 return buffer.masterBuffer()->fileName();
131 void add_preview(RenderMonitoredPreview &, InsetInclude const &, Buffer const &);
134 string const parentFilename(Buffer const & buffer)
136 return buffer.absFileName();
140 EmbeddedFile const includedFilename(Buffer const & buffer,
141 InsetCommandParams const & params)
143 // it is not a good idea to create this EmbeddedFile object
144 // each time, but there seems to be no easy way around.
145 EmbeddedFile file(to_utf8(params["filename"]),
146 onlyPath(parentFilename(buffer)));
147 file.setEmbed(!params["embed"].empty());
148 file.setInzipName(to_utf8(params["embed"]));
149 file.enable(buffer.embedded(), &buffer, false);
153 InsetLabel * createLabel(docstring const & label_str)
155 if (label_str.empty())
157 InsetCommandParams icp(LABEL_CODE);
158 icp["name"] = label_str;
159 return new InsetLabel(icp);
165 InsetInclude::InsetInclude(InsetCommandParams const & p)
166 : InsetCommand(p, "include"), include_label(uniqueID()),
167 preview_(new RenderMonitoredPreview(this)), set_label_(false), label_(0)
169 preview_->fileChanged(boost::bind(&InsetInclude::fileChanged, this));
171 if (isListings(params())) {
172 InsetListingsParams listing_params(to_utf8(p["lstparams"]));
173 label_ = createLabel(from_utf8(listing_params.getParamValue("label")));
178 InsetInclude::InsetInclude(InsetInclude const & other)
179 : InsetCommand(other), include_label(other.include_label),
180 preview_(new RenderMonitoredPreview(this)), set_label_(false), label_(0)
182 preview_->fileChanged(boost::bind(&InsetInclude::fileChanged, this));
185 label_ = new InsetLabel(*other.label_);
189 InsetInclude::~InsetInclude()
192 if (isVerbatim(params()) || isListings(params()))
196 string const parent_filename = buffer().absFileName();
197 FileName const included_file = makeAbsPath(to_utf8(params()["filename"]),
198 onlyPath(parent_filename));
200 if (!isLyXFilename(included_file.absFilename()))
203 Buffer * child = theBufferList().getBuffer(included_file.absFilename());
204 // File not opened, nothing to close.
208 // Child document has a different parent, don't close it.
209 if (child->parent() != &buffer())
213 theBufferList().release(child);
217 void InsetInclude::setBuffer(Buffer & buffer)
221 EmbeddedFile file_from = includedFilename(*buffer_, params());
222 EmbeddedFile file_to = file_from.copyTo(&buffer);
223 if (file_to.embedded())
224 setParam("embed", from_utf8(file_to.inzipName()));
225 } catch (ExceptionMessage const & message) {
226 Alert::error(message.title_, message.details_);
228 setParam("embed", docstring());
234 label_->setBuffer(buffer);
239 ParamInfo const & InsetInclude::findInfo(string const & /* cmdName */)
242 // This is only correct for the case of listings, but it'll do for now.
243 // In the other cases, this second parameter should just be empty.
244 static ParamInfo param_info_;
245 if (param_info_.empty()) {
246 param_info_.add("filename", ParamInfo::LATEX_REQUIRED);
247 param_info_.add("lstparams", ParamInfo::LATEX_OPTIONAL);
248 param_info_.add("embed", ParamInfo::LYX_INTERNAL);
254 bool InsetInclude::isCompatibleCommand(string const & s)
256 return type(s) != NONE;
260 void InsetInclude::doDispatch(Cursor & cur, FuncRequest & cmd)
262 BOOST_ASSERT(&cur.buffer() == &buffer());
263 switch (cmd.action) {
265 case LFUN_INSET_MODIFY: {
266 InsetCommandParams p(INCLUDE_CODE);
267 InsetCommandMailer::string2params("include", to_utf8(cmd.argument()), p);
268 if (!p.getCmdName().empty()) {
270 InsetListingsParams new_params(to_utf8(p["lstparams"]));
271 docstring const label_str = from_utf8(new_params.getParamValue("label"));
272 if (label_str.empty())
275 label_->updateCommand(label_str);
277 label_ = createLabel(label_str);
278 label_->setBuffer(buffer());
283 buffer().updateBibfilesCache();
289 //pass everything else up the chain
291 InsetCommand::doDispatch(cur, cmd);
297 void InsetInclude::setParams(InsetCommandParams const & p)
299 InsetCommand::setParams(p);
302 if (preview_->monitoring())
303 preview_->stopMonitoring();
305 if (type(params()) == INPUT)
306 add_preview(*preview_, *this, buffer());
310 docstring InsetInclude::screenLabel() const
314 switch (type(params())) {
316 temp = buffer().B_("Input");
319 temp = buffer().B_("Verbatim Input");
322 temp = buffer().B_("Verbatim Input*");
325 temp = buffer().B_("Include");
328 temp = listings_label_;
336 if (params()["filename"].empty())
339 temp += from_utf8(onlyFilename(to_utf8(params()["filename"])));
341 if (!params()["embed"].empty())
342 temp += _(" (embedded)");
347 /// return the child buffer if the file is a LyX doc and is loaded
348 Buffer * getChildBuffer(Buffer const & buffer, InsetCommandParams const & params)
350 if (isVerbatim(params) || isListings(params))
353 string const included_file = includedFilename(buffer, params).absFilename();
354 if (!isLyXFilename(included_file))
357 Buffer * childBuffer = loadIfNeeded(buffer, params);
359 // FIXME: recursive includes
360 return (childBuffer == &buffer) ? 0 : childBuffer;
364 /// return true if the file is or got loaded.
365 Buffer * loadIfNeeded(Buffer const & parent, InsetCommandParams const & params)
367 if (isVerbatim(params) || isListings(params))
370 string const parent_filename = parent.absFileName();
371 FileName const included_file = makeAbsPath(to_utf8(params["filename"]),
372 onlyPath(parent_filename));
374 if (!isLyXFilename(included_file.absFilename()))
377 Buffer * child = theBufferList().getBuffer(included_file.absFilename());
379 // the readonly flag can/will be wrong, not anymore I think.
380 if (!included_file.exists())
383 child = theBufferList().newBuffer(included_file.absFilename());
385 // Buffer creation is not possible.
388 if (!child->loadLyXFile(included_file)) {
389 //close the buffer we just opened
390 theBufferList().release(child);
394 if (!child->errorList("Parse").empty()) {
395 // FIXME: Do something.
398 child->setParent(&parent);
403 int InsetInclude::latex(odocstream & os, OutputParams const & runparams) const
405 string incfile = to_utf8(params()["filename"]);
407 // Do nothing if no file name has been specified
411 FileName const included_file =
412 includedFilename(buffer(), params()).availableFile();
414 // Check we're not trying to include ourselves.
415 // FIXME RECURSIVE INCLUDE
416 // This isn't sufficient, as the inclusion could be downstream.
417 // But it'll have to do for now.
418 if (isInputOrInclude(params()) &&
419 buffer().absFileName() == included_file.absFilename())
421 Alert::error(_("Recursive input"),
422 bformat(_("Attempted to include file %1$s in itself! "
423 "Ignoring inclusion."), from_utf8(incfile)));
427 Buffer const * const masterBuffer = buffer().masterBuffer();
429 // if incfile is relative, make it relative to the master
431 if (!FileName(incfile).isAbsolute()) {
433 incfile = to_utf8(makeRelPath(from_utf8(included_file.absFilename()),
434 from_utf8(masterBuffer->filePath())));
437 // write it to a file (so far the complete file)
438 string const exportfile = changeExtension(incfile, ".tex");
439 string const mangled =
440 DocFileName(changeExtension(included_file.absFilename(),".tex")).
442 FileName const writefile(makeAbsPath(mangled, masterBuffer->temppath()));
446 else if (!isValidLaTeXFilename(incfile)) {
447 frontend::Alert::warning(_("Invalid filename"),
448 _("The following filename is likely to cause trouble "
449 "when running the exported file through LaTeX: ") +
452 LYXERR(Debug::LATEX, "incfile:" << incfile);
453 LYXERR(Debug::LATEX, "exportfile:" << exportfile);
454 LYXERR(Debug::LATEX, "writefile:" << writefile);
456 if (runparams.inComment || runparams.dryrun) {
457 //Don't try to load or copy the file if we're
458 //in a comment or doing a dryrun
459 } else if (isInputOrInclude(params()) &&
460 isLyXFilename(included_file.absFilename())) {
461 //if it's a LyX file and we're inputting or including,
462 //try to load it so we can write the associated latex
463 if (!loadIfNeeded(buffer(), params()))
466 Buffer * tmp = theBufferList().getBuffer(included_file.absFilename());
468 if (tmp->params().baseClass() != masterBuffer->params().baseClass()) {
470 docstring text = bformat(_("Included file `%1$s'\n"
471 "has textclass `%2$s'\n"
472 "while parent file has textclass `%3$s'."),
473 included_file.displayName(),
474 from_utf8(tmp->params().documentClass().name()),
475 from_utf8(masterBuffer->params().documentClass().name()));
476 Alert::warning(_("Different textclasses"), text);
479 // Make sure modules used in child are all included in master
480 //FIXME It might be worth loading the children's modules into the master
481 //over in BufferParams rather than doing this check.
482 vector<string> const masterModules = masterBuffer->params().getModules();
483 vector<string> const childModules = tmp->params().getModules();
484 vector<string>::const_iterator it = childModules.begin();
485 vector<string>::const_iterator end = childModules.end();
486 for (; it != end; ++it) {
487 string const module = *it;
488 vector<string>::const_iterator found =
489 find(masterModules.begin(), masterModules.end(), module);
490 if (found == masterModules.end()) {
491 docstring text = bformat(_("Included file `%1$s'\n"
492 "uses module `%2$s'\n"
493 "which is not used in parent file."),
494 included_file.displayName(), from_utf8(module));
495 Alert::warning(_("Module not found"), text);
499 tmp->markDepClean(masterBuffer->temppath());
501 // FIXME: handle non existing files
502 // FIXME: Second argument is irrelevant!
503 // since only_body is true, makeLaTeXFile will not look at second
504 // argument. Should we set it to string(), or should makeLaTeXFile
505 // make use of it somehow? (JMarc 20031002)
506 // The included file might be written in a different encoding
507 Encoding const * const oldEnc = runparams.encoding;
508 runparams.encoding = &tmp->params().encoding();
509 tmp->makeLaTeXFile(writefile,
510 masterFileName(buffer()).onlyPath().absFilename(),
512 runparams.encoding = oldEnc;
514 // In this case, it's not a LyX file, so we copy the file
515 // to the temp dir, so that .aux files etc. are not created
516 // in the original dir. Files included by this file will be
517 // found via input@path, see ../Buffer.cpp.
518 unsigned long const checksum_in = included_file.checksum();
519 unsigned long const checksum_out = writefile.checksum();
521 if (checksum_in != checksum_out) {
522 if (!included_file.copyTo(writefile)) {
525 to_utf8(bformat(_("Could not copy the file\n%1$s\n"
526 "into the temporary directory."),
527 from_utf8(included_file.absFilename()))));
533 string const tex_format = (runparams.flavor == OutputParams::LATEX) ?
534 "latex" : "pdflatex";
535 if (isVerbatim(params())) {
536 incfile = latex_path(incfile);
538 os << '\\' << from_ascii(params().getCmdName()) << '{'
539 << from_utf8(incfile) << '}';
540 } else if (type(params()) == INPUT) {
541 runparams.exportdata->addExternalFile(tex_format, writefile,
544 // \input wants file with extension (default is .tex)
545 if (!isLyXFilename(included_file.absFilename())) {
546 incfile = latex_path(incfile);
548 os << '\\' << from_ascii(params().getCmdName())
549 << '{' << from_utf8(incfile) << '}';
551 incfile = changeExtension(incfile, ".tex");
552 incfile = latex_path(incfile);
554 os << '\\' << from_ascii(params().getCmdName())
555 << '{' << from_utf8(incfile) << '}';
557 } else if (type(params()) == LISTINGS) {
558 os << '\\' << from_ascii(params().getCmdName());
559 string const opt = to_utf8(params()["lstparams"]);
560 // opt is set in QInclude dialog and should have passed validation.
561 InsetListingsParams params(opt);
562 if (!params.params().empty())
563 os << "[" << from_utf8(params.params()) << "]";
564 os << '{' << from_utf8(incfile) << '}';
566 runparams.exportdata->addExternalFile(tex_format, writefile,
569 // \include don't want extension and demands that the
570 // file really have .tex
571 incfile = changeExtension(incfile, string());
572 incfile = latex_path(incfile);
574 os << '\\' << from_ascii(params().getCmdName()) << '{'
575 << from_utf8(incfile) << '}';
582 int InsetInclude::plaintext(odocstream & os, OutputParams const &) const
584 if (isVerbatim(params()) || isListings(params())) {
585 os << '[' << screenLabel() << '\n';
586 // FIXME: We don't know the encoding of the file, default to UTF-8.
587 os << includedFilename(buffer(), params()).fileContents("UTF-8");
589 return PLAINTEXT_NEWLINE + 1; // one char on a separate line
591 docstring const str = '[' + screenLabel() + ']';
598 int InsetInclude::docbook(odocstream & os, OutputParams const & runparams) const
600 string incfile = to_utf8(params()["filename"]);
602 // Do nothing if no file name has been specified
606 string const included_file = includedFilename(buffer(), params()).absFilename();
608 // Check we're not trying to include ourselves.
609 // FIXME RECURSIVE INCLUDE
610 // This isn't sufficient, as the inclusion could be downstream.
611 // But it'll have to do for now.
612 if (buffer().absFileName() == included_file) {
613 Alert::error(_("Recursive input"),
614 bformat(_("Attempted to include file %1$s in itself! "
615 "Ignoring inclusion."), from_utf8(incfile)));
619 // write it to a file (so far the complete file)
620 string const exportfile = changeExtension(incfile, ".sgml");
621 DocFileName writefile(changeExtension(included_file, ".sgml"));
623 if (loadIfNeeded(buffer(), params())) {
624 Buffer * tmp = theBufferList().getBuffer(included_file);
626 string const mangled = writefile.mangledFilename();
627 writefile = makeAbsPath(mangled,
628 buffer().masterBuffer()->temppath());
632 LYXERR(Debug::LATEX, "incfile:" << incfile);
633 LYXERR(Debug::LATEX, "exportfile:" << exportfile);
634 LYXERR(Debug::LATEX, "writefile:" << writefile);
636 tmp->makeDocBookFile(writefile, runparams, true);
639 runparams.exportdata->addExternalFile("docbook", writefile,
641 runparams.exportdata->addExternalFile("docbook-xml", writefile,
644 if (isVerbatim(params()) || isListings(params())) {
645 os << "<inlinegraphic fileref=\""
646 << '&' << include_label << ';'
647 << "\" format=\"linespecific\">";
649 os << '&' << include_label << ';';
655 void InsetInclude::validate(LaTeXFeatures & features) const
657 string incfile = to_utf8(params()["filename"]);
660 BOOST_ASSERT(&buffer() == &features.buffer());
662 string const included_file =
663 includedFilename(buffer(), params()).availableFile().absFilename();
665 if (isLyXFilename(included_file))
666 writefile = changeExtension(included_file, ".sgml");
668 writefile = included_file;
670 if (!features.runparams().nice && !isVerbatim(params()) && !isListings(params())) {
671 incfile = DocFileName(writefile).mangledFilename();
672 writefile = makeAbsPath(incfile,
673 buffer().masterBuffer()->temppath()).absFilename();
676 features.includeFile(include_label, writefile);
678 if (isVerbatim(params()))
679 features.require("verbatim");
680 else if (isListings(params()))
681 features.require("listings");
683 // Here we must do the fun stuff...
684 // Load the file in the include if it needs
686 if (loadIfNeeded(buffer(), params())) {
688 Buffer * const tmp = theBufferList().getBuffer(included_file);
689 // make sure the buffer isn't us
690 // FIXME RECURSIVE INCLUDES
691 // This is not sufficient, as recursive includes could be
692 // more than a file away. But it will do for now.
693 if (tmp && tmp != &buffer()) {
694 // We must temporarily change features.buffer,
695 // otherwise it would always be the master buffer,
696 // and nested includes would not work.
697 features.setBuffer(*tmp);
698 tmp->validate(features);
699 features.setBuffer(buffer());
705 void InsetInclude::fillWithBibKeys(BiblioInfo & keys,
706 InsetIterator const & /*di*/) const
708 if (loadIfNeeded(buffer(), params())) {
709 string const included_file = includedFilename(buffer(), params()).absFilename();
710 Buffer * tmp = theBufferList().getBuffer(included_file);
711 //FIXME This is kind of a dirty hack and should be made reasonable.
713 keys.fillWithBibKeys(tmp);
714 tmp->setParent(&buffer());
719 void InsetInclude::updateBibfilesCache()
721 Buffer * const tmp = getChildBuffer(buffer(), params());
724 tmp->updateBibfilesCache();
725 tmp->setParent(&buffer());
730 EmbeddedFileList const &
731 InsetInclude::getBibfilesCache(Buffer const & buffer) const
733 Buffer * const tmp = getChildBuffer(buffer, params());
736 EmbeddedFileList const & cache = tmp->getBibfilesCache();
737 tmp->setParent(&buffer);
740 static EmbeddedFileList const empty;
745 void InsetInclude::metrics(MetricsInfo & mi, Dimension & dim) const
747 BOOST_ASSERT(mi.base.bv);
749 bool use_preview = false;
750 if (RenderPreview::status() != LyXRC::PREVIEW_OFF) {
751 graphics::PreviewImage const * pimage =
752 preview_->getPreviewImage(mi.base.bv->buffer());
753 use_preview = pimage && pimage->image();
757 preview_->metrics(mi, dim);
761 button_.update(screenLabel(), true);
763 button_.metrics(mi, dim);
766 Box b(0, dim.wid, -dim.asc, dim.des);
771 void InsetInclude::draw(PainterInfo & pi, int x, int y) const
773 BOOST_ASSERT(pi.base.bv);
775 bool use_preview = false;
776 if (RenderPreview::status() != LyXRC::PREVIEW_OFF) {
777 graphics::PreviewImage const * pimage =
778 preview_->getPreviewImage(pi.base.bv->buffer());
779 use_preview = pimage && pimage->image();
783 preview_->draw(pi, x, y);
785 button_.draw(pi, x, y);
789 Inset::DisplayType InsetInclude::display() const
791 return type(params()) == INPUT ? Inline : AlignCenter;
800 void InsetInclude::fileChanged() const
802 Buffer const * const buffer = updateFrontend();
806 preview_->removePreview(*buffer);
807 add_preview(*preview_.get(), *this, *buffer);
808 preview_->startLoading(*buffer);
814 bool preview_wanted(InsetCommandParams const & params, Buffer const & buffer)
816 FileName const included_file = includedFilename(buffer, params);
818 return type(params) == INPUT && params.preview() &&
819 included_file.isReadableFile();
823 docstring latexString(InsetInclude const & inset)
826 // We don't need to set runparams.encoding since this will be done
827 // by latex() anyway.
828 OutputParams runparams(0);
829 runparams.flavor = OutputParams::LATEX;
830 inset.latex(os, runparams);
836 void add_preview(RenderMonitoredPreview & renderer, InsetInclude const & inset,
837 Buffer const & buffer)
839 InsetCommandParams const & params = inset.params();
840 if (RenderPreview::status() != LyXRC::PREVIEW_OFF &&
841 preview_wanted(params, buffer)) {
842 renderer.setAbsFile(includedFilename(buffer, params));
843 docstring const snippet = latexString(inset);
844 renderer.addPreview(snippet, buffer);
851 void InsetInclude::addPreview(graphics::PreviewLoader & ploader) const
853 Buffer const & buffer = ploader.buffer();
854 if (!preview_wanted(params(), buffer))
856 preview_->setAbsFile(includedFilename(buffer, params()));
857 docstring const snippet = latexString(*this);
858 preview_->addPreview(snippet, ploader);
862 void InsetInclude::addToToc(ParConstIterator const & cpit) const
864 bool const embedded_status = !params()["embed"].empty();
865 TocBackend & backend = buffer().tocBackend();
867 if (isListings(params())) {
869 label_->addToToc(cpit);
871 InsetListingsParams p(to_utf8(params()["lstparams"]));
872 string caption = p.getParamValue("caption");
875 Toc & toc = backend.toc("listing");
876 docstring str = convert<docstring>(toc.size() + 1)
877 + ". " + from_utf8(caption);
878 if (embedded_status) {
879 backend.toc("embedded").push_back(TocItem(cpit, 0, str));
880 str += _(" (embedded)");
882 ParConstIterator pit = cpit;
883 pit.push_back(*this);
884 toc.push_back(TocItem(pit, 0, str));
887 Buffer const * const childbuffer = getChildBuffer(buffer(), params());
890 // Add it to the embedded list nonetheless.
891 backend.toc("embedded").push_back(TocItem(cpit, 0,
892 params()["filename"]));
896 Toc & toc = backend.toc("child");
897 docstring str = childbuffer->fileName().displayName();
898 if (embedded_status) {
899 backend.toc("embedded").push_back(TocItem(cpit, 0, str));
900 str += _(" (embedded)");
902 toc.push_back(TocItem(cpit, 0, str));
904 TocList & toclist = backend.tocs();
905 TocList const & childtoclist = childbuffer->tocBackend().tocs();
906 TocList::const_iterator it = childtoclist.begin();
907 TocList::const_iterator const end = childtoclist.end();
908 for(; it != end; ++it)
909 toclist[it->first].insert(toclist[it->first].end(),
910 it->second.begin(), it->second.end());
914 void InsetInclude::updateLabels(ParIterator const & it)
916 Buffer const * const childbuffer = getChildBuffer(buffer(), params());
918 lyx::updateLabels(*childbuffer, true);
921 if (!isListings(params()))
925 label_->updateLabels(it);
927 InsetListingsParams const par(to_utf8(params()["lstparams"]));
928 if (par.getParamValue("caption").empty()) {
929 listings_label_.clear();
932 Counters & counters = buffer().params().documentClass().counters();
933 docstring const cnt = from_ascii("listing");
934 listings_label_ = buffer().B_("Program Listing");
935 if (counters.hasCounter(cnt)) {
937 listings_label_ += " " + convert<docstring>(counters.value(cnt));
942 void InsetInclude::registerEmbeddedFiles(EmbeddedFileList & files) const
944 files.registerFile(includedFilename(buffer(), params()), this, buffer());
948 void InsetInclude::updateEmbeddedFile(EmbeddedFile const & file)
950 InsetCommandParams p = params();
951 p["filename"] = from_utf8(file.outputFilename());
952 p["embed"] = file.embedded() ? from_utf8(file.inzipName()) : docstring();