[Libreoffice] [Patch] allow one anonymous db range per sheet in calc

Kohei Yoshida kyoshida at novell.com
Mon Mar 21 14:06:03 PDT 2011


Hello Markus,

On Mon, 2011-03-21 at 19:33 +0100, Markus Mohrhard wrote:

> this patch allows one anonymous db range per sheet instead of one per
> document. There are still some places the old anonymous db range is
> used, but I#m not quite sure whether i should change these.

Probably yes.  The idea is to replace the concept of one global
anonymous DB name with one anonymous name per sheet *across the calc
code*, so we need to make changes in every place where the global
anonymous name is used currently.  After this change, we will no longer
have a global anonymous name anymore (except for backward compatibility
handling in the import code, perhaps).

With that in mind, let's create a central method that generates
sheet-local anonymous names, and use it everywhere.  If I were you I
would create a static method inside ScDPCollection class for that.

> Additionally it allows one autofilter per sheet.

Nice!  This is what people have been asking for.

> I'd appreciate a better solution for generating strDBNoName, but i
> have found no way to append an integer to String.

We tend to use rtl::OUStringBuffer for appending integers to string.
So, for instance, you could do

rtl::OUStringBuffer aBuf;
aBuf.append(ScGlobal::GetRscString(STR_DB_NONAME));
aBuf.append(nTab);
aBuf.makeStringAndClear() // <= to get rtl::OUString instance.

to generate sheet local anonymous names.

BTW, how does this handle sheet position changes?  For example, let's
assume you have two sheets with auto filter applied (hence two
sheet-local anonymous DBs), and you swap their position.  Would the DB
ranges be still valid?

Kohei





More information about the LibreOffice mailing list