From 604bc943655b88994faa7f307d1c48e914965e95 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 24 Jul 2017 09:41:01 +0200 Subject: loplugin:unusedfields readonly fields Change-Id: I6629926df06f71ff86e9fb23ae4fc1ae73bc9406 Reviewed-on: https://gerrit.libreoffice.org/40360 Tested-by: Jenkins Reviewed-by: Noel Grandin --- cui/source/dialogs/hltpbase.cxx | 2 +- cui/source/inc/backgrnd.hxx | 1 - cui/source/tabpages/backgrnd.cxx | 7 +-- .../source/deployment/gui/dp_gui_updatedialog.cxx | 6 -- filter/inc/gfxtypes.hxx | 4 -- filter/source/graphicfilter/icgm/cgm.cxx | 8 --- filter/source/graphicfilter/icgm/cgm.hxx | 2 - include/sfx2/frame.hxx | 5 -- include/sfx2/viewfrm.hxx | 4 +- include/svx/svdundo.hxx | 4 -- sc/source/ui/view/drawvie3.cxx | 2 +- sd/source/ui/view/drviewsc.cxx | 13 ++-- sfx2/source/view/frame.cxx | 72 ---------------------- sfx2/source/view/frame2.cxx | 1 - svx/source/svdraw/svdundo.cxx | 15 ----- sw/source/ui/chrdlg/chardlg.cxx | 3 +- sw/source/ui/frmdlg/frmpage.cxx | 2 +- sw/source/uibase/shells/basesh.cxx | 2 +- 18 files changed, 16 insertions(+), 137 deletions(-) diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx index 520d0e017d2c..68afa3cb9433 100644 --- a/cui/source/dialogs/hltpbase.cxx +++ b/cui/source/dialogs/hltpbase.cxx @@ -159,7 +159,7 @@ void SvxHyperlinkTabPageBase::InitStdControls () if ( pFrame ) { std::unique_ptr pList(new TargetList); - pFrame->GetTargetList(*pList); + SfxFrame::GetDefaultTargetList(*pList); if( !pList->empty() ) { size_t nCount = pList->size(); diff --git a/cui/source/inc/backgrnd.hxx b/cui/source/inc/backgrnd.hxx index c200d996609c..de75d6923580 100644 --- a/cui/source/inc/backgrnd.hxx +++ b/cui/source/inc/backgrnd.hxx @@ -105,7 +105,6 @@ private: sal_uInt16 nHtmlMode; bool bAllowShowSelector : 1; bool bIsGraphicValid : 1; - bool bLinkOnly : 1; bool bHighlighting : 1; bool m_bColorSelected : 1; Graphic aBgdGraphic; diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index 2ac62da42ad3..6e82f808fb38 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -316,7 +316,6 @@ SvxBackgroundTabPage::SvxBackgroundTabPage(vcl::Window* pParent, const SfxItemSe , nHtmlMode(0) , bAllowShowSelector(true) , bIsGraphicValid(false) - , bLinkOnly(false) , bHighlighting(false) , m_bColorSelected(false) , pPageImpl(new SvxBackgroundPage_Impl) @@ -894,7 +893,7 @@ void SvxBackgroundTabPage::ShowBitmapUI_Impl() m_pBitmapContainer->Show(); m_pFileFrame->Show(); - m_pBtnLink->Show(!bLinkOnly && !(nHtmlMode & HTMLMODE_ON)); + m_pBtnLink->Show(!(nHtmlMode & HTMLMODE_ON)); m_pTypeFrame->Show(); @@ -1079,7 +1078,7 @@ IMPL_LINK_NOARG(SvxBackgroundTabPage, BrowseHdl_Impl, Button*, void) OUString aStrBrowse(get("findgraphicsft")->GetText()); pImportDlg = new SvxOpenGraphicDialog( aStrBrowse ); - if ( bHtml || bLinkOnly ) + if ( bHtml ) pImportDlg->EnableLink(false); pImportDlg->SetPath( aBgdGraphicPath, m_pBtnLink->IsChecked() ); @@ -1122,7 +1121,7 @@ IMPL_LINK( SvxBackgroundTabPage, LoadIdleHdl_Impl, Timer*, pIdle, void ) // new file chosen aBgdGraphicPath = pImportDlg->GetPath(); aBgdGraphicFilter = pImportDlg->GetCurrentFilter(); - bool bLink = ( nHtmlMode & HTMLMODE_ON ) || bLinkOnly || pImportDlg->IsAsLink(); + bool bLink = ( nHtmlMode & HTMLMODE_ON ) || pImportDlg->IsAsLink(); m_pBtnLink->Check( bLink ); m_pBtnLink->Enable(); diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index 16bcc0b5e687..7cf0ae366594 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -224,7 +224,6 @@ private: uno::Reference< task::XInteractionHandler > m_xInteractionHdl; // guarded by Application::GetSolarMutex(): - uno::Reference< task::XAbortChannel > m_abort; bool m_stop; }; @@ -250,15 +249,10 @@ UpdateDialog::Thread::Thread( } void UpdateDialog::Thread::stop() { - uno::Reference< task::XAbortChannel > abort; { SolarMutexGuard g; - abort = m_abort; m_stop = true; } - if (abort.is()) { - abort->sendAbort(); - } m_updateInformation->cancel(); } diff --git a/filter/inc/gfxtypes.hxx b/filter/inc/gfxtypes.hxx index e6404def6c98..135aa5fd4988 100644 --- a/filter/inc/gfxtypes.hxx +++ b/filter/inc/gfxtypes.hxx @@ -148,7 +148,6 @@ struct State maFontVariant("normal"), mnFontWeight(400.0), meTextAnchor(BEFORE), - meTextDisplayAlign(BEFORE), maCurrentColor(0.0), mbVisibility(true), meFillType(SOLID), @@ -188,7 +187,6 @@ struct State double mnFontWeight; TextAlign meTextAnchor; // text-anchor - TextAlign meTextDisplayAlign; // display-align ARGBColor maCurrentColor; bool mbVisibility; @@ -233,7 +231,6 @@ inline bool operator==(const State& rLHS, const State& rRHS ) rLHS.maFontVariant==rRHS.maFontVariant && rLHS.mnFontWeight==rRHS.mnFontWeight && rLHS.meTextAnchor==rRHS.meTextAnchor && - rLHS.meTextDisplayAlign==rRHS.meTextDisplayAlign && rLHS.maCurrentColor==rRHS.maCurrentColor && rLHS.mbVisibility==rRHS.mbVisibility && rLHS.meFillType==rRHS.meFillType && @@ -285,7 +282,6 @@ namespace std ^ size_t(rState.maFontVariant.hashCode()) ^ std::hash()(rState.mnFontWeight) ^ size_t(rState.meTextAnchor) - ^ size_t(rState.meTextDisplayAlign) ^ size_t(rState.mbVisibility) ^ size_t(rState.meFillType) ^ std::hash()(rState.mnFillOpacity) diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx index c841f7234a19..758f4e0a2fa8 100644 --- a/filter/source/graphicfilter/icgm/cgm.cxx +++ b/filter/source/graphicfilter/icgm/cgm.cxx @@ -43,7 +43,6 @@ CGM::CGM(uno::Reference< frame::XModel > const & rModel) , mnXFraction(0) , mnYFraction(0) , mbAngReverse(false) - , mpGraphic(nullptr) , mbStatus(true) , mbMetaFile(false) , mbIsFinished(false) @@ -72,13 +71,6 @@ CGM::CGM(uno::Reference< frame::XModel > const & rModel) CGM::~CGM() { - if ( mpGraphic ) - { - mpGDIMetaFile->Stop(); - mpGDIMetaFile->SetPrefMapMode( MapMode() ); - mpGDIMetaFile->SetPrefSize( Size( static_cast< long >( mnOutdx ), static_cast< long >( mnOutdy ) ) ); - *mpGraphic = Graphic( *mpGDIMetaFile ); - } for(sal_uInt8* i : maDefRepList) delete [] i; maDefRepList.clear(); diff --git a/filter/source/graphicfilter/icgm/cgm.hxx b/filter/source/graphicfilter/icgm/cgm.hxx index fb335e09bc0e..2921ce726ca7 100644 --- a/filter/source/graphicfilter/icgm/cgm.hxx +++ b/filter/source/graphicfilter/icgm/cgm.hxx @@ -56,8 +56,6 @@ class CGM double mnYFraction; bool mbAngReverse; // AngularDirection - Graphic* mpGraphic; - bool mbStatus; bool mbMetaFile; bool mbIsFinished; diff --git a/include/sfx2/frame.hxx b/include/sfx2/frame.hxx index 2bff62987274..8ac02bee0829 100644 --- a/include/sfx2/frame.hxx +++ b/include/sfx2/frame.hxx @@ -73,7 +73,6 @@ class SfxDispatcher; namespace tools { class Rectangle; } class SfxRequest; class SystemWindow; -class SfxFrameArr_Impl; typedef ::std::vector TargetList; @@ -97,7 +96,6 @@ class SFX2_DLLPUBLIC SfxFrame : public SvCompatWeakBase friend class SfxFrameWindow_Impl; private: - SfxFrameArr_Impl* pChildArr; std::unique_ptr< SfxFrame_Impl > pImpl; VclPtr pWindow; @@ -116,8 +114,6 @@ public: vcl::Window& GetWindow() const { return *pWindow;} void CancelTransfers(); bool DoClose(); - sal_uInt16 GetChildFrameCount() const; - SfxFrame* GetChildFrame( sal_uInt16 nPos ) const; void SetPresentationMode( bool bSet ); SystemWindow* GetSystemWindow() const; @@ -130,7 +126,6 @@ public: sal_uInt32 GetFrameType() const; static void GetDefaultTargetList( TargetList& ); - void GetTargetList( TargetList& ) const; void UpdateDescriptor( SfxObjectShell const *pDoc ); void Resize(); const css::uno::Reference< css::frame::XFrame >& diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx index a1f0c9384011..333e055c6996 100644 --- a/include/sfx2/viewfrm.hxx +++ b/include/sfx2/viewfrm.hxx @@ -148,8 +148,8 @@ public: bool DoClose(); sal_uIntPtr GetFrameType() const { return GetFrame().GetFrameType(); } - void GetTargetList( TargetList& rList ) const - { GetFrame().GetTargetList( rList ); } + static void GetTargetList( TargetList& rList ) + { SfxFrame::GetDefaultTargetList( rList ); } void SetModalMode( bool ); bool IsInModalMode() const; diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx index 5f9b6049c5a9..f46b0b3c0d80 100644 --- a/include/svx/svdundo.hxx +++ b/include/svx/svdundo.hxx @@ -147,7 +147,6 @@ class SVX_DLLPUBLIC SdrUndoAttrObj : public SdrUndoObj protected: SfxItemSet* pUndoSet; SfxItemSet* pRedoSet; - SfxItemSet* pRepeatSet; // FIXME: Or should we better remember the StyleSheetNames? rtl::Reference< SfxStyleSheetBase > mxUndoStyleSheet; @@ -175,9 +174,6 @@ public: virtual OUString GetComment() const override; virtual OUString GetSdrRepeatComment(SdrView& rView) const override; - - virtual void SdrRepeat(SdrView& rView) override; - virtual bool CanSdrRepeat(SdrView& rView) const override; }; /** diff --git a/sc/source/ui/view/drawvie3.cxx b/sc/source/ui/view/drawvie3.cxx index 3a541afe5530..1dc0b8f5dc45 100644 --- a/sc/source/ui/view/drawvie3.cxx +++ b/sc/source/ui/view/drawvie3.cxx @@ -207,7 +207,7 @@ void ScDrawView::UpdateIMap( SdrObject* pObj ) pImageMap = &pIMapInfo->GetImageMap(); // handle target list - pViewData->GetViewShell()->GetViewFrame()->GetTargetList( aTargetList ); + SfxViewFrame::GetTargetList( aTargetList ); // handle graphics from object if ( dynamic_cast( pObj) != nullptr ) diff --git a/sd/source/ui/view/drviewsc.cxx b/sd/source/ui/view/drviewsc.cxx index 5bbf7ff27c49..ca06c593e8ff 100644 --- a/sd/source/ui/view/drviewsc.cxx +++ b/sd/source/ui/view/drviewsc.cxx @@ -49,6 +49,8 @@ #include "DrawDocShell.hxx" #include "drawview.hxx" #include "sdabstdlg.hxx" +#include + namespace sd { void DrawViewShell::UpdateIMapDlg( SdrObject* pObj ) @@ -58,7 +60,7 @@ void DrawViewShell::UpdateIMapDlg( SdrObject* pObj ) { Graphic aGraphic; ImageMap* pIMap = nullptr; - TargetList* pTargetList = nullptr; + std::unique_ptr pTargetList; SdIMapInfo* pIMapInfo = SdDrawDocument::GetIMapInfo( pObj ); // get graphic from shape @@ -69,14 +71,11 @@ void DrawViewShell::UpdateIMapDlg( SdrObject* pObj ) if ( pIMapInfo ) { pIMap = const_cast(&pIMapInfo->GetImageMap()); - pTargetList = new TargetList; - GetViewFrame()->GetTargetList( *pTargetList ); + pTargetList.reset(new TargetList); + SfxViewFrame::GetTargetList( *pTargetList ); } - SvxIMapDlgChildWindow::UpdateIMapDlg( aGraphic, pIMap, pTargetList, pObj ); - - // We can delete the target list - delete pTargetList; + SvxIMapDlgChildWindow::UpdateIMapDlg( aGraphic, pIMap, pTargetList.get(), pObj ); } } diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index b93cce9e208f..73d7f562b1ee 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -101,12 +101,6 @@ SfxFrame::~SfxFrame() pFramesArr_Impl->erase( it ); delete pImpl->pDescr; - - if ( pChildArr ) - { - DBG_ASSERT( pChildArr->empty(), "Children are not removed!" ); - delete pChildArr; - } } bool SfxFrame::DoClose() @@ -173,9 +167,6 @@ bool SfxFrame::DocIsModified_Impl() if ( pImpl->pCurrentViewFrame && pImpl->pCurrentViewFrame->GetObjectShell() && pImpl->pCurrentViewFrame->GetObjectShell()->IsModified() ) return true; - for( sal_uInt16 nPos = GetChildFrameCount(); nPos--; ) - if( (*pChildArr)[ nPos ]->DocIsModified_Impl() ) - return true; return false; } @@ -210,13 +201,6 @@ bool SfxFrame::PrepareClose_Impl( bool bUI ) bRet = pCur->PrepareClose( bUI ); } - if ( bRet ) - { - // if this frame has child frames, ask them too - for( sal_uInt16 nPos = GetChildFrameCount(); bRet && nPos--; ) - bRet = (*pChildArr)[ nPos ]->PrepareClose_Impl( bUI ); - } - pImpl->bPrepClosing = false; } @@ -228,17 +212,6 @@ bool SfxFrame::PrepareClose_Impl( bool bUI ) } -SfxFrame* SfxFrame::GetChildFrame( sal_uInt16 nPos ) const -{ - if ( pChildArr && pChildArr->size() > nPos ) - { - DBG_ASSERT( nPos < pChildArr->size(), "Wrong Index!"); - return (*pChildArr)[nPos]; - } - - return nullptr; -} - bool SfxFrame::IsClosing_Impl() const { return pImpl->bClosing; @@ -249,11 +222,6 @@ void SfxFrame::SetIsClosing_Impl() pImpl->bClosing = true; } -sal_uInt16 SfxFrame::GetChildFrameCount() const -{ - return pChildArr ? pChildArr->size() : 0; -} - void SfxFrame::CancelTransfers() { if( !pImpl->bInCancelTransfers ) @@ -274,11 +242,6 @@ void SfxFrame::CancelTransfers() } } - // First stop multiload Frames - sal_uInt16 nCount = GetChildFrameCount(); - for( sal_uInt16 n = 0; nCancelTransfers(); - // Check if StarOne-Loader should be canceled SfxFrameWeakRef wFrame( this ); if (wFrame.is()) @@ -298,11 +261,6 @@ bool SfxFrame::IsAutoLoadLocked_Impl() const if ( !pObjSh || !pObjSh->IsAutoLoadLocked() ) return false; - // Its children are locked? - for ( sal_uInt16 n = GetChildFrameCount(); n--; ) - if ( !GetChildFrame(n)->IsAutoLoadLocked_Impl() ) - return false; - // otherwise allow AutoLoad return true; } @@ -339,28 +297,14 @@ void SfxFrame::GetViewData_Impl() if( pViewFrame && pViewFrame->GetViewShell() ) { SfxItemSet *pSet = GetDescriptor()->GetArgs(); - bool bGetViewData = false; if ( GetController().is() && pSet->GetItemState( SID_VIEW_DATA ) != SfxItemState::SET ) { css::uno::Any aData = GetController()->getViewData(); pSet->Put( SfxUsrAnyItem( SID_VIEW_DATA, aData ) ); - bGetViewData = true; } if ( pViewFrame->GetCurViewId() ) pSet->Put( SfxUInt16Item( SID_VIEW_ID, (sal_uInt16)pViewFrame->GetCurViewId() ) ); - if ( pChildArr ) - { - // For Framesets also the data from the ChildViews have to be processed - sal_uInt16 nCount = pChildArr->size(); - for ( sal_uInt16 n=nCount; n>0; n--) - { - SfxFrame* pFrame = (*pChildArr)[n-1]; - if ( bGetViewData ) - pFrame->GetDescriptor()->GetArgs()->ClearItem( SID_VIEW_DATA ); - pFrame->GetViewData_Impl(); - } - } } } @@ -437,22 +381,6 @@ void SfxFrame::GetDefaultTargetList(TargetList& rList) rList.push_back( OUString( "_self" ) ); } -void SfxFrame::GetTargetList( TargetList& rList ) const -{ - SfxFrame::GetDefaultTargetList(rList); - - SfxViewFrame* pView = GetCurrentViewFrame(); - if( pView && pView->GetViewShell() && pChildArr ) - { - sal_uInt16 nCount = pChildArr->size(); - for ( sal_uInt16 n=0; nGetTargetList( rList ); - } - } -} - void SfxFrame::InsertTopFrame_Impl( SfxFrame* pFrame ) { SfxFrameArr_Impl& rArr = *SfxGetpApp()->Get_Impl()->pTopFrames; diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx index 1d448e6987cc..5dc035fadf63 100644 --- a/sfx2/source/view/frame2.cxx +++ b/sfx2/source/view/frame2.cxx @@ -288,7 +288,6 @@ SfxFrame* SfxFrame::Create( const Reference < XFrame >& i_rFrame ) SfxFrame::SfxFrame( vcl::Window& i_rContainerWindow ) :SvCompatWeakBase( this ) - ,pChildArr( nullptr ) ,pWindow( nullptr ) { Construct_Impl(); diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx index 695a236a9f6a..133c604953d9 100644 --- a/svx/source/svdraw/svdundo.cxx +++ b/svx/source/svdraw/svdundo.cxx @@ -264,7 +264,6 @@ SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, bool bStyleSheet1, bool bSave : SdrUndoObj(rNewObj) , pUndoSet(nullptr) , pRedoSet(nullptr) - , pRepeatSet(nullptr) , mxUndoStyleSheet() , mxRedoStyleSheet() , bHaveToTakeRedoSet(true) @@ -311,7 +310,6 @@ SdrUndoAttrObj::~SdrUndoAttrObj() { delete pUndoSet; delete pRedoSet; - delete pRepeatSet; delete pUndoGroup; delete pTextUndo; delete pTextRedo; @@ -521,19 +519,6 @@ OUString SdrUndoAttrObj::GetComment() const return aStr; } -void SdrUndoAttrObj::SdrRepeat(SdrView& rView) -{ - if(pRepeatSet) - { - rView.SetAttrToMarked(*pRepeatSet, false); - } -} - -bool SdrUndoAttrObj::CanSdrRepeat(SdrView& rView) const -{ - return (pRepeatSet!=nullptr && rView.AreObjectsMarked()); -} - OUString SdrUndoAttrObj::GetSdrRepeatComment(SdrView& /*rView*/) const { OUString aStr; diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx index 3e30516b678d..bdf33691b0c3 100644 --- a/sw/source/ui/chrdlg/chardlg.cxx +++ b/sw/source/ui/chrdlg/chardlg.cxx @@ -174,8 +174,7 @@ SwCharURLPage::SwCharURLPage(vcl::Window* pParent, const SfxItemSet& rCoreSet) m_pNotVisitedLB->SaveValue(); std::unique_ptr pList( new TargetList ); - const SfxFrame& rFrame = pView->GetViewFrame()->GetFrame(); - rFrame.GetTargetList(*pList); + SfxFrame::GetDefaultTargetList(*pList); if ( !pList->empty() ) { size_t nCount = pList->size(); diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 82882cbc45d2..3c8657f07063 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -2763,7 +2763,7 @@ void SwFrameURLPage::Reset( const SfxItemSet *rSet ) if ( SfxItemState::SET == rSet->GetItemState( SID_DOCFRAME, true, &pItem)) { std::unique_ptr pList(new TargetList); - static_cast(pItem)->GetFrame()->GetTargetList(*pList); + SfxFrame::GetDefaultTargetList(*pList); if( !pList->empty() ) { size_t nCount = pList->size(); diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index e62f7a57e47b..79570ab3b9bc 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -165,7 +165,7 @@ static void lcl_UpdateIMapDlg( SwWrtShell& rSh ) void* pEditObj = GraphicType::NONE != nGrfType && GraphicType::Default != nGrfType ? rSh.GetIMapInventor() : nullptr; std::unique_ptr pList(new TargetList); - rSh.GetView().GetViewFrame()->GetFrame().GetTargetList(*pList); + SfxFrame::GetDefaultTargetList(*pList); SfxItemSet aSet( rSh.GetAttrPool(), svl::Items{} ); rSh.GetFlyFrameAttr( aSet ); -- cgit