[Libreoffice-commits] core.git: sc/inc sc/source
Noel Grandin
noel.grandin at collabora.co.uk
Mon Jun 25 13:20:42 UTC 2018
sc/inc/document.hxx | 30 +++++++++++++++---------------
sc/source/core/data/documen2.cxx | 6 ++++--
sc/source/core/data/documen3.cxx | 16 +++++++---------
sc/source/core/data/documen8.cxx | 10 +++++-----
sc/source/core/data/documen9.cxx | 7 +++----
sc/source/core/data/document.cxx | 13 ++++++-------
sc/source/core/data/documentimport.cxx | 2 +-
sc/source/core/data/table7.cxx | 2 +-
sc/source/filter/excel/impop.cxx | 3 ++-
sc/source/filter/oox/formulabuffer.cxx | 3 ++-
sc/source/ui/docshell/docsh.cxx | 6 +++++-
sc/source/ui/docshell/externalrefmgr.cxx | 5 +++--
sc/source/ui/docshell/tablink.cxx | 4 ++--
sc/source/ui/undo/refundo.cxx | 3 ++-
sc/source/ui/view/viewfun3.cxx | 6 +++---
15 files changed, 61 insertions(+), 55 deletions(-)
New commits:
commit 537ff805fc4b27e4d553c57f9b9457dc9eebb191
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Jun 21 09:50:37 2018 +0200
loplugin:useuniqueptr in ScDocument
Change-Id: I117424b6d28d4cc6cc6d7146f9df861a8075a791
Reviewed-on: https://gerrit.libreoffice.org/56320
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 86079dd4c7b1..49cd2a7b80fc 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -366,7 +366,7 @@ private:
SfxObjectShell* mpShell;
VclPtr<SfxPrinter> mpPrinter;
VclPtr<VirtualDevice> mpVirtualDevice_100th_mm;
- ScDrawLayer* mpDrawLayer; // SdrModel
+ std::unique_ptr<ScDrawLayer> mpDrawLayer; // SdrModel
rtl::Reference<XColorList> pColorList;
ScValidationDataList* pValidationList; // validity
SvNumberFormatterIndexTable* pFormatExchangeList; // for application of number formats
@@ -382,7 +382,7 @@ private:
ScFormulaCell* pFormulaTrack; // BroadcastTrack (start)
ScFormulaCell* pEOFormulaTrack; // BroadcastTrack (end), last cell
std::unique_ptr<ScBroadcastAreaSlotMachine> pBASM; // BroadcastAreas
- ScChartListenerCollection* pChartListenerCollection;
+ std::unique_ptr<ScChartListenerCollection> pChartListenerCollection;
std::unique_ptr<SvMemoryStream> pClipData;
std::unique_ptr<ScDetOpList> pDetOpList;
std::unique_ptr<ScChangeTrack> pChangeTrack;
@@ -414,13 +414,13 @@ private:
ScRangePairListRef xColNameRanges;
ScRangePairListRef xRowNameRanges;
- ScViewOptions* pViewOptions; // view options
- ScDocOptions* pDocOptions; // document options
- ScExtDocOptions* pExtDocOptions; // for import etc.
+ std::unique_ptr<ScViewOptions> pViewOptions; // view options
+ std::unique_ptr<ScDocOptions> pDocOptions; // document options
+ std::unique_ptr<ScExtDocOptions> pExtDocOptions; // for import etc.
std::unique_ptr<ScClipOptions> mpClipOptions; // clipboard options
std::unique_ptr<ScConsolidateParam> pConsolidateDlgData;
- ScAutoNameCache* pAutoNameCache; // for automatic name lookup during CompileXML
+ std::unique_ptr<ScAutoNameCache> pAutoNameCache; // for automatic name lookup during CompileXML
std::unique_ptr<SfxItemSet> pPreviewFont; // convert to std::unique_ptr or whatever
ScStyleSheet* pPreviewCellStyle;
@@ -591,11 +591,11 @@ public:
SC_DLLPUBLIC void SetViewOptions( const ScViewOptions& rOpt );
void SetPrintOptions();
- ScExtDocOptions* GetExtDocOptions() { return pExtDocOptions; }
- SC_DLLPUBLIC void SetExtDocOptions( ScExtDocOptions* pNewOptions );
+ ScExtDocOptions* GetExtDocOptions() { return pExtDocOptions.get(); }
+ SC_DLLPUBLIC void SetExtDocOptions( std::unique_ptr<ScExtDocOptions> pNewOptions );
ScClipOptions* GetClipOptions() { return mpClipOptions.get(); }
- void SetClipOptions(const ScClipOptions& rClipOptions);
+ void SetClipOptions(std::unique_ptr<ScClipOptions> pClipOptions);
SC_DLLPUBLIC void GetLanguage( LanguageType& rLatin, LanguageType& rCjk, LanguageType& rCtl ) const;
void SetLanguage( LanguageType eLatin, LanguageType eCjk, LanguageType eCtl );
@@ -992,8 +992,8 @@ public:
SfxBindings* GetViewBindings();
SfxObjectShell* GetDocumentShell() const { return mpShell; }
- SC_DLLPUBLIC ScDrawLayer* GetDrawLayer() { return mpDrawLayer; }
- SC_DLLPUBLIC const ScDrawLayer* GetDrawLayer() const { return mpDrawLayer; }
+ SC_DLLPUBLIC ScDrawLayer* GetDrawLayer() { return mpDrawLayer.get(); }
+ SC_DLLPUBLIC const ScDrawLayer* GetDrawLayer() const { return mpDrawLayer.get(); }
SfxBroadcaster* GetDrawBroadcaster(); // to avoid header
void BeginDrawUndo();
@@ -1269,7 +1269,7 @@ public:
*/
bool CompileErrorCells(FormulaError nErrCode);
- ScAutoNameCache* GetAutoNameCache() { return pAutoNameCache; }
+ ScAutoNameCache* GetAutoNameCache() { return pAutoNameCache.get(); }
void SetPreviewFont( std::unique_ptr<SfxItemSet> pFontSet );
SfxItemSet* GetPreviewFont() { return pPreviewFont.get(); }
SfxItemSet* GetPreviewFont( SCCOL nCol, SCROW nRow, SCTAB nTab );
@@ -1278,7 +1278,7 @@ public:
ScStyleSheet* GetPreviewCellStyle() { return pPreviewCellStyle; }
ScStyleSheet* GetPreviewCellStyle( SCCOL nCol, SCROW nRow, SCTAB nTab );
void SetPreviewCellStyle( ScStyleSheet* pStyle ) { pPreviewCellStyle = pStyle; }
- SC_DLLPUBLIC void SetAutoNameCache( ScAutoNameCache* pCache );
+ SC_DLLPUBLIC void SetAutoNameCache( std::unique_ptr<ScAutoNameCache> pCache );
/** Creates a ScLookupCache cache for the range if it
doesn't already exist. */
@@ -2045,8 +2045,8 @@ public:
bool GetNoListening() const { return bNoListening; }
ScBroadcastAreaSlotMachine* GetBASM() const { return pBASM.get(); }
- SC_DLLPUBLIC ScChartListenerCollection* GetChartListenerCollection() const { return pChartListenerCollection;}
- void SetChartListenerCollection( ScChartListenerCollection*,
+ SC_DLLPUBLIC ScChartListenerCollection* GetChartListenerCollection() const { return pChartListenerCollection.get(); }
+ void SetChartListenerCollection( std::unique_ptr<ScChartListenerCollection>,
bool bSetChartRangeLists );
void UpdateChart( const OUString& rName );
void RestoreChartListener( const OUString& rName );
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 88c9b972c912..9682dff38dc0 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -18,6 +18,8 @@
*/
#include <scitems.hxx>
+#include <scextopt.hxx>
+#include <autonamecache.hxx>
#include <editeng/eeitem.hxx>
#include <editeng/editeng.hxx>
@@ -234,7 +236,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) :
mxPoolHelper = new ScPoolHelper( this );
pBASM.reset( new ScBroadcastAreaSlotMachine( this ) );
- pChartListenerCollection = new ScChartListenerCollection( this );
+ pChartListenerCollection.reset( new ScChartListenerCollection( this ) );
pRefreshTimerControl.reset( new ScRefreshTimerControl );
}
else
@@ -383,7 +385,7 @@ ScDocument::~ScDocument()
ScAddInAsync::RemoveDocument( this );
ScAddInListener::RemoveDocument( this );
- DELETEZ( pChartListenerCollection); // before pBASM because of potential Listener!
+ pChartListenerCollection.reset(); // before pBASM because of potential Listener!
DELETEZ(maNonThreaded.pLookupCacheMapImpl); // before pBASM because of listeners
DELETEZ(maThreadSpecific.pLookupCacheMapImpl);
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 21d11f94d95c..91a67ebd583a 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -404,18 +404,17 @@ void ScDocument::StopTemporaryChartLock()
}
void ScDocument::SetChartListenerCollection(
- ScChartListenerCollection* pNewChartListenerCollection,
+ std::unique_ptr<ScChartListenerCollection> pNewChartListenerCollection,
bool bSetChartRangeLists )
{
- ScChartListenerCollection* pOld = pChartListenerCollection;
- pChartListenerCollection = pNewChartListenerCollection;
+ std::unique_ptr<ScChartListenerCollection> pOld = std::move(pChartListenerCollection);
+ pChartListenerCollection = std::move(pNewChartListenerCollection);
if ( pChartListenerCollection )
{
if ( pOld )
pChartListenerCollection->SetDiffDirty( *pOld, bSetChartRangeLists );
pChartListenerCollection->StartAllListeners();
}
- delete pOld;
}
void ScDocument::SetScenario( SCTAB nTab, bool bFlag )
@@ -1983,15 +1982,14 @@ tools::Rectangle ScDocument::GetMMRect( SCCOL nStartCol, SCROW nStartRow, SCCOL
return aRect;
}
-void ScDocument::SetExtDocOptions( ScExtDocOptions* pNewOptions )
+void ScDocument::SetExtDocOptions( std::unique_ptr<ScExtDocOptions> pNewOptions )
{
- delete pExtDocOptions;
- pExtDocOptions = pNewOptions;
+ pExtDocOptions = std::move(pNewOptions);
}
-void ScDocument::SetClipOptions(const ScClipOptions& rClipOptions)
+void ScDocument::SetClipOptions(std::unique_ptr<ScClipOptions> pClipOptions)
{
- mpClipOptions = o3tl::make_unique<ScClipOptions>(rClipOptions);
+ mpClipOptions = std::move(pClipOptions);
}
void ScDocument::DoMergeContents( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 7d5542173b96..32a1c2cd97cb 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -106,15 +106,15 @@ inline sal_uInt16 getScaleValue(SfxStyleSheetBase& rStyle, sal_uInt16 nWhich)
void ScDocument::ImplCreateOptions()
{
- pDocOptions = new ScDocOptions();
- pViewOptions = new ScViewOptions();
+ pDocOptions.reset( new ScDocOptions() );
+ pViewOptions.reset( new ScViewOptions() );
}
void ScDocument::ImplDeleteOptions()
{
- delete pDocOptions;
- delete pViewOptions;
- delete pExtDocOptions;
+ pDocOptions.reset();
+ pViewOptions.reset();
+ pExtDocOptions.reset();
}
SfxPrinter* ScDocument::GetPrinter(bool bCreateIfNotExist)
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index 5433142df41a..d342e49c6bbe 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -62,7 +62,7 @@ using namespace ::com::sun::star;
SfxBroadcaster* ScDocument::GetDrawBroadcaster()
{
- return mpDrawLayer;
+ return mpDrawLayer.get();
}
void ScDocument::BeginDrawUndo()
@@ -117,7 +117,7 @@ void ScDocument::InitDrawLayer( SfxObjectShell* pDocShell )
OUString aName;
if ( mpShell && !mpShell->IsLoading() ) // don't call GetTitle while loading
aName = mpShell->GetTitle();
- mpDrawLayer = new ScDrawLayer( this, aName );
+ mpDrawLayer.reset(new ScDrawLayer( this, aName ));
sfx2::LinkManager* pMgr = GetDocLinkManager().getLinkManager(bAutoCalc);
if (pMgr)
@@ -250,8 +250,7 @@ void ScDocument::DeleteDrawLayer()
pLocalPool->SetSecondaryPool(nullptr);
}
}
- delete mpDrawLayer;
- mpDrawLayer = nullptr;
+ mpDrawLayer.reset();
}
bool ScDocument::DrawGetPrintArea( ScRange& rRange, bool bSetHor, bool bSetVer ) const
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 58777dc19e43..32f1669e97d1 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2381,7 +2381,7 @@ void ScDocument::TransposeClip( ScDocument* pTransClip, InsertDeleteFlags nFlags
tools::Rectangle aDestRect = pTransClip->GetMMRect( 0, 0,
static_cast<SCCOL>(aClipRange.aEnd.Row() - aClipRange.aStart.Row()),
static_cast<SCROW>(aClipRange.aEnd.Col() - aClipRange.aStart.Col()), i );
- pTransClip->mpDrawLayer->CopyFromClip( mpDrawLayer, i, aSourceRect, ScAddress(0,0,i), aDestRect );
+ pTransClip->mpDrawLayer->CopyFromClip( mpDrawLayer.get(), i, aSourceRect, ScAddress(0,0,i), aDestRect );
}
}
@@ -2649,7 +2649,7 @@ void ScDocument::CopyBlockFromClip(
tools::Rectangle aSourceRect = rCxt.getClipDoc()->GetMMRect(
nCol1-nDx, nRow1-nDy, nCol2-nDx, nRow2-nDy, nClipTab );
tools::Rectangle aDestRect = GetMMRect( nCol1, nRow1, nCol2, nRow2, i );
- mpDrawLayer->CopyFromClip(rCxt.getClipDoc()->mpDrawLayer, nClipTab, aSourceRect,
+ mpDrawLayer->CopyFromClip(rCxt.getClipDoc()->mpDrawLayer.get(), nClipTab, aSourceRect,
ScAddress( nCol1, nRow1, i ), aDestRect );
}
}
@@ -3984,7 +3984,7 @@ void ScDocument::CompileXML()
// set AutoNameCache to speed up automatic name lookup
OSL_ENSURE( !pAutoNameCache, "AutoNameCache already set" );
- pAutoNameCache = new ScAutoNameCache( this );
+ pAutoNameCache.reset( new ScAutoNameCache( this ) );
if (pRangeName)
pRangeName->CompileUnresolvedXML(aCxt);
@@ -3998,7 +3998,7 @@ void ScDocument::CompileXML()
);
StartAllListeners();
- DELETEZ( pAutoNameCache ); // valid only during CompileXML, where cell contents don't change
+ pAutoNameCache.reset(); // valid only during CompileXML, where cell contents don't change
if ( pValidationList )
{
@@ -6731,10 +6731,9 @@ bool ScDocument::ContainsNotesInRange( const ScRangeList& rRangeList ) const
return false;
}
-void ScDocument::SetAutoNameCache( ScAutoNameCache* pCache )
+void ScDocument::SetAutoNameCache( std::unique_ptr<ScAutoNameCache> pCache )
{
- delete pAutoNameCache;
- pAutoNameCache = pCache;
+ pAutoNameCache = std::move(pCache);
}
thread_local ScDocumentThreadSpecific ScDocument::maThreadSpecific;
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index 55aaadae1ce7..d5788a0e2d03 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -173,7 +173,7 @@ void ScDocumentImport::setSheetName(SCTAB nTab, const OUString& rName)
void ScDocumentImport::setOriginDate(sal_uInt16 nYear, sal_uInt16 nMonth, sal_uInt16 nDay)
{
if (!mpImpl->mrDoc.pDocOptions)
- mpImpl->mrDoc.pDocOptions = new ScDocOptions;
+ mpImpl->mrDoc.pDocOptions.reset( new ScDocOptions );
mpImpl->mrDoc.pDocOptions->SetDate(nDay, nMonth, nYear);
}
diff --git a/sc/source/core/data/table7.cxx b/sc/source/core/data/table7.cxx
index aab7c47cf522..9bf03be16002 100644
--- a/sc/source/core/data/table7.cxx
+++ b/sc/source/core/data/table7.cxx
@@ -158,7 +158,7 @@ void ScTable::CopyOneCellFromClip(
rSrcStartPos.Col(), rSrcStartPos.Row(), rSrcEndPos.Col(), rSrcEndPos.Row(),
rSrcStartPos.Tab());
tools::Rectangle aDestRect = GetDoc().GetMMRect(nCol1, nRow1, nCol2, nRow2, nTab);
- pDrawLayer->CopyFromClip(rCxt.getClipDoc()->mpDrawLayer, rSrcStartPos.Tab(),
+ pDrawLayer->CopyFromClip(rCxt.getClipDoc()->mpDrawLayer.get(), rSrcStartPos.Tab(),
aSourceRect, ScAddress(nCol1, nRow1, nTab), aDestRect);
}
}
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index d01fe225c805..26e6ac10a0b5 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -81,6 +81,7 @@
#include <excimp8.hxx>
#include <excform.hxx>
#include <documentimport.hxx>
+#include <o3tl/make_unique.hxx>
#if defined(_WIN32)
#include <math.h>
@@ -1310,7 +1311,7 @@ void ImportExcel::PostDocLoad()
GetExtDocOptions().SetChanged( true );
// root data owns the extended document options -> create a new object
- GetDoc().SetExtDocOptions( new ScExtDocOptions( GetExtDocOptions() ) );
+ GetDoc().SetExtDocOptions( o3tl::make_unique<ScExtDocOptions>( GetExtDocOptions() ) );
const SCTAB nLast = pD->GetTableCount();
const ScRange* p;
diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx
index 0e5a5f796be8..87529dcad0d0 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -23,6 +23,7 @@
#include <tokenstringcontext.hxx>
#include <oox/token/tokens.hxx>
#include <svl/sharedstringpool.hxx>
+#include <o3tl/make_unique.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sheet;
@@ -343,7 +344,7 @@ void FormulaBuffer::finalizeImport()
ISegmentProgressBarRef xFormulaBar = getProgressBar().createSegment( getProgressBar().getFreeLength() );
ScDocumentImport& rDoc = getDocImport();
- rDoc.getDoc().SetAutoNameCache(new ScAutoNameCache(&rDoc.getDoc()));
+ rDoc.getDoc().SetAutoNameCache(o3tl::make_unique<ScAutoNameCache>(&rDoc.getDoc()));
ScExternalRefManager::ApiGuard aExtRefGuard(&rDoc.getDoc());
SCTAB nTabCount = rDoc.getDoc().GetTableCount();
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 48a3c806a20e..b0c10dd0989b 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -134,6 +134,7 @@
#include <datastream.hxx>
#include <documentlinkmgr.hxx>
#include <refupdatecontext.hxx>
+#include <o3tl/make_unique.hxx>
#include <memory>
#include <vector>
@@ -2380,7 +2381,10 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed )
{
ScExtDocOptions* pExtDocOpt = m_aDocument.GetExtDocOptions();
if( !pExtDocOpt )
- m_aDocument.SetExtDocOptions( pExtDocOpt = new ScExtDocOptions );
+ {
+ m_aDocument.SetExtDocOptions( o3tl::make_unique<ScExtDocOptions>() );
+ pExtDocOpt = m_aDocument.GetExtDocOptions();
+ }
pViewShell->GetViewData().WriteExtOptions( *pExtDocOpt );
/* #i104990# If the imported document contains a medium
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 8c39abc9cad4..55334a317871 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -60,6 +60,7 @@
#include <columnspanset.hxx>
#include <column.hxx>
#include <com/sun/star/document/MacroExecMode.hpp>
+#include <o3tl/make_unique.hxx>
#include <memory>
#include <algorithm>
@@ -2543,8 +2544,8 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt
ScExtDocOptions* pExtOptNew = rSrcDoc.GetExtDocOptions();
if (!pExtOptNew)
{
- pExtOptNew = new ScExtDocOptions;
- rSrcDoc.SetExtDocOptions(pExtOptNew);
+ rSrcDoc.SetExtDocOptions(o3tl::make_unique<ScExtDocOptions>());
+ pExtOptNew = rSrcDoc.GetExtDocOptions();
}
pExtOptNew->GetDocSettings().mnLinkCnt = nLinkCount + 1;
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index 2a6448b1944a..527aefedb0fb 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -536,8 +536,8 @@ ScDocumentLoader::ScDocumentLoader(const OUString& rFileName,
ScExtDocOptions* pExtDocOpt = rDoc.GetExtDocOptions();
if( !pExtDocOpt )
{
- pExtDocOpt = new ScExtDocOptions;
- rDoc.SetExtDocOptions( pExtDocOpt );
+ rDoc.SetExtDocOptions( o3tl::make_unique<ScExtDocOptions>() );
+ pExtDocOpt = rDoc.GetExtDocOptions();
}
pExtDocOpt->GetDocSettings().mnLinkCnt = nRekCnt;
diff --git a/sc/source/ui/undo/refundo.cxx b/sc/source/ui/undo/refundo.cxx
index 4aeb94dc36b1..d2a6c5cb2779 100644
--- a/sc/source/ui/undo/refundo.cxx
+++ b/sc/source/ui/undo/refundo.cxx
@@ -33,6 +33,7 @@
#include <unoreflist.hxx>
#include <scopetools.hxx>
#include <refupdatecontext.hxx>
+#include <o3tl/make_unique.hxx>
ScRefUndoData::ScRefUndoData( const ScDocument* pDoc ) :
pDBCollection(nullptr),
@@ -166,7 +167,7 @@ void ScRefUndoData::DoUndo( ScDocument* pDoc, bool bUndoRefFirst )
// bUndoRefFirst is bSetChartRangeLists
if ( pChartListenerCollection )
- pDoc->SetChartListenerCollection( new ScChartListenerCollection(
+ pDoc->SetChartListenerCollection( o3tl::make_unique<ScChartListenerCollection>(
*pChartListenerCollection ), bUndoRefFirst );
if (pDBCollection || pRangeName)
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 2a9824b24a32..cb71f1642ad3 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -231,9 +231,9 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b
// Copy document properties from pObjectShell to pClipDoc (to its clip options, as it has no object shell).
uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(pObjectShell->GetModel(), uno::UNO_QUERY);
uno::Reference<util::XCloneable> xCloneable(xDocumentPropertiesSupplier->getDocumentProperties(), uno::UNO_QUERY);
- ScClipOptions aOptions;
- aOptions.m_xDocumentProperties.set(xCloneable->createClone(), uno::UNO_QUERY);
- pClipDoc->SetClipOptions(aOptions);
+ std::unique_ptr<ScClipOptions> pOptions(new ScClipOptions);
+ pOptions->m_xDocumentProperties.set(xCloneable->createClone(), uno::UNO_QUERY);
+ pClipDoc->SetClipOptions(std::move(pOptions));
}
pDoc->CopyToClip( aClipParam, pClipDoc, &rMark, false, bIncludeObjects );
More information about the Libreoffice-commits
mailing list