About opening odc file and mpView null
Katarina Behrens
Katarina.Behrens at cib.de
Mon Dec 12 12:03:48 UTC 2016
Moin Julien,
> When opening directly odc file then going to data series of the charts, then
> area tab and finally bitmap, I got a crash.
...
> Any idea how to initialize mpView in this specific case? (since I don't
> reproduce this when opening the chart from ods file for example)
Short answer: you can't really, chart2 doesn't expose Sfx*Shell, so in .odc
files the code from SvxBitmapTabPage constructor will yield NULL mpView.
You can work-around the fact though, so for UI scale (SvxBitmapTabPage::Reset)
I'd do sth like this:
double fUIScale = ( mpView && mpView->GetModel() ? mpView>GetModel()-
>GetUIScale() : 1.0 )
For the other line that relies upon the fact that mpView ain't NULL, namely:
SfxItemSet rGeoAttr(mpView->GetGeoAttrFromMarked());
First, GetGeoAttrFromMarked() only makes sense iff some object are actually
marked (mpView->AreObjectsMarked()). Second, the code that follows assumes
that rGeoAttr item set might not contain given item(s) anyway (pItem may be
null) :
m_fObjectWidth = std::max( pItem ? (double)static_cast<const
SfxUInt32Item*>(pItem)->GetValue() : 0.0, 1.0 )
so I'd restructure the code accordingly i.e. set m_fObjectWidth to 0 and
change that to real value iff we have mpView AND some objects are actually
marked.
HTH
--
Katarina Behrens
Softwareentwicklerin LibreOffice
–––
CIB software GmbH
Geschäftsstelle Hamburg
Flachsland 10
22083 Hamburg
–––
T +49 (40) / 28 48 42 -235
F +49 (40) / 28 48 42 -100
Katarina.Behrens at cib.de
www.cib.de
–––
Sitz: München
Registergericht München, HRB 123286
Geschäftsführer: Dipl.-Ing. Ulrich Brandner
More information about the LibreOffice
mailing list