diff options
-rw-r--r-- | sw/CustomTarget_generated.mk | 34 | ||||
-rw-r--r-- | sw/Library_sw.mk | 1 | ||||
-rw-r--r-- | sw/Module_sw.mk | 1 | ||||
-rw-r--r-- | sw/source/core/inc/SwXMLBlockImport.hxx | 76 | ||||
-rw-r--r-- | sw/source/core/swg/BlockListTokens.txt | 7 | ||||
-rw-r--r-- | sw/source/core/swg/SwXMLBlockImport.cxx | 404 | ||||
-rw-r--r-- | sw/source/core/swg/SwXMLTextBlocks1.cxx | 93 | ||||
-rw-r--r-- | sw/source/core/swg/TextBlockTokens.txt | 5 |
8 files changed, 225 insertions, 396 deletions
diff --git a/sw/CustomTarget_generated.mk b/sw/CustomTarget_generated.mk deleted file mode 100644 index 27527990e63c..000000000000 --- a/sw/CustomTarget_generated.mk +++ /dev/null @@ -1,34 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# - -$(eval $(call gb_CustomTarget_CustomTarget,sw/generated)) - -sw_SRC := $(SRCDIR)/sw/source/core/swg -sw_PL := $(SRCDIR)/solenv/bin/gentoken.pl -sw_INC := $(call gb_CustomTarget_get_workdir,sw/generated) - -$(sw_INC)/TextBlockTokens.gperf : $(sw_SRC)/TextBlockTokens.txt $(sw_PL) - mkdir -p $(sw_INC) - $(PERL) $(sw_PL) $(sw_SRC)/TextBlockTokens.txt $(sw_INC)/TextBlockTokens.gperf - -$(sw_INC)/BlockListTokens.gperf : $(sw_SRC)/BlockListTokens.txt $(sw_PL) - mkdir -p $(sw_INC) - $(PERL) $(sw_PL) $(sw_SRC)/BlockListTokens.txt $(sw_INC)/BlockListTokens.gperf - -$(sw_INC)/tokens.cxx : $(sw_INC)/TextBlockTokens.gperf $(sw_INC)/BlockListTokens.gperf - $(GPERF) --compare-strncmp --readonly-tables --output-file=$(sw_INC)/tokens.cxx \ - --class-name=TextBlockTokens --word-array-name=textBlockList --enum $(sw_INC)/TextBlockTokens.gperf - $(GPERF) --compare-strncmp --readonly-tables -T $(sw_INC)/BlockListTokens.gperf \ - --class-name=BlockListTokens --word-array-name=blockListList >> $(sw_INC)/tokens.cxx - sed -i -e "s/(char\*)0/(char\*)0, XML_TOKEN_INVALID/g" $(sw_INC)/tokens.cxx - sed -i -e "/^#line/d" $(sw_INC)/tokens.cxx - -$(call gb_CustomTarget_get_target,sw/generated) : $(sw_INC)/tokens.cxx - -# vim: set noet sw=4 ts=4: diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index 2816b0524ff7..c4753150a5c8 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -36,7 +36,6 @@ $(eval $(call gb_Library_set_include,sw,\ $(eval $(call gb_Library_use_custom_headers,sw,\ officecfg/registry \ - sw/generated \ )) $(eval $(call gb_Library_use_sdk_api,sw)) diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index bf110be6a29c..a7a31efbab44 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -21,7 +21,6 @@ $(eval $(call gb_Module_Module,sw)) $(eval $(call gb_Module_add_targets,sw,\ $(call gb_Helper_optional,DESKTOP,Executable_tiledrendering) \ - CustomTarget_generated \ Library_msword \ Library_sw \ Library_swd \ diff --git a/sw/source/core/inc/SwXMLBlockImport.hxx b/sw/source/core/inc/SwXMLBlockImport.hxx index 9c4e77c388cf..ac166fd3d459 100644 --- a/sw/source/core/inc/SwXMLBlockImport.hxx +++ b/sw/source/core/inc/SwXMLBlockImport.hxx @@ -21,14 +21,6 @@ #define INCLUDED_SW_SOURCE_CORE_INC_SWXMLBLOCKIMPORT_HXX #include <xmloff/xmlimp.hxx> -#include <xmloff/nmspmap.hxx> -#include <xmloff/xmlnmspe.hxx> -#include <com/sun/star/xml/sax/XFastTokenHandler.hpp> -#include <com/sun/star/xml/sax/FastToken.hpp> -#include <sax/fastattribs.hxx> - -using namespace css::xml::sax; -using namespace xmloff::token; class SwXMLTextBlocks; class SwXMLBlockListImport : public SvXMLImport @@ -39,8 +31,10 @@ private: protected: // This method is called after the namespace map has been updated, but // before a context for the current element has been pushed. - virtual SvXMLImportContext* CreateFastContext( sal_Int32 Element, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) SAL_OVERRIDE; + virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE; public: SwXMLBlockListImport( @@ -63,8 +57,10 @@ private: protected: // This method is called after the namespace map has been updated, but // before a context for the current element has been pushed. - virtual SvXMLImportContext* CreateFastContext( sal_Int32 Element, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) SAL_OVERRIDE; + virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE; public: bool bTextOnly; @@ -83,62 +79,6 @@ public: throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; }; -enum SwXMLTextBlockToken : sal_Int32 -{ - OFFICE_BODY = FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_BODY, - OFFICE_TEXT = FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_TEXT, - OFFICE_DOCUMENT = FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_DOCUMENT, - OFFICE_DOCUMENT_CONTENT = FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_DOCUMENT_CONTENT, - TEXT_P = FastToken::NAMESPACE | XML_NAMESPACE_TEXT | XML_P -}; - -class SwXMLTextBlockTokenHandler : public - cppu::WeakImplHelper1< css::xml::sax::XFastTokenHandler >, - public sax_fastparser::FastTokenHandlerBase -{ -public: - SwXMLTextBlockTokenHandler(); - virtual ~SwXMLTextBlockTokenHandler(); - - //XFastTokenHandler - sal_Int32 SAL_CALL getTokenFromUTF8( const css::uno::Sequence< sal_Int8 >& Identifier ) - throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - css::uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 Token ) - throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - - //Much fast direct C++ shortcut to the method that matters - virtual sal_Int32 getTokenDirect( const char *pTag, sal_Int32 nLength ) const SAL_OVERRIDE; -}; - -enum SwXMLBlockListToken : sal_Int32 -{ - ABBREVIATED_NAME = FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST | XML_ABBREVIATED_NAME, - BLOCK = FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST | XML_BLOCK, - BLOCK_LIST = FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST | XML_BLOCK_LIST, - LIST_NAME = FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST | XML_LIST_NAME, - NAME = FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST | XML_NAME, - PACKAGE_NAME = FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST | XML_PACKAGE_NAME, - UNFORMATTED_TEXT = FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST | XML_UNFORMATTED_TEXT -}; - -class SwXMLBlockListTokenHandler : public - cppu::WeakImplHelper1< css::xml::sax::XFastTokenHandler >, - public sax_fastparser::FastTokenHandlerBase -{ -public: - SwXMLBlockListTokenHandler(); - virtual ~SwXMLBlockListTokenHandler(); - - //XFastTokenHandler - sal_Int32 SAL_CALL getTokenFromUTF8( const css::uno::Sequence< sal_Int8 >& Identifier ) - throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - css::uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 Token ) - throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - - //Much fast direct C++ shortcut to the method that matters - virtual sal_Int32 getTokenDirect( const char *pTag, sal_Int32 nLength ) const SAL_OVERRIDE; -}; - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/swg/BlockListTokens.txt b/sw/source/core/swg/BlockListTokens.txt deleted file mode 100644 index 0b5a64607b3e..000000000000 --- a/sw/source/core/swg/BlockListTokens.txt +++ /dev/null @@ -1,7 +0,0 @@ -abbreviated-name -block -block-list -list-name -name -package-name -unformatted-text diff --git a/sw/source/core/swg/SwXMLBlockImport.cxx b/sw/source/core/swg/SwXMLBlockImport.cxx index dcc69095a5e0..5d5355b293ee 100644 --- a/sw/source/core/swg/SwXMLBlockImport.cxx +++ b/sw/source/core/swg/SwXMLBlockImport.cxx @@ -18,27 +18,16 @@ */ #include <SwXMLBlockImport.hxx> +#include <xmloff/nmspmap.hxx> +#include <xmloff/xmlnmspe.hxx> #include <SwXMLTextBlocks.hxx> #include <xmloff/xmlictxt.hxx> #include <unotools/charclass.hxx> #include <swtypes.hxx> -#if defined __clang__ -#if __has_warning("-Wdeprecated-register") -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-register" -#endif -#endif -#include <tokens.cxx> -#if defined __clang__ -#if __has_warning("-Wdeprecated-register") -#pragma GCC diagnostic pop -#endif -#endif - -using namespace ::com::sun::star::uno; using namespace ::com::sun::star; -using namespace css::xml::sax; +using namespace ::xmloff::token; + class SwXMLBlockListImport; class SwXMLTextBlockImport; @@ -49,20 +38,24 @@ private: SwXMLBlockListImport & rLocalRef; public: - SwXMLBlockListContext( SwXMLBlockListImport& rImport, sal_Int32 Element, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ); + SwXMLBlockListContext( SwXMLBlockListImport& rImport, + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference<xml::sax::XAttributeList> & xAttrList); virtual ~SwXMLBlockListContext ( void ); + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference<xml::sax::XAttributeList> & xAttrList) SAL_OVERRIDE; - virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( - sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) - throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; }; class SwXMLBlockContext : public SvXMLImportContext { public: - SwXMLBlockContext( SwXMLBlockListImport& rImport, sal_Int32 Element, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ); + SwXMLBlockContext( SwXMLBlockListImport& rImport, + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference<xml::sax::XAttributeList> & xAttrList); virtual ~SwXMLBlockContext ( void ); }; @@ -72,13 +65,13 @@ private: SwXMLTextBlockImport & rLocalRef; public: - SwXMLTextBlockDocumentContext( SwXMLTextBlockImport& rImport, sal_Int32 Element, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ); - - virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( - sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) - throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; - + SwXMLTextBlockDocumentContext( SwXMLTextBlockImport& rImport, + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference<xml::sax::XAttributeList> & xAttrList); + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference<xml::sax::XAttributeList> & xAttrList) SAL_OVERRIDE; virtual ~SwXMLTextBlockDocumentContext ( void ); }; @@ -88,13 +81,13 @@ private: SwXMLTextBlockImport & rLocalRef; public: - SwXMLTextBlockBodyContext( SwXMLTextBlockImport& rImport, sal_Int32 Element, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ); - - virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( - sal_Int32, const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) - throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; - + SwXMLTextBlockBodyContext( SwXMLTextBlockImport& rImport, + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference<xml::sax::XAttributeList > & xAttrList); + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference<xml::sax::XAttributeList> & xAttrList) SAL_OVERRIDE; virtual ~SwXMLTextBlockBodyContext ( void ); }; @@ -104,14 +97,15 @@ private: SwXMLTextBlockImport & rLocalRef; public: - SwXMLTextBlockTextContext( SwXMLTextBlockImport& rImport, sal_Int32 Element, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ); - - virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( - sal_Int32 Element, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) - throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; - + SwXMLTextBlockTextContext( SwXMLTextBlockImport& rImport, + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference< + xml::sax::XAttributeList > & xAttrList ); + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference< + xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE; virtual ~SwXMLTextBlockTextContext ( void ); }; @@ -121,119 +115,101 @@ private: SwXMLTextBlockImport & rLocalRef; public: - SwXMLTextBlockParContext( SwXMLTextBlockImport & rImport, sal_Int32 Element, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ); - - virtual void SAL_CALL characters( const OUString & aChars ) - throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; - + SwXMLTextBlockParContext( SwXMLTextBlockImport& rImport, + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference< + xml::sax::XAttributeList > & xAttrList ); + virtual void Characters( const OUString& rChars ) SAL_OVERRIDE; virtual ~SwXMLTextBlockParContext ( void ); }; -SwXMLTextBlockTokenHandler::SwXMLTextBlockTokenHandler() -{ -} - -SwXMLTextBlockTokenHandler::~SwXMLTextBlockTokenHandler() -{ -} - -sal_Int32 SAL_CALL SwXMLTextBlockTokenHandler::getTokenFromUTF8( const Sequence< sal_Int8 >& Identifier ) - throw (css::uno::RuntimeException, std::exception) -{ - return getTokenDirect( reinterpret_cast< const char* >( Identifier.getConstArray() ), Identifier.getLength() ); -} - -Sequence< sal_Int8 > SAL_CALL SwXMLTextBlockTokenHandler::getUTF8Identifier( sal_Int32 ) - throw (css::uno::RuntimeException, std::exception) -{ - return Sequence< sal_Int8 >(); -} - -sal_Int32 SwXMLTextBlockTokenHandler::getTokenDirect( const char *pTag, sal_Int32 nLength ) const -{ - if( !nLength ) - nLength = strlen( pTag ); - const struct xmltoken* pToken = TextBlockTokens::in_word_set( pTag, nLength ); - return pToken ? pToken->nToken : XML_TOKEN_INVALID; -} - -SwXMLBlockListTokenHandler::SwXMLBlockListTokenHandler() -{ -} - -SwXMLBlockListTokenHandler::~SwXMLBlockListTokenHandler() -{ -} - -sal_Int32 SAL_CALL SwXMLBlockListTokenHandler::getTokenFromUTF8( const Sequence< sal_Int8 >& Identifier ) - throw (css::uno::RuntimeException, std::exception) -{ - return getTokenDirect( reinterpret_cast< const char* >( Identifier.getConstArray() ), Identifier.getLength() ); -} - -Sequence< sal_Int8 > SAL_CALL SwXMLBlockListTokenHandler::getUTF8Identifier( sal_Int32 ) - throw (css::uno::RuntimeException, std::exception) -{ - return Sequence< sal_Int8 >(); -} - -sal_Int32 SwXMLBlockListTokenHandler::getTokenDirect( const char *pTag, sal_Int32 nLength ) const -{ - if( !nLength ) - nLength = strlen( pTag ); - const struct xmltoken* pToken = BlockListTokens::in_word_set( pTag, nLength ); - return pToken ? pToken->nToken : XML_TOKEN_INVALID; -} SwXMLBlockListContext::SwXMLBlockListContext( - SwXMLBlockListImport& rImport, - sal_Int32 /*Element*/, - const uno::Reference< xml::sax::XFastAttributeList > & xAttrList ) : - SvXMLImportContext( rImport ), - rLocalRef( rImport ) -{ - if( xAttrList.is() && xAttrList->hasAttribute( SwXMLBlockListToken::LIST_NAME ) ) - rImport.getBlockList().SetName( xAttrList->getValue( SwXMLBlockListToken::LIST_NAME ) ); + SwXMLBlockListImport& rImport, + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference< + xml::sax::XAttributeList > & xAttrList ) : + SvXMLImportContext ( rImport, nPrefix, rLocalName ), + rLocalRef (rImport) +{ + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for (sal_Int16 i=0; i < nAttrCount; i++) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefx = rImport.GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName); + const OUString& rAttrValue = xAttrList->getValueByIndex( i ); + if ( XML_NAMESPACE_BLOCKLIST == nPrefx ) + { + if ( IsXMLToken ( aLocalName, XML_LIST_NAME ) ) + { + rImport.getBlockList().SetName(rAttrValue); + break; + } + } + } } SwXMLBlockListContext::~SwXMLBlockListContext ( void ) { } -uno::Reference< ::xml::sax::XFastContextHandler > SAL_CALL -SwXMLBlockListContext::createFastChildContext( sal_Int32 Element, - const uno::Reference< xml::sax::XFastAttributeList > & xAttrList ) - throw (uno::RuntimeException, xml::sax::SAXException, std::exception) +SvXMLImportContext *SwXMLBlockListContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference< xml::sax::XAttributeList > & xAttrList ) { - if ( Element == SwXMLBlockListToken::BLOCK ) - return new SwXMLBlockContext( rLocalRef, Element, xAttrList ); + SvXMLImportContext *pContext = 0; + if (nPrefix == XML_NAMESPACE_BLOCKLIST && + IsXMLToken ( rLocalName, XML_BLOCK ) ) + pContext = new SwXMLBlockContext (rLocalRef, nPrefix, rLocalName, xAttrList); else - return new SvXMLImportContext( rLocalRef ); + pContext = new SvXMLImportContext( rLocalRef, nPrefix, rLocalName); + return pContext; } SwXMLBlockContext::SwXMLBlockContext( - SwXMLBlockListImport& rImport, - sal_Int32 /*Element*/, - const uno::Reference< xml::sax::XFastAttributeList > & xAttrList ) : - SvXMLImportContext( rImport ) + SwXMLBlockListImport& rImport, + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference< + xml::sax::XAttributeList > & xAttrList ) : + SvXMLImportContext ( rImport, nPrefix, rLocalName ) { static const CharClass & rCC = GetAppCharClass(); - OUString aShort, aLong, aPackageName; + OUString aShort; + OUString aLong; + OUString aPackageName; bool bTextOnly = false; - if( xAttrList.is() ) + + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for (sal_Int16 i=0; i < nAttrCount; i++) { - if( xAttrList->hasAttribute( SwXMLBlockListToken::ABBREVIATED_NAME ) ) - aShort = rCC.uppercase( xAttrList->getValue( SwXMLBlockListToken::ABBREVIATED_NAME ) ); - if( xAttrList->hasAttribute( SwXMLBlockListToken::NAME ) ) - aLong = xAttrList->getValue( SwXMLBlockListToken::NAME ); - if( xAttrList->hasAttribute( SwXMLBlockListToken::PACKAGE_NAME ) ) - aPackageName = xAttrList->getValue( SwXMLBlockListToken::PACKAGE_NAME ); - if( xAttrList->hasAttribute( SwXMLBlockListToken::UNFORMATTED_TEXT ) ) + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefx = rImport.GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName); + const OUString& rAttrValue = xAttrList->getValueByIndex( i ); + if (XML_NAMESPACE_BLOCKLIST == nPrefx) { - OUString rAttrValue( xAttrList->getValue( SwXMLBlockListToken::UNFORMATTED_TEXT ) ); - if( IsXMLToken( rAttrValue, XML_TRUE ) ) - bTextOnly = true; + if ( IsXMLToken ( aLocalName, XML_ABBREVIATED_NAME ) ) + { + aShort = rCC.uppercase(rAttrValue); + } + else if ( IsXMLToken ( aLocalName, XML_NAME ) ) + { + aLong = rAttrValue; + } + else if ( IsXMLToken ( aLocalName, XML_PACKAGE_NAME ) ) + { + aPackageName = rAttrValue; + } + else if ( IsXMLToken ( aLocalName, XML_UNFORMATTED_TEXT ) ) + { + if ( IsXMLToken ( rAttrValue, XML_TRUE ) ) + bTextOnly = true; + } } } if (aShort.isEmpty() || aLong.isEmpty() || aPackageName.isEmpty()) @@ -246,47 +222,56 @@ SwXMLBlockContext::~SwXMLBlockContext ( void ) } SwXMLTextBlockDocumentContext::SwXMLTextBlockDocumentContext( - SwXMLTextBlockImport& rImport, - sal_Int32 /*Element*/, - const uno::Reference< xml::sax::XFastAttributeList > & /*xAttrList*/ ) : - SvXMLImportContext( rImport ), + SwXMLTextBlockImport& rImport, + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference< + xml::sax::XAttributeList > & ) : + SvXMLImportContext ( rImport, nPrefix, rLocalName ), rLocalRef(rImport) { } -uno::Reference< ::xml::sax::XFastContextHandler > SAL_CALL -SwXMLTextBlockDocumentContext::createFastChildContext( sal_Int32 Element, - const uno::Reference< xml::sax::XFastAttributeList > & xAttrList ) - throw (uno::RuntimeException, xml::sax::SAXException, std::exception) +SvXMLImportContext *SwXMLTextBlockDocumentContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference< xml::sax::XAttributeList > & xAttrList ) { - if ( Element == SwXMLTextBlockToken::OFFICE_BODY ) - return new SwXMLTextBlockBodyContext( rLocalRef, Element, xAttrList ); + SvXMLImportContext *pContext = 0; + if (nPrefix == XML_NAMESPACE_OFFICE && + IsXMLToken ( rLocalName, XML_BODY ) ) + pContext = new SwXMLTextBlockBodyContext (rLocalRef, nPrefix, rLocalName, xAttrList); else - return new SvXMLImportContext( rLocalRef ); + pContext = new SvXMLImportContext( rLocalRef, nPrefix, rLocalName); + return pContext; } - SwXMLTextBlockDocumentContext::~SwXMLTextBlockDocumentContext ( void ) { } SwXMLTextBlockTextContext::SwXMLTextBlockTextContext( - SwXMLTextBlockImport& rImport, - sal_Int32 /*Element*/, - const uno::Reference< xml::sax::XFastAttributeList > & /*xAttrList */) : - SvXMLImportContext ( rImport ), - rLocalRef( rImport ) + SwXMLTextBlockImport& rImport, + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference< + xml::sax::XAttributeList > & ) : + SvXMLImportContext ( rImport, nPrefix, rLocalName ), + rLocalRef(rImport) { } -uno::Reference< xml::sax::XFastContextHandler > SAL_CALL -SwXMLTextBlockTextContext::createFastChildContext( sal_Int32 Element, - const uno::Reference< xml::sax::XFastAttributeList > & xAttrList ) - throw (uno::RuntimeException, xml::sax::SAXException, std::exception) +SvXMLImportContext *SwXMLTextBlockTextContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference< xml::sax::XAttributeList > & xAttrList ) { - if ( Element == SwXMLTextBlockToken::TEXT_P ) - return new SwXMLTextBlockParContext( rLocalRef, Element, xAttrList ); + SvXMLImportContext *pContext = 0; + if (nPrefix == XML_NAMESPACE_TEXT && + IsXMLToken ( rLocalName, XML_P ) ) + pContext = new SwXMLTextBlockParContext (rLocalRef, nPrefix, rLocalName, xAttrList); else - return new SvXMLImportContext( rLocalRef ); + pContext = new SvXMLImportContext( rLocalRef, nPrefix, rLocalName); + return pContext; } SwXMLTextBlockTextContext::~SwXMLTextBlockTextContext ( void ) @@ -294,46 +279,50 @@ SwXMLTextBlockTextContext::~SwXMLTextBlockTextContext ( void ) } SwXMLTextBlockBodyContext::SwXMLTextBlockBodyContext( - SwXMLTextBlockImport& rImport, - sal_Int32 /*Element*/, - const uno::Reference< xml::sax::XFastAttributeList > & /*xAttrList*/ ) : - SvXMLImportContext( rImport ), + SwXMLTextBlockImport& rImport, + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference< + xml::sax::XAttributeList > & ) : + SvXMLImportContext ( rImport, nPrefix, rLocalName ), rLocalRef(rImport) { } -uno::Reference < xml::sax::XFastContextHandler > SAL_CALL -SwXMLTextBlockBodyContext::createFastChildContext( sal_Int32 Element, - const uno::Reference< xml::sax::XFastAttributeList > & xAttrList ) - throw (uno::RuntimeException, xml::sax::SAXException, std::exception) +SvXMLImportContext *SwXMLTextBlockBodyContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference< xml::sax::XAttributeList > & xAttrList ) { - if( Element == SwXMLTextBlockToken::OFFICE_TEXT ) - return new SwXMLTextBlockTextContext( rLocalRef, Element, xAttrList ); - else if( Element == SwXMLTextBlockToken::TEXT_P ) - return new SwXMLTextBlockParContext( rLocalRef, Element, xAttrList ); + SvXMLImportContext *pContext = 0; + if (nPrefix == XML_NAMESPACE_OFFICE && + IsXMLToken ( rLocalName, XML_TEXT ) ) + pContext = new SwXMLTextBlockTextContext (rLocalRef, nPrefix, rLocalName, xAttrList); + else if (nPrefix == XML_NAMESPACE_TEXT && + IsXMLToken ( rLocalName, XML_P ) ) + pContext = new SwXMLTextBlockParContext (rLocalRef, nPrefix, rLocalName, xAttrList); else - return new SvXMLImportContext( rLocalRef ); + pContext = new SvXMLImportContext( rLocalRef, nPrefix, rLocalName); + return pContext; } - SwXMLTextBlockBodyContext::~SwXMLTextBlockBodyContext ( void ) { } - SwXMLTextBlockParContext::SwXMLTextBlockParContext( - SwXMLTextBlockImport& rImport, - sal_Int32 /*Element*/, - const uno::Reference< xml::sax::XFastAttributeList > & /*xAttrList*/ ) : - SvXMLImportContext( rImport ), - rLocalRef( rImport ) + SwXMLTextBlockImport& rImport, + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference< + xml::sax::XAttributeList > & ) : + SvXMLImportContext ( rImport, nPrefix, rLocalName ), + rLocalRef(rImport) { } -void SAL_CALL SwXMLTextBlockParContext::characters( const OUString & aChars ) - throw (uno::RuntimeException, xml::sax::SAXException, std::exception) +void SwXMLTextBlockParContext::Characters( const OUString& rChars ) { - rLocalRef.m_rText += aChars; + rLocalRef.m_rText += rChars; } - SwXMLTextBlockParContext::~SwXMLTextBlockParContext ( void ) { if (rLocalRef.bTextOnly) @@ -346,12 +335,20 @@ SwXMLTextBlockParContext::~SwXMLTextBlockParContext ( void ) } // SwXMLBlockListImport ////////////////////////////// + +sal_Char const sXML_np__block_list[] = "_block-list"; +sal_Char const sXML_np__office[] = "_ooffice"; +sal_Char const sXML_np__text[] = "_otext"; + SwXMLBlockListImport::SwXMLBlockListImport( const uno::Reference< uno::XComponentContext > xContext, SwXMLTextBlocks &rBlocks ) : SvXMLImport( xContext, "", 0 ), rBlockList (rBlocks) { + GetNamespaceMap().Add( OUString ( sXML_np__block_list ), + GetXMLToken ( XML_N_BLOCK_LIST ), + XML_NAMESPACE_BLOCKLIST ); } SwXMLBlockListImport::~SwXMLBlockListImport ( void ) @@ -359,13 +356,19 @@ SwXMLBlockListImport::~SwXMLBlockListImport ( void ) { } -SvXMLImportContext* SwXMLBlockListImport::CreateFastContext( sal_Int32 Element, - const uno::Reference< xml::sax::XFastAttributeList > & xAttrList ) +SvXMLImportContext *SwXMLBlockListImport::CreateContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference< xml::sax::XAttributeList > & xAttrList ) { - if( Element == SwXMLBlockListToken::BLOCK_LIST ) - return new SwXMLBlockListContext( *this, Element, xAttrList ); + SvXMLImportContext *pContext = 0; + if ( XML_NAMESPACE_BLOCKLIST == nPrefix && + IsXMLToken ( rLocalName, XML_BLOCK_LIST ) ) + pContext = new SwXMLBlockListContext( *this, nPrefix, rLocalName, + xAttrList ); else - return SvXMLImport::CreateFastContext( Element, xAttrList ); + pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList ); + return pContext; } SwXMLTextBlockImport::SwXMLTextBlockImport( @@ -378,6 +381,12 @@ SwXMLTextBlockImport::SwXMLTextBlockImport( bTextOnly ( bNewTextOnly ), m_rText ( rNewText ) { + GetNamespaceMap().Add( OUString( sXML_np__office ), + GetXMLToken(XML_N_OFFICE_OOO), + XML_NAMESPACE_OFFICE ); + GetNamespaceMap().Add( OUString( sXML_np__text ), + GetXMLToken(XML_N_TEXT_OOO), + XML_NAMESPACE_TEXT ); } SwXMLTextBlockImport::~SwXMLTextBlockImport ( void ) @@ -385,16 +394,19 @@ SwXMLTextBlockImport::~SwXMLTextBlockImport ( void ) { } -SvXMLImportContext* SwXMLTextBlockImport::CreateFastContext( sal_Int32 Element, - const uno::Reference< xml::sax::XFastAttributeList > & xAttrList ) +SvXMLImportContext *SwXMLTextBlockImport::CreateContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const uno::Reference< xml::sax::XAttributeList > & xAttrList ) { - if( Element == SwXMLTextBlockToken::OFFICE_DOCUMENT || - Element == SwXMLTextBlockToken::OFFICE_DOCUMENT_CONTENT ) - return new SwXMLTextBlockDocumentContext( *this, Element, xAttrList ); + SvXMLImportContext *pContext = 0; + if( XML_NAMESPACE_OFFICE == nPrefix && + IsXMLToken ( rLocalName, bTextOnly ? XML_DOCUMENT : XML_DOCUMENT_CONTENT ) ) + pContext = new SwXMLTextBlockDocumentContext( *this, nPrefix, rLocalName, xAttrList ); else - return SvXMLImport::CreateFastContext( Element, xAttrList ); + pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList ); + return pContext; } - void SAL_CALL SwXMLTextBlockImport::endDocument(void) throw( xml::sax::SAXException, uno::RuntimeException, std::exception ) { diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index 1bd1be13f620..bbae9404a150 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -27,8 +27,6 @@ #include <com/sun/star/xml/sax/InputSource.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/xml/sax/Parser.hpp> -#include <com/sun/star/xml/sax/FastParser.hpp> -#include <com/sun/star/xml/sax/FastToken.hpp> #include <com/sun/star/xml/sax/Writer.hpp> #include <com/sun/star/document/XStorageBasedDocument.hpp> #include <doc.hxx> @@ -37,7 +35,6 @@ #include <SwXMLTextBlocks.hxx> #include <SwXMLBlockImport.hxx> #include <SwXMLBlockExport.hxx> -#include <xmloff/xmlnmspe.hxx> #include <swevent.hxx> #include <swerror.h> @@ -46,8 +43,6 @@ const char XMLN_BLOCKLIST[] = "BlockList.xml"; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::container; -using namespace css::xml::sax; -using namespace xmloff::token; using ::xmloff::token::XML_BLOCK_LIST; using ::xmloff::token::XML_UNFORMATTED_TEXT; @@ -106,45 +101,11 @@ sal_uLong SwXMLTextBlocks::GetDoc( sal_uInt16 nIdx ) aParserInput.aInputStream = xStream->getInputStream(); // get filter - // uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLTextBlockImport( *this, aCur, sal_True ); - uno::Reference< xml::sax::XFastDocumentHandler > xFilter = new SwXMLTextBlockImport( xContext, *this, aCur, true ); - uno::Reference< xml::sax::XFastTokenHandler > xTokenHandler = new SwXMLTextBlockTokenHandler(); + uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLTextBlockImport( xContext, *this, aCur, true ); // connect parser and filter - uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create(xContext); - xParser->setFastDocumentHandler( xFilter ); - xParser->setTokenHandler( xTokenHandler ); - - // all namespaces are mentioned in content.xml but only a few of them are handled - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:office:1.0", FastToken::NAMESPACE | XML_NAMESPACE_OFFICE ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:style:1.0", FastToken::NAMESPACE | XML_NAMESPACE_STYLE ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:text:1.0", FastToken::NAMESPACE | XML_NAMESPACE_TEXT ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:table:1.0", FastToken::NAMESPACE | XML_NAMESPACE_TABLE ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0", FastToken::NAMESPACE | XML_NAMESPACE_DRAW ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", FastToken::NAMESPACE | XML_NAMESPACE_FO ); - xParser->registerNamespace( "http://www.w3.org/1999/xlink", FastToken::NAMESPACE | XML_NAMESPACE_XLINK ); - xParser->registerNamespace( "http://purl.org/dc/elements/1.1/", FastToken::NAMESPACE | XML_NAMESPACE_DC ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:meta:1.0", FastToken::NAMESPACE | XML_NAMESPACE_META ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0", FastToken::NAMESPACE | XML_NAMESPACE_NUMBER ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0", FastToken::NAMESPACE | XML_NAMESPACE_SVG ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:chart:1.0", FastToken::NAMESPACE | XML_NAMESPACE_CHART ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0", FastToken::NAMESPACE | XML_NAMESPACE_DR3D ); - xParser->registerNamespace( "http://www.w3.org/1998/Math/MathML", FastToken::NAMESPACE | XML_NAMESPACE_MATH ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:form:1.0", FastToken::NAMESPACE | XML_NAMESPACE_FORM ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:script:1.0", FastToken::NAMESPACE | XML_NAMESPACE_SCRIPT ); - xParser->registerNamespace( "http://openoffice.org/2004/office", FastToken::NAMESPACE | XML_NAMESPACE_OOO ); - xParser->registerNamespace( "http://openoffice.org/2004/writer", FastToken::NAMESPACE | XML_NAMESPACE_OOOW ); - xParser->registerNamespace( "http://openoffice.org/2004/calc", FastToken::NAMESPACE | XML_NAMESPACE_OOOC ); - xParser->registerNamespace( "http://www.w3.org/2001/xml-events", FastToken::NAMESPACE | XML_NAMESPACE_DOM ); - xParser->registerNamespace( "http://openoffice.org/2005/report", FastToken::NAMESPACE | XML_NAMESPACE_REPORT ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:of:1.2", FastToken::NAMESPACE | XML_NAMESPACE_OF ); - xParser->registerNamespace( "http://www.w3.org/1999/xhtml", FastToken::NAMESPACE | XML_NAMESPACE_XHTML ); - xParser->registerNamespace( "http://www.w3.org/2003/g/data-view#", FastToken::NAMESPACE | XML_NAMESPACE_GRDDL ); - xParser->registerNamespace( "http://openoffice.org/2009/office", FastToken::NAMESPACE | XML_NAMESPACE_OFFICE_EXT ); - xParser->registerNamespace( "http://openoffice.org/2009/table", FastToken::NAMESPACE | XML_NAMESPACE_TABLE_EXT ); - xParser->registerNamespace( "http://openoffice.org/2009/draw", FastToken::NAMESPACE | XML_NAMESPACE_DRAW_EXT ); - xParser->registerNamespace( "urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0", FastToken::NAMESPACE | XML_NAMESPACE_CALC_EXT ); - xParser->registerNamespace( "urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0", FastToken::NAMESPACE | XML_NAMESPACE_LO_EXT ); + uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(xContext); + xParser->setDocumentHandler( xFilter ); // parse try @@ -330,44 +291,11 @@ sal_uLong SwXMLTextBlocks::GetBlockText( const OUString& rShort, OUString& rText // get filter // #110680# // uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLTextBlockImport( *this, rText, bTextOnly ); - uno::Reference< xml::sax::XFastDocumentHandler > xFilter = new SwXMLTextBlockImport( xContext, *this, rText, bTextOnly ); - uno::Reference< xml::sax::XFastTokenHandler > xTokenHandler = new SwXMLTextBlockTokenHandler(); + uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLTextBlockImport( xContext, *this, rText, bTextOnly ); // connect parser and filter - uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create(xContext); - xParser->setFastDocumentHandler( xFilter ); - xParser->setTokenHandler( xTokenHandler ); - // all namespaces are mentioned in content.xml but only a few of them are handled - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:office:1.0", FastToken::NAMESPACE | XML_NAMESPACE_OFFICE ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:style:1.0", FastToken::NAMESPACE | XML_NAMESPACE_STYLE ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:text:1.0", FastToken::NAMESPACE | XML_NAMESPACE_TEXT ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:table:1.0", FastToken::NAMESPACE | XML_NAMESPACE_TABLE ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0", FastToken::NAMESPACE | XML_NAMESPACE_DRAW ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", FastToken::NAMESPACE | XML_NAMESPACE_FO ); - xParser->registerNamespace( "http://www.w3.org/1999/xlink", FastToken::NAMESPACE | XML_NAMESPACE_XLINK ); - xParser->registerNamespace( "http://purl.org/dc/elements/1.1/", FastToken::NAMESPACE | XML_NAMESPACE_DC ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:meta:1.0", FastToken::NAMESPACE | XML_NAMESPACE_META ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0", FastToken::NAMESPACE | XML_NAMESPACE_NUMBER ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0", FastToken::NAMESPACE | XML_NAMESPACE_SVG ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:chart:1.0", FastToken::NAMESPACE | XML_NAMESPACE_CHART ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0", FastToken::NAMESPACE | XML_NAMESPACE_DR3D ); - xParser->registerNamespace( "http://www.w3.org/1998/Math/MathML", FastToken::NAMESPACE | XML_NAMESPACE_MATH ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:form:1.0", FastToken::NAMESPACE | XML_NAMESPACE_FORM ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:script:1.0", FastToken::NAMESPACE | XML_NAMESPACE_SCRIPT ); - xParser->registerNamespace( "http://openoffice.org/2004/office", FastToken::NAMESPACE | XML_NAMESPACE_OOO ); - xParser->registerNamespace( "http://openoffice.org/2004/writer", FastToken::NAMESPACE | XML_NAMESPACE_OOOW ); - xParser->registerNamespace( "http://openoffice.org/2004/calc", FastToken::NAMESPACE | XML_NAMESPACE_OOOC ); - xParser->registerNamespace( "http://www.w3.org/2001/xml-events", FastToken::NAMESPACE | XML_NAMESPACE_DOM ); - xParser->registerNamespace( "http://openoffice.org/2005/report", FastToken::NAMESPACE | XML_NAMESPACE_REPORT ); - xParser->registerNamespace( "urn:oasis:names:tc:opendocument:xmlns:of:1.2", FastToken::NAMESPACE | XML_NAMESPACE_OF ); - xParser->registerNamespace( "http://www.w3.org/1999/xhtml", FastToken::NAMESPACE | XML_NAMESPACE_XHTML ); - xParser->registerNamespace( "http://www.w3.org/2003/g/data-view#", FastToken::NAMESPACE | XML_NAMESPACE_GRDDL ); - xParser->registerNamespace( "http://openoffice.org/2009/office", FastToken::NAMESPACE | XML_NAMESPACE_OFFICE_EXT ); - xParser->registerNamespace( "http://openoffice.org/2009/table", FastToken::NAMESPACE | XML_NAMESPACE_TABLE_EXT ); - xParser->registerNamespace( "http://openoffice.org/2009/draw", FastToken::NAMESPACE | XML_NAMESPACE_DRAW_EXT ); - xParser->registerNamespace( "urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0", FastToken::NAMESPACE | XML_NAMESPACE_CALC_EXT ); - xParser->registerNamespace( "urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0", FastToken::NAMESPACE | XML_NAMESPACE_LO_EXT ); - xParser->registerNamespace( "http://www.w3.org/TR/css3-text/", FastToken::NAMESPACE | XML_NAMESPACE_CSS3TEXT ); + uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(xContext); + xParser->setDocumentHandler( xFilter ); // parse try @@ -490,14 +418,11 @@ void SwXMLTextBlocks::ReadInfo( void ) aParserInput.aInputStream = xDocStream->getInputStream(); // get filter - uno::Reference< xml::sax::XFastDocumentHandler > xFilter = new SwXMLBlockListImport( xContext, *this ); - uno::Reference< xml::sax::XFastTokenHandler > xTokenHandler = new SwXMLBlockListTokenHandler(); + uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLBlockListImport( xContext, *this ); // connect parser and filter - uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create(xContext); - xParser->setFastDocumentHandler( xFilter ); - xParser->registerNamespace( "http://openoffice.org/2001/block-list", FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST ); - xParser->setTokenHandler( xTokenHandler ); + uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext ); + xParser->setDocumentHandler( xFilter ); // parse try diff --git a/sw/source/core/swg/TextBlockTokens.txt b/sw/source/core/swg/TextBlockTokens.txt deleted file mode 100644 index 8698704fcb9a..000000000000 --- a/sw/source/core/swg/TextBlockTokens.txt +++ /dev/null @@ -1,5 +0,0 @@ -body -text -document -document-content -p |