diff options
Diffstat (limited to 'sw/source/filter')
-rw-r--r-- | sw/source/filter/basflt/fltini.cxx | 24 | ||||
-rw-r--r-- | sw/source/filter/basflt/shellio.cxx | 11 | ||||
-rw-r--r-- | sw/source/filter/inc/fltini.hxx | 9 | ||||
-rw-r--r-- | sw/source/filter/xml/swxml.cxx | 99 |
4 files changed, 121 insertions, 22 deletions
diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx index 6fdd73c186b9..23009829818b 100644 --- a/sw/source/filter/basflt/fltini.cxx +++ b/sw/source/filter/basflt/fltini.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fltini.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: jp $ $Date: 2001-10-30 14:38:12 $ + * last change: $Author: jp $ $Date: 2001-11-14 16:26:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -64,6 +64,8 @@ #pragma hdrstop +#define _SVSTDARR_STRINGS + #include <string.h> #include <stdio.h> // sscanf @@ -80,6 +82,7 @@ #ifndef _PARHTML_HXX //autogen #include <svtools/parhtml.hxx> #endif +#include <svtools/svstdarr.hxx> #ifndef _SVSTOR_HXX //autogen #include <so3/svstor.hxx> #endif @@ -396,6 +399,23 @@ ULONG Sw3Reader::Read( SwDoc &rDoc, SwPaM &rPam, const String & ) return nRet; } + // read the sections of the document, which is equal to the medium. + // returns the count of it +USHORT Sw3Reader::GetSectionList( SfxMedium& rMedium, + SvStrings& rStrings ) const +{ + SvStorageRef aStg( rMedium.GetStorage() ); + const SfxFilter* pFlt = rMedium.GetFilter(); + ASSERT( pFlt && pFlt->GetVersion(), + "Kein Filter oder Filter ohne FF-Version" ); + if( pFlt && pFlt->GetVersion() ) + aStg->SetVersion( (long)pFlt->GetVersion() ); + + if( pIO ) + pIO->GetSectionList( &aStg, rStrings ); + return rStrings.Count(); +} + ULONG Sw3Writer::WriteStorage() { diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index adfe4dcd435f..8bbfed3c00f7 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -2,9 +2,9 @@ * * $RCSfile: shellio.cxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: dvo $ $Date: 2001-11-08 18:55:01 $ + * last change: $Author: jp $ $Date: 2001-11-14 16:26:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -802,6 +802,13 @@ void Reader::ResetFrmFmts( SwDoc& rDoc ) } } + // read the sections of the document, which is equal to the medium. + // returns the count of it +USHORT Reader::GetSectionList( SfxMedium&, SvStrings& ) const +{ + return 0; +} + // ------------------------------------------------ BOOL SwReader::HasGlossaries( const Reader& rOptions ) { diff --git a/sw/source/filter/inc/fltini.hxx b/sw/source/filter/inc/fltini.hxx index 66bf746d2782..7b148af4d37b 100644 --- a/sw/source/filter/inc/fltini.hxx +++ b/sw/source/filter/inc/fltini.hxx @@ -2,9 +2,9 @@ * * $RCSfile: fltini.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: jp $ $Date: 2001-04-05 15:00:51 $ + * last change: $Author: jp $ $Date: 2001-11-14 16:27:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -157,6 +157,11 @@ public: virtual int GetReaderType(); XMLReader(); + + // read the sections of the document, which is equal to the medium. + // returns the count of it + virtual USHORT GetSectionList( SfxMedium& rMedium, + SvStrings& rStrings ) const; }; // die speziellen Writer diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index e29435538a05..2270b498e94c 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -2,9 +2,9 @@ * * $RCSfile: swxml.cxx,v $ * - * $Revision: 1.42 $ + * $Revision: 1.43 $ * - * last change: $Author: dvo $ $Date: 2001-08-03 16:21:37 $ + * last change: $Author: jp $ $Date: 2001-11-14 16:28:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -66,6 +66,9 @@ #pragma hdrstop + +#define _SVSTDARR_STRINGS + #ifndef _RSCSFX_HXX #include <rsc/rscsfx.hxx> #endif @@ -95,6 +98,8 @@ #include <com/sun/star/task/XStatusIndicatorFactory.hpp> #endif +#include <svtools/svstdarr.hxx> + #ifndef _SFXDOCFILE_HXX //autogen wg. SfxMedium #include <sfx2/docfile.hxx> #endif @@ -104,6 +109,18 @@ #ifndef _UTL_STREAM_WRAPPER_HXX_ #include <unotools/streamwrap.hxx> #endif +#ifndef _XMLGRHLP_HXX +#include <svx/xmlgrhlp.hxx> +#endif +#ifndef _XMLEOHLP_HXX +#include <svx/xmleohlp.hxx> +#endif +#ifndef _COMPHELPER_GENERICPROPERTYSET_HXX_ +#include <comphelper/genericpropertyset.hxx> +#endif +#ifndef _RTL_LOGFILE_HXX_ +#include <rtl/logfile.hxx> +#endif #ifndef _SWSWERROR_H #include <swerror.h> @@ -126,25 +143,16 @@ #ifndef _SWMODULE_HXX #include <swmodule.hxx> #endif -#ifndef _XMLGRHLP_HXX -#include <svx/xmlgrhlp.hxx> -#endif -#ifndef _XMLEOHLP_HXX -#include <svx/xmleohlp.hxx> +#ifndef _SW_XMLSECTIONLIST_HXX +#include <SwXMLSectionList.hxx> #endif -#ifndef _COMPHELPER_GENERICPROPERTYSET_HXX_ -#include <comphelper/genericpropertyset.hxx> +#ifndef _XMLIMP_HXX +#include <xmlimp.hxx> #endif + #ifndef _STATSTR_HRC #include <statstr.hrc> #endif -#ifndef _RTL_LOGFILE_HXX_ -#include <rtl/logfile.hxx> -#endif - -#ifndef _XMLIMP_HXX -#include "xmlimp.hxx" -#endif #define LOGFILE_AUTHOR "mb93740" @@ -732,3 +740,62 @@ sal_uInt32 XMLReader::Read( SwDoc &rDoc, SwPaM &rPaM, const String & rName ) return nRet; } + + // read the sections of the document, which is equal to the medium. + // returns the count of it +USHORT XMLReader::GetSectionList( SfxMedium& rMedium, + SvStrings& rStrings ) const +{ + SvStorage* pStg; + Reference< lang::XMultiServiceFactory > xServiceFactory = + comphelper::getProcessServiceFactory(); + ASSERT( xServiceFactory.is(), + "XMLReader::Read: got no service manager" ); + if( xServiceFactory.is() && 0 != ( pStg = rMedium.GetStorage() ) ) + { + xml::sax::InputSource aParserInput; + OUString sDocName( RTL_CONSTASCII_USTRINGPARAM( "content.xml" ) ); + aParserInput.sSystemId = sDocName; + SvStorageStreamRef xDocStream = pStg->OpenStream( sDocName, + ( STREAM_READ | STREAM_SHARE_DENYWRITE | STREAM_NOCREATE ) ); + xDocStream->Seek( 0L ); + xDocStream->SetBufferSize( 16*1024 ); + aParserInput.aInputStream = new utl::OInputStreamWrapper( *xDocStream ); + + // get parser + Reference< XInterface > xXMLParser = xServiceFactory->createInstance( + OUString::createFromAscii("com.sun.star.xml.sax.Parser") ); + ASSERT( xXMLParser.is(), + "XMLReader::Read: com.sun.star.xml.sax.Parser service missing" ); + if( xXMLParser.is() ) + { + // get filter + Reference< xml::sax::XDocumentHandler > xFilter = + new SwXMLSectionList( rStrings ); + + // connect parser and filter + Reference< xml::sax::XParser > xParser( xXMLParser, UNO_QUERY ); + xParser->setDocumentHandler( xFilter ); + + // parse + try + { + xParser->parseStream( aParserInput ); + } + catch( xml::sax::SAXParseException& ) + { + // re throw ? + } + catch( xml::sax::SAXException& ) + { + // re throw ? + } + catch( io::IOException& ) + { + // re throw ? + } + } + } + return rStrings.Count(); +} + |