]> git.lyx.org Git - lyx.git/commitdiff
Add support for units, in docbook export of graphics.
authorJosé Matox <jamatos@lyx.org>
Wed, 29 Sep 2004 15:25:54 +0000 (15:25 +0000)
committerJosé Matox <jamatos@lyx.org>
Wed, 29 Sep 2004 15:25:54 +0000 (15:25 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9026 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ChangeLog
src/insets/insetgraphics.C
src/insets/insetgraphics.h

index 4eace2f56a0536e190fd1f88437893191b8460dd..dceb568fa42d379f49b80bc01d0a57a568323f08 100644 (file)
@@ -1,3 +1,10 @@
+2004-09-29  Andreas Vox <vox@isp.uni-luebeck.de>
+
+       * 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  <larsbj@gullik.net>
 
        * render_preview.h: Use preferred calling of Boost.Signal
index 2314504c7cd265cd2d08471737695682fbdfcc97..5bbc846cf8c7c3be40b3ccb61405ba698cf8ae2e 100644 (file)
@@ -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 << "<graphic fileref=\"&" << graphic_label << ";\"/>";
+               os << "<inlinegraphic fileref=\"&" << graphic_label << ";\" " + createDocBookAttributes() + "/>";
        } else {
                runparams.exportdata->addExternalFile("docbook",
                                                      params().filename.absFilename());
-               os << "<graphic fileref=\"&" << graphic_label << ";\">";
+               os << "<inlinegraphic fileref=\"&" << graphic_label << ";\" " + createDocBookAttributes() + "/>";
        }
        return 0;
 }
index 6f781cd304efbc91e4dcfb11b15402834d08903c..e746581252b9595ff69fd98838f63fdce2c431ac 100644 (file)
@@ -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;