summaryrefslogtreecommitdiff
path: root/sw/source/core/edit/edtox.cxx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-11-24 21:55:10 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-11-25 09:13:12 +0100
commitf2cd9c0c789b5825b4d5bb84b352d089e231e527 (patch)
tree95f6ecfaf25231ee4de3320995263780cd655792 /sw/source/core/edit/edtox.cxx
parente1cbd518118a5f2889213e5725e0e0a3c133de5d (diff)
tdf#120703 PVS: V560 A part of conditional expression is always true/false
Change-Id: If173f42302553b164267909a0a3156bb25a6d558 Reviewed-on: https://gerrit.libreoffice.org/63957 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/source/core/edit/edtox.cxx')
-rw-r--r--sw/source/core/edit/edtox.cxx17
1 files changed, 8 insertions, 9 deletions
diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx
index 80526cc81b5f..2495fc8de524 100644
--- a/sw/source/core/edit/edtox.cxx
+++ b/sw/source/core/edit/edtox.cxx
@@ -154,17 +154,16 @@ void SwEditShell::InsertTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet )
}
/// update tables of content
-void SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet )
+void SwEditShell::UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet)
{
- OSL_ENSURE( dynamic_cast<const SwTOXBaseSection*>( &rTOX) != nullptr, "no TOXBaseSection!" );
- SwTOXBaseSection* pTOX = const_cast<SwTOXBaseSection*>(static_cast<const SwTOXBaseSection*>(&rTOX));
- OSL_ENSURE(pTOX, "no current listing");
- if( pTOX && nullptr != pTOX->GetFormat()->GetSectionNode() )
+ assert(dynamic_cast<const SwTOXBaseSection*>(&rTOX) && "no TOXBaseSection!");
+ SwTOXBaseSection& rTOXSect = static_cast<SwTOXBaseSection&>(const_cast<SwTOXBase&>(rTOX));
+ if (rTOXSect.GetFormat()->GetSectionNode())
{
SwDoc* pMyDoc = GetDoc();
SwDocShell* pDocSh = pMyDoc->GetDocShell();
- bool bInIndex = pTOX == GetCurTOX();
+ bool bInIndex = &rTOX == GetCurTOX();
SET_CURR_SHELL( this );
StartAllAction();
@@ -174,17 +173,17 @@ void SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet )
pMyDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::TOXCHANGE, nullptr);
// create listing stub
- pTOX->Update(pSet);
+ rTOXSect.Update(pSet);
// correct Cursor
if( bInIndex )
- pTOX->SetPosAtStartEnd( *GetCursor()->GetPoint() );
+ rTOXSect.SetPosAtStartEnd(*GetCursor()->GetPoint());
// start formatting
CalcLayout();
// insert page numbering
- pTOX->UpdatePageNum();
+ rTOXSect.UpdatePageNum();
pMyDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::TOXCHANGE, nullptr);