update dev300-m58
[ooovba.git] / applied_patches / 0168-calc-jump-on-formula-ref-sc.diff
blobce24a0a92dc550863beb5c7c5b305a0dbc292cad
1 diff --git sc/inc/cell.hxx sc/inc/cell.hxx
2 index 5ec1281..4c1afdb 100644
3 --- sc/inc/cell.hxx
4 +++ sc/inc/cell.hxx
5 @@ -662,6 +662,7 @@ private:
6 public:
7 ScDetectiveRefIter( ScFormulaCell* pCell );
8 BOOL GetNextRef( ScRange& rRange );
9 + ScToken* GetNextRefToken();
12 // ============================================================================
13 diff --git sc/inc/detfunc.hxx sc/inc/detfunc.hxx
14 index 49a7938..c38150d 100644
15 --- sc/inc/detfunc.hxx
16 +++ sc/inc/detfunc.hxx
17 @@ -35,6 +35,9 @@
18 #include <tools/gen.hxx>
19 #include <tools/color.hxx>
20 #include "scdllapi.h"
21 +#include "token.hxx"
23 +#include <vector>
25 class SdrObject;
26 class SdrPage;
27 @@ -46,6 +49,7 @@ class ScDetectiveData;
28 class ScDocument;
29 class ScAddress;
30 class ScRange;
31 +class ScRangeList;
33 #define SC_DET_MAXCIRCLE 1000
35 @@ -146,6 +150,9 @@ public:
37 BOOL MarkInvalid(BOOL& rOverflow);
39 + void GetAllPreds(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ::std::vector<ScSharedTokenRef>& rRefTokens);
40 + void GetAllSuccs(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ::std::vector<ScSharedTokenRef>& rRefTokens);
42 static void UpdateAllComments( ScDocument& rDoc ); // on all tables
43 void UpdateAllArrowColors(); // on all tables
45 diff --git sc/inc/reftokenhelper.hxx sc/inc/reftokenhelper.hxx
46 index d7b335f..44619ab 100644
47 --- sc/inc/reftokenhelper.hxx
48 +++ sc/inc/reftokenhelper.hxx
49 @@ -78,6 +78,9 @@ public:
50 static void join(::std::vector<ScSharedTokenRef>& rTokens, const ScSharedTokenRef& pToken);
52 static bool getDoubleRefDataFromToken(ScComplexRefData& rData, const ScSharedTokenRef& pToken);
54 + static ScSharedTokenRef createRefToken(const ScAddress& rAddr);
55 + static ScSharedTokenRef createRefToken(const ScRange& rRange);
58 #endif
59 diff --git sc/inc/sc.hrc sc/inc/sc.hrc
60 index bd688c8..340416b 100644
61 --- sc/inc/sc.hrc
62 +++ sc/inc/sc.hrc
63 @@ -900,6 +900,9 @@
64 #define SID_DETECTIVE_REFRESH (DETECTIVE_START+14)
65 #define SID_DETECTIVE_AUTO (DETECTIVE_START+15)
67 +#define SID_DETECTIVE_MARK_PRED (DETECTIVE_START+16)
68 +#define SID_DETECTIVE_MARK_SUCC (DETECTIVE_START+17)
70 #define DETECTIVE_END (DETECTIVE_START+20)
72 #define SID_API_SLOTS (DETECTIVE_END)
73 diff --git sc/sdi/cellsh.sdi sc/sdi/cellsh.sdi
74 index 05ab23c..b22589b 100644
75 --- sc/sdi/cellsh.sdi
76 +++ sc/sdi/cellsh.sdi
77 @@ -113,6 +113,8 @@ interface CellSelection
78 SID_DETECTIVE_ADD_ERR [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
79 SID_DETECTIVE_INVALID [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
80 SID_DETECTIVE_REFRESH [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
81 + SID_DETECTIVE_MARK_PRED [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
82 + SID_DETECTIVE_MARK_SUCC [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
83 FID_INS_ROW [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ]
84 FID_INS_COLUMN [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ]
85 FID_INS_CELLSDOWN [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ]
86 diff --git sc/sdi/scalc.sdi sc/sdi/scalc.sdi
87 index 66c0a09..f8eddc2 100644
88 --- sc/sdi/scalc.sdi
89 +++ sc/sdi/scalc.sdi
90 @@ -7899,4 +7899,53 @@ SfxBoolItem ToggleSheetGrid FID_TAB_TOGGLE_GRID
91 GroupId = GID_FORMAT;
94 +//--------------------------------------------------------------------------
95 +SfxVoidItem MarkPrecedents SID_DETECTIVE_MARK_PRED
96 +()
98 + /* flags: */
99 + AutoUpdate = FALSE,
100 + Cachable = Cachable,
101 + FastCall = FALSE,
102 + HasCoreId = FALSE,
103 + HasDialog = FALSE,
104 + ReadOnlyDoc = TRUE,
105 + Toggle = FALSE,
106 + Container = FALSE,
107 + RecordAbsolute = FALSE,
108 + RecordPerSet;
109 + Synchron;
111 + /* config: */
112 + AccelConfig = TRUE,
113 + MenuConfig = TRUE,
114 + StatusBarConfig = FALSE,
115 + ToolBoxConfig = FALSE,
116 + GroupId = GID_OPTIONS;
119 +//--------------------------------------------------------------------------
120 +SfxVoidItem MarkDependents SID_DETECTIVE_MARK_SUCC
123 + /* flags: */
124 + AutoUpdate = FALSE,
125 + Cachable = Cachable,
126 + FastCall = FALSE,
127 + HasCoreId = FALSE,
128 + HasDialog = FALSE,
129 + ReadOnlyDoc = TRUE,
130 + Toggle = FALSE,
131 + Container = FALSE,
132 + RecordAbsolute = FALSE,
133 + RecordPerSet;
134 + Synchron;
136 + /* config: */
137 + AccelConfig = TRUE,
138 + MenuConfig = TRUE,
139 + StatusBarConfig = FALSE,
140 + ToolBoxConfig = FALSE,
141 + GroupId = GID_OPTIONS;
144 diff --git sc/source/core/data/cell.cxx sc/source/core/data/cell.cxx
145 index 1c3035c..4d5773d 100644
146 --- sc/source/core/data/cell.cxx
147 +++ sc/source/core/data/cell.cxx
148 @@ -1954,7 +1954,7 @@ BOOL lcl_ScDetectiveRefIter_SkipRef( ScToken* p )
149 if ( rRef1.IsColDeleted() || rRef1.IsRowDeleted() || rRef1.IsTabDeleted()
150 || !rRef1.Valid() )
151 return TRUE;
152 - if ( p->GetType() == svDoubleRef )
153 + if ( p->GetType() == svDoubleRef || p->GetType() == svExternalDoubleRef )
155 ScSingleRefData& rRef2 = p->GetDoubleRef().Ref2;
156 if ( rRef2.IsColDeleted() || rRef2.IsRowDeleted() || rRef2.IsTabDeleted()
157 @@ -1967,7 +1967,20 @@ BOOL lcl_ScDetectiveRefIter_SkipRef( ScToken* p )
158 BOOL ScDetectiveRefIter::GetNextRef( ScRange& rRange )
160 BOOL bRet = FALSE;
161 + ScToken* p = GetNextRefToken();
162 + if( p )
164 + SingleDoubleRefProvider aProv( *p );
165 + rRange.aStart.Set( aProv.Ref1.nCol, aProv.Ref1.nRow, aProv.Ref1.nTab );
166 + rRange.aEnd.Set( aProv.Ref2.nCol, aProv.Ref2.nRow, aProv.Ref2.nTab );
167 + bRet = TRUE;
170 + return bRet;
173 +ScToken* ScDetectiveRefIter::GetNextRefToken()
175 ScToken* p = static_cast<ScToken*>(pCode->GetNextReferenceRPN());
176 if (p)
177 p->CalcAbsIfRel( aPos );
178 @@ -1978,16 +1991,7 @@ BOOL ScDetectiveRefIter::GetNextRef( ScRange& rRange )
179 if (p)
180 p->CalcAbsIfRel( aPos );
183 - if( p )
185 - SingleDoubleRefProvider aProv( *p );
186 - rRange.aStart.Set( aProv.Ref1.nCol, aProv.Ref1.nRow, aProv.Ref1.nTab );
187 - rRange.aEnd.Set( aProv.Ref2.nCol, aProv.Ref2.nRow, aProv.Ref2.nTab );
188 - bRet = TRUE;
191 - return bRet;
192 + return p;
195 // ============================================================================
196 diff --git sc/source/core/tool/detfunc.cxx sc/source/core/tool/detfunc.cxx
197 index 7680bda..99e0e71 100644
198 --- sc/source/core/tool/detfunc.cxx
199 +++ sc/source/core/tool/detfunc.cxx
200 @@ -80,6 +80,12 @@
201 #include "attrib.hxx"
202 #include "scmod.hxx"
203 #include "postit.hxx"
204 +#include "rangelst.hxx"
205 +#include "reftokenhelper.hxx"
207 +#include <vector>
209 +using ::std::vector;
211 //------------------------------------------------------------------------
213 @@ -1407,6 +1413,52 @@ BOOL ScDetectiveFunc::MarkInvalid(BOOL& rOverflow)
214 return ( bDeleted || nInsCount != 0 );
217 +void ScDetectiveFunc::GetAllPreds(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
218 + vector<ScSharedTokenRef>& rRefTokens)
220 + ScCellIterator aCellIter(pDoc, nCol1, nRow1, nTab, nCol2, nRow2, nTab);
221 + for (ScBaseCell* pCell = aCellIter.GetFirst(); pCell; pCell = aCellIter.GetNext())
223 + if (pCell->GetCellType() != CELLTYPE_FORMULA)
224 + continue;
226 + ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pCell);
227 + ScDetectiveRefIter aRefIter(pFCell);
228 + for (ScToken* p = aRefIter.GetNextRefToken(); p; p = aRefIter.GetNextRefToken())
230 + ScSharedTokenRef pRef(static_cast<ScToken*>(p->Clone()));
231 + ScRefTokenHelper::join(rRefTokens, pRef);
236 +void ScDetectiveFunc::GetAllSuccs(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
237 + vector<ScSharedTokenRef>& rRefTokens)
239 + vector<ScSharedTokenRef> aSrcRange;
240 + aSrcRange.push_back(
241 + ScRefTokenHelper::createRefToken(ScRange(nCol1, nRow1, nTab, nCol2, nRow2, nTab)));
243 + ScCellIterator aCellIter(pDoc, 0, 0, nTab, MAXCOL, MAXROW, nTab);
244 + for (ScBaseCell* pCell = aCellIter.GetFirst(); pCell; pCell = aCellIter.GetNext())
246 + if (pCell->GetCellType() != CELLTYPE_FORMULA)
247 + continue;
249 + ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pCell);
250 + ScDetectiveRefIter aRefIter(pFCell);
251 + for (ScToken* p = aRefIter.GetNextRefToken(); p; p = aRefIter.GetNextRefToken())
253 + ScSharedTokenRef pRef(static_cast<ScToken*>(p->Clone()));
254 + if (ScRefTokenHelper::intersects(aSrcRange, pRef))
256 + pRef = ScRefTokenHelper::createRefToken(aCellIter.GetPos());
257 + ScRefTokenHelper::join(rRefTokens, pRef);
263 void ScDetectiveFunc::UpdateAllComments( ScDocument& rDoc )
265 // for all caption objects, update attributes and SpecialTextBoxShadow flag
266 diff --git sc/source/core/tool/reftokenhelper.cxx sc/source/core/tool/reftokenhelper.cxx
267 index ed196e0..635df6e 100644
268 --- sc/source/core/tool/reftokenhelper.cxx
269 +++ sc/source/core/tool/reftokenhelper.cxx
270 @@ -475,3 +475,19 @@ bool ScRefTokenHelper::getDoubleRefDataFromToken(ScComplexRefData& rData, const
272 return true;
275 +ScSharedTokenRef ScRefTokenHelper::createRefToken(const ScAddress& rAddr)
277 + ScSingleRefData aRefData;
278 + aRefData.InitAddress(rAddr);
279 + ScSharedTokenRef pRef(new ScSingleRefToken(aRefData));
280 + return pRef;
283 +ScSharedTokenRef ScRefTokenHelper::createRefToken(const ScRange& rRange)
285 + ScComplexRefData aRefData;
286 + aRefData.InitRange(rRange);
287 + ScSharedTokenRef pRef(new ScDoubleRefToken(aRefData));
288 + return pRef;
290 diff --git sc/source/ui/docshell/docfunc.cxx sc/source/ui/docshell/docfunc.cxx
291 index f55b697..a289649 100644
292 --- sc/source/ui/docshell/docfunc.cxx
293 +++ sc/source/ui/docshell/docfunc.cxx
294 @@ -102,6 +102,7 @@
296 using namespace com::sun::star;
297 using ::com::sun::star::uno::Sequence;
298 +using ::std::vector;
300 // STATIC DATA -----------------------------------------------------------
302 @@ -524,6 +525,44 @@ BOOL ScDocFunc::DetectiveRefresh( BOOL bAutomatic )
303 return bDone;
306 +static void lcl_collectAllPredOrSuccRanges(
307 + const ScRangeList& rSrcRanges, vector<ScSharedTokenRef>& rRefTokens, ScDocShell& rDocShell,
308 + bool bPred)
310 + ScDocument* pDoc = rDocShell.GetDocument();
311 + vector<ScSharedTokenRef> aRefTokens;
312 + ScRangeList aSrcRanges(rSrcRanges);
313 + ScRange* p = aSrcRanges.First();
314 + if (!p)
315 + return;
316 + ScDetectiveFunc aDetFunc(pDoc, p->aStart.Tab());
317 + ScRangeList aDestRanges;
318 + for (; p; p = aSrcRanges.Next())
320 + if (bPred)
321 + {
322 + aDetFunc.GetAllPreds(
323 + p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(), aRefTokens);
325 + else
326 + {
327 + aDetFunc.GetAllSuccs(
328 + p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(), aRefTokens);
331 + rRefTokens.swap(aRefTokens);
334 +void ScDocFunc::DetectiveCollectAllPreds(const ScRangeList& rSrcRanges, vector<ScSharedTokenRef>& rRefTokens)
336 + lcl_collectAllPredOrSuccRanges(rSrcRanges, rRefTokens, rDocShell, true);
339 +void ScDocFunc::DetectiveCollectAllSuccs(const ScRangeList& rSrcRanges, vector<ScSharedTokenRef>& rRefTokens)
341 + lcl_collectAllPredOrSuccRanges(rSrcRanges, rRefTokens, rDocShell, false);
344 //------------------------------------------------------------------------
346 BOOL ScDocFunc::DeleteContents( const ScMarkData& rMark, USHORT nFlags,
347 diff --git sc/source/ui/inc/docfunc.hxx sc/source/ui/inc/docfunc.hxx
348 index 6a1bf00..302b07d 100644
349 --- sc/source/ui/inc/docfunc.hxx
350 +++ sc/source/ui/inc/docfunc.hxx
351 @@ -34,7 +34,10 @@
352 #include <tools/link.hxx>
353 #include "global.hxx"
354 #include "formula/grammar.hxx"
355 #include "tabbgcolor.hxx"
356 +#include "token.hxx"
358 +#include <vector>
360 class ScEditEngineDefaulter;
361 class SdrUndoAction;
362 @@ -42,6 +45,7 @@ class ScDocShell;
363 class ScMarkData;
364 class ScPatternAttr;
365 class ScRange;
366 +class ScRangeList;
367 class ScRangeName;
368 class ScBaseCell;
369 class ScTokenArray;
370 @@ -77,6 +81,8 @@ public:
371 BOOL DetectiveMarkInvalid(SCTAB nTab);
372 BOOL DetectiveDelAll(SCTAB nTab);
373 BOOL DetectiveRefresh(BOOL bAutomatic = FALSE);
374 + void DetectiveCollectAllPreds(const ScRangeList& rSrcRanges, ::std::vector<ScSharedTokenRef>& rRefTokens);
375 + void DetectiveCollectAllSuccs(const ScRangeList& rSrcRanges, ::std::vector<ScSharedTokenRef>& rRefTokens);
377 BOOL DeleteContents( const ScMarkData& rMark, USHORT nFlags,
378 BOOL bRecord, BOOL bApi );
379 diff --git sc/source/ui/inc/viewfunc.hxx sc/source/ui/inc/viewfunc.hxx
380 index 7bf556d..7bd9a26 100644
381 --- sc/source/ui/inc/viewfunc.hxx
382 +++ sc/source/ui/inc/viewfunc.hxx
383 @@ -326,6 +326,8 @@ public:
384 void DetectiveMarkInvalid();
385 void DetectiveDelAll();
386 void DetectiveRefresh();
387 + void DetectiveMarkPred();
388 + void DetectiveMarkSucc();
390 void ShowNote( bool bShow = true );
391 inline void HideNote() { ShowNote( false ); }
392 @@ -366,6 +368,8 @@ private:
393 BOOL TestFormatArea( SCCOL nCol, SCROW nRow, SCTAB nTab, BOOL bAttrChanged );
394 void DoAutoAttributes( SCCOL nCol, SCROW nRow, SCTAB nTab,
395 BOOL bAttrChanged, BOOL bAddUndo );
397 + void MarkAndJumpToRanges(const ScRangeList& rRanges);
401 diff --git sc/source/ui/view/cellsh1.cxx sc/source/ui/view/cellsh1.cxx
402 index 0cd4007..d6fdb75 100644
403 --- sc/source/ui/view/cellsh1.cxx
404 +++ sc/source/ui/view/cellsh1.cxx
405 @@ -1584,6 +1584,13 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
406 rReq.Done();
407 break;
409 + case SID_DETECTIVE_MARK_PRED:
410 + pTabViewShell->DetectiveMarkPred();
411 + break;
412 + case SID_DETECTIVE_MARK_SUCC:
413 + pTabViewShell->DetectiveMarkSucc();
414 + break;
416 case SID_SPELL_DIALOG:
417 // pTabViewShell->DoSpellingChecker();
419 diff --git sc/source/ui/view/gridwin.cxx sc/source/ui/view/gridwin.cxx
420 index 57f1996..2b2ec31 100644
421 --- sc/source/ui/view/gridwin.cxx
422 +++ sc/source/ui/view/gridwin.cxx
423 @@ -3078,6 +3078,17 @@ void __EXPORT ScGridWindow::KeyInput(const KeyEvent& rKEvt)
424 ShowNoteMarker( pViewData->GetCurX(), pViewData->GetCurY(), TRUE );
425 return;
427 + if (aCode.GetCode() == KEY_BRACKETLEFT && aCode.GetModifier() == KEY_MOD1)
429 + pViewSh->DetectiveMarkPred();
430 + return;
432 + if (aCode.GetCode() == KEY_BRACKETRIGHT && aCode.GetModifier() == KEY_MOD1)
434 + pViewSh->DetectiveMarkSucc();
435 + return;
440 Window::KeyInput(rKEvt);
441 diff --git sc/source/ui/view/tabvwsh3.cxx sc/source/ui/view/tabvwsh3.cxx
442 index e106539..eb4c908 100644
443 --- sc/source/ui/view/tabvwsh3.cxx
444 +++ sc/source/ui/view/tabvwsh3.cxx
445 @@ -407,13 +407,15 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
447 pViewData->ResetOldCursor();
448 SetCursor( nCol, nRow );
449 - AlignToCursor( nCol, nRow, SC_FOLLOW_JUMP );
450 rBindings.Invalidate( SID_CURRENTCELL );
451 rBindings.Update( nSlot );
453 if (!rReq.IsAPI())
454 rReq.Done();
456 + // align to cursor even if the cursor position hasn't changed,
457 + // because the cursor may be set outside the visible area.
458 + AlignToCursor( nCol, nRow, SC_FOLLOW_JUMP );
460 rReq.SetReturnValue( SfxStringItem( SID_CURRENTCELL, aAddress ) );
462 diff --git sc/source/ui/view/viewfun6.cxx sc/source/ui/view/viewfun6.cxx
463 index 43b3db1..e686cfc 100644
464 --- sc/source/ui/view/viewfun6.cxx
465 +++ sc/source/ui/view/viewfun6.cxx
466 @@ -50,6 +50,13 @@
467 #include "globstr.hrc"
468 #include "sc.hrc"
469 #include "fusel.hxx"
470 +#include "reftokenhelper.hxx"
471 +#include "externalrefmgr.hxx"
473 +#include <vector>
475 +using ::rtl::OUStringBuffer;
476 +using ::std::vector;
478 //==================================================================
480 @@ -140,6 +147,136 @@ void ScViewFunc::DetectiveRefresh()
481 RecalcPPT();
484 +static void lcl_jumpToRange(const ScRange& rRange, ScViewData* pView, ScDocument* pDoc)
486 + String aAddrText;
487 + rRange.Format(aAddrText, SCR_ABS_3D, pDoc);
488 + SfxStringItem aPosItem(SID_CURRENTCELL, aAddrText);
489 + SfxBoolItem aUnmarkItem(FN_PARAM_1, TRUE); // remove existing selection
490 + pView->GetDispatcher().Execute(
491 + SID_CURRENTCELL, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD,
492 + &aPosItem, &aUnmarkItem, 0L);
495 +void ScViewFunc::MarkAndJumpToRanges(const ScRangeList& rRanges)
497 + ScViewData* pView = GetViewData();
498 + ScDocShell* pDocSh = pView->GetDocShell();
500 + ScRangeList aRanges(rRanges);
501 + ScRange* p = aRanges.First();
502 + ScRangeList aRangesToMark;
503 + ScAddress aCurPos = pView->GetCurPos();
504 + for (; p; p = aRanges.Next())
506 + // Collect only those ranges that are on the same sheet as the current
507 + // cursor.
509 + if (p->aStart.Tab() == aCurPos.Tab())
510 + aRangesToMark.Append(*p);
513 + if (!aRangesToMark.Count())
514 + return;
516 + // Jump to the first range of all precedent ranges.
517 + p = aRangesToMark.First();
518 + lcl_jumpToRange(*p, pView, pDocSh->GetDocument());
520 + for (; p; p = aRangesToMark.Next())
521 + MarkRange(*p, false, true);
524 +void ScViewFunc::DetectiveMarkPred()
526 + ScViewData* pView = GetViewData();
527 + ScDocShell* pDocSh = pView->GetDocShell();
528 + ScDocument* pDoc = pDocSh->GetDocument();
529 + ScMarkData& rMarkData = pView->GetMarkData();
530 + ScAddress aCurPos = pView->GetCurPos();
531 + ScRangeList aRanges;
532 + if (rMarkData.IsMarked() || rMarkData.IsMultiMarked())
533 + rMarkData.FillRangeListWithMarks(&aRanges, false);
534 + else
535 + aRanges.Append(aCurPos);
537 + vector<ScSharedTokenRef> aRefTokens;
538 + pDocSh->GetDocFunc().DetectiveCollectAllPreds(aRanges, aRefTokens);
540 + if (aRefTokens.empty())
541 + // No precedents found. Nothing to do.
542 + return;
544 + ScSharedTokenRef p = aRefTokens.front();
545 + if (ScRefTokenHelper::isExternalRef(p))
547 + // This is external. Open the external document if available, and
548 + // jump to the destination.
550 + sal_uInt16 nFileId = p->GetIndex();
551 + ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
552 + const String* pPath = pRefMgr->getExternalFileName(nFileId);
554 + ScRange aRange;
555 + if (pPath && ScRefTokenHelper::getRangeFromToken(aRange, p, true))
557 + const String& rTabName = p->GetString();
558 + OUStringBuffer aBuf;
559 + aBuf.append(*pPath);
560 + aBuf.append(sal_Unicode('#'));
561 + aBuf.append(rTabName);
562 + aBuf.append(sal_Unicode('.'));
564 + String aRangeStr;
565 + aRange.Format(aRangeStr, SCA_VALID);
566 + aBuf.append(aRangeStr);
568 + ScGlobal::OpenURL(aBuf.makeStringAndClear(), String());
570 + return;
572 + else
574 + ScRange aRange;
575 + ScRefTokenHelper::getRangeFromToken(aRange, p, false);
576 + if (aRange.aStart.Tab() != aCurPos.Tab())
578 + // The first precedent range is on a different sheet. Jump to it
579 + // immediately and forget the rest.
580 + lcl_jumpToRange(aRange, pView, pDoc);
581 + return;
585 + ScRangeList aDestRanges;
586 + ScRefTokenHelper::getRangeListFromTokens(aDestRanges, aRefTokens);
587 + MarkAndJumpToRanges(aDestRanges);
590 +void ScViewFunc::DetectiveMarkSucc()
592 + ScViewData* pView = GetViewData();
593 + ScDocShell* pDocSh = pView->GetDocShell();
594 + ScMarkData& rMarkData = pView->GetMarkData();
595 + ScAddress aCurPos = pView->GetCurPos();
596 + ScRangeList aRanges;
597 + if (rMarkData.IsMarked() || rMarkData.IsMultiMarked())
598 + rMarkData.FillRangeListWithMarks(&aRanges, false);
599 + else
600 + aRanges.Append(aCurPos);
602 + vector<ScSharedTokenRef> aRefTokens;
603 + pDocSh->GetDocFunc().DetectiveCollectAllSuccs(aRanges, aRefTokens);
605 + if (aRefTokens.empty())
606 + // No dependants found. Nothing to do.
607 + return;
609 + ScRangeList aDestRanges;
610 + ScRefTokenHelper::getRangeListFromTokens(aDestRanges, aRefTokens);
611 + MarkAndJumpToRanges(aDestRanges);
614 //---------------------------------------------------------------------------
616 void ScViewFunc::ShowNote( bool bShow )