use fastparser in SvXMLPropertySetContext subclasses
Change-Id: I977f1cf198652d3c73e5a0f473794975a5647617
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101564
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/include/xmloff/xmlprcon.hxx b/include/xmloff/xmlprcon.hxx
index 97d9487..9a430ad 100644
--- a/include/xmloff/xmlprcon.hxx
+++ b/include/xmloff/xmlprcon.hxx
@@ -39,15 +39,6 @@ protected:
public:
SvXMLPropertySetContext(
SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList,
sal_uInt32 nFamily,
::std::vector< XMLPropertyState > &rProps,
const rtl::Reference < SvXMLImportPropertyMapper > &rMap,
sal_Int32 nStartIdx = -1, sal_Int32 nEndIdx = -1 );
SvXMLPropertySetContext(
SvXMLImport& rImport, sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
sal_uInt32 nFamily,
@@ -60,18 +51,18 @@ public:
virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) 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 method is called from this instance implementation of
// CreateChildContext if the element matches an entry in the
// SvXMLImportItemMapper with the mid flag MID_FLAG_ELEMENT_ITEM_IMPORT
virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp );
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp );
};
diff --git a/include/xmloff/xmlprmap.hxx b/include/xmloff/xmlprmap.hxx
index 19e9ab8..f38223c 100644
--- a/include/xmloff/xmlprmap.hxx
+++ b/include/xmloff/xmlprmap.hxx
@@ -93,6 +93,12 @@ public:
sal_uInt16 nNamespace, const OUString& rStrName, sal_uInt32 nPropType,
sal_Int32 nStartAt = -1 ) const;
/** Returns the index of an entry with the given XML-name and namespace
If there is no matching entry the method returns -1 */
sal_Int32 GetEntryIndex(
sal_Int32 nElement, sal_uInt32 nPropType,
sal_Int32 nStartAt = -1 ) const;
/** Retrieves a PropertyHandler for that property which placed at nIndex in the XMLPropertyMapEntry-array */
const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nIndex ) const;
diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx
index 364b212..191e8a6 100644
--- a/sc/source/filter/xml/xmlstyli.cxx
+++ b/sc/source/filter/xml/xmlstyli.cxx
@@ -273,11 +273,12 @@ class XMLTableCellPropsContext : public SvXMLPropertySetContext
::std::vector< XMLPropertyState > &rProps,
const rtl::Reference < SvXMLImportPropertyMapper > &rMap);
virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const uno::Reference< xml::sax::XAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp ) override;
using SvXMLPropertySetContext::createFastChildContext;
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp ) override;
};
}
@@ -293,33 +294,25 @@ XMLTableCellPropsContext::XMLTableCellPropsContext(
{
}
SvXMLImportContextRef XMLTableCellPropsContext::CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const uno::Reference< xml::sax::XAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp )
css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTableCellPropsContext::createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp )
{
// no need for a custom context or indeed a SvXMLTokenMap to grab just the
// single attribute ( href ) that we are interested in.
// still though, we will check namespaces etc.
if ((XML_NAMESPACE_STYLE == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix)
&& IsXMLToken(rLocalName, XML_HYPERLINK))
if (nElement == XML_ELEMENT(STYLE, XML_HYPERLINK) ||
nElement == XML_ELEMENT(LO_EXT, XML_HYPERLINK) )
{
OUString sURL;
for ( int i=0; i<xAttrList->getLength(); ++i )
for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
{
OUString aLocalName;
OUString sName = xAttrList->getNameByIndex(i);
sal_uInt16 nPrfx = GetImport().GetNamespaceMap().GetKeyByAttrName( sName,
&aLocalName );
if ( nPrfx == XML_NAMESPACE_XLINK )
{
if ( IsXMLToken( aLocalName, XML_HREF ) )
{
sURL = xAttrList->getValueByIndex(i);
break;
}
}
if ( aIter.getToken() == XML_ELEMENT(XLINK, XML_HREF) )
sURL = aIter.toString();
else
SAL_WARN("sc", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
}
if ( !sURL.isEmpty() )
{
@@ -328,7 +321,7 @@ SvXMLImportContextRef XMLTableCellPropsContext::CreateChildContext( sal_uInt16 n
rProperties.push_back( aProp );
}
}
return SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName, xAttrList, rProperties, rProp );
return SvXMLPropertySetContext::createFastChildContext( nElement, xAttrList, rProperties, rProp );
}
namespace {
diff --git a/xmloff/inc/XMLBackgroundImageContext.hxx b/xmloff/inc/XMLBackgroundImageContext.hxx
index 02152f1..c5ffa76 100644
--- a/xmloff/inc/XMLBackgroundImageContext.hxx
+++ b/xmloff/inc/XMLBackgroundImageContext.hxx
@@ -43,15 +43,14 @@ class XMLBackgroundImageContext final : public XMLElementPropertyContext
private:
void ProcessAttrs(
const css::uno::Reference<css::xml::sax::XAttributeList > & xAttrList );
const css::uno::Reference<css::xml::sax::XFastAttributeList > & xAttrList );
public:
XMLBackgroundImageContext(
SvXMLImport& rImport,
sal_uInt16 nPrfx,
const OUString& rLName,
const css::uno::Reference<css::xml::sax::XAttributeList > & xAttrList,
sal_Int32 nElement,
const css::uno::Reference<css::xml::sax::XFastAttributeList > & xAttrList,
const XMLPropertyState& rProp,
sal_Int32 nPosIdx,
sal_Int32 nFilterIdx,
@@ -65,7 +64,9 @@ public:
const OUString& rLocalName,
const css::uno::Reference<css::xml::sax::XAttributeList > & xAttrList ) override;
virtual void EndElement() override;
virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
};
diff --git a/xmloff/inc/XMLElementPropertyContext.hxx b/xmloff/inc/XMLElementPropertyContext.hxx
index 2027131..5c09efc0 100644
--- a/xmloff/inc/XMLElementPropertyContext.hxx
+++ b/xmloff/inc/XMLElementPropertyContext.hxx
@@ -39,14 +39,16 @@ protected:
public:
XMLElementPropertyContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName,
XMLElementPropertyContext( SvXMLImport& rImport, sal_Int32 nElement,
const XMLPropertyState& rProp,
::std::vector< XMLPropertyState > &rProps );
virtual ~XMLElementPropertyContext() override;
virtual void EndElement() override;
virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
};
diff --git a/xmloff/inc/XMLShapePropertySetContext.hxx b/xmloff/inc/XMLShapePropertySetContext.hxx
index 9aab307..ce34224 100644
--- a/xmloff/inc/XMLShapePropertySetContext.hxx
+++ b/xmloff/inc/XMLShapePropertySetContext.hxx
@@ -30,12 +30,6 @@ class XMLShapePropertySetContext : public SvXMLPropertySetContext
public:
XMLShapePropertySetContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName,
const css::uno::Reference<css::xml::sax::XAttributeList >& xAttrList,
sal_uInt32 nFam,
::std::vector< XMLPropertyState > &rProps,
const rtl::Reference < SvXMLImportPropertyMapper > &rMap );
XMLShapePropertySetContext( SvXMLImport& rImport, sal_Int32 nElement,
const css::uno::Reference<css::xml::sax::XFastAttributeList >& xAttrList,
sal_uInt32 nFam,
@@ -44,14 +38,14 @@ public:
virtual ~XMLShapePropertySetContext() override;
virtual void EndElement() override;
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
using SvXMLPropertySetContext::CreateChildContext;
virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp) override;
using SvXMLPropertySetContext::createFastChildContext;
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp ) override;
};
#endif
diff --git a/xmloff/inc/XMLTextColumnsContext.hxx b/xmloff/inc/XMLTextColumnsContext.hxx
index 1ebaa23..82a6439 100644
--- a/xmloff/inc/XMLTextColumnsContext.hxx
+++ b/xmloff/inc/XMLTextColumnsContext.hxx
@@ -45,9 +45,8 @@ class XMLTextColumnsContext final :public XMLElementPropertyContext
public:
XMLTextColumnsContext(
SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName,
const css::uno::Reference<css::xml::sax::XAttributeList > & xAttrList,
SvXMLImport& rImport, sal_Int32 nElement,
const css::uno::Reference<css::xml::sax::XFastAttributeList > & xAttrList,
const XMLPropertyState& rProp,
::std::vector< XMLPropertyState > &rProps );
@@ -55,7 +54,9 @@ public:
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override;
virtual void EndElement() override;
virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
};
diff --git a/xmloff/inc/xmltabi.hxx b/xmloff/inc/xmltabi.hxx
index 229f784..bc51546 100644
--- a/xmloff/inc/xmltabi.hxx
+++ b/xmloff/inc/xmltabi.hxx
@@ -36,16 +36,14 @@ private:
public:
SvxXMLTabStopImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName,
SvxXMLTabStopImportContext( SvXMLImport& rImport, sal_Int32 nElement,
const XMLPropertyState& rProp,
::std::vector< XMLPropertyState > &rProps );
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 EndElement() override;
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
};
diff --git a/xmloff/source/chart/XMLChartPropertyContext.cxx b/xmloff/source/chart/XMLChartPropertyContext.cxx
index 4055332..83cc7bb 100644
--- a/xmloff/source/chart/XMLChartPropertyContext.cxx
+++ b/xmloff/source/chart/XMLChartPropertyContext.cxx
@@ -41,10 +41,9 @@ XMLChartPropertyContext::XMLChartPropertyContext(
XMLChartPropertyContext::~XMLChartPropertyContext()
{}
SvXMLImportContextRef XMLChartPropertyContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const uno::Reference< xml::sax::XAttributeList > & xAttrList,
css::uno::Reference< css::xml::sax::XFastContextHandler > XMLChartPropertyContext::createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp )
{
@@ -53,21 +52,16 @@ SvXMLImportContextRef XMLChartPropertyContext::CreateChildContext(
switch( mxMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) )
{
case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE:
xContext = new XMLSymbolImageContext( GetImport(), nPrefix, rLocalName, rProp, rProperties );
return new XMLSymbolImageContext( GetImport(), nElement, rProp, rProperties );
break;
case XML_SCH_CONTEXT_SPECIAL_LABEL_SEPARATOR:
xContext = new XMLLabelSeparatorContext( GetImport(), nPrefix, rLocalName, rProp, rProperties );
return new XMLLabelSeparatorContext( GetImport(), nElement, rProp, rProperties );
break;
}
// default / no context yet: create child context by base class
if (!xContext)
{
xContext = SvXMLPropertySetContext::CreateChildContext(
nPrefix, rLocalName, xAttrList, rProperties, rProp );
}
return xContext;
return SvXMLPropertySetContext::createFastChildContext(
nElement, xAttrList, rProperties, rProp );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLChartPropertyContext.hxx b/xmloff/source/chart/XMLChartPropertyContext.hxx
index 4689aa6..7bbd55e 100644
--- a/xmloff/source/chart/XMLChartPropertyContext.hxx
+++ b/xmloff/source/chart/XMLChartPropertyContext.hxx
@@ -32,11 +32,10 @@ public:
const rtl::Reference< SvXMLImportPropertyMapper >& rMapper );
virtual ~XMLChartPropertyContext() override;
using SvXMLPropertySetContext::CreateChildContext;
virtual SvXMLImportContextRef CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList,
using SvXMLPropertySetContext::createFastChildContext;
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp ) override;
diff --git a/xmloff/source/chart/XMLLabelSeparatorContext.cxx b/xmloff/source/chart/XMLLabelSeparatorContext.cxx
index dec08c2..90af473 100644
--- a/xmloff/source/chart/XMLLabelSeparatorContext.cxx
+++ b/xmloff/source/chart/XMLLabelSeparatorContext.cxx
@@ -27,12 +27,11 @@
using namespace ::com::sun::star;
XMLLabelSeparatorContext::XMLLabelSeparatorContext(
SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLocalName,
SvXMLImport& rImport, sal_Int32 nElement,
const XMLPropertyState& rProp,
::std::vector< XMLPropertyState > &rProps ) :
XMLElementPropertyContext(
rImport, nPrfx, rLocalName, rProp, rProps ),
rImport, nElement, rProp, rProps ),
m_aSeparator()
{
}
@@ -40,7 +39,7 @@ XMLLabelSeparatorContext::XMLLabelSeparatorContext(
XMLLabelSeparatorContext::~XMLLabelSeparatorContext()
{}
void XMLLabelSeparatorContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& /*xAttrList*/ )
void XMLLabelSeparatorContext::startFastElement( sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
{
}
@@ -58,7 +57,7 @@ SvXMLImportContextRef XMLLabelSeparatorContext::CreateChildContext(
return pContext;
}
void XMLLabelSeparatorContext::EndElement()
void XMLLabelSeparatorContext::endFastElement(sal_Int32 nElement)
{
if( !m_aSeparator.isEmpty() )
{
@@ -67,7 +66,7 @@ void XMLLabelSeparatorContext::EndElement()
SetInsert( true );
}
XMLElementPropertyContext::EndElement();
XMLElementPropertyContext::endFastElement(nElement);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLLabelSeparatorContext.hxx b/xmloff/source/chart/XMLLabelSeparatorContext.hxx
index e2153ea..bd94d08 100644
--- a/xmloff/source/chart/XMLLabelSeparatorContext.hxx
+++ b/xmloff/source/chart/XMLLabelSeparatorContext.hxx
@@ -25,18 +25,19 @@ class XMLLabelSeparatorContext : public XMLElementPropertyContext
{
public:
XMLLabelSeparatorContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName,
XMLLabelSeparatorContext( SvXMLImport& rImport, sal_Int32 nElement,
const XMLPropertyState& rProp,
::std::vector< XMLPropertyState > &rProps );
virtual ~XMLLabelSeparatorContext() override;
virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
virtual void SAL_CALL startFastElement(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
virtual SvXMLImportContextRef CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
virtual void EndElement() override;
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
private:
OUString m_aSeparator;
diff --git a/xmloff/source/chart/XMLSymbolImageContext.cxx b/xmloff/source/chart/XMLSymbolImageContext.cxx
index 27d48ac..881f821 100644
--- a/xmloff/source/chart/XMLSymbolImageContext.cxx
+++ b/xmloff/source/chart/XMLSymbolImageContext.cxx
@@ -26,8 +26,10 @@
#include <xmloff/XMLBase64ImportContext.hxx>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <sal/log.hxx>
using namespace css;
using namespace xmloff::token;
namespace {
@@ -51,43 +53,38 @@ const SvXMLTokenMapEntry aSymbolImageAttrTokenMap[] =
};
XMLSymbolImageContext::XMLSymbolImageContext(
SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName,
SvXMLImport& rImport, sal_Int32 nElement,
const XMLPropertyState& rProp,
::std::vector< XMLPropertyState > &rProps ) :
XMLElementPropertyContext(
rImport, nPrfx, rLName, rProp, rProps )
rImport, nElement, rProp, rProps )
{
}
XMLSymbolImageContext::~XMLSymbolImageContext()
{}
void XMLSymbolImageContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
void XMLSymbolImageContext::startFastElement(
sal_Int32 /*nElement*/,
const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
{
static const SvXMLTokenMap aTokenMap( aSymbolImageAttrTokenMap );
OUString aLocalName;
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 );
sal_uInt16 nPrefix =
GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
&aLocalName );
const OUString& rValue = xAttrList->getValueByIndex( i );
const OUString sValue = aIter.toString();
switch( aTokenMap.Get( nPrefix, aLocalName ) )
switch( aIter.getToken() )
{
case XML_TOK_SYMBOL_IMAGE_HREF:
msURL = rValue;
case XML_ELEMENT(XLINK, XML_HREF):
msURL = sValue;
break;
case XML_TOK_SYMBOL_IMAGE_ACTUATE:
case XML_TOK_SYMBOL_IMAGE_TYPE:
case XML_TOK_SYMBOL_IMAGE_SHOW:
case XML_ELEMENT(XLINK, XML_ACTUATE):
case XML_ELEMENT(XLINK, XML_TYPE):
case XML_ELEMENT(XLINK, XML_SHOW):
// these values are currently not interpreted
// it is always assumed 'actuate=onLoad', 'type=simple', 'show=embed'
break;
default:
SAL_WARN("xmloff", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << sValue);
}
}
}
@@ -113,7 +110,7 @@ SvXMLImportContextRef XMLSymbolImageContext::CreateChildContext(
return pContext;
}
void XMLSymbolImageContext::EndElement()
void XMLSymbolImageContext::endFastElement(sal_Int32 nElement)
{
uno::Reference<graphic::XGraphic> xGraphic;
@@ -134,7 +131,7 @@ void XMLSymbolImageContext::EndElement()
SetInsert( true );
}
XMLElementPropertyContext::EndElement();
XMLElementPropertyContext::endFastElement(nElement);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLSymbolImageContext.hxx b/xmloff/source/chart/XMLSymbolImageContext.hxx
index 14f8787..d2267db 100644
--- a/xmloff/source/chart/XMLSymbolImageContext.hxx
+++ b/xmloff/source/chart/XMLSymbolImageContext.hxx
@@ -29,18 +29,19 @@ class XMLSymbolImageContext : public XMLElementPropertyContext
{
public:
XMLSymbolImageContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName,
XMLSymbolImageContext( SvXMLImport& rImport, sal_Int32 nElement,
const XMLPropertyState& rProp,
::std::vector< XMLPropertyState > &rProps );
virtual ~XMLSymbolImageContext() override;
virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
virtual void SAL_CALL startFastElement(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
virtual SvXMLImportContextRef CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
virtual void EndElement() override;
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
private:
OUString msURL;
diff --git a/xmloff/source/draw/XMLShapePropertySetContext.cxx b/xmloff/source/draw/XMLShapePropertySetContext.cxx
index 2fbcbb5..4a86aa4 100644
--- a/xmloff/source/draw/XMLShapePropertySetContext.cxx
+++ b/xmloff/source/draw/XMLShapePropertySetContext.cxx
@@ -32,19 +32,6 @@ using namespace ::com::sun::star::uno;
XMLShapePropertySetContext::XMLShapePropertySetContext(
SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName,
const Reference< xml::sax::XAttributeList > & xAttrList,
sal_uInt32 nFam,
::std::vector< XMLPropertyState > &rProps,
const rtl::Reference < SvXMLImportPropertyMapper > &rMap ) :
SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFam,
rProps, rMap ),
mnBulletIndex(-1)
{
}
XMLShapePropertySetContext::XMLShapePropertySetContext(
SvXMLImport& rImport, sal_Int32 nElement,
const Reference< xml::sax::XFastAttributeList > & xAttrList,
sal_uInt32 nFam,
@@ -60,7 +47,7 @@ XMLShapePropertySetContext::~XMLShapePropertySetContext()
{
}
void XMLShapePropertySetContext::EndElement()
void XMLShapePropertySetContext::endFastElement(sal_Int32 )
{
Reference< container::XIndexReplace > xNumRule;
if( mxBulletStyle.is() )
@@ -77,34 +64,29 @@ void XMLShapePropertySetContext::EndElement()
SvXMLPropertySetContext::EndElement();
}
SvXMLImportContextRef XMLShapePropertySetContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const Reference< xml::sax::XAttributeList > & xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp )
css::uno::Reference< css::xml::sax::XFastContextHandler > XMLShapePropertySetContext::createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp )
{
SvXMLImportContextRef xContext;
switch( mxMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) )
{
case CTF_NUMBERINGRULES:
mnBulletIndex = rProp.mnIndex;
mxBulletStyle = xContext = new SvxXMLListStyleContext( GetImport(), nPrefix, rLocalName, xAttrList );
mxBulletStyle = new SvxXMLListStyleContext( GetImport(), nElement, xAttrList );
return mxBulletStyle.get();
break;
case CTF_TABSTOP:
xContext = new SvxXMLTabStopImportContext( GetImport(), nPrefix,
rLocalName, rProp,
return new SvxXMLTabStopImportContext( GetImport(), nElement,
rProp,
rProperties );
break;
}
if (!xContext)
xContext = SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName,
return SvXMLPropertySetContext::createFastChildContext( nElement,
xAttrList,
rProperties, rProp );
return xContext;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx
index 7d6435a..f07820a 100644
--- a/xmloff/source/draw/ximpstyl.cxx
+++ b/xmloff/source/draw/ximpstyl.cxx
@@ -67,12 +67,12 @@ public:
::std::vector< XMLPropertyState > &rProps,
const rtl::Reference < SvXMLImportPropertyMapper > &rMap );
using SvXMLPropertySetContext::CreateChildContext;
virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp) override;
using SvXMLPropertySetContext::createFastChildContext;
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp ) override;
};
}
@@ -87,42 +87,34 @@ SdXMLDrawingPagePropertySetContext::SdXMLDrawingPagePropertySetContext(
{
}
SvXMLImportContextRef SdXMLDrawingPagePropertySetContext::CreateChildContext(
sal_uInt16 p_nPrefix,
const OUString& rLocalName,
const uno::Reference< xml::sax::XAttributeList > & xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp )
css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLDrawingPagePropertySetContext::createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp )
{
SvXMLImportContextRef xContext;
switch( mxMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) )
{
case CTF_PAGE_SOUND_URL:
{
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 aLocalName;
sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(xAttrList->getNameByIndex(i), &aLocalName);
if( (nPrefix == XML_NAMESPACE_XLINK) && IsXMLToken( aLocalName, XML_HREF ) )
if( aIter.getToken() == XML_ELEMENT(XLINK, XML_HREF) )
{
uno::Any aAny( GetImport().GetAbsoluteReference( xAttrList->getValueByIndex(i) ) );
uno::Any aAny( GetImport().GetAbsoluteReference( aIter.toString() ) );
XMLPropertyState aPropState( rProp.mnIndex, aAny );
rProperties.push_back( aPropState );
}
else
SAL_WARN("xmloff", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
}
break;
}
}
if (!xContext)
xContext = SvXMLPropertySetContext::CreateChildContext( p_nPrefix, rLocalName,
return SvXMLPropertySetContext::createFastChildContext( nElement,
xAttrList,
rProperties, rProp );
return xContext;
}
namespace {
diff --git a/xmloff/source/style/PagePropertySetContext.cxx b/xmloff/source/style/PagePropertySetContext.cxx
index 24fbe25..31c541f 100644
--- a/xmloff/source/style/PagePropertySetContext.cxx
+++ b/xmloff/source/style/PagePropertySetContext.cxx
@@ -48,12 +48,11 @@ PagePropertySetContext::~PagePropertySetContext()
{
}
SvXMLImportContextRef PagePropertySetContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const Reference< xml::sax::XAttributeList > & xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp )
css::uno::Reference< css::xml::sax::XFastContextHandler > PagePropertySetContext::createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp )
{
sal_Int32 nPos = CTF_PM_GRAPHICPOSITION;
sal_Int32 nFil = CTF_PM_GRAPHICFILTER;
@@ -74,7 +73,6 @@ SvXMLImportContextRef PagePropertySetContext::CreateChildContext(
default:
break;
}
SvXMLImportContextRef xContext;
switch( mxMapper->getPropertySetMapper()
->GetEntryContextId( rProp.mnIndex ) )
@@ -88,9 +86,9 @@ SvXMLImportContextRef PagePropertySetContext::CreateChildContext(
nFil == mxMapper->getPropertySetMapper()
->GetEntryContextId( rProp.mnIndex-1 ),
"invalid property map!");
xContext =
new XMLBackgroundImageContext( GetImport(), nPrefix,
rLocalName, xAttrList,
return
new XMLBackgroundImageContext( GetImport(), nElement,
xAttrList,
rProp,
rProp.mnIndex-2,
rProp.mnIndex-1,
@@ -100,24 +98,21 @@ SvXMLImportContextRef PagePropertySetContext::CreateChildContext(
break;
case CTF_PM_TEXTCOLUMNS:
xContext = new XMLTextColumnsContext( GetImport(), nPrefix,
rLocalName, xAttrList, rProp,
return new XMLTextColumnsContext( GetImport(), nElement,
xAttrList, rProp,
rProperties );
break;
case CTF_PM_FTN_LINE_WEIGHT:
xContext = new XMLFootnoteSeparatorImport(
GetImport(), nPrefix, rLocalName, rProperties,
return new XMLFootnoteSeparatorImport(
GetImport(), nElement, rProperties,
mxMapper->getPropertySetMapper(), rProp.mnIndex);
break;
}
if (!xContext)
xContext = SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName,
return SvXMLPropertySetContext::createFastChildContext( nElement,
xAttrList,
rProperties, rProp );
return xContext;
}
diff --git a/xmloff/source/style/PagePropertySetContext.hxx b/xmloff/source/style/PagePropertySetContext.hxx
index b44828b..8d8cb9a 100644
--- a/xmloff/source/style/PagePropertySetContext.hxx
+++ b/xmloff/source/style/PagePropertySetContext.hxx
@@ -44,12 +44,12 @@ public:
virtual ~PagePropertySetContext() override;
using SvXMLPropertySetContext::CreateChildContext;
virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp) override;
using SvXMLPropertySetContext::createFastChildContext;
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp ) override;
};
#endif // INCLUDED_XMLOFF_SOURCE_STYLE_PAGEPROPERTYSETCONTEXT_HXX
diff --git a/xmloff/source/style/XMLBackgroundImageContext.cxx b/xmloff/source/style/XMLBackgroundImageContext.cxx
index e900832..fdfe430 100644
--- a/xmloff/source/style/XMLBackgroundImageContext.cxx
+++ b/xmloff/source/style/XMLBackgroundImageContext.cxx
@@ -23,7 +23,7 @@
#include <com/sun/star/graphic/XGraphic.hpp>
#include <tools/debug.hxx>
#include <sal/log.hxx>
#include <sax/tools/converter.hxx>
#include <xmloff/xmltkmap.hxx>
@@ -169,37 +169,31 @@ static void lcl_xmlbic_MergeVertPos( GraphicLocation& ePos,
void XMLBackgroundImageContext::ProcessAttrs(
const Reference< xml::sax::XAttributeList >& xAttrList )
const Reference< xml::sax::XFastAttributeList >& xAttrList )
{
static const SvXMLTokenMap aTokenMap( aBGImgAttributesAttrTokenMap );
ePos = GraphicLocation_NONE;
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 );
const OUString& rValue = xAttrList->getValueByIndex( i );
const OUString sValue = aIter.toString();
switch( aTokenMap.Get( nPrefix, aLocalName ) )
switch( aIter.getToken() )
{
case XML_TOK_BGIMG_HREF:
m_sURL = rValue;
case XML_ELEMENT(XLINK, XML_HREF):
m_sURL = sValue;
if( GraphicLocation_NONE == ePos )
ePos = GraphicLocation_TILED;
break;
case XML_TOK_BGIMG_TYPE:
case XML_TOK_BGIMG_ACTUATE:
case XML_TOK_BGIMG_SHOW:
case XML_ELEMENT(XLINK, XML_TYPE):
case XML_ELEMENT(XLINK, XML_ACTUATE):
case XML_ELEMENT(XLINK, XML_SHOW):
break;
case XML_TOK_BGIMG_POSITION:
case XML_ELEMENT(STYLE, XML_POSITION):
{
GraphicLocation eNewPos = GraphicLocation_NONE, eTmp;
SvXMLTokenEnumerator aTokenEnum( rValue );
SvXMLTokenEnumerator aTokenEnum( sValue );
OUString aToken;
bool bHori = false, bVert = false;
bool bOK = true;
@@ -283,7 +277,7 @@ void XMLBackgroundImageContext::ProcessAttrs(
ePos = eNewPos;
}
break;
case XML_TOK_BGIMG_REPEAT:
case XML_ELEMENT(STYLE, XML_REPEAT):
{
GraphicLocation nPos = GraphicLocation_NONE;
static const SvXMLEnumMapEntry<GraphicLocation> psXML_BrushRepeat[] =
@@ -293,7 +287,7 @@ void XMLBackgroundImageContext::ProcessAttrs(
{ XML_STRETCH, GraphicLocation_AREA },
{ XML_TOKEN_INVALID, GraphicLocation(0) }
};
if( SvXMLUnitConverter::convertEnum( nPos, rValue,
if( SvXMLUnitConverter::convertEnum( nPos, sValue,
psXML_BrushRepeat ) )
{
if( GraphicLocation_MIDDLE_MIDDLE != nPos ||
@@ -304,36 +298,37 @@ void XMLBackgroundImageContext::ProcessAttrs(
}
}
break;
case XML_TOK_BGIMG_FILTER:
sFilter = rValue;
case XML_ELEMENT(STYLE, XML_FILTER_NAME):
sFilter = sValue;
break;
case XML_TOK_BGIMG_OPACITY:
case XML_ELEMENT(DRAW, XML_OPACITY):
{
sal_Int32 nTmp;
// convert from percent and clip
if (::sax::Converter::convertPercent( nTmp, rValue ))
if (::sax::Converter::convertPercent( nTmp, sValue ))
{
if( (nTmp >= 0) && (nTmp <= 100) )
nTransparency = static_cast<sal_Int8>( 100-nTmp );
}
}
break;
default:
SAL_WARN("xmloff", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << sValue);
}
}
}
XMLBackgroundImageContext::XMLBackgroundImageContext(
SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName,
const Reference< xml::sax::XAttributeList > & xAttrList,
SvXMLImport& rImport, sal_Int32 nElement,
const Reference< xml::sax::XFastAttributeList > & xAttrList,
const XMLPropertyState& rProp,
sal_Int32 nPosIdx,
sal_Int32 nFilterIdx,
sal_Int32 nTransparencyIdx,
sal_Int32 nBitmapModeIdx,
::std::vector< XMLPropertyState > &rProps ) :
XMLElementPropertyContext( rImport, nPrfx, rLName, rProp, rProps ),
XMLElementPropertyContext( rImport, nElement, rProp, rProps ),
aPosProp( nPosIdx ),
m_nBitmapModeIdx(nBitmapModeIdx),
aFilterProp( nFilterIdx ),
@@ -369,7 +364,7 @@ SvXMLImportContextRef XMLBackgroundImageContext::CreateChildContext(
return pContext;
}
void XMLBackgroundImageContext::EndElement()
void XMLBackgroundImageContext::endFastElement(sal_Int32 nElement)
{
uno::Reference<graphic::XGraphic> xGraphic;
if (!m_sURL.isEmpty())
@@ -394,7 +389,7 @@ void XMLBackgroundImageContext::EndElement()
aTransparencyProp.maValue <<= nTransparency;
SetInsert( true );
XMLElementPropertyContext::EndElement();
XMLElementPropertyContext::endFastElement(nElement);
if( -1 != aPosProp.mnIndex )
{
diff --git a/xmloff/source/style/XMLElementPropertyContext.cxx b/xmloff/source/style/XMLElementPropertyContext.cxx
index 91af29f..f065e08 100644
--- a/xmloff/source/style/XMLElementPropertyContext.cxx
+++ b/xmloff/source/style/XMLElementPropertyContext.cxx
@@ -21,13 +21,12 @@
XMLElementPropertyContext::XMLElementPropertyContext (
SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName,
SvXMLImport& rImport, sal_Int32 /*nElement*/,
const XMLPropertyState& rProp,
::std::vector< XMLPropertyState > &rProps ) :
SvXMLImportContext( rImport, nPrfx, rLName ),
SvXMLImportContext( rImport ),
bInsert( false ),
rProperties( rProps ),
rProperties( rProps ),
aProp( rProp )
{
}
@@ -36,11 +35,10 @@ XMLElementPropertyContext::~XMLElementPropertyContext()
{
}
void XMLElementPropertyContext::EndElement( )
void XMLElementPropertyContext::endFastElement(sal_Int32 )
{
if( bInsert )
rProperties.push_back( aProp );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLFootnoteSeparatorImport.cxx b/xmloff/source/style/XMLFootnoteSeparatorImport.cxx
index bd52f3c..b3a7903 100644
--- a/xmloff/source/style/XMLFootnoteSeparatorImport.cxx
+++ b/xmloff/source/style/XMLFootnoteSeparatorImport.cxx
@@ -55,12 +55,11 @@ using ::com::sun::star::xml::sax::XAttributeList;
XMLFootnoteSeparatorImport::XMLFootnoteSeparatorImport(
SvXMLImport& rImport,
sal_uInt16 nPrefix,
const OUString& rLocalName,
sal_Int32 /*nElement*/,
vector<XMLPropertyState> & rProps,
const rtl::Reference<XMLPropertySetMapper> & rMapperRef,
sal_Int32 nIndex) :
SvXMLImportContext(rImport, nPrefix, rLocalName),
SvXMLImportContext(rImport),
rProperties(rProps),
rMapper(rMapperRef),
nPropIndex(nIndex)
@@ -71,8 +70,9 @@ XMLFootnoteSeparatorImport::~XMLFootnoteSeparatorImport()
{
}
void XMLFootnoteSeparatorImport::StartElement(
const Reference<XAttributeList> & xAttrList)
void XMLFootnoteSeparatorImport::startFastElement(
sal_Int32 /*nElement*/,
const Reference<css::xml::sax::XFastAttributeList> & xAttrList)
{
// get the values from the properties
sal_Int16 nLineWeight = 0;
@@ -87,39 +87,36 @@ void XMLFootnoteSeparatorImport::StartElement(
sal_Int8 nLineStyle = 1;
// iterate over xattribute list and fill values
sal_Int16 nLength = xAttrList->getLength();
for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
for (auto &aIter : sax_fastparser::castToFastAttributeList(xAttrList))
{
OUString sLocalName;
sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
&sLocalName );
if (XML_NAMESPACE_STYLE == nPrefix)
OUString sAttrValue = aIter.toString();
sal_Int32 nTmp;
switch (aIter.getToken())
{
OUString sAttrValue = xAttrList->getValueByIndex(nAttr);
sal_Int32 nTmp;
if (IsXMLToken( sLocalName, XML_WIDTH ))
case XML_ELEMENT(STYLE, XML_WIDTH):
{
if (GetImport().GetMM100UnitConverter().convertMeasureToCore(
nTmp, sAttrValue))
{
nLineWeight = static_cast<sal_Int16>(nTmp);
}
break;
}
else if (IsXMLToken( sLocalName, XML_DISTANCE_BEFORE_SEP ))
case XML_ELEMENT(STYLE, XML_DISTANCE_BEFORE_SEP):
{
if (GetImport().GetMM100UnitConverter().convertMeasureToCore(
nTmp, sAttrValue))
nLineTextDistance = nTmp;
break;
}
else if (IsXMLToken( sLocalName, XML_DISTANCE_AFTER_SEP ))
case XML_ELEMENT(STYLE, XML_DISTANCE_AFTER_SEP):
{
if (GetImport().GetMM100UnitConverter().convertMeasureToCore(
nTmp, sAttrValue))
nLineDistance = nTmp;
break;
}
else if (IsXMLToken( sLocalName, XML_ADJUSTMENT ))
case XML_ELEMENT(STYLE, XML_ADJUSTMENT ):
{
static const SvXMLEnumMapEntry<text::HorizontalAdjust> aXML_HorizontalAdjust_Enum[] =
{
@@ -131,20 +128,23 @@ void XMLFootnoteSeparatorImport::StartElement(
SvXMLUnitConverter::convertEnum(
eLineAdjust, sAttrValue, aXML_HorizontalAdjust_Enum);
break;
}
else if (IsXMLToken( sLocalName, XML_REL_WIDTH ))
case XML_ELEMENT(STYLE, XML_REL_WIDTH ):
{
if (::sax::Converter::convertPercent(nTmp, sAttrValue))
nLineRelWidth = static_cast<sal_uInt8>(nTmp);
break;
}
else if (IsXMLToken( sLocalName, XML_COLOR ))
case XML_ELEMENT(STYLE, XML_COLOR):
{
if (::sax::Converter::convertColor(nTmp, sAttrValue))
{
nLineColor = nTmp;
}
break;
}
else if (IsXMLToken( sLocalName, XML_LINE_STYLE ))
case XML_ELEMENT(STYLE, XML_LINE_STYLE ):
{
static const SvXMLEnumMapEntry<sal_Int8> aXML_LineStyle_Enum[] =
{
@@ -156,7 +156,10 @@ void XMLFootnoteSeparatorImport::StartElement(
};
SvXMLUnitConverter::convertEnum(nLineStyle, sAttrValue, aXML_LineStyle_Enum);
break;
}
default:
SAL_WARN("xmloff", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << sAttrValue);
}
}
diff --git a/xmloff/source/style/XMLFootnoteSeparatorImport.hxx b/xmloff/source/style/XMLFootnoteSeparatorImport.hxx
index b17d692..30772b0 100644
--- a/xmloff/source/style/XMLFootnoteSeparatorImport.hxx
+++ b/xmloff/source/style/XMLFootnoteSeparatorImport.hxx
@@ -48,16 +48,15 @@ public:
XMLFootnoteSeparatorImport(
SvXMLImport& rImport,
sal_uInt16 nPrefix,
const OUString& rLocalName,
sal_Int32 nElement,
::std::vector<XMLPropertyState> & rProperties,
const rtl::Reference<XMLPropertySetMapper> & rMapperRef,
sal_Int32 nIndex);
virtual ~XMLFootnoteSeparatorImport() override;
virtual void StartElement(
const css::uno::Reference< css::xml::sax::XAttributeList> & xAttrList ) override;
virtual void SAL_CALL startFastElement( sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override;
};
#endif
diff --git a/xmloff/source/style/xmlprcon.cxx b/xmloff/source/style/xmlprcon.cxx
index 4007380..119e5bb 100644
--- a/xmloff/source/style/xmlprcon.cxx
+++ b/xmloff/source/style/xmlprcon.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <sal/log.hxx>
#include <xmloff/xmlprcon.hxx>
#include <xmloff/xmlimp.hxx>
#include <xmloff/xmltypes.hxx>
@@ -28,27 +29,6 @@ using namespace ::com::sun::star;
using namespace ::std;
SvXMLPropertySetContext::SvXMLPropertySetContext(
SvXMLImport& rImp, sal_uInt16 nPrfx,
const OUString& rLName,
const uno::Reference< xml::sax::XAttributeList >& xAttrList,
sal_uInt32 nFam,
vector< XMLPropertyState > &rProps,
const rtl::Reference < SvXMLImportPropertyMapper > &rMap,
sal_Int32 nSIdx, sal_Int32 nEIdx )
: SvXMLImportContext( rImp, nPrfx, rLName )
, mnStartIdx( nSIdx )
, mnEndIdx( nEIdx )
, mnFamily( nFam )
, mrProperties( rProps )
, mxMapper( rMap )
{
mxMapper->importXML( mrProperties, xAttrList,
GetImport().GetMM100UnitConverter(),
GetImport().GetNamespaceMap(), mnFamily,
mnStartIdx, mnEndIdx );
}
SvXMLPropertySetContext::SvXMLPropertySetContext(
SvXMLImport& rImp, sal_Int32 /*nElement*/,
const uno::Reference< xml::sax::XFastAttributeList >& xAttrList,
sal_uInt32 nFam,
@@ -72,24 +52,22 @@ SvXMLPropertySetContext::~SvXMLPropertySetContext()
{
}
SvXMLImportContextRef SvXMLPropertySetContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const uno::Reference< xml::sax::XAttributeList >& xAttrList )
css::uno::Reference< css::xml::sax::XFastContextHandler > SvXMLPropertySetContext::createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
{
rtl::Reference< XMLPropertySetMapper > aSetMapper(
mxMapper->getPropertySetMapper() );
sal_Int32 nEntryIndex = aSetMapper->GetEntryIndex( nPrefix, rLocalName,
mnFamily, mnStartIdx );
sal_Int32 nEntryIndex = aSetMapper->GetEntryIndex( nElement, mnFamily, mnStartIdx );
if( ( nEntryIndex != -1 ) && (-1 == mnEndIdx || nEntryIndex < mnEndIdx ) &&
( 0 != ( aSetMapper->GetEntryFlags( nEntryIndex )
& MID_FLAG_ELEMENT_ITEM_IMPORT ) ) )
{
XMLPropertyState aProp( nEntryIndex );
return CreateChildContext( nPrefix, rLocalName, xAttrList,
mrProperties, aProp );
return createFastChildContext( nElement, xAttrList, mrProperties, aProp );
}
SAL_WARN("xmloff", "unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement));
return nullptr;
}
@@ -97,13 +75,13 @@ SvXMLImportContextRef SvXMLPropertySetContext::CreateChildContext(
CreateChildContext if the element matches an entry in the
SvXMLImportItemMapper with the mid flag MID_FLAG_ELEMENT
*/
SvXMLImportContextRef SvXMLPropertySetContext::CreateChildContext(
sal_uInt16 /*nPrefix*/,
const OUString& /*rLocalName*/,
const uno::Reference< xml::sax::XAttributeList >&,
::std::vector< XMLPropertyState > &,
const XMLPropertyState& )
css::uno::Reference< css::xml::sax::XFastContextHandler > SvXMLPropertySetContext::createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/,
::std::vector< XMLPropertyState > &/*rProperties*/,
const XMLPropertyState& /*rProp*/ )
{
SAL_WARN("xmloff", "unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement));
return nullptr;
}
diff --git a/xmloff/source/style/xmlprmap.cxx b/xmloff/source/style/xmlprmap.cxx
index b00529b..7d81ad0 100644
--- a/xmloff/source/style/xmlprmap.cxx
+++ b/xmloff/source/style/xmlprmap.cxx
@@ -25,6 +25,7 @@
#include <xmloff/xmltoken.hxx>
#include <xmloff/maptype.hxx>
#include <xmloff/prhdlfac.hxx>
#include <xmloff/xmlimp.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -270,6 +271,37 @@ sal_Int32 XMLPropertySetMapper::GetEntryIndex(
return -1;
}
// Search for the given name and the namespace in the list and return
// the index of the entry
// If there is no matching entry the method returns -1
sal_Int32 XMLPropertySetMapper::GetEntryIndex(
sal_Int32 nElement,
sal_uInt32 nPropType,
sal_Int32 nStartAt /* = -1 */ ) const
{
sal_Int32 nEntries = GetEntryCount();
sal_Int32 nIndex= nStartAt == - 1? 0 : nStartAt+1;
if ( nEntries && nIndex < nEntries )
{
sal_uInt16 nNamespace = (nElement >> NMSP_SHIFT) - 1;
const OUString& rStrName = SvXMLImport::getNameFromToken(nElement);
do
{
const XMLPropertySetMapperEntry_Impl& rEntry = mpImpl->maMapEntries[nIndex];
if( (!nPropType || nPropType == rEntry.GetPropType()) &&
rEntry.nXMLNameSpace == nNamespace &&
rStrName == rEntry.sXMLAttributeName )
return nIndex;
else
nIndex++;
} while( nIndex<nEntries );
}
return -1;
}
/** searches for an entry that matches the given api name, namespace and local name or -1 if nothing found */
sal_Int32 XMLPropertySetMapper::FindEntryIndex(
const char* sApiName,
diff --git a/xmloff/source/style/xmltabi.cxx b/xmloff/source/style/xmltabi.cxx
index 86ded9f..20b71a3 100644
--- a/xmloff/source/style/xmltabi.cxx
+++ b/xmloff/source/style/xmltabi.cxx
@@ -18,6 +18,7 @@
*/
#include <com/sun/star/style/TabAlign.hpp>
#include <sal/log.hxx>
#include <xmloff/xmltkmap.hxx>
#include <xmloff/namespacemap.hxx>
#include <xmloff/xmlnamespace.hxx>
@@ -62,19 +63,17 @@ private:
public:
SvxXMLTabStopContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName,
const uno::Reference< xml::sax::XAttributeList > & xAttrList );
SvxXMLTabStopContext_Impl( SvXMLImport& rImport, sal_Int32 nElement,
const uno::Reference< xml::sax::XFastAttributeList > & xAttrList );
const style::TabStop& getTabStop() const { return aTabStop; }
};
SvxXMLTabStopContext_Impl::SvxXMLTabStopContext_Impl(
SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName,
const uno::Reference< xml::sax::XAttributeList > & xAttrList )
: SvXMLImportContext( rImport, nPrfx, rLName )
SvXMLImport& rImport, sal_Int32 /*nElement*/,
const uno::Reference< xml::sax::XFastAttributeList > & xAttrList )
: SvXMLImportContext( rImport )
{
aTabStop.Position = 0;
aTabStop.Alignment = style::TabAlign_LEFT;
@@ -84,64 +83,60 @@ SvxXMLTabStopContext_Impl::SvxXMLTabStopContext_Impl(
static const SvXMLTokenMap aTokenMap( aTabsAttributesAttrTokenMap );
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 );
const OUString& rValue = xAttrList->getValueByIndex( i );
const OUString sValue = aIter.toString();
sal_Int32 nVal;
switch( aTokenMap.Get( nPrefix, aLocalName ) )
switch( aIter.getToken() )
{
case XML_TOK_TABSTOP_POSITION:
case XML_ELEMENT(STYLE, XML_POSITION):
if (GetImport().GetMM100UnitConverter().convertMeasureToCore(
nVal, rValue))
nVal, sValue))
{
aTabStop.Position = nVal;
}
break;
case XML_TOK_TABSTOP_TYPE:
if( IsXMLToken( rValue, XML_LEFT ) )
case XML_ELEMENT(STYLE, XML_TYPE):
if( IsXMLToken( sValue, XML_LEFT ) )
{
aTabStop.Alignment = style::TabAlign_LEFT;
}
else if( IsXMLToken( rValue, XML_RIGHT ) )
else if( IsXMLToken( sValue, XML_RIGHT ) )
{
aTabStop.Alignment = style::TabAlign_RIGHT;
}
else if( IsXMLToken( rValue, XML_CENTER ) )
else if( IsXMLToken( sValue, XML_CENTER ) )
{
aTabStop.Alignment = style::TabAlign_CENTER;
}
else if( IsXMLToken( rValue, XML_CHAR ) )
else if( IsXMLToken( sValue, XML_CHAR ) )
{
aTabStop.Alignment = style::TabAlign_DECIMAL;
}
else if( IsXMLToken( rValue, XML_DEFAULT ) )
else if( IsXMLToken( sValue, XML_DEFAULT ) )
{
aTabStop.Alignment = style::TabAlign_DEFAULT;
}
break;
case XML_TOK_TABSTOP_CHAR:
if( !rValue.isEmpty() )
aTabStop.DecimalChar = rValue[0];
case XML_ELEMENT(STYLE, XML_CHAR):
if( !sValue.isEmpty() )
aTabStop.DecimalChar = sValue[0];
break;
case XML_TOK_TABSTOP_LEADER_STYLE:
if( IsXMLToken( rValue, XML_NONE ) )
case XML_ELEMENT(STYLE, XML_LEADER_STYLE):
if( IsXMLToken( sValue, XML_NONE ) )
aTabStop.FillChar = ' ';
else if( IsXMLToken( rValue, XML_DOTTED ) )
else if( IsXMLToken( sValue, XML_DOTTED ) )
aTabStop.FillChar = '.';
else
aTabStop.FillChar = '_';
break;
case XML_TOK_TABSTOP_LEADER_TEXT:
if( !rValue.isEmpty() )
cTextFillChar = rValue[0];
case XML_ELEMENT(STYLE, XML_LEADER_TEXT):
if( !sValue.isEmpty() )
cTextFillChar = sValue[0];
break;
default:
SAL_WARN("xmloff", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << sValue);
}
}
@@ -151,27 +146,22 @@ SvxXMLTabStopContext_Impl::SvxXMLTabStopContext_Impl(
SvxXMLTabStopImportContext::SvxXMLTabStopImportContext(
SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName,
SvXMLImport& rImport, sal_Int32 nElement,
const XMLPropertyState& rProp,
::std::vector< XMLPropertyState > &rProps )
: XMLElementPropertyContext( rImport, nPrfx, rLName, rProp, rProps )
: XMLElementPropertyContext( rImport, nElement, rProp, rProps )
{
}
SvXMLImportContextRef SvxXMLTabStopImportContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const uno::Reference< xml::sax::XAttributeList > & xAttrList )
css::uno::Reference< css::xml::sax::XFastContextHandler > SvxXMLTabStopImportContext::createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
{
SvXMLImportContext *pContext = nullptr;
if( XML_NAMESPACE_STYLE == nPrefix && IsXMLToken( rLocalName, XML_TAB_STOP ) )
if( nElement == XML_ELEMENT(STYLE, XML_TAB_STOP) )
{
// create new tabstop import context
const rtl::Reference<SvxXMLTabStopContext_Impl> xTabStopContext{
new SvxXMLTabStopContext_Impl( GetImport(), nPrefix, rLocalName,
xAttrList )};
new SvxXMLTabStopContext_Impl( GetImport(), nElement, xAttrList )};
// add new tabstop to array of tabstops
if( !mpTabStops )
@@ -179,13 +169,15 @@ SvXMLImportContextRef SvxXMLTabStopImportContext::CreateChildContext(
mpTabStops->push_back( xTabStopContext );
pContext = xTabStopContext.get();
return xTabStopContext.get();
}
else
SAL_WARN("xmloff", "unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement));
return pContext;
return nullptr;
}
void SvxXMLTabStopImportContext::EndElement( )
void SvxXMLTabStopImportContext::endFastElement(sal_Int32 nElement)
{
sal_uInt16 nCount = mpTabStops ? mpTabStops->size() : 0;
uno::Sequence< style::TabStop> aSeq( nCount );
@@ -215,8 +207,7 @@ void SvxXMLTabStopImportContext::EndElement( )
aProp.maValue <<= aSeq;
SetInsert( true );
XMLElementPropertyContext::EndElement();
XMLElementPropertyContext::endFastElement(nElement);
}
diff --git a/xmloff/source/text/XMLSectionFootnoteConfigImport.cxx b/xmloff/source/text/XMLSectionFootnoteConfigImport.cxx
index 6567846..4849e46 100644
--- a/xmloff/source/text/XMLSectionFootnoteConfigImport.cxx
+++ b/xmloff/source/text/XMLSectionFootnoteConfigImport.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/xml/sax/XAttributeList.hpp>
#include <com/sun/star/style/NumberingType.hpp>
#include <sal/log.hxx>
#include <sax/tools/converter.hxx>
#include <xmloff/xmlimp.hxx>
#include <xmloff/xmltoken.hxx>
@@ -47,11 +48,10 @@ using ::com::sun::star::xml::sax::XAttributeList;
XMLSectionFootnoteConfigImport::XMLSectionFootnoteConfigImport(
SvXMLImport& rImport,
sal_uInt16 nPrefix,
const OUString& rLocalName,
sal_Int32 /*nElement*/,
vector<XMLPropertyState> & rProps,
const rtl::Reference<XMLPropertySetMapper> & rMapperRef) :
SvXMLImportContext(rImport, nPrefix, rLocalName),
SvXMLImportContext(rImport),
rProperties(rProps),
rMapper(rMapperRef)
{
@@ -61,8 +61,9 @@ XMLSectionFootnoteConfigImport::~XMLSectionFootnoteConfigImport()
{
}
void XMLSectionFootnoteConfigImport::StartElement(
const Reference<XAttributeList> & xAttrList)
void XMLSectionFootnoteConfigImport::startFastElement(
sal_Int32 /*nElement*/,
const Reference<css::xml::sax::XFastAttributeList> & xAttrList)
{
bool bNumOwn = false;
bool bNumRestart = false;
@@ -74,18 +75,13 @@ void XMLSectionFootnoteConfigImport::StartElement(
OUString sNumLetterSync;
// iterate over xattribute list and fill values
sal_Int16 nLength = xAttrList->getLength();
for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
for (auto &aIter : sax_fastparser::castToFastAttributeList(xAttrList))
{
OUString sLocalName;
sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
&sLocalName );
OUString sAttrValue = xAttrList->getValueByIndex(nAttr);
OUString sAttrValue = aIter.toString();
if (XML_NAMESPACE_TEXT == nPrefix)
switch(aIter.getToken())
{
if (IsXMLToken(sLocalName, XML_START_VALUE))
case XML_ELEMENT(TEXT, XML_START_VALUE):
{
sal_Int32 nTmp;
if (::sax::Converter::convertNumber(nTmp, sAttrValue))
@@ -93,35 +89,40 @@ void XMLSectionFootnoteConfigImport::StartElement(
nNumRestartAt = static_cast< sal_Int16 >( nTmp ) - 1;
bNumRestart = true;
}
break;
}
else if( IsXMLToken( sLocalName, XML_NOTE_CLASS ) )
case XML_ELEMENT(TEXT, XML_NOTE_CLASS):
{
if( IsXMLToken( sAttrValue, XML_ENDNOTE ) )
bEndnote = true;
break;
}
}
else if (XML_NAMESPACE_STYLE == nPrefix)
{
if (IsXMLToken(sLocalName, XML_NUM_PREFIX))
case XML_ELEMENT(STYLE, XML_NUM_PREFIX):
{
sNumPrefix = sAttrValue;
bNumOwn = true;
break;
}
else if (IsXMLToken(sLocalName, XML_NUM_SUFFIX))
case XML_ELEMENT(TEXT, XML_NUM_SUFFIX):
{
sNumSuffix = sAttrValue;
bNumOwn = true;
break;
}
else if (IsXMLToken(sLocalName, XML_NUM_FORMAT))
case XML_ELEMENT(TEXT, XML_NUM_FORMAT):
{
sNumFormat = sAttrValue;
bNumOwn = true;
break;
}
else if (IsXMLToken(sLocalName, XML_NUM_LETTER_SYNC))
case XML_ELEMENT(TEXT, XML_NUM_LETTER_SYNC):
{
sNumLetterSync = sAttrValue;
bNumOwn = true;
break;
}
default:
SAL_WARN("xmloff", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << sAttrValue);
}
}
diff --git a/xmloff/source/text/XMLSectionFootnoteConfigImport.hxx b/xmloff/source/text/XMLSectionFootnoteConfigImport.hxx
index 0953525..0182c0d 100644
--- a/xmloff/source/text/XMLSectionFootnoteConfigImport.hxx
+++ b/xmloff/source/text/XMLSectionFootnoteConfigImport.hxx
@@ -48,15 +48,14 @@ public:
XMLSectionFootnoteConfigImport(
SvXMLImport& rImport,
sal_uInt16 nPrefix,
const OUString& rLocalName,
sal_Int32 nElement,
::std::vector<XMLPropertyState> & rProperties,
const rtl::Reference<XMLPropertySetMapper> & rMapperRef);
virtual ~XMLSectionFootnoteConfigImport() override;
virtual void StartElement(
const css::uno::Reference<css::xml::sax::XAttributeList> & xAttrList ) override;
virtual void SAL_CALL startFastElement( sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override;
};
diff --git a/xmloff/source/text/XMLTextColumnsContext.cxx b/xmloff/source/text/XMLTextColumnsContext.cxx
index a94da52..4bacea3 100644
--- a/xmloff/source/text/XMLTextColumnsContext.cxx
+++ b/xmloff/source/text/XMLTextColumnsContext.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/style/VerticalAlignment.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <sal/log.hxx>
#include <sax/tools/converter.hxx>
#include <xmloff/xmltkmap.hxx>
#include <xmloff/xmluconv.hxx>
@@ -253,41 +254,37 @@ const OUStringLiteral gsAutomaticDistance(u"AutomaticDistance");
const OUStringLiteral gsSeparatorLineStyle(u"SeparatorLineStyle");
XMLTextColumnsContext::XMLTextColumnsContext(
SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName,
const Reference< xml::sax::XAttributeList >&
xAttrList,
SvXMLImport& rImport, sal_Int32 nElement,
const Reference< xml::sax::XFastAttributeList >& xAttrList,
const XMLPropertyState& rProp,
::std::vector< XMLPropertyState > &rProps )
: XMLElementPropertyContext( rImport, nPrfx, rLName, rProp, rProps )
: XMLElementPropertyContext( rImport, nElement, rProp, rProps )
, pColumnAttrTokenMap( new SvXMLTokenMap(aColAttrTokenMap) )
, pColumnSepAttrTokenMap( new SvXMLTokenMap(aColSepAttrTokenMap) )
, nCount( 0 )
, bAutomatic( false )
, nAutomaticDistance( 0 )
{
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
sal_Int32 nVal;
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 );
const OUString& rValue = xAttrList->getValueByIndex( i );
if( XML_NAMESPACE_FO == nPrefix )
const OUString sValue = aIter.toString();
switch(aIter.getToken())
{
if( IsXMLToken( aLocalName, XML_COLUMN_COUNT ) &&
::sax::Converter::convertNumber( nVal, rValue, 0, SHRT_MAX ))
{
nCount = static_cast<sal_Int16>(nVal);
}
else if( IsXMLToken( aLocalName, XML_COLUMN_GAP ) )
case XML_ELEMENT(FO, XML_COLUMN_COUNT):
case XML_ELEMENT(FO_COMPAT, XML_COLUMN_COUNT):
if(::sax::Converter::convertNumber( nVal, sValue, 0, SHRT_MAX ))
nCount = static_cast<sal_Int16>(nVal);
break;
case XML_ELEMENT(FO, XML_COLUMN_GAP):
case XML_ELEMENT(FO_COMPAT, XML_COLUMN_GAP):
{
bAutomatic = GetImport().GetMM100UnitConverter().
convertMeasureToCore( nAutomaticDistance, rValue );
convertMeasureToCore( nAutomaticDistance, sValue );
break;
}
default:
SAL_WARN("xmloff", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << sValue);
}
}
}
@@ -327,7 +324,7 @@ SvXMLImportContextRef XMLTextColumnsContext::CreateChildContext(
return pContext;
}
void XMLTextColumnsContext::EndElement( )
void XMLTextColumnsContext::endFastElement(sal_Int32 nElement )
{
Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),UNO_QUERY);
if( !xFactory.is() )
@@ -436,7 +433,7 @@ void XMLTextColumnsContext::EndElement( )
aProp.maValue <<= xColumns;
SetInsert( true );
XMLElementPropertyContext::EndElement();
XMLElementPropertyContext::endFastElement(nElement);
}
diff --git a/xmloff/source/text/XMLTextPropertySetContext.cxx b/xmloff/source/text/XMLTextPropertySetContext.cxx
index e0d0348..2dc3af0 100644
--- a/xmloff/source/text/XMLTextPropertySetContext.cxx
+++ b/xmloff/source/text/XMLTextPropertySetContext.cxx
@@ -33,20 +33,6 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star;
XMLTextPropertySetContext::XMLTextPropertySetContext(
SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName,
const Reference< xml::sax::XAttributeList > & xAttrList,
sal_uInt32 nFamily,
::std::vector< XMLPropertyState > &rProps,
const rtl::Reference < SvXMLImportPropertyMapper > &rMap,
OUString& rDCTextStyleName ) :
SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFamily,
rProps, rMap ),
rDropCapTextStyleName( rDCTextStyleName )
{
}
XMLTextPropertySetContext::XMLTextPropertySetContext(
SvXMLImport& rImport, sal_Int32 nElement,
const Reference< xml::sax::XFastAttributeList > & xAttrList,
sal_uInt32 nFamily,
@@ -63,12 +49,11 @@ XMLTextPropertySetContext::~XMLTextPropertySetContext()
{
}
SvXMLImportContextRef XMLTextPropertySetContext::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const Reference< xml::sax::XAttributeList > & xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp )
css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextPropertySetContext::createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp )
{
SvXMLImportContextRef xContext;
@@ -76,13 +61,13 @@ SvXMLImportContextRef XMLTextPropertySetContext::CreateChildContext(
->GetEntryContextId( rProp.mnIndex ) )
{
case CTF_TABSTOP:
xContext = new SvxXMLTabStopImportContext( GetImport(), nPrefix,
rLocalName, rProp,
return new SvxXMLTabStopImportContext( GetImport(), nElement,
rProp,
rProperties );
break;
case CTF_TEXTCOLUMNS:
xContext = new XMLTextColumnsContext( GetImport(), nPrefix,
rLocalName, xAttrList, rProp,
return new XMLTextColumnsContext( GetImport(), nElement,
xAttrList, rProp,
rProperties );
break;
@@ -93,13 +78,13 @@ SvXMLImportContextRef XMLTextPropertySetContext::CreateChildContext(
->GetEntryContextId( rProp.mnIndex-2 ),
"invalid property map!");
XMLTextDropCapImportContext *pDCContext =
new XMLTextDropCapImportContext( GetImport(), nPrefix,
rLocalName, xAttrList,
new XMLTextDropCapImportContext( GetImport(), nElement,
xAttrList,
rProp,
rProp.mnIndex-2,
rProperties );
rDropCapTextStyleName = pDCContext->GetStyleName();
xContext = pDCContext;
return pDCContext;
}
break;
@@ -121,9 +106,9 @@ SvXMLImportContextRef XMLTextPropertySetContext::CreateChildContext(
rProp.mnIndex-3 ) ) )
nTranspIndex = rProp.mnIndex-3;
xContext =
new XMLBackgroundImageContext( GetImport(), nPrefix,
rLocalName, xAttrList,
return
new XMLBackgroundImageContext( GetImport(), nElement,
xAttrList,
rProp,
rProp.mnIndex-2,
rProp.mnIndex-1,
@@ -134,18 +119,15 @@ SvXMLImportContextRef XMLTextPropertySetContext::CreateChildContext(
break;
case CTF_SECTION_FOOTNOTE_END:
case CTF_SECTION_ENDNOTE_END:
xContext = new XMLSectionFootnoteConfigImport(
GetImport(), nPrefix, rLocalName, rProperties,
return new XMLSectionFootnoteConfigImport(
GetImport(), nElement, rProperties,
mxMapper->getPropertySetMapper());
break;
}
if (!xContext)
xContext = SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName,
return SvXMLPropertySetContext::createFastChildContext( nElement,
xAttrList,
rProperties, rProp );
return xContext;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextPropertySetContext.hxx b/xmloff/source/text/XMLTextPropertySetContext.hxx
index f53b6bd..33159f3 100644
--- a/xmloff/source/text/XMLTextPropertySetContext.hxx
+++ b/xmloff/source/text/XMLTextPropertySetContext.hxx
@@ -31,14 +31,6 @@ class XMLTextPropertySetContext : public SvXMLPropertySetContext
OUString& rDropCapTextStyleName;
public:
XMLTextPropertySetContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName,
const css::uno::Reference<css::xml::sax::XAttributeList >& xAttrList,
sal_uInt32 nFamily,
::std::vector< XMLPropertyState > &rProps,
const rtl::Reference < SvXMLImportPropertyMapper > &rMap,
OUString& rDopCapTextStyleName );
XMLTextPropertySetContext( SvXMLImport& rImport, sal_Int32 nElement,
const css::uno::Reference<css::xml::sax::XFastAttributeList >& xAttrList,
sal_uInt32 nFamily,
@@ -48,12 +40,12 @@ public:
virtual ~XMLTextPropertySetContext() override;
using SvXMLPropertySetContext::CreateChildContext;
virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp) override;
using SvXMLPropertySetContext::createFastChildContext;
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp ) override;
};
diff --git a/xmloff/source/text/XMLTextShapeStyleContext.cxx b/xmloff/source/text/XMLTextShapeStyleContext.cxx
index 72660d0..cf43c04 100644
--- a/xmloff/source/text/XMLTextShapeStyleContext.cxx
+++ b/xmloff/source/text/XMLTextShapeStyleContext.cxx
@@ -53,12 +53,12 @@ public:
::std::vector< XMLPropertyState > &rProps,
const rtl::Reference < SvXMLImportPropertyMapper > &rMap );
using SvXMLPropertySetContext::CreateChildContext;
virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const Reference< XAttributeList >& xAttrList,
using SvXMLPropertySetContext::createFastChildContext;
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp) override;
const XMLPropertyState& rProp ) override;
};
}
@@ -74,12 +74,11 @@ XMLTextShapePropertySetContext_Impl::XMLTextShapePropertySetContext_Impl(
{
}
SvXMLImportContextRef XMLTextShapePropertySetContext_Impl::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const Reference< XAttributeList > & xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp )
css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextShapePropertySetContext_Impl::createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
::std::vector< XMLPropertyState > &rProperties,
const XMLPropertyState& rProp )
{
SvXMLImportContextRef xContext;
@@ -87,8 +86,8 @@ SvXMLImportContextRef XMLTextShapePropertySetContext_Impl::CreateChildContext(
->GetEntryContextId( rProp.mnIndex ) )
{
case CTF_TEXTCOLUMNS:
xContext = new XMLTextColumnsContext( GetImport(), nPrefix,
rLocalName, xAttrList, rProp,
return new XMLTextColumnsContext( GetImport(), nElement,
xAttrList, rProp,
rProperties );
break;
@@ -102,9 +101,9 @@ SvXMLImportContextRef XMLTextShapePropertySetContext_Impl::CreateChildContext(
CTF_BACKGROUND_FILTER == mxMapper->getPropertySetMapper()
->GetEntryContextId( rProp.mnIndex-1 ),
"invalid property map!");
xContext =
new XMLBackgroundImageContext( GetImport(), nPrefix,
rLocalName, xAttrList,
return
new XMLBackgroundImageContext( GetImport(), nElement,
xAttrList,
rProp,
rProp.mnIndex-2,
rProp.mnIndex-1,
@@ -114,11 +113,8 @@ SvXMLImportContextRef XMLTextShapePropertySetContext_Impl::CreateChildContext(
break;
}
if (!xContext)
xContext = XMLShapePropertySetContext::CreateChildContext(
nPrefix, rLocalName, xAttrList, rProperties, rProp );
return xContext;
return XMLShapePropertySetContext::createFastChildContext(
nElement, xAttrList, rProperties, rProp );
}
void XMLTextShapeStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
diff --git a/xmloff/source/text/txtdropi.cxx b/xmloff/source/text/txtdropi.cxx
index e68e276..dc58e2c 100644
--- a/xmloff/source/text/txtdropi.cxx
+++ b/xmloff/source/text/txtdropi.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/style/DropCapFormat.hpp>
#include <sal/log.hxx>
#include <sax/tools/converter.hxx>
#include <xmloff/xmltkmap.hxx>
@@ -59,7 +60,7 @@ const SvXMLTokenMapEntry aDropAttrTokenMap[] =
};
void XMLTextDropCapImportContext::ProcessAttrs(
const Reference< xml::sax::XAttributeList >& xAttrList )
const Reference< xml::sax::XFastAttributeList >& xAttrList )
{
static const SvXMLTokenMap aTokenMap( aDropAttrTokenMap );
@@ -67,48 +68,45 @@ void XMLTextDropCapImportContext::ProcessAttrs(
bool bWholeWord = false;
sal_Int32 nTmp;
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 );
const OUString& rValue = xAttrList->getValueByIndex( i );
const OUString sValue = aIter.toString();
switch( aTokenMap.Get( nPrefix, aLocalName ) )
switch( aIter.getToken() )
{
case XML_TOK_DROP_LINES:
if (::sax::Converter::convertNumber( nTmp, rValue, 0, 255 ))
case XML_ELEMENT(STYLE, XML_LINES):
if (::sax::Converter::convertNumber( nTmp, sValue, 0, 255 ))
{
aFormat.Lines = nTmp < 2 ? 0 : static_cast<sal_Int8>(nTmp);
}
break;
case XML_TOK_DROP_LENGTH:
if( IsXMLToken( rValue, XML_WORD ) )
case XML_ELEMENT(STYLE, XML_LENGTH):
if( IsXMLToken( sValue, XML_WORD ) )
{
bWholeWord = true;
}
else if (::sax::Converter::convertNumber( nTmp, rValue, 1, 255 ))
else if (::sax::Converter::convertNumber( nTmp, sValue, 1, 255 ))
{
bWholeWord = false;
aFormat.Count = static_cast<sal_Int8>(nTmp);
}
break;
case XML_TOK_DROP_DISTANCE:
case XML_ELEMENT(STYLE, XML_DISTANCE):
if (GetImport().GetMM100UnitConverter().convertMeasureToCore(
nTmp, rValue, 0 ))
nTmp, sValue, 0 ))
{
aFormat.Distance = static_cast<sal_uInt16>(nTmp);
}
break;
case XML_TOK_DROP_STYLE:
sStyleName = rValue;
case XML_ELEMENT(STYLE, XML_STYLE_NAME):
sStyleName = sValue;
break;
default:
SAL_WARN("xmloff", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << sValue);
}
}
@@ -121,13 +119,12 @@ void XMLTextDropCapImportContext::ProcessAttrs(
}
XMLTextDropCapImportContext::XMLTextDropCapImportContext(
SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName,
const Reference< xml::sax::XAttributeList > & xAttrList,
SvXMLImport& rImport, sal_Int32 nElement,
const Reference< xml::sax::XFastAttributeList > & xAttrList,
const XMLPropertyState& rProp,
sal_Int32 nWholeWordIdx,
::std::vector< XMLPropertyState > &rProps ) :
XMLElementPropertyContext( rImport, nPrfx, rLName, rProp, rProps ),
XMLElementPropertyContext( rImport, nElement, rProp, rProps ),
aWholeWordProp( nWholeWordIdx )
{
ProcessAttrs( xAttrList );
@@ -137,10 +134,10 @@ XMLTextDropCapImportContext::~XMLTextDropCapImportContext()
{
}
void XMLTextDropCapImportContext::EndElement()
void XMLTextDropCapImportContext::endFastElement(sal_Int32 nElement)
{
SetInsert( true );
XMLElementPropertyContext::EndElement();
XMLElementPropertyContext::endFastElement(nElement);
if( -1 != aWholeWordProp.mnIndex )
rProperties.push_back( aWholeWordProp );
diff --git a/xmloff/source/text/txtdropi.hxx b/xmloff/source/text/txtdropi.hxx
index f2f0f92..c15d83d 100644
--- a/xmloff/source/text/txtdropi.hxx
+++ b/xmloff/source/text/txtdropi.hxx
@@ -30,21 +30,22 @@ class XMLTextDropCapImportContext :public XMLElementPropertyContext
private:
void ProcessAttrs(
const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList );
const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList );
public:
XMLTextDropCapImportContext(
SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName,
const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList,
SvXMLImport& rImport, sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList,
const XMLPropertyState& rProp,
sal_Int32 nWholeWOrdIdx,
::std::vector< XMLPropertyState > &rProps );
virtual ~XMLTextDropCapImportContext() override;
virtual void EndElement() override;
virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
const OUString& GetStyleName() const { return sStyleName; }
};