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