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.
16 #include "RowList_fwd.h"
19 #include "ParagraphList_fwd.h"
21 #include "support/types.h"
23 #include "frontends/mouse_state.h"
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 InsetOld {
43 explicit InsetText(BufferParams const &);
46 /// empty inset to empty par
49 void read(Buffer const & buf, LyXLex & lex);
51 void write(Buffer const & buf, std::ostream & os) const;
53 void metrics(MetricsInfo & mi, Dimension & dim) const;
55 void draw(PainterInfo & pi, int x, int y) const;
56 /// draw inset selection
57 void drawSelection(PainterInfo & pi, int x, int y) const;
58 /// are we inside the area covered by the inset?
59 virtual bool covers(BufferView & bv, int x, int y) const;
61 virtual docstring const editMessage() const;
63 EDITABLE editable() const { return HIGHLY_EDITABLE; }
65 bool canTrackChanges() const { return true; }
67 InsetText const * asTextInset() const { return this; }
69 int latex(Buffer const &, odocstream &, OutputParams const &) const;
71 int plaintext(Buffer const &, odocstream &, OutputParams const &) const;
73 int docbook(Buffer const &, odocstream &, OutputParams const &) const;
75 void validate(LaTeXFeatures & features) const;
77 /// return x,y of given position relative to the inset's baseline
78 void cursorPos(BufferView const & bv, CursorSlice const & sl,
79 bool boundary, int & x, int & y) const;
81 Code lyxCode() const { return TEXT_CODE; }
83 void setText(docstring const &, LyXFont const &, bool trackChanges);
85 void setAutoBreakRows(bool);
87 bool getAutoBreakRows() const { return text_.autoBreakRows_; }
89 void setDrawFrame(bool);
91 LColor_color frameColor() const;
93 void setFrameColor(LColor_color);
95 void setViewCache(BufferView const * bv) const;
97 bool showInsetDialog(BufferView *) const;
99 LyXText * getText(int i) const {
100 return (i == 0) ? const_cast<LyXText*>(&text_) : 0;
103 bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
105 /// set the change for the entire inset
106 void setChange(Change const & change);
108 /// append text onto the existing text
109 void appendParagraphs(Buffer * bp, ParagraphList &);
112 void addPreview(graphics::PreviewLoader &) const;
115 void edit(LCursor & cur, bool left);
117 InsetBase * editXY(LCursor & cur, int x, int y);
119 /// number of cells in this inset
120 size_t nargs() const { return 1; }
122 ParagraphList & paragraphs();
124 ParagraphList const & paragraphs() const;
126 bool insetAllowed(Code) const { return true; }
128 bool allowSpellCheck() const { return true; }
129 /// should paragraph indendation be ommitted in any case?
130 bool neverIndent() const;
132 InsetText(InsetText const &);
134 bool & Wide() const { return wide_inset_; }
138 virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
142 virtual std::auto_ptr<InsetBase> doClone() const;
148 /** We store the LColor::color value as an int to get LColor.h out
149 * of the header file.
153 mutable pit_type old_pit;
157 mutable bool wide_inset_;
160 mutable LyXText text_;
162 mutable LyXFont font_;