summaryrefslogtreecommitdiff
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
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>
-rw-r--r--compilerplugins/clang/refcounting.cxx120
-rw-r--r--dbaccess/source/core/api/KeySet.cxx18
-rw-r--r--dbaccess/source/core/api/KeySet.hxx4
-rw-r--r--dbaccess/source/core/api/RowSet.cxx28
-rw-r--r--dbaccess/source/core/api/RowSet.hxx4
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx2
-rw-r--r--lotuswordpro/source/filter/xfilter/xfdrawgroup.hxx6
-rw-r--r--lotuswordpro/source/filter/xfilter/xfdrawobj.hxx2
-rw-r--r--lotuswordpro/source/filter/xfilter/xfendnote.hxx2
-rw-r--r--lotuswordpro/source/filter/xfilter/xfheader.hxx2
-rw-r--r--lotuswordpro/source/filter/xfilter/xftable.cxx6
-rw-r--r--lotuswordpro/source/filter/xfilter/xftable.hxx2
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx6
-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
21 files changed, 189 insertions, 68 deletions
diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx
index 7b859ff65f22..3a6c715b6268 100644
--- a/compilerplugins/clang/refcounting.cxx
+++ b/compilerplugins/clang/refcounting.cxx
@@ -215,7 +215,81 @@ bool containsXInterfaceSubclass(const Type* pType0) {
}
}
+bool containsSvRefBaseSubclass(const Type* pType0) {
+ if (!pType0)
+ return false;
+ const Type* pType = pType0->getUnqualifiedDesugaredType();
+ if (!pType)
+ return false;
+ const CXXRecordDecl* pRecordDecl = pType->getAsCXXRecordDecl();
+ if (pRecordDecl) {
+ pRecordDecl = pRecordDecl->getCanonicalDecl();
+ }
+ if (pRecordDecl) {
+ const ClassTemplateSpecializationDecl* pTemplate = dyn_cast<ClassTemplateSpecializationDecl>(pRecordDecl);
+ if (pTemplate) {
+ std::string aName = pTemplate->getQualifiedNameAsString();
+ if (aName == "tools::SvRef")
+ return false;
+ for(unsigned i=0; i<pTemplate->getTemplateArgs().size(); ++i) {
+ const TemplateArgument& rArg = pTemplate->getTemplateArgs()[i];
+ if (rArg.getKind() == TemplateArgument::ArgKind::Type &&
+ containsSvRefBaseSubclass(rArg.getAsType().getTypePtr()))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ if (pType->isPointerType()) {
+ // ignore
+ return false;
+ } else if (pType->isArrayType()) {
+ const ArrayType* pArrayType = dyn_cast<ArrayType>(pType);
+ QualType elementType = pArrayType->getElementType();
+ return containsSvRefBaseSubclass(elementType.getTypePtr());
+ } else {
+ return isDerivedFrom(pRecordDecl, "tools::SvRefBase");
+ }
+}
+bool containsSalhelperReferenceObjectSubclass(const Type* pType0) {
+ if (!pType0)
+ return false;
+ const Type* pType = pType0->getUnqualifiedDesugaredType();
+ if (!pType)
+ return false;
+ const CXXRecordDecl* pRecordDecl = pType->getAsCXXRecordDecl();
+ if (pRecordDecl) {
+ pRecordDecl = pRecordDecl->getCanonicalDecl();
+ }
+ if (pRecordDecl) {
+ const ClassTemplateSpecializationDecl* pTemplate = dyn_cast<ClassTemplateSpecializationDecl>(pRecordDecl);
+ if (pTemplate) {
+ std::string aName = pTemplate->getQualifiedNameAsString();
+ if (aName == "rtl::Reference" || aName == "store::OStoreHandle")
+ return false;
+ for(unsigned i=0; i<pTemplate->getTemplateArgs().size(); ++i) {
+ const TemplateArgument& rArg = pTemplate->getTemplateArgs()[i];
+ if (rArg.getKind() == TemplateArgument::ArgKind::Type &&
+ containsSalhelperReferenceObjectSubclass(rArg.getAsType().getTypePtr()))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ if (pType->isPointerType()) {
+ // ignore
+ return false;
+ } else if (pType->isArrayType()) {
+ const ArrayType* pArrayType = dyn_cast<ArrayType>(pType);
+ QualType elementType = pArrayType->getElementType();
+ return containsSalhelperReferenceObjectSubclass(elementType.getTypePtr());
+ } else {
+ return isDerivedFrom(pRecordDecl, "salhelper::SimpleReferenceObject");
+ }
+}
bool RefCounting::VisitFieldDecl(const FieldDecl * fieldDecl) {
if (ignoreLocation(fieldDecl)) {
@@ -224,7 +298,29 @@ bool RefCounting::VisitFieldDecl(const FieldDecl * fieldDecl) {
if (fieldDecl->isBitField()) {
return true;
}
+
std::string aParentName = fieldDecl->getParent()->getQualifiedNameAsString();
+
+ if (containsSvRefBaseSubclass(fieldDecl->getType().getTypePtr())) {
+ report(
+ DiagnosticsEngine::Warning,
+ "SvRefBase subclass being directly heap managed, should be managed via tools::SvRef, "
+ + fieldDecl->getType().getAsString()
+ + ", parent is " + aParentName,
+ fieldDecl->getLocation())
+ << fieldDecl->getSourceRange();
+ }
+
+ if (containsSalhelperReferenceObjectSubclass(fieldDecl->getType().getTypePtr())) {
+ report(
+ DiagnosticsEngine::Warning,
+ "salhelper::SimpleReferenceObject subclass being directly heap managed, should be managed via rtl::Reference, "
+ + fieldDecl->getType().getAsString()
+ + ", parent is " + aParentName,
+ fieldDecl->getLocation())
+ << fieldDecl->getSourceRange();
+ }
+
if ( aParentName == "com::sun::star::uno::BaseReference"
|| aParentName == "cppu::detail::element_alias"
// this is playing some kind of game to avoid circular references
@@ -241,7 +337,6 @@ bool RefCounting::VisitFieldDecl(const FieldDecl * fieldDecl) {
+ ", parent is " + aParentName,
fieldDecl->getLocation())
<< fieldDecl->getSourceRange();
- return true;
}
return true;
}
@@ -251,6 +346,29 @@ bool RefCounting::VisitVarDecl(const VarDecl * varDecl) {
if (ignoreLocation(varDecl)) {
return true;
}
+ if (isa<ParmVarDecl>(varDecl)) {
+ return true;
+ }
+ if (containsSvRefBaseSubclass(varDecl->getType().getTypePtr())) {
+ report(
+ DiagnosticsEngine::Warning,
+ "SvRefBase subclass being directly stack managed, should be managed via tools::SvRef, "
+ + varDecl->getType().getAsString(),
+ varDecl->getLocation())
+ << varDecl->getSourceRange();
+ }
+ if (containsSalhelperReferenceObjectSubclass(varDecl->getType().getTypePtr())) {
+ StringRef name { compiler.getSourceManager().getFilename(compiler.getSourceManager().getSpellingLoc(varDecl->getLocation())) };
+ // this is playing games that it believes is safe
+ if (name == SRCDIR "/stoc/source/security/permissions.cxx")
+ return true;
+ report(
+ DiagnosticsEngine::Warning,
+ "salhelper::SimpleReferenceObject subclass being directly stack managed, should be managed via rtl::Reference, "
+ + varDecl->getType().getAsString(),
+ varDecl->getLocation())
+ << varDecl->getSourceRange();
+ }
if (containsXInterfaceSubclass(varDecl->getType())) {
report(
DiagnosticsEngine::Warning,
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index 404e01652836..060f028ebd80 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -111,7 +111,7 @@ OKeySet::OKeySet(const connectivity::OSQLTable& _xTable,
sal_Int32 i_nMaxRows,
sal_Int32& o_nRowCount)
:OCacheSet(i_nMaxRows)
- ,m_aParameterValueForCache(_aParameterValueForCache)
+ ,m_aParameterValueForCache(new ORowSetValueVector(_aParameterValueForCache))
,m_xTable(_xTable)
,m_xTableKeys(_xTableKeys)
,m_xComposer(_xComposer)
@@ -824,8 +824,8 @@ void OKeySet::copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow,sa
connectivity::ORowVector< ORowSetValue >::Vector::iterator aIter = _rKeyRow->get().begin();
// check the if the parameter values have been changed
- OSL_ENSURE((m_aParameterValueForCache.get().size()-1) == m_pParameterNames->size(),"OKeySet::copyRowValue: Parameter values and names differ!");
- connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaValuesIter = m_aParameterValueForCache.get().begin() +1;
+ OSL_ENSURE((m_aParameterValueForCache->get().size()-1) == m_pParameterNames->size(),"OKeySet::copyRowValue: Parameter values and names differ!");
+ connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaValuesIter = m_aParameterValueForCache->get().begin() +1;
bool bChanged = false;
SelectColumnsMetaData::const_iterator aParaIter = (*m_pParameterNames).begin();
@@ -836,8 +836,8 @@ void OKeySet::copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow,sa
aValue.setSigned(m_aSignedFlags[aParaIter->second.nPosition]);
if ( (_rInsertRow->get())[aParaIter->second.nPosition] != aValue )
{
- ORowSetValueVector aCopy(m_aParameterValueForCache);
- (aCopy.get())[i] = (_rInsertRow->get())[aParaIter->second.nPosition];
+ rtl::Reference<ORowSetValueVector> aCopy(new ORowSetValueVector(*m_aParameterValueForCache.get()));
+ (aCopy->get())[i] = (_rInsertRow->get())[aParaIter->second.nPosition];
m_aUpdatedParameter[i_nBookmark] = aCopy;
bChanged = true;
}
@@ -1192,13 +1192,13 @@ bool OKeySet::doTryRefetch_throw() throw(SQLException, RuntimeException)
OUpdatedParameter::iterator aUpdateFind = m_aUpdatedParameter.find(m_aKeyIter->first);
if ( aUpdateFind == m_aUpdatedParameter.end() )
{
- aParaIter = m_aParameterValueForCache.get().begin();
- aParaEnd = m_aParameterValueForCache.get().end();
+ aParaIter = m_aParameterValueForCache->get().begin();
+ aParaEnd = m_aParameterValueForCache->get().end();
}
else
{
- aParaIter = aUpdateFind->second.get().begin();
- aParaEnd = aUpdateFind->second.get().end();
+ aParaIter = aUpdateFind->second->get().begin();
+ aParaEnd = aUpdateFind->second->get().end();
}
for(++aParaIter;aParaIter != aParaEnd;++aParaIter,++nPos)
diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx
index 6ce838e2131b..945684f611d3 100644
--- a/dbaccess/source/core/api/KeySet.hxx
+++ b/dbaccess/source/core/api/KeySet.hxx
@@ -72,7 +72,7 @@ namespace dbaccess
typedef ::std::pair<ORowSetRow,::std::pair<sal_Int32,css::uno::Reference< css::sdbc::XRow> > > OKeySetValue;
typedef ::std::map<sal_Int32,OKeySetValue > OKeySetMatrix;
- typedef ::std::map<sal_Int32,ORowSetValueVector > OUpdatedParameter;
+ typedef ::std::map<sal_Int32, rtl::Reference<ORowSetValueVector> > OUpdatedParameter;
// is used when the source supports keys
class OKeySet : public OCacheSet
{
@@ -83,7 +83,7 @@ namespace dbaccess
::std::vector< OUString > m_aAutoColumns; // contains all columns which are autoincrement ones
OUpdatedParameter m_aUpdatedParameter; // contains all parameter which have been updated and are needed for refetching
- ORowSetValueVector m_aParameterValueForCache;
+ rtl::Reference<ORowSetValueVector> m_aParameterValueForCache;
::std::unique_ptr<SelectColumnsMetaData> m_pKeyColumnNames; // contains all key column names
::std::unique_ptr<SelectColumnsMetaData> m_pColumnNames; // contains all column names
::std::unique_ptr<SelectColumnsMetaData> m_pParameterNames; // contains all parameter names
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 9e03c14b086f..70a419a64c03 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -134,6 +134,8 @@ ORowSet::ORowSet( const Reference< css::uno::XComponentContext >& _rxContext )
:ORowSet_BASE1(m_aMutex)
,ORowSetBase( _rxContext, ORowSet_BASE1::rBHelper, &m_aMutex )
,m_pParameters( NULL )
+ ,m_aPrematureParamValues(new ORowSetValueVector)
+ ,m_aParameterValueForCache(new ORowSetValueVector)
,m_aRowsetListeners(*m_pMutex)
,m_aApproveListeners(*m_pMutex)
,m_aRowsChangeListener(*m_pMutex)
@@ -170,7 +172,7 @@ ORowSet::ORowSet( const Reference< css::uno::XComponentContext >& _rxContext )
sal_Int32 nRT = PropertyAttribute::READONLY | PropertyAttribute::TRANSIENT;
sal_Int32 nBT = PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT;
- m_aPrematureParamValues.get().resize( 0 );
+ m_aPrematureParamValues->get().resize( 0 );
// sdb.RowSet Properties
registerMayBeVoidProperty(PROPERTY_ACTIVE_CONNECTION,PROPERTY_ID_ACTIVE_CONNECTION, PropertyAttribute::MAYBEVOID|PropertyAttribute::TRANSIENT|PropertyAttribute::BOUND, &m_aActiveConnection, cppu::UnoType<XConnection>::get());
@@ -1681,14 +1683,14 @@ Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw()
{
impl_ensureStatement_throw();
- m_aParameterValueForCache.get().resize(1);
+ m_aParameterValueForCache->get().resize(1);
Reference< XParameters > xParam( m_xStatement, UNO_QUERY_THROW );
- size_t nParamCount( m_pParameters.is() ? m_pParameters->size() : m_aPrematureParamValues.get().size() );
+ size_t nParamCount( m_pParameters.is() ? m_pParameters->size() : m_aPrematureParamValues->get().size() );
for ( size_t i=1; i<=nParamCount; ++i )
{
ORowSetValue& rParamValue( getParameterStorage( (sal_Int32)i ) );
::dbtools::setObjectWithInfo( xParam, i, rParamValue.makeAny(), rParamValue.getTypeKind() );
- m_aParameterValueForCache.get().push_back(rParamValue);
+ m_aParameterValueForCache->get().push_back(rParamValue);
}
m_bParametersDirty = false;
@@ -1703,7 +1705,7 @@ Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw()
{
DELETEZ(m_pCache);
}
- m_pCache = new ORowSetCache( xResultSet, m_xComposer.get(), m_aContext, aComposedUpdateTableName, m_bModified, m_bNew,m_aParameterValueForCache,m_aFilter,m_nMaxRows );
+ m_pCache = new ORowSetCache( xResultSet, m_xComposer.get(), m_aContext, aComposedUpdateTableName, m_bModified, m_bNew, *m_aParameterValueForCache.get(),m_aFilter,m_nMaxRows );
if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
{
m_nPrivileges = Privilege::SELECT;
@@ -2432,10 +2434,10 @@ void ORowSet::impl_initParametersContainer_nothrow()
m_pParameters = new param::ParameterWrapperContainer( m_xComposer.get() );
// copy the premature parameters into the final ones
- size_t nParamCount( ::std::min( m_pParameters->size(), m_aPrematureParamValues.get().size() ) );
+ size_t nParamCount( ::std::min( m_pParameters->size(), m_aPrematureParamValues->get().size() ) );
for ( size_t i=0; i<nParamCount; ++i )
{
- (*m_pParameters)[i] = m_aPrematureParamValues.get()[i];
+ (*m_pParameters)[i] = m_aPrematureParamValues->get()[i];
}
}
@@ -2446,10 +2448,10 @@ void ORowSet::impl_disposeParametersContainer_nothrow()
// copy the actual values to our "premature" ones, to preserve them for later use
size_t nParamCount( m_pParameters->size() );
- m_aPrematureParamValues.get().resize( nParamCount );
+ m_aPrematureParamValues->get().resize( nParamCount );
for ( size_t i=0; i<nParamCount; ++i )
{
- m_aPrematureParamValues.get()[i] = (*m_pParameters)[i];
+ m_aPrematureParamValues->get()[i] = (*m_pParameters)[i];
}
m_pParameters->dispose();
@@ -2480,9 +2482,9 @@ ORowSetValue& ORowSet::getParameterStorage(sal_Int32 parameterIndex)
}
}
- if ( m_aPrematureParamValues.get().size() < (size_t)parameterIndex )
- m_aPrematureParamValues.get().resize( parameterIndex );
- return m_aPrematureParamValues.get()[ parameterIndex - 1 ];
+ if ( m_aPrematureParamValues->get().size() < (size_t)parameterIndex )
+ m_aPrematureParamValues->get().resize( parameterIndex );
+ return m_aPrematureParamValues->get()[ parameterIndex - 1 ];
}
// XParameters
@@ -2655,7 +2657,7 @@ void SAL_CALL ORowSet::clearParameters( ) throw(SQLException, RuntimeException,
::osl::MutexGuard aGuard( m_aColumnsMutex );
- size_t nParamCount( m_pParameters.is() ? m_pParameters->size() : m_aPrematureParamValues.get().size() );
+ size_t nParamCount( m_pParameters.is() ? m_pParameters->size() : m_aPrematureParamValues->get().size() );
for ( size_t i=1; i<=nParamCount; ++i )
getParameterStorage( (sal_Int32)i ).setNull();
m_aParametersSet.clear();
diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx
index 845df9af13b5..44e0d56222ea 100644
--- a/dbaccess/source/core/api/RowSet.hxx
+++ b/dbaccess/source/core/api/RowSet.hxx
@@ -86,8 +86,8 @@ namespace dbaccess
/** our parameters values, used when we do not yet have a parameters container
(since we have not been executed, yet)
*/
- ORowSetValueVector m_aPrematureParamValues;
- ORowSetValueVector m_aParameterValueForCache;
+ rtl::Reference<ORowSetValueVector> m_aPrematureParamValues;
+ rtl::Reference<ORowSetValueVector> m_aParameterValueForCache;
::std::vector<bool> m_aParametersSet;
::std::vector<bool> m_aReadOnlyDataColumns;
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 86fb9f75b581..f02dfa4d15a4 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -1391,7 +1391,7 @@ sal_Int8 OSelectionBrowseBox::ExecuteDrop( const BrowserExecuteDropEvent& _rEvt
return DND_ACTION_NONE;
}
- OTableFieldDesc aInfo;
+ rtl::Reference<OTableFieldDesc> aInfo;
// insert the field at the selected position
OJoinExchangeData jxdSource = OJoinExchObj::GetSourceDescription(_rEvt.maDropEvent.Transferable);
InsertField(jxdSource);
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 76bd6c1110b2..37976f0aa3f7 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -1252,7 +1252,7 @@ sal_Int32 OQueryController::getColWidth(sal_uInt16 _nColPos) const
{
if ( _nColPos < m_aFieldInformation.getLength() )
{
- ::std::unique_ptr<OTableFieldDesc> pField( new OTableFieldDesc());
+ rtl::Reference<OTableFieldDesc> pField( new OTableFieldDesc());
pField->Load( m_aFieldInformation[ _nColPos ], false );
return pField->GetColWidth();
}
diff --git a/lotuswordpro/source/filter/xfilter/xfdrawgroup.hxx b/lotuswordpro/source/filter/xfilter/xfdrawgroup.hxx
index d97ae140fa43..722fce1c2a72 100644
--- a/lotuswordpro/source/filter/xfilter/xfdrawgroup.hxx
+++ b/lotuswordpro/source/filter/xfilter/xfdrawgroup.hxx
@@ -87,13 +87,13 @@ public:
virtual void ToXml(IXFStream *pStrm) SAL_OVERRIDE;
private:
- XFContentContainer m_aChildren;
+ rtl::Reference<XFContentContainer> m_aChildren;
};
inline void XFDrawGroup::Add(XFFrame *pFrame)
{
if( pFrame )
- m_aChildren.Add(pFrame);
+ m_aChildren->Add(pFrame);
}
inline void XFDrawGroup::ToXml(IXFStream *pStrm)
@@ -105,7 +105,7 @@ inline void XFDrawGroup::ToXml(IXFStream *pStrm)
pStrm->StartElement( "draw:g" );
- m_aChildren.ToXml(pStrm);
+ m_aChildren->ToXml(pStrm);
pStrm->EndElement( "draw:g" );
diff --git a/lotuswordpro/source/filter/xfilter/xfdrawobj.hxx b/lotuswordpro/source/filter/xfilter/xfdrawobj.hxx
index 32e32c6977e2..d273a5378249 100644
--- a/lotuswordpro/source/filter/xfilter/xfdrawobj.hxx
+++ b/lotuswordpro/source/filter/xfilter/xfdrawobj.hxx
@@ -98,7 +98,7 @@ public:
virtual void ToXml(IXFStream *pStrm) SAL_OVERRIDE;
protected:
- XFContentContainer m_aContents;
+ rtl::Reference<XFContentContainer> m_aContents;
OUString m_strTextStyle;
double m_fRotate;
XFPoint m_aRotatePoint;
diff --git a/lotuswordpro/source/filter/xfilter/xfendnote.hxx b/lotuswordpro/source/filter/xfilter/xfendnote.hxx
index 78243ec61922..1626d2bcbea2 100644
--- a/lotuswordpro/source/filter/xfilter/xfendnote.hxx
+++ b/lotuswordpro/source/filter/xfilter/xfendnote.hxx
@@ -79,7 +79,7 @@ public:
private:
OUString m_strID;
OUString m_strLabel;
- XFContentContainer m_aContents;
+ rtl::Reference<XFContentContainer> m_aContents;
};
inline XFEndNote::XFEndNote()
diff --git a/lotuswordpro/source/filter/xfilter/xfheader.hxx b/lotuswordpro/source/filter/xfilter/xfheader.hxx
index 9a4773a9d07c..5fc150c05441 100644
--- a/lotuswordpro/source/filter/xfilter/xfheader.hxx
+++ b/lotuswordpro/source/filter/xfilter/xfheader.hxx
@@ -81,7 +81,7 @@ public:
pStrm->EndElement( "style:header" );
}
private:
- XFContentContainer m_aContents;
+ rtl::Reference<XFContentContainer> m_aContents;
};
#endif
diff --git a/lotuswordpro/source/filter/xfilter/xftable.cxx b/lotuswordpro/source/filter/xfilter/xftable.cxx
index f9576f032593..13d51934bd64 100644
--- a/lotuswordpro/source/filter/xfilter/xftable.cxx
+++ b/lotuswordpro/source/filter/xfilter/xftable.cxx
@@ -108,7 +108,7 @@ void XFTable::AddHeaderRow(XFRow *pRow)
{
if( !pRow )
return;
- m_aHeaderRows.Add(pRow);
+ m_aHeaderRows->Add(pRow);
}
OUString XFTable::GetTableName()
@@ -207,10 +207,10 @@ void XFTable::ToXml(IXFStream *pStrm)
}
}
- if( m_aHeaderRows.GetCount()>0 )
+ if( m_aHeaderRows->GetCount()>0 )
{
pStrm->StartElement( "table:table-header-rows" );
- m_aHeaderRows.ToXml(pStrm);
+ m_aHeaderRows->ToXml(pStrm);
pStrm->EndElement( "table:table-header-rows" );
}
//output rows:
diff --git a/lotuswordpro/source/filter/xfilter/xftable.hxx b/lotuswordpro/source/filter/xfilter/xftable.hxx
index 844d685966f2..e5caaa3b4320 100644
--- a/lotuswordpro/source/filter/xfilter/xftable.hxx
+++ b/lotuswordpro/source/filter/xfilter/xftable.hxx
@@ -109,7 +109,7 @@ private:
OUString m_strName;
bool m_bSubTable;
XFCell *m_pOwnerCell;
- XFContentContainer m_aHeaderRows;
+ rtl::Reference<XFContentContainer> m_aHeaderRows;
std::map<sal_uInt16, XFRow*> m_aRows;
std::map<sal_Int32,OUString> m_aColumns;
OUString m_strDefCellStyle;
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 6abf4be812cf..a208c38318df 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -1893,7 +1893,7 @@ void ScXMLExport::_ExportStyles( bool bUsed )
sal_Int32 nShapesCount(0);
CollectSharedData(nTableCount, nShapesCount);
}
- ScXMLStyleExport aStylesExp(*this, OUString(), GetAutoStylePool().get());
+ rtl::Reference<ScXMLStyleExport> aStylesExp(new ScXMLStyleExport(*this, OUString(), GetAutoStylePool().get()));
if (GetModel().is())
{
uno::Reference <lang::XMultiServiceFactory> xMultiServiceFactory(GetModel(), uno::UNO_QUERY);
@@ -1901,7 +1901,7 @@ void ScXMLExport::_ExportStyles( bool bUsed )
{
uno::Reference <beans::XPropertySet> xProperties(xMultiServiceFactory->createInstance("com.sun.star.sheet.Defaults"), uno::UNO_QUERY);
if (xProperties.is())
- aStylesExp.exportDefaultStyle(xProperties, OUString(XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME), xCellStylesExportPropertySetMapper);
+ aStylesExp->exportDefaultStyle(xProperties, OUString(XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME), xCellStylesExportPropertySetMapper);
if (pSharedData->HasShapes())
{
GetShapeExport()->ExportGraphicDefaults();
@@ -1934,7 +1934,7 @@ void ScXMLExport::_ExportStyles( bool bUsed )
}
exportDataStyles();
- aStylesExp.exportStyleFamily(OUString("CellStyles"),
+ aStylesExp->exportStyleFamily(OUString("CellStyles"),
OUString(XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME), xCellStylesExportPropertySetMapper, false, XML_STYLE_FAMILY_TABLE_CELL);
SvXMLExport::_ExportStyles(bUsed);
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();
}