#include "lyxlex.h"
#include "metricsinfo.h"
#include "outputparams.h"
+#include "TocBackend.h"
#include "frontends/Alert.h"
#include "frontends/Painter.h"
#include <boost/bind.hpp>
#include <boost/filesystem/operations.hpp>
-#include "support/std_ostream.h"
-
-#include <sstream>
-
namespace lyx {
using support::changeExtension;
using support::contains;
using support::copy;
-using support::FileName;
+using support::DocFileName;
using support::getFileContents;
using support::isFileReadable;
using support::isLyXFilename;
namespace {
-string const uniqueID()
+docstring const uniqueID()
{
static unsigned int seed = 1000;
- return "file" + convert<string>(++seed);
+ return "file" + convert<docstring>(++seed);
}
} // namespace anon
void InsetInclude::read(LyXLex & lex)
{
- params_.read(lex);
+ if (lex.isOK()) {
+ lex.next();
+ string const command = lex.getString();
+ params_.scanCommand(command);
+ }
+ string token;
+ while (lex.isOK()) {
+ lex.next();
+ token = lex.getString();
+ if (token == "\\end_inset")
+ break;
+ if (token == "preview") {
+ lex.next();
+ params_.preview(lex.getBool());
+ } else
+ lex.printError("Unknown parameter name `$$Token' for command " + params_.getCmdName());
+ }
+ if (token != "\\end_inset") {
+ lex.printError("Missing \\end_inset at this point. "
+ "Read: `$$Token'");
+ }
}
// write it to a file (so far the complete file)
string const exportfile = changeExtension(incfile, ".tex");
- string const mangled = FileName(changeExtension(included_file,
+ string const mangled = DocFileName(changeExtension(included_file,
".tex")).mangledFilename();
string const writefile = makeAbsPath(mangled, m_buffer->temppath());
if (loadIfNeeded(buffer, params_)) {
Buffer * tmp = theBufferList().getBuffer(included_file);
- string const mangled = FileName(writefile).mangledFilename();
+ string const mangled = DocFileName(writefile).mangledFilename();
writefile = makeAbsPath(mangled,
buffer.getMasterBuffer()->temppath());
if (!runparams.nice)
runparams.exportdata->addExternalFile("docbook-xml", writefile,
exportfile);
- // FIXME UNICODE
if (isVerbatim(params_)) {
os << "<inlinegraphic fileref=\""
- << '&' << from_ascii(include_label) << ';'
+ << '&' << include_label << ';'
<< "\" format=\"linespecific\">";
} else
- os << '&' << from_ascii(include_label) << ';';
+ os << '&' << include_label << ';';
return 0;
}
writefile = included_file;
if (!features.runparams().nice && !isVerbatim(params_)) {
- incfile = FileName(writefile).mangledFilename();
+ incfile = DocFileName(writefile).mangledFilename();
writefile = makeAbsPath(incfile,
buffer.getMasterBuffer()->temppath());
}
}
+void InsetInclude::addToToc(TocList & toclist, Buffer const & buffer) const
+{
+ Buffer const * const childbuffer = getChildBuffer(buffer, params_);
+ if (!childbuffer)
+ return;
+
+ TocList const & childtoclist = childbuffer->tocBackend().tocs();
+ TocList::const_iterator it = childtoclist.begin();
+ TocList::const_iterator const end = childtoclist.end();
+ for(; it != end; ++it)
+ toclist[it->first].insert(toclist[it->first].end(),
+ it->second.begin(), it->second.end());
+}
+
+
+void InsetInclude::updateLabels(Buffer const & buffer) const
+{
+ Buffer const * const childbuffer = getChildBuffer(buffer, params_);
+ if (!childbuffer)
+ return;
+
+ lyx::updateLabels(*childbuffer, true);
+}
+
+
string const InsetIncludeMailer::name_("include");
InsetIncludeMailer::InsetIncludeMailer(InsetInclude & inset)