summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmloff/inc/DomBuilderContext.hxx13
-rw-r--r--xmloff/source/core/DomBuilderContext.cxx39
-rw-r--r--xmloff/source/xforms/XFormsInstanceContext.cxx10
-rw-r--r--xmloff/source/xforms/XFormsInstanceContext.hxx6
4 files changed, 28 insertions, 40 deletions
diff --git a/xmloff/inc/DomBuilderContext.hxx b/xmloff/inc/DomBuilderContext.hxx
index 4df66e7ec5e3..ef019030d831 100644
--- a/xmloff/inc/DomBuilderContext.hxx
+++ b/xmloff/inc/DomBuilderContext.hxx
@@ -49,13 +49,11 @@ public:
/** default constructor: create new DOM tree */
DomBuilderContext( SvXMLImport& rImport,
- sal_uInt16 nPrefix,
- const OUString& rLocalName );
+ sal_Int32 nElement );
/** constructor: create DOM subtree under the given node */
DomBuilderContext( SvXMLImport& rImport,
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
+ sal_Int32 nElement,
css::uno::Reference<css::xml::dom::XNode> const & );
virtual ~DomBuilderContext() override;
@@ -70,11 +68,8 @@ public:
// implement SvXMLImportContext methods:
-
- virtual SvXMLImportContextRef CreateChildContext(
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const css::uno::Reference<css::xml::sax::XAttributeList >& xAttrList ) override;
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
virtual void StartElement(
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
diff --git a/xmloff/source/core/DomBuilderContext.cxx b/xmloff/source/core/DomBuilderContext.cxx
index dea7993d963d..9c72ebfbf1eb 100644
--- a/xmloff/source/core/DomBuilderContext.cxx
+++ b/xmloff/source/core/DomBuilderContext.cxx
@@ -55,16 +55,14 @@ using com::sun::star::xml::dom::NodeType_ELEMENT_NODE;
// helper functions; implemented below
static Reference<XNode> lcl_createDomInstance();
static Reference<XNode> lcl_createElement( SvXMLImport& rImport,
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
+ sal_Int32 nElement,
const Reference<XNode>& xParent);
DomBuilderContext::DomBuilderContext( SvXMLImport& rImport,
- sal_uInt16 nPrefix,
- const OUString& rLocalName ) :
- SvXMLImportContext( rImport, nPrefix, rLocalName ),
- mxNode( lcl_createElement( rImport, nPrefix, rLocalName,
+ sal_Int32 nElement ) :
+ SvXMLImportContext( rImport ),
+ mxNode( lcl_createElement( rImport, nElement,
lcl_createDomInstance() ) )
{
SAL_WARN_IF( !mxNode.is(), "xmloff", "empty XNode not allowed" );
@@ -73,11 +71,10 @@ DomBuilderContext::DomBuilderContext( SvXMLImport& rImport,
}
DomBuilderContext::DomBuilderContext( SvXMLImport& rImport,
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
+ sal_Int32 nElement,
Reference<XNode> const & xParent ) :
- SvXMLImportContext( rImport, nPrefix, rLocalName ),
- mxNode( lcl_createElement( rImport, nPrefix, rLocalName, xParent ) )
+ SvXMLImportContext( rImport ),
+ mxNode( lcl_createElement( rImport, nElement, xParent ) )
{
SAL_WARN_IF( !mxNode.is(), "xmloff", "empty XNode not allowed" );
SAL_WARN_IF( !Reference<XElement>( mxNode, UNO_QUERY ).is(), "xmloff", "need element" );
@@ -94,13 +91,11 @@ Reference<XDocument> DomBuilderContext::getTree()
return mxNode->getOwnerDocument();
}
-SvXMLImportContextRef DomBuilderContext::CreateChildContext(
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const Reference<XAttributeList>& )
+css::uno::Reference< css::xml::sax::XFastContextHandler > DomBuilderContext::createFastChildContext(
+ sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& )
{
// create DomBuilder for subtree
- return new DomBuilderContext( GetImport(), nPrefix, rLocalName, mxNode );
+ return new DomBuilderContext( GetImport(), nElement, mxNode );
}
@@ -184,8 +179,7 @@ static Reference<XNode> lcl_createDomInstance()
}
static Reference<XNode> lcl_createElement( SvXMLImport& rImport,
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
+ sal_Int32 nElement,
const Reference<XNode>& xParent)
{
SAL_WARN_IF( !xParent.is(), "xmloff", "need parent node" );
@@ -198,7 +192,10 @@ static Reference<XNode> lcl_createElement( SvXMLImport& rImport,
// multiple prefixes for the same namespace. Fortunately, those are rare.
Reference<XElement> xElement;
- switch( nPrefix )
+ sal_uInt16 nNamespace = (nElement >> NMSP_SHIFT) - 1;
+ const OUString& rPrefix = SvXMLImport::getNamespacePrefixFromToken(nElement, &rImport.GetNamespaceMap());
+ const OUString& rLocalName = SvXMLImport::getNameFromToken( nElement );
+ switch( nNamespace )
{
case XML_NAMESPACE_NONE:
// no namespace: use local name
@@ -219,9 +216,9 @@ static Reference<XNode> lcl_createElement( SvXMLImport& rImport,
// the namespace map to create a qualified name for us. Technically,
// this is a bug, since this will fail for multiple prefixes used for
// the same namespace.
- xElement = xDocument->createElementNS(
- rImport.GetNamespaceMap().GetNameByKey( nPrefix ),
- rImport.GetNamespaceMap().GetQNameByKey( nPrefix, rLocalName ) );
+ OUString namespaceURI = SvXMLImport::getNamespaceURIFromToken(nElement);
+ OUString qualifiedName = rPrefix.isEmpty() ? rLocalName : rPrefix + SvXMLImport::aNamespaceSeparator + rLocalName;
+ xElement = xDocument->createElementNS(namespaceURI, qualifiedName);
break;
}
SAL_WARN_IF( !xElement.is(), "xmloff", "can't create element" );
diff --git a/xmloff/source/xforms/XFormsInstanceContext.cxx b/xmloff/source/xforms/XFormsInstanceContext.cxx
index ebd5d2824269..80dcc3739999 100644
--- a/xmloff/source/xforms/XFormsInstanceContext.cxx
+++ b/xmloff/source/xforms/XFormsInstanceContext.cxx
@@ -64,10 +64,8 @@ XFormsInstanceContext::XFormsInstanceContext(
SAL_WARN_IF( !mxModel.is(), "xmloff", "need model" );
}
-SvXMLImportContextRef XFormsInstanceContext::CreateChildContext(
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const Reference<XAttributeList>& )
+css::uno::Reference< css::xml::sax::XFastContextHandler > XFormsInstanceContext::createFastChildContext(
+ sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& )
{
SvXMLImportContext* pContext = nullptr;
@@ -76,13 +74,13 @@ SvXMLImportContextRef XFormsInstanceContext::CreateChildContext(
// ignored.
if( mxInstance.is() )
{
+ const OUString& rLocalName = SvXMLImport::getNameFromToken( nElement );
GetImport().SetError( XMLERROR_XFORMS_ONLY_ONE_INSTANCE_ELEMENT, rLocalName );
}
else
{
// create new DomBuilderContext. Save reference to tree in Model.
- DomBuilderContext* pInstance =
- new DomBuilderContext( GetImport(), nPrefix, rLocalName );
+ DomBuilderContext* pInstance = new DomBuilderContext( GetImport(), nElement );
mxInstance = pInstance->getTree();
pContext = pInstance;
}
diff --git a/xmloff/source/xforms/XFormsInstanceContext.hxx b/xmloff/source/xforms/XFormsInstanceContext.hxx
index de7d304858c8..651bbf2466c3 100644
--- a/xmloff/source/xforms/XFormsInstanceContext.hxx
+++ b/xmloff/source/xforms/XFormsInstanceContext.hxx
@@ -52,10 +52,8 @@ public:
// arbitrary DOM elements. For the attributes, we use the
// TokenContext mechanism.
- virtual SvXMLImportContextRef CreateChildContext(
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const css::uno::Reference<css::xml::sax::XAttributeList >& xAttrList ) override;
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;