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>
35 class BufferView : boost::noncopyable {
50 BufferView(LyXView * owner, int , int , int, int);
54 Buffer * buffer() const;
58 LyXScreen * screen() const;
60 void buffer(Buffer * b);
62 void resize(int, int, int, int);
72 void update(LyXText *, UpdateCodes uc);
74 void updateScrollbar();
76 Inset * checkInsetHit(LyXText *, int & x, int & y);
78 void redoCurrentBuffer();
80 int resizeCurrentBuffer();
82 void cursorPrevious(LyXText *);
84 void cursorNext(LyXText *);
86 bool available() const;
88 LyXView * owner() const;
90 void beforeChange(LyXText *);
92 void savePosition(unsigned int i);
94 void restorePosition(unsigned int i);
96 bool isSavedPosition(unsigned int i);
97 /** This holds the mapping between buffer paragraphs and screen rows.
98 This should be private...but not yet. (Lgb)
102 LyXText * getLyXText() const;
104 LyXText * getParentText(Inset * inset) const;
106 Language const * getParentLanguage(Inset * inset) const;
108 int workWidth() const;
110 UpdatableInset * theLockingInset() const;
112 void theLockingInset(UpdatableInset * inset);
114 void updateInset(Inset * inset, bool mark_dirty);
126 void replaceWord(string const & replacestring);
128 void endOfSpellCheck();
130 void selectLastWord();
132 string const nextWord(float & value);
134 bool gotoLabel(string const & label);
138 void cut(bool realcut = true);
142 void pasteEnvironment();
144 void copyEnvironment();
149 /// removes all autodeletable insets
150 bool removeAutoInsets();
152 void insertErrors(TeXErrors & terr);
154 void setCursorFromRow(int row);
155 /** Insert an inset into the buffer.
156 Placie it in a layout of lout,
157 if no_table make sure that it doesn't end up in a table.
159 //bool insertInset(Inset * inset, string const & lout = string(),
160 // bool no_table = false);
161 bool insertInset(Inset * inset, string const & lout = string());
162 /** Inserts a lyx file at cursor position.
163 @return #false# if it fails.
165 bool insertLyXFile(string const & file);
167 bool lockInset(UpdatableInset * inset);
169 void showLockedInsetCursor(int x, int y, int asc, int desc);
171 void hideLockedInsetCursor();
173 void fitLockedInsetCursor(int x, int y, int asc, int desc);
175 int unlockInset(UpdatableInset * inset);
177 void lockedInsetStoreUndo(Undo::undo_kind kind);
183 void toggleSelection(bool = true);
196 bool belowMouse() const;
197 /// A callback for the slider in the scrollbar.
198 void scrollCB(double);
204 void pushIntoUpdateList(Inset * i);
206 bool ChangeInsets(Inset::Code code, string const & from,
209 bool ChangeRefsIfUnique(string const & from, string const & to);
211 bool ChangeCitationsIfUnique(string const & from, string const & to);
213 string const getClipboard() const;
215 void pasteClipboard(bool asPara);
217 void stuffClipboard(string const &) const;
219 bool Dispatch(kb_action action, string const & argument);
223 friend struct BufferView::Pimpl;
230 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
231 BufferView::UpdateCodes uc2);