+docstring const InsetQuotesParams::getGuiLabel(QuoteStyle const & qs, bool langdef)
+{
+ docstring const styledesc =
+ bformat(_("%1$souter%2$s and %3$sinner%4$s[[quotation marks]]"),
+ docstring(1, getQuoteChar(qs, PrimaryQuotes, OpeningQuote)),
+ docstring(1, getQuoteChar(qs, PrimaryQuotes, ClosingQuote)),
+ docstring(1, getQuoteChar(qs, SecondaryQuotes, OpeningQuote)),
+ docstring(1, getQuoteChar(qs, SecondaryQuotes, ClosingQuote))
+ );
+
+ if (!langdef)
+ return styledesc;
+
+ return bformat(_("%1$s[[quot. mark description]] (language default)"),
+ styledesc);
+}
+
+
+docstring const InsetQuotesParams::getShortGuiLabel(docstring const string)
+{
+ std::string const s = to_ascii(string);
+ QuoteStyle const style = getQuoteStyle(s);
+ QuoteSide const side = getQuoteSide(s);
+ QuoteLevel const level = getQuoteLevel(s);
+
+ return (side == OpeningQuote) ?
+ bformat(_("%1$stext"),
+ docstring(1, getQuoteChar(style, level, side))) :
+ bformat(_("text%1$s"),
+ docstring(1, getQuoteChar(style, level, side)));
+}
+
+
+/////////////////////////////////////////////////////////////////////
+//
+// InsetQuotes
+//
+///////////////////////////////////////////////////////////////////////
+
+InsetQuotes::InsetQuotes(Buffer * buf, string const & str)
+ : Inset(buf),
+ style_(InsetQuotesParams::EnglishQuotes), side_(InsetQuotesParams::OpeningQuote),
+ pass_thru_(false), internal_fontenc_(false), rtl_(false)
+{
+ if (buf) {
+ global_style_ = buf->masterBuffer()->params().quotes_style;
+ fontspec_ = buf->masterBuffer()->params().useNonTeXFonts;
+ }
+ else {
+ global_style_ = InsetQuotesParams::EnglishQuotes;
+ fontspec_ = false;
+ }
+
+ parseString(str);
+}
+
+
+InsetQuotes::InsetQuotes(Buffer * buf, char_type c, InsetQuotesParams::QuoteLevel level,
+ string const & side, string const & style)
+ : Inset(buf), level_(level), pass_thru_(false), fontspec_(false),
+ internal_fontenc_(false), rtl_(false)
+{
+ bool dynamic = false;
+ if (buf) {
+ global_style_ = buf->masterBuffer()->params().quotes_style;
+ fontenc_ = buf->masterBuffer()->params().main_font_encoding();
+ dynamic = buf->masterBuffer()->params().dynamic_quotes;
+ fontspec_ = buf->masterBuffer()->params().useNonTeXFonts;
+ } else {
+ global_style_ = InsetQuotesParams::EnglishQuotes;
+ fontenc_ = "OT1";
+ fontspec_ = false;
+ }
+ if (style.empty())
+ style_ = dynamic ? InsetQuotesParams::DynamicQuotes : global_style_;
+ else
+ style_ = getStyle(style);
+
+ if (side == "left" || side == "opening")
+ side_ = InsetQuotesParams::OpeningQuote;
+ else if (side == "right" || side == "closing")
+ side_ = InsetQuotesParams::ClosingQuote;
+ else
+ setSide(c);
+}
+
+
+docstring InsetQuotes::layoutName() const
+{
+ return from_ascii("Quotes");
+}
+
+
+void InsetQuotes::setSide(char_type c)
+{
+ // Decide whether opening or closing quote
+ if (lyx::isSpace(c) || isOpenPunctuation(c))
+ side_ = InsetQuotesParams::OpeningQuote;// opening quote
+ else
+ side_ = InsetQuotesParams::ClosingQuote;// closing quote
+}
+
+
+void InsetQuotes::parseString(string const & s, bool const allow_wildcards)
+{
+ style_ = quoteparams.getQuoteStyle(s, allow_wildcards, style_);
+ side_ = quoteparams.getQuoteSide(s, allow_wildcards, side_);
+ level_ = quoteparams.getQuoteLevel(s, allow_wildcards, level_);
+}
+
+
+InsetQuotesParams::QuoteStyle InsetQuotes::getStyle(string const & s)
+{
+ InsetQuotesParams::QuoteStyle qs = InsetQuotesParams::EnglishQuotes;
+
+ if (s == "english")
+ qs = InsetQuotesParams::EnglishQuotes;
+ else if (s == "swedish")
+ qs = InsetQuotesParams::SwedishQuotes;
+ else if (s == "german")
+ qs = InsetQuotesParams::GermanQuotes;
+ else if (s == "polish")
+ qs = InsetQuotesParams::PolishQuotes;
+ else if (s == "swiss")
+ qs = InsetQuotesParams::SwissQuotes;
+ else if (s == "danish")
+ qs = InsetQuotesParams::DanishQuotes;
+ else if (s == "plain")
+ qs = InsetQuotesParams::PlainQuotes;
+ else if (s == "british")
+ qs = InsetQuotesParams::BritishQuotes;
+ else if (s == "swedishg")
+ qs = InsetQuotesParams::SwedishGQuotes;
+ else if (s == "french")
+ qs = InsetQuotesParams::FrenchQuotes;
+ else if (s == "frenchin")
+ qs = InsetQuotesParams::FrenchINQuotes;
+ else if (s == "russian")
+ qs = InsetQuotesParams::RussianQuotes;
+ else if (s == "cjk")
+ qs = InsetQuotesParams::CJKQuotes;
+ else if (s == "cjkangle")
+ qs = InsetQuotesParams::CJKAngleQuotes;
+ else if (s == "dynamic")
+ qs = InsetQuotesParams::DynamicQuotes;
+
+ return qs;
+}
+
+