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.
18 #include "support/types.h"
32 A text inset is like a TeX box to write full text
33 (including styles and other insets) in a given space.
35 class InsetText : public Inset {
38 explicit InsetText(BufferParams const &);
43 Dimension const dimension(BufferView const &) const;
45 /// empty inset to empty par
48 void read(Buffer const & buf, Lexer & lex);
50 void write(Buffer const & buf, std::ostream & os) const;
52 void metrics(MetricsInfo & mi, Dimension & dim) const;
54 void draw(PainterInfo & pi, int x, int y) const;
56 virtual docstring const editMessage() const;
58 EDITABLE editable() const { return HIGHLY_EDITABLE; }
60 bool canTrackChanges() const { return true; }
62 InsetText * asTextInset() { return this; }
64 InsetText const * asTextInset() const { return this; }
66 int latex(Buffer const &, odocstream &, OutputParams const &) const;
68 int plaintext(Buffer const &, odocstream &, OutputParams const &) const;
70 int docbook(Buffer const &, odocstream &, OutputParams const &) const;
72 void validate(LaTeXFeatures & features) const;
74 /// return x,y of given position relative to the inset's baseline
75 void cursorPos(BufferView const & bv, CursorSlice const & sl,
76 bool boundary, int & x, int & y) const;
78 InsetCode lyxCode() const { return TEXT_CODE; }
80 void setText(docstring const &, Font const &, bool trackChanges);
82 void setAutoBreakRows(bool);
84 bool getAutoBreakRows() const { return text_.autoBreakRows_; }
86 void setDrawFrame(bool);
88 ColorCode frameColor() const;
90 void setFrameColor(ColorCode);
92 bool showInsetDialog(BufferView *) const;
94 Text * getText(int i) const {
95 return (i == 0) ? const_cast<Text*>(&text_) : 0;
98 virtual bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
100 /// set the change for the entire inset
101 void setChange(Change const & change);
102 /// accept the changes within the inset
103 void acceptChanges(BufferParams const & bparams);
104 /// reject the changes within the inset
105 void rejectChanges(BufferParams const & bparams);
107 /// append text onto the existing text
108 void appendParagraphs(Buffer * bp, ParagraphList &);
111 void addPreview(graphics::PreviewLoader &) const;
114 void edit(Cursor & cur, bool left);
116 Inset * editXY(Cursor & cur, int x, int y);
118 /// number of cells in this inset
119 size_t nargs() const { return 1; }
121 ParagraphList & paragraphs();
123 ParagraphList const & paragraphs() const;
125 bool insetAllowed(InsetCode) const { return true; }
127 bool allowSpellCheck() const { return true; }
128 /// should paragraph indendation be ommitted in any case?
129 bool neverIndent(Buffer const &) const;
131 virtual bool allowMultiPar() const { return true; }
133 InsetText(InsetText const &);
135 // Update the counters of this inset and of its contents
136 virtual void updateLabels(Buffer const &, ParIterator const &);
138 virtual Inset * clone() const;
142 virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
150 /** We store the ColorCode value as an int to get Color.h out
151 * of the header file.
155 mutable pit_type old_pit;