#include "LyXRC.h"
#include "Lexer.h"
#include "MetricsInfo.h"
+#include "output_xhtml.h"
#include "OutputParams.h"
#include "TextClass.h"
#include "TocBackend.h"
}
-InsetLabel * createLabel(docstring const & label_str)
+InsetLabel * createLabel(Buffer * buf, docstring const & label_str)
{
if (label_str.empty())
return 0;
InsetCommandParams icp(LABEL_CODE);
icp["name"] = label_str;
- return new InsetLabel(icp);
+ return new InsetLabel(buf, icp);
}
} // namespace anon
-InsetInclude::InsetInclude(InsetCommandParams const & p)
- : InsetCommand(p, "include"), include_label(uniqueID()),
+InsetInclude::InsetInclude(Buffer * buf, InsetCommandParams const & p)
+ : InsetCommand(buf, p, "include"), include_label(uniqueID()),
preview_(new RenderMonitoredPreview(this)), failedtoload_(false),
set_label_(false), label_(0), child_buffer_(0)
{
if (isListings(params())) {
InsetListingsParams listing_params(to_utf8(p["lstparams"]));
- label_ = createLabel(from_utf8(listing_params.getParamValue("label")));
+ label_ = createLabel(buffer_, from_utf8(listing_params.getParamValue("label")));
}
}
if (label_)
old_label = label_->getParam("name");
else {
- label_ = createLabel(new_label);
+ label_ = createLabel(buffer_, new_label);
label_->setBuffer(buffer());
}
Encoding const * const oldEnc = runparams.encoding;
Language const * const oldLang = runparams.master_language;
runparams.encoding = &tmp->params().encoding();
- runparams.master_language = masterBuffer->params().language;
+ runparams.master_language = buffer().params().language;
tmp->makeLaTeXFile(writefile,
masterFileName(buffer()).onlyPath().absFilename(),
runparams, false);
}
-docstring InsetInclude::xhtml(odocstream & os, OutputParams const &rp) const
+docstring InsetInclude::xhtml(XHTMLStream & xs, OutputParams const &rp) const
{
if (rp.inComment)
return docstring();
bool const listing = isListings(params());
if (listing || isVerbatim(params())) {
if (listing)
- os << "<pre>\n";
+ xs << StartTag("pre");
// FIXME: We don't know the encoding of the file, default to UTF-8.
- os << includedFilename(buffer(), params()).fileContents("UTF-8");
+ xs << includedFilename(buffer(), params()).fileContents("UTF-8");
if (listing)
- os << "</pre>\n";
+ xs << EndTag("pre");
return docstring();
}
Buffer const * const ibuf = loadIfNeeded();
if (!ibuf)
return docstring();
- ibuf->writeLyXHTMLSource(os, rp, true);
+ ibuf->writeLyXHTMLSource(xs.os(), rp, true);
return docstring();
}
} // namespace anon
-void InsetInclude::addPreview(graphics::PreviewLoader & ploader) const
+void InsetInclude::addPreview(DocIterator const & /*inset_pos*/,
+ graphics::PreviewLoader & ploader) const
{
Buffer const & buffer = ploader.buffer();
if (!preview_wanted(params(), buffer))
setParams(p);
}
-void InsetInclude::updateLabels(ParIterator const & it)
+void InsetInclude::updateLabels(ParIterator const & it, bool out)
{
Buffer const * const childbuffer = getChildBuffer();
if (childbuffer) {
- childbuffer->updateLabels(Buffer::UpdateChildOnly);
+ childbuffer->updateLabels(Buffer::UpdateChildOnly, out);
return;
}
if (!isListings(params()))
return;
if (label_)
- label_->updateLabels(it);
+ label_->updateLabels(it, out);
InsetListingsParams const par(to_utf8(params()["lstparams"]));
if (par.getParamValue("caption").empty()) {