Kaydet (Commit) 41e2f767 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Clean up SvxChartColorTable

* nNextElementNumber is unused since d57dfa29
  "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: 's avatarStephan Bergmann <sbergman@redhat.com>
üst a7bf6488
...@@ -27,18 +27,6 @@ ...@@ -27,18 +27,6 @@
using namespace com::sun::star; 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 // accessors
size_t SvxChartColorTable::size() const size_t SvxChartColorTable::size() const
{ {
...@@ -71,7 +59,6 @@ Color SvxChartColorTable::getColor( size_t _nIndex ) const ...@@ -71,7 +59,6 @@ Color SvxChartColorTable::getColor( size_t _nIndex ) const
void SvxChartColorTable::clear() void SvxChartColorTable::clear()
{ {
m_aColorEntries.clear(); m_aColorEntries.clear();
nNextElementNumber = 1;
} }
void SvxChartColorTable::append( const XColorEntry & _rEntry ) void SvxChartColorTable::append( const XColorEntry & _rEntry )
...@@ -127,8 +114,8 @@ OUString SvxChartColorTable::getDefaultName( size_t _nIndex ) ...@@ -127,8 +114,8 @@ OUString SvxChartColorTable::getDefaultName( size_t _nIndex )
{ {
OUString aName; OUString aName;
if (sDefaultNamePrefix.getLength() == 0) OUString sDefaultNamePrefix;
{ OUString sDefaultNamePostfix;
OUString aResName( CuiResId( RID_SVXSTR_DIAGRAM_ROW ) ); OUString aResName( CuiResId( RID_SVXSTR_DIAGRAM_ROW ) );
sal_Int32 nPos = aResName.indexOf( "$(ROW)" ); sal_Int32 nPos = aResName.indexOf( "$(ROW)" );
if( nPos != -1 ) if( nPos != -1 )
...@@ -140,10 +127,8 @@ OUString SvxChartColorTable::getDefaultName( size_t _nIndex ) ...@@ -140,10 +127,8 @@ OUString SvxChartColorTable::getDefaultName( size_t _nIndex )
{ {
sDefaultNamePrefix = aResName; sDefaultNamePrefix = aResName;
} }
}
aName = sDefaultNamePrefix + OUString::number(_nIndex + 1) + sDefaultNamePostfix; aName = sDefaultNamePrefix + OUString::number(_nIndex + 1) + sDefaultNamePostfix;
nNextElementNumber++;
return aName; return aName;
} }
......
...@@ -30,14 +30,8 @@ class SvxChartColorTable ...@@ -30,14 +30,8 @@ class SvxChartColorTable
{ {
private: private:
std::vector< XColorEntry > m_aColorEntries; std::vector< XColorEntry > m_aColorEntries;
int nNextElementNumber;
OUString sDefaultNamePrefix;
OUString sDefaultNamePostfix;
public: public:
SvxChartColorTable();
explicit SvxChartColorTable( const SvxChartColorTable & _rSource );
// accessors // accessors
size_t size() const; size_t size() const;
const XColorEntry & operator[]( size_t _nIndex ) const; const XColorEntry & operator[]( size_t _nIndex ) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment