mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-14 15:05:56 +00:00
Implement Paragraph::getLabel()
This function returns the first label (as string) if there is any
(cherry picked from commit a303600b54
)
This commit is contained in:
parent
18d9d7ee9d
commit
dcc91b4a85
@ -3337,6 +3337,21 @@ string Paragraph::getID(Buffer const &, OutputParams const &)
|
||||
}
|
||||
|
||||
|
||||
string Paragraph::getLabel() const
|
||||
{
|
||||
for (pos_type i = 0; i < size(); ++i) {
|
||||
if (Inset const * inset = getInset(i)) {
|
||||
InsetCode lyx_code = inset->lyxCode();
|
||||
if (lyx_code == LABEL_CODE) {
|
||||
InsetLabel const * const il = static_cast<InsetLabel const *>(inset);
|
||||
return to_utf8(il->getParam("name"));
|
||||
}
|
||||
}
|
||||
}
|
||||
return string();
|
||||
}
|
||||
|
||||
|
||||
pos_type Paragraph::firstWordDocBook(XMLStream & xs, OutputParams const & runparams) const
|
||||
{
|
||||
pos_type i;
|
||||
|
@ -201,6 +201,9 @@ public:
|
||||
/// Get the id of the paragraph, useful for DocBook
|
||||
std::string getID(Buffer const & buf, OutputParams const & runparams) const;
|
||||
|
||||
/// Get the (first) string of a \label in this paragraph, or empty string
|
||||
std::string getLabel() const;
|
||||
|
||||
/// Output the first word of a paragraph, return the position where it left.
|
||||
pos_type firstWordDocBook(XMLStream & xs, OutputParams const & runparams) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user