]> git.lyx.org Git - lyx.git/blob - src/BufferView.h
partial framebox support
[lyx.git] / src / BufferView.h
1 // -*- C++ -*-
2 /**
3  * \file BufferView.h
4  * Copyright 2002 the LyX Team
5  * Read the file COPYING
6  *
7  *  \author Lars Gullik Bjønnes
8 */
9
10 #ifndef BUFFER_VIEW_H
11 #define BUFFER_VIEW_H
12
13 #ifdef __GNUG__
14 #pragma interface
15 #endif
16
17 #include "LString.h"
18 #include "undo.h"
19
20 #include "insets/inset.h"
21
22 #include <boost/utility.hpp>
23
24 class LyXView;
25 class LyXText;
26 class TeXErrors;
27 class Buffer;
28 class LyXScreen;
29 class Language;
30 class Painter;
31 class UpdatableInset;
32 class WordLangTuple;
33 class WorkArea;
34
35 ///
36 class BufferView : boost::noncopyable {
37 public:
38         ///
39         enum UpdateCodes {
40                 ///
41                 UPDATE = 0,
42                 ///
43                 SELECT = 1,
44                 ///
45                 FITCUR = 2,
46                 ///
47                 CHANGE = 4
48         };
49
50         ///
51         BufferView(LyXView * owner, int , int , int, int);
52         ///
53         ~BufferView();
54         ///
55         Buffer * buffer() const;
56         ///
57         Painter & painter() const;
58         ///
59         LyXScreen & screen() const;
60         /// return the work area for this bview
61         WorkArea & workarea() const;
62         ///
63         void buffer(Buffer * b);
64         ///
65         void resize();
66         /**
67          * Repaint the pixmap. Used for when we don't want
68          * to go through the full update() logic, just a simple
69          * repaint of the whole screen.
70          */
71         void repaint();
72         ///
73         bool fitCursor();
74         ///
75         void update();
76         //
77         void update(LyXText *, UpdateCodes uc);
78         ///
79         void updateScrollbar();
80         ///
81         void redoCurrentBuffer();
82         ///
83         bool available() const;
84         ///
85         LyXView * owner() const;
86         ///
87         void beforeChange(LyXText *);
88         ///
89         void savePosition(unsigned int i);
90         ///
91         void restorePosition(unsigned int i);
92         ///
93         bool isSavedPosition(unsigned int i);
94         /** This holds the mapping between buffer paragraphs and screen rows.
95             This should be private...but not yet. (Lgb)
96         */
97         LyXText * text;
98         ///
99         LyXText * getLyXText() const;
100         ///
101         LyXText * getParentText(Inset * inset) const;
102         ///
103         Language const * getParentLanguage(Inset * inset) const;
104         ///
105         int workWidth() const;
106         ///
107         UpdatableInset * theLockingInset() const;
108         ///
109         void theLockingInset(UpdatableInset * inset);
110         ///
111         void updateInset(Inset * inset, bool mark_dirty);
112         ///
113         int slx;
114         ///
115         int sly;
116         ///
117         void insetUnlock();
118         ///
119         void replaceWord(string const & replacestring);
120         ///
121         void endOfSpellCheck();
122         ///
123         void selectLastWord();
124         /// return the next word
125         WordLangTuple const nextWord(float & value);
126         ///
127         bool gotoLabel(string const & label);
128         ///
129         void pasteEnvironment();
130         ///
131         void copyEnvironment();
132         ///
133         void menuUndo();
134         ///
135         void menuRedo();
136         /// removes all autodeletable insets
137         bool removeAutoInsets();
138         ///
139         void insertErrors(TeXErrors & terr);
140         ///
141         void setCursorFromRow(int row);
142         /** Insert an inset into the buffer.
143             Place it in a layout of lout,
144             if no_table make sure that it doesn't end up in a table.
145         */
146         bool insertInset(Inset * inset, string const & lout = string());
147         /// Inserts a lyx file at cursor position. return #false# if it fails
148         bool insertLyXFile(string const & file);
149         ///
150         bool lockInset(UpdatableInset * inset);
151         ///
152         void showLockedInsetCursor(int x, int y, int asc, int desc);
153         ///
154         void hideLockedInsetCursor();
155         ///
156         bool fitLockedInsetCursor(int x, int y, int asc, int desc);
157         ///
158         int unlockInset(UpdatableInset * inset);
159         ///
160         void lockedInsetStoreUndo(Undo::undo_kind kind);
161         ///
162         void showCursor();
163         ///
164         void hideCursor();
165         ///
166         void toggleSelection(bool = true);
167         ///
168         void toggleToggle();
169         ///
170         void center();
171         ///
172         int scroll(long time);
173
174         /// Scroll the view by a number of pixels
175         void scrollDocView(int);
176
177         ///
178         void switchKeyMap();
179
180         ///
181         bool ChangeInsets(Inset::Code code, string const & from,
182                           string const & to);
183         ///
184         bool ChangeRefsIfUnique(string const & from, string const & to);
185         ///
186         bool ChangeCitationsIfUnique(string const & from, string const & to);
187         ///
188         string const getClipboard() const;
189         ///
190         void stuffClipboard(string const &) const;
191         ///
192         bool dispatch(FuncRequest const & argument);
193
194 private:
195         ///
196         struct Pimpl;
197         ///
198         friend struct BufferView::Pimpl;
199         ///
200         Pimpl * pimpl_;
201 };
202
203
204 ///
205 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
206                                   BufferView::UpdateCodes uc2);
207
208 #endif