4 * Copyright 2002 the LyX Team
5 * Read the file COPYING
7 * \author Lars Gullik Bjønnes
19 #include "commandtags.h"
21 #include "insets/inset.h"
22 #include "WordLangTuple.h"
24 #include <boost/utility.hpp>
36 class BufferView : boost::noncopyable {
51 BufferView(LyXView * owner, int , int , int, int);
55 Buffer * buffer() const;
57 Painter & painter() const;
59 LyXScreen & screen() const;
61 void buffer(Buffer * b);
65 * Repaint the pixmap. Used for when we don't want
66 * to go through the full update() logic, just a simple
67 * repaint of the whole screen.
75 void update(LyXText *, UpdateCodes uc);
77 void updateScrollbar();
79 Inset * checkInsetHit(LyXText *, int & x, int & y);
81 void redoCurrentBuffer();
83 void cursorPrevious(LyXText *);
85 void cursorNext(LyXText *);
87 bool available() const;
89 LyXView * owner() const;
91 void beforeChange(LyXText *);
93 void savePosition(unsigned int i);
95 void restorePosition(unsigned int i);
97 bool isSavedPosition(unsigned int i);
98 /** This holds the mapping between buffer paragraphs and screen rows.
99 This should be private...but not yet. (Lgb)
103 LyXText * getLyXText() const;
105 LyXText * getParentText(Inset * inset) const;
107 Language const * getParentLanguage(Inset * inset) const;
109 int workWidth() const;
111 UpdatableInset * theLockingInset() const;
113 void theLockingInset(UpdatableInset * inset);
115 void updateInset(Inset * inset, bool mark_dirty);
123 void replaceWord(string const & replacestring);
125 void endOfSpellCheck();
127 void selectLastWord();
128 /// return the next word
129 WordLangTuple const nextWord(float & value);
131 bool gotoLabel(string const & label);
135 void cut(bool realcut = true);
139 void pasteEnvironment();
141 void copyEnvironment();
146 /// removes all autodeletable insets
147 bool removeAutoInsets();
149 void insertErrors(TeXErrors & terr);
151 void setCursorFromRow(int row);
152 /** Insert an inset into the buffer.
153 Placie it in a layout of lout,
154 if no_table make sure that it doesn't end up in a table.
156 //bool insertInset(Inset * inset, string const & lout = string(),
157 // bool no_table = false);
158 bool insertInset(Inset * inset, string const & lout = string());
159 /** Inserts a lyx file at cursor position.
160 \return #false# if it fails.
162 bool insertLyXFile(string const & file);
164 bool lockInset(UpdatableInset * inset);
166 void showLockedInsetCursor(int x, int y, int asc, int desc);
168 void hideLockedInsetCursor();
170 bool fitLockedInsetCursor(int x, int y, int asc, int desc);
172 int unlockInset(UpdatableInset * inset);
174 void lockedInsetStoreUndo(Undo::undo_kind kind);
180 void toggleSelection(bool = true);
186 /// Scroll the view by a number of pixels
187 void scrollDocView(int);
193 bool ChangeInsets(Inset::Code code, string const & from,
196 bool ChangeRefsIfUnique(string const & from, string const & to);
198 bool ChangeCitationsIfUnique(string const & from, string const & to);
200 string const getClipboard() const;
202 void pasteClipboard(bool asPara);
204 void stuffClipboard(string const &) const;
206 bool dispatch(kb_action action, string const & argument);
211 friend struct BufferView::Pimpl;
218 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
219 BufferView::UpdateCodes uc2);