* arthur/xml_transform/templates/opendoc/css.css,
* arthur/xml_transform/templates/opendoc/opendoc_generator.sh,
* arthur/xml_transform/templates/opendoc/xsl.xsl: New.
* arthur/xml_transform/README
* arthur/xml_transform/loader.cc
* arthur/xml_transform/loader.hh
* arthur/xml_transform/main.cc
* arthur/xml_transform/xml_transform.cc
* arthur/xml_transform/xml_transform.hh
---
scribo/sandbox/ChangeLog | 15 ++++++++++++
scribo/sandbox/arthur/xml_transform/README | 9 ++++++-
scribo/sandbox/arthur/xml_transform/loader.cc | 12 ++++++++++
scribo/sandbox/arthur/xml_transform/loader.hh | 1 +
scribo/sandbox/arthur/xml_transform/main.cc | 18 ++++++++++++--
.../templates/{html => opendoc}/css.css | 1 -
.../templates/opendoc/opendoc_generator.sh | 24 ++++++++++++++++++++
.../templates/{html => opendoc}/xsl.xsl | 6 +----
.../sandbox/arthur/xml_transform/xml_transform.cc | 19 +++++++++++++++
.../sandbox/arthur/xml_transform/xml_transform.hh | 1 +
10 files changed, 96 insertions(+), 10 deletions(-)
copy scribo/sandbox/arthur/xml_transform/templates/{html => opendoc}/css.css (93%)
mode change 100644 => 100755
create mode 100755
scribo/sandbox/arthur/xml_transform/templates/opendoc/opendoc_generator.sh
copy scribo/sandbox/arthur/xml_transform/templates/{html => opendoc}/xsl.xsl (95%)
mode change 100644 => 100755
diff --git a/scribo/sandbox/ChangeLog b/scribo/sandbox/ChangeLog
index 7c53037..176e809 100644
--- a/scribo/sandbox/ChangeLog
+++ b/scribo/sandbox/ChangeLog
@@ -1,3 +1,18 @@
+2010-07-23 Arthur Crepin-Leblond <crepin(a)ptaouchnok.lrde.epita.fr>
+
+ OpenDocument output (odt and odf).
+
+ * arthur/xml_transform/templates/opendoc/css.css,
+ * arthur/xml_transform/templates/opendoc/opendoc_generator.sh,
+ * arthur/xml_transform/templates/opendoc/xsl.xsl: New.
+
+ * arthur/xml_transform/README
+ * arthur/xml_transform/loader.cc
+ * arthur/xml_transform/loader.hh
+ * arthur/xml_transform/main.cc
+ * arthur/xml_transform/xml_transform.cc
+ * arthur/xml_transform/xml_transform.hh
+
2010-07-22 Arthur Crepin-Leblond <crepin(a)ptaouchnok.lrde.epita.fr>
SVG output.
diff --git a/scribo/sandbox/arthur/xml_transform/README
b/scribo/sandbox/arthur/xml_transform/README
index 4e98a76..9ac4973 100644
--- a/scribo/sandbox/arthur/xml_transform/README
+++ b/scribo/sandbox/arthur/xml_transform/README
@@ -16,14 +16,21 @@ SVG output:
Base 64 operations:
--to-base64 <xml> <ppm> <out_xml> : Produces a container XML file
by converting cropped pictures into base 64 format.
+
+OpenDocument output:
+ --open <xml> <ppm> <out_dir> : OpenDocument output (odt, odf).
+
+Base 64 operations:
+ --to-base64 <xml> <ppm> <out_xml> : Produces a container XML file
by converting cropped pictures into base 64 format.
--to-base64-no-crop <xml> <ppm> <out_xml> : Same as to-base64 but
only the picture is converted in base 64.
--from-base64 <xml> <out_dir> : Decodes a XML container file to produce
original image files.
-For PDF/HTML/SVG output, Bourne shell scripts are provided to produce the outputs, just
run sh *_generator.sh
+For PDF/HTML/SVG/OD output, Bourne shell scripts are provided to produce the outputs,
just run sh *_generator.sh
Requirements:
PDF : fop >= 0.95
HTML : xsltproc
SVG : trunk version of fop
+OpenDocument : ooconvert
BUILD:
diff --git a/scribo/sandbox/arthur/xml_transform/loader.cc
b/scribo/sandbox/arthur/xml_transform/loader.cc
index 1698899..d4778a9 100644
--- a/scribo/sandbox/arthur/xml_transform/loader.cc
+++ b/scribo/sandbox/arthur/xml_transform/loader.cc
@@ -141,6 +141,18 @@ void Loader::add_svg_templates(QString output)
xsl.copy(output + "main.xsl");
}
+void Loader::add_open_templates(QString output)
+{
+ QFile css("templates/opendoc/css.css");
+ css.copy(output + "css.css");
+
+ QFile gen("templates/opendoc/opendoc_generator.sh");
+ gen.copy(output + "opendoc_generator.sh");
+
+ QFile xsl("templates/opendoc/xsl.xsl");
+ xsl.copy(output + "xsl.xsl");
+}
+
bool Loader::xml_output(QString xml_file, bool html, QString output)
{
QFile file(xml_file);
diff --git a/scribo/sandbox/arthur/xml_transform/loader.hh
b/scribo/sandbox/arthur/xml_transform/loader.hh
index 3cbae5c..a5c3637 100644
--- a/scribo/sandbox/arthur/xml_transform/loader.hh
+++ b/scribo/sandbox/arthur/xml_transform/loader.hh
@@ -43,6 +43,7 @@ class Loader : public QObject
bool set_output(QString& output);
void add_pdf_templates(bool crop, bool base64, QString output);
void add_svg_templates(QString output);
+ void add_open_templates(QString output);
void add_html_templates(bool base64, QString output);
};
diff --git a/scribo/sandbox/arthur/xml_transform/main.cc
b/scribo/sandbox/arthur/xml_transform/main.cc
index d1c789d..34a1b6e 100644
--- a/scribo/sandbox/arthur/xml_transform/main.cc
+++ b/scribo/sandbox/arthur/xml_transform/main.cc
@@ -19,18 +19,25 @@ int main(int argc, char **argv)
"SVG output:\n"
"\t--svg <xml> <out_dir> : SVG output (works only with base 64 xml
encoded.\n\n"
"Base 64 operations:\n"
+ "\t--to-base64 <xml> <ppm> <out_xml> : Produces a container
XML file by converting cropped pictures into base 64 format.\n\n"
+
+ "OpenDocument output:\n"
+ "\t--open <xml> <ppm> <out_dir> : OpenDocument output (odt,
odf).\n\n"
+ "Base 64 operations:\n"
"\t--to-base64 <xml> <ppm> <out_xml> : Produces a container
XML file by converting cropped pictures into base 64 format.\n"
"\t--to-base64-no-crop <xml> <ppm> <out_xml> : Same as
to-base64 but only the picture is converted in base 64.\n"
"\t--from-base64 <xml> <out_dir> : Decodes a XML container file to
produce original image files.\n\n"
- "For PDF/HTML/SVG output, Bourne shell scripts are provided to produce the
outputs, just run sh *_generator.sh \n"
+ "For PDF/HTML/SVG/OD output, Bourne shell scripts are provided to produce the
outputs, just run sh *_generator.sh \n"
"Requirements:\n"
"PDF : fop >= 0.95\n"
"HTML : xsltproc\n"
- "SVG : trunk version of fop\n";
+ "SVG : trunk version of fop\n"
+ "OpenDocument : ooconvert";
if (argc > 4)
{
std::string html = "--html";
+ std::string open = "--open";
std::string pdf = "--pdf";
std::string pdf_no_crop = "--pdf-no-crop";
std::string to_base64 = "--to-base64";
@@ -41,11 +48,16 @@ int main(int argc, char **argv)
XmlTransform xmlt(argv[2], argv[3], argv[4]);
xmlt.createHTML(false);
}
- if (pdf.compare(argv[1]) == 0)
+ else if (pdf.compare(argv[1]) == 0)
{
XmlTransform xmlt(argv[2], argv[3], argv[4]);
xmlt.createPDF(true, false);
}
+ else if (open.compare(argv[1]) == 0)
+ {
+ XmlTransform xmlt(argv[2], argv[3], argv[4]);
+ xmlt.createOpen();
+ }
else if (pdf_no_crop.compare(argv[1]) == 0)
{
XmlTransform xmlt(argv[2], argv[3], argv[4]);
diff --git a/scribo/sandbox/arthur/xml_transform/templates/html/css.css
b/scribo/sandbox/arthur/xml_transform/templates/opendoc/css.css
old mode 100644
new mode 100755
similarity index 93%
copy from scribo/sandbox/arthur/xml_transform/templates/html/css.css
copy to scribo/sandbox/arthur/xml_transform/templates/opendoc/css.css
index 0443390..1559149
--- a/scribo/sandbox/arthur/xml_transform/templates/html/css.css
+++ b/scribo/sandbox/arthur/xml_transform/templates/opendoc/css.css
@@ -1,7 +1,6 @@
.line
{
position:absolute;
- background-color:white;
z-index:7;
display:inline;
white-space:pre;
diff --git a/scribo/sandbox/arthur/xml_transform/templates/opendoc/opendoc_generator.sh
b/scribo/sandbox/arthur/xml_transform/templates/opendoc/opendoc_generator.sh
new file mode 100755
index 0000000..c2d9e6f
--- /dev/null
+++ b/scribo/sandbox/arthur/xml_transform/templates/opendoc/opendoc_generator.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+if [ -z "$1" ]
+then
+ echo "opendoc_generator <odt|odf>";
+else
+ if [ "$1" == "odt" ]
+ then
+ echo "saving to output.odt";
+ xsltproc xsl.xsl output.xml > output.html
+ ooconvert output.html output.odt
+ rm output.html
+ elif [ "$1" == "odf" ]
+ then
+ echo "saving to output.odf";
+ xsltproc xsl.xsl output.xml > output.html
+ ooconvert output.html output.odf;
+ rm output.html
+ else
+ echo "opendoc_generator <odt|odf>";
+ fi
+fi
+
+#rm output.html
\ No newline at end of file
diff --git a/scribo/sandbox/arthur/xml_transform/templates/html/xsl.xsl
b/scribo/sandbox/arthur/xml_transform/templates/opendoc/xsl.xsl
old mode 100644
new mode 100755
similarity index 95%
copy from scribo/sandbox/arthur/xml_transform/templates/html/xsl.xsl
copy to scribo/sandbox/arthur/xml_transform/templates/opendoc/xsl.xsl
index 1f29044..bf1cc30
--- a/scribo/sandbox/arthur/xml_transform/templates/html/xsl.xsl
+++ b/scribo/sandbox/arthur/xml_transform/templates/opendoc/xsl.xsl
@@ -15,8 +15,6 @@
pcGts/page/chart_region|
pcGts/page/table_region|
pcGts/page/separator_region|
- pcGts/page/text_region|
- pcGts/page/text_region/paragraph|
pcGts/page/text_region/paragraph/line">
<!-- Regions Coordinates -->
@@ -129,10 +127,8 @@
</xsl:choose>
</xsl:variable>
- <div class="line"
onmouseover="this.style.opacity=0.2;this.filters.alpha.opacity=20"
- onmouseout="this.style.opacity=1;this.filters.alpha.opacity=100">
+ <div class="line">
<xsl:attribute name="style">
- opacity:1;
height:auto;
font-size:<xsl:value-of select="$a+$d" />px;
width:<xsl:value-of select="$x2 - $x1" />px;
diff --git a/scribo/sandbox/arthur/xml_transform/xml_transform.cc
b/scribo/sandbox/arthur/xml_transform/xml_transform.cc
index c40366a..90af5a5 100644
--- a/scribo/sandbox/arthur/xml_transform/xml_transform.cc
+++ b/scribo/sandbox/arthur/xml_transform/xml_transform.cc
@@ -117,6 +117,25 @@ void XmlTransform::createPDF (bool crop, bool base64)
abort();
}
+void XmlTransform::createOpen ()
+{
+ if (loader_->xml_output(xml_file_, false, output_dir_))
+ {
+ QString output = output_dir_;
+ output.append("img");
+
+ if (loader_->set_output(output))
+ {
+ crop_->crop_regions();
+ loader_->add_open_templates(output_dir_);
+ }
+ else
+ abort();
+ }
+ else
+ abort();
+}
+
void XmlTransform::createSVG ()
{
if (loader_->xml_output(xml_file_, false, output_dir_))
diff --git a/scribo/sandbox/arthur/xml_transform/xml_transform.hh
b/scribo/sandbox/arthur/xml_transform/xml_transform.hh
index 30d5c6c..ad83fd5 100644
--- a/scribo/sandbox/arthur/xml_transform/xml_transform.hh
+++ b/scribo/sandbox/arthur/xml_transform/xml_transform.hh
@@ -43,6 +43,7 @@ class XmlTransform : public QObject
void createHTML(bool base64);
void createPDF(bool crop, bool base64);
void createSVG();
+ void createOpen();
void toBase64(bool crop);
void fromBase64();
--
1.5.6.5