3 * \file BufferView_pimpl.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Asger Alstrup
8 * \author Alfredo Braustein
9 * \author Lars Gullik Bjønnes
11 * \author André Pönitz
13 * \author Jürgen Vigna
15 * Full author contact details are available in file CREDITS.
18 #ifndef BUFFERVIEW_PIMPL_H
19 #define BUFFERVIEW_PIMPL_H
21 #include "BufferView.h"
23 #include "errorlist.h"
25 #include "insets/inset.h"
27 #include "frontends/key_state.h"
28 #include "frontends/Timeout.h"
30 #include "support/types.h"
32 #include <boost/scoped_ptr.hpp>
33 #include <boost/shared_ptr.hpp>
34 #include <boost/signals/trackable.hpp>
44 class ViewMetricsInfo;
48 class BufferView::Pimpl : public boost::signals::trackable {
51 Pimpl(BufferView & bv, LyXView * owner, int width, int height);
53 Painter & painter() const;
54 /// return the screen for this bview
55 LyXScreen & screen() const;
57 void setBuffer(Buffer * buf);
59 void resizeCurrentBuffer();
65 void update(Update::flags flags = Update::Force);
67 void newFile(std::string const &, std::string const &, bool);
69 bool loadLyXFile(std::string const &, bool);
71 void workAreaResize();
73 void updateScrollbar();
75 void scrollDocView(int value);
76 /// Wheel mouse scroll, move by multiples of text->defaultRowHeight().
77 void scroll(int lines);
79 typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
81 void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
83 void selectionRequested();
89 bool available() const;
90 /// get the change at the cursor position
91 Change const getCurrentChange();
93 void savePosition(unsigned int i);
95 void restorePosition(unsigned int i);
97 bool isSavedPosition(unsigned int i);
98 /// save bookmarks to .lyx/session
99 void saveSavedPositions();
104 /// a function should be executed from the workarea
105 bool workAreaDispatch(FuncRequest const & ev);
106 /// return true for events that will handle
107 FuncStatus getStatus(FuncRequest const & cmd);
108 /// a function should be executed
109 bool dispatch(FuncRequest const & ev);
110 /// Flag: do a full redraw of inside text of inset
111 bool repaintAll() { return refresh_inside_; }
113 void repaintAll(bool r) {refresh_inside_ = r; }
115 /// An error list (replaces the error insets)
116 ErrorList errorlist_;
117 /// add an error to the list
118 void addError(ErrorItem const &);
119 /// buffer errors signal connection
120 boost::signals::connection errorConnection_;
121 /// buffer messages signal connection
122 boost::signals::connection messageConnection_;
123 /// buffer busy status signal connection
124 boost::signals::connection busyConnection_;
125 /// buffer title changed signal connection
126 boost::signals::connection titleConnection_;
127 /// buffer reset timers signal connection
128 boost::signals::connection timerConnection_;
129 /// buffer readonly status changed signal connection
130 boost::signals::connection readonlyConnection_;
131 /// buffer closing signal connection
132 boost::signals::connection closingConnection_;
133 /// connect to signals in the given buffer
134 void connectBuffer(Buffer & buf);
135 /// disconnect from signals in the given buffer
136 void disconnectBuffer();
137 /// track changes for the document
139 /// notify readonly status
140 void showReadonly(bool);
144 friend class BufferView;
153 boost::scoped_ptr<LyXScreen> screen_;
155 boost::scoped_ptr<WorkArea> workarea_;
156 /// Estimated average par height for scrollbar
159 Timeout cursor_timeout;
161 void stuffClipboard(std::string const &) const;
163 bool using_xterm_cursor;
168 std::string filename;
169 /// Cursor paragraph Id
172 lyx::pos_type par_pos;
174 Position() : par_id(0), par_pos(0) {}
176 Position(std::string const & f, int id, lyx::pos_type pos)
177 : filename(f), par_id(id), par_pos(pos) {}
180 std::vector<Position> saved_positions;
182 void menuInsertLyXFile(std::string const & filen);
184 WorkArea & workarea() const;
185 /// this is used to handle XSelection events in the right manner
194 bool multiparsel_cache_;
196 lyx::pit_type anchor_ref_;
200 ViewMetricsInfo metrics(bool singlepar = false);
201 /// Working variable indicating a full screen refresh
202 mutable bool refresh_inside_;
205 #endif // BUFFERVIEW_PIMPL_H