X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetBranch.h;h=6106ce5a5c3babbd8923c8783d5e2a2d59cf9b6b;hb=997f0621c5346bb623cf86713c4fe1be0c941104;hp=b608fd19cc1a7a509331095e908eeee5dfed3f5f;hpb=780bce0f96d5a1cccf62358de6c1a10ccdb3c949;p=lyx.git diff --git a/src/insets/InsetBranch.h b/src/insets/InsetBranch.h index b608fd19cc..6106ce5a5c 100644 --- a/src/insets/InsetBranch.h +++ b/src/insets/InsetBranch.h @@ -12,8 +12,7 @@ #ifndef INSETBRANCH_H #define INSETBRANCH_H -#include "InsetCollapsable.h" - +#include "InsetCollapsible.h" namespace lyx { @@ -21,13 +20,17 @@ class InsetBranchParams { public: /// explicit InsetBranchParams(docstring const & b = docstring()) - : branch(b) {} + : branch(b), inverted(false) {} + InsetBranchParams(docstring const & b, bool i) + : branch(b), inverted(i) {} /// void write(std::ostream & os) const; /// void read(Lexer & lex); /// docstring branch; + /// + bool inverted; }; @@ -39,78 +42,79 @@ public: /// The Branch inset for alternative, conditional output. -class InsetBranch : public InsetCollapsable +class InsetBranch : public InsetCollapsible { public: /// - InsetBranch(Buffer const &, InsetBranchParams const &); - /// - ~InsetBranch(); + InsetBranch(Buffer *, InsetBranchParams const &); /// static std::string params2string(InsetBranchParams const &); /// static void string2params(std::string const &, InsetBranchParams &); - -private: /// - docstring editMessage() const; + docstring branch() const { return params_.branch; } /// - InsetCode lyxCode() const { return BRANCH_CODE; } + void rename(docstring const & newname) { params_.branch = newname; } /// - void write(std::ostream &) const; + InsetBranchParams const & params() const { return params_; } + +private: /// - void read(Lexer & lex); + InsetCode lyxCode() const override { return BRANCH_CODE; } /// - void setButtonLabel(); + void write(std::ostream &) const override; /// - ColorCode backgroundColor() const; + void read(Lexer & lex) override; /// - bool showInsetDialog(BufferView *) const; + docstring const buttonLabel(BufferView const &) const override; /// - int latex(odocstream &, OutputParams const &) const; + ColorCode backgroundColor(PainterInfo const &) const override; /// - int plaintext(odocstream &, OutputParams const &) const; + void latex(otexstream &, OutputParams const &) const override; /// - int docbook(odocstream &, OutputParams const &) const; + int plaintext(odocstringstream & ods, OutputParams const & op, + size_t max_length = INT_MAX) const override; /// - void textString(odocstream &) const; + void docbook(XMLStream &, OutputParams const &) const override; /// - void validate(LaTeXFeatures &) const; + docstring xhtml(XMLStream &, OutputParams const &) const override; /// - void addToToc(DocIterator const &); + void toString(odocstream &) const override; /// - InsetBranchParams const & params() const { return params_; } + void forOutliner(docstring &, size_t const, bool const) const override; + /// + void validate(LaTeXFeatures &) const override; /// - void setParams(InsetBranchParams const & params) { params_ = params; } + std::string contextMenuName() const override; /// - virtual bool usePlainLayout() { return false; } + void updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted = false) override; /** \returns true if params_.branch is listed as 'selected' in - \c buffer. This handles the case of child documents. + \c buffer. \p child only checks within child documents. */ - bool isBranchSelected() const; + bool isBranchSelected(bool const child = false) 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. + * Note that Branch insets are considered part of the + * document when they are selected XOR inverted. */ - bool producesOutput() const { return isBranchSelected(); } + bool producesOutput() const override; /// - bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; + bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override; /// - bool isMacroScope() const; + bool isMacroScope() const override; /// - docstring toolTip(BufferView const & bv, int x, int y) const; + docstring toolTip(BufferView const & bv, int x, int y) const override; /// - bool usePlainLayout() const { return false; } + bool usePlainLayout() const override { return false; } /// - void doDispatch(Cursor & cur, FuncRequest & cmd); + void doDispatch(Cursor & cur, FuncRequest & cmd) override; /// - docstring name() const { return from_ascii("Branch"); } + docstring layoutName() const override { return from_ascii("Branch:") + branch(); } /// - Inset * clone() const { return new InsetBranch(*this); } + Inset * clone() const override { return new InsetBranch(*this); } /// friend class InsetBranchParams;