#include "MetricsInfo.h"
#include "OutputParams.h"
#include "output_latex.h"
+#include "texstream.h"
#include "TocBackend.h"
#include "frontends/alert.h"
namespace external {
-TempName::TempName() : tempfile_(new support::TempFile("lyxextXXXXXX.tmp"))
+TempName::TempName()
{
// must have an extension for the converter code to work correctly.
+ support::TempFile f("lyxextXXXXXX.tmp");
+ // Let f go out of scope here and delete the file ourselves in
+ // ~TempName(), since otherwise external processes would not be able
+ // to use the file on windows (bug 9925). This is not as safe as
+ // keeping a support::TempFile member would be, but the best we can do.
+ f.setAutoRemove(false);
+ tempname_ = f.name();
}
-TempName::TempName(TempName const & that) : tempfile_(0)
+TempName::TempName(TempName const & that)
{
*this = that;
}
TempName::~TempName()
{
- delete tempfile_;
+ tempname_.removeFile();
}
TempName & TempName::operator=(TempName const & other)
{
if (this != &other) {
- delete tempfile_;
- tempfile_ = new support::TempFile("lyxextXXXXXX.tmp");
+ tempname_.removeFile();
+ support::TempFile f("lyxextXXXXXX.tmp");
+ f.setAutoRemove(false);
+ tempname_ = f.name();
}
return *this;
}
support::FileName TempName::operator()() const
{
- return tempfile_->name();
+ return tempname_;
}
} // namespace external
InsetExternalParams::InsetExternalParams()
: display(true),
+ preview_mode(PREVIEW_OFF),
lyxscale(defaultLyxScale),
draft(false)
{
if (lyxerr.debugging(Debug::EXTERNAL)) {
lyxerr << "InsetExternalParams::read:\n";
+ // false positive
+ // coverity[NEGATIVE_RETURNS]
write(buffer, lyxerr);
}
// Mouse hover is not copied and remains empty
InsetExternal::InsetExternal(InsetExternal const & other)
: Inset(other),
- boost::signals::trackable(),
+ boost::signals2::trackable(),
params_(other.params_),
renderer_(other.renderer_->clone(this))
{}
static docstring latexString(InsetExternal const & inset)
{
- TexRow texrow;
odocstringstream ods;
- otexstream os(ods, texrow);
+ otexstream os(ods, false);
// We don't need to set runparams.encoding since it is not used by
// latex().
OutputParams runparams(0);
if (runparams.for_tooltip)
return 0;
- TexRow texrow;
- otexstream ots(os, texrow);
+ otexstream ots(os, false);
ots << '\n'; // output external material on a new line
external::writeExternal(params_, "Ascii", buffer(), ots,
*(runparams.exportdata), false,
int InsetExternal::docbook(odocstream & os,
OutputParams const & runparams) const
{
- TexRow texrow;
odocstringstream ods;
- otexstream ots(ods, texrow);
+ otexstream ots(ods, false);
external::writeExternal(params_, "DocBook", buffer(), ots,
*(runparams.exportdata), false,
runparams.dryrun || runparams.inComment);