2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1995 Matthias Ettrich
8 * Copyright 1995-2000 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();
156 void protectedBlank(LyXText *);
160 void menuSeparator();
162 void endOfSentenceDot();
166 void hyphenationPoint();
171 /// removes all autodeletable insets
172 bool removeAutoInsets();
174 void insertErrors(TeXErrors & terr);
176 void setCursorFromRow(int row);
177 /** Insert an inset into the buffer.
178 Placie it in a layout of lout,
179 if no_table make sure that it doesn't end up in a table.
181 bool insertInset(Inset * inset, string const & lout = string(),
182 bool no_table = false);
183 /** Inserts a lyx file at cursor position.
184 @return #false# if it fails.
186 bool insertLyXFile(string const & file);
188 bool lockInset(UpdatableInset * inset);
190 void showLockedInsetCursor(int x, int y, int asc, int desc);
192 void hideLockedInsetCursor();
194 void fitLockedInsetCursor(int x, int y, int asc, int desc);
196 int unlockInset(UpdatableInset * inset);
198 void lockedInsetStoreUndo(Undo::undo_kind kind);
204 void toggleSelection(bool = true);
217 bool belowMouse() const;
218 /// A callback for the slider in the scrollbar.
219 void scrollCB(double);
225 void pushIntoUpdateList(Inset * i);
227 bool ChangeInsets(Inset::Code code, string const & from,
230 bool ChangeRefsIfUnique(string const & from, string const & to);
232 bool ChangeCitationsIfUnique(string const & from, string const & to);
234 string const getClipboard() const;
236 void pasteClipboard(bool asPara);
238 void stuffClipboard(string const &) const;
240 bool Dispatch(kb_action action, string const & argument);
244 friend struct BufferView::Pimpl;
251 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
252 BufferView::UpdateCodes uc2);