]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBranch.h
This optional argument to the InsetCollapsable constructor
[lyx.git] / src / insets / InsetBranch.h
index 8793602a2e1299bcea5305387d395a26e9d79929..b608fd19cc1a7a509331095e908eeee5dfed3f5f 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,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