diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-05-04 23:42:17 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-11 20:24:40 +0200 |
commit | c88f76035cd1d088cc06067270677618340fd839 (patch) | |
tree | 2e98a3c2c6bdb6ee909d0b7c45012060e57b9a29 /canvas | |
parent | b5d624c4af1085d4670149e9c1d280da7bc9add0 (diff) |
Use hasElements to check Sequence emptiness in accessibility..canvas
Similar to clang-tidy readability-container-size-empty
Change-Id: I24c3f04b4eed3c1cd973166885660f113a26844f
Reviewed-on: https://gerrit.libreoffice.org/71805
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'canvas')
-rw-r--r-- | canvas/source/cairo/cairo_canvas.cxx | 2 | ||||
-rw-r--r-- | canvas/source/cairo/cairo_canvashelper.cxx | 4 | ||||
-rw-r--r-- | canvas/source/cairo/cairo_spritecanvas.cxx | 2 | ||||
-rw-r--r-- | canvas/source/cairo/cairo_textlayout.cxx | 12 | ||||
-rw-r--r-- | canvas/source/opengl/ogl_canvashelper.cxx | 4 | ||||
-rw-r--r-- | canvas/source/opengl/ogl_spritecanvas.cxx | 2 | ||||
-rw-r--r-- | canvas/source/opengl/ogl_textlayout.cxx | 2 | ||||
-rw-r--r-- | canvas/source/simplecanvas/simplecanvasimpl.cxx | 2 | ||||
-rw-r--r-- | canvas/source/tools/canvastools.cxx | 2 | ||||
-rw-r--r-- | canvas/source/vcl/canvas.cxx | 2 | ||||
-rw-r--r-- | canvas/source/vcl/canvashelper.cxx | 2 | ||||
-rw-r--r-- | canvas/source/vcl/canvashelper_texturefill.cxx | 4 | ||||
-rw-r--r-- | canvas/source/vcl/spritecanvas.cxx | 4 | ||||
-rw-r--r-- | canvas/source/vcl/textlayout.cxx | 4 |
14 files changed, 24 insertions, 24 deletions
diff --git a/canvas/source/cairo/cairo_canvas.cxx b/canvas/source/cairo/cairo_canvas.cxx index 134dabf26fc4..036d443aba7a 100644 --- a/canvas/source/cairo/cairo_canvas.cxx +++ b/canvas/source/cairo/cairo_canvas.cxx @@ -51,7 +51,7 @@ namespace cairocanvas void Canvas::initialize() { // #i64742# Only perform initialization when not in probe mode - if( maArguments.getLength() == 0 ) + if( !maArguments.hasElements() ) return; // tdf#93870 - force VCL canvas in OpenGL mode for now. diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx index 5a442dfc8997..71ca12e629ef 100644 --- a/canvas/source/cairo/cairo_canvashelper.cxx +++ b/canvas/source/cairo/cairo_canvashelper.cxx @@ -677,7 +677,7 @@ namespace cairocanvas rendering::FillRule eFillrule ) { if( pTextures ) - ENSURE_ARG_OR_THROW( pTextures->getLength(), + ENSURE_ARG_OR_THROW( pTextures->hasElements(), "CanvasHelper::fillTexturedPolyPolygon: empty texture sequence"); bool bOpToDo = false; @@ -960,7 +960,7 @@ namespace cairocanvas //tdf#103026 If the w scaling is 0, then all dashes become zero so //cairo will set the cairo_t status to CAIRO_STATUS_INVALID_DASH //and no further drawing will occur - if (strokeAttributes.DashArray.getLength() > 0 && w > 0.0) + if (strokeAttributes.DashArray.hasElements() && w > 0.0) { auto aDashArray(comphelper::sequenceToContainer<std::vector<double>>(strokeAttributes.DashArray)); for (auto& rDash : aDashArray) diff --git a/canvas/source/cairo/cairo_spritecanvas.cxx b/canvas/source/cairo/cairo_spritecanvas.cxx index b7b7792009e5..113c7541964b 100644 --- a/canvas/source/cairo/cairo_spritecanvas.cxx +++ b/canvas/source/cairo/cairo_spritecanvas.cxx @@ -54,7 +54,7 @@ namespace cairocanvas SAL_INFO("canvas.cairo", "CairoSpriteCanvas created " << this); // #i64742# Only call initialize when not in probe mode - if( maArguments.getLength() == 0 ) + if( !maArguments.hasElements() ) return; /* maArguments: diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx index c9a99621a00d..5e7fca21f61a 100644 --- a/canvas/source/cairo/cairo_textlayout.cxx +++ b/canvas/source/cairo/cairo_textlayout.cxx @@ -166,7 +166,7 @@ namespace cairocanvas const sal_Int32 nAboveBaseline( -aMetric.GetAscent() ); const sal_Int32 nBelowBaseline( aMetric.GetDescent() ); - if( maLogicalAdvancements.getLength() ) + if( maLogicalAdvancements.hasElements() ) { return geometry::RealRectangle2D( 0, nAboveBaseline, maLogicalAdvancements[ maLogicalAdvancements.getLength()-1 ], @@ -307,7 +307,7 @@ namespace cairocanvas // TODO(P2): cache that std::unique_ptr< long []> aOffsets(new long[maLogicalAdvancements.getLength()]); - if( maLogicalAdvancements.getLength() ) + if( maLogicalAdvancements.hasElements() ) { setupTextOffsets( aOffsets.get(), maLogicalAdvancements, viewState, renderState ); @@ -318,7 +318,7 @@ namespace cairocanvas aSysLayoutData = rOutDev.GetSysTextLayoutData(rOutpos, maText.Text, ::canvas::tools::numeric_cast<sal_uInt16>(maText.StartPosition), ::canvas::tools::numeric_cast<sal_uInt16>(maText.Length), - maLogicalAdvancements.getLength() ? aOffsets.get() : nullptr); + maLogicalAdvancements.hasElements() ? aOffsets.get() : nullptr); // Sort them so that all glyphs on the same glyph fallback level are consecutive std::sort(aSysLayoutData.rGlyphData.begin(), aSysLayoutData.rGlyphData.end(), compareFallbacks); @@ -337,7 +337,7 @@ namespace cairocanvas { bCairoRenderable = false; SAL_INFO("canvas.cairo", ":cairocanvas::TextLayout::draw(S,O,p,v,r): VCL FALLBACK " << - (maLogicalAdvancements.getLength() ? "ADV " : "") << + (maLogicalAdvancements.hasElements() ? "ADV " : "") << (aFontData.back().first.bAntialias ? "AA " : "") << (aFontData.back().first.bFakeBold ? "FB " : "") << (aFontData.back().first.bFakeItalic ? "FI " : "") << @@ -352,7 +352,7 @@ namespace cairocanvas // The fallback checks need to be done after final font is known. if (!bCairoRenderable) // VCL FALLBACKS { - if (maLogicalAdvancements.getLength()) // VCL FALLBACK - with glyph advances + if (maLogicalAdvancements.hasElements()) // VCL FALLBACK - with glyph advances { rOutDev.DrawTextArray( rOutpos, maText.Text, aOffsets.get(), ::canvas::tools::numeric_cast<sal_uInt16>(maText.StartPosition), @@ -465,7 +465,7 @@ namespace cairocanvas << (cairo_glyphs.size() > 1 ? cairo_glyphs[1].index : -1) << "," << (cairo_glyphs.size() > 2 ? cairo_glyphs[2].index : -1) - << ") " << (maLogicalAdvancements.getLength() ? "ADV " : "") + << ") " << (maLogicalAdvancements.hasElements() ? "ADV " : "") << (rSysFontData.bAntialias ? "AA " : "") << (rSysFontData.bFakeBold ? "FB " : "") << (rSysFontData.bFakeItalic ? "FI " : "") << " || Name:" diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx index f29a69302063..cbbd639741f6 100644 --- a/canvas/source/opengl/ogl_canvashelper.cxx +++ b/canvas/source/opengl/ogl_canvashelper.cxx @@ -730,7 +730,7 @@ namespace oglcanvas // handle custom spacing, if there uno::Sequence<double> aLogicalAdvancements=xLayoutetText->queryLogicalAdvancements(); - if( aLogicalAdvancements.getLength() ) + if( aLogicalAdvancements.hasElements() ) { // create the DXArray const sal_Int32 nLen( aLogicalAdvancements.getLength() ); @@ -922,7 +922,7 @@ namespace oglcanvas break; } - if (renderState.DeviceColor.getLength()) + if (renderState.DeviceColor.hasElements()) o_action.maARGBColor = mpDevice->getDeviceColorSpace()->convertToARGB(renderState.DeviceColor)[0]; } diff --git a/canvas/source/opengl/ogl_spritecanvas.cxx b/canvas/source/opengl/ogl_spritecanvas.cxx index ed2de8179748..ccc0025172b5 100644 --- a/canvas/source/opengl/ogl_spritecanvas.cxx +++ b/canvas/source/opengl/ogl_spritecanvas.cxx @@ -43,7 +43,7 @@ namespace oglcanvas void SpriteCanvas::initialize() { // Only call initialize when not in probe mode - if( maArguments.getLength() == 0 ) + if( !maArguments.hasElements() ) return; SAL_INFO("canvas.ogl", "SpriteCanvas::initialize called" ); diff --git a/canvas/source/opengl/ogl_textlayout.cxx b/canvas/source/opengl/ogl_textlayout.cxx index b5ad271f63e4..63d21c6aa1fe 100644 --- a/canvas/source/opengl/ogl_textlayout.cxx +++ b/canvas/source/opengl/ogl_textlayout.cxx @@ -88,7 +88,7 @@ namespace oglcanvas const rendering::FontRequest& rFontRequest( mpFont->getFontRequest() ); const double nFontSize( std::max( rFontRequest.CellSize, rFontRequest.ReferenceAdvancement ) ); - if( maLogicalAdvancements.getLength() ) + if( maLogicalAdvancements.hasElements() ) { return geometry::RealRectangle2D( 0, -nFontSize/2, maLogicalAdvancements[ maLogicalAdvancements.getLength()-1 ], diff --git a/canvas/source/simplecanvas/simplecanvasimpl.cxx b/canvas/source/simplecanvas/simplecanvasimpl.cxx index fb82b701459a..9e209b5cf3e5 100644 --- a/canvas/source/simplecanvas/simplecanvasimpl.cxx +++ b/canvas/source/simplecanvas/simplecanvasimpl.cxx @@ -142,7 +142,7 @@ namespace uno::Reference<rendering::XCanvas> xRet; // can't do much without an XCanvas, can't we? - if( rArgs.getLength() < 1 ) + if( !rArgs.hasElements() ) throw lang::IllegalArgumentException(); xRet.set( rArgs[0], uno::UNO_QUERY ); diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx index 543f9170266c..759a39a27b2e 100644 --- a/canvas/source/tools/canvastools.cxx +++ b/canvas/source/tools/canvastools.cxx @@ -229,7 +229,7 @@ namespace canvas } virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToARGB( const uno::Sequence< double >& deviceColor ) override { - SAL_WARN_IF(deviceColor.getLength() == 0, "canvas", "empty deviceColor argument"); + SAL_WARN_IF(!deviceColor.hasElements(), "canvas", "empty deviceColor argument"); const double* pIn( deviceColor.getConstArray() ); const std::size_t nLen( deviceColor.getLength() ); ENSURE_ARG_OR_THROW2(nLen%4==0, diff --git a/canvas/source/vcl/canvas.cxx b/canvas/source/vcl/canvas.cxx index 59c200c85b7e..c33185b2999c 100644 --- a/canvas/source/vcl/canvas.cxx +++ b/canvas/source/vcl/canvas.cxx @@ -74,7 +74,7 @@ namespace vclcanvas void Canvas::initialize() { // #i64742# Only perform initialization when not in probe mode - if( maArguments.getLength() == 0 ) + if( !maArguments.hasElements() ) return; /* maArguments: diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index a03ad7e1c6d3..47ea98d4b3c4 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -334,7 +334,7 @@ namespace vclcanvas } // apply dashing, if any - if( strokeAttributes.DashArray.getLength() ) + if( strokeAttributes.DashArray.hasElements() ) { const std::vector<double>& aDashArray( ::comphelper::sequenceToContainer< std::vector<double> >(strokeAttributes.DashArray) ); diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx index 50a0976cc56b..18d773e0df9e 100644 --- a/canvas/source/vcl/canvashelper_texturefill.cxx +++ b/canvas/source/vcl/canvashelper_texturefill.cxx @@ -571,7 +571,7 @@ namespace vclcanvas { ENSURE_ARG_OR_THROW( xPolyPolygon.is(), "CanvasHelper::fillPolyPolygon(): polygon is NULL"); - ENSURE_ARG_OR_THROW( textures.getLength(), + ENSURE_ARG_OR_THROW( textures.hasElements(), "CanvasHelper::fillTexturedPolyPolygon: empty texture sequence"); if( mpOutDevProvider ) @@ -591,7 +591,7 @@ namespace vclcanvas ::canvas::ParametricPolyPolygon* pGradient = dynamic_cast< ::canvas::ParametricPolyPolygon* >( textures[0].Gradient.get() ); - if( pGradient && pGradient->getValues().maColors.getLength() ) + if( pGradient && pGradient->getValues().maColors.hasElements() ) { // copy state from Gradient polypoly locally // (given object might change!) diff --git a/canvas/source/vcl/spritecanvas.cxx b/canvas/source/vcl/spritecanvas.cxx index ee1de2808c66..429559fbe964 100644 --- a/canvas/source/vcl/spritecanvas.cxx +++ b/canvas/source/vcl/spritecanvas.cxx @@ -54,7 +54,7 @@ namespace vclcanvas SolarMutexGuard aGuard; // #i64742# Only call initialize when not in probe mode - if( maArguments.getLength() == 0 ) + if( !maArguments.hasElements() ) return; SAL_INFO("canvas.vcl", "SpriteCanvas created" ); @@ -71,7 +71,7 @@ namespace vclcanvas SAL_INFO("canvas.vcl", "VCLSpriteCanvas::initialize called" ); - ENSURE_ARG_OR_THROW( maArguments.getLength() >= 1, + ENSURE_ARG_OR_THROW( maArguments.hasElements(), "VCLSpriteCanvas::initialize: wrong number of arguments" ); /* maArguments: diff --git a/canvas/source/vcl/textlayout.cxx b/canvas/source/vcl/textlayout.cxx index 0585a38c41f8..3eee412c3416 100644 --- a/canvas/source/vcl/textlayout.cxx +++ b/canvas/source/vcl/textlayout.cxx @@ -234,7 +234,7 @@ namespace vclcanvas const sal_Int32 nAboveBaseline( -aMetric.GetAscent() ); const sal_Int32 nBelowBaseline( aMetric.GetDescent() ); - if( maLogicalAdvancements.getLength() ) + if( maLogicalAdvancements.hasElements() ) { return geometry::RealRectangle2D( 0, nAboveBaseline, maLogicalAdvancements[ maLogicalAdvancements.getLength()-1 ], @@ -330,7 +330,7 @@ namespace vclcanvas setupLayoutMode( rOutDev, mnTextDirection ); - if( maLogicalAdvancements.getLength() ) + if( maLogicalAdvancements.hasElements() ) { // TODO(P2): cache that std::unique_ptr< long []> aOffsets(new long[maLogicalAdvancements.getLength()]); |