Commit 1f39fd72 authored by Thorsten Zachmann's avatar Thorsten Zachmann

o refactor for reusage

svn path=/trunk/koffice/; revision=728730
parent fd30a0e0
......@@ -135,15 +135,32 @@ bool KoPADocument::saveOasis( KoStore* store, KoXmlWriter* manifestWriter )
return false;
KoGenStyles mainStyles;
KoSavingContext savingContext( mainStyles, KoSavingContext::Store );
KoXmlWriter * bodyWriter = oasisStore.bodyWriter();
if ( !saveOasisPages( bodyWriter, mainStyles, m_pages, m_masterPages ) ) {
return false;
}
mainStyles.saveOdfAutomaticStyles( contentWriter, false );
oasisStore.closeContentWriter();
//add manifest line for content.xml
manifestWriter->addManifestEntry( "content.xml", "text/xml" );
return mainStyles.saveOdfStylesDotXml( store, manifestWriter );
}
bool KoPADocument::saveOasisPages( KoXmlWriter* bodyWriter, KoGenStyles &mainStyles,
QList<KoPAPageBase *> &pages, QList<KoPAPageBase *> &masterPages )
{
KoSavingContext savingContext( mainStyles, KoSavingContext::Store );
KoPASavingContext paContext( *bodyWriter, savingContext, 1 );
paContext.setOptions( KoPASavingContext::DrawId | KoPASavingContext::AutoStyleInStyleXml );
// save master pages
foreach( KoPAPageBase *page, m_masterPages )
foreach( KoPAPageBase *page, masterPages )
{
page->saveOdf( paContext );
}
......@@ -155,7 +172,7 @@ bool KoPADocument::saveOasis( KoStore* store, KoXmlWriter* manifestWriter )
paContext.setOptions( KoPASavingContext::DrawId );
// save pages
foreach ( KoPAPageBase *page, m_pages )
foreach ( KoPAPageBase *page, pages )
{
page->saveOdf( paContext );
paContext.incrementPage();
......@@ -164,14 +181,7 @@ bool KoPADocument::saveOasis( KoStore* store, KoXmlWriter* manifestWriter )
bodyWriter->endElement(); // office:odfTagName()
bodyWriter->endElement(); // office:body
mainStyles.saveOdfAutomaticStyles( contentWriter, false );
oasisStore.closeContentWriter();
//add manifest line for content.xml
manifestWriter->addManifestEntry( "content.xml", "text/xml" );
return mainStyles.saveOdfStylesDotXml( store, manifestWriter );
return true;
}
KoPAPageBase* KoPADocument::pageByIndex( int index, bool masterPage ) const
......
......@@ -51,6 +51,16 @@ public:
bool saveOasis( KoStore* store, KoXmlWriter* manifestWriter );
/**
* Save pages
*
* This is used by saveOasis and for copy and paste of pages.
*
* For all pages that are specified also the master slide has to be specified.
*/
bool saveOasisPages( KoXmlWriter* bodyWriter, KoGenStyles &mainStyles,
QList<KoPAPageBase *> &pages, QList<KoPAPageBase *> &masterPages );
/**
* Get page by index.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment