mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Full text in toc for index entries.
* Text::asString(): new method. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26601 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7c8851a45b
commit
45cd1149e4
19
src/Text.cpp
19
src/Text.cpp
@ -1489,6 +1489,25 @@ docstring Text::getPossibleLabel(Cursor const & cur) const
|
||||
}
|
||||
|
||||
|
||||
docstring Text::asString(int options) const
|
||||
{
|
||||
return asString(0, pars_.size(), options);
|
||||
}
|
||||
|
||||
|
||||
docstring Text::asString(pit_type beg, pit_type end, int options) const
|
||||
{
|
||||
size_t i = size_t(beg);
|
||||
docstring str = pars_[i].asString(options);
|
||||
for (++i; i != size_t(end); ++i) {
|
||||
str += '\n';
|
||||
str += pars_[i].asString(options);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Text::charsTranspose(Cursor & cur)
|
||||
{
|
||||
LASSERT(this == cur.text(), /**/);
|
||||
|
11
src/Text.h
11
src/Text.h
@ -108,6 +108,17 @@ public:
|
||||
/// FIXME: replace Cursor with DocIterator.
|
||||
docstring getStringToIndex(Cursor const & cur);
|
||||
|
||||
/// Convert the paragraphs to a string.
|
||||
/// \param AsStringParameter options. This can contain any combination of
|
||||
/// asStringParameter values. Valid examples:
|
||||
/// asString(AS_STR_LABEL)
|
||||
/// asString(AS_STR_LABEL | AS_STR_INSETS)
|
||||
/// asString(AS_STR_INSETS)
|
||||
docstring asString(int options = AS_STR_NONE) const;
|
||||
///
|
||||
docstring asString(pit_type beg, pit_type end,
|
||||
int options = AS_STR_NONE) const;
|
||||
|
||||
/// insert a character at cursor position
|
||||
/// FIXME: replace Cursor with DocIterator.
|
||||
void insertChar(Cursor & cur, char_type c);
|
||||
|
@ -230,7 +230,7 @@ int InsetBranch::docbook(odocstream & os,
|
||||
void InsetBranch::textString(odocstream & os) const
|
||||
{
|
||||
if (isBranchSelected())
|
||||
os << paragraphs().begin()->asString(AS_STR_LABEL | AS_STR_INSETS);
|
||||
os << text().asString(0, 1, AS_STR_LABEL | AS_STR_INSETS);
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,7 +109,7 @@ int InsetFlex::docbook(odocstream & os, OutputParams const & runparams) const
|
||||
|
||||
void InsetFlex::textString(odocstream & os) const
|
||||
{
|
||||
os << paragraphs().begin()->asString(AS_STR_LABEL | AS_STR_INSETS);
|
||||
os << text().asString(0, 1, AS_STR_LABEL | AS_STR_INSETS);
|
||||
}
|
||||
|
||||
|
||||
|
@ -171,15 +171,19 @@ void InsetIndex::write(ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetIndex::textString(odocstream & os) const
|
||||
{
|
||||
os << text().asString(0, 1, AS_STR_LABEL | AS_STR_INSETS);
|
||||
}
|
||||
|
||||
|
||||
void InsetIndex::addToToc(DocIterator const & cpit)
|
||||
{
|
||||
DocIterator pit = cpit;
|
||||
pit.push_back(CursorSlice(*this));
|
||||
|
||||
Toc & toc = buffer().tocBackend().toc("index");
|
||||
docstring str;
|
||||
str = getNewLabel(str);
|
||||
toc.push_back(TocItem(pit, 0, str));
|
||||
odocstringstream ods;
|
||||
textString(ods);
|
||||
buffer().tocBackend().toc("index").push_back(TocItem(pit, 0, ods.str()));
|
||||
// Proceed with the rest of the inset.
|
||||
InsetCollapsable::addToToc(cpit);
|
||||
}
|
||||
|
@ -41,6 +41,8 @@ private:
|
||||
/// should paragraph indendation be omitted in any case?
|
||||
bool neverIndent() const { return true; }
|
||||
///
|
||||
void textString(odocstream &) const;
|
||||
///
|
||||
void addToToc(DocIterator const &);
|
||||
///
|
||||
Inset * clone() const { return new InsetIndex(*this); }
|
||||
|
Loading…
Reference in New Issue
Block a user