[Libreoffice-commits] core.git: sc/source
Rachit Gupta
rachitgupta1792 at gmail.com
Sat Feb 8 13:32:50 PST 2014
sc/source/ui/app/inputhdl.cxx | 4 ++--
sc/source/ui/app/rfindlst.cxx | 17 ++++++++++++++++-
sc/source/ui/inc/rfindlst.hxx | 11 +++++++----
sc/source/ui/view/gridwin4.cxx | 2 +-
4 files changed, 26 insertions(+), 8 deletions(-)
New commits:
commit 5ff8e1d8e31f23492ee1ccc3af0b73791cd5101b
Author: Rachit Gupta <rachitgupta1792 at gmail.com>
Date: Sat Jan 18 16:07:02 2014 +0530
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
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 531a244..53ea0bb 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 f24b9eb..b3c16f4 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];
}
diff --git a/sc/source/ui/inc/rfindlst.hxx b/sc/source/ui/inc/rfindlst.hxx
index 090ea65..28f1fac 100644
--- a/sc/source/ui/inc/rfindlst.hxx
+++ b/sc/source/ui/inc/rfindlst.hxx
@@ -28,12 +28,15 @@
struct ScRangeFindData
{
- ScRange aRef;
- sal_uInt16 nFlags;
+ ScRange aRef;
+ sal_uInt16 nFlags;
sal_Int32 nSelStart;
sal_Int32 nSelEnd;
ScRangeFindData( const ScRange& rR, sal_uInt16 nF, sal_Int32 nS, sal_Int32 nE ) :
+ ColorData nColorData;
+
+ ScRangeFindData( const ScRange& rR, sal_uInt16 nF, xub_StrLen nS, xub_StrLen nE) :
aRef(rR), nFlags(nF), nSelStart(nS), nSelEnd(nE) {}
};
@@ -47,7 +50,7 @@ public:
ScRangeFindList(const OUString& rName);
sal_uLong Count() const { return maEntries.size(); }
- void Insert( const ScRangeFindData &rNew ) { maEntries.push_back(rNew); }
+ ColorData Insert( const ScRangeFindData &rNew );
ScRangeFindData* GetObject( sal_uLong nIndex ) { return &(maEntries[nIndex]); }
@@ -56,7 +59,7 @@ public:
const OUString& GetDocName() const { return aDocName; }
bool IsHidden() const { return bHidden; }
- static ColorData GetColorName( size_t nIndex );
+ static ColorData GetColorName(const size_t nIndex);
};
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 6390f8b..729073b 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -805,7 +805,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
if ( aRef.aStart.Tab() >= nTab && aRef.aEnd.Tab() <= nTab )
aOutputData.DrawRefMark( aRef.aStart.Col(), aRef.aStart.Row(),
aRef.aEnd.Col(), aRef.aEnd.Row(),
- Color( ScRangeFindList::GetColorName( i ) ),
+ Color( pData->nColorData ),
sal_True );
}
}
More information about the Libreoffice-commits
mailing list