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);
70 void setCursorFromScrollbar();
71 /// Wheel mouse scroll, move by multiples of text->defaultRowHeight().
72 void scroll(int lines);
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);
100 /// Width and height of the BufferView in Pixels
102 This is set externally by the workAreaResize method.
105 /// Height of the BufferView in Pixels
107 This is set externally by the workAreaResize method.
112 ViewMetricsInfo const & viewMetricsInfo();
114 void updateMetrics(bool singlepar = false);
122 ScrollbarParameters scrollbarParameters_;
124 /// track changes for the document
128 ViewMetricsInfo metrics_info_;
131 friend class BufferView;
140 /// Estimated average par height for scrollbar
146 std::string filename;
147 /// Cursor paragraph Id
150 lyx::pos_type par_pos;
152 Position() : par_id(0), par_pos(0) {}
154 Position(std::string const & f, int id, lyx::pos_type pos)
155 : filename(f), par_id(id), par_pos(pos) {}
158 std::vector<Position> saved_positions;
160 void menuInsertLyXFile(std::string const & filen);
162 /// this is used to handle XSelection events in the right manner
171 bool multiparsel_cache_;
173 lyx::pit_type anchor_ref_;
178 #endif // BUFFERVIEW_PIMPL_H