summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2018-01-17 12:06:34 +0100
committerpranavk <pranavk@collabora.co.uk>2018-01-18 13:55:15 +0100
commitbf1e0f8ee19e1f0a499d8a85ffaf552ccd419811 (patch)
treee94ad9d70e39cbec5e86df226635bc6435f8e638 /sw
parentc58145ff3a814df6702f805eb75bbc31be888c51 (diff)
sw: Cleanup various unused return values.
Change-Id: Ic0e0c6cfd4b6d79f7c3807ac4300f30343269dea Reviewed-on: https://gerrit.libreoffice.org/48115 Reviewed-by: pranavk <pranavk@collabora.co.uk> Tested-by: pranavk <pranavk@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/docsh.hxx15
-rw-r--r--sw/source/uibase/app/docst.cxx70
-rw-r--r--sw/source/uibase/shells/basesh.cxx3
3 files changed, 26 insertions, 62 deletions
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index 879c367631b5..aed3fa37dc27 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -118,7 +118,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,
@@ -126,17 +126,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 68e49790f662..58e8c59130ef 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -319,7 +319,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 )
@@ -548,15 +548,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)
@@ -569,12 +567,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;
@@ -590,16 +585,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() );
@@ -662,7 +647,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,
@@ -670,12 +655,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_pDoc->getIDocumentState().IsModified();
SwUndoId nNewStyleUndoId(UNDO_EMPTY);
@@ -791,7 +776,7 @@ sal_uInt16 SwDocShell::Edit(
}
if(!pStyle)
- return 0;
+ return;
// put dialogues together
rtl::Reference< SwDocStyleSheet > xTmp( new SwDocStyleSheet( *static_cast<SwDocStyleSheet*>(pStyle) ) );
@@ -843,7 +828,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();
@@ -873,8 +858,6 @@ sal_uInt16 SwDocShell::Edit(
if( !bModified )
m_pDoc->getIDocumentState().ResetModified();
}
-
- nRet = aApplyStyleHelper.getRet();
}
else
{
@@ -883,16 +866,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
@@ -912,11 +885,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);
@@ -927,13 +898,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);
@@ -945,10 +913,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
@@ -1073,7 +1038,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 );
@@ -1081,8 +1046,8 @@ SfxStyleFamily SwDocShell::UpdateStyle(const OUString &rName, SfxStyleFamily nFa
SwDocStyleSheet* pStyle =
static_cast<SwDocStyleSheet*>( m_xBasePool->Find(rName, (SfxStyleFamily)nFamily) );
- if(!pStyle)
- return nFamily;
+ if (!pStyle)
+ return;
switch(nFamily)
{
@@ -1168,11 +1133,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();
@@ -1332,7 +1296,6 @@ SfxStyleFamily SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily
default: break;
}
- return nFamily;
}
std::set<Color> SwDocShell::GetDocColors()
@@ -1399,9 +1362,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 9da444b3d081..746450ba2484 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -2450,8 +2450,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq)
break;
}
- rTempView.GetDocShell()->FormatPage(
- rPageDesc.GetName(), sPageId, rSh);
+ rTempView.GetDocShell()->FormatPage(rPageDesc.GetName(), sPageId, rSh, &rReq);
rTempView.InvalidateRulerPos();
}
}