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);
50 void resizeCurrentBuffer();
56 bool update(Update::flags flags = Update::Force);
57 /// load a buffer into the view
58 bool loadLyXFile(std::string const &, bool);
60 void workAreaResize(int width, int height);
62 void updateScrollbar();
64 ScrollbarParameters const & scrollbarParameters() const;
66 void scrollDocView(int value);
68 void setCursorFromScrollbar();
69 /// Wheel mouse scroll, move by multiples of text->defaultRowHeight().
70 void scroll(int lines);
72 void selectionRequested();
76 bool available() const;
77 /// get the change at the cursor position
78 Change const getCurrentChange();
80 void savePosition(unsigned int i);
82 void restorePosition(unsigned int i);
84 bool isSavedPosition(unsigned int i);
85 /// save bookmarks to .lyx/session
86 void saveSavedPositions();
91 /// a function should be executed from the workarea
92 bool workAreaDispatch(FuncRequest const & ev);
93 /// return true for events that will handle
94 FuncStatus getStatus(FuncRequest const & cmd);
95 /// a function should be executed
96 bool dispatch(FuncRequest const & ev);
98 /// Width and height of the BufferView in Pixels
100 This is set externally by the workAreaResize method.
103 /// Height of the BufferView in Pixels
105 This is set externally by the workAreaResize method.
110 ViewMetricsInfo const & viewMetricsInfo();
112 void updateMetrics(bool singlepar = false);
120 ScrollbarParameters scrollbarParameters_;
122 /// track changes for the document
126 ViewMetricsInfo metrics_info_;
129 friend class BufferView;
138 /// Estimated average par height for scrollbar
144 std::string filename;
145 /// Cursor paragraph Id
148 lyx::pos_type par_pos;
150 Position() : par_id(0), par_pos(0) {}
152 Position(std::string const & f, int id, lyx::pos_type pos)
153 : filename(f), par_id(id), par_pos(pos) {}
156 std::vector<Position> saved_positions;
158 void menuInsertLyXFile(std::string const & filen);
160 /// this is used to handle XSelection events in the right manner
169 bool multiparsel_cache_;
171 lyx::pit_type anchor_ref_;
176 #endif // BUFFERVIEW_PIMPL_H