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
This commit is contained in:
Dov Feldstern 2007-11-05 23:44:47 +00:00
parent 31617cf92a
commit 7bf4f48a4a
6 changed files with 14 additions and 9 deletions

View 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

View 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()

View 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:

View 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 &);
///

View 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());

View 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 &);