[Libreoffice-commits] core.git: sfx2/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Jan 24 12:51:37 UTC 2020


 sfx2/source/appl/newhelp.cxx     |    2 +-
 sfx2/source/bastyp/fltfnc.cxx    |    4 ++--
 sfx2/source/doc/docfile.cxx      |    4 ++--
 sfx2/source/doc/docinsert.cxx    |    2 +-
 sfx2/source/doc/docmacromode.cxx |    2 +-
 sfx2/source/doc/oleprops.cxx     |   32 ++++++++++++++++----------------
 sfx2/source/doc/oleprops.hxx     |    4 ++--
 sfx2/source/doc/sfxbasemodel.cxx |    4 ++--
 8 files changed, 27 insertions(+), 27 deletions(-)

New commits:
commit a5e2555632a2105274d130ad115573be36f863b8
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jan 24 12:05:07 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jan 24 13:51:04 2020 +0100

    loplugin:makeshared in sfx2
    
    Change-Id: I54492b9c9bb7aaf4aed4846c68ff3545695430f6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87331
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 44f6d04c3821..7f7ae61767f1 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -2550,7 +2550,7 @@ void SfxHelpTextWindow_Impl::DoSearch()
         return;
 
     // create the search dialog
-    m_xSrchDlg.reset(new sfx2::SearchDialog(pTextWin->GetFrameWeld(), "HelpSearchDialog"));
+    m_xSrchDlg = std::make_shared<sfx2::SearchDialog>(pTextWin->GetFrameWeld(), "HelpSearchDialog");
     // set handler
     m_xSrchDlg->SetFindHdl( LINK( this, SfxHelpTextWindow_Impl, FindHdl ) );
     m_xSrchDlg->SetCloseHdl( LINK( this, SfxHelpTextWindow_Impl, CloseHdl ) );
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx
index e83edf00f776..060dd47a3d9f 100644
--- a/sfx2/source/bastyp/fltfnc.cxx
+++ b/sfx2/source/bastyp/fltfnc.cxx
@@ -1018,7 +1018,7 @@ void SfxFilterContainer::ReadSingleFilter_Impl(
     std::shared_ptr<const SfxFilter> pFilter = bUpdate ? SfxFilter::GetFilterByName( sFilterName ) : nullptr;
     if (!pFilter)
     {
-        pFilter.reset(new SfxFilter( sFilterName             ,
+        pFilter = std::make_shared<SfxFilter>( sFilterName             ,
                                  sExtension              ,
                                  nFlags                  ,
                                  nClipboardId            ,
@@ -1026,7 +1026,7 @@ void SfxFilterContainer::ReadSingleFilter_Impl(
                                  sMimeType               ,
                                  sUserData               ,
                                  sServiceName            ,
-                                 bEnabled ));
+                                 bEnabled );
         rList.push_back( pFilter );
     }
     else
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 06302d39f280..3e103460be1b 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -3240,7 +3240,7 @@ SfxMedium::SfxMedium( const uno::Sequence<beans::PropertyValue>& aArgs ) :
     else
     {
         // This filter is from an external provider such as orcus.
-        pImpl->m_pCustomFilter.reset(new SfxFilter(aFilterProvider, aFilterName));
+        pImpl->m_pCustomFilter = std::make_shared<SfxFilter>(aFilterProvider, aFilterName);
         pImpl->m_pFilter = pImpl->m_pCustomFilter;
     }
 
@@ -3405,7 +3405,7 @@ SfxItemSet* SfxMedium::GetItemSet() const
 {
     // this method *must* return an ItemSet, returning NULL can cause crashes
     if (!pImpl->m_pSet)
-        pImpl->m_pSet.reset( new SfxAllItemSet( SfxGetpApp()->GetPool() ) );
+        pImpl->m_pSet = std::make_shared<SfxAllItemSet>( SfxGetpApp()->GetPool() );
     return pImpl->m_pSet.get();
 }
 
diff --git a/sfx2/source/doc/docinsert.cxx b/sfx2/source/doc/docinsert.cxx
index 4114f61f538e..3d585992307b 100644
--- a/sfx2/source/doc/docinsert.cxx
+++ b/sfx2/source/doc/docinsert.cxx
@@ -194,7 +194,7 @@ IMPL_LINK_NOARG(DocumentInserter, DialogClosedHdl, sfx2::FileDialogHelper*, void
     if ( xCtrlAccess.is() )
     {
         // always create a new itemset
-        m_xItemSet.reset(new SfxAllItemSet( SfxGetpApp()->GetPool() ));
+        m_xItemSet = std::make_shared<SfxAllItemSet>( SfxGetpApp()->GetPool() );
 
         short nDlgType = m_pFileDlg->GetDialogType();
         bool bHasPassword = (
diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx
index bfffdeac3e11..bbb3b629de2b 100644
--- a/sfx2/source/doc/docmacromode.cxx
+++ b/sfx2/source/doc/docmacromode.cxx
@@ -123,7 +123,7 @@ namespace sfx2
 
     //= DocumentMacroMode
     DocumentMacroMode::DocumentMacroMode( IMacroDocumentAccess& rDocumentAccess )
-        :m_xData( new DocumentMacroMode_Data( rDocumentAccess ) )
+        :m_xData( std::make_shared<DocumentMacroMode_Data>( rDocumentAccess ) )
     {
     }
 
diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx
index 57ece53ea78d..3267c58dc877 100644
--- a/sfx2/source/doc/oleprops.cxx
+++ b/sfx2/source/doc/oleprops.cxx
@@ -799,33 +799,33 @@ void SfxOleSection::SetProperty( const SfxOlePropertyRef& xProp )
 
 void SfxOleSection::SetInt32Value( sal_Int32 nPropId, sal_Int32 nValue )
 {
-    SetProperty( SfxOlePropertyRef( new SfxOleInt32Property( nPropId, nValue ) ) );
+    SetProperty( std::make_shared<SfxOleInt32Property>( nPropId, nValue ) );
 }
 
 void SfxOleSection::SetDoubleValue( sal_Int32 nPropId, double fValue )
 {
-    SetProperty( SfxOlePropertyRef( new SfxOleDoubleProperty( nPropId, fValue ) ) );
+    SetProperty( std::make_shared<SfxOleDoubleProperty>( nPropId, fValue ) );
 }
 
 void SfxOleSection::SetBoolValue( sal_Int32 nPropId, bool bValue )
 {
-    SetProperty( SfxOlePropertyRef( new SfxOleBoolProperty( nPropId, bValue ) ) );
+    SetProperty( std::make_shared<SfxOleBoolProperty>( nPropId, bValue ) );
 }
 
 bool SfxOleSection::SetStringValue( sal_Int32 nPropId, const OUString& rValue )
 {
     bool bInserted = !rValue.isEmpty();
     if( bInserted )
-        SetProperty( SfxOlePropertyRef( new SfxOleString8Property( nPropId, maCodePageProp, rValue ) ) );
+        SetProperty( std::make_shared<SfxOleString8Property>( nPropId, maCodePageProp, rValue ) );
     return bInserted;
 }
 
 void SfxOleSection::SetFileTimeValue( sal_Int32 nPropId, const util::DateTime& rValue )
 {
     if ( rValue.Year == 0 || rValue.Month == 0 || rValue.Day == 0 )
-        SetProperty( SfxOlePropertyRef( new SfxOleFileTimeProperty( nPropId, TIMESTAMP_INVALID_UTILDATETIME ) ) );
+        SetProperty( std::make_shared<SfxOleFileTimeProperty>( nPropId, TIMESTAMP_INVALID_UTILDATETIME ) );
     else
-        SetProperty( SfxOlePropertyRef( new SfxOleFileTimeProperty( nPropId, rValue ) ) );
+        SetProperty( std::make_shared<SfxOleFileTimeProperty>( nPropId, rValue ) );
 }
 
 void SfxOleSection::SetDateValue( sal_Int32 nPropId, const util::Date& rValue )
@@ -833,12 +833,12 @@ void SfxOleSection::SetDateValue( sal_Int32 nPropId, const util::Date& rValue )
     //Annoyingly MS2010 considers VT_DATE apparently as an invalid possibility, so here we use VT_FILETIME
     //instead :-(
     if ( rValue.Year == 0 || rValue.Month == 0 || rValue.Day == 0 )
-        SetProperty( SfxOlePropertyRef( new SfxOleFileTimeProperty( nPropId, TIMESTAMP_INVALID_UTILDATETIME ) ) );
+        SetProperty( std::make_shared<SfxOleFileTimeProperty>( nPropId, TIMESTAMP_INVALID_UTILDATETIME ) );
     else
     {
         const util::DateTime aValue(0, 0, 0, 0, rValue.Day, rValue.Month,
                 rValue.Year, false );
-        SetProperty( SfxOlePropertyRef( new SfxOleFileTimeProperty( nPropId, aValue ) ) );
+        SetProperty( std::make_shared<SfxOleFileTimeProperty>( nPropId, aValue ) );
     }
 }
 
@@ -1043,25 +1043,25 @@ void SfxOleSection::LoadProperty( SvStream& rStrm, sal_Int32 nPropId )
     switch( nPropType )
     {
         case PROPTYPE_INT32:
-            xProp.reset( new SfxOleInt32Property( nPropId ) );
+            xProp = std::make_shared<SfxOleInt32Property>( nPropId );
         break;
         case PROPTYPE_DOUBLE:
-            xProp.reset( new SfxOleDoubleProperty( nPropId ) );
+            xProp = std::make_shared<SfxOleDoubleProperty>( nPropId );
         break;
         case PROPTYPE_BOOL:
-            xProp.reset( new SfxOleBoolProperty( nPropId ) );
+            xProp = std::make_shared<SfxOleBoolProperty>( nPropId );
         break;
         case PROPTYPE_STRING8:
-            xProp.reset( new SfxOleString8Property( nPropId, maCodePageProp ) );
+            xProp = std::make_shared<SfxOleString8Property>( nPropId, maCodePageProp );
         break;
         case PROPTYPE_STRING16:
-            xProp.reset( new SfxOleString16Property( nPropId ) );
+            xProp = std::make_shared<SfxOleString16Property>( nPropId );
         break;
         case PROPTYPE_FILETIME:
-            xProp.reset( new SfxOleFileTimeProperty( nPropId ) );
+            xProp = std::make_shared<SfxOleFileTimeProperty>( nPropId );
         break;
         case PROPTYPE_DATE:
-            xProp.reset( new SfxOleDateProperty( nPropId ) );
+            xProp = std::make_shared<SfxOleDateProperty>( nPropId );
         break;
     }
     // load property contents
@@ -1149,7 +1149,7 @@ SfxOleSection& SfxOlePropertySet::AddSection( const SvGlobalName& rSectionGuid )
     {
         // #i66214# #i66428# applications may write broken dictionary properties in wrong sections
         bool bSupportsDict = rSectionGuid == GetSectionGuid( SECTION_CUSTOM );
-        xSection.reset( new SfxOleSection( bSupportsDict ) );
+        xSection = std::make_shared<SfxOleSection>( bSupportsDict );
         maSectionMap[ rSectionGuid ] = xSection;
     }
     return *xSection;
diff --git a/sfx2/source/doc/oleprops.hxx b/sfx2/source/doc/oleprops.hxx
index b9b742676cd2..de19ff4b530f 100644
--- a/sfx2/source/doc/oleprops.hxx
+++ b/sfx2/source/doc/oleprops.hxx
@@ -100,9 +100,9 @@ class SfxOleTextEncoding
 {
 public:
     explicit     SfxOleTextEncoding() :
-                            mxTextEnc( new rtl_TextEncoding( osl_getThreadTextEncoding() ) ) {}
+                            mxTextEnc( std::make_shared<rtl_TextEncoding>( osl_getThreadTextEncoding() ) ) {}
     explicit     SfxOleTextEncoding( rtl_TextEncoding eTextEnc ) :
-                            mxTextEnc( new rtl_TextEncoding( eTextEnc ) ) {}
+                            mxTextEnc( std::make_shared<rtl_TextEncoding>( eTextEnc ) ) {}
 
     /** Returns the current text encoding identifier. */
     rtl_TextEncoding GetTextEncoding() const { return *mxTextEnc; }
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index aa19c4f3dcde..0446ee82ac50 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -501,7 +501,7 @@ SfxSaveGuard::~SfxSaveGuard()
 
 SfxBaseModel::SfxBaseModel( SfxObjectShell *pObjectShell )
 : BaseMutex()
-, m_pData( new IMPL_SfxBaseModel_DataContainer( m_aMutex, pObjectShell ) )
+, m_pData( std::make_shared<IMPL_SfxBaseModel_DataContainer>( m_aMutex, pObjectShell ) )
 , m_bSupportEmbeddedScripts( pObjectShell && pObjectShell->Get_Impl() && !pObjectShell->Get_Impl()->m_bNoBasicCapabilities )
 , m_bSupportDocRecovery( pObjectShell && pObjectShell->Get_Impl() && pObjectShell->Get_Impl()->m_bDocRecoverySupport )
 {
@@ -3484,7 +3484,7 @@ void SfxBaseModel::getGrabBagItem(css::uno::Any& rVal) const
 void SfxBaseModel::setGrabBagItem(const css::uno::Any& rVal)
 {
     if (!m_pData->m_xGrabBagItem.get())
-        m_pData->m_xGrabBagItem.reset(new SfxGrabBagItem);
+        m_pData->m_xGrabBagItem = std::make_shared<SfxGrabBagItem>();
 
     m_pData->m_xGrabBagItem->PutValue(rVal, 0);
 }


More information about the Libreoffice-commits mailing list