]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetquotes.C
Make it compile when USE_BOOST_FORMAT is unset
[lyx.git] / src / insets / insetquotes.C
index f001179ae9e4f3ba608a6a8109fe51133cdf25d2..1403f21a6471c08babceaab64ee77f670990d0e3 100644 (file)
@@ -1,12 +1,12 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file insetquotes.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
+ * \author Jean-Marc Lasgouttes
  *
- *         Copyright 1995 Matthias Ettrich
- *          Copyright 1995-2001 The LyX Team.
- *
- * ====================================================== */
+ * Full author contact details are available in file CREDITS
+ */
 
 #include <config.h>
 
@@ -28,6 +28,7 @@
 #include "lyxfont.h"
 #include "lyxrc.h"
 #include "paragraph.h"
+#include "lyxlex.h"
 
 using std::ostream;
 using std::endl;
@@ -52,19 +53,19 @@ int quote_index[2][6] = {
 
 // Corresponding LaTeX code, for double and single quotes.
 char const * const latex_quote_t1[2][5] =
-{ { "\\quotesinglbase{}",  "'", "`",
+{ { "\\quotesinglbase ",  "'", "`",
     "\\guilsinglleft{}", "\\guilsinglright{}" },
   { ",,", "''", "``", "<<", ">>" } };
 
 char const * const latex_quote_ot1[2][5] =
-{ { "\\quotesinglbase{}",  "'", "`",
+{ { "\\quotesinglbase ",  "'", "`",
     "\\guilsinglleft{}", "\\guilsinglright{}" },
-  { "\\quotedblbase{}", "''", "``",
+  { "\\quotedblbase ", "''", "``",
     "\\guillemotleft{}", "\\guillemotright{}" } };
 
 char const * const latex_quote_babel[2][5] =
-{ { "\\glq{}",  "'", "`", "\\flq{}", "\\frq{}" },
-  { "\\glqq{}", "''", "``", "\\flqq{}", "\\frqq{}" } };
+{ { "\\glq ",  "'", "`", "\\flq{}", "\\frq{}" },
+  { "\\glqq ", "''", "``", "\\flqq{}", "\\frqq{}" } };
 
 } // namespace anon
 
@@ -204,7 +205,7 @@ int InsetQuotes::width(BufferView *, LyXFont const & font) const
        for (string::size_type i = 0; i < text.length(); ++i) {
                if (text[i] == ' ')
                        w += font_metrics::width('i', font);
-               else if (i == 0 || text[i] != text[i-1])
+               else if (i == 0 || text[i] != text[i - 1])
                        w += font_metrics::width(text[i], font);
                else
                        w += font_metrics::width(',', font);
@@ -232,7 +233,12 @@ void InsetQuotes::draw(BufferView * bv, LyXFont const & font,
 {
        string const text = dispString(font.language());
 
-       bv->painter().text(int(x), baseline, text, font);
+       if (text.length() == 2 && text[0] == text[1]) {
+               bv->painter().text(int(x), baseline, text[0], font);
+               int x2 = int(x + font_metrics::width(',', font));
+               bv->painter().text(x2, baseline, text[0], font);
+       } else
+               bv->painter().text(int(x), baseline, text, font);
        x += width(bv, font);
 }
 
@@ -320,7 +326,7 @@ int InsetQuotes::linuxdoc(Buffer const *, ostream & os) const
 }
 
 
-int InsetQuotes::docbook(Buffer const *, ostream & os) const
+int InsetQuotes::docbook(Buffer const *, ostream & os, bool) const
 {
        if (times_ == DoubleQ) {
                if (side_ == LeftQ)