lyx_mirror/src/insets/InsetBibtex.h
Jean-Marc Lasgouttes 963a0aa466 Implement Row::Element::row_flags
Move the enum definition RowFlags in its own include file, to avoid
loading Inset.h. Document it more thoroughly.

Rename RowAfter to AlwaysBreakAfter.

Add CanBreakInside (rows that can be themselves broken). This allow to
differentiate elements before bodyPos() and allows to remove a
parameter to shortenIfNeeded().

Make the Inset::rowFlags() method return int instead of RowFlags, as
should be done for all the bitwise flags. Remove the hand-made bitwise
operators.

Set R::E::row_flags when creating elements.
* INSET elements use the inset's rowFLags();
* virtual element forbid breaking before them, and inherit the *After
  flags from the previous element of the row;
* STRING elements usr CanBreakInside, except before bodyPos.

More stuff may be added later.
2021-12-07 17:04:47 +01:00

118 lines
2.8 KiB
C++

// -*- C++ -*-
/**
* \file InsetBibtex.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Alejandro Aguilar Sierra
*
* Full author contact details are available in file CREDITS.
*/
#ifndef INSET_BIBTEX_H
#define INSET_BIBTEX_H
#include "InsetCommand.h"
namespace lyx {
class docstring_list;
namespace support {
class FileName;
} // namespace support
/** Used to insert BibTeX's information
*/
class InsetBibtex : public InsetCommand {
public:
///
InsetBibtex(Buffer *, InsetCommandParams const &);
///
docstring_list getBibFiles() const;
///
bool addDatabase(docstring const &);
///
bool delDatabase(docstring const &);
///
void write(std::ostream &) const override;
/// \name Public functions inherited from Inset class
//@{
///
docstring toolTip(BufferView const & bv, int x, int y) const override;
///
bool hasSettings() const override { return true; }
///
InsetCode lyxCode() const override { return BIBTEX_CODE; }
///
int rowFlags() const override { return Display; }
///
void latex(otexstream &, OutputParams const &) const override;
///
int plaintext(odocstringstream & ods, OutputParams const & op,
size_t max_length = INT_MAX) const override;
///
void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false) override;
///
void addToToc(DocIterator const & di, bool output_active,
UpdateType utype, TocBackend & backend) const override;
///
void collectBibKeys(InsetIterator const &, support::FileNameList &) const override;
///
void validate(LaTeXFeatures &) const override;
///
docstring xhtml(XMLStream &, OutputParams const &) const override;
///
void docbook(XMLStream &, OutputParams const &) const override;
///
std::string contextMenuName() const override;
//@}
/// \name Static public methods obligated for InsetCommand derived classes
//@{
///
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "bibtex"; }
///
static bool isCompatibleCommand(std::string const & s)
{ return s == "bibtex"; }
//@}
private:
///
void editDatabases(docstring const & db = docstring()) const;
///
void parseBibTeXFiles(support::FileNameList &) const;
///
bool usingBiblatex() const;
///
docstring getRefLabel() const;
///
std::map<std::string, std::string> getFileEncodings() const;
/// \name Private functions inherited from Inset class
//@{
///
bool getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const override;
///
void doDispatch(Cursor & cur, FuncRequest & cmd) override;
///
Inset * clone() const override { return new InsetBibtex(*this); }
//@}
/// \name Private functions inherited from InsetCommand class
//@{
///
docstring screenLabel() const override;
//@}
};
} // namespace lyx
#endif // INSET_BIBTEX_H