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