From: José Matox Date: Wed, 29 Sep 2004 15:25:54 +0000 (+0000) Subject: Add support for units, in docbook export of graphics. X-Git-Tag: 1.6.10~14990 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=6b9ff53e6d7359b5fc03754719734ea0932bad85;p=lyx.git Add support for units, in docbook export of graphics. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9026 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 4eace2f56a..dceb568fa4 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,10 @@ +2004-09-29 Andreas Vox + + * insetgraphics.C (docbook): create inlinegraphic instead of graphic. + + * insetgraphics.[hC] (createDocBookAttributes): Export parameters + as attributes with new method for docbook. + 2004-09-26 Lars Gullik Bjonnes * render_preview.h: Use preferred calling of Boost.Signal diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index 2314504c7c..5bbc846cf8 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -337,6 +337,35 @@ string const InsetGraphics::createLatexOptions() const } +string const InsetGraphics::createDocBookAttributes() const +{ + // Calculate the options part of the command, we must do it to a string + // stream since we copied the code from createLatexParams() + + // FIXME: av: need to translate spec -> Docbook XSL spec (http://www.sagehill.net/docbookxsl/ImageSizing.html) + // Right now it only works with my version of db2latex :-) + + ostringstream options; + if (!float_equal(params().scale, 0.0, 0.05)) { + if (!float_equal(params().scale, 100.0, 0.05)) + options << " scale=\"" << params().scale / 100.0 + << "\" "; + } else { + if (!params().width.zero()) + options << " width=\"" << params().width.asLatexString() << "\" "; + if (!params().height.zero()) + options << " depth=\"" << params().height.asLatexString() << "\" "; + } + + if (!params().special.empty()) + options << params().special << " "; + + string opts = options.str(); + // trailing blanks are ok ... + return opts; +} + + namespace { enum CopyStatus { @@ -706,11 +735,11 @@ int InsetGraphics::docbook(Buffer const &, ostream & os, if (runparams.flavor == OutputParams::XML) { runparams.exportdata->addExternalFile("docbook-xml", params().filename.absFilename()); - os << ""; + os << ""; } else { runparams.exportdata->addExternalFile("docbook", params().filename.absFilename()); - os << ""; + os << ""; } return 0; } diff --git a/src/insets/insetgraphics.h b/src/insets/insetgraphics.h index 6f781cd304..e746581252 100644 --- a/src/insets/insetgraphics.h +++ b/src/insets/insetgraphics.h @@ -95,6 +95,8 @@ private: std::string const statusMessage() const; /// Create the options for the latex command. std::string const createLatexOptions() const; + /// Create the atributes for docbook export. + std::string const createDocBookAttributes() const; /// Convert the file if needed, and return the location of the file. std::string const prepareFile(Buffer const & buf, OutputParams const &) const;