summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-04-29 15:50:02 +0200
committerTomaž Vajngerl <quikee@gmail.com>2019-04-30 04:57:21 +0200
commit7334034ae93b49fc93b5859a3c047a319d138282 (patch)
tree6216d895de7ede63bd946a0e75913a3b07e4c2b6 /vcl
parentc0ff8a24365456383900ed7958c8fb9ea68043e9 (diff)
drop Graphic::operator bool
which tends to interact in very weird ways with other code, for example it makes Graphic appear to have an operator< Change-Id: I335fe8f3644b710bc61291e625cbca7334a37716 Reviewed-on: https://gerrit.libreoffice.org/71532 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/graph.cxx9
-rw-r--r--vcl/source/graphic/GraphicObject.cxx2
-rw-r--r--vcl/source/graphic/UnoGraphic.cxx17
-rw-r--r--vcl/source/graphic/UnoGraphicProvider.cxx4
4 files changed, 11 insertions, 21 deletions
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index 0b2c043572db..8d63a4ab8171 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -296,14 +296,9 @@ bool Graphic::operator!=( const Graphic& rGraphic ) const
return (*mxImpGraphic != *rGraphic.mxImpGraphic);
}
-bool Graphic::operator!() const
+bool Graphic::IsNone() const
{
- return (GraphicType::NONE == mxImpGraphic->ImplGetType());
-}
-
-Graphic::operator bool() const
-{
- return GraphicType::NONE != mxImpGraphic->ImplGetType();
+ return GraphicType::NONE == mxImpGraphic->ImplGetType();
}
void Graphic::Clear()
diff --git a/vcl/source/graphic/GraphicObject.cxx b/vcl/source/graphic/GraphicObject.cxx
index be2dc76bd2a6..8e1b50a2c0da 100644
--- a/vcl/source/graphic/GraphicObject.cxx
+++ b/vcl/source/graphic/GraphicObject.cxx
@@ -71,7 +71,7 @@ void SearchForGraphics(uno::Reference<uno::XInterface> const & xInterface,
if (!sURL.isEmpty() && !GraphicObject::isGraphicObjectUniqueIdURL(sURL))
{
Graphic aGraphic = vcl::graphic::loadFromURL(sURL);
- if (aGraphic)
+ if (!aGraphic.IsNone())
{
raGraphicList.push_back(aGraphic.GetXGraphic());
}
diff --git a/vcl/source/graphic/UnoGraphic.cxx b/vcl/source/graphic/UnoGraphic.cxx
index bc2ce6349f55..446da50867a4 100644
--- a/vcl/source/graphic/UnoGraphic.cxx
+++ b/vcl/source/graphic/UnoGraphic.cxx
@@ -125,15 +125,10 @@ sal_Int8 SAL_CALL Graphic::getType()
{
sal_Int8 cRet = graphic::GraphicType::EMPTY;
- if (!!maGraphic)
+ if (!maGraphic.IsNone())
{
- ::GraphicType eType = maGraphic.GetType();
-
- if (eType != ::GraphicType::NONE)
- {
- cRet = (eType == ::GraphicType::Bitmap) ? graphic::GraphicType::PIXEL
- : graphic::GraphicType::VECTOR;
- }
+ cRet = (maGraphic.GetType() == ::GraphicType::Bitmap) ? graphic::GraphicType::PIXEL
+ : graphic::GraphicType::VECTOR;
}
return cRet;
@@ -146,7 +141,7 @@ awt::Size SAL_CALL Graphic::getSize()
SolarMutexGuard aGuard;
Size aVclSize;
- if (!!maGraphic && maGraphic.GetType() != ::GraphicType::NONE)
+ if (!maGraphic.IsNone())
{
aVclSize = maGraphic.GetSizePixel();
}
@@ -157,7 +152,7 @@ uno::Sequence<sal_Int8> SAL_CALL Graphic::getDIB()
{
SolarMutexGuard aGuard;
- if (!!maGraphic && maGraphic.GetType() != ::GraphicType::NONE)
+ if (!maGraphic.IsNone())
{
SvMemoryStream aMemoryStream;
@@ -174,7 +169,7 @@ uno::Sequence<sal_Int8> SAL_CALL Graphic::getMaskDIB()
{
SolarMutexGuard aGuard;
- if (!!maGraphic && maGraphic.GetType() != ::GraphicType::NONE)
+ if (!maGraphic.IsNone())
{
SvMemoryStream aMemoryStream;
diff --git a/vcl/source/graphic/UnoGraphicProvider.cxx b/vcl/source/graphic/UnoGraphicProvider.cxx
index 9e99cd89decd..450fd2b26f4b 100644
--- a/vcl/source/graphic/UnoGraphicProvider.cxx
+++ b/vcl/source/graphic/UnoGraphicProvider.cxx
@@ -408,10 +408,10 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co
if (bLazyRead)
{
Graphic aGraphic = rFilter.ImportUnloadedGraphic(*pIStm);
- if (aGraphic)
+ if (!aGraphic.IsNone())
aVCLGraphic = aGraphic;
}
- if (!aVCLGraphic)
+ if (aVCLGraphic.IsNone())
error = rFilter.ImportGraphic(aVCLGraphic, aPath, *pIStm, GRFILTER_FORMAT_DONTKNOW,
nullptr, GraphicFilterImportFlags::NONE, pExtHeader);