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"
20 #include "support/types.h"
22 #include "frontends/mouse_state.h"
34 A text inset is like a TeX box to write full text
35 (including styles and other insets) in a given space.
37 class InsetText : public InsetOld {
40 explicit InsetText(BufferParams const &);
43 /// empty inset to empty par
46 void read(Buffer const & buf, LyXLex & lex);
48 void write(Buffer const & buf, std::ostream & os) const;
50 void metrics(MetricsInfo & mi, Dimension & dim) const;
52 void draw(PainterInfo & pi, int x, int y) const;
53 /// draw inset selection
54 void drawSelection(PainterInfo & pi, int x, int y) const;
56 std::string const editMessage() const;
58 EDITABLE editable() const { return HIGHLY_EDITABLE; }
60 bool isTextInset() const { return true; }
62 int latex(Buffer const &, std::ostream &,
63 OutputParams const &) const;
65 int plaintext(Buffer const &, std::ostream &,
66 OutputParams const &) const;
68 int linuxdoc(Buffer const &, std::ostream &,
69 OutputParams const &) const;
71 int docbook(Buffer const &, std::ostream &,
72 OutputParams const &) const;
74 void validate(LaTeXFeatures & features) const;
76 /// return x,y of given position relative to the inset's baseline
77 void cursorPos(CursorSlice const & sl, bool boundary, int & x, int & y) const;
79 Code lyxCode() const { return TEXT_CODE; }
81 void setText(std::string const &, LyXFont const &);
83 void setAutoBreakRows(bool);
85 bool getAutoBreakRows() const { return text_.autoBreakRows_; }
87 void setDrawFrame(bool);
89 LColor_color frameColor() const;
91 void setFrameColor(LColor_color);
93 void setViewCache(BufferView const * bv) const;
95 bool showInsetDialog(BufferView *) const;
97 LyXText * getText(int i) const {
98 return (i == 0) ? const_cast<LyXText*>(&text_) : 0;
101 bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
103 /// mark as erased for change tracking
104 void markErased(bool erased);
107 * Mark as new. Used when pasting in tabular, and adding rows
108 * or columns. Note that pasting will ensure that tracking already
109 * happens, and this just resets the changes for the copied text,
110 * whereas for row/col add, we need to start tracking changes
111 * for the (empty) paragraph contained.
113 void markNew(bool track_changes = false);
115 /// append text onto the existing text
116 void appendParagraphs(Buffer * bp, ParagraphList &);
119 void addPreview(lyx::graphics::PreviewLoader &) const;
122 void edit(LCursor & cur, bool left);
124 InsetBase * editXY(LCursor & cur, int x, int y);
126 /// number of cells in this inset
127 size_t nargs() const { return 1; }
129 ParagraphList & paragraphs();
131 ParagraphList const & paragraphs() const;
133 bool insetAllowed(Code) const { return true; }
135 bool allowSpellCheck() const { return true; }
136 /// should paragraph indendation be ommitted in any case?
137 bool neverIndent() const;
139 InsetText(InsetText const &);
143 virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
147 virtual std::auto_ptr<InsetBase> doClone() const;
153 /** We store the LColor::color value as an int to get LColor.h out
154 * of the header file.
158 mutable lyx::pit_type old_pit;
163 mutable LyXText text_;
165 mutable LyXFont font_;