summaryrefslogtreecommitdiff
path: root/cui/source/options/cfgchart.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'cui/source/options/cfgchart.cxx')
-rw-r--r--cui/source/options/cfgchart.cxx50
1 files changed, 35 insertions, 15 deletions
diff --git a/cui/source/options/cfgchart.cxx b/cui/source/options/cfgchart.cxx
index 4b449a0a16e7..0d406cd9156f 100644
--- a/cui/source/options/cfgchart.cxx
+++ b/cui/source/options/cfgchart.cxx
@@ -43,7 +43,8 @@ SvxChartColorTable::SvxChartColorTable()
{}
SvxChartColorTable::SvxChartColorTable( const SvxChartColorTable & _rSource ) :
- m_aColorEntries( _rSource.m_aColorEntries )
+ m_aColorEntries( _rSource.m_aColorEntries ),
+ nNextElementNumber( m_aColorEntries.size() + 1 )
{}
// accessors
@@ -79,6 +80,7 @@ ColorData SvxChartColorTable::getColorData( size_t _nIndex ) const
void SvxChartColorTable::clear()
{
m_aColorEntries.clear();
+ nNextElementNumber = 1;
}
void SvxChartColorTable::append( const XColorEntry & _rEntry )
@@ -86,6 +88,12 @@ void SvxChartColorTable::append( const XColorEntry & _rEntry )
m_aColorEntries.push_back( _rEntry );
}
+void SvxChartColorTable::remove( size_t _nIndex )
+{
+ if (m_aColorEntries.size() > 0)
+ m_aColorEntries.erase( m_aColorEntries.begin() + _nIndex);
+}
+
void SvxChartColorTable::replace( size_t _nIndex, const XColorEntry & _rEntry )
{
DBG_ASSERT( _nIndex <= m_aColorEntries.size(),
@@ -113,25 +121,37 @@ void SvxChartColorTable::useDefault()
clear();
- String aResName( CUI_RES( RID_SVXSTR_DIAGRAM_ROW ) );
- String aPrefix, aPostfix, aName;
- xub_StrLen nPos = aResName.SearchAscii( "$(ROW)" );
- if( nPos != STRING_NOTFOUND )
+ for( sal_Int32 i=0; i<ROW_COLOR_COUNT; i++ )
{
- aPrefix = String( aResName, 0, nPos );
- aPostfix = String( aResName, nPos + sizeof( "$(ROW)" ) - 1, STRING_LEN );
+ append( XColorEntry( aColors[ i % sizeof( aColors ) ], getNextDefaultName() ));
}
- else
- aPrefix = aResName;
+}
- for( sal_Int32 i=0; i<ROW_COLOR_COUNT; i++ )
- {
- aName = aPrefix;
- aName.Append( String::CreateFromInt32( i + 1 ));
- aName.Append( aPostfix );
+String SvxChartColorTable::getNextDefaultName()
+{
+ String aName;
- append( XColorEntry( aColors[ i % sizeof( aColors ) ], aName ));
+ if (sDefaultNamePrefix.Len() == 0)
+ {
+ String aResName( CUI_RES( RID_SVXSTR_DIAGRAM_ROW ) );
+ xub_StrLen nPos = aResName.SearchAscii( "$(ROW)" );
+ if( nPos != STRING_NOTFOUND )
+ {
+ sDefaultNamePrefix = String( aResName, 0, nPos );
+ sDefaultNamePostfix = String( aResName, nPos + sizeof( "$(ROW)" ) - 1, STRING_LEN );
+ }
+ else
+ {
+ sDefaultNamePrefix = aResName;
+ }
}
+
+ aName = sDefaultNamePrefix;
+ aName.Append( String::CreateFromInt32 ( nNextElementNumber ) );
+ aName.Append( sDefaultNamePostfix );
+ nNextElementNumber++;
+
+ return aName;
}
// comparison