diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-09-23 20:49:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-24 10:50:41 +0200 |
commit | c183a6eb292b31c7fb24f751630960f2035353c5 (patch) | |
tree | fac9b484bbb46637b507fd4d471e377a3d508aa3 /sc | |
parent | 5c30291e8672cbdd3e61f3c6b18444da2d959024 (diff) |
no need to allocate this SfxItemSet on the heap
Change-Id: I083ea9ef7b04322d60ce29b7e1610332a4709493
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122553
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/html/htmlpars.cxx | 18 | ||||
-rw-r--r-- | sc/source/filter/inc/htmlpars.hxx | 6 |
2 files changed, 12 insertions, 12 deletions
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 991b8c0a1960..85cdff23a885 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -1874,7 +1874,7 @@ ScHTMLTable::~ScHTMLTable() const SfxItemSet& ScHTMLTable::GetCurrItemSet() const { // first try cell item set, then row item set, then table item set - return mxDataItemSet ? *mxDataItemSet : (mxRowItemSet ? *mxRowItemSet : maTableItemSet); + return moDataItemSet ? *moDataItemSet : (moRowItemSet ? *moRowItemSet : maTableItemSet); } ScHTMLSize ScHTMLTable::GetSpan( const ScHTMLPos& rCellPos ) const @@ -1992,7 +1992,7 @@ void ScHTMLTable::RowOn( const HtmlImportInfo& rInfo ) if( mpParentTable && !mbPreFormText ) // no rows allowed in global and preformatted tables { ImplRowOn(); - ProcessFormatOptions( *mxRowItemSet, rInfo ); + ProcessFormatOptions( *moRowItemSet, rInfo ); } CreateNewEntry( rInfo ); } @@ -2110,9 +2110,9 @@ void ScHTMLTable::DataOn( const HtmlImportInfo& rInfo ) ImplDataOn( aSpanSize ); if (nNumberFormat != NUMBERFORMAT_ENTRY_NOT_FOUND) - mxDataItemSet->Put( SfxUInt32Item(ATTR_VALUE_FORMAT, nNumberFormat) ); + moDataItemSet->Put( SfxUInt32Item(ATTR_VALUE_FORMAT, nNumberFormat) ); - ProcessFormatOptions( *mxDataItemSet, rInfo ); + ProcessFormatOptions( *moDataItemSet, rInfo ); CreateNewEntry( rInfo ); mxCurrEntry->pValStr = std::move(pValStr); mxCurrEntry->pNumStr = std::move(pNumStr); @@ -2139,7 +2139,7 @@ void ScHTMLTable::BodyOn( const HtmlImportInfo& rInfo ) ImplRowOn(); if( bPushed || !mbDataOn ) ImplDataOn( ScHTMLSize( 1, 1 ) ); - ProcessFormatOptions( *mxDataItemSet, rInfo ); + ProcessFormatOptions( *moDataItemSet, rInfo ); } CreateNewEntry( rInfo ); } @@ -2440,7 +2440,7 @@ void ScHTMLTable::ImplRowOn() { if( mbRowOn ) ImplRowOff(); - mxRowItemSet.reset( new SfxItemSet( maTableItemSet ) ); + moRowItemSet.emplace( maTableItemSet ); maCurrCell.mnCol = 0; mbRowOn = true; mbDataOn = false; @@ -2452,7 +2452,7 @@ void ScHTMLTable::ImplRowOff() ImplDataOff(); if( mbRowOn ) { - mxRowItemSet.reset(); + moRowItemSet.reset(); ++maCurrCell.mnRow; mbRowOn = mbDataOn = false; } @@ -2464,7 +2464,7 @@ void ScHTMLTable::ImplDataOn( const ScHTMLSize& rSpanSize ) ImplDataOff(); if( !mbRowOn ) ImplRowOn(); - mxDataItemSet.reset( new SfxItemSet( *mxRowItemSet ) ); + moDataItemSet.emplace( *moRowItemSet ); InsertNewCell( rSpanSize ); mbDataOn = true; mbPushEmptyLine = false; @@ -2474,7 +2474,7 @@ void ScHTMLTable::ImplDataOff() { if( mbDataOn ) { - mxDataItemSet.reset(); + moDataItemSet.reset(); ++maCurrCell.mnCol; mpCurrEntryVector = nullptr; mbDataOn = false; diff --git a/sc/source/filter/inc/htmlpars.hxx b/sc/source/filter/inc/htmlpars.hxx index e0c4dad24843..02af4857616e 100644 --- a/sc/source/filter/inc/htmlpars.hxx +++ b/sc/source/filter/inc/htmlpars.hxx @@ -21,6 +21,7 @@ #include <memory> #include <map> +#include <optional> #include <stack> #include <string_view> #include <unordered_map> @@ -446,7 +447,6 @@ protected: private: typedef ::std::unique_ptr< ScHTMLTableMap > ScHTMLTableMapPtr; - typedef ::std::unique_ptr< SfxItemSet > SfxItemSetPtr; typedef ::std::vector< SCCOLROW > ScSizeVec; typedef ::std::vector< ScHTMLEntry* > ScHTMLEntryVector; typedef ::std::unique_ptr< ScHTMLEntry > ScHTMLEntryPtr; @@ -527,8 +527,8 @@ private: OUStringBuffer maCaptionBuffer; /// Caption buffer of the table from <caption> </caption> ScHTMLTableAutoId maTableId; /// Unique identifier of this table. SfxItemSet maTableItemSet; /// Items for the entire table. - SfxItemSetPtr mxRowItemSet; /// Items for the current table row. - SfxItemSetPtr mxDataItemSet; /// Items for the current cell. + std::optional<SfxItemSet> moRowItemSet; /// Items for the current table row. + std::optional<SfxItemSet> moDataItemSet; /// Items for the current cell. ScRangeList maHMergedCells; /// List of all horizontally merged cells. ScRangeList maVMergedCells; /// List of all vertically merged cells. ScRangeList maUsedCells; /// List of all used cells. |