summaryrefslogtreecommitdiff
path: root/sc/source/filter/xml/xmlrowi.cxx
diff options
context:
space:
mode:
authorMohammed Abdul Azeem <azeemmysore@gmail.com>2017-08-16 22:51:05 +0530
committerMichael Meeks <michael.meeks@collabora.com>2017-08-30 10:55:28 +0200
commitda8cf43b4f2af008df231f5e0629c71bd7f2b762 (patch)
treeba63371e3f32af2d8c2dc4612bf6970c731ba96e /sc/source/filter/xml/xmlrowi.cxx
parent0365ca351aac534d3fc09d22f6a91017525bfef8 (diff)
Refactoring fastcontexts code:
Moved all the casts inside ::createFastChildContext and used reference to it as an argument in the constructors. This avoids spreading the cast statements all over the place. Also removed some of the empty createFastChildContext(), they are unnecessary as the parent class already has it. Change-Id: I344ede732a53878a7e265c0178b07d73b5398237 Reviewed-on: https://gerrit.libreoffice.org/41178 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sc/source/filter/xml/xmlrowi.cxx')
-rw-r--r--sc/source/filter/xml/xmlrowi.cxx37
1 files changed, 18 insertions, 19 deletions
diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx
index b27c08baa782..b3b9c8705e2e 100644
--- a/sc/source/filter/xml/xmlrowi.cxx
+++ b/sc/source/filter/xml/xmlrowi.cxx
@@ -44,21 +44,18 @@ using namespace com::sun::star;
using namespace xmloff::token;
ScXMLTableRowContext::ScXMLTableRowContext( ScXMLImport& rImport,
- const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList ) :
+ const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList ) :
ScXMLImportContext( rImport ),
sVisibility(GetXMLToken(XML_VISIBLE)),
nRepeatedRows(1),
bHasCell(false)
{
OUString sCellStyleName;
- if ( xAttrList.is() )
+ if ( rAttrList.is() )
{
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
-
- for( auto &it : *pAttribList )
+ for (auto &it : *rAttrList)
{
- switch( it.getToken() )
+ switch (it.getToken())
{
case XML_ELEMENT( TABLE, XML_STYLE_NAME ):
{
@@ -103,6 +100,8 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
const uno::Reference< xml::sax::XFastAttributeList > & xAttrList )
{
SvXMLImportContext *pContext(nullptr);
+ sax_fastparser::FastAttributeList *pAttribList =
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
switch( nElement )
{
@@ -111,7 +110,7 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
{
bHasCell = true;
pContext = new ScXMLTableRowCellContext( GetScImport(),
- xAttrList, false, static_cast<SCROW>(nRepeatedRows)
+ pAttribList, false, static_cast<SCROW>(nRepeatedRows)
//this
);
}
@@ -121,7 +120,7 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
{
bHasCell = true;
pContext = new ScXMLTableRowCellContext( GetScImport(),
- xAttrList, true, static_cast<SCROW>(nRepeatedRows)
+ pAttribList, true, static_cast<SCROW>(nRepeatedRows)
//this
);
}
@@ -206,7 +205,7 @@ void SAL_CALL ScXMLTableRowContext::endFastElement(sal_Int32 /*nElement*/)
}
ScXMLTableRowsContext::ScXMLTableRowsContext( ScXMLImport& rImport,
- const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
+ const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
const bool bTempHeader,
const bool bTempGroup ) :
ScXMLImportContext( rImport ),
@@ -227,12 +226,10 @@ ScXMLTableRowsContext::ScXMLTableRowsContext( ScXMLImport& rImport,
{
nGroupStartRow = rImport.GetTables().GetCurrentRow();
++nGroupStartRow;
- if ( xAttrList.is() )
+ if ( rAttrList.is() )
{
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- auto &aIter( pAttribList->find( XML_ELEMENT( TABLE, XML_DISPLAY ) ) );
- if( aIter != pAttribList->end() )
+ auto &aIter( rAttrList->find( XML_ELEMENT( TABLE, XML_DISPLAY ) ) );
+ if (aIter != rAttrList->end())
bGroupDisplay = IsXMLToken( aIter, XML_TRUE );
}
}
@@ -247,23 +244,25 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
const uno::Reference< xml::sax::XFastAttributeList > & xAttrList )
{
SvXMLImportContext *pContext(nullptr);
+ sax_fastparser::FastAttributeList *pAttribList =
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
switch( nElement )
{
case XML_ELEMENT( TABLE, XML_TABLE_ROW_GROUP ):
- pContext = new ScXMLTableRowsContext( GetScImport(), xAttrList,
+ pContext = new ScXMLTableRowsContext( GetScImport(), pAttribList,
false, true );
break;
case XML_ELEMENT( TABLE, XML_TABLE_HEADER_ROWS ):
- pContext = new ScXMLTableRowsContext( GetScImport(), xAttrList,
+ pContext = new ScXMLTableRowsContext( GetScImport(), pAttribList,
true, false );
break;
case XML_ELEMENT( TABLE, XML_TABLE_ROWS ):
- pContext = new ScXMLTableRowsContext( GetScImport(), xAttrList,
+ pContext = new ScXMLTableRowsContext( GetScImport(), pAttribList,
false, false );
break;
case XML_ELEMENT( TABLE, XML_TABLE_ROW ):
- pContext = new ScXMLTableRowContext( GetScImport(), xAttrList );
+ pContext = new ScXMLTableRowContext( GetScImport(), pAttribList );
break;
}