[Libreoffice] [REVIEW] fix for fdo#39850 and fdo#39820: update range names and database ranges in formula cells

Markus Mohrhard markus.mohrhard at googlemail.com
Mon Aug 15 23:07:20 PDT 2011

this patch might be a bit to big for 3-4, but who knows:

We have three related problems:
-database range tokens must be adjusted when we copy between different
-global/local range name tokens must be updated when we copy between
different documents
-local range name tokens must be updated when we copy them between different

If we don't update the tokens in the formula cells they may point to
different entries after the copy process.

I think we have an additional related problem that might be gone with this
patch. If we have an external sheet it will be copied when we load the file.
This seems to result in some corner case that the range names in formulas
are messed up. I haven't found the bug report for this problem at the

The idea behind this patch is quite simple. For every ScNameToken we need to
update the index and for all range names also set the flag for local/global
range names. For range names we first extract the name and then search for
the name in the local and global range name container, then we can set the
token to the correct index and set the local/global flag. For database
ranges we only have a global container, so we just need to get the database
data name and then search for this name in the new  database range

I plan to use this as a base for changing the copy/paste code in master: we
can use this code to remove the part that copies all range names to the new
document/sheet. Instead we can now only copy the relevant range names to the
new document.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110816/b33bf547/attachment.htm>

More information about the LibreOffice mailing list