mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-16 07:55:41 +00:00
c466baaa5b
The current spelling is not strictly wrong, but flagged as unusual or historical by some authorities. It is also found fault with many spell checkers. Thus we decided to move to the more standard "-ible" form once and for all. See #10678 for discussion This part covers the most tricky part: the internal naming. Translations and layouts will follow. This will all also all be backported to 2.3.x, for the sake of backwards compatibility (cherry-picking).
130 lines
3.1 KiB
C++
130 lines
3.1 KiB
C++
// -*- C++ -*-
|
|
/**
|
|
* \file InsetBranch.h
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author Martin Vermeer
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#ifndef INSETBRANCH_H
|
|
#define INSETBRANCH_H
|
|
|
|
#include "InsetCollapsible.h"
|
|
|
|
namespace lyx {
|
|
|
|
class InsetBranchParams {
|
|
public:
|
|
///
|
|
explicit InsetBranchParams(docstring const & b = docstring())
|
|
: 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;
|
|
};
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// InsetBranch
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
/// The Branch inset for alternative, conditional output.
|
|
|
|
class InsetBranch : public InsetCollapsible
|
|
{
|
|
public:
|
|
///
|
|
InsetBranch(Buffer *, InsetBranchParams const &);
|
|
|
|
///
|
|
static std::string params2string(InsetBranchParams const &);
|
|
///
|
|
static void string2params(std::string const &, InsetBranchParams &);
|
|
///
|
|
docstring branch() const { return params_.branch; }
|
|
///
|
|
void rename(docstring const & newname) { params_.branch = newname; }
|
|
///
|
|
InsetBranchParams const & params() const { return params_; }
|
|
|
|
private:
|
|
///
|
|
InsetCode lyxCode() const { return BRANCH_CODE; }
|
|
///
|
|
void write(std::ostream &) const;
|
|
///
|
|
void read(Lexer & lex);
|
|
///
|
|
docstring const buttonLabel(BufferView const &) const;
|
|
///
|
|
ColorCode backgroundColor(PainterInfo const &) const;
|
|
///
|
|
void latex(otexstream &, OutputParams const &) const;
|
|
///
|
|
int plaintext(odocstringstream & ods, OutputParams const & op,
|
|
size_t max_length = INT_MAX) const;
|
|
///
|
|
int docbook(odocstream &, OutputParams const &) const;
|
|
///
|
|
docstring xhtml(XHTMLStream &, OutputParams const &) const;
|
|
///
|
|
void toString(odocstream &) const;
|
|
///
|
|
void forOutliner(docstring &, size_t const, bool const) const;
|
|
///
|
|
void validate(LaTeXFeatures &) const;
|
|
///
|
|
std::string contextMenuName() const;
|
|
///
|
|
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. \p child only checks within child documents.
|
|
*/
|
|
bool isBranchSelected(bool const child = false) const;
|
|
/*!
|
|
* Is the content of this inset part of the output document?
|
|
*
|
|
* Note that Branch insets are considered part of the
|
|
* document when they are selected XOR inverted.
|
|
*/
|
|
bool producesOutput() const;
|
|
///
|
|
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
|
|
///
|
|
bool isMacroScope() const;
|
|
///
|
|
docstring toolTip(BufferView const & bv, int x, int y) const;
|
|
///
|
|
bool usePlainLayout() const { return false; }
|
|
///
|
|
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
|
///
|
|
docstring layoutName() const { return from_ascii("Branch:") + branch(); }
|
|
///
|
|
Inset * clone() const { return new InsetBranch(*this); }
|
|
|
|
///
|
|
friend class InsetBranchParams;
|
|
///
|
|
InsetBranchParams params_;
|
|
};
|
|
|
|
} // namespace lyx
|
|
|
|
#endif
|