2003-08-17 11:28:23 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
* \file InsetBranch.h
|
2003-08-17 11:28:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Martin Vermeer
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-08-17 11:28:23 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INSETBRANCH_H
|
|
|
|
#define INSETBRANCH_H
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "InsetCollapsable.h"
|
|
|
|
#include "MailInset.h"
|
2003-08-17 11:28:23 +00:00
|
|
|
|
2003-12-14 16:33:56 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2005-01-19 15:03:31 +00:00
|
|
|
class InsetBranchParams {
|
|
|
|
public:
|
2006-11-03 15:16:45 +00:00
|
|
|
explicit InsetBranchParams(docstring const & b = docstring())
|
2003-12-14 16:33:56 +00:00
|
|
|
: branch(b) {}
|
2003-08-28 07:41:31 +00:00
|
|
|
///
|
|
|
|
void write(std::ostream & os) const;
|
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
void read(Lexer & lex);
|
2003-08-28 07:41:31 +00:00
|
|
|
///
|
2006-11-03 15:16:45 +00:00
|
|
|
docstring branch;
|
2003-12-14 16:33:56 +00:00
|
|
|
};
|
2003-08-28 07:41:31 +00:00
|
|
|
|
|
|
|
|
2003-08-17 11:28:23 +00:00
|
|
|
/** The Branch inset for alternative, conditional output.
|
|
|
|
|
|
|
|
*/
|
|
|
|
class InsetBranch : public InsetCollapsable {
|
|
|
|
public:
|
|
|
|
///
|
2008-03-04 22:28:18 +00:00
|
|
|
InsetBranch(Buffer const &, InsetBranchParams const &);
|
2003-08-28 07:41:31 +00:00
|
|
|
///
|
2003-08-17 11:28:23 +00:00
|
|
|
~InsetBranch();
|
2003-08-28 07:41:31 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
docstring editMessage() const;
|
2003-08-17 11:28:23 +00:00
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
InsetCode lyxCode() const { return BRANCH_CODE; }
|
2003-08-17 11:28:23 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
void write(std::ostream &) const;
|
2003-08-17 11:28:23 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
void read(Lexer & lex);
|
2003-08-17 11:28:23 +00:00
|
|
|
///
|
|
|
|
void setButtonLabel();
|
|
|
|
///
|
2007-10-25 12:41:02 +00:00
|
|
|
virtual ColorCode backgroundColor() const;
|
2007-06-12 13:45:49 +00:00
|
|
|
///
|
2003-08-17 11:28:23 +00:00
|
|
|
bool showInsetDialog(BufferView *) const;
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int latex(odocstream &, OutputParams const &) const;
|
2003-08-17 11:28:23 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int plaintext(odocstream &, OutputParams const &) const;
|
2007-02-16 09:28:25 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int docbook(odocstream &, OutputParams const &) const;
|
2003-08-17 11:28:23 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
void textString(odocstream &) const;
|
2007-01-19 16:23:47 +00:00
|
|
|
///
|
2003-08-17 11:28:23 +00:00
|
|
|
void validate(LaTeXFeatures &) const;
|
|
|
|
///
|
|
|
|
InsetBranchParams const & params() const { return params_; }
|
|
|
|
///
|
|
|
|
void setParams(InsetBranchParams const & params) { params_ = params; }
|
2003-12-14 16:33:56 +00:00
|
|
|
|
|
|
|
/** \returns true if params_.branch is listed as 'selected' in
|
2005-10-25 15:21:49 +00:00
|
|
|
\c buffer. This handles the case of child documents.
|
2003-12-14 16:33:56 +00:00
|
|
|
*/
|
2008-02-27 20:43:16 +00:00
|
|
|
bool isBranchSelected() const;
|
2005-04-22 08:57:22 +00:00
|
|
|
///
|
2007-04-26 14:56:30 +00:00
|
|
|
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
|
2007-12-21 20:42:46 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
virtual void updateLabels(ParIterator const &);
|
2007-12-21 20:42:46 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
bool isMacroScope() const;
|
2008-02-12 09:11:06 +00:00
|
|
|
///
|
|
|
|
docstring toolTip(BufferView const & bv, int x, int y) const;
|
2003-10-17 18:01:15 +00:00
|
|
|
protected:
|
2007-04-29 12:32:14 +00:00
|
|
|
///
|
2008-03-04 22:28:18 +00:00
|
|
|
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
2007-04-29 12:32:14 +00:00
|
|
|
///
|
2007-04-30 14:39:09 +00:00
|
|
|
docstring name() const { return from_ascii("Branch"); }
|
2003-08-17 11:28:23 +00:00
|
|
|
private:
|
2008-03-04 22:28:18 +00:00
|
|
|
///
|
2003-08-17 11:28:23 +00:00
|
|
|
friend class InsetBranchParams;
|
2008-03-04 22:28:18 +00:00
|
|
|
///
|
|
|
|
Inset * clone() const { return new InsetBranch(*this); }
|
2003-08-17 11:28:23 +00:00
|
|
|
///
|
|
|
|
InsetBranchParams params_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class InsetBranchMailer : public MailInset {
|
|
|
|
public:
|
|
|
|
///
|
2003-12-10 14:49:51 +00:00
|
|
|
InsetBranchMailer(InsetBranch & inset);
|
2003-08-17 11:28:23 +00:00
|
|
|
///
|
2007-04-29 13:39:47 +00:00
|
|
|
virtual Inset & inset() const { return inset_; }
|
2003-08-17 11:28:23 +00:00
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
virtual std::string const & name() const { return name_; }
|
2003-08-17 11:28:23 +00:00
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
virtual std::string const inset2string(Buffer const &) const;
|
2003-08-17 11:28:23 +00:00
|
|
|
///
|
2003-12-10 14:49:51 +00:00
|
|
|
static std::string const params2string(InsetBranchParams const &);
|
2003-08-17 11:28:23 +00:00
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
static void string2params(std::string const &, InsetBranchParams &);
|
2003-08-17 11:28:23 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
///
|
2003-12-10 14:49:51 +00:00
|
|
|
static std::string const name_;
|
2003-08-17 11:28:23 +00:00
|
|
|
///
|
|
|
|
InsetBranch & inset_;
|
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
2003-08-17 11:28:23 +00:00
|
|
|
|
|
|
|
#endif
|