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();
173 /// removes all autodeletable insets
174 bool removeAutoInsets();
176 void insertErrors(TeXErrors & terr);
178 void setCursorFromRow(int row);
179 /** Insert an inset into the buffer.
180 Placie it in a layout of lout,
181 if no_table make sure that it doesn't end up in a table.
183 bool insertInset(Inset * inset, string const & lout = string(),
184 bool no_table = false);
185 /// open and lock an updatable inset
186 bool open_new_inset(UpdatableInset * new_inset, bool behind = false);
187 /** Inserts a lyx file at cursor position.
188 @return #false# if it fails.
190 bool insertLyXFile(string const & file);
192 bool lockInset(UpdatableInset * inset);
194 void showLockedInsetCursor(int x, int y, int asc, int desc);
196 void hideLockedInsetCursor();
198 void fitLockedInsetCursor(int x, int y, int asc, int desc);
200 int unlockInset(UpdatableInset * inset);
202 void lockedInsetStoreUndo(Undo::undo_kind kind);
208 void toggleSelection(bool = true);
221 bool belowMouse() const;
222 /// A callback for the slider in the scrollbar.
223 void scrollCB(double);
229 void pushIntoUpdateList(Inset * i);
231 bool ChangeInsets(Inset::Code code, string const & from,
234 bool ChangeRefsIfUnique(string const & from, string const & to);
236 bool ChangeCitationsIfUnique(string const & from, string const & to);
238 string const getClipboard() const;
240 void pasteClipboard(bool asPara);
242 void stuffClipboard(string const &) const;
244 bool Dispatch(kb_action action, string const & argument);
248 friend struct BufferView::Pimpl;
255 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
256 BufferView::UpdateCodes uc2);