diff options
author | Christian Lippka <cl@openoffice.org> | 2001-05-03 11:20:25 +0000 |
---|---|---|
committer | Christian Lippka <cl@openoffice.org> | 2001-05-03 11:20:25 +0000 |
commit | bd09ab59bf6f75459347919446b0c95ccc817277 (patch) | |
tree | 7109d0e875e49ee50d4bf509a871d6ad71e997b6 | |
parent | 026d66401af2ba09bf09616fc05de078950a9e6f (diff) |
#86276# added organizer support for xml files
-rw-r--r-- | sd/inc/sdxmlwrp.hxx | 16 | ||||
-rw-r--r-- | sd/source/filter/xml/sdxmlwrp.cxx | 54 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshel4.cxx | 75 |
3 files changed, 94 insertions, 51 deletions
diff --git a/sd/inc/sdxmlwrp.hxx b/sd/inc/sdxmlwrp.hxx index 50001fd48..3f8049d9b 100644 --- a/sd/inc/sdxmlwrp.hxx +++ b/sd/inc/sdxmlwrp.hxx @@ -2,9 +2,9 @@ * * $RCSfile: sdxmlwrp.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: ka $ $Date: 2001-02-13 12:02:55 $ + * last change: $Author: cl $ $Date: 2001-05-03 12:17:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -67,11 +67,21 @@ // - SdXMLFilter - // --------------- +enum SdXMLFilterMode +{ + SDXMLMODE_Normal, // standard load and save of the complete document + SDXMLMODE_Preview, // only for import, only the first draw page and its master page is loaded + SDXMLMODE_Organizer // only for import, only the styles are loaded +}; + class SdXMLFilter : public SdFilter { +private: + SdXMLFilterMode meFilterMode; + public: - SdXMLFilter( SfxMedium& rMedium, SdDrawDocShell& rDocShell, sal_Bool bShowProgress ); + SdXMLFilter( SfxMedium& rMedium, SdDrawDocShell& rDocShell, sal_Bool bShowProgress, SdXMLFilterMode eFilterMode = SDXMLMODE_Normal ); ~SdXMLFilter(); virtual sal_Bool Import(); diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx index e3e3727d9..eaf9a7526 100644 --- a/sd/source/filter/xml/sdxmlwrp.cxx +++ b/sd/source/filter/xml/sdxmlwrp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: sdxmlwrp.cxx,v $ * - * $Revision: 1.24 $ + * $Revision: 1.25 $ * - * last change: $Author: ka $ $Date: 2001-04-10 12:07:19 $ + * last change: $Author: cl $ $Date: 2001-05-03 12:17:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -188,8 +188,8 @@ struct XML_SERVICEMAP // - SdXMLWrapper - // ---------------- -SdXMLFilter::SdXMLFilter( SfxMedium& rMedium, SdDrawDocShell& rDocShell, sal_Bool bShowProgress ) : - SdFilter( rMedium, rDocShell, bShowProgress ) +SdXMLFilter::SdXMLFilter( SfxMedium& rMedium, SdDrawDocShell& rDocShell, sal_Bool bShowProgress, SdXMLFilterMode eFilterMode ) : + SdFilter( rMedium, rDocShell, bShowProgress ), meFilterMode( eFilterMode ) { } @@ -291,17 +291,26 @@ sal_Bool SdXMLFilter::Import() } else { - aServices[i ].mpService = IsDraw() ? sXML_import_draw_meta_service : sXML_import_impress_meta_service; - aServices[i++].mpStream = sXML_metaStreamName; + if( (mrDocShell.GetCreateMode() != SFX_CREATE_MODE_EMBEDDED) && (meFilterMode != SDXMLMODE_Organizer) ) + { + aServices[i ].mpService = IsDraw() ? sXML_import_draw_meta_service : sXML_import_impress_meta_service; + aServices[i++].mpStream = sXML_metaStreamName; + } aServices[i ].mpService = IsDraw() ? sXML_import_draw_styles_service : sXML_import_impress_styles_service; aServices[i++].mpStream = sXML_styleStreamName; - aServices[i ].mpService = IsDraw() ? sXML_import_draw_content_service : sXML_import_impress_content_service; - aServices[i++].mpStream = sXML_contentStreamName; + if( meFilterMode != SDXMLMODE_Organizer ) + { + aServices[i ].mpService = IsDraw() ? sXML_import_draw_content_service : sXML_import_impress_content_service; + aServices[i++].mpStream = sXML_contentStreamName; + } - aServices[i ].mpService = IsDraw() ? sXML_import_draw_settings_service : sXML_import_impress_settings_service; - aServices[i++].mpStream = sXML_settingsStreamName; + if( meFilterMode != SDXMLMODE_Organizer ) + { + aServices[i ].mpService = IsDraw() ? sXML_import_draw_settings_service : sXML_import_impress_settings_service; + aServices[i++].mpStream = sXML_settingsStreamName; + } } aServices[i].mpService = NULL; @@ -513,21 +522,24 @@ sal_Bool SdXMLFilter::Export() uno::Reference< lang::XComponent > xComponent( mxModel, uno::UNO_QUERY ); - XML_SERVICEMAP aServices[5]; - aServices[0].mpService = IsDraw() ? sXML_export_draw_meta_service : sXML_export_impress_meta_service; - aServices[0].mpStream = sXML_metaStreamName; + XML_SERVICEMAP aServices[5]; sal_uInt16 i = 0; + aServices[i ].mpService = IsDraw() ? sXML_export_draw_styles_service : sXML_export_impress_styles_service; + aServices[i++].mpStream = sXML_styleStreamName; - aServices[1].mpService = IsDraw() ? sXML_export_draw_styles_service : sXML_export_impress_styles_service; - aServices[1].mpStream = sXML_styleStreamName; + aServices[i ].mpService = IsDraw() ? sXML_export_draw_content_service : sXML_export_impress_content_service; + aServices[i++].mpStream = sXML_contentStreamName; - aServices[2].mpService = IsDraw() ? sXML_export_draw_content_service : sXML_export_impress_content_service; - aServices[2].mpStream = sXML_contentStreamName; + aServices[i ].mpService = IsDraw() ? sXML_export_draw_settings_service : sXML_export_impress_settings_service; + aServices[i++].mpStream = sXML_settingsStreamName; - aServices[3].mpService = IsDraw() ? sXML_export_draw_settings_service : sXML_export_impress_settings_service; - aServices[3].mpStream = sXML_settingsStreamName; + if( mrDocShell.GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + { + aServices[i ].mpService = IsDraw() ? sXML_export_draw_meta_service : sXML_export_impress_meta_service; + aServices[i++].mpStream = sXML_metaStreamName; + }; - aServices[4].mpService = NULL; - aServices[4].mpStream = NULL; + aServices[i].mpService = NULL; + aServices[i].mpStream = NULL; XML_SERVICEMAP* pServices = aServices; diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index 2da8b3c2e..3a24035de 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -2,9 +2,9 @@ * * $RCSfile: docshel4.cxx,v $ * - * $Revision: 1.23 $ + * $Revision: 1.24 $ * - * last change: $Author: thb $ $Date: 2001-04-26 17:11:08 $ + * last change: $Author: cl $ $Date: 2001-05-03 12:20:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -427,44 +427,65 @@ BOOL SdDrawDocShell::Load( SvStorage* pStore ) BOOL SdDrawDocShell::LoadFrom(SvStorage* pStor) { - BOOL bRet = FALSE; + const ULONG nStoreVer = pStor->GetVersion(); + const BOOL bBinary = ( nStoreVer < SOFFICE_FILEFORMAT_60 ); - BOOL bRet1 = SfxObjectShell::LoadFrom(pStor); - BOOL bRet2 = TRUE; WaitObject* pWait = NULL; - if( pViewShell ) pWait = new WaitObject( (Window*) pViewShell->GetActiveWindow() ); - // da trotz eines erfolgten InitNew() noch LoadFrom() gerufen werden kann, - // muessen die Vorlagen hier geloescht werden - GetStyleSheetPool()->Clear(); - - // Pool und StyleSheet Pool laden - SvStorageStreamRef aPoolStm = pStor->OpenStream(pSfxStyleSheets); - aPoolStm->SetVersion(pStor->GetVersion()); - aPoolStm->SetKey(pStor->GetKey()); - bRet2 = aPoolStm->GetError() == 0; - if (bRet2) + BOOL bRet = FALSE; + if( bBinary ) { - aPoolStm->SetBufferSize( 32768 ); - GetPool().SetFileFormatVersion((USHORT)pStor->GetVersion()); - GetPool().Load(*aPoolStm); + + BOOL bRet1 = SfxObjectShell::LoadFrom(pStor); + BOOL bRet2 = TRUE; + + // da trotz eines erfolgten InitNew() noch LoadFrom() gerufen werden kann, + // muessen die Vorlagen hier geloescht werden + GetStyleSheetPool()->Clear(); + + // Pool und StyleSheet Pool laden + SvStorageStreamRef aPoolStm = pStor->OpenStream(pSfxStyleSheets); + aPoolStm->SetVersion(pStor->GetVersion()); + aPoolStm->SetKey(pStor->GetKey()); bRet2 = aPoolStm->GetError() == 0; - DBG_ASSERT(bRet2, "Fehler beim Laden des Item-Pools"); - } + if (bRet2) + { + aPoolStm->SetBufferSize( 32768 ); + GetPool().SetFileFormatVersion((USHORT)pStor->GetVersion()); + GetPool().Load(*aPoolStm); + bRet2 = aPoolStm->GetError() == 0; + DBG_ASSERT(bRet2, "Fehler beim Laden des Item-Pools"); + } + + if (bRet2) + { + GetStyleSheetPool()->Load(*aPoolStm); + bRet2 = aPoolStm->GetError() == 0; + aPoolStm->SetBufferSize(0); + DBG_ASSERT(bRet2, "Fehler beim Laden des StyleSheet-Pools"); + } - if (bRet2) + bRet = bRet1 || bRet2; + } + else { - GetStyleSheetPool()->Load(*aPoolStm); - bRet2 = aPoolStm->GetError() == 0; - aPoolStm->SetBufferSize(0); - DBG_ASSERT(bRet2, "Fehler beim Laden des StyleSheet-Pools"); + SfxMedium aMedium( pStor ); + + pDoc->NewOrLoadCompleted( NEW_DOC ); + pDoc->CreateFirstPages(); + pDoc->StopWorkStartupDelay(); + + SdFilter* pFilter = new SdXMLFilter( aMedium, *this, sal_True, SDXMLMODE_Organizer ); + + bRet = pFilter ? pFilter->Import() : FALSE; + delete pFilter; + } delete pWait; - bRet = bRet1 || bRet2; return bRet; } |