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 | |
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>
75 files changed, 103 insertions, 115 deletions
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx index 3e95252d6ad0..afb4a674cbb9 100644 --- a/avmedia/source/viewer/mediawindow_impl.cxx +++ b/avmedia/source/viewer/mediawindow_impl.cxx @@ -577,7 +577,7 @@ void MediaWindowImpl::Paint(vcl::RenderContext& rRenderContext, const tools::Rec const Point aBasePos(mpChildWindow->GetPosPixel()); const tools::Rectangle aVideoRect(aBasePos, mpChildWindow->GetSizePixel()); - if (pLogo && !pLogo->IsEmpty() && (aVideoRect.GetWidth() > 0) && (aVideoRect.GetHeight() > 0)) + if (pLogo && !pLogo->IsEmpty() && !aVideoRect.IsEmpty()) { Size aLogoSize(pLogo->GetSizePixel()); const Color aBackgroundColor(67, 67, 67); diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index b668ba6e7ebd..1e25750eefc6 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -362,7 +362,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs ) ClickScaleHdl(*m_xTsbScale); - if(rBitmapSize.Width() > 0 && rBitmapSize.Height() > 0) + if(!rBitmapSize.IsEmpty()) { if (eRelative == TRISTATE_TRUE) { @@ -436,7 +436,7 @@ void SvxBitmapTabPage::ClickBitmapHdl_Impl() void SvxBitmapTabPage::CalculateBitmapPresetSize() { - if(rBitmapSize.Width() > 0 && rBitmapSize.Height() > 0) + if(!rBitmapSize.IsEmpty()) { long nObjectWidth = static_cast<long>(m_fObjectWidth); long nObjectHeight = static_cast<long>(m_fObjectHeight); diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx index fe9475d36170..58ec7423de8f 100644 --- a/filter/source/graphicfilter/ipict/ipict.cxx +++ b/filter/source/graphicfilter/ipict/ipict.cxx @@ -224,7 +224,7 @@ private: // returns true if there's no need to print the shape/text/frame bool IsInvisible( PictDrawingMethod eMethod ) const { if ( eActROP == RasterOp::N1 ) return true; - if ( eMethod == PictDrawingMethod::FRAME && ( nActPenSize.Width() == 0 || nActPenSize.Height() == 0 ) ) return true; + if ( eMethod == PictDrawingMethod::FRAME && nActPenSize.IsEmpty() ) return true; return false; } diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 4c195865a2fc..6c244b25160d 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -1154,8 +1154,7 @@ static void ApplyRectangularGradientAsBitmap( const SvxMSDffManager& rManager, S { Size aBitmapSizePixel( static_cast< sal_Int32 >( ( rObjData.aBoundRect.GetWidth() / 2540.0 ) * 90.0 ), // we will create a bitmap with 90 dpi static_cast< sal_Int32 >( ( rObjData.aBoundRect.GetHeight() / 2540.0 ) * 90.0 ) ); - if (!(aBitmapSizePixel.Width() > 0 && aBitmapSizePixel.Height() > 0 && - aBitmapSizePixel.Width() <= 1024 && aBitmapSizePixel.Height() <= 1024)) + if (aBitmapSizePixel.IsEmpty() || aBitmapSizePixel.Width() > 1024 || aBitmapSizePixel.Height() > 1024) return; double fFocusX = rManager.GetPropertyValue( DFF_Prop_fillToRight, 0 ) / 65536.0; diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx index 947cd4bf4862..efba924622ab 100644 --- a/framework/source/fwe/classes/addonsoptions.cxx +++ b/framework/source/fwe/classes/addonsoptions.cxx @@ -1577,7 +1577,7 @@ Image AddonsOptions_Impl::ReadImageFromURL(const OUString& aImageURL) BitmapEx aBitmapEx = aGraphic.GetBitmapEx(); Size aBmpSize = aBitmapEx.GetSizePixel(); - if ( aBmpSize.Width() > 0 && aBmpSize.Height() > 0 ) + if ( !aBmpSize.IsEmpty() ) { // Support non-transparent bitmaps to be downward compatible with OOo 1.1.x addons if( !aBitmapEx.IsTransparent() ) diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 924e21c2b3c4..e63466746b44 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -2350,7 +2350,7 @@ bool LayoutManager::implts_resizeContainerWindow( const awt::Size& rContainerSiz sal_Int32 nDisplay = xContainerTopWindow->getDisplay(); tools::Rectangle aWorkArea = Application::GetScreenPosSizePixel( nDisplay ); - if (( aWorkArea.GetWidth() > 0 ) && ( aWorkArea.GetHeight() > 0 )) + if (!aWorkArea.IsEmpty()) { if (( rContainerSize.Width > aWorkArea.GetWidth() ) || ( rContainerSize.Height > aWorkArea.GetHeight() )) return false; diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index 9bb4c8e2a102..b5418af17d96 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -2479,7 +2479,7 @@ void ToolbarLayoutManager::implts_calcWindowPosSizeOnSingleRowColumn( aMinSize = static_cast<ToolBox *>(pWindow.get())->CalcMinimumWindowSizePixel(); } - if (( aMinSize.Width() > 0 ) && ( aMinSize.Height() > 0 )) + if ( !aMinSize.IsEmpty() ) { if ( isHorizontalDockingArea( nDockingArea )) { diff --git a/framework/source/uielement/imagebuttontoolbarcontroller.cxx b/framework/source/uielement/imagebuttontoolbarcontroller.cxx index 3d9997aaaa57..340999620c68 100644 --- a/framework/source/uielement/imagebuttontoolbarcontroller.cxx +++ b/framework/source/uielement/imagebuttontoolbarcontroller.cxx @@ -130,7 +130,7 @@ bool ImageButtonToolbarController::ReadImageFromURL( bool bBigImage, const OUStr const ::Size aSize = bBigImage ? aImageSizeBig : aImageSizeSmall; // Sizes used for toolbar images ::Size aBmpSize = aBitmapEx.GetSizePixel(); - if ( aBmpSize.Width() > 0 && aBmpSize.Height() > 0 ) + if ( !aBmpSize.IsEmpty() ) { ::Size aNoScaleSize( aBmpSize.Width(), aSize.Height() ); if ( aBmpSize != aNoScaleSize ) diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx index 0165cff1c5b8..fb4a14f1db7b 100644 --- a/include/tools/gen.hxx +++ b/include/tools/gen.hxx @@ -196,6 +196,8 @@ public: void setWidth(long nWidth) { nA = nWidth; } void setHeight(long nHeight) { nB = nHeight; } + bool IsEmpty() const { return nA <= 0 || nB <= 0; } + void extendBy(long x, long y) { nA += x; diff --git a/reportdesign/source/ui/report/ScrollHelper.cxx b/reportdesign/source/ui/report/ScrollHelper.cxx index 08c7d22729d7..305da63c38f4 100644 --- a/reportdesign/source/ui/report/ScrollHelper.cxx +++ b/reportdesign/source/ui/report/ScrollHelper.cxx @@ -122,7 +122,7 @@ Size OScrollWindowHelper::ResizeScrollBars() { // get the new output-size in pixel Size aOutPixSz = GetOutputSizePixel(); - if ( aOutPixSz.Width() == 0 || aOutPixSz.Height() == 0 ) + if ( aOutPixSz.IsEmpty() ) return aOutPixSz; aOutPixSz.AdjustHeight( -(m_aReportWindow->getRulerHeight()) ); diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx index 6c2645077d70..d33ccf6ddf0d 100644 --- a/sc/source/core/data/table5.cxx +++ b/sc/source/core/data/table5.cxx @@ -1025,7 +1025,7 @@ void ScTable::SyncColRowFlags() void ScTable::SetPageSize( const Size& rSize ) { - if ( rSize.Width() != 0 && rSize.Height() != 0 ) + if ( !rSize.IsEmpty() ) { if (aPageSizeTwips != rSize) InvalidatePageBreaks(); diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index c3cc1b38190e..5437f5060540 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -3428,7 +3428,7 @@ XclExpChartDrawing::XclExpChartDrawing( const XclExpRoot& rRoot, const Reference< XModel >& rxModel, const Size& rChartSize ) : XclExpRoot( rRoot ) { - if( (rChartSize.Width() > 0) && (rChartSize.Height() > 0) ) + if( !rChartSize.IsEmpty() ) { ScfPropertySet aPropSet( rxModel ); Reference< XShapes > xShapes; diff --git a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx index eb701ca85cc2..2d762fd41d9a 100644 --- a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx +++ b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx @@ -1429,7 +1429,7 @@ css::awt::Rectangle ScAccessibleCsvCell::implGetBounds() tools::Rectangle aRect( implGetRealPos(), implGetRealSize() ); aRect.Intersection( aClipRect ); - if( (aRect.GetWidth() <= 0) || (aRect.GetHeight() <= 0) ) + if( aRect.IsEmpty() ) aRect.SetSize( Size( -1, -1 ) ); return css::awt::Rectangle(aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight()); diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index b80ab75b75ae..c9b69f63ad5e 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -520,7 +520,7 @@ void ScInputWindow::NotifyLOKClient() if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier()) { Size aSize = GetSizePixel(); - if (aSize.Width() != 0 && aSize.Height() != 0) + if (!aSize.IsEmpty()) { std::vector<vcl::LOKPayloadItem> aItems; aItems.emplace_back("type", "calc-input-win"); diff --git a/sc/source/ui/cctrl/cbuttonw.cxx b/sc/source/ui/cctrl/cbuttonw.cxx index 6a6a76892704..52660ee7a28d 100644 --- a/sc/source/ui/cctrl/cbuttonw.cxx +++ b/sc/source/ui/cctrl/cbuttonw.cxx @@ -49,7 +49,7 @@ void ScDDComboBoxButton::SetOptSizePixel() void ScDDComboBoxButton::Draw( const Point& rAt, const Size& rSize ) { - if ( rSize.Width() == 0 || rSize.Height() == 0 ) + if ( rSize.IsEmpty() ) return; // save old state diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index e18dd815396f..6b3cc310e98c 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -313,7 +313,7 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* aSize = Size( aSz.Width, aSz.Height ); aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) ); - if (aSize.Height() == 0 || aSize.Width() == 0) + if (aSize.IsEmpty()) { // rectangle with balanced edge ratio aSize.setWidth( 5000 ); @@ -498,7 +498,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawV MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) ); bool bSizeCh = false; - if (aSize.Height() <= 0 || aSize.Width() <= 0) + if (aSize.IsEmpty()) { aSize.setWidth( 5000 ); aSize.setHeight( 5000 ); @@ -651,7 +651,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawV >>= aDialogAWTSize ) { Size aDialogSize( aDialogAWTSize.Width, aDialogAWTSize.Height ); - if ( aDialogSize.Width() > 0 && aDialogSize.Height() > 0 ) + if ( !aDialogSize.IsEmpty() ) { //calculate and set new position Point aDialogPos = rViewShell.GetChartDialogPos( aDialogSize, aRect ); diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index f4f61330b4fb..fa8c8d854460 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -305,7 +305,7 @@ void ScTabViewShell::UpdateOleZoom() { //TODO/LATER: is there a difference between the two GetVisArea methods? Size aObjSize = static_cast<const SfxObjectShell*>(pDocSh)->GetVisArea().GetSize(); - if ( aObjSize.Width() > 0 && aObjSize.Height() > 0 ) + if ( !aObjSize.IsEmpty() ) { vcl::Window* pWin = GetActiveWin(); Size aWinHMM = pWin->PixelToLogic(pWin->GetOutputSizePixel(), MapMode(MapUnit::Map100thMM)); @@ -330,7 +330,7 @@ void ScTabViewShell::InnerResizePixel( const Point &rOfs, const Size &rSize, boo aSize.AdjustWidth( -(aBorder.Left() + aBorder.Right()) ); aSize.AdjustHeight( -(aBorder.Top() + aBorder.Bottom()) ); - if ( aObjSize.Width() > 0 && aObjSize.Height() > 0 ) + if ( !aObjSize.IsEmpty() ) { Size aLogicSize = GetWindow()->PixelToLogic(aSize, MapMode(MapUnit::Map100thMM)); SfxViewShell::SetZoomFactor( Fraction( aLogicSize.Width(),aObjSize.Width() ), diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx index 86b6f0f2f155..a438fcca7800 100644 --- a/sc/source/ui/view/viewfun7.cxx +++ b/sc/source/ui/view/viewfun7.cxx @@ -328,7 +328,7 @@ bool ScViewFunc::PasteObject( const Point& rPos, const uno::Reference < embed::X aSize = Size( aSz.Width, aSz.Height ); aSize = OutputDevice::LogicToLogic(aSize, MapMode(aMapObj), MapMode(aMap100)); // for SdrOle2Obj - if( aSize.Height() == 0 || aSize.Width() == 0 ) + if( aSize.IsEmpty() ) { OSL_FAIL("SvObjectDescriptor::GetSize == 0"); aSize.setWidth( 5000 ); diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index b56f82c13051..f3e7faf875f3 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -92,7 +92,7 @@ sal_uInt16 PPTExBulletProvider::GetId(Graphic const & rGraphic, Size& rGraphicSi if ( rGraphicSize.Width() && rGraphicSize.Height() ) { - if (aPrefSize.Width() == 0 || aPrefSize.Height() == 0) + if (aPrefSize.IsEmpty()) { aBmpEx.Scale(aPrefSize); } diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index 7b66e6a53348..970076977ec2 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -338,7 +338,7 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq ) Size aSize( aSz.Width, aSz.Height ); - if (aSize.Height() == 0 || aSize.Width() == 0) + if (aSize.IsEmpty()) { // rectangle with balanced edge ratio aSize.setWidth( 14100 ); @@ -514,7 +514,7 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq ) aSize =Size( aSz.Width, aSz.Height ); aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) ); - if (aSize.Height() == 0 || aSize.Width() == 0) + if (aSize.IsEmpty()) { // rectangle with balanced edge ratio aSize.setWidth( 14100 ); diff --git a/sd/source/ui/sidebar/MasterPageContainer.cxx b/sd/source/ui/sidebar/MasterPageContainer.cxx index 67b6dbe9f37b..21fb595e9624 100644 --- a/sd/source/ui/sidebar/MasterPageContainer.cxx +++ b/sd/source/ui/sidebar/MasterPageContainer.cxx @@ -566,7 +566,7 @@ void MasterPageContainer::Implementation::UpdatePreviewSizePixel() if (iDescriptor != maContainer.end()) { Size aPageSize ((*iDescriptor)->mpMasterPage->GetSize()); - OSL_ASSERT(aPageSize.Width() > 0 && aPageSize.Height() > 0); + OSL_ASSERT(!aPageSize.IsEmpty()); if (aPageSize.Width() > 0) nWidth = aPageSize.Width(); if (aPageSize.Height() > 0) diff --git a/sd/source/ui/sidebar/PreviewValueSet.cxx b/sd/source/ui/sidebar/PreviewValueSet.cxx index 44d578576b4f..56863fc47f38 100644 --- a/sd/source/ui/sidebar/PreviewValueSet.cxx +++ b/sd/source/ui/sidebar/PreviewValueSet.cxx @@ -73,7 +73,7 @@ void PreviewValueSet::Resize() SvtValueSet::Resize(); Size aWindowSize (GetOutputSizePixel()); - if (aWindowSize.Width()>0 && aWindowSize.Height()>0) + if (!aWindowSize.IsEmpty()) { Rearrange(); } diff --git a/sd/source/ui/slideshow/slideshowviewimpl.cxx b/sd/source/ui/slideshow/slideshowviewimpl.cxx index aef1594f5b1d..56d14adf2370 100644 --- a/sd/source/ui/slideshow/slideshowviewimpl.cxx +++ b/sd/source/ui/slideshow/slideshowviewimpl.cxx @@ -330,7 +330,7 @@ geometry::AffineMatrix2D SAL_CALL SlideShowView::getTransformation( ) const Size& rTmpSize( mrOutputWindow.GetSizePixel() ); - if (rTmpSize.Width()<=0 || rTmpSize.Height()<=0) + if (rTmpSize.IsEmpty()) { return geometry::AffineMatrix2D (1,0,0,0,1,0); } diff --git a/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx index d2d0a241e507..4136cb49d6bc 100644 --- a/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx +++ b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx @@ -119,7 +119,7 @@ BitmapEx GenericPageCache::GetPreviewBitmap ( { // Scale the bitmap to the desired size when that is possible, // i.e. the bitmap is not empty. - if (bResize && aBitmapSize.Width()>0 && aBitmapSize.Height()>0) + if (bResize && !aBitmapSize.IsEmpty()) { aPreview.Scale(maPreviewSize); } diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx index 82eb09404c3d..6b090fbe5f5a 100644 --- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx +++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx @@ -292,7 +292,7 @@ void SlideSorterView::Rearrange() if ( ! pWindow) return; const Size aWindowSize (pWindow->GetSizePixel()); - if (aWindowSize.Width()<=0 || aWindowSize.Height()<=0) + if (aWindowSize.IsEmpty()) return; const bool bRearrangeSuccess ( diff --git a/sd/source/ui/slidesorter/view/SlsLayouter.cxx b/sd/source/ui/slidesorter/view/SlsLayouter.cxx index b4c6dfd428e0..86205e8eca63 100644 --- a/sd/source/ui/slidesorter/view/SlsLayouter.cxx +++ b/sd/source/ui/slidesorter/view/SlsLayouter.cxx @@ -484,9 +484,9 @@ bool Layouter::Implementation::Rearrange ( mnPageCount = nPageCount; // Return early when the window or the model have not yet been initialized. - if (rWindowSize.Width()<=0 || rWindowSize.Height()<=0) + if (rWindowSize.IsEmpty()) return false; - if (rPreviewModelSize.Width()<=0 || rPreviewModelSize.Height()<=0) + if (rPreviewModelSize.IsEmpty()) return false; CalculateRowAndColumnCount(rWindowSize); diff --git a/sd/source/ui/tools/PreviewRenderer.cxx b/sd/source/ui/tools/PreviewRenderer.cxx index 8f5d2dd73609..34f394737c09 100644 --- a/sd/source/ui/tools/PreviewRenderer.cxx +++ b/sd/source/ui/tools/PreviewRenderer.cxx @@ -358,7 +358,7 @@ void PreviewRenderer::SetupOutputSize ( // Adapt it to the desired width. const Size aPageModelSize (rPage.GetSize()); - if (aPageModelSize.Width()>0 || aPageModelSize.Height()>0) + if (!aPageModelSize.IsEmpty()) { const sal_Int32 nFrameWidth (mbHasFrame ? snFrameWidth : 0); aMapMode.SetScaleX( diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 57b18bb945e4..ce7e22c52f84 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -466,7 +466,7 @@ bool ViewShellBase::HasSelection(bool bText) const void ViewShellBase::InnerResizePixel (const Point& rOrigin, const Size &rSize, bool) { Size aObjSize = GetObjectShell()->GetVisArea().GetSize(); - if ( aObjSize.Width() > 0 && aObjSize.Height() > 0 ) + if ( !aObjSize.IsEmpty() ) { SvBorder aBorder( GetBorderPixel() ); Size aSize( rSize ); diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index 39097ac7fdfb..96b23e87f71b 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -1209,7 +1209,7 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) ::tools::Rectangle aVisArea = mpFrameView->GetVisArea(); Size aVisAreaSize = aVisArea.GetSize(); - if (aVisAreaSize.Height()!=0 && aVisAreaSize.Width()!=0) + if (!aVisAreaSize.IsEmpty()) { mbZoomOnPage = false; SetZoomRect(aVisArea); diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 3ac055930198..9ef01355849c 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -877,7 +877,7 @@ void ViewShell::Resize() // Make sure that the new size is not degenerate. const Size aSize (mpParentWindow->GetSizePixel()); - if (aSize.Width()==0 || aSize.Height()==0) + if (aSize.IsEmpty()) return; // Remember the new position and size. diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx index fda8a28dc7ad..f3488e417f84 100644 --- a/sfx2/source/control/thumbnailview.cxx +++ b/sfx2/source/control/thumbnailview.cxx @@ -207,7 +207,7 @@ void ThumbnailView::DrawItem(ThumbnailViewItem const *pItem) { ::tools::Rectangle aRect = pItem->getDrawArea(); - if ((aRect.GetHeight() > 0) && (aRect.GetWidth() > 0)) + if (!aRect.IsEmpty()) Invalidate(aRect); } } @@ -1382,7 +1382,7 @@ void SfxThumbnailView::DrawItem(ThumbnailViewItem const *pItem) { ::tools::Rectangle aRect = pItem->getDrawArea(); - if ((aRect.GetHeight() > 0) && (aRect.GetWidth() > 0)) + if (!aRect.IsEmpty()) Invalidate(aRect); } } diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx index ff892863dd0d..8af946eeab82 100644 --- a/sfx2/source/doc/new.cxx +++ b/sfx2/source/doc/new.cxx @@ -58,7 +58,7 @@ void SfxPreviewWin_Impl::ImpPaint(vcl::RenderContext& rRenderContext, GDIMetaFil rRenderContext.DrawRect(tools::Rectangle(Point(0,0), rRenderContext.GetOutputSize())); Size aTmpSize = pFile ? pFile->GetPrefSize() : Size(1, 1); - DBG_ASSERT(aTmpSize.Height() != 0 && aTmpSize.Width() != 0, "size of first page is 0, override GetFirstPageSize or set visible-area!"); + DBG_ASSERT(!aTmpSize.IsEmpty(), "size of first page is 0, override GetFirstPageSize or set visible-area!"); #define FRAME 4 diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 17f3f1263404..8bdafbc3a5c8 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -131,7 +131,7 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( bool bFullContent ) const } xFile->SetPrefSize( aTmpSize ); - DBG_ASSERT( aTmpSize.Height() != 0 && aTmpSize.Width() != 0, + DBG_ASSERT( !aTmpSize.IsEmpty(), "size of first page is 0, override GetFirstPageSize or set visible-area!" ); xFile->Record( pDevice ); 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. diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index cd85b2756ea1..cd62dff7c05a 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -1874,8 +1874,7 @@ void BrowseBox::MakeFieldVisible Size aTestSize = pDataWin->GetSizePixel(); - if ( !bBootstrapped || - ( aTestSize.Width() == 0 && aTestSize.Height() == 0 ) ) + if ( !bBootstrapped || aTestSize.IsEmpty() ) return; // is it visible already? diff --git a/svtools/source/filter/DocumentToGraphicRenderer.cxx b/svtools/source/filter/DocumentToGraphicRenderer.cxx index bec55b93fbe3..415ab353e73f 100644 --- a/svtools/source/filter/DocumentToGraphicRenderer.cxx +++ b/svtools/source/filter/DocumentToGraphicRenderer.cxx @@ -204,8 +204,7 @@ Graphic DocumentToGraphicRenderer::renderToGraphic( if (!xDevice.is()) return Graphic(); - assert( aDocumentSizePixel.Width() > 0 && aDocumentSizePixel.Height() > 0 && - aTargetSizePixel.Width() > 0 && aTargetSizePixel.Height() > 0); + assert( !aDocumentSizePixel.IsEmpty() && !aTargetSizePixel.IsEmpty()); double fScaleX = aTargetSizePixel.Width() / static_cast<double>(aDocumentSizePixel.Width()); double fScaleY = aTargetSizePixel.Height() / static_cast<double>(aDocumentSizePixel.Height()); diff --git a/svx/source/dialog/hyperdlg.cxx b/svx/source/dialog/hyperdlg.cxx index 27976ef1bd20..c94fb35c1239 100644 --- a/svx/source/dialog/hyperdlg.cxx +++ b/svx/source/dialog/hyperdlg.cxx @@ -44,8 +44,7 @@ SvxHlinkDlgWrapper::SvxHlinkDlgWrapper( vcl::Window* _pParent, sal_uInt16 nId, SetVisible_Impl(false); vcl::Window* pTopWindow = nullptr; - if ( pInfo->aSize.Width() != 0 && pInfo->aSize.Height() != 0 && - (nullptr != (pTopWindow = SfxGetpApp()->GetTopWindow()))) + if ( !pInfo->aSize.IsEmpty() && (nullptr != (pTopWindow = SfxGetpApp()->GetTopWindow()))) { weld::Dialog* pDialog = GetController()->getDialog(); diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx index 4adb4fe49dba..f1ef6bc17bd5 100644 --- a/svx/source/gallery2/galobj.cxx +++ b/svx/source/gallery2/galobj.cxx @@ -98,7 +98,7 @@ bool SgaObject::CreateThumb( const Graphic& rGraphic ) { Size aLogSize( OutputDevice::LogicToLogic(aBmpEx.GetPrefSize(), aBmpEx.GetPrefMapMode(), MapMode(MapUnit::Map100thMM)) ); - if( aLogSize.Width() > 0 && aLogSize.Height() > 0 ) + if( !aLogSize.IsEmpty() ) { double fFactorLog = static_cast< double >( aLogSize.Width() ) / aLogSize.Height(); double fFactorPix = static_cast< double >( aBmpSize.Width() ) / aBmpSize.Height(); diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx index 6960a87b659e..e89f48a9bf6a 100644 --- a/svx/source/sidebar/nbdtmg.cxx +++ b/svx/source/sidebar/nbdtmg.cxx @@ -845,12 +845,10 @@ void OutlineTypeMgr::ApplyNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt1 const Graphic* pGrf = pLevelSettings->pBrushItem->GetGraphic(); Size aSize = pLevelSettings->aSize; sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; - if (!isResetSize && aFmt.GetGraphicSize()!=Size(0,0)) aSize=aFmt.GetGraphicSize(); - else { - if (aSize.Width()==0 && aSize.Height()==0 && pGrf) { - aSize = SvxNumberFormat::GetGraphicSizeMM100( pGrf ); - } - } + if (!isResetSize && aFmt.GetGraphicSize()!=Size(0,0))\ + aSize = aFmt.GetGraphicSize(); + else if (aSize.IsEmpty() && pGrf) + aSize = SvxNumberFormat::GetGraphicSizeMM100( pGrf ); aSize = OutputDevice::LogicToLogic(aSize, MapMode(MapUnit::Map100thMM), MapMode(GetMapUnit())); aFmt.SetGraphicBrush( pLevelSettings->pBrushItem, &aSize, &eOrient ); } diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 9b76a6eafe31..4fc4ded76971 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -2026,7 +2026,7 @@ void SdrObjEditView::ImpMakeTextCursorAreaVisible() if (pCsr != nullptr) { Size aSiz(pCsr->GetSize()); - if (aSiz.Width() != 0 && aSiz.Height() != 0) + if (!aSiz.IsEmpty()) { MakeVisible(tools::Rectangle(pCsr->GetPos(), aSiz), *pTextEditWin); } diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 232b727f4497..6c77b5b306ce 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -2245,7 +2245,7 @@ void SdrObjCustomShape::SuggestTextFrameSize(Size aSuggestedTextFrameSize) bool SdrObjCustomShape::AdjustTextFrameWidthAndHeight(tools::Rectangle& rR, bool bHgt, bool bWdt) const { // Either we have text or the application has native text and suggested its size to us. - bool bHasText = HasText() || (m_aSuggestedTextFrameSize.Width() != 0 && m_aSuggestedTextFrameSize.Height() != 0); + bool bHasText = HasText() || !m_aSuggestedTextFrameSize.IsEmpty(); if ( bHasText && !rR.IsEmpty() ) { bool bWdtGrow=bWdt && IsAutoGrowWidth(); diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index fc70e8bc1984..e565f3de71e0 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -1063,7 +1063,7 @@ void SdrGrafObj::AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrink mpGraphicObject->GetPrefMapMode(), MapMode( MapUnit::Map100thMM ) ); - if( aSize.Height() != 0 && aSize.Width() != 0 ) + if( !aSize.IsEmpty() ) { Point aPos( rMaxRect.TopLeft() ); diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx index 358ee9b2e4c8..6e68116928a6 100644 --- a/svx/source/svdraw/svdomedia.cxx +++ b/svx/source/svdraw/svdomedia.cxx @@ -166,7 +166,7 @@ void SdrMediaObj::AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrin MapMode(MapUnit::Map100thMM)) ); Size aMaxSize( rMaxRect.GetSize() ); - if( aSize.Height() != 0 && aSize.Width() != 0 ) + if( !aSize.IsEmpty() ) { Point aPos( rMaxRect.TopLeft() ); diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx index 24b64ac02f70..bec8f74cb481 100644 --- a/svx/source/svdraw/svdovirt.cxx +++ b/svx/source/svdraw/svdovirt.cxx @@ -326,7 +326,7 @@ void SdrVirtObj::NbcShear(const Point& rRef, long nAngle, double tn, bool bVShea void SdrVirtObj::Move(const Size& rSiz) { - if (rSiz.Width()!=0 || rSiz.Height()!=0) { + if (!rSiz.IsEmpty()) { tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect(); NbcMove(rSiz); SetChanged(); diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index 8c15b31d5cc3..ccc47ca9c401 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -1022,7 +1022,7 @@ void SdrPaintView::MakeVisible(const tools::Rectangle& rRect, vcl::Window& rWin) MapMode aMap(rWin.GetMapMode()); Size aActualSize(rWin.GetOutputSize()); - if( aActualSize.Height() <= 0 || aActualSize.Width() <= 0 ) + if( aActualSize.IsEmpty() ) return; Size aNewSize(rRect.GetSize()); diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx index a294e115307e..930bab99641b 100644 --- a/svx/source/tbxctrls/itemwin.cxx +++ b/svx/source/tbxctrls/itemwin.cxx @@ -192,7 +192,7 @@ namespace { void formatBitmapExToSize(BitmapEx& rBitmapEx, const Size& rSize) { - if(!rBitmapEx.IsEmpty() && rSize.Width() > 0 && rSize.Height() > 0) + if(!rBitmapEx.IsEmpty() && !rSize.IsEmpty()) { ScopedVclPtrInstance< VirtualDevice > pVirtualDevice; pVirtualDevice->SetOutputSizePixel(rSize); diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index 13a18338bd20..545259b37f78 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -1038,7 +1038,7 @@ sal_Bool SAL_CALL GraphicExporter::filter( const Sequence< PropertyValue >& aDes { // export graphic only if it has a size const Size aGraphSize( aGraphic.GetPrefSize() ); - if ( ( aGraphSize.Width() == 0 ) || ( aGraphSize.Height() == 0 ) ) + if ( aGraphSize.IsEmpty() ) { nStatus = ERRCODE_GRFILTER_FILTERERROR; } diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index 86e316af53f9..964fde20a56d 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -817,7 +817,7 @@ void SwVirtFlyDrawObj::NbcCrop(const basegfx::B2DPoint& rRef, double fxFact, dou aGraphicSize = OutputDevice::LogicToLogic( aGraphicSize, pGraphicObject->GetPrefMapMode(), aMapMode100thmm); } - if( aGraphicSize.Width() == 0 || aGraphicSize.Height() == 0 ) + if( aGraphicSize.IsEmpty() ) { return ; } diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 13746c579141..856ad958b58c 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -1362,7 +1362,7 @@ Size SwFEShell::RequestObjectResize( const SwRect &rRect, const uno::Reference < } // set the new Size at the fly themself - if ( pFly->getFramePrintArea().Height() > 0 && pFly->getFramePrintArea().Width() > 0 ) + if ( !pFly->getFramePrintArea().IsEmpty() ) { aSz.AdjustWidth(pFly->getFrameArea().Width() - pFly->getFramePrintArea().Width() ); aSz.AdjustHeight(pFly->getFrameArea().Height()- pFly->getFramePrintArea().Height() ); diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx index 1751c9d913e0..87fb9075644f 100644 --- a/sw/source/core/frmedt/fews.cxx +++ b/sw/source/core/frmedt/fews.cxx @@ -1279,8 +1279,7 @@ Size SwFEShell::GetGraphicDefaultSize() const // of the anchor frame is taken. const SwFrame* pAnchorFrame = pFly->GetAnchorFrame(); aRet = pAnchorFrame->getFramePrintArea().SSize(); - if ( aRet.Width() == 0 && aRet.Height() == 0 && - pAnchorFrame->GetUpper() ) + if ( aRet.IsEmpty() && pAnchorFrame->GetUpper() ) { aRet = pAnchorFrame->GetUpper()->getFramePrintArea().SSize(); } diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index f417675b4292..d4e24094dd1f 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -3481,7 +3481,7 @@ IMapObject* SwFrameFormat::GetIMapObject( const Point& rPoint, aOrigSz = pFly->GetFormat()->GetFrameSize().GetSize(); } - if( aOrigSz.Width() != 0 && aOrigSz.Height() != 0 ) + if( !aOrigSz.IsEmpty() ) { Point aPos( rPoint ); Size aActSz ( pRef == pFly ? pFly->getFrameArea().SSize() : pRef->getFramePrintArea().SSize() ); diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index bf73d951705a..7f913c8a02ff 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -1295,14 +1295,14 @@ bool SwLayAction::FormatLayout( OutputDevice *pRenderContext, SwLayoutFrame *pLa SwRect aSpaceToPrevPage( aPageRect ); aSpaceToPrevPage.Top( aSpaceToPrevPage.Top() - nHalfDocBorder ); aSpaceToPrevPage.Bottom( pLay->getFrameArea().Top() ); - if(aSpaceToPrevPage.Height() > 0 && aSpaceToPrevPage.Width() > 0) + if(!aSpaceToPrevPage.IsEmpty()) m_pImp->GetShell()->AddPaintRect( aSpaceToPrevPage ); // left aSpaceToPrevPage = aPageRect; aSpaceToPrevPage.Left( aSpaceToPrevPage.Left() - nHalfDocBorder ); aSpaceToPrevPage.Right( pLay->getFrameArea().Left() ); - if(aSpaceToPrevPage.Height() > 0 && aSpaceToPrevPage.Width() > 0) + if(!aSpaceToPrevPage.IsEmpty()) m_pImp->GetShell()->AddPaintRect( aSpaceToPrevPage ); } if ( bNext ) @@ -1311,14 +1311,14 @@ bool SwLayAction::FormatLayout( OutputDevice *pRenderContext, SwLayoutFrame *pLa SwRect aSpaceToNextPage( aPageRect ); aSpaceToNextPage.Bottom( aSpaceToNextPage.Bottom() + nHalfDocBorder ); aSpaceToNextPage.Top( pLay->getFrameArea().Bottom() ); - if(aSpaceToNextPage.Height() > 0 && aSpaceToNextPage.Width() > 0) + if(!aSpaceToNextPage.IsEmpty()) m_pImp->GetShell()->AddPaintRect( aSpaceToNextPage ); // right aSpaceToNextPage = aPageRect; aSpaceToNextPage.Right( aSpaceToNextPage.Right() + nHalfDocBorder ); aSpaceToNextPage.Left( pLay->getFrameArea().Right() ); - if(aSpaceToNextPage.Height() > 0 && aSpaceToNextPage.Width() > 0) + if(!aSpaceToNextPage.IsEmpty()) m_pImp->GetShell()->AddPaintRect( aSpaceToNextPage ); } } diff --git a/sw/source/core/layout/virtoutp.cxx b/sw/source/core/layout/virtoutp.cxx index b04ac349b9c7..50821ad73677 100644 --- a/sw/source/core/layout/virtoutp.cxx +++ b/sw/source/core/layout/virtoutp.cxx @@ -82,7 +82,7 @@ bool SwLayVout::DoesFit( const Size &rNew ) { if( rNew.Height() > VIRTUALHEIGHT ) return false; - if( rNew.Width() <= 0 || rNew.Height() <= 0 ) + if( rNew.IsEmpty() ) return false; if( rNew.Width() <= aSize.Width() ) return true; diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index a4d7b9c9d8d3..52979fde8c10 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -608,7 +608,7 @@ void SwTextFly::DrawFlyRect( OutputDevice* pOut, const SwRect &rRect ) SwRect aFly( pAnchoredObjTmp->GetObjRect() ); // OD 24.01.2003 #106593# ::SwAlignRect( aFly, pPage->getRootFrame()->GetCurrShell(), pOut ); - if( aFly.Width() > 0 && aFly.Height() > 0 ) + if( !aFly.IsEmpty() ) aRegion -= aFly; } } diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx index 46979a985bcd..d4d628dce507 100644 --- a/sw/source/core/view/pagepreviewlayout.cxx +++ b/sw/source/core/view/pagepreviewlayout.cxx @@ -301,7 +301,7 @@ bool SwPagePreviewLayout::Prepare( const sal_uInt16 _nProposedStartPageNum, if ( !bStartPosRangeValid ) return false; - bool bWinSizeValid = _rPxWinSize.Width() != 0 && _rPxWinSize.Height() != 0; + bool bWinSizeValid = !_rPxWinSize.IsEmpty(); OSL_ENSURE( bWinSizeValid, "no window size - no prepare of preview paint"); if ( !bWinSizeValid ) return false; diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 424b902a644c..580a07363439 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -685,8 +685,7 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, (nPercentHeight ? 0 : pFSItem->GetHeight()-aTwipSpc.Height()) ); - OSL_ENSURE( aTwipSz.Width() >= 0 && aTwipSz.Height() >= 0, - "Frame size minus spacing < 0!!!???" ); + OSL_ENSURE( !aTwipSz.IsEmpty(), "Frame size minus spacing < 0!!!???" ); if( aTwipSz.Width() < 0 ) aTwipSz.setWidth( 0 ); if( aTwipSz.Height() < 0 ) @@ -951,8 +950,7 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma (nPercentHeight ? 0 : pFSItem->GetHeight()-aTwipSpc.Height()) ); - OSL_ENSURE( aTwipSz.Width() >= 0 && aTwipSz.Height() >= 0, - "Frame size minus spacing < 0!!!???" ); + OSL_ENSURE( !aTwipSz.IsEmpty(), "Frame size minus spacing < 0!!!???" ); if( aTwipSz.Width() < 0 ) aTwipSz.setWidth( 0 ); if( aTwipSz.Height() < 0 ) diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index 886f6946d046..4f0de200ba6d 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -569,7 +569,7 @@ void SwWW8WrGrf::WritePICFHeader(SvStream& rStrm, const ww8::Frame &rFly, still keep the correct display size anyway. */ const bool bIsSubstitutedSize = (aGrTwipSz.Width() > SHRT_MAX) || (aGrTwipSz.Height() > SHRT_MAX) || - (aGrTwipSz.Width() < 0 ) || (aGrTwipSz.Height() < 0); + aGrTwipSz.IsEmpty(); if ( bIsSubstitutedSize ) { aGrTwipSz.setWidth( nWidth ); @@ -703,7 +703,7 @@ void SwWW8WrGrf::WritePICBulletFHeader(SvStream& rStrm, const Graphic &rGrf, Set_UInt16( pArr, mm ); // set mm if ( (convertTwipToMm100(aGrTwipSz.Width()) > USHRT_MAX ) || ( convertTwipToMm100(aGrTwipSz.Height()) > USHRT_MAX ) - || (aGrTwipSz.Width() < 0 ) || (aGrTwipSz.Height() < 0) ) + || aGrTwipSz.IsEmpty() ) { aGrTwipSz.setWidth( nWidth ); aGrTwipSz.setHeight( nHeight ); diff --git a/sw/source/uibase/table/chartins.cxx b/sw/source/uibase/table/chartins.cxx index b9e5f1e5103b..dfdabb224ffe 100644 --- a/sw/source/uibase/table/chartins.cxx +++ b/sw/source/uibase/table/chartins.cxx @@ -189,7 +189,7 @@ void SwInsertChart() >>= aDialogAWTSize ) { Size aDialogSize( aDialogAWTSize.Width, aDialogAWTSize.Height ); - if ( aDialogSize.Width() > 0 && aDialogSize.Height() > 0 ) + if ( !aDialogSize.IsEmpty() ) { //calculate and set new position SwRect aSwRect; diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index 672523a664fe..ac0309973449 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -1321,7 +1321,7 @@ void SwPagePreview::OuterResizePixel( const Point &rOfst, const Size &rSize ) // Call of the DocSzChgd-Method of the scrollbars is necessary, // because from the maximum scroll range half the height of the // VisArea is always deducted. - if ( m_pVScrollbar && aTmpSize.Width() > 0 && aTmpSize.Height() > 0 ) + if ( m_pVScrollbar && !aTmpSize.IsEmpty() ) { ScrollDocSzChg(); } diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx index 49fe620c66af..0dd9a1964307 100644 --- a/sw/source/uibase/uiview/viewport.cxx +++ b/sw/source/uibase/uiview/viewport.cxx @@ -225,7 +225,7 @@ void SwView::SetVisArea( const tools::Rectangle &rRect, bool bUpdateScrollbar ) return; const Size aSize( aLR.GetSize() ); - if( aSize.Width() < 0 || aSize.Height() < 0 ) + if( aSize.IsEmpty() ) return; // Before the data can be changed, call an update if necessary. This @@ -942,7 +942,7 @@ void SwView::ShowAtResize() void SwView::InnerResizePixel( const Point &rOfst, const Size &rSize, bool ) { Size aObjSize = GetObjectShell()->GetVisArea().GetSize(); - if ( aObjSize.Width() > 0 && aObjSize.Height() > 0 ) + if ( !aObjSize.IsEmpty() ) { SvBorder aBorder( GetBorderPixel() ); Size aSize( rSize ); @@ -1089,8 +1089,7 @@ void SwView::OuterResizePixel( const Point &rOfst, const Size &rSize ) m_pWrtShell->ResetCursorStack(); OSL_ENSURE( !GetEditWin().IsVisible() || - (( aEditSz.Width() > 0 && aEditSz.Height() > 0 ) - || !m_aVisArea.IsEmpty()), "Small world, isn't it?" ); + !aEditSz.IsEmpty() || !m_aVisArea.IsEmpty(), "Small world, isn't it?" ); // Never set EditWin! diff --git a/vcl/skia/x11/cairotextrender.cxx b/vcl/skia/x11/cairotextrender.cxx index 57f663f29e6d..eb05134e3a74 100644 --- a/vcl/skia/x11/cairotextrender.cxx +++ b/vcl/skia/x11/cairotextrender.cxx @@ -27,7 +27,7 @@ cairo_t* SkiaX11CairoTextRender::getCairoContext() if (pImpl) { tools::Rectangle aClipRect = pImpl->getClipRegion().GetBoundRect(); - if (aClipRect.GetWidth() == 0 || aClipRect.GetHeight() == 0) + if (aClipRect.IsEmpty()) { aClipRect.setWidth(GetWidth()); aClipRect.setHeight(GetHeight()); diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx index 7786ce516424..9323bffb8e2a 100644 --- a/vcl/source/bitmap/BitmapTools.cxx +++ b/vcl/source/bitmap/BitmapTools.cxx @@ -371,7 +371,7 @@ BitmapEx CanvasTransformBitmap( const BitmapEx& rBitmap, const Size aDestBmpSize( ::basegfx::fround( rDestRect.getWidth() ), ::basegfx::fround( rDestRect.getHeight() ) ); - if( aDestBmpSize.Width() == 0 || aDestBmpSize.Height() == 0 ) + if( aDestBmpSize.IsEmpty() ) return BitmapEx(); Bitmap aDstBitmap( aDestBmpSize, aSrcBitmap.GetBitCount(), &pReadAccess->GetPalette() ); diff --git a/vcl/source/filter/png/pngread.cxx b/vcl/source/filter/png/pngread.cxx index d68f7f09a9e1..bd530689f47c 100644 --- a/vcl/source/filter/png/pngread.cxx +++ b/vcl/source/filter/png/pngread.cxx @@ -450,7 +450,7 @@ bool PNGReaderImpl::ImplReadHeader() maOrigSize.setWidth( ImplReadsal_uInt32() ); maOrigSize.setHeight( ImplReadsal_uInt32() ); - if (maOrigSize.Width() <= 0 || maOrigSize.Height() <= 0) + if (maOrigSize.IsEmpty()) return false; mnPngDepth = *(maDataIter++); diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index ee7a8797cde9..4c635b454fd3 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -74,8 +74,7 @@ void ImplDrawDefault( OutputDevice* pOutDev, const OUString* pText, aSize.AdjustWidth( -(2*nPixelWidth + 4*nPixel) ); aSize.AdjustHeight( -(2*nPixelWidth + 4*nPixel) ); - if( aSize.Width() > 0 && aSize.Height() > 0 - && ( pBitmapEx && !!*pBitmapEx ) ) + if( !aSize.IsEmpty() && pBitmapEx && !!*pBitmapEx ) { Size aBitmapSize( pOutDev->PixelToLogic( pBitmapEx->GetSizePixel() ) ); @@ -87,8 +86,7 @@ void ImplDrawDefault( OutputDevice* pOutDev, const OUString* pText, } } - if ( aSize.Width() > 0 && aSize.Height() > 0 && pFont && pText && pText->getLength() - && pOutDev->IsOutputEnabled() ) + if ( !aSize.IsEmpty() && pFont && pText && pText->getLength() && pOutDev->IsOutputEnabled() ) { MapMode aMapMode( MapUnit::MapPoint ); Size aSz = pOutDev->LogicToLogic( Size( 0, 12 ), &aMapMode, nullptr ); diff --git a/vcl/source/graphic/GraphicObject.cxx b/vcl/source/graphic/GraphicObject.cxx index b9395a14363e..377945ef2e32 100644 --- a/vcl/source/graphic/GraphicObject.cxx +++ b/vcl/source/graphic/GraphicObject.cxx @@ -380,7 +380,7 @@ bool GraphicObject::ImplGetCropParams( OutputDevice const * pOut, Point& rPt, Si nTotalWidth = aSize100.Width() - pAttr->GetLeftCrop() - pAttr->GetRightCrop(); nTotalHeight = aSize100.Height() - pAttr->GetTopCrop() - pAttr->GetBottomCrop(); - if( aSize100.Width() > 0 && aSize100.Height() > 0 && nTotalWidth > 0 && nTotalHeight > 0 ) + if( !aSize100.IsEmpty() && nTotalWidth > 0 && nTotalHeight > 0 ) { double fScale = static_cast<double>(aSize100.Width()) / nTotalWidth; const long nNewLeft = -FRound( ( ( pAttr->GetMirrorFlags() & BmpMirrorFlags::Horizontal ) ? pAttr->GetRightCrop() : pAttr->GetLeftCrop() ) * fScale ); @@ -524,7 +524,7 @@ bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz, void GraphicObject::DrawTiled( OutputDevice* pOut, const tools::Rectangle& rArea, const Size& rSize, const Size& rOffset, int nTileCacheSize1D ) { - if( pOut == nullptr || rSize.Width() == 0 || rSize.Height() == 0 ) + if( pOut == nullptr || rSize.IsEmpty() ) return; const MapMode aOutMapMode( pOut->GetMapMode() ); diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index 6e707e953ab1..79d26bfe3217 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -1449,7 +1449,7 @@ void OutputDevice::DrawImage( const Point& rPos, const Size& rSize, { assert(!is_double_buffered_window()); - bool bIsSizeValid = rSize.getWidth() != 0 && rSize.getHeight() != 0; + bool bIsSizeValid = !rSize.IsEmpty(); if (!ImplIsRecordLayout()) { diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx index d80f6b2fefc5..3f52d42ad49b 100644 --- a/vcl/source/treelist/svimpbox.cxx +++ b/vcl/source/treelist/svimpbox.cxx @@ -1279,7 +1279,7 @@ void SvImpLBox::InitScrollBarBox() void SvImpLBox::Resize() { m_aOutputSize = m_pView->Control::GetOutputSizePixel(); - if( m_aOutputSize.Width() <= 0 || m_aOutputSize.Height() <= 0 ) + if( m_aOutputSize.IsEmpty() ) return; m_nFlags |= LBoxFlags::InResize; InitScrollBarBox(); diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index b62abdaf56df..c9cdd199e6e4 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -1221,7 +1221,7 @@ void Window::PixelInvalidate(const tools::Rectangle* pRectangle) return; Size aSize = GetSizePixel(); - if (aSize.getWidth() <= 0 || aSize.getHeight() <= 0) + if (aSize.IsEmpty()) return; if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier()) diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 614b8d4eaf13..82174b2872b7 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -303,7 +303,7 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi void PrintDialog::PrintPreviewWindow::preparePreviewBitmap() { - if(maPreviewSize.getWidth() < 0 || maPreviewSize.getHeight() < 0) + if(maPreviewSize.IsEmpty()) { // not yet fully initialized, no need to prepare anything return; @@ -502,7 +502,7 @@ void PrintDialog::ShowNupOrderWindow::Paint(vcl::RenderContext& rRenderContext, Size const & PrintDialog::getJobPageSize() { - if( maFirstPageSize.Width() == 0 && maFirstPageSize.Height() == 0) + if( maFirstPageSize.IsEmpty() ) { maFirstPageSize = maNupPortraitSize; GDIMetaFile aMtf; diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index c2c40b7713ff..f2069b87b885 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -1346,8 +1346,7 @@ void Window::queue_resize(StateChangedType eReason) if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier()) { Size aSize = GetSizePixel(); - if (aSize.getWidth() > 0 && aSize.getHeight() > 0 && GetParentDialog() - && !pParent->IsInInitShow()) + if (!aSize.IsEmpty() && GetParentDialog() && !pParent->IsInInitShow()) LogicInvalidate(nullptr); } } diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index 3ad836c082b9..031d610869c2 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -1851,7 +1851,7 @@ void X11SalFrame::GetPosSize( tools::Rectangle &rPosSize ) void X11SalFrame::SetSize( const Size &rSize ) { - if( rSize.Width() > 0 && rSize.Height() > 0 ) + if( !rSize.IsEmpty() ) { if( ! ( nStyle_ & SalFrameStyleFlags::SIZEABLE ) && ! IsChildWindow() diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx index 3a8297b3ab52..ff81d24097f9 100644 --- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx @@ -488,7 +488,7 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context, // Find the overall bounding rect of the control scrollbarRect = rControlRectangle; - if (scrollbarRect.GetWidth() <= 0 || scrollbarRect.GetHeight() <= 0) + if (scrollbarRect.IsEmpty()) return; gint slider_side; @@ -599,7 +599,7 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context, button22BoundRect.SetSize( Size( slider_width, stepper_size ) ); } - bool has_slider = ( thumbRect.GetWidth() > 0 && thumbRect.GetHeight() > 0 ); + bool has_slider = !thumbRect.IsEmpty(); // ----------------- CONTENTS GtkStyleContext* pScrollbarContentsStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ? @@ -914,7 +914,7 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context, thumbRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, 0 ); } - bool has_slider = ( thumbRect.GetWidth() > 0 && thumbRect.GetHeight() > 0 ); + bool has_slider = !thumbRect.IsEmpty(); // ----------------- CONTENTS GtkStyleContext* pScrollbarContentsStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ? @@ -2702,7 +2702,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co cairo_destroy(cr); // unref - if (rControlRegion.GetWidth() >= 0 && rControlRegion.GetHeight() >= 0) + if (!rControlRegion.IsEmpty()) mpFrame->damaged(rControlRegion.Left(), rControlRegion.Top(), rControlRegion.GetWidth(), rControlRegion.GetHeight()); return true; diff --git a/vcl/win/gdi/salbmp.cxx b/vcl/win/gdi/salbmp.cxx index d891965e57ee..f2b21a6668e9 100644 --- a/vcl/win/gdi/salbmp.cxx +++ b/vcl/win/gdi/salbmp.cxx @@ -207,7 +207,7 @@ std::shared_ptr< Gdiplus::Bitmap > WinSalBitmap::ImplGetGdiPlusBitmap(const WinS // use from buffer aRetval = pSystemDependentData_GdiPlusBitmap->getGdiPlusBitmap(); } - else if(maSize.Width() > 0 && maSize.Height() > 0) + else if(!maSize.IsEmpty()) { // create and set data const WinSalBitmap* pAssociatedAlpha(nullptr); @@ -709,7 +709,7 @@ HGLOBAL WinSalBitmap::ImplCreateDIB( const Size& rSize, sal_uInt16 nBits, const HGLOBAL hDIB = nullptr; - if( rSize.Width() <= 0 || rSize.Height() <= 0 ) + if( rSize.IsEmpty() ) return hDIB; // calculate bitmap size in Bytes |