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.
15 #include "updatableinset.h"
16 #include "RowList_fwd.h"
20 #include "support/types.h"
22 #include "frontends/mouse_state.h"
36 A text inset is like a TeX box to write full text
37 (including styles and other insets) in a given space.
39 class InsetText : public UpdatableInset {
42 explicit InsetText(BufferParams const &);
46 InsetText(InsetText const &);
48 virtual std::auto_ptr<InsetBase> clone() const;
50 void operator=(InsetText const & it);
51 /// empty inset to empty par, or just mark as erased
52 void clear(bool just_mark_erased);
54 void read(Buffer const & buf, LyXLex & lex);
56 void write(Buffer const & buf, std::ostream & os) const;
58 void metrics(MetricsInfo & mi, Dimension & dim) const;
60 void draw(PainterInfo & pi, int x, int y) const;
61 /// draw inset selection
62 void drawSelection(PainterInfo & pi, int x, int y) const;
64 std::string const editMessage() const;
66 bool isTextInset() const { return true; }
68 int latex(Buffer const &, std::ostream &,
69 OutputParams const &) const;
71 int plaintext(Buffer const &, std::ostream &,
72 OutputParams const &) const;
74 int linuxdoc(Buffer const &, std::ostream &,
75 OutputParams const &) const;
77 int docbook(Buffer const &, std::ostream &,
78 OutputParams const &) const;
80 void validate(LaTeXFeatures & features) const;
82 InsetOld::Code lyxCode() const { return InsetOld::TEXT_CODE; }
84 void getCursorPos(LCursor const & cur, int & x, int & y) const;
86 void setFont(BufferView *, LyXFont const &,
87 bool toggleall = false,
88 bool selectall = false);
90 void setText(std::string const &, LyXFont const &);
92 void setAutoBreakRows(bool);
94 bool getAutoBreakRows() const { return autoBreakRows_; }
96 void setDrawFrame(bool);
98 LColor_color frameColor() const;
100 void setFrameColor(LColor_color);
102 void setViewCache(BufferView const * bv) const;
104 bool showInsetDialog(BufferView *) const;
105 /// Appends \c list with all labels found within this inset.
106 void getLabelList(Buffer const &, std::vector<std::string> & list) const;
108 LyXText * getText(int) const;
110 bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
112 /// mark as erased for change tracking
113 void markErased() { clear(true); }
115 * Mark as new. Used when pasting in tabular, and adding rows
116 * or columns. Note that pasting will ensure that tracking already
117 * happens, and this just resets the changes for the copied text,
118 * whereas for row/col add, we need to start tracking changes
119 * for the (empty) paragraph contained.
121 void markNew(bool track_changes = false);
123 /// append text onto the existing text
124 void appendParagraphs(Buffer * bp, ParagraphList &);
127 void addPreview(lyx::graphics::PreviewLoader &) const;
130 void edit(LCursor & cur, bool left);
132 InsetBase * editXY(LCursor & cur, int x, int y) const;
134 /// number of cells in this inset
135 size_t nargs() const { return 1; }
137 ParagraphList & paragraphs();
139 ParagraphList const & paragraphs() const;
141 bool insetAllowed(Code) const { return true; }
143 bool allowSpellCheck() const { return true; }
147 void priv_dispatch(LCursor & cur, FuncRequest & cmd);
150 void updateLocal(LCursor &);
154 void setCharFont(Buffer const &, int pos, LyXFont const & font);
156 void removeNewlines();
158 void drawFrame(Painter &, int x, int y) const;
160 void clearInset(Painter &, int x, int y) const;
166 /** We store the LColor::color value as an int to get LColor.h out
167 * of the header file.
171 mutable lyx::par_type old_par;
174 mutable LyXText text_;
176 mutable LyXFont font_;