* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
*
* Full author contact details are available in file CREDITS.
*/
#define INSETCAPTION_H
#include "InsetText.h"
-#include "TextClass.h"
-
namespace lyx {
class InsetCaption : public InsetText {
public:
///
- InsetCaption(InsetCaption const &);
- InsetCaption(BufferParams const &);
- ///
- virtual ~InsetCaption() {}
+ InsetCaption(Buffer *, std::string const &);
///
- void write(Buffer const & buf, std::ostream & os) const;
+ std::string const & floattype() const { return floattype_; }
///
- void read(Buffer const & buf, Lexer & lex);
+ docstring layoutName() const override;
+ /// return the mandatory argument (LaTeX format) only
+ void getArgument(otexstream & os, OutputParams const &) const;
+ /// return the caption text
+ int getCaptionAsPlaintext(odocstream & os, OutputParams const &) const;
+ /// write the caption text as DocBook in os
+ void getCaptionAsDocBook(XMLStream & os, OutputParams const &) const;
+ /// return the caption text as HTML
+ docstring getCaptionAsHTML(XMLStream & os, OutputParams const &) const;
+ ///
+ std::string contextMenuName() const override;
+private:
///
- virtual DisplayType display() const;
+ void write(std::ostream & os) const override;
///
- virtual bool neverIndent(Buffer const &) const { return true; }
+ int rowFlags() const override { return Display; }
///
- virtual Inset::Code lyxCode() const;
+ bool neverIndent() const override { return true; }
///
- virtual docstring const editMessage() const;
+ bool forceLocalFontSwitch() const override { return true; }
///
- virtual void cursorPos(BufferView const & bv,
- CursorSlice const & sl, bool boundary, int & x, int & y) const;
+ InsetCode lyxCode() const override { return CAPTION_CODE; }
///
- bool descendable() const { return true; }
+ void cursorPos(BufferView const & bv,
+ CursorSlice const & sl, bool boundary, int & x, int & y) const override;
///
- virtual bool metrics(MetricsInfo & mi, Dimension & dim) const;
+ bool descendable(BufferView const &) const override { return true; }
///
- virtual void draw(PainterInfo & pi, int x, int y) const;
+ void metrics(MetricsInfo & mi, Dimension & dim) const override;
///
- void drawSelection(PainterInfo & pi, int x, int y) const;
+ void drawBackground(PainterInfo & pi, int x, int y) const override;
///
- virtual void edit(Cursor & cur, bool left);
+ void draw(PainterInfo & pi, int x, int y) const override;
+ /// Strike out the inset when deleted.
+ bool canPaintChange(BufferView const &) const override { return true; }
///
- virtual Inset * editXY(Cursor & cur, int x, int y);
+ void edit(Cursor & cur, bool front, EntryDirection entry_from) override;
///
- bool insetAllowed(Inset::Code code) const;
+ Inset * editXY(Cursor & cur, int x, int y) override;
///
- virtual bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
+ bool insetAllowed(InsetCode code) const override;
///
- virtual bool wide() const { return false; }
+ void doDispatch(Cursor & cur, FuncRequest & cmd) override;
///
- int latex(Buffer const & buf, odocstream & os,
- OutputParams const &) const;
+ bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const override;
+ // Update the counters of this inset and of its contents
+ void updateBuffer(ParIterator const &, UpdateType, bool const deleted) override;
///
- int plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const;
+ void latex(otexstream & os, OutputParams const &) const override;
///
- int docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const;
- /// return the mandatory argument (LaTeX format) only
- int getArgument(Buffer const & buf, odocstream & os,
- OutputParams const &) const;
- /// return the optional argument(s) only
- int getOptArg(Buffer const & buf, odocstream & os,
- OutputParams const &) const;
+ int plaintext(odocstringstream & ods, OutputParams const & op,
+ size_t max_length = INT_MAX) const override;
///
- void setCount(int c) { counter_ = c; }
+ void docbook(XMLStream &, OutputParams const &) const override;
///
- std::string const & type() const { return type_; }
+ docstring xhtml(XMLStream & os, OutputParams const & runparams) const override;
///
- void setType(std::string const & type) { type_ = type; }
+ void addToToc(DocIterator const & di, bool output_active, UpdateType utype,
+ TocBackend & backend) const override;
///
- void setCustomLabel(docstring const & label);
+ docstring toolTip(BufferView const & bv, int x, int y) const override;
///
- void addToToc(TocList &, Buffer const &, ParConstIterator &) const;
+ bool forcePlainLayout(idx_type = 0) const override { return true; }
/// Captions don't accept alignment, spacing, etc.
- bool forceDefaultParagraphs(idx_type) const { return true; }
+ bool allowParagraphCustomization(idx_type = 0) const override { return false; }
+ ///
+ Inset * clone() const override { return new InsetCaption(*this); }
-private:
///
- void computeFullLabel(Buffer const & buf) const;
+ mutable docstring full_label_;
///
- virtual std::auto_ptr<Inset> doClone() const;
+ mutable int labelwidth_ = 0;
///
- mutable docstring full_label_;
+ mutable bool rtl_ = false;
///
- mutable int labelwidth_;
+ std::string floattype_;
///
- std::string type_;
+ bool is_subfloat_ = false;
///
- docstring custom_label_;
+ bool is_deleted_ = false;
///
- int counter_;
+ bool non_float_ = false;
///
- TextClass const & textclass_;
+ std::string type_;
};
-inline
-Inset::DisplayType InsetCaption::display() const
-{
- return AlignCenter;
-}
-
-
-inline
-Inset::Code InsetCaption::lyxCode() const
-{
- return CAPTION_CODE;
-}
-
-
} // namespace lyx
#endif