summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-08-30 13:31:41 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-08-30 19:26:41 +0100
commit606232e450888b12e24da9c3e56c91333a1bb6d3 (patch)
treebc658d4d70f0469e366b95b30909f641c0096929
parent29730225f2e1dcc0a2e0a63f1eebbc442055fecb (diff)
rework for coverity#1371269 Missing move assignment operator
Change-Id: I10f9ed448854b4ece61fd84b8aa49674d0828cac
-rw-r--r--sw/source/ui/misc/outline.cxx2
-rw-r--r--sw/source/uibase/config/uinums.cxx30
-rw-r--r--sw/source/uibase/inc/uinums.hxx5
3 files changed, 17 insertions, 20 deletions
diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx
index 4bc1439f9680..c1da74163f2f 100644
--- a/sw/source/ui/misc/outline.cxx
+++ b/sw/source/ui/misc/outline.cxx
@@ -305,7 +305,7 @@ IMPL_LINK_TYPED( SwOutlineTabDialog, MenuSelectHdl, Menu *, pMenu, bool )
const SwNumRulesWithName *pRules = pChapterNumRules->GetRules( nLevelNo );
if( pRules )
{
- pRules->MakeNumRule( rWrtSh, *pNumRule );
+ *pNumRule = pRules->MakeNumRule(rWrtSh);
pNumRule->SetRuleType( OUTLINE_RULE );
}
else
diff --git a/sw/source/uibase/config/uinums.cxx b/sw/source/uibase/config/uinums.cxx
index ede3be4d7a6e..a3943a968111 100644
--- a/sw/source/uibase/config/uinums.cxx
+++ b/sw/source/uibase/config/uinums.cxx
@@ -159,21 +159,19 @@ SwNumRulesWithName& SwNumRulesWithName::operator=(const SwNumRulesWithName &rCop
return *this;
}
-void SwNumRulesWithName::MakeNumRule( SwWrtShell& rSh, SwNumRule& rChg ) const
+SwNumRule SwNumRulesWithName::MakeNumRule(SwWrtShell& rSh) const
{
// #i89178#
- rChg = SwNumRule( maName, numfunc::GetDefaultPositionAndSpaceMode() );
- rChg.SetAutoRule( false );
- for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
+ SwNumRule aChg(maName, numfunc::GetDefaultPositionAndSpaceMode());
+ aChg.SetAutoRule( false );
+ for (sal_uInt16 n = 0; n < MAXLEVEL; ++n)
{
SwNumFormatGlobal* pFormat = aFormats[ n ];
- if( nullptr != pFormat)
- {
- SwNumFormat aNew;
- pFormat->ChgNumFormat( rSh, aNew );
- rChg.Set( n, aNew );
- }
+ if (!pFormat)
+ continue;
+ aChg.Set(n, pFormat->MakeNumFormat(rSh));
}
+ return aChg;
}
void SwNumRulesWithName::GetNumFormat(
@@ -236,8 +234,7 @@ SwNumRulesWithName::SwNumFormatGlobal::~SwNumFormatGlobal()
{
}
-void SwNumRulesWithName::SwNumFormatGlobal::ChgNumFormat( SwWrtShell& rSh,
- SwNumFormat& rNew ) const
+SwNumFormat SwNumRulesWithName::SwNumFormatGlobal::MakeNumFormat(SwWrtShell& rSh) const
{
SwCharFormat* pFormat = nullptr;
if( !sCharFormatName.isEmpty() )
@@ -272,10 +269,11 @@ void SwNumRulesWithName::SwNumFormatGlobal::ChgNumFormat( SwWrtShell& rSh,
}
}
}
- const_cast<SwNumFormat&>(aFormat).SetCharFormat( pFormat );
- rNew = aFormat;
- if( pFormat )
- const_cast<SwNumFormat&>(aFormat).SetCharFormat( nullptr );
+ const_cast<SwNumFormat&>(aFormat).SetCharFormat(pFormat);
+ SwNumFormat aNew = aFormat;
+ if (pFormat)
+ const_cast<SwNumFormat&>(aFormat).SetCharFormat(nullptr);
+ return aNew;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/inc/uinums.hxx b/sw/source/uibase/inc/uinums.hxx
index 27a168276aa0..332957966d49 100644
--- a/sw/source/uibase/inc/uinums.hxx
+++ b/sw/source/uibase/inc/uinums.hxx
@@ -53,7 +53,7 @@ class SW_DLLPUBLIC SwNumRulesWithName
SwNumFormatGlobal( const SwNumFormatGlobal& );
~SwNumFormatGlobal();
- void ChgNumFormat( SwWrtShell& rSh, SwNumFormat& rChg ) const;
+ SwNumFormat MakeNumFormat(SwWrtShell& rSh) const;
};
SwNumFormatGlobal* aFormats[ MAXLEVEL ];
@@ -73,8 +73,7 @@ public:
SwNumRulesWithName &operator=(const SwNumRulesWithName &);
const OUString& GetName() const { return maName; }
- void MakeNumRule( SwWrtShell& rSh, SwNumRule& rChg ) const;
-
+ SwNumRule MakeNumRule(SwWrtShell& rSh) const;
void GetNumFormat(size_t, SwNumFormat const*&, OUString const*&) const;
};