summaryrefslogtreecommitdiff
path: root/oox/source/ppt/pptshape.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'oox/source/ppt/pptshape.cxx')
-rw-r--r--oox/source/ppt/pptshape.cxx69
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 );
+}
+
} }