X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetBranch.h;h=b608fd19cc1a7a509331095e908eeee5dfed3f5f;hb=d6f1915684328c6e3fe61c6eef8846b5cabec334;hp=8793602a2e1299bcea5305387d395a26e9d79929;hpb=82a738b853207f8f2cc93545c2125fdc673fffc0;p=lyx.git diff --git a/src/insets/InsetBranch.h b/src/insets/InsetBranch.h index 8793602a2e..b608fd19cc 100644 --- a/src/insets/InsetBranch.h +++ b/src/insets/InsetBranch.h @@ -13,13 +13,13 @@ #define INSETBRANCH_H #include "InsetCollapsable.h" -#include "MailInset.h" namespace lyx { class InsetBranchParams { public: + /// explicit InsetBranchParams(docstring const & b = docstring()) : branch(b) {} /// @@ -31,15 +31,28 @@ 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(); + + /// + static std::string params2string(InsetBranchParams const &); + /// + static void string2params(std::string const &, InsetBranchParams &); + +private: /// docstring editMessage() const; /// @@ -51,7 +64,7 @@ public: /// void setButtonLabel(); /// - virtual ColorCode backgroundColor() const; + ColorCode backgroundColor() const; /// bool showInsetDialog(BufferView *) const; /// @@ -65,59 +78,44 @@ public: /// void validate(LaTeXFeatures &) const; /// + void addToToc(DocIterator const &); + /// InsetBranchParams const & params() const { return params_; } /// void setParams(InsetBranchParams const & params) { params_ = params; } + /// + virtual bool usePlainLayout() { return false; } /** \returns true if params_.branch is listed as 'selected' in \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; /// 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