]> git.lyx.org Git - lyx.git/blobdiff - src/lyxtext.h
* src/insets/insetcommand.C: fix plaintext() output
[lyx.git] / src / lyxtext.h
index c54132f5543e06bef142afcd56690f2562d25ea0..897808cca860789ac90c57995140309b4efb7b67 100644 (file)
@@ -30,11 +30,11 @@ class Buffer;
 class BufferParams;
 class BufferView;
 class CursorSlice;
+class DocIterator;
 class ErrorList;
-class InsetBase;
-class InsetBase_code;
 class FuncRequest;
 class FuncStatus;
+class InsetBase;
 class LColor_color;
 class LCursor;
 class LyXTextClass;
@@ -94,11 +94,6 @@ public:
        /// FIXME: replace LCursor with DocIterator.
        void setFont(LCursor & cur, LyXFont const &, bool toggleall = false);
 
-       /// returns pos in given par at given x coord.
-       /// FIXME: move to TextMetrics.
-       pos_type x2pos(BufferView const &, pit_type pit, int row, int x) const;
-       int pos2x(pit_type pit, pos_type pos) const;
-
        ///
        void toggleFree(LCursor & cur, LyXFont const &, bool toggleall = false);
 
@@ -149,13 +144,6 @@ public:
        /// FIXME: move to TextMetrics.
        pit_type getPitNearY(BufferView & bv, int y);
 
-       /** returns the column near the specified x-coordinate of the row
-        x is set to the real beginning of this column
-        */
-       /// FIXME: move to TextMetrics.
-       pos_type getColumnNearX(BufferView const & bv, int right_margin,
-               pit_type pit, Row const & row, int & x, bool & boundary) const;
-
        /** Find the word under \c from in the relative location
         *  defined by \c word_location.
         *  @param from return here the start of the word
@@ -165,10 +153,17 @@ public:
        /// just selects the word the cursor is in
        void selectWord(LCursor & cur, word_location loc);
 
-       /// accept selected change
-       void acceptChange(LCursor & cur);
-       /// reject selected change
-       void rejectChange(LCursor & cur);
+       /// what type of change operation to make 
+       enum ChangeOp {
+               ACCEPT,
+               REJECT
+       };
+       /// accept or reject the selected change
+       void acceptOrRejectChanges(LCursor & cur, ChangeOp op);
+       /// accept the changes within the complete LyXText
+       void acceptChanges(BufferParams const & bparams);
+       /// reject the changes within the complete LyXText
+       void rejectChanges(BufferParams const & bparams);
 
        /// returns true if par was empty and was removed
        bool setCursor(LCursor & cur, pit_type par, pos_type pos,
@@ -185,8 +180,10 @@ public:
        void recUndo(LCursor & cur, pit_type first, pit_type last) const;
        ///
        void recUndo(LCursor & cur, pit_type first) const;
-       /// returns true if par was empty and was removed
-       bool setCursorFromCoordinates(LCursor & cur, int x, int y);
+
+       /// sets cursor only within this LyXText.
+       /// x,y are screen coordinates
+       void setCursorFromCoordinates(LCursor & cur, int x, int y);
 
        /// sets cursor recursively descending into nested editable insets
        /**
@@ -348,23 +345,16 @@ public:
        int cursorY(BufferView const & bv, CursorSlice const & cursor,
                bool boundary) const;
 
-       /// delete double space or empty paragraphs around old cursor
-       /// FIXME: replace LCursor with DocIterator.
-       bool deleteEmptyParagraphMechanism(LCursor & cur, LCursor & old);
+       /// delete double spaces, leading spaces, and empty paragraphs around old cursor.
+       /// \retval true if a change has happened and we need a redraw.
+       /// FIXME: replace LCursor with DocIterator. This is not possible right
+       /// now because recordUndo() is called which needs a LCursor.
+       static bool deleteEmptyParagraphMechanism(LCursor & cur,
+               LCursor & old, bool & need_anchor_change);
 
-       /// sets row.end to the pos value *after* which a row should break.
-       /// for example, the pos after which isNewLine(pos) == true
-       /// FIXME: move to TextMetrics.
-       void rowBreakPoint(Buffer const &, int right_margin, int max_width, pit_type pit,
-               Row & row) const;
-       /// sets row.width to the minimum space a row needs on the screen in pixel
-       /// FIXME: move to TextMetrics.
-       void setRowWidth(Buffer const &, int right_margin, int max_width, pit_type pit,
-               Row & row) const;
-
-       /// Calculate and set the height of the row
-       /// FIXME: move to TextMetrics.
-       void setHeightOfRow(BufferView const &, pit_type, Row & row);
+       /// delete double spaces, leading spaces, and empty paragraphs
+       /// from \first to \last paragraph
+       void deleteEmptyParagraphMechanism(pit_type first, pit_type last, bool trackChanges);
 
 public:
        /// the current font settings
@@ -392,7 +382,7 @@ private:
 
        // fix the cursor `cur' after a characters has been deleted at `where'
        // position. Called by deleteEmptyParagraphMechanism
-       void fixCursorAfterDelete(CursorSlice & cur, CursorSlice const & where);
+       static void fixCursorAfterDelete(CursorSlice & cur, CursorSlice const & where);
 
        // At cursor position 0, try to merge the paragraph with the one before it.
        // Ignore change tracking, i.e., physically remove the end-of-par character
@@ -404,14 +394,16 @@ private:
        void deleteWordBackward(LCursor & cur);
        ///
        void deleteLineForward(LCursor & cur);
-
-       /// FIXME
-       int labelEnd(Buffer const &, int max_width, pit_type pit) const;
-
        ///
        void charInserted();
        /// set 'number' font property
        void number(LCursor & cur);
+
+       /// paste plain text at current cursor.
+       /// \param str string to paste
+       /// \param asParagraphs whether to paste as paragraphs or as lines
+       void pasteString(LCursor & cur, docstring const & str,
+                       bool asParagraphs);
 };
 
 } // namespace lyx