* 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 "lyxtextclass.h"
-
+#include "support/strfwd.h"
namespace lyx {
class InsetCaption : public InsetText {
public:
///
- InsetCaption(BufferParams const &);
+ InsetCaption(Buffer *);
///
- virtual ~InsetCaption() {}
+ std::string const & type() const { return type_; }
///
- void write(Buffer const & buf, std::ostream & os) const;
+ docstring name() const;
+ /// return the mandatory argument (LaTeX format) only
+ int getArgument(odocstream & os, OutputParams const &) const;
+ /// return the optional argument(s) only
+ int getOptArg(odocstream & os, OutputParams const &) const;
+ /// return the caption text
+ int getCaptionAsPlaintext(odocstream & os, OutputParams const &) const;
+ /// return the caption text as HTML
+ docstring getCaptionAsHTML(XHTMLStream & os, OutputParams const &) const;
+private:
///
- void read(Buffer const & buf, LyXLex & lex);
+ void write(std::ostream & os) const;
///
- virtual bool display() const;
+ void read(Lexer & lex);
///
- virtual bool neverIndent(Buffer const &) const { return true; }
+ DisplayType display() const { return AlignCenter; }
///
- virtual InsetBase::Code lyxCode() const;
+ bool neverIndent() const { return true; }
///
- virtual docstring const editMessage() const;
+ InsetCode lyxCode() const { return CAPTION_CODE; }
///
- virtual void cursorPos(BufferView const & bv,
+ void cursorPos(BufferView const & bv,
CursorSlice const & sl, bool boundary, int & x, int & y) const;
///
- bool descendable() const { return true; }
- ///
- virtual bool metrics(MetricsInfo & mi, Dimension & dim) const;
- ///
- virtual void draw(PainterInfo & pi, int x, int y) const;
+ bool descendable(BufferView const &) const { return true; }
///
- void drawSelection(PainterInfo & pi, int x, int y) const;
+ void metrics(MetricsInfo & mi, Dimension & dim) const;
///
- virtual void edit(LCursor & cur, bool left);
+ void draw(PainterInfo & pi, int x, int y) const;
///
- virtual InsetBase * editXY(LCursor & cur, int x, int y);
+ void edit(Cursor & cur, bool front, EntryDirection entry_from);
///
- bool insetAllowed(InsetBase::Code code) const;
+ Inset * editXY(Cursor & cur, int x, int y);
///
- virtual bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
+ bool insetAllowed(InsetCode code) const;
///
- virtual bool wide() const { return false; }
+ bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
+ // Update the counters of this inset and of its contents
+ void updateLabels(ParIterator const &, bool);
///
- int latex(Buffer const & buf, odocstream & os,
- OutputParams const &) const;
+ int latex(odocstream & os, OutputParams const &) const;
///
- int plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const;
+ int plaintext(odocstream & os, OutputParams const & runparams) const;
///
- int docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const;
- ///
- void setCount(int c) { counter_ = c; }
- ///
- std::string const & type() const { return type_; }
- ///
- void setType(std::string const & type) { type_ = type; }
+ int docbook(odocstream & os, OutputParams const & runparams) const;
+ ///
+ docstring xhtml(XHTMLStream & os, OutputParams const & runparams) const;
///
void setCustomLabel(docstring const & label);
///
- void addToToc(TocList &, Buffer const &) const;
+ void addToToc(DocIterator const &);
+ ///
+ virtual bool forcePlainLayout(idx_type = 0) const { return true; }
/// Captions don't accept alignment, spacing, etc.
- bool forceDefaultParagraphs(idx_type) const { return true; }
-
-private:
- ///
- void computeFullLabel() const;
+ virtual bool allowParagraphCustomization(idx_type = 0) const { return false; }
///
- virtual std::auto_ptr<InsetBase> doClone() const;
+ Inset * clone() const { return new InsetCaption(*this); }
+
///
mutable docstring full_label_;
///
std::string type_;
///
docstring custom_label_;
- ///
- int counter_;
- ///
- LyXTextClass const & textclass_;
};
-inline
-bool InsetCaption::display() const
-{
- return true;
-}
-
-
-inline
-InsetBase::Code InsetCaption::lyxCode() const
-{
- return CAPTION_CODE;
-}
-
-
} // namespace lyx
#endif