]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetquotes.C
Don't remove cell selections after fontchange.
[lyx.git] / src / insets / insetquotes.C
index a2396f02349a4b9f71a5cdc93316bdb0eef569c1..d4e1541ad8721a8bf7ee7bd98c4189d8c000f664 100644 (file)
 #endif
 
 #include "insetquotes.h"
-#include "support/lyxlib.h"
-#include "debug.h"
-#include "lyxfont.h"
-#include "lyxrc.h"
-#include "buffer.h"
-#include "LaTeXFeatures.h"
+
+#include "support/LAssert.h"
 #include "support/lstrings.h"
+#include "BufferView.h"
+#include "LaTeXFeatures.h"
 #include "Painter.h"
+#include "buffer.h"
+#include "debug.h"
 #include "font.h"
 #include "language.h"
-#include "BufferView.h"
+#include "lyxfont.h"
+#include "lyxrc.h"
+#include "paragraph.h"
 
 using std::ostream;
 using std::endl;
@@ -85,7 +87,7 @@ InsetQuotes::InsetQuotes(char c, BufferParams const & params)
 {
        // Decide whether left or right 
        switch (c) {
-       case ' ': case '(': case '{': case '[': case '-': case ':':
+       case ' ': case '(': 
        case Paragraph::META_HFILL:
        case Paragraph::META_NEWLINE: 
                side_ = LeftQ;   // left quote 
@@ -153,13 +155,18 @@ string const InsetQuotes::dispString(Language const * loclang) const
                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) {
+           || 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 = "´´";
-               else if (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 (disp == "<<")
                        disp = '«';
                else if (disp == ">>")
                        disp = '»';
@@ -254,22 +261,26 @@ void InsetQuotes::read(Buffer const *, LyXLex & lex)
 extern bool use_babel;
 
 int InsetQuotes::latex(Buffer const * buf, ostream & os,
-                      bool /*fragile*/, bool) const
+                      bool /*fragile*/, bool /* free_spc */) const
 {
        // How do we get the local language here??
+       lyx::pos_type curr_pos = parOwner()->getPositionOfInset(this);
+       lyx::Assert(curr_pos != -1);
+       string const curr_lang =
+               parOwner()->getFont(buf->params,
+                                   curr_pos).language()->babel();
 
-       string const doclang = buf->getLanguage()->babel();
        const int quoteind = quote_index[side_][language_];
        string qstr;
        
        if (language_ == FrenchQ && times_ == DoubleQ
-           && doclang == "frenchb") {
+           && curr_lang == "frenchb") {
                if (side_ == LeftQ) 
                        qstr = "\\og "; //the spaces are important here
                else 
                        qstr = " \\fg{}"; //and here
        } else if (language_ == FrenchQ && times_ == DoubleQ
-                  && doclang == "french") {
+                  && curr_lang == "french") {
                if (side_ == LeftQ) 
                        qstr = "<< "; //the spaces are important here
                else 
@@ -309,7 +320,7 @@ int InsetQuotes::linuxdoc(Buffer const *, ostream & os) const
 }
 
 
-int InsetQuotes::docBook(Buffer const *, ostream & os) const
+int InsetQuotes::docbook(Buffer const *, ostream & os) const
 {
        if (times_ == DoubleQ) {
                if (side_ == LeftQ)
@@ -338,16 +349,16 @@ void InsetQuotes::validate(LaTeXFeatures & features) const
            && lyxrc.fontenc != "T1") {
                if (times_ == SingleQ) 
                        switch (type) {
-                       case ',': features.quotesinglbase = true; break;
-                       case '<': features.guilsinglleft = true; break;
-                       case '>': features.guilsinglright = true; break;
+                       case ',': features.require("quotesinglbase");  break;
+                       case '<': features.require("guilsinglleft");  break;
+                       case '>': features.require("guilsinglright"); break;
                        default: break;
                        }
                else 
                        switch (type) {
-                       case ',': features.quotedblbase = true; break;
-                       case '<': features.guillemotleft = true; break;
-                       case '>': features.guillemotright = true; break;
+                       case ',': features.require("quotedblbase");   break;
+                       case '<': features.require("guillemotleft");  break;
+                       case '>': features.require("guillemotright"); break;
                        default: break;
                        }
        }