4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
17 #include "ColorCode.h"
20 #include "support/types.h"
34 class WordList : public std::set<docstring> {};
37 A text inset is like a TeX box to write full text
38 (including styles and other insets) in a given space.
40 class InsetText : public Inset {
43 explicit InsetText(BufferParams const &);
47 InsetText(InsetText const &);
50 Dimension const dimension(BufferView const &) const;
52 /// empty inset to empty par
55 void read(Buffer const & buf, Lexer & lex);
57 void write(Buffer const & buf, std::ostream & os) const;
59 void metrics(MetricsInfo & mi, Dimension & dim) const;
61 void draw(PainterInfo & pi, int x, int y) const;
63 virtual docstring const editMessage() const;
65 EDITABLE editable() const { return HIGHLY_EDITABLE; }
67 bool canTrackChanges() const { return true; }
69 InsetText * asInsetText() { return this; }
71 InsetText const * asInsetText() const { return this; }
73 int latex(Buffer const &, odocstream &, OutputParams const &) const;
75 int plaintext(Buffer const &, odocstream &, OutputParams const &) const;
77 int docbook(Buffer const &, odocstream &, OutputParams const &) const;
79 void validate(LaTeXFeatures & features) const;
81 /// return x,y of given position relative to the inset's baseline
82 void cursorPos(BufferView const & bv, CursorSlice const & sl,
83 bool boundary, int & x, int & y) const;
85 InsetCode lyxCode() const { return TEXT_CODE; }
87 void setText(docstring const &, Font const &, bool trackChanges);
89 void setAutoBreakRows(bool);
91 bool getAutoBreakRows() const { return text_.autoBreakRows_; }
93 void setDrawFrame(bool);
95 ColorCode frameColor() const;
97 void setFrameColor(ColorCode);
99 bool showInsetDialog(BufferView *) const;
101 Text * getText(int i) const {
102 return (i == 0) ? const_cast<Text*>(&text_) : 0;
105 virtual bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
107 /// set the change for the entire inset
108 void setChange(Change const & change);
109 /// accept the changes within the inset
110 void acceptChanges(BufferParams const & bparams);
111 /// reject the changes within the inset
112 void rejectChanges(BufferParams const & bparams);
114 /// append text onto the existing text
115 void appendParagraphs(Buffer * bp, ParagraphList &);
118 void addPreview(graphics::PreviewLoader &) const;
121 void edit(Cursor & cur, bool front, EntryDirection entry_from);
123 Inset * editXY(Cursor & cur, int x, int y);
125 /// number of cells in this inset
126 size_t nargs() const { return 1; }
128 ParagraphList & paragraphs();
130 ParagraphList const & paragraphs() const;
132 bool insetAllowed(InsetCode) const { return true; }
134 bool allowSpellCheck() const { return true; }
135 /// should paragraph indendation be ommitted in any case?
136 bool neverIndent(Buffer const &) const;
138 virtual bool isMacroScope(Buffer const &) const { return true; }
140 virtual bool allowMultiPar() const { return true; }
142 // Update the counters of this inset and of its contents
143 virtual void updateLabels(Buffer const &, ParIterator const &);
145 virtual Inset * clone() const;
148 bool completionSupported(Cursor const &) const;
150 bool inlineCompletionSupported(Cursor const & cur) const;
152 bool automaticInlineCompletion() const;
154 bool automaticPopupCompletion() const;
156 CompletionList const * createCompletionList(Cursor const & cur) const;
158 docstring completionPrefix(Cursor const & cur) const;
160 bool insertCompletion(Cursor & cur, docstring const & s, bool finished);
162 void completionPosAndDim(Cursor const &, int & x, int & y, Dimension & dim) const;
166 virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
170 void setParagraphOwner();
174 ColorCode frame_color_;
176 mutable pit_type old_pit;
178 docstring previousWord(Buffer const & buffer, CursorSlice const & sl) const;