diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-11 14:05:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-13 11:39:21 +0000 |
commit | 414ede0435645a2ebf8f1476435b6ec3bb248f33 (patch) | |
tree | 97f4fc1f1f3a3b9c077ae11348baa6fed6852f9b /sc/inc | |
parent | d05f56b160390022fdb0c21eed5e430440cd79ca (diff) |
new loplugin: useuniqueptr: sc part 1
Change-Id: Ic96fd3b56b2063df0882168a7d02725d3c50515f
Reviewed-on: https://gerrit.libreoffice.org/32961
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/addincol.hxx | 5 | ||||
-rw-r--r-- | sc/inc/appoptio.hxx | 7 | ||||
-rw-r--r-- | sc/inc/attrib.hxx | 2 | ||||
-rw-r--r-- | sc/inc/chartpos.hxx | 15 | ||||
-rw-r--r-- | sc/inc/chgviset.hxx | 3 | ||||
-rw-r--r-- | sc/inc/dociter.hxx | 9 | ||||
-rw-r--r-- | sc/inc/dpgroup.hxx | 3 | ||||
-rw-r--r-- | sc/inc/dpresfilter.hxx | 2 | ||||
-rw-r--r-- | sc/inc/dpsave.hxx | 4 | ||||
-rw-r--r-- | sc/inc/dptabres.hxx | 15 | ||||
-rw-r--r-- | sc/inc/dptabsrc.hxx | 3 | ||||
-rw-r--r-- | sc/inc/editutil.hxx | 2 | ||||
-rw-r--r-- | sc/inc/markarr.hxx | 7 | ||||
-rw-r--r-- | sc/inc/paramisc.hxx | 8 | ||||
-rw-r--r-- | sc/inc/patattr.hxx | 7 | ||||
-rw-r--r-- | sc/inc/prnsave.hxx | 5 | ||||
-rw-r--r-- | sc/inc/rangenam.hxx | 7 |
17 files changed, 55 insertions, 49 deletions
diff --git a/sc/inc/addincol.hxx b/sc/inc/addincol.hxx index 49d30b6a7b7a..79150156f969 100644 --- a/sc/inc/addincol.hxx +++ b/sc/inc/addincol.hxx @@ -88,7 +88,8 @@ private: css::uno::Reference< css::reflection::XIdlMethod> xFunction; css::uno::Any aObject; long nArgCount; - ScAddInArgDesc* pArgDescs; + std::unique_ptr<ScAddInArgDesc[]> + pArgDescs; long nCallerPos; sal_uInt16 nCategory; OString sHelpId; @@ -113,7 +114,7 @@ public: { return xFunction; } const css::uno::Any& GetObject() const { return aObject; } long GetArgumentCount() const { return nArgCount; } - const ScAddInArgDesc* GetArguments() const { return pArgDescs; } + const ScAddInArgDesc* GetArguments() const { return pArgDescs.get(); } long GetCallerPos() const { return nCallerPos; } const OUString& GetDescription() const { return aDescription; } sal_uInt16 GetCategory() const { return nCategory; } diff --git a/sc/inc/appoptio.hxx b/sc/inc/appoptio.hxx index 5bc668a24629..d3d6f5ba61eb 100644 --- a/sc/inc/appoptio.hxx +++ b/sc/inc/appoptio.hxx @@ -45,8 +45,8 @@ public: SvxZoomType GetZoomType() const { return eZoomType; } void SetSynchronizeZoom( bool bNew ) { bSynchronizeZoom = bNew; } bool GetSynchronizeZoom() const { return bSynchronizeZoom; } - sal_uInt16 GetLRUFuncListCount() const { return nLRUFuncCount; } - sal_uInt16* GetLRUFuncList() const { return pLRUList; } + sal_uInt16 GetLRUFuncListCount() const { return nLRUFuncCount; } + sal_uInt16* GetLRUFuncList() const { return pLRUList.get(); } void SetLRUFuncList( const sal_uInt16* pList, const sal_uInt16 nCount ); void SetStatusFunc( sal_uInt32 nNew ) { nStatusFunc = nNew; } @@ -83,7 +83,8 @@ public: private: FieldUnit eMetric; sal_uInt16 nLRUFuncCount; - sal_uInt16* pLRUList; + std::unique_ptr<sal_uInt16[]> + pLRUList; SvxZoomType eZoomType; sal_uInt16 nZoom; bool bSynchronizeZoom; diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx index 3b71b8c79aa4..83235acd0e6f 100644 --- a/sc/inc/attrib.hxx +++ b/sc/inc/attrib.hxx @@ -214,7 +214,7 @@ public: public: sal_uInt16 nCount; - SCTAB* pTabArr; + std::unique_ptr<SCTAB[]> pTabArr; }; inline ScTableListItem::ScTableListItem( const sal_uInt16 nWhichP ) diff --git a/sc/inc/chartpos.hxx b/sc/inc/chartpos.hxx index 18c40aee8e53..664cbc966c08 100644 --- a/sc/inc/chartpos.hxx +++ b/sc/inc/chartpos.hxx @@ -46,12 +46,13 @@ class ScChartPositionMap SCROW nRowAdd, // header rows ColumnMap& rCols // table with col tables with address* ); - ~ScChartPositionMap(); //! deletes all ScAddress* ScChartPositionMap( const ScChartPositionMap& ) = delete; ScChartPositionMap& operator=( const ScChartPositionMap& ) = delete; public: + ~ScChartPositionMap(); //! deletes all ScAddress* + SCCOL GetColCount() const { return nColCount; } SCROW GetRowCount() const { return nRowCount; } @@ -103,7 +104,7 @@ class ScChartPositioner final // only parameter struct { ScRangeListRef aRangeListRef; ScDocument* pDocument; - ScChartPositionMap* pPositionMap; + std::unique_ptr<ScChartPositionMap> pPositionMap; ScChartGlue eGlue; SCCOL nStartCol; SCROW nStartRow; @@ -132,15 +133,7 @@ public: bool HasColHeaders() const { return bColHeaders; } bool HasRowHeaders() const { return bRowHeaders; } - void InvalidateGlue() - { - eGlue = SC_CHARTGLUE_NA; - if ( pPositionMap ) - { - delete pPositionMap; - pPositionMap = nullptr; - } - } + void InvalidateGlue(); const ScChartPositionMap* GetPositionMap(); }; diff --git a/sc/inc/chgviset.hxx b/sc/inc/chgviset.hxx index ee61570f4248..68e144d9059d 100644 --- a/sc/inc/chgviset.hxx +++ b/sc/inc/chgviset.hxx @@ -34,7 +34,8 @@ class SC_DLLPUBLIC ScChangeViewSettings { private: - utl::TextSearch* pCommentSearcher; + std::unique_ptr<utl::TextSearch> + pCommentSearcher; DateTime aFirstDateTime; DateTime aLastDateTime; OUString aAuthorToShow; diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx index f3142781a61c..04d04b60e29f 100644 --- a/sc/inc/dociter.hxx +++ b/sc/inc/dociter.hxx @@ -370,7 +370,8 @@ private: SCROW nStartRow; SCROW nEndRow; SCCOL nCol; - ScAttrIterator* pColIter; + std::unique_ptr<ScAttrIterator> + pColIter; public: ScDocAttrIterator(ScDocument* pDocument, SCTAB nTable, @@ -391,7 +392,8 @@ private: SCROW nEndRow; SCCOL nIterStartCol; SCCOL nIterEndCol; - ScAttrIterator* pColIter; + std::unique_ptr<ScAttrIterator> + pColIter; public: ScAttrRectIterator(ScDocument* pDocument, SCTAB nTable, @@ -450,7 +452,8 @@ class ScHorizontalValueIterator private: ScDocument *pDoc; const ScAttrArray *pAttrArray; - ScHorizontalCellIterator *pCellIter; + std::unique_ptr<ScHorizontalCellIterator> + pCellIter; sal_uLong nNumFormat; // for CalcAsShown SCTAB nEndTab; SCCOL nCurCol; diff --git a/sc/inc/dpgroup.hxx b/sc/inc/dpgroup.hxx index e45f3f45eda9..1eddcf931e34 100644 --- a/sc/inc/dpgroup.hxx +++ b/sc/inc/dpgroup.hxx @@ -124,7 +124,8 @@ class ScDPGroupTableData : public ScDPTableData std::shared_ptr<ScDPTableData> pSourceData; long nSourceCount; ScDPGroupDimensionVec aGroups; - ScDPNumGroupDimension* pNumGroups; // array[nSourceCount] + std::unique_ptr<ScDPNumGroupDimension[]> + pNumGroups; // array[nSourceCount] ScDocument* pDoc; StringHashSet aGroupNames; diff --git a/sc/inc/dpresfilter.hxx b/sc/inc/dpresfilter.hxx index 82c2862229df..0ab75d433b88 100644 --- a/sc/inc/dpresfilter.hxx +++ b/sc/inc/dpresfilter.hxx @@ -99,7 +99,7 @@ private: LeafValuesType maLeafValues; OUString maPrimaryDimName; - MemberNode* mpRoot; + std::unique_ptr<MemberNode> mpRoot; public: diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx index 663bcb2d724d..8338e0ef4862 100644 --- a/sc/inc/dpsave.hxx +++ b/sc/inc/dpsave.hxx @@ -241,7 +241,7 @@ public: private: DimsType m_DimList; DupNameCountType maDupNameCounts; /// keep track of number of duplicates in each name. - ScDPDimensionSaveData* pDimensionData; // settings that create new dimensions + std::unique_ptr<ScDPDimensionSaveData> pDimensionData; // settings that create new dimensions sal_uInt16 nColumnGrandMode; sal_uInt16 nRowGrandMode; sal_uInt16 nIgnoreEmptyMode; @@ -347,7 +347,7 @@ public: bool IsEmpty() const; const ScDPDimensionSaveData* GetExistingDimensionData() const - { return pDimensionData; } + { return pDimensionData.get(); } void RemoveAllGroupDimensions( const OUString& rSrcDimName, std::vector<OUString>* pDeletedNames = nullptr ); diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx index 65dbf5dbb4d1..7b6e7d1d5aaa 100644 --- a/sc/inc/dptabres.hxx +++ b/sc/inc/dptabres.hxx @@ -159,12 +159,12 @@ private: double fVal; double fAux; long nCount; - ScDPAggData* pChild; + std::unique_ptr<ScDPAggData> pChild; std::vector<double> mSortedValues; public: ScDPAggData() : fVal(0.0), fAux(0.0), nCount(SC_DPAGG_EMPTY), pChild(nullptr) {} - ~ScDPAggData() { delete pChild; } + ~ScDPAggData() {} void Update( const ScDPValue& rNext, ScSubTotalFunc eFunc, const ScDPSubTotalState& rSubState ); void Calculate( ScSubTotalFunc eFunc, const ScDPSubTotalState& rSubState ); @@ -183,7 +183,7 @@ public: void Reset(); // also deletes children - const ScDPAggData* GetExistingChild() const { return pChild; } + const ScDPAggData* GetExistingChild() const { return pChild.get(); } ScDPAggData* GetChild(); #if DUMP_PIVOT_TABLE @@ -437,8 +437,9 @@ class ScDPDataMember private: const ScDPResultData* pResultData; const ScDPResultMember* pResultMember; //! Ref? - ScDPDataDimension* pChildDimension; - ScDPAggData aAggregate; + std::unique_ptr<ScDPDataDimension> + pChildDimension; + ScDPAggData aAggregate; void UpdateValues( const ::std::vector<ScDPValue>& aValues, const ScDPSubTotalState& rSubState ); @@ -486,8 +487,8 @@ public: #endif //! this will be removed! - const ScDPDataDimension* GetChildDimension() const { return pChildDimension; } - ScDPDataDimension* GetChildDimension() { return pChildDimension; } + const ScDPDataDimension* GetChildDimension() const { return pChildDimension.get(); } + ScDPDataDimension* GetChildDimension() { return pChildDimension.get(); } }; typedef std::vector<ScDPDataMember*> ScDPDataMembers; diff --git a/sc/inc/dptabsrc.hxx b/sc/inc/dptabsrc.hxx index 48c0714e915a..26e949a813b7 100644 --- a/sc/inc/dptabsrc.hxx +++ b/sc/inc/dptabsrc.hxx @@ -315,7 +315,8 @@ class ScDPDimension : public cppu::WeakImplHelper< aReferenceValue; // settings for "show data as" / "displayed value" bool bHasSelectedPage; OUString aSelectedPage; - ScDPItemData* pSelectedData; // internal, temporary, created from aSelectedPage + std::unique_ptr<ScDPItemData> + pSelectedData; // internal, temporary, created from aSelectedPage bool mbHasHiddenMember; public: diff --git a/sc/inc/editutil.hxx b/sc/inc/editutil.hxx index e71976eb2b51..00f0029d3eba 100644 --- a/sc/inc/editutil.hxx +++ b/sc/inc/editutil.hxx @@ -88,7 +88,7 @@ public: class ScEditAttrTester { ScEditEngineDefaulter* pEngine; - SfxItemSet* pEditAttrs; + std::unique_ptr<SfxItemSet> pEditAttrs; bool bNeedsObject; bool bNeedsCellAttr; diff --git a/sc/inc/markarr.hxx b/sc/inc/markarr.hxx index 0fd826cad395..a88dd7683e1b 100644 --- a/sc/inc/markarr.hxx +++ b/sc/inc/markarr.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SC_INC_MARKARR_HXX #include "address.hxx" +#include <memory> #define SC_MARKARRAY_DELTA 4 @@ -32,9 +33,9 @@ struct ScMarkEntry class ScMarkArray { - SCSIZE nCount; - SCSIZE nLimit; - ScMarkEntry* pData; + SCSIZE nCount; + SCSIZE nLimit; + std::unique_ptr<ScMarkEntry[]> pData; friend class ScMarkArrayIter; friend class ScDocument; // for FillInfo diff --git a/sc/inc/paramisc.hxx b/sc/inc/paramisc.hxx index 0a21a1db83a6..5853051a4abd 100644 --- a/sc/inc/paramisc.hxx +++ b/sc/inc/paramisc.hxx @@ -25,9 +25,9 @@ struct ScSolveParam { - ScAddress aRefFormulaCell; - ScAddress aRefVariableCell; - OUString* pStrTargetVal; + ScAddress aRefFormulaCell; + ScAddress aRefVariableCell; + std::unique_ptr<OUString> pStrTargetVal; ScSolveParam(); ScSolveParam( const ScSolveParam& r ); @@ -36,7 +36,7 @@ struct ScSolveParam const OUString& rTargetValStr ); ~ScSolveParam(); - ScSolveParam& operator= ( const ScSolveParam& r ); + ScSolveParam& operator= ( const ScSolveParam& r ); bool operator== ( const ScSolveParam& r ) const; }; diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx index 3f75827a75c8..05bfc926c6ac 100644 --- a/sc/inc/patattr.hxx +++ b/sc/inc/patattr.hxx @@ -27,6 +27,7 @@ #include <editeng/svxenum.hxx> #include "scdllapi.h" #include "fonthelper.hxx" +#include <memory> namespace vcl { class Font; } class OutputDevice; @@ -51,9 +52,9 @@ enum ScAutoFontColorMode class SC_DLLPUBLIC ScPatternAttr: public SfxSetItem { - OUString* pName; - ScStyleSheet* pStyle; - sal_uInt64 mnKey; + std::unique_ptr<OUString> pName; + ScStyleSheet* pStyle; + sal_uInt64 mnKey; public: ScPatternAttr(SfxItemSet* pItemSet, const OUString& rStyleName); ScPatternAttr(SfxItemSet* pItemSet); diff --git a/sc/inc/prnsave.hxx b/sc/inc/prnsave.hxx index 9bdbc28ecfd0..463a424451ad 100644 --- a/sc/inc/prnsave.hxx +++ b/sc/inc/prnsave.hxx @@ -22,6 +22,7 @@ #include "address.hxx" #include <vector> +#include <memory> class ScRange; @@ -51,8 +52,8 @@ public: class ScPrintRangeSaver { - SCTAB nTabCount; - ScPrintSaverTab* pData; ///< Array + SCTAB nTabCount; + std::unique_ptr<ScPrintSaverTab[]> pData; public: ScPrintRangeSaver( SCTAB nCount ); diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx index a1924de86a26..19c288b8ac87 100644 --- a/sc/inc/rangenam.hxx +++ b/sc/inc/rangenam.hxx @@ -63,7 +63,8 @@ private: OUString aName; OUString aUpperName; // #i62977# for faster searching (aName is never modified after ctor) OUString maNewName; ///< used for formulas after changing names in the dialog - ScTokenArray* pCode; + std::unique_ptr<ScTokenArray> + pCode; ScAddress aPos; Type eType; ScDocument* pDoc; @@ -116,9 +117,9 @@ public: sal_uInt16 GetIndex() const { return nIndex; } /// Does not change the name, but sets maNewName for formula update after dialog. void SetNewName( const OUString& rNewName ) { maNewName = rNewName; } - ScTokenArray* GetCode() { return pCode; } + ScTokenArray* GetCode() { return pCode.get(); } SC_DLLPUBLIC void SetCode( ScTokenArray& ); - const ScTokenArray* GetCode() const { return pCode; } + const ScTokenArray* GetCode() const { return pCode.get(); } SC_DLLPUBLIC FormulaError GetErrCode() const; bool HasReferences() const; void AddType( Type nType ); |