X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetBranch.h;h=391f2475f06765971a9d4d69afb324b5bef05943;hb=9762ba5d388e8a81a6e58c464b635ca4cf48cbfa;hp=c51c728e4f1610a4ce2a070a2cd11087f6240e78;hpb=3f27f951cbc2521edfbf78792839d61306bdb978;p=lyx.git diff --git a/src/insets/InsetBranch.h b/src/insets/InsetBranch.h index c51c728e4f..391f2475f0 100644 --- a/src/insets/InsetBranch.h +++ b/src/insets/InsetBranch.h @@ -12,7 +12,7 @@ #ifndef INSETBRANCH_H #define INSETBRANCH_H -#include "InsetCollapsable.h" +#include "InsetCollapsible.h" namespace lyx { @@ -20,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; }; @@ -38,7 +42,7 @@ public: /// The Branch inset for alternative, conditional output. -class InsetBranch : public InsetCollapsable +class InsetBranch : public InsetCollapsible { public: /// @@ -52,6 +56,8 @@ public: docstring branch() const { return params_.branch; } /// void rename(docstring const & newname) { params_.branch = newname; } + /// + InsetBranchParams const & params() const { return params_; } private: /// @@ -61,13 +67,14 @@ private: /// void read(Lexer & lex); /// - docstring const buttonLabel(BufferView const & bv) const; + docstring const buttonLabel(BufferView const &) const; /// ColorCode backgroundColor(PainterInfo const &) const; /// void latex(otexstream &, OutputParams const &) const; /// - int plaintext(odocstream &, OutputParams const &) const; + int plaintext(odocstringstream & ods, OutputParams const & op, + size_t max_length = INT_MAX) const; /// int docbook(odocstream &, OutputParams const &) const; /// @@ -75,29 +82,27 @@ private: /// void toString(odocstream &) const; /// - void forToc(docstring &, size_t) const; + void forOutliner(docstring &, size_t const, bool const) const; /// void validate(LaTeXFeatures &) const; /// - docstring contextMenuName() const; + std::string contextMenuName() const; /// - void addToToc(DocIterator const &) const; - /// - InsetBranchParams const & params() const { return params_; } + void updateBuffer(ParIterator const & it, UpdateType utype); /// void setParams(InsetBranchParams const & params) { params_ = params; } /** \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; /// bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; /// @@ -109,7 +114,7 @@ private: /// void doDispatch(Cursor & cur, FuncRequest & cmd); /// - docstring layoutName() const { return from_ascii("Branch"); } + docstring layoutName() const { return from_ascii("Branch:") + branch(); } /// Inset * clone() const { return new InsetBranch(*this); }