[Libreoffice-commits] core.git: package/source pyuno/source reportdesign/source sax/source
Noel (via logerrit)
logerrit at kemper.freedesktop.org
Sun Feb 21 18:01:08 UTC 2021
package/source/manifest/ManifestExport.cxx | 31 ++++--------
package/source/xstor/owriteablestream.cxx | 30 ++++-------
package/source/xstor/xstorage.cxx | 12 +---
package/source/xstor/xstorage.hxx | 2
package/source/zippackage/ZipPackage.cxx | 16 ++----
package/source/zippackage/ZipPackageStream.cxx | 7 --
pyuno/source/module/pyuno_runtime.cxx | 3 -
reportdesign/source/core/api/ReportDefinition.cxx | 8 +--
reportdesign/source/core/api/Section.cxx | 4 -
reportdesign/source/core/sdr/ReportDrawPage.cxx | 13 ++---
reportdesign/source/filter/xml/xmlColumn.cxx | 4 -
reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx | 20 +++----
reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx | 3 -
reportdesign/source/ui/misc/statusbarcontroller.cxx | 2
sax/source/expatwrap/sax_expat.cxx | 4 -
15 files changed, 66 insertions(+), 93 deletions(-)
New commits:
commit e150c78cdfbe112bd880107b476ac42e72d4643c
Author: Noel <noel.grandin at collabora.co.uk>
AuthorDate: Sun Feb 21 12:34:46 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Feb 21 19:00:26 2021 +0100
loplugin:refcounting in package..sax
Change-Id: I83618f54a4117cd81d8626307716129a761e14c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111274
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx
index 2f6f1ea0d913..c3c4be339646 100644
--- a/package/source/manifest/ManifestExport.cxx
+++ b/package/source/manifest/ManifestExport.cxx
@@ -32,6 +32,7 @@
#include <osl/diagnose.h>
#include <rtl/ustrbuf.hxx>
+#include <rtl/ref.hxx>
#include <sal/log.hxx>
#include <comphelper/base64.hxx>
#include <comphelper/documentconstants.hxx>
@@ -119,7 +120,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
const OUString sPBKDF2_Name ( PBKDF2_NAME );
const OUString sPGP_Name ( PGP_NAME );
- ::comphelper::AttributeList * pRootAttrList = new ::comphelper::AttributeList;
+ rtl::Reference<::comphelper::AttributeList> pRootAttrList = new ::comphelper::AttributeList;
// find the mediatype of the document if any
OUString aDocMediaType;
@@ -211,8 +212,6 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
}
}
- uno::Reference < xml::sax::XAttributeList > xRootAttrList (pRootAttrList);
-
xHandler->startDocument();
uno::Reference < xml::sax::XExtendedDocumentHandler > xExtHandler ( xHandler, uno::UNO_QUERY );
if ( xExtHandler.is() && bProvideDTD )
@@ -220,7 +219,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
xExtHandler->unknown ( MANIFEST_DOCTYPE );
xHandler->ignorableWhitespace ( sWhiteSpace );
}
- xHandler->startElement( sManifestElement, xRootAttrList );
+ xHandler->startElement( sManifestElement, pRootAttrList );
const uno::Any *pKeyInfoProperty = nullptr;
if ( pRootFolderPropSeq )
@@ -271,14 +270,13 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
xHandler->startElement(isODF13 ? sEncryptedKeyElement13 : sEncryptedKeyElement, nullptr);
xHandler->ignorableWhitespace ( sWhiteSpace );
- ::comphelper::AttributeList * pNewAttrList = new ::comphelper::AttributeList;
- uno::Reference < xml::sax::XAttributeList > xNewAttrList (pNewAttrList);
+ rtl::Reference<::comphelper::AttributeList> pNewAttrList = new ::comphelper::AttributeList;
// TODO: the algorithm should rather be configurable
pNewAttrList->AddAttribute(
isODF13 ? sAlgorithmAttribute13 : sAlgorithmAttribute,
sCdataAttribute,
"http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p" );
- xHandler->startElement(isODF13 ? sEncryptionMethodElement13 : sEncryptionMethodElement, xNewAttrList);
+ xHandler->startElement(isODF13 ? sEncryptionMethodElement13 : sEncryptionMethodElement, pNewAttrList);
xHandler->endElement(isODF13 ? sEncryptionMethodElement13 : sEncryptionMethodElement);
xHandler->ignorableWhitespace ( sWhiteSpace );
@@ -339,7 +337,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
// now write individual file entries
for (const uno::Sequence<beans::PropertyValue>& rSequence : rManList)
{
- ::comphelper::AttributeList *pAttrList = new ::comphelper::AttributeList;
+ rtl::Reference<::comphelper::AttributeList> pAttrList = new ::comphelper::AttributeList;
OUString aString;
const uno::Any *pVector = nullptr, *pSalt = nullptr, *pIterationCount = nullptr, *pDigest = nullptr, *pDigestAlg = nullptr, *pEncryptAlg = nullptr, *pStartKeyAlg = nullptr, *pDerivedKeySize = nullptr;
for (const beans::PropertyValue& rValue : rSequence)
@@ -386,13 +384,11 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
}
xHandler->ignorableWhitespace ( sWhiteSpace );
- uno::Reference < xml::sax::XAttributeList > xAttrList ( pAttrList );
- xHandler->startElement( sFileEntryElement , xAttrList);
+ xHandler->startElement( sFileEntryElement , pAttrList);
if ( pVector && pSalt && pIterationCount && pDigest && pDigestAlg && pEncryptAlg && pStartKeyAlg && pDerivedKeySize )
{
// ==== Encryption Data
- ::comphelper::AttributeList * pNewAttrList = new ::comphelper::AttributeList;
- uno::Reference < xml::sax::XAttributeList > xNewAttrList (pNewAttrList);
+ rtl::Reference<::comphelper::AttributeList> pNewAttrList = new ::comphelper::AttributeList;
OUStringBuffer aBuffer;
uno::Sequence < sal_Int8 > aSequence;
@@ -414,11 +410,10 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
::comphelper::Base64::encode(aBuffer, aSequence);
pNewAttrList->AddAttribute ( sChecksumAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
- xHandler->startElement( sEncryptionDataElement , xNewAttrList);
+ xHandler->startElement( sEncryptionDataElement , pNewAttrList);
// ==== Algorithm
pNewAttrList = new ::comphelper::AttributeList;
- xNewAttrList = pNewAttrList;
sal_Int32 nEncAlgID = 0;
sal_Int32 nDerivedKeySize = 0;
@@ -448,7 +443,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
pNewAttrList->AddAttribute ( sInitialisationVectorAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
xHandler->ignorableWhitespace ( sWhiteSpace );
- xHandler->startElement( sAlgorithmElement , xNewAttrList);
+ xHandler->startElement( sAlgorithmElement , pNewAttrList);
xHandler->ignorableWhitespace ( sWhiteSpace );
xHandler->endElement( sAlgorithmElement );
@@ -456,7 +451,6 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
{
// ==== Start Key Generation
pNewAttrList = new ::comphelper::AttributeList;
- xNewAttrList = pNewAttrList;
OUString sStartKeyAlg;
OUString sStartKeySize;
@@ -481,14 +475,13 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
pNewAttrList->AddAttribute ( sKeySizeAttribute, sCdataAttribute, sStartKeySize );
xHandler->ignorableWhitespace ( sWhiteSpace );
- xHandler->startElement( sStartKeyGenerationElement , xNewAttrList);
+ xHandler->startElement( sStartKeyGenerationElement , pNewAttrList);
xHandler->ignorableWhitespace ( sWhiteSpace );
xHandler->endElement( sStartKeyGenerationElement );
}
// ==== Key Derivation
pNewAttrList = new ::comphelper::AttributeList;
- xNewAttrList = pNewAttrList;
if (pKeyInfoProperty)
{
@@ -522,7 +515,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
}
xHandler->ignorableWhitespace(sWhiteSpace);
- xHandler->startElement(sKeyDerivationElement, xNewAttrList);
+ xHandler->startElement(sKeyDerivationElement, pNewAttrList);
xHandler->ignorableWhitespace(sWhiteSpace);
xHandler->endElement(sKeyDerivationElement);
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index 77a34c533653..1b914138a0c1 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -1234,14 +1234,9 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre
if ( !xInStream.is() )
throw io::IOException();
- OInputCompStream* pStream = new OInputCompStream( *this, xInStream, InsertOwnProps( m_aProps, m_bUseCommonEncryption ), m_nStorageType );
- uno::Reference< io::XStream > xCompStream(
- static_cast< ::cppu::OWeakObject* >( pStream ),
- uno::UNO_QUERY );
- SAL_WARN_IF( !xCompStream.is(), "package.xstor", "OInputCompStream MUST provide XStream interfaces!" );
-
- m_aInputStreamsVector.push_back( pStream );
- return xCompStream;
+ rtl::Reference<OInputCompStream> pStream = new OInputCompStream( *this, xInStream, InsertOwnProps( m_aProps, m_bUseCommonEncryption ), m_nStorageType );
+ m_aInputStreamsVector.push_back( pStream.get() );
+ return pStream;
}
else if ( ( nStreamMode & embed::ElementModes::READWRITE ) == embed::ElementModes::SEEKABLEREAD )
{
@@ -1256,14 +1251,9 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre
if ( !xInStream.is() )
throw io::IOException();
- OInputSeekStream* pStream = new OInputSeekStream( *this, xInStream, InsertOwnProps( m_aProps, m_bUseCommonEncryption ), m_nStorageType );
- uno::Reference< io::XStream > xSeekStream(
- static_cast< ::cppu::OWeakObject* >( pStream ),
- uno::UNO_QUERY );
- SAL_WARN_IF( !xSeekStream.is(), "package.xstor", "OInputSeekStream MUST provide XStream interfaces!" );
-
- m_aInputStreamsVector.push_back( pStream );
- return xSeekStream;
+ rtl::Reference<OInputSeekStream> pStream = new OInputSeekStream( *this, xInStream, InsertOwnProps( m_aProps, m_bUseCommonEncryption ), m_nStorageType );
+ m_aInputStreamsVector.push_back( pStream.get() );
+ return pStream;
}
else if ( ( nStreamMode & embed::ElementModes::WRITE ) == embed::ElementModes::WRITE )
{
@@ -1308,12 +1298,14 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre
// xStream = GetTempFileAsStream();
}
+ rtl::Reference<OWriteStream> tmp;
if ( !xStream.is() )
- m_pAntiImpl = new OWriteStream( this, bHierarchyAccess );
+ tmp = new OWriteStream( this, bHierarchyAccess );
else
- m_pAntiImpl = new OWriteStream( this, xStream, bHierarchyAccess );
+ tmp = new OWriteStream( this, xStream, bHierarchyAccess );
- return m_pAntiImpl;
+ m_pAntiImpl = tmp.get();
+ return tmp;
}
throw lang::IllegalArgumentException(); // TODO
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index 13e93c9da9ad..6b2a5b02c5d1 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -190,7 +190,6 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XInputStream > const & xInpu
, m_bControlMediaType( false )
, m_bMTFallbackUsed( false )
, m_bControlVersion( false )
-, m_pSwitchStream( nullptr )
, m_nStorageType( nStorageType )
, m_pRelStorElement( nullptr )
, m_nRelInfoStatus( RELINFO_NO_INIT )
@@ -231,7 +230,6 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XStream > const & xStream,
, m_bControlMediaType( false )
, m_bMTFallbackUsed( false )
, m_bControlVersion( false )
-, m_pSwitchStream( nullptr )
, m_nStorageType( nStorageType )
, m_pRelStorElement( nullptr )
, m_nRelInfoStatus( RELINFO_NO_INIT )
@@ -243,7 +241,7 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XStream > const & xStream,
if ( m_nStorageMode & embed::ElementModes::WRITE )
{
m_pSwitchStream = new SwitchablePersistenceStream(xContext, xStream);
- m_xStream = static_cast< io::XStream* >( m_pSwitchStream );
+ m_xStream = static_cast< io::XStream* >( m_pSwitchStream.get() );
}
else
{
@@ -275,7 +273,6 @@ OStorage_Impl::OStorage_Impl( OStorage_Impl* pParent,
, m_bControlMediaType( false )
, m_bMTFallbackUsed( false )
, m_bControlVersion( false )
-, m_pSwitchStream( nullptr )
, m_nStorageType( nStorageType )
, m_pRelStorElement( nullptr )
, m_nRelInfoStatus( RELINFO_NO_INIT )
@@ -1617,8 +1614,7 @@ void OStorage_Impl::CreateRelStorage()
if (!m_pRelStorElement->m_xStorage)
throw uno::RuntimeException( THROW_WHERE );
- OStorage* pResultStorage = new OStorage(m_pRelStorElement->m_xStorage.get(), false);
- m_xRelStorage.set( static_cast<embed::XStorage*>(pResultStorage) );
+ m_xRelStorage = new OStorage(m_pRelStorElement->m_xStorage.get(), false);
}
void OStorage_Impl::CommitStreamRelInfo( std::u16string_view rName, SotElement_Impl const * pStreamElement )
@@ -2408,8 +2404,8 @@ uno::Reference< embed::XStorage > SAL_CALL OStorage::openStorageElement(
throw io::IOException( THROW_WHERE ); // TODO: general_error
bool bReadOnlyWrap = ( ( nStorageMode & embed::ElementModes::WRITE ) != embed::ElementModes::WRITE );
- OStorage* pResultStorage = new OStorage(pElement->m_xStorage.get(), bReadOnlyWrap);
- xResult.set( static_cast<embed::XStorage*>(pResultStorage) );
+ rtl::Reference<OStorage> pResultStorage = new OStorage(pElement->m_xStorage.get(), bReadOnlyWrap);
+ xResult = pResultStorage;
if ( bReadOnlyWrap )
{
diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx
index cddaa7d6fbe1..14d11a8de0b2 100644
--- a/package/source/xstor/xstorage.hxx
+++ b/package/source/xstor/xstorage.hxx
@@ -155,7 +155,7 @@ struct OStorage_Impl
bool m_bControlVersion;
OUString m_aVersion;
- SwitchablePersistenceStream* m_pSwitchStream;
+ rtl::Reference<SwitchablePersistenceStream> m_pSwitchStream;
sal_Int32 m_nStorageType; // the mode in which the storage is used
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index c91947992047..3de64f6502b2 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -558,10 +558,10 @@ void ZipPackage::getZipFileContents()
break;
if ( !pCurrent->hasByName( sTemp ) )
{
- ZipPackageFolder* pPkgFolder = new ZipPackageFolder(m_xContext, m_nFormat, m_bAllowRemoveOnInsert);
+ rtl::Reference<ZipPackageFolder> pPkgFolder = new ZipPackageFolder(m_xContext, m_nFormat, m_bAllowRemoveOnInsert);
pPkgFolder->setName( sTemp );
pPkgFolder->doSetParent( pCurrent );
- pCurrent = pPkgFolder;
+ pCurrent = pPkgFolder.get();
}
else
{
@@ -582,7 +582,7 @@ void ZipPackage::getZipFileContents()
if (!pCurrent->hasByName(sTemp))
{
- ZipPackageStream *pPkgStream = new ZipPackageStream(*this, m_xContext, m_nFormat, m_bAllowRemoveOnInsert);
+ rtl::Reference<ZipPackageStream> pPkgStream = new ZipPackageStream(*this, m_xContext, m_nFormat, m_bAllowRemoveOnInsert);
pPkgStream->SetPackageMember(true);
pPkgStream->setZipEntryOnLoading(rEntry);
pPkgStream->setName(sTemp);
@@ -1056,8 +1056,7 @@ void ZipPackage::WriteManifest( ZipOutputStream& aZipOut, const vector< uno::Seq
// Write the manifest
uno::Reference < XManifestWriter > xWriter = ManifestWriter::create( m_xContext );
ZipEntry * pEntry = new ZipEntry;
- ZipPackageBuffer *pBuffer = new ZipPackageBuffer;
- uno::Reference < XOutputStream > xManOutStream( *pBuffer, UNO_QUERY );
+ rtl::Reference<ZipPackageBuffer> pBuffer = new ZipPackageBuffer;
pEntry->sPath = "META-INF/manifest.xml";
pEntry->nMethod = DEFLATED;
@@ -1065,7 +1064,7 @@ void ZipPackage::WriteManifest( ZipOutputStream& aZipOut, const vector< uno::Seq
pEntry->nSize = pEntry->nCompressedSize = -1;
pEntry->nTime = ZipOutputStream::getCurrentDosTime();
- xWriter->writeManifestSequence ( xManOutStream, comphelper::containerToSequence(aManList) );
+ xWriter->writeManifestSequence ( pBuffer, comphelper::containerToSequence(aManList) );
sal_Int32 nBufferLength = static_cast < sal_Int32 > ( pBuffer->getPosition() );
pBuffer->realloc( nBufferLength );
@@ -1082,8 +1081,7 @@ void ZipPackage::WriteManifest( ZipOutputStream& aZipOut, const vector< uno::Seq
void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< uno::Sequence < PropertyValue > >& aManList )
{
ZipEntry* pEntry = new ZipEntry;
- ZipPackageBuffer *pBuffer = new ZipPackageBuffer;
- uno::Reference< io::XOutputStream > xConTypeOutStream( *pBuffer, UNO_QUERY );
+ rtl::Reference<ZipPackageBuffer> pBuffer = new ZipPackageBuffer;
pEntry->sPath = "[Content_Types].xml";
pEntry->nMethod = DEFLATED;
@@ -1125,7 +1123,7 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< uno:
aOverridesSequence.realloc(nOverSeqLength);
::comphelper::OFOPXMLHelper::WriteContentSequence(
- xConTypeOutStream, aDefaultsSequence, aOverridesSequence, m_xContext );
+ pBuffer, aDefaultsSequence, aOverridesSequence, m_xContext );
sal_Int32 nBufferLength = static_cast < sal_Int32 > ( pBuffer->getPosition() );
pBuffer->realloc( nBufferLength );
diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx
index 962d206ed1cb..fb1794841809 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -285,17 +285,14 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream(
uno::UNO_QUERY_THROW );
// create a package based on it
- ZipPackage* pPackage = new ZipPackage( m_xContext );
- uno::Reference< XSingleServiceFactory > xPackageAsFactory( static_cast< XSingleServiceFactory* >( pPackage ) );
- if ( !xPackageAsFactory.is() )
- throw RuntimeException(THROW_WHERE );
+ rtl::Reference<ZipPackage> pPackage = new ZipPackage( m_xContext );
Sequence< Any > aArgs( 1 );
aArgs[0] <<= xTempStream;
pPackage->initialize( aArgs );
// create a new package stream
- uno::Reference< XDataSinkEncrSupport > xNewPackStream( xPackageAsFactory->createInstance(), UNO_QUERY_THROW );
+ uno::Reference< XDataSinkEncrSupport > xNewPackStream( pPackage->createInstance(), UNO_QUERY_THROW );
xNewPackStream->setDataStream(
new WrapStreamForShare(GetOwnSeekStream(), m_rZipPackage.GetSharedMutexRef()));
diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx
index 4e44245e2827..91caaffb457c 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -28,6 +28,7 @@
#include <osl/process.h>
#include <rtl/ustrbuf.hxx>
#include <rtl/bootstrap.hxx>
+#include <rtl/ref.hxx>
#include <typelib/typedescription.hxx>
@@ -819,7 +820,7 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con
Sequence<Type> interfaces = invokeGetTypes(*this, o);
if (interfaces.getLength())
{
- Adapter *pAdapter = new Adapter( o, interfaces );
+ rtl::Reference<Adapter> pAdapter = new Adapter( o, interfaces );
mappedObject =
getImpl()->cargo->xAdapterFactory->createAdapter(
pAdapter, interfaces );
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index c8d52066c048..119ff9870a1c 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -2473,8 +2473,8 @@ uno::Reference< frame::XTitle > OReportDefinition::impl_getTitleHelper_throw()
uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(m_aProps->m_xContext);
uno::Reference< frame::XModel > xThis(static_cast< frame::XModel* >(this), uno::UNO_QUERY_THROW);
- ::framework::TitleHelper* pHelper = new ::framework::TitleHelper( m_aProps->m_xContext );
- m_pImpl->m_xTitleHelper.set(static_cast< ::cppu::OWeakObject* >(pHelper), uno::UNO_QUERY_THROW);
+ rtl::Reference<::framework::TitleHelper> pHelper = new ::framework::TitleHelper( m_aProps->m_xContext );
+ m_pImpl->m_xTitleHelper = pHelper;
pHelper->setOwner (xThis );
pHelper->connectWithUntitledNumbers (uno::Reference<frame::XUntitledNumbers>(xDesktop, uno::UNO_QUERY_THROW));
}
@@ -2492,8 +2492,8 @@ uno::Reference< frame::XUntitledNumbers > OReportDefinition::impl_getUntitledHel
if ( ! m_pImpl->m_xNumberedControllers.is ())
{
uno::Reference< frame::XModel > xThis(static_cast< frame::XModel* >(this), uno::UNO_QUERY_THROW);
- ::comphelper::NumberedCollection* pHelper = new ::comphelper::NumberedCollection();
- m_pImpl->m_xNumberedControllers.set(static_cast< ::cppu::OWeakObject* >(pHelper), uno::UNO_QUERY_THROW);
+ rtl::Reference<::comphelper::NumberedCollection> pHelper = new ::comphelper::NumberedCollection();
+ m_pImpl->m_xNumberedControllers = pHelper;
pHelper->setOwner (xThis);
pHelper->setUntitledPrefix (" : ");
diff --git a/reportdesign/source/core/api/Section.cxx b/reportdesign/source/core/api/Section.cxx
index 2ff6228b7ade..4744eff5cfa2 100644
--- a/reportdesign/source/core/api/Section.cxx
+++ b/reportdesign/source/core/api/Section.cxx
@@ -79,7 +79,7 @@ uno::Reference<report::XSection> OSection::createOSection(
const uno::Reference< uno::XComponentContext >& context,
bool const bPageSection)
{
- OSection *const pNew =
+ rtl::Reference<OSection> pNew =
new OSection(xParentDef, nullptr, context, lcl_getAbsent(bPageSection));
pNew->init();
return pNew;
@@ -89,7 +89,7 @@ uno::Reference<report::XSection> OSection::createOSection(
const uno::Reference< report::XGroup >& xParentGroup,
const uno::Reference< uno::XComponentContext >& context)
{
- OSection *const pNew =
+ rtl::Reference<OSection> pNew =
new OSection(nullptr, xParentGroup, context, lcl_getGroupAbsent());
pNew->init();
return pNew;
diff --git a/reportdesign/source/core/sdr/ReportDrawPage.cxx b/reportdesign/source/core/sdr/ReportDrawPage.cxx
index 5c8da47c1cc6..0c1e15cebb13 100644
--- a/reportdesign/source/core/sdr/ReportDrawPage.cxx
+++ b/reportdesign/source/core/sdr/ReportDrawPage.cxx
@@ -86,15 +86,14 @@ uno::Reference< drawing::XShape > OReportDrawPage::CreateShape( SdrObject *pObj
}
else
bChangeOrientation = rUnoObj.GetObjIdentifier() == OBJ_RD_HFIXEDLINE;
- SvxShapeControl* pShape = new SvxShapeControl( pObj );
- xShape = static_cast<SvxShape_UnoImplHelper *>(pShape);
+ rtl::Reference<SvxShapeControl> pShape = new SvxShapeControl( pObj );
+ xShape = static_cast<SvxShape_UnoImplHelper *>(pShape.get());
pShape->setShapeKind(pObj->GetObjIdentifier());
}
else if (dynamic_cast< const OCustomShape* >(pObj) != nullptr)
{
- SvxCustomShape* pShape = new SvxCustomShape( pObj );
- uno::Reference < drawing::XEnhancedCustomShapeDefaulter > xShape2 = pShape;
- xShape.set(xShape2,uno::UNO_QUERY);
+ rtl::Reference<SvxCustomShape> pShape = new SvxCustomShape( pObj );
+ xShape = pShape;
pShape->setShapeKind(pObj->GetObjIdentifier());
}
else if (dynamic_cast< const SdrOle2Obj* >(pObj) != nullptr)
@@ -125,8 +124,8 @@ uno::Reference< drawing::XShape > OReportDrawPage::CreateShape( SdrObject *pObj
awt::Size aSz( aTmp.Width(), aTmp.Height() );
xObj->setVisualAreaSize( nAspect, aSz );
}
- SvxOle2Shape* pShape = new SvxOle2Shape( pObj );
- xShape.set(*pShape,uno::UNO_QUERY);
+ rtl::Reference<SvxOle2Shape> pShape = new SvxOle2Shape( pObj );
+ xShape = pShape;
pShape->setShapeKind(pObj->GetObjIdentifier());
}
diff --git a/reportdesign/source/filter/xml/xmlColumn.cxx b/reportdesign/source/filter/xml/xmlColumn.cxx
index 9693ee3ceb0d..da8a6966169b 100644
--- a/reportdesign/source/filter/xml/xmlColumn.cxx
+++ b/reportdesign/source/filter/xml/xmlColumn.cxx
@@ -115,7 +115,7 @@ void OXMLRowColumn::fillStyle(const OUString& _sStyleName)
if ( !pAutoStyles )
return;
- PropertySetInfo* pInfo = new PropertySetInfo();
+ rtl::Reference<PropertySetInfo> pInfo = new PropertySetInfo();
static PropertyMapEntry const pMap[] =
{
{OUString(PROPERTY_WIDTH), PROPERTY_ID_WIDTH, ::cppu::UnoType<sal_Int32>::get() ,PropertyAttribute::BOUND,0},
@@ -124,7 +124,7 @@ void OXMLRowColumn::fillStyle(const OUString& _sStyleName)
{OUString(), 0, css::uno::Type(), 0, 0 }
};
pInfo->add(pMap);
- Reference<XPropertySet> xProp = GenericPropertySet_CreateInstance(pInfo);
+ Reference<XPropertySet> xProp = GenericPropertySet_CreateInstance(pInfo.get());
XMLPropStyleContext* pAutoStyle = const_cast<XMLPropStyleContext*>(dynamic_cast< const XMLPropStyleContext*>(pAutoStyles->FindStyleChildContext(XmlStyleFamily::TABLE_COLUMN,_sStyleName)));
if ( pAutoStyle )
{
diff --git a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx
index 7bd9e8d1bbe3..04409a7d2ab0 100644
--- a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx
+++ b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx
@@ -122,8 +122,7 @@ void SAL_CALL ExportDocumentHandler::startElement(const OUString & _sName, const
bool bExport = true;
if ( _sName == "office:chart" )
{
- SvXMLAttributeList* pList = new SvXMLAttributeList();
- uno::Reference< xml::sax::XAttributeList > xNewAttribs = pList;
+ rtl::Reference<SvXMLAttributeList> pList = new SvXMLAttributeList();
OUStringBuffer sValue;
static const SvXMLEnumMapEntry<sal_uInt16> aXML_CommandTypeEnumMap[] =
{
@@ -149,16 +148,15 @@ void SAL_CALL ExportDocumentHandler::startElement(const OUString & _sName, const
pList->AddAttribute(lcl_createAttribute(XML_NP_OFFICE,XML_MIMETYPE),MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII);
- m_xDelegatee->startElement(lcl_createAttribute(XML_NP_OFFICE,XML_REPORT),xNewAttribs);
+ m_xDelegatee->startElement(lcl_createAttribute(XML_NP_OFFICE,XML_REPORT),pList);
const OUString sTableCalc = lcl_createAttribute(XML_NP_TABLE,XML_CALCULATION_SETTINGS);
m_xDelegatee->startElement(sTableCalc,nullptr);
pList = new SvXMLAttributeList();
- uno::Reference< xml::sax::XAttributeList > xNullAttr = pList;
pList->AddAttribute(lcl_createAttribute(XML_NP_TABLE,XML_DATE_VALUE),"1899-12-30");
const OUString sNullDate = lcl_createAttribute(XML_NP_TABLE,XML_NULL_DATE);
- m_xDelegatee->startElement(sNullDate,xNullAttr);
+ m_xDelegatee->startElement(sNullDate,pList);
m_xDelegatee->endElement(sNullDate);
m_xDelegatee->endElement(sTableCalc);
bExport = false;
@@ -347,8 +345,7 @@ void ExportDocumentHandler::exportTableRows()
const OUString sFormulaAttrib( lcl_createAttribute(XML_NP_RPT,XML_FORMULA) );
static constexpr OUStringLiteral s_sFloat = u"float";
- SvXMLAttributeList* pCellAtt = new SvXMLAttributeList();
- uno::Reference< xml::sax::XAttributeList > xCellAtt = pCellAtt;
+ rtl::Reference<SvXMLAttributeList> pCellAtt = new SvXMLAttributeList();
pCellAtt->AddAttribute(sValueType, "string");
bool bRemoveString = true;
@@ -358,7 +355,7 @@ void ExportDocumentHandler::exportTableRows()
const sal_Int32 nEmptyCellCount = m_nColumnCount - nCount;
for(sal_Int32 i = 0; i < nEmptyCellCount ; ++i)
{
- m_xDelegatee->startElement(sCell,xCellAtt);
+ m_xDelegatee->startElement(sCell,pCellAtt);
if ( bRemoveString )
{
bRemoveString = false;
@@ -373,11 +370,10 @@ void ExportDocumentHandler::exportTableRows()
for(const auto& rColumn : std::as_const(m_aColumns))
{
OUString sFormula = "field:[" + rColumn + "]";
- SvXMLAttributeList* pList = new SvXMLAttributeList();
- uno::Reference< xml::sax::XAttributeList > xAttribs = pList;
+ rtl::Reference<SvXMLAttributeList> pList = new SvXMLAttributeList();
pList->AddAttribute(sFormulaAttrib,sFormula);
- m_xDelegatee->startElement(sCell,xCellAtt);
+ m_xDelegatee->startElement(sCell,pCellAtt);
if ( bRemoveString )
{
bRemoveString = false;
@@ -385,7 +381,7 @@ void ExportDocumentHandler::exportTableRows()
pCellAtt->AddAttribute(sValueType,s_sFloat);
}
m_xDelegatee->startElement(sP,nullptr);
- m_xDelegatee->startElement(sFtext,xAttribs);
+ m_xDelegatee->startElement(sFtext,pList);
m_xDelegatee->startElement(sRElement,nullptr);
m_xDelegatee->startElement(sRComponent,nullptr);
diff --git a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx
index 89e43259f929..933b00dc2fe0 100644
--- a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx
+++ b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx
@@ -36,6 +36,7 @@
#include <xmloff/xmltkmap.hxx>
#include <xmloff/xmlnamespace.hxx>
#include <tools/diagnose_ex.h>
+#include <rtl/ref.hxx>
#include "xmlHelper.hxx"
#include "xmlEnums.hxx"
@@ -269,7 +270,7 @@ void SAL_CALL ImportDocumentHandler::startElement(const OUString & _sName, const
}
}
- SvXMLAttributeList* pList = new SvXMLAttributeList();
+ rtl::Reference<SvXMLAttributeList> pList = new SvXMLAttributeList();
xNewAttribs = pList;
pList->AppendAttributeList(_xAttrList);
pList->AddAttribute("table:cell-range-address","local-table.$A$1:.$Z$65536");
diff --git a/reportdesign/source/ui/misc/statusbarcontroller.cxx b/reportdesign/source/ui/misc/statusbarcontroller.cxx
index 2d7820d2e0e1..ce00f4f654ea 100644
--- a/reportdesign/source/ui/misc/statusbarcontroller.cxx
+++ b/reportdesign/source/ui/misc/statusbarcontroller.cxx
@@ -88,7 +88,7 @@ void SAL_CALL OStatusbarController::initialize( const Sequence< Any >& _rArgumen
}
}
- SfxStatusBarControl *pController = nullptr;
+ rtl::Reference<SfxStatusBarControl> pController;
if ( m_aCommandURL == ".uno:ZoomSlider" )
{
m_nSlotId = SID_ATTR_ZOOMSLIDER;
diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx
index 6017dc354001..b580970f68f3 100644
--- a/sax/source/expatwrap/sax_expat.cxx
+++ b/sax/source/expatwrap/sax_expat.cxx
@@ -357,8 +357,8 @@ SaxExpatParser::SaxExpatParser( )
{
m_pImpl.reset( new SaxExpatParser_Impl );
- LocatorImpl *pLoc = new LocatorImpl( m_pImpl.get() );
- m_pImpl->rDocumentLocator.set( pLoc );
+ rtl::Reference<LocatorImpl> pLoc = new LocatorImpl( m_pImpl.get() );
+ m_pImpl->rDocumentLocator = pLoc;
// Performance-improvement; handing out the same object with every call of
// the startElement callback is allowed (see sax-specification):
More information about the Libreoffice-commits
mailing list