mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
Factor out some code for later use (and to remove duplication).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30177 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c4675cc4be
commit
dd11fc928f
@ -435,29 +435,39 @@ void InsetFloat::setNewLabel(BufferParams const & bp)
|
||||
}
|
||||
|
||||
|
||||
docstring InsetFloat::getCaption(OutputParams const & runparams) const
|
||||
InsetCaption const * InsetFloat::getCaptionInset() const
|
||||
{
|
||||
if (paragraphs().empty())
|
||||
return docstring();
|
||||
|
||||
ParagraphList::const_iterator pit = paragraphs().begin();
|
||||
for (; pit != paragraphs().end(); ++pit) {
|
||||
InsetList::const_iterator it = pit->insetList().begin();
|
||||
for (; it != pit->insetList().end(); ++it) {
|
||||
Inset & inset = *it->inset;
|
||||
if (inset.lyxCode() == CAPTION_CODE) {
|
||||
odocstringstream ods;
|
||||
InsetCaption * ins =
|
||||
static_cast<InsetCaption *>(it->inset);
|
||||
ins->getOptArg(ods, runparams);
|
||||
ods << '[';
|
||||
ins->getArgument(ods, runparams);
|
||||
ods << ']';
|
||||
return ods.str();
|
||||
InsetCaption const * ins =
|
||||
static_cast<InsetCaption const *>(it->inset);
|
||||
return ins;
|
||||
}
|
||||
}
|
||||
}
|
||||
return docstring();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
docstring InsetFloat::getCaption(OutputParams const & runparams) const
|
||||
{
|
||||
if (paragraphs().empty())
|
||||
return docstring();
|
||||
|
||||
InsetCaption const * ins = getCaptionInset();
|
||||
if (ins == 0)
|
||||
return docstring();
|
||||
|
||||
odocstringstream ods;
|
||||
ins->getOptArg(ods, runparams);
|
||||
ods << '[';
|
||||
ins->getArgument(ods, runparams);
|
||||
ods << ']';
|
||||
return ods.str();
|
||||
}
|
||||
|
||||
|
||||
@ -466,21 +476,13 @@ docstring InsetFloat::getCaptionText(OutputParams const & runparams) const
|
||||
if (paragraphs().empty())
|
||||
return docstring();
|
||||
|
||||
ParagraphList::const_iterator pit = paragraphs().begin();
|
||||
for (; pit != paragraphs().end(); ++pit) {
|
||||
InsetList::const_iterator it = pit->insetList().begin();
|
||||
for (; it != pit->insetList().end(); ++it) {
|
||||
Inset & inset = *it->inset;
|
||||
if (inset.lyxCode() == CAPTION_CODE) {
|
||||
odocstringstream ods;
|
||||
InsetCaption * ins =
|
||||
static_cast<InsetCaption *>(it->inset);
|
||||
ins->getCaptionText(ods, runparams);
|
||||
return ods.str();
|
||||
}
|
||||
}
|
||||
}
|
||||
return docstring();
|
||||
InsetCaption const * ins = getCaptionInset();
|
||||
if (ins == 0)
|
||||
return docstring();
|
||||
|
||||
odocstringstream ods;
|
||||
ins->getCaptionText(ods, runparams);
|
||||
return ods.str();
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
namespace lyx {
|
||||
|
||||
class InsetCaption;
|
||||
|
||||
class InsetFloatParams {
|
||||
public:
|
||||
///
|
||||
@ -111,6 +113,8 @@ private:
|
||||
///
|
||||
docstring getCaptionText(OutputParams const &) const;
|
||||
///
|
||||
InsetCaption const * getCaptionInset() const;
|
||||
///
|
||||
InsetFloatParams params_;
|
||||
///
|
||||
docstring name_;
|
||||
|
Loading…
Reference in New Issue
Block a user