no need to store reference to Import here

can just cast the parent member

Change-Id: I990bd4da3afbd78da819038c7907c28de87faaaf
Reviewed-on: https://gerrit.libreoffice.org/82567
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2019-11-13 09:35:05 +02:00
parent 26b7ff2b6c
commit ead34a4d34
4 changed files with 13 additions and 20 deletions

View File

@@ -86,7 +86,7 @@ using namespace ::com::sun::star::util;
class RptMLMasterStylesContext_Impl:
public XMLTextMasterStylesContext
{
ORptFilter& m_rImport;
ORptFilter& GetImport() { return static_cast<ORptFilter&>(XMLTextMasterStylesContext::GetImport()); }
public:
@@ -106,14 +106,13 @@ RptMLMasterStylesContext_Impl::RptMLMasterStylesContext_Impl(
const OUString& rLName ,
const uno::Reference< xml::sax::XAttributeList > & xAttrList ) :
XMLTextMasterStylesContext( rImport, nPrfx, rLName, xAttrList )
,m_rImport(rImport)
{
}
void RptMLMasterStylesContext_Impl::EndElement()
{
FinishStyles( true );
m_rImport.FinishStyles();
GetImport().FinishStyles();
}
/// read a component (file + filter version)

View File

@@ -43,7 +43,6 @@ ScXMLExternalRefTabSourceContext::ScXMLExternalRefTabSourceContext(
ScXMLImport& rImport,
const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList, ScXMLExternalTabData& rRefInfo ) :
ScXMLImportContext( rImport ),
mrScImport(rImport),
mrExternalRefInfo(rRefInfo)
{
using namespace ::xmloff::token;
@@ -98,7 +97,7 @@ static bool lcl_isValidRelativeURL(const OUString& rUrl)
void SAL_CALL ScXMLExternalRefTabSourceContext::endFastElement( sal_Int32 /*nElement*/ )
{
ScDocument* pDoc = mrScImport.GetDocument();
ScDocument* pDoc = GetScImport().GetDocument();
if (!pDoc)
return;
@@ -111,7 +110,6 @@ void SAL_CALL ScXMLExternalRefTabSourceContext::endFastElement( sal_Int32 /*nEle
ScXMLExternalRefRowsContext::ScXMLExternalRefRowsContext(
ScXMLImport& rImport, ScXMLExternalTabData& rRefInfo ) :
ScXMLImportContext( rImport ),
mrScImport(rImport),
mrExternalRefInfo(rRefInfo)
{
}
@@ -126,7 +124,7 @@ Reference< XFastContextHandler > SAL_CALL ScXMLExternalRefRowsContext::createFas
// #i101319# row elements inside group, rows or header-rows
// are treated like row elements directly in the table element
const SvXMLTokenMap& rTokenMap = mrScImport.GetTableRowsElemTokenMap();
const SvXMLTokenMap& rTokenMap = GetScImport().GetTableRowsElemTokenMap();
sal_uInt16 nToken = rTokenMap.Get( nElement );
sax_fastparser::FastAttributeList *pAttribList =
sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
@@ -137,10 +135,10 @@ Reference< XFastContextHandler > SAL_CALL ScXMLExternalRefRowsContext::createFas
case XML_TOK_TABLE_ROWS_HEADER_ROWS:
case XML_TOK_TABLE_ROWS_ROWS:
return new ScXMLExternalRefRowsContext(
mrScImport, mrExternalRefInfo);
GetScImport(), mrExternalRefInfo);
case XML_TOK_TABLE_ROWS_ROW:
return new ScXMLExternalRefRowContext(
mrScImport, pAttribList, mrExternalRefInfo);
GetScImport(), pAttribList, mrExternalRefInfo);
default:
;
}

View File

@@ -40,7 +40,6 @@ public:
virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
private:
ScXMLImport& mrScImport;
ScXMLExternalTabData& mrExternalRefInfo;
OUString maRelativeUrl;
@@ -61,7 +60,6 @@ public:
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
private:
ScXMLImport& mrScImport;
ScXMLExternalTabData& mrExternalRefInfo;
};

View File

@@ -29,7 +29,7 @@ using namespace ::xmloff::token;
class SvXMLSectionListContext : public SvXMLImportContext
{
private:
SwXMLSectionList & m_rImport;
SwXMLSectionList & GetImport() { return static_cast<SwXMLSectionList&>(SvXMLImportContext::GetImport()); }
public:
SvXMLSectionListContext(SwXMLSectionList& rImport);
@@ -42,12 +42,11 @@ public:
class SwXMLParentContext : public SvXMLImportContext
{
private:
SwXMLSectionList & m_rImport;
SwXMLSectionList & GetImport() { return static_cast<SwXMLSectionList&>(SvXMLImportContext::GetImport()); }
public:
SwXMLParentContext(SwXMLSectionList& rImport)
: SvXMLImportContext(rImport)
, m_rImport(rImport)
{
}
@@ -65,11 +64,11 @@ public:
Element == XML_ELEMENT(TEXT, XML_INSERTION) ||
Element == XML_ELEMENT(TEXT, XML_DELETION))
{
return new SvXMLSectionListContext(m_rImport);
return new SvXMLSectionListContext(GetImport());
}
else
{
return new SwXMLParentContext(m_rImport);
return new SwXMLParentContext(GetImport());
}
}
};
@@ -102,8 +101,7 @@ SvXMLImportContext * SwXMLSectionList::CreateFastContext(
}
SvXMLSectionListContext::SvXMLSectionListContext( SwXMLSectionList& rImport )
: SvXMLImportContext ( rImport ),
m_rImport(rImport)
: SvXMLImportContext ( rImport )
{
}
@@ -124,10 +122,10 @@ css::uno::Reference<css::xml::sax::XFastContextHandler> SvXMLSectionListContext:
if (aIter.getToken() == (XML_NAMESPACE_TEXT | XML_NAME))
sName = aIter.toString();
if ( !sName.isEmpty() )
m_rImport.m_rSectionList.push_back(sName);
GetImport().m_rSectionList.push_back(sName);
}
pContext = new SvXMLSectionListContext(m_rImport);
pContext = new SvXMLSectionListContext(GetImport());
return pContext;
}