X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInset.h;h=ab35584e126c06a830b3cee11fa294ec4008c474;hb=62af7ee772f16f154225d2d0b65d77f4376b6001;hp=578a7f4d5a1a9541a37a2c40e8b928fd2f6861a7;hpb=c466baaa5b99e44ea25616556bd0918197f4b54c;p=lyx.git diff --git a/src/insets/Inset.h b/src/insets/Inset.h index 578a7f4d5a..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 InsetCollapsible; class InsetCommand; +class InsetGraphics; class InsetIterator; class InsetLayout; class InsetList; @@ -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; @@ -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, @@ -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?