X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetBranch.h;h=c51c728e4f1610a4ce2a070a2cd11087f6240e78;hb=bfddee97e191a853f0576f4fab3f095c4e9ce0de;hp=8793602a2e1299bcea5305387d395a26e9d79929;hpb=82a738b853207f8f2cc93545c2125fdc673fffc0;p=lyx.git diff --git a/src/insets/InsetBranch.h b/src/insets/InsetBranch.h index 8793602a2e..c51c728e4f 100644 --- a/src/insets/InsetBranch.h +++ b/src/insets/InsetBranch.h @@ -13,13 +13,12 @@ #define INSETBRANCH_H #include "InsetCollapsable.h" -#include "MailInset.h" - namespace lyx { class InsetBranchParams { public: + /// explicit InsetBranchParams(docstring const & b = docstring()) : branch(b) {} /// @@ -31,17 +30,30 @@ public: }; -/** The Branch inset for alternative, conditional output. +///////////////////////////////////////////////////////////////////////// +// +// InsetBranch +// +///////////////////////////////////////////////////////////////////////// + +/// The Branch inset for alternative, conditional output. -*/ -class InsetBranch : public InsetCollapsable { +class InsetBranch : public InsetCollapsable +{ public: /// - InsetBranch(Buffer const &, InsetBranchParams const &); + InsetBranch(Buffer *, InsetBranchParams const &); + /// - ~InsetBranch(); + static std::string params2string(InsetBranchParams const &); /// - docstring editMessage() const; + static void string2params(std::string const &, InsetBranchParams &); + /// + docstring branch() const { return params_.branch; } + /// + void rename(docstring const & newname) { params_.branch = newname; } + +private: /// InsetCode lyxCode() const { return BRANCH_CODE; } /// @@ -49,22 +61,28 @@ public: /// void read(Lexer & lex); /// - void setButtonLabel(); + docstring const buttonLabel(BufferView const & bv) const; /// - virtual ColorCode backgroundColor() const; + ColorCode backgroundColor(PainterInfo const &) const; /// - bool showInsetDialog(BufferView *) const; - /// - int latex(odocstream &, OutputParams const &) const; + void latex(otexstream &, OutputParams const &) const; /// int plaintext(odocstream &, OutputParams const &) const; /// int docbook(odocstream &, OutputParams const &) const; /// - void textString(odocstream &) const; + docstring xhtml(XHTMLStream &, OutputParams const &) const; + /// + void toString(odocstream &) const; + /// + void forToc(docstring &, size_t) const; /// void validate(LaTeXFeatures &) const; /// + docstring contextMenuName() const; + /// + void addToToc(DocIterator const &) const; + /// InsetBranchParams const & params() const { return params_; } /// void setParams(InsetBranchParams const & params) { params_ = params; } @@ -73,51 +91,32 @@ public: \c buffer. This handles the case of child documents. */ bool isBranchSelected() const; + /*! + * Is the content of this inset part of the output document? + * + * Note that Branch insets are only considered part of the + * document when they are selected. + */ + bool producesOutput() const { return isBranchSelected(); } /// bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; /// - virtual void updateLabels(ParIterator const &); - /// bool isMacroScope() const; /// docstring toolTip(BufferView const & bv, int x, int y) const; /// - virtual bool useEmptyLayout() const { return false; } -protected: + bool usePlainLayout() const { return false; } /// void doDispatch(Cursor & cur, FuncRequest & cmd); /// - docstring name() const { return from_ascii("Branch"); } -private: - /// - friend class InsetBranchParams; + docstring layoutName() const { return from_ascii("Branch"); } /// Inset * clone() const { return new InsetBranch(*this); } - /// - InsetBranchParams params_; -}; - -class InsetBranchMailer : public MailInset { -public: - /// - InsetBranchMailer(InsetBranch & inset); - /// - virtual Inset & inset() const { return inset_; } - /// - virtual std::string const & name() const { return name_; } /// - virtual std::string const inset2string(Buffer const &) const; - /// - static std::string const params2string(InsetBranchParams const &); - /// - static void string2params(std::string const &, InsetBranchParams &); - -private: - /// - static std::string const name_; + friend class InsetBranchParams; /// - InsetBranch & inset_; + InsetBranchParams params_; }; } // namespace lyx