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 void 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 bool needsRedraw() const
122 return needs_redraw_;
124 void needsRedraw(bool redraw_needed)
126 needs_redraw_ = redraw_needed;
134 ScrollbarParameters scrollbarParameters_;
138 /// An error list (replaces the error insets)
139 ErrorList errorlist_;
140 /// add an error to the list
141 void addError(ErrorItem const &);
142 /// buffer errors signal connection
143 boost::signals::connection errorConnection_;
144 /// buffer messages signal connection
145 boost::signals::connection messageConnection_;
146 /// buffer busy status signal connection
147 boost::signals::connection busyConnection_;
148 /// buffer title changed signal connection
149 boost::signals::connection titleConnection_;
150 /// buffer reset timers signal connection
151 boost::signals::connection timerConnection_;
152 /// buffer readonly status changed signal connection
153 boost::signals::connection readonlyConnection_;
154 /// buffer closing signal connection
155 boost::signals::connection closingConnection_;
156 /// connect to signals in the given buffer
157 void connectBuffer(Buffer & buf);
158 /// disconnect from signals in the given buffer
159 void disconnectBuffer();
160 /// track changes for the document
162 /// notify readonly status
163 void showReadonly(bool);
166 ViewMetricsInfo metrics_info_;
168 void updateMetrics(bool singlepar = false);
171 friend class BufferView;
180 /// Estimated average par height for scrollbar
186 std::string filename;
187 /// Cursor paragraph Id
190 lyx::pos_type par_pos;
192 Position() : par_id(0), par_pos(0) {}
194 Position(std::string const & f, int id, lyx::pos_type pos)
195 : filename(f), par_id(id), par_pos(pos) {}
198 std::vector<Position> saved_positions;
200 void menuInsertLyXFile(std::string const & filen);
202 /// this is used to handle XSelection events in the right manner
211 bool multiparsel_cache_;
213 lyx::pit_type anchor_ref_;
218 #endif // BUFFERVIEW_PIMPL_H