background images half-work; the url is hardcoded for now.

This commit is contained in:
Chani Armitage
2010-06-24 12:51:54 -07:00
parent e967b2ce1e
commit ef15f91c6b
2 changed files with 15 additions and 2 deletions
+13
View File
@@ -1,6 +1,7 @@
function style2css(stylesheet, stylesxmldom) {
// helper constants
var xlinkns = 'http://www.w3.org/1999/xlink';
var stylens = "urn:oasis:names:tc:opendocument:xmlns:style:1.0";
var officens = "urn:oasis:names:tc:opendocument:xmlns:office:1.0";
@@ -9,6 +10,7 @@ function style2css(stylesheet, stylesxmldom) {
var drawns="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0";
var tablens="urn:oasis:names:tc:opendocument:xmlns:table:1.0";
var namespaces = {
xlink: xlinkns,
draw: drawns,
fo: fons,
office: officens,
@@ -61,6 +63,10 @@ function style2css(stylesheet, stylesxmldom) {
[ fons, 'font-size', 'font-size' ]
];
var bgImageSimpleMapping = [
[ xlinkns, 'href', 'background-image' ]
];
var paragraphPropertySimpleMapping = [
[ fons, 'text-align', 'text-align' ],
[ fons, 'padding-left', 'padding-left' ],
@@ -193,6 +199,13 @@ function style2css(stylesheet, stylesxmldom) {
function getParagraphProperties(props) {
var rule = '';
rule += applySimpleMapping(props, paragraphPropertySimpleMapping);
var imageProps = props.getElementsByTagNameNS(stylens, 'background-image');
if (imageProps.length > 0) {
//var url = imageProps.item(0).getAttributeNS(xlinkns, 'href');
var url = "http://chani.ca/avatar.png";
rule += "background-image: url('" + url + "');";
rule += "background-repeat: repeat;"; //FIXME test
}
return rule;
}