]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetcaption.h
* In the process of fixing the math background color bug, this commit transfer backgr...
[lyx.git] / src / insets / insetcaption.h
index b9705f062367356cf4f42f93163a838495c512c1..45adb74e8789a3c5d4ea64d5428f5b46be3774c9 100644 (file)
@@ -1,23 +1,22 @@
 // -*- C++ -*-
-/* This file is part of
- * ======================================================
+/**
+ * \file insetcaption.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
+ * \author Lars Gullik Bjønnes
  *
- *           Copyright 2000-2001 The LyX Team.
- *
- *======================================================
+ * Full author contact details are available in file CREDITS.
  */
 
-
 #ifndef INSETCAPTION_H
 #define INSETCAPTION_H
 
-#ifdef __GNUG__
-#pragma interface
-#endif
-
 #include "insettext.h"
+#include "lyxtextclass.h"
+
+
+namespace lyx {
 
 /** A caption inset
 */
@@ -26,37 +25,79 @@ public:
        ///
        InsetCaption(BufferParams const &);
        ///
-       void write(Buffer const * buf, std::ostream & os) const;
+       virtual ~InsetCaption() {}
+       ///
+       void write(Buffer const & buf, std::ostream & os) const;
+       ///
+       void read(Buffer const & buf, LyXLex & lex);
+       ///
+       virtual bool display() const;
+       ///
+       virtual bool neverIndent(Buffer const &) const { return true; }
+       ///
+       virtual InsetBase::Code lyxCode() const;
+       ///
+       virtual docstring const editMessage() const;
+       ///
+       virtual 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;
+       ///
+       void drawSelection(PainterInfo & pi, int x, int y) const;
+       ///
+       virtual void edit(LCursor & cur, bool left);
+       ///
+       virtual InsetBase * editXY(LCursor & cur, int x, int y);
        ///
-       void read(Buffer const * buf, LyXLex & lex);
+       bool insetAllowed(InsetBase::Code code) const;
        ///
-       virtual
-       bool display() const;
+       virtual bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
        ///
-       virtual
-       bool needFullRow() const;
+       virtual bool wide() const { return false; }
        ///
-       virtual
-       Inset::Code lyxCode() const;
+       int latex(Buffer const & buf, odocstream & os,
+                 OutputParams const &) const;
        ///
-       virtual
-       string const editMessage() const;
+       int plaintext(Buffer const & buf, odocstream & os,
+                     OutputParams const & runparams) const;
        ///
-       virtual
-       void draw(BufferView * bv, LyXFont const & f,
-                         int baseline, float & x, bool cleared) const;
+       int docbook(Buffer const & buf, odocstream & os,
+                   OutputParams const & runparams) const;
        ///
-       virtual
-       int latex(Buffer const * buf, std::ostream & os,
-                         bool fragile, bool free_spc) const;
+       void setCount(int c) { counter_ = c; }
        ///
-       virtual
-       int ascii(Buffer const * buf, std::ostream & os, int linelen) const;
+       std::string const & type() const { return type_; }
        ///
-       virtual
-       int docbook(Buffer const * buf, std::ostream & os, bool mixcont) const;
-protected:
+       void setType(std::string const & type) { type_ = type; }
+       ///
+       void setCustomLabel(docstring const & label);
+       ///
+       void addToToc(TocList &, Buffer const &) const;
+       /// Captions don't accept alignment, spacing, etc.
+       bool forceDefaultParagraphs(idx_type) const { return true; }
+
 private:
+       ///
+       void computeFullLabel() const;
+       ///
+       virtual std::auto_ptr<InsetBase> doClone() const;
+       ///
+       mutable docstring full_label_;
+       ///
+       mutable int labelwidth_;
+       ///
+       std::string type_;
+       ///
+       docstring custom_label_;
+       ///
+       int counter_;
+       ///
+       LyXTextClass const & textclass_;
 };
 
 
@@ -68,15 +109,12 @@ bool InsetCaption::display() const
 
 
 inline
-bool InsetCaption::needFullRow() const
+InsetBase::Code InsetCaption::lyxCode() const
 {
-       return true;
+       return CAPTION_CODE;
 }
 
 
-inline
-Inset::Code InsetCaption::lyxCode() const
-{
-       return CAPTION_CODE;
-}
+} // namespace lyx
+
 #endif