diff options
author | Vladimir Glazunov <vg@openoffice.org> | 2010-05-28 09:14:25 +0200 |
---|---|---|
committer | Vladimir Glazunov <vg@openoffice.org> | 2010-05-28 09:14:25 +0200 |
commit | 026c7e4aa36974f7ce0efeec70011bf745fab4a2 (patch) | |
tree | e48c98483e19a29cc6610781c6975d0338aa568b /oox/source/ppt/pptshape.cxx | |
parent | aa2d6f3360a16f9066e8b83ddcd69e62996a6f53 (diff) | |
parent | cdac63817e9f570ebea893e9c488c198aff3026c (diff) |
CWS-TOOLING: integrate CWS ooxml10
Diffstat (limited to 'oox/source/ppt/pptshape.cxx')
-rw-r--r-- | oox/source/ppt/pptshape.cxx | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index ed53992f944b..eb3b3503452e 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -28,6 +28,7 @@ #include "oox/ppt/pptshape.hxx" #include "oox/core/namespaces.hxx" #include "oox/core/xmlfilterbase.hxx" +#include "oox/drawingml/textbody.hxx" #include "tokens.hxx" #include <com/sun/star/container/XNamed.hpp> @@ -40,6 +41,7 @@ using rtl::OUString; using namespace ::oox::core; +using namespace ::oox::drawingml; using namespace ::com::sun::star; using namespace ::com::sun::star::awt; using namespace ::com::sun::star::uno; @@ -97,6 +99,11 @@ void PPTShape::addShape( { if ( ( meShapeLocation == Master ) || ( meShapeLocation == Layout ) ) sServiceName = rtl::OUString(); + else { + const rtl::OUString sTitleShapeService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.SubtitleShape" ) ); + sServiceName = sTitleShapeService; + aMasterTextListStyle = rSlidePersist.getMasterPersist().get() ? rSlidePersist.getMasterPersist()->getTitleTextStyle() : rSlidePersist.getTitleTextStyle(); + } } break; case XML_obj : @@ -162,6 +169,21 @@ void PPTShape::addShape( } } + // use placeholder index if possible + if( mnSubType && getSubTypeIndex() && rSlidePersist.getMasterPersist().get() ) { + oox::drawingml::ShapePtr pPlaceholder = PPTShape::findPlaceholderByIndex( getSubTypeIndex(), rSlidePersist.getMasterPersist()->getShapes()->getChildren() ); + if( pPlaceholder.get() && pPlaceholder->getTextBody() ) { + TextListStylePtr pNewTextListStyle ( new TextListStyle() ); + + pNewTextListStyle->apply( pPlaceholder->getTextBody()->getTextListStyle() ); + if( pPlaceholder->getMasterTextListStyle().get() ) + pNewTextListStyle->apply( *pPlaceholder->getMasterTextListStyle() ); + + aMasterTextListStyle = pNewTextListStyle; + } + } + + if ( sServiceName.getLength() ) { if ( !aMasterTextListStyle.get() ) @@ -209,4 +231,51 @@ void PPTShape::applyShapeReference( const oox::drawingml::Shape& rReferencedShap Shape::applyShapeReference( rReferencedShape ); } +oox::drawingml::ShapePtr PPTShape::findPlaceholder( const sal_Int32 nMasterPlaceholder, std::vector< oox::drawingml::ShapePtr >& rShapes ) +{ + oox::drawingml::ShapePtr aShapePtr; + std::vector< oox::drawingml::ShapePtr >::reverse_iterator aRevIter( rShapes.rbegin() ); + while( aRevIter != rShapes.rend() ) + { + if ( (*aRevIter)->getSubType() == nMasterPlaceholder ) + { + aShapePtr = *aRevIter; + break; + } + std::vector< oox::drawingml::ShapePtr >& rChildren = (*aRevIter)->getChildren(); + aShapePtr = findPlaceholder( nMasterPlaceholder, rChildren ); + if ( aShapePtr.get() ) + break; + aRevIter++; + } + return aShapePtr; +} + +oox::drawingml::ShapePtr PPTShape::findPlaceholderByIndex( const sal_Int32 nIdx, std::vector< oox::drawingml::ShapePtr >& rShapes ) +{ + oox::drawingml::ShapePtr aShapePtr; + std::vector< oox::drawingml::ShapePtr >::reverse_iterator aRevIter( rShapes.rbegin() ); + while( aRevIter != rShapes.rend() ) + { + if ( (*aRevIter)->getSubTypeIndex() == nIdx ) + { + aShapePtr = *aRevIter; + break; + } + std::vector< oox::drawingml::ShapePtr >& rChildren = (*aRevIter)->getChildren(); + aShapePtr = findPlaceholderByIndex( nIdx, rChildren ); + if ( aShapePtr.get() ) + break; + aRevIter++; + } + return aShapePtr; +} + +// if nFirstPlaceholder can't be found, it will be searched for nSecondPlaceholder +oox::drawingml::ShapePtr PPTShape::findPlaceholder( sal_Int32 nFirstPlaceholder, sal_Int32 nSecondPlaceholder, std::vector< oox::drawingml::ShapePtr >& rShapes ) +{ + oox::drawingml::ShapePtr pPlaceholder = findPlaceholder( nFirstPlaceholder, rShapes ); + return !nSecondPlaceholder || pPlaceholder.get() ? pPlaceholder : findPlaceholder( nSecondPlaceholder, rShapes ); +} + } } |