summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2016-12-12 21:44:59 +0100
committerJulien Nabet <serval2412@yahoo.fr>2016-12-14 12:52:21 +0000
commitb8cb82eaeab9f0f36dc6dae1009d9e97108a90c3 (patch)
tree67da9f71bd5adb7b3d695af565cb9453a64251a8 /cui
parentb4e1d0240ed55f05d435bb848d8f256cc81e3ba3 (diff)
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/31924 Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de> Tested-by: Katarina Behrens <Katarina.Behrens@cib.de> (cherry picked from commit d543d66a4ee34d3b0088f45951b56c150f7206ec) Reviewed-on: https://gerrit.libreoffice.org/32008 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/tabpages/tpbitmap.cxx25
1 files changed, 17 insertions, 8 deletions
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index ec7b6d55c7ea..a703aef8ede2 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -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);