summaryrefslogtreecommitdiff
path: root/sw/source/filter
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-01-07 13:01:41 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-01-07 17:45:03 +0100
commite1383444c6d00f5d0b1d507670517f45988b9cc7 (patch)
tree5304b99014f1b2236456923a3e98b2c0dbf31511 /sw/source/filter
parent0f4dd820ee433932d9d9237b676292d31c4ba913 (diff)
extract some common code from ImportContext classes
which reduces code bloat, and lets us log when elements are ignored Change-Id: I5ca12bc1fcbfa3bea49ebde819fd80bd233a96a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86338 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/filter')
-rw-r--r--sw/source/filter/xml/xmlbrsh.cxx4
-rw-r--r--sw/source/filter/xml/xmlimp.cxx7
-rw-r--r--sw/source/filter/xml/xmlitem.cxx8
-rw-r--r--sw/source/filter/xml/xmlmeta.cxx3
-rw-r--r--sw/source/filter/xml/xmlscript.cxx4
-rw-r--r--sw/source/filter/xml/xmltbli.cxx15
-rw-r--r--sw/source/filter/xml/xmltext.cxx5
7 files changed, 5 insertions, 41 deletions
diff --git a/sw/source/filter/xml/xmlbrsh.cxx b/sw/source/filter/xml/xmlbrsh.cxx
index 47d1ba3d2bdd..8712409847d3 100644
--- a/sw/source/filter/xml/xmlbrsh.cxx
+++ b/sw/source/filter/xml/xmlbrsh.cxx
@@ -122,10 +122,6 @@ SvXMLImportContextRef SwXMLBrushItemImportContext::CreateChildContext(
pContext = new XMLBase64ImportContext(GetImport(), nPrefix, rLocalName, xAttrList, m_xBase64Stream);
}
}
- if (!pContext)
- {
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
- }
return pContext;
}
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 6b9a18327714..eb755dcd11db 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -220,7 +220,7 @@ SwXMLDocContext_Impl::SwXMLDocContext_Impl( SwXMLImport& rImport ) :
uno::Reference< xml::sax::XFastContextHandler > SAL_CALL SwXMLDocContext_Impl::createFastChildContext(
sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
{
- return new SvXMLImportContext( GetImport() );
+ return nullptr;
}
SvXMLImportContextRef SwXMLDocContext_Impl::CreateChildContext(
@@ -274,9 +274,6 @@ SvXMLImportContextRef SwXMLDocContext_Impl::CreateChildContext(
break;
}
- if( !pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
-
return pContext;
}
@@ -412,8 +409,6 @@ SvXMLImportContext *SwXMLImport::CreateFastContext( sal_Int32 nElement,
pContext = new SwXMLOfficeDocContext_Impl( *this, xDocProps );
}
break;
- default:
- pContext = new SvXMLImportContext( *this );
}
return pContext;
}
diff --git a/sw/source/filter/xml/xmlitem.cxx b/sw/source/filter/xml/xmlitem.cxx
index 55736082e326..4d12335a1d44 100644
--- a/sw/source/filter/xml/xmlitem.cxx
+++ b/sw/source/filter/xml/xmlitem.cxx
@@ -54,21 +54,21 @@ SvXMLImportContextRef SvXMLItemSetContext::CreateChildContext( sal_uInt16 nPrefi
return CreateChildContext( nPrefix, rLocalName, xAttrList,
rItemSet, *pEntry, rUnitConv );
}
- return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ return nullptr;
}
/** This method is called from this instance implementation of
CreateChildContext if the element matches an entry in the
SvXMLImportItemMapper with the mid flag MID_SW_FLAG_ELEMENT
*/
-SvXMLImportContextRef SvXMLItemSetContext::CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLocalName,
+SvXMLImportContextRef SvXMLItemSetContext::CreateChildContext( sal_uInt16 /*nPrefix*/,
+ const OUString& /*rLocalName*/,
const uno::Reference< xml::sax::XAttributeList >& /*xAttrList*/,
SfxItemSet& /*rItemSet*/,
const SvXMLItemMapEntry& /*rEntry*/,
const SvXMLUnitConverter& /*rUnitConv*/ )
{
- return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ return nullptr;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/xml/xmlmeta.cxx b/sw/source/filter/xml/xmlmeta.cxx
index 5834ae020250..f9496ff96af9 100644
--- a/sw/source/filter/xml/xmlmeta.cxx
+++ b/sw/source/filter/xml/xmlmeta.cxx
@@ -60,9 +60,6 @@ SvXMLImportContext *SwXMLImport::CreateMetaContext(
pContext = new SvXMLMetaDocumentContext(*this, xDocProps);
}
- if( !pContext )
- pContext = new SvXMLImportContext( *this );
-
return pContext;
}
diff --git a/sw/source/filter/xml/xmlscript.cxx b/sw/source/filter/xml/xmlscript.cxx
index 57e46fd1a66a..aa54efa5dc5a 100644
--- a/sw/source/filter/xml/xmlscript.cxx
+++ b/sw/source/filter/xml/xmlscript.cxx
@@ -34,10 +34,6 @@ SvXMLImportContext *SwXMLImport::CreateScriptContext(
pContext = new XMLScriptContext( *this, rLocalName, GetModel() );
}
- if( !pContext )
- pContext = new SvXMLImportContext( *this, XML_NAMESPACE_OFFICE,
- rLocalName );
-
return pContext;
}
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 1b882317804a..bc815b7a098d 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -647,9 +647,6 @@ SvXMLImportContextRef SwXMLTableCellContext_Impl::CreateChildContext(
}
}
- if( !pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
-
return pContext;
}
@@ -846,9 +843,6 @@ SvXMLImportContextRef SwXMLTableColsContext_Impl::CreateChildContext(
rLocalName, xAttrList,
GetTable() );
- if( !pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
-
return pContext;
}
@@ -966,9 +960,6 @@ SvXMLImportContextRef SwXMLTableRowContext_Impl::CreateChildContext(
rLocalName );
}
- if( !pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
-
return pContext;
}
@@ -1024,9 +1015,6 @@ SvXMLImportContextRef SwXMLTableRowsContext_Impl::CreateChildContext(
GetTable(),
bHeader );
- if( !pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
-
return pContext;
}
@@ -1462,9 +1450,6 @@ SvXMLImportContextRef SwXMLTableContext::CreateChildContext( sal_uInt16 nPrefix,
break;
}
- if( !pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
-
return pContext;
}
diff --git a/sw/source/filter/xml/xmltext.cxx b/sw/source/filter/xml/xmltext.cxx
index 690c3cac4d8d..5514d9cc0efe 100644
--- a/sw/source/filter/xml/xmltext.cxx
+++ b/sw/source/filter/xml/xmltext.cxx
@@ -58,8 +58,6 @@ SvXMLImportContextRef SwXMLBodyContentContext_Impl::CreateChildContext(
SvXMLImportContext *pContext = GetSwImport().GetTextImport()->CreateTextChildContext(
GetImport(), nPrefix, rLocalName, xAttrList,
XMLTextType::Body );
- if( !pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
return pContext;
}
@@ -77,9 +75,6 @@ SvXMLImportContext *SwXMLImport::CreateBodyContentContext(
if( !IsStylesOnlyMode() )
pContext = new SwXMLBodyContentContext_Impl( *this, rLocalName );
- else
- pContext = new SvXMLImportContext( *this, XML_NAMESPACE_OFFICE,
- rLocalName );
return pContext;
}