]> git.lyx.org Git - lyx.git/blobdiff - src/lyxtext.h
Various fixes to Tabular, InsetTabular and InsetText. Fixed left border for
[lyx.git] / src / lyxtext.h
index 8c9369a6bbc61121c6967d04f15158e4e5b44931..33c0d196dea13cb0df1fe0a9c2c9c533c5d2fa37 100644 (file)
 #include "lyxcursor.h"
 #include "lyxparagraph.h"
 #include "layout.h"
+#include "lyxrow.h"
 
 class Buffer;
 class BufferParams;
-class Row;
 class BufferView;
 class InsetText;
 
@@ -75,13 +75,17 @@ public:
        ///
        UpdatableInset * the_locking_inset;
 
+       ///
+       int GetRealCursorX(BufferView *) const;
        ///
        LyXFont const GetFont(Buffer const *, LyXParagraph * par,
                        LyXParagraph::size_type pos) const;
        ///
        void SetCharFont(Buffer const *, LyXParagraph * par,
-                        LyXParagraph::size_type pos,
-                        LyXFont const & font);
+                        LyXParagraph::size_type pos, LyXFont const & font);
+       void SetCharFont(BufferView *, LyXParagraph * par,
+                        LyXParagraph::size_type pos,
+                        LyXFont const & font, bool toggleall);
        /// returns a pointer to the very first LyXParagraph
        LyXParagraph * FirstParagraph() const;
   
@@ -154,10 +158,6 @@ public:
            Returns true if something was broken. */
         bool FullRebreak(BufferView *);
 
-#ifndef NEW_INSETS
-       ///
-       LyXParagraph::footnote_flag GetFootnoteFlag(int row);
-#endif
        ///
        Row * need_break_row;
        ///
@@ -220,7 +220,7 @@ public:
        ///
        mutable LyXCursor sel_cursor;
        ///
-       LyXCursor sel_start_cursor;
+       mutable LyXCursor sel_start_cursor;
        ///
        mutable LyXCursor sel_end_cursor;
        /// needed for the toggling
@@ -231,9 +231,9 @@ public:
        LyXCursor toggle_end_cursor;
    
        /// need the selection cursor:
-       void SetSelection();
+       void SetSelection(BufferView *);
        ///
-       void ClearSelection() const;
+       void ClearSelection(BufferView *) const;
        ///
        string const selectionAsString(Buffer const *) const;
        
@@ -327,7 +327,8 @@ public:
        };
        /// Change the case of the word at cursor position.
        void ChangeWordCase(BufferView *, TextCase action);
-
+       void TransposeChars(BufferView const &);
+       
        /** returns a printed row in a pixmap. The y value is needed to
          decide, wether it is selected text or not. This is a strange
          solution but faster.
@@ -335,29 +336,6 @@ public:
        void GetVisibleRow(BufferView *, int y_offset, int x_offset,
                           Row * row_ptr, int y, bool cleared=false);
 
-#ifndef NEW_INSETS
-       /* footnotes: */
-       ///
-       void ToggleFootnote(BufferView *);
-       ///
-       void OpenStuff(BufferView *);
-       ///
-       void OpenFootnotes();
-       ///
-       void OpenFootnote(BufferView *);
-       ///
-       void CloseFootnotes();
-       ///
-       void CloseFootnote(BufferView *);
-
-       /** turn the selection into a new environment. If there is no
-         selection, create an empty environment
-        */ 
-       void InsertFootnoteEnvironment(BufferView *,
-                                      LyXParagraph::footnote_kind kind);
-       ///
-       void MeltFootnoteEnvironment(BufferView *);
-#endif
        ///
        void CutSelection(BufferView *, bool = true);
        ///
@@ -391,21 +369,9 @@ public:
                          LyXAlignment align, 
                          string labelwidthstring,
                          bool noindent);
-       ///
-       void SetParagraphExtraOpt(BufferView *, int type,
-                                 string const & width,
-                                 string const & widthp,
-                                 int alignment, bool hfill,
-                                 bool start_minipage);
 
        /* these things are for search and replace */
 
-       /** returns true if the specified string is at the specified
-         position
-         */
-       bool IsStringInText(LyXParagraph * par,
-                           LyXParagraph::size_type pos,
-                           string const & str) const;
        /** sets the selection over the number of characters of string,
          no check!!
          */
@@ -416,12 +382,6 @@ public:
          */
        void ReplaceSelectionWithString(BufferView *, string const & str);
 
-       /** if the string can be found: return true and set the cursor to
-         the new position */
-       bool SearchForward(BufferView *, string const & str) const;
-       ///
-       bool SearchBackward(BufferView *, string const & str) const;
-
        /// needed to insert the selection
        void InsertStringA(BufferView *, string const & str);
        /// needed to insert the selection
@@ -675,4 +635,23 @@ private:
        LyXParagraph * OwnerParagraph(LyXParagraph *) const;
 };
 
+
+/* returns a pointer to the row near the specified y-coordinate
+ * (relative to the whole text). y is set to the real beginning
+ * of this row */
+inline
+Row * LyXText::GetRowNearY(int & y) const
+{
+       // If possible we should optimize this method. (Lgb)
+       Row * tmprow = firstrow;
+       int tmpy = 0;
+       
+       while (tmprow->next() && tmpy + tmprow->height() <= y) {
+               tmpy += tmprow->height();
+               tmprow = tmprow->next();
+       }
+       
+       y = tmpy;   // return the real y
+       return tmprow;
+}
 #endif