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>
37 class ViewMetricsInfo;
47 class BufferView::Pimpl : public boost::signals::trackable {
50 Pimpl(BufferView & bv, LyXView * owner);
52 void setBuffer(Buffer * buf);
54 void resizeCurrentBuffer();
60 void update(Update::flags flags = Update::Force);
62 void newFile(std::string const &, std::string const &, bool);
64 bool loadLyXFile(std::string const &, bool);
66 void workAreaResize(int width, int height);
68 void updateScrollbar();
70 ScrollbarParameters const & scrollbarParameters() const;
72 void scrollDocView(int value);
73 /// Wheel mouse scroll, move by multiples of text->defaultRowHeight().
74 void scroll(int lines);
76 void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
78 void selectionRequested();
82 bool available() const;
83 /// get the change at the cursor position
84 Change const getCurrentChange();
86 void savePosition(unsigned int i);
88 void restorePosition(unsigned int i);
90 bool isSavedPosition(unsigned int i);
91 /// save bookmarks to .lyx/session
92 void saveSavedPositions();
97 /// a function should be executed from the workarea
98 bool workAreaDispatch(FuncRequest const & ev);
99 /// return true for events that will handle
100 FuncStatus getStatus(FuncRequest const & cmd);
101 /// a function should be executed
102 bool dispatch(FuncRequest const & ev);
105 lyx::frontend::Gui & gui() const;
107 /// Width and height of the BufferView in Pixels
109 This is set externally by the workAreaResize method.
112 /// Height of the BufferView in Pixels
114 This is set externally by the workAreaResize method.
119 ViewMetricsInfo const & viewMetricsInfo();
121 bool needsRedraw() const
123 return needs_redraw_;
125 void needsRedraw(bool redraw_needed)
127 needs_redraw_ = redraw_needed;
135 ScrollbarParameters scrollbarParameters_;
139 /// An error list (replaces the error insets)
140 ErrorList errorlist_;
141 /// add an error to the list
142 void addError(ErrorItem const &);
143 /// buffer errors signal connection
144 boost::signals::connection errorConnection_;
145 /// buffer messages signal connection
146 boost::signals::connection messageConnection_;
147 /// buffer busy status signal connection
148 boost::signals::connection busyConnection_;
149 /// buffer title changed signal connection
150 boost::signals::connection titleConnection_;
151 /// buffer reset timers signal connection
152 boost::signals::connection timerConnection_;
153 /// buffer readonly status changed signal connection
154 boost::signals::connection readonlyConnection_;
155 /// buffer closing signal connection
156 boost::signals::connection closingConnection_;
157 /// connect to signals in the given buffer
158 void connectBuffer(Buffer & buf);
159 /// disconnect from signals in the given buffer
160 void disconnectBuffer();
161 /// track changes for the document
163 /// notify readonly status
164 void showReadonly(bool);
168 friend class BufferView;
171 ViewMetricsInfo metrics_info_;
173 void updateMetrics(bool singlepar = false);
182 /// Estimated average par height for scrollbar
188 std::string filename;
189 /// Cursor paragraph Id
192 lyx::pos_type par_pos;
194 Position() : par_id(0), par_pos(0) {}
196 Position(std::string const & f, int id, lyx::pos_type pos)
197 : filename(f), par_id(id), par_pos(pos) {}
200 std::vector<Position> saved_positions;
202 void menuInsertLyXFile(std::string const & filen);
204 /// this is used to handle XSelection events in the right manner
213 bool multiparsel_cache_;
215 lyx::pit_type anchor_ref_;
219 #endif // BUFFERVIEW_PIMPL_H