diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-05-09 06:17:47 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-05-09 06:17:47 +0200 |
commit | 9cfab5c687b337b035179561af49c16eea93b459 (patch) | |
tree | 454187497c319220b794ac3f900c6340c8c269cd /sc | |
parent | a2a9f197f3f3e16ef5efa1d9c35e0d1fee4e3c71 (diff) |
index is 1-based in this case
Change-Id: I74aae3f422423de09cb012e274f8d536f8b778f1
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/colorscale.cxx | 5 | ||||
-rw-r--r-- | sc/source/core/data/documen4.cxx | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index 4e74d1e8de77..787690dbe048 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -148,12 +148,13 @@ void ScColorScaleFormatList::AddFormat( ScColorScaleFormat* pFormat ) maColorScaleFormats.push_back( pFormat ); } +// attention nFormat is 1 based, 0 is reserved for no format ScColorScaleFormat* ScColorScaleFormatList::GetFormat(sal_uInt32 nFormat) { - if( nFormat >= size() ) + if( nFormat > size() || !nFormat ) return NULL; - return &maColorScaleFormats[nFormat]; + return &maColorScaleFormats[nFormat-1]; } ScColorScaleFormatList::iterator ScColorScaleFormatList::begin() diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index 7df52ccb2ff1..b936699d88d7 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -629,6 +629,7 @@ sal_uLong ScDocument::AddCondFormat( const ScConditionalFormat& rNew ) } //takes ownership +// returns a 1-based index, 0 is reserved for no entry sal_uLong ScDocument::AddColorScaleFormat( ScColorScaleFormat* pNew ) { if(!pNew) @@ -639,7 +640,7 @@ sal_uLong ScDocument::AddColorScaleFormat( ScColorScaleFormat* pNew ) mpColorScaleList->AddFormat( pNew ); - return mpColorScaleList->size()-1; + return mpColorScaleList->size(); } sal_uLong ScDocument::AddValidationEntry( const ScValidationData& rNew ) |