Hi!
Martin --- thanks for all your work towards the ForceLTR option!
The attached patch uses this option in order to make sure that insets
which define this option are put in an LTR environment if they are in
RTL surroundings (which is why I originally asked for this option).
To this end, I also define two new functions:
1) An accessor method InsetCollapsable::ForceLTR
2) The virtual Inset::asCollapsableInset for identifying insets which
are (or inherit from) Collapsable. (Similar to asTextInset, asMathInset).
Please look this over, I will commit in the next few days if there are
no objections.
Dov
diff -r 14ceb06dbd35 src/Paragraph.cpp
--- a/src/Paragraph.cpp Wed Oct 31 00:15:34 2007 +0200
+++ b/src/Paragraph.cpp Wed Oct 31 00:40:23 2007 +0200
@@ -718,7 +718,11 @@ void Paragraph::Private::latexInset(Buff
if ((inset->lyxCode() == GRAPHICS_CODE
|| inset->lyxCode() == MATH_CODE
- || inset->lyxCode() == HYPERLINK_CODE)
+ || inset->lyxCode() == HYPERLINK_CODE
+ || (inset->asCollapsableInset()
+ && inset->asCollapsableInset()->forceLTR()
+ // ERT is an exception, since it doesn't go to output
+ && inset->lyxCode() != ERT_CODE))
&& running_font.isRightToLeft()) {
if (running_font.language()->lang() == "farsi")
os << "\\beginL{}";
diff -r 14ceb06dbd35 src/insets/Inset.h
--- a/src/insets/Inset.h Wed Oct 31 00:15:34 2007 +0200
+++ b/src/insets/Inset.h Wed Oct 31 00:40:23 2007 +0200
@@ -36,6 +36,7 @@ class CursorSlice;
class CursorSlice;
class FuncRequest;
class FuncStatus;
+class InsetCollapsable;
class InsetIterator;
class InsetLayout;
class InsetList;
@@ -90,7 +91,11 @@ public:
virtual InsetText * asTextInset() { return 0; }
/// is this inset based on the TextInset class?
virtual InsetText const * asTextInset() const { return 0; }
-
+ /// is this inset based on the CollapsableInset class?
+ virtual InsetCollapsable * asCollapsableInset() { return 0; }
+ /// is this inset based on the CollapsableInset class?
+ virtual InsetCollapsable const * asCollapsableInset() const { return 0;
}
+
/// the real dispatcher
void dispatch(Cursor & cur, FuncRequest & cmd);
/**
diff -r 14ceb06dbd35 src/insets/InsetCollapsable.h
--- a/src/insets/InsetCollapsable.h Wed Oct 31 00:15:34 2007 +0200
+++ b/src/insets/InsetCollapsable.h Wed Oct 31 00:40:23 2007 +0200
@@ -132,6 +132,11 @@ public:
///
virtual ColorCode backgroundColor() const {return layout_.bgcolor; }
+ ///
+ InsetCollapsable * asCollapsableInset() { return this; }
+ ///
+ InsetCollapsable const * asCollapsableInset() const { return this; }
+
int latex(Buffer const &, odocstream &,
OutputParams const &) const;
///
@@ -143,6 +148,8 @@ 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
+ virtual bool forceLTR() const { return layout_.forceltr; }
protected:
///