#ifndef INSETBASE_H
#define INSETBASE_H
-#include "Biblio_typedefs.h"
-#include "Changes.h"
#include "Dimension.h"
#include "support/docstream.h"
namespace lyx {
+class BiblioInfo;
class Buffer;
class BufferParams;
class BufferView;
-class ParIterator;
-class ParConstIterator;
+class Change;
+class Color_color;
+class Cursor;
class CursorSlice;
-class InsetIterator;
class FuncRequest;
class FuncStatus;
+class InsetIterator;
class InsetLayout;
class InsetMath;
class InsetText;
class LaTeXFeatures;
-class Color_color;
-class Cursor;
class Lexer;
-class Text;
+class MathAtom;
class MetricsInfo;
-class Dimension;
-class PainterInfo;
class OutputParams;
+class PainterInfo;
+class Paragraph;
+class ParConstIterator;
+class ParIterator;
+class Text;
class TocList;
+class EmbeddedFile;
+class EmbeddedFiles;
namespace graphics { class PreviewLoader; }
/// virtual base class destructor
virtual ~Inset() {}
- /// replicate ourselves
- std::auto_ptr<Inset> clone() const;
/// identification as math inset
virtual InsetMath * asInsetMath() { return 0; }
/// compute the size of the object returned in dim
/// \retval true if metrics changed.
- virtual bool metrics(MetricsInfo & mi, Dimension & dim) const = 0;
+ virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
/// draw inset and update (xo, yo)-cache
virtual void draw(PainterInfo & pi, int x, int y) const = 0;
/// draw inset selection if necessary
int yo(BufferView const & bv) const;
/// set x/y drawing position cache if available
virtual void setPosCache(PainterInfo const &, int, int) const;
+ ///
+ void setDimCache(MetricsInfo const &, Dimension const &) const;
/// do we cover screen position x/y?
virtual bool covers(BufferView const & bv, int x, int y) const;
/// get the screen positions of the cursor (see note in Cursor.cpp)
///
BOX_CODE,
///
- CHARSTYLE_CODE,
+ FLEX_CODE,
///
VSPACE_CODE,
///
/// Add an entry to the TocList
/// pit is the ParConstIterator of the paragraph containing the inset
virtual void addToToc(TocList &, Buffer const &, ParConstIterator const &) const {}
+ /// report files that can be embedded with the lyx file
+ virtual void registerEmbeddedFiles(Buffer const &, EmbeddedFiles &) const {};
+ /// use embedded or external file after the embedding status of a file is changed
+ virtual void updateEmbeddedFile(Buffer const &, EmbeddedFile const &) {}
/// Fill keys with BibTeX information
virtual void fillWithBibKeys(Buffer const &,
- biblio::BibKeyList &, InsetIterator const &) const { return; }
+ BiblioInfo &, InsetIterator const &) const { return; }
/// Update the counters of this inset and of its contents
virtual void updateLabels(Buffer const &, ParIterator const &) {}
/// reject the changes within the inset
virtual void rejectChanges(BufferParams const &) {};
- /// inset width.
- int width() const { return dim_.wid; }
- /// inset ascent.
- int ascent() const { return dim_.asc; }
- /// inset descent.
- int descent() const { return dim_.des; }
+ ///
+ virtual Dimension const dimension(BufferView const &) const;
///
int scroll() const { return 0; }
///
///
enum CollapseStatus {
Collapsed,
- Inlined,
Open
};
///
protected:
Inset();
+ /// replicate ourselves
+ friend class Paragraph;
+ friend class MathAtom;
+ virtual Inset * clone() const = 0;
+
/** The real dispatcher.
* Gets normally called from Cursor::dispatch(). Cursor::dispatch()
* assumes the common case of 'LFUN handled, need update'.
* \sa getStatus
*/
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
-
- /// Cached dimensions of the inset.
- mutable Dimension dim_;
-private:
- virtual std::auto_ptr<Inset> doClone() const = 0;
};