]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetinclude.C
Some more changes for updating text-insets.
[lyx.git] / src / insets / insetinclude.C
index 9bc670cf7b343667920d05e403d89337df2ae623..440190bb5449d104c2d06d1b9b9d69c7a666eb76 100644 (file)
@@ -188,6 +188,22 @@ extern "C" void include_cb(FL_OBJECT *, long arg)
 }
 
 
+static string unique_id() {
+       static unsigned int seed=1000;
+
+#ifdef HAVE_SSTREAM
+       std::ostringstream ost;
+       ost << "file" << ++seed;
+#else
+       char ctmp[16];
+       ostrstream ost(ctmp,16);
+       ost << "file" << ++seed << '\0';
+#endif
+
+       return ost.str();
+}
+
+
 InsetInclude::InsetInclude(string const & fname, Buffer * bf)
        : InsetCommand("include") 
 {
@@ -195,6 +211,7 @@ InsetInclude::InsetInclude(string const & fname, Buffer * bf)
        setContents(fname);
        flag = InsetInclude::INCLUDE;
        noload = false;
+       include_label = unique_id();
 }
 
 
@@ -477,27 +494,9 @@ int InsetInclude::DocBook(Buffer const *, ostream & os) const
 }
 
 
-static unsigned int unique_id() {
-       static unsigned int seed=1000;
-
-       return ++seed;
-}
-
-
 void InsetInclude::Validate(LaTeXFeatures & features) const
 {
 
-#ifdef HAVE_SSTREAM
-       std::ostringstream ost;
-       ost << "file" << unique_id();
-       include_label = ost.str();
-#else
-       char ctmp[16];
-       ostrstream ost(ctmp,16);
-       ost << "file" << unique_id() << '\0';
-       include_label = ost.str();
-#endif
-
        string incfile(getContents());
        string writefile = ChangeExtension(getFileName(), ".sgml");
        if (!master->tmppath.empty() && !master->niceFile) {