1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
2002-09-25 14:26:13 +00:00
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
* \file InsetBibtex.h
|
2002-09-25 14:26:13 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
2002-09-25 14:26:13 +00:00
|
|
|
* \author Alejandro Aguilar Sierra
|
2002-03-21 17:09:55 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-09-25 14:26:13 +00:00
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2003-02-21 09:20:18 +00:00
|
|
|
#ifndef INSET_BIBTEX_H
|
|
|
|
#define INSET_BIBTEX_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2008-03-29 14:38:38 +00:00
|
|
|
#include "InsetCommand.h"
|
|
|
|
|
2010-10-31 00:31:57 +00:00
|
|
|
namespace lyx {
|
2008-04-19 15:52:35 +00:00
|
|
|
|
2010-10-31 00:31:57 +00:00
|
|
|
class BiblioInfo;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2010-10-31 00:31:57 +00:00
|
|
|
namespace support {
|
|
|
|
class FileName;
|
|
|
|
class FileNameList;
|
|
|
|
}
|
2006-12-01 20:09:08 +00:00
|
|
|
|
2003-09-03 17:40:58 +00:00
|
|
|
/** Used to insert BibTeX's information
|
|
|
|
*/
|
|
|
|
class InsetBibtex : public InsetCommand {
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
|
|
|
///
|
2009-11-08 15:53:21 +00:00
|
|
|
InsetBibtex(Buffer *, InsetCommandParams const &);
|
2008-06-05 06:42:53 +00:00
|
|
|
///
|
2010-05-03 22:57:28 +00:00
|
|
|
~InsetBibtex();
|
2010-10-27 21:35:13 +00:00
|
|
|
|
2003-05-26 09:13:55 +00:00
|
|
|
///
|
2010-10-27 21:35:13 +00:00
|
|
|
support::FileNameList getBibFiles() const;
|
|
|
|
///
|
|
|
|
bool addDatabase(docstring const &);
|
|
|
|
///
|
|
|
|
bool delDatabase(docstring const &);
|
|
|
|
|
|
|
|
/// \name Public functions inherited from Inset class
|
|
|
|
//@{
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2008-04-28 12:48:04 +00:00
|
|
|
docstring toolTip(BufferView const & bv, int x, int y) const;
|
|
|
|
///
|
2009-04-22 20:55:13 +00:00
|
|
|
bool hasSettings() const { return true; }
|
2000-08-04 13:12:30 +00:00
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
InsetCode lyxCode() const { return BIBTEX_CODE; }
|
2000-08-04 13:12:30 +00:00
|
|
|
///
|
2007-05-18 14:32:29 +00:00
|
|
|
DisplayType display() const { return AlignCenter; }
|
2003-10-22 10:22:09 +00:00
|
|
|
///
|
Introduce a wrapper class for odocstream to help ensuring that no
blank lines may be inadvertently output. This is achieved by using two
special iomanip-like variables (breakln and safebreakln) in the lyx::
namespace. When they are inserted in the stream, a newline is output
only if not already at the beginning of a line. The difference between
breakln and safebreakln is that, if needed, the former outputs '\n'
and the latter "%\n".
In future, the new class will also be used for counting the number of
newlines issued. Even if the infractrure for doing that is already in
place, the counting is essentially still done the old way.
There are still places in the code where the functionality of the
class could be used, most probably. ATM, it is used for InsetTabular,
InsetListings, InsetFloat, and InsetText.
The Comment and GreyedOut insets required a special treatment and a
new InsetLayout parameter (Display) has been introduced. The default
for Display is "true", meaning that the corresponding latex
environment is of "display" type, i.e., it stands on its own, whereas
"false" means that the contents appear inline with the text. The
latter is the case for both Comment and GreyedOut insets.
Mostly, the only visible effects on latex exports should be the
disappearing of some redundant % chars and the appearing/disappearing
of null {} latex groups after a comment or lyxgreyedout environments
(they are related to the presence or absence of a space immediately
after those environments), as well as the fact that math environments
are now started on their own lines.
As a last thing, only the latex code between \begin{document} and
\end{document} goes through the new class, the preamble being directly
output through odocstream, as usual.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37360 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-29 02:41:13 +00:00
|
|
|
int latex(otexstream &, OutputParams const &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2010-12-03 20:08:04 +00:00
|
|
|
void collectBibKeys(InsetIterator const &) const;
|
2001-07-20 14:18:48 +00:00
|
|
|
///
|
2004-03-29 13:17:25 +00:00
|
|
|
void validate(LaTeXFeatures &) const;
|
2007-10-25 04:13:56 +00:00
|
|
|
///
|
2009-11-30 22:48:10 +00:00
|
|
|
docstring xhtml(XHTMLStream &, OutputParams const &) const;
|
2009-06-11 21:23:18 +00:00
|
|
|
///
|
2010-11-29 21:27:25 +00:00
|
|
|
docstring contextMenuName() const;
|
2010-10-27 21:35:13 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/// \name Static public methods obligated for InsetCommand derived classes
|
|
|
|
//@{
|
|
|
|
///
|
2008-02-23 22:01:02 +00:00
|
|
|
static ParamInfo const & findInfo(std::string const &);
|
2007-10-25 04:13:56 +00:00
|
|
|
///
|
2009-11-30 22:48:10 +00:00
|
|
|
static std::string defaultCommand() { return "bibtex"; }
|
2007-10-25 04:13:56 +00:00
|
|
|
///
|
|
|
|
static bool isCompatibleCommand(std::string const & s)
|
|
|
|
{ return s == "bibtex"; }
|
2010-10-27 21:35:13 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
private:
|
2008-03-29 15:32:36 +00:00
|
|
|
/// look up the path to the file using TeX
|
|
|
|
static support::FileName
|
|
|
|
getBibTeXPath(docstring const & filename, Buffer const & buf);
|
2008-04-28 15:14:18 +00:00
|
|
|
///
|
2010-10-27 21:35:13 +00:00
|
|
|
void editDatabases() const;
|
2010-12-03 19:29:46 +00:00
|
|
|
///
|
2010-12-03 20:08:04 +00:00
|
|
|
void parseBibTeXFiles() const;
|
2010-10-27 21:35:13 +00:00
|
|
|
|
|
|
|
/// \name Private functions inherited from Inset class
|
|
|
|
//@{
|
2008-02-23 22:01:02 +00:00
|
|
|
///
|
2008-04-28 15:14:18 +00:00
|
|
|
bool getStatus(Cursor & cur, FuncRequest const & cmd,
|
|
|
|
FuncStatus & flag) const;
|
|
|
|
///
|
2010-10-27 21:35:13 +00:00
|
|
|
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
2008-04-28 15:14:18 +00:00
|
|
|
///
|
2008-03-05 00:21:05 +00:00
|
|
|
Inset * clone() const { return new InsetBibtex(*this); }
|
2010-10-27 21:35:13 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/// \name Private functions inherited from InsetCommand class
|
|
|
|
//@{
|
|
|
|
///
|
|
|
|
docstring screenLabel() const;
|
|
|
|
//@}
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
2003-02-21 09:20:18 +00:00
|
|
|
#endif // INSET_BIBTEX_H
|