From: Dov Feldstern Date: Mon, 5 Nov 2007 23:44:47 +0000 (+0000) Subject: Use forceLTR instead of inset codes in order to determine whether an inset X-Git-Tag: 1.6.10~7466 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=7bf4f48a4a04d30caec46b103709fb19cf654155;p=features.git Use forceLTR instead of inset codes in order to determine whether an inset 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 --- diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 675a85edb5..1a1394d784 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -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 diff --git a/src/insets/Inset.h b/src/insets/Inset.h index c0dfb170c5..2caf998873 100644 --- a/src/insets/Inset.h +++ b/src/insets/Inset.h @@ -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() diff --git a/src/insets/InsetCollapsable.h b/src/insets/InsetCollapsable.h index c8733ff48f..8be193e00c 100644 --- a/src/insets/InsetCollapsable.h +++ b/src/insets/InsetCollapsable.h @@ -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: diff --git a/src/insets/InsetGraphics.h b/src/insets/InsetGraphics.h index 884f03c51a..4dfe1a9a94 100644 --- a/src/insets/InsetGraphics.h +++ b/src/insets/InsetGraphics.h @@ -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 &); /// diff --git a/src/insets/InsetHyperlink.h b/src/insets/InsetHyperlink.h index 21947cc93b..d4f7a123e6 100644 --- a/src/insets/InsetHyperlink.h +++ b/src/insets/InsetHyperlink.h @@ -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()); diff --git a/src/mathed/InsetMathHull.h b/src/mathed/InsetMathHull.h index e866874bcf..c20de9edf5 100644 --- a/src/mathed/InsetMathHull.h +++ b/src/mathed/InsetMathHull.h @@ -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 &);