diff options
author | Rachit Gupta <rachitgupta1792@gmail.com> | 2014-01-18 16:07:02 +0530 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-02-08 22:30:56 +0100 |
commit | 5ff8e1d8e31f23492ee1ccc3af0b73791cd5101b (patch) | |
tree | 5b3f60402f2e7842f8d6ef1eb2e5c1495a7d5e01 /sc/source/ui/app | |
parent | dec544be7c929a5c006008ddd3b901f18f4fbbe1 (diff) |
fdo#52461 Multiple instances of same cell now get same color.
nColorData added to ScRangeFindData for color assigned to cell.
While inserting a range in maEntries, vector is checked.
If the range is already present, the color is returned.
Else, a new entry is pushed in the vector and it's color is returned.
Conflicts:
sc/source/ui/inc/rfindlst.hxx
Change-Id: I38b93092cd22fa42ada55fa5d28eec9b71c12703
Diffstat (limited to 'sc/source/ui/app')
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/app/rfindlst.cxx | 17 |
2 files changed, 18 insertions, 3 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 531a2443103a..53ea0bbb2ff3 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -277,11 +277,11 @@ handle_r1c1: pRangeFindList = new ScRangeFindList( pDocSh->GetTitle() ); } - pRangeFindList->Insert( ScRangeFindData( aRange, nFlags, nStart, nPos ) ); + ColorData nColorData = pRangeFindList->Insert( ScRangeFindData( aRange, nFlags, nStart, nPos ) ); ESelection aSel( 0, nStart, 0, nPos ); SfxItemSet aSet( pEngine->GetEmptyItemSet() ); - aSet.Put( SvxColorItem( Color( ScRangeFindList::GetColorName( nCount ) ), + aSet.Put( SvxColorItem( Color( nColorData ), EE_CHAR_COLOR ) ); pEngine->QuickSetAttribs( aSet, aSel ); ++nCount; diff --git a/sc/source/ui/app/rfindlst.cxx b/sc/source/ui/app/rfindlst.cxx index f24b9eb63f44..b3c16f4a5245 100644 --- a/sc/source/ui/app/rfindlst.cxx +++ b/sc/source/ui/app/rfindlst.cxx @@ -35,7 +35,22 @@ ScRangeFindList::ScRangeFindList(const OUString& rName) : { } -ColorData ScRangeFindList::GetColorName( size_t nIndex ) +ColorData ScRangeFindList::Insert( const ScRangeFindData &rNew ) +{ + for(std::vector<ScRangeFindData>::iterator it=maEntries.begin(); it!=maEntries.end(); ++it) + { + if(it->aRef == rNew.aRef) + { + return it->nColorData; + } + } + ScRangeFindData insertData(rNew); + insertData.nColorData = aColNames[maEntries.size() % SC_RANGECOLORS]; + maEntries.push_back(insertData); + return insertData.nColorData; +} + +ColorData ScRangeFindList::GetColorName( const size_t nIndex ) { return aColNames[nIndex % SC_RANGECOLORS]; } |