#include "support/lstrings.h"
#include <boost/bind.hpp>
-#include <boost/assert.hpp>
+#include "support/lassert.h"
using namespace std;
using namespace lyx::support;
void InsetText::initParagraphs(Buffer const & buf)
{
- BOOST_ASSERT(paragraphs().empty());
+ LASSERT(paragraphs().empty(), /**/);
buffer_ = const_cast<Buffer *>(&buf);
paragraphs().push_back(Paragraph());
Paragraph & ourpar = paragraphs().back();
void InsetText::clear()
{
ParagraphList & pars = paragraphs();
- BOOST_ASSERT(!pars.empty());
+ LASSERT(!pars.empty(), /**/);
// This is a gross hack...
Layout const & old_layout = pars.begin()->layout();
Paragraph oldpar = *paragraphs().begin();
paragraphs().clear();
ErrorList errorList;
+ lex.setContext("InsetText::read");
bool res = text_.read(buffer(), lex, errorList, this);
- if (!res) {
- lex.printError("Missing \\end_inset at this point. "
- "Read: `$$Token'");
- }
+ if (!res)
+ lex.printError("Missing \\end_inset at this point. ");
// sanity check
// ensure we have at least one paragraph.
}
-// FIXME: instead of this hack, which only works by chance,
-// cells should have their own insetcell type, which returns CELL_CODE!
-bool InsetText::isTableCell() const
-{
- // this is only true for tabular cells
- return !text_.isMainText(buffer()) && lyxCode() == TEXT_CODE;
-}
-
-
-
-bool InsetText::neverIndent() const
-{
- return isTableCell();
-}
-
-
ParagraphList const & InsetText::paragraphs() const
{
return text_.paragraphs();
}
+//void InsetInclude::addToToc(DocIterator const & cpit)
+//{
+//}
+
+
void InsetText::updateLabels(ParIterator const & it)
{
ParIterator it2 = it;
it2.forwardPos();
- BOOST_ASSERT(&it2.inset() == this && it2.pit() == 0);
- lyx::updateLabels(buffer(), it2);
+ LASSERT(&it2.inset() == this && it2.pit() == 0, /**/);
+ if (producesOutput())
+ lyx::updateLabels(buffer(), it2);
+ else {
+ DocumentClass const & tclass = buffer().params().documentClass();
+ Counters const savecnt = tclass.counters();
+ lyx::updateLabels(buffer(), it2);
+ tclass.counters() = savecnt;
+ }
}
// find text inset in old cursor
Cursor insetCur = old;
int scriptSlice = insetCur.find(this);
- BOOST_ASSERT(scriptSlice != -1);
+ LASSERT(scriptSlice != -1, /**/);
insetCur.cutOff(scriptSlice);
- BOOST_ASSERT(&insetCur.inset() == this);
+ LASSERT(&insetCur.inset() == this, /**/);
// update the old paragraph's words
insetCur.paragraph().updateWords(insetCur.top());
}
+bool InsetText::showCompletionCursor() const
+{
+ return lyxrc.completion_cursor_text;
+}
+
+
CompletionList const * InsetText::createCompletionList(Cursor const & cur) const
{
return completionSupported(cur) ? text_.createCompletionList(cur) : 0;