[Libreoffice] problem with ScTableSheetsObj::replaceByName
erack at redhat.com
Thu Feb 2 05:21:19 PST 2012
On Thursday, 2012-02-02 00:37:16 +0100, Markus Mohrhard wrote:
> while writing api tests I found ScTableSheetsObj::replaceByName. The
> method should take a name of a sheet and a ScTableSheetObj wrapped
> into an uno::Any and then replace the old sheet with the new one.
> I identified now several problems in this method. Line 2568 tests that
> the ScTableSheetObj does not yet have a ScDocShell which means it is
> not yet part of a ScDocument. But as much as I know of calc's design
> we can not have a ScTableSheetObj (the uno implementation for a single
> sheet) without it being part of a ScDocument. Normally you don't have
> access to a ScTable except through a ScDocument and a ScDocument has
> either a ScDocShell or should be an undo or copy document.
It seems (didn't check for the specific service name, there ought to be
some table somewhere) one can create a sheet instance via
ScModelObj::createInstance() that doesn't have a ScDocShell, at least
there's a comment in ScCellRangesBase ctors of which ScTableSheetObj is
derived that mentions createInstance. In fact all ScCellRangesBase
methods check for pDocShell.
> If this part of my analysis is correct there is right now no way to
> use this method without getting an exception. But even if we would be
> able to create a ScTableSheetObj that is not part of a
> ScDocument/ScDocShell we would be running in the problem that the
> method would not do more than deleting the old sheet and inserting a
> new empty sheet with the same name.
Well, yes, that seems to be the outcome ;)
> If all parts of this are correct I suggest that we implement more
> something like: delete sheet and then create a copy of the passed
> sheet at this place with the new name.
Um.. how would you create the copy?
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GnuPG key 0x293C05FD : 997A 4C60 CE41 0149 0DB3 9E96 2F1A D073 293C 05FD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: not available
More information about the LibreOffice