X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInset.h;h=ab35584e126c06a830b3cee11fa294ec4008c474;hb=62af7ee772f16f154225d2d0b65d77f4376b6001;hp=e5a3991548e32f0a5eb6c481d0255a008577c981;hpb=51aebc9327345f6ea065035f489dbfec1568279f;p=lyx.git diff --git a/src/insets/Inset.h b/src/insets/Inset.h index e5a3991548..ab35584e12 100644 --- a/src/insets/Inset.h +++ b/src/insets/Inset.h @@ -20,9 +20,11 @@ #include "InsetLayout.h" #include "LayoutEnums.h" #include "OutputEnums.h" +#include "OutputParams.h" #include "support/strfwd.h" #include "support/types.h" +#include "support/FileNameList.h" #include @@ -38,11 +40,13 @@ class Cursor; class CursorSlice; class Dimension; class DocIterator; +class Encoding; class FuncRequest; class FuncStatus; class InsetArgument; -class InsetCollapsable; +class InsetCollapsible; class InsetCommand; +class InsetGraphics; class InsetIterator; class InsetLayout; class InsetList; @@ -143,10 +147,10 @@ public: virtual InsetText * asInsetText() { return 0; } /// is this inset based on the InsetText class? virtual InsetText const * asInsetText() const { return 0; } - /// is this inset based on the InsetCollapsable class? - virtual InsetCollapsable * asInsetCollapsable() { return 0; } - /// is this inset based on the InsetCollapsable class? - virtual InsetCollapsable const * asInsetCollapsable() const { return 0; } + /// is this inset based on the InsetCollapsible class? + virtual InsetCollapsible * asInsetCollapsible() { return 0; } + /// is this inset based on the InsetCollapsible class? + virtual InsetCollapsible const * asInsetCollapsible() const { return 0; } /// is this inset based on the InsetTabular class? virtual InsetTabular * asInsetTabular() { return 0; } /// is this inset based on the InsetTabular class? @@ -157,6 +161,10 @@ public: virtual InsetCommand const * asInsetCommand() const { return 0; } /// 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; } + /// is this inset based on the InsetGraphics class? + virtual InsetGraphics const * asInsetGraphics() const { return 0; } /// the real dispatcher void dispatch(Cursor & cur, FuncRequest & cmd); @@ -194,6 +202,17 @@ public: /// https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg199001.html virtual Inset * editXY(Cursor & cur, int x, int y); + /// The default margin inside text insets + static int textOffset(BufferView const *) { return 4; } + /// + virtual int topOffset(BufferView const *bv) const { return textOffset(bv); } + /// + virtual int bottomOffset(BufferView const *bv) const { return textOffset(bv); } + /// + virtual int leftOffset(BufferView const *bv) const { return textOffset(bv); } + /// + virtual int rightOffset(BufferView const *bv) const { return textOffset(bv); } + /// compute the size of the object returned in dim virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0; /// draw inset and update (xo, yo)-cache @@ -209,9 +228,7 @@ public: virtual bool showInsetDialog(BufferView *) const; /// draw two angular markers - void drawMarkers(PainterInfo & pi, int x, int y) const; - /// draw four angular markers - void drawMarkers2(PainterInfo & pi, int x, int y) const; + virtual void drawMarkers(PainterInfo & pi, int x, int y) const; /// add space for markers void metricsMarkers(Dimension & dim, int framesize = 1) const; /// add space for markers @@ -237,7 +254,7 @@ public: /// Don't eliminate empty paragraphs virtual bool allowEmpty() const; /// Force inset into LTR environment if surroundings are RTL - virtual bool forceLTR() const; + virtual bool forceLTR(OutputParams const &) const; /// whether to include this inset in the strings generated for the TOC virtual bool isInToc() const; @@ -342,18 +359,18 @@ public: 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 + /// InsetMathCommand and InsetInfo. + virtual bool isActive() const { return nargs() > 0; } /// can the contents of the inset be edited on screen ? - // true for InsetCollapsables (not ButtonOnly) (not InsetInfo), InsetText + // equivalent to isActive except for closed InsetCollapsible virtual bool editable() const; /// has the Inset settings that can be modified in a dialog ? virtual bool hasSettings() const; /// can we go further down on mouse click? - // true for InsetCaption, InsetCollapsables (not ButtonOnly), InsetTabular + /// true for InsetCaption, InsetCollapsibles (not ButtonOnly), InsetTabular virtual bool descendable(BufferView const &) const { return false; } - /// is this an inset that can be moved into? - /// FIXME: merge with editable() - // true for InsetTabular & InsetText - virtual bool isActive() const { return nargs() > 0; } /// can we click at the specified position ? virtual bool clickable(BufferView const &, int, int) const { return false; } /// Move one cell backwards @@ -418,6 +435,14 @@ public: /// if this inset has paragraphs should they be forced to use a /// local font language switch? virtual bool forceLocalFontSwitch() const { return false; } + /// if this inset has paragraphs should they be forced to use a + /// font language switch that switches paragraph directions + /// (relevant with polyglossia only)? + virtual bool forceParDirectionSwitch() const { return false; } + /// Does the inset force a specific encoding? + virtual Encoding const * forcedEncoding(Encoding const *, Encoding const *) const + { return 0; } + /// Is the content of this inset part of the output document? virtual bool producesOutput() const { return true; } @@ -458,6 +483,8 @@ public: /// 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 DisplayType { Inline = 0, AlignLeft, @@ -473,7 +500,7 @@ public: virtual LyXAlignment contentAlignment() const { return LYX_ALIGN_NONE; } /// should we break lines after this inset? virtual bool isLineSeparator() const { return false; } - /// should paragraph indendation be ommitted in any case? + /// should paragraph indendation be omitted in any case? virtual bool neverIndent() const { return false; } /// dumps content to lyxerr virtual void dump() const; @@ -529,7 +556,7 @@ public: UpdateType /* utype*/, TocBackend & /* tocbackend */) const {} /// Collect BibTeX information - virtual void collectBibKeys(InsetIterator const &) const {} + virtual void collectBibKeys(InsetIterator const &, support::FileNameList &) const {} /// Update the counters of this inset and of its contents. /// The boolean indicates whether we are preparing for output, e.g., /// of XHTML. @@ -578,6 +605,8 @@ public: */ virtual bool resetFontEdit() const; + /// does the inset contain changes ? + virtual bool isChanged() const { return false; } /// set the change for the entire inset virtual void setChange(Change const &) {} /// accept the changes within the inset @@ -585,12 +614,13 @@ public: /// reject the changes within the inset virtual void rejectChanges() {} + /// + virtual bool needsCProtection(bool const, bool const) const { return false; } + /// virtual ColorCode backgroundColor(PainterInfo const &) const; /// virtual ColorCode labelColor() const; - // - enum { TEXT_TO_INSET_OFFSET = 4 }; /// Determine the action of backspace and delete: do we select instead of /// deleting if not already selected?