summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
authorMuthu Subramanian <sumuthu@suse.com>2012-07-04 20:56:47 +0530
committerMuthu Subramanian K <sumuthu@suse.com>2012-10-13 13:20:51 +0530
commit3dd5267d1808180a65f9e401caad791cf3870ac0 (patch)
tree685ac623f09892de0869c09a467db056cdfa18c5 /oox/source
parent898e6f94e595a53f6b6fcc22e8702a7357f76a32 (diff)
n#768027: Slide notesMaster and notes import.
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/ppt/pptshape.cxx4
-rw-r--r--oox/source/ppt/pptshapecontext.cxx17
-rw-r--r--oox/source/ppt/slidefragmenthandler.cxx35
3 files changed, 51 insertions, 5 deletions
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index 2f2e330de539..417c1bdb0aac 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -264,6 +264,10 @@ void PPTShape::addShape(
// use placeholder index if possible
if( mnSubType && getSubTypeIndex().has() && rSlidePersist.getMasterPersist().get() ) {
oox::drawingml::ShapePtr pPlaceholder = PPTShape::findPlaceholderByIndex( getSubTypeIndex().get(), rSlidePersist.getMasterPersist()->getShapes()->getChildren() );
+ // TODO: Check if this is required for non-notes slides as well...
+ if( rSlidePersist.isNotesPage() && pPlaceholder.get() && pPlaceholder->getSubType() != getSubType() )
+ pPlaceholder.reset();
+
if( pPlaceholder.get()) {
OSL_TRACE("found placeholder with index: %d and type: %s", getSubTypeIndex().get(), lclDebugSubType( mnSubType ));
}
diff --git a/oox/source/ppt/pptshapecontext.cxx b/oox/source/ppt/pptshapecontext.cxx
index 0333f5ab2e1f..c301f2385df6 100644
--- a/oox/source/ppt/pptshapecontext.cxx
+++ b/oox/source/ppt/pptshapecontext.cxx
@@ -65,14 +65,17 @@ PPTShapeContext::PPTShapeContext( ContextHandler& rParent, const SlidePersistPtr
oox::drawingml::ShapePtr findPlaceholder( const sal_Int32 nMasterPlaceholder, const OptValue< sal_Int32 >& oSubTypeIndex, std::vector< oox::drawingml::ShapePtr >& rShapes )
{
oox::drawingml::ShapePtr aShapePtr;
- oox::drawingml::ShapePtr aTmpShapePtr;
+ oox::drawingml::ShapePtr aChoiceShapePtr1;
+ oox::drawingml::ShapePtr aChoiceShapePtr2;
std::vector< oox::drawingml::ShapePtr >::reverse_iterator aRevIter( rShapes.rbegin() );
while( aRevIter != rShapes.rend() )
{
if ( (*aRevIter)->getSubType() == nMasterPlaceholder )
{
- if( !oSubTypeIndex.has() && aTmpShapePtr == NULL )
- aTmpShapePtr = *aRevIter;
+ if( !oSubTypeIndex.has() && aChoiceShapePtr1 == NULL )
+ aChoiceShapePtr1 = *aRevIter;
+ else if( aChoiceShapePtr2 == NULL )
+ aChoiceShapePtr2 = *aRevIter;
if( (*aRevIter)->getSubTypeIndex() == oSubTypeIndex )
{
aShapePtr = *aRevIter;
@@ -86,7 +89,7 @@ oox::drawingml::ShapePtr findPlaceholder( const sal_Int32 nMasterPlaceholder, co
++aRevIter;
}
if( aShapePtr == NULL )
- return aTmpShapePtr;
+ return aChoiceShapePtr1 ? aChoiceShapePtr1 : aChoiceShapePtr2;
return aShapePtr;
}
@@ -185,9 +188,13 @@ Reference< XFastContextHandler > PPTShapeContext::createFastChildContext( sal_In
if ( pMasterPersist.get() ) {
if( pPPTShapePtr->getSubTypeIndex().has() )
pPlaceholder = PPTShape::findPlaceholderByIndex( pPPTShapePtr->getSubTypeIndex().get(), pMasterPersist->getShapes()->getChildren() );
- if ( !pPlaceholder.get() )
+ // TODO: Check if this is required for non-notes pages as well...
+ if ( !pPlaceholder.get() || ( pMasterPersist->isNotesPage() && pPlaceholder->getSubType() != nFirstPlaceholder &&
+ pPlaceholder->getSubType() != nSecondPlaceholder ) )
+ {
pPlaceholder = findPlaceholder( nFirstPlaceholder, nSecondPlaceholder,
pPPTShapePtr->getSubTypeIndex(), pMasterPersist->getShapes()->getChildren() );
+ }
}
}
if ( pPlaceholder.get() )
diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx
index 9f987421479b..d01416485eab 100644
--- a/oox/source/ppt/slidefragmenthandler.cxx
+++ b/oox/source/ppt/slidefragmenthandler.cxx
@@ -45,6 +45,7 @@
#include "oox/vml/vmldrawing.hxx"
#include "oox/vml/vmldrawingfragment.hxx"
#include "oox/drawingml/clrschemecontext.hxx"
+#include "oox/ppt/pptimport.hxx"
using rtl::OUString;
@@ -93,6 +94,40 @@ SlideFragmentHandler::~SlideFragmentHandler() throw()
return this;
}
case PPT_TOKEN( notes ): // CT_NotesSlide
+ {
+ // Import notesMaster
+ PowerPointImport& rFilter = dynamic_cast< PowerPointImport& >( getFilter() );
+ OUString aNotesFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "notesMaster" ) );
+ printf("notesMaster: %s\n", ::rtl::OUStringToOString(aNotesFragmentPath, RTL_TEXTENCODING_UTF8).getStr() );
+
+ std::vector< SlidePersistPtr >& rMasterPages( rFilter.getMasterPages() );
+ std::vector< SlidePersistPtr >::iterator aIter( rMasterPages.begin() );
+ while( aIter != rMasterPages.end() )
+ {
+ if( (*aIter)->getPath() == aNotesFragmentPath )
+ {
+ if( !mpSlidePersistPtr->getMasterPersist() )
+ mpSlidePersistPtr->setMasterPersist( *aIter );
+ break;
+ }
+ ++aIter;
+ }
+ if( aIter == rMasterPages.end() && !mpSlidePersistPtr->getMasterPersist() )
+ {
+ TextListStylePtr pTextListStyle(new TextListStyle);
+ SlidePersistPtr pMasterPersistPtr = SlidePersistPtr( new SlidePersist( rFilter, sal_True, sal_True, mpSlidePersistPtr->getPage(),
+ ShapePtr( new PPTShape( Master, "com.sun.star.drawing.GroupShape" ) ), mpSlidePersistPtr->getNotesTextStyle() ) );
+ //pMasterPersistPtr->setLayoutPath( aLayoutFragmentPath );
+ pMasterPersistPtr->setPath( aNotesFragmentPath );
+ rFilter.getMasterPages().push_back( pMasterPersistPtr );
+ FragmentHandlerRef xMasterFragmentHandler( new SlideFragmentHandler( rFilter, aNotesFragmentPath, pMasterPersistPtr, Master ) );
+ rFilter.importFragment( xMasterFragmentHandler );
+ //pMasterPersistPtr->createBackground( rFilter );
+ //pMasterPersistPtr->createXShapes( rFilter );
+ mpSlidePersistPtr->setMasterPersist( pMasterPersistPtr );
+ }
+ return this;
+ }
case PPT_TOKEN( notesMaster ): // CT_NotesMaster
return this;
case PPT_TOKEN( cSld ): // CT_CommonSlideData