summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-15 13:52:37 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-15 16:08:51 +0200
commitd7855213ae60d79fc51d8b9bfe49f13200137c05 (patch)
treea9f852a6ddacffce339945e8667500d3531257a4 /svx/source
parentb267650fd097f16d1b31c87a11a497294ad4ee42 (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 'svx/source')
-rw-r--r--svx/source/dialog/hyperdlg.cxx3
-rw-r--r--svx/source/gallery2/galobj.cxx2
-rw-r--r--svx/source/sidebar/nbdtmg.cxx10
-rw-r--r--svx/source/svdraw/svdedxv.cxx2
-rw-r--r--svx/source/svdraw/svdoashp.cxx2
-rw-r--r--svx/source/svdraw/svdograf.cxx2
-rw-r--r--svx/source/svdraw/svdomedia.cxx2
-rw-r--r--svx/source/svdraw/svdovirt.cxx2
-rw-r--r--svx/source/svdraw/svdpntv.cxx2
-rw-r--r--svx/source/tbxctrls/itemwin.cxx2
-rw-r--r--svx/source/unodraw/UnoGraphicExporter.cxx2
11 files changed, 14 insertions, 17 deletions
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;
}