-InsetCaption const * InsetCollapsable::getCaptionInset() const
-{
- 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) {
- InsetCaption const * ins =
- static_cast<InsetCaption const *>(it->inset);
- return ins;
- }
- }
- }
- return 0;
-}
-
-
-docstring InsetCollapsable::getCaptionText(OutputParams const & runparams) const
-{
- if (paragraphs().empty())
- return docstring();
-
- InsetCaption const * ins = getCaptionInset();
- if (ins == 0)
- return docstring();
-
- odocstringstream ods;
- ins->getCaptionText(ods, runparams);
- return ods.str();
-}
-
-
-docstring InsetCollapsable::getCaptionHTML(OutputParams const & runparams) const
-{
- if (paragraphs().empty())
- return docstring();
-
- InsetCaption const * ins = getCaptionInset();
- if (ins == 0)
- return docstring();
-
- odocstringstream ods;
- docstring def = ins->getCaptionHTML(ods, runparams);
- if (!def.empty())
- ods << def << '\n';
- return ods.str();
-}
-
-