summaryrefslogtreecommitdiff
path: root/xmloff/source/draw
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff/source/draw')
-rw-r--r--xmloff/source/draw/QRCodeContext.cxx68
-rw-r--r--xmloff/source/draw/QRCodeContext.hxx4
-rw-r--r--xmloff/source/draw/SignatureLineContext.cxx51
-rw-r--r--xmloff/source/draw/SignatureLineContext.hxx4
-rw-r--r--xmloff/source/draw/XMLImageMapContext.cxx4
-rw-r--r--xmloff/source/draw/XMLNumberStyles.cxx2
-rw-r--r--xmloff/source/draw/XMLReplacementImageContext.cxx29
-rw-r--r--xmloff/source/draw/descriptionimp.cxx7
-rw-r--r--xmloff/source/draw/descriptionimp.hxx8
-rw-r--r--xmloff/source/draw/eventimp.cxx5
-rw-r--r--xmloff/source/draw/eventimp.hxx3
-rw-r--r--xmloff/source/draw/shapeexport.cxx4
-rw-r--r--xmloff/source/draw/shapeimport.cxx219
-rw-r--r--xmloff/source/draw/ximp3dobject.cxx86
-rw-r--r--xmloff/source/draw/ximp3dobject.hxx12
-rw-r--r--xmloff/source/draw/ximp3dscene.cxx35
-rw-r--r--xmloff/source/draw/ximp3dscene.hxx6
-rw-r--r--xmloff/source/draw/ximpcustomshape.cxx3
-rw-r--r--xmloff/source/draw/ximpcustomshape.hxx4
-rw-r--r--xmloff/source/draw/ximpgrp.cxx40
-rw-r--r--xmloff/source/draw/ximpgrp.hxx5
-rw-r--r--xmloff/source/draw/ximplink.cxx18
-rw-r--r--xmloff/source/draw/ximplink.hxx2
-rw-r--r--xmloff/source/draw/ximppage.cxx2
-rw-r--r--xmloff/source/draw/ximpshap.cxx1073
-rw-r--r--xmloff/source/draw/ximpshap.hxx120
26 files changed, 739 insertions, 1075 deletions
diff --git a/xmloff/source/draw/QRCodeContext.cxx b/xmloff/source/draw/QRCodeContext.cxx
index a23f5ca11fd5..978737b34131 100644
--- a/xmloff/source/draw/QRCodeContext.cxx
+++ b/xmloff/source/draw/QRCodeContext.cxx
@@ -35,53 +35,47 @@ using namespace css::io;
using namespace css::graphic;
using namespace xmloff::token;
-QRCodeContext::QRCodeContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName,
- const Reference<XAttributeList>& xAttrList,
+QRCodeContext::QRCodeContext(SvXMLImport& rImport, sal_Int32 /*nElement*/,
+ const Reference<XFastAttributeList>& xAttrList,
const Reference<XShape>& rxShape)
- : SvXMLImportContext(rImport, nPrfx, rLocalName)
+ : SvXMLImportContext(rImport)
{
Reference<beans::XPropertySet> xPropSet(rxShape, UNO_QUERY_THROW);
css::drawing::QRCode aQRCode;
- const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
- for (sal_Int16 i = 0; i < nAttrCount; i++)
+ for (auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList))
{
- OUString sAttrName = xAttrList->getNameByIndex(i);
- OUString aLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(sAttrName, &aLocalName);
- OUString sValue = xAttrList->getValueByIndex(i);
-
- switch (nPrefix)
+ switch (aIter.getToken())
{
- case XML_NAMESPACE_LO_EXT:
- if (IsXMLToken(aLocalName, XML_QRCODE_ERROR_CORRECTION))
- {
- OUString aErrorCorrValue = sValue;
-
- if (aErrorCorrValue == "low")
- aQRCode.ErrorCorrection = css::drawing::QRCodeErrorCorrection::LOW;
- else if (aErrorCorrValue == "medium")
- aQRCode.ErrorCorrection = css::drawing::QRCodeErrorCorrection::MEDIUM;
- else if (aErrorCorrValue == "quartile")
- aQRCode.ErrorCorrection = css::drawing::QRCodeErrorCorrection::QUARTILE;
- else
- aQRCode.ErrorCorrection = css::drawing::QRCodeErrorCorrection::HIGH;
- }
+ case XML_ELEMENT(LO_EXT, XML_QRCODE_ERROR_CORRECTION):
+ {
+ OUString aErrorCorrValue = aIter.toString();
- if (IsXMLToken(aLocalName, XML_QRCODE_BORDER))
- {
- sal_Int32 nAttrVal;
- if (sax::Converter::convertNumber(nAttrVal, sValue, 0))
- aQRCode.Border = nAttrVal;
- }
+ if (aErrorCorrValue == "low")
+ aQRCode.ErrorCorrection = css::drawing::QRCodeErrorCorrection::LOW;
+ else if (aErrorCorrValue == "medium")
+ aQRCode.ErrorCorrection = css::drawing::QRCodeErrorCorrection::MEDIUM;
+ else if (aErrorCorrValue == "quartile")
+ aQRCode.ErrorCorrection = css::drawing::QRCodeErrorCorrection::QUARTILE;
+ else
+ aQRCode.ErrorCorrection = css::drawing::QRCodeErrorCorrection::HIGH;
break;
-
- case XML_NAMESPACE_OFFICE:
- if (IsXMLToken(aLocalName, XML_STRING_VALUE))
- {
- aQRCode.Payload = sValue;
- }
+ }
+ case XML_ELEMENT(LO_EXT, XML_QRCODE_BORDER):
+ {
+ sal_Int32 nAttrVal;
+ if (sax::Converter::convertNumber(nAttrVal, aIter.toString(), 0))
+ aQRCode.Border = nAttrVal;
+ break;
+ }
+ case XML_ELEMENT(OFFICE, XML_STRING_VALUE):
+ {
+ aQRCode.Payload = aIter.toString();
+ break;
+ }
+ default:
+ XMLOFF_WARN_UNKNOWN("xmloff", aIter);
}
}
xPropSet->setPropertyValue("QRCodeProperties", Any(aQRCode));
diff --git a/xmloff/source/draw/QRCodeContext.hxx b/xmloff/source/draw/QRCodeContext.hxx
index 74709bab40f8..c35c6f9bd988 100644
--- a/xmloff/source/draw/QRCodeContext.hxx
+++ b/xmloff/source/draw/QRCodeContext.hxx
@@ -18,8 +18,8 @@
class QRCodeContext : public SvXMLImportContext
{
public:
- QRCodeContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName,
- const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+ QRCodeContext(SvXMLImport& rImport, sal_Int32 nElement,
+ const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
const css::uno::Reference<css::drawing::XShape>& rxShape);
};
diff --git a/xmloff/source/draw/SignatureLineContext.cxx b/xmloff/source/draw/SignatureLineContext.cxx
index aa51e54156f0..d85acded8226 100644
--- a/xmloff/source/draw/SignatureLineContext.cxx
+++ b/xmloff/source/draw/SignatureLineContext.cxx
@@ -23,6 +23,7 @@
#include <comphelper/storagehelper.hxx>
#include <xmloff/xmltoken.hxx>
#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmlnamespace.hxx>
using namespace css;
using namespace css::xml::sax;
@@ -35,29 +36,34 @@ using namespace css::graphic;
using namespace css::security;
using namespace xmloff::token;
-SignatureLineContext::SignatureLineContext(SvXMLImport& rImport, sal_uInt16 nPrfx,
- const OUString& rLocalName,
- const Reference<XAttributeList>& xAttrList,
+SignatureLineContext::SignatureLineContext(SvXMLImport& rImport, sal_Int32 /*nElement*/,
+ const Reference<XFastAttributeList>& xAttrList,
const Reference<XShape>& rxShape)
- : SvXMLImportContext(rImport, nPrfx, rLocalName)
+ : SvXMLImportContext(rImport)
{
Reference<beans::XPropertySet> xPropSet(rxShape, UNO_QUERY_THROW);
xPropSet->setPropertyValue("IsSignatureLine", Any(true));
- xPropSet->setPropertyValue("SignatureLineId", Any(xAttrList->getValueByName("loext:id")));
- xPropSet->setPropertyValue("SignatureLineSuggestedSignerName",
- Any(xAttrList->getValueByName("loext:suggested-signer-name")));
- xPropSet->setPropertyValue("SignatureLineSuggestedSignerTitle",
- Any(xAttrList->getValueByName("loext:suggested-signer-title")));
- xPropSet->setPropertyValue("SignatureLineSuggestedSignerEmail",
- Any(xAttrList->getValueByName("loext:suggested-signer-email")));
- xPropSet->setPropertyValue("SignatureLineSigningInstructions",
- Any(xAttrList->getValueByName("loext:signing-instructions")));
-
- bool bShowSignDate = xAttrList->getValueByName("loext:show-sign-date") == GetXMLToken(XML_TRUE);
- bool bCanAddComment
- = xAttrList->getValueByName("loext:can-add-comment") == GetXMLToken(XML_TRUE);
+ xPropSet->setPropertyValue("SignatureLineId",
+ Any(xAttrList->getOptionalValue(XML_ELEMENT(LO_EXT, XML_ID))));
+ xPropSet->setPropertyValue(
+ "SignatureLineSuggestedSignerName",
+ Any(xAttrList->getOptionalValue(XML_ELEMENT(LO_EXT, XML_SUGGESTED_SIGNER_NAME))));
+ xPropSet->setPropertyValue(
+ "SignatureLineSuggestedSignerTitle",
+ Any(xAttrList->getOptionalValue(XML_ELEMENT(LO_EXT, XML_SUGGESTED_SIGNER_TITLE))));
+ xPropSet->setPropertyValue(
+ "SignatureLineSuggestedSignerEmail",
+ Any(xAttrList->getOptionalValue(XML_ELEMENT(LO_EXT, XML_SUGGESTED_SIGNER_EMAIL))));
+ xPropSet->setPropertyValue(
+ "SignatureLineSigningInstructions",
+ Any(xAttrList->getOptionalValue(XML_ELEMENT(LO_EXT, XML_SIGNING_INSTRUCTIONS))));
+
+ bool bShowSignDate = xAttrList->getOptionalValue(XML_ELEMENT(LO_EXT, XML_SHOW_SIGN_DATE))
+ == GetXMLToken(XML_TRUE);
+ bool bCanAddComment = xAttrList->getOptionalValue(XML_ELEMENT(LO_EXT, XML_CAN_ADD_COMMENT))
+ == GetXMLToken(XML_TRUE);
xPropSet->setPropertyValue("SignatureLineShowSignDate", Any(bShowSignDate));
xPropSet->setPropertyValue("SignatureLineCanAddComment", Any(bCanAddComment));
@@ -91,11 +97,12 @@ SignatureLineContext::SignatureLineContext(SvXMLImport& rImport, sal_uInt16 nPrf
// Try to find matching signature line image - if none exists that is fine,
// then the signature line is not digitally signed.
- auto pSignatureInfo = std::find_if(
- xSignatureInfo.begin(), xSignatureInfo.end(),
- [&xAttrList](const DocumentSignatureInformation& rSignatureInfo) {
- return rSignatureInfo.SignatureLineId == xAttrList->getValueByName("loext:id");
- });
+ auto pSignatureInfo
+ = std::find_if(xSignatureInfo.begin(), xSignatureInfo.end(),
+ [&xAttrList](const DocumentSignatureInformation& rSignatureInfo) {
+ return rSignatureInfo.SignatureLineId
+ == xAttrList->getOptionalValue(XML_ELEMENT(LO_EXT, XML_ID));
+ });
bool bIsSigned(false);
if (pSignatureInfo != xSignatureInfo.end())
{
diff --git a/xmloff/source/draw/SignatureLineContext.hxx b/xmloff/source/draw/SignatureLineContext.hxx
index f64b81bda5f4..cabefaafd954 100644
--- a/xmloff/source/draw/SignatureLineContext.hxx
+++ b/xmloff/source/draw/SignatureLineContext.hxx
@@ -18,8 +18,8 @@
class SignatureLineContext : public SvXMLImportContext
{
public:
- SignatureLineContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName,
- const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+ SignatureLineContext(SvXMLImport& rImport, sal_Int32 nElement,
+ const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
const css::uno::Reference<css::drawing::XShape>& rxShape);
};
diff --git a/xmloff/source/draw/XMLImageMapContext.cxx b/xmloff/source/draw/XMLImageMapContext.cxx
index 446e3e60801a..6ec8a01d6b29 100644
--- a/xmloff/source/draw/XMLImageMapContext.cxx
+++ b/xmloff/source/draw/XMLImageMapContext.cxx
@@ -496,10 +496,8 @@ constexpr OUStringLiteral gsImageMap(u"ImageMap");
XMLImageMapContext::XMLImageMapContext(
SvXMLImport& rImport,
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
Reference<XPropertySet> const & rPropertySet) :
- SvXMLImportContext(rImport, nPrefix, rLocalName),
+ SvXMLImportContext(rImport),
xPropertySet(rPropertySet)
{
try
diff --git a/xmloff/source/draw/XMLNumberStyles.cxx b/xmloff/source/draw/XMLNumberStyles.cxx
index 44c85b8e2bfd..db2f93e8b607 100644
--- a/xmloff/source/draw/XMLNumberStyles.cxx
+++ b/xmloff/source/draw/XMLNumberStyles.cxx
@@ -555,7 +555,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLNumberFormatMembe
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
- return mxSlaveContext->createFastChildContextFallback( nElement, xAttrList );
+ return mxSlaveContext->createFastChildContext( nElement, xAttrList );
}
void SdXMLNumberFormatMemberImportContext::startFastElement(
diff --git a/xmloff/source/draw/XMLReplacementImageContext.cxx b/xmloff/source/draw/XMLReplacementImageContext.cxx
index a096a4823d38..3d7ad0e62e93 100644
--- a/xmloff/source/draw/XMLReplacementImageContext.cxx
+++ b/xmloff/source/draw/XMLReplacementImageContext.cxx
@@ -37,34 +37,13 @@ using namespace ::xmloff::token;
XMLReplacementImageContext::XMLReplacementImageContext(
SvXMLImport& rImport,
- sal_uInt16 nPrfx, const OUString& rLName,
- const Reference< XAttributeList > & rAttrList,
+ sal_Int32 /*nElement*/,
+ const Reference< XFastAttributeList > & rAttrList,
const Reference< XPropertySet > & rPropSet ) :
- SvXMLImportContext( rImport, nPrfx, rLName ),
+ SvXMLImportContext( rImport ),
m_xPropSet( rPropSet )
{
- rtl::Reference < XMLTextImportHelper > xTxtImport =
- GetImport().GetTextImport();
- const SvXMLTokenMap& rTokenMap =
- xTxtImport->GetTextFrameAttrTokenMap();
-
- sal_Int16 nAttrCount = rAttrList.is() ? rAttrList->getLength() : 0;
- for( sal_Int16 i=0; i < nAttrCount; i++ )
- {
- const OUString& rAttrName = rAttrList->getNameByIndex( i );
- const OUString& rValue = rAttrList->getValueByIndex( i );
-
- OUString aLocalName;
- sal_uInt16 nPrefix =
- GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
- &aLocalName );
- switch( rTokenMap.Get( nPrefix, aLocalName ) )
- {
- case XML_TOK_TEXT_FRAME_HREF:
- m_sHRef = rValue;
- break;
- }
- }
+ m_sHRef = rAttrList->getOptionalValue(XML_ELEMENT(XLINK, XML_HREF));
}
XMLReplacementImageContext::~XMLReplacementImageContext()
diff --git a/xmloff/source/draw/descriptionimp.cxx b/xmloff/source/draw/descriptionimp.cxx
index 0e41cd680331..738f47dd2bf0 100644
--- a/xmloff/source/draw/descriptionimp.cxx
+++ b/xmloff/source/draw/descriptionimp.cxx
@@ -35,9 +35,8 @@ using namespace ::com::sun::star::beans;
using namespace ::xmloff::token;
-SdXMLDescriptionContext::SdXMLDescriptionContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName,
- const Reference< XAttributeList>&, const Reference< XShape >& rxShape)
-: SvXMLImportContext(rImport, nPrfx, rLocalName), mxShape( rxShape )
+SdXMLDescriptionContext::SdXMLDescriptionContext( SvXMLImport& rImport, sal_Int32 nElement, const Reference< XShape >& rxShape)
+: SvXMLImportContext(rImport), mxShape( rxShape ), mnElement(nElement)
{
}
@@ -53,7 +52,7 @@ void SdXMLDescriptionContext::endFastElement(sal_Int32 )
try
{
uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY_THROW);
- if(IsXMLToken(GetLocalName(),XML_TITLE))
+ if( (mnElement & TOKEN_MASK) == XML_TITLE)
{
xPropSet->setPropertyValue("Title", Any(msText));
}
diff --git a/xmloff/source/draw/descriptionimp.hxx b/xmloff/source/draw/descriptionimp.hxx
index 6dee51daf293..57a1fa2b7c81 100644
--- a/xmloff/source/draw/descriptionimp.hxx
+++ b/xmloff/source/draw/descriptionimp.hxx
@@ -25,17 +25,15 @@
// office:events inside a shape
-class SdXMLDescriptionContext : public SvXMLImportContext
+class SdXMLDescriptionContext final : public SvXMLImportContext
{
private:
css::uno::Reference< css::drawing::XShape > mxShape;
OUString msText;
+ sal_Int32 mnElement;
public:
- SdXMLDescriptionContext( SvXMLImport& rImport,
- sal_uInt16 nPrfx,
- const OUString& rLocalName,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ SdXMLDescriptionContext( SvXMLImport& rImport, sal_Int32 mnElement,
const css::uno::Reference< css::drawing::XShape >& rxShape );
virtual ~SdXMLDescriptionContext() override;
diff --git a/xmloff/source/draw/eventimp.cxx b/xmloff/source/draw/eventimp.cxx
index 226cacafc1d3..c71c71043cc2 100644
--- a/xmloff/source/draw/eventimp.cxx
+++ b/xmloff/source/draw/eventimp.cxx
@@ -436,9 +436,8 @@ void SdXMLEventContextData::ApplyProperties()
}
-SdXMLEventsContext::SdXMLEventsContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName,
- const Reference< XAttributeList>&, const Reference< XShape >& rxShape)
-: SvXMLImportContext(rImport, nPrfx, rLocalName), mxShape( rxShape )
+SdXMLEventsContext::SdXMLEventsContext( SvXMLImport& rImport, const Reference< XShape >& rxShape)
+: SvXMLImportContext(rImport), mxShape( rxShape )
{
}
diff --git a/xmloff/source/draw/eventimp.hxx b/xmloff/source/draw/eventimp.hxx
index 029601388078..2f66b7865dcb 100644
--- a/xmloff/source/draw/eventimp.hxx
+++ b/xmloff/source/draw/eventimp.hxx
@@ -36,9 +36,6 @@ private:
public:
SdXMLEventsContext( SvXMLImport& rImport,
- sal_uInt16 nPrfx,
- const OUString& rLocalName,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
const css::uno::Reference< css::drawing::XShape >& rxShape );
virtual ~SdXMLEventsContext() override;
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index 32cf74b8a799..8ff9105412ce 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -2497,7 +2497,9 @@ void XMLShapeExport::ImpExportControlShape(
SAL_WARN_IF( !xControlModel.is(), "xmloff", "Control shape has not XControlModel" );
if( xControlModel.is() )
{
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CONTROL, mrExport.GetFormExport()->getControlId( xControlModel ) );
+ OUString sControlId = mrExport.GetFormExport()->getControlId( xControlModel );
+ assert(!sControlId.isEmpty());
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CONTROL, sControlId );
}
}
diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx
index 9a26ea3576be..e3fcfd70fd56 100644
--- a/xmloff/source/draw/shapeimport.cxx
+++ b/xmloff/source/draw/shapeimport.cxx
@@ -345,48 +345,48 @@ const SvXMLTokenMap& XMLShapeImportHelper::Get3DLightAttrTokenMap()
SvXMLShapeContext* XMLShapeImportHelper::Create3DSceneChildContext(
SvXMLImport& rImport,
- sal_uInt16 p_nPrefix,
- const OUString& rLocalName,
- const uno::Reference< xml::sax::XAttributeList>& xAttrList,
+ sal_Int32 nElement,
+ const uno::Reference< xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes)
{
SdXMLShapeContext *pContext = nullptr;
if(rShapes.is())
{
- const SvXMLTokenMap& rTokenMap = Get3DSceneShapeElemTokenMap();
- switch(rTokenMap.Get(p_nPrefix, rLocalName))
+ switch(nElement)
{
- case XML_TOK_3DSCENE_3DSCENE:
+ case XML_ELEMENT(DR3D, XML_SCENE):
{
// dr3d:3dscene inside dr3d:3dscene context
pContext = new SdXML3DSceneShapeContext( rImport, xAttrList, rShapes, false);
break;
}
- case XML_TOK_3DSCENE_3DCUBE:
+ case XML_ELEMENT(DR3D, XML_CUBE):
{
// dr3d:3dcube inside dr3d:3dscene context
pContext = new SdXML3DCubeObjectShapeContext( rImport, xAttrList, rShapes);
break;
}
- case XML_TOK_3DSCENE_3DSPHERE:
+ case XML_ELEMENT(DR3D, XML_SPHERE):
{
// dr3d:3dsphere inside dr3d:3dscene context
pContext = new SdXML3DSphereObjectShapeContext( rImport, xAttrList, rShapes);
break;
}
- case XML_TOK_3DSCENE_3DLATHE:
+ case XML_ELEMENT(DR3D, XML_ROTATE):
{
// dr3d:3dlathe inside dr3d:3dscene context
pContext = new SdXML3DLatheObjectShapeContext( rImport, xAttrList, rShapes);
break;
}
- case XML_TOK_3DSCENE_3DEXTRUDE:
+ case XML_ELEMENT(DR3D, XML_EXTRUDE):
{
// dr3d:3dextrude inside dr3d:3dscene context
pContext = new SdXML3DExtrudeObjectShapeContext( rImport, xAttrList, rShapes);
break;
}
+ default:
+ XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
}
}
@@ -394,15 +394,11 @@ SvXMLShapeContext* XMLShapeImportHelper::Create3DSceneChildContext(
return nullptr;
// now parse the attribute list and call the child context for each unknown attribute
- sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
- for(sal_Int16 a(0); a < nAttrCount; a++)
+ for(auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList))
{
- const OUString& rAttrName = xAttrList->getNameByIndex(a);
- OUString aLocalName;
- sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName);
- const OUString aValue( xAttrList->getValueByIndex(a) );
+ if (!pContext->processAttribute( aIter.getToken(), aIter.toString() ))
+ XMLOFF_WARN_UNKNOWN("xmloff", aIter);
- pContext->processAttribute( nPrefix, aLocalName, aValue );
}
return pContext;
@@ -420,279 +416,216 @@ 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,
+ sal_Int32 nElement,
+ const uno::Reference< xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes,
bool bTemporaryShape)
{
SdXMLShapeContext *pContext = nullptr;
-
- const SvXMLTokenMap& rTokenMap = GetGroupShapeElemTokenMap();
- sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-
- switch(rTokenMap.Get(p_nPrefix, rLocalName))
+ switch (nElement)
{
- case XML_TOK_GROUP_GROUP:
- {
+ case XML_ELEMENT(DRAW, XML_G):
// draw:g inside group context (RECURSIVE)
pContext = new SdXMLGroupShapeContext( rImport, xAttrList, rShapes, bTemporaryShape);
break;
- }
- case XML_TOK_GROUP_3DSCENE:
+ case XML_ELEMENT(DR3D, XML_SCENE):
{
// dr3d:3dscene inside group context
pContext = new SdXML3DSceneShapeContext( rImport, xAttrList, rShapes, bTemporaryShape);
break;
}
- case XML_TOK_GROUP_RECT:
+ case XML_ELEMENT(DRAW, XML_RECT):
{
// draw:rect inside group context
pContext = new SdXMLRectShapeContext( rImport, xAttrList, rShapes, bTemporaryShape );
break;
}
- case XML_TOK_GROUP_LINE:
+ case XML_ELEMENT(DRAW, XML_LINE):
{
// draw:line inside group context
pContext = new SdXMLLineShapeContext( rImport, xAttrList, rShapes, bTemporaryShape );
break;
}
- case XML_TOK_GROUP_CIRCLE:
- case XML_TOK_GROUP_ELLIPSE:
+ case XML_ELEMENT(DRAW, XML_CIRCLE):
+ case XML_ELEMENT(DRAW, XML_ELLIPSE):
{
// draw:circle or draw:ellipse inside group context
pContext = new SdXMLEllipseShapeContext( rImport, xAttrList, rShapes, bTemporaryShape );
break;
}
- case XML_TOK_GROUP_POLYGON:
- case XML_TOK_GROUP_POLYLINE:
+ case XML_ELEMENT(DRAW, XML_POLYGON):
+ case XML_ELEMENT(DRAW, XML_POLYLINE):
{
// draw:polygon or draw:polyline inside group context
pContext = new SdXMLPolygonShapeContext( rImport, xAttrList, rShapes,
- rTokenMap.Get(p_nPrefix, rLocalName) == XML_TOK_GROUP_POLYGON, bTemporaryShape );
+ nElement == XML_ELEMENT(DRAW, XML_POLYGON), bTemporaryShape );
break;
}
- case XML_TOK_GROUP_PATH:
+ case XML_ELEMENT(DRAW, XML_PATH):
{
// draw:path inside group context
pContext = new SdXMLPathShapeContext( rImport, xAttrList, rShapes, bTemporaryShape);
break;
}
- case XML_TOK_GROUP_FRAME:
+ case XML_ELEMENT(DRAW, XML_FRAME):
{
// text:text-box inside group context
pContext = new SdXMLFrameShapeContext( rImport, xAttrList, rShapes, bTemporaryShape );
break;
}
- case XML_TOK_GROUP_CONTROL:
+ case XML_ELEMENT(DRAW, XML_CONTROL):
{
// draw:control inside group context
pContext = new SdXMLControlShapeContext( rImport, xAttrList, rShapes, bTemporaryShape );
break;
}
- case XML_TOK_GROUP_CONNECTOR:
+ case XML_ELEMENT(DRAW, XML_CONNECTOR):
{
// draw:connector inside group context
pContext = new SdXMLConnectorShapeContext( rImport, xAttrList, rShapes, bTemporaryShape );
break;
}
- case XML_TOK_GROUP_MEASURE:
+ case XML_ELEMENT(DRAW, XML_MEASURE):
{
// draw:measure inside group context
pContext = new SdXMLMeasureShapeContext( rImport, xAttrList, rShapes, bTemporaryShape );
break;
}
- case XML_TOK_GROUP_PAGE:
+ case XML_ELEMENT(DRAW, XML_PAGE_THUMBNAIL):
{
// draw:page inside group context
pContext = new SdXMLPageShapeContext( rImport, xAttrList, rShapes, bTemporaryShape );
break;
}
- case XML_TOK_GROUP_CAPTION:
- case XML_TOK_GROUP_ANNOTATION:
+ case XML_ELEMENT(DRAW, XML_CAPTION):
+ case XML_ELEMENT(OFFICE, XML_ANNOTATION):
{
// draw:caption inside group context
pContext = new SdXMLCaptionShapeContext( rImport, xAttrList, rShapes, bTemporaryShape );
break;
}
- case XML_TOK_GROUP_CHART:
+ case XML_ELEMENT(CHART, XML_CHART):
{
// chart:chart inside group context
pContext = new SdXMLChartShapeContext( rImport, xAttrList, rShapes, bTemporaryShape );
break;
}
- case XML_TOK_GROUP_CUSTOM_SHAPE:
+ case XML_ELEMENT(DRAW, XML_CUSTOM_SHAPE):
{
// draw:customshape
pContext = new SdXMLCustomShapeContext( rImport, xAttrList, rShapes );
break;
}
- case XML_TOK_GROUP_A:
- {
- return new SdXMLShapeLinkContext( rImport, xAttrList, rShapes );
- }
+ case XML_ELEMENT(DRAW, XML_A):
+ return new SdXMLShapeLinkContext( rImport, xAttrList, rShapes );
+ break;
// add other shapes here...
default:
+ XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
return new SvXMLShapeContext( rImport, bTemporaryShape );
}
// now parse the attribute list and call the child context for each unknown attribute
- for(sal_Int16 a(0); a < nAttrCount; a++)
+ for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
{
- const OUString& rAttrName = xAttrList->getNameByIndex(a);
- OUString aLocalName;
- sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName);
- const OUString aValue( xAttrList->getValueByIndex(a) );
-
- pContext->processAttribute( nPrefix, aLocalName, aValue );
+ if (!pContext->processAttribute( aIter.getToken(), aIter.toString() ))
+ XMLOFF_WARN_UNKNOWN("xmloff", aIter);
}
-
return pContext;
}
// This method is called from SdXMLFrameShapeContext to create children of draw:frame
SvXMLShapeContext* XMLShapeImportHelper::CreateFrameChildContext(
SvXMLImport& rImport,
- sal_uInt16 p_nPrefix,
- const OUString& rLocalName,
- const uno::Reference< xml::sax::XAttributeList>& rAttrList,
+ sal_Int32 nElement,
+ const uno::Reference< xml::sax::XFastAttributeList>& rAttrList,
uno::Reference< drawing::XShapes > const & rShapes,
- const uno::Reference< xml::sax::XAttributeList>& rFrameAttrList)
+ const uno::Reference< xml::sax::XFastAttributeList>& rFrameAttrList)
{
SdXMLShapeContext *pContext = nullptr;
- const SvXMLTokenMap& rTokenMap = GetFrameShapeElemTokenMap();
-
- SvXMLAttributeList *pAttrList = new SvXMLAttributeList( rAttrList );
+ rtl::Reference<sax_fastparser::FastAttributeList> xCombinedAttrList = new sax_fastparser::FastAttributeList(rAttrList);
if( rFrameAttrList.is() )
- pAttrList->AppendAttributeList( rFrameAttrList );
- uno::Reference < xml::sax::XAttributeList > xAttrList = pAttrList;
+ xCombinedAttrList->add(rFrameAttrList);
- switch(rTokenMap.Get(p_nPrefix, rLocalName))
+ switch(nElement)
{
- case XML_TOK_FRAME_TEXT_BOX:
+ case XML_ELEMENT(DRAW, XML_TEXT_BOX):
{
// text:text-box inside group context
- pContext = new SdXMLTextBoxShapeContext( rImport, xAttrList, rShapes );
+ pContext = new SdXMLTextBoxShapeContext( rImport, xCombinedAttrList.get(), rShapes );
break;
}
- case XML_TOK_FRAME_IMAGE:
+ case XML_ELEMENT(DRAW, XML_IMAGE):
{
// office:image inside group context
- pContext = new SdXMLGraphicObjectShapeContext( rImport, xAttrList, rShapes );
+ pContext = new SdXMLGraphicObjectShapeContext( rImport, xCombinedAttrList.get(), rShapes );
break;
}
- case XML_TOK_FRAME_OBJECT:
- case XML_TOK_FRAME_OBJECT_OLE:
+ case XML_ELEMENT(DRAW, XML_OBJECT):
+ case XML_ELEMENT(DRAW, XML_OBJECT_OLE):
{
// draw:object or draw:object_ole
- pContext = new SdXMLObjectShapeContext( rImport, xAttrList, rShapes );
+ pContext = new SdXMLObjectShapeContext( rImport, xCombinedAttrList.get(), rShapes );
break;
}
- case XML_TOK_FRAME_TABLE:
+ case XML_ELEMENT(TABLE, XML_TABLE):
{
// draw:object or draw:object_ole
if( rImport.IsTableShapeSupported() )
- pContext = new SdXMLTableShapeContext( rImport, xAttrList, rShapes );
+ pContext = new SdXMLTableShapeContext( rImport, xCombinedAttrList.get(), rShapes );
break;
}
- case XML_TOK_FRAME_PLUGIN:
+ case XML_ELEMENT(DRAW, XML_PLUGIN):
{
// draw:plugin
- pContext = new SdXMLPluginShapeContext( rImport, xAttrList, rShapes );
+ pContext = new SdXMLPluginShapeContext( rImport, xCombinedAttrList.get(), rShapes );
break;
}
- case XML_TOK_FRAME_FLOATING_FRAME:
+ case XML_ELEMENT(DRAW, XML_FLOATING_FRAME):
{
// draw:floating-frame
- pContext = new SdXMLFloatingFrameShapeContext( rImport, xAttrList, rShapes );
+ pContext = new SdXMLFloatingFrameShapeContext( rImport, xCombinedAttrList.get(), rShapes );
break;
}
- case XML_TOK_FRAME_APPLET:
+ case XML_ELEMENT(DRAW, XML_APPLET):
{
// draw:applet
- pContext = new SdXMLAppletShapeContext( rImport, xAttrList, rShapes );
+ pContext = new SdXMLAppletShapeContext( rImport, xCombinedAttrList.get(), rShapes );
break;
}
// add other shapes here...
default:
+ XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
break;
}
if( pContext )
{
// now parse the attribute list and call the child context for each unknown attribute
- sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
- for(sal_Int16 a(0); a < nAttrCount; a++)
+ for(auto& aIter : *xCombinedAttrList)
{
- const OUString& rAttrName = xAttrList->getNameByIndex(a);
- OUString aLocalName;
- sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName);
- const OUString aValue( xAttrList->getValueByIndex(a) );
-
- pContext->processAttribute( nPrefix, aLocalName, aValue );
+ if (!pContext->processAttribute( aIter.getToken(), aIter.toString() ))
+ XMLOFF_WARN_UNKNOWN("xmloff", aIter);
}
}
return pContext;
}
-SvXMLImportContextRef XMLShapeImportHelper::CreateFrameChildContext(
+css::uno::Reference< css::xml::sax::XFastContextHandler > XMLShapeImportHelper::CreateFrameChildContext(
SvXMLImportContext *pThisContext,
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+ sal_Int32 nElement,
+ const uno::Reference< xml::sax::XFastAttributeList>& xAttrList )
{
- SvXMLImportContextRef xContext;
-
+ css::uno::Reference< css::xml::sax::XFastContextHandler > xContext;
SdXMLFrameShapeContext *pFrameContext = dynamic_cast<SdXMLFrameShapeContext*>( pThisContext );
if (pFrameContext)
- xContext = pFrameContext->CreateChildContext( nPrefix, rLocalName, xAttrList );
+ xContext = pFrameContext->createFastChildContext( nElement, xAttrList );
+ if (!xContext)
+ XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
return xContext;
}
@@ -700,7 +633,7 @@ SvXMLImportContextRef XMLShapeImportHelper::CreateFrameChildContext(
shape to the given XShapes.
*/
void XMLShapeImportHelper::addShape( uno::Reference< drawing::XShape >& rShape,
- const uno::Reference< xml::sax::XAttributeList >&,
+ const uno::Reference< xml::sax::XFastAttributeList >&,
uno::Reference< drawing::XShapes >& rShapes)
{
if( rShape.is() && rShapes.is() )
@@ -716,7 +649,7 @@ void XMLShapeImportHelper::addShape( uno::Reference< drawing::XShape >& rShape,
*/
void XMLShapeImportHelper::finishShape(
css::uno::Reference< css::drawing::XShape >& rShape,
- const css::uno::Reference< css::xml::sax::XAttributeList >&,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >&,
css::uno::Reference< css::drawing::XShapes >&)
{
/* Set property <PositionLayoutDir>
diff --git a/xmloff/source/draw/ximp3dobject.cxx b/xmloff/source/draw/ximp3dobject.cxx
index b58e7c559578..abe34189c90d 100644
--- a/xmloff/source/draw/ximp3dobject.cxx
+++ b/xmloff/source/draw/ximp3dobject.cxx
@@ -19,49 +19,48 @@
#include "ximp3dobject.hxx"
#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlnamespace.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <xexptran.hxx>
#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
#include <com/sun/star/drawing/Direction3D.hpp>
#include <com/sun/star/drawing/Position3D.hpp>
+#include <sal/log.hxx>
#include <osl/diagnose.h>
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/polygon/b3dpolypolygontools.hxx>
using namespace ::com::sun::star;
+using namespace ::xmloff::token;
SdXML3DObjectContext::SdXML3DObjectContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes)
: SdXMLShapeContext( rImport, xAttrList, rShapes, false/*bTemporaryShape*/ ),
mbSetTransform( false )
{
- sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
- for(sal_Int16 i=0; i < nAttrCount; i++)
+ for(auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList))
{
- OUString sAttrName = xAttrList->getNameByIndex( i );
- OUString aLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
- OUString sValue = xAttrList->getValueByIndex( i );
- const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->Get3DObjectAttrTokenMap();
-
- switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ const OUString sValue = aIter.toString();
+ switch(aIter.getToken())
{
- case XML_TOK_3DOBJECT_DRAWSTYLE_NAME:
+ case XML_ELEMENT(DRAW, XML_STYLE_NAME):
{
maDrawStyleName = sValue;
break;
}
- case XML_TOK_3DOBJECT_TRANSFORM:
+ case XML_ELEMENT(DR3D, XML_TRANSFORM):
{
SdXMLImExTransform3D aTransform(sValue, GetImport().GetMM100UnitConverter());
if(aTransform.NeedsAction())
mbSetTransform = aTransform.GetFullHomogenTransform(mxHomMat);
break;
}
+ default:
+ XMLOFF_WARN_UNKNOWN("xmloff", aIter);
}
}
}
@@ -90,24 +89,19 @@ void SdXML3DObjectContext::startFastElement(
SdXML3DCubeObjectShapeContext::SdXML3DCubeObjectShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes)
: SdXML3DObjectContext( rImport, xAttrList, rShapes ),
maMinEdge(-2500.0, -2500.0, -2500.0),
maMaxEdge(2500.0, 2500.0, 2500.0)
{
- sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
- for(sal_Int16 i=0; i < nAttrCount; i++)
+ for(auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList))
{
- OUString sAttrName = xAttrList->getNameByIndex( i );
- OUString aLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
- OUString sValue = xAttrList->getValueByIndex( i );
- const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->Get3DCubeObjectAttrTokenMap();
+ OUString sValue = aIter.toString();
- switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ switch(aIter.getToken())
{
- case XML_TOK_3DCUBEOBJ_MINEDGE:
+ case XML_ELEMENT(DR3D, XML_MIN_EDGE):
{
::basegfx::B3DVector aNewVec;
SvXMLUnitConverter::convertB3DVector(aNewVec, sValue);
@@ -116,7 +110,7 @@ SdXML3DCubeObjectShapeContext::SdXML3DCubeObjectShapeContext(
maMinEdge = aNewVec;
break;
}
- case XML_TOK_3DCUBEOBJ_MAXEDGE:
+ case XML_ELEMENT(DR3D, XML_MAX_EDGE):
{
::basegfx::B3DVector aNewVec;
SvXMLUnitConverter::convertB3DVector(aNewVec, sValue);
@@ -125,6 +119,8 @@ SdXML3DCubeObjectShapeContext::SdXML3DCubeObjectShapeContext(
maMaxEdge = aNewVec;
break;
}
+ default:
+ XMLOFF_WARN_UNKNOWN("xmloff", aIter);
}
}
}
@@ -172,24 +168,19 @@ void SdXML3DCubeObjectShapeContext::startFastElement(
SdXML3DSphereObjectShapeContext::SdXML3DSphereObjectShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes)
: SdXML3DObjectContext( rImport, xAttrList, rShapes ),
maCenter(0.0, 0.0, 0.0),
maSphereSize(5000.0, 5000.0, 5000.0)
{
- sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
- for(sal_Int16 i=0; i < nAttrCount; i++)
+ for(auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList))
{
- OUString sAttrName = xAttrList->getNameByIndex( i );
- OUString aLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
- OUString sValue = xAttrList->getValueByIndex( i );
- const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->Get3DSphereObjectAttrTokenMap();
+ OUString sValue = aIter.toString();
- switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ switch(aIter.getToken())
{
- case XML_TOK_3DSPHEREOBJ_CENTER:
+ case XML_ELEMENT(DR3D, XML_CENTER):
{
::basegfx::B3DVector aNewVec;
SvXMLUnitConverter::convertB3DVector(aNewVec, sValue);
@@ -198,7 +189,7 @@ SdXML3DSphereObjectShapeContext::SdXML3DSphereObjectShapeContext(
maCenter = aNewVec;
break;
}
- case XML_TOK_3DSPHEREOBJ_SIZE:
+ case XML_ELEMENT(DR3D, XML_SIZE):
{
::basegfx::B3DVector aNewVec;
SvXMLUnitConverter::convertB3DVector(aNewVec, sValue);
@@ -207,6 +198,8 @@ SdXML3DSphereObjectShapeContext::SdXML3DSphereObjectShapeContext(
maSphereSize = aNewVec;
break;
}
+ default:
+ XMLOFF_WARN_UNKNOWN("xmloff", aIter);
}
}
}
@@ -251,31 +244,30 @@ void SdXML3DSphereObjectShapeContext::startFastElement(
SdXML3DPolygonBasedShapeContext::SdXML3DPolygonBasedShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes)
: SdXML3DObjectContext( rImport, xAttrList, rShapes )
{
- sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
- for(sal_Int16 i=0; i < nAttrCount; i++)
+ for(auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList))
{
- OUString sAttrName = xAttrList->getNameByIndex( i );
- OUString aLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
- OUString sValue = xAttrList->getValueByIndex( i );
- const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->Get3DPolygonBasedAttrTokenMap();
+ OUString sValue = aIter.toString();
- switch(rAttrTokenMap.Get(nPrefix, aLocalName))
+ switch(aIter.getToken())
{
- case XML_TOK_3DPOLYGONBASED_VIEWBOX:
+ case XML_ELEMENT(SVG, XML_VIEWBOX):
+ case XML_ELEMENT(SVG_COMPAT, XML_VIEWBOX):
{
maViewBox = sValue;
break;
}
- case XML_TOK_3DPOLYGONBASED_D:
+ case XML_ELEMENT(SVG, XML_D):
+ case XML_ELEMENT(SVG_COMPAT, XML_D):
{
maPoints = sValue;
break;
}
+ default:
+ XMLOFF_WARN_UNKNOWN("xmloff", aIter);
}
}
}
@@ -328,7 +320,7 @@ void SdXML3DPolygonBasedShapeContext::startFastElement(
SdXML3DLatheObjectShapeContext::SdXML3DLatheObjectShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes)
: SdXML3DPolygonBasedShapeContext( rImport, xAttrList, rShapes )
{
@@ -354,7 +346,7 @@ void SdXML3DLatheObjectShapeContext::startFastElement(
SdXML3DExtrudeObjectShapeContext::SdXML3DExtrudeObjectShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes)
: SdXML3DPolygonBasedShapeContext( rImport, xAttrList, rShapes )
{
diff --git a/xmloff/source/draw/ximp3dobject.hxx b/xmloff/source/draw/ximp3dobject.hxx
index ac40bd88b6ac..7bbab86f7ea0 100644
--- a/xmloff/source/draw/ximp3dobject.hxx
+++ b/xmloff/source/draw/ximp3dobject.hxx
@@ -36,7 +36,7 @@ class SdXML3DObjectContext : public SdXMLShapeContext
public:
SdXML3DObjectContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes);
virtual ~SdXML3DObjectContext() override;
@@ -55,7 +55,7 @@ class SdXML3DCubeObjectShapeContext : public SdXML3DObjectContext
public:
SdXML3DCubeObjectShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes);
virtual ~SdXML3DCubeObjectShapeContext() override;
@@ -74,7 +74,7 @@ class SdXML3DSphereObjectShapeContext : public SdXML3DObjectContext
public:
SdXML3DSphereObjectShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes);
virtual ~SdXML3DSphereObjectShapeContext() override;
@@ -93,7 +93,7 @@ class SdXML3DPolygonBasedShapeContext : public SdXML3DObjectContext
public:
SdXML3DPolygonBasedShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes);
virtual ~SdXML3DPolygonBasedShapeContext() override;
@@ -109,7 +109,7 @@ class SdXML3DLatheObjectShapeContext : public SdXML3DPolygonBasedShapeContext
public:
SdXML3DLatheObjectShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes);
virtual ~SdXML3DLatheObjectShapeContext() override;
@@ -125,7 +125,7 @@ class SdXML3DExtrudeObjectShapeContext : public SdXML3DPolygonBasedShapeContext
public:
SdXML3DExtrudeObjectShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes);
virtual ~SdXML3DExtrudeObjectShapeContext() override;
diff --git a/xmloff/source/draw/ximp3dscene.cxx b/xmloff/source/draw/ximp3dscene.cxx
index b062898256ff..9477481343e8 100644
--- a/xmloff/source/draw/ximp3dscene.cxx
+++ b/xmloff/source/draw/ximp3dscene.cxx
@@ -94,7 +94,7 @@ SdXML3DLightContext::~SdXML3DLightContext()
SdXML3DSceneShapeContext::SdXML3DSceneShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes,
bool bTemporaryShapes)
: SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShapes ), SdXML3DSceneAttributesHelper( rImport )
@@ -168,45 +168,24 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SdXML3DSceneShapeConte
case XML_ELEMENT(SVG_COMPAT, XML_TITLE):
case XML_ELEMENT(SVG, XML_DESC):
case XML_ELEMENT(SVG_COMPAT, XML_DESC):
+ xContext = new SdXMLDescriptionContext( GetImport(), nElement, mxShape );
break;
case XML_ELEMENT(OFFICE, XML_EVENT_LISTENERS):
+ xContext = new SdXMLEventsContext( GetImport(), mxShape );
break;
// look for local light context first
case XML_ELEMENT(DR3D, XML_LIGHT):
// dr3d:light inside dr3d:scene context
xContext = create3DLightContext( xAttrList );
break;
+ default:
+ // call GroupChildContext function at common ShapeImport
+ return XMLShapeImportHelper::Create3DSceneChildContext(
+ GetImport(), nElement, xAttrList, mxChildren);
}
return xContext.get();
}
-SvXMLImportContextRef SdXML3DSceneShapeContext::CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const uno::Reference< xml::sax::XAttributeList>& xAttrList )
-{
- SvXMLImportContextRef xContext;
-
- // #i68101#
- if( nPrefix == XML_NAMESPACE_SVG &&
- (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) )
- {
- xContext = new SdXMLDescriptionContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
- }
- else if( nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
- {
- xContext = new SdXMLEventsContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
- }
-
- // call GroupChildContext function at common ShapeImport
- if (!xContext)
- {
- xContext = GetImport().GetShapeImport()->Create3DSceneChildContext(
- GetImport(), nPrefix, rLocalName, xAttrList, mxChildren);
- }
-
- return xContext;
-}
-
SdXML3DSceneAttributesHelper::SdXML3DSceneAttributesHelper( SvXMLImport& rImporter )
: mrImport( rImporter ),
mbSetTransform( false ),
diff --git a/xmloff/source/draw/ximp3dscene.hxx b/xmloff/source/draw/ximp3dscene.hxx
index 9d06f93990cf..42905689fffb 100644
--- a/xmloff/source/draw/ximp3dscene.hxx
+++ b/xmloff/source/draw/ximp3dscene.hxx
@@ -36,7 +36,7 @@ public:
SdXML3DSceneShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes,
bool bTemporaryShape);
virtual ~SdXML3DSceneShapeContext() override;
@@ -48,10 +48,6 @@ public:
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
-
- virtual SvXMLImportContextRef CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList ) override;
};
#endif // INCLUDED_XMLOFF_SOURCE_DRAW_XIMP3DSCENE_HXX
diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx
index e85143e0b1d4..8e23b0ee844f 100644
--- a/xmloff/source/draw/ximpcustomshape.cxx
+++ b/xmloff/source/draw/ximpcustomshape.cxx
@@ -55,9 +55,8 @@ using namespace ::xmloff::EnhancedCustomShapeToken;
XMLEnhancedCustomShapeContext::XMLEnhancedCustomShapeContext( SvXMLImport& rImport,
css::uno::Reference< css::drawing::XShape >& rxShape,
- sal_uInt16 nPrefix, const OUString& rLocalName,
std::vector< css::beans::PropertyValue >& rCustomShapeGeometry ) :
- SvXMLImportContext( rImport, nPrefix, rLocalName ),
+ SvXMLImportContext( rImport ),
mrUnitConverter( rImport.GetMM100UnitConverter() ),
mrxShape( rxShape ),
mrCustomShapeGeometry( rCustomShapeGeometry )
diff --git a/xmloff/source/draw/ximpcustomshape.hxx b/xmloff/source/draw/ximpcustomshape.hxx
index 4700388bf110..f06d01c0cddb 100644
--- a/xmloff/source/draw/ximpcustomshape.hxx
+++ b/xmloff/source/draw/ximpcustomshape.hxx
@@ -51,8 +51,8 @@ class XMLEnhancedCustomShapeContext : public SvXMLImportContext
public:
- XMLEnhancedCustomShapeContext( SvXMLImport& rImport, css::uno::Reference< css::drawing::XShape > &, sal_uInt16 nPrefix,
- const OUString& rLocalName, std::vector< css::beans::PropertyValue >& rCustomShapeGeometry );
+ XMLEnhancedCustomShapeContext( SvXMLImport& rImport, css::uno::Reference< css::drawing::XShape > &,
+ std::vector< css::beans::PropertyValue >& rCustomShapeGeometry );
virtual void SAL_CALL startFastElement(
sal_Int32 nElement,
diff --git a/xmloff/source/draw/ximpgrp.cxx b/xmloff/source/draw/ximpgrp.cxx
index 716e0d5f506b..c9cf7e218a35 100644
--- a/xmloff/source/draw/ximpgrp.cxx
+++ b/xmloff/source/draw/ximpgrp.cxx
@@ -30,7 +30,7 @@ using namespace ::xmloff::token;
SdXMLGroupShapeContext::SdXMLGroupShapeContext(
SvXMLImport& rImport,
- const uno::Reference< xml::sax::XAttributeList>& xAttrList,
+ const uno::Reference< xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes,
bool bTemporaryShape)
: SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape )
@@ -45,59 +45,31 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLGroupShapeContext
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
- // #i68101#
+ // #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
+ return new SdXMLDescriptionContext( GetImport(), nElement, mxShape );
}
else if( nElement == XML_ELEMENT(OFFICE, XML_EVENT_LISTENERS) )
{
- // handled in CreateChildContext
+ return new SdXMLEventsContext( GetImport(), mxShape );
}
else if( nElement == XML_ELEMENT(DRAW, XML_GLUE_POINT) )
{
- // handled in CreateChildContext
+ addGluePoint( xAttrList );
}
else
{
// call GroupChildContext function at common ShapeImport
- return GetImport().GetShapeImport()->CreateGroupChildContext(
+ return XMLShapeImportHelper::CreateGroupChildContext(
GetImport(), nElement, xAttrList, mxChildren);
}
return nullptr;
}
-SvXMLImportContextRef SdXMLGroupShapeContext::CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const uno::Reference< xml::sax::XAttributeList>& xAttrList )
-{
- SvXMLImportContextRef xContext;
-
- // #i68101#
- if( nPrefix == XML_NAMESPACE_SVG &&
- (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) )
- {
- xContext = new SdXMLDescriptionContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
- }
- else if( nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
- {
- xContext = new SdXMLEventsContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
- }
- else if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_GLUE_POINT ) )
- {
- addGluePoint( xAttrList );
- }
- else
- {
- // handled in createFastChildContext
- }
-
- return xContext;
-}
-
void SdXMLGroupShapeContext::startFastElement (sal_Int32 /*nElement*/,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/)
{
diff --git a/xmloff/source/draw/ximpgrp.hxx b/xmloff/source/draw/ximpgrp.hxx
index c775e2e35bfc..3bab50490c0b 100644
--- a/xmloff/source/draw/ximpgrp.hxx
+++ b/xmloff/source/draw/ximpgrp.hxx
@@ -34,14 +34,11 @@ class SdXMLGroupShapeContext : public SdXMLShapeContext
public:
SdXMLGroupShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes,
bool bTemporaryShape);
virtual ~SdXMLGroupShapeContext() override;
- virtual SvXMLImportContextRef CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName,
- 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 >& xAttrList ) override;
diff --git a/xmloff/source/draw/ximplink.cxx b/xmloff/source/draw/ximplink.cxx
index cebd3086c7f4..41b236cc8a9c 100644
--- a/xmloff/source/draw/ximplink.cxx
+++ b/xmloff/source/draw/ximplink.cxx
@@ -27,23 +27,19 @@ using namespace ::com::sun::star;
using namespace ::xmloff::token;
-SdXMLShapeLinkContext::SdXMLShapeLinkContext( SvXMLImport& rImport, const uno::Reference< xml::sax::XAttributeList>& xAttrList, uno::Reference< drawing::XShapes > const & rShapes)
+SdXMLShapeLinkContext::SdXMLShapeLinkContext( SvXMLImport& rImport, const uno::Reference< xml::sax::XFastAttributeList>& xAttrList, uno::Reference< drawing::XShapes > const & rShapes)
: SvXMLShapeContext( rImport, false )
, mxParent( rShapes )
{
- sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-
- for(sal_Int16 i=0; i < nAttrCount; i++)
+ for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
{
- OUString sAttrName = xAttrList->getNameByIndex( i );
- OUString aLocalName;
- sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
- if( (nPrefix == XML_NAMESPACE_XLINK) && IsXMLToken( aLocalName, XML_HREF ) )
+ if( aIter.getToken() == XML_ELEMENT(XLINK, XML_HREF) )
{
assert(msHyperlink.pData);
- msHyperlink = xAttrList->getValueByIndex( i );
- break;
+ msHyperlink = aIter.toString();
}
+ else
+ XMLOFF_WARN_UNKNOWN("xmloff", aIter);
}
}
@@ -55,7 +51,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLShapeLinkContext:
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
- SvXMLShapeContext* pContext = GetImport().GetShapeImport()->CreateGroupChildContext( GetImport(), nElement, xAttrList, mxParent);
+ SvXMLShapeContext* pContext = XMLShapeImportHelper::CreateGroupChildContext( GetImport(), nElement, xAttrList, mxParent);
if( pContext )
{
diff --git a/xmloff/source/draw/ximplink.hxx b/xmloff/source/draw/ximplink.hxx
index 3055d85204af..274365fb5a90 100644
--- a/xmloff/source/draw/ximplink.hxx
+++ b/xmloff/source/draw/ximplink.hxx
@@ -37,7 +37,7 @@ class SdXMLShapeLinkContext : public SvXMLShapeContext
public:
SdXMLShapeLinkContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes);
virtual ~SdXMLShapeLinkContext() override;
diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx
index 8b8342bd0edc..b9492b96a776 100644
--- a/xmloff/source/draw/ximppage.cxx
+++ b/xmloff/source/draw/ximppage.cxx
@@ -264,7 +264,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLGenericPageContex
else
{
// call GroupChildContext function at common ShapeImport
- auto p = GetImport().GetShapeImport()->CreateGroupChildContext(GetImport(), nElement, xAttrList, mxShapes);
+ auto p = XMLShapeImportHelper::CreateGroupChildContext(GetImport(), nElement, xAttrList, mxShapes);
if (p)
return p;
}
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 520bc682e6bf..5ae4680332ae 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -141,7 +141,7 @@ static bool ImpIsEmptyURL( std::u16string_view rURL )
SdXMLShapeContext::SdXMLShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes,
bool bTemporaryShape)
: SvXMLShapeContext( rImport, bTemporaryShape )
@@ -169,53 +169,37 @@ SdXMLShapeContext::~SdXMLShapeContext()
{
}
-SvXMLImportContextRef SdXMLShapeContext::CreateChildContext( sal_uInt16 p_nPrefix,
- const OUString& rLocalName,
- const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLShapeContext::createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
SvXMLImportContextRef xContext;
-
// #i68101#
- if( p_nPrefix == XML_NAMESPACE_SVG &&
- (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) )
+ 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) )
{
- xContext = new SdXMLDescriptionContext( GetImport(), p_nPrefix, rLocalName, xAttrList, mxShape );
+ xContext = new SdXMLDescriptionContext( GetImport(), nElement, mxShape );
}
- else if( p_nPrefix == XML_NAMESPACE_LO_EXT && IsXMLToken( rLocalName, XML_SIGNATURELINE ) )
+ else if( nElement == XML_ELEMENT(LO_EXT, XML_SIGNATURELINE) )
{
- xContext = new SignatureLineContext( GetImport(), p_nPrefix, rLocalName, xAttrList, mxShape );
+ xContext = new SignatureLineContext( GetImport(), nElement, xAttrList, mxShape );
}
- else if( p_nPrefix == XML_NAMESPACE_LO_EXT && IsXMLToken( rLocalName, XML_QRCODE ) )
+ else if( nElement == XML_ELEMENT(LO_EXT, XML_QRCODE) )
{
- xContext = new QRCodeContext( GetImport(), p_nPrefix, rLocalName, xAttrList, mxShape );
+ xContext = new QRCodeContext( GetImport(), nElement, xAttrList, mxShape );
}
- else if( p_nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
+ else if( nElement == XML_ELEMENT(OFFICE, XML_EVENT_LISTENERS) )
{
- xContext = new SdXMLEventsContext( GetImport(), p_nPrefix, rLocalName, xAttrList, mxShape );
+ xContext = new SdXMLEventsContext( GetImport(), mxShape );
}
- else if( p_nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_GLUE_POINT ) )
+ else if( nElement == XML_ELEMENT(DRAW, XML_GLUE_POINT) )
{
addGluePoint( xAttrList );
}
- else if( p_nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_THUMBNAIL ) )
+ else if( nElement == XML_ELEMENT(DRAW, XML_THUMBNAIL) )
{
// search attributes for xlink:href
- sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
- for(sal_Int16 i=0; i < nAttrCount; i++)
- {
- OUString sAttrName = xAttrList->getNameByIndex( i );
- OUString aLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
-
- if( nPrefix == XML_NAMESPACE_XLINK )
- {
- if( IsXMLToken( aLocalName, XML_HREF ) )
- {
- maThumbnailURL = xAttrList->getValueByIndex( i );
- break;
- }
- }
- }
+ maThumbnailURL = xAttrList->getOptionalValue(XML_ELEMENT(XLINK, XML_HREF));
}
else
{
@@ -245,15 +229,18 @@ SvXMLImportContextRef SdXMLShapeContext::CreateChildContext( sal_uInt16 p_nPrefi
if( mxCursor.is() )
{
xContext = GetImport().GetTextImport()->CreateTextChildContext(
- GetImport(), p_nPrefix, rLocalName, xAttrList,
+ GetImport(), nElement, xAttrList,
( mbTextBox ? XMLTextType::TextBox : XMLTextType::Shape ) );
}
}
- return xContext;
+ if (!xContext)
+ XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
+
+ return xContext.get();
}
-void SdXMLShapeContext::addGluePoint( const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+void SdXMLShapeContext::addGluePoint( const uno::Reference< xml::sax::XFastAttributeList>& xAttrList )
{
// get the glue points container for this shape if it's not already there
if( !mxGluePoints.is() )
@@ -279,46 +266,40 @@ void SdXMLShapeContext::addGluePoint( const uno::Reference< xml::sax::XAttribute
sal_Int32 nId = -1;
// read attributes for the 3DScene
- sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
- for(sal_Int16 i=0; i < nAttrCount; i++)
+ for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
{
- OUString sAttrName = xAttrList->getNameByIndex( i );
- OUString aLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
- const OUString sValue( xAttrList->getValueByIndex( i ) );
-
- if( nPrefix == XML_NAMESPACE_SVG )
+ switch(aIter.getToken())
{
- if( IsXMLToken( aLocalName, XML_X ) )
- {
+ case XML_ELEMENT(SVG, XML_X):
+ case XML_ELEMENT(SVG_COMPAT, XML_X):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
- aGluePoint.Position.X, sValue);
- }
- else if( IsXMLToken( aLocalName, XML_Y ) )
- {
+ aGluePoint.Position.X, aIter.toString());
+ break;
+ case XML_ELEMENT(SVG, XML_Y):
+ case XML_ELEMENT(SVG_COMPAT, XML_Y):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
- aGluePoint.Position.Y, sValue);
- }
- }
- else if( nPrefix == XML_NAMESPACE_DRAW )
- {
- if( IsXMLToken( aLocalName, XML_ID ) )
- {
- nId = sValue.toInt32();
- }
- else if( IsXMLToken( aLocalName, XML_ALIGN ) )
+ aGluePoint.Position.Y, aIter.toString());
+ break;
+ case XML_ELEMENT(DRAW, XML_ID):
+ nId = aIter.toInt32();
+ break;
+ case XML_ELEMENT(DRAW, XML_ALIGN):
{
drawing::Alignment eKind;
- if( SvXMLUnitConverter::convertEnum( eKind, sValue, aXML_GlueAlignment_EnumMap ) )
+ if( SvXMLUnitConverter::convertEnum( eKind, aIter.toString(), aXML_GlueAlignment_EnumMap ) )
{
aGluePoint.PositionAlignment = eKind;
aGluePoint.IsRelative = false;
}
+ break;
}
- else if( IsXMLToken( aLocalName, XML_ESCAPE_DIRECTION ) )
+ case XML_ELEMENT(DRAW, XML_ESCAPE_DIRECTION):
{
- SvXMLUnitConverter::convertEnum( aGluePoint.Escape, sValue, aXML_GlueEscapeDirection_EnumMap );
+ SvXMLUnitConverter::convertEnum( aGluePoint.Escape, aIter.toString(), aXML_GlueEscapeDirection_EnumMap );
+ break;
}
+ default:
+ XMLOFF_WARN_UNKNOWN("xmloff", aIter);
}
}
@@ -801,125 +782,110 @@ void SdXMLShapeContext::SetThumbnail()
}
// this is called from the parent group for each unparsed attribute in the attribute list
-void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
+bool SdXMLShapeContext::processAttribute( sal_Int32 nElement, const OUString& rValue )
{
- if( (XML_NAMESPACE_DRAW == nPrefix) || (XML_NAMESPACE_DRAW_EXT == nPrefix) )
+ sal_Int32 nTmp;
+ switch (nElement)
{
- if( IsXMLToken( rLocalName, XML_ZINDEX ) )
- {
+ case XML_ELEMENT(DRAW, XML_ZINDEX):
+ case XML_ELEMENT(DRAW_EXT, XML_ZINDEX):
mnZOrder = rValue.toInt32();
- }
- else if( IsXMLToken( rLocalName, XML_ID ) )
- {
+ break;
+ case XML_ELEMENT(DRAW, XML_ID):
+ case XML_ELEMENT(DRAW_EXT, XML_ID):
if (!mbHaveXmlId) { maShapeId = rValue; }
- }
- else if( IsXMLToken( rLocalName, XML_NAME ) )
- {
+ break;
+ case XML_ELEMENT(DRAW, XML_NAME):
+ case XML_ELEMENT(DRAW_EXT, XML_NAME):
maShapeName = rValue;
- }
- else if( IsXMLToken( rLocalName, XML_STYLE_NAME ) )
- {
+ break;
+ case XML_ELEMENT(DRAW, XML_STYLE_NAME):
+ case XML_ELEMENT(DRAW_EXT, XML_STYLE_NAME):
maDrawStyleName = rValue;
- }
- else if( IsXMLToken( rLocalName, XML_TEXT_STYLE_NAME ) )
- {
+ break;
+ case XML_ELEMENT(DRAW, XML_TEXT_STYLE_NAME):
+ case XML_ELEMENT(DRAW_EXT, XML_TEXT_STYLE_NAME):
maTextStyleName = rValue;
- }
- else if( IsXMLToken( rLocalName, XML_LAYER ) )
- {
+ break;
+ case XML_ELEMENT(DRAW, XML_LAYER):
+ case XML_ELEMENT(DRAW_EXT, XML_LAYER):
maLayerName = rValue;
- }
- else if( IsXMLToken( rLocalName, XML_TRANSFORM ) )
- {
+ break;
+ case XML_ELEMENT(DRAW, XML_TRANSFORM):
+ case XML_ELEMENT(DRAW_EXT, XML_TRANSFORM):
mnTransform.SetString(rValue, GetImport().GetMM100UnitConverter());
- }
- else if( IsXMLToken( rLocalName, XML_DISPLAY ) )
- {
+ break;
+ case XML_ELEMENT(DRAW, XML_DISPLAY):
+ case XML_ELEMENT(DRAW_EXT, XML_DISPLAY):
mbVisible = IsXMLToken( rValue, XML_ALWAYS ) || IsXMLToken( rValue, XML_SCREEN );
mbPrintable = IsXMLToken( rValue, XML_ALWAYS ) || IsXMLToken( rValue, XML_PRINTER );
- }
- }
- else if( XML_NAMESPACE_PRESENTATION == nPrefix )
- {
- if( IsXMLToken( rLocalName, XML_USER_TRANSFORMED ) )
- {
+ break;
+ case XML_ELEMENT(PRESENTATION, XML_USER_TRANSFORMED):
mbIsUserTransformed = IsXMLToken( rValue, XML_TRUE );
- }
- else if( IsXMLToken( rLocalName, XML_PLACEHOLDER ) )
- {
+ break;
+ case XML_ELEMENT(PRESENTATION, XML_PLACEHOLDER):
mbIsPlaceholder = IsXMLToken( rValue, XML_TRUE );
if( mbIsPlaceholder )
mbClearDefaultAttributes = false;
- }
- else if( IsXMLToken( rLocalName, XML_CLASS ) )
- {
+ break;
+ case XML_ELEMENT(PRESENTATION, XML_CLASS):
maPresentationClass = rValue;
- }
- else if( IsXMLToken( rLocalName, XML_STYLE_NAME ) )
- {
+ break;
+ case XML_ELEMENT(PRESENTATION, XML_STYLE_NAME):
maDrawStyleName = rValue;
mnStyleFamily = XmlStyleFamily::SD_PRESENTATION_ID;
- }
- }
- else if( XML_NAMESPACE_SVG == nPrefix )
- {
- if( IsXMLToken( rLocalName, XML_X ) )
- {
+ break;
+ case XML_ELEMENT(SVG, XML_X):
+ case XML_ELEMENT(SVG_COMPAT, XML_X):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
maPosition.X, rValue);
- }
- else if( IsXMLToken( rLocalName, XML_Y ) )
- {
+ break;
+ case XML_ELEMENT(SVG, XML_Y):
+ case XML_ELEMENT(SVG_COMPAT, XML_Y):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
maPosition.Y, rValue);
- }
- else if( IsXMLToken( rLocalName, XML_WIDTH ) )
- {
+ break;
+ case XML_ELEMENT(SVG, XML_WIDTH):
+ case XML_ELEMENT(SVG_COMPAT, XML_WIDTH):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
maSize.Width, rValue);
if (maSize.Width > 0)
maSize.Width = o3tl::saturating_add<sal_Int32>(maSize.Width, 1);
else if (maSize.Width < 0)
maSize.Width = o3tl::saturating_add<sal_Int32>(maSize.Width, -1);
- }
- else if( IsXMLToken( rLocalName, XML_HEIGHT ) )
- {
+ break;
+ case XML_ELEMENT(SVG, XML_HEIGHT):
+ case XML_ELEMENT(SVG_COMPAT, XML_HEIGHT):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
maSize.Height, rValue);
if (maSize.Height > 0)
maSize.Height = o3tl::saturating_add<sal_Int32>(maSize.Height, 1);
else if (maSize.Height < 0)
maSize.Height = o3tl::saturating_add<sal_Int32>(maSize.Height, -1);
- }
- else if( IsXMLToken( rLocalName, XML_TRANSFORM ) )
- {
+ break;
+ case XML_ELEMENT(SVG, XML_TRANSFORM):
+ case XML_ELEMENT(SVG_COMPAT, XML_TRANSFORM):
// because of #85127# take svg:transform into account and handle like
// draw:transform for compatibility
mnTransform.SetString(rValue, GetImport().GetMM100UnitConverter());
- }
- }
- else if (nPrefix == XML_NAMESPACE_STYLE)
- {
- sal_Int32 nTmp;
- if (IsXMLToken(rLocalName, XML_REL_WIDTH))
- {
+ break;
+ case XML_ELEMENT(STYLE, XML_REL_WIDTH):
if (sax::Converter::convertPercent(nTmp, rValue))
mnRelWidth = static_cast<sal_Int16>(nTmp);
- }
- else if (IsXMLToken(rLocalName, XML_REL_HEIGHT))
- {
+ break;
+ case XML_ELEMENT(STYLE, XML_REL_HEIGHT):
if (sax::Converter::convertPercent(nTmp, rValue))
mnRelHeight = static_cast<sal_Int16>(nTmp);
- }
- }
- else if( (XML_NAMESPACE_NONE == nPrefix) || (XML_NAMESPACE_XML == nPrefix) )
- {
- if( IsXMLToken( rLocalName, XML_ID ) )
- {
+ break;
+ case XML_ELEMENT(NONE, XML_ID):
+ case XML_ELEMENT(XML, XML_ID):
maShapeId = rValue;
mbHaveXmlId = true;
- }
+ break;
+ default:
+ return false;
}
+ return true;
}
bool SdXMLShapeContext::isPresentationShape() const
@@ -943,7 +909,7 @@ bool SdXMLShapeContext::isPresentationShape() const
SdXMLRectShapeContext::SdXMLRectShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes,
bool bTemporaryShape)
: SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape ),
@@ -956,19 +922,18 @@ SdXMLRectShapeContext::~SdXMLRectShapeContext()
}
// this is called from the parent group for each unparsed attribute in the attribute list
-void SdXMLRectShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
+bool SdXMLRectShapeContext::processAttribute( sal_Int32 nElement, const OUString& rValue )
{
- if( XML_NAMESPACE_DRAW == nPrefix )
+ switch (nElement)
{
- if( IsXMLToken( rLocalName, XML_CORNER_RADIUS ) )
- {
+ case XML_ELEMENT(DRAW, XML_CORNER_RADIUS):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
mnRadius, rValue);
- return;
- }
+ break;
+ default:
+ return SdXMLShapeContext::processAttribute( nElement, rValue );
}
-
- SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+ return true;
}
void SdXMLRectShapeContext::startFastElement (sal_Int32 nElement,
@@ -1007,7 +972,7 @@ void SdXMLRectShapeContext::startFastElement (sal_Int32 nElement,
SdXMLLineShapeContext::SdXMLLineShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes,
bool bTemporaryShape)
: SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape ),
@@ -1023,37 +988,34 @@ SdXMLLineShapeContext::~SdXMLLineShapeContext()
}
// this is called from the parent group for each unparsed attribute in the attribute list
-void SdXMLLineShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
+bool SdXMLLineShapeContext::processAttribute( sal_Int32 nElement, const OUString& rValue )
{
- if( XML_NAMESPACE_SVG == nPrefix )
+ switch (nElement)
{
- if( IsXMLToken( rLocalName, XML_X1 ) )
- {
+ case XML_ELEMENT(SVG, XML_X1):
+ case XML_ELEMENT(SVG_COMPAT, XML_X1):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
mnX1, rValue);
- return;
- }
- if( IsXMLToken( rLocalName, XML_Y1 ) )
- {
+ break;
+ case XML_ELEMENT(SVG, XML_Y1):
+ case XML_ELEMENT(SVG_COMPAT, XML_Y1):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
mnY1, rValue);
- return;
- }
- if( IsXMLToken( rLocalName, XML_X2 ) )
- {
+ break;
+ case XML_ELEMENT(SVG, XML_X2):
+ case XML_ELEMENT(SVG_COMPAT, XML_X2):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
mnX2, rValue);
- return;
- }
- if( IsXMLToken( rLocalName, XML_Y2 ) )
- {
+ break;
+ case XML_ELEMENT(SVG, XML_Y2):
+ case XML_ELEMENT(SVG_COMPAT, XML_Y2):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
mnY2, rValue);
- return;
- }
+ break;
+ default:
+ return SdXMLShapeContext::processAttribute( nElement, rValue );
}
-
- SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+ return true;
}
void SdXMLLineShapeContext::startFastElement (sal_Int32 nElement,
@@ -1119,7 +1081,7 @@ void SdXMLLineShapeContext::startFastElement (sal_Int32 nElement,
SdXMLEllipseShapeContext::SdXMLEllipseShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes,
bool bTemporaryShape)
: SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape ),
@@ -1138,67 +1100,58 @@ SdXMLEllipseShapeContext::~SdXMLEllipseShapeContext()
}
// this is called from the parent group for each unparsed attribute in the attribute list
-void SdXMLEllipseShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
+bool SdXMLEllipseShapeContext::processAttribute( sal_Int32 nElement, const OUString& rValue )
{
- if( XML_NAMESPACE_SVG == nPrefix )
+ switch (nElement)
{
- if( IsXMLToken( rLocalName, XML_RX ) )
- {
+ case XML_ELEMENT(SVG, XML_RX):
+ case XML_ELEMENT(SVG_COMPAT, XML_RX):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
mnRX, rValue);
- return;
- }
- if( IsXMLToken( rLocalName, XML_RY ) )
- {
+ break;
+ case XML_ELEMENT(SVG, XML_RY):
+ case XML_ELEMENT(SVG_COMPAT, XML_RY):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
mnRY, rValue);
- return;
- }
- if( IsXMLToken( rLocalName, XML_CX ) )
- {
+ break;
+ case XML_ELEMENT(SVG, XML_CX):
+ case XML_ELEMENT(SVG_COMPAT, XML_CX):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
mnCX, rValue);
- return;
- }
- if( IsXMLToken( rLocalName, XML_CY ) )
- {
+ break;
+ case XML_ELEMENT(SVG, XML_CY):
+ case XML_ELEMENT(SVG_COMPAT, XML_CY):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
mnCY, rValue);
- return;
- }
- if( IsXMLToken( rLocalName, XML_R ) )
- {
+ break;
+ case XML_ELEMENT(SVG, XML_R):
+ case XML_ELEMENT(SVG_COMPAT, XML_R):
// single radius, it's a circle and both radii are the same
GetImport().GetMM100UnitConverter().convertMeasureToCore(
mnRX, rValue);
mnRY = mnRX;
- return;
- }
- }
- else if( XML_NAMESPACE_DRAW == nPrefix )
- {
- if( IsXMLToken( rLocalName, XML_KIND ) )
- {
+ break;
+ case XML_ELEMENT(DRAW, XML_KIND):
SvXMLUnitConverter::convertEnum( meKind, rValue, aXML_CircleKind_EnumMap );
- return;
- }
- if( IsXMLToken( rLocalName, XML_START_ANGLE ) )
+ break;
+ case XML_ELEMENT(DRAW, XML_START_ANGLE):
{
double dStartAngle;
if (::sax::Converter::convertDouble( dStartAngle, rValue ))
mnStartAngle = static_cast<sal_Int32>(dStartAngle * 100.0);
- return;
+ break;
}
- if( IsXMLToken( rLocalName, XML_END_ANGLE ) )
+ case XML_ELEMENT(DRAW, XML_END_ANGLE):
{
double dEndAngle;
if (::sax::Converter::convertDouble( dEndAngle, rValue ))
mnEndAngle = static_cast<sal_Int32>(dEndAngle * 100.0);
- return;
+ break;
}
+ default:
+ return SdXMLShapeContext::processAttribute( nElement, rValue );
}
-
- SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+ return true;
}
void SdXMLEllipseShapeContext::startFastElement (sal_Int32 nElement,
@@ -1242,7 +1195,7 @@ void SdXMLEllipseShapeContext::startFastElement (sal_Int32 nElement,
SdXMLPolygonShapeContext::SdXMLPolygonShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes, bool bClosed, bool bTemporaryShape)
: SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape ),
mbClosed( bClosed )
@@ -1250,26 +1203,21 @@ SdXMLPolygonShapeContext::SdXMLPolygonShapeContext(
}
// this is called from the parent group for each unparsed attribute in the attribute list
-void SdXMLPolygonShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
+bool SdXMLPolygonShapeContext::processAttribute( sal_Int32 nElement, const OUString& rValue )
{
- if( XML_NAMESPACE_SVG == nPrefix )
+ switch (nElement)
{
- if( IsXMLToken( rLocalName, XML_VIEWBOX ) )
- {
+ case XML_ELEMENT(SVG, XML_VIEWBOX):
+ case XML_ELEMENT(SVG_COMPAT, XML_VIEWBOX):
maViewBox = rValue;
- return;
- }
- }
- else if( XML_NAMESPACE_DRAW == nPrefix )
- {
- if( IsXMLToken( rLocalName, XML_POINTS ) )
- {
+ break;
+ case XML_ELEMENT(DRAW, XML_POINTS):
maPoints = rValue;
- return;
- }
+ break;
+ default:
+ return SdXMLShapeContext::processAttribute( nElement, rValue );
}
-
- SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+ return true;
}
SdXMLPolygonShapeContext::~SdXMLPolygonShapeContext()
@@ -1350,7 +1298,7 @@ void SdXMLPolygonShapeContext::startFastElement (sal_Int32 nElement,
SdXMLPathShapeContext::SdXMLPathShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes,
bool bTemporaryShape)
: SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape )
@@ -1362,23 +1310,22 @@ SdXMLPathShapeContext::~SdXMLPathShapeContext()
}
// this is called from the parent group for each unparsed attribute in the attribute list
-void SdXMLPathShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
+bool SdXMLPathShapeContext::processAttribute( sal_Int32 nElement, const OUString& rValue )
{
- if( XML_NAMESPACE_SVG == nPrefix )
+ switch (nElement)
{
- if( IsXMLToken( rLocalName, XML_VIEWBOX ) )
- {
+ case XML_ELEMENT(SVG, XML_VIEWBOX):
+ case XML_ELEMENT(SVG_COMPAT, XML_VIEWBOX):
maViewBox = rValue;
- return;
- }
- else if( IsXMLToken( rLocalName, XML_D ) )
- {
+ break;
+ case XML_ELEMENT(SVG, XML_D):
+ case XML_ELEMENT(SVG_COMPAT, XML_D):
maD = rValue;
- return;
- }
+ break;
+ default:
+ return SdXMLShapeContext::processAttribute( nElement, rValue );
}
-
- SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+ return true;
}
void SdXMLPathShapeContext::startFastElement (sal_Int32 nElement,
@@ -1502,7 +1449,7 @@ void SdXMLPathShapeContext::startFastElement (sal_Int32 nElement,
SdXMLTextBoxShapeContext::SdXMLTextBoxShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes)
: SdXMLShapeContext( rImport, xAttrList, rShapes, false/*bTemporaryShape*/ ),
mnRadius(0),
@@ -1515,26 +1462,21 @@ SdXMLTextBoxShapeContext::~SdXMLTextBoxShapeContext()
}
// this is called from the parent group for each unparsed attribute in the attribute list
-void SdXMLTextBoxShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
+bool SdXMLTextBoxShapeContext::processAttribute( sal_Int32 nElement, const OUString& rValue )
{
- if( XML_NAMESPACE_DRAW == nPrefix )
+ switch (nElement)
{
- if( IsXMLToken( rLocalName, XML_CORNER_RADIUS ) )
- {
+ case XML_ELEMENT(DRAW, XML_CORNER_RADIUS):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
mnRadius, rValue);
- return;
- }
-
- if( IsXMLToken( rLocalName, XML_CHAIN_NEXT_NAME ) )
- {
+ break;
+ case XML_ELEMENT(DRAW, XML_CHAIN_NEXT_NAME):
maChainNextName = rValue;
- return;
- }
-
+ break;
+ default:
+ return SdXMLShapeContext::processAttribute( nElement, rValue );
}
-
- SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+ return true;
}
void SdXMLTextBoxShapeContext::startFastElement (sal_Int32 nElement,
@@ -1689,7 +1631,7 @@ void SdXMLTextBoxShapeContext::startFastElement (sal_Int32 nElement,
SdXMLControlShapeContext::SdXMLControlShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes,
bool bTemporaryShape)
: SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape )
@@ -1701,18 +1643,17 @@ SdXMLControlShapeContext::~SdXMLControlShapeContext()
}
// this is called from the parent group for each unparsed attribute in the attribute list
-void SdXMLControlShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
+bool SdXMLControlShapeContext::processAttribute( sal_Int32 nElement, const OUString& rValue )
{
- if( XML_NAMESPACE_DRAW == nPrefix )
+ switch (nElement)
{
- if( IsXMLToken( rLocalName, XML_CONTROL ) )
- {
+ case XML_ELEMENT(DRAW, XML_CONTROL):
maFormId = rValue;
- return;
- }
+ break;
+ default:
+ return SdXMLShapeContext::processAttribute( nElement, rValue );
}
-
- SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+ return true;
}
void SdXMLControlShapeContext::startFastElement (sal_Int32 nElement,
@@ -1752,7 +1693,7 @@ void SdXMLControlShapeContext::startFastElement (sal_Int32 nElement,
SdXMLConnectorShapeContext::SdXMLConnectorShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes,
bool bTemporaryShape)
: SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape ),
@@ -1790,33 +1731,23 @@ bool SvXMLImport::needFixPositionAfterZ() const
// this is called from the parent group for each unparsed attribute in the attribute list
-void SdXMLConnectorShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
+bool SdXMLConnectorShapeContext::processAttribute( sal_Int32 nElement, const OUString& rValue )
{
- switch( nPrefix )
+ switch( nElement )
{
- case XML_NAMESPACE_DRAW:
- {
- if( IsXMLToken( rLocalName, XML_START_SHAPE ) )
- {
+ case XML_ELEMENT(DRAW, XML_START_SHAPE):
maStartShapeId = rValue;
- return;
- }
- if( IsXMLToken( rLocalName, XML_START_GLUE_POINT ) )
- {
+ break;
+ case XML_ELEMENT(DRAW, XML_START_GLUE_POINT):
mnStartGlueId = rValue.toInt32();
- return;
- }
- if( IsXMLToken( rLocalName, XML_END_SHAPE ) )
- {
+ break;
+ case XML_ELEMENT(DRAW, XML_END_SHAPE):
maEndShapeId = rValue;
- return;
- }
- if( IsXMLToken( rLocalName, XML_END_GLUE_POINT ) )
- {
+ break;
+ case XML_ELEMENT(DRAW, XML_END_GLUE_POINT):
mnEndGlueId = rValue.toInt32();
- return;
- }
- if( IsXMLToken( rLocalName, XML_LINE_SKEW ) )
+ break;
+ case XML_ELEMENT(DRAW, XML_LINE_SKEW):
{
SvXMLTokenEnumerator aTokenEnum( rValue );
OUString aToken;
@@ -1835,48 +1766,40 @@ void SdXMLConnectorShapeContext::processAttribute( sal_uInt16 nPrefix, const OUS
}
}
}
- return;
+ break;
}
- if( IsXMLToken( rLocalName, XML_TYPE ) )
+ case XML_ELEMENT(DRAW, XML_TYPE):
{
(void)SvXMLUnitConverter::convertEnum( mnType, rValue, aXML_ConnectionKind_EnumMap );
- return;
+ break;
}
// #121965# draw:transform may be used in ODF1.2, e.g. exports from MS seem to use these
- else if( IsXMLToken( rLocalName, XML_TRANSFORM ) )
- {
+ case XML_ELEMENT(DRAW, XML_TRANSFORM):
mnTransform.SetString(rValue, GetImport().GetMM100UnitConverter());
- }
- }
- break;
+ break;
- case XML_NAMESPACE_SVG:
- {
- if( IsXMLToken( rLocalName, XML_X1 ) )
- {
+ case XML_ELEMENT(SVG, XML_X1):
+ case XML_ELEMENT(SVG_COMPAT, XML_X1):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
maStart.X, rValue);
- return;
- }
- if( IsXMLToken( rLocalName, XML_Y1 ) )
- {
+ break;
+ case XML_ELEMENT(SVG, XML_Y1):
+ case XML_ELEMENT(SVG_COMPAT, XML_Y1):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
maStart.Y, rValue);
- return;
- }
- if( IsXMLToken( rLocalName, XML_X2 ) )
- {
+ break;
+ case XML_ELEMENT(SVG, XML_X2):
+ case XML_ELEMENT(SVG_COMPAT, XML_X2):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
maEnd.X, rValue);
- return;
- }
- if( IsXMLToken( rLocalName, XML_Y2 ) )
- {
+ break;
+ case XML_ELEMENT(SVG, XML_Y2):
+ case XML_ELEMENT(SVG_COMPAT, XML_Y2):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
maEnd.Y, rValue);
- return;
- }
- if( IsXMLToken( rLocalName, XML_D ) )
+ break;
+ case XML_ELEMENT(SVG, XML_D):
+ case XML_ELEMENT(SVG_COMPAT, XML_D):
{
basegfx::B2DPolyPolygon aPolyPolygon;
@@ -1892,11 +1815,12 @@ void SdXMLConnectorShapeContext::processAttribute( sal_uInt16 nPrefix, const OUS
maPath <<= aSourcePolyPolygon;
}
}
+ break;
}
+ default:
+ return SdXMLShapeContext::processAttribute( nElement, rValue );
}
- }
-
- SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+ return true;
}
void SdXMLConnectorShapeContext::startFastElement (sal_Int32 nElement,
@@ -2057,7 +1981,7 @@ void SdXMLConnectorShapeContext::startFastElement (sal_Int32 nElement,
SdXMLMeasureShapeContext::SdXMLMeasureShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes,
bool bTemporaryShape)
: SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape ),
@@ -2071,40 +1995,42 @@ SdXMLMeasureShapeContext::~SdXMLMeasureShapeContext()
}
// this is called from the parent group for each unparsed attribute in the attribute list
-void SdXMLMeasureShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
+bool SdXMLMeasureShapeContext::processAttribute( sal_Int32 nElement, const OUString& rValue )
{
- switch( nPrefix )
- {
- case XML_NAMESPACE_SVG:
+ switch( nElement )
{
- if( IsXMLToken( rLocalName, XML_X1 ) )
+ case XML_ELEMENT(SVG, XML_X1):
+ case XML_ELEMENT(SVG_COMPAT, XML_X1):
{
GetImport().GetMM100UnitConverter().convertMeasureToCore(
maStart.X, rValue);
- return;
+ break;
}
- if( IsXMLToken( rLocalName, XML_Y1 ) )
+ case XML_ELEMENT(SVG, XML_Y1):
+ case XML_ELEMENT(SVG_COMPAT, XML_Y1):
{
GetImport().GetMM100UnitConverter().convertMeasureToCore(
maStart.Y, rValue);
- return;
+ break;
}
- if( IsXMLToken( rLocalName, XML_X2 ) )
+ case XML_ELEMENT(SVG, XML_X2):
+ case XML_ELEMENT(SVG_COMPAT, XML_X2):
{
GetImport().GetMM100UnitConverter().convertMeasureToCore(
maEnd.X, rValue);
- return;
+ break;
}
- if( IsXMLToken( rLocalName, XML_Y2 ) )
+ case XML_ELEMENT(SVG, XML_Y2):
+ case XML_ELEMENT(SVG_COMPAT, XML_Y2):
{
GetImport().GetMM100UnitConverter().convertMeasureToCore(
maEnd.Y, rValue);
- return;
+ break;
}
+ default:
+ return SdXMLShapeContext::processAttribute( nElement, rValue );
}
- }
-
- SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+ return true;
}
void SdXMLMeasureShapeContext::startFastElement (sal_Int32 nElement,
@@ -2161,7 +2087,7 @@ void SdXMLMeasureShapeContext::endFastElement(sal_Int32 nElement)
SdXMLPageShapeContext::SdXMLPageShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes,
bool bTemporaryShape)
: SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape ), mnPageNumber(0)
@@ -2174,18 +2100,13 @@ SdXMLPageShapeContext::~SdXMLPageShapeContext()
}
// this is called from the parent group for each unparsed attribute in the attribute list
-void SdXMLPageShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
+bool SdXMLPageShapeContext::processAttribute( sal_Int32 nElement, const OUString& rValue )
{
- if( XML_NAMESPACE_DRAW == nPrefix )
- {
- if( IsXMLToken( rLocalName, XML_PAGE_NUMBER ) )
- {
- mnPageNumber = rValue.toInt32();
- return;
- }
- }
-
- SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+ if( nElement == XML_ELEMENT(DRAW, XML_PAGE_NUMBER) )
+ mnPageNumber = rValue.toInt32();
+ else
+ return SdXMLShapeContext::processAttribute( nElement, rValue );
+ return true;
}
void SdXMLPageShapeContext::startFastElement (sal_Int32 nElement,
@@ -2247,7 +2168,7 @@ void SdXMLPageShapeContext::startFastElement (sal_Int32 nElement,
SdXMLCaptionShapeContext::SdXMLCaptionShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes,
bool bTemporaryShape)
: SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape ),
@@ -2317,36 +2238,32 @@ void SdXMLCaptionShapeContext::startFastElement (sal_Int32 nElement,
}
// this is called from the parent group for each unparsed attribute in the attribute list
-void SdXMLCaptionShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
+bool SdXMLCaptionShapeContext::processAttribute( sal_Int32 nElement, const OUString& rValue )
{
- if( XML_NAMESPACE_DRAW == nPrefix )
+ switch (nElement)
{
- if( IsXMLToken( rLocalName, XML_CAPTION_POINT_X ) )
- {
+ case XML_ELEMENT(DRAW, XML_CAPTION_POINT_X):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
maCaptionPoint.X, rValue);
- return;
- }
- if( IsXMLToken( rLocalName, XML_CAPTION_POINT_Y ) )
- {
+ break;
+ case XML_ELEMENT(DRAW, XML_CAPTION_POINT_Y):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
maCaptionPoint.Y, rValue);
- return;
- }
- if( IsXMLToken( rLocalName, XML_CORNER_RADIUS ) )
- {
+ break;
+ case XML_ELEMENT(DRAW, XML_CORNER_RADIUS):
GetImport().GetMM100UnitConverter().convertMeasureToCore(
mnRadius, rValue);
- return;
- }
+ break;
+ default:
+ return SdXMLShapeContext::processAttribute( nElement, rValue );
}
- SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+ return true;
}
SdXMLGraphicObjectShapeContext::SdXMLGraphicObjectShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes)
: SdXMLShapeContext( rImport, xAttrList, rShapes, false/*bTemporaryShape*/ ),
maURL()
@@ -2354,18 +2271,13 @@ SdXMLGraphicObjectShapeContext::SdXMLGraphicObjectShapeContext(
}
// this is called from the parent group for each unparsed attribute in the attribute list
-void SdXMLGraphicObjectShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
+bool SdXMLGraphicObjectShapeContext::processAttribute( sal_Int32 nElement, const OUString& rValue )
{
- if( XML_NAMESPACE_XLINK == nPrefix )
- {
- if( IsXMLToken( rLocalName, XML_HREF ) )
- {
- maURL = rValue;
- return;
- }
- }
-
- SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+ if( nElement == XML_ELEMENT(XLINK, XML_HREF) )
+ maURL = rValue;
+ else
+ return SdXMLShapeContext::processAttribute( nElement, rValue );
+ return true;
}
void SdXMLGraphicObjectShapeContext::startFastElement (sal_Int32 nElement,
@@ -2461,30 +2373,31 @@ void SdXMLGraphicObjectShapeContext::endFastElement(sal_Int32 nElement)
SdXMLShapeContext::endFastElement(nElement);
}
-SvXMLImportContextRef SdXMLGraphicObjectShapeContext::CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName,
- const uno::Reference<xml::sax::XAttributeList>& xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLGraphicObjectShapeContext::createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
- SvXMLImportContextRef xContext;
+ css::uno::Reference< css::xml::sax::XFastContextHandler > xContext;
- if( (XML_NAMESPACE_OFFICE == nPrefix) &&
- xmloff::token::IsXMLToken( rLocalName, xmloff::token::XML_BINARY_DATA ) )
+ if( nElement == XML_ELEMENT(OFFICE, XML_BINARY_DATA) )
{
if( maURL.isEmpty() && !mxBase64Stream.is() )
{
mxBase64Stream = GetImport().GetStreamForGraphicObjectURLFromBase64();
if( mxBase64Stream.is() )
- xContext = new XMLBase64ImportContext( GetImport(), nPrefix,
- rLocalName, xAttrList,
+ xContext = new XMLBase64ImportContext( GetImport(),
mxBase64Stream );
}
}
// delegate to parent class if no context could be created
if (!xContext)
- xContext = SdXMLShapeContext::CreateChildContext(nPrefix, rLocalName,
+ xContext = SdXMLShapeContext::createFastChildContext(nElement,
xAttrList);
+ if (!xContext)
+ XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
+
return xContext;
}
@@ -2496,7 +2409,7 @@ SdXMLGraphicObjectShapeContext::~SdXMLGraphicObjectShapeContext()
SdXMLChartShapeContext::SdXMLChartShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes,
bool bTemporaryShape)
: SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape )
@@ -2583,14 +2496,14 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLChartShapeContext
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
if( mxChartContext.is() )
- return mxChartContext->createFastChildContextFallback( nElement, xAttrList );
+ return mxChartContext->createFastChildContext( nElement, xAttrList );
return nullptr;
}
SdXMLObjectShapeContext::SdXMLObjectShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes)
: SdXMLShapeContext( rImport, xAttrList, rShapes, false/*bTemporaryShape*/ )
{
@@ -2732,27 +2645,20 @@ void SdXMLObjectShapeContext::endFastElement(sal_Int32 nElement)
}
// this is called from the parent group for each unparsed attribute in the attribute list
-void SdXMLObjectShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
+bool SdXMLObjectShapeContext::processAttribute( sal_Int32 nElement, const OUString& rValue )
{
- switch( nPrefix )
+ switch( nElement )
{
- case XML_NAMESPACE_DRAW:
- if( IsXMLToken( rLocalName, XML_CLASS_ID ) )
- {
+ case XML_ELEMENT(DRAW, XML_CLASS_ID):
maCLSID = rValue;
- return;
- }
- break;
- case XML_NAMESPACE_XLINK:
- if( IsXMLToken( rLocalName, XML_HREF ) )
- {
+ break;
+ case XML_ELEMENT(XLINK, XML_HREF):
maHref = rValue;
- return;
- }
- break;
+ break;
+ default:
+ return SdXMLShapeContext::processAttribute( nElement, rValue );
}
-
- SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+ return true;
}
css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLObjectShapeContext::createFastChildContext(
@@ -2786,24 +2692,13 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLObjectShapeContex
}
return xEContext.get();
}
- return nullptr;
-}
-
-SvXMLImportContextRef SdXMLObjectShapeContext::CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName,
- const uno::Reference<xml::sax::XAttributeList>& xAttrList )
-{
- SvXMLImportContextRef xContext;
// delegate to parent class if no context could be created
- if (!xContext)
- xContext = SdXMLShapeContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
-
- return xContext;
+ return SdXMLShapeContext::createFastChildContext(nElement, xAttrList);
}
SdXMLAppletShapeContext::SdXMLAppletShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes)
: SdXMLShapeContext( rImport, xAttrList, rShapes, false/*bTemporaryShape*/ ),
mbIsScript( false )
@@ -2830,37 +2725,26 @@ void SdXMLAppletShapeContext::startFastElement (sal_Int32 /*nElement*/,
}
// this is called from the parent group for each unparsed attribute in the attribute list
-void SdXMLAppletShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
+bool SdXMLAppletShapeContext::processAttribute( sal_Int32 nElement, const OUString& rValue )
{
- switch( nPrefix )
+ switch( nElement )
{
- case XML_NAMESPACE_DRAW:
- if( IsXMLToken( rLocalName, XML_APPLET_NAME ) )
- {
+ case XML_ELEMENT(DRAW, XML_APPLET_NAME):
maAppletName = rValue;
- return;
- }
- if( IsXMLToken( rLocalName, XML_CODE ) )
- {
+ break;
+ case XML_ELEMENT(DRAW, XML_CODE):
maAppletCode = rValue;
- return;
- }
- if( IsXMLToken( rLocalName, XML_MAY_SCRIPT ) )
- {
+ break;
+ case XML_ELEMENT(DRAW, XML_MAY_SCRIPT):
mbIsScript = IsXMLToken( rValue, XML_TRUE );
- return;
- }
- break;
- case XML_NAMESPACE_XLINK:
- if( IsXMLToken( rLocalName, XML_HREF ) )
- {
+ break;
+ case XML_ELEMENT(XLINK, XML_HREF):
maHref = GetImport().GetAbsoluteReference(rValue);
- return;
- }
- break;
+ break;
+ default:
+ return SdXMLShapeContext::processAttribute( nElement, rValue );
}
-
- SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+ return true;
}
void SdXMLAppletShapeContext::endFastElement(sal_Int32 nElement)
@@ -2909,31 +2793,20 @@ void SdXMLAppletShapeContext::endFastElement(sal_Int32 nElement)
SdXMLShapeContext::endFastElement(nElement);
}
-SvXMLImportContextRef SdXMLAppletShapeContext::CreateChildContext( sal_uInt16 p_nPrefix, const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLAppletShapeContext::createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
- if( p_nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_PARAM ) )
+ if( nElement == XML_ELEMENT(DRAW, XML_PARAM) )
{
OUString aParamName, aParamValue;
- const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
// now parse the attribute list and look for draw:name and draw:value
- for(sal_Int16 a(0); a < nAttrCount; a++)
+ for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
{
- const OUString& rAttrName = xAttrList->getNameByIndex(a);
- OUString aLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName);
- const OUString aValue( xAttrList->getValueByIndex(a) );
-
- if( nPrefix == XML_NAMESPACE_DRAW )
- {
- if( IsXMLToken( aLocalName, XML_NAME ) )
- {
- aParamName = aValue;
- }
- else if( IsXMLToken( aLocalName, XML_VALUE ) )
- {
- aParamValue = aValue;
- }
- }
+ if( aIter.getToken() == XML_ELEMENT(DRAW, XML_NAME) )
+ aParamName = aIter.toString();
+ if( aIter.getToken() == XML_ELEMENT(DRAW, XML_VALUE) )
+ aParamValue = aIter.toString();
}
if( !aParamName.isEmpty() )
@@ -2946,15 +2819,15 @@ SvXMLImportContextRef SdXMLAppletShapeContext::CreateChildContext( sal_uInt16 p_
maParams[nIndex].State = beans::PropertyState_DIRECT_VALUE;
}
- return new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName );
+ return new SvXMLImportContext( GetImport() );
}
- return SdXMLShapeContext::CreateChildContext( p_nPrefix, rLocalName, xAttrList );
+ return SdXMLShapeContext::createFastChildContext( nElement, xAttrList );
}
SdXMLPluginShapeContext::SdXMLPluginShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes) :
SdXMLShapeContext( rImport, xAttrList, rShapes, false/*bTemporaryShape*/ ),
mbMedia( false )
@@ -3044,27 +2917,20 @@ lcl_GetMediaReference(SvXMLImport const& rImport, OUString const& rURL)
}
// this is called from the parent group for each unparsed attribute in the attribute list
-void SdXMLPluginShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
+bool SdXMLPluginShapeContext::processAttribute( sal_Int32 nElement, const OUString& rValue )
{
- switch( nPrefix )
+ switch( nElement )
{
- case XML_NAMESPACE_DRAW:
- if( IsXMLToken( rLocalName, XML_MIME_TYPE ) )
- {
+ case XML_ELEMENT(DRAW, XML_MIME_TYPE):
maMimeType = rValue;
- return;
- }
- break;
- case XML_NAMESPACE_XLINK:
- if( IsXMLToken( rLocalName, XML_HREF ) )
- {
+ break;
+ case XML_ELEMENT(XLINK, XML_HREF):
maHref = lcl_GetMediaReference(GetImport(), rValue);
- return;
- }
- break;
+ break;
+ default:
+ return SdXMLShapeContext::processAttribute( nElement, rValue );
}
-
- SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+ return true;
}
void SdXMLPluginShapeContext::endFastElement(sal_Int32 nElement)
@@ -3172,52 +3038,41 @@ void SdXMLPluginShapeContext::endFastElement(sal_Int32 nElement)
SdXMLShapeContext::endFastElement(nElement);
}
-SvXMLImportContextRef SdXMLPluginShapeContext::CreateChildContext( sal_uInt16 p_nPrefix, const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLPluginShapeContext::createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
- if( p_nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_PARAM ) )
+ if( nElement == XML_ELEMENT(DRAW, XML_PARAM) )
{
OUString aParamName, aParamValue;
- const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
// now parse the attribute list and look for draw:name and draw:value
- for(sal_Int16 a(0); a < nAttrCount; a++)
+ for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
{
- const OUString& rAttrName = xAttrList->getNameByIndex(a);
- OUString aLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName);
- const OUString aValue( xAttrList->getValueByIndex(a) );
-
- if( nPrefix == XML_NAMESPACE_DRAW )
- {
- if( IsXMLToken( aLocalName, XML_NAME ) )
- {
- aParamName = aValue;
- }
- else if( IsXMLToken( aLocalName, XML_VALUE ) )
- {
- aParamValue = aValue;
- }
- }
+ if( aIter.getToken() == XML_ELEMENT(DRAW, XML_NAME) )
+ aParamName = aIter.toString();
+ else if( aIter.getToken() == XML_ELEMENT(DRAW, XML_VALUE) )
+ aParamValue = aIter.toString();
+ }
- if( !aParamName.isEmpty() )
- {
- sal_Int32 nIndex = maParams.getLength();
- maParams.realloc( nIndex + 1 );
- maParams[nIndex].Name = aParamName;
- maParams[nIndex].Handle = -1;
- maParams[nIndex].Value <<= aParamValue;
- maParams[nIndex].State = beans::PropertyState_DIRECT_VALUE;
- }
+ if( !aParamName.isEmpty() )
+ {
+ sal_Int32 nIndex = maParams.getLength();
+ maParams.realloc( nIndex + 1 );
+ maParams[nIndex].Name = aParamName;
+ maParams[nIndex].Handle = -1;
+ maParams[nIndex].Value <<= aParamValue;
+ maParams[nIndex].State = beans::PropertyState_DIRECT_VALUE;
}
- return new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName );
+ return new SvXMLImportContext( GetImport() );
}
- return SdXMLShapeContext::CreateChildContext( p_nPrefix, rLocalName, xAttrList );
+ return SdXMLShapeContext::createFastChildContext( nElement, xAttrList );
}
SdXMLFloatingFrameShapeContext::SdXMLFloatingFrameShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes)
: SdXMLShapeContext( rImport, xAttrList, rShapes, false/*bTemporaryShape*/ )
{
@@ -3260,27 +3115,20 @@ void SdXMLFloatingFrameShapeContext::startFastElement (sal_Int32 /*nElement*/,
}
// this is called from the parent group for each unparsed attribute in the attribute list
-void SdXMLFloatingFrameShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
+bool SdXMLFloatingFrameShapeContext::processAttribute( sal_Int32 nElement, const OUString& rValue )
{
- switch( nPrefix )
+ switch( nElement )
{
- case XML_NAMESPACE_DRAW:
- if( IsXMLToken( rLocalName, XML_FRAME_NAME ) )
- {
+ case XML_ELEMENT(DRAW, XML_FRAME_NAME):
maFrameName = rValue;
- return;
- }
- break;
- case XML_NAMESPACE_XLINK:
- if( IsXMLToken( rLocalName, XML_HREF ) )
- {
+ break;
+ case XML_ELEMENT(XLINK, XML_HREF):
maHref = GetImport().GetAbsoluteReference(rValue);
- return;
- }
- break;
+ break;
+ default:
+ return SdXMLShapeContext::processAttribute( nElement, rValue );
}
-
- SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+ return true;
}
void SdXMLFloatingFrameShapeContext::endFastElement(sal_Int32 nElement)
@@ -3303,7 +3151,7 @@ void SdXMLFloatingFrameShapeContext::endFastElement(sal_Int32 nElement)
SdXMLFrameShapeContext::SdXMLFrameShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes,
bool bTemporaryShape)
: SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape ),
@@ -3316,8 +3164,7 @@ SdXMLFrameShapeContext::SdXMLFrameShapeContext( SvXMLImport& rImport,
if( xClone.is() )
mxAttrList.set( xClone->createClone(), uno::UNO_QUERY );
else
- mxAttrList = new SvXMLAttributeList( xAttrList );
-
+ mxAttrList = new sax_fastparser::FastAttributeList(xAttrList);
}
SdXMLFrameShapeContext::~SdXMLFrameShapeContext()
@@ -3411,16 +3258,15 @@ OUString SdXMLFrameShapeContext::getGraphicPackageURLFromImportContext(const SvX
return aRetval;
}
-SvXMLImportContextRef SdXMLFrameShapeContext::CreateChildContext( sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLFrameShapeContext::createFastChildContext(
+ sal_Int32 nElement,
+ const uno::Reference< xml::sax::XFastAttributeList>& xAttrList )
{
SvXMLImportContextRef xContext;
-
if( !mxImplContext.is() )
{
- SvXMLShapeContext* pShapeContext= GetImport().GetShapeImport()->CreateFrameChildContext(
- GetImport(), nPrefix, rLocalName, xAttrList, mxShapes, mxAttrList );
+ SvXMLShapeContext* pShapeContext = XMLShapeImportHelper::CreateFrameChildContext(
+ GetImport(), nElement, xAttrList, mxShapes, mxAttrList );
xContext = pShapeContext;
@@ -3428,20 +3274,21 @@ SvXMLImportContextRef SdXMLFrameShapeContext::CreateChildContext( sal_uInt16 nPr
if ( !msHyperlink.isEmpty() )
pShapeContext->setHyperlink( msHyperlink );
+ auto nToken = nElement & TOKEN_MASK;
// Ignore gltf model if necessary and so the fallback image will be imported
- if( IsXMLToken(rLocalName, XML_PLUGIN ) )
+ if( nToken == XML_PLUGIN )
{
SdXMLPluginShapeContext* pPluginContext = dynamic_cast<SdXMLPluginShapeContext*>(pShapeContext);
if( pPluginContext && pPluginContext->getMimeType() == "model/vnd.gltf+json" )
{
mxImplContext = nullptr;
- return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
+ return new SvXMLImportContext(GetImport());
}
}
mxImplContext = xContext;
- mbSupportsReplacement = IsXMLToken(rLocalName, XML_OBJECT ) || IsXMLToken(rLocalName, XML_OBJECT_OLE);
- setSupportsMultipleContents(IsXMLToken(rLocalName, XML_IMAGE));
+ mbSupportsReplacement = (nToken == XML_OBJECT ) || (nToken == XML_OBJECT_OLE);
+ setSupportsMultipleContents(nToken == XML_IMAGE);
if(getSupportsMultipleContents() && dynamic_cast< SdXMLGraphicObjectShapeContext* >(xContext.get()))
{
@@ -3451,11 +3298,11 @@ SvXMLImportContextRef SdXMLFrameShapeContext::CreateChildContext( sal_uInt16 nPr
addContent(*mxImplContext);
}
}
- else if(getSupportsMultipleContents() && XML_NAMESPACE_DRAW == nPrefix && IsXMLToken(rLocalName, XML_IMAGE))
+ else if(getSupportsMultipleContents() && nElement == XML_ELEMENT(DRAW, XML_IMAGE))
{
// read another image
- xContext = GetImport().GetShapeImport()->CreateFrameChildContext(
- GetImport(), nPrefix, rLocalName, xAttrList, mxShapes, mxAttrList);
+ xContext = XMLShapeImportHelper::CreateFrameChildContext(
+ GetImport(), nElement, xAttrList, mxShapes, mxAttrList);
mxImplContext = xContext;
if(dynamic_cast< SdXMLGraphicObjectShapeContext* >(xContext.get()))
@@ -3464,8 +3311,7 @@ SvXMLImportContextRef SdXMLFrameShapeContext::CreateChildContext( sal_uInt16 nPr
}
}
else if( mbSupportsReplacement && !mxReplImplContext.is() &&
- XML_NAMESPACE_DRAW == nPrefix &&
- IsXMLToken( rLocalName, XML_IMAGE ) )
+ nElement == XML_ELEMENT(DRAW, XML_IMAGE) )
{
// read replacement image
SvXMLImportContext *pImplContext = mxImplContext.get();
@@ -3478,17 +3324,18 @@ SvXMLImportContextRef SdXMLFrameShapeContext::CreateChildContext( sal_uInt16 nPr
if( xPropSet.is() )
{
xContext = new XMLReplacementImageContext( GetImport(),
- nPrefix, rLocalName, xAttrList, xPropSet );
+ nElement, xAttrList, xPropSet );
mxReplImplContext = xContext;
}
}
}
- else if(
- ( nPrefix == XML_NAMESPACE_SVG && // #i68101#
- (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) ) ||
- (nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) ) ||
- (nPrefix == XML_NAMESPACE_DRAW && (IsXMLToken( rLocalName, XML_GLUE_POINT ) ||
- IsXMLToken( rLocalName, XML_THUMBNAIL ) ) ) )
+ else if( nElement == XML_ELEMENT(SVG, XML_TITLE) || // #i68101#
+ nElement == XML_ELEMENT(SVG_COMPAT, XML_TITLE) ||
+ nElement == XML_ELEMENT(SVG, XML_DESC) ||
+ nElement == XML_ELEMENT(SVG_COMPAT, XML_DESC) ||
+ nElement == XML_ELEMENT(OFFICE, XML_EVENT_LISTENERS) ||
+ nElement == XML_ELEMENT(DRAW, XML_GLUE_POINT) ||
+ nElement == XML_ELEMENT(DRAW, XML_THUMBNAIL) )
{
if (getSupportsMultipleContents())
{ // tdf#103567 ensure props are set on surviving shape
@@ -3496,10 +3343,10 @@ SvXMLImportContextRef SdXMLFrameShapeContext::CreateChildContext( sal_uInt16 nPr
mxImplContext = solveMultipleImages();
}
SvXMLImportContext *pImplContext = mxImplContext.get();
- xContext = dynamic_cast<SdXMLShapeContext&>(*pImplContext).CreateChildContext( nPrefix,
- rLocalName, xAttrList );
+ xContext = static_cast<SvXMLImportContext*>(dynamic_cast<SdXMLShapeContext&>(*pImplContext).createFastChildContext( nElement,
+ xAttrList ).get());
}
- else if ( (XML_NAMESPACE_DRAW == nPrefix) && IsXMLToken( rLocalName, XML_IMAGE_MAP ) )
+ else if ( nElement == XML_ELEMENT(DRAW, XML_IMAGE_MAP) )
{
if (getSupportsMultipleContents())
{ // tdf#103567 ensure props are set on surviving shape
@@ -3512,11 +3359,11 @@ SvXMLImportContextRef SdXMLFrameShapeContext::CreateChildContext( sal_uInt16 nPr
uno::Reference < beans::XPropertySet > xPropSet( pSContext->getShape(), uno::UNO_QUERY );
if (xPropSet.is())
{
- xContext = new XMLImageMapContext(GetImport(), nPrefix, rLocalName, xPropSet);
+ xContext = new XMLImageMapContext(GetImport(), xPropSet);
}
}
}
- else if ((XML_NAMESPACE_LO_EXT == nPrefix) && IsXMLToken(rLocalName, XML_SIGNATURELINE))
+ else if ( nElement == XML_ELEMENT(LO_EXT, XML_SIGNATURELINE) )
{
SdXMLShapeContext* pSContext = dynamic_cast<SdXMLShapeContext*>(mxImplContext.get());
if (pSContext)
@@ -3524,12 +3371,12 @@ SvXMLImportContextRef SdXMLFrameShapeContext::CreateChildContext( sal_uInt16 nPr
uno::Reference<beans::XPropertySet> xPropSet(pSContext->getShape(), uno::UNO_QUERY);
if (xPropSet.is())
{
- xContext = new SignatureLineContext(GetImport(), nPrefix, rLocalName, xAttrList,
+ xContext = new SignatureLineContext(GetImport(), nElement, xAttrList,
pSContext->getShape());
}
}
}
- else if ((XML_NAMESPACE_LO_EXT == nPrefix) && IsXMLToken(rLocalName, XML_QRCODE))
+ else if ( nElement == XML_ELEMENT(LO_EXT, XML_QRCODE))
{
SdXMLShapeContext* pSContext = dynamic_cast<SdXMLShapeContext*>(mxImplContext.get());
if (pSContext)
@@ -3537,13 +3384,13 @@ SvXMLImportContextRef SdXMLFrameShapeContext::CreateChildContext( sal_uInt16 nPr
uno::Reference<beans::XPropertySet> xPropSet(pSContext->getShape(), uno::UNO_QUERY);
if (xPropSet.is())
{
- xContext = new QRCodeContext(GetImport(), nPrefix, rLocalName, xAttrList,
+ xContext = new QRCodeContext(GetImport(), nElement, xAttrList,
pSContext->getShape());
}
}
}
- return xContext;
+ return xContext.get();
}
void SdXMLFrameShapeContext::startFastElement (sal_Int32 /*nElement*/,
@@ -3568,28 +3415,23 @@ void SdXMLFrameShapeContext::endFastElement(sal_Int32 nElement)
if( !mxImplContext.is() )
{
// now check if this is an empty presentation object
- sal_Int16 nAttrCount = mxAttrList.is() ? mxAttrList->getLength() : 0;
- for(sal_Int16 a(0); a < nAttrCount; a++)
+ for( auto& aIter : sax_fastparser::castToFastAttributeList(mxAttrList) )
{
- OUString aLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(mxAttrList->getNameByIndex(a), &aLocalName);
-
- if( nPrefix == XML_NAMESPACE_PRESENTATION )
+ switch (aIter.getToken())
{
- if( IsXMLToken( aLocalName, XML_PLACEHOLDER ) )
- {
- mbIsPlaceholder = IsXMLToken( mxAttrList->getValueByIndex(a), XML_TRUE );
- }
- else if( IsXMLToken( aLocalName, XML_CLASS ) )
- {
- maPresentationClass = mxAttrList->getValueByIndex(a);
- }
+ case XML_ELEMENT(PRESENTATION, XML_PLACEHOLDER):
+ mbIsPlaceholder = IsXMLToken( aIter.toString(), XML_TRUE );
+ break;
+ case XML_ELEMENT(PRESENTATION, XML_CLASS):
+ maPresentationClass = aIter.toString();
+ break;
+ default:;
}
}
if( (!maPresentationClass.isEmpty()) && mbIsPlaceholder )
{
- uno::Reference< xml::sax::XAttributeList> xEmpty;
+ uno::Reference< xml::sax::XFastAttributeList> xEmpty;
enum XMLTokenEnum eToken = XML_TEXT_BOX;
@@ -3609,14 +3451,14 @@ void SdXMLFrameShapeContext::endFastElement(sal_Int32 nElement)
eToken = XML_OBJECT;
}
- mxImplContext = GetImport().GetShapeImport()->CreateFrameChildContext(
- GetImport(), XML_NAMESPACE_DRAW, GetXMLToken( eToken ), mxAttrList, mxShapes, xEmpty );
+ auto x = XML_ELEMENT(DRAW, eToken);
+ mxImplContext = XMLShapeImportHelper::CreateFrameChildContext(
+ GetImport(), x, mxAttrList, mxShapes, xEmpty );
if( mxImplContext.is() )
{
- auto nElement2 = XML_ELEMENT(DRAW, eToken);
- mxImplContext->StartElement( mxAttrList );
- mxImplContext->endFastElement(nElement2);
+ mxImplContext->startFastElement( x, mxAttrList );
+ mxImplContext->endFastElement(x);
}
}
}
@@ -3625,45 +3467,40 @@ void SdXMLFrameShapeContext::endFastElement(sal_Int32 nElement)
SdXMLShapeContext::endFastElement(nElement);
}
-void SdXMLFrameShapeContext::processAttribute( sal_uInt16 nPrefix,
- const OUString& rLocalName, const OUString& rValue )
+bool SdXMLFrameShapeContext::processAttribute( sal_Int32 nElement, const OUString& rValue )
{
bool bId( false );
- switch ( nPrefix )
+ switch ( nElement )
{
- case XML_NAMESPACE_DRAW :
- case XML_NAMESPACE_DRAW_EXT :
- bId = IsXMLToken( rLocalName, XML_ID );
- break;
- case XML_NAMESPACE_NONE :
- case XML_NAMESPACE_XML :
- bId = IsXMLToken( rLocalName, XML_ID );
+ case XML_ELEMENT(DRAW, XML_ID):
+ case XML_ELEMENT(DRAW_EXT, XML_ID):
+ case XML_ELEMENT(NONE, XML_ID):
+ case XML_ELEMENT(XML, XML_ID) :
+ bId = true;
break;
+ default:;
}
if ( bId )
- SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+ return SdXMLShapeContext::processAttribute( nElement, rValue );
+ return true; // deliberately ignoring other attributes
}
SdXMLCustomShapeContext::SdXMLCustomShapeContext(
SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
uno::Reference< drawing::XShapes > const & rShapes)
: SdXMLShapeContext( rImport, xAttrList, rShapes, false/*bTemporaryShape*/ )
{
// See the XMLTextFrameContext ctor, a frame has Writer content (and not
// editeng) if its autostyle has a parent style. Do the same for shapes as well.
- sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
- for (sal_Int16 i=0; i < nAttrCount; ++i)
+ for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
{
- const OUString& rAttrName = xAttrList->getNameByIndex(i);
- OUString aLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName);
- if (nPrefix == XML_NAMESPACE_DRAW && IsXMLToken(aLocalName, XML_STYLE_NAME))
+ if (aIter.getToken() == XML_ELEMENT(DRAW, XML_STYLE_NAME))
{
- OUString aStyleName = xAttrList->getValueByIndex(i);
+ OUString aStyleName = aIter.toString();
if(!aStyleName.isEmpty())
{
rtl::Reference<XMLTextImportHelper> xTxtImport = GetImport().GetTextImport();
@@ -3684,22 +3521,19 @@ SdXMLCustomShapeContext::~SdXMLCustomShapeContext()
}
// this is called from the parent group for each unparsed attribute in the attribute list
-void SdXMLCustomShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
+bool SdXMLCustomShapeContext::processAttribute( sal_Int32 nElement, const OUString& rValue )
{
- if( XML_NAMESPACE_DRAW == nPrefix )
+ if( nElement == XML_ELEMENT(DRAW, XML_ENGINE) )
{
- if( IsXMLToken( rLocalName, XML_ENGINE ) )
- {
- maCustomShapeEngine = rValue;
- return;
- }
- if ( IsXMLToken( rLocalName, XML_DATA ) )
- {
- maCustomShapeData = rValue;
- return;
- }
+ maCustomShapeEngine = rValue;
+ }
+ else if (nElement == XML_ELEMENT(DRAW, XML_DATA) )
+ {
+ maCustomShapeData = rValue;
}
- SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+ else
+ return SdXMLShapeContext::processAttribute( nElement, rValue );
+ return true;
}
void SdXMLCustomShapeContext::startFastElement (sal_Int32 nElement,
@@ -3861,28 +3695,25 @@ void SdXMLCustomShapeContext::endFastElement(sal_Int32 nElement)
}
}
-SvXMLImportContextRef SdXMLCustomShapeContext::CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName,
- const uno::Reference<xml::sax::XAttributeList>& xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLCustomShapeContext::createFastChildContext(
+ sal_Int32 nElement,
+ const uno::Reference< xml::sax::XFastAttributeList>& xAttrList )
{
- SvXMLImportContextRef xContext;
- if ( XML_NAMESPACE_DRAW == nPrefix )
+ css::uno::Reference< css::xml::sax::XFastContextHandler > xContext;
+ if ( nElement == XML_ELEMENT(DRAW, XML_ENHANCED_GEOMETRY) )
{
- if ( IsXMLToken( rLocalName, XML_ENHANCED_GEOMETRY ) )
- {
- uno::Reference< beans::XPropertySet > xPropSet( mxShape,uno::UNO_QUERY );
- if ( xPropSet.is() )
- xContext = new XMLEnhancedCustomShapeContext( GetImport(), mxShape, nPrefix, rLocalName, maCustomShapeGeometry );
- }
+ uno::Reference< beans::XPropertySet > xPropSet( mxShape,uno::UNO_QUERY );
+ if ( xPropSet.is() )
+ xContext = new XMLEnhancedCustomShapeContext( GetImport(), mxShape, maCustomShapeGeometry );
}
// delegate to parent class if no context could be created
if (!xContext)
- xContext = SdXMLShapeContext::CreateChildContext( nPrefix, rLocalName,
+ xContext = SdXMLShapeContext::createFastChildContext( nElement,
xAttrList);
return xContext;
}
-SdXMLTableShapeContext::SdXMLTableShapeContext( SvXMLImport& rImport, const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList, css::uno::Reference< css::drawing::XShapes > const & rShapes )
+SdXMLTableShapeContext::SdXMLTableShapeContext( SvXMLImport& rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList, css::uno::Reference< css::drawing::XShapes > const & rShapes )
: SdXMLShapeContext( rImport, xAttrList, rShapes, false )
{
}
@@ -3990,11 +3821,11 @@ void SdXMLTableShapeContext::endFastElement(sal_Int32 nElement)
}
// this is called from the parent group for each unparsed attribute in the attribute list
-void SdXMLTableShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
+bool SdXMLTableShapeContext::processAttribute( sal_Int32 nElement, const OUString& rValue )
{
- if( nPrefix == XML_NAMESPACE_TABLE )
+ if( IsTokenInNamespace(nElement, XML_NAMESPACE_TABLE) )
{
- if( IsXMLToken( rLocalName, XML_TEMPLATE_NAME ) )
+ if( (nElement & TOKEN_MASK) == XML_TEMPLATE_NAME )
{
msTemplateStyleName = rValue;
}
@@ -4004,7 +3835,7 @@ void SdXMLTableShapeContext::processAttribute( sal_uInt16 nPrefix, const OUStrin
const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0];
while( pEntry->msApiName && (i < 6) )
{
- if( IsXMLToken( rLocalName, pEntry->meXMLName ) )
+ if( (nElement & TOKEN_MASK) == pEntry->meXMLName )
{
if( IsXMLToken( rValue, XML_TRUE ) )
maTemplateStylesUsed[i] = true;
@@ -4015,7 +3846,7 @@ void SdXMLTableShapeContext::processAttribute( sal_uInt16 nPrefix, const OUStrin
}
}
}
- SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
+ return SdXMLShapeContext::processAttribute( nElement, rValue );
}
css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLTableShapeContext::createFastChildContext(
@@ -4023,7 +3854,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLTableShapeContext
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
if( mxTableImportContext.is() && IsTokenInNamespace(nElement, XML_NAMESPACE_TABLE) )
- return mxTableImportContext->createFastChildContextFallback(nElement, xAttrList);
+ return mxTableImportContext->createFastChildContext(nElement, xAttrList);
return SdXMLShapeContext::createFastChildContext(nElement, xAttrList);
}
diff --git a/xmloff/source/draw/ximpshap.hxx b/xmloff/source/draw/ximpshap.hxx
index 49d70c5b3c37..6ad30c5a6bd1 100644
--- a/xmloff/source/draw/ximpshap.hxx
+++ b/xmloff/source/draw/ximpshap.hxx
@@ -48,7 +48,7 @@ protected:
css::uno::Reference< css::drawing::XShapes > mxShapes;
css::uno::Reference< css::text::XTextCursor > mxCursor;
css::uno::Reference< css::text::XTextCursor > mxOldCursor;
- css::uno::Reference< css::xml::sax::XAttributeList> mxAttrList;
+ css::uno::Reference< css::xml::sax::XFastAttributeList> mxAttrList;
css::uno::Reference< css::container::XIdentifierContainer > mxGluePoints;
css::uno::Reference< css::document::XActionLockable > mxLockable;
@@ -92,14 +92,14 @@ protected:
using SvXMLImportContext::GetImport;
- void addGluePoint( const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList );
+ void addGluePoint( const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList );
bool isPresentationShape() const;
public:
SdXMLShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes,
bool bTemporaryShape);
virtual ~SdXMLShapeContext() override;
@@ -108,12 +108,11 @@ public:
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
virtual void SAL_CALL endFastElement(sal_Int32 nElement) 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;
// this is called from the parent group for each unparsed attribute in the attribute list
- virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue );
+ virtual bool processAttribute( sal_Int32 nElement, const OUString& rValue );
};
@@ -126,7 +125,7 @@ class SdXMLRectShapeContext : public SdXMLShapeContext
public:
SdXMLRectShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes,
bool bTemporaryShape);
virtual ~SdXMLRectShapeContext() override;
@@ -135,7 +134,7 @@ public:
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
// this is called from the parent group for each unparsed attribute in the attribute list
- virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue ) override;
+ virtual bool processAttribute( sal_Int32 nElement, const OUString& rValue ) override;
};
// draw:line context
@@ -150,7 +149,7 @@ class SdXMLLineShapeContext : public SdXMLShapeContext
public:
SdXMLLineShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes,
bool bTemporaryShape);
virtual ~SdXMLLineShapeContext() override;
@@ -159,7 +158,7 @@ public:
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
// this is called from the parent group for each unparsed attribute in the attribute list
- virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue ) override;
+ virtual bool processAttribute( sal_Int32 nElement, const OUString& rValue ) override;
};
// draw:ellipse and draw:circle context
@@ -177,7 +176,7 @@ class SdXMLEllipseShapeContext : public SdXMLShapeContext
public:
SdXMLEllipseShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes,
bool bTemporaryShape);
virtual ~SdXMLEllipseShapeContext() override;
@@ -186,7 +185,7 @@ public:
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
// this is called from the parent group for each unparsed attribute in the attribute list
- virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue ) override;
+ virtual bool processAttribute( sal_Int32 nElement, const OUString& rValue ) override;
};
// draw:polyline and draw:polygon context
@@ -200,7 +199,7 @@ class SdXMLPolygonShapeContext : public SdXMLShapeContext
public:
SdXMLPolygonShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes, bool bClosed, bool bTemporaryShape);
virtual ~SdXMLPolygonShapeContext() override;
virtual void SAL_CALL startFastElement(
@@ -208,7 +207,7 @@ public:
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
// this is called from the parent group for each unparsed attribute in the attribute list
- virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue ) override;
+ virtual bool processAttribute( sal_Int32 nElement, const OUString& rValue ) override;
};
// draw:path context
@@ -221,7 +220,7 @@ class SdXMLPathShapeContext : public SdXMLShapeContext
public:
SdXMLPathShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes,
bool bTemporaryShape);
virtual ~SdXMLPathShapeContext() override;
@@ -230,7 +229,7 @@ public:
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
// this is called from the parent group for each unparsed attribute in the attribute list
- virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue ) override;
+ virtual bool processAttribute( sal_Int32 nElement, const OUString& rValue ) override;
};
// draw:text-box context
@@ -243,7 +242,7 @@ class SdXMLTextBoxShapeContext : public SdXMLShapeContext
public:
SdXMLTextBoxShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes);
virtual ~SdXMLTextBoxShapeContext() override;
virtual void SAL_CALL startFastElement(
@@ -251,7 +250,7 @@ public:
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
// this is called from the parent group for each unparsed attribute in the attribute list
- virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue ) override;
+ virtual bool processAttribute( sal_Int32 nElement, const OUString& rValue ) override;
};
// draw:control context
@@ -264,7 +263,7 @@ private:
public:
SdXMLControlShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes,
bool bTemporaryShape);
virtual ~SdXMLControlShapeContext() override;
@@ -273,7 +272,7 @@ public:
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
// this is called from the parent group for each unparsed attribute in the attribute list
- virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue ) override;
+ virtual bool processAttribute( sal_Int32 nElement, const OUString& rValue ) override;
};
// draw:connector context
@@ -301,7 +300,7 @@ private:
public:
SdXMLConnectorShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes,
bool bTemporaryShape);
virtual ~SdXMLConnectorShapeContext() override;
@@ -310,7 +309,7 @@ public:
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
// this is called from the parent group for each unparsed attribute in the attribute list
- virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue ) override;
+ virtual bool processAttribute( sal_Int32 nElement, const OUString& rValue ) override;
};
// draw:measure context
@@ -324,7 +323,7 @@ private:
public:
SdXMLMeasureShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes,
bool bTemporaryShape);
virtual ~SdXMLMeasureShapeContext() override;
@@ -334,7 +333,7 @@ public:
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
// this is called from the parent group for each unparsed attribute in the attribute list
- virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue ) override;
+ virtual bool processAttribute( sal_Int32 nElement, const OUString& rValue ) override;
};
// draw:page context
@@ -346,7 +345,7 @@ private:
public:
SdXMLPageShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes,
bool bTemporaryShape);
virtual ~SdXMLPageShapeContext() override;
@@ -355,7 +354,7 @@ public:
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
// this is called from the parent group for each unparsed attribute in the attribute list
- virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue ) override;
+ virtual bool processAttribute( sal_Int32 nElement, const OUString& rValue ) override;
};
// draw:caption context
@@ -369,7 +368,7 @@ private:
public:
SdXMLCaptionShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes,
bool bTemporaryShape);
virtual ~SdXMLCaptionShapeContext() override;
@@ -378,7 +377,7 @@ public:
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
// this is called from the parent group for each unparsed attribute in the attribute list
- virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue ) override;
+ virtual bool processAttribute( sal_Int32 nElement, const OUString& rValue ) override;
};
// office:image context
@@ -392,7 +391,7 @@ private:
public:
SdXMLGraphicObjectShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes);
virtual ~SdXMLGraphicObjectShapeContext() override;
@@ -400,11 +399,12 @@ public:
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
virtual void SAL_CALL endFastElement(sal_Int32 nElement) 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;
// this is called from the parent group for each unparsed attribute in the attribute list
- virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue ) override;
+ virtual bool processAttribute( sal_Int32 nElement, const OUString& rValue ) override;
};
// chart:chart context
@@ -416,7 +416,7 @@ class SdXMLChartShapeContext : public SdXMLShapeContext
public:
SdXMLChartShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes,
bool bTemporaryShape);
@@ -442,7 +442,7 @@ private:
public:
SdXMLObjectShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes);
virtual ~SdXMLObjectShapeContext() override;
@@ -454,11 +454,8 @@ 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;
-
// this is called from the parent group for each unparsed attribute in the attribute list
- virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue ) override;
+ virtual bool processAttribute( sal_Int32 nElement, const OUString& rValue ) override;
};
// draw:applet
@@ -476,7 +473,7 @@ private:
public:
SdXMLAppletShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes);
virtual ~SdXMLAppletShapeContext() override;
@@ -484,12 +481,12 @@ public:
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
virtual void SAL_CALL endFastElement(sal_Int32 nElement) 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;
// this is called from the parent group for each unparsed attribute in the attribute list
- virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue ) override;
+ virtual bool processAttribute( sal_Int32 nElement, const OUString& rValue ) override;
};
// draw:plugin
@@ -506,7 +503,7 @@ private:
public:
SdXMLPluginShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes);
virtual ~SdXMLPluginShapeContext() override;
@@ -514,12 +511,12 @@ public:
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
virtual void SAL_CALL endFastElement(sal_Int32 nElement) 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;
// this is called from the parent group for each unparsed attribute in the attribute list
- virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue ) override;
+ virtual bool processAttribute( sal_Int32 nElement, const OUString& rValue ) override;
const OUString& getMimeType() const { return maMimeType; }
};
@@ -535,7 +532,7 @@ private:
public:
SdXMLFloatingFrameShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes);
virtual ~SdXMLFloatingFrameShapeContext() override;
@@ -545,7 +542,7 @@ public:
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
// this is called from the parent group for each unparsed attribute in the attribute list
- virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue ) override;
+ virtual bool processAttribute( sal_Int32 nElement, const OUString& rValue ) override;
};
// draw:-frame
@@ -566,20 +563,20 @@ protected:
public:
SdXMLFrameShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes,
bool bTemporaryShape);
virtual ~SdXMLFrameShapeContext() 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 startFastElement(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
- virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue ) override;
+ virtual bool processAttribute( sal_Int32 nElement, const OUString& rValue ) override;
};
class SdXMLCustomShapeContext : public SdXMLShapeContext
@@ -593,7 +590,7 @@ public:
SdXMLCustomShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes);
virtual ~SdXMLCustomShapeContext() override;
@@ -601,12 +598,11 @@ public:
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
virtual void SAL_CALL endFastElement(sal_Int32 nElement) 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;
// this is called from the parent group for each unparsed attribute in the attribute list
- virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue ) override;
+ virtual bool processAttribute( sal_Int32 nElement, const OUString& rValue ) override;
};
// draw:table
@@ -616,7 +612,7 @@ class SdXMLTableShapeContext : public SdXMLShapeContext
public:
SdXMLTableShapeContext( SvXMLImport& rImport,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
css::uno::Reference< css::drawing::XShapes > const & rShapes );
virtual ~SdXMLTableShapeContext() override;
@@ -629,7 +625,7 @@ public:
sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
// this is called from the parent group for each unparsed attribute in the attribute list
- virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue ) override;
+ virtual bool processAttribute( sal_Int32 nElement, const OUString& rValue ) override;
private:
SvXMLImportContextRef mxTableImportContext;