rework for coverity#1371269 Missing move assignment operator

Change-Id: I10f9ed448854b4ece61fd84b8aa49674d0828cac
This commit is contained in:
Caolán McNamara
2016-08-30 13:31:41 +01:00
parent 29730225f2
commit 606232e450
3 changed files with 17 additions and 20 deletions

View File

@@ -305,7 +305,7 @@ IMPL_LINK_TYPED( SwOutlineTabDialog, MenuSelectHdl, Menu *, pMenu, bool )
const SwNumRulesWithName *pRules = pChapterNumRules->GetRules( nLevelNo ); const SwNumRulesWithName *pRules = pChapterNumRules->GetRules( nLevelNo );
if( pRules ) if( pRules )
{ {
pRules->MakeNumRule( rWrtSh, *pNumRule ); *pNumRule = pRules->MakeNumRule(rWrtSh);
pNumRule->SetRuleType( OUTLINE_RULE ); pNumRule->SetRuleType( OUTLINE_RULE );
} }
else else

View File

@@ -159,21 +159,19 @@ SwNumRulesWithName& SwNumRulesWithName::operator=(const SwNumRulesWithName &rCop
return *this; return *this;
} }
void SwNumRulesWithName::MakeNumRule( SwWrtShell& rSh, SwNumRule& rChg ) const SwNumRule SwNumRulesWithName::MakeNumRule(SwWrtShell& rSh) const
{ {
// #i89178# // #i89178#
rChg = SwNumRule( maName, numfunc::GetDefaultPositionAndSpaceMode() ); SwNumRule aChg(maName, numfunc::GetDefaultPositionAndSpaceMode());
rChg.SetAutoRule( false ); aChg.SetAutoRule( false );
for( sal_uInt16 n = 0; n < MAXLEVEL; ++n ) for (sal_uInt16 n = 0; n < MAXLEVEL; ++n)
{ {
SwNumFormatGlobal* pFormat = aFormats[ n ]; SwNumFormatGlobal* pFormat = aFormats[ n ];
if( nullptr != pFormat) if (!pFormat)
{ continue;
SwNumFormat aNew; aChg.Set(n, pFormat->MakeNumFormat(rSh));
pFormat->ChgNumFormat( rSh, aNew );
rChg.Set( n, aNew );
}
} }
return aChg;
} }
void SwNumRulesWithName::GetNumFormat( void SwNumRulesWithName::GetNumFormat(
@@ -236,8 +234,7 @@ SwNumRulesWithName::SwNumFormatGlobal::~SwNumFormatGlobal()
{ {
} }
void SwNumRulesWithName::SwNumFormatGlobal::ChgNumFormat( SwWrtShell& rSh, SwNumFormat SwNumRulesWithName::SwNumFormatGlobal::MakeNumFormat(SwWrtShell& rSh) const
SwNumFormat& rNew ) const
{ {
SwCharFormat* pFormat = nullptr; SwCharFormat* pFormat = nullptr;
if( !sCharFormatName.isEmpty() ) if( !sCharFormatName.isEmpty() )
@@ -272,10 +269,11 @@ void SwNumRulesWithName::SwNumFormatGlobal::ChgNumFormat( SwWrtShell& rSh,
} }
} }
} }
const_cast<SwNumFormat&>(aFormat).SetCharFormat( pFormat ); const_cast<SwNumFormat&>(aFormat).SetCharFormat(pFormat);
rNew = aFormat; SwNumFormat aNew = aFormat;
if( pFormat ) if (pFormat)
const_cast<SwNumFormat&>(aFormat).SetCharFormat( nullptr ); const_cast<SwNumFormat&>(aFormat).SetCharFormat(nullptr);
return aNew;
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -53,7 +53,7 @@ class SW_DLLPUBLIC SwNumRulesWithName
SwNumFormatGlobal( const SwNumFormatGlobal& ); SwNumFormatGlobal( const SwNumFormatGlobal& );
~SwNumFormatGlobal(); ~SwNumFormatGlobal();
void ChgNumFormat( SwWrtShell& rSh, SwNumFormat& rChg ) const; SwNumFormat MakeNumFormat(SwWrtShell& rSh) const;
}; };
SwNumFormatGlobal* aFormats[ MAXLEVEL ]; SwNumFormatGlobal* aFormats[ MAXLEVEL ];
@@ -73,8 +73,7 @@ public:
SwNumRulesWithName &operator=(const SwNumRulesWithName &); SwNumRulesWithName &operator=(const SwNumRulesWithName &);
const OUString& GetName() const { return maName; } 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; void GetNumFormat(size_t, SwNumFormat const*&, OUString const*&) const;
}; };