/* This file is part of
* ======================================================
- *
+ *
* LyX, The Document Processor
- *
+ *
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
// Index of chars used for the quote. Index is [side, language]
int quote_index[2][6] = {
- { 2, 1, 0, 0, 3, 4 }, // "'',,<>"
+ { 2, 1, 0, 0, 3, 4 }, // "'',,<>"
{ 1, 1, 2, 1, 4, 3 } }; // "`'`'><"
// Corresponding LaTeX code, for double and single quotes.
-char const * const latex_quote_t1[2][5] =
-{ { "\\quotesinglbase{}", "'", "`",
- "\\guilsinglleft{}", "\\guilsinglright{}" },
+char const * const latex_quote_t1[2][5] =
+{ { "\\quotesinglbase{}", "'", "`",
+ "\\guilsinglleft{}", "\\guilsinglright{}" },
{ ",,", "''", "``", "<<", ">>" } };
-char const * const latex_quote_ot1[2][5] =
-{ { "\\quotesinglbase{}", "'", "`",
- "\\guilsinglleft{}", "\\guilsinglright{}" },
+char const * const latex_quote_ot1[2][5] =
+{ { "\\quotesinglbase{}", "'", "`",
+ "\\guilsinglleft{}", "\\guilsinglright{}" },
{ "\\quotedblbase{}", "''", "``",
"\\guillemotleft{}", "\\guillemotright{}" } };
-char const * const latex_quote_babel[2][5] =
+char const * const latex_quote_babel[2][5] =
{ { "\\glq{}", "'", "`", "\\flq{}", "\\frq{}" },
{ "\\glqq{}", "''", "``", "\\flqq{}", "\\frqq{}" } };
InsetQuotes::InsetQuotes(char c, BufferParams const & params)
: language_(params.quotes_language), times_(params.quotes_times)
{
- // Decide whether left or right
+ // Decide whether left or right
switch (c) {
- case ' ': case '(':
+ case ' ': case '(':
case Paragraph::META_HFILL:
- case Paragraph::META_NEWLINE:
- side_ = LeftQ; // left quote
+ case Paragraph::META_NEWLINE:
+ side_ = LeftQ; // left quote
break;
default:
side_ = RightQ; // right quote
}
int i;
-
+
for (i = 0; i < 6; ++i) {
if (str[0] == language_char[i]) {
language_ = quote_language(i);
if (i >= 6) {
lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
" bad language specification." << endl;
- language_ = EnglishQ;
+ language_ = EnglishQ;
}
for (i = 0; i < 2; ++i) {
if (i >= 2) {
lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
" bad side specification." << endl;
- side_ = LeftQ;
+ side_ = LeftQ;
}
for (i = 0; i < 2; ++i) {
if (i >= 2) {
lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
" bad times specification." << endl;
- times_ = DoubleQ;
+ times_ = DoubleQ;
}
}
string const InsetQuotes::dispString(Language const * loclang) const
{
- string disp;
+ string disp;
disp += quote_char[quote_index[side_][language_]];
if (times_ == DoubleQ)
disp += disp;
- if (lyxrc.font_norm_type == LyXRC::ISO_8859_1
- || lyxrc.font_norm_type == LyXRC::ISO_8859_3
- || lyxrc.font_norm_type == LyXRC::ISO_8859_4
- || lyxrc.font_norm_type == LyXRC::ISO_8859_9) {
+ if (lyxrc.font_norm_type == LyXRC::ISO_8859_1
+ || lyxrc.font_norm_type == LyXRC::ISO_8859_3
+ || lyxrc.font_norm_type == LyXRC::ISO_8859_4
+ || lyxrc.font_norm_type == LyXRC::ISO_8859_9) {
if (disp == "'")
disp = "´";
else if (disp == "''")
disp = "´´";
}
- if (lyxrc.font_norm_type == LyXRC::ISO_8859_1
- || lyxrc.font_norm_type == LyXRC::ISO_8859_9
- || lyxrc.font_norm_type == LyXRC::ISO_8859_15) {
+ if (lyxrc.font_norm_type == LyXRC::ISO_8859_1
+ || lyxrc.font_norm_type == LyXRC::ISO_8859_9
+ || lyxrc.font_norm_type == LyXRC::ISO_8859_15) {
if (disp == "<<")
disp = '«';
else if (disp == ">>")
else
disp = " " + disp;
}
-
- return disp;
+
+ return disp;
}
string text;
text += language_char[language_];
text += side_char[side_];
- text += times_char[times_];
+ text += times_char[times_];
os << "Quotes " << text;
}
const int quoteind = quote_index[side_][language_];
string qstr;
-
+
if (language_ == FrenchQ && times_ == DoubleQ
&& curr_lang == "frenchb") {
- if (side_ == LeftQ)
+ if (side_ == LeftQ)
qstr = "\\og "; //the spaces are important here
- else
+ else
qstr = " \\fg{}"; //and here
} else if (language_ == FrenchQ && times_ == DoubleQ
&& curr_lang == "french") {
- if (side_ == LeftQ)
+ if (side_ == LeftQ)
qstr = "<< "; //the spaces are important here
- else
+ else
qstr = " >>"; //and here
} else if (lyxrc.fontenc == "T1") {
qstr = latex_quote_t1[times_][quoteind];
} else if (!use_babel) {
#endif
qstr = latex_quote_ot1[times_][quoteind];
- } else {
+ } else {
qstr = latex_quote_babel[times_][quoteind];
}
}
-void InsetQuotes::validate(LaTeXFeatures & features) const
+void InsetQuotes::validate(LaTeXFeatures & features) const
{
char type = quote_char[quote_index[side_][language_]];
#ifdef DO_USE_DEFAULT_LANGUAGE
- if (features.bufferParams().language->lang() == "default"
+ if (features.bufferParams().language->lang() == "default"
#else
if (!use_babel
#endif
&& lyxrc.fontenc != "T1") {
- if (times_ == SingleQ)
+ if (times_ == SingleQ)
switch (type) {
case ',': features.require("quotesinglbase"); break;
case '<': features.require("guilsinglleft"); break;
case '>': features.require("guilsinglright"); break;
default: break;
}
- else
+ else
switch (type) {
case ',': features.require("quotedblbase"); break;
case '<': features.require("guillemotleft"); break;