incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1167622 - /incubator/ooo/trunk/main/oox/source/ppt/presentationfragmenthandler.cxx
Date Sat, 10 Sep 2011 22:44:01 GMT
Author: erack
Date: Sat Sep 10 22:44:00 2011
New Revision: 1167622

URL: http://svn.apache.org/viewvc?rev=1167622&view=rev
Log:
impress212: ppt slide persist, minor improvment

# User sj <sj@openoffice.org>

Modified:
    incubator/ooo/trunk/main/oox/source/ppt/presentationfragmenthandler.cxx

Modified: incubator/ooo/trunk/main/oox/source/ppt/presentationfragmenthandler.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/oox/source/ppt/presentationfragmenthandler.cxx?rev=1167622&r1=1167621&r2=1167622&view=diff
==============================================================================
--- incubator/ooo/trunk/main/oox/source/ppt/presentationfragmenthandler.cxx (original)
+++ incubator/ooo/trunk/main/oox/source/ppt/presentationfragmenthandler.cxx Sat Sep 10 22:44:00
2011
@@ -173,6 +173,7 @@ void PresentationFragmentHandler::endDoc
             OUString aSlideFragmentPath = getFragmentPathFromRelId( maSlidesVector[ nSlide
] );
             if( aSlideFragmentPath.getLength() > 0 )
 			{
+				rtl::OUString aMasterFragmentPath;
 				SlidePersistPtr pMasterPersistPtr;
                 SlidePersistPtr pSlidePersistPtr( new SlidePersist( rFilter, sal_False, sal_False,
xSlide,
 									ShapePtr( new PPTShape( Slide, "com.sun.star.drawing.GroupShape" ) ), mpTextListStyle
) );
@@ -185,7 +186,7 @@ void PresentationFragmentHandler::endDoc
 				{
 					// importing layout
                     RelationsRef xLayoutRelations = rFilter.importRelations( aLayoutFragmentPath
);
-                    OUString aMasterFragmentPath = xLayoutRelations->getFragmentPathFromFirstType(
CREATE_OFFICEDOC_RELATION_TYPE( "slideMaster" ) );
+                    aMasterFragmentPath = xLayoutRelations->getFragmentPathFromFirstType(
CREATE_OFFICEDOC_RELATION_TYPE( "slideMaster" ) );
                     if( aMasterFragmentPath.getLength() )
                     {
                         // check if the corresponding masterpage+layout has already been
imported
@@ -200,49 +201,51 @@ void PresentationFragmentHandler::endDoc
                             }
                             aIter++;
                         }
-                        if ( aIter == rMasterPages.end() )
-                        {   // masterpersist not found, we have to load it
-                            Reference< drawing::XDrawPage > xMasterPage;
-                            Reference< drawing::XMasterPagesSupplier > xMPS( xModel,
uno::UNO_QUERY_THROW );
-                            Reference< drawing::XDrawPages > xMasterPages( xMPS->getMasterPages(),
uno::UNO_QUERY_THROW );
-
-                            if( !(rFilter.getMasterPages().size() ))
-                                xMasterPages->getByIndex( 0 ) >>= xMasterPage;
-                            else
-                                xMasterPage = xMasterPages->insertNewByIndex( xMasterPages->getCount()
);
-
-                            pMasterPersistPtr = SlidePersistPtr( new SlidePersist( rFilter,
sal_True, sal_False, xMasterPage,
-                                ShapePtr( new PPTShape( Master, "com.sun.star.drawing.GroupShape"
) ), mpTextListStyle ) );
-                            pMasterPersistPtr->setLayoutPath( aLayoutFragmentPath );
-                            rFilter.getMasterPages().push_back( pMasterPersistPtr );
-                            rFilter.setActualSlidePersist( pMasterPersistPtr );
-                            FragmentHandlerRef xMasterFragmentHandler( new SlideFragmentHandler(
rFilter, aMasterFragmentPath, pMasterPersistPtr, Master ) );
-
-                            // set the correct theme
-                            OUString aThemeFragmentPath = xMasterFragmentHandler->getFragmentPathFromFirstType(
CREATE_OFFICEDOC_RELATION_TYPE( "theme" ) );
-                            if( aThemeFragmentPath.getLength() > 0 )
-                            {
-                                std::map< OUString, oox::drawingml::ThemePtr >&
rThemes( rFilter.getThemes() );
-                                std::map< OUString, oox::drawingml::ThemePtr >::iterator
aIter2( rThemes.find( aThemeFragmentPath ) );
-                                if( aIter2 == rThemes.end() )
-                                {
-                                    oox::drawingml::ThemePtr pThemePtr( new oox::drawingml::Theme()
);
-                                    pMasterPersistPtr->setTheme( pThemePtr );
-                                    rFilter.importFragment( new ThemeFragmentHandler( rFilter,
aThemeFragmentPath, *pThemePtr ) );
-                                    rThemes[ aThemeFragmentPath ] = pThemePtr;
-                                }
-                                else
-                                {
-                                    pMasterPersistPtr->setTheme( (*aIter2).second );
-                                }
-                            }
-                            importSlide( xMasterFragmentHandler, pMasterPersistPtr );
-                            rFilter.importFragment( new LayoutFragmentHandler( rFilter, aLayoutFragmentPath,
pMasterPersistPtr ) );
-                            pMasterPersistPtr->createBackground( rFilter );
-                            pMasterPersistPtr->createXShapes( rFilter );
+					}
+				}
+
+                if ( !pMasterPersistPtr.get() )
+                {   // masterpersist not found, we have to load it
+                    Reference< drawing::XDrawPage > xMasterPage;
+                    Reference< drawing::XMasterPagesSupplier > xMPS( xModel, uno::UNO_QUERY_THROW
);
+                    Reference< drawing::XDrawPages > xMasterPages( xMPS->getMasterPages(),
uno::UNO_QUERY_THROW );
+
+                    if( !(rFilter.getMasterPages().size() ))
+                        xMasterPages->getByIndex( 0 ) >>= xMasterPage;
+                    else
+                        xMasterPage = xMasterPages->insertNewByIndex( xMasterPages->getCount()
);
+
+                    pMasterPersistPtr = SlidePersistPtr( new SlidePersist( rFilter, sal_True,
sal_False, xMasterPage,
+                        ShapePtr( new PPTShape( Master, "com.sun.star.drawing.GroupShape"
) ), mpTextListStyle ) );
+                    pMasterPersistPtr->setLayoutPath( aLayoutFragmentPath );
+                    rFilter.getMasterPages().push_back( pMasterPersistPtr );
+                    rFilter.setActualSlidePersist( pMasterPersistPtr );
+
+                    FragmentHandlerRef xMasterFragmentHandler( new SlideFragmentHandler(
rFilter, aMasterFragmentPath, pMasterPersistPtr, Master ) );
+
+                    // set the correct theme
+                    OUString aThemeFragmentPath = xMasterFragmentHandler->getFragmentPathFromFirstType(
CREATE_OFFICEDOC_RELATION_TYPE( "theme" ) );
+                    if( aThemeFragmentPath.getLength() > 0 )
+                    {
+                        std::map< OUString, oox::drawingml::ThemePtr >& rThemes(
rFilter.getThemes() );
+                        std::map< OUString, oox::drawingml::ThemePtr >::iterator aIter2(
rThemes.find( aThemeFragmentPath ) );
+                        if( aIter2 == rThemes.end() )
+                        {
+                            oox::drawingml::ThemePtr pThemePtr( new oox::drawingml::Theme()
);
+                            pMasterPersistPtr->setTheme( pThemePtr );
+                            rFilter.importFragment( new ThemeFragmentHandler( rFilter, aThemeFragmentPath,
*pThemePtr ) );
+                            rThemes[ aThemeFragmentPath ] = pThemePtr;
+                        }
+                        else
+                        {
+                            pMasterPersistPtr->setTheme( (*aIter2).second );
                         }
                     }
-				}
+                    importSlide( xMasterFragmentHandler, pMasterPersistPtr );
+                    rFilter.importFragment( new LayoutFragmentHandler( rFilter, aLayoutFragmentPath,
pMasterPersistPtr ) );
+                    pMasterPersistPtr->createBackground( rFilter );
+                    pMasterPersistPtr->createXShapes( rFilter );
+                }
 
 				// importing slide page
 				pSlidePersistPtr->setMasterPersist( pMasterPersistPtr );



Mime
View raw message