use FastParser in linguistic
Change-Id: Iee2254dc13ccc31d266009ba1eb00f2517484cc7 Reviewed-on: https://gerrit.libreoffice.org/79814 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
committed by
Noel Grandin
parent
be634d0212
commit
36c965311f
@@ -105,6 +105,8 @@ namespace xmloff { namespace token {
|
|||||||
XML_N_FORM,
|
XML_N_FORM,
|
||||||
XML_NP_SCRIPT,
|
XML_NP_SCRIPT,
|
||||||
XML_N_SCRIPT,
|
XML_N_SCRIPT,
|
||||||
|
XML_NP_TCD,
|
||||||
|
XML_N_TCD,
|
||||||
XML_NP_XFORMS_1_0,
|
XML_NP_XFORMS_1_0,
|
||||||
XML_N_XFORMS_1_0,
|
XML_N_XFORMS_1_0,
|
||||||
XML_NP_XSD,
|
XML_NP_XSD,
|
||||||
@@ -486,6 +488,7 @@ namespace xmloff { namespace token {
|
|||||||
XML_CONTRAST,
|
XML_CONTRAST,
|
||||||
XML_CONTROL,
|
XML_CONTROL,
|
||||||
XML_CONVERSION_MODE,
|
XML_CONVERSION_MODE,
|
||||||
|
XML_CONVERSION_TYPE,
|
||||||
XML_COPY_BACK,
|
XML_COPY_BACK,
|
||||||
XML_COPY_FORMULAS,
|
XML_COPY_FORMULAS,
|
||||||
XML_COPY_OUTLINE_LEVELS,
|
XML_COPY_OUTLINE_LEVELS,
|
||||||
@@ -716,6 +719,7 @@ namespace xmloff { namespace token {
|
|||||||
XML_ENDNOTE_REF,
|
XML_ENDNOTE_REF,
|
||||||
XML_ENDNOTES_CONFIGURATION,
|
XML_ENDNOTES_CONFIGURATION,
|
||||||
XML_ENGRAVED,
|
XML_ENGRAVED,
|
||||||
|
XML_ENTRY,
|
||||||
XML_EQ,
|
XML_EQ,
|
||||||
XML_EQUAL_AUTHOR,
|
XML_EQUAL_AUTHOR,
|
||||||
XML_EQUAL_COMMENT,
|
XML_EQUAL_COMMENT,
|
||||||
@@ -1095,6 +1099,7 @@ namespace xmloff { namespace token {
|
|||||||
XML_LABEL_STROKE_WIDTH,
|
XML_LABEL_STROKE_WIDTH,
|
||||||
XML_LAMBDA,
|
XML_LAMBDA,
|
||||||
XML_LANDSCAPE,
|
XML_LANDSCAPE,
|
||||||
|
XML_LANG,
|
||||||
XML_LANGUAGE,
|
XML_LANGUAGE,
|
||||||
XML_LANGUAGE_ASIAN,
|
XML_LANGUAGE_ASIAN,
|
||||||
XML_LANGUAGE_COMPLEX,
|
XML_LANGUAGE_COMPLEX,
|
||||||
@@ -1107,6 +1112,7 @@ namespace xmloff { namespace token {
|
|||||||
XML_LEADER_CHAR,
|
XML_LEADER_CHAR,
|
||||||
XML_LEFT,
|
XML_LEFT,
|
||||||
XML_LEFT_OUTSIDE,
|
XML_LEFT_OUTSIDE,
|
||||||
|
XML_LEFT_TEXT,
|
||||||
XML_LEFT_TOP_POSITION,
|
XML_LEFT_TOP_POSITION,
|
||||||
XML_LEFTARC,
|
XML_LEFTARC,
|
||||||
XML_LEFTCIRCLE,
|
XML_LEFTCIRCLE,
|
||||||
@@ -1557,6 +1563,7 @@ namespace xmloff { namespace token {
|
|||||||
XML_RIDGE,
|
XML_RIDGE,
|
||||||
XML_RIGHT,
|
XML_RIGHT,
|
||||||
XML_RIGHT_OUTSIDE,
|
XML_RIGHT_OUTSIDE,
|
||||||
|
XML_RIGHT_TEXT,
|
||||||
XML_RIGHTARC,
|
XML_RIGHTARC,
|
||||||
XML_RIGHTCIRCLE,
|
XML_RIGHTCIRCLE,
|
||||||
XML_RING,
|
XML_RING,
|
||||||
@@ -1869,6 +1876,7 @@ namespace xmloff { namespace token {
|
|||||||
XML_TEXT_COMBINE_END_CHAR,
|
XML_TEXT_COMBINE_END_CHAR,
|
||||||
XML_TEXT_COMBINE_START_CHAR,
|
XML_TEXT_COMBINE_START_CHAR,
|
||||||
XML_TEXT_CONTENT,
|
XML_TEXT_CONTENT,
|
||||||
|
XML_TEXT_CONVERSION_DICTIONARY,
|
||||||
XML_TEXT_CROSSING_OUT,
|
XML_TEXT_CROSSING_OUT,
|
||||||
XML_TEXT_EMPHASIZE,
|
XML_TEXT_EMPHASIZE,
|
||||||
XML_TEXT_GLOBAL,
|
XML_TEXT_GLOBAL,
|
||||||
|
@@ -38,6 +38,7 @@ $(eval $(call gb_Library_use_libraries,lng,\
|
|||||||
cppuhelper \
|
cppuhelper \
|
||||||
i18nlangtag \
|
i18nlangtag \
|
||||||
sal \
|
sal \
|
||||||
|
sax \
|
||||||
svl \
|
svl \
|
||||||
tl \
|
tl \
|
||||||
ucbhelper \
|
ucbhelper \
|
||||||
|
@@ -82,10 +82,8 @@ class ConvDicXMLImportContext :
|
|||||||
public SvXMLImportContext
|
public SvXMLImportContext
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ConvDicXMLImportContext(
|
ConvDicXMLImportContext( ConvDicXMLImport &rImport ) :
|
||||||
ConvDicXMLImport &rImport,
|
SvXMLImportContext( rImport )
|
||||||
sal_uInt16 nPrfx, const OUString& rLName ) :
|
|
||||||
SvXMLImportContext( rImport, nPrfx, rLName )
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +94,8 @@ public:
|
|||||||
|
|
||||||
// SvXMLImportContext
|
// SvXMLImportContext
|
||||||
virtual void Characters( const OUString &rChars ) override;
|
virtual void Characters( const OUString &rChars ) override;
|
||||||
virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > &rxAttrList) override;
|
virtual css::uno::Reference<XFastContextHandler> SAL_CALL createFastChildContext(
|
||||||
|
sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -107,17 +106,17 @@ class ConvDicXMLDictionaryContext_Impl :
|
|||||||
sal_Int16 nConversionType;
|
sal_Int16 nConversionType;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ConvDicXMLDictionaryContext_Impl( ConvDicXMLImport &rImport,
|
ConvDicXMLDictionaryContext_Impl( ConvDicXMLImport &rImport ) :
|
||||||
sal_uInt16 nPrefix, const OUString& rLName) :
|
ConvDicXMLImportContext( rImport )
|
||||||
ConvDicXMLImportContext( rImport, nPrefix, rLName )
|
|
||||||
{
|
{
|
||||||
nLanguage = LANGUAGE_NONE;
|
nLanguage = LANGUAGE_NONE;
|
||||||
nConversionType = -1;
|
nConversionType = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SvXMLImportContext
|
// SvXMLImportContext
|
||||||
virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
|
virtual void SAL_CALL startFastElement( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
|
||||||
virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > &rxAttrList ) override;
|
virtual css::uno::Reference<XFastContextHandler> SAL_CALL createFastChildContext(
|
||||||
|
sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -127,16 +126,15 @@ class ConvDicXMLEntryTextContext_Impl :
|
|||||||
OUString aLeftText;
|
OUString aLeftText;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ConvDicXMLEntryTextContext_Impl(
|
ConvDicXMLEntryTextContext_Impl( ConvDicXMLImport &rImport ) :
|
||||||
ConvDicXMLImport &rImport,
|
ConvDicXMLImportContext( rImport )
|
||||||
sal_uInt16 nPrefix, const OUString& rLName ) :
|
|
||||||
ConvDicXMLImportContext( rImport, nPrefix, rLName )
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// SvXMLImportContext
|
// SvXMLImportContext
|
||||||
virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
|
virtual void SAL_CALL startFastElement( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
|
||||||
virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > &rxAttrList ) override;
|
virtual css::uno::Reference<XFastContextHandler> SAL_CALL createFastChildContext(
|
||||||
|
sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
|
||||||
|
|
||||||
const OUString & GetLeftText() const { return aLeftText; }
|
const OUString & GetLeftText() const { return aLeftText; }
|
||||||
};
|
};
|
||||||
@@ -151,16 +149,14 @@ class ConvDicXMLRightTextContext_Impl :
|
|||||||
public:
|
public:
|
||||||
ConvDicXMLRightTextContext_Impl(
|
ConvDicXMLRightTextContext_Impl(
|
||||||
ConvDicXMLImport &rImport,
|
ConvDicXMLImport &rImport,
|
||||||
sal_uInt16 nPrefix, const OUString& rLName,
|
|
||||||
ConvDicXMLEntryTextContext_Impl &rParentContext ) :
|
ConvDicXMLEntryTextContext_Impl &rParentContext ) :
|
||||||
ConvDicXMLImportContext( rImport, nPrefix, rLName ),
|
ConvDicXMLImportContext( rImport ),
|
||||||
rEntryContext( rParentContext )
|
rEntryContext( rParentContext )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// SvXMLImportContext
|
// SvXMLImportContext
|
||||||
virtual void EndElement() override;
|
virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
|
||||||
virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > &rxAttrList ) override;
|
|
||||||
virtual void Characters( const OUString &rChars ) override;
|
virtual void Characters( const OUString &rChars ) override;
|
||||||
|
|
||||||
const OUString & GetRightText() const { return aRightText; }
|
const OUString & GetRightText() const { return aRightText; }
|
||||||
@@ -180,99 +176,95 @@ void ConvDicXMLImportContext::Characters(const OUString & /*rChars*/)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SvXMLImportContextRef ConvDicXMLImportContext::CreateChildContext(
|
css::uno::Reference<XFastContextHandler> ConvDicXMLImportContext::createFastChildContext(
|
||||||
sal_uInt16 nPrefix, const OUString& rLocalName,
|
sal_Int32 Element,
|
||||||
const uno::Reference< xml::sax::XAttributeList > & /*rxAttrList*/ )
|
const css::uno::Reference< css::xml::sax::XFastAttributeList > & /*xAttrList*/ )
|
||||||
{
|
{
|
||||||
SvXMLImportContext *pContext = nullptr;
|
if ( Element == ConvDicXMLToken::TEXT_CONVERSION_DICTIONARY )
|
||||||
if ( nPrefix == XML_NAMESPACE_TCD && rLocalName == "text-conversion-dictionary" )
|
return new ConvDicXMLDictionaryContext_Impl( GetConvDicImport() );
|
||||||
pContext = new ConvDicXMLDictionaryContext_Impl( GetConvDicImport(), nPrefix, rLocalName );
|
|
||||||
else
|
else
|
||||||
pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
|
return new SvXMLImportContext( GetImport() );
|
||||||
return pContext;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ConvDicXMLDictionaryContext_Impl::StartElement(
|
void ConvDicXMLDictionaryContext_Impl::startFastElement( sal_Int32 /*nElement*/,
|
||||||
const uno::Reference< xml::sax::XAttributeList > &rxAttrList )
|
const css::uno::Reference< css::xml::sax::XFastAttributeList >& rxAttrList )
|
||||||
{
|
{
|
||||||
sal_Int16 nAttrCount = rxAttrList.is() ? rxAttrList->getLength() : 0;
|
if ( rxAttrList.is() )
|
||||||
for (sal_Int16 i = 0; i < nAttrCount; ++i)
|
|
||||||
{
|
{
|
||||||
OUString aAttrName = rxAttrList->getNameByIndex(i);
|
sax_fastparser::FastAttributeList *pAttribList =
|
||||||
OUString aLocalName;
|
sax_fastparser::FastAttributeList::castToFastAttributeList( rxAttrList );
|
||||||
sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
|
|
||||||
GetKeyByAttrName( aAttrName, &aLocalName );
|
|
||||||
OUString aValue = rxAttrList->getValueByIndex(i);
|
|
||||||
|
|
||||||
if ( nPrefix == XML_NAMESPACE_TCD && aLocalName == "lang" )
|
for (auto &aIter : *pAttribList)
|
||||||
nLanguage = LanguageTag::convertToLanguageType( aValue );
|
{
|
||||||
else if ( nPrefix == XML_NAMESPACE_TCD && aLocalName == "conversion-type" )
|
switch (aIter.getToken())
|
||||||
nConversionType = GetConversionTypeFromText( aValue );
|
{
|
||||||
|
case XML_NAMESPACE_TCD | XML_LANG:
|
||||||
|
nLanguage = LanguageTag::convertToLanguageType( aIter.toString() );
|
||||||
|
break;
|
||||||
|
case XML_NAMESPACE_TCD | XML_CONVERSION_TYPE:
|
||||||
|
nConversionType = GetConversionTypeFromText( aIter.toString() );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
GetConvDicImport().SetLanguage( nLanguage );
|
GetConvDicImport().SetLanguage( nLanguage );
|
||||||
GetConvDicImport().SetConversionType( nConversionType );
|
GetConvDicImport().SetConversionType( nConversionType );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SvXMLImportContextRef ConvDicXMLDictionaryContext_Impl::CreateChildContext(
|
css::uno::Reference<XFastContextHandler> ConvDicXMLDictionaryContext_Impl::createFastChildContext(
|
||||||
sal_uInt16 nPrefix, const OUString& rLocalName,
|
sal_Int32 Element,
|
||||||
const uno::Reference< xml::sax::XAttributeList > & /*rxAttrList*/ )
|
const css::uno::Reference< css::xml::sax::XFastAttributeList > & /*xAttrList*/ )
|
||||||
{
|
{
|
||||||
SvXMLImportContext *pContext = nullptr;
|
if ( Element == ConvDicXMLToken::ENTRY )
|
||||||
if ( nPrefix == XML_NAMESPACE_TCD && rLocalName == "entry" )
|
return new ConvDicXMLEntryTextContext_Impl( GetConvDicImport() );
|
||||||
pContext = new ConvDicXMLEntryTextContext_Impl( GetConvDicImport(), nPrefix, rLocalName );
|
|
||||||
else
|
else
|
||||||
pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
|
return new SvXMLImportContext(GetImport());
|
||||||
return pContext;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
css::uno::Reference<XFastContextHandler> ConvDicXMLEntryTextContext_Impl::createFastChildContext(
|
||||||
SvXMLImportContextRef ConvDicXMLEntryTextContext_Impl::CreateChildContext(
|
sal_Int32 Element,
|
||||||
sal_uInt16 nPrefix, const OUString& rLocalName,
|
const css::uno::Reference< css::xml::sax::XFastAttributeList > & /*xAttrList*/ )
|
||||||
const uno::Reference< xml::sax::XAttributeList > & /*rxAttrList*/ )
|
|
||||||
{
|
{
|
||||||
SvXMLImportContext *pContext = nullptr;
|
if ( Element == ConvDicXMLToken::RIGHT_TEXT )
|
||||||
if ( nPrefix == XML_NAMESPACE_TCD && rLocalName == "right-text" )
|
return new ConvDicXMLRightTextContext_Impl( GetConvDicImport(), *this );
|
||||||
pContext = new ConvDicXMLRightTextContext_Impl( GetConvDicImport(), nPrefix, rLocalName, *this );
|
|
||||||
else
|
else
|
||||||
pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
|
return new SvXMLImportContext(GetImport());
|
||||||
return pContext;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConvDicXMLEntryTextContext_Impl::StartElement(
|
void ConvDicXMLEntryTextContext_Impl::startFastElement(
|
||||||
const uno::Reference< xml::sax::XAttributeList >& rxAttrList )
|
sal_Int32 /*Element*/,
|
||||||
|
const css::uno::Reference< css::xml::sax::XFastAttributeList >& rxAttrList )
|
||||||
{
|
{
|
||||||
sal_Int16 nAttrCount = rxAttrList.is() ? rxAttrList->getLength() : 0;
|
if ( rxAttrList.is() )
|
||||||
for (sal_Int16 i = 0; i < nAttrCount; ++i)
|
|
||||||
{
|
{
|
||||||
OUString aAttrName = rxAttrList->getNameByIndex(i);
|
sax_fastparser::FastAttributeList *pAttribList =
|
||||||
OUString aLocalName;
|
sax_fastparser::FastAttributeList::castToFastAttributeList( rxAttrList );
|
||||||
sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
|
|
||||||
GetKeyByAttrName( aAttrName, &aLocalName );
|
|
||||||
OUString aValue = rxAttrList->getValueByIndex(i);
|
|
||||||
|
|
||||||
if ( nPrefix == XML_NAMESPACE_TCD && aLocalName == "left-text" )
|
for (auto &aIter : *pAttribList)
|
||||||
aLeftText = aValue;
|
{
|
||||||
|
switch (aIter.getToken())
|
||||||
|
{
|
||||||
|
case XML_NAMESPACE_TCD | XML_LEFT_TEXT:
|
||||||
|
aLeftText = aIter.toString();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SvXMLImportContextRef ConvDicXMLRightTextContext_Impl::CreateChildContext(
|
|
||||||
sal_uInt16 nPrefix, const OUString& rLocalName,
|
|
||||||
const uno::Reference< xml::sax::XAttributeList > & /*rxAttrList*/ )
|
|
||||||
{
|
|
||||||
// leaf: return default (empty) context
|
|
||||||
SvXMLImportContext *pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
|
|
||||||
return pContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConvDicXMLRightTextContext_Impl::Characters( const OUString &rChars )
|
void ConvDicXMLRightTextContext_Impl::Characters( const OUString &rChars )
|
||||||
{
|
{
|
||||||
aRightText += rChars;
|
aRightText += rChars;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConvDicXMLRightTextContext_Impl::EndElement()
|
void ConvDicXMLRightTextContext_Impl::endFastElement( sal_Int32 /*nElement*/ )
|
||||||
{
|
{
|
||||||
ConvDic *pDic = GetConvDicImport().GetDic();
|
ConvDic *pDic = GetConvDicImport().GetDic();
|
||||||
if (pDic)
|
if (pDic)
|
||||||
@@ -359,25 +351,24 @@ void ConvDicXMLExport::ExportContent_()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAL_CALL ConvDicXMLImport::startDocument()
|
//!! see comment for pDic member
|
||||||
|
ConvDicXMLImport::ConvDicXMLImport( ConvDic *pConvDic ) :
|
||||||
|
SvXMLImport ( comphelper::getProcessComponentContext(), "com.sun.star.lingu2.ConvDicXMLImport", SvXMLImportFlags::ALL ),
|
||||||
|
pDic ( pConvDic )
|
||||||
{
|
{
|
||||||
// register namespace at first possible opportunity
|
nLanguage = LANGUAGE_NONE;
|
||||||
GetNamespaceMap().Add( "tcd",
|
nConversionType = -1;
|
||||||
XML_NAMESPACE_TCD_STRING, XML_NAMESPACE_TCD );
|
GetNamespaceMap().Add( GetXMLToken(XML_NP_TCD), GetXMLToken(XML_N_TCD), XML_NAMESPACE_TCD);
|
||||||
SvXMLImport::startDocument();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SvXMLImportContext * ConvDicXMLImport::CreateDocumentContext(
|
SvXMLImportContext * ConvDicXMLImport::CreateFastContext(
|
||||||
sal_uInt16 nPrefix,
|
sal_Int32 Element,
|
||||||
const OUString &rLocalName,
|
const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList )
|
||||||
const uno::Reference < xml::sax::XAttributeList > & /*rxAttrList*/ )
|
|
||||||
{
|
{
|
||||||
SvXMLImportContext *pContext = nullptr;
|
if( Element == ConvDicXMLToken::TEXT_CONVERSION_DICTIONARY )
|
||||||
if ( nPrefix == XML_NAMESPACE_TCD && rLocalName == "text-conversion-dictionary" )
|
return new ConvDicXMLDictionaryContext_Impl( *this );
|
||||||
pContext = new ConvDicXMLDictionaryContext_Impl( *this, nPrefix, rLocalName );
|
|
||||||
else
|
else
|
||||||
pContext = new SvXMLImportContext( *this, nPrefix, rLocalName );
|
return SvXMLImport::CreateFastContext( Element, xAttrList );
|
||||||
return pContext;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -24,9 +24,12 @@
|
|||||||
#include <com/sun/star/util/MeasureUnit.hpp>
|
#include <com/sun/star/util/MeasureUnit.hpp>
|
||||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||||
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
|
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
|
||||||
|
#include <com/sun/star/xml/sax/FastToken.hpp>
|
||||||
#include <comphelper/processfactory.hxx>
|
#include <comphelper/processfactory.hxx>
|
||||||
#include <xmloff/xmlexp.hxx>
|
#include <xmloff/xmlexp.hxx>
|
||||||
#include <xmloff/xmlimp.hxx>
|
#include <xmloff/xmlimp.hxx>
|
||||||
|
#include <xmloff/xmltoken.hxx>
|
||||||
|
#include <xmloff/xmlnmspe.hxx>
|
||||||
#include <cppuhelper/interfacecontainer.h>
|
#include <cppuhelper/interfacecontainer.h>
|
||||||
#include <rtl/ustring.hxx>
|
#include <rtl/ustring.hxx>
|
||||||
#include <linguistic/misc.hxx>
|
#include <linguistic/misc.hxx>
|
||||||
@@ -34,6 +37,8 @@
|
|||||||
|
|
||||||
|
|
||||||
class ConvDic;
|
class ConvDic;
|
||||||
|
using namespace css::xml::sax;
|
||||||
|
using namespace ::xmloff::token;
|
||||||
|
|
||||||
|
|
||||||
class ConvDicXMLExport : public SvXMLExport
|
class ConvDicXMLExport : public SvXMLExport
|
||||||
@@ -62,6 +67,29 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum ConvDicXMLToken : sal_Int32
|
||||||
|
{
|
||||||
|
TEXT_CONVERSION_DICTIONARY = FastToken::NAMESPACE | XML_NAMESPACE_TCD | XML_BLOCK_LIST,
|
||||||
|
RIGHT_TEXT = FastToken::NAMESPACE | XML_NAMESPACE_TCD | XML_RIGHT_TEXT,
|
||||||
|
ENTRY = FastToken::NAMESPACE | XML_NAMESPACE_TCD | XML_ENTRY,
|
||||||
|
};
|
||||||
|
|
||||||
|
class ConvDicXMLTokenHandler : public
|
||||||
|
cppu::WeakImplHelper< css::xml::sax::XFastTokenHandler >,
|
||||||
|
public sax_fastparser::FastTokenHandlerBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit ConvDicXMLTokenHandler();
|
||||||
|
virtual ~ConvDicXMLTokenHandler() override;
|
||||||
|
|
||||||
|
//XFastTokenHandler
|
||||||
|
virtual sal_Int32 SAL_CALL getTokenFromUTF8( const css::uno::Sequence< sal_Int8 >& Identifier ) override;
|
||||||
|
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 Token ) override;
|
||||||
|
|
||||||
|
// Much faster direct C++ shortcut to the method that matters
|
||||||
|
virtual sal_Int32 getTokenDirect( const char *pToken, sal_Int32 nLength ) const override;
|
||||||
|
};
|
||||||
|
|
||||||
class ConvDicXMLImport : public SvXMLImport
|
class ConvDicXMLImport : public SvXMLImport
|
||||||
{
|
{
|
||||||
ConvDic *pDic; // conversion dictionary to be used
|
ConvDic *pDic; // conversion dictionary to be used
|
||||||
@@ -77,19 +105,7 @@ class ConvDicXMLImport : public SvXMLImport
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//!! see comment for pDic member
|
//!! see comment for pDic member
|
||||||
explicit ConvDicXMLImport( ConvDic *pConvDic ) :
|
explicit ConvDicXMLImport( ConvDic *pConvDic );
|
||||||
SvXMLImport ( comphelper::getProcessComponentContext(), "com.sun.star.lingu2.ConvDicXMLImport", SvXMLImportFlags::ALL ),
|
|
||||||
pDic ( pConvDic )
|
|
||||||
{
|
|
||||||
nLanguage = LANGUAGE_NONE;
|
|
||||||
nConversionType = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void SAL_CALL startDocument() override;
|
|
||||||
|
|
||||||
virtual SvXMLImportContext * CreateDocumentContext(
|
|
||||||
sal_uInt16 nPrefix, const OUString &rLocalName,
|
|
||||||
const css::uno::Reference < css::xml::sax::XAttributeList > &rxAttrList ) override;
|
|
||||||
|
|
||||||
ConvDic * GetDic() { return pDic; }
|
ConvDic * GetDic() { return pDic; }
|
||||||
LanguageType GetLanguage() const { return nLanguage; }
|
LanguageType GetLanguage() const { return nLanguage; }
|
||||||
@@ -97,6 +113,10 @@ public:
|
|||||||
|
|
||||||
void SetLanguage( LanguageType nLang ) { nLanguage = nLang; }
|
void SetLanguage( LanguageType nLang ) { nLanguage = nLang; }
|
||||||
void SetConversionType( sal_Int16 nType ) { nConversionType = nType; }
|
void SetConversionType( sal_Int16 nType ) { nConversionType = nType; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual SvXMLImportContext *CreateFastContext( sal_Int32 Element,
|
||||||
|
const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -109,6 +109,8 @@ namespace xmloff { namespace token {
|
|||||||
TOKEN( "urn:oasis:names:tc:opendocument:xmlns:form:1.0", XML_N_FORM ),
|
TOKEN( "urn:oasis:names:tc:opendocument:xmlns:form:1.0", XML_N_FORM ),
|
||||||
TOKEN( "script", XML_NP_SCRIPT ),
|
TOKEN( "script", XML_NP_SCRIPT ),
|
||||||
TOKEN( "urn:oasis:names:tc:opendocument:xmlns:script:1.0", XML_N_SCRIPT ),
|
TOKEN( "urn:oasis:names:tc:opendocument:xmlns:script:1.0", XML_N_SCRIPT ),
|
||||||
|
TOKEN( "tcd", XML_NP_TCD ),
|
||||||
|
TOKEN( "http://openoffice.org/2003/text-conversion-dictionary", XML_N_TCD ),
|
||||||
TOKEN( "xforms", XML_NP_XFORMS_1_0 ),
|
TOKEN( "xforms", XML_NP_XFORMS_1_0 ),
|
||||||
TOKEN( "http://www.w3.org/2002/xforms", XML_N_XFORMS_1_0 ),
|
TOKEN( "http://www.w3.org/2002/xforms", XML_N_XFORMS_1_0 ),
|
||||||
TOKEN( "xsd", XML_NP_XSD ),
|
TOKEN( "xsd", XML_NP_XSD ),
|
||||||
@@ -487,6 +489,7 @@ namespace xmloff { namespace token {
|
|||||||
TOKEN( "contrast", XML_CONTRAST ),
|
TOKEN( "contrast", XML_CONTRAST ),
|
||||||
TOKEN( "control", XML_CONTROL ),
|
TOKEN( "control", XML_CONTROL ),
|
||||||
TOKEN( "conversion-mode", XML_CONVERSION_MODE ),
|
TOKEN( "conversion-mode", XML_CONVERSION_MODE ),
|
||||||
|
TOKEN( "conversion-type", XML_CONVERSION_TYPE ),
|
||||||
TOKEN( "copy-back", XML_COPY_BACK ),
|
TOKEN( "copy-back", XML_COPY_BACK ),
|
||||||
TOKEN( "copy-formulas", XML_COPY_FORMULAS ),
|
TOKEN( "copy-formulas", XML_COPY_FORMULAS ),
|
||||||
TOKEN( "copy-outline-levels", XML_COPY_OUTLINE_LEVELS ),
|
TOKEN( "copy-outline-levels", XML_COPY_OUTLINE_LEVELS ),
|
||||||
@@ -717,6 +720,7 @@ namespace xmloff { namespace token {
|
|||||||
TOKEN( "endnote-ref", XML_ENDNOTE_REF ),
|
TOKEN( "endnote-ref", XML_ENDNOTE_REF ),
|
||||||
TOKEN( "endnotes-configuration", XML_ENDNOTES_CONFIGURATION ),
|
TOKEN( "endnotes-configuration", XML_ENDNOTES_CONFIGURATION ),
|
||||||
TOKEN( "engraved", XML_ENGRAVED ),
|
TOKEN( "engraved", XML_ENGRAVED ),
|
||||||
|
TOKEN( "entry", XML_ENTRY ),
|
||||||
TOKEN( "eq", XML_EQ ),
|
TOKEN( "eq", XML_EQ ),
|
||||||
TOKEN( "equal-author", XML_EQUAL_AUTHOR ),
|
TOKEN( "equal-author", XML_EQUAL_AUTHOR ),
|
||||||
TOKEN( "equal-comment", XML_EQUAL_COMMENT ),
|
TOKEN( "equal-comment", XML_EQUAL_COMMENT ),
|
||||||
@@ -1097,6 +1101,7 @@ namespace xmloff { namespace token {
|
|||||||
TOKEN( "label-stroke-width", XML_LABEL_STROKE_WIDTH ),
|
TOKEN( "label-stroke-width", XML_LABEL_STROKE_WIDTH ),
|
||||||
TOKEN( "lambda", XML_LAMBDA ),
|
TOKEN( "lambda", XML_LAMBDA ),
|
||||||
TOKEN( "landscape", XML_LANDSCAPE ),
|
TOKEN( "landscape", XML_LANDSCAPE ),
|
||||||
|
TOKEN( "lang", XML_LANG ),
|
||||||
TOKEN( "language", XML_LANGUAGE ),
|
TOKEN( "language", XML_LANGUAGE ),
|
||||||
TOKEN( "language-asian", XML_LANGUAGE_ASIAN ),
|
TOKEN( "language-asian", XML_LANGUAGE_ASIAN ),
|
||||||
TOKEN( "language-complex", XML_LANGUAGE_COMPLEX ),
|
TOKEN( "language-complex", XML_LANGUAGE_COMPLEX ),
|
||||||
@@ -1109,6 +1114,7 @@ namespace xmloff { namespace token {
|
|||||||
TOKEN( "leader-char", XML_LEADER_CHAR ),
|
TOKEN( "leader-char", XML_LEADER_CHAR ),
|
||||||
TOKEN( "left", XML_LEFT ),
|
TOKEN( "left", XML_LEFT ),
|
||||||
TOKEN( "left-outside", XML_LEFT_OUTSIDE ),
|
TOKEN( "left-outside", XML_LEFT_OUTSIDE ),
|
||||||
|
TOKEN( "left-text", XML_LEFT_TEXT ),
|
||||||
TOKEN( "left-top-position", XML_LEFT_TOP_POSITION ),
|
TOKEN( "left-top-position", XML_LEFT_TOP_POSITION ),
|
||||||
TOKEN( "left-arc", XML_LEFTARC ),
|
TOKEN( "left-arc", XML_LEFTARC ),
|
||||||
TOKEN( "left-circle", XML_LEFTCIRCLE ),
|
TOKEN( "left-circle", XML_LEFTCIRCLE ),
|
||||||
@@ -1559,6 +1565,7 @@ namespace xmloff { namespace token {
|
|||||||
TOKEN( "ridge", XML_RIDGE ),
|
TOKEN( "ridge", XML_RIDGE ),
|
||||||
TOKEN( "right", XML_RIGHT ),
|
TOKEN( "right", XML_RIGHT ),
|
||||||
TOKEN( "right-outside", XML_RIGHT_OUTSIDE ),
|
TOKEN( "right-outside", XML_RIGHT_OUTSIDE ),
|
||||||
|
TOKEN( "right-text", XML_RIGHT_TEXT ),
|
||||||
TOKEN( "right-arc", XML_RIGHTARC ),
|
TOKEN( "right-arc", XML_RIGHTARC ),
|
||||||
TOKEN( "right-circle", XML_RIGHTCIRCLE ),
|
TOKEN( "right-circle", XML_RIGHTCIRCLE ),
|
||||||
TOKEN( "ring", XML_RING ),
|
TOKEN( "ring", XML_RING ),
|
||||||
@@ -1871,6 +1878,7 @@ namespace xmloff { namespace token {
|
|||||||
TOKEN( "text-combine-end-char", XML_TEXT_COMBINE_END_CHAR ),
|
TOKEN( "text-combine-end-char", XML_TEXT_COMBINE_END_CHAR ),
|
||||||
TOKEN( "text-combine-start-char", XML_TEXT_COMBINE_START_CHAR ),
|
TOKEN( "text-combine-start-char", XML_TEXT_COMBINE_START_CHAR ),
|
||||||
TOKEN( "text-content", XML_TEXT_CONTENT ),
|
TOKEN( "text-content", XML_TEXT_CONTENT ),
|
||||||
|
TOKEN( "text-conversion-dictionary", XML_TEXT_CONVERSION_DICTIONARY ),
|
||||||
TOKEN( "text-crossing-out", XML_TEXT_CROSSING_OUT ),
|
TOKEN( "text-crossing-out", XML_TEXT_CROSSING_OUT ),
|
||||||
TOKEN( "text-emphasize", XML_TEXT_EMPHASIZE ),
|
TOKEN( "text-emphasize", XML_TEXT_EMPHASIZE ),
|
||||||
TOKEN( "text-global", XML_TEXT_GLOBAL ),
|
TOKEN( "text-global", XML_TEXT_GLOBAL ),
|
||||||
|
@@ -52,6 +52,8 @@ NP_FORM_DUMMY
|
|||||||
N_FORM_DUMMY
|
N_FORM_DUMMY
|
||||||
NP_SCRIPT_DUMMY
|
NP_SCRIPT_DUMMY
|
||||||
N_SCRIPT_DUMMY
|
N_SCRIPT_DUMMY
|
||||||
|
tcd
|
||||||
|
N_TCD_DUMMY
|
||||||
xforms
|
xforms
|
||||||
N_XFORMS_1_0_DUMMY
|
N_XFORMS_1_0_DUMMY
|
||||||
xsd
|
xsd
|
||||||
@@ -410,6 +412,7 @@ contour-polygon
|
|||||||
contrast
|
contrast
|
||||||
control
|
control
|
||||||
conversion-mode
|
conversion-mode
|
||||||
|
conversion-type
|
||||||
copy-back
|
copy-back
|
||||||
copy-formulas
|
copy-formulas
|
||||||
copy-outline-levels
|
copy-outline-levels
|
||||||
@@ -640,6 +643,7 @@ endnote-citation
|
|||||||
endnote-ref
|
endnote-ref
|
||||||
endnotes-configuration
|
endnotes-configuration
|
||||||
engraved
|
engraved
|
||||||
|
entry
|
||||||
eq
|
eq
|
||||||
equal-author
|
equal-author
|
||||||
equal-comment
|
equal-comment
|
||||||
@@ -1015,6 +1019,7 @@ label-stroke-opacity
|
|||||||
label-stroke-width
|
label-stroke-width
|
||||||
lambda
|
lambda
|
||||||
landscape
|
landscape
|
||||||
|
lang
|
||||||
language
|
language
|
||||||
language-asian
|
language-asian
|
||||||
language-complex
|
language-complex
|
||||||
@@ -1027,6 +1032,7 @@ layer-set
|
|||||||
leader-char
|
leader-char
|
||||||
left
|
left
|
||||||
left-outside
|
left-outside
|
||||||
|
left-text
|
||||||
left-top-position
|
left-top-position
|
||||||
left-arc
|
left-arc
|
||||||
left-circle
|
left-circle
|
||||||
@@ -1477,6 +1483,7 @@ revision
|
|||||||
ridge
|
ridge
|
||||||
right
|
right
|
||||||
right-outside
|
right-outside
|
||||||
|
right-text
|
||||||
right-arc
|
right-arc
|
||||||
right-circle
|
right-circle
|
||||||
ring
|
ring
|
||||||
@@ -1789,6 +1796,7 @@ text-combine
|
|||||||
text-combine-end-char
|
text-combine-end-char
|
||||||
text-combine-start-char
|
text-combine-start-char
|
||||||
text-content
|
text-content
|
||||||
|
text-conversion-dictionary
|
||||||
text-crossing-out
|
text-crossing-out
|
||||||
text-emphasize
|
text-emphasize
|
||||||
text-global
|
text-global
|
||||||
|
Reference in New Issue
Block a user