summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadek Doulik <rodo@novell.com>2011-03-07 16:55:36 +0100
committerRadek Doulik <rodo@novell.com>2011-03-07 17:02:21 +0100
commit01a0954a9be510af6189e0da25e3ce864b614738 (patch)
tree07a2b59b1f007e2b69939c1a95fee547de971e4c
parentc8d770b844ec6a72b3d1f068394da09d3a364525 (diff)
fix placeholder text style n#650026LO-BASE-INTEGRATION-DEV300_M101
- make it inherit style from master text list styles, the style of placeholders living in master slide was not used, in this case the placeholder has body style and should thus use body text style of master slide - also added more debug output related to placeholders to make it easier debug next time
-rw-r--r--oox/inc/oox/drawingml/shape.hxx1
-rw-r--r--oox/inc/oox/ppt/pptshape.hxx2
-rw-r--r--oox/source/ppt/pptshape.cxx85
-rw-r--r--oox/source/ppt/pptshapecontext.cxx19
4 files changed, 100 insertions, 7 deletions
diff --git a/oox/inc/oox/drawingml/shape.hxx b/oox/inc/oox/drawingml/shape.hxx
index 77acee672..099a7afb6 100644
--- a/oox/inc/oox/drawingml/shape.hxx
+++ b/oox/inc/oox/drawingml/shape.hxx
@@ -130,6 +130,7 @@ public:
void setName( const rtl::OUString& rName ) { msName = rName; }
::rtl::OUString getName( ) { return msName; }
void setId( const rtl::OUString& rId ) { msId = rId; }
+ ::rtl::OUString getId() { return msId; }
void setHidden( sal_Bool bHidden ) { mbHidden = bHidden; }
sal_Bool getHidden() const { return mbHidden; };
void setSubType( sal_Int32 nSubType ) { mnSubType = nSubType; }
diff --git a/oox/inc/oox/ppt/pptshape.hxx b/oox/inc/oox/ppt/pptshape.hxx
index c512a8d79..37bd51d64 100644
--- a/oox/inc/oox/ppt/pptshape.hxx
+++ b/oox/inc/oox/ppt/pptshape.hxx
@@ -68,6 +68,8 @@ public:
static oox::drawingml::ShapePtr findPlaceholderByIndex( const sal_Int32 nIdx, std::vector< oox::drawingml::ShapePtr >& rShapes );
static oox::drawingml::ShapePtr findPlaceholder( sal_Int32 nFirstPlaceholder, sal_Int32 nSecondPlaceholder, std::vector< oox::drawingml::ShapePtr >& rShapes );
+ static oox::drawingml::TextListStylePtr getSubTypeTextListStyle( const SlidePersist& rSlidePersist, sal_Int32 nSubType );
+
protected:
oox::drawingml::ShapePtr mpPlaceholder;
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index 2336d2d1e..d88f3d401 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -64,6 +64,61 @@ PPTShape::~PPTShape()
{
}
+static const char* lclDebugSubType( sal_Int32 nType )
+{
+ switch (nType) {
+ case XML_ctrTitle :
+ return "ctrTitle";
+ case XML_title :
+ return "title";
+ case XML_subTitle :
+ return "subTitle";
+ case XML_obj :
+ return "obj";
+ case XML_body :
+ return "body";
+ case XML_dt :
+ return "dt";
+ case XML_hdr :
+ return "hdr";
+ case XML_ftr :
+ return "frt";
+ case XML_sldNum :
+ return "sldNum";
+ case XML_sldImg :
+ return "sldImg";
+ }
+
+ return "unknown - please extend lclDebugSubType";
+}
+
+oox::drawingml::TextListStylePtr PPTShape::getSubTypeTextListStyle( const SlidePersist& rSlidePersist, sal_Int32 nSubType )
+{
+ oox::drawingml::TextListStylePtr pTextListStyle;
+
+ OSL_TRACE( "subtype style: %s", lclDebugSubType( nSubType ) );
+
+ switch( nSubType )
+ {
+ case XML_ctrTitle :
+ case XML_title :
+ case XML_subTitle :
+ pTextListStyle = rSlidePersist.getMasterPersist().get() ? rSlidePersist.getMasterPersist()->getTitleTextStyle() : rSlidePersist.getTitleTextStyle();
+ break;
+ case XML_obj :
+ pTextListStyle = rSlidePersist.getMasterPersist().get() ? rSlidePersist.getMasterPersist()->getBodyTextStyle() : rSlidePersist.getBodyTextStyle();
+ break;
+ case XML_body :
+ if ( rSlidePersist.isNotesPage() )
+ pTextListStyle = rSlidePersist.getMasterPersist().get() ? rSlidePersist.getMasterPersist()->getNotesTextStyle() : rSlidePersist.getNotesTextStyle();
+ else
+ pTextListStyle = rSlidePersist.getMasterPersist().get() ? rSlidePersist.getMasterPersist()->getBodyTextStyle() : rSlidePersist.getBodyTextStyle();
+ break;
+ }
+
+ return pTextListStyle;
+}
+
void PPTShape::addShape(
const oox::core::XmlFilterBase& rFilterBase,
const SlidePersist& rSlidePersist,
@@ -72,6 +127,7 @@ void PPTShape::addShape(
const awt::Rectangle* pShapeRect,
::oox::drawingml::ShapeIdMap* pShapeMap )
{
+ OSL_TRACE("add shape id: %s location: %s", rtl::OUStringToOString(msId, RTL_TEXTENCODING_UTF8 ).getStr(), meShapeLocation == Master ? "master" : meShapeLocation == Slide ? "slide" : "other");
// only placeholder from layout are being inserted
if ( mnSubType && ( meShapeLocation == Master ) )
return;
@@ -179,19 +235,44 @@ void PPTShape::addShape(
// use placeholder index if possible
if( mnSubType && getSubTypeIndex() && getSubTypeIndex() != -1 && rSlidePersist.getMasterPersist().get() ) {
oox::drawingml::ShapePtr pPlaceholder = PPTShape::findPlaceholderByIndex( getSubTypeIndex(), rSlidePersist.getMasterPersist()->getShapes()->getChildren() );
+ if( pPlaceholder.get()) {
+ OSL_TRACE("found placeholder with index: %d and type: %s", getSubTypeIndex(), lclDebugSubType( mnSubType ));
+ }
if( pPlaceholder.get() ) {
+ PPTShape* pPPTPlaceholder = dynamic_cast< PPTShape* >( pPlaceholder.get() );
+ TextListStylePtr pNewTextListStyle ( new TextListStyle() );
+
if( pPlaceholder->getTextBody() ) {
- TextListStylePtr pNewTextListStyle ( new TextListStyle() );
pNewTextListStyle->apply( pPlaceholder->getTextBody()->getTextListStyle() );
if( pPlaceholder->getMasterTextListStyle().get() )
pNewTextListStyle->apply( *pPlaceholder->getMasterTextListStyle() );
-
+
+ // OSL_TRACE("placeholder body style");
+ // pPlaceholder->getTextBody()->getTextListStyle().dump();
+ // OSL_TRACE("master text list style");
+ // pPlaceholder->getMasterTextListStyle()->dump();
+
aMasterTextListStyle = pNewTextListStyle;
}
+ if( pPPTPlaceholder->mpPlaceholder.get() ) {
+ OSL_TRACE("placeholder has parent placeholder: %s type: %s index: %d",
+ rtl::OUStringToOString( pPPTPlaceholder->mpPlaceholder->getId(), RTL_TEXTENCODING_UTF8 ).getStr(),
+ lclDebugSubType( pPPTPlaceholder->mpPlaceholder->getSubType() ),
+ pPPTPlaceholder->mpPlaceholder->getSubTypeIndex() );
+ OSL_TRACE("has textbody %d", pPPTPlaceholder->mpPlaceholder->getTextBody() != NULL );
+ TextListStylePtr pPlaceholderStyle = getSubTypeTextListStyle( rSlidePersist, pPPTPlaceholder->mpPlaceholder->getSubType() );
+ if( pPPTPlaceholder->mpPlaceholder->getTextBody() )
+ pNewTextListStyle->apply( pPPTPlaceholder->mpPlaceholder->getTextBody()->getTextListStyle() );
+ if( pPlaceholderStyle.get() ) {
+ pNewTextListStyle->apply( *pPlaceholderStyle );
+ //pPlaceholderStyle->dump();
+ }
+ }
} else if( !mpPlaceholder.get() ) {
aMasterTextListStyle.reset();
}
+ OSL_TRACE("placeholder id: %s", pPlaceholder.get() ? rtl::OUStringToOString(pPlaceholder->getId(), RTL_TEXTENCODING_UTF8 ).getStr() : "not found");
}
if ( sServiceName.getLength() )
diff --git a/oox/source/ppt/pptshapecontext.cxx b/oox/source/ppt/pptshapecontext.cxx
index d8fc780aa..a6c3b132f 100644
--- a/oox/source/ppt/pptshapecontext.cxx
+++ b/oox/source/ppt/pptshapecontext.cxx
@@ -168,21 +168,30 @@ Reference< XFastContextHandler > PPTShapeContext::createFastChildContext( sal_In
{
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() );
+ {
+ pPlaceholder = PPTShape::findPlaceholderByIndex( pPPTShapePtr->getSubTypeIndex(), mpSlidePersistPtr->getShapes()->getChildren() );
+ if ( !pPlaceholder.get() )
+ pPlaceholder = findPlaceholder( nFirstPlaceholder, nSecondPlaceholder, pPPTShapePtr->getSubTypeIndex(),
+ 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 ( pMasterPersist.get() ) {
+ pPlaceholder = PPTShape::findPlaceholderByIndex( pPPTShapePtr->getSubTypeIndex(), pMasterPersist->getShapes()->getChildren() );
+ if ( !pPlaceholder.get() )
+ pPlaceholder = findPlaceholder( nFirstPlaceholder, nSecondPlaceholder,
+ pPPTShapePtr->getSubTypeIndex(), pMasterPersist->getShapes()->getChildren() );
+ }
}
if ( pPlaceholder.get() )
{
+ OSL_TRACE("shape %s will get shape reference %s applied", rtl::OUStringToOString(mpShapePtr->getId(), RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString(pPlaceholder->getId(), RTL_TEXTENCODING_UTF8 ).getStr());
mpShapePtr->applyShapeReference( *pPlaceholder.get() );
PPTShape* pPPTShape = dynamic_cast< PPTShape* >( pPlaceholder.get() );
if ( pPPTShape )
pPPTShape->setReferenced( sal_True );
- pPPTShapePtr->setPlaceholder( pPlaceholder );
+ pPPTShapePtr->setPlaceholder( pPlaceholder );
}
}
}