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; bool close = false;
odocstream::pos_type const len = os.tellp(); odocstream::pos_type const len = os.tellp();
if ((inset->lyxCode() == GRAPHICS_CODE if (inset->forceLTR()
|| inset->lyxCode() == MATH_CODE && running_font.isRightToLeft()
|| inset->lyxCode() == HYPERLINK_CODE // ERT is an exception, it should be output with no decorations at all
|| (inset->asInsetCollapsable() && inset->lyxCode() != ERT_CODE) {
&& inset->asInsetCollapsable()->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") if (running_font.language()->lang() == "farsi")
os << "\\beginL{}"; os << "\\beginL{}";
else else

View File

@ -164,6 +164,8 @@ public:
virtual bool isFreeSpacing() const { return false; } virtual bool isFreeSpacing() const { return false; }
/// ///
virtual bool allowEmpty() 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? /// is this an inset that can be moved into?
/// FIXME: merge with editable() /// FIXME: merge with editable()

View File

@ -147,7 +147,7 @@ public:
virtual bool isFreeSpacing() const { return layout_->freespacing; } virtual bool isFreeSpacing() const { return layout_->freespacing; }
/// Don't eliminate empty paragraphs /// Don't eliminate empty paragraphs
virtual bool allowEmpty() const { return layout_->keepempty; } 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; } virtual bool forceLTR() const { return layout_->forceltr; }
protected: protected:

View File

@ -82,6 +82,8 @@ public:
void registerEmbeddedFiles(Buffer const &, EmbeddedFiles &) const; void registerEmbeddedFiles(Buffer const &, EmbeddedFiles &) const;
/// ///
void updateEmbeddedFile(Buffer const &, EmbeddedFile const &); void updateEmbeddedFile(Buffer const &, EmbeddedFile const &);
/// Force inset into LTR environment if surroundings are RTL?
virtual bool forceLTR() const { return true; }
protected: protected:
InsetGraphics(InsetGraphics const &); InsetGraphics(InsetGraphics const &);
/// ///

View File

@ -56,6 +56,8 @@ public:
/// ///
static bool isCompatibleCommand(std::string const & s) static bool isCompatibleCommand(std::string const & s)
{ return s == "href"; } { return s == "href"; }
/// Force inset into LTR environment if surroundings are RTL?
virtual bool forceLTR() const { return true; }
private: private:
virtual Inset * clone() const { virtual Inset * clone() const {
return new InsetHyperlink(params()); return new InsetHyperlink(params());

View File

@ -121,6 +121,9 @@ public:
/// ///
static int displayMargin() { return 12; } static int displayMargin() { return 12; }
/// Force inset into LTR environment if surroundings are RTL?
virtual bool forceLTR() const { return true; }
protected: protected:
InsetMathHull(InsetMathHull const &); InsetMathHull(InsetMathHull const &);