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"
|
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:
|
2008-03-27 22:26:24 +00:00
|
|
|
///
|
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
|
|
|
|
|
|
|
|
2008-03-27 22:26:24 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// InsetBranch
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/// The Branch inset for alternative, conditional output.
|
2003-08-17 11:28:23 +00:00
|
|
|
|
2008-03-27 22:26:24 +00:00
|
|
|
class InsetBranch : public InsetCollapsable
|
|
|
|
{
|
2003-08-17 11:28:23 +00:00
|
|
|
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();
|
2008-03-27 22:26:24 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
static std::string params2string(InsetBranchParams const &);
|
|
|
|
///
|
|
|
|
static void string2params(std::string const &, InsetBranchParams &);
|
|
|
|
|
|
|
|
private:
|
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();
|
|
|
|
///
|
2008-03-27 22:26:24 +00:00
|
|
|
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-03-27 22:26:24 +00:00
|
|
|
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;
|
2008-03-24 19:18:18 +00:00
|
|
|
///
|
2008-03-27 22:26:24 +00:00
|
|
|
bool useEmptyLayout() const { return false; }
|
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"); }
|
2008-03-04 22:28:18 +00:00
|
|
|
///
|
|
|
|
Inset * clone() const { return new InsetBranch(*this); }
|
2003-08-17 11:28:23 +00:00
|
|
|
|
|
|
|
///
|
2008-03-27 22:26:24 +00:00
|
|
|
friend class InsetBranchParams;
|
2003-08-17 11:28:23 +00:00
|
|
|
///
|
2008-03-27 22:26:24 +00:00
|
|
|
InsetBranchParams params_;
|
2003-08-17 11:28:23 +00:00
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
2003-08-17 11:28:23 +00:00
|
|
|
|
|
|
|
#endif
|