]> git.lyx.org Git - features.git/blobdiff - src/insets/Inset.h
Rename XHTMLStream to XMLStream, move it to another file, and prepare for DocBook...
[features.git] / src / insets / Inset.h
index ecd171dc45de302844373c860c378171d198f662..1366ca59f2196a2de3eec9320652537c89f98ed7 100644 (file)
@@ -20,6 +20,7 @@
 #include "InsetLayout.h"
 #include "LayoutEnums.h"
 #include "OutputEnums.h"
+#include "OutputParams.h"
 
 #include "support/strfwd.h"
 #include "support/types.h"
@@ -63,7 +64,7 @@ class ParIterator;
 class Text;
 class TocBackend;
 class TocList;
-class XHTMLStream;
+class XMLStream;
 class otexstream;
 
 namespace graphics { class PreviewLoader; }
@@ -201,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
@@ -242,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;
 
@@ -331,11 +343,11 @@ public:
        /// docbook output
        virtual int docbook(odocstream & os, OutputParams const &) const;
        /// XHTML output
-       /// the inset is expected to write XHTML to the XHTMLStream
+       /// the inset is expected to write XHTML to the XMLStream
        /// \return any "deferred" material that should be written outside the
        /// normal stream, and which will in fact be written after the current
        /// paragraph closes. this is appropriate e.g. for floats.
-       virtual docstring xhtml(XHTMLStream & xs, OutputParams const &) const;
+       virtual docstring xhtml(XMLStream &, OutputParams const &) const;
 
        /// Writes a string representation of the inset to the odocstream.
        /// This one should be called when you want the whole contents of
@@ -423,6 +435,10 @@ 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; }
@@ -467,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,
@@ -542,7 +560,7 @@ public:
        /// Update the counters of this inset and of its contents.
        /// The boolean indicates whether we are preparing for output, e.g.,
        /// of XHTML.
-       virtual void updateBuffer(ParIterator const &, UpdateType) {}
+       virtual void updateBuffer(ParIterator const &, UpdateType, bool const) {}
 
        /// Updates the inset's dialog
        virtual Buffer const * updateFrontend() const;
@@ -587,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
@@ -594,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?