aboutsummaryrefslogtreecommitdiff
path: root/src/odf/odfLoader.ml
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2017-11-29 15:51:39 +0100
committerSébastien Dailly <sebastien@chimrod.com>2018-02-09 10:27:07 +0100
commitbb48738c4111f5f4e2faa40fe67ae1b8b9d7c2eb (patch)
treefdea7f0473453423f052700c7cf807640589ab2f /src/odf/odfLoader.ml
parent754713ed399110d5a199653a684d65cbe258bf5d (diff)
Rework on the Sheet.ml API : removed low level functions, made the sheet mutable
Diffstat (limited to 'src/odf/odfLoader.ml')
-rwxr-xr-xsrc/odf/odfLoader.ml10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/odf/odfLoader.ml b/src/odf/odfLoader.ml
index 93a6c62..280e6bd 100755
--- a/src/odf/odfLoader.ml
+++ b/src/odf/odfLoader.ml
@@ -83,7 +83,7 @@ let build_p (attributes:Xmlm.attribute list) = begin function
end
-let build_row (sheet:Sheet.Raw.t ref) (row_num:int ref) catalog (attributes:Xmlm.attribute list) (childs:tree list) = begin
+let build_row (sheet:Sheet.t) (row_num:int ref) (attributes:Xmlm.attribute list) (childs:tree list) = begin
let repetition =
try int_of_string @@ List.assoc (NS.table, "number-rows-repeated") attributes
@@ -94,7 +94,7 @@ let build_row (sheet:Sheet.Raw.t ref) (row_num:int ref) catalog (attributes:Xmlm
List.iter (function
| Cell cell ->
for i = 1 to cell.repetition do
- sheet := snd @@ Sheet.Raw.add (!cell_num, !row_num) cell.expression catalog !sheet;
+ ignore @@ Sheet.add ~history:false cell.expression (!cell_num, !row_num) sheet;
cell_num := !cell_num + cell.cell_width
done;
| _ -> ()
@@ -109,13 +109,13 @@ let data str = Data str
let load catalog source = begin
(* Mutable datas *)
- let sheet = ref Sheet.Raw.empty in
+ let sheet = Sheet.create catalog in
let cache = Hashtbl.create 10 in
let table = Base.String_dict.of_alist_exn [
((NS.text ^ "p"), build_p);
((NS.table ^ "table-cell"), build_cell cache);
- ((NS.table ^ "table-row"), build_row sheet (ref 1) catalog)
+ ((NS.table ^ "table-row"), build_row sheet (ref 1))
] in
let el (((ns, name), attributes):Xmlm.tag) childs = begin
@@ -125,6 +125,6 @@ let load catalog source = begin
end in
match Xmlm.input_doc_tree ~el ~data source with
- | _, Unit -> !sheet
+ | _, Unit -> sheet
| _ -> raise Not_found
end