]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetinclude.C
hopefully fix tex2lyx linking.
[lyx.git] / src / insets / insetinclude.C
index af81cea20921d75e161f453d7e24df7df991b948..f0954516f42f251904a07ab4b6908e53d75c2a90 100644 (file)
@@ -30,6 +30,7 @@
 #include "lyxlex.h"
 #include "metricsinfo.h"
 #include "outputparams.h"
+#include "TocBackend.h"
 
 #include "frontends/Alert.h"
 #include "frontends/Painter.h"
 #include <boost/bind.hpp>
 #include <boost/filesystem/operations.hpp>
 
-#include "support/std_ostream.h"
-
-#include <sstream>
-
 
 namespace lyx {
 
@@ -62,7 +59,7 @@ using support::bformat;
 using support::changeExtension;
 using support::contains;
 using support::copy;
-using support::FileName;
+using support::DocFileName;
 using support::getFileContents;
 using support::isFileReadable;
 using support::isLyXFilename;
@@ -393,7 +390,7 @@ int InsetInclude::latex(Buffer const & buffer, odocstream & os,
 
        // write it to a file (so far the complete file)
        string const exportfile = changeExtension(incfile, ".tex");
-       string const mangled = FileName(changeExtension(included_file,
+       string const mangled = DocFileName(changeExtension(included_file,
                                                        ".tex")).mangledFilename();
        string const writefile = makeAbsPath(mangled, m_buffer->temppath());
 
@@ -527,7 +524,7 @@ int InsetInclude::docbook(Buffer const & buffer, odocstream & os,
        if (loadIfNeeded(buffer, params_)) {
                Buffer * tmp = theBufferList().getBuffer(included_file);
 
-               string const mangled = FileName(writefile).mangledFilename();
+               string const mangled = DocFileName(writefile).mangledFilename();
                writefile = makeAbsPath(mangled,
                                        buffer.getMasterBuffer()->temppath());
                if (!runparams.nice)
@@ -571,7 +568,7 @@ void InsetInclude::validate(LaTeXFeatures & features) const
                writefile = included_file;
 
        if (!features.runparams().nice && !isVerbatim(params_)) {
-               incfile = FileName(writefile).mangledFilename();
+               incfile = DocFileName(writefile).mangledFilename();
                writefile = makeAbsPath(incfile,
                                        buffer.getMasterBuffer()->temppath());
        }
@@ -771,6 +768,31 @@ void InsetInclude::addPreview(graphics::PreviewLoader & ploader) const
 }
 
 
+void InsetInclude::addToToc(TocList & toclist, Buffer const & buffer) const
+{
+       Buffer const * const childbuffer = getChildBuffer(buffer, params_);
+       if (!childbuffer)
+               return;
+
+       TocList const & childtoclist = childbuffer->tocBackend().tocs();
+       TocList::const_iterator it = childtoclist.begin();
+       TocList::const_iterator const end = childtoclist.end();
+       for(; it != end; ++it)
+               toclist[it->first].insert(toclist[it->first].end(),
+                               it->second.begin(), it->second.end());
+}
+
+
+void InsetInclude::updateLabels(Buffer const & buffer) const
+{
+       Buffer const * const childbuffer = getChildBuffer(buffer, params_);
+       if (!childbuffer)
+               return;
+
+       lyx::updateLabels(*childbuffer, true);
+}
+
+
 string const InsetIncludeMailer::name_("include");
 
 InsetIncludeMailer::InsetIncludeMailer(InsetInclude & inset)