summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-02-19 13:01:03 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-02-19 13:01:03 +0100
commitd861cda209ec697aaa96d2d722f67a50b9283d20 (patch)
treeb274292459e73c04abf1ac56fd7b88ed60ff1319 /sw/source/core/unocore
parent0d16f5fa42b9b7f734ee626a30fed79e0e6366bc (diff)
dba33f: #i108572# SwXShape::AddExistingShapeToFmt: allow for the given SdrObject to be an object list, and iterate over all elements
Diffstat (limited to 'sw/source/core/unocore')
-rw-r--r--sw/source/core/unocore/unodraw.cxx42
1 files changed, 26 insertions, 16 deletions
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 2511dfadb591..f7249cc7e352 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -42,6 +42,7 @@
#include <unotextrange.hxx>
#include <unoprnms.hxx>
#include <svx/unoprnms.hxx>
+#include <svx/svditer.hxx>
#include <swunohelper.hxx>
#include <doc.hxx>
#include <fmtcntnt.hxx>
@@ -1055,25 +1056,34 @@ SwXShape::SwXShape(uno::Reference< uno::XInterface > & xShape) :
-----------------------------------------------------------------------*/
void SwXShape::AddExistingShapeToFmt( SdrObject& _rObj )
{
- SwXShape* pSwShape = NULL;
- uno::Reference< lang::XUnoTunnel > xShapeTunnel( _rObj.getWeakUnoShape(), uno::UNO_QUERY );
- if ( xShapeTunnel.is() )
- pSwShape = reinterpret_cast< SwXShape * >(
- sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething( SwXShape::getUnoTunnelId() ) ) );
- if ( pSwShape )
+ SdrObjListIter aIter( _rObj, IM_DEEPNOGROUPS );
+ while ( aIter.IsMore() )
{
- if ( pSwShape->m_bDescriptor )
- {
- SwFrmFmt* pFmt = ::FindFrmFmt( &const_cast< SdrObject& >( _rObj ) );
- if ( pFmt )
- pFmt->Add( pSwShape );
- pSwShape->m_bDescriptor = sal_False;
- }
+ SdrObject* pCurrent = aIter.Next();
+ OSL_ENSURE( pCurrent, "SwXShape::AddExistingShapeToFmt: invalid object list element!" );
+ if ( !pCurrent )
+ continue;
- if ( !pSwShape->pImpl->bInitializedPropertyNotifier )
+ SwXShape* pSwShape = NULL;
+ uno::Reference< lang::XUnoTunnel > xShapeTunnel( pCurrent->getWeakUnoShape(), uno::UNO_QUERY );
+ if ( xShapeTunnel.is() )
+ pSwShape = reinterpret_cast< SwXShape * >(
+ sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething( SwXShape::getUnoTunnelId() ) ) );
+ if ( pSwShape )
{
- lcl_addShapePropertyEventFactories( _rObj, *pSwShape );
- pSwShape->pImpl->bInitializedPropertyNotifier = true;
+ if ( pSwShape->m_bDescriptor )
+ {
+ SwFrmFmt* pFmt = ::FindFrmFmt( const_cast< SdrObject* >( pCurrent ) );
+ if ( pFmt )
+ pFmt->Add( pSwShape );
+ pSwShape->m_bDescriptor = sal_False;
+ }
+
+ if ( !pSwShape->pImpl->bInitializedPropertyNotifier )
+ {
+ lcl_addShapePropertyEventFactories( *pCurrent, *pSwShape );
+ pSwShape->pImpl->bInitializedPropertyNotifier = true;
+ }
}
}
}