#include "ColorCode.h"
#include "InsetCode.h"
-#include "InsetLayout.h"
#include "LayoutEnums.h"
#include "OutputEnums.h"
#include "OutputParams.h"
+#include "RowFlags.h"
+#include "support/docstring.h"
#include "support/strfwd.h"
#include "support/types.h"
-#include "support/FileNameList.h"
#include <climits>
namespace lyx {
-class BiblioInfo;
class Buffer;
class BufferView;
class Change;
class Lexer;
class MathAtom;
class MetricsInfo;
-class OutputParams;
class PainterInfo;
-class ParConstIterator;
class ParIterator;
class Text;
class TocBackend;
-class TocList;
class XMLStream;
class otexstream;
namespace graphics { class PreviewLoader; }
+namespace support {class FileNameList; }
/// returns the InsetCode corresponding to the \c name.
/// Eg, insetCode("branch") == BRANCH_CODE
ENTRY_DIRECTION_RIGHT,
ENTRY_DIRECTION_LEFT
};
- ///
- typedef ptrdiff_t difference_type;
- /// short of anything else reasonable
- typedef size_t size_type;
- /// type for cell indices
- typedef size_t idx_type;
- /// type for cursor positions
- typedef ptrdiff_t pos_type;
- /// type for row numbers
- typedef size_t row_type;
- /// type for column numbers
- typedef size_t col_type;
/// virtual base class destructor
virtual ~Inset() {}
virtual bool isLabeled() const { return false; }
/// identification as math inset
- virtual InsetMath * asInsetMath() { return 0; }
+ virtual InsetMath * asInsetMath() { return nullptr; }
/// identification as math inset
- virtual InsetMath const * asInsetMath() const { return 0; }
+ virtual InsetMath const * asInsetMath() const { return nullptr; }
/// true for 'math' math inset, but not for e.g. mbox
virtual bool inMathed() const { return false; }
/// is this inset based on the InsetText class?
- virtual InsetText * asInsetText() { return 0; }
+ virtual InsetText * asInsetText() { return nullptr; }
/// is this inset based on the InsetText class?
- virtual InsetText const * asInsetText() const { return 0; }
+ virtual InsetText const * asInsetText() const { return nullptr; }
/// is this inset based on the InsetCollapsible class?
- virtual InsetCollapsible * asInsetCollapsible() { return 0; }
+ virtual InsetCollapsible * asInsetCollapsible() { return nullptr; }
/// is this inset based on the InsetCollapsible class?
- virtual InsetCollapsible const * asInsetCollapsible() const { return 0; }
+ virtual InsetCollapsible const * asInsetCollapsible() const { return nullptr; }
/// is this inset based on the InsetTabular class?
- virtual InsetTabular * asInsetTabular() { return 0; }
+ virtual InsetTabular * asInsetTabular() { return nullptr; }
/// is this inset based on the InsetTabular class?
- virtual InsetTabular const * asInsetTabular() const { return 0; }
+ virtual InsetTabular const * asInsetTabular() const { return nullptr; }
/// is this inset based on the InsetCommand class?
- virtual InsetCommand * asInsetCommand() { return 0; }
+ virtual InsetCommand * asInsetCommand() { return nullptr; }
/// is this inset based on the InsetCommand class?
- virtual InsetCommand const * asInsetCommand() const { return 0; }
+ virtual InsetCommand const * asInsetCommand() const { return nullptr; }
/// is this inset based on the InsetArgument class?
virtual InsetArgument const * asInsetArgument() const { return nullptr; }
/// is this inset based on the InsetGraphics class?
- virtual InsetGraphics * asInsetGraphics() { return 0; }
+ virtual InsetGraphics * asInsetGraphics() { return nullptr; }
/// is this inset based on the InsetGraphics class?
- virtual InsetGraphics const * asInsetGraphics() const { return 0; }
+ virtual InsetGraphics const * asInsetGraphics() const { return nullptr; }
/// the real dispatcher
void dispatch(Cursor & cur, FuncRequest & cmd);
virtual void cursorPos(BufferView const & bv,
CursorSlice const & sl, bool boundary, int & x, int & y) const;
+ ///
+ virtual docstring layoutName() const;
+ ///
+ virtual InsetLayout const & getLayout() const;
+ ///
+ virtual bool isPassThru() const;
/// Allow multiple blanks
virtual bool isFreeSpacing() const;
/// Don't eliminate empty paragraphs
virtual bool forceLTR(OutputParams const &) const;
/// whether to include this inset in the strings generated for the TOC
virtual bool isInToc() const;
+ /// Inset font
+ virtual FontInfo getFont() const;
+ /// Label font
+ virtual FontInfo getLabelfont() const;
/// Where should we go when we press the up or down cursor key?
virtual bool idxUpDown(Cursor & cur, bool up) const;
/// output, add PLAINTEXT_NEWLINE to the number of chars in the last line
virtual int plaintext(odocstringstream &, OutputParams const &,
size_t max_length = INT_MAX) const = 0;
- /// docbook output
+ /// DocBook output
virtual void docbook(XMLStream &, OutputParams const &) const;
/// XHTML output
/// the inset is expected to write XHTML to the XMLStream
/// Appends a potentially abbreviated version of the inset to
/// \param str. Intended for use by the TOC.
virtual void forOutliner(docstring & str,
- size_t const maxlen = TOC_ENTRY_LENGTH,
- bool const shorten = true) const;
+ size_t const maxlen = TOC_ENTRY_LENGTH,
+ bool const shorten = true) const;
/// Can a cursor be put in there ?
/// Forced to false for insets that have hidden contents, like
/// This default implementation returns an empty string.
virtual std::string contextMenuName() const;
-
- virtual docstring layoutName() const;
- ///
- virtual InsetLayout const & getLayout() const;
- ///
- virtual bool isPassThru() const { return getLayout().isPassThru(); }
/// Is this inset embedded in a title?
virtual bool isInTitle() const { return false; }
/// Is this inset's layout defined in the document's textclass?
/// is this equivalent to a space (which is BTW different from
/// a line separator)?
virtual bool isSpace() const { return false; }
+ /// returns chars, words if the inset is equivalent to such, otherwise
+ /// (0,0), which should be interpreted as 'false'
+ virtual std::pair<int, int> isWords() const { return std::pair<int,int>(0, 0); }
/// does this inset try to use all available space (like \\hfill does)?
virtual bool isHfill() const { return false; }
- virtual OutputParams::CtObject CtObject(OutputParams const &) const { return OutputParams::CT_NORMAL; }
-
- enum RowFlags {
- Inline = 0,
- // break row before this inset
- BreakBefore = 1 << 0,
- // break row after this inset
- BreakAfter = 1 << 1,
- // it is possible to break after this inset
- CanBreakAfter = 1 << 2,
- // force new (maybe empty) row after this inset
- RowAfter = 1 << 3,
- // specify an alignment (left, right) for a display inset
- // (default is center)
- AlignLeft = 1 << 4,
- AlignRight = 1 << 5,
- // A display inset breaks row at both ends
- Display = BreakBefore | BreakAfter
- };
+ virtual CtObject getCtObject(OutputParams const &) const;
- /// How should this inset be displayed in its row?
- virtual RowFlags rowFlags() const { return Inline; }
+ // properties with respect to row breaking (made of RowFLag enums)
+ virtual int rowFlags() const { return Inline; }
/// indentation before this inset (only needed for displayed hull insets with fleqn option)
virtual int indent(BufferView const &) const { return 0; }
///
///
virtual bool allowSpellCheck() const { return false; }
- /// if this insets owns text cells (e.g. InsetText) return cell num
- virtual Text * getText(int /*num*/) const { return 0; }
+ /// if this insets owns text cells (e.g. InsetText) return cell idx
+ virtual Text * getText(int /*idx*/) const { return 0; }
/** Adds a LaTeX snippet to the Preview Loader for transformation
* into a bitmap image. Does not start the loading process.
/// returns whether paragraph breaks can occur inside this inset
virtual bool allowMultiPar() const { return false; }
/**
- * The font is inherited from the parent for LaTeX export if this
- * method returns true. No open font changes are closed in front of
- * the inset for LaTeX export, and the font is inherited for all other
- * exports as well as on screen.
- * If this method returns false all open font changes are closed in
- * front of the inset for LaTeX export. The default font is used
- * inside the inset for all exports and on screen.
+ * The font inside the inset is inherited from the parent for
+ * LaTeX export if this method returns true, as well as on screen.
+ * Otherwise the document default font is used.
*/
virtual bool inheritFont() const { return true; }
/**
};
-inline Inset::RowFlags operator|(Inset::RowFlags const d1,
- Inset::RowFlags const d2)
-{
- return static_cast<Inset::RowFlags>(int(d1) | int(d2));
-}
-
-
-inline Inset::RowFlags operator&(Inset::RowFlags const d1,
- Inset::RowFlags const d2)
-{
- return static_cast<Inset::RowFlags>(int(d1) & int(d2));
-}
-
-
} // namespace lyx
#endif