diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-08-25 11:09:38 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-10-21 10:36:39 +0200 |
commit | e26f8d2592a3d7cc5b43b3246b364397dd704f0d (patch) | |
tree | 8677f333ba26a23f2999ab3a083696a8d2e29b74 /sc/source/ui | |
parent | 3dce7bd77c56e61cd9457b03e8cf4137a7630eb9 (diff) |
coverity#1401307 document checked 'Uncaught exception'
markup std::unique_ptr where coverity warns a dtor might throw exceptions which
won't throw in practice, or where std::terminate is an acceptable response if
they do
Change-Id: Icc99cdecf8d8b011e599574f0a05b59efd1c65c2
Reviewed-on: https://gerrit.libreoffice.org/41561
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/ui')
24 files changed, 93 insertions, 94 deletions
diff --git a/sc/source/ui/dataprovider/htmldataprovider.hxx b/sc/source/ui/dataprovider/htmldataprovider.hxx index 69398632846f..db438760ea85 100644 --- a/sc/source/ui/dataprovider/htmldataprovider.hxx +++ b/sc/source/ui/dataprovider/htmldataprovider.hxx @@ -24,7 +24,7 @@ private: ScDocument* mpDocument; rtl::Reference<HTMLFetchThread> mxHTMLFetchThread; - std::unique_ptr<ScDocument> mpDoc; + ScDocumentUniquePtr mpDoc; public: diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 96fc5982fc13..0bb9aa4fed3b 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -1157,7 +1157,7 @@ bool isEditable(ScDocShell& rDocShell, const ScRangeList& rRanges, bool bApi) return true; } -void createUndoDoc(std::unique_ptr<ScDocument>& pUndoDoc, ScDocument* pDoc, const ScRange& rRange) +void createUndoDoc(ScDocumentUniquePtr& pUndoDoc, ScDocument* pDoc, const ScRange& rRange) { SCTAB nTab = rRange.aStart.Tab(); pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO)); @@ -1241,8 +1241,8 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb if (!isEditable(rDocShell, aRanges, bApi)) return false; - std::unique_ptr<ScDocument> pOldUndoDoc; - std::unique_ptr<ScDocument> pNewUndoDoc; + ScDocumentUniquePtr pOldUndoDoc; + ScDocumentUniquePtr pNewUndoDoc; ScDPObject aUndoDPObj(*pOldObj); // for undo or revert on failure @@ -1352,7 +1352,7 @@ bool ScDBDocFunc::RemovePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi) } } - std::unique_ptr<ScDocument> pOldUndoDoc; + ScDocumentUniquePtr pOldUndoDoc; std::unique_ptr<ScDPObject> pUndoDPObj; if (bRecord) @@ -1403,7 +1403,7 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool if (!isEditable(rDocShell, ScRange(rDPObj.GetOutRange().aStart), bApi)) return false; - std::unique_ptr<ScDocument> pNewUndoDoc; + ScDocumentUniquePtr pNewUndoDoc; ScDocument& rDoc = rDocShell.GetDocument(); if (bRecord && !rDoc.IsUndoEnabled()) @@ -1516,8 +1516,8 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi) if (!isEditable(rDocShell, rDPObj.GetOutRange(), bApi)) return false; - std::unique_ptr<ScDocument> pOldUndoDoc; - std::unique_ptr<ScDocument> pNewUndoDoc; + ScDocumentUniquePtr pOldUndoDoc; + ScDocumentUniquePtr pNewUndoDoc; ScDPObject aUndoDPObj(rDPObj); // For undo or revert on failure. diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 8cdfa9f12de8..dfbc54582c6b 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -583,7 +583,7 @@ bool ScDocFunc::DeleteContents( ScMarkData aMultiMark = rMark; aMultiMark.SetMarking(false); // for MarkToMulti - std::unique_ptr<ScDocument> pUndoDoc; + ScDocumentUniquePtr pUndoDoc; bool bMulti = aMultiMark.IsMultiMarked(); aMultiMark.MarkToMulti(); aMultiMark.GetMultiMarkArea( aMarkRange ); @@ -688,7 +688,7 @@ bool ScDocFunc::DeleteCell( // To keep track of all non-empty cells within the deleted area. std::shared_ptr<ScSimpleUndo::DataSpansType> pDataSpans; - std::unique_ptr<ScDocument> pUndoDoc; + ScDocumentUniquePtr pUndoDoc; if (bRecord) { pUndoDoc = sc::DocFuncUtil::createDeleteContentsUndoDoc(rDoc, rMark, rPos, nFlags, false); @@ -2737,7 +2737,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos, SCTAB nDestEndTab = nDestTab+nSrcTabCount-1; SCTAB nTab; - std::unique_ptr<ScDocument> pClipDoc = o3tl::make_unique<ScDocument>(SCDOCMODE_CLIP); + ScDocumentUniquePtr pClipDoc(new ScDocument(SCDOCMODE_CLIP)); ScMarkData aSourceMark; for (nTab=nStartTab; nTab<=nEndTab; nTab++) diff --git a/sc/source/ui/docshell/docfuncutil.cxx b/sc/source/ui/docshell/docfuncutil.cxx index 1eede21b952d..f00fa56608fb 100644 --- a/sc/source/ui/docshell/docfuncutil.cxx +++ b/sc/source/ui/docshell/docfuncutil.cxx @@ -42,11 +42,11 @@ bool DocFuncUtil::hasProtectedTab( const ScDocument& rDoc, const ScMarkData& rMa return false; } -std::unique_ptr<ScDocument> DocFuncUtil::createDeleteContentsUndoDoc( +ScDocumentUniquePtr DocFuncUtil::createDeleteContentsUndoDoc( ScDocument& rDoc, const ScMarkData& rMark, const ScRange& rRange, InsertDeleteFlags nFlags, bool bOnlyMarked ) { - std::unique_ptr<ScDocument> pUndoDoc(new ScDocument(SCDOCMODE_UNDO)); + ScDocumentUniquePtr pUndoDoc(new ScDocument(SCDOCMODE_UNDO)); SCTAB nTab = rRange.aStart.Tab(); pUndoDoc->InitUndo(&rDoc, nTab, nTab); SCTAB nTabCount = rDoc.GetTableCount(); @@ -76,7 +76,7 @@ std::unique_ptr<ScDocument> DocFuncUtil::createDeleteContentsUndoDoc( void DocFuncUtil::addDeleteContentsUndo( svl::IUndoManager* pUndoMgr, ScDocShell* pDocSh, const ScMarkData& rMark, - const ScRange& rRange, std::unique_ptr<ScDocument>&& pUndoDoc, InsertDeleteFlags nFlags, + const ScRange& rRange, ScDocumentUniquePtr&& pUndoDoc, InsertDeleteFlags nFlags, const std::shared_ptr<ScSimpleUndo::DataSpansType>& pSpans, bool bMulti, bool bDrawUndo ) { diff --git a/sc/source/ui/docshell/documentlinkmgr.cxx b/sc/source/ui/docshell/documentlinkmgr.cxx index c8ba3a48b6d4..aa508dca8ef0 100644 --- a/sc/source/ui/docshell/documentlinkmgr.cxx +++ b/sc/source/ui/docshell/documentlinkmgr.cxx @@ -22,7 +22,7 @@ #include <ddelink.hxx> #include <strings.hrc> #include <scresid.hxx> - +#include <o3tl/deleter.hxx> #include <svx/svdoole2.hxx> #include <vcl/layout.hxx> @@ -33,7 +33,7 @@ namespace sc { struct DocumentLinkManagerImpl { SfxObjectShell* mpShell; - std::unique_ptr<DataStream> mpDataStream; + std::unique_ptr<DataStream, o3tl::default_delete<DataStream>> mpDataStream; std::unique_ptr<sfx2::LinkManager> mpLinkManager; DocumentLinkManagerImpl(const DocumentLinkManagerImpl&) = delete; diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 3fe47e3ef4ee..7a6dca99ad89 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -2152,7 +2152,7 @@ bool ScImportExport::Doc2Dif( SvStream& rStrm ) bool ScImportExport::Dif2Doc( SvStream& rStrm ) { SCTAB nTab = aRange.aStart.Tab(); - std::unique_ptr<ScDocument> pImportDoc( new ScDocument( SCDOCMODE_UNDO ) ); + ScDocumentUniquePtr pImportDoc( new ScDocument( SCDOCMODE_UNDO ) ); pImportDoc->InitUndo( pDoc, nTab, nTab ); // for DIF in the clipboard, IBM_850 is always used diff --git a/sc/source/ui/inc/dataprovider.hxx b/sc/source/ui/inc/dataprovider.hxx index 30e871ee6b0c..c9188eadf6a6 100644 --- a/sc/source/ui/inc/dataprovider.hxx +++ b/sc/source/ui/inc/dataprovider.hxx @@ -109,7 +109,7 @@ class CSVDataProvider : public DataProvider { rtl::Reference<CSVFetchThread> mxCSVFetchThread; ScDocument* mpDocument; - std::unique_ptr<ScDocument> mpDoc; + ScDocumentUniquePtr mpDoc; void Refresh(); diff --git a/sc/source/ui/inc/docfuncutil.hxx b/sc/source/ui/inc/docfuncutil.hxx index dba17c80464a..74d83757d492 100644 --- a/sc/source/ui/inc/docfuncutil.hxx +++ b/sc/source/ui/inc/docfuncutil.hxx @@ -25,13 +25,13 @@ public: static bool hasProtectedTab( const ScDocument& rDoc, const ScMarkData& rMark ); - static std::unique_ptr<ScDocument> createDeleteContentsUndoDoc( + static ScDocumentUniquePtr createDeleteContentsUndoDoc( ScDocument& rDoc, const ScMarkData& rMark, const ScRange& rRange, InsertDeleteFlags nFlags, bool bOnlyMarked ); static void addDeleteContentsUndo( svl::IUndoManager* pUndoMgr, ScDocShell* pDocSh, const ScMarkData& rMark, - const ScRange& rRange, std::unique_ptr<ScDocument>&& pUndoDoc, InsertDeleteFlags nFlags, + const ScRange& rRange, ScDocumentUniquePtr&& pUndoDoc, InsertDeleteFlags nFlags, const std::shared_ptr<ScSimpleUndo::DataSpansType>& pSpans, bool bMulti, bool bDrawUndo ); diff --git a/sc/source/ui/inc/spelldialog.hxx b/sc/source/ui/inc/spelldialog.hxx index af7c7bcb5ff6..f68a6e59906d 100644 --- a/sc/source/ui/inc/spelldialog.hxx +++ b/sc/source/ui/inc/spelldialog.hxx @@ -22,13 +22,13 @@ #include <memory> #include <svx/SpellDialogChildWindow.hxx> +#include "document.hxx" class ScConversionEngineBase; class ScSelectionState; class ScTabViewShell; class ScViewData; class ScRangeList; -class ScDocShell; class ScDocument; /** Specialized spell check dialog child window for Calc. @@ -73,12 +73,11 @@ private: private: typedef ::std::unique_ptr< ScConversionEngineBase > ScConvEnginePtr; - typedef ::std::unique_ptr< ScDocument > ScDocumentPtr; typedef ::std::unique_ptr< ScSelectionState > ScSelectionStatePtr; ScConvEnginePtr mxEngine; - ScDocumentPtr mxUndoDoc; - ScDocumentPtr mxRedoDoc; + ScDocumentUniquePtr mxUndoDoc; + ScDocumentUniquePtr mxRedoDoc; ScSelectionStatePtr mxOldSel; /// For cursor position in selection tools::SvRef< ScRangeList > mxOldRangeList; /// Original selection range for comparison. diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 7fd417808646..35fa4d61357a 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SC_SOURCE_UI_INC_TABVWSH_HXX #include <formula/errorcodes.hxx> +#include <o3tl/deleter.hxx> #include <svx/fmshell.hxx> #include <svtools/htmlcfg.hxx> #include <sfx2/viewsh.hxx> @@ -115,7 +116,7 @@ private: FmFormShell* pFormShell; - std::unique_ptr<ScInputHandler> mpInputHandler; // for OLE input cell + std::unique_ptr<ScInputHandler, o3tl::default_delete<ScInputHandler>> mpInputHandler; // for OLE input cell ::editeng::SvxBorderLine* pCurFrameLine; diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx index 7239f911d081..5115bc173d20 100644 --- a/sc/source/ui/inc/undoblk.hxx +++ b/sc/source/ui/inc/undoblk.hxx @@ -153,7 +153,7 @@ public: private: ScMarkData aMarkData; - std::unique_ptr<ScDocument> + ScDocumentUniquePtr pUndoDoc; ScRange aExtendedRange; sal_uLong nStartChangeAction; @@ -254,7 +254,7 @@ public: ScUndoDeleteContents( ScDocShell* pNewDocShell, const ScMarkData& rMark, const ScRange& rRange, - std::unique_ptr<ScDocument>&& pNewUndoDoc, bool bNewMulti, + ScDocumentUniquePtr&& pNewUndoDoc, bool bNewMulti, InsertDeleteFlags nNewFlags, bool bObjects ); virtual ~ScUndoDeleteContents() override; @@ -272,7 +272,7 @@ private: ScRange aRange; ScMarkData aMarkData; - std::unique_ptr<ScDocument> pUndoDoc; // Block mark and deleted data + ScDocumentUniquePtr pUndoDoc; // Block mark and deleted data SdrUndoAction* pDrawUndo; // Deleted objects sal_uLong nStartChangeAction; sal_uLong nEndChangeAction; @@ -304,7 +304,7 @@ public: private: ScRange aRange; ScMarkData aMarkData; - std::unique_ptr<ScDocument> + ScDocumentUniquePtr pUndoDoc; // Block mark and deleted data sal_uLong nStartChangeAction; sal_uLong nEndChangeAction; @@ -413,7 +413,7 @@ public: private: ScRange aSource; ScMarkData aMarkData; - std::unique_ptr<ScDocument> + ScDocumentUniquePtr pUndoDoc; FillDir eFillDir; FillCmd eFillCmd; @@ -444,7 +444,7 @@ public: private: ScCellMergeOption maOption; bool mbMergeContents; // Merge contents in Redo(). - std::unique_ptr<ScDocument> mxUndoDoc; // when data is merged + ScDocumentUniquePtr mxUndoDoc; // when data is merged SdrUndoAction* mpDrawUndo; void DoChange( bool bUndo ) const; @@ -467,7 +467,7 @@ public: virtual OUString GetComment() const override; private: - std::unique_ptr<ScDocument> + ScDocumentUniquePtr pUndoDoc; // deleted data ScMarkData aMarkData; bool bSize; @@ -526,7 +526,7 @@ public: private: ScRange aRange; - std::unique_ptr<ScDocument> + ScDocumentUniquePtr pUndoDoc; // Deleted data ScRefAddress theFormulaCell; ScRefAddress theFormulaEnd; @@ -609,8 +609,8 @@ public: virtual OUString GetComment() const override; private: - std::unique_ptr<ScDocument> xUndoDoc; - std::unique_ptr<ScDocument> xRedoDoc; + ScDocumentUniquePtr xUndoDoc; + ScDocumentUniquePtr xRedoDoc; void DoChange( ScDocument* pSrcDoc ) const; }; @@ -631,8 +631,8 @@ public: private: void DoChange(ScDocument* pDoc); - std::unique_ptr<ScDocument> mpUndoDoc; - std::unique_ptr<ScDocument> mpRedoDoc; + ScDocumentUniquePtr mpUndoDoc; + ScDocumentUniquePtr mpRedoDoc; ScRange maRange; }; @@ -652,8 +652,8 @@ public: private: void DoChange(const ScDocument* pDoc); - std::unique_ptr<ScDocument> mpUndoDoc; - std::unique_ptr<ScDocument> mpRedoDoc; + ScDocumentUniquePtr mpUndoDoc; + ScDocumentUniquePtr mpRedoDoc; SCTAB mnTab; }; @@ -674,7 +674,7 @@ public: virtual OUString GetComment() const override; private: - std::unique_ptr<ScDocument> + ScDocumentUniquePtr pUndoDoc; ScRange aRange; ScMarkData aMarkData; @@ -700,7 +700,7 @@ public: private: ScMarkData aMarkData; - std::unique_ptr<ScDocument> + ScDocumentUniquePtr pUndoDoc; OUString aStyleName; ScRange aRange; @@ -722,8 +722,8 @@ public: virtual OUString GetComment() const override; private: - std::unique_ptr<ScDocument> xUndoDoc; - std::unique_ptr<ScDocument> xRedoDoc; + ScDocumentUniquePtr xUndoDoc; + ScDocumentUniquePtr xRedoDoc; }; class ScUndoEnterMatrix: public ScBlockUndo @@ -743,7 +743,7 @@ public: virtual OUString GetComment() const override; private: - std::unique_ptr<ScDocument> + ScDocumentUniquePtr pUndoDoc; OUString aFormula; sal_uLong nStartChangeAction; @@ -837,8 +837,8 @@ private: OUString aNewOpt; OUString aNewArea; ScRange aNewRange; - std::unique_ptr<ScDocument> xUndoDoc; - std::unique_ptr<ScDocument> xRedoDoc; + ScDocumentUniquePtr xUndoDoc; + ScDocumentUniquePtr xRedoDoc; sal_uLong nOldRefresh; sal_uLong nNewRefresh; bool bWithInsert; @@ -862,7 +862,7 @@ public: private: ScMarkData aMarkData; - std::unique_ptr<ScDocument> + ScDocumentUniquePtr pUndoDoc; bool bIsIncrement; }; @@ -883,7 +883,7 @@ public: private: ScMarkData aMarkData; - std::unique_ptr<ScDocument> + ScDocumentUniquePtr pUndoDoc; TransliterationFlags nTransliterationType; @@ -905,7 +905,7 @@ public: private: ScMarkData aMarkData; - std::unique_ptr<ScDocument> + ScDocumentUniquePtr pUndoDoc; std::unique_ptr<sal_uInt16[]> pWhich; @@ -927,7 +927,7 @@ public: private: SCTAB nTab; - std::unique_ptr<ScDocument> + ScDocumentUniquePtr pUndoDoc; }; @@ -956,7 +956,7 @@ private: void SetCurTab(); std::vector<ScCellMergeOption> maOptions; - std::unique_ptr<ScDocument> pUndoDoc; + ScDocumentUniquePtr pUndoDoc; }; class ScUndoBorder: public ScBlockUndo @@ -976,7 +976,7 @@ public: virtual OUString GetComment() const override; private: - std::unique_ptr<ScDocument> xUndoDoc; + ScDocumentUniquePtr xUndoDoc; std::unique_ptr<ScRangeList> xRanges; std::unique_ptr<SvxBoxItem> xOuter; std::unique_ptr<SvxBoxInfoItem> xInner; diff --git a/sc/source/ui/inc/undodat.hxx b/sc/source/ui/inc/undodat.hxx index 7f60385d32af..46542158bbbb 100644 --- a/sc/source/ui/inc/undodat.hxx +++ b/sc/source/ui/inc/undodat.hxx @@ -60,7 +60,7 @@ private: SCCOLROW nStart; SCCOLROW nEnd; SCTAB nTab; - std::unique_ptr<ScDocument> + ScDocumentUniquePtr pUndoDoc; bool bColumns; sal_uInt16 nLevel; @@ -113,7 +113,7 @@ private: SCCOLROW nStart; SCCOLROW nEnd; SCTAB nTab; - std::unique_ptr<ScDocument> xUndoDoc; + ScDocumentUniquePtr xUndoDoc; std::unique_ptr<ScOutlineTable> xUndoTable; bool bColumns; sal_uInt16 nLevel; @@ -138,7 +138,7 @@ public: private: ScAddress aBlockStart; ScAddress aBlockEnd; - std::unique_ptr<ScDocument> xUndoDoc; + ScDocumentUniquePtr xUndoDoc; std::unique_ptr<ScOutlineTable> xUndoTable; bool bShow; }; @@ -161,7 +161,7 @@ public: private: ScAddress aBlockStart; ScAddress aBlockEnd; - std::unique_ptr<ScDocument> xUndoDoc; + ScDocumentUniquePtr xUndoDoc; std::unique_ptr<ScOutlineTable> xUndoTable; }; @@ -183,7 +183,7 @@ public: private: ScAddress aBlockStart; ScAddress aBlockEnd; - std::unique_ptr<ScDocument> xUndoDoc; + ScDocumentUniquePtr xUndoDoc; std::unique_ptr<ScOutlineTable> xUndoTable; }; @@ -206,7 +206,7 @@ private: SCTAB nTab; ScSubTotalParam aParam; // The original passed parameter SCROW nNewEndRow; // Size of result - std::unique_ptr<ScDocument> xUndoDoc; + ScDocumentUniquePtr xUndoDoc; std::unique_ptr<ScOutlineTable> xUndoTable; std::unique_ptr<ScRangeName> xUndoRange; std::unique_ptr<ScDBCollection> xUndoDB; @@ -232,7 +232,7 @@ private: SdrUndoAction* pDrawUndo; SCTAB nTab; ScQueryParam aQueryParam; - std::unique_ptr<ScDocument> xUndoDoc; + ScDocumentUniquePtr xUndoDoc; std::unique_ptr<ScDBCollection> xUndoDB; // due to source and target range ScRange aOldDest; ScRange aAdvSource; @@ -302,8 +302,8 @@ private: ScImportParam aImportParam; SCCOL nEndCol; SCROW nEndRow; - std::unique_ptr<ScDocument> xUndoDoc; - std::unique_ptr<ScDocument> xRedoDoc; + ScDocumentUniquePtr xUndoDoc; + ScDocumentUniquePtr xRedoDoc; std::unique_ptr<ScDBData> xUndoDBData; std::unique_ptr<ScDBData> xRedoDBData; SCCOL nFormulaCols; @@ -332,7 +332,7 @@ private: ScAddress aBlockEnd; SCROW nNewEndRow; ScAddress aCursorPos; - std::unique_ptr<ScDocument> xUndoDoc; + ScDocumentUniquePtr xUndoDoc; std::unique_ptr<ScOutlineTable> xUndoTable; std::unique_ptr<ScRangeName> xUndoRange; std::unique_ptr<ScDBCollection> xUndoDB; @@ -357,8 +357,8 @@ public: virtual OUString GetComment() const override; private: - std::unique_ptr<ScDocument> xOldUndoDoc; - std::unique_ptr<ScDocument> xNewUndoDoc; + ScDocumentUniquePtr xOldUndoDoc; + ScDocumentUniquePtr xNewUndoDoc; std::unique_ptr<ScDPObject> xOldDPObject; std::unique_ptr<ScDPObject> xNewDPObject; bool bAllowMove; @@ -382,7 +382,7 @@ public: private: ScArea aDestArea; - std::unique_ptr<ScDocument> xUndoDoc; + ScDocumentUniquePtr xUndoDoc; ScConsolidateParam aParam; bool bInsRef; SCSIZE nInsertCount; @@ -440,8 +440,8 @@ public: private: std::unique_ptr<ScMarkData> mxMarkData; - std::unique_ptr<ScDocument> xUndoDoc; - std::unique_ptr<ScDocument> xRedoDoc; + ScDocumentUniquePtr xUndoDoc; + ScDocumentUniquePtr xRedoDoc; std::unique_ptr<ScRefUndoData> xRefUndoData; std::unique_ptr<ScRefUndoData> xRefRedoData; sal_uLong nStartChangeAction; diff --git a/sc/source/ui/inc/undotab.hxx b/sc/source/ui/inc/undotab.hxx index ee2ade721dda..901c406730a9 100644 --- a/sc/source/ui/inc/undotab.hxx +++ b/sc/source/ui/inc/undotab.hxx @@ -269,7 +269,7 @@ public: private: SCTAB nTab; SCTAB nCount; - std::unique_ptr<ScDocument> xRedoDoc; + ScDocumentUniquePtr xRedoDoc; SdrUndoAction* pDrawUndo; void DoChange() const; diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index 3b7de1a31273..b033116e47e0 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -1394,7 +1394,7 @@ void ScUndoDragDrop::Redo() BeginRedo(); ScDocument& rDoc = pDocShell->GetDocument(); - std::unique_ptr<ScDocument> pClipDoc(new ScDocument( SCDOCMODE_CLIP )); + ScDocumentUniquePtr pClipDoc(new ScDocument( SCDOCMODE_CLIP )); EnableDrawAdjust( &rDoc, false ); //! include in ScBlockUndo? diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx index 604a662009c2..7828532b92c9 100644 --- a/sc/source/ui/undo/undoblk3.cxx +++ b/sc/source/ui/undo/undoblk3.cxx @@ -64,7 +64,7 @@ ScUndoDeleteContents::ScUndoDeleteContents( ScDocShell* pNewDocShell, const ScMarkData& rMark, const ScRange& rRange, - std::unique_ptr<ScDocument>&& pNewUndoDoc, bool bNewMulti, + ScDocumentUniquePtr&& pNewUndoDoc, bool bNewMulti, InsertDeleteFlags nNewFlags, bool bObjects ) : ScSimpleUndo( pNewDocShell ), aRange ( rRange ), diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx index 8fb5c3d57b8e..c91134f3a6c3 100644 --- a/sc/source/ui/unoobj/funcuno.cxx +++ b/sc/source/ui/unoobj/funcuno.cxx @@ -141,7 +141,7 @@ static bool lcl_CopyData( ScDocument* pSrcDoc, const ScRange& rSrcRange, rSrcRange.aEnd.Row() - rSrcRange.aStart.Row() + rDestPos.Row(), nDestTab ) ); - std::unique_ptr<ScDocument> pClipDoc(new ScDocument( SCDOCMODE_CLIP )); + ScDocumentUniquePtr pClipDoc(new ScDocument( SCDOCMODE_CLIP )); ScMarkData aSourceMark; aSourceMark.SelectOneTable( nSrcTab ); // for CopyToClip aSourceMark.SetMarkArea( rSrcRange ); diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index 6cc144191db4..e2016d2acce9 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -783,9 +783,9 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) break; case SID_DATA_PROVIDER: { - std::shared_ptr<ScDocument> pDoc = std::make_shared<ScDocument>(); - pDoc->InsertTab(0, "test"); - ScopedVclPtrInstance< ScDataProviderDlg > aDialog( pTabViewShell->GetDialogParent(), pDoc); + std::shared_ptr<ScDocument> xDoc(new ScDocument, o3tl::default_delete<ScDocument>()); + xDoc->InsertTab(0, "test"); + ScopedVclPtrInstance< ScDataProviderDlg > aDialog( pTabViewShell->GetDialogParent(), xDoc); if (aDialog->Execute() == RET_OK) { // handle the import here diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx index 0b65d959edc4..2cc79ac57080 100644 --- a/sc/source/ui/view/dbfunc3.cxx +++ b/sc/source/ui/view/dbfunc3.cxx @@ -1998,7 +1998,7 @@ void ScDBFunc::ShowDataPilotSourceData( ScDPObject& rDPObj, const Sequence<sheet SCTAB nNewTab = GetViewData().GetTabNo(); - std::unique_ptr<ScDocument> pInsDoc(new ScDocument(SCDOCMODE_CLIP)); + ScDocumentUniquePtr pInsDoc(new ScDocument(SCDOCMODE_CLIP)); pInsDoc->ResetClip( pDoc, nNewTab ); for (SCROW nRow = 0; nRow < nRowSize; ++nRow) { diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index 077877beee44..c94993a43bbc 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -32,7 +32,7 @@ #include <tools/multisel.hxx> #include <vcl/waitobj.hxx> #include <vcl/settings.hxx> -#include <o3tl/make_unique.hxx> +#include <o3tl/deleter.hxx> #include "preview.hxx" #include "prevwsh.hxx" @@ -389,11 +389,11 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) { ScPrintOptions aOptions = pScMod->GetPrintOptions(); - std::unique_ptr<ScPrintFunc> pPrintFunc; + std::unique_ptr<ScPrintFunc, o3tl::default_delete<ScPrintFunc>> pPrintFunc; if (bStateValid) - pPrintFunc = o3tl::make_unique<ScPrintFunc>( this, pDocShell, aState, &aOptions ); + pPrintFunc.reset(new ScPrintFunc(this, pDocShell, aState, &aOptions)); else - pPrintFunc = o3tl::make_unique<ScPrintFunc>( this, pDocShell, nTab, nFirstAttr[nTab], nTotalPages, nullptr, &aOptions ); + pPrintFunc.reset(new ScPrintFunc(this, pDocShell, nTab, nFirstAttr[nTab], nTotalPages, nullptr, &aOptions)); pPrintFunc->SetOffset(aOffset); pPrintFunc->SetManualZoom(nZoom); diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index 3442c54618dc..b8d5ecfd30f5 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -1339,7 +1339,7 @@ void ScPrintFunc::DrawBorder( long nScrX, long nScrY, long nScrW, long nScrH, if (pBorderData) { - std::unique_ptr<ScDocument> pBorderDoc(new ScDocument( SCDOCMODE_UNDO )); + ScDocumentUniquePtr pBorderDoc(new ScDocument( SCDOCMODE_UNDO )); pBorderDoc->InitUndo( pDoc, 0,0, true,true ); if (pBorderData) pBorderDoc->ApplyAttr( 0,0,0, *pBorderData ); diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 5f15c438b891..2cf0b789062f 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -1498,8 +1498,7 @@ void ScTabViewShell::Construct( TriState nForceDesignMode ) // use the InputHandler of the App). // As an intermediate solution each View gets its own InputHandler, // which only yields problems if two Views are in one task window. - - mpInputHandler = o3tl::make_unique<ScInputHandler>(); + mpInputHandler.reset(new ScInputHandler); // old version: // if ( !GetViewFrame()->ISA(SfxTopViewFrame) ) // OLE or Plug-In diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 0e5dc1edbcf0..55fe8f091d05 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -798,7 +798,7 @@ void ScViewFunc::EnterBlock( const OUString& rString, const EditTextObject* pDat ScAddress aPos( nCol, nRow, nTab ); - std::unique_ptr<ScDocument> pInsDoc(new ScDocument( SCDOCMODE_CLIP )); + ScDocumentUniquePtr pInsDoc(new ScDocument( SCDOCMODE_CLIP )); pInsDoc->ResetClip( pDoc, nTab ); if (aNewStr[0] == '=') // Formula ? @@ -1746,7 +1746,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, //! account for bAttrib during Undo !!! - std::unique_ptr<ScDocument> pUndoDoc; + ScDocumentUniquePtr pUndoDoc; std::unique_ptr<ScMarkData> pUndoMark; OUString aUndoStr; if (bAddUndo) diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 4294c55c1a07..1df722ed79f8 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -309,7 +309,7 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b // TODO: What's this for? break; - ::std::unique_ptr<ScDocument> pDocClip(new ScDocument(SCDOCMODE_CLIP)); + ScDocumentUniquePtr pDocClip(new ScDocument(SCDOCMODE_CLIP)); // Check for geometrical feasibility of the ranges. bool bValidRanges = true; @@ -926,7 +926,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, ScDocShellRef aTransShellRef; // for objects in xTransClip - must remain valid as long as xTransClip ScDocument* pOrigClipDoc = nullptr; - ::std::unique_ptr< ScDocument > xTransClip; + ScDocumentUniquePtr xTransClip; if ( bTranspose ) { SCCOL nX; @@ -1279,7 +1279,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, // copy from clipboard // save original data in case of calculation - std::unique_ptr<ScDocument> pMixDoc; + ScDocumentUniquePtr pMixDoc; if (nFunction != ScPasteFunc::NONE) { bSkipEmpty = false; @@ -1485,7 +1485,7 @@ bool ScViewFunc::PasteMultiRangesFromClip( return false; } - ::std::unique_ptr<ScDocument> pTransClip(new ScDocument(SCDOCMODE_CLIP)); + ScDocumentUniquePtr pTransClip(new ScDocument(SCDOCMODE_CLIP)); pClipDoc->TransposeClip(pTransClip.get(), nFlags, bAsLink); pClipDoc = pTransClip.release(); SCCOL nTempColSize = nColSize; @@ -1542,7 +1542,7 @@ bool ScViewFunc::PasteMultiRangesFromClip( } bool bRowInfo = ( aMarkedRange.aStart.Col()==0 && aMarkedRange.aEnd.Col()==MAXCOL ); - ::std::unique_ptr<ScDocument> pUndoDoc; + ScDocumentUniquePtr pUndoDoc; if (pDoc->IsUndoEnabled()) { pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO)); @@ -1550,7 +1550,7 @@ bool ScViewFunc::PasteMultiRangesFromClip( pDoc->CopyToDocument(aMarkedRange, nUndoFlags, false, *pUndoDoc, &aMark); } - ::std::unique_ptr<ScDocument> pMixDoc; + ScDocumentUniquePtr pMixDoc; if ( bSkipEmpty || nFunction != ScPasteFunc::NONE) { if ( nFlags & InsertDeleteFlags::CONTENTS ) @@ -1693,7 +1693,7 @@ bool ScViewFunc::PasteFromClipToMultiRanges( return false; } - std::unique_ptr<ScDocument> pUndoDoc; + ScDocumentUniquePtr pUndoDoc; if (pDoc->IsUndoEnabled()) { pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO)); @@ -1705,7 +1705,7 @@ bool ScViewFunc::PasteFromClipToMultiRanges( } } - std::unique_ptr<ScDocument> pMixDoc; + ScDocumentUniquePtr pMixDoc; if (bSkipEmpty || nFunction != ScPasteFunc::NONE) { if (nFlags & InsertDeleteFlags::CONTENTS) @@ -1923,7 +1923,7 @@ bool ScViewFunc::LinkBlock( const ScRange& rSource, const ScAddress& rDestPos ) // run with paste ScDocument* pDoc = GetViewData().GetDocument(); - std::unique_ptr<ScDocument> pClipDoc(new ScDocument( SCDOCMODE_CLIP )); + ScDocumentUniquePtr pClipDoc(new ScDocument( SCDOCMODE_CLIP )); pDoc->CopyTabToClip( rSource.aStart.Col(), rSource.aStart.Row(), rSource.aEnd.Col(), rSource.aEnd.Row(), rSource.aStart.Tab(), pClipDoc.get() ); diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index 411a7979ee78..d3baacf6ba34 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -140,7 +140,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId, ScMarkData aSrcMark; aSrcMark.SelectOneTable( nSrcTab ); // for CopyToClip - std::unique_ptr<ScDocument> pClipDoc(new ScDocument( SCDOCMODE_CLIP )); + ScDocumentUniquePtr pClipDoc(new ScDocument( SCDOCMODE_CLIP )); SCCOL nFirstCol, nLastCol; SCROW nFirstRow, nLastRow; |