]> git.lyx.org Git - features.git/blobdiff - src/insets/insetquotes.C
change to use only ostream to write latex from insets
[features.git] / src / insets / insetquotes.C
index 0e731c4c960c1a83be630816923682c859213d23..3e044d20c5ce6189a2cc1c0b25eeee50711aee1d 100644 (file)
@@ -226,13 +226,52 @@ void InsetQuotes::Read(LyXLex & lex)
 
 int InsetQuotes::Latex(ostream & os, signed char /*fragile*/) const
 {
+#ifdef USE_OSTREAM_ONLY
+       string doclang = 
+               current_view->buffer()->GetLanguage();
+       int quoteind = quote_index[side][language];
+       string qstr;
+       
+       if (lyxrc->fontenc == "T1") {
+               qstr = latex_quote_t1[times][quoteind];
+       }
+       else if (doclang == "default") {
+               qstr = latex_quote_ot1[times][quoteind];
+       } 
+       else if (language == InsetQuotes::FrenchQ 
+                && times == InsetQuotes::DoubleQ
+                && doclang == "frenchb") {
+               if (side == InsetQuotes::LeftQ) 
+                       qstr = "\\og{}";
+               else 
+                       qstr = " \\fg{}";
+       } 
+       else 
+               qstr = latex_quote_babel[times][quoteind];
+
+       // protect against !` and ?` ligatures.
+       // Is it very bad of us to always protect against those ligatures?
+#if 0
+       if ((suffixIs(file, '?') || suffixIs(file, '!'))
+           && qstr[0] == '`')
+               qstr = "{}" + qstr;
+#else
+       // Always guard against unfortunate ligatures (!` ?`)
+       qstr.insert(0, "{}");
+#endif
+
+       os << qstr;
+       return 0;
+#else
        string quote;
        int res = Latex(quote, 0);
        os << quote;
        return res;
+#endif
 }
 
 
+#ifndef USE_OSTREAM_ONLY
 int InsetQuotes::Latex(string & file, signed char /*fragile*/) const
 {
        string doclang = 
@@ -265,6 +304,7 @@ int InsetQuotes::Latex(string & file, signed char /*fragile*/) const
        file += qstr;
        return 0;
 }
+#endif
 
 
 int InsetQuotes::Linuxdoc(string & file) const