Kaydet (Commit) d543d66a authored tarafından Julien Nabet's avatar Julien Nabet Kaydeden (comit) Katarina Behrens

tdf#104615: there's no mpView when opening odc directly

2 parts changed for these bts:
0  SdrEditView::GetGeoAttrFromMarked (this=0x0) at /home/julien/lo/libreoffice/svx/source/svdraw/svdedtv1.cxx:1278
1  0x00002aaadf70ae97 in SvxBitmapTabPage::Reset (this=0x55555b2eb8b0, rAttrs=0x55555afa0310) at /home/julien/lo/libreoffice/cui/source/tabpages/tpbitmap.cxx:278
See https://bugs.documentfoundation.org//show_bug.cgi?id=104615#c1

0  SdrPaintView::GetModel (this=0x0) at /home/julien/lo/libreoffice/include/svx/svdpntv.hxx:256
1  0x00002aaadf90ba0f in SvxBitmapTabPage::ModifyBitmapHdl (this=this@entry=0x55555b2e7950) at /home/julien/lo/libreoffice/cui/source/tabpages/tpbitmap.cxx:526
2  0x00002aaadf90bcc7 in SvxBitmapTabPage::ClickBitmapHdl_Impl (this=this@entry=0x55555b2e7950) at /home/julien/lo/libreoffice/cui/source/tabpages/tpbitmap.cxx:457
3  0x00002aaadf90c9d8 in SvxBitmapTabPage::Reset (this=0x55555b2e7950, rAttrs=<optimized out>) at /home/julien/lo/libreoffice/cui/source/tabpages/tpbitmap.cxx:441
See https://bugs.documentfoundation.org//show_bug.cgi?id=104615#c2

Thank you to Katarina Behrens for her help on this.
See http://nabble.documentfoundation.org/About-opening-odc-file-and-mpView-null-td4202317.html

Change-Id: Ibbca868f33ca3292e0d3f787df87876bc9464e0b
Reviewed-on: https://gerrit.libreoffice.org/31924Reviewed-by: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>
Tested-by: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>
üst bf569c3f
......@@ -275,17 +275,26 @@ bool SvxBitmapTabPage::FillItemSet( SfxItemSet* rAttrs )
void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs )
{
SfxItemSet rGeoAttr(mpView->GetGeoAttrFromMarked());
const SfxPoolItem* pItem = nullptr;
const double fUIScale(double(mpView->GetModel()->GetUIScale()));
const SfxPoolItem* pItemTransfWidth = nullptr;
const SfxPoolItem* pItemTransfHeight = nullptr;
double fUIScale = 1.0;
if (mpView)
{
fUIScale = ( mpView->GetModel() ? double(mpView->GetModel()->GetUIScale()) : 1.0);
pItem = GetItem( rGeoAttr, SID_ATTR_TRANSFORM_WIDTH );
m_fObjectWidth = std::max( pItem ? (double)static_cast<const SfxUInt32Item*>(pItem)->GetValue() : 0.0, 1.0 );
if (mpView->AreObjectsMarked())
{
SfxItemSet rGeoAttr(mpView->GetGeoAttrFromMarked());
pItemTransfWidth = GetItem( rGeoAttr, SID_ATTR_TRANSFORM_WIDTH );
pItemTransfHeight= GetItem( rGeoAttr, SID_ATTR_TRANSFORM_HEIGHT );
}
}
m_fObjectWidth = std::max( pItemTransfWidth ? (double)static_cast<const SfxUInt32Item*>(pItemTransfWidth)->GetValue() : 0.0, 1.0 );
m_fObjectHeight = std::max( pItemTransfHeight ? (double)static_cast<const SfxUInt32Item*>(pItemTransfHeight)->GetValue() : 0.0, 1.0 );
double fTmpWidth((OutputDevice::LogicToLogic(static_cast<sal_Int32>(m_fObjectWidth), mePoolUnit, MapUnit::Map100thMM )) / fUIScale);
m_fObjectWidth = fTmpWidth;
pItem = GetItem( rGeoAttr, SID_ATTR_TRANSFORM_HEIGHT );
m_fObjectHeight = std::max( pItem ? (double)static_cast<const SfxUInt32Item*>(pItem)->GetValue() : 0.0, 1.0 );
double fTmpHeight((OutputDevice::LogicToLogic(static_cast<sal_Int32>(m_fObjectHeight), mePoolUnit, MapUnit::Map100thMM )) / fUIScale);
m_fObjectHeight = fTmpHeight;
......@@ -518,7 +527,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyBitmapHdl, ValueSet*, void)
BitmapEx aBmpEx(pGraphicObject->GetGraphic().GetBitmapEx());
Size aTempBitmapSize = aBmpEx.GetSizePixel();
const double fUIScale(double(mpView->GetModel()->GetUIScale()));
const double fUIScale = ( (mpView && mpView->GetModel()) ? double(mpView->GetModel()->GetUIScale()) : 1.0);
rBitmapSize.Width() = ((OutputDevice::LogicToLogic(static_cast<sal_Int32>(aTempBitmapSize.Width()),MapUnit::MapPixel, MapUnit::Map100thMM )) / fUIScale);
rBitmapSize.Height() = ((OutputDevice::LogicToLogic(static_cast<sal_Int32>(aTempBitmapSize.Height()),MapUnit::MapPixel, MapUnit::Map100thMM )) / fUIScale);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment