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 * ====================================================== */
19 #include FORMS_H_LOCATION
21 #include "commandtags.h"
22 #include <boost/utility.hpp>
33 class BufferView : public noncopyable {
48 BufferView(LyXView * owner, int , int , int, int);
52 Buffer * buffer() const;
56 LyXScreen * screen() const;
58 WorkArea * workarea() const;
60 void buffer(Buffer * b);
62 void resize(int, int, int, int);
68 void fitCursor(LyXText *);
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 gotoInset(std::vector<Inset::Code> const & codes,
86 void gotoInset(Inset::Code codes, bool same_content);
88 void cursorPrevious(LyXText *);
90 void cursorNext(LyXText *);
92 bool available() const;
94 LyXView * owner() const;
96 void beforeChange(LyXText *);
98 void savePosition(unsigned int i);
100 void restorePosition(unsigned int i);
102 bool isSavedPosition(unsigned int i);
103 /** This holds the mapping between buffer paragraphs and screen rows.
104 This should be private...but not yet. (Lgb)
108 LyXText * getLyXText() const;
110 LyXText * getParentText(Inset * inset) const;
112 Language const * getParentLanguage(Inset * inset) const;
114 int workWidth() const;
116 UpdatableInset * theLockingInset() const;
118 void theLockingInset(UpdatableInset * inset);
120 void updateInset(Inset * inset, bool mark_dirty);
134 void replaceWord(string const & replacestring);
136 void endOfSpellCheck();
138 void selectLastWord();
140 string const nextWord(float & value);
142 void insertCorrectQuote();
144 bool gotoLabel(string const & label);
152 void pasteEnvironment();
154 void copyEnvironment();
158 void protectedBlank(LyXText *);
162 void menuSeparator();
164 void endOfSentenceDot();
168 void hyphenationPoint();
183 void allFloats(char flag, char figmar);
185 /// removes all autodeletable insets
186 bool removeAutoInsets();
188 void insertErrors(TeXErrors & terr);
190 void setCursorFromRow(int row);
191 /** Insert an inset into the buffer.
192 Placie it in a layout of lout,
193 if no_table make sure that it doesn't end up in a table.
195 bool insertInset(Inset * inset, string const & lout = string(),
196 bool no_table = false);
197 /// open and lock an updatable inset
198 bool open_new_inset(UpdatableInset * new_inset, bool behind = false);
199 /** Inserts a lyx file at cursor position.
200 @return #false# if it fails.
202 bool insertLyXFile(string const & file);
204 bool lockInset(UpdatableInset * inset);
206 void showLockedInsetCursor(int x, int y, int asc, int desc);
208 void hideLockedInsetCursor();
210 void fitLockedInsetCursor(int x, int y, int asc, int desc);
212 int unlockInset(UpdatableInset * inset);
214 void lockedInsetStoreUndo(Undo::undo_kind kind);
220 void toggleSelection(bool = true);
233 bool belowMouse() const;
234 /// A callback for the slider in the scrollbar.
235 void scrollCB(double);
241 void pushIntoUpdateList(Inset * i);
243 bool ChangeInsets(Inset::Code code, string const & from,
246 bool ChangeRefsIfUnique(string const & from, string const & to);
248 bool ChangeCitationsIfUnique(string const & from, string const & to);
250 void pasteClipboard(bool asPara);
252 void stuffClipboard(string const &) const;
254 bool Dispatch(kb_action action, string const & argument);
258 friend struct BufferView::Pimpl;
265 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
266 BufferView::UpdateCodes uc2);