[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - cui/source

Julien Nabet serval2412 at yahoo.fr
Wed Dec 14 12:52:55 UTC 2016


 cui/source/tabpages/tpbitmap.cxx |   25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

New commits:
commit b8cb82eaeab9f0f36dc6dae1009d9e97108a90c3
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Mon Dec 12 21:44:59 2016 +0100

    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 at entry=0x55555b2e7950) at /home/julien/lo/libreoffice/cui/source/tabpages/tpbitmap.cxx:526
    2  0x00002aaadf90bcc7 in SvxBitmapTabPage::ClickBitmapHdl_Impl (this=this at 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 at cib.de>
    Tested-by: Katarina Behrens <Katarina.Behrens at cib.de>
    (cherry picked from commit d543d66a4ee34d3b0088f45951b56c150f7206ec)
    Reviewed-on: https://gerrit.libreoffice.org/32008
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
    Tested-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index ec7b6d5..a703aef 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);


More information about the Libreoffice-commits mailing list