Kaydet (Commit) 7ef4457b authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Revert "fdo#80403: Writer specific AutoCorr use FastParser"

This reverts commit c1e90457 (plus follow-up
c940d4d3 "loplugin:saloverride" and
5f0f3d4e "Work around
-Werror,-Wdeprecated-register"), it broke JunitTest_sw_unoapi.

Change-Id: I21499f8a7810eef637bb51a30380ae60b3d915cd
üst b21f2439
# -*- 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:
......@@ -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))
......
......@@ -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 \
......
......@@ -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: */
abbreviated-name
block
block-list
list-name
name
package-name
unformatted-text
......@@ -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;