diff options
author | Jan Holesovsky <kendy@collabora.com> | 2018-01-17 12:06:34 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-03-22 16:18:50 +0100 |
commit | adabda5056d99a1efade39a47bceafa9a467d149 (patch) | |
tree | c5afe888e741c3393cdad2e2b3218e90152f2d24 | |
parent | f72cd9bd5a51afd531de914bf81ab041b2cb92b7 (diff) |
sw: Cleanup various unused return values.
Reviewed-on: https://gerrit.libreoffice.org/48042
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
(cherry picked from commit 2bd262305cae9b4268c8fb50993119f1bcd7de14)
Change-Id: Ic0e0c6cfd4b6d79f7c3807ac4300f30343269dea
-rw-r--r-- | sw/inc/docsh.hxx | 15 | ||||
-rw-r--r-- | sw/source/uibase/app/docst.cxx | 94 | ||||
-rw-r--r-- | sw/source/uibase/shells/basesh.cxx | 3 |
3 files changed, 38 insertions, 74 deletions
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index 6829837d91cf..9ab55372c184 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -119,7 +119,7 @@ class SW_DLLPUBLIC SwDocShell /// @param nSlot /// Only used for nFamily == SfxStyleFamily::Page. Identifies optional Slot by which the edit is triggered. /// Used to activate certain dialog pane - SAL_DLLPRIVATE sal_uInt16 Edit( + SAL_DLLPRIVATE void Edit( const OUString &rName, const OUString& rParent, const SfxStyleFamily nFamily, @@ -127,17 +127,17 @@ class SW_DLLPUBLIC SwDocShell const bool bNew, const OString& sPageId, SwWrtShell* pActShell = nullptr, - const bool bBasic = false ); + SfxRequest* pRequest = nullptr); - SAL_DLLPRIVATE bool Delete(const OUString &rName, SfxStyleFamily nFamily); - SAL_DLLPRIVATE bool Hide(const OUString &rName, SfxStyleFamily nFamily, bool bHidden); + SAL_DLLPRIVATE void Delete(const OUString &rName, SfxStyleFamily nFamily); + SAL_DLLPRIVATE void Hide(const OUString &rName, SfxStyleFamily nFamily, bool bHidden); SAL_DLLPRIVATE SfxStyleFamily ApplyStyles(const OUString &rName, const SfxStyleFamily nFamily, SwWrtShell* pShell, sal_uInt16 nMode = 0); SAL_DLLPRIVATE SfxStyleFamily DoWaterCan( const OUString &rName, SfxStyleFamily nFamily); - SAL_DLLPRIVATE SfxStyleFamily UpdateStyle(const OUString &rName, SfxStyleFamily nFamily, SwWrtShell* pShell); - SAL_DLLPRIVATE SfxStyleFamily MakeByExample(const OUString &rName, + SAL_DLLPRIVATE void UpdateStyle(const OUString &rName, SfxStyleFamily nFamily, SwWrtShell* pShell); + SAL_DLLPRIVATE void MakeByExample(const OUString &rName, SfxStyleFamily nFamily, sal_uInt16 nMask, SwWrtShell* pShell); SAL_DLLPRIVATE void SubInitNew(); ///< for InitNew and HtmlSourceMode. @@ -257,7 +257,8 @@ public: void FormatPage( const OUString& rPage, const OString& rPageId, - SwWrtShell& rActShell ); + SwWrtShell& rActShell, + SfxRequest* pRequest = nullptr); // #i59688# /** linked graphics are now loaded on demand. diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index b17e936dd02e..bfbe6438110c 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -93,7 +93,7 @@ void SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh) { SfxWhichIter aIter(rSet); sal_uInt16 nWhich = aIter.FirstWhich(); - SfxStyleFamily nActualFamily = (SfxStyleFamily)USHRT_MAX; + SfxStyleFamily nActualFamily = SfxStyleFamily(USHRT_MAX); SwWrtShell* pShell = pSh ? pSh : GetWrtShell(); if(!pShell) @@ -242,7 +242,7 @@ void SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh) { SwEditWin& rEdtWin = pShell->GetView().GetEditWin(); SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate(); - rSet.Put(SfxBoolItem(nWhich, pApply && pApply->eType != (SfxStyleFamily)0)); + rSet.Put(SfxBoolItem(nWhich, pApply && pApply->eType != SfxStyleFamily(0))); } break; case SID_STYLE_UPDATE_BY_EXAMPLE: @@ -304,7 +304,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) if( pArgs && SfxItemState::SET == pArgs->GetItemState( SID_STYLE_FAMILY, false, &pItem )) { - const SfxStyleFamily nFamily = (SfxStyleFamily) static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + const SfxStyleFamily nFamily = static_cast<SfxStyleFamily>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); OUString sName; sal_uInt16 nMask = 0; @@ -322,7 +322,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) if (sName.isEmpty() && m_xBasePool.get()) sName = SfxStyleDialog::GenerateUnusedName(*m_xBasePool); - Edit(sName, sParent, nFamily, nMask, true, OString(), nullptr, rReq.IsAPI()); + Edit(sName, sParent, nFamily, nMask, true, OString(), nullptr, &rReq); // Update Watermark if new page style was created if( nFamily == SfxStyleFamily::Page ) @@ -422,7 +422,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) if( SfxItemState::SET == pArgs->GetItemState(SID_STYLE_FAMILY, false, &pItem )) - nFamily = (SfxStyleFamily) static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + nFamily = static_cast<SfxStyleFamily>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); if( SfxItemState::SET == pArgs->GetItemState(SID_STYLE_FAMILYNAME, false, &pItem )) { @@ -514,18 +514,18 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) break; case SID_STYLE_APPLY: // Shell-switch in ApplyStyles - nRet = (sal_uInt16) ApplyStyles(aParam, nFamily, pActShell, rReq.GetModifier() ); + nRet = static_cast<sal_uInt16>(ApplyStyles(aParam, nFamily, pActShell, rReq.GetModifier() )); bReturns = true; break; case SID_STYLE_WATERCAN: - nRet = (sal_uInt16) DoWaterCan(aParam, nFamily); + nRet = static_cast<sal_uInt16>(DoWaterCan(aParam, nFamily)); bReturns = true; break; case SID_STYLE_UPDATE_BY_EXAMPLE: - nRet = static_cast<sal_uInt16>(UpdateStyle(aParam, nFamily, pActShell)); + UpdateStyle(aParam, nFamily, pActShell); break; case SID_STYLE_NEW_BY_EXAMPLE: - nRet = static_cast<sal_uInt16>(MakeByExample(aParam, nFamily, nMask, pActShell )); + MakeByExample(aParam, nFamily, nMask, pActShell); break; default: @@ -551,15 +551,13 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) class ApplyStyle { public: - ApplyStyle(SwDocShell &rDocSh, bool bNew, SfxStyleSheetBase* pStyle, - sal_uInt16 nRet, rtl::Reference< SwDocStyleSheet > const & xTmp, + ApplyStyle(SwDocShell &rDocSh, bool bNew, + rtl::Reference< SwDocStyleSheet > const & xTmp, SfxStyleFamily nFamily, SfxAbstractApplyTabDialog *pDlg, rtl::Reference< SfxStyleSheetBasePool > const & xBasePool, bool bModified) : m_rDocSh(rDocSh) , m_bNew(bNew) - , m_pStyle(pStyle) - , m_nRet(nRet) , m_xTmp(xTmp) , m_nFamily(nFamily) , m_pDlg(pDlg) @@ -572,12 +570,9 @@ public: { ApplyHdl(nullptr); } - sal_uInt16 getRet() const { return m_nRet; } private: SwDocShell &m_rDocSh; bool m_bNew; - SfxStyleSheetBase* m_pStyle; - sal_uInt16 m_nRet; rtl::Reference< SwDocStyleSheet > m_xTmp; SfxStyleFamily m_nFamily; VclPtr<SfxAbstractApplyTabDialog> m_pDlg; @@ -593,16 +588,6 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl, LinkParamNone*, void) pWrtShell->StartAllAction(); - // newly set the mask only with paragraph-templates - if( m_bNew ) - { - m_nRet = SfxStyleFamily::Para == m_pStyle->GetFamily() - ? m_xTmp->GetMask() - : SFXSTYLEBIT_USERDEF; - } - else if( m_pStyle->GetMask() != m_xTmp->GetMask() ) - m_nRet = m_xTmp->GetMask(); - if( SfxStyleFamily::Para == m_nFamily ) { SfxItemSet aSet( *m_pDlg->GetOutputItemSet() ); @@ -664,7 +649,7 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl, LinkParamNone*, void) pWrtShell->EndAllAction(); } -sal_uInt16 SwDocShell::Edit( +void SwDocShell::Edit( const OUString &rName, const OUString &rParent, const SfxStyleFamily nFamily, @@ -672,12 +657,12 @@ sal_uInt16 SwDocShell::Edit( const bool bNew, const OString& sPage, SwWrtShell* pActShell, - const bool bBasic ) + SfxRequest* pRequest) { assert( GetWrtShell() ); + const bool bBasic = pRequest && pRequest->IsAPI(); SfxStyleSheetBase *pStyle = nullptr; - sal_uInt16 nRet = nMask; bool bModified = m_xDoc->getIDocumentState().IsModified(); SwUndoId nNewStyleUndoId(SwUndoId::EMPTY); @@ -696,7 +681,7 @@ sal_uInt16 SwDocShell::Edit( else nMask = SFXSTYLEBIT_USERDEF; - pStyle = &m_xBasePool->Make( rName, (SfxStyleFamily)nFamily, nMask ); + pStyle = &m_xBasePool->Make( rName, nFamily, nMask ); // set the current one as Parent SwDocStyleSheet* pDStyle = static_cast<SwDocStyleSheet*>(pStyle); @@ -788,12 +773,12 @@ sal_uInt16 SwDocShell::Edit( } else { - pStyle = m_xBasePool->Find( rName, (SfxStyleFamily)nFamily ); + pStyle = m_xBasePool->Find( rName, nFamily ); SAL_WARN_IF( !pStyle, "sw.ui", "Style not found" ); } if(!pStyle) - return 0; + return; // put dialogues together rtl::Reference< SwDocStyleSheet > xTmp( new SwDocStyleSheet( *static_cast<SwDocStyleSheet*>(pStyle) ) ); @@ -845,7 +830,7 @@ sal_uInt16 SwDocShell::Edit( *(xTmp.get()), nFamily, sPage, pActShell ? pActShell : m_pWrtShell, bNew)); assert( pDlg ); - ApplyStyle aApplyStyleHelper(*this, bNew, pStyle, nRet, xTmp, nFamily, pDlg.get(), m_xBasePool, bModified); + ApplyStyle aApplyStyleHelper(*this, bNew, xTmp, nFamily, pDlg.get(), m_xBasePool, bModified); pDlg->SetApplyHdl(LINK(&aApplyStyleHelper, ApplyStyle, ApplyHdl)); short nDlgRet = pDlg->Execute(); @@ -875,8 +860,6 @@ sal_uInt16 SwDocShell::Edit( if( !bModified ) m_xDoc->getIDocumentState().ResetModified(); } - - nRet = aApplyStyleHelper.getRet(); } else { @@ -885,16 +868,6 @@ sal_uInt16 SwDocShell::Edit( GetWrtShell()->StartAllAction(); - // newly set the mask only with paragraph-templates - if( bNew ) - { - nRet = SfxStyleFamily::Para == pStyle->GetFamily() - ? xTmp->GetMask() - : SFXSTYLEBIT_USERDEF; - } - else if( pStyle->GetMask() != xTmp->GetMask() ) - nRet = xTmp->GetMask(); - if( SfxStyleFamily::Para == nFamily ) ::SfxToSwPageDescAttr( *GetWrtShell(), xTmp->GetItemSet() ); else @@ -914,11 +887,9 @@ sal_uInt16 SwDocShell::Edit( } GetWrtShell()->EndAllAction(); } - - return nRet; } -bool SwDocShell::Delete(const OUString &rName, SfxStyleFamily nFamily) +void SwDocShell::Delete(const OUString &rName, SfxStyleFamily nFamily) { SfxStyleSheetBase *pStyle = m_xBasePool->Find(rName, nFamily); @@ -929,13 +900,10 @@ bool SwDocShell::Delete(const OUString &rName, SfxStyleFamily nFamily) GetWrtShell()->StartAllAction(); m_xBasePool->Remove(pStyle); GetWrtShell()->EndAllAction(); - - return true; } - return false; } -bool SwDocShell::Hide(const OUString &rName, SfxStyleFamily nFamily, bool bHidden) +void SwDocShell::Hide(const OUString &rName, SfxStyleFamily nFamily, bool bHidden) { SfxStyleSheetBase *pStyle = m_xBasePool->Find(rName, nFamily); @@ -947,10 +915,7 @@ bool SwDocShell::Hide(const OUString &rName, SfxStyleFamily nFamily, bool bHidde rtl::Reference< SwDocStyleSheet > xTmp( new SwDocStyleSheet( *static_cast<SwDocStyleSheet*>(pStyle) ) ); xTmp->SetHidden( bHidden ); GetWrtShell()->EndAllAction(); - - return true; } - return false; } // apply template @@ -1027,7 +992,7 @@ SfxStyleFamily SwDocShell::DoWaterCan(const OUString &rName, SfxStyleFamily nFam SwEditWin& rEdtWin = m_pView->GetEditWin(); SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate(); - bool bWaterCan = !(pApply && pApply->eType != (SfxStyleFamily)0); + bool bWaterCan = !(pApply && pApply->eType != SfxStyleFamily(0)); if( rName.isEmpty() ) bWaterCan = false; @@ -1067,7 +1032,7 @@ SfxStyleFamily SwDocShell::DoWaterCan(const OUString &rName, SfxStyleFamily nFam } } else - aTemplate.eType = (SfxStyleFamily)0; + aTemplate.eType = SfxStyleFamily(0); m_pView->GetEditWin().SetApplyTemplate(aTemplate); @@ -1075,7 +1040,7 @@ SfxStyleFamily SwDocShell::DoWaterCan(const OUString &rName, SfxStyleFamily nFam } // update template -SfxStyleFamily SwDocShell::UpdateStyle(const OUString &rName, SfxStyleFamily nFamily, SwWrtShell* pShell) +void SwDocShell::UpdateStyle(const OUString &rName, SfxStyleFamily nFamily, SwWrtShell* pShell) { SwWrtShell* pCurrWrtShell = pShell ? pShell : GetWrtShell(); assert( pCurrWrtShell ); @@ -1083,8 +1048,8 @@ SfxStyleFamily SwDocShell::UpdateStyle(const OUString &rName, SfxStyleFamily nFa SwDocStyleSheet* pStyle = static_cast<SwDocStyleSheet*>( m_xBasePool->Find(rName, nFamily) ); - if(!pStyle) - return nFamily; + if (!pStyle) + return; switch(nFamily) { @@ -1170,11 +1135,10 @@ SfxStyleFamily SwDocShell::UpdateStyle(const OUString &rName, SfxStyleFamily nFa break; default: break; } - return nFamily; } // NewByExample -SfxStyleFamily SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily nFamily, +void SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily nFamily, sal_uInt16 nMask, SwWrtShell* pShell ) { SwWrtShell* pCurrWrtShell = pShell ? pShell : GetWrtShell(); @@ -1334,7 +1298,6 @@ SfxStyleFamily SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily default: break; } - return nFamily; } std::set<Color> SwDocShell::GetDocColors() @@ -1401,9 +1364,10 @@ void SwDocShell::LoadStyles_( SfxObjectShell& rSource, bool bPreserveCurrentDocu void SwDocShell::FormatPage( const OUString& rPage, const OString& rPageId, - SwWrtShell& rActShell ) + SwWrtShell& rActShell, + SfxRequest* pRequest) { - Edit( rPage, aEmptyOUStr, SfxStyleFamily::Page, 0, false, rPageId, &rActShell); + Edit(rPage, aEmptyOUStr, SfxStyleFamily::Page, 0, false, rPageId, &rActShell, pRequest); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index b938767159bb..a8e7ff358020 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -2448,8 +2448,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) break; } - rTempView.GetDocShell()->FormatPage( - rPageDesc.GetName(), sPageId, rSh); + rTempView.GetDocShell()->FormatPage(rPageDesc.GetName(), sPageId, rSh, &rReq); rTempView.InvalidateRulerPos(); } } |