]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetInclude.cpp
InsetSpace support for
[lyx.git] / src / insets / InsetInclude.cpp
index 3029349d94263cb93bee606eddf7c6888a189383..971e11f2a0e461a347f094b16b6ba64ce5234106 100644 (file)
@@ -271,7 +271,7 @@ void InsetInclude::doDispatch(Cursor & cur, FuncRequest & cmd)
                                        }                                       
 
                                        if (new_label != old_label) {
-                                               label_->updateCommand(new_label);
+                                               label_->updateLabelAndRefs(new_label, &cur);
                                                // the label might have been adapted (duplicate)
                                                if (new_label != label_->getParam("name")) {
                                                        new_params.addParam("label", "{" + 
@@ -547,8 +547,7 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
        LYXERR(Debug::LATEX, "exportfile:" << exportfile);
        LYXERR(Debug::LATEX, "writefile:" << writefile);
 
-       string const tex_format = (runparams.flavor == OutputParams::LATEX) ?
-                       "latex" : "pdflatex";
+       string const tex_format = flavor2format(runparams.flavor);
        if (runparams.inComment || runparams.dryrun) {
                //Don't try to load or copy the file if we're
                //in a comment or doing a dryrun
@@ -601,7 +600,7 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
                tmp->markDepClean(masterBuffer->temppath());
 
                // Don't assume the child's format is latex
-               string const inc_format = tmp->bufferFormat();
+               string const inc_format = tmp->params().bufferFormat();
                FileName const tmpwritefile(changeExtension(writefile.absFileName(),
                        formats.extension(inc_format)));
 
@@ -628,7 +627,7 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
                                        "was not exported correctly.\nWarning: "
                                        "LaTeX export is probably incomplete."),
                                        included_file.displayName());
-                       ErrorList & el = tmp->errorList("Export");
+                       ErrorList const & el = tmp->errorList("Export");
                        if (!el.empty())
                                msg = bformat(from_ascii("%1$s\n\n%2$s\n\n%3$s"),
                                                msg, el.begin()->error,
@@ -735,7 +734,7 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
 }
 
 
-docstring InsetInclude::xhtml(XHTMLStream & xs, OutputParams const &rp) const
+docstring InsetInclude::xhtml(XHTMLStream & xs, OutputParams const & rp) const
 {
        if (rp.inComment)
                 return docstring();
@@ -779,7 +778,23 @@ docstring InsetInclude::xhtml(XHTMLStream & xs, OutputParams const &rp) const
        Buffer const * const ibuf = loadIfNeeded();
        if (!ibuf)
                return docstring();
-       ibuf->writeLyXHTMLSource(xs.os(), rp, true);
+
+       // are we generating only some paragraphs, or all of them?
+       bool const all_pars = !rp.dryrun || 
+                       (rp.par_begin == 0 && 
+                        rp.par_end == (int)buffer().text().paragraphs().size());
+       
+       OutputParams op = rp;
+       if (all_pars) {
+               op.par_begin = 0;
+               op.par_end = 0;
+               ibuf->writeLyXHTMLSource(xs.os(), op, true);
+       } else
+               xs << XHTMLStream::ESCAPE_NONE 
+                  << "<!-- Included file: " 
+                  << from_utf8(included_file.absFileName()) 
+                  << XHTMLStream::ESCAPE_NONE 
+                        << " -->";
        return docstring();
 }
 
@@ -1085,7 +1100,7 @@ void InsetInclude::updateCommand()
                return;
 
        docstring old_label = label_->getParam("name");
-       label_->updateCommand(old_label, false);
+       label_->updateLabel(old_label);
        // the label might have been adapted (duplicate)
        docstring new_label = label_->getParam("name");
        if (old_label == new_label)
@@ -1100,6 +1115,7 @@ void InsetInclude::updateCommand()
        setParams(p);   
 }
 
+
 void InsetInclude::updateBuffer(ParIterator const & it, UpdateType utype)
 {
        Buffer const * const childbuffer = getChildBuffer();