X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBufferParams.cpp;h=fa0b7c3b92819ccb8d4beea6f64c898a71fd9487;hb=5fdc577badb1cb133d6a0dc7d831bb1f82576adb;hp=50870c57b2e826065de252e82530658e374b7e26;hpb=c19794a01360a26824ddcabd82cde810e4d1867a;p=lyx.git diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 50870c57b2..fa0b7c3b92 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -71,8 +71,9 @@ static char const * const string_paragraph_separation[] = { }; -static char const * const string_quotes_language[] = { - "english", "swedish", "german", "polish", "french", "danish", "" +static char const * const string_quotes_style[] = { + "english", "swedish", "german", "polish", "swiss", "danish", "plain", + "british", "swedishg", "french", "frenchin", "russian", "cjk", "cjkangle", "" }; @@ -127,27 +128,35 @@ ParSepTranslator const & parseptranslator() } -// Quotes language -typedef Translator QuotesLangTranslator; +// Quotes style +typedef Translator QuotesStyleTranslator; -QuotesLangTranslator const init_quoteslangtranslator() +QuotesStyleTranslator const init_quotesstyletranslator() { - QuotesLangTranslator translator - (string_quotes_language[0], InsetQuotes::EnglishQuotes); - translator.addPair(string_quotes_language[1], InsetQuotes::SwedishQuotes); - translator.addPair(string_quotes_language[2], InsetQuotes::GermanQuotes); - translator.addPair(string_quotes_language[3], InsetQuotes::PolishQuotes); - translator.addPair(string_quotes_language[4], InsetQuotes::FrenchQuotes); - translator.addPair(string_quotes_language[5], InsetQuotes::DanishQuotes); + QuotesStyleTranslator translator + (string_quotes_style[0], InsetQuotesParams::EnglishQuotes); + translator.addPair(string_quotes_style[1], InsetQuotesParams::SwedishQuotes); + translator.addPair(string_quotes_style[2], InsetQuotesParams::GermanQuotes); + translator.addPair(string_quotes_style[3], InsetQuotesParams::PolishQuotes); + translator.addPair(string_quotes_style[4], InsetQuotesParams::SwissQuotes); + translator.addPair(string_quotes_style[5], InsetQuotesParams::DanishQuotes); + translator.addPair(string_quotes_style[6], InsetQuotesParams::PlainQuotes); + translator.addPair(string_quotes_style[7], InsetQuotesParams::BritishQuotes); + translator.addPair(string_quotes_style[8], InsetQuotesParams::SwedishGQuotes); + translator.addPair(string_quotes_style[9], InsetQuotesParams::FrenchQuotes); + translator.addPair(string_quotes_style[10], InsetQuotesParams::FrenchINQuotes); + translator.addPair(string_quotes_style[11], InsetQuotesParams::RussianQuotes); + translator.addPair(string_quotes_style[12], InsetQuotesParams::CJKQuotes); + translator.addPair(string_quotes_style[13], InsetQuotesParams::CJKAngleQuotes); return translator; } -QuotesLangTranslator const & quoteslangtranslator() +QuotesStyleTranslator const & quotesstyletranslator() { - static QuotesLangTranslator const translator = - init_quoteslangtranslator(); + static QuotesStyleTranslator const translator = + init_quotesstyletranslator(); return translator; } @@ -394,7 +403,8 @@ BufferParams::BufferParams() cite_engine_type_ = ENGINE_TYPE_DEFAULT; makeDocumentClass(); paragraph_separation = ParagraphIndentSeparation; - quotes_language = InsetQuotes::EnglishQuotes; + quotes_style = InsetQuotesParams::EnglishQuotes; + dynamic_quotes = false; fontsize = "default"; /* PaperLayout */ @@ -828,10 +838,12 @@ string BufferParams::readToken(Lexer & lex, string const & token, if (pimpl_->defskip.kind() == VSpace::DEFSKIP) // that is invalid pimpl_->defskip = VSpace(VSpace::MEDSKIP); - } else if (token == "\\quotes_language") { - string quotes_lang; - lex >> quotes_lang; - quotes_language = quoteslangtranslator().find(quotes_lang); + } else if (token == "\\quotes_style") { + string qstyle; + lex >> qstyle; + quotes_style = quotesstyletranslator().find(qstyle); + } else if (token == "\\dynamic_quotes") { + lex >> dynamic_quotes; } else if (token == "\\papersize") { string ppsize; lex >> ppsize; @@ -1299,8 +1311,9 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const os << "\n\\paragraph_indentation " << getIndentation().asLyXCommand(); else os << "\n\\defskip " << getDefSkip().asLyXCommand(); - os << "\n\\quotes_language " - << string_quotes_language[quotes_language] + os << "\n\\quotes_style " + << string_quotes_style[quotes_style] + << "\n\\dynamic_quotes " << dynamic_quotes << "\n\\papercolumns " << columns << "\n\\papersides " << sides << "\n\\paperpagestyle " << pagestyle << '\n'; @@ -1452,7 +1465,7 @@ void BufferParams::validate(LaTeXFeatures & features) const // some languages are only available via polyglossia if (features.hasPolyglossiaExclusiveLanguages()) - features.require("polyglossia"); + features.require("polyglossia"); if (useNonTeXFonts && fontsMath() != "auto") features.require("unicode-math"); @@ -2182,14 +2195,17 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features, os << "[" << from_ascii(language->polyglossiaOpts()) << "]"; os << "{" << from_ascii(language->polyglossia()) << "}\n"; // now setup the other languages - std::map const polylangs = + set const polylangs = features.getPolyglossiaLanguages(); - for (std::map::const_iterator mit = polylangs.begin(); + for (set::const_iterator mit = polylangs.begin(); mit != polylangs.end() ; ++mit) { + // We do not output the options here; they are output in + // the language switch commands. This is safer if multiple + // varieties are used. + if (*mit == language->polyglossia()) + continue; os << "\\setotherlanguage"; - if (!mit->second.empty()) - os << "[" << from_ascii(mit->second) << "]"; - os << "{" << from_ascii(mit->first) << "}\n"; + os << "{" << from_ascii(*mit) << "}\n"; } } @@ -2544,9 +2560,9 @@ Font const BufferParams::getFont() const } -InsetQuotes::QuoteLanguage BufferParams::getQuoteStyle(string const & qs) const +InsetQuotesParams::QuoteStyle BufferParams::getQuoteStyle(string const & qs) const { - return quoteslangtranslator().find(qs); + return quotesstyletranslator().find(qs); }