[Libreoffice] [Patch] Make ScVbaWorksheet work with sheet local DBRanges

Kohei Yoshida kyoshida at novell.com
Fri Apr 22 07:18:41 PDT 2011


On Thu, 2011-04-21 at 22:34 +0200, Markus Mohrhard wrote:
> Hello,
> 
> here a short patch that reworks the
> ScVbaWorksheet::getAutoFilterMode/setAutoFilterMode methods.

Hi Markus,

Just a minor thing.  In ScVbaWorksheet::setAutoFilterMode(), you do

+        if (bAutoFilterMode && pDoc)

but you've already de-referenced pDoc before that line

+    ScDBData* pDBData = pDoc->GetAnonymousDBData(getSheetID());

so it's probably pointless to check for pDoc pointer value in that if
statement.

Taking this a step further, if you want to check the existence of the
document model to be extra safe, it's better to check the value of
pDocShell.  ScDocument instance is a concrete member of ScDocShell, so
if the ScDocShell instance exists, ScDocument that returns from it is
pretty much guaranteed to exist.

Other than that, the rest looks good to me, but I'd like Noel's blessing
on the VBA part.

Kohei

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



More information about the LibreOffice mailing list