2003-06-20 12:46:28 +00:00
|
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
|
* \file buffer_funcs.cpp
|
2003-06-20 12:46:28 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
2003-06-20 12:46:28 +00:00
|
|
|
|
* \author Alfredo Braunstein
|
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-06-20 12:46:28 +00:00
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include "buffer_funcs.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "Buffer.h"
|
|
|
|
|
#include "BufferList.h"
|
|
|
|
|
#include "BufferParams.h"
|
|
|
|
|
#include "DocIterator.h"
|
|
|
|
|
#include "Counters.h"
|
|
|
|
|
#include "ErrorList.h"
|
2005-02-25 11:55:36 +00:00
|
|
|
|
#include "Floating.h"
|
|
|
|
|
#include "FloatList.h"
|
2003-06-20 12:46:28 +00:00
|
|
|
|
#include "gettext.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "Language.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
|
#include "LaTeX.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "LyXTextClass.h"
|
|
|
|
|
#include "Paragraph.h"
|
2005-04-19 09:04:25 +00:00
|
|
|
|
#include "paragraph_funcs.h"
|
2006-03-23 20:11:06 +00:00
|
|
|
|
#include "ParagraphList.h"
|
2005-02-25 11:55:36 +00:00
|
|
|
|
#include "ParagraphParameters.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "ParIterator.h"
|
|
|
|
|
#include "LyXVC.h"
|
|
|
|
|
#include "TexRow.h"
|
2006-11-11 00:35:14 +00:00
|
|
|
|
#include "TocBackend.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "VCBackend.h"
|
2003-06-20 12:46:28 +00:00
|
|
|
|
|
|
|
|
|
#include "frontends/Alert.h"
|
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "insets/InsetBibitem.h"
|
|
|
|
|
#include "insets/InsetCaption.h"
|
|
|
|
|
#include "insets/InsetInclude.h"
|
|
|
|
|
#include "insets/InsetTabular.h"
|
2005-02-25 11:55:36 +00:00
|
|
|
|
|
2003-09-06 18:38:02 +00:00
|
|
|
|
#include "support/filetools.h"
|
2005-01-31 10:42:26 +00:00
|
|
|
|
#include "support/fs_extras.h"
|
2003-06-20 12:46:28 +00:00
|
|
|
|
#include "support/lyxlib.h"
|
|
|
|
|
|
2004-11-06 15:23:12 +00:00
|
|
|
|
#include <boost/bind.hpp>
|
2005-01-31 10:42:26 +00:00
|
|
|
|
#include <boost/filesystem/operations.hpp>
|
2004-11-06 15:23:12 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2006-04-16 14:19:25 +00:00
|
|
|
|
using namespace std;
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
using support::bformat;
|
2006-11-26 21:30:39 +00:00
|
|
|
|
using support::FileName;
|
2006-10-21 00:16:43 +00:00
|
|
|
|
using support::libFileSearch;
|
2006-12-17 12:12:17 +00:00
|
|
|
|
using support::makeAbsPath;
|
2006-10-21 00:16:43 +00:00
|
|
|
|
using support::makeDisplayPath;
|
|
|
|
|
using support::onlyFilename;
|
|
|
|
|
using support::onlyPath;
|
|
|
|
|
using support::unlink;
|
2003-06-20 12:46:28 +00:00
|
|
|
|
|
2005-02-25 11:55:36 +00:00
|
|
|
|
using std::min;
|
2003-10-06 15:43:21 +00:00
|
|
|
|
using std::string;
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace Alert = frontend::Alert;
|
2005-01-31 10:42:26 +00:00
|
|
|
|
namespace fs = boost::filesystem;
|
2003-06-30 23:56:22 +00:00
|
|
|
|
|
2003-06-20 12:46:28 +00:00
|
|
|
|
namespace {
|
|
|
|
|
|
2006-12-02 16:07:15 +00:00
|
|
|
|
bool readFile(Buffer * const b, FileName const & s)
|
2003-06-20 12:46:28 +00:00
|
|
|
|
{
|
2005-01-05 20:21:27 +00:00
|
|
|
|
BOOST_ASSERT(b);
|
|
|
|
|
|
2003-06-20 12:46:28 +00:00
|
|
|
|
// File information about normal file
|
2006-12-02 16:07:15 +00:00
|
|
|
|
if (!fs::exists(s.toFilesystemEncoding())) {
|
|
|
|
|
docstring const file = makeDisplayPath(s.absFilename(), 50);
|
2006-09-11 08:54:10 +00:00
|
|
|
|
docstring text = bformat(_("The specified document\n%1$s"
|
|
|
|
|
"\ncould not be read."), file);
|
|
|
|
|
Alert::error(_("Could not read document"), text);
|
2003-06-20 12:46:28 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check if emergency save file exists and is newer.
|
2006-12-02 16:07:15 +00:00
|
|
|
|
FileName const e(s.absFilename() + ".emergency");
|
2004-03-26 17:49:08 +00:00
|
|
|
|
|
2006-12-02 16:07:15 +00:00
|
|
|
|
if (fs::exists(e.toFilesystemEncoding()) &&
|
|
|
|
|
fs::exists(s.toFilesystemEncoding()) &&
|
|
|
|
|
fs::last_write_time(e.toFilesystemEncoding()) > fs::last_write_time(s.toFilesystemEncoding()))
|
2004-03-26 17:49:08 +00:00
|
|
|
|
{
|
2006-12-02 16:07:15 +00:00
|
|
|
|
docstring const file = makeDisplayPath(s.absFilename(), 20);
|
2006-09-11 08:54:10 +00:00
|
|
|
|
docstring const text =
|
|
|
|
|
bformat(_("An emergency save of the document "
|
2005-01-05 20:21:27 +00:00
|
|
|
|
"%1$s exists.\n\n"
|
2006-09-11 08:54:10 +00:00
|
|
|
|
"Recover emergency save?"), file);
|
|
|
|
|
switch (Alert::prompt(_("Load emergency save?"), text, 0, 2,
|
|
|
|
|
_("&Recover"), _("&Load Original"),
|
|
|
|
|
_("&Cancel")))
|
2004-03-26 17:49:08 +00:00
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
// the file is not saved if we load the emergency file.
|
|
|
|
|
b->markDirty();
|
2006-12-17 12:12:17 +00:00
|
|
|
|
return b->readFile(e);
|
2004-03-26 17:49:08 +00:00
|
|
|
|
case 1:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
2003-06-20 12:46:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-03-26 17:49:08 +00:00
|
|
|
|
// Now check if autosave file is newer.
|
2006-12-02 16:07:15 +00:00
|
|
|
|
FileName const a(onlyPath(s.absFilename()) + '#' + onlyFilename(s.absFilename()) + '#');
|
2004-03-26 17:49:08 +00:00
|
|
|
|
|
2006-12-02 16:07:15 +00:00
|
|
|
|
if (fs::exists(a.toFilesystemEncoding()) &&
|
|
|
|
|
fs::exists(s.toFilesystemEncoding()) &&
|
|
|
|
|
fs::last_write_time(a.toFilesystemEncoding()) > fs::last_write_time(s.toFilesystemEncoding()))
|
2004-03-26 17:49:08 +00:00
|
|
|
|
{
|
2006-12-02 16:07:15 +00:00
|
|
|
|
docstring const file = makeDisplayPath(s.absFilename(), 20);
|
2006-09-11 08:54:10 +00:00
|
|
|
|
docstring const text =
|
|
|
|
|
bformat(_("The backup of the document "
|
2005-01-05 20:21:27 +00:00
|
|
|
|
"%1$s is newer.\n\nLoad the "
|
2006-09-11 08:54:10 +00:00
|
|
|
|
"backup instead?"), file);
|
|
|
|
|
switch (Alert::prompt(_("Load backup?"), text, 0, 2,
|
|
|
|
|
_("&Load backup"), _("Load &original"),
|
|
|
|
|
_("&Cancel") ))
|
2004-03-26 17:49:08 +00:00
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
// the file is not saved if we load the autosave file.
|
|
|
|
|
b->markDirty();
|
2006-12-17 12:12:17 +00:00
|
|
|
|
return b->readFile(a);
|
2004-03-26 17:49:08 +00:00
|
|
|
|
case 1:
|
|
|
|
|
// Here we delete the autosave
|
2006-12-02 16:07:15 +00:00
|
|
|
|
unlink(a);
|
2004-03-26 17:49:08 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
2003-06-20 12:46:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2006-12-17 12:12:17 +00:00
|
|
|
|
return b->readFile(s);
|
2003-06-20 12:46:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace anon
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-12-02 16:07:15 +00:00
|
|
|
|
bool loadLyXFile(Buffer * b, FileName const & s)
|
2003-06-20 12:46:28 +00:00
|
|
|
|
{
|
2005-01-05 20:21:27 +00:00
|
|
|
|
BOOST_ASSERT(b);
|
|
|
|
|
|
2006-12-02 16:07:15 +00:00
|
|
|
|
if (fs::is_readable(s.toFilesystemEncoding())) {
|
2003-06-20 12:46:28 +00:00
|
|
|
|
if (readFile(b, s)) {
|
2003-09-09 09:47:59 +00:00
|
|
|
|
b->lyxvc().file_found_hook(s);
|
2006-12-02 16:07:15 +00:00
|
|
|
|
if (!fs::is_writable(s.toFilesystemEncoding()))
|
2005-01-31 10:42:26 +00:00
|
|
|
|
b->setReadonly(true);
|
2003-06-20 12:46:28 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
2005-01-31 10:42:26 +00:00
|
|
|
|
} else {
|
2006-12-02 16:07:15 +00:00
|
|
|
|
docstring const file = makeDisplayPath(s.absFilename(), 20);
|
2003-06-20 12:46:28 +00:00
|
|
|
|
// Here we probably should run
|
|
|
|
|
if (LyXVC::file_not_found_hook(s)) {
|
2006-09-11 08:54:10 +00:00
|
|
|
|
docstring const text =
|
|
|
|
|
bformat(_("Do you want to retrieve the document"
|
|
|
|
|
" %1$s from version control?"), file);
|
|
|
|
|
int const ret = Alert::prompt(_("Retrieve from version control?"),
|
|
|
|
|
text, 0, 1, _("&Retrieve"), _("&Cancel"));
|
2003-06-20 12:46:28 +00:00
|
|
|
|
|
|
|
|
|
if (ret == 0) {
|
|
|
|
|
// How can we know _how_ to do the checkout?
|
|
|
|
|
// With the current VC support it has to be,
|
|
|
|
|
// a RCS file since CVS do not have special ,v files.
|
|
|
|
|
RCS::retrieve(s);
|
|
|
|
|
return loadLyXFile(b, s);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2006-09-27 10:24:13 +00:00
|
|
|
|
// FIXME newFile() should probably be a member method of Application...
|
2003-06-30 23:56:22 +00:00
|
|
|
|
Buffer * newFile(string const & filename, string const & templatename,
|
2005-01-05 20:21:27 +00:00
|
|
|
|
bool const isNamed)
|
2003-06-20 12:46:28 +00:00
|
|
|
|
{
|
|
|
|
|
// get a free buffer
|
2006-10-11 17:24:46 +00:00
|
|
|
|
Buffer * b = theBufferList().newBuffer(filename);
|
2005-01-05 20:21:27 +00:00
|
|
|
|
BOOST_ASSERT(b);
|
2003-06-20 12:46:28 +00:00
|
|
|
|
|
2006-12-17 12:12:17 +00:00
|
|
|
|
FileName tname;
|
2003-06-20 12:46:28 +00:00
|
|
|
|
// use defaults.lyx as a default template if it exists.
|
|
|
|
|
if (templatename.empty())
|
2006-12-17 12:12:17 +00:00
|
|
|
|
tname = libFileSearch("templates", "defaults.lyx");
|
2003-06-20 12:46:28 +00:00
|
|
|
|
else
|
2006-12-27 10:56:11 +00:00
|
|
|
|
tname = makeAbsPath(templatename);
|
2003-06-20 12:46:28 +00:00
|
|
|
|
|
|
|
|
|
if (!tname.empty()) {
|
2003-07-28 14:40:29 +00:00
|
|
|
|
if (!b->readFile(tname)) {
|
2006-12-17 12:12:17 +00:00
|
|
|
|
docstring const file = makeDisplayPath(tname.absFilename(), 50);
|
2006-09-11 08:54:10 +00:00
|
|
|
|
docstring const text = bformat(
|
|
|
|
|
_("The specified document template\n%1$s\ncould not be read."),
|
|
|
|
|
file);
|
|
|
|
|
Alert::error(_("Could not read template"), text);
|
2006-10-11 17:24:46 +00:00
|
|
|
|
theBufferList().release(b);
|
2006-07-17 15:13:49 +00:00
|
|
|
|
return 0;
|
2003-06-20 12:46:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!isNamed) {
|
|
|
|
|
b->setUnnamed();
|
|
|
|
|
b->setFileName(filename);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
b->setReadonly(false);
|
2003-10-22 14:40:24 +00:00
|
|
|
|
b->fully_loaded(true);
|
2003-06-20 12:46:28 +00:00
|
|
|
|
|
|
|
|
|
return b;
|
|
|
|
|
}
|
2003-06-24 20:42:15 +00:00
|
|
|
|
|
|
|
|
|
|
2006-08-13 16:16:43 +00:00
|
|
|
|
void bufferErrors(Buffer const & buf, TeXErrors const & terr,
|
|
|
|
|
ErrorList & errorList)
|
2003-06-24 20:42:15 +00:00
|
|
|
|
{
|
|
|
|
|
TeXErrors::Errors::const_iterator cit = terr.begin();
|
|
|
|
|
TeXErrors::Errors::const_iterator end = terr.end();
|
|
|
|
|
|
|
|
|
|
for (; cit != end; ++cit) {
|
2005-06-03 08:48:04 +00:00
|
|
|
|
int id_start = -1;
|
|
|
|
|
int pos_start = -1;
|
|
|
|
|
int errorrow = cit->error_in_line;
|
2005-11-29 13:39:03 +00:00
|
|
|
|
bool found = buf.texrow().getIdFromRow(errorrow, id_start,
|
2006-04-05 23:56:29 +00:00
|
|
|
|
pos_start);
|
2005-06-03 08:48:04 +00:00
|
|
|
|
int id_end = -1;
|
|
|
|
|
int pos_end = -1;
|
|
|
|
|
do {
|
|
|
|
|
++errorrow;
|
2005-11-29 13:39:03 +00:00
|
|
|
|
found = buf.texrow().getIdFromRow(errorrow, id_end,
|
2006-04-05 23:56:29 +00:00
|
|
|
|
pos_end);
|
2005-11-29 13:39:03 +00:00
|
|
|
|
} while (found && id_start == id_end && pos_start == pos_end);
|
2005-06-03 08:48:04 +00:00
|
|
|
|
|
2006-11-12 10:58:00 +00:00
|
|
|
|
errorList.push_back(ErrorItem(cit->error_desc,
|
|
|
|
|
cit->error_text, id_start, pos_start, pos_end));
|
2003-06-24 20:42:15 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-04-09 00:26:19 +00:00
|
|
|
|
string const bufferFormat(Buffer const & buffer)
|
2003-06-24 20:42:15 +00:00
|
|
|
|
{
|
2006-08-23 10:57:45 +00:00
|
|
|
|
if (buffer.isDocBook())
|
2003-06-24 20:42:15 +00:00
|
|
|
|
return "docbook";
|
|
|
|
|
else if (buffer.isLiterate())
|
|
|
|
|
return "literate";
|
|
|
|
|
else
|
|
|
|
|
return "latex";
|
|
|
|
|
}
|
2004-12-27 16:30:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int countWords(DocIterator const & from, DocIterator const & to)
|
|
|
|
|
{
|
|
|
|
|
int count = 0;
|
|
|
|
|
bool inword = false;
|
|
|
|
|
for (DocIterator dit = from ; dit != to ; dit.forwardPos()) {
|
|
|
|
|
// Copied and adapted from isLetter() in ControlSpellChecker
|
|
|
|
|
if (dit.inTexted()
|
|
|
|
|
&& dit.pos() != dit.lastpos()
|
|
|
|
|
&& dit.paragraph().isLetter(dit.pos())
|
2006-10-19 12:49:11 +00:00
|
|
|
|
&& !dit.paragraph().isDeleted(dit.pos())) {
|
2004-12-27 16:30:27 +00:00
|
|
|
|
if (!inword) {
|
|
|
|
|
++count;
|
|
|
|
|
inword = true;
|
|
|
|
|
}
|
|
|
|
|
} else if (inword)
|
|
|
|
|
inword = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
}
|
2005-02-25 11:55:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
depth_type getDepth(DocIterator const & it)
|
2005-02-25 11:55:36 +00:00
|
|
|
|
{
|
2006-10-21 00:16:43 +00:00
|
|
|
|
depth_type depth = 0;
|
2006-04-05 23:56:29 +00:00
|
|
|
|
for (size_t i = 0 ; i < it.depth() ; ++i)
|
2005-08-03 20:21:11 +00:00
|
|
|
|
if (!it[i].inset().inMathed())
|
|
|
|
|
depth += it[i].paragraph().getDepth() + 1;
|
|
|
|
|
// remove 1 since the outer inset does not count
|
|
|
|
|
return depth - 1;
|
|
|
|
|
}
|
2005-02-25 11:55:36 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
depth_type getItemDepth(ParIterator const & it)
|
2006-04-05 23:56:29 +00:00
|
|
|
|
{
|
2005-08-03 20:21:11 +00:00
|
|
|
|
Paragraph const & par = *it;
|
|
|
|
|
LYX_LABEL_TYPES const labeltype = par.layout()->labeltype;
|
2005-02-25 11:55:36 +00:00
|
|
|
|
|
2005-08-03 20:21:11 +00:00
|
|
|
|
if (labeltype != LABEL_ENUMERATE && labeltype != LABEL_ITEMIZE)
|
2006-04-05 23:56:29 +00:00
|
|
|
|
return 0;
|
2005-02-25 11:55:36 +00:00
|
|
|
|
|
2005-08-03 20:21:11 +00:00
|
|
|
|
// this will hold the lowest depth encountered up to now.
|
2006-10-21 00:16:43 +00:00
|
|
|
|
depth_type min_depth = getDepth(it);
|
2005-08-03 20:21:11 +00:00
|
|
|
|
ParIterator prev_it = it;
|
2005-02-25 11:55:36 +00:00
|
|
|
|
while (true) {
|
2005-08-03 20:21:11 +00:00
|
|
|
|
if (prev_it.pit())
|
|
|
|
|
--prev_it.top().pit();
|
|
|
|
|
else {
|
|
|
|
|
// start of nested inset: go to outer par
|
|
|
|
|
prev_it.pop_back();
|
|
|
|
|
if (prev_it.empty()) {
|
|
|
|
|
// start of document: nothing to do
|
|
|
|
|
return 0;
|
2005-02-25 11:55:36 +00:00
|
|
|
|
}
|
2005-08-03 20:21:11 +00:00
|
|
|
|
}
|
2006-04-05 23:56:29 +00:00
|
|
|
|
|
2005-08-03 20:21:11 +00:00
|
|
|
|
// We search for the first paragraph with same label
|
|
|
|
|
// that is not more deeply nested.
|
|
|
|
|
Paragraph & prev_par = *prev_it;
|
2006-10-21 00:16:43 +00:00
|
|
|
|
depth_type const prev_depth = getDepth(prev_it);
|
2006-04-05 23:56:29 +00:00
|
|
|
|
if (labeltype == prev_par.layout()->labeltype) {
|
2005-08-03 20:21:11 +00:00
|
|
|
|
if (prev_depth < min_depth) {
|
|
|
|
|
return prev_par.itemdepth + 1;
|
2005-02-25 11:55:36 +00:00
|
|
|
|
}
|
2005-08-03 20:21:11 +00:00
|
|
|
|
else if (prev_depth == min_depth) {
|
|
|
|
|
return prev_par.itemdepth;
|
2005-02-25 11:55:36 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2005-08-03 20:21:11 +00:00
|
|
|
|
min_depth = std::min(min_depth, prev_depth);
|
|
|
|
|
// small optimization: if we are at depth 0, we won't
|
|
|
|
|
// find anything else
|
|
|
|
|
if (prev_depth == 0) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2005-02-25 11:55:36 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-08-03 20:21:11 +00:00
|
|
|
|
bool needEnumCounterReset(ParIterator const & it)
|
2005-02-25 11:55:36 +00:00
|
|
|
|
{
|
2005-08-03 20:21:11 +00:00
|
|
|
|
Paragraph const & par = *it;
|
|
|
|
|
BOOST_ASSERT(par.layout()->labeltype == LABEL_ENUMERATE);
|
2006-10-21 00:16:43 +00:00
|
|
|
|
depth_type const cur_depth = par.getDepth();
|
2005-08-03 20:21:11 +00:00
|
|
|
|
ParIterator prev_it = it;
|
|
|
|
|
while (prev_it.pit()) {
|
|
|
|
|
--prev_it.top().pit();
|
|
|
|
|
Paragraph const & prev_par = *prev_it;
|
|
|
|
|
if (prev_par.getDepth() <= cur_depth)
|
|
|
|
|
return prev_par.layout()->labeltype != LABEL_ENUMERATE;
|
2005-02-25 11:55:36 +00:00
|
|
|
|
}
|
2005-08-03 20:21:11 +00:00
|
|
|
|
// start of nested inset: reset
|
|
|
|
|
return true;
|
2005-02-25 11:55:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-02-05 14:09:53 +00:00
|
|
|
|
void setCaptionLabels(InsetBase & inset, string const & type,
|
|
|
|
|
docstring const label, Counters & counters)
|
2007-01-30 13:23:21 +00:00
|
|
|
|
{
|
|
|
|
|
LyXText * text = inset.getText(0);
|
|
|
|
|
if (!text)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ParagraphList & pars = text->paragraphs();
|
|
|
|
|
if (pars.empty())
|
|
|
|
|
return;
|
|
|
|
|
|
2007-02-05 14:09:53 +00:00
|
|
|
|
docstring const counter = from_ascii(type);
|
2007-01-30 13:23:21 +00:00
|
|
|
|
|
|
|
|
|
ParagraphList::iterator p = pars.begin();
|
|
|
|
|
for (; p != pars.end(); ++p) {
|
|
|
|
|
InsetList::iterator it2 = p->insetlist.begin();
|
|
|
|
|
InsetList::iterator end2 = p->insetlist.end();
|
|
|
|
|
// Any caption within this float should have the same
|
|
|
|
|
// label prefix but different numbers.
|
|
|
|
|
for (; it2 != end2; ++it2) {
|
|
|
|
|
InsetBase & icap = *it2->inset;
|
|
|
|
|
// Look deeper just in case.
|
2007-02-05 14:09:53 +00:00
|
|
|
|
setCaptionLabels(icap, type, label, counters);
|
2007-01-30 13:23:21 +00:00
|
|
|
|
if (icap.lyxCode() == InsetBase::CAPTION_CODE) {
|
|
|
|
|
// We found a caption!
|
|
|
|
|
counters.step(counter);
|
|
|
|
|
int number = counters.value(counter);
|
2007-02-01 12:45:14 +00:00
|
|
|
|
InsetCaption & ic = static_cast<InsetCaption &>(icap);
|
|
|
|
|
ic.setType(type);
|
|
|
|
|
ic.setCount(number);
|
|
|
|
|
ic.setCustomLabel(label);
|
2007-01-30 13:23:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setCaptions(Paragraph & par, LyXTextClass const & textclass)
|
|
|
|
|
{
|
|
|
|
|
if (par.insetlist.empty())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
Counters & counters = textclass.counters();
|
|
|
|
|
|
|
|
|
|
InsetList::iterator it = par.insetlist.begin();
|
|
|
|
|
InsetList::iterator end = par.insetlist.end();
|
|
|
|
|
for (; it != end; ++it) {
|
|
|
|
|
InsetBase & inset = *it->inset;
|
2007-02-05 18:04:03 +00:00
|
|
|
|
if (inset.lyxCode() == InsetBase::FLOAT_CODE
|
|
|
|
|
|| inset.lyxCode() == InsetBase::WRAP_CODE) {
|
|
|
|
|
docstring const & name = inset.getInsetName();
|
|
|
|
|
if (name.empty())
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
Floating const & fl = textclass.floats().getType(to_ascii(name));
|
|
|
|
|
// FIXME UNICODE
|
|
|
|
|
string const & type = fl.type();
|
|
|
|
|
docstring const label = from_utf8(fl.name());
|
|
|
|
|
setCaptionLabels(inset, type, label, counters);
|
|
|
|
|
}
|
|
|
|
|
else if (inset.lyxCode() == InsetBase::TABULAR_CODE
|
|
|
|
|
&& static_cast<InsetTabular &>(inset).tabular.isLongTabular()) {
|
|
|
|
|
// FIXME: are "table" and "Table" the correct type and label?
|
|
|
|
|
setCaptionLabels(inset, "table", from_ascii("Table"), counters);
|
|
|
|
|
}
|
2007-01-30 13:23:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-16 14:19:25 +00:00
|
|
|
|
// set the label of a paragraph. This includes the counters.
|
2006-11-13 16:53:49 +00:00
|
|
|
|
void setLabel(Buffer const & buf, ParIterator & it, LyXTextClass const & textclass)
|
2005-02-25 11:55:36 +00:00
|
|
|
|
{
|
|
|
|
|
Paragraph & par = *it;
|
|
|
|
|
LyXLayout_ptr const & layout = par.layout();
|
|
|
|
|
Counters & counters = textclass.counters();
|
|
|
|
|
|
|
|
|
|
if (it.pit() == 0) {
|
|
|
|
|
par.params().appendix(par.params().startOfAppendix());
|
|
|
|
|
} else {
|
|
|
|
|
par.params().appendix(it.plist()[it.pit() - 1].params().appendix());
|
|
|
|
|
if (!par.params().appendix() &&
|
|
|
|
|
par.params().startOfAppendix()) {
|
|
|
|
|
par.params().appendix(true);
|
|
|
|
|
textclass.counters().reset();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-08-03 20:21:11 +00:00
|
|
|
|
// Compute the item depth of the paragraph
|
|
|
|
|
par.itemdepth = getItemDepth(it);
|
|
|
|
|
|
2005-02-25 11:55:36 +00:00
|
|
|
|
if (layout->margintype == MARGIN_MANUAL) {
|
|
|
|
|
if (par.params().labelWidthString().empty())
|
2007-01-15 16:58:14 +00:00
|
|
|
|
par.params().labelWidthString(par.translateIfPossible(layout->labelstring(), buf.params()));
|
2005-02-25 11:55:36 +00:00
|
|
|
|
} else {
|
2007-01-15 16:58:14 +00:00
|
|
|
|
par.params().labelWidthString(docstring());
|
2005-02-25 11:55:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-01-11 16:38:08 +00:00
|
|
|
|
// Optimisation: setLabel() can be called for each for each
|
|
|
|
|
// paragraph of the document. So we make the string static to
|
|
|
|
|
// avoid the repeated instanciation.
|
|
|
|
|
static docstring itemlabel;
|
|
|
|
|
|
2005-02-25 11:55:36 +00:00
|
|
|
|
// is it a layout that has an automatic label?
|
|
|
|
|
if (layout->labeltype == LABEL_COUNTER) {
|
2005-04-19 09:04:25 +00:00
|
|
|
|
if (layout->toclevel <= buf.params().secnumdepth
|
2005-05-12 10:16:04 +00:00
|
|
|
|
&& (layout->latextype != LATEX_ENVIRONMENT
|
2005-04-19 09:04:25 +00:00
|
|
|
|
|| isFirstInSequence(it.pit(), it.plist()))) {
|
2006-10-20 22:17:16 +00:00
|
|
|
|
counters.step(layout->counter);
|
2007-01-15 16:58:14 +00:00
|
|
|
|
par.params().labelString(
|
|
|
|
|
par.expandLabel(layout, buf.params()));
|
2007-01-11 16:38:08 +00:00
|
|
|
|
} else
|
2007-01-15 16:58:14 +00:00
|
|
|
|
par.params().labelString(docstring());
|
2007-01-11 16:38:08 +00:00
|
|
|
|
|
2005-02-25 11:55:36 +00:00
|
|
|
|
} else if (layout->labeltype == LABEL_ITEMIZE) {
|
|
|
|
|
// At some point of time we should do something more
|
|
|
|
|
// clever here, like:
|
|
|
|
|
// par.params().labelString(
|
2006-11-13 16:53:49 +00:00
|
|
|
|
// buf.params().user_defined_bullet(par.itemdepth).getText());
|
2005-02-25 11:55:36 +00:00
|
|
|
|
// for now, use a simple hardcoded label
|
|
|
|
|
switch (par.itemdepth) {
|
|
|
|
|
case 0:
|
2006-10-21 00:16:43 +00:00
|
|
|
|
itemlabel = char_type(0x2022);
|
2005-02-25 11:55:36 +00:00
|
|
|
|
break;
|
|
|
|
|
case 1:
|
2006-10-21 00:16:43 +00:00
|
|
|
|
itemlabel = char_type(0x2013);
|
2005-02-25 11:55:36 +00:00
|
|
|
|
break;
|
|
|
|
|
case 2:
|
2006-10-21 00:16:43 +00:00
|
|
|
|
itemlabel = char_type(0x2217);
|
2005-02-25 11:55:36 +00:00
|
|
|
|
break;
|
|
|
|
|
case 3:
|
2007-01-11 16:38:08 +00:00
|
|
|
|
itemlabel = char_type(0x2219); // or 0x00b7
|
2005-02-25 11:55:36 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2007-01-15 16:58:14 +00:00
|
|
|
|
par.params().labelString(itemlabel);
|
2005-02-25 11:55:36 +00:00
|
|
|
|
|
|
|
|
|
} else if (layout->labeltype == LABEL_ENUMERATE) {
|
|
|
|
|
// FIXME
|
|
|
|
|
// Yes I know this is a really, really! bad solution
|
|
|
|
|
// (Lgb)
|
2006-10-21 00:16:43 +00:00
|
|
|
|
docstring enumcounter = from_ascii("enum");
|
2005-02-25 11:55:36 +00:00
|
|
|
|
|
|
|
|
|
switch (par.itemdepth) {
|
|
|
|
|
case 2:
|
|
|
|
|
enumcounter += 'i';
|
|
|
|
|
case 1:
|
|
|
|
|
enumcounter += 'i';
|
|
|
|
|
case 0:
|
|
|
|
|
enumcounter += 'i';
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
enumcounter += "iv";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
// not a valid enumdepth...
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2005-08-03 20:21:11 +00:00
|
|
|
|
// Maybe we have to reset the enumeration counter.
|
|
|
|
|
if (needEnumCounterReset(it))
|
|
|
|
|
counters.reset(enumcounter);
|
|
|
|
|
|
2005-02-25 11:55:36 +00:00
|
|
|
|
counters.step(enumcounter);
|
|
|
|
|
|
2005-09-09 14:52:55 +00:00
|
|
|
|
string format;
|
|
|
|
|
|
|
|
|
|
switch (par.itemdepth) {
|
|
|
|
|
case 0:
|
|
|
|
|
format = N_("\\arabic{enumi}.");
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
format = N_("(\\alph{enumii})");
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
format = N_("\\roman{enumiii}.");
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
format = N_("\\Alph{enumiv}.");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
// not a valid enumdepth...
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-15 16:58:14 +00:00
|
|
|
|
par.params().labelString(counters.counterLabel(
|
|
|
|
|
par.translateIfPossible(from_ascii(format), buf.params())));
|
2007-01-11 16:38:08 +00:00
|
|
|
|
|
2005-02-25 11:55:36 +00:00
|
|
|
|
} else if (layout->labeltype == LABEL_BIBLIO) {// ale970302
|
2006-10-21 00:16:43 +00:00
|
|
|
|
counters.step(from_ascii("bibitem"));
|
|
|
|
|
int number = counters.value(from_ascii("bibitem"));
|
2005-06-09 09:58:08 +00:00
|
|
|
|
if (par.bibitem())
|
2005-02-25 11:55:36 +00:00
|
|
|
|
par.bibitem()->setCounter(number);
|
2007-01-11 16:38:08 +00:00
|
|
|
|
|
2007-01-15 16:58:14 +00:00
|
|
|
|
par.params().labelString(
|
|
|
|
|
par.translateIfPossible(layout->labelstring(), buf.params()));
|
|
|
|
|
// In biblio shouldn't be following counters but...
|
2005-02-25 11:55:36 +00:00
|
|
|
|
} else if (layout->labeltype == LABEL_SENSITIVE) {
|
|
|
|
|
// Search for the first float or wrap inset in the iterator
|
|
|
|
|
size_t i = it.depth();
|
2007-02-19 12:38:31 +00:00
|
|
|
|
InsetBase * in = 0;
|
2005-02-25 11:55:36 +00:00
|
|
|
|
while (i > 0) {
|
|
|
|
|
--i;
|
2007-02-20 19:12:06 +00:00
|
|
|
|
InsetBase::Code const code = it[i].inset().lyxCode();
|
|
|
|
|
if (code == InsetBase::FLOAT_CODE ||
|
|
|
|
|
code == InsetBase::WRAP_CODE) {
|
|
|
|
|
in = &it[i].inset();
|
2005-02-25 11:55:36 +00:00
|
|
|
|
break;
|
2007-02-20 19:12:06 +00:00
|
|
|
|
}
|
2005-02-25 11:55:36 +00:00
|
|
|
|
}
|
2007-02-20 19:12:06 +00:00
|
|
|
|
// FIXME Can getInsetName() return an empty name for wide or
|
|
|
|
|
// float insets? If not we can put the definition of type
|
|
|
|
|
// inside the if (in) clause and use that instead of
|
|
|
|
|
// if (!type.empty()).
|
2007-02-19 12:38:31 +00:00
|
|
|
|
docstring type;
|
|
|
|
|
if (in)
|
|
|
|
|
type = in->getInsetName();
|
2005-02-25 11:55:36 +00:00
|
|
|
|
|
|
|
|
|
if (!type.empty()) {
|
2006-10-22 10:15:23 +00:00
|
|
|
|
Floating const & fl = textclass.floats().getType(to_ascii(type));
|
2006-10-20 20:30:00 +00:00
|
|
|
|
// FIXME UNICODE
|
2006-10-21 00:16:43 +00:00
|
|
|
|
counters.step(from_ascii(fl.type()));
|
2005-02-25 11:55:36 +00:00
|
|
|
|
|
|
|
|
|
// Doesn't work... yet.
|
2007-01-15 16:58:14 +00:00
|
|
|
|
par.params().labelString(par.translateIfPossible(
|
|
|
|
|
bformat(from_ascii("%1$s #:"), from_utf8(fl.name())),
|
|
|
|
|
buf.params()));
|
2005-02-25 11:55:36 +00:00
|
|
|
|
} else {
|
|
|
|
|
// par->SetLayout(0);
|
2007-01-15 16:58:14 +00:00
|
|
|
|
par.params().labelString(par.translateIfPossible(
|
|
|
|
|
layout->labelstring(), buf.params()));
|
2005-02-25 11:55:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-04-11 08:24:15 +00:00
|
|
|
|
} else if (layout->labeltype == LABEL_NO_LABEL)
|
2007-01-15 16:58:14 +00:00
|
|
|
|
par.params().labelString(docstring());
|
2006-04-11 08:24:15 +00:00
|
|
|
|
else
|
2007-01-15 16:58:14 +00:00
|
|
|
|
par.params().labelString(
|
|
|
|
|
par.translateIfPossible(layout->labelstring(), buf.params()));
|
2005-02-25 11:55:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // anon namespace
|
|
|
|
|
|
|
|
|
|
|
2006-09-09 11:16:28 +00:00
|
|
|
|
bool updateCurrentLabel(Buffer const & buf,
|
|
|
|
|
ParIterator & it)
|
2006-04-07 22:16:09 +00:00
|
|
|
|
{
|
2006-04-16 14:19:25 +00:00
|
|
|
|
if (it == par_iterator_end(buf.inset()))
|
2006-09-09 11:16:28 +00:00
|
|
|
|
return false;
|
2006-04-22 18:48:28 +00:00
|
|
|
|
|
Move BufferView cached pointer out of LyXText:
* LyXText
- bv(), bv_owner, : deleted.
- These methods now need a (Buffer const &) argument: getFont(), applyOuterFont(), getLayoutFont(), getLabelFont(), setCharFont(), setLayout(), singleWidth(), leftMargin(), rightMargin(), computeRowMetrics(), isMainText(), spacing(), isRTL(), cursorX(), rowBreakPoint(), setRowWidth(), labelFill(), labelEnd().
- These methods now need a (BufferView const &) argument and are propably candidates for future removal when 1.6 is opened for development: redoParagraph(), x2pos(), getRowNearY(), getColumnNearX(), checkInsetHit(), setHeightOfRow().
- recUndo(): now need a LCursor argument.
* CoordCache::get(LyXText const *, pit_type):
- now const.
- use const_iterator instead of iterator.
* FontIterator:
- add (Buffer const &) argument to ctor
- buffer_: new const reference to applicable BufferView.
* InsetBase
- xo(), yo(), covers() and neverIndent() are now const.
* InsetText::setViewCache(): deleted
All other changes are due to the LyXText and InsetBase API changes.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15618 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-30 12:45:33 +00:00
|
|
|
|
// if (it.lastpit == 0 && LyXText::isMainText(buf))
|
2006-04-22 18:48:28 +00:00
|
|
|
|
// return false;
|
|
|
|
|
|
2006-04-07 22:16:09 +00:00
|
|
|
|
switch (it->layout()->labeltype) {
|
2006-09-09 11:16:28 +00:00
|
|
|
|
|
2006-04-07 22:16:09 +00:00
|
|
|
|
case LABEL_NO_LABEL:
|
|
|
|
|
case LABEL_MANUAL:
|
|
|
|
|
case LABEL_BIBLIO:
|
|
|
|
|
case LABEL_TOP_ENVIRONMENT:
|
|
|
|
|
case LABEL_CENTERED_TOP_ENVIRONMENT:
|
|
|
|
|
case LABEL_STATIC:
|
|
|
|
|
case LABEL_ITEMIZE:
|
2006-11-13 16:53:49 +00:00
|
|
|
|
setLabel(buf, it, buf.params().getLyXTextClass());
|
2006-04-16 14:19:25 +00:00
|
|
|
|
return true;
|
2006-04-07 22:16:09 +00:00
|
|
|
|
|
|
|
|
|
case LABEL_SENSITIVE:
|
|
|
|
|
case LABEL_COUNTER:
|
|
|
|
|
// do more things with enumerate later
|
|
|
|
|
case LABEL_ENUMERATE:
|
2006-04-16 14:19:25 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This is dead code which get rid of a warning:
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-09 11:16:28 +00:00
|
|
|
|
void updateLabels(Buffer const & buf,
|
2006-11-13 16:53:49 +00:00
|
|
|
|
ParIterator & from, ParIterator & to, bool childonly)
|
2006-04-16 14:19:25 +00:00
|
|
|
|
{
|
|
|
|
|
for (ParIterator it = from; it != to; ++it) {
|
|
|
|
|
if (it.pit() > it.lastpit())
|
|
|
|
|
return;
|
|
|
|
|
if (!updateCurrentLabel (buf, it)) {
|
2006-11-13 16:53:49 +00:00
|
|
|
|
updateLabels(buf, childonly);
|
2006-04-16 14:19:25 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2006-04-07 22:16:09 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-11-13 16:53:49 +00:00
|
|
|
|
void updateLabels(Buffer const & buf, ParIterator & iter, bool childonly)
|
2006-04-16 14:19:25 +00:00
|
|
|
|
{
|
|
|
|
|
if (updateCurrentLabel(buf, iter))
|
|
|
|
|
return;
|
|
|
|
|
|
2006-11-13 16:53:49 +00:00
|
|
|
|
updateLabels(buf, childonly);
|
2006-04-16 14:19:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-11-13 16:53:49 +00:00
|
|
|
|
void updateLabels(Buffer const & buf, bool childonly)
|
2005-02-25 11:55:36 +00:00
|
|
|
|
{
|
2006-11-13 16:53:49 +00:00
|
|
|
|
// Use the master text class also for child documents
|
|
|
|
|
LyXTextClass const & textclass = buf.params().getLyXTextClass();
|
|
|
|
|
|
|
|
|
|
if (!childonly) {
|
|
|
|
|
// If this is a child document start with the master
|
|
|
|
|
Buffer const * const master = buf.getMasterBuffer();
|
|
|
|
|
if (master != &buf) {
|
|
|
|
|
updateLabels(*master);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// start over the counters
|
|
|
|
|
textclass.counters().reset();
|
|
|
|
|
}
|
2006-09-09 11:16:28 +00:00
|
|
|
|
|
2006-04-16 14:19:25 +00:00
|
|
|
|
ParIterator const end = par_iterator_end(buf.inset());
|
2005-02-25 11:55:36 +00:00
|
|
|
|
|
2006-04-16 14:19:25 +00:00
|
|
|
|
for (ParIterator it = par_iterator_begin(buf.inset()); it != end; ++it) {
|
2005-02-25 11:55:36 +00:00
|
|
|
|
// reduce depth if necessary
|
|
|
|
|
if (it.pit()) {
|
|
|
|
|
Paragraph const & prevpar = it.plist()[it.pit() - 1];
|
|
|
|
|
it->params().depth(min(it->params().depth(),
|
|
|
|
|
prevpar.getMaxDepthAfter()));
|
|
|
|
|
} else
|
|
|
|
|
it->params().depth(0);
|
|
|
|
|
|
|
|
|
|
// set the counter for this paragraph
|
2006-11-13 16:53:49 +00:00
|
|
|
|
setLabel(buf, it, textclass);
|
|
|
|
|
|
2007-01-30 13:23:21 +00:00
|
|
|
|
// It is better to set the captions after setLabel because
|
|
|
|
|
// the caption number might need the section number in the
|
|
|
|
|
// future.
|
|
|
|
|
setCaptions(*it, textclass);
|
|
|
|
|
|
2006-11-13 16:53:49 +00:00
|
|
|
|
// Now included docs
|
|
|
|
|
InsetList::const_iterator iit = it->insetlist.begin();
|
|
|
|
|
InsetList::const_iterator end = it->insetlist.end();
|
|
|
|
|
for (; iit != end; ++iit) {
|
|
|
|
|
if (iit->inset->lyxCode() == InsetBase::INCLUDE_CODE)
|
|
|
|
|
static_cast<InsetInclude const *>(iit->inset)
|
|
|
|
|
->updateLabels(buf);
|
|
|
|
|
}
|
2005-02-25 11:55:36 +00:00
|
|
|
|
}
|
2006-04-22 18:48:28 +00:00
|
|
|
|
|
2007-03-12 11:23:41 +00:00
|
|
|
|
Buffer & cbuf = const_cast<Buffer &>(buf);
|
|
|
|
|
cbuf.tocBackend().update();
|
|
|
|
|
cbuf.structureChanged();
|
2005-02-25 11:55:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-03-12 11:23:41 +00:00
|
|
|
|
void checkBufferStructure(Buffer & buffer, ParIterator const & par_it)
|
|
|
|
|
{
|
2007-03-15 19:16:53 +00:00
|
|
|
|
if (par_it->layout()->labeltype == LABEL_COUNTER
|
|
|
|
|
&& par_it->layout()->toclevel != LyXLayout::NOT_IN_TOC) {
|
2007-03-12 11:23:41 +00:00
|
|
|
|
buffer.tocBackend().updateItem(par_it);
|
|
|
|
|
buffer.structureChanged();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
} // namespace lyx
|