[Libreoffice-commits] .: oox/source
Muthu Subramanian
sumuthu at kemper.freedesktop.org
Wed Jul 4 08:05:00 PDT 2012
oox/source/ppt/pptshape.cxx | 4 +++
oox/source/ppt/pptshapecontext.cxx | 17 ++++++++++-----
oox/source/ppt/slidefragmenthandler.cxx | 35 ++++++++++++++++++++++++++++++++
3 files changed, 51 insertions(+), 5 deletions(-)
New commits:
commit 37f6fc4933769cb031b63d607a607a42654732f0
Author: Muthu Subramanian <sumuthu at suse.com>
Date: Wed Jul 4 20:56:47 2012 +0530
n#768027: Slide notesMaster and notes import.
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index 1456fbb..bbe12cb 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -289,6 +289,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 0333f5a..c301f23 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 952a57c..2b010be 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
More information about the Libreoffice-commits
mailing list