diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx index 0d061f073e97..c1bcd290cd4a 100644 --- a/sc/source/ui/view/drawvie4.cxx +++ b/sc/source/ui/view/drawvie4.cxx @@ -494,10 +494,13 @@ void ScDrawView::SetMarkedOriginalSize() { tools::Rectangle aDrawRect = pObj->GetLogicRect(); - pUndoGroup->AddAction( std::make_unique( *pObj ) ); - pObj->Resize( aDrawRect.TopLeft(), double( aOriginalSize.Width() ) / aDrawRect.GetWidth(), - double( aOriginalSize.Height() ) / aDrawRect.GetHeight() ); - ++nDone; + if (aDrawRect.GetWidth() && aDrawRect.GetHeight()) + { + pUndoGroup->AddAction( std::make_unique( *pObj ) ); + pObj->Resize( aDrawRect.TopLeft(), double( aOriginalSize.Width() ) / aDrawRect.GetWidth(), + double( aOriginalSize.Height() ) / aDrawRect.GetHeight() ); + ++nDone; + } } } diff --git a/sc/source/ui/view/tabvwshh.cxx b/sc/source/ui/view/tabvwshh.cxx index 9d4b391ce52c..12503cb908bc 100644 --- a/sc/source/ui/view/tabvwshh.cxx +++ b/sc/source/ui/view/tabvwshh.cxx @@ -111,11 +111,11 @@ void ScTabViewShell::ExecuteObject( const SfxRequest& rReq ) pDrView->MoveMarkedObj( Size( nNewVal - aRect.Left(), 0 ) ); else if ( nSlotId == SID_OBJECT_TOP ) pDrView->MoveMarkedObj( Size( 0, nNewVal - aRect.Top() ) ); - else if ( nSlotId == SID_OBJECT_WIDTH ) + else if ( nSlotId == SID_OBJECT_WIDTH && aRect.GetWidth() ) pDrView->ResizeMarkedObj( aRect.TopLeft(), double(nNewVal) / aRect.GetWidth(), 1.0 ); - else // if ( nSlotId == SID_OBJECT_HEIGHT ) + else if ( nSlotId == SID_OBJECT_HEIGHT && aRect.GetHeight() ) pDrView->ResizeMarkedObj( aRect.TopLeft(), 1.0, double(nNewVal) / aRect.GetHeight() ); diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index 4ea3e5d489bd..c3205cbe37bc 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -918,9 +918,12 @@ void View::SetMarkedOriginalSize() { ::tools::Rectangle aDrawRect( pObj->GetLogicRect() ); - pUndoGroup->AddAction( mrDoc.GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) ); - pObj->Resize( aDrawRect.TopLeft(), double( aOleSize.Width() ) / aDrawRect.GetWidth(), - double( aOleSize.Height() ) / aDrawRect.GetHeight() ); + if (aDrawRect.GetWidth() && aDrawRect.GetHeight()) + { + pUndoGroup->AddAction( mrDoc.GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) ); + pObj->Resize( aDrawRect.TopLeft(), double( aOleSize.Width() ) / aDrawRect.GetWidth(), + double( aOleSize.Height() ) / aDrawRect.GetHeight() ); + } } } } diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 7454d52f8858..febdc244848c 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -737,7 +737,8 @@ SwRect SwAnchoredDrawObject::GetObjBoundRect() const nTargetHeight = nHeight * (*GetDrawObj()->GetRelativeHeight()); } - if ( nTargetWidth != aCurrObjRect.GetWidth( ) || nTargetHeight != aCurrObjRect.GetHeight( ) ) + if ( (nTargetWidth != aCurrObjRect.GetWidth( ) || nTargetHeight != aCurrObjRect.GetHeight( )) + && aCurrObjRect.GetWidth() && aCurrObjRect.GetHeight() ) { SwDoc& rDoc = const_cast(GetPageFrame()->GetFormat()->GetDoc());