mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 11:08:41 +00:00
Polish some of the recent changes in accord with suggestions
of JMarc's. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30186 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
51d4d42906
commit
3b707bc0ed
@ -256,8 +256,8 @@ int InsetCaption::docbook(odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
docstring InsetCaption::xhtml(odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
docstring InsetCaption::xhtml(odocstream &,
|
||||
OutputParams const &) const
|
||||
{
|
||||
return docstring();
|
||||
}
|
||||
@ -276,7 +276,7 @@ int InsetCaption::getOptArg(odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetCaption::getCaptionText(odocstream & os,
|
||||
int InsetCaption::getCaptionAsPlaintext(odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
os << full_label_ << ' ';
|
||||
@ -284,7 +284,7 @@ int InsetCaption::getCaptionText(odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
docstring InsetCaption::getCaptionHTML(odocstream & os,
|
||||
docstring InsetCaption::getCaptionAsHTML(odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
os << full_label_ << ' ';
|
||||
|
@ -29,9 +29,9 @@ public:
|
||||
/// return the optional argument(s) only
|
||||
int getOptArg(odocstream & os, OutputParams const &) const;
|
||||
/// return the caption text
|
||||
int getCaptionText(odocstream & os, OutputParams const &) const;
|
||||
int getCaptionAsPlaintext(odocstream & os, OutputParams const &) const;
|
||||
/// return the caption text as HTML
|
||||
docstring getCaptionHTML(odocstream & os, OutputParams const &) const;
|
||||
docstring getCaptionAsHTML(odocstream & os, OutputParams const &) const;
|
||||
private:
|
||||
///
|
||||
void write(std::ostream & os) const;
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "FloatList.h"
|
||||
#include "FuncRequest.h"
|
||||
#include "FuncStatus.h"
|
||||
#include "InsetCaption.h"
|
||||
#include "InsetLayout.h"
|
||||
#include "InsetList.h"
|
||||
#include "Language.h"
|
||||
@ -784,56 +783,6 @@ docstring InsetCollapsable::floatName(
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
InsetLayout::InsetDecoration InsetCollapsable::decoration() const
|
||||
{
|
||||
if (!layout_)
|
||||
|
@ -23,7 +23,6 @@
|
||||
namespace lyx {
|
||||
|
||||
class CursorSlice;
|
||||
class InsetCaption;
|
||||
class InsetLayout;
|
||||
|
||||
namespace frontend { class Painter; }
|
||||
@ -181,12 +180,6 @@ protected:
|
||||
///
|
||||
virtual void resetParagraphsFont();
|
||||
///
|
||||
InsetCaption const * getCaptionInset() const;
|
||||
///
|
||||
docstring getCaptionText(OutputParams const &) const;
|
||||
///
|
||||
docstring getCaptionHTML(OutputParams const &) const;
|
||||
///
|
||||
mutable CollapseStatus status_;
|
||||
private:
|
||||
/// cache for the layout_. Make sure it is in sync with the document class!
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "ErrorList.h"
|
||||
#include "FuncRequest.h"
|
||||
#include "FuncStatus.h"
|
||||
#include "InsetCaption.h"
|
||||
#include "InsetList.h"
|
||||
#include "Intl.h"
|
||||
#include "Lexer.h"
|
||||
@ -651,4 +652,48 @@ docstring InsetText::contextMenu(BufferView const &, int, int) const
|
||||
}
|
||||
|
||||
|
||||
InsetCaption const * InsetText::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 InsetText::getCaptionText(OutputParams const & runparams) const
|
||||
{
|
||||
InsetCaption const * ins = getCaptionInset();
|
||||
if (ins == 0)
|
||||
return docstring();
|
||||
|
||||
odocstringstream ods;
|
||||
ins->getCaptionAsPlaintext(ods, runparams);
|
||||
return ods.str();
|
||||
}
|
||||
|
||||
|
||||
docstring InsetText::getCaptionHTML(OutputParams const & runparams) const
|
||||
{
|
||||
InsetCaption const * ins = getCaptionInset();
|
||||
if (ins == 0)
|
||||
return docstring();
|
||||
|
||||
odocstringstream ods;
|
||||
docstring def = ins->getCaptionAsHTML(ods, runparams);
|
||||
if (!def.empty())
|
||||
ods << def << '\n';
|
||||
return ods.str();
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -26,6 +26,7 @@ class CompletionList;
|
||||
class CursorSlice;
|
||||
class Dimension;
|
||||
class ParagraphList;
|
||||
class InsetCaption;
|
||||
class InsetTabular;
|
||||
|
||||
/**
|
||||
@ -176,6 +177,13 @@ public:
|
||||
virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
///
|
||||
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
||||
protected:
|
||||
///
|
||||
InsetCaption const * getCaptionInset() const;
|
||||
///
|
||||
docstring getCaptionText(OutputParams const &) const;
|
||||
///
|
||||
docstring getCaptionHTML(OutputParams const &) const;
|
||||
private:
|
||||
///
|
||||
void initParagraphs(UsePlain type);
|
||||
|
@ -259,29 +259,6 @@ bool InsetWrap::showInsetDialog(BufferView * bv) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetWrap::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();
|
||||
}
|
||||
|
||||
|
||||
void InsetWrap::string2params(string const & in, InsetWrapParams & params)
|
||||
{
|
||||
params = InsetWrapParams();
|
||||
|
@ -85,8 +85,6 @@ private:
|
||||
///
|
||||
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
||||
///
|
||||
docstring getCaptionText(OutputParams const &) const;
|
||||
///
|
||||
docstring name() const;
|
||||
///
|
||||
Inset * clone() const { return new InsetWrap(*this); }
|
||||
|
Loading…
Reference in New Issue
Block a user