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"
25 #include "insets/inset.h"
27 #include "frontends/key_state.h"
28 #include "frontends/Timeout.h"
30 #include "support/types.h"
32 #include <boost/scoped_ptr.hpp>
33 #include <boost/shared_ptr.hpp>
34 #include <boost/signals/trackable.hpp>
46 struct BufferView::Pimpl : public boost::signals::trackable {
48 Pimpl(BufferView & bv, LyXView * owner,
49 int xpos, int ypos, int width, int height);
51 Painter & painter() const;
52 /// return the screen for this bview
53 LyXScreen & screen() const;
55 void setBuffer(Buffer * buf);
56 /// Return true if the cursor was fitted.
59 void redoCurrentBuffer();
61 void resizeCurrentBuffer();
65 void newFile(std::string const &, std::string const &, bool);
67 bool loadLyXFile(std::string const &, bool);
69 void workAreaResize();
71 void updateScrollbar();
73 void scrollDocView(int value);
74 /// Wheel mouse scroll, move by multiples of text->defaultRowHeight().
75 void scroll(int lines);
77 typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
79 void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
81 void selectionRequested();
87 bool available() const;
88 /// get the change at the cursor position
89 Change const getCurrentChange();
91 void savePosition(unsigned int i);
93 void restorePosition(unsigned int i);
95 bool isSavedPosition(unsigned int i);
100 /// a function should be executed from the workarea
101 bool workAreaDispatch(FuncRequest const & ev);
102 /// a function should be executed
103 bool dispatch(FuncRequest const & ev);
109 /// the y coordinate of the top of the screen
111 /// An error list (replaces the error insets)
112 ErrorList errorlist_;
113 /// add an error to the list
114 void addError(ErrorItem const &);
115 /// buffer errors signal connection
116 boost::signals::connection errorConnection_;
117 /// buffer messages signal connection
118 boost::signals::connection messageConnection_;
119 /// buffer busy status signal connection
120 boost::signals::connection busyConnection_;
121 /// buffer title changed signal connection
122 boost::signals::connection titleConnection_;
123 /// buffer reset timers signal connection
124 boost::signals::connection timerConnection_;
125 /// buffer readonly status changed signal connection
126 boost::signals::connection readonlyConnection_;
127 /// buffer closing signal connection
128 boost::signals::connection closingConnection_;
129 /// connect to signals in the given buffer
130 void connectBuffer(Buffer & buf);
131 /// disconnect from signals in the given buffer
132 void disconnectBuffer();
133 /// track changes for the document
135 /// notify readonly status
136 void showReadonly(bool);
140 friend class BufferView;
149 boost::scoped_ptr<LyXScreen> screen_;
151 boost::scoped_ptr<WorkArea> workarea_;
153 Timeout cursor_timeout;
155 void stuffClipboard(std::string const &) const;
157 bool using_xterm_cursor;
161 std::string filename;
162 /// Cursor paragraph Id
165 lyx::pos_type par_pos;
167 Position() : par_id(0), par_pos(0) {}
169 Position(std::string const & f, int id, lyx::pos_type pos)
170 : filename(f), par_id(id), par_pos(pos) {}
173 std::vector<Position> saved_positions;
174 /// Get next inset of this class from current cursor position
175 InsetBase * getInsetByCode(InsetBase::Code code);
177 void MenuInsertLyXFile(std::string const & filen);
179 WorkArea & workarea() const;
180 /// this is used to handle XSelection events in the right manner
189 #endif // BUFFERVIEW_PIMPL_H