diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-30 14:20:43 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-30 18:53:57 +0200 |
commit | c9dcd0a6197160fdc8bf086ae4d8a78558e7d078 (patch) | |
tree | afaa73dd1d2bfa8353577d78667c5a91bd4f3ae2 /sfx2 | |
parent | 1ad14b32c651b23b2c37d83dbdea889607ea6680 (diff) |
loplugin:returnconstant in sfx2
Change-Id: I9a41a2b53669bebfca573fef8d0d755e4621ce37
Reviewed-on: https://gerrit.libreoffice.org/58333
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/doc/doctemplates.cxx | 18 | ||||
-rw-r--r-- | sfx2/source/doc/objstor.cxx | 14 | ||||
-rw-r--r-- | sfx2/source/doc/sfxbasemodel.cxx | 39 | ||||
-rw-r--r-- | sfx2/source/view/frame.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/view/frame2.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 4 |
7 files changed, 35 insertions, 54 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 4426c889af82..a7ff1009de71 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -638,10 +638,9 @@ SvStream* SfxMedium::GetOutStream() } -bool SfxMedium::CloseOutStream() +void SfxMedium::CloseOutStream() { CloseOutStream_Impl(); - return true; } void SfxMedium::CloseOutStream_Impl() diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 4db2cd02e2fe..fe2cea50168b 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -200,7 +200,7 @@ class SfxDocTplService_Impl bool needsUpdate(); OUString getLongName( const OUString& rShortName ); bool setTitleForURL( const OUString& rURL, const OUString& aTitle ); - bool getTitleFromURL( const OUString& rURL, OUString& aTitle, OUString& aType, bool& bDocHasTitle ); + void getTitleFromURL( const OUString& rURL, OUString& aTitle, OUString& aType, bool& bDocHasTitle ); bool addEntry( Content& rParentFolder, const OUString& rTitle, @@ -641,7 +641,7 @@ bool SfxDocTplService_Impl::setTitleForURL( const OUString& rURL, const OUString } -bool SfxDocTplService_Impl::getTitleFromURL( const OUString& rURL, OUString& aTitle, OUString& aType, bool& bDocHasTitle ) +void SfxDocTplService_Impl::getTitleFromURL( const OUString& rURL, OUString& aTitle, OUString& aType, bool& bDocHasTitle ) { bDocHasTitle = false; @@ -682,8 +682,6 @@ bool SfxDocTplService_Impl::getTitleFromURL( const OUString& rURL, OUString& aTi } else bDocHasTitle = true; - - return true; } @@ -1908,8 +1906,7 @@ bool SfxDocTplService_Impl::addTemplate( const OUString& rGroupName, OUString aTitle, aType; bool bDocHasTitle = false; - if( !getTitleFromURL( rSourceURL, aTitle, aType, bDocHasTitle ) ) - return false; + getTitleFromURL( rSourceURL, aTitle, aType, bDocHasTitle ); INetURLObject aSourceObj( rSourceURL ); if ( rTemplateName == aTitle ) @@ -2365,11 +2362,7 @@ void SfxDocTplService_Impl::addHierGroup( GroupList_Impl& rList, OUString aTmpTitle; bool bDocHasTitle = false; - if( !getTitleFromURL( aTargetDir, aTmpTitle, aType, bDocHasTitle ) ) - { - SAL_WARN( "sfx.doc", "addHierGroup(): template of alien format" ); - continue; - } + getTitleFromURL( aTargetDir, aTmpTitle, aType, bDocHasTitle ); if ( !aType.isEmpty() ) bUpdateType = true; @@ -2461,8 +2454,7 @@ void SfxDocTplService_Impl::addFsysGroup( GroupList_Impl& rList, continue; bool bDocHasTitle = false; - if( !getTitleFromURL( aTargetURL, aChildTitle, aType, bDocHasTitle ) ) - continue; + getTitleFromURL( aTargetURL, aChildTitle, aType, bDocHasTitle ); pGroup->addEntry( aChildTitle, aTargetURL, aType, OUString() ); } diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index d594da1b51fb..26d0de770931 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -164,7 +164,8 @@ void impl_addToModelCollection(const css::uno::Reference< css::frame::XModel >& bool SfxObjectShell::Save() { - return SaveChildren(); + SaveChildren(); + return true; } @@ -1545,7 +1546,7 @@ bool SfxObjectShell::SaveTo_Impl if( bOk && !bCopyTo ) // we also don't touch any graphical replacements here - bOk = SaveChildren( true ); + SaveChildren( true ); } if ( bOk ) @@ -3116,15 +3117,13 @@ uno::Reference< embed::XStorage > const & SfxObjectShell::GetStorage() } -bool SfxObjectShell::SaveChildren( bool bObjectsOnly ) +void SfxObjectShell::SaveChildren( bool bObjectsOnly ) { if ( pImpl->mpObjectContainer ) { bool bOasis = ( SotStorage::GetVersion( GetStorage() ) > SOFFICE_FILEFORMAT_60 ); GetEmbeddedObjectContainer().StoreChildren(bOasis,bObjectsOnly); } - - return true; } bool SfxObjectShell::SaveAsChildren( SfxMedium& rMedium ) @@ -3134,7 +3133,10 @@ bool SfxObjectShell::SaveAsChildren( SfxMedium& rMedium ) return false; if ( xStorage == GetStorage() ) - return SaveChildren(); + { + SaveChildren(); + return true; + } if ( pImpl->mpObjectContainer ) { diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 488a3d7a06c8..e9b12b34621a 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1397,26 +1397,24 @@ Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getPrinter() { SfxModelGuard aGuard( *this ); - if ( impl_getPrintHelper() ) - return m_pData->m_xPrintable->getPrinter(); - else - return Sequence< beans::PropertyValue >(); + impl_getPrintHelper(); + return m_pData->m_xPrintable->getPrinter(); } void SAL_CALL SfxBaseModel::setPrinter(const Sequence< beans::PropertyValue >& rPrinter) { SfxModelGuard aGuard( *this ); - if ( impl_getPrintHelper() ) - m_pData->m_xPrintable->setPrinter( rPrinter ); + impl_getPrintHelper(); + m_pData->m_xPrintable->setPrinter( rPrinter ); } void SAL_CALL SfxBaseModel::print(const Sequence< beans::PropertyValue >& rOptions) { SfxModelGuard aGuard( *this ); - if ( impl_getPrintHelper() ) - m_pData->m_xPrintable->print( rOptions ); + impl_getPrintHelper(); + m_pData->m_xPrintable->print( rOptions ); } @@ -3193,24 +3191,20 @@ void SAL_CALL SfxBaseModel::addPrintJobListener( const Reference< view::XPrintJo { SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); - if ( impl_getPrintHelper() ) - { - Reference < view::XPrintJobBroadcaster > xPJB( m_pData->m_xPrintable, UNO_QUERY ); - if ( xPJB.is() ) - xPJB->addPrintJobListener( xListener ); - } + impl_getPrintHelper(); + Reference < view::XPrintJobBroadcaster > xPJB( m_pData->m_xPrintable, UNO_QUERY ); + if ( xPJB.is() ) + xPJB->addPrintJobListener( xListener ); } void SAL_CALL SfxBaseModel::removePrintJobListener( const Reference< view::XPrintJobListener >& xListener ) { SfxModelGuard aGuard( *this ); - if ( impl_getPrintHelper() ) - { - Reference < view::XPrintJobBroadcaster > xPJB( m_pData->m_xPrintable, UNO_QUERY ); - if ( xPJB.is() ) - xPJB->removePrintJobListener( xListener ); - } + impl_getPrintHelper(); + Reference < view::XPrintJobBroadcaster > xPJB( m_pData->m_xPrintable, UNO_QUERY ); + if ( xPJB.is() ) + xPJB->removePrintJobListener( xListener ); } sal_Int64 SAL_CALL SfxBaseModel::getSomething( const Sequence< sal_Int8 >& aIdentifier ) @@ -3725,10 +3719,10 @@ void SAL_CALL SfxBaseModel::removeStorageChangeListener( cppu::UnoType<document::XStorageChangeListener>::get(), xListener ); } -bool SfxBaseModel::impl_getPrintHelper() +void SfxBaseModel::impl_getPrintHelper() { if ( m_pData->m_xPrintable.is() ) - return true; + return; m_pData->m_xPrintable = new SfxPrintHelper(); Reference < lang::XInitialization > xInit( m_pData->m_xPrintable, UNO_QUERY ); Sequence < Any > aValues(1); @@ -3736,7 +3730,6 @@ bool SfxBaseModel::impl_getPrintHelper() xInit->initialize( aValues ); Reference < view::XPrintJobBroadcaster > xBrd( m_pData->m_xPrintable, UNO_QUERY ); xBrd->addPrintJobListener( new SfxPrintHelperListener_Impl( m_pData.get() ) ); - return true; } diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index 82591b21c8fa..8ae28d2e291b 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -127,7 +127,7 @@ bool SfxFrame::DoClose() xFrame->dispose(); } else - bRet = DoClose_Impl(); + DoClose_Impl(); } catch( css::util::CloseVetoException& ) { @@ -142,7 +142,7 @@ bool SfxFrame::DoClose() return bRet; } -bool SfxFrame::DoClose_Impl() +void SfxFrame::DoClose_Impl() { SfxBindings* pBindings = nullptr; if ( pImpl->pCurrentViewFrame ) @@ -158,9 +158,7 @@ bool SfxFrame::DoClose_Impl() if ( pImpl->bOwnsBindings ) DELETEZ( pBindings ); - bool bRet = Close(); - DBG_ASSERT( bRet, "Impossible state: frame closes, but controller refuses!"); - return bRet; + Close(); } bool SfxFrame::DocIsModified_Impl() diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx index 6fc3cff26a7d..0f6c1af16799 100644 --- a/sfx2/source/view/frame2.cxx +++ b/sfx2/source/view/frame2.cxx @@ -343,10 +343,9 @@ SystemWindow* SfxFrame::GetTopWindow_Impl() const } -bool SfxFrame::Close() +void SfxFrame::Close() { delete this; - return true; } void SfxFrame::LockResize_Impl( bool bLock ) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index d369cf65c4b6..24f25b86f663 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1089,7 +1089,7 @@ void SfxViewFrame::ReleaseObjectShell_Impl() GetDispatcher()->SetDisableFlags( SfxDisableFlags::NONE ); } -bool SfxViewFrame::Close() +void SfxViewFrame::Close() { DBG_ASSERT( GetFrame().IsClosing_Impl() || !GetFrame().GetFrameInterface().is(), "ViewFrame closed too early!" ); @@ -1107,8 +1107,6 @@ bool SfxViewFrame::Close() // manner, thus it is better to let the dispatcher be. GetDispatcher()->Lock(true); delete this; - - return true; } void SfxViewFrame::DoActivate( bool bUI ) |