]> git.lyx.org Git - lyx.git/blob - src/BufferView.h
move include files
[lyx.git] / src / BufferView.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  * 
5  *           LyX, The Document Processor
6  *        
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2000 The LyX Team.
9  *
10  * ====================================================== */
11
12 #ifndef BUFFER_VIEW_H
13 #define BUFFER_VIEW_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "LString.h"
20 #include "undo.h"
21 #include "commandtags.h"
22 #include <boost/utility.hpp>
23
24 class LyXView;
25 class LyXText;
26 class TeXErrors;
27 class Buffer;
28 class LyXScreen;
29 class WorkArea;
30 class Language;
31
32 ///
33 class BufferView : public boost::noncopyable {
34 public:
35         ///
36         enum UpdateCodes {
37                 ///
38                 UPDATE = 0,
39                 ///
40                 SELECT = 1,
41                 ///
42                 FITCUR = 2,
43                 ///
44                 CHANGE = 4
45         };
46                                             
47         ///
48         BufferView(LyXView * owner, int , int , int, int);
49         ///
50         ~BufferView();
51         ///
52         Buffer * buffer() const;
53         ///
54         Painter & painter();
55         ///
56         LyXScreen * screen() const;
57         ///
58         WorkArea * workarea() const;
59         ///
60         void buffer(Buffer * b);
61         ///
62         void resize(int, int, int, int);
63         ///
64         void resize();
65         ///
66         void redraw();
67         ///
68         void fitCursor(LyXText *);
69         ///
70         void update();
71         //
72         void update(LyXText *, UpdateCodes uc);
73         ///
74         void updateScrollbar();
75         ///
76         Inset * checkInsetHit(LyXText *, int & x, int & y,
77                               unsigned int button);
78         /// 
79         void redoCurrentBuffer();
80         ///
81         int resizeCurrentBuffer();
82         ///
83         void gotoInset(std::vector<Inset::Code> const & codes,
84                        bool same_content);
85         ///
86         void gotoInset(Inset::Code codes, bool same_content);
87         ///
88         void cursorPrevious(LyXText *);
89         ///
90         void cursorNext(LyXText *);
91         /// 
92         bool available() const;
93         ///
94         LyXView * owner() const;
95         ///
96         void beforeChange(LyXText *);
97         ///
98         void savePosition(unsigned int i);
99         ///
100         void restorePosition(unsigned int i);
101         ///
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)
105         */
106         LyXText * text;
107         ///
108         LyXText * getLyXText() const;
109         ///
110         LyXText * getParentText(Inset * inset) const;
111         ///
112         Language const * getParentLanguage(Inset * inset) const;
113         ///
114         int workWidth() const;
115         ///
116         UpdatableInset * theLockingInset() const;
117         ///
118         void theLockingInset(UpdatableInset * inset); 
119         ///
120         void updateInset(Inset * inset, bool mark_dirty);
121         ///
122         bool inset_slept;
123         ///
124         int slx;
125         ///
126         int sly;
127         ///
128         void insetUnlock();
129         ///
130         void insetSleep();
131         ///
132         void insetWakeup();
133         ///
134         void replaceWord(string const & replacestring);
135         ///
136         void endOfSpellCheck();
137         ///
138         void selectLastWord();
139         ///
140         string const nextWord(float & value);
141         ///
142         void insertCorrectQuote();
143         ///
144         bool gotoLabel(string const & label);
145         ///
146         void paste();
147         ///
148         void cut();
149         ///
150         void copy();
151         ///
152         void pasteEnvironment();
153         ///
154         void copyEnvironment();
155         ///
156         void hfill();
157         ///
158         void protectedBlank(LyXText *);
159         ///
160         void newline();
161         ///
162         void menuSeparator();
163         ///
164         void endOfSentenceDot();
165         ///
166         void ldots();
167         ///
168         void hyphenationPoint();
169         ///
170         void menuUndo();
171         ///
172         void menuRedo();
173 #ifndef NEW_INSETS
174         ///
175         void toggleFloat();
176         ///
177         void openStuff();
178 #endif
179         ///
180         void insertNote();
181 #ifndef NEW_INSETS
182         ///
183         void allFloats(char flag, char figmar);
184 #endif
185         /// removes all autodeletable insets
186         bool removeAutoInsets();
187         ///
188         void insertErrors(TeXErrors & terr);
189         ///
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.
194         */
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.
201         */
202         bool insertLyXFile(string const & file);
203         ///
204         bool lockInset(UpdatableInset * inset);
205         ///
206         void showLockedInsetCursor(int x, int y, int asc, int desc);
207         ///
208         void hideLockedInsetCursor();
209         ///
210         void fitLockedInsetCursor(int x, int y, int asc, int desc);
211         ///
212         int unlockInset(UpdatableInset * inset);
213         ///
214         void lockedInsetStoreUndo(Undo::undo_kind kind);
215         ///
216         void showCursor();
217         ///
218         void hideCursor();
219         ///
220         void toggleSelection(bool = true);
221         ///
222         void toggleToggle();
223         ///
224         void center();
225         
226         ///
227         bool focus() const;
228         ///
229         void focus(bool);
230         ///
231         bool active() const;
232         ///
233         bool belowMouse() const;
234         /// A callback for the slider in the scrollbar.
235         void scrollCB(double);
236
237         ///
238         void setState();
239
240         ///
241         void pushIntoUpdateList(Inset * i);
242         ///
243         bool ChangeInsets(Inset::Code code, string const & from, 
244                           string const & to);
245         ///
246         bool ChangeRefsIfUnique(string const & from, string const & to);
247         ///
248         bool ChangeCitationsIfUnique(string const & from, string const & to);
249         ///
250         void pasteClipboard(bool asPara);
251         ///
252         void stuffClipboard(string const &) const;
253         ///
254         bool Dispatch(kb_action action, string const & argument);
255 private:
256         struct Pimpl;
257         ///
258         friend struct BufferView::Pimpl;
259         ///
260         Pimpl * pimpl_;
261 };
262
263
264 ///
265 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
266                                   BufferView::UpdateCodes uc2);
267
268 #endif