]> git.lyx.org Git - features.git/blob - src/insets/Inset.h
Tabular::editXY should not touch the selection
[features.git] / src / insets / Inset.h
1 // -*- C++ -*-
2 /**
3  * \file Inset.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Alejandro Aguilar Sierra
8  * \author Jürgen Vigna
9  * \author Lars Gullik Bjønnes
10  * \author Matthias Ettrich
11  *
12  * Full author contact details are available in file CREDITS.
13  */
14
15 #ifndef INSETBASE_H
16 #define INSETBASE_H
17
18 #include "ColorCode.h"
19 #include "InsetCode.h"
20 #include "InsetLayout.h"
21 #include "LayoutEnums.h"
22 #include "OutputEnums.h"
23
24 #include "support/strfwd.h"
25 #include "support/types.h"
26
27 #include <climits>
28
29
30 namespace lyx {
31
32 class BiblioInfo;
33 class Buffer;
34 class BufferView;
35 class Change;
36 class CompletionList;
37 class Cursor;
38 class CursorSlice;
39 class Dimension;
40 class DocIterator;
41 class FuncRequest;
42 class FuncStatus;
43 class InsetCollapsable;
44 class InsetCommand;
45 class InsetIterator;
46 class InsetLayout;
47 class InsetList;
48 class InsetMath;
49 class InsetTabular;
50 class InsetText;
51 class LaTeXFeatures;
52 class Lexer;
53 class MathAtom;
54 class MetricsInfo;
55 class OutputParams;
56 class PainterInfo;
57 class ParConstIterator;
58 class ParIterator;
59 class Text;
60 class TocBackend;
61 class TocList;
62 class XHTMLStream;
63 class otexstream;
64
65 namespace graphics { class PreviewLoader; }
66
67
68 /// returns the InsetCode corresponding to the \c name.
69 /// Eg, insetCode("branch") == BRANCH_CODE
70 InsetCode insetCode(std::string const & name);
71 /// returns the Inset name corresponding to the \c InsetCode.
72 /// Eg, insetName(BRANCH_CODE) == "branch"
73 std::string insetName(InsetCode);
74 /// returns the Inset name corresponding to the \c InsetCode.
75 /// Eg, insetDisplayName(BRANCH_CODE) == _("Branch")
76 docstring insetDisplayName(InsetCode);
77 ///
78 static int const TOC_ENTRY_LENGTH = 120;
79
80 /// Common base class to all insets
81
82 // Do not add _any_ (non-static) data members as this would inflate
83 // everything storing large quantities of insets. Mathed e.g. would
84 // suffer.
85
86 class Inset {
87 public:
88         ///
89         enum EntryDirection {
90                 ENTRY_DIRECTION_IGNORE,
91                 ENTRY_DIRECTION_RIGHT,
92                 ENTRY_DIRECTION_LEFT
93         };
94         ///
95         typedef ptrdiff_t  difference_type;
96         /// short of anything else reasonable
97         typedef size_t     size_type;
98         /// type for cell indices
99         typedef size_t     idx_type;
100         /// type for cursor positions
101         typedef ptrdiff_t  pos_type;
102         /// type for row numbers
103         typedef size_t     row_type;
104         /// type for column numbers
105         typedef size_t     col_type;
106
107         /// virtual base class destructor
108         virtual ~Inset() {}
109
110         /// change associated Buffer
111         virtual void setBuffer(Buffer & buffer);
112         /// reset associated Buffer to null value
113         virtual void resetBuffer();
114         /// retrieve associated Buffer
115         virtual Buffer & buffer();
116         virtual Buffer const & buffer() const;
117         /// Returns true if buffer_ actually points to a Buffer that has
118         /// been loaded into LyX and is still open. Note that this will
119         /// always return false for cloned Buffers. If you want to allow
120         /// for the case of cloned Buffers, use isBufferValid().
121         bool isBufferLoaded() const;
122         /// Returns true if this is a loaded buffer or a cloned buffer.
123         bool isBufferValid() const;
124
125         /// initialize view for this inset.
126         /**
127           * This is typically used after this inset is created interactively.
128           * Intented purpose is to sanitize internal state with regard to current
129           * Buffer. 
130           **/
131         virtual void initView() {}
132         /// \return true if this inset is labeled.
133         virtual bool isLabeled() const { return false; }
134
135         /// identification as math inset
136         virtual InsetMath * asInsetMath() { return 0; }
137         /// identification as math inset
138         virtual InsetMath const * asInsetMath() const { return 0; }
139         /// true for 'math' math inset, but not for e.g. mbox
140         virtual bool inMathed() const { return false; }
141         /// is this inset based on the InsetText class?
142         virtual InsetText * asInsetText() { return 0; }
143         /// is this inset based on the InsetText class?
144         virtual InsetText const * asInsetText() const { return 0; }
145         /// is this inset based on the InsetCollapsable class?
146         virtual InsetCollapsable * asInsetCollapsable() { return 0; }
147         /// is this inset based on the InsetCollapsable class?
148         virtual InsetCollapsable const * asInsetCollapsable() const { return 0; }
149         /// is this inset based on the InsetTabular class?
150         virtual InsetTabular * asInsetTabular() { return 0; }
151         /// is this inset based on the InsetTabular class?
152         virtual InsetTabular const * asInsetTabular() const { return 0; }
153         /// is this inset based on the InsetCommand class?
154         virtual InsetCommand * asInsetCommand() { return 0; }
155         /// is this inset based on the InsetCommand class?
156         virtual InsetCommand const * asInsetCommand() const { return 0; }
157
158         /// the real dispatcher
159         void dispatch(Cursor & cur, FuncRequest & cmd);
160         /**
161          * \returns true if this function made a definitive decision on
162          * whether the inset wants to handle the request \p cmd or not.
163          * The result of this decision is put into \p status.
164          *
165          * Every request that is enabled in this method needs to be handled
166          * in doDispatch(). Normally we have a 1:1 relationship between the
167          * requests handled in getStatus() and doDispatch(), but there are
168          * some exceptions:
169          * - A request that is disabled in getStatus() does not need to
170          *   appear in doDispatch(). It is guaranteed that doDispatch()
171          *   is never called with this request.
172          * - A few requests are en- or disabled in Inset::getStatus().
173          *   These need to be handled in the doDispatch() methods of the
174          *   derived insets, since Inset::doDispatch() has not enough
175          *   information to handle them.
176          * - LFUN_MOUSE_* need not to be handled in getStatus(), because these
177          *   are dispatched directly
178          */
179         virtual bool getStatus(Cursor & cur, FuncRequest const & cmd,
180                 FuncStatus & status) const;
181
182         /// cursor enters
183         virtual void edit(Cursor & cur, bool front, 
184                 EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
185         /// cursor enters
186         /// Note: this method must preserve the selection status. See:
187         /// https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg199001.html
188         virtual Inset * editXY(Cursor & cur, int x, int y);
189
190         /// compute the size of the object returned in dim
191         virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
192         /// draw inset and update (xo, yo)-cache
193         virtual void draw(PainterInfo & pi, int x, int y) const = 0;
194         /// draw inset selection if necessary
195         virtual void drawSelection(PainterInfo &, int, int) const {}
196         /// draw inset background if the inset has an own background and a
197         /// selection is drawn by drawSelection.
198         virtual void drawBackground(PainterInfo &, int, int) const;
199         ///
200         virtual bool editing(BufferView const * bv) const;
201         ///
202         virtual bool showInsetDialog(BufferView *) const;
203
204         // The possible marker types for insets
205         enum marker_type { NO_MARKER, MARKER2, MARKER };
206         /// draw two angular markers
207         void drawMarkers(PainterInfo & pi, int x, int y) const;
208         /// draw four angular markers
209         void drawMarkers2(PainterInfo & pi, int x, int y) const;
210         /// add space for markers
211         void metricsMarkers(Dimension & dim, int framesize = 1) const;
212         /// add space for markers
213         void metricsMarkers2(Dimension & dim, int framesize = 1) const;
214         /// draw inset decoration if necessary.
215         /// This can use \c drawMarkers() for example.
216         virtual void drawDecoration(PainterInfo &, int, int) const {}
217
218         /// last metrics computed for the inset
219         Dimension const dimension(BufferView const &) const;
220         /// last drawn position for 'important' insets
221         int xo(BufferView const & bv) const;
222         /// last drawn position for 'important' insets
223         int yo(BufferView const & bv) const;
224         /// do we cover screen position x/y?
225         bool covers(BufferView const & bv, int x, int y) const;
226         /// get the screen positions of the cursor (see note in Cursor.cpp)
227         virtual void cursorPos(BufferView const & bv,
228                 CursorSlice const & sl, bool boundary, int & x, int & y) const;
229
230         /// Allow multiple blanks
231         virtual bool isFreeSpacing() const;
232         /// Don't eliminate empty paragraphs
233         virtual bool allowEmpty() const;
234         /// Force inset into LTR environment if surroundings are RTL
235         virtual bool forceLTR() const;
236         /// whether to include this inset in the strings generated for the TOC
237         virtual bool isInToc() const;
238
239         /// Where should we go when we press the up or down cursor key?
240         virtual bool idxUpDown(Cursor & cur, bool up) const;
241         /// Move one cell backwards
242         virtual bool idxBackward(Cursor &) const { return false; }
243         /// Move one cell forward
244         virtual bool idxForward(Cursor &) const { return false; }
245
246         /// Move to the next cell
247         virtual bool idxNext(Cursor &) const { return false; }
248         /// Move to the previous cell
249         virtual bool idxPrev(Cursor &) const { return false; }
250
251         /// Target pos when we enter the inset while moving forward
252         virtual bool idxFirst(Cursor &) const { return false; }
253         /// Target pos when we enter the inset while moving backwards
254         virtual bool idxLast(Cursor &) const { return false; }
255
256         /// Delete a cell and move cursor
257         virtual bool idxDelete(idx_type &) { return false; }
258         /// pulls cell after pressing erase
259         virtual void idxGlue(idx_type) {}
260         /// returns list of cell indices that are "between" from and to for
261         /// selection purposes
262         virtual bool idxBetween(idx_type idx, idx_type from, idx_type to) const;
263
264         /// to which column belongs a cell with a given index?
265         virtual col_type col(idx_type) const { return 0; }
266         /// to which row belongs a cell with a given index?
267         virtual row_type row(idx_type) const { return 0; }
268         /// cell index corresponding to row and column;
269         virtual idx_type index(row_type row, col_type col) const;
270         /// number of embedded cells
271         virtual size_t nargs() const { return 0; }
272         /// number of rows in gridlike structures
273         virtual size_t nrows() const { return 0; }
274         /// number of columns in gridlike structures
275         virtual size_t ncols() const { return 0; }
276         /// Is called when the cursor leaves this inset.
277         /// Returns true if cursor is now invalid, e.g. if former 
278         /// insets in higher cursor slices of \c old do not exist 
279         /// anymore.
280         /// \c old is the old cursor, the last slice points to this.
281         /// \c cur is the new cursor. Use the update flags to cause a redraw.
282         virtual bool notifyCursorLeaves(Cursor const & /*old*/, Cursor & /*cur*/)
283                 { return false; }
284         /// Is called when the cursor enters this inset.
285         /// Returns true if cursor is now invalid, e.g. if former 
286         /// insets in higher cursor slices of \c old do not exist 
287         /// anymore.
288         /// \c cur is the new cursor, some slice points to this. Use the update
289         /// flags to cause a redraw.
290         virtual bool notifyCursorEnters(Cursor & /*cur*/)
291                 { return false; }
292         /// is called when the mouse enters or leaves this inset
293         /// return true if this inset needs a repaint
294         virtual bool setMouseHover(BufferView const *, bool) const
295                 { return false; }
296         /// return true if this inset is hovered (under mouse)
297         /// This is by now only used by mathed to draw corners 
298         /// (Inset::drawMarkers() and Inset::drawMarkers2()).
299         /// Other insets do not have to redefine this function to 
300         /// return the correct status of mouseHovered.
301         virtual bool mouseHovered(BufferView const *) const { return false; }
302
303         /// request "external features"
304         virtual void validate(LaTeXFeatures &) const {}
305
306         /// Validate LFUN_INSET_MODIFY argument.
307         virtual bool validateModifyArgument(docstring const &) const { return true; }
308
309         /// describe content if cursor inside
310         virtual void infoize(odocstream &) const {}
311         /// describe content if cursor behind
312         virtual void infoize2(odocstream &) const {}
313
314         enum { PLAINTEXT_NEWLINE = 10000 };
315
316         /// plain text output in ucs4 encoding
317         /// return the number of characters; in case of multiple lines of
318         /// output, add PLAINTEXT_NEWLINE to the number of chars in the last line
319         virtual int plaintext(odocstringstream &, OutputParams const &,
320                               size_t max_length = INT_MAX) const = 0;
321         /// docbook output
322         virtual int docbook(odocstream & os, OutputParams const &) const;
323         /// XHTML output
324         /// the inset is expected to write XHTML to the XHTMLStream
325         /// \return any "deferred" material that should be written outside the
326         /// normal stream, and which will in fact be written after the current
327         /// paragraph closes. this is appropriate e.g. for floats.
328         virtual docstring xhtml(XHTMLStream & xs, OutputParams const &) const;
329
330         /// Writes a string representation of the inset to the odocstream.
331         /// This one should be called when you want the whole contents of
332         /// the inset.
333         virtual void toString(odocstream &) const {}
334         /// Appends a potentially abbreviated version of the inset to
335         /// \param str. Intended for use by the TOC.
336         virtual void forOutliner(docstring & str,
337                                                          size_t const maxlen = TOC_ENTRY_LENGTH,
338                                                          bool const shorten = true) const;
339
340         /// can the contents of the inset be edited on screen ?
341         // true for InsetCollapsables (not ButtonOnly) (not InsetInfo), InsetText
342         virtual bool editable() const;
343         /// has the Inset settings that can be modified in a dialog ?
344         virtual bool hasSettings() const;
345         /// can we go further down on mouse click?
346         // true for InsetCaption, InsetCollapsables (not ButtonOnly), InsetTabular
347         virtual bool descendable(BufferView const &) const { return false; }
348         /// is this an inset that can be moved into?
349         /// FIXME: merge with editable()
350         // true for InsetTabular & InsetText
351         virtual bool isActive() const { return nargs() > 0; }
352         /// can we click at the specified position ?
353         virtual bool clickable(BufferView const &, int, int) const { return false; }
354         /// Move one cell backwards
355         virtual bool allowsCaptionVariation(std::string const &) const { return false; }
356         // true for insets that have a table structure (InsetMathGrid, InsetTabular)
357         virtual bool isTable() const { return false; }
358
359         /// does this contain text that can be change track marked in DVI?
360         virtual bool canTrackChanges() const { return false; }
361         /// Will this inset paint its own change tracking status (in the parent
362         /// paragraph) or will it let RowPainter handle it?
363         virtual bool canPaintChange(BufferView const &) const { return false; }
364         /// return true if the inset should be removed automatically
365         virtual bool autoDelete() const;
366
367         /// Returns true if the inset supports completions.
368         virtual bool completionSupported(Cursor const &) const { return false; }
369         /// Returns true if the inset supports inline completions at the
370         /// cursor position. In this case the completion might be stored
371         /// in the BufferView's inlineCompletion property.
372         virtual bool inlineCompletionSupported(Cursor const & /*cur*/) const 
373                 { return false; }
374         /// Return true if the inline completion should be automatic.
375         virtual bool automaticInlineCompletion() const { return true; }
376         /// Return true if the popup completion should be automatic.
377         virtual bool automaticPopupCompletion() const { return true; }
378         /// Return true if the cursor should indicate a completion.
379         virtual bool showCompletionCursor() const { return true; }
380         /// Returns completion suggestions at cursor position. Return an
381         /// null pointer if no completion is a available or possible.
382         /// The caller is responsible to free the returned object!
383         virtual CompletionList const * createCompletionList(Cursor const &) const 
384                 { return 0; }
385         /// Returns the completion prefix to filter the suggestions for completion.
386         /// This is only called if completionList returned a non-null list.
387         virtual docstring completionPrefix(Cursor const &) const;
388         /// Do a completion at the cursor position. Return true on success.
389         /// The completion does not contain the prefix. If finished is true, the
390         /// completion is final. If finished is false, completion might only be
391         /// a partial completion.
392         virtual bool insertCompletion(Cursor & /*cur*/, 
393                 docstring const & /*completion*/, bool /*finished*/) 
394                 { return false; }
395         /// Get the completion inset position and size
396         virtual void completionPosAndDim(Cursor const &, int & /*x*/, int & /*y*/, 
397                 Dimension & /*dim*/) const {}
398
399         /// returns true if the inset can hold an inset of given type
400         virtual bool insetAllowed(InsetCode) const { return false; }
401         /// should this inset use the empty layout by default rather than 
402         /// the standard layout? (default: only if that is forced.)
403         virtual bool usePlainLayout() const { return forcePlainLayout(); }
404         /// if this inset has paragraphs should they be forced to use the
405         /// empty layout?
406         virtual bool forcePlainLayout(idx_type = 0) const { return false; }
407         /// if this inset has paragraphs should the user be allowed to
408         /// customize alignment, etc?
409         virtual bool allowParagraphCustomization(idx_type = 0) const
410                 { return true; }
411         /// Is the width forced to some value?
412         virtual bool hasFixedWidth() const { return false; }
413         /// if this inset has paragraphs should they be forced to use a
414         /// local font language switch?
415         virtual bool forceLocalFontSwitch() const { return false; }
416
417         /// Is the content of this inset part of the output document?
418         virtual bool producesOutput() const { return true; }
419         /// Is the content of this inset part of the immediate (visible) text sequence?
420         virtual bool isPartOfTextSequence() const { return producesOutput(); }
421
422         /// \return Tool tip for this inset.
423         /// This default implementation returns an empty string. This can be
424         /// either plain text or Qt html, and formatToolTip will be called
425         /// on it before display in both cases.
426         virtual docstring toolTip(BufferView const & bv, int x, int y) const;
427         
428         /// \return Context menu identifier. This function determines
429         /// whose Inset's menu should be shown for the given position.
430         virtual std::string contextMenu(BufferView const & bv, int x, int y) const;
431
432         /// \return Context menu identifier for this inset.
433         /// This default implementation returns an empty string.
434         virtual std::string contextMenuName() const;
435
436
437         virtual docstring layoutName() const;
438         ///
439         virtual InsetLayout const & getLayout() const;
440         ///
441         virtual bool isPassThru() const { return getLayout().isPassThru(); }
442         /// Is this inset's layout defined in the document's textclass?
443         bool undefined() const;
444         /// should this inset be handled like a normal character?
445         /// (a character can be a letter or punctuation)
446         virtual bool isChar() const { return false; }
447         /// is this equivalent to a letter?
448         /// (a letter is a character that is considered part of a word)
449         virtual bool isLetter() const { return false; }
450         /// is this equivalent to a space (which is BTW different from
451         /// a line separator)?
452         virtual bool isSpace() const { return false; }
453         /// does this inset try to use all available space (like \\hfill does)?
454         virtual bool isHfill() const { return false; }
455
456         enum DisplayType {
457                 Inline = 0,
458                 AlignLeft,
459                 AlignCenter,
460                 AlignRight
461         };
462
463         /// should we have a non-filled line before this inset?
464         virtual DisplayType display() const { return Inline; }
465         ///
466         virtual LyXAlignment contentAlignment() const { return LYX_ALIGN_NONE; }
467         /// should we break lines after this inset?
468         virtual bool isLineSeparator() const { return false; }
469         /// should paragraph indendation be ommitted in any case?
470         virtual bool neverIndent() const { return false; }
471         /// dumps content to lyxerr
472         virtual void dump() const;
473         /// write inset in .lyx format
474         virtual void write(std::ostream &) const {}
475         /// read inset in .lyx format
476         virtual void read(Lexer &) {}
477         /** Export the inset to LaTeX.
478          *  Don't use a temporary stringstream if the final output is
479          *  supposed to go to a file.
480          *  \sa Buffer::writeLaTeXSource for the reason.
481          */
482         virtual void latex(otexstream &, OutputParams const &) const {}
483         /// returns true to override begin and end inset in file
484         virtual bool directWrite() const;
485         ///
486         virtual bool allowSpellCheck() const { return false; }
487
488         /// if this insets owns text cells (e.g. InsetText) return cell num
489         virtual Text * getText(int /*num*/) const { return 0; }
490
491         /** Adds a LaTeX snippet to the Preview Loader for transformation
492          *  into a bitmap image. Does not start the laoding process.
493          *
494          *  Most insets have no interest in this capability, so the method
495          *  defaults to empty.
496          */
497         virtual void addPreview(DocIterator const &,
498                 graphics::PreviewLoader &) const {}
499
500         /** Classifies the unicode characters appearing in a math inset
501          *  depending on whether they are to be translated as latex
502          *  math/text commands or used as math symbols without translation.
503          *
504          *  Only math insets have interest in this classification, so the
505          *  method defaults to empty.
506          */
507         virtual void initUnicodeMath() const {}
508
509         /// Add an entry to the TocList
510         /// Pass a DocIterator that points at the paragraph containing
511         /// the inset
512         ///
513         /// \param output_active : is the inset active or is it in an inactive
514         /// branch or a note?
515         ///
516         /// \param utype : is the toc being generated for use by the output
517         /// routines?
518         ///
519         /// \param tocbackend : where to add the toc information.
520         virtual void addToToc(DocIterator const & /* di */,
521                                                   bool /* output_active */,
522                               UpdateType /* utype*/,
523                               TocBackend & /* tocbackend */) const {}
524         /// Collect BibTeX information
525         virtual void collectBibKeys(InsetIterator const &) const {}
526         /// Update the counters of this inset and of its contents.
527         /// The boolean indicates whether we are preparing for output, e.g.,
528         /// of XHTML.
529         virtual void updateBuffer(ParIterator const &, UpdateType) {}
530
531         /// Updates the inset's dialog
532         virtual Buffer const * updateFrontend() const;
533
534 public:
535         /// returns LyX code associated with the inset. Used for TOC, ...)
536         virtual InsetCode lyxCode() const { return NO_CODE; }
537
538         ///
539         enum mode_type {UNDECIDED_MODE, TEXT_MODE, MATH_MODE};
540         /// return text or mathmode if that is possible to determine
541         virtual mode_type currentMode() const { return UNDECIDED_MODE; }
542         /// returns whether changing mode during latex export is forbidden
543         virtual bool lockedMode() const { return false; }
544         /// returns whether only ascii chars are allowed during latex export
545         virtual bool asciiOnly() const { return false; }
546         /// returns whether this inset is allowed in other insets of given mode
547         virtual bool allowedIn(mode_type) const { return true; }
548         /**
549          * The font is inherited from the parent for LaTeX export if this
550          * method returns true. No open font changes are closed in front of
551          * the inset for LaTeX export, and the font is inherited for all other
552          * exports as well as on screen.
553          * If this method returns false all open font changes are closed in
554          * front of the inset for LaTeX export. The default font is used
555          * inside the inset for all exports and on screen.
556          */
557         virtual bool inheritFont() const { return true; }
558         /**
559          * If this method returns true all explicitly set font attributes
560          * are reset during editing operations.
561          * For copy/paste operations the language is never changed, since
562          * the language of a given text never changes if the text is
563          * formatted differently, while other font attribues like size may
564          * need to change if the text is copied from one environment to
565          * another one.
566          * If this method returns false no font attribute is reset.
567          * The default implementation returns true if the resetFont layout
568          * tag is set and otherwise the negation of inheritFont(),
569          * since inherited inset font attributes do not need to be changed,
570          * and non-inherited ones need to be set explicitly.
571          */
572         virtual bool resetFontEdit() const;
573
574         /// set the change for the entire inset
575         virtual void setChange(Change const &) {}
576         /// accept the changes within the inset
577         virtual void acceptChanges() {}
578         /// reject the changes within the inset
579         virtual void rejectChanges() {}
580
581         ///
582         virtual ColorCode backgroundColor(PainterInfo const &) const;
583         ///
584         virtual ColorCode labelColor() const;
585         //
586         enum { TEXT_TO_INSET_OFFSET = 4 };
587
588         /// Determine the action of backspace and delete: do we select instead of
589         /// deleting if not already selected?
590         virtual bool confirmDeletion() const { return false; }
591
592 protected:
593         /// Constructors
594         Inset(Buffer * buf) : buffer_(buf) {}
595         Inset(Inset const &) : buffer_(0) {}
596
597         /// replicate ourselves
598         friend class InsetList;
599         friend class MathAtom;
600         virtual Inset * clone() const = 0;
601
602         /** The real dispatcher.
603          *  Gets normally called from Cursor::dispatch(). Cursor::dispatch()
604          *  assumes the common case of 'LFUN handled, need update'.
605          *  This has to be overriden by calling Cursor::undispatched() or
606          *  Cursor::noScreenUpdate() if appropriate.
607          *  If you need to call the dispatch method of some inset directly
608          *  you may have to explicitly request an update at that place. Don't
609          *  do it in doDispatch(), since that causes nested updates when
610          *  called from Cursor::dispatch(), and these can lead to crashes.
611          *  \sa getStatus
612          */
613         virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
614
615         Buffer * buffer_;
616 };
617
618 } // namespace lyx
619
620 #endif