mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-26 18:07:18 +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,
|
docstring InsetCaption::xhtml(odocstream &,
|
||||||
OutputParams const & runparams) const
|
OutputParams const &) const
|
||||||
{
|
{
|
||||||
return docstring();
|
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
|
OutputParams const & runparams) const
|
||||||
{
|
{
|
||||||
os << full_label_ << ' ';
|
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
|
OutputParams const & runparams) const
|
||||||
{
|
{
|
||||||
os << full_label_ << ' ';
|
os << full_label_ << ' ';
|
||||||
|
@ -29,9 +29,9 @@ public:
|
|||||||
/// return the optional argument(s) only
|
/// return the optional argument(s) only
|
||||||
int getOptArg(odocstream & os, OutputParams const &) const;
|
int getOptArg(odocstream & os, OutputParams const &) const;
|
||||||
/// return the caption text
|
/// return the caption text
|
||||||
int getCaptionText(odocstream & os, OutputParams const &) const;
|
int getCaptionAsPlaintext(odocstream & os, OutputParams const &) const;
|
||||||
/// return the caption text as HTML
|
/// return the caption text as HTML
|
||||||
docstring getCaptionHTML(odocstream & os, OutputParams const &) const;
|
docstring getCaptionAsHTML(odocstream & os, OutputParams const &) const;
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
void write(std::ostream & os) const;
|
void write(std::ostream & os) const;
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "FloatList.h"
|
#include "FloatList.h"
|
||||||
#include "FuncRequest.h"
|
#include "FuncRequest.h"
|
||||||
#include "FuncStatus.h"
|
#include "FuncStatus.h"
|
||||||
#include "InsetCaption.h"
|
|
||||||
#include "InsetLayout.h"
|
#include "InsetLayout.h"
|
||||||
#include "InsetList.h"
|
#include "InsetList.h"
|
||||||
#include "Language.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
|
InsetLayout::InsetDecoration InsetCollapsable::decoration() const
|
||||||
{
|
{
|
||||||
if (!layout_)
|
if (!layout_)
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
|
|
||||||
class CursorSlice;
|
class CursorSlice;
|
||||||
class InsetCaption;
|
|
||||||
class InsetLayout;
|
class InsetLayout;
|
||||||
|
|
||||||
namespace frontend { class Painter; }
|
namespace frontend { class Painter; }
|
||||||
@ -181,12 +180,6 @@ protected:
|
|||||||
///
|
///
|
||||||
virtual void resetParagraphsFont();
|
virtual void resetParagraphsFont();
|
||||||
///
|
///
|
||||||
InsetCaption const * getCaptionInset() const;
|
|
||||||
///
|
|
||||||
docstring getCaptionText(OutputParams const &) const;
|
|
||||||
///
|
|
||||||
docstring getCaptionHTML(OutputParams const &) const;
|
|
||||||
///
|
|
||||||
mutable CollapseStatus status_;
|
mutable CollapseStatus status_;
|
||||||
private:
|
private:
|
||||||
/// cache for the layout_. Make sure it is in sync with the document class!
|
/// cache for the layout_. Make sure it is in sync with the document class!
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "ErrorList.h"
|
#include "ErrorList.h"
|
||||||
#include "FuncRequest.h"
|
#include "FuncRequest.h"
|
||||||
#include "FuncStatus.h"
|
#include "FuncStatus.h"
|
||||||
|
#include "InsetCaption.h"
|
||||||
#include "InsetList.h"
|
#include "InsetList.h"
|
||||||
#include "Intl.h"
|
#include "Intl.h"
|
||||||
#include "Lexer.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
|
} // namespace lyx
|
||||||
|
@ -26,6 +26,7 @@ class CompletionList;
|
|||||||
class CursorSlice;
|
class CursorSlice;
|
||||||
class Dimension;
|
class Dimension;
|
||||||
class ParagraphList;
|
class ParagraphList;
|
||||||
|
class InsetCaption;
|
||||||
class InsetTabular;
|
class InsetTabular;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -176,6 +177,13 @@ public:
|
|||||||
virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
|
virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||||
///
|
///
|
||||||
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
||||||
|
protected:
|
||||||
|
///
|
||||||
|
InsetCaption const * getCaptionInset() const;
|
||||||
|
///
|
||||||
|
docstring getCaptionText(OutputParams const &) const;
|
||||||
|
///
|
||||||
|
docstring getCaptionHTML(OutputParams const &) const;
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
void initParagraphs(UsePlain type);
|
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)
|
void InsetWrap::string2params(string const & in, InsetWrapParams & params)
|
||||||
{
|
{
|
||||||
params = InsetWrapParams();
|
params = InsetWrapParams();
|
||||||
|
@ -85,8 +85,6 @@ private:
|
|||||||
///
|
///
|
||||||
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
||||||
///
|
///
|
||||||
docstring getCaptionText(OutputParams const &) const;
|
|
||||||
///
|
|
||||||
docstring name() const;
|
docstring name() const;
|
||||||
///
|
///
|
||||||
Inset * clone() const { return new InsetWrap(*this); }
|
Inset * clone() const { return new InsetWrap(*this); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user