]> git.lyx.org Git - lyx.git/blobdiff - src/buffer.C
hopefully fix tex2lyx linking.
[lyx.git] / src / buffer.C
index 261bc0b14447e2ab16e5b8594d807782bc661b5b..43f7f7efb59cd86ba82ecf3667e9f06f0faf58ca 100644 (file)
@@ -47,6 +47,7 @@
 #include "pariterator.h"
 #include "sgml.h"
 #include "texrow.h"
+#include "TocBackend.h"
 #include "undo.h"
 #include "version.h"
 
@@ -142,7 +143,7 @@ using std::string;
 
 namespace {
 
-int const LYX_FORMAT = 253;
+int const LYX_FORMAT = 254;
 
 } // namespace anon
 
@@ -192,13 +193,16 @@ public:
 
        ///
        MacroTable macros;
+
+       ///
+       TocBackend toc_backend;
 };
 
 
 Buffer::Impl::Impl(Buffer & parent, string const & file, bool readonly_)
        : lyx_clean(true), bak_clean(true), unnamed(false), read_only(readonly_),
-         filename(file), file_fully_loaded(false),
-               inset(params)
+         filename(file), file_fully_loaded(false), inset(params),
+         toc_backend(&parent)
 {
        inset.setAutoBreakRows(true);
        lyxvc.buffer(&parent);
@@ -326,6 +330,18 @@ TexRow const & Buffer::texrow() const
 }
 
 
+TocBackend & Buffer::tocBackend()
+{
+       return pimpl_->toc_backend;
+}
+
+
+TocBackend const & Buffer::tocBackend() const
+{
+       return pimpl_->toc_backend;
+}
+
+
 string const Buffer::getLatexName(bool const no_path) const
 {
        string const name = changeExtension(makeLatexName(fileName()), ".tex");
@@ -538,11 +554,9 @@ void Buffer::insertStringAsLines(ParagraphList & pars,
                                }
                                space_inserted = true;
                        }
-/* FIXME: not needed anymore?
                } else if (!isPrintable(*cit)) {
                        // Ignore unprintables
                        continue;
-*/
                } else {
                        // just insert the character
                        par.insertChar(pos, *cit, font, params().trackChanges);
@@ -1148,9 +1162,11 @@ void Buffer::validate(LaTeXFeatures & features) const
                features.require("dvipost");
 
        // AMS Style is at document level
-       if (params().use_amsmath == BufferParams::AMS_ON
+       if (params().use_amsmath == BufferParams::package_on
            || tclass.provides(LyXTextClass::amsmath))
                features.require("amsmath");
+       if (params().use_esint == BufferParams::package_on)
+               features.require("esint");
 
        for_each(paragraphs().begin(), paragraphs().end(),
                 boost::bind(&Paragraph::validate, _1, boost::ref(features)));
@@ -1429,6 +1445,18 @@ docstring const Buffer::B_(string const & l10n) const
 }
 
 
+docstring const Buffer::translateLabel(docstring const & label) const
+{
+       if (support::isAscii(label))
+               // Probably standard layout, try to translate
+               return B_(to_ascii(label));
+       else
+               // This must be a user defined layout. We can not translate
+               // this, since gettext accepts only ascii keys.
+               return label;
+}
+
+
 bool Buffer::isClean() const
 {
        return pimpl_->lyx_clean;
@@ -1611,7 +1639,6 @@ void Buffer::changeRefsIfUnique(docstring const & from, docstring const & to,
        } else
                getLabelList(labels);
 
-       // FIXME UNICODE
        if (lyx::count(labels.begin(), labels.end(), from) > 1)
                return;