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 @@
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;
}
......
......@@ -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;
......
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