diff options
author | sj <sj@openoffice.org> | 2010-06-30 13:51:07 +0200 |
---|---|---|
committer | sj <sj@openoffice.org> | 2010-06-30 13:51:07 +0200 |
commit | f22687dd640b780ef17d00969c9918e0f073502d (patch) | |
tree | d5566abc64acecb09c3391f630f2c43e867d8507 /oox/source/ppt | |
parent | 33750471297793a14d19f783208f7d8019903570 (diff) |
impress193: #i112792,i112794# fixed crash (resulting from merge conflict), fixed zero sized/placed placeholder objects
Diffstat (limited to 'oox/source/ppt')
-rw-r--r-- | oox/source/ppt/pptshapecontext.cxx | 197 |
1 files changed, 90 insertions, 107 deletions
diff --git a/oox/source/ppt/pptshapecontext.cxx b/oox/source/ppt/pptshapecontext.cxx index 86e254088041..01681b6b404a 100644 --- a/oox/source/ppt/pptshapecontext.cxx +++ b/oox/source/ppt/pptshapecontext.cxx @@ -100,124 +100,107 @@ Reference< XFastContextHandler > PPTShapeContext::createFastChildContext( sal_In switch( aElementToken ) { - // nvSpPr CT_ShapeNonVisual begin -// case NMSP_PPT|XML_drElemPr: -// break; - case NMSP_PPT|XML_cNvPr: - mpShapePtr->setId( xAttribs->getOptionalValue( XML_id ) ); - mpShapePtr->setName( xAttribs->getOptionalValue( XML_name ) ); - break; - case NMSP_PPT|XML_ph: - { - sal_Int32 nSubType( xAttribs->getOptionalValueToken( XML_type, XML_obj ) ); - mpShapePtr->setSubType( nSubType ); - OUString sIdx( xAttribs->getOptionalValue( XML_idx ) ); - sal_Bool bHasIdx = sIdx.getLength() > 0; - sal_Int32 nIdx = sIdx.toInt32(); - mpShapePtr->setSubTypeIndex( nIdx ); - - if ( nSubType || bHasIdx ) + // nvSpPr CT_ShapeNonVisual begin + // case NMSP_PPT|XML_drElemPr: + // break; + case NMSP_PPT|XML_cNvPr: + mpShapePtr->setId( xAttribs->getOptionalValue( XML_id ) ); + mpShapePtr->setName( xAttribs->getOptionalValue( XML_name ) ); + break; + case NMSP_PPT|XML_ph: { - PPTShape* pPPTShapePtr = dynamic_cast< PPTShape* >( mpShapePtr.get() ); - if ( pPPTShapePtr ) + sal_Int32 nSubType( xAttribs->getOptionalValueToken( XML_type, XML_obj ) ); + mpShapePtr->setSubType( nSubType ); + mpShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() ); + if ( nSubType ) { - oox::ppt::ShapeLocation eShapeLocation = pPPTShapePtr->getShapeLocation(); - oox::drawingml::ShapePtr pPlaceholder; - - if ( bHasIdx && eShapeLocation == Slide ) + PPTShape* pPPTShapePtr = dynamic_cast< PPTShape* >( mpShapePtr.get() ); + if ( pPPTShapePtr ) { - // TODO: use id to shape map - SlidePersistPtr pMasterPersist( mpSlidePersistPtr->getMasterPersist() ); - if ( pMasterPersist.get() ) - pPlaceholder = PPTShape::findPlaceholderByIndex( nIdx, pMasterPersist->getShapes()->getChildren() ); - } - if ( !pPlaceholder.get() && ( ( eShapeLocation == Slide ) || ( eShapeLocation == Layout ) ) ) - { - // inheriting properties from placeholder objects by cloning shape - - sal_Int32 nFirstPlaceholder = 0; - sal_Int32 nSecondPlaceholder = 0; - switch( nSubType ) + oox::ppt::ShapeLocation eShapeLocation = pPPTShapePtr->getShapeLocation(); + if ( ( eShapeLocation == Slide ) || ( eShapeLocation == Layout ) ) { - case XML_ctrTitle : // slide/layout - nFirstPlaceholder = XML_ctrTitle; - nSecondPlaceholder = XML_title; - break; - case XML_subTitle : // slide/layout - nFirstPlaceholder = XML_subTitle; - nSecondPlaceholder = XML_title; - break; - case XML_obj : // slide/layout - nFirstPlaceholder = XML_obj; - nSecondPlaceholder = XML_body; - break; - case XML_dt : // slide/layout/master/notes/notesmaster/handoutmaster - case XML_sldNum : // slide/layout/master/notes/notesmaster/handoutmaster - case XML_ftr : // slide/layout/master/notes/notesmaster/handoutmaster - case XML_hdr : // notes/notesmaster/handoutmaster - case XML_body : // slide/layout/master/notes/notesmaster - case XML_title : // slide/layout/master/ - case XML_chart : // slide/layout - case XML_tbl : // slide/layout - case XML_clipArt : // slide/layout - case XML_dgm : // slide/layout - case XML_media : // slide/layout - case XML_sldImg : // notes/notesmaster - case XML_pic : // slide/layout - nFirstPlaceholder = nSubType; - default: - break; - } - if ( nFirstPlaceholder ) - { - if ( eShapeLocation == Layout ) // for layout objects the referenced object can be found within the same shape tree - pPlaceholder = findPlaceholder( nFirstPlaceholder, nSecondPlaceholder, -1, mpSlidePersistPtr->getShapes()->getChildren() ); - else if ( eShapeLocation == Slide ) // normal slide shapes have to search within the corresponding master tree for referenced objects + // inheriting properties from placeholder objects by cloning shape + sal_Int32 nFirstPlaceholder = 0; + sal_Int32 nSecondPlaceholder = 0; + switch( nSubType ) { - SlidePersistPtr pMasterPersist( mpSlidePersistPtr->getMasterPersist() ); - if ( pMasterPersist.get() ) - pPlaceholder = findPlaceholder( nFirstPlaceholder, nSecondPlaceholder, - pPPTShapePtr->getSubTypeIndex(), pMasterPersist->getShapes()->getChildren() ); - } - if ( pPlaceholder.get() ) - { - mpShapePtr->applyShapeReference( *pPlaceholder.get() ); - PPTShape* pPPTShape = dynamic_cast< PPTShape* >( pPlaceholder.get() ); - if ( pPPTShape ) - pPPTShape->setReferenced( sal_True ); + case XML_ctrTitle : // slide/layout + nFirstPlaceholder = XML_ctrTitle; + nSecondPlaceholder = XML_title; + break; + + case XML_subTitle : // slide/layout + nFirstPlaceholder = XML_subTitle; + nSecondPlaceholder = XML_title; + break; + + case XML_obj : // slide/layout + nFirstPlaceholder = XML_obj; + nSecondPlaceholder = XML_body; + break; + + case XML_dt : // slide/layout/master/notes/notesmaster/handoutmaster + case XML_sldNum : // slide/layout/master/notes/notesmaster/handoutmaster + case XML_ftr : // slide/layout/master/notes/notesmaster/handoutmaster + case XML_hdr : // notes/notesmaster/handoutmaster + case XML_body : // slide/layout/master/notes/notesmaster + case XML_title : // slide/layout/master/ + case XML_chart : // slide/layout + case XML_tbl : // slide/layout + case XML_clipArt : // slide/layout + case XML_dgm : // slide/layout + case XML_media : // slide/layout + case XML_sldImg : // notes/notesmaster + case XML_pic : // slide/layout + nFirstPlaceholder = nSubType; + default: + break; } + if ( nFirstPlaceholder ) + { + oox::drawingml::ShapePtr pPlaceholder; + if ( eShapeLocation == Layout ) // for layout objects the referenced object can be found within the same shape tree + pPlaceholder = findPlaceholder( nFirstPlaceholder, nSecondPlaceholder, -1, mpSlidePersistPtr->getShapes()->getChildren() ); + else if ( eShapeLocation == Slide ) // normal slide shapes have to search within the corresponding master tree for referenced objects + { + SlidePersistPtr pMasterPersist( mpSlidePersistPtr->getMasterPersist() ); + if ( pMasterPersist.get() ) + pPlaceholder = findPlaceholder( nFirstPlaceholder, nSecondPlaceholder, + pPPTShapePtr->getSubTypeIndex(), pMasterPersist->getShapes()->getChildren() ); + } + if ( pPlaceholder.get() ) + { + mpShapePtr->applyShapeReference( *pPlaceholder.get() ); + PPTShape* pPPTShape = dynamic_cast< PPTShape* >( pPlaceholder.get() ); + if ( pPPTShape ) + pPPTShape->setReferenced( sal_True ); + } + } } - } - if ( pPlaceholder.get() ) - { - mpShapePtr->applyShapeReference( *pPlaceholder.get() ); - PPTShape* pPPTShape = dynamic_cast< PPTShape* >( pPlaceholder.get() ); - if ( pPPTShape ) - pPPTShape->setReferenced( sal_True ); - pPPTShapePtr->setPlaceholder( pPlaceholder ); - } - } + } + } + break; } - break; - } - // nvSpPr CT_ShapeNonVisual end - case NMSP_PPT|XML_spPr: - xRet = new PPTShapePropertiesContext( *this, *mpShapePtr ); - break; + // nvSpPr CT_ShapeNonVisual end - case NMSP_PPT|XML_style: - xRet = new oox::drawingml::ShapeStyleContext( *this, *mpShapePtr ); - break; + case NMSP_PPT|XML_spPr: + xRet = new PPTShapePropertiesContext( *this, *mpShapePtr ); + break; - case NMSP_PPT|XML_txBody: - { - oox::drawingml::TextBodyPtr xTextBody( new oox::drawingml::TextBody ); - xTextBody->getTextProperties().maPropertyMap[ PROP_FontIndependentLineSpacing ] <<= static_cast< sal_Bool >( sal_True ); - mpShapePtr->setTextBody( xTextBody ); - xRet = new oox::drawingml::TextBodyContext( *this, *xTextBody ); - break; - } + case NMSP_PPT|XML_style: + xRet = new oox::drawingml::ShapeStyleContext( *this, *mpShapePtr ); + break; + + case NMSP_PPT|XML_txBody: + { + oox::drawingml::TextBodyPtr xTextBody( new oox::drawingml::TextBody ); + xTextBody->getTextProperties().maPropertyMap[ PROP_FontIndependentLineSpacing ] <<= static_cast< sal_Bool >( sal_True ); + mpShapePtr->setTextBody( xTextBody ); + xRet = new oox::drawingml::TextBodyContext( *this, *xTextBody ); + break; + } } if( !xRet.is() ) |