[Libreoffice-commits] core.git: sw/source
Jan Holesovsky
kendy at collabora.com
Fri Jul 15 09:41:06 UTC 2016
sw/source/uibase/utlui/content.cxx | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
New commits:
commit 8969af9e29bff94708093ac1a8dc15d5ef9c480b
Author: Jan Holesovsky <kendy at collabora.com>
Date: Fri Jul 15 10:44:32 2016 +0200
Simplify dynamic_cast followed by a static_cast.
Change-Id: I4bf7f85397f83554f511f80621b5086cda6ab1a9
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index abe568f..31e2d55 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -394,18 +394,17 @@ void SwContentType::Init(bool* pbInvalidateWindow)
{
for(SwPostItMgr::const_iterator i = aMgr->begin(); i != aMgr->end(); ++i)
{
- if ( dynamic_cast< const SwFormatField *>( (*i)->GetBroadCaster() ) != nullptr ) // SwPostit
+ if (const SwFormatField* pFormatField = dynamic_cast<const SwFormatField *>((*i)->GetBroadCaster())) // SwPostit
{
- const SwFormatField* aFormatField = static_cast<const SwFormatField*>((*i)->GetBroadCaster());
- if (aFormatField->GetTextField() && aFormatField->IsFieldInDoc() &&
+ if (pFormatField->GetTextField() && pFormatField->IsFieldInDoc() &&
(*i)->mLayoutStatus!=SwPostItHelper::INVISIBLE )
{
- OUString sEntry = aFormatField->GetField()->GetPar2();
+ OUString sEntry = pFormatField->GetField()->GetPar2();
sEntry = RemoveNewline(sEntry);
SwPostItContent* pCnt = new SwPostItContent(
this,
sEntry,
- aFormatField,
+ pFormatField,
nMemberCount);
pMember->insert(pCnt);
nMemberCount++;
@@ -508,8 +507,7 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged)
// with the same number and existing "pOldMember" the
// old one is compared with the new OutlinePos.
// cast for Win16
- if (nOldMemberCount > nPos &&
- static_cast<SwOutlineContent*>((*pOldMember)[nPos])->GetOutlineLevel() != nLevel)
+ if (nOldMemberCount > nPos && static_cast<SwOutlineContent*>((*pOldMember)[nPos])->GetOutlineLevel() != nLevel)
*pbLevelOrVisibilityChanged = true;
nPos++;
@@ -699,18 +697,17 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged)
{
for(SwPostItMgr::const_iterator i = aMgr->begin(); i != aMgr->end(); ++i)
{
- if ( dynamic_cast< const SwFormatField *>( (*i)->GetBroadCaster() ) != nullptr ) // SwPostit
+ if (const SwFormatField* pFormatField = dynamic_cast<const SwFormatField *>((*i)->GetBroadCaster())) // SwPostit
{
- const SwFormatField* aFormatField = static_cast<const SwFormatField*>((*i)->GetBroadCaster());
- if (aFormatField->GetTextField() && aFormatField->IsFieldInDoc() &&
+ if (pFormatField->GetTextField() && pFormatField->IsFieldInDoc() &&
(*i)->mLayoutStatus!=SwPostItHelper::INVISIBLE )
{
- OUString sEntry = aFormatField->GetField()->GetPar2();
+ OUString sEntry = pFormatField->GetField()->GetPar2();
sEntry = RemoveNewline(sEntry);
SwPostItContent* pCnt = new SwPostItContent(
this,
sEntry,
- aFormatField,
+ pFormatField,
nMemberCount);
pMember->insert(pCnt);
nMemberCount++;
@@ -1111,8 +1108,7 @@ VclPtr<PopupMenu> SwContentTree::CreateContextMenu()
pSubPop2->InsertItem( i + 201, m_aContextStrings[
STR_HYPERLINK - STR_CONTEXT_FIRST + i]);
}
- pSubPop2->CheckItem( 201 +
- static_cast<int>(GetParentWindow()->GetRegionDropMode()));
+ pSubPop2->CheckItem(201 + static_cast<int>(GetParentWindow()->GetRegionDropMode()));
// Insert the list of the open files
sal_uInt16 nId = 301;
const SwView* pActiveView = ::GetActiveView();
@@ -2208,8 +2204,7 @@ void SwContentTree::Notify(SfxBroadcaster & rBC, SfxHint const& rHint)
return;
}
- SfxViewEventHint const*const pVEHint(
- dynamic_cast<SfxViewEventHint const*>(&rHint));
+ SfxViewEventHint const*const pVEHint(dynamic_cast<SfxViewEventHint const*>(&rHint));
SwXTextView* pDyingShell = nullptr;
if (m_pActiveShell && pVEHint && pVEHint->GetEventName() == "OnViewClosed")
pDyingShell = dynamic_cast<SwXTextView*>(pVEHint->GetController().get());
More information about the Libreoffice-commits
mailing list