+#else
+// increment depth over selection and
+// make a total rebreak of those paragraphs
+void LyXText::IncDepth(BufferView * bview)
+{
+ // If there is no selection, just use the current paragraph
+ if (!selection.set()) {
+ selection.start = cursor; // dummy selection
+ selection.end = cursor;
+ }
+
+ // We end at the next paragraph with depth 0
+ LyXParagraph * endpar = selection.end.par()->next();
+
+ LyXParagraph * undoendpar = endpar;
+
+ if (endpar && endpar->GetDepth()) {
+ while (endpar && endpar->GetDepth()) {
+ endpar = endpar->next();
+ undoendpar = endpar;
+ }
+ }
+ else if (endpar) {
+ endpar = endpar->next(); // because of parindents etc.
+ }
+
+ SetUndo(bview->buffer(), Undo::EDIT,
+ selection.start.par()->previous(),
+ undoendpar);
+
+ LyXCursor tmpcursor = cursor; // store the current cursor
+
+ // ok we have a selection. This is always between sel_start_cursor
+ // and sel_end cursor
+ cursor = selection.start;
+
+ bool anything_changed = false;
+
+ while (true) {
+ // NOTE: you can't change the depth of a bibliography entry
+ if (
+ textclasslist.Style(bview->buffer()->params.textclass,
+ cursor.par()->GetLayout()
+ ).labeltype != LABEL_BIBLIO) {
+ LyXParagraph * prev = cursor.par()->previous();
+
+ if (prev
+ && (prev->GetDepth() - cursor.par()->GetDepth() > 0
+ || (prev->GetDepth() == cursor.par()->GetDepth()
+ && textclasslist.Style(bview->buffer()->params.textclass,
+ prev->GetLayout()).isEnvironment()))) {
+ cursor.par()->params.depth(cursor.par()->params.depth() + 1);
+ anything_changed = true;
+ }
+ }
+ if (cursor.par() == selection.end.par())
+ break;
+ cursor.par(cursor.par()->next());
+ }
+
+ // if nothing changed set all depth to 0
+ if (!anything_changed) {
+ cursor = selection.start;
+ while (cursor.par() != selection.end.par()) {
+ cursor.par()->params.depth(0);
+ cursor.par(cursor.par()->next());
+ }
+ cursor.par()->params.depth(0);
+ }
+
+ RedoParagraphs(bview, selection.start, endpar);
+
+ // we have to reset the selection, because the
+ // geometry could have changed
+ SetCursor(bview, selection.start.par(), selection.start.pos());
+ selection.cursor = cursor;
+ SetCursor(bview, selection.end.par(), selection.end.pos());
+ UpdateCounters(bview, cursor.row());
+ ClearSelection(bview);
+ SetSelection(bview);
+ SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
+}
+#endif