summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Lippka <cl@openoffice.org>2001-03-01 15:31:32 +0000
committerChristian Lippka <cl@openoffice.org>2001-03-01 15:31:32 +0000
commit20ea3277b813927b6a1f95b22542ef4e7b3b452e (patch)
tree33f08937c95b31dc490bcded09f061d4c2c0a53d
parentf681d13166abc01c46d2e50aebf8f7c030c7799f (diff)
seperate content stream into content and style stream
-rw-r--r--xmloff/source/core/facreg.cxx119
-rw-r--r--xmloff/source/core/xmlexp.cxx44
-rw-r--r--xmloff/source/core/xmlimp.cxx9
-rw-r--r--xmloff/source/draw/sdxmlexp.cxx254
-rw-r--r--xmloff/source/draw/sdxmlexp_impl.hxx6
-rw-r--r--xmloff/source/draw/sdxmlimp.cxx132
-rw-r--r--xmloff/source/draw/sdxmlimp_impl.hxx6
-rw-r--r--xmloff/source/draw/ximpshap.cxx167
-rw-r--r--xmloff/source/draw/ximpstyl.cxx21
9 files changed, 577 insertions, 181 deletions
diff --git a/xmloff/source/core/facreg.cxx b/xmloff/source/core/facreg.cxx
index ab593ba6f3c1..8ae5b97822c6 100644
--- a/xmloff/source/core/facreg.cxx
+++ b/xmloff/source/core/facreg.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: facreg.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: sab $ $Date: 2001-02-28 17:47:49 $
+ * last change: $Author: cl $ $Date: 2001-03-01 16:30:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -80,21 +80,61 @@ extern uno::Sequence< OUString > SAL_CALL SdImpressXMLImport_getSupportedService
extern OUString SAL_CALL SdImpressXMLImport_getImplementationName() throw();
extern uno::Reference< uno::XInterface > SAL_CALL SdImpressXMLImport_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+// impress import.styles
+extern uno::Sequence< OUString > SAL_CALL SdImpressXMLImport_Style_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SdImpressXMLImport_Style_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SdImpressXMLImport_Style_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+
+// impress import.content
+extern uno::Sequence< OUString > SAL_CALL SdImpressXMLImport_Content_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SdImpressXMLImport_Content_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SdImpressXMLImport_Content_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+
// impress export
extern uno::Sequence< OUString > SAL_CALL SdImpressXMLExport_getSupportedServiceNames() throw();
extern OUString SAL_CALL SdImpressXMLExport_getImplementationName() throw();
extern uno::Reference< uno::XInterface > SAL_CALL SdImpressXMLExport_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+// impress export.styles
+extern uno::Sequence< OUString > SAL_CALL SdImpressXMLExport_Style_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SdImpressXMLExport_Style_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SdImpressXMLExport_Style_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+
+// impress export.content
+extern uno::Sequence< OUString > SAL_CALL SdImpressXMLExport_Content_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SdImpressXMLExport_Content_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SdImpressXMLExport_Content_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+
// draw import
extern uno::Sequence< OUString > SAL_CALL SdDrawXMLImport_getSupportedServiceNames() throw();
extern OUString SAL_CALL SdDrawXMLImport_getImplementationName() throw();
extern uno::Reference< uno::XInterface > SAL_CALL SdDrawXMLImport_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+// draw import.styles
+extern uno::Sequence< OUString > SAL_CALL SdDrawXMLImport_Style_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SdDrawXMLImport_Style_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SdDrawXMLImport_Style_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+
+// draw import.content
+extern uno::Sequence< OUString > SAL_CALL SdDrawXMLImport_Content_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SdDrawXMLImport_Content_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SdDrawXMLImport_Content_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+
// draw export
extern uno::Sequence< OUString > SAL_CALL SdDrawXMLExport_getSupportedServiceNames() throw();
extern OUString SAL_CALL SdDrawXMLExport_getImplementationName() throw();
extern uno::Reference< uno::XInterface > SAL_CALL SdDrawXMLExport_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+// draw export
+extern uno::Sequence< OUString > SAL_CALL SdDrawXMLExport_Style_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SdDrawXMLExport_Style_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SdDrawXMLExport_Style_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+
+// draw export
+extern uno::Sequence< OUString > SAL_CALL SdDrawXMLExport_Content_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SdDrawXMLExport_Content_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SdDrawXMLExport_Content_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+
// chart import
extern uno::Sequence< OUString > SAL_CALL SchXMLImport_getSupportedServiceNames() throw();
extern OUString SAL_CALL SchXMLImport_getImplementationName() throw();
@@ -159,10 +199,26 @@ sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryK
writeInfo( pKey, SdImpressXMLImport_getImplementationName(), SdImpressXMLImport_getSupportedServiceNames() );
writeInfo( pKey, SdImpressXMLExport_getImplementationName(), SdImpressXMLExport_getSupportedServiceNames() );
+ // impress.styles
+ writeInfo( pKey, SdImpressXMLImport_Style_getImplementationName(), SdImpressXMLImport_Style_getSupportedServiceNames() );
+ writeInfo( pKey, SdImpressXMLExport_Style_getImplementationName(), SdImpressXMLExport_Style_getSupportedServiceNames() );
+
+ // impress.content
+ writeInfo( pKey, SdImpressXMLImport_Content_getImplementationName(), SdImpressXMLImport_Content_getSupportedServiceNames() );
+ writeInfo( pKey, SdImpressXMLExport_Content_getImplementationName(), SdImpressXMLExport_Content_getSupportedServiceNames() );
+
// draw
writeInfo( pKey, SdDrawXMLImport_getImplementationName(), SdDrawXMLImport_getSupportedServiceNames() );
writeInfo( pKey, SdDrawXMLExport_getImplementationName(), SdDrawXMLExport_getSupportedServiceNames() );
+ // draw.styles
+ writeInfo( pKey, SdDrawXMLImport_Style_getImplementationName(), SdDrawXMLImport_Style_getSupportedServiceNames() );
+ writeInfo( pKey, SdDrawXMLExport_Style_getImplementationName(), SdDrawXMLExport_Style_getSupportedServiceNames() );
+
+ // draw.content
+ writeInfo( pKey, SdDrawXMLImport_Content_getImplementationName(), SdDrawXMLImport_Content_getSupportedServiceNames() );
+ writeInfo( pKey, SdDrawXMLExport_Content_getImplementationName(), SdDrawXMLExport_Content_getSupportedServiceNames() );
+
// chart
writeInfo( pKey, SchXMLImport_getImplementationName(), SchXMLImport_getSupportedServiceNames() );
writeInfo( pKey, SchXMLExport_getImplementationName(), SchXMLExport_getSupportedServiceNames() );
@@ -170,6 +226,7 @@ sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryK
// meta
writeInfo( pKey, XMLMetaImportComponent_getImplementationName(), XMLMetaImportComponent_getSupportedServiceNames() );
writeInfo( pKey, XMLMetaExportComponent_getImplementationName(), XMLMetaExportComponent_getSupportedServiceNames() );
+ writeInfo( pKey, XMLMetaExportComponent_getImplementationName(), XMLMetaExportComponent_getSupportedServiceNames() );
// writer auto text events
writeInfo( pKey, XMLAutoTextEventExport_getImplementationName(), XMLAutoTextEventExport_getSupportedServiceNames() );
@@ -200,6 +257,20 @@ void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServic
SdImpressXMLImport_createInstance,
SdImpressXMLImport_getSupportedServiceNames() );
}
+ if( SdImpressXMLImport_Style_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SdImpressXMLImport_Style_getImplementationName(),
+ SdImpressXMLImport_Style_createInstance,
+ SdImpressXMLImport_Style_getSupportedServiceNames() );
+ }
+ if( SdImpressXMLImport_Content_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SdImpressXMLImport_Content_getImplementationName(),
+ SdImpressXMLImport_Content_createInstance,
+ SdImpressXMLImport_Content_getSupportedServiceNames() );
+ }
else if( SdDrawXMLImport_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
{
xFactory = ::cppu::createSingleFactory( xMSF,
@@ -207,13 +278,41 @@ void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServic
SdDrawXMLImport_createInstance,
SdDrawXMLImport_getSupportedServiceNames() );
}
- if( SdImpressXMLExport_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
+ else if( SdDrawXMLImport_Style_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SdDrawXMLImport_Style_getImplementationName(),
+ SdDrawXMLImport_Style_createInstance,
+ SdDrawXMLImport_Style_getSupportedServiceNames() );
+ }
+ else if( SdDrawXMLImport_Content_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SdDrawXMLImport_Content_getImplementationName(),
+ SdDrawXMLImport_Content_createInstance,
+ SdDrawXMLImport_Content_getSupportedServiceNames() );
+ }
+ else if( SdImpressXMLExport_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
{
xFactory = ::cppu::createSingleFactory( xMSF,
SdImpressXMLExport_getImplementationName(),
SdImpressXMLExport_createInstance,
SdImpressXMLExport_getSupportedServiceNames() );
}
+ else if( SdImpressXMLExport_Style_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SdImpressXMLExport_Style_getImplementationName(),
+ SdImpressXMLExport_Style_createInstance,
+ SdImpressXMLExport_Style_getSupportedServiceNames() );
+ }
+ else if( SdImpressXMLExport_Content_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SdImpressXMLExport_Content_getImplementationName(),
+ SdImpressXMLExport_Content_createInstance,
+ SdImpressXMLExport_Content_getSupportedServiceNames() );
+ }
else if( SdDrawXMLExport_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
{
xFactory = ::cppu::createSingleFactory( xMSF,
@@ -221,6 +320,20 @@ void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServic
SdDrawXMLExport_createInstance,
SdDrawXMLExport_getSupportedServiceNames() );
}
+ else if( SdDrawXMLExport_Style_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SdDrawXMLExport_Style_getImplementationName(),
+ SdDrawXMLExport_Style_createInstance,
+ SdDrawXMLExport_Style_getSupportedServiceNames() );
+ }
+ else if( SdDrawXMLExport_Content_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SdDrawXMLExport_Content_getImplementationName(),
+ SdDrawXMLExport_Content_createInstance,
+ SdDrawXMLExport_Content_getSupportedServiceNames() );
+ }
else if( SchXMLImport_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
{
xFactory = ::cppu::createSingleFactory( xMSF,
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 8fbf11fbd960..46724434db17 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlexp.cxx,v $
*
- * $Revision: 1.38 $
+ * $Revision: 1.39 $
*
- * last change: $Author: mtg $ $Date: 2001-02-28 11:32:54 $
+ * last change: $Author: cl $ $Date: 2001-03-01 16:30:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -214,7 +214,7 @@ void SvXMLExport::_InitCtor()
sEmbeddedObjectProtocol = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.EmbeddedObject:" ) );
}
-SvXMLExport::SvXMLExport( MapUnit eDfltUnit, const sal_Char * pClass ) :
+SvXMLExport::SvXMLExport( MapUnit eDfltUnit, const sal_Char * pClass, sal_uInt16 nExportFlags ) :
pImpl( 0 ), mpClass( pClass ),
sCDATA( OUString::createFromAscii( sXML_CDATA ) ),
sWS( OUString::createFromAscii( sXML_WS ) ),
@@ -225,7 +225,8 @@ SvXMLExport::SvXMLExport( MapUnit eDfltUnit, const sal_Char * pClass ) :
pNumExport(0L),
pProgressBarHelper( NULL ),
pEventExport( NULL ),
- bSaveLinkedSections(sal_True)
+ bSaveLinkedSections(sal_True),
+ mnExportFlags( nExportFlags )
{
_InitCtor();
}
@@ -499,8 +500,6 @@ void SvXMLExport::ImplExportStyles( sal_Bool bUsed )
{
CheckAttrList();
- _ExportFontDecls();
-
// AddAttributeASCII( XML_NAMESPACE_NONE, sXML_id, sXML_styles_id );
{
// <style:styles>
@@ -509,7 +508,10 @@ void SvXMLExport::ImplExportStyles( sal_Bool bUsed )
_ExportStyles( sal_False );
}
+}
+void SvXMLExport::ImplExportAutoStyles( sal_Bool bUsed )
+{
// AddAttributeASCII( XML_NAMESPACE_NONE, sXML_id, sXML_auto_styles_id );
{
// <style:automatic-styles>
@@ -531,7 +533,10 @@ void SvXMLExport::ImplExportStyles( sal_Bool bUsed )
#endif
_ExportAutoStyles();
}
+}
+void SvXMLExport::ImplExportMasterStyles( sal_Bool bUsed )
+{
{
// <style:master-styles>
SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, sXML_master_styles,
@@ -607,19 +612,36 @@ sal_uInt32 SvXMLExport::exportDoc( const sal_Char *pClass )
sal_True, sal_True );
// meta information
- ImplExportMeta();
+ if( mnExportFlags & EXPORT_META )
+ ImplExportMeta();
// view settings
- _ExportViewSettings();
+ if( mnExportFlags & EXPORT_SETTINGS )
+ _ExportViewSettings();
// scripts
- _ExportScripts();
+ if( mnExportFlags & EXPORT_SCRIPTS )
+ _ExportScripts();
+
+ // font declerations
+ if( mnExportFlags & EXPORT_FONTDECLS )
+ _ExportFontDecls();
// styles
- ImplExportStyles( sal_False );
+ if( mnExportFlags & EXPORT_STYLES )
+ ImplExportStyles( sal_False );
+
+ // autostyles
+ if( mnExportFlags & EXPORT_AUTOSTYLES )
+ ImplExportAutoStyles( sal_False );
+
+ // masterstyles
+ if( mnExportFlags & EXPORT_MASTERSTYLES )
+ ImplExportMasterStyles( sal_False );
// contnt
- ImplExportContent();
+ if( mnExportFlags & EXPORT_CONTENT )
+ ImplExportContent();
}
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index e611387e3066..1a232722b992 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlimp.cxx,v $
*
- * $Revision: 1.23 $
+ * $Revision: 1.24 $
*
- * last change: $Author: cl $ $Date: 2001-02-08 14:28:14 $
+ * last change: $Author: cl $ $Date: 2001-03-01 16:30:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -218,14 +218,15 @@ void SvXMLImport::_InitCtor()
pNumImport = new SvXMLNumFmtHelper(xNumberFormatsSupplier);
}
-SvXMLImport::SvXMLImport() throw () :
+SvXMLImport::SvXMLImport( sal_uInt16 nImportFlags ) throw () :
pImpl( 0 ),
pNamespaceMap( new SvXMLNamespaceMap ),
pUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, MAP_100TH_MM ) ),
pContexts( new SvXMLImportContexts_Impl ),
pNumImport( NULL ),
pProgressBarHelper( NULL ),
- pEventImportHelper( NULL )
+ pEventImportHelper( NULL ),
+ mnImportFlags( nImportFlags )
{
_InitCtor();
}
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index dd90843c36ea..eb71cc630ce3 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: sdxmlexp.cxx,v $
*
- * $Revision: 1.49 $
+ * $Revision: 1.50 $
*
- * last change: $Author: cl $ $Date: 2001-02-27 16:09:08 $
+ * last change: $Author: cl $ $Date: 2001-03-01 16:31:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -482,8 +482,8 @@ DECLARE_LIST(ImpXMLAutoLayoutInfoList, ImpXMLAutoLayoutInfo*);
//////////////////////////////////////////////////////////////////////////////
-SdXMLExport::SdXMLExport( sal_Bool bIsDraw)
-: SvXMLExport( MAP_CM, bIsDraw ? sXML_drawing : sXML_presentation ),
+SdXMLExport::SdXMLExport( sal_Bool bIsDraw, sal_uInt16 nExportFlags )
+: SvXMLExport( MAP_CM, bIsDraw ? sXML_drawing : sXML_presentation, nExportFlags ),
mpPageMasterInfoList(new ImpXMLEXPPageMasterList(1, 4, 4)),
mpPageMaterUsageList(new ImpXMLEXPPageMasterList(1, 4, 4)),
mpAutoLayoutInfoList(new ImpXMLAutoLayoutInfoList(1, 4, 4)),
@@ -1837,18 +1837,24 @@ void SdXMLExport::_ExportAutoStyles()
{
GetPropertySetMapper()->SetAutoStyles( sal_True );
- // #80012# PageMaster export moved from _ExportStyles
- // prepare page-master infos
- ImpPrepPageMasterInfos();
+ if( getExportFlags() & EXPORT_STYLES )
+ {
+ // #80012# PageMaster export moved from _ExportStyles
+ // prepare page-master infos
+ ImpPrepPageMasterInfos();
- // write page-master infos
- ImpWritePageMasterInfos();
+ // write page-master infos
+ ImpWritePageMasterInfos();
- // prepare draw:style-name for master page export
- ImpPrepMasterPageInfos();
+ // prepare draw:style-name for master page export
+ ImpPrepMasterPageInfos();
+ }
- // prepare draw:style-name for page export
- ImpPrepDrawPageInfos();
+ if( getExportFlags() & EXPORT_CONTENT )
+ {
+ // prepare draw:style-name for page export
+ ImpPrepDrawPageInfos();
+ }
// export draw-page styles
GetAutoStylePool()->exportXML(
@@ -1857,107 +1863,113 @@ void SdXMLExport::_ExportAutoStyles()
GetMM100UnitConverter(),
GetNamespaceMap());
- // create auto style infos for objects on master pages
- for(sal_Int32 nMPageId(0L); nMPageId < mnDocMasterPageCount; nMPageId++)
+ if( getExportFlags() & EXPORT_STYLES )
{
- uno::Any aAny(mxDocMasterPages->getByIndex(nMPageId));
- uno::Reference< drawing::XDrawPage > xMasterPage;
-
- if((aAny >>= xMasterPage) && xMasterPage.is() )
+ // create auto style infos for objects on master pages
+ for(sal_Int32 nMPageId(0L); nMPageId < mnDocMasterPageCount; nMPageId++)
{
- // collect layer information
- GetFormExport()->examineForms( xMasterPage );
+ uno::Any aAny(mxDocMasterPages->getByIndex(nMPageId));
+ uno::Reference< drawing::XDrawPage > xMasterPage;
- // get MasterPage Name
- OUString aMasterPageNamePrefix;
- uno::Reference < container::XNamed > xNamed(xMasterPage, uno::UNO_QUERY);
- if(xNamed.is())
+ if((aAny >>= xMasterPage) && xMasterPage.is() )
{
- aMasterPageNamePrefix = xNamed->getName();
- }
- if(aMasterPageNamePrefix.getLength())
- {
- aMasterPageNamePrefix += OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
- }
- GetShapeExport()->setPresentationStylePrefix( aMasterPageNamePrefix );
+ // collect layer information
+ GetFormExport()->examineForms( xMasterPage );
- uno::Reference< drawing::XShapes > xShapes(xMasterPage, uno::UNO_QUERY);
- if(xShapes.is() && xShapes->getCount())
- GetShapeExport()->collectShapesAutoStyles( xShapes );
+ // get MasterPage Name
+ OUString aMasterPageNamePrefix;
+ uno::Reference < container::XNamed > xNamed(xMasterPage, uno::UNO_QUERY);
+ if(xNamed.is())
+ {
+ aMasterPageNamePrefix = xNamed->getName();
+ }
+ if(aMasterPageNamePrefix.getLength())
+ {
+ aMasterPageNamePrefix += OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
+ }
+ GetShapeExport()->setPresentationStylePrefix( aMasterPageNamePrefix );
- if(IsImpress())
- {
- uno::Reference< presentation::XPresentationPage > xPresPage(xMasterPage, uno::UNO_QUERY);
- if(xPresPage.is())
+ uno::Reference< drawing::XShapes > xShapes(xMasterPage, uno::UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ GetShapeExport()->collectShapesAutoStyles( xShapes );
+
+ if(IsImpress())
{
- uno::Reference< drawing::XDrawPage > xNotesPage(xPresPage->getNotesPage());
- if(xNotesPage.is())
+ uno::Reference< presentation::XPresentationPage > xPresPage(xMasterPage, uno::UNO_QUERY);
+ if(xPresPage.is())
{
- // collect layer information
- GetFormExport()->examineForms( xNotesPage );
+ uno::Reference< drawing::XDrawPage > xNotesPage(xPresPage->getNotesPage());
+ if(xNotesPage.is())
+ {
+ // collect layer information
+ GetFormExport()->examineForms( xNotesPage );
- uno::Reference< drawing::XShapes > xShapes(xNotesPage, uno::UNO_QUERY);
- if(xShapes.is() && xShapes->getCount())
- GetShapeExport()->collectShapesAutoStyles( xShapes );
+ uno::Reference< drawing::XShapes > xShapes(xNotesPage, uno::UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ GetShapeExport()->collectShapesAutoStyles( xShapes );
+ }
}
}
}
}
}
- // create auto style infos for objects on pages
- for(sal_Int32 nPageInd(0); nPageInd < mnDocDrawPageCount; nPageInd++)
+ if( getExportFlags() & EXPORT_CONTENT )
{
- uno::Any aAny(mxDocDrawPages->getByIndex(nPageInd));
- uno::Reference<drawing::XDrawPage> xDrawPage;
-
- if((aAny >>= xDrawPage) && xDrawPage.is() )
+ // create auto style infos for objects on pages
+ for(sal_Int32 nPageInd(0); nPageInd < mnDocDrawPageCount; nPageInd++)
{
- // collect layer information
- GetFormExport()->examineForms( xDrawPage );
+ uno::Any aAny(mxDocDrawPages->getByIndex(nPageInd));
+ uno::Reference<drawing::XDrawPage> xDrawPage;
- // get MasterPage Name
- OUString aMasterPageNamePrefix;
- uno::Reference < drawing::XMasterPageTarget > xMasterPageInt(xDrawPage, uno::UNO_QUERY);
- if(xMasterPageInt.is())
+ if((aAny >>= xDrawPage) && xDrawPage.is() )
{
- uno::Reference<drawing::XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage());
- if(xUsedMasterPage.is())
+ // collect layer information
+ GetFormExport()->examineForms( xDrawPage );
+
+ // get MasterPage Name
+ OUString aMasterPageNamePrefix;
+ uno::Reference < drawing::XMasterPageTarget > xMasterPageInt(xDrawPage, uno::UNO_QUERY);
+ if(xMasterPageInt.is())
{
- uno::Reference < container::XNamed > xMasterNamed(xUsedMasterPage, uno::UNO_QUERY);
- if(xMasterNamed.is())
+ uno::Reference<drawing::XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage());
+ if(xUsedMasterPage.is())
{
- aMasterPageNamePrefix = xMasterNamed->getName();
+ uno::Reference < container::XNamed > xMasterNamed(xUsedMasterPage, uno::UNO_QUERY);
+ if(xMasterNamed.is())
+ {
+ aMasterPageNamePrefix = xMasterNamed->getName();
+ }
}
}
- }
- if(aMasterPageNamePrefix.getLength())
- {
- aMasterPageNamePrefix += OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
- }
+ if(aMasterPageNamePrefix.getLength())
+ {
+ aMasterPageNamePrefix += OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
+ }
- GetShapeExport()->setPresentationStylePrefix( aMasterPageNamePrefix );
+ GetShapeExport()->setPresentationStylePrefix( aMasterPageNamePrefix );
- // prepare object infos
- uno::Reference< drawing::XShapes > xShapes(xDrawPage, uno::UNO_QUERY);
- if(xShapes.is() && xShapes->getCount())
- GetShapeExport()->collectShapesAutoStyles( xShapes );
+ // prepare object infos
+ uno::Reference< drawing::XShapes > xShapes(xDrawPage, uno::UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ GetShapeExport()->collectShapesAutoStyles( xShapes );
- // prepare presentation notes page object infos (ONLY if presentation)
- if(IsImpress())
- {
- uno::Reference< presentation::XPresentationPage > xPresPage(xDrawPage, uno::UNO_QUERY);
- if(xPresPage.is())
+ // prepare presentation notes page object infos (ONLY if presentation)
+ if(IsImpress())
{
- uno::Reference< drawing::XDrawPage > xNotesPage(xPresPage->getNotesPage());
- if(xNotesPage.is())
+ uno::Reference< presentation::XPresentationPage > xPresPage(xDrawPage, uno::UNO_QUERY);
+ if(xPresPage.is())
{
- // collect layer information
- GetFormExport()->examineForms( xNotesPage );
+ uno::Reference< drawing::XDrawPage > xNotesPage(xPresPage->getNotesPage());
+ if(xNotesPage.is())
+ {
+ // collect layer information
+ GetFormExport()->examineForms( xNotesPage );
- uno::Reference< drawing::XShapes > xShapes(xNotesPage, uno::UNO_QUERY);
- if(xShapes.is() && xShapes->getCount())
- GetShapeExport()->collectShapesAutoStyles( xShapes );
+ uno::Reference< drawing::XShapes > xShapes(xNotesPage, uno::UNO_QUERY);
+ if(xShapes.is() && xShapes->getCount())
+ GetShapeExport()->collectShapesAutoStyles( xShapes );
+ }
}
}
}
@@ -2102,3 +2114,75 @@ uno::Reference< uno::XInterface > SAL_CALL SdDrawXMLExport_createInstance(const
{
return (cppu::OWeakObject*)new SdXMLExport( sal_True );
}
+
+//////////////////////////////////////////////////////////////////////////////
+
+uno::Sequence< OUString > SAL_CALL SdImpressXMLExport_Style_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.sax.exporter.Impress.Styles" ) );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL SdImpressXMLExport_Style_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdXMLExport.Impress.Styles" ) );
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SdImpressXMLExport_Style_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
+{
+ return (cppu::OWeakObject*)new SdXMLExport( sal_False, EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES );
+}
+
+uno::Sequence< OUString > SAL_CALL SdDrawXMLExport_Style_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.sax.exporter.Draw.Styles" ) );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL SdDrawXMLExport_Style_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdXMLExport.Draw.Styles" ) );
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SdDrawXMLExport_Style_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
+{
+ return (cppu::OWeakObject*)new SdXMLExport( sal_True, EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+uno::Sequence< OUString > SAL_CALL SdImpressXMLExport_Content_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.sax.exporter.Impress.Content" ) );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL SdImpressXMLExport_Content_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdXMLExport.Impress.Content" ) );
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SdImpressXMLExport_Content_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
+{
+ return (cppu::OWeakObject*)new SdXMLExport( sal_False, EXPORT_SETTINGS|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
+}
+
+uno::Sequence< OUString > SAL_CALL SdDrawXMLExport_Content_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.sax.exporter.Draw.Content" ) );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL SdDrawXMLExport_Content_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdXMLExport.Draw.Content" ) );
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SdDrawXMLExport_Content_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
+{
+ return (cppu::OWeakObject*)new SdXMLExport( sal_True, EXPORT_SETTINGS|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
+}
diff --git a/xmloff/source/draw/sdxmlexp_impl.hxx b/xmloff/source/draw/sdxmlexp_impl.hxx
index 0f4674b061a2..6ed49a1616f8 100644
--- a/xmloff/source/draw/sdxmlexp_impl.hxx
+++ b/xmloff/source/draw/sdxmlexp_impl.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: sdxmlexp_impl.hxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: cl $ $Date: 2001-02-21 18:04:45 $
+ * last change: $Author: cl $ $Date: 2001-03-01 16:31:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -188,7 +188,7 @@ class SdXMLExport : public SvXMLExport
void exportPresentationSettings();
public:
- SdXMLExport( sal_Bool bIsDraw );
+ SdXMLExport( sal_Bool bIsDraw, sal_uInt16 nExportFlags = EXPORT_ALL );
virtual ~SdXMLExport();
void SetProgress(sal_Int32 nProg);
diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx
index 70924e31ec14..01fb5b03daa1 100644
--- a/xmloff/source/draw/sdxmlimp.cxx
+++ b/xmloff/source/draw/sdxmlimp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: sdxmlimp.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: cl $ $Date: 2001-02-21 18:04:45 $
+ * last change: $Author: cl $ $Date: 2001-03-01 16:31:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -280,44 +280,65 @@ SvXMLImportContext *SdXMLDocContext_Impl::CreateChildContext(
{
case XML_TOK_DOC_VIEWSETTINGS:
{
- // draw:view-settings inside office:document
- pContext = GetSdImport().CreateViewSettingsContext(rLocalName, xAttrList);
+ if( GetImport().getImportFlags() & IMPORT_SETTINGS )
+ {
+ // draw:view-settings inside office:document
+ pContext = GetSdImport().CreateViewSettingsContext(rLocalName, xAttrList);
+ }
break;
}
case XML_TOK_DOC_STYLES:
{
- // office:styles inside office:document
- pContext = GetSdImport().CreateStylesContext(rLocalName, xAttrList);
- break;
+ if( GetImport().getImportFlags() & IMPORT_STYLES )
+ {
+ // office:styles inside office:document
+ pContext = GetSdImport().CreateStylesContext(rLocalName, xAttrList);
+ break;
+ }
}
case XML_TOK_DOC_AUTOSTYLES:
{
- // office:automatic-styles inside office:document
- pContext = GetSdImport().CreateAutoStylesContext(rLocalName, xAttrList);
+ if( GetImport().getImportFlags() & IMPORT_AUTOSTYLES )
+ {
+ // office:automatic-styles inside office:document
+ pContext = GetSdImport().CreateAutoStylesContext(rLocalName, xAttrList);
+ }
break;
}
case XML_TOK_DOC_MASTERSTYLES:
{
- // office:master-styles inside office:document
- pContext = GetSdImport().CreateMasterStylesContext(rLocalName, xAttrList);
+ if( GetImport().getImportFlags() & IMPORT_MASTERSTYLES )
+ {
+ // office:master-styles inside office:document
+ pContext = GetSdImport().CreateMasterStylesContext(rLocalName, xAttrList);
+ }
break;
}
case XML_TOK_DOC_META:
{
- // office:meta inside office:document
- pContext = GetSdImport().CreateMetaContext(rLocalName, xAttrList);
+ if( GetImport().getImportFlags() & IMPORT_META )
+ {
+ // office:meta inside office:document
+ pContext = GetSdImport().CreateMetaContext(rLocalName, xAttrList);
+ }
break;
}
case XML_TOK_DOC_SCRIPT:
{
- // office:script inside office:document
- pContext = GetSdImport().CreateScriptContext( rLocalName );
+ if( GetImport().getImportFlags() & IMPORT_SCRIPTS )
+ {
+ // office:script inside office:document
+ pContext = GetSdImport().CreateScriptContext( rLocalName );
+ }
break;
}
case XML_TOK_DOC_BODY:
{
- // office:body inside office:document
- pContext = GetSdImport().CreateBodyContext(rLocalName, xAttrList);
+ if( GetImport().getImportFlags() & IMPORT_CONTENT )
+ {
+ // office:body inside office:document
+ pContext = GetSdImport().CreateBodyContext(rLocalName, xAttrList);
+ }
break;
}
}
@@ -367,8 +388,81 @@ uno::Reference< uno::XInterface > SAL_CALL SdDrawXMLImport_createInstance(const
//////////////////////////////////////////////////////////////////////////////
-SdXMLImport::SdXMLImport( sal_Bool bIsDraw )
-: mpMasterStylesContext(0L),
+uno::Sequence< OUString > SAL_CALL SdImpressXMLImport_Style_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.sax.importer.Impress.Styles" ) );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL SdImpressXMLImport_Style_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdXMLImport.Impress.Styles" ) );
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SdImpressXMLImport_Style_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
+{
+ return (cppu::OWeakObject*)new SdXMLImport( sal_False, IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES );
+}
+
+uno::Sequence< OUString > SAL_CALL SdDrawXMLImport_Style_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.sax.importer.Draw.Styles" ) );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL SdDrawXMLImport_Style_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdXMLImport.Draw.Styles" ) );
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SdDrawXMLImport_Style_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
+{
+ return (cppu::OWeakObject*)new SdXMLImport( sal_True, IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+uno::Sequence< OUString > SAL_CALL SdImpressXMLImport_Content_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.sax.importer.Impress.Content" ) );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL SdImpressXMLImport_Content_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdXMLImport.Impress.Content" ) );
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SdImpressXMLImport_Content_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
+{
+ return (cppu::OWeakObject*)new SdXMLImport( sal_False, IMPORT_META|IMPORT_STYLES|IMPORT_MASTERSTYLES|IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_SETTINGS|IMPORT_FONTDECLS );
+}
+
+uno::Sequence< OUString > SAL_CALL SdDrawXMLImport_Content_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.sax.importer.Draw.Content" ) );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+OUString SAL_CALL SdDrawXMLImport_Content_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdXMLImport.Draw.Content" ) );
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SdDrawXMLImport_Content_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )
+{
+ return (cppu::OWeakObject*)new SdXMLImport( sal_True, IMPORT_META|IMPORT_STYLES|IMPORT_MASTERSTYLES|IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_SETTINGS|IMPORT_FONTDECLS );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdXMLImport::SdXMLImport( sal_Bool bIsDraw, sal_uInt16 nImportFlags )
+: SvXMLImport( nImportFlags ),
+ mpMasterStylesContext(0L),
mpDocElemTokenMap(0L),
mpBodyElemTokenMap(0L),
mpStylesElemTokenMap(0L),
diff --git a/xmloff/source/draw/sdxmlimp_impl.hxx b/xmloff/source/draw/sdxmlimp_impl.hxx
index 59ce2fe27c3a..89cc3a63b102 100644
--- a/xmloff/source/draw/sdxmlimp_impl.hxx
+++ b/xmloff/source/draw/sdxmlimp_impl.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: sdxmlimp_impl.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: cl $ $Date: 2001-02-21 18:04:45 $
+ * last change: $Author: cl $ $Date: 2001-03-01 16:31:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -256,7 +256,7 @@ protected:
com::sun::star::xml::sax::XAttributeList>& xAttrList);
public:
- SdXMLImport( sal_Bool bIsDraw );
+ SdXMLImport( sal_Bool bIsDraw, sal_uInt16 nImportFlags = IMPORT_ALL );
~SdXMLImport();
// XImporter
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 2896cbacaf80..93246c55b63c 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ximpshap.cxx,v $
*
- * $Revision: 1.30 $
+ * $Revision: 1.31 $
*
- * last change: $Author: bm $ $Date: 2001-02-27 12:53:38 $
+ * last change: $Author: cl $ $Date: 2001-03-01 16:31:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -107,6 +107,10 @@
#include <com/sun/star/drawing/PointSequence.hpp>
#endif
+#ifndef _COM_SUN_STAR_STYLE_XSTYLEFAMILIESSUPPLIER_HPP_
+#include <com/sun/star/style/XStyleFamiliesSupplier.hPP>
+#endif
+
#ifndef _XEXPTRANSFORM_HXX
#include "xexptran.hxx"
#endif
@@ -358,62 +362,137 @@ void SdXMLShapeContext::SetTransformation()
void SdXMLShapeContext::SetStyle()
{
- do
+ try
{
- // set style on shape
- if(maDrawStyleName.getLength() == 0 || !mxShape.is())
- break;
+ do
+ {
+ XMLPropStyleContext* pDocStyle = NULL;
- const SvXMLStyleContext* pStyle = 0L;
- sal_Bool bAutoStyle(FALSE);
+ // set style on shape
+ if(maDrawStyleName.getLength() == 0 || !mxShape.is())
+ break;
- if(GetImport().GetShapeImport()->GetAutoStylesContext())
- pStyle = GetImport().GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext(mnStyleFamily, maDrawStyleName);
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if( !xPropSet.is() )
+ break;
- if(pStyle)
- bAutoStyle = TRUE;
+ const SvXMLStyleContext* pStyle = 0L;
+ sal_Bool bAutoStyle(FALSE);
- if(!pStyle && GetImport().GetShapeImport()->GetStylesContext())
- pStyle = GetImport().GetShapeImport()->GetStylesContext()->FindStyleChildContext(mnStyleFamily, maDrawStyleName);
+ if(GetImport().GetShapeImport()->GetAutoStylesContext())
+ pStyle = GetImport().GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext(mnStyleFamily, maDrawStyleName);
- if(NULL == pStyle || !pStyle->ISA(XMLShapeStyleContext) )
- break;
+ if(pStyle)
+ bAutoStyle = TRUE;
- uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
- if( !xPropSet.is() )
- break;
+ if(!pStyle && GetImport().GetShapeImport()->GetStylesContext())
+ pStyle = GetImport().GetShapeImport()->GetStylesContext()->FindStyleChildContext(mnStyleFamily, maDrawStyleName);
- XMLPropStyleContext* pDocStyle =
- PTR_CAST( XMLShapeStyleContext, pStyle );
+ OUString aStyleName = maDrawStyleName;
+ uno::Reference< style::XStyle > xStyle;
- if( pDocStyle->GetStyle().is() )
- {
- // set style on object
- uno::Any aAny;
- aAny <<= pDocStyle->GetStyle();
- xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Style")), aAny);
- }
+ if( pStyle && pStyle->ISA(XMLShapeStyleContext) )
+ {
+ pDocStyle = PTR_CAST( XMLShapeStyleContext, pStyle );
- // we are finished if this is not a auto style
- if(!bAutoStyle)
- break;
+ if( pDocStyle->GetStyle().is() )
+ {
+ xStyle = pDocStyle->GetStyle();
+ }
+ else
+ {
+ aStyleName = pDocStyle->GetParent();
+ }
+ }
- // check if this is a control shape
- // if so we must split the style for the shape and its control model
- uno::Reference< drawing::XControlShape > xControl( mxShape, uno::UNO_QUERY );
- if( xControl.is() )
- {
- uno::Reference< beans::XPropertySet > xControlModel( xControl->getControl(), uno::UNO_QUERY );
- if( !xControlModel.is() )
- break;
+ if( !xStyle.is() )
+ {
+ uno::Reference< style::XStyleFamiliesSupplier > xFamiliesSupplier( GetImport().GetModel(), uno::UNO_QUERY );
- xPropSet = PropertySetMerger_CreateInstance( xPropSet, xControlModel );
- }
+ if( !xFamiliesSupplier.is() )
+ {
+ DBG_ERROR( "XModel does not support XStyleFamiliesSupplier!" );
+ break;
+ }
+
+ uno::Reference< container::XNameAccess > xFamilies( xFamiliesSupplier->getStyleFamilies() );
+ if( !xFamilies.is() )
+ {
+ DBG_ERROR( "XModel has no style families!" );
+ break;
+ }
+
+ uno::Reference< container::XNameAccess > xFamily;
- // set PropertySet on object
- pDocStyle->FillPropertySet(xPropSet);
+ if( XML_STYLE_FAMILY_SD_PRESENTATION_ID == mnStyleFamily )
+ {
+ sal_Int32 nPos = -1;
+ OUString aFamily;
+
+ do
+ {
+ nPos++;
+ nPos = aStyleName.indexOf( sal_Unicode('-'), nPos );
+ if( -1 != nPos )
+ aFamily = aStyleName.copy( 0, nPos );
+
+ } while( -1 != nPos && !xFamilies->hasByName( aFamily ) );
+
+ if( -1 == nPos )
+ break;
+
+ xFamilies->getByName( aFamily ) >>= xFamily;
+ aStyleName = aStyleName.copy( nPos + 1 );
+ }
+ else
+ {
+ // get graphics familie
+ xFamilies->getByName( OUString( RTL_CONSTASCII_USTRINGPARAM( "graphics" ) ) ) >>= xFamily;
+ }
+
+ if( xFamily.is() )
+ xFamily->getByName( aStyleName ) >>= xStyle;
+ }
- } while(0);
+ if( xStyle.is() )
+ {
+ try
+ {
+ // set style on object
+ uno::Any aAny;
+ aAny <<= xStyle;
+ xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Style")), aAny);
+ }
+ catch( uno::Exception& e )
+ {
+ DBG_ERROR( "could not find style for shape!" );
+ }
+ }
+
+ // if this is an auto style, set its properties
+ if(bAutoStyle && pDocStyle)
+ {
+ // check if this is a control shape
+ // if so we must split the style for the shape and its control model
+ uno::Reference< drawing::XControlShape > xControl( mxShape, uno::UNO_QUERY );
+ if( xControl.is() )
+ {
+ uno::Reference< beans::XPropertySet > xControlModel( xControl->getControl(), uno::UNO_QUERY );
+ if( !xControlModel.is() )
+ break;
+
+ xPropSet = PropertySetMerger_CreateInstance( xPropSet, xControlModel );
+ }
+
+ // set PropertySet on object
+ pDocStyle->FillPropertySet(xPropSet);
+ }
+
+ } while(0);
+ }
+ catch( uno::Exception& e )
+ {
+ }
}
void SdXMLShapeContext::SetLayer()
diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx
index 1aab71a0bedc..58cfeda41506 100644
--- a/xmloff/source/draw/ximpstyl.cxx
+++ b/xmloff/source/draw/ximpstyl.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ximpstyl.cxx,v $
*
- * $Revision: 1.19 $
+ * $Revision: 1.20 $
*
- * last change: $Author: cl $ $Date: 2001-02-11 13:21:57 $
+ * last change: $Author: cl $ $Date: 2001-03-01 16:31:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1130,15 +1130,18 @@ void SdXMLStylesContext::EndElement()
XMLShapeStyleContext* pDocStyle = (XMLShapeStyleContext*)pStyle;
// pDocStyle->Filter();
- pStyle = GetSdImport().GetShapeImport()->GetStylesContext()->FindStyleChildContext(
- pStyle->GetFamily(), pStyle->GetParent());
-
- if(pStyle && pStyle->ISA(XMLShapeStyleContext))
+ SvXMLStylesContext* pStylesContext = GetSdImport().GetShapeImport()->GetStylesContext();
+ if( pStylesContext )
{
- XMLShapeStyleContext* pParentStyle = (XMLShapeStyleContext*)pStyle;
- if(pParentStyle->GetStyle().is())
+ pStyle = pStylesContext->FindStyleChildContext(pStyle->GetFamily(), pStyle->GetParent());
+
+ if(pStyle && pStyle->ISA(XMLShapeStyleContext))
{
- pDocStyle->SetStyle(pParentStyle->GetStyle());
+ XMLShapeStyleContext* pParentStyle = (XMLShapeStyleContext*)pStyle;
+ if(pParentStyle->GetStyle().is())
+ {
+ pDocStyle->SetStyle(pParentStyle->GetStyle());
+ }
}
}
}