summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorRüdiger Timm <rt@openoffice.org>2008-07-30 13:11:20 +0000
committerRüdiger Timm <rt@openoffice.org>2008-07-30 13:11:20 +0000
commitf9574978660a1f81f22fd4588b6ba7a18415826d (patch)
tree9333bb0a8168bd2ca62f16c897fc0f01b5472d5e /sd
parent7ebc5b97530fec040aebab0484b109ff80ca31b7 (diff)
INTEGRATION: CWS impress150 (1.9.90); FILE MERGED
2008/07/22 12:52:30 cl 1.9.90.1: #i91932# do not crash if shape has no style
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/docshell/formatclipboard.cxx69
1 files changed, 42 insertions, 27 deletions
diff --git a/sd/source/ui/docshell/formatclipboard.cxx b/sd/source/ui/docshell/formatclipboard.cxx
index f83d840e2e4f..8035e78150c7 100644
--- a/sd/source/ui/docshell/formatclipboard.cxx
+++ b/sd/source/ui/docshell/formatclipboard.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: formatclipboard.cxx,v $
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
* This file is part of OpenOffice.org.
*
@@ -169,38 +169,53 @@ void SdFormatClipboard::Paste( ::sd::View& rDrawView, bool, bool )
{
//modify source itemset
{
- SfxItemSet aTargetSet( pObj->GetStyleSheet()->GetItemSet() );
-
- USHORT nWhich=0;
- SfxItemState nSourceState;
- SfxItemState nTargetState;
- const SfxPoolItem* pSourceItem=0;
- const SfxPoolItem* pTargetItem=0;
- SfxItemIter aSourceIter(*m_pItemSet);
- pSourceItem = aSourceIter.FirstItem();
- while( pSourceItem!=NULL )
+ boost::shared_ptr< SfxItemSet > pTargetSet;
+
+ if( pObj->GetStyleSheet() )
+ {
+ pTargetSet.reset( new SfxItemSet( pObj->GetStyleSheet()->GetItemSet() ) );
+ }
+ else
{
- if (!IsInvalidItem(pSourceItem))
+ SdrModel* pModel = pObj->GetModel();
+ if( pModel )
{
- nWhich = pSourceItem->Which();
- if(nWhich)
+ pTargetSet.reset( new SfxItemSet( pModel->GetItemPool() ) );
+ }
+ }
+
+ if( pTargetSet.get() )
+ {
+ USHORT nWhich=0;
+ SfxItemState nSourceState;
+ SfxItemState nTargetState;
+ const SfxPoolItem* pSourceItem=0;
+ const SfxPoolItem* pTargetItem=0;
+ SfxItemIter aSourceIter(*m_pItemSet);
+ pSourceItem = aSourceIter.FirstItem();
+ while( pSourceItem!=NULL )
+ {
+ if (!IsInvalidItem(pSourceItem))
{
- nSourceState = m_pItemSet->GetItemState( nWhich );
- nTargetState = aTargetSet.GetItemState( nWhich );
- pTargetItem = aTargetSet.GetItem( nWhich );
- ::com::sun::star::uno::Any aSourceValue, aTargetValue;
-
- if(!pTargetItem)
- m_pItemSet->ClearItem(nWhich);
- else if( (*pSourceItem) == (*pTargetItem) )
+ nWhich = pSourceItem->Which();
+ if(nWhich)
{
- //do not set items which have the same content in source and target
- m_pItemSet->ClearItem(nWhich);
+ nSourceState = m_pItemSet->GetItemState( nWhich );
+ nTargetState = pTargetSet->GetItemState( nWhich );
+ pTargetItem = pTargetSet->GetItem( nWhich );
+
+ if(!pTargetItem)
+ m_pItemSet->ClearItem(nWhich);
+ else if( (*pSourceItem) == (*pTargetItem) )
+ {
+ //do not set items which have the same content in source and target
+ m_pItemSet->ClearItem(nWhich);
+ }
}
}
- }
- pSourceItem = aSourceIter.NextItem();
- }//end while
+ pSourceItem = aSourceIter.NextItem();
+ }//end while
+ }
}
BOOL bReplaceAll = TRUE;
rDrawView.SetAttrToMarked(*m_pItemSet, bReplaceAll);