summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-08-05 10:48:40 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-08-05 11:26:04 +0000
commit9c1f700aff5f7e375d3570231e6d68fe2e2c0334 (patch)
tree0d616e27ab7cf82dd5e28939b984a626adc682e0 /xmloff
parenta5b842f3aa401352f5454edb8f47d9576dff0092 (diff)
improve refcounting loplugin to check SvRef-based classes
Change-Id: I2b3c8eedabeaecd8dcae9fe69c951353a5686883 Reviewed-on: https://gerrit.libreoffice.org/17521 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/inc/SchXMLExport.hxx4
-rw-r--r--xmloff/inc/SchXMLImport.hxx2
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx22
-rw-r--r--xmloff/source/chart/SchXMLImport.cxx11
-rw-r--r--xmloff/source/draw/sdxmlexp.cxx4
-rw-r--r--xmloff/source/draw/shapeexport.cxx6
-rw-r--r--xmloff/source/table/XMLTableExport.cxx4
7 files changed, 27 insertions, 26 deletions
diff --git a/xmloff/inc/SchXMLExport.hxx b/xmloff/inc/SchXMLExport.hxx
index e9e215912c45..41e179de4cad 100644
--- a/xmloff/inc/SchXMLExport.hxx
+++ b/xmloff/inc/SchXMLExport.hxx
@@ -37,9 +37,9 @@ class SchXMLExport : public SvXMLExport
{
private:
com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > mxStatusIndicator;
- SchXMLAutoStylePoolP maAutoStylePool;
+ rtl::Reference<SchXMLAutoStylePoolP> maAutoStylePool;
- SchXMLExportHelper maExportHelper;
+ rtl::Reference<SchXMLExportHelper> maExportHelper;
protected:
virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) SAL_OVERRIDE;
diff --git a/xmloff/inc/SchXMLImport.hxx b/xmloff/inc/SchXMLImport.hxx
index 6535faacfe80..01e6e1d46893 100644
--- a/xmloff/inc/SchXMLImport.hxx
+++ b/xmloff/inc/SchXMLImport.hxx
@@ -160,7 +160,7 @@ class SchXMLImport : public SvXMLImport
private:
com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > mxStatusIndicator;
- SchXMLImportHelper maImportHelper;
+ rtl::Reference<SchXMLImportHelper> maImportHelper;
protected:
virtual SvXMLImportContext *CreateContext(
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 08f1c5311ae0..e50c783d91dd 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -3560,8 +3560,8 @@ SchXMLExport::SchXMLExport(
OUString const & implementationName, SvXMLExportFlags nExportFlags )
: SvXMLExport( util::MeasureUnit::CM, xContext, implementationName,
::xmloff::token::XML_CHART, nExportFlags ),
- maAutoStylePool( *this ),
- maExportHelper( *this, maAutoStylePool )
+ maAutoStylePool( new SchXMLAutoStylePoolP(*this) ),
+ maExportHelper( new SchXMLExportHelper(*this, *maAutoStylePool.get()) )
{
if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
_GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT);
@@ -3579,11 +3579,11 @@ SchXMLExport::~SchXMLExport()
sal_uInt32 SchXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass )
{
- maExportHelper.SetSourceShellID(GetSourceShellID());
- maExportHelper.SetDestinationShellID(GetDestinationShellID());
+ maExportHelper->SetSourceShellID(GetSourceShellID());
+ maExportHelper->SetDestinationShellID(GetDestinationShellID());
Reference< chart2::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY );
- maExportHelper.m_pImpl->InitRangeSegmentationProperties( xChartDoc );
+ maExportHelper->m_pImpl->InitRangeSegmentationProperties( xChartDoc );
return SvXMLExport::exportDoc( eClass );
}
@@ -3606,8 +3606,8 @@ void SchXMLExport::_ExportAutoStyles()
Reference< chart::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY );
if( xChartDoc.is())
{
- maExportHelper.m_pImpl->collectAutoStyles( xChartDoc );
- maExportHelper.m_pImpl->exportAutoStyles();
+ maExportHelper->m_pImpl->collectAutoStyles( xChartDoc );
+ maExportHelper->m_pImpl->exportAutoStyles();
}
else
{
@@ -3654,13 +3654,13 @@ void SchXMLExport::_ExportContent()
aAny = xProp->getPropertyValue(
OUString( "ChartRangeAddress" ));
aAny >>= sChartAddress;
- maExportHelper.m_pImpl->SetChartRangeAddress( sChartAddress );
+ maExportHelper->m_pImpl->SetChartRangeAddress( sChartAddress );
OUString sTableNumberList;
aAny = xProp->getPropertyValue(
OUString( "TableNumberList" ));
aAny >>= sTableNumberList;
- maExportHelper.m_pImpl->SetTableNumberList( sTableNumberList );
+ maExportHelper->m_pImpl->SetTableNumberList( sTableNumberList );
// do not include own table if there are external addresses
bIncludeTable = sChartAddress.isEmpty();
@@ -3673,7 +3673,7 @@ void SchXMLExport::_ExportContent()
}
}
}
- maExportHelper.m_pImpl->exportChart( xChartDoc, bIncludeTable );
+ maExportHelper->m_pImpl->exportChart( xChartDoc, bIncludeTable );
}
else
{
@@ -3683,7 +3683,7 @@ void SchXMLExport::_ExportContent()
rtl::Reference< XMLPropertySetMapper > SchXMLExport::GetPropertySetMapper() const
{
- return maExportHelper.m_pImpl->GetPropertySetMapper();
+ return maExportHelper->m_pImpl->GetPropertySetMapper();
}
void SchXMLExportHelper_Impl::InitRangeSegmentationProperties( const Reference< chart2::XChartDocument > & xChartDoc )
diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx
index 46083c41febd..a8e1ea4a81e4 100644
--- a/xmloff/source/chart/SchXMLImport.cxx
+++ b/xmloff/source/chart/SchXMLImport.cxx
@@ -506,7 +506,8 @@ Reference< chart2::XDataSeries > SchXMLImportHelper::GetNewDataSeries(
SchXMLImport::SchXMLImport(
const Reference< uno::XComponentContext >& xContext,
OUString const & implementationName, SvXMLImportFlags nImportFlags ) :
- SvXMLImport( xContext, implementationName, nImportFlags )
+ SvXMLImport( xContext, implementationName, nImportFlags ),
+ maImportHelper(new SchXMLImportHelper)
{
GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT);
@@ -540,7 +541,7 @@ SvXMLImportContext *SchXMLImport::CreateContext( sal_uInt16 nPrefix, const OUStr
( IsXMLToken( rLocalName, XML_DOCUMENT_STYLES) ||
IsXMLToken( rLocalName, XML_DOCUMENT_CONTENT) ))
{
- pContext = new SchXMLDocContext( maImportHelper, *this, nPrefix, rLocalName );
+ pContext = new SchXMLDocContext( *maImportHelper.get(), *this, nPrefix, rLocalName );
} else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
( IsXMLToken(rLocalName, XML_DOCUMENT) ||
(IsXMLToken(rLocalName, XML_DOCUMENT_META)
@@ -556,12 +557,12 @@ SvXMLImportContext *SchXMLImport::CreateContext( sal_uInt16 nPrefix, const OUStr
xDPS->getDocumentProperties())
// flat OpenDocument file format
: new SchXMLFlatDocContext_Impl(
- maImportHelper, *this, nPrefix, rLocalName,
+ *maImportHelper.get(), *this, nPrefix, rLocalName,
xDPS->getDocumentProperties());
} else {
pContext = (IsXMLToken(rLocalName, XML_DOCUMENT_META))
? SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList )
- : new SchXMLDocContext( maImportHelper, *this,
+ : new SchXMLDocContext( *maImportHelper.get(), *this,
nPrefix, rLocalName );
}
} else {
@@ -583,7 +584,7 @@ SvXMLImportContext* SchXMLImport::CreateStylesContext(
// set context at base class, so that all auto-style classes are imported
SetAutoStyles( pStylesCtxt );
- maImportHelper.SetAutoStylesContext( pStylesCtxt );
+ maImportHelper->SetAutoStylesContext( pStylesCtxt );
return pStylesCtxt;
}
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index 894581548b38..fa86bafaed48 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -1717,13 +1717,13 @@ void SdXMLExport::ImpWritePresentationStyles()
// write presentation styles (ONLY if presentation)
if(IsImpress() && mxDocStyleFamilies.is() && xNamed.is())
{
- XMLStyleExport aStEx(*this, OUString(), GetAutoStylePool().get());
+ rtl::Reference<XMLStyleExport> aStEx(new XMLStyleExport(*this, OUString(), GetAutoStylePool().get()));
const rtl::Reference< SvXMLExportPropertyMapper > aMapperRef( GetPropertySetMapper() );
OUString aPrefix( xNamed->getName() );
aPrefix += "-";
- aStEx.exportStyleFamily(xNamed->getName(),
+ aStEx->exportStyleFamily(xNamed->getName(),
OUString(XML_STYLE_FAMILY_SD_PRESENTATION_NAME),
aMapperRef, false,
XML_STYLE_FAMILY_SD_PRESENTATION_ID, &aPrefix);
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index be6b76db744e..28522458b60c 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -1247,7 +1247,7 @@ void XMLShapeExport::ImpExportGluePoints( const uno::Reference< drawing::XShape
void XMLShapeExport::ExportGraphicDefaults()
{
- XMLStyleExport aStEx(mrExport, OUString(), mrExport.GetAutoStylePool().get());
+ rtl::Reference<XMLStyleExport> aStEx(new XMLStyleExport(mrExport, OUString(), mrExport.GetAutoStylePool().get()));
// construct PropertySetMapper
rtl::Reference< SvXMLExportPropertyMapper > xPropertySetMapper( CreateShapePropMapper( mrExport ) );
@@ -1268,10 +1268,10 @@ void XMLShapeExport::ExportGraphicDefaults()
uno::Reference< beans::XPropertySet > xDefaults( xFact->createInstance("com.sun.star.drawing.Defaults"), uno::UNO_QUERY );
if( xDefaults.is() )
{
- aStEx.exportDefaultStyle( xDefaults, OUString(XML_STYLE_FAMILY_SD_GRAPHICS_NAME), xPropertySetMapper );
+ aStEx->exportDefaultStyle( xDefaults, OUString(XML_STYLE_FAMILY_SD_GRAPHICS_NAME), xPropertySetMapper );
// write graphic family styles
- aStEx.exportStyleFamily("graphics", OUString(XML_STYLE_FAMILY_SD_GRAPHICS_NAME), xPropertySetMapper, false, XML_STYLE_FAMILY_SD_GRAPHICS_ID);
+ aStEx->exportStyleFamily("graphics", OUString(XML_STYLE_FAMILY_SD_GRAPHICS_NAME), xPropertySetMapper, false, XML_STYLE_FAMILY_SD_GRAPHICS_ID);
}
}
catch(const lang::ServiceNotRegisteredException&)
diff --git a/xmloff/source/table/XMLTableExport.cxx b/xmloff/source/table/XMLTableExport.cxx
index ab86020132be..38824f85f494 100644
--- a/xmloff/source/table/XMLTableExport.cxx
+++ b/xmloff/source/table/XMLTableExport.cxx
@@ -456,10 +456,10 @@ void XMLTableExport::exportTableStyles()
if( !mbExportTables )
return;
- XMLStyleExport aStEx(mrExport, OUString(), mrExport.GetAutoStylePool().get());
+ rtl::Reference<XMLStyleExport> aStEx(new XMLStyleExport(mrExport, OUString(), mrExport.GetAutoStylePool().get()));
// write graphic family styles
- aStEx.exportStyleFamily("cell", OUString(XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME), mxCellExportPropertySetMapper.get(), true, XML_STYLE_FAMILY_TABLE_CELL);
+ aStEx->exportStyleFamily("cell", OUString(XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME), mxCellExportPropertySetMapper.get(), true, XML_STYLE_FAMILY_TABLE_CELL);
exportTableTemplates();
}