diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-06-29 10:17:42 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-06-29 13:31:49 +0200 |
commit | 41e2f767113e7fc5ea942f80f92990b3f276f26b (patch) | |
tree | 1bb42beb0d950c708c2222346dc104829ab636fd | |
parent | a7bf6488ebb544e1efaed0a1e53073df9cc2064d (diff) |
Clean up SvxChartColorTable
* nNextElementNumber is unused since d57dfa29c2ba47293eb12a853cdccf4196565ef7
"Improvement of adding and removing color charts".
* There appears to be no compelling reason to store sDefaultNamePre-/Postfix as
members (but which are not even copied by the copy ctor). Just compute them
whenever they are needed in getDefaultName (which is understood to not be a
hot code path).
* With those changes, the user-provided default and copy ctor can be left
implicitly-declared, which avoids -Wdeprecated-copy (because the copy
assignment op was implicitly-declared while the copy ctor was not) with GCC
trunk towards GCC 9.
Change-Id: I2bfa5f19c967e24407bf5b79adaf171200822f45
Reviewed-on: https://gerrit.libreoffice.org/56666
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | cui/source/options/cfgchart.cxx | 37 | ||||
-rw-r--r-- | cui/source/options/cfgchart.hxx | 6 |
2 files changed, 11 insertions, 32 deletions
diff --git a/cui/source/options/cfgchart.cxx b/cui/source/options/cfgchart.cxx index 29351cfa7f6a..7cbd051e9130 100644 --- a/cui/source/options/cfgchart.cxx +++ b/cui/source/options/cfgchart.cxx @@ -27,18 +27,6 @@ using namespace com::sun::star; - -SvxChartColorTable::SvxChartColorTable() - : nNextElementNumber(0) -{ -} - -SvxChartColorTable::SvxChartColorTable(const SvxChartColorTable & _rSource) - : m_aColorEntries(_rSource.m_aColorEntries) - , nNextElementNumber(m_aColorEntries.size() + 1) -{ -} - // accessors size_t SvxChartColorTable::size() const { @@ -71,7 +59,6 @@ Color SvxChartColorTable::getColor( size_t _nIndex ) const void SvxChartColorTable::clear() { m_aColorEntries.clear(); - nNextElementNumber = 1; } void SvxChartColorTable::append( const XColorEntry & _rEntry ) @@ -127,23 +114,21 @@ OUString SvxChartColorTable::getDefaultName( size_t _nIndex ) { OUString aName; - if (sDefaultNamePrefix.getLength() == 0) + OUString sDefaultNamePrefix; + OUString sDefaultNamePostfix; + OUString aResName( CuiResId( RID_SVXSTR_DIAGRAM_ROW ) ); + sal_Int32 nPos = aResName.indexOf( "$(ROW)" ); + if( nPos != -1 ) { - OUString aResName( CuiResId( RID_SVXSTR_DIAGRAM_ROW ) ); - sal_Int32 nPos = aResName.indexOf( "$(ROW)" ); - if( nPos != -1 ) - { - sDefaultNamePrefix = aResName.copy( 0, nPos ); - sDefaultNamePostfix = aResName.copy( nPos + sizeof( "$(ROW)" ) - 1 ); - } - else - { - sDefaultNamePrefix = aResName; - } + sDefaultNamePrefix = aResName.copy( 0, nPos ); + sDefaultNamePostfix = aResName.copy( nPos + sizeof( "$(ROW)" ) - 1 ); + } + else + { + sDefaultNamePrefix = aResName; } aName = sDefaultNamePrefix + OUString::number(_nIndex + 1) + sDefaultNamePostfix; - nNextElementNumber++; return aName; } diff --git a/cui/source/options/cfgchart.hxx b/cui/source/options/cfgchart.hxx index b5e783d8ad5d..eba4a7fda42e 100644 --- a/cui/source/options/cfgchart.hxx +++ b/cui/source/options/cfgchart.hxx @@ -30,14 +30,8 @@ class SvxChartColorTable { private: std::vector< XColorEntry > m_aColorEntries; - int nNextElementNumber; - OUString sDefaultNamePrefix; - OUString sDefaultNamePostfix; public: - SvxChartColorTable(); - explicit SvxChartColorTable( const SvxChartColorTable & _rSource ); - // accessors size_t size() const; const XColorEntry & operator[]( size_t _nIndex ) const; |