diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-03-06 11:05:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-03-08 07:20:29 +0100 |
commit | 5c23459245f566831383934dd64d19e002bfcfcb (patch) | |
tree | 27d92a2167c6245c3be7844e2bbe7b6e624f0f9e /svx | |
parent | 4a7771ffa8d98d08dffbba90fd42d1ab75e056fe (diff) |
new loplugin constvars
detect static variables that can be made const.
Thanks to mike kaganski for suggesting this.
Here I introduce a new plugin feature - using markers
in nearby comments to disable the plugin for specific
vars.
Some of this stuff was old debugging code. I removed the stuff
that was older than 5 years.
Change-Id: I6ec7742a7fdadf28fd128b592fcdf6da8257585c
Reviewed-on: https://gerrit.libreoffice.org/68807
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/sdr/contact/objectcontactofpageview.cxx | 11 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewcontactofsdrpage.cxx | 2 | ||||
-rw-r--r-- | svx/source/sdr/overlay/overlaymanager.cxx | 13 | ||||
-rw-r--r-- | svx/source/sdr/overlay/overlaymanagerbuffered.cxx | 12 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrole2primitive2d.cxx | 13 | ||||
-rw-r--r-- | svx/source/svdraw/sdrpaintwindow.cxx | 17 | ||||
-rw-r--r-- | svx/source/svdraw/svdedtv2.cxx | 10 | ||||
-rw-r--r-- | svx/source/svdraw/svdotextdecomposition.cxx | 3 | ||||
-rw-r--r-- | svx/source/svdraw/svdpntv.cxx | 31 |
9 files changed, 13 insertions, 99 deletions
diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx index 0c6ecf0abc3a..236c35ca9017 100644 --- a/svx/source/sdr/contact/objectcontactofpageview.cxx +++ b/svx/source/sdr/contact/objectcontactofpageview.cxx @@ -85,15 +85,8 @@ namespace sdr void ObjectContactOfPageView::PrepareProcessDisplay() { if(IsActive()) - { - static bool bInvalidateDuringPaint(true); - - if(bInvalidateDuringPaint) - { - // there are still non-triggered LazyInvalidate events, trigger these - Invoke(); - } - } + // there are still non-triggered LazyInvalidate events, trigger these + Invoke(); } // From baseclass Timer, the timeout call triggered by the LazyInvalidate mechanism diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index 5eea087eac66..3214e22823cb 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -101,7 +101,7 @@ ViewObjectContact& ViewContactOfPageShadow::CreateObjectSpecificViewObjectContac drawinglayer::primitive2d::Primitive2DContainer ViewContactOfPageShadow::createViewIndependentPrimitive2DSequence() const { - static bool bUseOldPageShadow(false); + static bool bUseOldPageShadow(false); // loplugin:constvars:ignore const SdrPage& rPage = getPage(); basegfx::B2DHomMatrix aPageMatrix; aPageMatrix.set(0, 0, static_cast<double>(rPage.GetWidth())); diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx index 14460a3ac605..63909dc3344b 100644 --- a/svx/source/sdr/overlay/overlaymanager.cxx +++ b/svx/source/sdr/overlay/overlaymanager.cxx @@ -128,15 +128,10 @@ namespace sdr { // set Property 'ReducedDisplayQuality' to true to allow simpler interaction // visualisations - static bool bUseReducedDisplayQualityForDrag(true); - - if(bUseReducedDisplayQualityForDrag) - { - uno::Sequence< beans::PropertyValue > xProperties(1); - xProperties[0].Name = "ReducedDisplayQuality"; - xProperties[0].Value <<= true; - maViewInformation2D = drawinglayer::geometry::ViewInformation2D(xProperties); - } + uno::Sequence< beans::PropertyValue > xProperties(1); + xProperties[0].Name = "ReducedDisplayQuality"; + xProperties[0].Value <<= true; + maViewInformation2D = drawinglayer::geometry::ViewInformation2D(xProperties); } rtl::Reference<OverlayManager> OverlayManager::create(OutputDevice& rOutputDevice) diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx index f551bb559385..dfe2c4eaf87f 100644 --- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx +++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx @@ -123,18 +123,6 @@ namespace sdr for(const auto& rRect : aRectangles) { -#ifdef DBG_UTIL - // #i72754# possible graphical region test only with non-pro - static bool bDoPaintForVisualControl(false); - - if(bDoPaintForVisualControl) - { - getOutputDevice().SetLineColor(COL_LIGHTGREEN); - getOutputDevice().SetFillColor(); - getOutputDevice().DrawRect(rRect); - } -#endif - // restore the area const Point aTopLeft(rRect.TopLeft()); const Size aSize(rRect.GetSize()); diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx index cde617b806ac..68c264dd039e 100644 --- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx @@ -71,17 +71,14 @@ namespace drawinglayer { // to take care of getSdrLFSTAttribute() later, the same as in SdrGrafPrimitive2D::create2DDecomposition // should happen. For the moment we only need the OLE itself - // Added complete primitive preparation using getSdrLFSTAttribute() now. To not do stuff which is not needed now, it - // may be suppressed by using a static bool. The paint version only supported text. - static bool bBehaveCompatibleToPaintVersion(false); + // Added complete primitive preparation using getSdrLFSTAttribute() now. Primitive2DContainer aRetval; // create unit outline polygon const basegfx::B2DPolygon& aUnitOutline(basegfx::utils::createUnitPolygon()); // add fill - if(!bBehaveCompatibleToPaintVersion - && !getSdrLFSTAttribute().getFill().isDefault()) + if(!getSdrLFSTAttribute().getFill().isDefault()) { basegfx::B2DPolyPolygon aTransformed(aUnitOutline); @@ -96,8 +93,7 @@ namespace drawinglayer // add line // #i97981# condition was inverse to purpose. When being compatible to paint version, // border needs to be suppressed - if(!bBehaveCompatibleToPaintVersion - && !getSdrLFSTAttribute().getLine().isDefault()) + if(!getSdrLFSTAttribute().getLine().isDefault()) { // if line width is given, polygon needs to be grown by half of it to make the // outline to be outside of the bitmap @@ -162,8 +158,7 @@ namespace drawinglayer } // add shadow - if(!bBehaveCompatibleToPaintVersion - && !getSdrLFSTAttribute().getShadow().isDefault()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { aRetval = createEmbeddedShadowPrimitive( aRetval, diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx index 80116583feb8..711da48c53b7 100644 --- a/svx/source/svdraw/sdrpaintwindow.cxx +++ b/svx/source/svdraw/sdrpaintwindow.cxx @@ -162,23 +162,6 @@ void SdrPreRenderDevice::OutputPreRenderDevice(const vcl::Region& rExpandedRegio aTopLeft, aSize, aTopLeft, aSize, *mpPreRenderDevice); - -#ifdef DBG_UTIL - // #i74769# - static bool bDoPaintForVisualControlRegion(false); - - if(bDoPaintForVisualControlRegion) - { - int nR = comphelper::rng::uniform_int_distribution(0, 0x7F-1); - int nG = comphelper::rng::uniform_int_distribution(0, 0x7F-1); - int nB = comphelper::rng::uniform_int_distribution(0, 0x7F-1); - const Color aColor(((((nR|0x80)<<8)|(nG|0x80))<<8)|(nB|0x80)); - - mpOutputDevice->SetLineColor(aColor); - mpOutputDevice->SetFillColor(); - mpOutputDevice->DrawRect(rRect); - } -#endif } mpOutputDevice->EnableMapMode(bMapModeWasEnabledDest); diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index a243a9c2d410..f9fd815444b5 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -1089,15 +1089,7 @@ void SdrEditView::MergeMarkedObjects(SdrMergeMode eMode) case SdrMergeMode::Merge: { // merge all contained parts (OR) - static bool bTestXOR(false); - if(bTestXOR) - { - aMergePolyPolygonA = basegfx::utils::solvePolygonOperationXor(aMergePolyPolygonA, aMergePolyPolygonB); - } - else - { - aMergePolyPolygonA = basegfx::utils::solvePolygonOperationOr(aMergePolyPolygonA, aMergePolyPolygonB); - } + aMergePolyPolygonA = basegfx::utils::solvePolygonOperationOr(aMergePolyPolygonA, aMergePolyPolygonB); break; } case SdrMergeMode::Subtract: diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index a4b7163d1977..a9072395da89 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -221,9 +221,8 @@ namespace // prepare DXArray content. To make it independent from font size (and such from // the text transformation), scale it to unit coordinates ::std::vector< double > aDXArray; - static bool bDisableTextArray(false); - if(!bDisableTextArray && rInfo.mpDXArray && rInfo.mnTextLen) + if(rInfo.mpDXArray && rInfo.mnTextLen) { aDXArray.reserve(rInfo.mnTextLen); diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index 967215a3822b..f799c3b098cf 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -553,37 +553,6 @@ void SdrPaintView::CompleteRedraw(OutputDevice* pOut, const vcl::Region& rReg, s if(!pWindow->GetPaintRegion().IsEmpty()) { aOptimizedRepaintRegion.Intersect(pWindow->GetPaintRegion()); - -#ifdef DBG_UTIL - // #i74769# test-paint repaint region - static bool bDoPaintForVisualControl(false); - - if(bDoPaintForVisualControl) - { - RectangleVector aRectangles; - aOptimizedRepaintRegion.GetRegionRectangles(aRectangles); - - pWindow->SetLineColor(COL_LIGHTGREEN); - pWindow->SetFillColor(); - - for(const auto& rRect : aRectangles) - { - pWindow->DrawRect(rRect); - } - - //RegionHandle aRegionHandle(aOptimizedRepaintRegion.BeginEnumRects()); - //Rectangle aRegionRectangle; - - //while(aOptimizedRepaintRegion.GetEnumRects(aRegionHandle, aRegionRectangle)) - //{ - // pWindow->SetLineCOL_LIGHTGREEN); - // pWindow->SetFillColor(); - // pWindow->DrawRect(aRegionRectangle); - //} - - //aOptimizedRepaintRegion.EndEnumRects(aRegionHandle); - } -#endif } } } |