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 <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 cursorPrevious(LyXText *);
83 void cursorNext(LyXText *);
85 bool available() const;
87 LyXView * owner() const;
89 void beforeChange(LyXText *);
91 void savePosition(unsigned int i);
93 void restorePosition(unsigned int i);
95 bool isSavedPosition(unsigned int i);
96 /** This holds the mapping between buffer paragraphs and screen rows.
97 This should be private...but not yet. (Lgb)
101 LyXText * getLyXText() const;
103 LyXText * getParentText(Inset * inset) const;
105 Language const * getParentLanguage(Inset * inset) const;
107 int workWidth() const;
109 UpdatableInset * theLockingInset() const;
111 void theLockingInset(UpdatableInset * inset);
113 void updateInset(Inset * inset, bool mark_dirty);
125 void replaceWord(string const & replacestring);
127 void endOfSpellCheck();
129 void selectLastWord();
131 string const nextWord(float & value);
133 void insertCorrectQuote();
135 bool gotoLabel(string const & label);
143 void pasteEnvironment();
145 void copyEnvironment();
150 /// removes all autodeletable insets
151 bool removeAutoInsets();
153 void insertErrors(TeXErrors & terr);
155 void setCursorFromRow(int row);
156 /** Insert an inset into the buffer.
157 Placie it in a layout of lout,
158 if no_table make sure that it doesn't end up in a table.
160 //bool insertInset(Inset * inset, string const & lout = string(),
161 // bool no_table = false);
162 bool insertInset(Inset * inset, string const & lout = string());
163 /** Inserts a lyx file at cursor position.
164 @return #false# if it fails.
166 bool insertLyXFile(string const & file);
168 bool lockInset(UpdatableInset * inset);
170 void showLockedInsetCursor(int x, int y, int asc, int desc);
172 void hideLockedInsetCursor();
174 void fitLockedInsetCursor(int x, int y, int asc, int desc);
176 int unlockInset(UpdatableInset * inset);
178 void lockedInsetStoreUndo(Undo::undo_kind kind);
184 void toggleSelection(bool = true);
197 bool belowMouse() const;
198 /// A callback for the slider in the scrollbar.
199 void scrollCB(double);
205 void pushIntoUpdateList(Inset * i);
207 bool ChangeInsets(Inset::Code code, string const & from,
210 bool ChangeRefsIfUnique(string const & from, string const & to);
212 bool ChangeCitationsIfUnique(string const & from, string const & to);
214 string const getClipboard() const;
216 void pasteClipboard(bool asPara);
218 void stuffClipboard(string const &) const;
220 bool Dispatch(kb_action action, string const & argument);
224 friend struct BufferView::Pimpl;
231 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
232 BufferView::UpdateCodes uc2);