diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-21 10:36:23 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-21 13:27:58 +0200 |
commit | c0ce1ec3736be861a2ed58827fadb25269ab0117 (patch) | |
tree | f294165ac148084d8584105ecee19ddf57b51dfb /sfx2 | |
parent | 1abdeff9de5d9257464048bcdf50a6d6fd926c0b (diff) |
loplugin:unusedfields in sfx2 part1
and fix a memory leak in NotebookbarTabControl where it was not freeing
it's m_pListener field
Change-Id: Ib9970c9084982d532fa38d1bc3c44180ab2c3c39
Reviewed-on: https://gerrit.libreoffice.org/39036
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/bastyp/fltfnc.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/bastyp/frmhtml.cxx | 11 | ||||
-rw-r--r-- | sfx2/source/doc/docfilt.cxx | 7 | ||||
-rw-r--r-- | sfx2/source/doc/frmdescr.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/notebookbar/NotebookbarTabControl.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/view/frame.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/view/sfxbasecontroller.cxx | 13 | ||||
-rw-r--r-- | sfx2/source/view/viewimp.hxx | 3 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 18 |
9 files changed, 9 insertions, 57 deletions
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index ed12ff58cab4..ef136761d100 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -1040,7 +1040,6 @@ void SfxFilterContainer::ReadSingleFilter_Impl( nFlags , nClipboardId , sType , - (sal_uInt16)nDocumentIconId , sMimeType , sUserData , sServiceName )); @@ -1054,7 +1053,6 @@ void SfxFilterContainer::ReadSingleFilter_Impl( pFilt->nFormatType = nFlags; pFilt->lFormat = nClipboardId; pFilt->aTypeName = sType; - pFilt->nDocIcon = (sal_uInt16)nDocumentIconId; pFilt->aMimeType = sMimeType; pFilt->aUserData = sUserData; pFilt->aServiceName = sServiceName; diff --git a/sfx2/source/bastyp/frmhtml.cxx b/sfx2/source/bastyp/frmhtml.cxx index b63d4e3368c8..99b8e42702b5 100644 --- a/sfx2/source/bastyp/frmhtml.cxx +++ b/sfx2/source/bastyp/frmhtml.cxx @@ -35,7 +35,6 @@ static sal_Char const sHTML_SC_yes[] = "YES"; static sal_Char const sHTML_SC_no[] = "NO"; static sal_Char const sHTML_SC_auto[] = "AUTO"; -#define HTML_O_READONLY "READONLY" #define HTML_O_EDIT "EDIT" static HTMLOptionEnum<ScrollingMode> const aScrollingTable[] = @@ -109,15 +108,7 @@ void SfxFrameHTMLParser::ParseFrameOptions( pFrame->SetResizable( false ); break; default: - if (rOption.GetTokenString().equalsIgnoreAsciiCase(HTML_O_READONLY)) - { - const OUString& aStr = rOption.GetString(); - bool bReadonly = true; - if ( aStr.equalsIgnoreAsciiCase("FALSE") ) - bReadonly = false; - pFrame->SetReadOnly( bReadonly ); - } - else if (rOption.GetTokenString().equalsIgnoreAsciiCase(HTML_O_EDIT)) + if (rOption.GetTokenString().equalsIgnoreAsciiCase(HTML_O_EDIT)) { const OUString& aStr = rOption.GetString(); bool bEdit = true; diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx index 8d8876bc9191..99406c4ef772 100644 --- a/sfx2/source/doc/docfilt.cxx +++ b/sfx2/source/doc/docfilt.cxx @@ -42,8 +42,7 @@ SfxFilter::SfxFilter( const OUString& rProvider, const OUString &rFilterName ) : maProvider(rProvider), nFormatType(SfxFilterFlags::NONE), nVersion(0), - lFormat(SotClipboardFormatId::NONE), - nDocIcon(0) + lFormat(SotClipboardFormatId::NONE) { } @@ -52,7 +51,6 @@ SfxFilter::SfxFilter( const OUString &rName, SfxFilterFlags nType, SotClipboardFormatId lFmt, const OUString &rTypNm, - sal_uInt16 nIcon, const OUString &rMimeType, const OUString &rUsrDat, const OUString &rServiceName ): @@ -65,8 +63,7 @@ SfxFilter::SfxFilter( const OUString &rName, aUIName(maFilterName), nFormatType(nType), nVersion(SOFFICE_FILEFORMAT_50), - lFormat(lFmt), - nDocIcon(nIcon) + lFormat(lFmt) { OUString aExts = GetWildcard().getGlob(); OUString aShort, aLong; diff --git a/sfx2/source/doc/frmdescr.cxx b/sfx2/source/doc/frmdescr.cxx index 5eb4fc22bb88..3bb997755b9e 100644 --- a/sfx2/source/doc/frmdescr.cxx +++ b/sfx2/source/doc/frmdescr.cxx @@ -43,9 +43,7 @@ SfxFrameDescriptor::SfxFrameDescriptor() : eScroll( ScrollingMode::Auto ), bHasBorder( true ), bHasBorderSet( false ), - bResizeHorizontal( true ), bResizeVertical( true ), - bReadOnly( false ), pImpl( new SfxFrameDescriptor_Impl ) { } diff --git a/sfx2/source/notebookbar/NotebookbarTabControl.cxx b/sfx2/source/notebookbar/NotebookbarTabControl.cxx index 3c8f2058e18f..9bf86aa6d505 100644 --- a/sfx2/source/notebookbar/NotebookbarTabControl.cxx +++ b/sfx2/source/notebookbar/NotebookbarTabControl.cxx @@ -136,6 +136,10 @@ NotebookbarTabControl::NotebookbarTabControl( Window* pParent ) { } +NotebookbarTabControl::~NotebookbarTabControl() +{ +} + void NotebookbarTabControl::StateChanged(StateChangedType nStateChange) { if( !m_bInitialized && SfxViewFrame::Current() ) @@ -146,7 +150,7 @@ void NotebookbarTabControl::StateChanged(StateChangedType nStateChange) SetToolBox( static_cast<ToolBox*>( pShortcuts.get() ) ); SetIconClickHdl( LINK( this, NotebookbarTabControl, OpenNotebookbarPopupMenu ) ); - m_pListener = new ChangedUIEventListener( this ); + m_pListener.reset( new ChangedUIEventListener( this ) ); m_bInitialized = true; } diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index cda50d95dab9..927b84412eb7 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -338,10 +338,6 @@ void SfxFrame::GetViewData_Impl() SfxViewFrame* pViewFrame = GetCurrentViewFrame(); if( pViewFrame && pViewFrame->GetViewShell() ) { - const SfxMedium *pMed = GetCurrentDocument()->GetMedium(); - bool bReadOnly = pMed->GetOpenMode() == SFX_STREAM_READONLY; - GetDescriptor()->SetReadOnly( bReadOnly ); - SfxItemSet *pSet = GetDescriptor()->GetArgs(); bool bGetViewData = false; if ( GetController().is() && pSet->GetItemState( SID_VIEW_DATA ) != SfxItemState::SET ) diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index d08517f36a8c..97e44426949f 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -355,7 +355,7 @@ void SAL_CALL IMPL_SfxBaseController_CloseListenerHelper::disposing( const lang: { } -void SAL_CALL IMPL_SfxBaseController_CloseListenerHelper::queryClosing( const lang::EventObject& aEvent, sal_Bool bDeliverOwnership ) +void SAL_CALL IMPL_SfxBaseController_CloseListenerHelper::queryClosing( const lang::EventObject& /*aEvent*/, sal_Bool /*bDeliverOwnership*/ ) { SolarMutexGuard aGuard; SfxViewShell* pShell = m_pController->GetViewShell_Impl(); @@ -364,16 +364,6 @@ void SAL_CALL IMPL_SfxBaseController_CloseListenerHelper::queryClosing( const la bool bCanClose = pShell->PrepareClose( false ); if ( !bCanClose ) { - if ( bDeliverOwnership && ( !pShell->GetWindow() || !pShell->GetWindow()->IsReallyVisible() ) ) - { - // ignore Ownership in case of visible frame (will be closed by user) - Reference < frame::XModel > xModel( aEvent.Source, uno::UNO_QUERY ); - if ( xModel.is() ) - pShell->TakeOwnership_Impl(); - else - pShell->TakeFrameOwnership_Impl(); - } - throw util::CloseVetoException("Controller disagree ...",static_cast< ::cppu::OWeakObject*>(this)); } } @@ -978,7 +968,6 @@ void SAL_CALL SfxBaseController::dispose() if ( pFrame && pFrame->GetViewShell() == m_pData->m_pViewShell ) pFrame->GetFrame().SetIsClosing_Impl(); m_pData->m_pViewShell->DiscardClients_Impl(); - m_pData->m_pViewShell->pImpl->m_bControllerSet = false; if ( pFrame ) { diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx index 2994a218086d..976869ac237e 100644 --- a/sfx2/source/view/viewimp.hxx +++ b/sfx2/source/view/viewimp.hxx @@ -43,13 +43,10 @@ struct SfxViewShell_Impl { ::osl::Mutex aMutex; ::comphelper::OInterfaceContainerHelper2 aInterceptorContainer; - bool m_bControllerSet; SfxShellArr_Impl aArr; Size aMargin; bool m_bHasPrintOptions; bool m_bIsShowView; - bool m_bGotOwnership; - bool m_bGotFrameOwnership; sal_uInt16 m_nFamily; ::rtl::Reference<SfxBaseController> m_pController; std::unique_ptr< ::svt::AcceleratorExecute > m_xAccExec; diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 205c73eb4f5f..dd81339f9783 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -230,11 +230,8 @@ sal_uInt32 SfxViewShell_Impl::m_nLastViewShellId = 0; SfxViewShell_Impl::SfxViewShell_Impl(SfxViewShellFlags const nFlags) : aInterceptorContainer( aMutex ) -, m_bControllerSet(false) , m_bHasPrintOptions(nFlags & SfxViewShellFlags::HAS_PRINTOPTIONS) , m_bIsShowView(!(nFlags & SfxViewShellFlags::NO_SHOW)) -, m_bGotOwnership(false) -, m_bGotFrameOwnership(false) , m_nFamily(0xFFFF) // undefined, default set by TemplateDialog , m_pController(nullptr) , mpIPClientList(nullptr) @@ -1725,7 +1722,6 @@ void SfxViewShell::JumpToMark( const OUString& rMark ) void SfxViewShell::SetController( SfxBaseController* pController ) { pImpl->m_pController = pController; - pImpl->m_bControllerSet = true; // there should be no old listener, but if there is one, it should be disconnected if ( pImpl->xClipboardListener.is() ) @@ -1916,20 +1912,6 @@ bool SfxViewShell::TryContextMenuInterception( Menu& rMenu, const OUString& rMen return true; } -void SfxViewShell::TakeOwnership_Impl() -{ - // currently there is only one reason to take Ownership: a hidden frame is printed - // so the ViewShell will check this on EndPrint (->prnmon.cxx) - pImpl->m_bGotOwnership = true; -} - -void SfxViewShell::TakeFrameOwnership_Impl() -{ - // currently there is only one reason to take Ownership: a hidden frame is printed - // so the ViewShell will check this on EndPrint (->prnmon.cxx) - pImpl->m_bGotFrameOwnership = true; -} - bool SfxViewShell::HandleNotifyEvent_Impl( NotifyEvent& rEvent ) { if (pImpl->m_pController.is()) |