Commit fe56a221 authored by Thorsten Zachmann's avatar Thorsten Zachmann

o use the new unified style writing funtionality

svn path=/trunk/koffice/; revision=724788
parent 178d80bc
......@@ -183,71 +183,7 @@ bool KoPADocument::saveOasis( KoStore* store, KoXmlWriter* manifestWriter )
//add manifest line for content.xml
manifestWriter->addManifestEntry( "content.xml", "text/xml" );
if ( !store->open( "styles.xml" ) )
return false;
manifestWriter->addManifestEntry( "styles.xml", "text/xml" );
saveOdfDocumentStyles( store, paContext, &masterStyles );
if ( !store->close() ) // done with styles.xml
return false;
return true;
}
void KoPADocument::saveOdfAutomaticStyles( KoXmlWriter& contentWriter, KoGenStyles& mainStyles, bool stylesDotXml )
{
// test style writing
QList<KoGenStyles::NamedStyle> styles = mainStyles.styles( KoGenStyle::StyleGraphicAuto, stylesDotXml );
QList<KoGenStyles::NamedStyle>::const_iterator it = styles.begin();
for ( ; it != styles.end() ; ++it ) {
//qDebug() << "style:style" << ( *it ).name;
( *it ).style->writeStyle( &contentWriter, mainStyles, "style:style", ( *it ).name , "style:graphic-properties" );
}
styles = mainStyles.styles( KoGenStyle::StyleDrawingPage, stylesDotXml );
it = styles.begin();
for ( ; it != styles.end() ; ++it ) {
//qDebug() << "style:style" << ( *it ).name;
( *it ).style->writeStyle( &contentWriter, mainStyles, "style:style", ( *it ).name , "style:drawing-page-properties" );
}
styles = mainStyles.styles( KoGenStyle::StylePageLayout, stylesDotXml );
it = styles.begin();
for ( ; it != styles.end() ; ++it ) {
//qDebug() << "style:style" << ( *it ).name;
(*it).style->writeStyle( &contentWriter, mainStyles, "style:page-layout", (*it).name, "style:page-layout-properties" );
}
}
void KoPADocument::saveOdfDocumentStyles( KoStore * store, KoShapeSavingContext & context, QFile *masterStyles )
{
KoStoreDevice stylesDev( store );
KoXmlWriter* stylesWriter = createOasisXmlWriter( &stylesDev, "office:document-styles" );
KoGenStyles & mainStyles = context.mainStyles();
#if 1
mainStyles.saveOdfDocumentStyles( stylesWriter );
mainStyles.saveOdfAutomaticStyles( stylesWriter, true );
mainStyles.saveOdfMasterStyles( stylesWriter );
#else
stylesWriter->startElement( "office:styles" );
KoShapeStyleWriter styleHandler( context );
styleHandler.writeOfficeStyles( stylesWriter );
stylesWriter->endElement(); // office:styles
stylesWriter->startElement( "office:automatic-styles" );
saveOdfAutomaticStyles( *stylesWriter, mainStyles, true );
stylesWriter->endElement(); // office:automatic-styles
stylesWriter->addCompleteElement( masterStyles );
#endif
stylesWriter->endElement(); // root element (office:document-styles)
stylesWriter->endDocument();
delete stylesWriter;
return mainStyles.saveOdfStylesDotXml( store, manifestWriter );
}
KoPAPageBase* KoPADocument::pageByIndex( int index, bool masterPage ) const
......
......@@ -129,9 +129,6 @@ protected:
virtual KoView *createViewInstance( QWidget *parent ) = 0;
virtual const char *odfTagName( bool withNamespace ) = 0;
void saveOdfAutomaticStyles( KoXmlWriter& contentWriter, KoGenStyles& mainStyles, bool stylesDotXml );
void saveOdfDocumentStyles( KoStore * store, KoShapeSavingContext& context, QFile *masterStyles );
/**
* This function is called by at the end of addShape. This is used
* e.g. for doing work on the application which is in the KoShapeAppData.
......
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