]> git.lyx.org Git - lyx.git/blobdiff - src/Text.cpp
compil fix for Qt-4.2
[lyx.git] / src / Text.cpp
index 6b29809261a4d5be798c4bf31a1e39e065d9a9b6..6e2ee99964f6bd948eebc9a79c0a153e4c2ee72a 100644 (file)
@@ -543,7 +543,7 @@ void Text::insertChar(Cursor & cur, char_type c)
        }
 
        par.insertChar(cur.pos(), c, cur.current_font, cur.buffer().params().trackChanges);
-       checkBufferStructure(cur.buffer(), cur);
+       cur.checkBufferStructure();
 
 //             cur.updateFlags(Update::Force);
        setCursor(cur.top(), cur.pit(), cur.pos() + 1);
@@ -795,7 +795,7 @@ void Text::deleteWordForward(Cursor & cur)
                cursorForwardOneWord(cur);
                cur.setSelection();
                cutSelection(cur, true, false);
-               checkBufferStructure(cur.buffer(), cur);
+               cur.checkBufferStructure();
        }
 }
 
@@ -811,7 +811,7 @@ void Text::deleteWordBackward(Cursor & cur)
                cursorBackwardOneWord(cur);
                cur.setSelection();
                cutSelection(cur, true, false);
-               checkBufferStructure(cur.buffer(), cur);
+               cur.checkBufferStructure();
        }
 }
 
@@ -823,9 +823,11 @@ void Text::changeCase(Cursor & cur, TextCase action)
        CursorSlice from;
        CursorSlice to;
 
+       bool gotsel = false;
        if (cur.selection()) {
                from = cur.selBegin();
                to = cur.selEnd();
+               gotsel = true;
        } else {
                from = cur.top();
                getWord(from, to, PARTIAL_WORD);
@@ -850,12 +852,15 @@ void Text::changeCase(Cursor & cur, TextCase action)
        }
 
        // the selection may have changed due to logically-only deleted chars
-       setCursor(cur, begPit, begPos);
-       cur.resetAnchor();
-       setCursor(cur, endPit, right);
-       cur.setSelection();
+       if (gotsel) {
+               setCursor(cur, begPit, begPos);
+               cur.resetAnchor();
+               setCursor(cur, endPit, right);
+               cur.setSelection();
+       } else
+               setCursor(cur, endPit, right);
 
-       checkBufferStructure(cur.buffer(), cur);
+       cur.checkBufferStructure();
 }
 
 
@@ -905,7 +910,7 @@ bool Text::erase(Cursor & cur)
                        // the character has been logically deleted only => skip it
                        cur.top().forwardPos();
                }
-               checkBufferStructure(cur.buffer(), cur);
+               cur.checkBufferStructure();
                needsUpdate = true;
        } else {
                if (cur.pit() == cur.lastpit())
@@ -927,7 +932,7 @@ bool Text::erase(Cursor & cur)
                // Make sure the cursor is correct. Is this really needed?
                // No, not really... at least not here!
                cur.text()->setCursor(cur.top(), cur.pit(), cur.pos());
-               checkBufferStructure(cur.buffer(), cur);
+               cur.checkBufferStructure();
        }
 
        return needsUpdate;
@@ -1015,7 +1020,7 @@ bool Text::backspace(Cursor & cur)
                setCursorIntern(cur, cur.pit(), cur.pos() - 1,
                                false, cur.boundary());
                cur.paragraph().eraseChar(cur.pos(), cur.buffer().params().trackChanges);
-               checkBufferStructure(cur.buffer(), cur);
+               cur.checkBufferStructure();
        }
 
        if (cur.pos() == cur.lastpos())
@@ -1384,7 +1389,7 @@ void Text::charsTranspose(Cursor & cur)
        par.insertChar(pos1, char2, font2, trackChanges);
        par.insertChar(pos2, char1, font1, trackChanges);
 
-       checkBufferStructure(cur.buffer(), cur);
+       cur.checkBufferStructure();
 
        // After the transposition, move cursor to after the transposition.
        setCursor(cur, cur.pit(), pos2);
@@ -1392,4 +1397,16 @@ void Text::charsTranspose(Cursor & cur)
 }
 
 
+DocIterator Text::macrocontextPosition() const
+{
+       return macrocontext_position_;
+}
+
+
+void Text::setMacrocontextPosition(DocIterator const & pos)
+{
+       macrocontext_position_ = pos;
+}
+
+
 } // namespace lyx