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"
24 #include "metricsinfo.h"
26 #include "frontends/LyXKeySym.h"
28 #include "support/types.h"
30 #include <boost/signals/trackable.hpp>
46 class BufferView::Pimpl : public boost::signals::trackable {
49 Pimpl(BufferView & bv, LyXView * owner);
51 void setBuffer(Buffer * buf);
52 /// return the first layout of the Buffer.
53 std::string firstLayout();
55 void resizeCurrentBuffer();
61 bool update(Update::flags flags = Update::Force);
62 /// load a buffer into the view
63 bool loadLyXFile(std::string const &, bool);
65 void workAreaResize(int width, int height);
67 void updateScrollbar();
69 ScrollbarParameters const & scrollbarParameters() const;
71 void scrollDocView(int value);
72 /// Wheel mouse scroll, move by multiples of text->defaultRowHeight().
73 void scroll(int lines);
75 void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
77 void selectionRequested();
81 bool available() const;
82 /// get the change at the cursor position
83 Change const getCurrentChange();
85 void savePosition(unsigned int i);
87 void restorePosition(unsigned int i);
89 bool isSavedPosition(unsigned int i);
90 /// save bookmarks to .lyx/session
91 void saveSavedPositions();
96 /// a function should be executed from the workarea
97 bool workAreaDispatch(FuncRequest const & ev);
98 /// return true for events that will handle
99 FuncStatus getStatus(FuncRequest const & cmd);
100 /// a function should be executed
101 bool dispatch(FuncRequest const & ev);
104 lyx::frontend::Gui & gui() const;
106 /// Width and height of the BufferView in Pixels
108 This is set externally by the workAreaResize method.
111 /// Height of the BufferView in Pixels
113 This is set externally by the workAreaResize method.
118 ViewMetricsInfo const & viewMetricsInfo();
120 void updateMetrics(bool singlepar = false);
128 ScrollbarParameters scrollbarParameters_;
130 /// An error list (replaces the error insets)
131 ErrorList errorlist_;
132 /// add an error to the list
133 void addError(ErrorItem const &);
134 /// buffer errors signal connection
135 boost::signals::connection errorConnection_;
136 /// buffer messages signal connection
137 boost::signals::connection messageConnection_;
138 /// buffer busy status signal connection
139 boost::signals::connection busyConnection_;
140 /// buffer title changed signal connection
141 boost::signals::connection titleConnection_;
142 /// buffer reset timers signal connection
143 boost::signals::connection timerConnection_;
144 /// buffer readonly status changed signal connection
145 boost::signals::connection readonlyConnection_;
146 /// buffer closing signal connection
147 boost::signals::connection closingConnection_;
148 /// connect to signals in the given buffer
149 void connectBuffer(Buffer & buf);
150 /// disconnect from signals in the given buffer
151 void disconnectBuffer();
152 /// track changes for the document
154 /// notify readonly status
155 void showReadonly(bool);
158 ViewMetricsInfo metrics_info_;
161 friend class BufferView;
170 /// Estimated average par height for scrollbar
176 std::string filename;
177 /// Cursor paragraph Id
180 lyx::pos_type par_pos;
182 Position() : par_id(0), par_pos(0) {}
184 Position(std::string const & f, int id, lyx::pos_type pos)
185 : filename(f), par_id(id), par_pos(pos) {}
188 std::vector<Position> saved_positions;
190 void menuInsertLyXFile(std::string const & filen);
192 /// this is used to handle XSelection events in the right manner
201 bool multiparsel_cache_;
203 lyx::pit_type anchor_ref_;
208 #endif // BUFFERVIEW_PIMPL_H