[Libreoffice] [Patch] New Uno Interface for sheet local anonymous db data

Kohei Yoshida kyoshida at novell.com
Wed May 4 08:58:41 PDT 2011

On Wed, 2011-05-04 at 14:29 +0200, Markus Mohrhard wrote:
> Hello,
> for the import of the sheet local anonymous db data from excel I had
> to create a new UNO interface that supports calc's new sheet local db
> data.
> I attached my first version that compiles without any errors. But I'm
> open to any suggestion about better concepts or renaming of the
> interface.

So, I have several suggestions.  Please bear with me being a little too
nit-picky.  The API affects not just the implementers but the extension
developers as well, so I'd like to be extra picky.

* Since the interface itself has Unnamed in it, I think it's redundant
to repeat that in its methods.  When setting and getting database ranges
using this interface, we already know that they are unnamed.

* usually getFoo's counterpart is setFoo, so it's probably more
consistent to stick with this convention rather than addFoo/getFoo.  The
term 'add' also implies that you could add multiple ranges when in fact
you can't.

* I think it would look better to have all methods be consistently
named ...ByTable.  This would also future-proof ourselves in case we
decide to add more methods in the future that allow handling of
anonymous ranges that are not bound to sheets.  UNO API supports those
languages that don't support method overloading, so having unique method
names becomes important in such cases.

Also.... and I'm not 100% sure about this, but I would prefer to pass a
table index as the first parameter to the "add" method.  I know this
would make it redundant since the range struct already provides sheet
index, but IMO that method should raise the index out of bound exception
in case the sheet index is out-of-bound, and if the method doesn't take
a sheet index it may make the method a bit more confusing.  Maybe we
should create a 2-dimensional range struct for this...  but that would
be an extra hassle, so maybe not.

With these in mind, my suggested interface definition would be something

interface XUnnamedDatabaseRanges: com::sun::star::uno::XInterface
    void setNewByTable( [in] long nTab, [in] com::sun::star::table::CellRangeAddress aRange )
        raises( com::sun::star::lang::IndexOutOfBoundsException );

    any getByTable( [in] long nTab )
        raises( com::sun::star::container::NoSuchElementException,
                com::sun::star::lang::IndexOutOfBoundsException );

    boolean hasByTable ( [in] long nTab )
        raises( com::sun::star::lang::IndexOutOfBoundsException );


What do you think about this?


Kohei Yoshida, LibreOffice hacker, Calc
<kyoshida at novell.com>

More information about the LibreOffice mailing list