Buffer * checkAndLoadLyXFile(FileName const & filename)
{
// File already open?
- Buffer * checkBuffer = theBufferList().getBuffer(filename.absFilename());
+ Buffer * checkBuffer = theBufferList().getBuffer(filename);
if (checkBuffer) {
if (checkBuffer->isClean())
return checkBuffer;
{
static int newfile_number;
- string document_path = path.absFilename();
- string filename = addName(document_path,
+ FileName filename(path,
"newfile" + convert<string>(++newfile_number) + ".lyx");
while (theBufferList().exists(filename)
- || FileName(filename).isReadableFile()) {
+ || filename.isReadableFile()) {
++newfile_number;
- filename = addName(document_path,
+ filename.set(path,
"newfile" + convert<string>(newfile_number) + ".lyx");
}
- return newFile(filename, templatename, false);
+ return newFile(filename.absFilename(), templatename, false);
}
// start over the counters
textclass.counters().reset();
buf.clearReferenceCache();
+ buf.inset().setBuffer(const_cast<Buffer &>(buf));
buf.updateMacros();
}
Buffer & cbuf = const_cast<Buffer &>(buf);
- if (buf.text().empty()) {
- // FIXME: we don't call continue with updateLabels()
- // here because it crashes on newly created documents.
- // But the TocBackend needs to be initialised
- // nonetheless so we update the tocBackend manually.
- cbuf.tocBackend().update();
- return;
- }
+ BOOST_ASSERT(!buf.text().paragraphs().empty());
// do the real work
ParIterator parit = par_iterator_begin(buf.inset());