summaryrefslogtreecommitdiff
path: root/svx/source/svdraw/svdmodel.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-06 12:47:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-06 14:20:06 +0200
commitbfc298d02ca6275588d5897d97ced9498a3e91aa (patch)
tree45f290e8a753a2e382b940ed7f3c43b2bac959cd /svx/source/svdraw/svdmodel.cxx
parentee9cb297c583cb5a2e6ed388af31fffc79f282ca (diff)
loplugin:flatten in svx/svdraw
Change-Id: I8379e5ebaee2090d2b4dbd05d55b55000915cd7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100233 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/svdraw/svdmodel.cxx')
-rw-r--r--svx/source/svdraw/svdmodel.cxx116
1 files changed, 58 insertions, 58 deletions
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index ccab4da45a4a..c3afe2ccb352 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -388,24 +388,24 @@ void SdrModel::Repeat(SfxRepeatTarget& rView)
void SdrModel::ImpPostUndoAction(std::unique_ptr<SdrUndoAction> pUndo)
{
DBG_ASSERT( mpImpl->mpUndoManager == nullptr, "svx::SdrModel::ImpPostUndoAction(), method not supported with application undo manager!" );
- if( IsUndoEnabled() )
+ if( !IsUndoEnabled() )
+ return;
+
+ if (m_aUndoLink)
{
- if (m_aUndoLink)
- {
- m_aUndoLink(std::move(pUndo));
- }
- else
+ m_aUndoLink(std::move(pUndo));
+ }
+ else
+ {
+ if (!m_pUndoStack)
+ m_pUndoStack.reset(new std::deque<std::unique_ptr<SfxUndoAction>>);
+ m_pUndoStack->emplace_front(std::move(pUndo));
+ while (m_pUndoStack->size()>m_nMaxUndoCount)
{
- if (!m_pUndoStack)
- m_pUndoStack.reset(new std::deque<std::unique_ptr<SfxUndoAction>>);
- m_pUndoStack->emplace_front(std::move(pUndo));
- while (m_pUndoStack->size()>m_nMaxUndoCount)
- {
- m_pUndoStack->pop_back();
- }
- if (m_pRedoStack!=nullptr)
- m_pRedoStack->clear();
+ m_pUndoStack->pop_back();
}
+ if (m_pRedoStack!=nullptr)
+ m_pRedoStack->clear();
}
}
@@ -1730,55 +1730,55 @@ void SdrModel::setLock( bool bLock )
void SdrModel::MigrateItemSet( const SfxItemSet* pSourceSet, SfxItemSet* pDestSet, SdrModel* pNewModelel )
{
assert(pNewModelel != nullptr);
- if( pSourceSet && pDestSet && (pSourceSet != pDestSet ) )
- {
- SfxWhichIter aWhichIter(*pSourceSet);
- sal_uInt16 nWhich(aWhichIter.FirstWhich());
- const SfxPoolItem *pPoolItem;
+ if( !(pSourceSet && pDestSet && (pSourceSet != pDestSet )) )
+ return;
+
+ SfxWhichIter aWhichIter(*pSourceSet);
+ sal_uInt16 nWhich(aWhichIter.FirstWhich());
+ const SfxPoolItem *pPoolItem;
- while(nWhich)
+ while(nWhich)
+ {
+ if(SfxItemState::SET == pSourceSet->GetItemState(nWhich, false, &pPoolItem))
{
- if(SfxItemState::SET == pSourceSet->GetItemState(nWhich, false, &pPoolItem))
- {
- std::unique_ptr<SfxPoolItem> pResultItem;
+ std::unique_ptr<SfxPoolItem> pResultItem;
- switch( nWhich )
- {
- case XATTR_FILLBITMAP:
- pResultItem = static_cast<const XFillBitmapItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- case XATTR_LINEDASH:
- pResultItem = static_cast<const XLineDashItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- case XATTR_LINESTART:
- pResultItem = static_cast<const XLineStartItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- case XATTR_LINEEND:
- pResultItem = static_cast<const XLineEndItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- case XATTR_FILLGRADIENT:
- pResultItem = static_cast<const XFillGradientItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- case XATTR_FILLFLOATTRANSPARENCE:
- // allow all kinds of XFillFloatTransparenceItem to be set
- pResultItem = static_cast<const XFillFloatTransparenceItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- case XATTR_FILLHATCH:
- pResultItem = static_cast<const XFillHatchItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- }
+ switch( nWhich )
+ {
+ case XATTR_FILLBITMAP:
+ pResultItem = static_cast<const XFillBitmapItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ case XATTR_LINEDASH:
+ pResultItem = static_cast<const XLineDashItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ case XATTR_LINESTART:
+ pResultItem = static_cast<const XLineStartItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ case XATTR_LINEEND:
+ pResultItem = static_cast<const XLineEndItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ case XATTR_FILLGRADIENT:
+ pResultItem = static_cast<const XFillGradientItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ case XATTR_FILLFLOATTRANSPARENCE:
+ // allow all kinds of XFillFloatTransparenceItem to be set
+ pResultItem = static_cast<const XFillFloatTransparenceItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ case XATTR_FILLHATCH:
+ pResultItem = static_cast<const XFillHatchItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ }
- // set item
- if( pResultItem )
- {
- pDestSet->Put(*pResultItem);
- pResultItem.reset();
- }
- else
- pDestSet->Put(*pPoolItem);
+ // set item
+ if( pResultItem )
+ {
+ pDestSet->Put(*pResultItem);
+ pResultItem.reset();
}
- nWhich = aWhichIter.NextWhich();
+ else
+ pDestSet->Put(*pPoolItem);
}
+ nWhich = aWhichIter.NextWhich();
}
}