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,
79 void redoCurrentBuffer();
81 int resizeCurrentBuffer();
83 void cursorPrevious(LyXText *);
85 void cursorNext(LyXText *);
87 bool available() const;
89 LyXView * owner() const;
91 void beforeChange(LyXText *);
93 void savePosition(unsigned int i);
95 void restorePosition(unsigned int i);
97 bool isSavedPosition(unsigned int i);
98 /** This holds the mapping between buffer paragraphs and screen rows.
99 This should be private...but not yet. (Lgb)
103 LyXText * getLyXText() const;
105 LyXText * getParentText(Inset * inset) const;
107 Language const * getParentLanguage(Inset * inset) const;
109 int workWidth() const;
111 UpdatableInset * theLockingInset() const;
113 void theLockingInset(UpdatableInset * inset);
115 void updateInset(Inset * inset, bool mark_dirty);
127 void replaceWord(string const & replacestring);
129 void endOfSpellCheck();
131 void selectLastWord();
133 string const nextWord(float & value);
135 bool gotoLabel(string const & label);
139 void cut(bool realcut = true);
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);