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 bool gotoLabel(string const & label);
144 void pasteEnvironment();
146 void copyEnvironment();
151 /// removes all autodeletable insets
152 bool removeAutoInsets();
154 void insertErrors(TeXErrors & terr);
156 void setCursorFromRow(int row);
157 /** Insert an inset into the buffer.
158 Placie it in a layout of lout,
159 if no_table make sure that it doesn't end up in a table.
161 //bool insertInset(Inset * inset, string const & lout = string(),
162 // bool no_table = false);
163 bool insertInset(Inset * inset, string const & lout = string());
164 /** Inserts a lyx file at cursor position.
165 @return #false# if it fails.
167 bool insertLyXFile(string const & file);
169 bool lockInset(UpdatableInset * inset);
171 void showLockedInsetCursor(int x, int y, int asc, int desc);
173 void hideLockedInsetCursor();
175 void fitLockedInsetCursor(int x, int y, int asc, int desc);
177 int unlockInset(UpdatableInset * inset);
179 void lockedInsetStoreUndo(Undo::undo_kind kind);
185 void toggleSelection(bool = true);
198 bool belowMouse() const;
199 /// A callback for the slider in the scrollbar.
200 void scrollCB(double);
206 void pushIntoUpdateList(Inset * i);
208 bool ChangeInsets(Inset::Code code, string const & from,
211 bool ChangeRefsIfUnique(string const & from, string const & to);
213 bool ChangeCitationsIfUnique(string const & from, string const & to);
215 string const getClipboard() const;
217 void pasteClipboard(bool asPara);
219 void stuffClipboard(string const &) const;
221 bool Dispatch(kb_action action, string const & argument);
225 friend struct BufferView::Pimpl;
232 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
233 BufferView::UpdateCodes uc2);