diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-15 13:52:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-15 16:08:51 +0200 |
commit | d7855213ae60d79fc51d8b9bfe49f13200137c05 (patch) | |
tree | a9f852a6ddacffce339945e8667500d3531257a4 /starmath | |
parent | b267650fd097f16d1b31c87a11a497294ad4ee42 (diff) |
add an IsEmpty method to tools::Size and use it
Change-Id: I7f5201e2ea6c74329336e16bf219630e38ff92cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92264
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/source/unomodel.cxx | 4 | ||||
-rw-r--r-- | starmath/source/view.cxx | 6 | ||||
-rw-r--r-- | starmath/source/visitors.cxx | 3 |
3 files changed, 6 insertions, 7 deletions
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index fae29907f2cf..62c2aeb60303 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -946,7 +946,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer( // if paper size is 0 (usually if no 'real' printer is found), // guess the paper size - if (aPrtPaperSize.Height() == 0 || aPrtPaperSize.Width() == 0) + if (aPrtPaperSize.IsEmpty()) aPrtPaperSize = lcl_GuessPaperSize(); awt::Size aPageSize( aPrtPaperSize.Width(), aPrtPaperSize.Height() ); @@ -1019,7 +1019,7 @@ void SAL_CALL SmModel::render( Point aPrtPageOffset( pPrinter->GetPageOffset() ); // no real printer ?? - if (aPrtPaperSize.Height() == 0 || aPrtPaperSize.Width() == 0) + if (aPrtPaperSize.IsEmpty()) { aPrtPaperSize = lcl_GuessPaperSize(); // factors from Windows DIN A4 diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 44154a3e4259..d78aa25628cf 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -599,7 +599,7 @@ void SmGraphicWindow::ZoomToFitInWindow() Size aSize (LogicToPixel(rDoc.GetSize())); Size aWindowSize (GetSizePixel()); - if (aSize.Width() > 0 && aSize.Height() > 0) + if (!aSize.IsEmpty()) { long nVal = std::min ((85 * aWindowSize.Width()) / aSize.Width(), (85 * aWindowSize.Height()) / aSize.Height()); @@ -884,7 +884,7 @@ SFX_IMPL_NAMED_VIEWFACTORY(SmViewShell, "Default") void SmViewShell::InnerResizePixel(const Point &rOfs, const Size &rSize, bool) { Size aObjSize = GetObjectShell()->GetVisArea().GetSize(); - if ( aObjSize.Width() > 0 && aObjSize.Height() > 0 ) + if ( !aObjSize.IsEmpty() ) { Size aProvidedSize = GetWindow()->PixelToLogic(rSize, MapMode(MapUnit::Map100thMM)); SfxViewShell::SetZoomFactor( Fraction( aProvidedSize.Width(), aObjSize.Width() ), @@ -1192,7 +1192,7 @@ void SmViewShell::Impl_Print(OutputDevice &rOutDev, const SmPrintUIOptions &rPri break; case PRINT_SIZE_SCALED: - if ((aSize.Width() > 0) && (aSize.Height() > 0)) + if (!aSize.IsEmpty()) { Size OutputSize (rOutDev.LogicToPixel(Size(aOutRect.GetWidth(), aOutRect.GetHeight()), MapMode(MapUnit::Map100thMM))); diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx index dcf36497a4eb..a88375a831b1 100644 --- a/starmath/source/visitors.cxx +++ b/starmath/source/visitors.cxx @@ -462,8 +462,7 @@ void SmDrawingVisitor::Visit( SmRectangleNode* pNode ) aTmp.AdjustTop(nTmpBorderWidth ); aTmp.AdjustBottom( -sal_Int32(nTmpBorderWidth) ); - SAL_WARN_IF( aTmp.GetHeight() == 0 || aTmp.GetWidth() == 0, - "starmath", "Empty rectangle" ); + SAL_WARN_IF( aTmp.IsEmpty(), "starmath", "Empty rectangle" ); //! avoid GROWING AND SHRINKING of drawn rectangle when constantly //! increasing zoomfactor. |