summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-10-06 10:50:12 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-10-06 15:10:51 +0100
commit31ee230b6efac9a6a60ceb5c2367ae9a5cf98929 (patch)
treec7ff6f56f5295caa88bda7ceb2036691e3db5c36 /sc
parent5a242f651c8ae8d53ac67f5059f64629303848ab (diff)
Related: tdf#94814 some cleanup of static_cast following dynamic_cast
to the same type Change-Id: I197e88acbc30f8e8bb9e7f2d54803971df6062af
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/documen8.cxx25
-rw-r--r--sc/source/core/data/documen9.cxx3
-rw-r--r--sc/source/core/data/drwlayer.cxx7
-rw-r--r--sc/source/core/data/validat.cxx3
-rw-r--r--sc/source/core/tool/editutil.cxx9
-rw-r--r--sc/source/core/tool/interpr2.cxx3
-rw-r--r--sc/source/filter/html/htmlexp.cxx4
-rw-r--r--sc/source/ui/app/scmod.cxx17
-rw-r--r--sc/source/ui/docshell/docfunc.cxx4
-rw-r--r--sc/source/ui/docshell/docsh3.cxx3
-rw-r--r--sc/source/ui/docshell/docsh4.cxx57
-rw-r--r--sc/source/ui/docshell/docsh6.cxx6
-rw-r--r--sc/source/ui/docshell/servobj.cxx8
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx6
14 files changed, 73 insertions, 82 deletions
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 15818a927a10..fdd9049453ac 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -726,8 +726,8 @@ void ScDocument::SaveDdeLinks(SvStream& rStream) const
for (i=0; i<nCount; i++)
{
::sfx2::SvBaseLink* pBase = *rLinks[i];
- if (dynamic_cast<const ScDdeLink*>( pBase) != nullptr)
- if ( !bExport40 || static_cast<ScDdeLink*>(pBase)->GetMode() == SC_DDE_DEFAULT )
+ if (ScDdeLink* pLink = dynamic_cast<ScDdeLink*>(pBase))
+ if ( !bExport40 || pLink->GetMode() == SC_DDE_DEFAULT )
++nDdeCount;
}
@@ -741,9 +741,8 @@ void ScDocument::SaveDdeLinks(SvStream& rStream) const
for (i=0; i<nCount; i++)
{
::sfx2::SvBaseLink* pBase = *rLinks[i];
- if (dynamic_cast<const ScDdeLink*>( pBase) != nullptr)
+ if (ScDdeLink* pLink = dynamic_cast<ScDdeLink*>(pBase))
{
- ScDdeLink* pLink = static_cast<ScDdeLink*>(pBase);
if ( !bExport40 || pLink->GetMode() == SC_DDE_DEFAULT )
pLink->Store( rStream, aHdr );
}
@@ -893,9 +892,8 @@ void ScDocument::CopyDdeLinks( ScDocument* pDestDoc ) const
for (size_t i = 0, n = rLinks.size(); i < n; ++i)
{
const sfx2::SvBaseLink* pBase = *rLinks[i];
- if (dynamic_cast<const ScDdeLink*>( pBase) != nullptr)
+ if (const ScDdeLink* p = dynamic_cast<const ScDdeLink*>(pBase))
{
- const ScDdeLink* p = static_cast<const ScDdeLink*>(pBase);
ScDdeLink* pNew = new ScDdeLink(pDestDoc, *p);
pDestMgr->InsertDDELink(
pNew, pNew->GetAppl(), pNew->GetTopic(), pNew->GetItem());
@@ -1078,8 +1076,8 @@ void ScDocument::DeleteAreaLinksOnTab( SCTAB nTab )
while ( nPos < rLinks.size() )
{
const ::sfx2::SvBaseLink* pBase = *rLinks[nPos];
- if ( dynamic_cast<const ScAreaLink*>( pBase) != nullptr &&
- static_cast<const ScAreaLink*>(pBase)->GetDestArea().aStart.Tab() == nTab )
+ const ScAreaLink* pLink = dynamic_cast<const ScAreaLink*>(pBase);
+ if (pLink && pLink->GetDestArea().aStart.Tab() == nTab)
pMgr->Remove(nPos);
else
++nPos;
@@ -1100,9 +1098,8 @@ void ScDocument::UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode,
for (sal_uInt16 i=0; i<nCount; i++)
{
::sfx2::SvBaseLink* pBase = *rLinks[i];
- if (dynamic_cast<const ScAreaLink*>( pBase) != nullptr)
+ if (ScAreaLink* pLink = dynamic_cast<ScAreaLink*>(pBase))
{
- ScAreaLink* pLink = static_cast<ScAreaLink*>(pBase);
ScRange aOutRange = pLink->GetDestArea();
SCCOL nCol1 = aOutRange.aStart.Col();
@@ -1136,14 +1133,14 @@ void ScDocument::UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode,
{
bool bFound = false;
::sfx2::SvBaseLink* pFirst = *rLinks[nFirstIndex];
- if ( dynamic_cast<const ScAreaLink*>( pFirst) != nullptr )
+ if (ScAreaLink* pFirstLink = dynamic_cast<ScAreaLink*>(pFirst))
{
- ScAddress aFirstPos = static_cast<ScAreaLink*>(pFirst)->GetDestArea().aStart;
+ ScAddress aFirstPos = pFirstLink->GetDestArea().aStart;
for ( sal_uInt16 nSecondIndex = nFirstIndex + 1; nSecondIndex < nCount && !bFound; ++nSecondIndex )
{
::sfx2::SvBaseLink* pSecond = *rLinks[nSecondIndex];
- if ( dynamic_cast<const ScAreaLink*>( pSecond) != nullptr &&
- static_cast<ScAreaLink*>(pSecond)->GetDestArea().aStart == aFirstPos )
+ ScAreaLink* pSecondLink = dynamic_cast<ScAreaLink*>(pSecond);
+ if (pSecondLink && pSecondLink->GetDestArea().aStart == aFirstPos)
{
// remove the first link, exit the inner loop, don't increment nFirstIndex
pMgr->Remove(pFirst);
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index 9ca20922cded..e1d0479edf1e 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -344,9 +344,8 @@ void ScDocument::StartAnimations( SCTAB nTab, vcl::Window* pWin )
SdrObject* pObject = aIter.Next();
while (pObject)
{
- if (dynamic_cast<const SdrGrafObj*>( pObject) != nullptr)
+ if (SdrGrafObj* pGrafObj = dynamic_cast<SdrGrafObj*>(pObject))
{
- SdrGrafObj* pGrafObj = static_cast<SdrGrafObj*>(pObject);
if ( pGrafObj->IsAnimated() )
{
const Rectangle& rRect = pGrafObj->GetCurrentBoundRect();
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index f87954f742c5..6a7429fbe6b2 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -2047,9 +2047,8 @@ IMapObject* ScDrawLayer::GetHitIMapObject( SdrObject* pObj,
Graphic aGraphic;
bool bObjSupported = false;
- if ( dynamic_cast<const SdrGrafObj*>( pObj) != nullptr ) // Simple Graphics object
+ if (const SdrGrafObj* pGrafObj = dynamic_cast<const SdrGrafObj*>(pObj)) // Simple Graphics object
{
- const SdrGrafObj* pGrafObj = static_cast<const SdrGrafObj*>( pObj );
const GeoStat& rGeo = pGrafObj->GetGeoStat();
const Graphic& rGraphic = pGrafObj->GetGraphic();
@@ -2075,10 +2074,10 @@ IMapObject* ScDrawLayer::GetHitIMapObject( SdrObject* pObj,
bObjSupported = true;
}
- else if ( dynamic_cast<const SdrOle2Obj*>( pObj) != nullptr ) // OLE object
+ else if (const SdrOle2Obj* pOleObj = dynamic_cast<const SdrOle2Obj*>(pObj)) // OLE object
{
// TODO/LEAN: working with visual area needs running state
- aGraphSize = static_cast<const SdrOle2Obj*>(pObj)->GetOrigObjSize();
+ aGraphSize = pOleObj->GetOrigObjSize();
bObjSupported = true;
}
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 2e77adac1745..8d2efdbc25ab 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -289,9 +289,8 @@ bool ScValidationData::DoMacro( const ScAddress& rPos, const OUString& rInput,
StarBASIC* pRoot = pDocSh->GetBasic();
SbxVariable* pVar = pRoot->Find( aErrorTitle, SbxCLASS_METHOD );
- if ( pVar && dynamic_cast<const SbMethod*>( pVar) != nullptr )
+ if (SbMethod* pMethod = dynamic_cast<SbMethod*>(pVar))
{
- SbMethod* pMethod = static_cast<SbMethod*>(pVar);
SbModule* pModule = pMethod->GetModule();
SbxObject* pObject = pModule->GetParent();
OUStringBuffer aMacroStr = pObject->GetName();
diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
index c2fedb2749c4..0576020c6c18 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -875,12 +875,11 @@ OUString ScFieldEditEngine::CalcFieldValue( const SvxFieldItem& rField,
void ScFieldEditEngine::FieldClicked( const SvxFieldItem& rField, sal_Int32, sal_Int32 )
{
- const SvxFieldData* pFld = rField.GetField();
-
- if ( pFld && dynamic_cast<const SvxURLField*>( pFld) != nullptr && bExecuteURL )
+ if (!bExecuteURL)
+ return;
+ if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(rField.GetField()))
{
- const SvxURLField* pURLField = static_cast<const SvxURLField*>(pFld);
- ScGlobal::OpenURL( pURLField->GetURL(), pURLField->GetTargetFrame() );
+ ScGlobal::OpenURL(pURLField->GetURL(), pURLField->GetTargetFrame());
}
}
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index ce1fdda1cd91..5699816693d4 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -2346,9 +2346,8 @@ static ScDdeLink* lcl_GetDdeLink( sfx2::LinkManager* pLinkMgr,
for (size_t i=0; i<nCount; i++ )
{
::sfx2::SvBaseLink* pBase = *pLinkMgr->GetLinks()[i];
- if (dynamic_cast<const ScDdeLink*>( pBase) != nullptr)
+ if (ScDdeLink* pLink = dynamic_cast<ScDdeLink*>(pBase))
{
- ScDdeLink* pLink = static_cast<ScDdeLink*>(pBase);
if ( pLink->GetAppl() == rA &&
pLink->GetTopic() == rT &&
pLink->GetItem() == rI &&
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index c8d362275788..f274326bd9c8 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -1268,11 +1268,9 @@ bool ScHTMLExport::WriteFieldText( const EditTextObject* pData )
if ( aSet.GetItemState( EE_FEATURE_FIELD, false, &pItem ) == SfxItemState::SET )
{
const SvxFieldData* pField = static_cast<const SvxFieldItem*>(pItem)->GetField();
- if ( pField && dynamic_cast<const SvxURLField*>( pField) != nullptr )
+ if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
{
bUrl = true;
- const SvxURLField* pURLField = static_cast<const SvxURLField*>(pField);
-// String aFieldText = rEngine.GetText( aSel );
rStrm.WriteChar( '<' ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_anchor ).WriteChar( ' ' ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_O_href ).WriteCharPtr( "=\"" );
OUT_STR( pURLField->GetURL() );
rStrm.WriteCharPtr( "\">" );
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 81626abc9dc4..5eda81d28064 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -246,9 +246,8 @@ void ScModule::ConfigurationChanged( utl::ConfigurationBroadcaster* p, sal_uInt3
SfxViewShell* pViewShell = SfxViewShell::GetFirst();
while(pViewShell)
{
- if ( dynamic_cast<const ScTabViewShell*>( pViewShell) != nullptr )
+ if (ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(pViewShell))
{
- ScTabViewShell* pViewSh = static_cast<ScTabViewShell*>(pViewShell);
pViewSh->PaintGrid();
pViewSh->PaintTop();
pViewSh->PaintLeft();
@@ -293,10 +292,8 @@ void ScModule::ConfigurationChanged( utl::ConfigurationBroadcaster* p, sal_uInt3
SfxViewShell* pSh = SfxViewShell::GetFirst();
while ( pSh )
{
- if ( dynamic_cast<const ScTabViewShell*>( pSh) != nullptr )
+ if (ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(pSh))
{
- ScTabViewShell* pViewSh = static_cast<ScTabViewShell*>(pSh);
-
// set ref-device for EditEngine (re-evaluates digit settings)
ScInputHandler* pHdl = GetInputHdl(pViewSh);
if (pHdl)
@@ -305,9 +302,8 @@ void ScModule::ConfigurationChanged( utl::ConfigurationBroadcaster* p, sal_uInt3
pViewSh->DigitLanguageChanged();
pViewSh->PaintGrid();
}
- else if ( dynamic_cast<const ScPreviewShell*>( pSh) != nullptr )
+ else if (ScPreviewShell* pPreviewSh = dynamic_cast<ScPreviewShell*>(pSh))
{
- ScPreviewShell* pPreviewSh = static_cast<ScPreviewShell*>(pSh);
ScPreview* pPreview = pPreviewSh->GetPreview();
pPreview->SetDigitLanguage( GetOptDigitLanguage() );
@@ -1551,8 +1547,8 @@ void ScModule::SetRefDialog( sal_uInt16 nId, bool bVis, SfxViewFrame* pViewFrm )
{
// store the dialog id also in the view shell
SfxViewShell* pViewSh = pViewFrm->GetViewShell();
- if ( pViewSh && dynamic_cast<const ScTabViewShell*>( pViewSh) != nullptr )
- static_cast<ScTabViewShell*>(pViewSh)->SetCurRefDlgId( nCurRefDlgId );
+ if (ScTabViewShell* pTabViewSh = dynamic_cast<ScTabViewShell*>(pViewSh))
+ pTabViewSh->SetCurRefDlgId(nCurRefDlgId);
else
{
// no ScTabViewShell - possible for example from a Basic macro
@@ -2146,10 +2142,9 @@ IMPL_LINK_TYPED( ScModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void )
const SvxFieldItem& rField = pInfo->GetField();
const SvxFieldData* pField = rField.GetField();
- if (pField && dynamic_cast<const SvxURLField*>( pField) != nullptr)
+ if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
{
// URLField
- const SvxURLField* pURLField = static_cast<const SvxURLField*>(pField);
OUString aURL = pURLField->GetURL();
switch ( pURLField->GetFormat() )
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index b554dd29060b..52a8c7186ba5 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -5220,8 +5220,8 @@ bool ScDocFunc::InsertAreaLink( const OUString& rFile, const OUString& rFilter,
while (nLinkPos<nLinkCount)
{
::sfx2::SvBaseLink* pBase = *pLinkManager->GetLinks()[nLinkPos];
- if ( dynamic_cast< const ScAreaLink *>( pBase ) != nullptr &&
- static_cast<ScAreaLink*>(pBase)->GetDestArea().aStart == rDestRange.aStart )
+ ScAreaLink* pLink = dynamic_cast<ScAreaLink*>(pBase);
+ if (pLink && pLink->GetDestArea().aStart == rDestRange.aStart)
{
if ( bUndo )
{
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index a1135db48cbb..4ac965f4edf9 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -480,9 +480,8 @@ sal_uInt16 ScDocShell::SetPrinter( SfxPrinter* pNewPrinter, SfxPrinterChangeFlag
while (pFrame)
{
SfxViewShell* pSh = pFrame->GetViewShell();
- if (pSh && dynamic_cast<const ScTabViewShell*>( pSh) != nullptr)
+ if (ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(pSh))
{
- ScTabViewShell* pViewSh = static_cast<ScTabViewShell*>(pSh);
ScInputHandler* pInputHdl = pScMod->GetInputHdl(pViewSh);
if (pInputHdl)
pInputHdl->UpdateRefDevice();
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 79cabb134d8c..d923654d4ebd 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -674,31 +674,39 @@ void ScDocShell::Execute( SfxRequest& rReq )
}
SfxApplication* pApp = SfxGetpApp();
const SfxPoolItem* pItem;
+ const SfxStringItem* pStringItem(nullptr);
SfxMedium* pMed = NULL;
- if ( pReqArgs &&
- pReqArgs->GetItemState( SID_FILE_NAME, true, &pItem ) == SfxItemState::SET &&
- dynamic_cast<const SfxStringItem*>( pItem) != nullptr )
+ if (pReqArgs && pReqArgs->GetItemState(SID_FILE_NAME, true, &pItem) == SfxItemState::SET)
{
- OUString aFileName =
- static_cast<const SfxStringItem*>(pItem)->GetValue();
+ pStringItem = dynamic_cast<const SfxStringItem*>(pItem);
+ }
+ if (pStringItem)
+ {
+ OUString aFileName = pStringItem->GetValue();
OUString aFilterName;
- if ( pReqArgs->GetItemState( SID_FILTER_NAME, true, &pItem ) == SfxItemState::SET &&
- dynamic_cast<const SfxStringItem*>( pItem) != nullptr )
+ pStringItem = nullptr;
+ if (pReqArgs->GetItemState(SID_FILTER_NAME, true, &pItem) == SfxItemState::SET)
+ pStringItem = dynamic_cast<const SfxStringItem*>(pItem);
+ if (pStringItem)
{
- aFilterName = static_cast<const SfxStringItem*>(pItem)->GetValue();
+ aFilterName = pStringItem->GetValue();
}
OUString aOptions;
- if ( pReqArgs->GetItemState( SID_FILE_FILTEROPTIONS, true, &pItem ) == SfxItemState::SET &&
- dynamic_cast<const SfxStringItem*>( pItem) != nullptr )
+ pStringItem = nullptr;
+ if (pReqArgs->GetItemState(SID_FILE_FILTEROPTIONS, true, &pItem) == SfxItemState::SET)
+ pStringItem = dynamic_cast<const SfxStringItem*>(pItem);
+ if (pStringItem)
{
- aOptions = static_cast<const SfxStringItem*>(pItem)->GetValue();
+ aOptions = pStringItem->GetValue();
}
short nVersion = 0;
- if ( pReqArgs->GetItemState( SID_VERSION, true, &pItem ) == SfxItemState::SET &&
- dynamic_cast<const SfxInt16Item*>( pItem) != nullptr )
+ const SfxInt16Item* pInt16Item(nullptr);
+ if (pReqArgs->GetItemState(SID_VERSION, true, &pItem) == SfxItemState::SET)
+ pInt16Item = dynamic_cast<const SfxInt16Item*>(pItem);
+ if (pInt16Item)
{
- nVersion = static_cast<const SfxInt16Item*>(pItem)->GetValue();
+ nVersion = pInt16Item->GetValue();
}
// kein Filter angegeben -> Detection
@@ -817,9 +825,9 @@ void ScDocShell::Execute( SfxRequest& rReq )
const SfxPoolItem* pItem;
if ( pReqArgs->GetItemState( nSlot, true, &pItem ) == SfxItemState::SET )
{
- if ( dynamic_cast<const SfxStringItem*>( pItem) != nullptr )
+ if (const SfxStringItem* pStringItem = dynamic_cast<const SfxStringItem*>(pItem))
{
- OUString aName = static_cast<const SfxStringItem*>(pItem)->GetValue();
+ OUString aName = pStringItem->GetValue();
SCTAB nTab;
if (aDocument.GetTable( aName, nTab ))
{
@@ -845,9 +853,9 @@ void ScDocShell::Execute( SfxRequest& rReq )
const SfxPoolItem* pItem;
if ( pReqArgs->GetItemState( nSlot, true, &pItem ) == SfxItemState::SET )
{
- if ( dynamic_cast<const SfxStringItem*>( pItem) != nullptr )
+ if (const SfxStringItem* pStringItem = dynamic_cast<const SfxStringItem*>(pItem))
{
- OUString aName = static_cast<const SfxStringItem*>(pItem)->GetValue();
+ OUString aName = pStringItem->GetValue();
SCTAB nTab;
if (aDocument.GetTable( aName, nTab ))
{
@@ -893,9 +901,9 @@ void ScDocShell::Execute( SfxRequest& rReq )
const SfxPoolItem* pItem;
if ( pReqArgs->GetItemState( nSlot, true, &pItem ) == SfxItemState::SET )
{
- if ( dynamic_cast<const SfxUInt16Item*>( pItem) != nullptr )
+ if (const SfxUInt16Item* pInt16Item = dynamic_cast<const SfxUInt16Item*>(pItem))
{
- sal_uInt16 nY2k = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+ sal_uInt16 nY2k = pInt16Item->GetValue();
// immer an den DocOptions setzen, damit das auch fuer SO50
// gespeichert wird (und alle Abfragen bisher auch darauf laufen).
// SetDocOptions propagiert das an den NumberFormatter
@@ -2292,10 +2300,13 @@ IMPL_LINK_TYPED( ScDocShell, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg
pImpl->pRequest->AppendItem( SfxStringItem( SID_FILE_FILTEROPTIONS, sOptions ) );
}
const SfxPoolItem* pItem = NULL;
+ const SfxInt16Item* pInt16Item(nullptr);
SfxItemSet* pSet = pMed->GetItemSet();
- if ( pSet &&
- pSet->GetItemState( SID_VERSION, true, &pItem ) == SfxItemState::SET &&
- dynamic_cast<const SfxInt16Item*>( pItem) != nullptr )
+ if (pSet && pSet->GetItemState(SID_VERSION, true, &pItem) == SfxItemState::SET)
+ {
+ pInt16Item = dynamic_cast<const SfxInt16Item*>(pItem);
+ }
+ if (pInt16Item)
{
pImpl->pRequest->AppendItem( *pItem );
}
diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index 737423695da7..0a012928f572 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -354,9 +354,8 @@ void ScDocShell::UpdateLinks()
{
--k;
::sfx2::SvBaseLink* pBase = *pLinkManager->GetLinks()[k];
- if (dynamic_cast<const ScTableLink*>( pBase) != nullptr)
+ if (ScTableLink* pTabLink = dynamic_cast<ScTableLink*>(pBase))
{
- ScTableLink* pTabLink = static_cast<ScTableLink*>(pBase);
if (pTabLink->IsUsed())
aNames.insert(pTabLink->GetFileName());
else // nicht mehr benutzt -> loeschen
@@ -418,9 +417,8 @@ bool ScDocShell::ReloadTabLinks()
for (size_t i=0; i<nCount; i++ )
{
::sfx2::SvBaseLink* pBase = *pLinkManager->GetLinks()[i];
- if (dynamic_cast<const ScTableLink*>( pBase) != nullptr)
+ if (ScTableLink* pTabLink = dynamic_cast<ScTableLink*>(pBase))
{
- ScTableLink* pTabLink = static_cast<ScTableLink*>(pBase);
// pTabLink->SetAddUndo(sal_False); //! Undo's zusammenfassen
// Painting only after Update() makes no sense:
diff --git a/sc/source/ui/docshell/servobj.cxx b/sc/source/ui/docshell/servobj.cxx
index e090bd26724b..4e2d7a32baeb 100644
--- a/sc/source/ui/docshell/servobj.cxx
+++ b/sc/source/ui/docshell/servobj.cxx
@@ -228,18 +228,18 @@ void ScServerObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
const ScHint* pScHint = dynamic_cast<const ScHint*>( &rHint );
if (pScHint && (pScHint->GetId() & SC_HINT_DATACHANGED))
bDataChanged = true;
- else if ( dynamic_cast<const ScAreaChangedHint*>(&rHint) ) // position of broadcaster changed
+ else if (const ScAreaChangedHint *pChgHint = dynamic_cast<const ScAreaChangedHint*>(&rHint)) // position of broadcaster changed
{
- ScRange aNewRange = static_cast<const ScAreaChangedHint&>(rHint).GetRange();
+ ScRange aNewRange = pChgHint->GetRange();
if ( aRange != aNewRange )
{
bRefreshListener = true;
bDataChanged = true;
}
}
- else if ( dynamic_cast<const SfxSimpleHint*>(&rHint) )
+ else if (const SfxSimpleHint *pSplHint = dynamic_cast<const SfxSimpleHint*>(&rHint))
{
- sal_uLong nId = static_cast<const SfxSimpleHint&>(rHint).GetId();
+ sal_uLong nId = pSplHint->GetId();
if (nId == SFX_HINT_DYING)
{
// If the range is being deleted, listening must be restarted
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index a0c259259b13..a09ca5dfd373 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -323,9 +323,8 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq )
if ( pFieldItem )
{
const SvxFieldData* pField = pFieldItem->GetField();
- if( pField && dynamic_cast<const SvxURLField*>( pField) != nullptr )
+ if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
{
- const SvxURLField* pURLField = static_cast< const SvxURLField* >( pField );
ScGlobal::OpenURL( pURLField->GetURL(), pURLField->GetTargetFrame() );
}
}
@@ -391,9 +390,8 @@ void ScDrawTextObjectBar::GetState( SfxItemSet& rSet )
if (pFieldItem)
{
const SvxFieldData* pField = pFieldItem->GetField();
- if ( pField && dynamic_cast<const SvxURLField*>( pField) != nullptr )
+ if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
{
- const SvxURLField* pURLField = static_cast<const SvxURLField*>(pField);
aHLinkItem.SetName( pURLField->GetRepresentation() );
aHLinkItem.SetURL( pURLField->GetURL() );
aHLinkItem.SetTargetFrame( pURLField->GetTargetFrame() );