Angus Leeming <[EMAIL PROTECTED]> writes:

> You attached the insetcite patch...

That's what happens if you start posting before waking up ...

Sorry.
/Andreas

Index: src/buffer.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/buffer.C,v
retrieving revision 1.584
diff -u -p -r1.584 buffer.C
--- src/buffer.C        2004/10/09 21:32:55     1.584
+++ src/buffer.C        2004/10/21 07:35:00
@@ -1089,6 +1089,13 @@ void Buffer::makeDocBookFile(string cons
                        ofs << " PUBLIC \"-//OASIS//DTD DocBook V4.2//EN\"";

string preamble = params().preamble;
+ if (runparams.flavor != OutputParams::XML ) {
+ preamble += "<!ENTITY % output.print.png \"IGNORE\">\n";
+ preamble += "<!ENTITY % output.print.pdf \"IGNORE\">\n";
+ preamble += "<!ENTITY % output.print.eps \"IGNORE\">\n";
+ preamble += "<!ENTITY % output.print.bmp \"IGNORE\">\n";
+ }
+
string const name = runparams.nice ? ChangeExtension(pimpl_->filename, ".sgml")
: fname;
preamble += features.getIncludedFiles(name);
Index: src/insets/insetgraphics.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/insets/insetgraphics.C,v
retrieving revision 1.258
diff -u -p -r1.258 insetgraphics.C
--- src/insets/insetgraphics.C 2004/10/05 13:38:31 1.258
+++ src/insets/insetgraphics.C 2004/10/21 07:35:13
@@ -295,22 +295,22 @@ string const InsetGraphics::createLatexO
// before writing it to the output stream.
ostringstream options;
if (!params().bb.empty())
- options << " bb=" << rtrim(params().bb) << ",\n";
+ options << " bb=" << rtrim(params().bb) << ",\n";
if (params().draft)
- options << " draft,\n";
+ options << " draft,\n";
if (params().clip)
- options << " clip,\n";
+ options << " clip,\n";
if (!float_equal(params().scale, 0.0, 0.05)) {
if (!float_equal(params().scale, 100.0, 0.05))
- options << " scale=" << params().scale / 100.0
+ options << " scale=" << params().scale / 100.0
<< ",\n";
} else {
if (!params().width.zero())
- options << " width=" << params().width.asLatexString() << ",\n";
+ options << " width=" << params().width.asLatexString() << ",\n";
if (!params().height.zero())
- options << " height=" << params().height.asLatexString() << ",\n";
+ options << " height=" << params().height.asLatexString() << ",\n";
if (params().keepAspectRatio)
- options << " keepaspectratio,\n";
+ options << " keepaspectratio,\n";
}


// Make sure rotation angle is not very close to zero;
@@ -341,50 +341,50 @@ string const InsetGraphics::createLatexO
string const InsetGraphics::toDocbookLength(LyXLength const & len) const
{
ostringstream result;
- switch (len.unit() ) {
- case LyXLength::SP: //< Scaled point (65536sp = 1pt) TeX's smallest unit.
+ switch (len.unit()) {
+ case LyXLength::SP: // Scaled point (65536sp = 1pt) TeX's smallest unit.
result << len.value() * 65536.0 * 72 / 72.27 << "pt";
break;
- case LyXLength::PT: //< Point = 1/72.27in = 0.351mm
+ case LyXLength::PT: // Point = 1/72.27in = 0.351mm
result << len.value() * 72 / 72.27 << "pt";
break;
- case LyXLength::BP: //< Big point (72bp = 1in), also PostScript point
+ case LyXLength::BP: // Big point (72bp = 1in), also PostScript point
result << len.value() << "pt";
break;
- case LyXLength::DD: //< Didot point = 1/72 of a French inch, = 0.376mm
+ case LyXLength::DD: // Didot point = 1/72 of a French inch, = 0.376mm
result << len.value() * 0.376 << "mm";
break;
- case LyXLength::MM: //< Millimeter = 2.845pt
+ case LyXLength::MM: // Millimeter = 2.845pt
result << len.value() << "mm";
break;
- case LyXLength::PC: //< Pica = 12pt = 4.218mm
+ case LyXLength::PC: // Pica = 12pt = 4.218mm
result << len.value() << "pc";
break;
- case LyXLength::CC: //< Cicero = 12dd = 4.531mm
+ case LyXLength::CC: // Cicero = 12dd = 4.531mm
result << len.value() * 4.531 << "mm";
break;
- case LyXLength::CM: //< Centimeter = 10mm = 2.371pc
+ case LyXLength::CM: // Centimeter = 10mm = 2.371pc
result << len.value() << "cm";
break;
- case LyXLength::IN: //< Inch = 25.4mm = 72.27pt = 6.022pc
+ case LyXLength::IN: // Inch = 25.4mm = 72.27pt = 6.022pc
result << len.value() << "in";
break;
- case LyXLength::EX: //< Height of a small "x" for the current font.
+ case LyXLength::EX: // Height of a small "x" for the current font.
// Obviously we have to compromise here. Any better ratio than 1.5 ?
result << len.value() / 1.5 << "em";
break;
- case LyXLength::EM: //< Width of capital "M" in current font.
+ case LyXLength::EM: // Width of capital "M" in current font.
result << len.value() << "em";
break;
- case LyXLength::MU: //< Math unit (18mu = 1em) for positioning in math mode
+ case LyXLength::MU: // Math unit (18mu = 1em) for positioning in math mode
result << len.value() * 18 << "em";
break;
- case LyXLength::PTW: //< Percent of TextWidth
- case LyXLength::PCW: //< Percent of ColumnWidth
- case LyXLength::PPW: //< Percent of PageWidth
- case LyXLength::PLW: //< Percent of LineWidth
- case LyXLength::PTH: //< Percent of TextHeight
- case LyXLength::PPH: //< Percent of Paper
+ case LyXLength::PTW: // Percent of TextWidth
+ case LyXLength::PCW: // Percent of ColumnWidth
+ case LyXLength::PPW: // Percent of PageWidth
+ case LyXLength::PLW: // Percent of LineWidth
+ case LyXLength::PTH: // Percent of TextHeight
+ case LyXLength::PPH: // Percent of Paper
// Sigh, this will go wrong.
result << len.value() << "%";
break;
@@ -409,13 +409,13 @@ string const InsetGraphics::createDocBoo
options << " scale=\"" << static_cast<int>( (params().scale) + 0.5 )
<< "\" ";
} else {
- if ( ! params().width.zero()) {
+ if (!params().width.zero()) {
options << " width=\"" << toDocbookLength(params().width) << "\" ";
}
- if ( ! params().height.zero()) {
+ if (!params().height.zero()) {
options << " depth=\"" << toDocbookLength(params().height) << "\" ";
}
- if ( params().keepAspectRatio ) {
+ if (params().keepAspectRatio) {
// This will be irrelevant unless both width and height are set
options << "scalefit=\"1\" ";
}
@@ -788,6 +788,32 @@ int InsetGraphics::linuxdoc(Buffer const
}



+namespace {
+
+int writeImageObject(char * format, ostream& os, OutputParams const & runparams,
+ string const graphic_label, string const attributes)
+{
+ if (runparams.flavor != OutputParams::XML) {
+ os << "<![ %output.print." << format << "; [" << std::endl;
+ }
+ os <<"<imageobject><imagedata fileref=\"&"
+ << graphic_label << ";." << format << "\" " << attributes ;
+ if (runparams.flavor == OutputParams::XML) {
+ os << " role=\"" << format << "\"/>" ;
+ }
+ else {
+ os << " format=\"" << format << "\">" ;
+ }
+ os << "</imageobject>";
+ if (runparams.flavor != OutputParams::XML) {
+ os << std::endl << "]]>" ;
+ }
+ return runparams.flavor == OutputParams::XML ? 0 : 2;
+}
+// end anonymous namespace
+}
+
+
// For explanation on inserting graphics into DocBook checkout:
// http://en.tldp.org/LDP/LDP-Author-Guide/html/inserting-pictures.html
// See also the docbook guide at http://www.docbook.org/
@@ -800,15 +826,21 @@ int InsetGraphics::docbook(Buffer const
if (runparams.flavor == OutputParams::XML) {
runparams.exportdata->addExternalFile("docbook-xml",
params().filename.absFilename());
- os << "<inlinemediaobject><imageobject><imagedata fileref=\"&"
- << graphic_label << ";\" " << createDocBookAttributes()
- << "/></imageobject></inlinemediaobject>";
} else {
runparams.exportdata->addExternalFile("docbook",
params().filename.absFilename());
- os << "<inlinegraphic fileref=\"&" << graphic_label << ";\" " + createDocBookAttributes() + ">";
}
- return 0;
+ os << "<inlinemediaobject>";
+
+ int r = 0;
+ string attributes = createDocBookAttributes();
+ r += writeImageObject("png", os, runparams, graphic_label, attributes);
+ r += writeImageObject("pdf", os, runparams, graphic_label, attributes);
+ r += writeImageObject("eps", os, runparams, graphic_label, attributes);
+ r += writeImageObject("bmp", os, runparams, graphic_label, attributes);
+
+ os << "</inlinemediaobject>";
+ return r;
}





Reply via email to