diff options
-rw-r--r-- | forms/source/component/GroupManager.cxx | 4 | ||||
-rw-r--r-- | forms/source/component/GroupManager.hxx | 4 | ||||
-rw-r--r-- | forms/source/richtext/richtextunowrapper.cxx | 3 | ||||
-rw-r--r-- | forms/source/richtext/richtextunowrapper.hxx | 3 | ||||
-rw-r--r-- | formula/source/core/api/token.cxx | 5 | ||||
-rw-r--r-- | formula/source/ui/resource/ModuleHelper.cxx | 8 | ||||
-rw-r--r-- | fpicker/source/office/fpsmartcontent.cxx | 5 | ||||
-rw-r--r-- | fpicker/source/office/fpsmartcontent.hxx | 3 | ||||
-rw-r--r-- | framework/inc/uielement/fontsizemenucontroller.hxx | 4 | ||||
-rw-r--r-- | framework/inc/xml/imagesconfiguration.hxx | 8 | ||||
-rw-r--r-- | framework/source/layoutmanager/layoutmanager.cxx | 5 | ||||
-rw-r--r-- | framework/source/uiconfiguration/imagemanagerimpl.cxx | 2 | ||||
-rw-r--r-- | framework/source/uielement/fontsizemenucontroller.cxx | 8 | ||||
-rw-r--r-- | framework/source/xml/imagesdocumenthandler.cxx | 4 | ||||
-rw-r--r-- | include/formula/token.hxx | 11 |
15 files changed, 37 insertions, 40 deletions
diff --git a/forms/source/component/GroupManager.cxx b/forms/source/component/GroupManager.cxx index e90de941c0d3..615c0558274a 100644 --- a/forms/source/component/GroupManager.cxx +++ b/forms/source/component/GroupManager.cxx @@ -205,8 +205,6 @@ OGroupManager::OGroupManager(const Reference< XContainer >& _rxContainer) OGroupManager::~OGroupManager() { - // delete all Components and CompGroup - delete m_pCompGroup; } // XPropertyChangeListener @@ -215,7 +213,7 @@ void OGroupManager::disposing(const EventObject& evt) throw( RuntimeException, s Reference<XContainer> xContainer(evt.Source, UNO_QUERY); if (xContainer.get() == m_xContainer.get()) { - DELETEZ(m_pCompGroup); + m_pCompGroup.reset(); // delete group m_aGroupArr.clear(); diff --git a/forms/source/component/GroupManager.hxx b/forms/source/component/GroupManager.hxx index 3ede11f1e911..ec6893081375 100644 --- a/forms/source/component/GroupManager.hxx +++ b/forms/source/component/GroupManager.hxx @@ -31,6 +31,7 @@ #include <algorithm> #include <map> +#include <memory> #include <vector> using namespace comphelper; @@ -159,7 +160,8 @@ typedef std::vector<OGroupArr::iterator> OActiveGroups; class OGroupManager : public ::cppu::WeakImplHelper< css::beans::XPropertyChangeListener, css::container::XContainerListener> { - OGroup* m_pCompGroup; // Sort all Components by TabIndices + std::unique_ptr<OGroup> + m_pCompGroup; // Sort all Components by TabIndices OGroupArr m_aGroupArr; // Sort all Components by group OActiveGroups m_aActiveGroupMap; // This map contains all indices of all groups with more than 1 element diff --git a/forms/source/richtext/richtextunowrapper.cxx b/forms/source/richtext/richtextunowrapper.cxx index d6ab326d1d1b..bbc64fda97f3 100644 --- a/forms/source/richtext/richtextunowrapper.cxx +++ b/forms/source/richtext/richtextunowrapper.cxx @@ -79,7 +79,6 @@ namespace frm RichTextEditSource::~RichTextEditSource() { - delete m_pTextForwarder; } @@ -91,7 +90,7 @@ namespace frm SvxTextForwarder* RichTextEditSource::GetTextForwarder() { - return m_pTextForwarder; + return m_pTextForwarder.get(); } diff --git a/forms/source/richtext/richtextunowrapper.hxx b/forms/source/richtext/richtextunowrapper.hxx index 7f2fba8cedf9..3b2ca0c53f47 100644 --- a/forms/source/richtext/richtextunowrapper.hxx +++ b/forms/source/richtext/richtextunowrapper.hxx @@ -54,7 +54,8 @@ namespace frm { private: EditEngine& m_rEngine; - SvxTextForwarder* m_pTextForwarder; + std::unique_ptr<SvxTextForwarder> + m_pTextForwarder; IEngineTextChangeListener* m_pTextChangeListener; public: diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx index f910d7163c35..45031ef42ad9 100644 --- a/formula/source/core/api/token.cxx +++ b/formula/source/core/api/token.cxx @@ -365,18 +365,17 @@ bool FormulaFAPToken::operator==( const FormulaToken& r ) const } -short* FormulaJumpToken::GetJump() const { return pJump; } +short* FormulaJumpToken::GetJump() const { return pJump.get(); } bool FormulaJumpToken::IsInForceArray() const { return bIsInForceArray; } void FormulaJumpToken::SetInForceArray( bool b ) { bIsInForceArray = b; } bool FormulaJumpToken::operator==( const FormulaToken& r ) const { return FormulaToken::operator==( r ) && pJump[0] == r.GetJump()[0] && - memcmp( pJump+1, r.GetJump()+1, pJump[0] * sizeof(short) ) == 0 && + memcmp( pJump.get()+1, r.GetJump()+1, pJump[0] * sizeof(short) ) == 0 && bIsInForceArray == r.IsInForceArray(); } FormulaJumpToken::~FormulaJumpToken() { - delete [] pJump; } diff --git a/formula/source/ui/resource/ModuleHelper.cxx b/formula/source/ui/resource/ModuleHelper.cxx index de87fa8af07a..97fbf86a9534 100644 --- a/formula/source/ui/resource/ModuleHelper.cxx +++ b/formula/source/ui/resource/ModuleHelper.cxx @@ -43,7 +43,7 @@ namespace formula */ class OModuleImpl { - ResMgr* m_pResources; + std::unique_ptr<ResMgr> m_pResources; public: /// ctor @@ -55,14 +55,12 @@ public: }; OModuleImpl::OModuleImpl() - :m_pResources(nullptr) { } OModuleImpl::~OModuleImpl() { - delete m_pResources; } @@ -73,9 +71,9 @@ ResMgr* OModuleImpl::getResManager() if (!m_pResources) { // create a manager with a fixed prefix - m_pResources = ResMgr::CreateResMgr("forui"); + m_pResources.reset( ResMgr::CreateResMgr("forui") ); } - return m_pResources; + return m_pResources.get(); } diff --git a/fpicker/source/office/fpsmartcontent.cxx b/fpicker/source/office/fpsmartcontent.cxx index fc5af8d4af06..7e068be975ac 100644 --- a/fpicker/source/office/fpsmartcontent.cxx +++ b/fpicker/source/office/fpsmartcontent.cxx @@ -76,7 +76,6 @@ namespace svt TODO: If there is real need for caching the content, it must be done here. */ - delete m_pContent; } @@ -145,7 +144,7 @@ namespace svt // nothing to do, regardless of the state return; - DELETEZ( m_pContent ); + m_pContent.reset(); m_eState = INVALID; // default to INVALID m_sURL = _rURL; @@ -153,7 +152,7 @@ namespace svt { try { - m_pContent = new ::ucbhelper::Content( _rURL, m_xCmdEnv, comphelper::getProcessComponentContext() ); + m_pContent.reset( new ::ucbhelper::Content( _rURL, m_xCmdEnv, comphelper::getProcessComponentContext() ) ); m_eState = UNKNOWN; // from now on, the state is unknown -> we cannot know for sure if the content // is really valid (some UCP's only tell this when asking for properties, not upon diff --git a/fpicker/source/office/fpsmartcontent.hxx b/fpicker/source/office/fpsmartcontent.hxx index e20acb0089fa..9606e1166f3c 100644 --- a/fpicker/source/office/fpsmartcontent.hxx +++ b/fpicker/source/office/fpsmartcontent.hxx @@ -25,6 +25,7 @@ #include <com/sun/star/ucb/XCommandEnvironment.hpp> #include <com/sun/star/task/XInteractionHandler.hpp> #include <ucbhelper/content.hxx> +#include <memory> namespace svt @@ -49,7 +50,7 @@ namespace svt private: OUString m_sURL; - ::ucbhelper::Content* m_pContent; + std::unique_ptr<::ucbhelper::Content> m_pContent; State m_eState; css::uno::Reference < css::ucb::XCommandEnvironment > m_xCmdEnv; css::uno::Reference < css::task::XInteractionHandler > m_xOwnInteraction; diff --git a/framework/inc/uielement/fontsizemenucontroller.hxx b/framework/inc/uielement/fontsizemenucontroller.hxx index 13673a971816..af4e3ca44001 100644 --- a/framework/inc/uielement/fontsizemenucontroller.hxx +++ b/framework/inc/uielement/fontsizemenucontroller.hxx @@ -38,6 +38,8 @@ #include <cppuhelper/weak.hxx> #include <rtl/ustring.hxx> +#include <memory> + namespace framework { class FontSizeMenuController : public svt::PopupMenuControllerBase @@ -66,7 +68,7 @@ namespace framework void fillPopupMenu( css::uno::Reference< css::awt::XPopupMenu >& rPopupMenu ); OUString retrievePrinterName( css::uno::Reference< css::frame::XFrame >& rFrame ); - long* m_pHeightArray; + std::unique_ptr<long[]> m_pHeightArray; css::awt::FontDescriptor m_aFontDescriptor; css::frame::status::FontHeight m_aFontHeight; css::uno::Reference< css::frame::XDispatch > m_xCurrentFontDispatch; diff --git a/framework/inc/xml/imagesconfiguration.hxx b/framework/inc/xml/imagesconfiguration.hxx index 61778f081687..44b42a1c46ad 100644 --- a/framework/inc/xml/imagesconfiguration.hxx +++ b/framework/inc/xml/imagesconfiguration.hxx @@ -60,16 +60,16 @@ typedef std::vector<std::unique_ptr<ExternalImageItemDescriptor> > ExternalImage struct ImageListItemDescriptor { - ImageListItemDescriptor() : nMaskMode( ImageMaskMode_Color ), - pImageItemList( nullptr ) {} + ImageListItemDescriptor() : nMaskMode( ImageMaskMode_Color ) {} - ~ImageListItemDescriptor() { delete pImageItemList; } + ~ImageListItemDescriptor() {} OUString aURL; // an URL to a bitmap with several images inside Color aMaskColor; // a color used as transparent OUString aMaskURL; // an URL to an optional bitmap used as a mask ImageMaskMode nMaskMode; // an enum to describe the current mask mode - ImageItemListDescriptor* pImageItemList; // an array of ImageItemDescriptors that describes every image + std::unique_ptr<ImageItemListDescriptor> + pImageItemList; // an array of ImageItemDescriptors that describes every image OUString aHighContrastURL; // an URL to an optional high contrast bitmap with serveral images inside OUString aHighContrastMaskURL; // an URL to an optional high contrast bitmap as a mask }; diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 756205886d34..711f39b301b7 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -3153,17 +3153,16 @@ namespace detail class InfoHelperBuilder { private: - ::cppu::OPropertyArrayHelper *m_pInfoHelper; + std::unique_ptr<::cppu::OPropertyArrayHelper> m_pInfoHelper; public: explicit InfoHelperBuilder(const LayoutManager &rManager) { uno::Sequence< beans::Property > aProperties; rManager.describeProperties(aProperties); - m_pInfoHelper = new ::cppu::OPropertyArrayHelper(aProperties, true); + m_pInfoHelper.reset( new ::cppu::OPropertyArrayHelper(aProperties, true) ); } ~InfoHelperBuilder() { - delete m_pInfoHelper; } InfoHelperBuilder(const InfoHelperBuilder&) = delete; InfoHelperBuilder& operator=(const InfoHelperBuilder&) = delete; diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx index d900733a5995..89583b33d7fa 100644 --- a/framework/source/uiconfiguration/imagemanagerimpl.cxx +++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx @@ -403,7 +403,7 @@ bool ImageManagerImpl::implts_storeUserImages( ImageListItemDescriptor* pList = new ImageListItemDescriptor; aUserImageListInfo.pImageList->push_back( std::unique_ptr<ImageListItemDescriptor>(pList) ); - pList->pImageItemList = new ImageItemListDescriptor; + pList->pImageItemList.reset( new ImageItemListDescriptor ); for ( sal_uInt16 i=0; i < pImageList->GetImageCount(); i++ ) { ImageItemDescriptor* pItem = new ImageItemDescriptor; diff --git a/framework/source/uielement/fontsizemenucontroller.cxx b/framework/source/uielement/fontsizemenucontroller.cxx index 75f47e42c53b..8345f0f31a92 100644 --- a/framework/source/uielement/fontsizemenucontroller.cxx +++ b/framework/source/uielement/fontsizemenucontroller.cxx @@ -59,14 +59,12 @@ DEFINE_XSERVICEINFO_MULTISERVICE_2 ( FontSizeMenuController DEFINE_INIT_SERVICE ( FontSizeMenuController, {} ) FontSizeMenuController::FontSizeMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : - svt::PopupMenuControllerBase( xContext ), - m_pHeightArray( nullptr ) + svt::PopupMenuControllerBase( xContext ) { } FontSizeMenuController::~FontSizeMenuController() { - delete []m_pHeightArray; } // private function @@ -155,7 +153,7 @@ void FontSizeMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r FontMetric aFontMetric = pFontList->Get( m_aFontDescriptor.Name, m_aFontDescriptor.StyleName ); // setup font size array - delete m_pHeightArray; + m_pHeightArray.reset(); const sal_IntPtr* pTempAry; const sal_IntPtr* pAry = pFontList->GetSizeAry( aFontMetric ); @@ -169,7 +167,7 @@ void FontSizeMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r // first insert font size names (for simplified/traditional chinese) float fPoint; FontSizeNames aFontSizeNames( Application::GetSettings().GetUILanguageTag().getLanguageType() ); - m_pHeightArray = new long[nSizeCount+aFontSizeNames.Count()]; + m_pHeightArray.reset( new long[nSizeCount+aFontSizeNames.Count()] ); OUString aCommand; if ( !aFontSizeNames.IsEmpty() ) diff --git a/framework/source/xml/imagesdocumenthandler.cxx b/framework/source/xml/imagesdocumenthandler.cxx index f0b2a196e052..96ff940024ae 100644 --- a/framework/source/xml/imagesdocumenthandler.cxx +++ b/framework/source/xml/imagesdocumenthandler.cxx @@ -302,7 +302,7 @@ void SAL_CALL OReadImagesDocumentHandler::startElement( } if ( !m_pImages->pImageItemList ) - m_pImages->pImageItemList = new ImageItemListDescriptor; + m_pImages->pImageItemList.reset( new ImageItemListDescriptor ); m_bImageStartFound = true; @@ -717,7 +717,7 @@ void OWriteImagesDocumentHandler::WriteImageList( const ImageListItemDescriptor* m_xWriteDocumentHandler->startElement( ELEMENT_NS_IMAGES, xList ); m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - ImageItemListDescriptor* pImageItemList = pImageList->pImageItemList; + ImageItemListDescriptor* pImageItemList = pImageList->pImageItemList.get(); if ( pImageItemList ) { for (std::unique_ptr<ImageItemDescriptor> & i : *pImageItemList) diff --git a/include/formula/token.hxx b/include/formula/token.hxx index a2376bc0fc28..2405b66b2e4e 100644 --- a/include/formula/token.hxx +++ b/include/formula/token.hxx @@ -388,22 +388,23 @@ public: class FORMULA_DLLPUBLIC FormulaJumpToken : public FormulaToken { private: - short* pJump; + std::unique_ptr<short[]> + pJump; bool bIsInForceArray; public: FormulaJumpToken( OpCode e, short* p ) : FormulaToken( formula::svJump , e), bIsInForceArray( false) { - pJump = new short[ p[0] + 1 ]; - memcpy( pJump, p, (p[0] + 1) * sizeof(short) ); + pJump.reset( new short[ p[0] + 1 ] ); + memcpy( pJump.get(), p, (p[0] + 1) * sizeof(short) ); } FormulaJumpToken( const FormulaJumpToken& r ) : FormulaToken( r ), bIsInForceArray( r.bIsInForceArray) { - pJump = new short[ r.pJump[0] + 1 ]; - memcpy( pJump, r.pJump, (r.pJump[0] + 1) * sizeof(short) ); + pJump.reset( new short[ r.pJump[0] + 1 ] ); + memcpy( pJump.get(), r.pJump.get(), (r.pJump[0] + 1) * sizeof(short) ); } virtual ~FormulaJumpToken() override; virtual short* GetJump() const override; |