summaryrefslogtreecommitdiff
path: root/sd/source/ui
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-10-13 11:02:30 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-10-13 12:47:38 +0200
commit1374f5fdcbbd24b9ba614b378fd94f5ff95ad102 (patch)
treea47982a70463150dced3c7c1a7d13c669febd681 /sd/source/ui
parent97b7b6030a6cf5b28ae0c1f61f7f55167b82dab6 (diff)
static_cast after dynamic_cast
Change-Id: I53e10fbebfd07c471ddd9b264562317251700500 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104225 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui')
-rw-r--r--sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx6
-rw-r--r--sd/source/ui/accessibility/AccessibleSlideSorterView.cxx5
-rw-r--r--sd/source/ui/app/sdpopup.cxx24
-rw-r--r--sd/source/ui/dlg/dlgfield.cxx35
-rw-r--r--sd/source/ui/func/fuinsfil.cxx4
-rw-r--r--sd/source/ui/func/fupoor.cxx14
-rw-r--r--sd/source/ui/func/fuprlout.cxx5
-rw-r--r--sd/source/ui/func/futhes.cxx5
-rw-r--r--sd/source/ui/sidebar/MasterPageObserver.cxx10
-rw-r--r--sd/source/ui/slidesorter/controller/SlsListener.cxx5
-rw-r--r--sd/source/ui/unoidl/unopage.cxx24
-rw-r--r--sd/source/ui/view/Outliner.cxx4
-rw-r--r--sd/source/ui/view/ViewShellBase.cxx5
-rw-r--r--sd/source/ui/view/drbezob.cxx16
-rw-r--r--sd/source/ui/view/sdview2.cxx4
-rw-r--r--sd/source/ui/view/sdview3.cxx3
16 files changed, 67 insertions, 102 deletions
diff --git a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
index 92ac8bdf1c0c..67238cb3154c 100644
--- a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
+++ b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
@@ -655,9 +655,8 @@ uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes()
uno::Any anyAttribute;
OUStringBuffer sValue;
- if (nullptr != dynamic_cast<const ::sd::DrawViewShell* > (mpViewShell))
+ if (auto pDrViewSh = dynamic_cast<::sd::DrawViewShell* > (mpViewShell))
{
- ::sd::DrawViewShell* pDrViewSh = static_cast< ::sd::DrawViewShell*>(mpViewShell);
OUString sDisplay;
OUString sName = "page-name:";
// MT IA2: Not used...
@@ -708,9 +707,8 @@ uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes()
sValue.append(";");
}
}
- if (dynamic_cast<const ::sd::PresentationViewShell* >(mpViewShell) != nullptr )
+ if (auto pPresViewSh = dynamic_cast<::sd::PresentationViewShell* >(mpViewShell))
{
- ::sd::PresentationViewShell* pPresViewSh = static_cast< ::sd::PresentationViewShell*>(mpViewShell);
SdPage* pCurrPge = pPresViewSh->getCurrentPage();
SdDrawDocument* pDoc = pPresViewSh->GetDoc();
SdPage* pNotesPge = pDoc->GetSdPage((pCurrPge->GetPageNum()-1)>>1, PageKind::Notes);
diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
index 99f38b4d3d79..b35c1a57e6f0 100644
--- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
+++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
@@ -822,10 +822,9 @@ void AccessibleSlideSorterView::Implementation::Notify (
break;
}
}
- else if (dynamic_cast<const sd::ViewShellHint*>(&rHint))
+ else if (auto pViewShellHint = dynamic_cast<const sd::ViewShellHint*>(&rHint))
{
- const sd::ViewShellHint& rViewShellHint = static_cast<const sd::ViewShellHint&>(rHint);
- switch (rViewShellHint.GetHintId())
+ switch (pViewShellHint->GetHintId())
{
case sd::ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START:
mbModelChangeLocked = true;
diff --git a/sd/source/ui/app/sdpopup.cxx b/sd/source/ui/app/sdpopup.cxx
index eeadaef35bf9..d4b81ea7fde5 100644
--- a/sd/source/ui/app/sdpopup.cxx
+++ b/sd/source/ui/app/sdpopup.cxx
@@ -50,9 +50,8 @@ void SdFieldPopup::Fill( LanguageType eLanguage )
InsertItem( nID++, SdResId( STR_VAR ), nStyle );
InsertSeparator();
- if( dynamic_cast< const SvxDateField *>( pField ) != nullptr )
+ if( auto pDateField = dynamic_cast< const SvxDateField *>( pField ) )
{
- const SvxDateField* pDateField = static_cast<const SvxDateField*>( pField );
SvxDateField aDateField( *pDateField );
if( pDateField->GetType() == SvxDateType::Fix )
@@ -82,9 +81,8 @@ void SdFieldPopup::Fill( LanguageType eLanguage )
CheckItem( static_cast<sal_uInt16>( pDateField->GetFormat() ) + 1 ); // - 2 + 3 !
}
- else if( dynamic_cast< const SvxExtTimeField *>( pField ) != nullptr )
+ else if( auto pTimeField = dynamic_cast< const SvxExtTimeField *>( pField ) )
{
- const SvxExtTimeField* pTimeField = static_cast<const SvxExtTimeField*>( pField );
SvxExtTimeField aTimeField( *pTimeField );
if( pTimeField->GetType() == SvxTimeType::Fix )
@@ -116,9 +114,8 @@ void SdFieldPopup::Fill( LanguageType eLanguage )
CheckItem( static_cast<sal_uInt16>( pTimeField->GetFormat() ) + 1 ); // - 2 + 3 !
}
- else if( dynamic_cast< const SvxExtFileField *>( pField ) != nullptr )
+ else if( auto pFileField = dynamic_cast< const SvxExtFileField *>( pField ) )
{
- const SvxExtFileField* pFileField = static_cast<const SvxExtFileField*>(pField);
//SvxExtFileField aFileField( *pFileField );
if( pFileField->GetType() == SvxFileType::Fix )
@@ -133,9 +130,8 @@ void SdFieldPopup::Fill( LanguageType eLanguage )
CheckItem( static_cast<sal_uInt16>( pFileField->GetFormat() ) + 3 );
}
- else if( dynamic_cast< const SvxAuthorField *>( pField ) != nullptr )
+ else if( auto pAuthorField = dynamic_cast< const SvxAuthorField *>( pField ) )
{
- const SvxAuthorField* pAuthorField = static_cast<const SvxAuthorField*>(pField);
SvxAuthorField aAuthorField( *pAuthorField );
if( pAuthorField->GetType() == SvxAuthorType::Fix )
@@ -161,9 +157,8 @@ SvxFieldData* SdFieldPopup::GetField()
SvxFieldData* pNewField = nullptr;
sal_uInt16 nCount = GetItemCount();
- if( dynamic_cast< const SvxDateField *>( pField ) != nullptr )
+ if( auto pDateField = dynamic_cast< const SvxDateField *>( pField ) )
{
- const SvxDateField* pDateField = static_cast<const SvxDateField*>(pField);
SvxDateType eType;
SvxDateFormat eFormat;
sal_uInt16 i;
@@ -194,9 +189,8 @@ SvxFieldData* SdFieldPopup::GetField()
}
}
}
- else if( dynamic_cast< const SvxExtTimeField *>( pField ) != nullptr )
+ else if( auto pTimeField = dynamic_cast< const SvxExtTimeField *>( pField ) )
{
- const SvxExtTimeField* pTimeField = static_cast<const SvxExtTimeField*>(pField);
SvxTimeType eType;
SvxTimeFormat eFormat;
sal_uInt16 i;
@@ -228,9 +222,8 @@ SvxFieldData* SdFieldPopup::GetField()
}
}
- else if( dynamic_cast< const SvxExtFileField *>( pField ) != nullptr )
+ else if( auto pFileField = dynamic_cast< const SvxExtFileField *>( pField ) )
{
- const SvxExtFileField* pFileField = static_cast<const SvxExtFileField*>(pField);
SvxFileType eType;
SvxFileFormat eFormat;
sal_uInt16 i;
@@ -265,9 +258,8 @@ SvxFieldData* SdFieldPopup::GetField()
}
}
}
- else if( dynamic_cast< const SvxAuthorField *>( pField ) != nullptr )
+ else if( auto pAuthorField = dynamic_cast< const SvxAuthorField *>( pField ) )
{
- const SvxAuthorField* pAuthorField = static_cast<const SvxAuthorField*>(pField);
SvxAuthorType eType;
SvxAuthorFormat eFormat;
sal_uInt16 i;
diff --git a/sd/source/ui/dlg/dlgfield.cxx b/sd/source/ui/dlg/dlgfield.cxx
index 9a7bc1d0b2b0..dd8b4535d045 100644
--- a/sd/source/ui/dlg/dlgfield.cxx
+++ b/sd/source/ui/dlg/dlgfield.cxx
@@ -65,9 +65,8 @@ SvxFieldData* SdModifyFieldDlg::GetField()
m_xRbtVar->get_state_changed_from_saved() ||
m_xLbFormat->get_value_changed_from_saved() )
{
- if( dynamic_cast< const SvxDateField *>( m_pField ) != nullptr )
+ if( auto pDateField = dynamic_cast< const SvxDateField *>( m_pField ) )
{
- const SvxDateField* pDateField = static_cast<const SvxDateField*>(m_pField);
SvxDateType eType;
SvxDateFormat eFormat;
@@ -82,9 +81,8 @@ SvxFieldData* SdModifyFieldDlg::GetField()
static_cast<SvxDateField*>( pNewField )->SetType( eType );
static_cast<SvxDateField*>( pNewField )->SetFormat( eFormat );
}
- else if( dynamic_cast< const SvxExtTimeField *>( m_pField ) != nullptr )
+ else if( auto pTimeField = dynamic_cast< const SvxExtTimeField *>( m_pField ) )
{
- const SvxExtTimeField* pTimeField = static_cast<const SvxExtTimeField*>( m_pField );
SvxTimeType eType;
SvxTimeFormat eFormat;
@@ -154,9 +152,8 @@ void SdModifyFieldDlg::FillFormatList()
m_xLbFormat->clear();
- if( dynamic_cast< const SvxDateField *>( m_pField ) != nullptr )
+ if( auto pDateField = dynamic_cast< const SvxDateField *>( m_pField ) )
{
- const SvxDateField* pDateField = static_cast<const SvxDateField*>( m_pField );
SvxDateField aDateField( *pDateField );
//SvxDateFormat::AppDefault, // not used
@@ -180,9 +177,8 @@ void SdModifyFieldDlg::FillFormatList()
m_xLbFormat->set_active( static_cast<sal_uInt16>(pDateField->GetFormat()) - 2 );
}
- else if( dynamic_cast< const SvxExtTimeField *>( m_pField ) != nullptr )
+ else if( auto pTimeField = dynamic_cast< const SvxExtTimeField *>( m_pField ) )
{
- const SvxExtTimeField* pTimeField = static_cast<const SvxExtTimeField*>( m_pField );
SvxExtTimeField aTimeField( *pTimeField );
//SvxTimeFormat::AppDefault, // not used
@@ -208,10 +204,8 @@ void SdModifyFieldDlg::FillFormatList()
m_xLbFormat->set_active( static_cast<sal_uInt16>(pTimeField->GetFormat()) - 2 );
}
- else if( dynamic_cast< const SvxExtFileField *>( m_pField ) != nullptr )
+ else if( auto pFileField = dynamic_cast< const SvxExtFileField *>( m_pField ) )
{
- const SvxExtFileField* pFileField = static_cast<const SvxExtFileField*>( m_pField );
-
m_xLbFormat->append_text( SdResId( STR_FILEFORMAT_NAME_EXT ) );
m_xLbFormat->append_text( SdResId( STR_FILEFORMAT_FULLPATH ) );
m_xLbFormat->append_text( SdResId( STR_FILEFORMAT_PATH ) );
@@ -219,9 +213,8 @@ void SdModifyFieldDlg::FillFormatList()
m_xLbFormat->set_active( static_cast<sal_uInt16>( pFileField->GetFormat() ) );
}
- else if( dynamic_cast< const SvxAuthorField *>( m_pField ) != nullptr )
+ else if( auto pAuthorField = dynamic_cast< const SvxAuthorField *>( m_pField ) )
{
- const SvxAuthorField* pAuthorField = static_cast<const SvxAuthorField*>( m_pField );
SvxAuthorField aAuthorField( *pAuthorField );
for( sal_uInt16 i = 0; i < 4; i++ )
@@ -240,37 +233,29 @@ void SdModifyFieldDlg::FillControls()
{
m_xLbFormat->clear();
- if( dynamic_cast< const SvxDateField *>( m_pField ) != nullptr )
+ if( auto pDateField = dynamic_cast< const SvxDateField *>( m_pField ) )
{
- const SvxDateField* pDateField = static_cast<const SvxDateField*>(m_pField);
-
if( pDateField->GetType() == SvxDateType::Fix )
m_xRbtFix->set_active(true);
else
m_xRbtVar->set_active(true);
}
- else if( dynamic_cast< const SvxExtTimeField *>( m_pField ) != nullptr )
+ else if( auto pTimeField = dynamic_cast< const SvxExtTimeField *>( m_pField ) )
{
- const SvxExtTimeField* pTimeField = static_cast<const SvxExtTimeField*>(m_pField);
-
if( pTimeField->GetType() == SvxTimeType::Fix )
m_xRbtFix->set_active(true);
else
m_xRbtVar->set_active(true);
}
- else if( dynamic_cast< const SvxExtFileField *>( m_pField ) != nullptr )
+ else if( auto pFileField = dynamic_cast< const SvxExtFileField *>( m_pField ) )
{
- const SvxExtFileField* pFileField = static_cast<const SvxExtFileField*>(m_pField);
-
if( pFileField->GetType() == SvxFileType::Fix )
m_xRbtFix->set_active(true);
else
m_xRbtVar->set_active(true);
}
- else if( dynamic_cast< const SvxAuthorField *>( m_pField ) != nullptr )
+ else if( auto pAuthorField = dynamic_cast< const SvxAuthorField *>( m_pField ) )
{
- const SvxAuthorField* pAuthorField = static_cast<const SvxAuthorField*>(m_pField);
-
if( pAuthorField->GetType() == SvxAuthorType::Fix )
m_xRbtFix->set_active(true);
else
diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx
index abff3b1c7046..08684ae41a5a 100644
--- a/sd/source/ui/func/fuinsfil.cxx
+++ b/sd/source/ui/func/fuinsfil.cxx
@@ -334,9 +334,9 @@ bool FuInsertFile::InsSDDinDrMode(SfxMedium* pMedium)
if (pView)
{
- if( dynamic_cast< const OutlineView *>( pView ) != nullptr)
+ if( auto pOutlineView = dynamic_cast<OutlineView *>( pView ))
{
- pPage = static_cast<OutlineView*>(pView)->GetActualPage();
+ pPage = pOutlineView->GetActualPage();
}
else
{
diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx
index d3ceffea98e7..47225d7bb2c5 100644
--- a/sd/source/ui/func/fupoor.cxx
+++ b/sd/source/ui/func/fupoor.cxx
@@ -179,10 +179,8 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt)
{
if(rKEvt.GetKeyCode().IsMod1())
{
- if( dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr)
+ if( auto pDrawViewShell = dynamic_cast<DrawViewShell *>( mpViewShell ))
{
- DrawViewShell* pDrawViewShell =
- static_cast<DrawViewShell*>(mpViewShell);
SdPage* pActualPage = pDrawViewShell->GetActualPage();
SdrTextObj* pCandidate = nullptr;
@@ -298,9 +296,8 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt)
// increase zoom
mpViewShell->SetZoom(mpWindow->GetZoom() * 3 / 2);
- if( dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr)
- static_cast<DrawViewShell*>(mpViewShell)
- ->SetZoomOnPage(false);
+ if( auto pViewShell = dynamic_cast<DrawViewShell *>( mpViewShell ))
+ pViewShell->SetZoomOnPage(false);
bReturn = true;
}
@@ -314,9 +311,8 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt)
// decrease zoom
mpViewShell->SetZoom(mpWindow->GetZoom() * 2 / 3);
- if( dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr)
- static_cast<DrawViewShell*>(mpViewShell)
- ->SetZoomOnPage(false);
+ if( auto pViewShell = dynamic_cast<DrawViewShell *>( mpViewShell ))
+ pViewShell->SetZoomOnPage(false);
bReturn = true;
}
diff --git a/sd/source/ui/func/fuprlout.cxx b/sd/source/ui/func/fuprlout.cxx
index 08b608717e63..8ee1a4899740 100644
--- a/sd/source/ui/func/fuprlout.cxx
+++ b/sd/source/ui/func/fuprlout.cxx
@@ -230,10 +230,9 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq )
{
if (bOnMaster)
{
- if( dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr)
+ if( auto pDrawViewShell = dynamic_cast<DrawViewShell *>( mpViewShell ))
{
- ::sd::View* pView =
- static_cast<DrawViewShell*>(mpViewShell)->GetView();
+ ::sd::View* pView = pDrawViewShell->GetView();
for (auto pSelectedPage : aSelectedPages)
{
sal_uInt16 nPgNum = pSelectedPage->TRG_GetMasterPage().GetPageNum();
diff --git a/sd/source/ui/func/futhes.cxx b/sd/source/ui/func/futhes.cxx
index e30ac5e2ea5e..63d5ff021c9c 100644
--- a/sd/source/ui/func/futhes.cxx
+++ b/sd/source/ui/func/futhes.cxx
@@ -76,10 +76,7 @@ void FuThesaurus::DoExecute( SfxRequest& )
SdrMark* pMark = rMarkList.GetMark(0);
SdrObject* pObj = pMark->GetMarkedSdrObj();
- if ( dynamic_cast< const SdrTextObj *>( pObj ) != nullptr )
- {
- pTextObj = static_cast<SdrTextObj*>(pObj);
- }
+ pTextObj = dynamic_cast<SdrTextObj *>( pObj );
}
}
diff --git a/sd/source/ui/sidebar/MasterPageObserver.cxx b/sd/source/ui/sidebar/MasterPageObserver.cxx
index b103fbaa620c..017a0bcdf991 100644
--- a/sd/source/ui/sidebar/MasterPageObserver.cxx
+++ b/sd/source/ui/sidebar/MasterPageObserver.cxx
@@ -234,14 +234,12 @@ void MasterPageObserver::Implementation::Notify(
// filters out events that are sent in between the insertion
// of a new standard master page and a new notes master
// page.
- if (dynamic_cast< const SdDrawDocument *>( &rBroadcaster ) != nullptr)
+ if (auto pDrawDocument = dynamic_cast<SdDrawDocument *>( &rBroadcaster ))
{
- SdDrawDocument& rDocument (
- static_cast<SdDrawDocument&>(rBroadcaster));
- if (rDocument.GetMasterSdPageCount(PageKind::Standard)
- == rDocument.GetMasterSdPageCount(PageKind::Notes))
+ if (pDrawDocument->GetMasterSdPageCount(PageKind::Standard)
+ == pDrawDocument->GetMasterSdPageCount(PageKind::Notes))
{
- AnalyzeUsedMasterPages (rDocument);
+ AnalyzeUsedMasterPages (*pDrawDocument);
}
}
break;
diff --git a/sd/source/ui/slidesorter/controller/SlsListener.cxx b/sd/source/ui/slidesorter/controller/SlsListener.cxx
index 5c1d58d32390..8f6b0268842f 100644
--- a/sd/source/ui/slidesorter/controller/SlsListener.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsListener.cxx
@@ -287,10 +287,9 @@ void Listener::Notify (
mrController.CheckForMasterPageAssignment();
mrController.CheckForSlideTransitionAssignment();
}
- else if (dynamic_cast<const ViewShellHint*>(&rHint))
+ else if (auto pViewShellHint = dynamic_cast<const ViewShellHint*>(&rHint))
{
- const ViewShellHint& rViewShellHint = static_cast<const ViewShellHint&>(rHint);
- switch (rViewShellHint.GetHintId())
+ switch (pViewShellHint->GetHintId())
{
case ViewShellHint::HINT_PAGE_RESIZE_START:
// Initiate a model change but do nothing (well, not much)
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 1c95cb1820a6..5b2debfcd06e 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -1760,8 +1760,8 @@ static void refreshpage( SdDrawDocument* pDoc, const PageKind ePageKind )
if( !pViewSh )
return;
- if( dynamic_cast<const ::sd::DrawViewShell* >(pViewSh) != nullptr )
- static_cast< ::sd::DrawViewShell*>(pViewSh)->ResetActualPage();
+ if( auto pDrawViewShell = dynamic_cast<::sd::DrawViewShell* >(pViewSh) )
+ pDrawViewShell->ResetActualPage();
Size aPageSize = pDoc->GetSdPage(0, ePageKind)->GetSize();
const long nWidth = aPageSize.Width();
@@ -1891,8 +1891,9 @@ sal_Bool SAL_CALL SdPageLinkTargets::hasElements()
{
SdrObject* pObj = aIter.Next();
OUString aStr( pObj->GetName() );
- if( aStr.isEmpty() && dynamic_cast< const SdrOle2Obj *>( pObj ) != nullptr )
- aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
+ if( aStr.isEmpty() )
+ if (auto pOleObj = dynamic_cast< const SdrOle2Obj *>( pObj ))
+ aStr = pOleObj->GetPersistName();
if( !aStr.isEmpty() )
return true;
}
@@ -1936,8 +1937,9 @@ Sequence< OUString > SAL_CALL SdPageLinkTargets::getElementNames()
{
SdrObject* pObj = aIter.Next();
OUString aStr( pObj->GetName() );
- if( aStr.isEmpty() && dynamic_cast< const SdrOle2Obj *>( pObj ) != nullptr )
- aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
+ if( aStr.isEmpty() )
+ if (auto pOleObj = dynamic_cast< const SdrOle2Obj *>( pObj ))
+ aStr = pOleObj->GetPersistName();
if( !aStr.isEmpty() )
nObjCount++;
}
@@ -1953,8 +1955,9 @@ Sequence< OUString > SAL_CALL SdPageLinkTargets::getElementNames()
{
SdrObject* pObj = aIter.Next();
OUString aStr( pObj->GetName() );
- if( aStr.isEmpty() && dynamic_cast< const SdrOle2Obj *>( pObj ) != nullptr )
- aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
+ if( aStr.isEmpty() )
+ if (auto pOleObj = dynamic_cast< const SdrOle2Obj *>( pObj ))
+ aStr = pOleObj->GetPersistName();
if( !aStr.isEmpty() )
*pStr++ = aStr;
}
@@ -1982,8 +1985,9 @@ SdrObject* SdPageLinkTargets::FindObject( const OUString& rName ) const throw()
{
SdrObject* pObj = aIter.Next();
OUString aStr( pObj->GetName() );
- if( aStr.isEmpty() && dynamic_cast< const SdrOle2Obj *>( pObj ) != nullptr )
- aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
+ if( aStr.isEmpty() )
+ if (auto pOleObj = dynamic_cast< const SdrOle2Obj *>( pObj ))
+ aStr = pOleObj->GetPersistName();
if( !aStr.isEmpty() && (aStr == rName) )
return pObj;
}
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 6f8e5b76d10f..59e740b4bda1 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -355,8 +355,8 @@ bool SdOutliner::SpellNextDocument()
}
else
{
- if( dynamic_cast< const sd::OutlineView *>( mpView ) != nullptr)
- static_cast<sd::OutlineView*>(mpView)->PrepareClose();
+ if( auto pOutlineView = dynamic_cast<sd::OutlineView *>( mpView ))
+ pOutlineView->PrepareClose();
mpDrawDocument->GetDocSh()->SetWaitCursor( true );
Initialize (true);
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index df1091cced75..303ea3355a53 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -234,9 +234,8 @@ ViewShellBase::ViewShellBase (
_pFrame->GetWindow().SetBackground(Application::GetSettings().GetStyleSettings().GetLightColor());
// Set up the members in the correct order.
- if (nullptr != dynamic_cast< DrawDocShell *>( GetViewFrame()->GetObjectShell() ))
- mpDocShell = static_cast<DrawDocShell*>(
- GetViewFrame()->GetObjectShell());
+ if (auto pDrawDocShell = dynamic_cast< DrawDocShell *>( GetViewFrame()->GetObjectShell() ))
+ mpDocShell = pDrawDocShell;
if (mpDocShell != nullptr)
mpDocument = mpDocShell->GetDoc();
mpImpl->mpViewShellManager = std::make_shared<ViewShellManager>(*this);
diff --git a/sd/source/ui/view/drbezob.cxx b/sd/source/ui/view/drbezob.cxx
index 2ab2bc56be3f..c84489042672 100644
--- a/sd/source/ui/view/drbezob.cxx
+++ b/sd/source/ui/view/drbezob.cxx
@@ -88,14 +88,14 @@ void BezierObjectBar::GetAttrState(SfxItemSet& rSet)
if(xFunc.is())
{
- if( nullptr != dynamic_cast< const FuSelection *>( xFunc.get() ))
+ if( auto pFuSelection = dynamic_cast< const FuSelection *>( xFunc.get() ))
{
- sal_uInt16 nEditMode = static_cast<FuSelection*>(xFunc.get())->GetEditMode();
+ sal_uInt16 nEditMode = pFuSelection->GetEditMode();
rSet.Put(SfxBoolItem(nEditMode, true));
}
- else if( nullptr != dynamic_cast< const FuConstructBezierPolygon *>( xFunc.get() ))
+ else if( auto pFuPolygon = dynamic_cast< const FuConstructBezierPolygon *>( xFunc.get() ))
{
- sal_uInt16 nEditMode = static_cast<FuConstructBezierPolygon*>(xFunc.get())->GetEditMode();
+ sal_uInt16 nEditMode = pFuPolygon->GetEditMode();
rSet.Put(SfxBoolItem(nEditMode, true));
}
}
@@ -294,13 +294,13 @@ void BezierObjectBar::Execute(SfxRequest& rReq)
if(xFunc.is())
{
- if( nullptr != dynamic_cast< const FuSelection *>( xFunc.get() ))
+ if( auto pFuSelection = dynamic_cast<FuSelection *>( xFunc.get() ))
{
- static_cast<FuSelection*>(xFunc.get())->SetEditMode(rReq.GetSlot());
+ pFuSelection->SetEditMode(rReq.GetSlot());
}
- else if( nullptr != dynamic_cast< const FuConstructBezierPolygon *>( xFunc.get() ))
+ else if( auto pFuPolygon = dynamic_cast<FuConstructBezierPolygon *>( xFunc.get() ))
{
- static_cast<FuConstructBezierPolygon*>(xFunc.get())->SetEditMode(rReq.GetSlot());
+ pFuPolygon->SetEditMode(rReq.GetSlot());
}
}
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
index cbe8281af0eb..e550a2291f87 100644
--- a/sd/source/ui/view/sdview2.cxx
+++ b/sd/source/ui/view/sdview2.cxx
@@ -775,10 +775,10 @@ sal_Int8 View::ExecuteDrop( const ExecuteDropEvent& rEvt,
nRet = nDropAction;
}
}
- else if( dynamic_cast< const DrawViewShell *>( mpViewSh ) != nullptr )
+ else if( auto pDrawViewShell = dynamic_cast< DrawViewShell *>( mpViewSh ) )
{
// insert as normal URL button
- static_cast<DrawViewShell*>( mpViewSh )->InsertURLButton( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), OUString(), &aPos );
+ pDrawViewShell->InsertURLButton( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), OUString(), &aPos );
nRet = nDropAction;
}
}
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index c3508ec217fc..eca9b996d9dd 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -511,10 +511,9 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
{
ImpRememberOrigAndClone* pRem = &aConnectorContainer[a];
- if(dynamic_cast< const SdrEdgeObj *>( pRem->pClone ) != nullptr)
+ if(auto pCloneEdge = dynamic_cast<SdrEdgeObj *>( pRem->pClone ))
{
SdrEdgeObj* pOrigEdge = static_cast<SdrEdgeObj*>(pRem->pOrig);
- SdrEdgeObj* pCloneEdge = static_cast<SdrEdgeObj*>(pRem->pClone);
// test first connection
SdrObjConnection& rConn0 = pOrigEdge->GetConnection(false);