mirror of
https://github.com/webodf/WebODF.git
synced 2026-12-01 16:56:05 +01:00
Slight refactoring.
This commit is contained in:
@@ -424,6 +424,7 @@ odf.OdfCanvas = (function () {
|
||||
function namespaceResolver(prefix) {
|
||||
return namespaces[prefix];
|
||||
}
|
||||
// find all the frame elements
|
||||
frames = [];
|
||||
node = odfbody.firstChild;
|
||||
while (node && node !== odfbody) {
|
||||
@@ -441,11 +442,25 @@ odf.OdfCanvas = (function () {
|
||||
}
|
||||
}
|
||||
}
|
||||
// adjust all the frame positions
|
||||
for (i = 0; i < frames.length; i += 1) {
|
||||
node = frames[i];
|
||||
setFramePosition('frame' + String(i), node, stylesheet);
|
||||
}
|
||||
images = odfbody.getElementsByTagNameNS(drawns, 'image');
|
||||
formatParagraphAnchors(odfbody);
|
||||
}
|
||||
/**
|
||||
* Load all the images that are inside an odf element.
|
||||
* @param {!Object} container
|
||||
* @param {!Element} odffragment
|
||||
* @param {!StyleSheet} stylesheet
|
||||
* @return {undefined}
|
||||
*/
|
||||
function loadImages(container, odffragment, stylesheet) {
|
||||
var i,
|
||||
images,
|
||||
node;
|
||||
// do delayed loading for all the images
|
||||
function loadImage(name, container, node, stylesheet) {
|
||||
// load image with a small delay to give the html ui a chance to
|
||||
// update
|
||||
@@ -453,11 +468,11 @@ odf.OdfCanvas = (function () {
|
||||
setImage(name, container, node, stylesheet);
|
||||
});
|
||||
}
|
||||
images = odffragment.getElementsByTagNameNS(drawns, 'image');
|
||||
for (i = 0; i < images.length; i += 1) {
|
||||
node = /**@type{!Element}*/(images.item(i));
|
||||
loadImage('image' + String(i), container, node, stylesheet);
|
||||
}
|
||||
formatParagraphAnchors(odfbody);
|
||||
}
|
||||
/**
|
||||
* @param {Document} document Put and ODF Canvas inside this element.
|
||||
@@ -546,6 +561,7 @@ odf.OdfCanvas = (function () {
|
||||
sizer.style.background = "white";
|
||||
sizer.appendChild(odfnode);
|
||||
element.appendChild(sizer);
|
||||
loadImages(container, odfnode.body, css);
|
||||
fixContainerSize();
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -215,7 +215,8 @@ odf.OdfContainer = (function () {
|
||||
// it would make sense to move this to base64.toBase64
|
||||
while (i < privatedata.length) {
|
||||
self.url += base64.convertUTF8ArrayToBase64(
|
||||
p.slice(i, Math.min(i + chunksize, p.length)));
|
||||
p.slice(i, Math.min(i + chunksize, p.length))
|
||||
);
|
||||
i += chunksize;
|
||||
}
|
||||
}
|
||||
@@ -378,7 +379,8 @@ odf.OdfContainer = (function () {
|
||||
function handleContentXml(xmldoc) {
|
||||
var node = importRootNode(xmldoc),
|
||||
root,
|
||||
automaticStyles, fontFaceDecls,
|
||||
automaticStyles,
|
||||
fontFaceDecls,
|
||||
c;
|
||||
if (!node || node.localName !== 'document-content' ||
|
||||
node.namespaceURI !== officens) {
|
||||
@@ -589,7 +591,9 @@ odf.OdfContainer = (function () {
|
||||
}
|
||||
function createElement(Type) {
|
||||
var original = document.createElementNS(
|
||||
Type.namespaceURI, Type.localName),
|
||||
Type.namespaceURI,
|
||||
Type.localName
|
||||
),
|
||||
method,
|
||||
iface = new Type();
|
||||
for (method in iface) {
|
||||
|
||||
Reference in New Issue
Block a user