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 buffer(Buffer *);
56 /// Return true if the cursor was fitted.
59 void redoCurrentBuffer();
61 void resizeCurrentBuffer();
65 * Repaint pixmap. Used for when we've made a visible
66 * change but don't need the full update() logic
69 bool newFile(std::string const &, std::string const &, bool);
71 bool loadLyXFile(std::string const &, bool);
73 void workAreaResize();
75 void updateScrollbar();
77 void scrollDocView(int value);
78 /// Wheel mouse scroll, move by multiples of text->defaultRowHeight().
79 void scroll(int lines);
81 typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
83 void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
85 void selectionRequested();
91 bool available() const;
92 /// get the change at the cursor position
93 Change const getCurrentChange();
95 void savePosition(unsigned int i);
97 void restorePosition(unsigned int i);
99 bool isSavedPosition(unsigned int i);
105 bool insertInset(InsetBase * inset, std::string const & lout = std::string());
106 /// a function should be executed from the workarea
107 bool workAreaDispatch(FuncRequest const & ev);
108 /// a function should be executed
109 bool dispatch(FuncRequest const & ev);
114 /// update paragraph dialogs
115 void updateParagraphDialog();
117 /// the y coordinate of the top of the screen
119 /// An error list (replaces the error insets)
120 ErrorList errorlist_;
121 /// add an error to the list
122 void addError(ErrorItem const &);
123 /// buffer errors signal connection
124 boost::signals::connection errorConnection_;
125 /// buffer messages signal connection
126 boost::signals::connection messageConnection_;
127 /// buffer busy status signal connection
128 boost::signals::connection busyConnection_;
129 /// buffer title changed signal connection
130 boost::signals::connection titleConnection_;
131 /// buffer reset timers signal connection
132 boost::signals::connection timerConnection_;
133 /// buffer readonly status changed signal connection
134 boost::signals::connection readonlyConnection_;
135 /// buffer closing signal connection
136 boost::signals::connection closingConnection_;
137 /// connect to signals in the given buffer
138 void connectBuffer(Buffer & buf);
139 /// disconnect from signals in the given buffer
140 void disconnectBuffer();
141 /// track changes for the document
143 /// notify readonly status
144 void showReadonly(bool);
147 * Change all insets with the given code's contents to a new
148 * string. May only be used with InsetCommand-derived insets
149 * Returns true if a screen update is needed.
151 bool ChangeInsets(InsetBase::Code code, std::string const & from,
152 std::string const & to);
155 friend class BufferView;
164 boost::scoped_ptr<LyXScreen> screen_;
166 boost::scoped_ptr<WorkArea> workarea_;
168 Timeout cursor_timeout;
170 void stuffClipboard(std::string const &) const;
172 bool using_xterm_cursor;
176 std::string filename;
177 /// Cursor paragraph Id
180 lyx::pos_type par_pos;
182 Position() : par_id(0), par_pos(0) {}
184 Position(std::string const & f, int id, lyx::pos_type pos)
185 : filename(f), par_id(id), par_pos(pos) {}
188 std::vector<Position> saved_positions;
189 /// Get next inset of this class from current cursor position
190 InsetBase * getInsetByCode(InsetBase::Code code);
192 void MenuInsertLyXFile(std::string const & filen);
194 WorkArea & workarea() const;
195 /// this is used to handle XSelection events in the right manner
204 #endif // BUFFERVIEW_PIMPL_H