diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-02-21 12:34:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-02-21 19:00:26 +0100 |
commit | e150c78cdfbe112bd880107b476ac42e72d4643c (patch) | |
tree | 8f67a46bd60ee89d28d485f0ada90ab7871566cc /reportdesign | |
parent | bb8fb3237c9d1b9516f5803d476c1db09570c2dc (diff) |
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@collabora.co.uk>
Diffstat (limited to 'reportdesign')
7 files changed, 25 insertions, 29 deletions
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; |