- /** This is not quite the correct place for this enum. I think
- the correct would be to let each subclass of Inset declare
- its own enum code. Actually the notion of an Inset::Code
- should be avoided, but I am not sure how this could be done
- in a cleaner way. */
- enum Code {
- ///
- NO_CODE, // 0
- ///
- TOC_CODE, // do these insets really need a code? (ale)
- ///
- QUOTE_CODE,
- ///
- MARK_CODE,
- ///
- REF_CODE,
- ///
- URL_CODE, // 5
- ///
- HTMLURL_CODE,
- ///
- SEPARATOR_CODE,
- ///
- ENDING_CODE,
- ///
- LABEL_CODE,
- ///
- NOTE_CODE, // 10
- ///
- ACCENT_CODE,
- ///
- MATH_CODE,
- ///
- INDEX_CODE,
- ///
- INCLUDE_CODE,
- ///
- GRAPHICS_CODE, // 15
- ///
- BIBITEM_CODE,
- ///
- BIBTEX_CODE,
- ///
- TEXT_CODE,
- ///
- ERT_CODE,
- ///
- FOOT_CODE, // 20
- ///
- MARGIN_CODE,
- ///
- FLOAT_CODE,
- ///
- WRAP_CODE,
- ///
- SPACE_CODE, // 25
- ///
- SPECIALCHAR_CODE,
- ///
- TABULAR_CODE,
- ///
- EXTERNAL_CODE,
-#if 0
- ///
- THEOREM_CODE,
-#endif
- ///
- CAPTION_CODE,
- ///
- MATHMACRO_CODE, // 30
- ///
- CITE_CODE,
- ///
- FLOAT_LIST_CODE,
- ///
- INDEX_PRINT_CODE,
- ///
- OPTARG_CODE, // 35
- ///
- ENVIRONMENT_CODE,
- ///
- HFILL_CODE,
- ///
- NEWLINE_CODE,
- ///
- LINE_CODE,
- ///
- BRANCH_CODE, // 40
- ///
- BOX_CODE,
- ///
- CHARSTYLE_CODE,
- ///
- VSPACE_CODE,
- ///
- MATHMACROARG_CODE,
- ///
- NOMENCL_CODE, // 45
- ///
- NOMENCL_PRINT_CODE,
- ///
- PAGEBREAK_CODE,
- ///
- LISTINGS_CODE
- };
-
- /** returns the Code corresponding to the \c name.
- * Eg, translate("branch") == BRANCH_CODE
- */
- static Code translate(std::string const & name);
+ /// Returns true if the inset supports completions.
+ virtual bool completionSupported(Cursor const &) const { return false; }
+ /// Returns true if the inset supports inline completions at the
+ /// cursor position. In this case the completion might be stored
+ /// in the BufferView's inlineCompletion property.
+ virtual bool inlineCompletionSupported(Cursor const & /*cur*/) const
+ { return false; }
+ /// Return true if the inline completion should be automatic.
+ virtual bool automaticInlineCompletion() const { return true; }
+ /// Return true if the popup completion should be automatic.
+ virtual bool automaticPopupCompletion() const { return true; }
+ /// Return true if the cursor should indicate a completion.
+ virtual bool showCompletionCursor() const { return true; }
+ /// Returns completion suggestions at cursor position. Return an
+ /// null pointer if no completion is a available or possible.
+ /// The caller is responsible to free the returned object!
+ virtual CompletionList const * createCompletionList(Cursor const &) const
+ { return 0; }
+ /// Returns the completion prefix to filter the suggestions for completion.
+ /// This is only called if completionList returned a non-null list.
+ virtual docstring completionPrefix(Cursor const &) const;
+ /// Do a completion at the cursor position. Return true on success.
+ /// The completion does not contain the prefix. If finished is true, the
+ /// completion is final. If finished is false, completion might only be
+ /// a partial completion.
+ virtual bool insertCompletion(Cursor & /*cur*/,
+ docstring const & /*completion*/, bool /*finished*/)
+ { return false; }
+ /// Get the completion inset position and size
+ virtual void completionPosAndDim(Cursor const &, int & /*x*/, int & /*y*/,
+ Dimension & /*dim*/) const {}