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 InsetQuotes.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 Jean-Marc Lasgouttes
|
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
|
|
|
|
1999-10-02 16:21:10 +00:00
|
|
|
#ifndef INSET_QUOTES_H
|
|
|
|
#define INSET_QUOTES_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
#include "Inset.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2008-03-15 00:02:41 +00:00
|
|
|
#include "support/docstring.h"
|
2006-09-02 10:18:20 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/** Quotes.
|
|
|
|
Used for the various quotes. German, English, French, all either
|
2002-03-21 17:09:55 +00:00
|
|
|
double or single **/
|
2008-03-15 00:02:41 +00:00
|
|
|
class InsetQuotes : public Inset
|
|
|
|
{
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
|
|
|
///
|
2008-03-15 00:02:41 +00:00
|
|
|
enum QuoteLanguage {
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2008-03-15 00:02:41 +00:00
|
|
|
EnglishQuotes,
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2008-03-15 00:02:41 +00:00
|
|
|
SwedishQuotes,
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2008-03-15 00:02:41 +00:00
|
|
|
GermanQuotes,
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2008-03-15 00:02:41 +00:00
|
|
|
PolishQuotes,
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2008-03-15 00:02:41 +00:00
|
|
|
FrenchQuotes,
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2008-03-15 00:02:41 +00:00
|
|
|
DanishQuotes
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
///
|
2008-03-15 00:02:41 +00:00
|
|
|
enum QuoteSide {
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2008-03-15 00:02:41 +00:00
|
|
|
LeftQuote,
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2008-03-15 00:02:41 +00:00
|
|
|
RightQuote
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
///
|
2008-03-15 00:02:41 +00:00
|
|
|
enum QuoteTimes {
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2008-03-15 00:02:41 +00:00
|
|
|
SingleQuotes,
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2008-03-15 00:02:41 +00:00
|
|
|
DoubleQuotes
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
2002-03-21 17:09:55 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/** The constructor works like this:
|
|
|
|
\begin{itemize}
|
2002-03-21 17:09:55 +00:00
|
|
|
\item fls <- french single quote left
|
|
|
|
\item grd <- german double quote right
|
1999-09-27 18:44:28 +00:00
|
|
|
\item etc.
|
|
|
|
\end{itemize}
|
2000-04-08 17:02:02 +00:00
|
|
|
*/
|
2009-11-08 15:53:21 +00:00
|
|
|
explicit InsetQuotes(Buffer * buf, std::string const & str = "eld");
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Create the right quote inset after character c
|
2009-11-08 15:53:21 +00:00
|
|
|
InsetQuotes(Buffer * buffer, char_type c);
|
2004-02-20 10:32:44 +00:00
|
|
|
/// Direct access to inner/outer quotation marks
|
2009-11-08 15:53:21 +00:00
|
|
|
InsetQuotes(Buffer * buf, char_type c, QuoteTimes t);
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2007-11-01 22:17:22 +00:00
|
|
|
docstring name() const;
|
2007-04-29 12:32:14 +00:00
|
|
|
///
|
2007-09-21 20:39:47 +00:00
|
|
|
void metrics(MetricsInfo &, Dimension &) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2003-05-30 06:48:24 +00:00
|
|
|
void draw(PainterInfo & pi, int x, int y) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
void write(std::ostream &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
void read(Lexer & lex);
|
1999-09-27 18:44:28 +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;
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int plaintext(odocstream &, OutputParams const &) const;
|
2000-04-24 20:58:23 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int docbook(odocstream &, OutputParams const &) const;
|
2009-06-05 17:48:14 +00:00
|
|
|
///
|
2009-11-19 23:02:47 +00:00
|
|
|
docstring xhtml(XHTMLStream &, OutputParams const &) const;
|
2005-11-25 14:40:34 +00:00
|
|
|
|
2010-12-15 01:34:04 +00:00
|
|
|
///
|
|
|
|
void toString(odocstream &) const;
|
2010-12-20 21:55:09 +00:00
|
|
|
///
|
|
|
|
void forToc(docstring &, size_t maxlen) const;
|
2005-11-25 14:40:34 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
void validate(LaTeXFeatures &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2007-10-16 16:48:21 +00:00
|
|
|
InsetCode lyxCode() const { return QUOTE_CODE; }
|
|
|
|
/// should this inset be handled like a normal character
|
2002-01-08 14:24:49 +00:00
|
|
|
bool isChar() const { return true; }
|
2002-03-21 17:09:55 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
private:
|
2008-02-27 20:43:16 +00:00
|
|
|
///
|
2008-02-28 19:04:13 +00:00
|
|
|
Inset * clone() const { return new InsetQuotes(*this); }
|
2004-11-23 23:04:52 +00:00
|
|
|
|
2004-02-20 10:32:44 +00:00
|
|
|
/// Decide whether we need left or right quotation marks
|
2008-03-15 00:02:41 +00:00
|
|
|
void setSide(char_type c);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
void parseString(std::string const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2008-03-15 00:02:41 +00:00
|
|
|
docstring displayString() const;
|
|
|
|
|
|
|
|
///
|
|
|
|
QuoteLanguage language_;
|
|
|
|
///
|
|
|
|
QuoteSide side_;
|
|
|
|
///
|
|
|
|
QuoteTimes times_;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
#endif
|