#include "OutputParams.h"
#include "output_xhtml.h"
#include "sgml.h"
+#include "texstream.h"
#include "TocBackend.h"
#include "frontends/alert.h"
#include "support/os.h"
#include "support/Systemcall.h"
-#include <boost/tuple/tuple.hpp>
-
#include <algorithm>
#include <sstream>
+#include <tuple>
using namespace std;
using namespace lyx::support;
// we move it to a temp dir or uncompress it.
FileName temp_file;
GraphicsCopyStatus status;
- boost::tie(status, temp_file) =
- copyToDirIfNeeded(params().filename, temp_path);
+ tie(status, temp_file) = copyToDirIfNeeded(params().filename, temp_path);
if (status == FAILURE)
return orig_file;
if (params().filename.empty())
return string();
- string const orig_file = params().filename.absFileName();
+ if (!params().filename.isReadableFile())
+ return string();
// The master buffer. This is useful when there are multiple levels
// of include files
Buffer const * masterBuffer = buffer().masterBuffer();
- if (!params().filename.isReadableFile())
- return string();
-
// We place all temporary files in the master buffer's temp dir.
// This is possible because we use mangled file names.
// FIXME We may want to put these files in some special temporary
// Copy to temporary directory.
FileName temp_file;
GraphicsCopyStatus status;
- boost::tie(status, temp_file) =
- copyToDirIfNeeded(params().filename, temp_path);
+ tie(status, temp_file) = copyToDirIfNeeded(params().filename, temp_path);
if (status == FAILURE)
return string();
- string output_file = onlyFileName(temp_file.absFileName());
-
string const from = formats.getFormatFromFile(temp_file);
- if (from.empty())
+ if (from.empty()) {
LYXERR(Debug::GRAPHICS, "\tCould not get file format.");
+ return string();
+ }
string const to = findTargetFormat(from, runparams);
string const ext = formats.extension(to);
+ string const orig_file = params().filename.absFileName();
+ string output_file = onlyFileName(temp_file.absFileName());
LYXERR(Debug::GRAPHICS, "\t we have: from " << from << " to " << to);
LYXERR(Debug::GRAPHICS, "\tthe orig file is: " << orig_file);
// really be better to do width and height conversion, rather than to output
// these parameters here.
string imgstyle;
- if (!params().width.zero())
- imgstyle += "width:" + params().width.asHTMLString() + ";";
- if (!params().height.zero())
- imgstyle += " height:" + params().height.asHTMLString() + ";";
+ bool const havewidth = !params().width.zero();
+ bool const haveheight = !params().height.zero();
+ if (havewidth || haveheight) {
+ if (havewidth)
+ imgstyle += "width:" + params().width.asHTMLString() + ";";
+ if (haveheight)
+ imgstyle += " height:" + params().height.asHTMLString() + ";";
+ } else if (params().scale != "100") {
+ // Note that this will not have the same effect as in LaTeX export:
+ // There, the image will be scaled from its original size. Here, the
+ // percentage will be interpreted by the browser, and the image will
+ // be scaled to a percentage of the window size.
+ imgstyle = "width:" + params().scale + "%;";
+ }
if (!imgstyle.empty())
imgstyle = "style='" + imgstyle + "' ";
void InsetGraphics::addToToc(DocIterator const & cpit, bool output_active,
- UpdateType) const
+ UpdateType, TocBackend & backend) const
{
//FIXME UNICODE
docstring const str = from_utf8(params_.filename.onlyFileName());
- buffer().tocBackend().toc("graphics")->push_back(TocItem(cpit, 0, str, output_active));
+ TocBuilder & b = backend.builder("graphics");
+ b.pushItem(cpit, str, output_active);
+ b.pop();
}