patch from Dekel

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@767 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-05-23 19:53:56 +00:00
parent 2649fe2b52
commit b18c63a393
5 changed files with 40 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2000-05-21 Dekel Tsur <dekel@math.tau.ac.il>
* src/paragraph.C (String): Several fixes/improvements
* src/insets/insetbib.[Ch] (InsetCitation::Ascii) New method
2000-05-22 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/paragraph.C (String): give more correct output.

View File

@ -204,6 +204,11 @@ string InsetCitation::getScreenLabel() const
return temp + ']';
}
int InsetCitation::Ascii(ostream & os) const
{
os << getScreenLabel();;
return 0;
}
InsetBibKey::InsetBibKey(string const & key, string const & label):
InsetCommand("bibitem", key, label)

View File

@ -43,6 +43,7 @@ public:
EDITABLE Editable() const {
return IS_EDITABLE;
}
int Ascii(std::ostream &) const;
///
struct Holder {
InsetCitation * inset;

View File

@ -4276,7 +4276,7 @@ bool LyXParagraph::isMultiLingual()
string LyXParagraph::String(bool label)
{
string s;
if (label && !IsDummy())
if (label && !IsDummy() && !labelstring.empty())
s += labelstring + ' ';
string::size_type len = s.size();
@ -4313,6 +4313,20 @@ string LyXParagraph::String(LyXParagraph::size_type beg,
LyXParagraph::size_type end)
{
string s;
int actcell = 0;
int cell = 1;
if (table)
for (LyXParagraph::size_type i = 0; i < beg; ++i)
if (IsNewline(i)) {
if (cell >= table->NumberOfCellsInRow(actcell))
cell = 1;
else
++cell;
++actcell;
}
if (beg == 0 && !IsDummy() && !labelstring.empty())
s += labelstring + ' ';
for (LyXParagraph::size_type i = beg; i < end; ++i) {
unsigned char c = GetChar(i);
@ -4327,16 +4341,21 @@ string LyXParagraph::String(LyXParagraph::size_type beg,
GetInset(i)->Ascii(ost);
ost << '\0';
#endif
s += subst(ost.str(),'\n',' ');
s += ost.str();
} else if (table && IsNewlineChar(c)) {
if (cell >= table->NumberOfCellsInRow(actcell)) {
s += '\n';
cell = 1;
} else {
s += ' ';
++cell;
}
++actcell;
}
}
//if (next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE)
// s += NextAfterFootnote()->String(false);
if (!IsDummy()) {
if (isRightToLeftPar())
reverse(s.begin(), s.end());
}
return s;
}

View File

@ -1086,13 +1086,14 @@ string LyXText::selectionAsString() const
// First paragraph in selection
result += sel_start_cursor.par->String(sel_start_cursor.pos,
sel_start_cursor.par->Last());
sel_start_cursor.par->Last())
+ "\n\n";
// The paragraphs in between (if any)
LyXCursor tmpcur(sel_start_cursor);
tmpcur.par = tmpcur.par->Next();
while (tmpcur.par != sel_end_cursor.par) {
result += tmpcur.par->String(false);
result += tmpcur.par->String(0, tmpcur.par->Last()) + "\n\n";
tmpcur.par = tmpcur.par->Next(); // Or NextAfterFootnote??
}