diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-02-21 13:32:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-02-21 16:11:48 +0100 |
commit | 897970cd0b9709258b6b5b5fc05dba2e74a72b7c (patch) | |
tree | 45bd0da067e508cd233ca959b4d8bb7317260416 /framework/source/fwe | |
parent | 6b6f9fb71fa1bfcb438b89596e6f19529cfe1eba (diff) |
loplugin:refcounting in framework
Change-Id: I2d7d14fe0335689e4a338c70587bf33137ed1ddd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111279
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework/source/fwe')
4 files changed, 13 insertions, 19 deletions
diff --git a/framework/source/fwe/xml/menudocumenthandler.cxx b/framework/source/fwe/xml/menudocumenthandler.cxx index d1fd63bc2b3b..7e697a667dd1 100644 --- a/framework/source/fwe/xml/menudocumenthandler.cxx +++ b/framework/source/fwe/xml/menudocumenthandler.cxx @@ -717,8 +717,7 @@ OWriteMenuDocumentHandler::OWriteMenuDocumentHandler( m_xWriteDocumentHandler( rDocumentHandler ), m_bIsMenuBar( bIsMenuBar ) { - ::comphelper::AttributeList* pList = new ::comphelper::AttributeList; - m_xEmptyList.set( static_cast<XAttributeList *>(pList), UNO_QUERY ); + m_xEmptyList = new ::comphelper::AttributeList; m_aAttributeType = ATTRIBUTE_TYPE_CDATA; } @@ -789,8 +788,7 @@ void OWriteMenuDocumentHandler::WriteMenu( const Reference< XIndexAccess >& rMen { if ( !aCommandURL.isEmpty() ) { - ::comphelper::AttributeList* pListMenu = new ::comphelper::AttributeList; - Reference< XAttributeList > xListMenu( static_cast<XAttributeList *>(pListMenu) , UNO_QUERY ); + rtl::Reference<::comphelper::AttributeList> pListMenu = new ::comphelper::AttributeList; pListMenu->AddAttribute( ATTRIBUTE_NS_ID, m_aAttributeType, @@ -802,7 +800,7 @@ void OWriteMenuDocumentHandler::WriteMenu( const Reference< XIndexAccess >& rMen aLabel ); m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - m_xWriteDocumentHandler->startElement( ELEMENT_NS_MENU, xListMenu ); + m_xWriteDocumentHandler->startElement( ELEMENT_NS_MENU, pListMenu ); m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); m_xWriteDocumentHandler->startElement( ELEMENT_NS_MENUPOPUP, m_xEmptyList ); m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); @@ -840,8 +838,7 @@ void OWriteMenuDocumentHandler::WriteMenu( const Reference< XIndexAccess >& rMen void OWriteMenuDocumentHandler::WriteMenuItem( const OUString& aCommandURL, const OUString& aLabel, const OUString& aHelpURL, sal_Int16 nStyle ) { - ::comphelper::AttributeList* pList = new ::comphelper::AttributeList; - Reference< XAttributeList > xList( static_cast<XAttributeList *>(pList) , UNO_QUERY ); + rtl::Reference<::comphelper::AttributeList> pList = new ::comphelper::AttributeList; pList->AddAttribute( ATTRIBUTE_NS_ID, m_aAttributeType, @@ -880,7 +877,7 @@ void OWriteMenuDocumentHandler::WriteMenuItem( const OUString& aCommandURL, cons } m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - m_xWriteDocumentHandler->startElement( ELEMENT_NS_MENUITEM, xList ); + m_xWriteDocumentHandler->startElement( ELEMENT_NS_MENUITEM, pList ); m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); m_xWriteDocumentHandler->endElement( ELEMENT_NS_MENUITEM ); } diff --git a/framework/source/fwe/xml/saxnamespacefilter.cxx b/framework/source/fwe/xml/saxnamespacefilter.cxx index 5a05dfb54e43..18baa687422b 100644 --- a/framework/source/fwe/xml/saxnamespacefilter.cxx +++ b/framework/source/fwe/xml/saxnamespacefilter.cxx @@ -27,6 +27,7 @@ #include <xml/saxnamespacefilter.hxx> #include <comphelper/attributelist.hxx> +#include <rtl/ref.hxx> using namespace ::com::sun::star::xml::sax; using namespace ::com::sun::star::uno; @@ -58,7 +59,7 @@ void SAL_CALL SaxNamespaceFilter::startElement( if ( !m_aNamespaceStack.empty() ) aXMLNamespaces = m_aNamespaceStack.top(); - ::comphelper::AttributeList* pNewList = new ::comphelper::AttributeList(); + rtl::Reference<::comphelper::AttributeList> pNewList = new ::comphelper::AttributeList(); // examine all namespaces for this level ::std::vector< sal_Int16 > aAttributeIndexes; diff --git a/framework/source/fwe/xml/statusbardocumenthandler.cxx b/framework/source/fwe/xml/statusbardocumenthandler.cxx index 36cf5da27a48..a6f157ba21b9 100644 --- a/framework/source/fwe/xml/statusbardocumenthandler.cxx +++ b/framework/source/fwe/xml/statusbardocumenthandler.cxx @@ -476,8 +476,7 @@ OWriteStatusBarDocumentHandler::OWriteStatusBarDocumentHandler( m_aStatusBarItems( aStatusBarItems ), m_xWriteDocumentHandler( rWriteDocumentHandler ) { - ::comphelper::AttributeList* pList = new ::comphelper::AttributeList; - m_xEmptyList.set( static_cast<XAttributeList *>(pList), UNO_QUERY ); + m_xEmptyList = new ::comphelper::AttributeList; m_aAttributeType = ATTRIBUTE_TYPE_CDATA; m_aXMLXlinkNS = XMLNS_XLINK_PREFIX; m_aXMLStatusBarNS = XMLNS_STATUSBAR_PREFIX; @@ -556,8 +555,7 @@ void OWriteStatusBarDocumentHandler::WriteStatusBarItem( sal_Int16 nStyle, sal_Int16 nWidth ) { - ::comphelper::AttributeList* pList = new ::comphelper::AttributeList; - Reference< XAttributeList > xList( static_cast<XAttributeList *>(pList) , UNO_QUERY ); + rtl::Reference<::comphelper::AttributeList> pList = new ::comphelper::AttributeList; if (m_aAttributeURL.isEmpty() ) { @@ -642,7 +640,7 @@ void OWriteStatusBarDocumentHandler::WriteStatusBarItem( } m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - m_xWriteDocumentHandler->startElement( ELEMENT_NS_STATUSBARITEM, xList ); + m_xWriteDocumentHandler->startElement( ELEMENT_NS_STATUSBARITEM, pList ); m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); m_xWriteDocumentHandler->endElement( ELEMENT_NS_STATUSBARITEM ); } diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx index 386da1bc7f53..401a08fbeca1 100644 --- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx +++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx @@ -577,8 +577,7 @@ OWriteToolBoxDocumentHandler::OWriteToolBoxDocumentHandler( m_xWriteDocumentHandler( rWriteDocumentHandler ), m_rItemAccess( rItemAccess ) { - ::comphelper::AttributeList* pList = new ::comphelper::AttributeList; - m_xEmptyList.set( static_cast<XAttributeList *>(pList), UNO_QUERY ); + m_xEmptyList = new ::comphelper::AttributeList; m_aAttributeType = ATTRIBUTE_TYPE_CDATA; m_aXMLXlinkNS = XMLNS_XLINK_PREFIX; m_aXMLToolbarNS = XMLNS_TOOLBAR_PREFIX; @@ -674,8 +673,7 @@ void OWriteToolBoxDocumentHandler::WriteToolBoxItem( sal_Int16 nStyle, bool bVisible ) { - ::comphelper::AttributeList* pList = new ::comphelper::AttributeList; - Reference< XAttributeList > xList( static_cast<XAttributeList *>(pList) , UNO_QUERY ); + rtl::Reference<::comphelper::AttributeList> pList = new ::comphelper::AttributeList; if ( m_aAttributeURL.isEmpty() ) { @@ -719,7 +717,7 @@ void OWriteToolBoxDocumentHandler::WriteToolBoxItem( } m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - m_xWriteDocumentHandler->startElement( ELEMENT_NS_TOOLBARITEM, xList ); + m_xWriteDocumentHandler->startElement( ELEMENT_NS_TOOLBARITEM, pList ); m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); m_xWriteDocumentHandler->endElement( ELEMENT_NS_TOOLBARITEM ); } |