diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-02 11:13:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-02 12:23:47 +0000 |
commit | 4d0d98238b427b98310b6d0624e21bbec6d553f8 (patch) | |
tree | 997a979f3b4682c38ca21738f1a1b687c65e15e3 /sc | |
parent | 1f5797e0c0cc0425e29b7a945485ac146fec0085 (diff) |
flatten some classes in sc
no need to allocate separately where the contained class is only one
pointer big
Change-Id: Ibd31ff94c6fae6683d2784173057290dd547954e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148087
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/excel/xilink.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/inc/xcl97esc.hxx | 3 | ||||
-rw-r--r-- | sc/source/filter/inc/xilink.hxx | 3 | ||||
-rw-r--r-- | sc/source/filter/xcl97/xcl97esc.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx | 8 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlimprt.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlimprt.hxx | 4 |
8 files changed, 21 insertions, 19 deletions
diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx index ada9bb1a36b0..10933aecf9c5 100644 --- a/sc/source/filter/excel/xilink.cxx +++ b/sc/source/filter/excel/xilink.cxx @@ -399,7 +399,7 @@ XclImpExtName::XclImpExtName( XclImpSupbook& rSupbook, XclImpStream& rStrm, XclS } break; case xlExtOLE: - mpMOper.reset( new MOper(rSupbook.GetSharedStringPool(), rStrm) ); + moMOper.emplace( rSupbook.GetSharedStringPool(), rStrm ); break; default: ; @@ -472,7 +472,7 @@ bool extractSheetAndRange(const OUString& rName, OUString& rSheet, OUString& rRa bool XclImpExtName::CreateOleData(const ScDocument& rDoc, const OUString& rUrl, sal_uInt16& rFileId, OUString& rTabName, ScRange& rRange) const { - if (!mpMOper) + if (!moMOper) return false; OUString aSheet, aRangeStr; @@ -488,7 +488,7 @@ bool XclImpExtName::CreateOleData(const ScDocument& rDoc, const OUString& rUrl, // We don't support multi-sheet range for this. return false; - const ScMatrix& rCache = mpMOper->GetCache(); + const ScMatrix& rCache = moMOper->GetCache(); SCSIZE nC, nR; rCache.GetDimensions(nC, nR); if (!nC || !nR) diff --git a/sc/source/filter/inc/xcl97esc.hxx b/sc/source/filter/inc/xcl97esc.hxx index d7724d758981..3a0a606113a7 100644 --- a/sc/source/filter/inc/xcl97esc.hxx +++ b/sc/source/filter/inc/xcl97esc.hxx @@ -20,6 +20,7 @@ #pragma once #include <memory> +#include <optional> #include <stack> #include <filter/msfilter/escherex.hxx> #include "xeroot.hxx" @@ -37,7 +38,7 @@ private: virtual SvStream* ImplQueryPictureStream() override; private: - ::std::unique_ptr< ::utl::TempFileFast > mxPicTempFile; + ::std::optional< ::utl::TempFileFast > moPicTempFile; SvStream* mpPicStrm; }; diff --git a/sc/source/filter/inc/xilink.hxx b/sc/source/filter/inc/xilink.hxx index cdfef4c82397..686f928ff1c6 100644 --- a/sc/source/filter/inc/xilink.hxx +++ b/sc/source/filter/inc/xilink.hxx @@ -20,6 +20,7 @@ #pragma once #include <memory> +#include <optional> #include <map> #include "xllink.hxx" #include "xiroot.hxx" @@ -154,7 +155,7 @@ private: typedef ::std::unique_ptr< ScTokenArray > TokenArrayPtr; XclImpCachedMatrixPtr mxDdeMatrix; /// Cached results of the DDE link. - std::unique_ptr<MOper> mpMOper; /// Cached values for OLE link + std::optional<MOper> moMOper; /// Cached values for OLE link TokenArrayPtr mxArray; /// Formula tokens for external name. OUString maName; /// The name of the external name. sal_uInt32 mnStorageId; /// Storage ID for OLE object storages. diff --git a/sc/source/filter/xcl97/xcl97esc.cxx b/sc/source/filter/xcl97/xcl97esc.cxx index 03336e90b577..99d4db7ca53f 100644 --- a/sc/source/filter/xcl97/xcl97esc.cxx +++ b/sc/source/filter/xcl97/xcl97esc.cxx @@ -75,8 +75,8 @@ XclEscherExGlobal::XclEscherExGlobal( const XclExpRoot& rRoot ) SvStream* XclEscherExGlobal::ImplQueryPictureStream() { - mxPicTempFile.reset( new ::utl::TempFileFast ); - mpPicStrm = mxPicTempFile->GetStream( StreamMode::READWRITE ); + moPicTempFile.emplace(); + mpPicStrm = moPicTempFile->GetStream( StreamMode::READWRITE ); mpPicStrm->SetEndian( SvStreamEndian::LITTLE ); return mpPicStrm; } diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx index b8737d663d97..efe429b49faa 100644 --- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx +++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx @@ -285,7 +285,7 @@ void ScXMLChangeTrackingImportHelper::SetInsertionCutOff(const sal_uInt32 nID, c if ((pCurrentAction->nActionType == SC_CAT_DELETE_COLS) || (pCurrentAction->nActionType == SC_CAT_DELETE_ROWS)) { - static_cast<ScMyDelAction*>(pCurrentAction.get())->pInsCutOff.reset( new ScMyInsertionCutOff(nID, nPosition) ); + static_cast<ScMyDelAction*>(pCurrentAction.get())->moInsCutOff.emplace( nID, nPosition ); } else { @@ -505,17 +505,17 @@ void ScXMLChangeTrackingImportHelper::SetDeletionDependencies(ScMyDelAction* pAc pAction->aGeneratedList.clear(); } } - if (pAction->pInsCutOff) + if (pAction->moInsCutOff) { OSL_ENSURE(((pAction->nActionType == SC_CAT_DELETE_COLS) || (pAction->nActionType == SC_CAT_DELETE_ROWS) || (pAction->nActionType == SC_CAT_DELETE_TABS)), "wrong action type"); - ScChangeAction* pChangeAction = pTrack->GetAction(pAction->pInsCutOff->nID); + ScChangeAction* pChangeAction = pTrack->GetAction(pAction->moInsCutOff->nID); if (pChangeAction && pChangeAction->IsInsertType()) { ScChangeActionIns* pInsAction = static_cast<ScChangeActionIns*>(pChangeAction); if (pDelAct) - pDelAct->SetCutOffInsert(pInsAction, static_cast<sal_Int16>(pAction->pInsCutOff->nPosition)); + pDelAct->SetCutOffInsert(pInsAction, static_cast<sal_Int16>(pAction->moInsCutOff->nPosition)); } else { diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx index 5d9c97738688..e9f2525e91c5 100644 --- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx +++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx @@ -129,7 +129,7 @@ struct ScMyInsAction : public ScMyBaseAction struct ScMyDelAction : public ScMyBaseAction { std::vector<ScMyGenerated> aGeneratedList; - std::unique_ptr<ScMyInsertionCutOff> pInsCutOff; + std::optional<ScMyInsertionCutOff> moInsCutOff; std::vector<ScMyMoveCutOff> aMoveCutOffs; sal_Int32 nD; diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 467b8820db55..1f5002964684 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -397,7 +397,7 @@ ScXMLImport::~ScXMLImport() noexcept //call SvXMLImport dtor contents before deleting pSolarMutexGuard cleanup(); - pSolarMutexGuard.reset(); + moSolarMutexGuard.reset(); } void ScXMLImport::initialize( const css::uno::Sequence<css::uno::Any>& aArguments ) @@ -1529,8 +1529,8 @@ void ScXMLImport::LockSolarMutex() if (nSolarMutexLocked == 0) { - OSL_ENSURE(!pSolarMutexGuard, "Solar Mutex is locked"); - pSolarMutexGuard.reset(new SolarMutexGuard()); + OSL_ENSURE(!moSolarMutexGuard, "Solar Mutex is locked"); + moSolarMutexGuard.emplace(); } ++nSolarMutexLocked; } @@ -1542,8 +1542,8 @@ void ScXMLImport::UnlockSolarMutex() nSolarMutexLocked--; if (nSolarMutexLocked == 0) { - OSL_ENSURE(pSolarMutexGuard, "Solar Mutex is always unlocked"); - pSolarMutexGuard.reset(); + OSL_ENSURE(moSolarMutexGuard, "Solar Mutex is always unlocked"); + moSolarMutexGuard.reset(); } } } diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx index 4481b5ebdb40..7fdd00a65065 100644 --- a/sc/source/filter/xml/xmlimprt.hxx +++ b/sc/source/filter/xml/xmlimprt.hxx @@ -23,6 +23,7 @@ #include <xmloff/xmlprmap.hxx> #include "xmlsubti.hxx" #include <formula/grammar.hxx> +#include <vcl/svapp.hxx> #include <dociter.hxx> #include <com/sun/star/sheet/ValidationAlertStyle.hpp> @@ -60,7 +61,6 @@ class ScDrawObjData; class SvXMLTokenMap; class XMLShapeImportHelper; class ScXMLChangeTrackingImportHelper; -class SolarMutexGuard; struct ScMyNamedExpression { @@ -146,7 +146,7 @@ class ScXMLImport: public SvXMLImport ScMyLabelRanges maMyLabelRanges; ScMyImportValidations maValidations; std::unique_ptr<ScMyImpDetectiveOpArray> pDetectiveOpArray; - std::unique_ptr<SolarMutexGuard> pSolarMutexGuard; + std::optional<SolarMutexGuard> moSolarMutexGuard; std::unique_ptr<XMLNumberFormatAttributesExportHelper> pNumberFormatAttributesExportHelper; std::unique_ptr<ScMyStyleNumberFormats> pStyleNumberFormats; |