summaryrefslogtreecommitdiff
path: root/sc/source/ui/docshell/docfunc.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2010-09-16 10:35:22 +0200
committerFridrich Štrba <fridrich.strba@bluewin.ch>2010-09-16 10:35:22 +0200
commitfbf28ef12b3087bd1df7b79645685955d60ba911 (patch)
tree492417136dfefefda53b5fbecf4b402c3b943724 /sc/source/ui/docshell/docfunc.cxx
parentd8bb8c4fb850b9de762567ed7d337972467470d6 (diff)
calc-jump-on-formula-ref-sc.diff: Migrated
n#464359, i#101018 allow ctrl-[ and ctrl-] to jump to references used in a formula expression.
Diffstat (limited to 'sc/source/ui/docshell/docfunc.cxx')
-rw-r--r--sc/source/ui/docshell/docfunc.cxx39
1 files changed, 39 insertions, 0 deletions
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 36b6641d94a6..b6bb1483adfe 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -106,6 +106,7 @@
using namespace com::sun::star;
using ::com::sun::star::uno::Sequence;
+using ::std::vector;
// STATIC DATA -----------------------------------------------------------
@@ -536,6 +537,44 @@ BOOL ScDocFunc::DetectiveRefresh( BOOL bAutomatic )
return bDone;
}
+static void lcl_collectAllPredOrSuccRanges(
+ const ScRangeList& rSrcRanges, vector<ScSharedTokenRef>& rRefTokens, ScDocShell& rDocShell,
+ bool bPred)
+{
+ ScDocument* pDoc = rDocShell.GetDocument();
+ vector<ScSharedTokenRef> aRefTokens;
+ ScRangeList aSrcRanges(rSrcRanges);
+ ScRange* p = aSrcRanges.First();
+ if (!p)
+ return;
+ ScDetectiveFunc aDetFunc(pDoc, p->aStart.Tab());
+ ScRangeList aDestRanges;
+ for (; p; p = aSrcRanges.Next())
+ {
+ if (bPred)
+ {
+ aDetFunc.GetAllPreds(
+ p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(), aRefTokens);
+ }
+ else
+ {
+ aDetFunc.GetAllSuccs(
+ p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(), aRefTokens);
+ }
+ }
+ rRefTokens.swap(aRefTokens);
+}
+
+void ScDocFunc::DetectiveCollectAllPreds(const ScRangeList& rSrcRanges, vector<ScSharedTokenRef>& rRefTokens)
+{
+ lcl_collectAllPredOrSuccRanges(rSrcRanges, rRefTokens, rDocShell, true);
+}
+
+void ScDocFunc::DetectiveCollectAllSuccs(const ScRangeList& rSrcRanges, vector<ScSharedTokenRef>& rRefTokens)
+{
+ lcl_collectAllPredOrSuccRanges(rSrcRanges, rRefTokens, rDocShell, false);
+}
+
//------------------------------------------------------------------------
BOOL ScDocFunc::DeleteContents( const ScMarkData& rMark, USHORT nFlags,