summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammed Abdul Azeem <azeemmysore@gmail.com>2017-07-09 17:02:06 +0530
committerMichael Meeks <michael.meeks@collabora.com>2017-07-11 12:22:36 +0200
commitb401896a56149aa2871b65a330a6f601a9830ccd (patch)
tree8a8d31fdca5d47794442fab4c8c28be592b5e178
parent4f41e8810d67bd3d82e1ff40b23a9131921674a2 (diff)
Helper function to cast to FastAttributeList:
Refactoring codes that cast XFastAttributeList reference to FastAttributeList pointer using the helper function. Change-Id: Iecf4b815d6556b0992d638b633260fbd459c0dc4 Reviewed-on: https://gerrit.libreoffice.org/39723 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r--include/sax/fastattribs.hxx7
-rw-r--r--oox/source/helper/attributelist.cxx3
-rw-r--r--sc/source/filter/xml/XMLCalculationSettingsContext.cxx2
-rw-r--r--sc/source/filter/xml/XMLConsolidationContext.cxx2
-rw-r--r--sc/source/filter/xml/XMLTrackedChangesContext.cxx2
-rw-r--r--sc/source/filter/xml/datastreamimport.cxx2
-rw-r--r--sc/source/filter/xml/xmlbodyi.cxx2
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx2
-rw-r--r--sc/source/filter/xml/xmldrani.cxx2
-rw-r--r--sc/source/filter/xml/xmlexternaltabi.cxx9
-rw-r--r--sc/source/filter/xml/xmlrowi.cxx4
-rw-r--r--sc/source/filter/xml/xmltabi.cxx2
-rw-r--r--writerfilter/source/ooxml/OOXMLFactory.cxx5
-rw-r--r--xmloff/source/core/xmlictxt.cxx2
-rw-r--r--xmloff/source/core/xmlimp.cxx2
15 files changed, 28 insertions, 20 deletions
diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index c813fcf6944d..4147ac978f44 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -102,6 +102,13 @@ public:
virtual css::uno::Sequence< css::xml::Attribute > SAL_CALL getUnknownAttributes( ) override;
virtual css::uno::Sequence< css::xml::FastAttribute > SAL_CALL getFastAttributes() override;
+ static FastAttributeList* castToFastAttributeList(
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
+ {
+ assert( dynamic_cast <FastAttributeList *> ( xAttrList.get() ) != nullptr );
+ return ( static_cast <FastAttributeList *> ( xAttrList.get() ) );
+ }
+
/// Use for fast iteration and conversion of attributes
class FastAttributeIter {
const FastAttributeList &mrList;
diff --git a/oox/source/helper/attributelist.cxx b/oox/source/helper/attributelist.cxx
index 70abbc1e521f..e3f365cd8960 100644
--- a/oox/source/helper/attributelist.cxx
+++ b/oox/source/helper/attributelist.cxx
@@ -116,8 +116,7 @@ sax_fastparser::FastAttributeList *AttributeList::getAttribList() const
{
if( mpAttribList == nullptr )
{
- assert( dynamic_cast< sax_fastparser::FastAttributeList *>( mxAttribs.get() ) != nullptr );
- mpAttribList = static_cast< sax_fastparser::FastAttributeList *>( mxAttribs.get() );
+ mpAttribList = sax_fastparser::FastAttributeList::castToFastAttributeList( mxAttribs );
}
return mpAttribList;
}
diff --git a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
index e885d737de33..1347c299ff29 100644
--- a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
+++ b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
@@ -51,7 +51,7 @@ ScXMLCalculationSettingsContext::ScXMLCalculationSettingsContext( ScXMLImport& r
if( xAttrList.is() )
{
sax_fastparser::FastAttributeList *pAttribList =
- static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
for( auto &aIter : *pAttribList )
{
diff --git a/sc/source/filter/xml/XMLConsolidationContext.cxx b/sc/source/filter/xml/XMLConsolidationContext.cxx
index 092f561cec99..30b863395e81 100644
--- a/sc/source/filter/xml/XMLConsolidationContext.cxx
+++ b/sc/source/filter/xml/XMLConsolidationContext.cxx
@@ -42,7 +42,7 @@ ScXMLConsolidationContext::ScXMLConsolidationContext(
if( xAttrList.is() )
{
sax_fastparser::FastAttributeList *pAttribList =
- static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
for( auto &aIter : *pAttribList )
{
diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
index e680128eb643..22fc26b133eb 100644
--- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx
+++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
@@ -395,7 +395,7 @@ ScXMLTrackedChangesContext::ScXMLTrackedChangesContext( ScXMLImport& rImport,
if( xAttrList.is() )
{
sax_fastparser::FastAttributeList *pAttribList =
- static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
auto aIter( pAttribList->find( XML_ELEMENT( TABLE, XML_PROTECTION_KEY ) ) );
if( aIter != pAttribList->end() )
diff --git a/sc/source/filter/xml/datastreamimport.cxx b/sc/source/filter/xml/datastreamimport.cxx
index 4b61ae9398e5..156ee52e02bd 100644
--- a/sc/source/filter/xml/datastreamimport.cxx
+++ b/sc/source/filter/xml/datastreamimport.cxx
@@ -30,7 +30,7 @@ ScXMLDataStreamContext::ScXMLDataStreamContext(
if( xAttrList.is() )
{
sax_fastparser::FastAttributeList *pAttribList =
- static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
for( auto &aIter : *pAttribList )
{
diff --git a/sc/source/filter/xml/xmlbodyi.cxx b/sc/source/filter/xml/xmlbodyi.cxx
index b8ad60262c87..ec36351fa27d 100644
--- a/sc/source/filter/xml/xmlbodyi.cxx
+++ b/sc/source/filter/xml/xmlbodyi.cxx
@@ -93,7 +93,7 @@ ScXMLBodyContext::ScXMLBodyContext( ScXMLImport& rImport,
return;
sax_fastparser::FastAttributeList *pAttribList =
- static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
for( auto &it : *pAttribList )
{
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 36e174804372..8989827d4c2d 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -160,7 +160,7 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
if( xAttrList.is() )
{
sax_fastparser::FastAttributeList *pAttribList =
- static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
for( auto &it : *pAttribList )
{
diff --git a/sc/source/filter/xml/xmldrani.cxx b/sc/source/filter/xml/xmldrani.cxx
index 2e3dbb2147e7..fd9e6f6d74f6 100644
--- a/sc/source/filter/xml/xmldrani.cxx
+++ b/sc/source/filter/xml/xmldrani.cxx
@@ -120,7 +120,7 @@ ScXMLDatabaseRangeContext::ScXMLDatabaseRangeContext( ScXMLImport& rImport,
if( xAttrList.is() )
{
sax_fastparser::FastAttributeList *pAttribList =
- static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
for( auto &aIter : *pAttribList )
{
diff --git a/sc/source/filter/xml/xmlexternaltabi.cxx b/sc/source/filter/xml/xmlexternaltabi.cxx
index 9ce7d4e57121..1b0f1775eb0a 100644
--- a/sc/source/filter/xml/xmlexternaltabi.cxx
+++ b/sc/source/filter/xml/xmlexternaltabi.cxx
@@ -52,7 +52,8 @@ ScXMLExternalRefTabSourceContext::ScXMLExternalRefTabSourceContext(
if( xAttrList.is() )
{
- sax_fastparser::FastAttributeList *pAttribList = static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
+ sax_fastparser::FastAttributeList *pAttribList =
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
for( auto &it : *pAttribList )
{
@@ -167,7 +168,8 @@ ScXMLExternalRefRowContext::ScXMLExternalRefRowContext(
const SvXMLTokenMap& rAttrTokenMap = mrScImport.GetTableRowAttrTokenMap();
if ( xAttrList.is() )
{
- sax_fastparser::FastAttributeList *pAttribList = static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
+ sax_fastparser::FastAttributeList *pAttribList =
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
for( auto &it : *pAttribList )
{
@@ -246,7 +248,8 @@ ScXMLExternalRefCellContext::ScXMLExternalRefCellContext(
const SvXMLTokenMap& rTokenMap = rImport.GetTableRowCellAttrTokenMap();
if( xAttrList.is() )
{
- sax_fastparser::FastAttributeList *pAttribList = static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
+ sax_fastparser::FastAttributeList *pAttribList =
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
for( auto &it : *pAttribList )
{
diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx
index 41c6defe29fd..b27c08baa782 100644
--- a/sc/source/filter/xml/xmlrowi.cxx
+++ b/sc/source/filter/xml/xmlrowi.cxx
@@ -54,7 +54,7 @@ ScXMLTableRowContext::ScXMLTableRowContext( ScXMLImport& rImport,
if ( xAttrList.is() )
{
sax_fastparser::FastAttributeList *pAttribList =
- static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
for( auto &it : *pAttribList )
{
@@ -230,7 +230,7 @@ ScXMLTableRowsContext::ScXMLTableRowsContext( ScXMLImport& rImport,
if ( xAttrList.is() )
{
sax_fastparser::FastAttributeList *pAttribList =
- static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
auto &aIter( pAttribList->find( XML_ELEMENT( TABLE, XML_DISPLAY ) ) );
if( aIter != pAttribList->end() )
bGroupDisplay = IsXMLToken( aIter, XML_TRUE );
diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx
index c1bef215d008..0bad32e4004d 100644
--- a/sc/source/filter/xml/xmltabi.cxx
+++ b/sc/source/filter/xml/xmltabi.cxx
@@ -147,7 +147,7 @@ ScXMLTableContext::ScXMLTableContext( ScXMLImport& rImport,
if ( xAttrList.is() )
{
sax_fastparser::FastAttributeList *pAttribList =
- static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
for( auto &it : *pAttribList )
{
diff --git a/writerfilter/source/ooxml/OOXMLFactory.cxx b/writerfilter/source/ooxml/OOXMLFactory.cxx
index 58d9b3d4aeb5..12f6237ea996 100644
--- a/writerfilter/source/ooxml/OOXMLFactory.cxx
+++ b/writerfilter/source/ooxml/OOXMLFactory.cxx
@@ -44,9 +44,8 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
if (pFactory.get() == nullptr)
return;
- assert( dynamic_cast< sax_fastparser::FastAttributeList *>( Attribs.get() ) != nullptr );
- sax_fastparser::FastAttributeList *pAttribs;
- pAttribs = static_cast< sax_fastparser::FastAttributeList *>( Attribs.get() );
+ sax_fastparser::FastAttributeList *pAttribs =
+ sax_fastparser::FastAttributeList::castToFastAttributeList( Attribs );
const AttributeInfo *pAttr = pFactory->getAttributeInfoArray(nDefine);
if (!pAttr)
diff --git a/xmloff/source/core/xmlictxt.cxx b/xmloff/source/core/xmlictxt.cxx
index 920e2981f02e..a16dfa2f0beb 100644
--- a/xmloff/source/core/xmlictxt.cxx
+++ b/xmloff/source/core/xmlictxt.cxx
@@ -94,7 +94,7 @@ void SAL_CALL SvXMLImportContext::startUnknownElement(const OUString & rPrefix,
if ( Attribs.is() )
{
sax_fastparser::FastAttributeList *pAttribList =
- static_cast< sax_fastparser::FastAttributeList *>( Attribs.get() );
+ sax_fastparser::FastAttributeList::castToFastAttributeList( Attribs );
for( auto &it : *pAttribList )
{
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index a84cf8caabef..91e2a97148a3 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -791,7 +791,7 @@ void SAL_CALL SvXMLImport::startFastElement (sal_Int32 Element,
if ( Attribs.is() )
{
sax_fastparser::FastAttributeList *pAttribList =
- static_cast< sax_fastparser::FastAttributeList *>( Attribs.get() );
+ sax_fastparser::FastAttributeList::castToFastAttributeList( Attribs );
auto &aIter( pAttribList->find( XML_ELEMENT( OFFICE, XML_VERSION ) ) );
if( aIter != pAttribList->end() )
{