diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-23 08:48:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-27 11:48:46 +0200 |
commit | 1534025a0386584a7b8f3f929b10ce5eb33257cf (patch) | |
tree | 7f12dd6763148089cd4fb5495c8fffe84f415e12 /sc | |
parent | 0f2e01677cd0e8857faec99c61d71e88eee78b27 (diff) |
loplugin:methodcycles more graph theory for the win
implemeent a reduction approach, which is good at finding virtual
methods that only themselves or their virtual partners.
The accessibility GetVisArea stuff is dead since
commit 891e41fac81fbd8d5cdb277b26639abfd25a7143
Date: Wed Apr 4 11:23:22 2018 +0200
dead code in AccessibleTextHelper_Impl::UpdateVisibleChildren
Change-Id: I78d9d8bca585ecec8394f2c3fe2baa93db0e58f5
Reviewed-on: https://gerrit.libreoffice.org/60912
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/Accessibility/AccessibleText.cxx | 235 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 13 | ||||
-rw-r--r-- | sc/source/ui/inc/docsh.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/vba/vbacondition.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/vba/vbacondition.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/vba/vbaformatcondition.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/vba/vbaformatcondition.hxx | 1 |
7 files changed, 12 insertions, 262 deletions
diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index 4260968c75c0..a3ca67e793ab 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -55,7 +55,6 @@ public: ScViewForwarder(ScTabViewShell* pViewShell, ScSplitPos eSplitPos, const ScAddress& rCell); virtual bool IsValid() const override; - virtual tools::Rectangle GetVisArea() const override; virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const override; virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const override; @@ -75,34 +74,6 @@ bool ScViewForwarder::IsValid() const return mpViewShell != nullptr; } -tools::Rectangle ScViewForwarder::GetVisArea() const -{ - tools::Rectangle aVisArea; - if (mpViewShell) - { - vcl::Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos); - if (pWindow) - { - aVisArea.SetSize(pWindow->GetSizePixel()); - - ScHSplitPos eWhichH = ((meSplitPos == SC_SPLIT_TOPLEFT) || (meSplitPos == SC_SPLIT_BOTTOMLEFT)) ? - SC_SPLIT_LEFT : SC_SPLIT_RIGHT; - ScVSplitPos eWhichV = ((meSplitPos == SC_SPLIT_TOPLEFT) || (meSplitPos == SC_SPLIT_TOPRIGHT)) ? - SC_SPLIT_TOP : SC_SPLIT_BOTTOM; - - Point aBaseCellPos(mpViewShell->GetViewData().GetScrPos(mpViewShell->GetViewData().GetPosX(eWhichH), - mpViewShell->GetViewData().GetPosY(eWhichV), meSplitPos, true)); - Point aCellPos(mpViewShell->GetViewData().GetScrPos(maCellPos.Col(), maCellPos.Row(), meSplitPos, true)); - aVisArea.SetPos(aCellPos - aBaseCellPos); - } - } - else - { - OSL_FAIL("this ViewForwarder is not valid"); - } - return aVisArea; -} - Point ScViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const { if (mpViewShell) @@ -148,7 +119,6 @@ public: const EditView* _pEditView); virtual bool IsValid() const override; - virtual tools::Rectangle GetVisArea() const override; virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const override; virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const override; @@ -168,24 +138,6 @@ bool ScEditObjectViewForwarder::IsValid() const return (mpWindow != nullptr); } -tools::Rectangle ScEditObjectViewForwarder::GetVisArea() const -{ - tools::Rectangle aVisArea; - if (mpWindow) - { - tools::Rectangle aVisRect(mpWindow->GetWindowExtentsRelative(mpWindow->GetAccessibleParentWindow())); - - aVisRect.SetPos(Point(0, 0)); - - aVisArea = aVisRect; - } - else - { - OSL_FAIL("this ViewForwarder is not valid"); - } - return aVisArea; -} - Point ScEditObjectViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const { if (mpWindow) @@ -241,16 +193,10 @@ public: explicit ScPreviewViewForwarder(ScPreviewShell* pViewShell); virtual bool IsValid() const override; - virtual tools::Rectangle GetVisArea() const override; virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const override; virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const override; void SetInvalid(); - - tools::Rectangle GetVisRect() const; - - // clips the VisArea and calculates with the negative coordinates - tools::Rectangle CorrectVisArea(const tools::Rectangle& rVisArea) const; }; ScPreviewViewForwarder::ScPreviewViewForwarder(ScPreviewShell* pViewShell) @@ -263,12 +209,6 @@ bool ScPreviewViewForwarder::IsValid() const return mpViewShell != nullptr; } -tools::Rectangle ScPreviewViewForwarder::GetVisArea() const -{ - OSL_FAIL("should be implemented in an abrevated class"); - return tools::Rectangle(); -} - Point ScPreviewViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const { if (mpViewShell) @@ -316,79 +256,16 @@ void ScPreviewViewForwarder::SetInvalid() mpViewShell = nullptr; } -tools::Rectangle ScPreviewViewForwarder::GetVisRect() const -{ - if ( mpViewShell ) - { - Size aOutputSize; - vcl::Window* pWindow = mpViewShell->GetWindow(); - if ( pWindow ) - aOutputSize = pWindow->GetOutputSizePixel(); - tools::Rectangle aVisRect( Point(), aOutputSize ); - return aVisRect; - } - return tools::Rectangle(); -} - -tools::Rectangle ScPreviewViewForwarder::CorrectVisArea(const tools::Rectangle& rVisArea) const -{ - tools::Rectangle aVisArea(rVisArea); - Point aPos = aVisArea.TopLeft(); // get first the position to remember negative positions after clipping - - vcl::Window* pWin = mpViewShell->GetWindow(); - if (pWin) - aVisArea = pWin->GetWindowExtentsRelative(pWin).GetIntersection(aVisArea); - - sal_Int32 nX(aPos.getX()); - sal_Int32 nY(aPos.getY()); - - if (nX > 0) - nX = 0; - else if (nX < 0) - nX = -nX; - if (nY > 0) - nY = 0; - else if (nY < 0) - nY = -nY; - aVisArea.SetPos(Point(nX, nY)); - - return aVisArea; -} - class ScPreviewHeaderFooterViewForwarder : public ScPreviewViewForwarder { - bool mbHeader; public: - ScPreviewHeaderFooterViewForwarder(ScPreviewShell* pViewShell, bool bHeader); - - virtual tools::Rectangle GetVisArea() const override; + ScPreviewHeaderFooterViewForwarder(ScPreviewShell* pViewShell); }; -ScPreviewHeaderFooterViewForwarder::ScPreviewHeaderFooterViewForwarder(ScPreviewShell* pViewShell, bool bHeader) +ScPreviewHeaderFooterViewForwarder::ScPreviewHeaderFooterViewForwarder(ScPreviewShell* pViewShell) : - ScPreviewViewForwarder(pViewShell), - mbHeader(bHeader) -{ -} - -tools::Rectangle ScPreviewHeaderFooterViewForwarder::GetVisArea() const + ScPreviewViewForwarder(pViewShell) { - tools::Rectangle aVisArea; - if (mpViewShell) - { - const ScPreviewLocationData& rData = mpViewShell->GetLocationData(); - if ( mbHeader ) - rData.GetHeaderPosition( aVisArea ); - else - rData.GetFooterPosition( aVisArea ); - - aVisArea = CorrectVisArea(aVisArea); - } - else - { - OSL_FAIL("this ViewForwarder is not valid"); - } - return aVisArea; } class ScPreviewCellViewForwarder : public ScPreviewViewForwarder @@ -397,8 +274,6 @@ class ScPreviewCellViewForwarder : public ScPreviewViewForwarder public: ScPreviewCellViewForwarder(ScPreviewShell* pViewShell, const ScAddress& aCellPos); - - virtual tools::Rectangle GetVisArea() const override; }; ScPreviewCellViewForwarder::ScPreviewCellViewForwarder(ScPreviewShell* pViewShell, @@ -409,99 +284,36 @@ ScPreviewCellViewForwarder::ScPreviewCellViewForwarder(ScPreviewShell* pViewShel { } -tools::Rectangle ScPreviewCellViewForwarder::GetVisArea() const -{ - tools::Rectangle aVisArea; - if (mpViewShell) - { - const ScPreviewLocationData& rData = mpViewShell->GetLocationData(); - aVisArea = rData.GetCellOutputRect(maCellPos); - - aVisArea = CorrectVisArea(aVisArea); - } - else - { - OSL_FAIL("this ViewForwarder is not valid"); - } - return aVisArea; -} - class ScPreviewHeaderCellViewForwarder : public ScPreviewViewForwarder { ScAddress maCellPos; - bool mbColHeader; public: ScPreviewHeaderCellViewForwarder(ScPreviewShell* pViewShell, - const ScAddress& aCellPos, - bool bColHeader); - - virtual tools::Rectangle GetVisArea() const override; + const ScAddress& aCellPos); }; ScPreviewHeaderCellViewForwarder::ScPreviewHeaderCellViewForwarder(ScPreviewShell* pViewShell, - const ScAddress& aCellPos, - bool bColHeader) + const ScAddress& aCellPos) : ScPreviewViewForwarder(pViewShell), - maCellPos(aCellPos), - mbColHeader(bColHeader) + maCellPos(aCellPos) { } -tools::Rectangle ScPreviewHeaderCellViewForwarder::GetVisArea() const -{ - tools::Rectangle aVisArea; - if (mpViewShell) - { - const ScPreviewLocationData& rData = mpViewShell->GetLocationData(); - aVisArea = rData.GetHeaderCellOutputRect(GetVisRect(), maCellPos, mbColHeader); - - aVisArea = CorrectVisArea(aVisArea); - } - else - { - OSL_FAIL("this ViewForwarder is not valid"); - } - return aVisArea; -} - class ScPreviewNoteViewForwarder : public ScPreviewViewForwarder { ScAddress maCellPos; - bool mbNoteMark; public: ScPreviewNoteViewForwarder(ScPreviewShell* pViewShell, - const ScAddress& aCellPos, - bool bNoteMark); - - virtual tools::Rectangle GetVisArea() const override; + const ScAddress& aCellPos); }; ScPreviewNoteViewForwarder::ScPreviewNoteViewForwarder(ScPreviewShell* pViewShell, - const ScAddress& aCellPos, - bool bNoteMark) + const ScAddress& aCellPos) : ScPreviewViewForwarder(pViewShell), - maCellPos(aCellPos), - mbNoteMark(bNoteMark) -{ -} - -tools::Rectangle ScPreviewNoteViewForwarder::GetVisArea() const + maCellPos(aCellPos) { - tools::Rectangle aVisArea; - if (mpViewShell) - { - const ScPreviewLocationData& rData = mpViewShell->GetLocationData(); - aVisArea = rData.GetNoteInRangeOutputRect(GetVisRect(), mbNoteMark, maCellPos); - - aVisArea = CorrectVisArea(aVisArea); - } - else - { - OSL_FAIL("this ViewForwarder is not valid"); - } - return aVisArea; } class ScEditViewForwarder : public SvxEditViewForwarder @@ -512,7 +324,6 @@ public: ScEditViewForwarder(EditView* pEditView, vcl::Window* pWin); virtual bool IsValid() const override; - virtual tools::Rectangle GetVisArea() const override; virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const override; virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const override; virtual bool GetSelection( ESelection& rSelection ) const override; @@ -535,22 +346,6 @@ bool ScEditViewForwarder::IsValid() const return mpWindow && mpEditView; } -tools::Rectangle ScEditViewForwarder::GetVisArea() const -{ - tools::Rectangle aVisArea; - if (IsValid() && mpEditView->GetEditEngine()) - { - MapMode aMapMode(mpEditView->GetEditEngine()->GetRefMapMode()); - - aVisArea = mpWindow->LogicToPixel( mpEditView->GetVisArea(), aMapMode ); - } - else - { - OSL_FAIL("this EditViewForwarder is no longer valid"); - } - return aVisArea; -} - Point ScEditViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const { if (mpWindow) @@ -1281,7 +1076,7 @@ SvxTextForwarder* ScAccessiblePreviewHeaderCellTextData::GetTextForwarder() SvxViewForwarder* ScAccessiblePreviewHeaderCellTextData::GetViewForwarder() { if (!mpViewForwarder) - mpViewForwarder.reset(new ScPreviewHeaderCellViewForwarder(mpViewShell, aCellPos, mbColHeader)); + mpViewForwarder.reset(new ScPreviewHeaderCellViewForwarder(mpViewShell, aCellPos)); return mpViewForwarder.get(); } @@ -1400,7 +1195,7 @@ SvxTextForwarder* ScAccessibleHeaderTextData::GetTextForwarder() SvxViewForwarder* ScAccessibleHeaderTextData::GetViewForwarder() { if (!mpViewForwarder) - mpViewForwarder = new ScPreviewHeaderFooterViewForwarder(mpViewShell, mbHeader); + mpViewForwarder = new ScPreviewHeaderFooterViewForwarder(mpViewShell); return mpViewForwarder; } @@ -1503,7 +1298,7 @@ SvxTextForwarder* ScAccessibleNoteTextData::GetTextForwarder() SvxViewForwarder* ScAccessibleNoteTextData::GetViewForwarder() { if (!mpViewForwarder) - mpViewForwarder = new ScPreviewNoteViewForwarder(mpViewShell, maCellPos, mbMarkNote); + mpViewForwarder = new ScPreviewNoteViewForwarder(mpViewShell, maCellPos); return mpViewForwarder; } @@ -1518,7 +1313,6 @@ public: explicit ScCsvViewForwarder( vcl::Window* pWindow, const tools::Rectangle& rBoundBox ); virtual bool IsValid() const override; - virtual tools::Rectangle GetVisArea() const override; virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const override; virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const override; @@ -1536,11 +1330,6 @@ bool ScCsvViewForwarder::IsValid() const return mpWindow != nullptr; } -tools::Rectangle ScCsvViewForwarder::GetVisArea() const -{ - return maBoundBox; -} - Point ScCsvViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const { if( !mpWindow ) return Point(); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index a1cc279398f7..d06c28843502 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -2718,19 +2718,6 @@ bool ScDocShell::PrepareClose( bool bUI ) return bRet; } -void ScDocShell::PrepareReload() -{ - SfxObjectShell::PrepareReload(); // FIXME: Doesn't do a thing? - - // The Disconnect of DDE Links can trigger a Reschedule. - // If the DDE Links are not deleted before the Document dtor, - // the DDE Link Update for this Document can be triggered from this Reschedule on Reload. - // This causes a hang. - // - // Thus: Disconnect the DDE Links of the old Document before Reload - m_aDocument.GetDocLinkManager().disconnectDdeLinks(); -} - OUString ScDocShell::GetOwnFilterName() { return OUString(pFilterSc50); diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index fe8dac8a1ef5..c31eacb566b9 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -202,7 +202,6 @@ public: virtual bool SaveAs( SfxMedium& rMedium ) override; virtual bool ConvertTo( SfxMedium &rMedium ) override; virtual bool PrepareClose( bool bUI = true ) override; - virtual void PrepareReload() override; virtual void LoadStyles( SfxObjectShell &rSource ) override; virtual bool DoSaveCompleted( SfxMedium * pNewStor=nullptr, bool bRegisterRecent=true ) override; // SfxObjectShell diff --git a/sc/source/ui/vba/vbacondition.cxx b/sc/source/ui/vba/vbacondition.cxx index 08ca695e4d6d..274be099b4b9 100644 --- a/sc/source/ui/vba/vbacondition.cxx +++ b/sc/source/ui/vba/vbacondition.cxx @@ -92,20 +92,6 @@ ScVbaCondition< Ifc... >::Formula2( ) } template< typename... Ifc > -void -ScVbaCondition< Ifc... >::setFormula1( const uno::Any& _aFormula1) -{ - OUString sFormula; - if ( _aFormula1 >>= sFormula ) - { - mxSheetCondition->setFormula1( sFormula ); - table::CellRangeAddress aCellRangeAddress = mxAddressable->getRangeAddress(); - table::CellAddress aCellAddress( aCellRangeAddress.Sheet, aCellRangeAddress.StartColumn, aCellRangeAddress.StartRow ); - mxSheetCondition->setSourcePosition(aCellAddress); - } -} - -template< typename... Ifc > sal_Int32 ScVbaCondition< Ifc... >::Operator(bool _bIncludeFormulaValue) { diff --git a/sc/source/ui/vba/vbacondition.hxx b/sc/source/ui/vba/vbacondition.hxx index 7757eb5d06b5..346905a8c2c4 100644 --- a/sc/source/ui/vba/vbacondition.hxx +++ b/sc/source/ui/vba/vbacondition.hxx @@ -39,8 +39,6 @@ public: virtual OUString SAL_CALL Formula1( ) override; virtual OUString SAL_CALL Formula2( ) override; /// @throws css::script::BasicErrorException - virtual void setFormula1( const css::uno::Any& _aFormula1); - /// @throws css::script::BasicErrorException virtual sal_Int32 Operator(bool _bIncludeFormulaValue); virtual sal_Int32 SAL_CALL Operator() override = 0; diff --git a/sc/source/ui/vba/vbaformatcondition.cxx b/sc/source/ui/vba/vbaformatcondition.cxx index 55d81e888030..b32a922a5402 100644 --- a/sc/source/ui/vba/vbaformatcondition.cxx +++ b/sc/source/ui/vba/vbaformatcondition.cxx @@ -109,14 +109,6 @@ ScVbaFormatCondition::retrieveAPIType(sal_Int32 _nVBAType, const uno::Reference< return aAPIType; } -void -ScVbaFormatCondition::setFormula1( const uno::Any& _aFormula1) -{ - // getA1Formula *SHOULD* detect whether the formula is r1c1 or A1 syntax - // and if R1C1 convert to A1 - ScVbaFormatCondition_BASE::setFormula1( uno::makeAny( ScVbaFormatConditions::getA1Formula(_aFormula1) ) ); -} - ::sal_Int32 SAL_CALL ScVbaFormatCondition::Type( ) { diff --git a/sc/source/ui/vba/vbaformatcondition.hxx b/sc/source/ui/vba/vbaformatcondition.hxx index 78ea75783314..892f6eb6e74e 100644 --- a/sc/source/ui/vba/vbaformatcondition.hxx +++ b/sc/source/ui/vba/vbaformatcondition.hxx @@ -58,7 +58,6 @@ public: virtual ::sal_Int32 SAL_CALL Type( ) override; using ScVbaFormatCondition_BASE::Operator; virtual ::sal_Int32 SAL_CALL Operator( ) override; - virtual void setFormula1( const css::uno::Any& _aFormula1) override; virtual css::uno::Reference< ::ooo::vba::excel::XInterior > SAL_CALL Interior( ) override; virtual css::uno::Any SAL_CALL Borders( const css::uno::Any& Index ) override; virtual css::uno::Reference< ::ooo::vba::excel::XFont > SAL_CALL Font( ) override; |