RTL fixes (drawing of text in tabulars, reverse parenthesis when exporting

to ASCII/copying to clipboard).


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_1_6@1480 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Dekel Tsur 2001-02-11 10:20:32 +00:00
parent 33d134c972
commit 7b3c57e57e
6 changed files with 71 additions and 10 deletions

View File

@ -1,3 +1,15 @@
2001-02-10 Dekel Tsur <dekelts@tau.ac.il>
* src/insets/insettext.C (LocalDispatch): Restore the language
if the inset becomes empty.
* src/text.C (PrepareToPrint): Fix for RTL text in tabulars.
* src/paragraph.C (GetUChar): New method.
(String): Use GetUChar.
* src/buffer.C (asciiParagraph): Use GetUChar.
2001-02-02 Dekel Tsur <dekelts@tau.ac.il>
* LaTeX.C (scanAuxFile): A rewrite of this method. It now returns

View File

@ -1496,7 +1496,7 @@ string const Buffer::asciiParagraph(LyXParagraph const * par,
} else {
islatex = 0;
}
c = par->GetChar(i);
c = par->GetUChar(params, i);
if (islatex)
continue;
switch (c) {

View File

@ -1102,6 +1102,15 @@ InsetText::LocalDispatch(BufferView * bv,
result = UNDISPATCHED;
break;
}
/// If the action has deleted all text in the inset, we need to change the
// language to the language to the surronding text.
if (par->Last() == 0 && !par->next) {
LyXFont font(LyXFont::ALL_IGNORE);
font.setLanguage(bv->getParentLanguage(this));
SetFont(bv, font, false);
}
if (result != FINISHED) {
ShowInsetCursor(bv);
} else

View File

@ -441,6 +441,8 @@ public:
LyXFont const getFont(BufferParams const &, size_type pos) const;
///
value_type GetChar(size_type pos) const;
///
value_type GetUChar(BufferParams const &, size_type pos) const;
/// The position must already exist.
void SetChar(size_type pos, value_type c) {
#ifndef HAVE_ROPE

View File

@ -1018,6 +1018,47 @@ LyXParagraph::GetChar(LyXParagraph::size_type pos) const
}
LyXParagraph::value_type
LyXParagraph::GetUChar(BufferParams const & bparams,
LyXParagraph::size_type pos) const
{
value_type c = GetChar(pos);
if (!lyxrc.rtl_support)
return c;
value_type uc = c;
switch (c) {
case '(':
uc = ')';
break;
case ')':
uc = '(';
break;
case '[':
uc = ']';
break;
case ']':
uc = '[';
break;
case '{':
uc = '}';
break;
case '}':
uc = '{';
break;
case '<':
uc = '>';
break;
case '>':
uc = '<';
break;
}
if (uc != c && GetFontSettings(bparams, pos).isRightToLeft())
return uc;
else
return c;
}
// return an string of the current word, and the end of the word in lastpos.
string const LyXParagraph::GetWord(LyXParagraph::size_type & lastpos) const
{
@ -3991,7 +4032,7 @@ string const LyXParagraph::String(Buffer const * buffer,
s += labelstring + ' ';
for (LyXParagraph::size_type i = beg; i < end; ++i) {
value_type c = GetChar(i);
value_type c = GetUChar(buffer->params, i);
if (IsPrintable(c))
s += c;
else if (c == META_INSET) {

View File

@ -2196,21 +2196,18 @@ void LyXText::PrepareToPrint(BufferView * bview,
bool const is_rtl =
row->par()->isRightToLeftPar(bview->buffer()->params);
#ifndef NEW_INSETS
if (is_rtl) {
x = RightMargin(bview->buffer(), row);
x = (workWidth(bview) > 0)
? RightMargin(bview->buffer(), row) : 0;
#ifndef NEW_INSETS
if (row->par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) {
LyXFont font(LyXFont::ALL_SANE);
font.setSize(LyXFont::SIZE_SMALL);
x += lyxfont::width("Mwide-figM", font);
}
} else
#endif
if (workWidth(bview) > 0)
x = LeftMargin(bview, row);
else
x = 0;
} else
x = (workWidth(bview) > 0) ? LeftMargin(bview, row) : 0;
// is there a manual margin with a manual label
if (textclasslist.Style(bview->buffer()->params.textclass,