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 "insets/inset.h"
23 #include <boost/utility.hpp>
36 class BufferView : boost::noncopyable {
51 BufferView(LyXView * owner, int , int , int, int);
55 Buffer * buffer() const;
59 LyXScreen * screen() const;
61 void buffer(Buffer * b);
63 void resize(int, int, int, int);
69 void fitCursor(LyXText *);
73 void update(LyXText *, UpdateCodes uc);
75 void updateScrollbar();
77 Inset * checkInsetHit(LyXText *, int & x, int & y,
80 void redoCurrentBuffer();
82 int resizeCurrentBuffer();
84 void cursorPrevious(LyXText *);
86 void cursorNext(LyXText *);
88 bool available() const;
90 LyXView * owner() const;
92 void beforeChange(LyXText *);
94 void savePosition(unsigned int i);
96 void restorePosition(unsigned int i);
98 bool isSavedPosition(unsigned int i);
99 /** This holds the mapping between buffer paragraphs and screen rows.
100 This should be private...but not yet. (Lgb)
104 LyXText * getLyXText() const;
106 LyXText * getParentText(Inset * inset) const;
108 Language const * getParentLanguage(Inset * inset) const;
110 int workWidth() const;
112 UpdatableInset * theLockingInset() const;
114 void theLockingInset(UpdatableInset * inset);
116 void updateInset(Inset * inset, bool mark_dirty);
128 void replaceWord(string const & replacestring);
130 void endOfSpellCheck();
132 void selectLastWord();
134 string const nextWord(float & value);
136 void insertCorrectQuote();
138 bool gotoLabel(string const & label);
146 void pasteEnvironment();
148 void copyEnvironment();
153 /// removes all autodeletable insets
154 bool removeAutoInsets();
156 void insertErrors(TeXErrors & terr);
158 void setCursorFromRow(int row);
159 /** Insert an inset into the buffer.
160 Placie it in a layout of lout,
161 if no_table make sure that it doesn't end up in a table.
163 //bool insertInset(Inset * inset, string const & lout = string(),
164 // bool no_table = false);
165 bool insertInset(Inset * inset, string const & lout = string());
166 /** Inserts a lyx file at cursor position.
167 @return #false# if it fails.
169 bool insertLyXFile(string const & file);
171 bool lockInset(UpdatableInset * inset);
173 void showLockedInsetCursor(int x, int y, int asc, int desc);
175 void hideLockedInsetCursor();
177 void fitLockedInsetCursor(int x, int y, int asc, int desc);
179 int unlockInset(UpdatableInset * inset);
181 void lockedInsetStoreUndo(Undo::undo_kind kind);
187 void toggleSelection(bool = true);
200 bool belowMouse() const;
201 /// A callback for the slider in the scrollbar.
202 void scrollCB(double);
208 void pushIntoUpdateList(Inset * i);
210 bool ChangeInsets(Inset::Code code, string const & from,
213 bool ChangeRefsIfUnique(string const & from, string const & to);
215 bool ChangeCitationsIfUnique(string const & from, string const & to);
217 string const getClipboard() const;
219 void pasteClipboard(bool asPara);
221 void stuffClipboard(string const &) const;
223 bool Dispatch(kb_action action, string const & argument);
227 friend struct BufferView::Pimpl;
234 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
235 BufferView::UpdateCodes uc2);