2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1995 Matthias Ettrich
8 * Copyright 1995-2001 The LyX Team.
10 * ====================================================== */
21 #include "commandtags.h"
22 #include <boost/utility.hpp>
33 class BufferView : boost::noncopyable {
48 BufferView(LyXView * owner, int , int , int, int);
52 Buffer * buffer() const;
56 LyXScreen * screen() const;
58 void buffer(Buffer * b);
60 void resize(int, int, int, int);
66 void fitCursor(LyXText *);
70 void update(LyXText *, UpdateCodes uc);
72 void updateScrollbar();
74 Inset * checkInsetHit(LyXText *, int & x, int & y,
77 void redoCurrentBuffer();
79 int resizeCurrentBuffer();
81 void gotoInset(std::vector<Inset::Code> const & codes,
84 void gotoInset(Inset::Code codes, bool same_content);
86 void cursorPrevious(LyXText *);
88 void cursorNext(LyXText *);
90 bool available() const;
92 LyXView * owner() const;
94 void beforeChange(LyXText *);
96 void savePosition(unsigned int i);
98 void restorePosition(unsigned int i);
100 bool isSavedPosition(unsigned int i);
101 /** This holds the mapping between buffer paragraphs and screen rows.
102 This should be private...but not yet. (Lgb)
106 LyXText * getLyXText() const;
108 LyXText * getParentText(Inset * inset) const;
110 Language const * getParentLanguage(Inset * inset) const;
112 int workWidth() const;
114 UpdatableInset * theLockingInset() const;
116 void theLockingInset(UpdatableInset * inset);
118 void updateInset(Inset * inset, bool mark_dirty);
132 void replaceWord(string const & replacestring);
134 void endOfSpellCheck();
136 void selectLastWord();
138 string const nextWord(float & value);
140 void insertCorrectQuote();
142 bool gotoLabel(string const & label);
150 void pasteEnvironment();
152 void copyEnvironment();
157 /// removes all autodeletable insets
158 bool removeAutoInsets();
160 void insertErrors(TeXErrors & terr);
162 void setCursorFromRow(int row);
163 /** Insert an inset into the buffer.
164 Placie it in a layout of lout,
165 if no_table make sure that it doesn't end up in a table.
167 bool insertInset(Inset * inset, string const & lout = string(),
168 bool no_table = false);
169 /** Inserts a lyx file at cursor position.
170 @return #false# if it fails.
172 bool insertLyXFile(string const & file);
174 bool lockInset(UpdatableInset * inset);
176 void showLockedInsetCursor(int x, int y, int asc, int desc);
178 void hideLockedInsetCursor();
180 void fitLockedInsetCursor(int x, int y, int asc, int desc);
182 int unlockInset(UpdatableInset * inset);
184 void lockedInsetStoreUndo(Undo::undo_kind kind);
190 void toggleSelection(bool = true);
203 bool belowMouse() const;
204 /// A callback for the slider in the scrollbar.
205 void scrollCB(double);
211 void pushIntoUpdateList(Inset * i);
213 bool ChangeInsets(Inset::Code code, string const & from,
216 bool ChangeRefsIfUnique(string const & from, string const & to);
218 bool ChangeCitationsIfUnique(string const & from, string const & to);
220 string const getClipboard() const;
222 void pasteClipboard(bool asPara);
224 void stuffClipboard(string const &) const;
226 bool Dispatch(kb_action action, string const & argument);
230 friend struct BufferView::Pimpl;
237 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
238 BufferView::UpdateCodes uc2);