#include <config.h>
#include "Bidi.h"
-#include "BufferView.h"
#include "Buffer.h"
-#include "Cursor.h"
+#include "BufferView.h"
#include "CoordCache.h"
+#include "Cursor.h"
#include "CutAndPaste.h"
#include "DispatchResult.h"
#include "Encoding.h"
+#include "Font.h"
#include "FuncRequest.h"
#include "Language.h"
#include "lfuns.h"
-#include "Font.h"
#include "LyXFunc.h" // only for setMessage()
#include "LyXRC.h"
-#include "Row.h"
-#include "Text.h"
-#include "Paragraph.h"
#include "paragraph_funcs.h"
+#include "Paragraph.h"
#include "ParIterator.h"
+#include "Row.h"
+#include "Text.h"
#include "TextMetrics.h"
+#include "TocBackend.h"
#include "support/debug.h"
#include "support/docstream.h"
//#define FILEDEBUG 1
-bool Cursor::isInside(Inset const * p)
+bool Cursor::isInside(Inset const * p) const
{
for (size_t i = 0; i != depth(); ++i)
if (&operator[](i).inset() == p)
{
if (empty())
return 0;
- int s = 0;
- // go up until first non-0 text is hit
- // (innermost text is 0 in mathed)
- for (s = depth() - 1; s >= 0; --s)
- if (operator[](s).text())
- break;
- CursorSlice const & sl = operator[](s);
+ CursorSlice const & sl = innerTextSlice();
Text const & text = *sl.text();
Font font = text.getPar(sl.pit()).getFont(
bv().buffer().params(), sl.pos(), outerFont(sl.pit(), text.paragraphs()));
// if a character is entered.
// HACK. far from being perfect...
- // go up until first non-0 text is hit
- // (innermost text is 0 in mathed)
- int s = 0;
- for (s = depth() - 1; s >= 0; --s)
- if (operator[](s).text())
- break;
- CursorSlice const & sl = operator[](s);
+
+ CursorSlice const & sl = innerTextSlice();
Text const & text = *sl.text();
Paragraph const & par = text.getPar(sl.pit());
}
+void Cursor::checkBufferStructure()
+{
+ if (paragraph().layout()->toclevel == Layout::NOT_IN_TOC)
+ return;
+ Buffer const * master = buffer().masterBuffer();
+ master->tocBackend().updateItem(ParConstIterator(*this));
+ master->structureChanged();
+}
+
+
} // namespace lyx