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 "metricsinfo.h"
25 #include "frontends/LyXKeySym.h"
27 #include "support/types.h"
43 class BufferView::Pimpl {
46 Pimpl(BufferView & bv, LyXView * owner);
48 void setBuffer(Buffer * buf);
49 /// return the first layout of the Buffer.
50 std::string firstLayout();
52 void resizeCurrentBuffer();
58 bool update(Update::flags flags = Update::Force);
59 /// load a buffer into the view
60 bool loadLyXFile(std::string const &, bool);
62 void workAreaResize(int width, int height);
64 void updateScrollbar();
66 ScrollbarParameters const & scrollbarParameters() const;
68 void scrollDocView(int value);
69 /// Wheel mouse scroll, move by multiples of text->defaultRowHeight().
70 void scroll(int lines);
72 void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
74 void selectionRequested();
78 bool available() const;
79 /// get the change at the cursor position
80 Change const getCurrentChange();
82 void savePosition(unsigned int i);
84 void restorePosition(unsigned int i);
86 bool isSavedPosition(unsigned int i);
87 /// save bookmarks to .lyx/session
88 void saveSavedPositions();
93 /// a function should be executed from the workarea
94 bool workAreaDispatch(FuncRequest const & ev);
95 /// return true for events that will handle
96 FuncStatus getStatus(FuncRequest const & cmd);
97 /// a function should be executed
98 bool dispatch(FuncRequest const & ev);
101 lyx::frontend::Gui & gui() const;
103 /// Width and height of the BufferView in Pixels
105 This is set externally by the workAreaResize method.
108 /// Height of the BufferView in Pixels
110 This is set externally by the workAreaResize method.
115 ViewMetricsInfo const & viewMetricsInfo();
117 void updateMetrics(bool singlepar = false);
125 ScrollbarParameters scrollbarParameters_;
127 /// track changes for the document
131 ViewMetricsInfo metrics_info_;
134 friend class BufferView;
143 /// Estimated average par height for scrollbar
149 std::string filename;
150 /// Cursor paragraph Id
153 lyx::pos_type par_pos;
155 Position() : par_id(0), par_pos(0) {}
157 Position(std::string const & f, int id, lyx::pos_type pos)
158 : filename(f), par_id(id), par_pos(pos) {}
161 std::vector<Position> saved_positions;
163 void menuInsertLyXFile(std::string const & filen);
165 /// this is used to handle XSelection events in the right manner
174 bool multiparsel_cache_;
176 lyx::pit_type anchor_ref_;
181 #endif // BUFFERVIEW_PIMPL_H