summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/xmloff/shapeimport.hxx5
-rw-r--r--reportdesign/source/filter/xml/xmlCell.cxx40
-rw-r--r--reportdesign/source/filter/xml/xmlCell.hxx4
-rw-r--r--reportdesign/source/filter/xml/xmlSubDocument.cxx44
-rw-r--r--reportdesign/source/filter/xml/xmlSubDocument.hxx4
-rw-r--r--sc/source/filter/xml/XMLTableShapesContext.cxx16
-rw-r--r--sc/source/filter/xml/XMLTableShapesContext.hxx6
-rw-r--r--sc/source/filter/xml/xmlannoi.cxx78
-rw-r--r--sc/source/filter/xml/xmlannoi.hxx12
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx92
-rw-r--r--sc/source/filter/xml/xmlcelli.hxx4
-rw-r--r--xmloff/source/chart/SchXMLChartContext.cxx44
-rw-r--r--xmloff/source/chart/SchXMLChartContext.hxx4
-rw-r--r--xmloff/source/draw/shapeimport.cxx44
-rw-r--r--xmloff/source/draw/ximpgrp.cxx33
-rw-r--r--xmloff/source/draw/ximpgrp.hxx2
-rw-r--r--xmloff/source/draw/ximplink.cxx9
-rw-r--r--xmloff/source/draw/ximplink.hxx5
-rw-r--r--xmloff/source/draw/ximppage.cxx17
-rw-r--r--xmloff/source/draw/ximppage.hxx3
20 files changed, 218 insertions, 248 deletions
diff --git a/include/xmloff/shapeimport.hxx b/include/xmloff/shapeimport.hxx
index dacd947a66d2..0f841acfd601 100644
--- a/include/xmloff/shapeimport.hxx
+++ b/include/xmloff/shapeimport.hxx
@@ -256,6 +256,11 @@ public:
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes,
bool bTemporaryShape = false);
+ SvXMLShapeContext* CreateGroupChildContext(
+ SvXMLImport& rImport, sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
+ css::uno::Reference< css::drawing::XShapes > const & rShapes,
+ bool bTemporaryShape = false);
SvXMLShapeContext* CreateFrameChildContext(
SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName,
diff --git a/reportdesign/source/filter/xml/xmlCell.cxx b/reportdesign/source/filter/xml/xmlCell.cxx
index 1ce789210df1..51dc70c75ffb 100644
--- a/reportdesign/source/filter/xml/xmlCell.cxx
+++ b/reportdesign/source/filter/xml/xmlCell.cxx
@@ -86,32 +86,6 @@ OXMLCell::~OXMLCell()
{
}
-SvXMLImportContextRef OXMLCell::CreateChildContext(
- sal_uInt16 _nPrefix,
- const OUString& _rLocalName,
- const Reference< XAttributeList > & xAttrList )
-{
- SvXMLImportContext *pContext = nullptr;
- ORptFilter& rImport = GetOwnImport();
- const SvXMLTokenMap& rTokenMap = rImport.GetCellElemTokenMap();
- const sal_uInt16 nToken = rTokenMap.Get( _nPrefix, _rLocalName );
- switch( nToken )
- {
- case XML_TOK_CUSTOM_SHAPE:
- case XML_TOK_FRAME:
- {
- if ( !m_bContainsShape )
- m_nCurrentCount = m_pContainer->getSection()->getCount();
- rtl::Reference< XMLShapeImportHelper > xShapeImportHelper = rImport.GetShapeImport();
- uno::Reference< drawing::XShapes > xShapes = m_pContainer->getSection().get();
- pContext = xShapeImportHelper->CreateGroupChildContext(rImport,_nPrefix,_rLocalName,xAttrList,xShapes);
- m_bContainsShape = true;
- }
- break;
- }
- return pContext;
-}
-
css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLCell::createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
@@ -172,8 +146,20 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLCell::createFastCh
case XML_ELEMENT(TEXT, XML_P):
xContext = new OXMLCell( rImport,xAttrList ,m_pContainer,this);
break;
- default:
+
+ case XML_ELEMENT(DRAW, XML_CUSTOM_SHAPE):
+ case XML_ELEMENT(DRAW, XML_FRAME):
+ {
+ if ( !m_bContainsShape )
+ m_nCurrentCount = m_pContainer->getSection()->getCount();
+ uno::Reference< drawing::XShapes > xShapes = m_pContainer->getSection().get();
+ xContext = GetImport().GetShapeImport()->CreateGroupChildContext(rImport,nElement,xAttrList,xShapes);
+ m_bContainsShape = true;
+ }
break;
+
+ default:
+ SAL_WARN("reportdesign", "unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement));
}
if ( m_xComponent.is() )
diff --git a/reportdesign/source/filter/xml/xmlCell.hxx b/reportdesign/source/filter/xml/xmlCell.hxx
index d11826af3170..065af60d7c58 100644
--- a/reportdesign/source/filter/xml/xmlCell.hxx
+++ b/reportdesign/source/filter/xml/xmlCell.hxx
@@ -47,10 +47,6 @@ namespace rptxml
,OXMLCell* _pCell = nullptr);
virtual ~OXMLCell() override;
- 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 >& xAttrList ) override;
diff --git a/reportdesign/source/filter/xml/xmlSubDocument.cxx b/reportdesign/source/filter/xml/xmlSubDocument.cxx
index fed6eaf13aba..ec10ba195e86 100644
--- a/reportdesign/source/filter/xml/xmlSubDocument.cxx
+++ b/reportdesign/source/filter/xml/xmlSubDocument.cxx
@@ -27,6 +27,7 @@
#include "xmlTable.hxx"
#include <comphelper/property.hxx>
#include <com/sun/star/report/XReportControlModel.hpp>
+#include <sal/log.hxx>
#include <osl/diagnose.h>
namespace rptxml
@@ -53,33 +54,6 @@ OXMLSubDocument::~OXMLSubDocument()
{
}
-SvXMLImportContextRef OXMLSubDocument::CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList )
-{
- SvXMLImportContextRef xContext;
- const SvXMLTokenMap& rTokenMap = static_cast<ORptFilter&>(GetImport()).GetReportElemTokenMap();
- switch( rTokenMap.Get( nPrefix, rLocalName ) )
- {
- case XML_TOK_SUB_FRAME:
- {
- if ( !m_bContainsShape )
- m_nCurrentCount = m_pContainer->getSection()->getCount();
- rtl::Reference< XMLShapeImportHelper > xShapeImportHelper = GetImport().GetShapeImport();
- uno::Reference< drawing::XShapes > xShapes = m_pContainer->getSection().get();
- xContext = xShapeImportHelper->CreateGroupChildContext(GetImport(),nPrefix,rLocalName,xAttrList,xShapes);
- m_bContainsShape = true;
- if (m_pCellParent)
- {
- // #i94115 say to the parent Cell it contains shapes
- m_pCellParent->setContainsShape(true);
- }
- }
- break;
- }
- return xContext;
-}
-
css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLSubDocument::createFastChildContext(
sal_Int32 nElement,
const Reference< XFastAttributeList > & xAttrList )
@@ -102,7 +76,23 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLSubDocument::creat
case XML_ELEMENT(OFFICE, XML_BODY):
xContext = new RptXMLDocumentBodyContext(GetImport());
break;
+
+ case XML_ELEMENT(DRAW, XML_FRAME):
+ {
+ if ( !m_bContainsShape )
+ m_nCurrentCount = m_pContainer->getSection()->getCount();
+ uno::Reference< drawing::XShapes > xShapes = m_pContainer->getSection().get();
+ xContext = GetImport().GetShapeImport()->CreateGroupChildContext(GetImport(),nElement,xAttrList,xShapes);
+ m_bContainsShape = true;
+ if (m_pCellParent)
+ {
+ // #i94115 say to the parent Cell it contains shapes
+ m_pCellParent->setContainsShape(true);
+ }
+ }
+ break;
default:
+ SAL_WARN("reportdesign", "unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement));
break;
}
diff --git a/reportdesign/source/filter/xml/xmlSubDocument.hxx b/reportdesign/source/filter/xml/xmlSubDocument.hxx
index 14f7fffdcf42..f4cbf9848be5 100644
--- a/reportdesign/source/filter/xml/xmlSubDocument.hxx
+++ b/reportdesign/source/filter/xml/xmlSubDocument.hxx
@@ -51,10 +51,6 @@ namespace rptxml
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
- virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override;
-
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
virtual void addMasterDetailPair(const ::std::pair< OUString,OUString >& _aPair) override;
};
diff --git a/sc/source/filter/xml/XMLTableShapesContext.cxx b/sc/source/filter/xml/XMLTableShapesContext.cxx
index f645ee09e89a..866d6107d591 100644
--- a/sc/source/filter/xml/XMLTableShapesContext.cxx
+++ b/sc/source/filter/xml/XMLTableShapesContext.cxx
@@ -33,23 +33,21 @@ ScXMLTableShapesContext::~ScXMLTableShapesContext()
{
}
-SvXMLImportContextRef ScXMLTableShapesContext::CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLName,
- const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > ScXMLTableShapesContext::createFastChildContext(
+ sal_Int32 nElement,
+ const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
{
- SvXMLImportContext *pContext = nullptr;
-
ScXMLImport& rXMLImport(GetScImport());
uno::Reference<drawing::XShapes> xShapes (rXMLImport.GetTables().GetCurrentXShapes());
if (xShapes.is())
{
XMLTableShapeImportHelper* pTableShapeImport(static_cast<XMLTableShapeImportHelper*>(rXMLImport.GetShapeImport().get()));
pTableShapeImport->SetOnTable(true);
- pContext = rXMLImport.GetShapeImport()->CreateGroupChildContext(
- rXMLImport, nPrefix, rLName, xAttrList, xShapes);
+ return GetImport().GetShapeImport()->CreateGroupChildContext(
+ rXMLImport, nElement, xAttrList, xShapes);
}
-
- return pContext;
+ XMLOFF_WARN_UNKNOWN_ELEMENT("sc", nElement);
+ return nullptr;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/xml/XMLTableShapesContext.hxx b/sc/source/filter/xml/XMLTableShapesContext.hxx
index 9af805a717a5..8205fc96561a 100644
--- a/sc/source/filter/xml/XMLTableShapesContext.hxx
+++ b/sc/source/filter/xml/XMLTableShapesContext.hxx
@@ -32,9 +32,9 @@ public:
virtual ~ScXMLTableShapesContext() override;
- 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 >& xAttrList ) override;
};
#endif
diff --git a/sc/source/filter/xml/xmlannoi.cxx b/sc/source/filter/xml/xmlannoi.cxx
index 67ec0d50aee5..b78d2cbccb48 100644
--- a/sc/source/filter/xml/xmlannoi.cxx
+++ b/sc/source/filter/xml/xmlannoi.cxx
@@ -41,11 +41,10 @@ ScXMLAnnotationData::~ScXMLAnnotationData()
}
ScXMLAnnotationContext::ScXMLAnnotationContext( ScXMLImport& rImport,
- sal_uInt16 nPrfx,
- const OUString& rLName,
- const uno::Reference<xml::sax::XAttributeList>& xAttrList,
+ sal_Int32 nElement,
+ const uno::Reference<xml::sax::XFastAttributeList>& xAttrList,
ScXMLAnnotationData& rAnnotationData) :
- ScXMLImportContext( rImport, nPrfx, rLName ),
+ ScXMLImportContext( rImport ),
mrAnnotationData( rAnnotationData )
{
uno::Reference<drawing::XShapes> xLocalShapes (GetScImport().GetTables().GetCurrentXShapes());
@@ -53,52 +52,50 @@ ScXMLAnnotationContext::ScXMLAnnotationContext( ScXMLImport& rImport,
{
XMLTableShapeImportHelper* pTableShapeImport = static_cast<XMLTableShapeImportHelper*>(GetScImport().GetShapeImport().get());
pTableShapeImport->SetAnnotation(this);
- pShapeContext.reset( GetScImport().GetShapeImport()->CreateGroupChildContext(
- GetScImport(), nPrfx, rLName, xAttrList, xLocalShapes, true) );
+ pShapeContext.reset( GetImport().GetShapeImport()->CreateGroupChildContext(
+ GetScImport(), nElement, xAttrList, xLocalShapes, true) );
}
- sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
- const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetTableAnnotationAttrTokenMap();
- for( sal_Int16 i=0; i < nAttrCount; ++i )
+ for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
{
- const OUString& sAttrName(xAttrList->getNameByIndex( i ));
- OUString aLocalName;
- sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName(
- sAttrName, &aLocalName );
- const OUString& sValue(xAttrList->getValueByIndex( i ));
+ const OUString sValue = aIter.toString();
- switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+ switch( aIter.getToken() )
{
- case XML_TOK_TABLE_ANNOTATION_ATTR_AUTHOR:
+ case XML_ELEMENT(OFFICE, XML_AUTHOR):
{
maAuthorBuffer = sValue;
}
break;
- case XML_TOK_TABLE_ANNOTATION_ATTR_CREATE_DATE:
+ case XML_ELEMENT(OFFICE, XML_CREATE_DATE):
{
maCreateDateBuffer = sValue;
}
break;
- case XML_TOK_TABLE_ANNOTATION_ATTR_CREATE_DATE_STRING:
+ case XML_ELEMENT(OFFICE, XML_CREATE_DATE_STRING):
{
maCreateDateStringBuffer = sValue;
}
break;
- case XML_TOK_TABLE_ANNOTATION_ATTR_DISPLAY:
+ case XML_ELEMENT(OFFICE, XML_DISPLAY):
{
mrAnnotationData.mbShown = IsXMLToken(sValue, XML_TRUE);
}
break;
- case XML_TOK_TABLE_ANNOTATION_ATTR_X:
+ case XML_ELEMENT(SVG, XML_X):
+ case XML_ELEMENT(SVG_COMPAT, XML_X):
{
mrAnnotationData.mbUseShapePos = true;
}
break;
- case XML_TOK_TABLE_ANNOTATION_ATTR_Y:
+ case XML_ELEMENT(SVG, XML_Y):
+ case XML_ELEMENT(SVG_COMPAT, XML_Y):
{
mrAnnotationData.mbUseShapePos = true;
}
break;
+ default:
+ SAL_WARN("xmloff", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
}
}
}
@@ -113,32 +110,31 @@ void ScXMLAnnotationContext::startFastElement(sal_Int32 nElement, const css::uno
pShapeContext->startFastElement(nElement, xAttrList);
}
-SvXMLImportContextRef ScXMLAnnotationContext::CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLName,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > ScXMLAnnotationContext::createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
- SvXMLImportContextRef xContext;
-
- if( XML_NAMESPACE_DC == nPrefix )
+ switch (nElement)
{
- if( IsXMLToken( rLName, XML_CREATOR ) )
- xContext = new ScXMLContentContext(GetScImport(), nPrefix,
- rLName, maAuthorBuffer);
- else if( IsXMLToken( rLName, XML_DATE ) )
- xContext = new ScXMLContentContext(GetScImport(), nPrefix,
- rLName, maCreateDateBuffer);
+ case XML_ELEMENT(DC, XML_CREATOR):
+ return new ScXMLContentContext(GetScImport(), maAuthorBuffer);
+ case XML_ELEMENT(DC, XML_DATE):
+ return new ScXMLContentContext(GetScImport(), maCreateDateBuffer);
+ case XML_ELEMENT(META, XML_DATE_STRING):
+ return new ScXMLContentContext(GetScImport(), maCreateDateStringBuffer);
}
- else if( XML_NAMESPACE_META == nPrefix )
+
+ if( pShapeContext )
{
- if( IsXMLToken( rLName, XML_DATE_STRING ) )
- xContext = new ScXMLContentContext(GetScImport(), nPrefix,
- rLName, maCreateDateStringBuffer);
+ auto p = pShapeContext->createFastChildContext(nElement, xAttrList);
+ if (!p)
+ p = pShapeContext->createFastChildContextFallback(nElement, xAttrList);
+ if (p)
+ return p;
}
- if( !xContext && pShapeContext )
- xContext = pShapeContext->CreateChildContext(nPrefix, rLName, xAttrList);
-
- return xContext;
+ XMLOFF_WARN_UNKNOWN_ELEMENT("sc", nElement);
+ return nullptr;
}
void ScXMLAnnotationContext::characters( const OUString& rChars )
diff --git a/sc/source/filter/xml/xmlannoi.hxx b/sc/source/filter/xml/xmlannoi.hxx
index 7b8541df5986..95de84a39df5 100644
--- a/sc/source/filter/xml/xmlannoi.hxx
+++ b/sc/source/filter/xml/xmlannoi.hxx
@@ -68,16 +68,16 @@ class ScXMLAnnotationContext : public ScXMLImportContext
{
public:
- ScXMLAnnotationContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
- const OUString& rLName,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ ScXMLAnnotationContext( ScXMLImport& rImport,
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
ScXMLAnnotationData& rAnnotationData);
virtual ~ScXMLAnnotationContext() override;
- 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 >& xAttrList ) override;
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList) override;
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 6068fd901905..3b1bab4f34ab 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -628,29 +628,55 @@ void ScXMLTableRowCellContext::PushParagraphEnd()
++mnCurParagraph;
}
-SvXMLImportContextRef ScXMLTableRowCellContext::CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLName,
- const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLTableRowCellContext::createFastChildContext(
+ sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
{
SvXMLImportContext *pContext = nullptr;
+ sax_fastparser::FastAttributeList *pAttribList =
+ &sax_fastparser::castToFastAttributeList( xAttrList );
- const SvXMLTokenMap& rTokenMap = rXMLImport.GetTableRowCellElemTokenMap();
bool bTextP(false);
- switch( rTokenMap.Get( nPrefix, rLName ) )
+ switch (nElement)
{
- case XML_TOK_TABLE_ROW_CELL_P:
+ case XML_ELEMENT( TEXT, XML_P ):
{
+ bIsEmpty = false;
bTextP = true;
+
+ pContext = new ScXMLCellTextParaContext(rXMLImport, *this);
+ }
+ break;
+ case XML_ELEMENT( TABLE, XML_SUB_TABLE ):
+ {
+ SAL_WARN("sc", "ScXMLTableRowCellContext::createFastChildContext: subtables are not supported");
+ }
+ break;
+ case XML_ELEMENT( TABLE, XML_DETECTIVE ):
+ {
+ bIsEmpty = false;
+ if (!pDetectiveObjVec)
+ pDetectiveObjVec.reset( new ScMyImpDetectiveObjVec );
+ pContext = new ScXMLDetectiveContext(
+ rXMLImport, pDetectiveObjVec.get() );
}
break;
- case XML_TOK_TABLE_ROW_CELL_ANNOTATION:
+ case XML_ELEMENT( TABLE, XML_CELL_RANGE_SOURCE ):
+ {
+ bIsEmpty = false;
+ if (!pCellRangeSource)
+ pCellRangeSource.reset(new ScMyImpCellRangeSource());
+ pContext = new ScXMLCellRangeSourceContext(
+ rXMLImport, pAttribList, pCellRangeSource.get() );
+ }
+ break;
+ case XML_ELEMENT(OFFICE, XML_ANNOTATION):
{
bIsEmpty = false;
OSL_ENSURE(
!mxAnnotationData,
"ScXMLTableRowCellContext::CreateChildContext - multiple annotations in one cell");
mxAnnotationData.reset( new ScXMLAnnotationData );
- pContext = new ScXMLAnnotationContext( rXMLImport, nPrefix, rLName,
+ pContext = new ScXMLAnnotationContext( rXMLImport, nElement,
xAttrList, *mxAnnotationData);
}
break;
@@ -671,8 +697,8 @@ SvXMLImportContextRef ScXMLTableRowCellContext::CreateChildContext( sal_uInt16 n
static_cast< XMLTableShapeImportHelper* >( rXMLImport.GetShapeImport().get() );
pTableShapeImport->SetOnTable(false);
pTableShapeImport->SetCell(aCellPos);
- pContext = rXMLImport.GetShapeImport()->CreateGroupChildContext(
- rXMLImport, nPrefix, rLName, xAttrList, xShapes);
+ pContext = GetImport().GetShapeImport()->CreateGroupChildContext(
+ rXMLImport, nElement, xAttrList, xShapes);
if (pContext)
{
bIsEmpty = false;
@@ -684,52 +710,6 @@ SvXMLImportContextRef ScXMLTableRowCellContext::CreateChildContext( sal_uInt16 n
return pContext;
}
-uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLTableRowCellContext::createFastChildContext(
- sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
-{
- SvXMLImportContext *pContext = nullptr;
- sax_fastparser::FastAttributeList *pAttribList =
- &sax_fastparser::castToFastAttributeList( xAttrList );
-
- // bool bTextP(false);
- switch (nElement)
- {
- case XML_ELEMENT( TEXT, XML_P ):
- {
- bIsEmpty = false;
- // bTextP = true;
-
- pContext = new ScXMLCellTextParaContext(rXMLImport, *this);
- }
- break;
- case XML_ELEMENT( TABLE, XML_SUB_TABLE ):
- {
- SAL_WARN("sc", "ScXMLTableRowCellContext::createFastChildContext: subtables are not supported");
- }
- break;
- case XML_ELEMENT( TABLE, XML_DETECTIVE ):
- {
- bIsEmpty = false;
- if (!pDetectiveObjVec)
- pDetectiveObjVec.reset( new ScMyImpDetectiveObjVec );
- pContext = new ScXMLDetectiveContext(
- rXMLImport, pDetectiveObjVec.get() );
- }
- break;
- case XML_ELEMENT( TABLE, XML_CELL_RANGE_SOURCE ):
- {
- bIsEmpty = false;
- if (!pCellRangeSource)
- pCellRangeSource.reset(new ScMyImpCellRangeSource());
- pContext = new ScXMLCellRangeSourceContext(
- rXMLImport, pAttribList, pCellRangeSource.get() );
- }
- break;
- }
-
- return pContext;
-}
-
void ScXMLTableRowCellContext::DoMerge( const ScAddress& rScAddress, const SCCOL nCols, const SCROW nRows )
{
SCCOL mergeToCol = rScAddress.Col() + nCols;
diff --git a/sc/source/filter/xml/xmlcelli.hxx b/sc/source/filter/xml/xmlcelli.hxx
index 35ab79944c10..4229a86117c2 100644
--- a/sc/source/filter/xml/xmlcelli.hxx
+++ b/sc/source/filter/xml/xmlcelli.hxx
@@ -135,10 +135,6 @@ public:
virtual ~ScXMLTableRowCellContext() override;
- 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 >& xAttrList ) override;
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx
index 5221ffd67140..d6ab1baf5c09 100644
--- a/xmloff/source/chart/SchXMLChartContext.cxx
+++ b/xmloff/source/chart/SchXMLChartContext.cxx
@@ -1020,7 +1020,7 @@ void SchXMLChartContext::MergeSeriesForStockChart()
css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLChartContext::createFastChildContext(
sal_Int32 nElement,
- const css::uno::Reference< css::xml::sax::XFastAttributeList >& )
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
SvXMLImportContext* pContext = nullptr;
uno::Reference< chart::XChartDocument > xDoc = mrImportHelper.GetChartDocument();
@@ -1039,7 +1039,6 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLChartContext::cr
maChartTypeServiceName,
maLSequencesPerIndex, maChartSize );
break;
-
case XML_ELEMENT(CHART, XML_TITLE):
if( xDoc.is())
{
@@ -1052,7 +1051,6 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLChartContext::cr
maMainTitle, xTitleShape );
}
break;
-
case XML_ELEMENT(CHART, XML_SUBTITLE):
if( xDoc.is())
{
@@ -1065,12 +1063,10 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLChartContext::cr
maSubTitle, xTitleShape );
}
break;
-
case XML_ELEMENT(CHART, XML_LEGEND):
pContext = new SchXMLLegendContext( mrImportHelper, GetImport() );
break;
-
- case XML_ELEMENT(TABLE, XML_TABLE):
+ case XML_ELEMENT(TABLE, XML_TABLE):
{
SchXMLTableContext * pTableContext =
new SchXMLTableContext( GetImport(), maTable );
@@ -1103,40 +1099,6 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLChartContext::cr
break;
default:
- break;
- }
-
- return pContext;
-}
-
-SvXMLImportContextRef SchXMLChartContext::CreateChildContext(
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const uno::Reference< xml::sax::XAttributeList >& xAttrList )
-{
- SvXMLImportContext* pContext = nullptr;
- const SvXMLTokenMap& rTokenMap = mrImportHelper.GetChartElemTokenMap();
- uno::Reference< chart::XChartDocument > xDoc = mrImportHelper.GetChartDocument();
- uno::Reference< beans::XPropertySet > xProp( xDoc, uno::UNO_QUERY );
-
- switch( rTokenMap.Get( nPrefix, rLocalName ))
- {
- case XML_TOK_CHART_PLOT_AREA:
- break;
-
- case XML_TOK_CHART_TITLE:
- break;
-
- case XML_TOK_CHART_SUBTITLE:
- break;
-
- case XML_TOK_CHART_LEGEND:
- break;
-
- case XML_TOK_CHART_TABLE:
- break;
-
- default:
// try importing as an additional shape
if( ! mxDrawPage.is())
{
@@ -1148,7 +1110,7 @@ SvXMLImportContextRef SchXMLChartContext::CreateChildContext(
}
if( mxDrawPage.is())
pContext = GetImport().GetShapeImport()->CreateGroupChildContext(
- GetImport(), nPrefix, rLocalName, xAttrList, mxDrawPage );
+ GetImport(), nElement, xAttrList, mxDrawPage );
break;
}
diff --git a/xmloff/source/chart/SchXMLChartContext.hxx b/xmloff/source/chart/SchXMLChartContext.hxx
index 251431912d75..a40465394df0 100644
--- a/xmloff/source/chart/SchXMLChartContext.hxx
+++ b/xmloff/source/chart/SchXMLChartContext.hxx
@@ -85,10 +85,6 @@ public:
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 SvXMLImportContextRef CreateChildContext(
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
private:
SchXMLTable maTable;
diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx
index 2a2d5e137eb4..9a26ea3576be 100644
--- a/xmloff/source/draw/shapeimport.cxx
+++ b/xmloff/source/draw/shapeimport.cxx
@@ -20,6 +20,7 @@
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
#include <sal/log.hxx>
+#include <comphelper/attributelist.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/text/PositionLayoutDir.hpp>
@@ -419,6 +420,49 @@ void XMLShapeImportHelper::SetAutoStylesContext(SvXMLStylesContext* pNew)
SvXMLShapeContext* XMLShapeImportHelper::CreateGroupChildContext(
SvXMLImport& rImport,
+ sal_Int32 Element,
+ const uno::Reference< xml::sax::XFastAttributeList>& Attribs,
+ uno::Reference< drawing::XShapes > const & rShapes,
+ bool bTemporaryShape)
+{
+ // fall back to slow-parser path
+ const OUString& rPrefix = SvXMLImport::getNamespacePrefixFromToken(Element, &rImport.GetNamespaceMap());
+ const OUString& rLocalName = SvXMLImport::getNameFromToken( Element );
+ OUString aName = rPrefix.isEmpty() ? rLocalName : rPrefix + SvXMLImport::aNamespaceSeparator + rLocalName;
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ rImport.GetNamespaceMap().GetKeyByAttrName( aName, &aLocalName );
+
+ rtl::Reference < comphelper::AttributeList > maAttrList = new comphelper::AttributeList();
+
+ if ( Attribs.is() )
+ {
+ for( auto &it : sax_fastparser::castToFastAttributeList( Attribs ) )
+ {
+ sal_Int32 nToken = it.getToken();
+ const OUString& rAttrNamespacePrefix = SvXMLImport::getNamespacePrefixFromToken(nToken, &rImport.GetNamespaceMap());
+ OUString sAttrName = SvXMLImport::getNameFromToken( nToken );
+ if ( !rAttrNamespacePrefix.isEmpty() )
+ sAttrName = rAttrNamespacePrefix + SvXMLImport::aNamespaceSeparator + sAttrName;
+
+ maAttrList->AddAttribute( sAttrName, "CDATA", it.toString() );
+ }
+
+ const uno::Sequence< xml::Attribute > unknownAttribs = Attribs->getUnknownAttributes();
+ for ( const auto& rUnknownAttrib : unknownAttribs )
+ {
+ const OUString& rAttrValue = rUnknownAttrib.Value;
+ const OUString& rAttrName = rUnknownAttrib.Name;
+ // note: rAttrName is expected to be namespace-prefixed here
+ maAttrList->AddAttribute( rAttrName, "CDATA", rAttrValue );
+ }
+ }
+
+ return CreateGroupChildContext(rImport, nPrefix, aLocalName, maAttrList.get(), rShapes, bTemporaryShape );
+}
+
+SvXMLShapeContext* XMLShapeImportHelper::CreateGroupChildContext(
+ SvXMLImport& rImport,
sal_uInt16 p_nPrefix,
const OUString& rLocalName,
const uno::Reference< xml::sax::XAttributeList>& xAttrList,
diff --git a/xmloff/source/draw/ximpgrp.cxx b/xmloff/source/draw/ximpgrp.cxx
index 6627cfacb692..716e0d5f506b 100644
--- a/xmloff/source/draw/ximpgrp.cxx
+++ b/xmloff/source/draw/ximpgrp.cxx
@@ -41,6 +41,35 @@ SdXMLGroupShapeContext::~SdXMLGroupShapeContext()
{
}
+css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLGroupShapeContext::createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
+{
+ // #i68101#
+ if( nElement == XML_ELEMENT(SVG, XML_TITLE) ||
+ nElement == XML_ELEMENT(SVG, XML_DESC ) ||
+ nElement == XML_ELEMENT(SVG_COMPAT, XML_TITLE) ||
+ nElement == XML_ELEMENT(SVG_COMPAT, XML_DESC ) )
+ {
+ // handled in CreateChildContext
+ }
+ else if( nElement == XML_ELEMENT(OFFICE, XML_EVENT_LISTENERS) )
+ {
+ // handled in CreateChildContext
+ }
+ else if( nElement == XML_ELEMENT(DRAW, XML_GLUE_POINT) )
+ {
+ // handled in CreateChildContext
+ }
+ else
+ {
+ // call GroupChildContext function at common ShapeImport
+ return GetImport().GetShapeImport()->CreateGroupChildContext(
+ GetImport(), nElement, xAttrList, mxChildren);
+ }
+ return nullptr;
+}
+
SvXMLImportContextRef SdXMLGroupShapeContext::CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const uno::Reference< xml::sax::XAttributeList>& xAttrList )
@@ -63,9 +92,7 @@ SvXMLImportContextRef SdXMLGroupShapeContext::CreateChildContext( sal_uInt16 nPr
}
else
{
- // call GroupChildContext function at common ShapeImport
- xContext = GetImport().GetShapeImport()->CreateGroupChildContext(
- GetImport(), nPrefix, rLocalName, xAttrList, mxChildren);
+ // handled in createFastChildContext
}
return xContext;
diff --git a/xmloff/source/draw/ximpgrp.hxx b/xmloff/source/draw/ximpgrp.hxx
index e0c6802b9f08..c775e2e35bfc 100644
--- a/xmloff/source/draw/ximpgrp.hxx
+++ b/xmloff/source/draw/ximpgrp.hxx
@@ -46,6 +46,8 @@ public:
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
virtual void SAL_CALL endFastElement(sal_Int32 nElement) 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;
};
#endif // INCLUDED_XMLOFF_SOURCE_DRAW_XIMPGRP_HXX
diff --git a/xmloff/source/draw/ximplink.cxx b/xmloff/source/draw/ximplink.cxx
index 08049faac123..cebd3086c7f4 100644
--- a/xmloff/source/draw/ximplink.cxx
+++ b/xmloff/source/draw/ximplink.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/log.hxx>
#include <xmloff/xmlimp.hxx>
#include <xmloff/xmlnamespace.hxx>
#include "ximplink.hxx"
@@ -50,11 +51,11 @@ SdXMLShapeLinkContext::~SdXMLShapeLinkContext()
{
}
-SvXMLImportContextRef SdXMLShapeLinkContext::CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLShapeLinkContext::createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
- SvXMLShapeContext* pContext = GetImport().GetShapeImport()->CreateGroupChildContext( GetImport(), nPrefix, rLocalName, xAttrList, mxParent);
+ SvXMLShapeContext* pContext = GetImport().GetShapeImport()->CreateGroupChildContext( GetImport(), nElement, xAttrList, mxParent);
if( pContext )
{
diff --git a/xmloff/source/draw/ximplink.hxx b/xmloff/source/draw/ximplink.hxx
index d5d075a2f993..3055d85204af 100644
--- a/xmloff/source/draw/ximplink.hxx
+++ b/xmloff/source/draw/ximplink.hxx
@@ -41,9 +41,8 @@ public:
css::uno::Reference< css::drawing::XShapes > const & rShapes);
virtual ~SdXMLShapeLinkContext() override;
- 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;
};
#endif // INCLUDED_XMLOFF_SOURCE_DRAW_XIMPLINK_HXX
diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx
index 486c0e05f4d9..8b8342bd0edc 100644
--- a/xmloff/source/draw/ximppage.cxx
+++ b/xmloff/source/draw/ximppage.cxx
@@ -261,18 +261,17 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLGenericPageContex
if( mxAnnotationAccess.is() )
return new DrawAnnotationContext( GetImport(), xAttrList, mxAnnotationAccess );
}
+ else
+ {
+ // call GroupChildContext function at common ShapeImport
+ auto p = GetImport().GetShapeImport()->CreateGroupChildContext(GetImport(), nElement, xAttrList, mxShapes);
+ if (p)
+ return p;
+ }
+ XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
return nullptr;
}
-SvXMLImportContextRef SdXMLGenericPageContext::CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const Reference< xml::sax::XAttributeList>& xAttrList )
-{
- // call GroupChildContext function at common ShapeImport
- return GetImport().GetShapeImport()->CreateGroupChildContext(
- GetImport(), nPrefix, rLocalName, xAttrList, mxShapes);
-}
-
void SdXMLGenericPageContext::endFastElement(sal_Int32 )
{
GetImport().GetShapeImport()->popGroupAndPostProcess();
diff --git a/xmloff/source/draw/ximppage.hxx b/xmloff/source/draw/ximppage.hxx
index daa47f9ec48a..2bde07d12a18 100644
--- a/xmloff/source/draw/ximppage.hxx
+++ b/xmloff/source/draw/ximppage.hxx
@@ -65,9 +65,6 @@ public:
virtual ~SdXMLGenericPageContext() override;
virtual void SAL_CALL startFastElement( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
- 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;