Review Request: fix saving of textranges in KoTextWriter::Private::saveParagraph(...)
Friedrich W. H. Kossebau
kossebau at kde.org
Thu Dec 6 11:35:02 GMT 2012
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/107601/
-----------------------------------------------------------
(Updated Dec. 6, 2012, 11:35 a.m.)
Review request for Calligra and C. Boemann.
Changes
-------
Put extended rationale as comment into the text. Good thing to do, because explaining I found two more corner cases which were not covered:
* ending tags at begin of block
* final subspan
Even more confident in this patch now :)
Description
-------
After lots of experiments here finally something relatively elegant (though you should have seen my intermediate hacks to understand ;) ).
Fixes the bugs seen with e.g. orpheus on saving bookmarks, at least for me. I think/hope I catched all cases which can be there by the parameters from & to, the possible textblock contents and the possible textranges.
Usage of KoTextRangeManager::textRangesChangingWithin(...) and KoTextRange::saveOdf(...) can be surely improved, but for now this here is at least a working fix.
Here my rationale for the patch:
Start and end tags of textranges can appear on positions in a text block.
in front of the first text element, between the elements, or behind the last.
A textblock is composed of no or many text fragments.
If there is no element at all, the only possible position is 0 (relative to the
begin of the block).
Start tags are ideally written in front of the content they are tagging,
and not behind the previous content. That way tags which are at the very begin
of the text do not need special handling.
End tags are ideally written directly behind the content, and not in front of
the next content. That way end tags which are at the very end of the text
do not need special handling.
Then there is the case of start tags which are at the final position of a text block:
the content they belong to includes the block end/border, so they need to be
written at the place of the last position.
Diffs (updated)
-----
libs/kotext/KoAnnotation.h 0dfb43c
libs/kotext/KoAnnotation.cpp a700f02
libs/kotext/KoBookmark.h c64cbe1
libs/kotext/KoBookmark.cpp 5538e5f
libs/kotext/KoTextRange.h c728798
libs/kotext/opendocument/KoTextWriter_p.cpp 9cc353c
Diff: http://git.reviewboard.kde.org/r/107601/diff/
Testing
-------
Oh yes. Created reports with lots of tables & charts, updated them, saved, updated, loaded, updated, added new tables & charts, updated, saved, updated, loaded, .... And no longer any issue then, so far.
Thanks,
Friedrich W. H. Kossebau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20121206/a0855273/attachment.htm>
More information about the calligra-devel
mailing list