]> git.lyx.org Git - features.git/commitdiff
Use forceLTR instead of inset codes in order to determine whether an inset
authorDov Feldstern <dov@lyx.org>
Mon, 5 Nov 2007 23:44:47 +0000 (23:44 +0000)
committerDov Feldstern <dov@lyx.org>
Mon, 5 Nov 2007 23:44:47 +0000 (23:44 +0000)
should be surrounded by external \L{} in bidi text.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21458 a592a061-630c-0410-9148-cb99ea01b6c8

src/Paragraph.cpp
src/insets/Inset.h
src/insets/InsetCollapsable.h
src/insets/InsetGraphics.h
src/insets/InsetHyperlink.h
src/mathed/InsetMathHull.h

index 675a85edb5112f6c73aa57cfa5776fcb5c349957..1a1394d7840738c385fb9510efe6b0b6e5272d62 100644 (file)
@@ -723,14 +723,10 @@ void Paragraph::Private::latexInset(Buffer const & buf,
        bool close = false;
        odocstream::pos_type const len = os.tellp();
 
-       if ((inset->lyxCode() == GRAPHICS_CODE
-            || inset->lyxCode() == MATH_CODE
-            || inset->lyxCode() == HYPERLINK_CODE
-                || (inset->asInsetCollapsable()
-                        && inset->asInsetCollapsable()->forceLTR()
-                        // ERT is an exception, since it doesn't go to output
-                        && inset->lyxCode() != ERT_CODE))
-           && running_font.isRightToLeft()) {
+       if (inset->forceLTR() 
+           && running_font.isRightToLeft()
+               // ERT is an exception, it should be output with no decorations at all
+               && inset->lyxCode() != ERT_CODE) {
                if (running_font.language()->lang() == "farsi")
                        os << "\\beginL{}";
                else
index c0dfb170c540d7536e2c79d34c4553020939dff0..2caf998873b0bc43d0e51e5ade93bb2954c0c92a 100644 (file)
@@ -164,6 +164,8 @@ public:
        virtual bool isFreeSpacing() const { return false; }
        ///
        virtual bool allowEmpty() const { return false; }
+       /// Force inset into LTR environment if surroundings are RTL?
+       virtual bool forceLTR() const { return false; }
 
        /// is this an inset that can be moved into?
        /// FIXME: merge with editable()
index c8733ff48f708258c2bc188040cc96945d35c696..8be193e00ccff5b7a4a34672766daa33b751c0d6 100644 (file)
@@ -147,7 +147,7 @@ public:
        virtual bool isFreeSpacing() const { return layout_->freespacing; }
        /// Don't eliminate empty paragraphs
        virtual bool allowEmpty() const { return layout_->keepempty; }
-       /// Force inset into LTR environment if surroundings are RTL
+       /// Force inset into LTR environment if surroundings are RTL?
        virtual bool forceLTR() const { return layout_->forceltr; }
 
 protected:
index 884f03c51a16fb56677c8ffe9f1519eae8e26d21..4dfe1a9a948ed54ce8a3d769525efa3139b9c4b0 100644 (file)
@@ -82,6 +82,8 @@ public:
        void registerEmbeddedFiles(Buffer const &, EmbeddedFiles &) const;
        ///
        void updateEmbeddedFile(Buffer const &, EmbeddedFile const &);
+       /// Force inset into LTR environment if surroundings are RTL?
+       virtual bool forceLTR() const { return true; }
 protected:
        InsetGraphics(InsetGraphics const &);
        ///
index 21947cc93b0c5475a802109937a0cca3d5c00cfc..d4f7a123e63f48904f51a836211a5fc517f09913 100644 (file)
@@ -56,6 +56,8 @@ public:
        ///
        static bool isCompatibleCommand(std::string const & s) 
                { return s == "href"; }
+       /// Force inset into LTR environment if surroundings are RTL?
+       virtual bool forceLTR() const { return true; }
 private:
        virtual Inset * clone() const {
                return new InsetHyperlink(params());
index e866874bcfd0b5c77167bd702cbe75004ba6d02a..c20de9edf54c2c8941839f7a5d2d3fc4d2c3c97b 100644 (file)
@@ -120,6 +120,9 @@ public:
 
        ///
        static int displayMargin() { return 12; }
+       
+       /// Force inset into LTR environment if surroundings are RTL?
+       virtual bool forceLTR() const { return true; }
 
 protected:
        InsetMathHull(InsetMathHull const &);