[Libreoffice-commits] core.git: sw/source
Jan Holesovsky
kendy at collabora.com
Wed Jul 20 17:35:57 UTC 2016
sw/source/uibase/uiview/viewdraw.cxx | 9 ++++-----
sw/source/uibase/uno/unoatxt.cxx | 7 +++----
2 files changed, 7 insertions(+), 9 deletions(-)
New commits:
commit 356456a8573b16838ac84ef11a4a084f4be36099
Author: Jan Holesovsky <kendy at collabora.com>
Date: Wed Jul 20 19:16:40 2016 +0200
Simplify dynamic_cast followed by a static_cast.
Change-Id: I288f947fa74fd246dd07dd709fc8c20f72d89f86
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index 2ab98fe..d5dcb93 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -102,10 +102,10 @@ void SwView::ExecDraw(SfxRequest& rReq)
}
}
}
- else if( nSlotId == SID_FM_CREATE_FIELDCONTROL)
+ else if (nSlotId == SID_FM_CREATE_FIELDCONTROL)
{
- FmFormView* pFormView = dynamic_cast<FmFormView*>( pSdrView );
- if ( pFormView )
+ FmFormView* pFormView = dynamic_cast<FmFormView*>(pSdrView);
+ if (pFormView)
{
const SfxUnoAnyItem* pDescriptorItem = rReq.GetArg<SfxUnoAnyItem>(SID_FM_DATACCESS_DESCRIPTOR);
OSL_ENSURE( pDescriptorItem, "SwView::ExecDraw(SID_FM_CREATE_FIELDCONTROL): invalid request args!" );
@@ -541,9 +541,8 @@ bool SwView::BeginTextEdit(SdrObject* pObj, SdrPageView* pPV, vcl::Window* pWin,
// OutlinerView.
Point aNewTextEditOffset(0, 0);
- if(dynamic_cast< const SwDrawVirtObj *>( pObj ) != nullptr)
+ if (SwDrawVirtObj* pVirtObj = dynamic_cast<SwDrawVirtObj *>(pObj))
{
- SwDrawVirtObj* pVirtObj = static_cast<SwDrawVirtObj*>(pObj);
pToBeActivated = &const_cast<SdrObject&>(pVirtObj->GetReferencedObj());
aNewTextEditOffset = pVirtObj->GetOffset();
}
diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx
index 7b6ef86..21ff39b 100644
--- a/sw/source/uibase/uno/unoatxt.cxx
+++ b/sw/source/uibase/uno/unoatxt.cxx
@@ -763,8 +763,7 @@ void SwXAutoTextEntry::Notify( SfxBroadcaster& _rBC, const SfxHint& _rHint )
{
if ( &_rBC == &xDocSh )
{ // it's our document
- const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>( &_rHint );
- if ( pSimpleHint )
+ if (const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&_rHint))
{
if ( SFX_HINT_DEINITIALIZING == pSimpleHint->GetId() )
{
@@ -776,9 +775,9 @@ void SwXAutoTextEntry::Notify( SfxBroadcaster& _rBC, const SfxHint& _rHint )
xDocSh.Clear();
}
}
- else if(dynamic_cast<const SfxEventHint*>(&_rHint))
+ else if (const SfxEventHint* pEventHint = dynamic_cast<const SfxEventHint*>(&_rHint))
{
- if(SFX_EVENT_PREPARECLOSEDOC == static_cast< const SfxEventHint& >( _rHint ).GetEventId())
+ if (SFX_EVENT_PREPARECLOSEDOC == pEventHint->GetEventId())
{
implFlushDocument();
xBodyText = nullptr;
More information about the Libreoffice-commits
mailing list