]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBranch.h
#5502 add binding for full screen toggle on mac
[lyx.git] / src / insets / InsetBranch.h
index 09e9dbc11aec1ae7ca3848eb3db2a8ea11842170..ecd2f7d7e2b5ffdeec15201629240705ead56043 100644 (file)
 #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,73 +61,63 @@ 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;
+       void latex(otexstream &, OutputParams const &) const;
        ///
-       int latex(odocstream &, 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;
        ///
-       void textString(odocstream &) const;
+       docstring xhtml(XHTMLStream &, OutputParams const &) const;
+       ///
+       void toString(odocstream &) const;
+       ///
+       void forOutliner(docstring &, size_t) const;
        ///
        void validate(LaTeXFeatures &) const;
        ///
+       std::string contextMenuName() const;
+       ///
+       void addToToc(DocIterator const & di, bool output_active) const;
+       ///
        InsetBranchParams const & params() const { return params_; }
        ///
        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.
+        */
+       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;
-protected:
        ///
-       void doDispatch(Cursor & cur, FuncRequest & cmd);
+       bool usePlainLayout() const { return false; }
        ///
-       docstring name() const { return from_ascii("Branch"); }
-private:
+       void doDispatch(Cursor & cur, FuncRequest & cmd);
        ///
-       friend class InsetBranchParams;
+       docstring layoutName() const { return from_ascii("Branch:") + 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