+docstring const InsetQuotesParams::getGuiLabel(QuoteStyle const & qs, bool langdef) const
+{
+ docstring const styledesc =
+ bformat(_("%1$souter%2$s and %3$sinner%4$s[[quotation marks]]"),
+ docstring(1, getQuoteChar(qs, QuoteLevel::Primary, QuoteSide::Opening)),
+ docstring(1, getQuoteChar(qs, QuoteLevel::Primary, QuoteSide::Closing)),
+ docstring(1, getQuoteChar(qs, QuoteLevel::Secondary, QuoteSide::Opening)),
+ docstring(1, getQuoteChar(qs, QuoteLevel::Secondary, QuoteSide::Closing))
+ );
+
+ if (!langdef)
+ return styledesc;
+
+ return bformat(_("%1$s[[quot. mark description]] (language default)"),
+ styledesc);
+}
+
+
+docstring const InsetQuotesParams::getShortGuiLabel(docstring const & str) const
+{
+ string const s = to_ascii(str);
+ QuoteStyle const style = getQuoteStyle(s);
+ QuoteSide const side = getQuoteSide(s);
+ QuoteLevel const level = getQuoteLevel(s);
+
+ return (side == QuoteSide::Opening) ?
+ 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)
+{
+ if (buf) {
+ global_style_ = buf->masterBuffer()->params().quotes_style;
+ fontspec_ = buf->masterBuffer()->params().useNonTeXFonts;
+ }
+
+ parseString(str);
+}
+
+
+InsetQuotes::InsetQuotes(Buffer * buf, char_type c, QuoteLevel level,
+ string const & side, string const & style)
+ : Inset(buf), level_(level)
+{
+ bool dynamic = false;
+ if (buf) {
+ global_style_ = buf->masterBuffer()->params().quotes_style;
+ dynamic = buf->masterBuffer()->params().dynamic_quotes;
+ fontspec_ = buf->masterBuffer()->params().useNonTeXFonts;
+ }
+ if (style.empty())
+ style_ = dynamic ? QuoteStyle::Dynamic : global_style_;
+ else
+ style_ = getStyle(style);
+
+ if (side == "left" || side == "opening")
+ side_ = QuoteSide::Opening;
+ else if (side == "right" || side == "closing")
+ side_ = QuoteSide::Closing;
+ 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_ = QuoteSide::Opening;// opening quote
+ else
+ side_ = QuoteSide::Closing;// 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_);
+}
+
+
+QuoteStyle InsetQuotes::getStyle(string const & s)
+{
+ QuoteStyle qs = QuoteStyle::English;
+
+ if (s == "english")
+ qs = QuoteStyle::English;
+ else if (s == "swedish")
+ qs = QuoteStyle::Swedish;
+ else if (s == "german")
+ qs = QuoteStyle::German;
+ else if (s == "polish")
+ qs = QuoteStyle::Polish;
+ else if (s == "swiss")
+ qs = QuoteStyle::Swiss;
+ else if (s == "danish")
+ qs = QuoteStyle::Danish;
+ else if (s == "plain")
+ qs = QuoteStyle::Plain;
+ else if (s == "british")
+ qs = QuoteStyle::British;
+ else if (s == "swedishg")
+ qs = QuoteStyle::SwedishG;
+ else if (s == "french")
+ qs = QuoteStyle::French;
+ else if (s == "frenchin")
+ qs = QuoteStyle::FrenchIN;
+ else if (s == "russian")
+ qs = QuoteStyle::Russian;
+ else if (s == "cjk")
+ qs = QuoteStyle::CJK;
+ else if (s == "cjkangle")
+ qs = QuoteStyle::CJKAngle;
+ else if (s == "hungarian")
+ qs = QuoteStyle::Hungarian;
+ else if (s == "dynamic")
+ qs = QuoteStyle::Dynamic;
+
+ return qs;
+}
+
+