LibreOffice Module sc (master)  1
anyrefdg.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <rangelst.hxx>
21 #include <comphelper/string.hxx>
22 #include <sfx2/app.hxx>
23 #include <sfx2/viewsh.hxx>
24 #include <sfx2/bindings.hxx>
25 #include <sfx2/dispatch.hxx>
26 #include <sfx2/viewfrm.hxx>
27 
28 #include <anyrefdg.hxx>
29 #include <sc.hrc>
30 #include <inputhdl.hxx>
31 #include <scmod.hxx>
32 #include <inputwin.hxx>
33 #include <tabvwsh.hxx>
34 #include <docsh.hxx>
35 #include <rfindlst.hxx>
36 #include <compiler.hxx>
37 #include <inputopt.hxx>
38 #include <rangeutl.hxx>
39 #include <tokenarray.hxx>
40 #include <comphelper/lok.hxx>
41 #include <output.hxx>
42 
43 #include <memory>
44 
46  : m_pDlg(_pDlg)
47  , m_pRefEdit (nullptr)
48  , m_pRefBtn (nullptr)
49  , m_pDialog(nullptr)
50  , m_pBindings(_pBindings)
51  , m_nRefTab(0)
52  , m_bHighlightRef(false)
53 {
54  ScInputOptions aInputOption=SC_MOD()->GetInputOptions();
55  m_bEnableColorRef=aInputOption.GetRangeFinder();
56 }
57 
59 {
60  dispose();
61 }
62 
64 {
65  // common cleanup for ScAnyRefDlg and ScFormulaDlg is done here
66  HideReference();
67  enableInput( true );
68 
69  ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl();
70  if ( pInputHdl )
71  pInputHdl->ResetDelayTimer(); // stop the timer for disabling the input line
72 
73  m_pDialog = nullptr;
74 }
75 
77 {
78  ScDocShell* pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>));
79  while( pDocShell )
80  {
81  SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell );
82  while( pFrame )
83  {
84  // enable everything except InPlace, including bean frames
85  if ( !pFrame->GetFrame().IsInPlace() )
86  {
87  SfxViewShell* p = pFrame->GetViewShell();
88  ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( p );
89  if(pViewSh!=nullptr)
90  {
91  vcl::Window *pWin=pViewSh->GetWindow();
92  if(pWin)
93  {
94  vcl::Window *pParent=pWin->GetParent();
95  if(pParent)
96  {
97  pParent->EnableInput(bEnable);
98  pViewSh->EnableRefInput(bEnable);
99  }
100  }
101  }
102  }
103  pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell );
104  }
105 
106  pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pDocShell, checkSfxObjectShell<ScDocShell>));
107  }
108 }
109 
111 {
112  if (!m_bEnableColorRef)
113  return;
114 
115  m_bHighlightRef = true;
116  ScViewData* pViewData=ScDocShell::GetViewData();
117  if ( !pViewData )
118  return;
119 
120  ScDocument& rDoc = pViewData->GetDocument();
121  ScTabViewShell* pTabViewShell=pViewData->GetViewShell();
122 
123  ScRangeList aRangeList;
124 
125  pTabViewShell->DoneRefMode();
126  pTabViewShell->ClearHighlightRanges();
127 
128  if( ParseWithNames( aRangeList, rStr, rDoc ) )
129  {
130  for ( size_t i = 0, nRanges = aRangeList.size(); i < nRanges; ++i )
131  {
132  ScRange const & rRangeEntry = aRangeList[ i ];
133  Color aColName = ScRangeFindList::GetColorName( i );
134  pTabViewShell->AddHighlightRange( rRangeEntry, aColName );
135  }
136  }
137 }
138 
139 bool ScFormulaReferenceHelper::ParseWithNames( ScRangeList& rRanges, const OUString& rStr, const ScDocument& rDoc )
140 {
141  rRanges.RemoveAll();
142 
143  if (rStr.isEmpty())
144  return true;
145 
146  ScAddress::Details aDetails(rDoc.GetAddressConvention(), 0, 0);
147 
148  bool bError = false;
149  sal_Int32 nIdx {0};
150  do
151  {
152  ScRange aRange;
153  OUString aRangeStr( rStr.getToken( 0, ';', nIdx ) );
154 
155  ScRefFlags nFlags = aRange.ParseAny( aRangeStr, rDoc, aDetails );
156  if ( nFlags & ScRefFlags::VALID )
157  {
158  if ( (nFlags & ScRefFlags::TAB_3D) == ScRefFlags::ZERO )
159  aRange.aStart.SetTab( m_nRefTab );
160  if ( (nFlags & ScRefFlags::TAB2_3D) == ScRefFlags::ZERO )
161  aRange.aEnd.SetTab( aRange.aStart.Tab() );
162  rRanges.push_back( aRange );
163  }
164  else if ( ScRangeUtil::MakeRangeFromName( aRangeStr, rDoc, m_nRefTab, aRange, RUTL_NAMES, aDetails ) )
165  rRanges.push_back( aRange );
166  else
167  bError = true;
168  }
169  while (nIdx>0);
170 
171  return !bError;
172 }
173 
175 {
176  if( !m_bEnableColorRef)
177  return;
178 
179  m_bHighlightRef=true;
180  ScViewData* pViewData=ScDocShell::GetViewData();
181  if ( !(pViewData && m_pRefComp) )
182  return;
183 
184  ScTabViewShell* pTabViewShell=pViewData->GetViewShell();
185  SCCOL nCol = pViewData->GetCurX();
186  SCROW nRow = pViewData->GetCurY();
187  SCTAB nTab = pViewData->GetTabNo();
188  ScAddress aPos( nCol, nRow, nTab );
189 
190  std::unique_ptr<ScTokenArray> pScTokA(m_pRefComp->CompileString(rStr));
191 
192  if (!(pTabViewShell && pScTokA))
193  return;
194 
195  const ScViewData& rViewData = pTabViewShell->GetViewData();
196  ScDocument& rDoc = rViewData.GetDocument();
197  pTabViewShell->DoneRefMode();
198  pTabViewShell->ClearHighlightRanges();
199 
201  const formula::FormulaToken* pToken = aIter.GetNextReference();
202 
203  sal_uInt16 nIndex=0;
204 
205  while(pToken!=nullptr)
206  {
207  bool bDoubleRef=(pToken->GetType()==formula::svDoubleRef);
208 
209  if(pToken->GetType()==formula::svSingleRef || bDoubleRef)
210  {
211  ScRange aRange;
212  if(bDoubleRef)
213  {
214  ScComplexRefData aRef( *pToken->GetDoubleRef() );
215  aRange = aRef.toAbs(rDoc, aPos);
216  }
217  else
218  {
219  ScSingleRefData aRef( *pToken->GetSingleRef() );
220  aRange.aStart = aRef.toAbs(rDoc, aPos);
221  aRange.aEnd = aRange.aStart;
222  }
223  Color aColName=ScRangeFindList::GetColorName(nIndex++);
224  pTabViewShell->AddHighlightRange(aRange, aColName);
225  }
226 
227  pToken = aIter.GetNextReference();
228  }
229 }
230 
232 {
233  ScViewData* pViewData=ScDocShell::GetViewData();
234 
235  if( !(pViewData && m_bHighlightRef && m_bEnableColorRef))
236  return;
237 
238  ScTabViewShell* pTabViewShell=pViewData->GetViewShell();
239 
240  if(pTabViewShell!=nullptr)
241  {
242  // bDoneRefMode is sal_False when called from before SetReference.
243  // In that case, RefMode was just started and must not be ended now.
244 
245  if ( bDoneRefMode )
246  pTabViewShell->DoneRefMode();
247  pTabViewShell->ClearHighlightRanges();
248 
250  {
251  // Clear
252  std::vector<ReferenceMark> aReferenceMarks;
253  ScInputHandler::SendReferenceMarks( pTabViewShell, aReferenceMarks );
254  }
255  }
256  m_bHighlightRef=false;
257 }
258 
259 void ScFormulaReferenceHelper::ShowReference(const OUString& rStr)
260 {
261  if( !m_bEnableColorRef )
262  return;
263 
264  if( rStr.indexOf('(') != -1 ||
265  rStr.indexOf('+') != -1 ||
266  rStr.indexOf('*') != -1 ||
267  rStr.indexOf('-') != -1 ||
268  rStr.indexOf('/') != -1 ||
269  rStr.indexOf('&') != -1 ||
270  rStr.indexOf('<') != -1 ||
271  rStr.indexOf('>') != -1 ||
272  rStr.indexOf('=') != -1 ||
273  rStr.indexOf('^') != -1 )
274  {
275  ShowFormulaReference(rStr);
276  }
277  else
278  {
279  ShowSimpleReference(rStr);
280  }
281 }
282 
284 {
285  if( !m_pRefEdit && pEdit )
286  {
287  m_pDlg->RefInputStart( pEdit );
288  }
289 
291  if( !pViewShell )
292  return;
293 
294  pViewShell->ActiveGrabFocus();
295  if( !m_pRefEdit )
296  return;
297 
298  const ScViewData& rViewData = pViewShell->GetViewData();
299  ScDocument& rDoc = rViewData.GetDocument();
300  ScRangeList aRangeList;
301  if( !ParseWithNames( aRangeList, m_pRefEdit->GetText(), rDoc ) )
302  return;
303 
304  if ( !aRangeList.empty() )
305  {
306  const ScRange & rRange = aRangeList.front();
307  pViewShell->SetTabNo( rRange.aStart.Tab() );
308  pViewShell->MoveCursorAbs( rRange.aStart.Col(),
309  rRange.aStart.Row(), SC_FOLLOW_JUMP, false, false );
310  pViewShell->MoveCursorAbs( rRange.aEnd.Col(),
311  rRange.aEnd.Row(), SC_FOLLOW_JUMP, true, false );
312  m_pDlg->SetReference( rRange, rDoc );
313  }
314 }
315 
317 {
318  ScViewData* pViewData=ScDocShell::GetViewData();
319  if ( !pViewData )
320  return;
321 
322  ScDocument& rDoc = pViewData->GetDocument();
323  SCCOL nCol = pViewData->GetCurX();
324  SCROW nRow = pViewData->GetCurY();
325  SCTAB nTab = pViewData->GetTabNo();
326  ScAddress aCursorPos( nCol, nRow, nTab );
327 
328  m_pRefComp.reset( new ScCompiler( rDoc, aCursorPos, rDoc.GetGrammar()) );
329  m_pRefComp->EnableJumpCommandReorder(false);
330  m_pRefComp->EnableStopOnError(false);
331 
332  m_nRefTab = nTab;
333 }
334 
336 {
337  if (m_pRefEdit)
338  m_pRefEdit->GrabFocus();
339  m_pDlg->RefInputDone(true);
340  return true;
341 }
342 
344 {
345  if ( !CanInputDone( bForced ) )
346  return;
347 
348  if (!m_pDialog)
349  return;
350 
351  // Adjust window title
353 
354  if (m_pRefEdit)
356 
357  // set button image
358  if (m_pRefBtn)
359  {
362  }
363 
365 
366  m_pRefEdit = nullptr;
367  m_pRefBtn = nullptr;
368 }
369 
371 {
372  if (m_pRefEdit)
373  return;
374 
375  m_pRefEdit = pEdit;
376  m_pRefBtn = pButton;
377 
378  // Save and adjust window title
381  {
382  const OUString sLabel = pLabel->get_label();
383  if (!sLabel.isEmpty())
384  {
385  const OUString sNewDialogText = m_sOldDialogText + ": " + comphelper::string::stripEnd(sLabel, ':');
386  m_pDialog->set_title(pLabel->strip_mnemonic(sNewDialogText));
387  }
388  }
389 
390  m_pDialog->collapse(pEdit->GetWidget(), pButton ? pButton->GetWidget() : nullptr);
391 
392  // set button image
393  if (pButton)
394  pButton->SetEndImage();
395 
397  if (m_pRefBtn)
399 }
400 
402 {
403  if( !pEdit )
404  return;
405 
406  if( m_pRefEdit == pEdit ) // is this the active ref edit field?
407  {
408  m_pRefEdit->GrabFocus(); // before RefInputDone()
409  m_pDlg->RefInputDone( true ); // finish ref input
410  }
411  else
412  {
413  m_pDlg->RefInputDone( true ); // another active ref edit?
414  m_pDlg->RefInputStart( pEdit, pButton ); // start ref input
415  // pRefEdit might differ from pEdit after RefInputStart() (i.e. ScFormulaDlg)
416  if( m_pRefEdit )
418  }
419 }
420 
421 void ScFormulaReferenceHelper::DoClose( sal_uInt16 nId )
422 {
423  SfxApplication* pSfxApp = SfxGetpApp();
424 
425  SetDispatcherLock( false );
426 
427  SfxViewFrame* pViewFrm = SfxViewFrame::Current();
428  if ( pViewFrm && pViewFrm->HasChildWindow(FID_INPUTLINE_STATUS) )
429  {
430  // The input row is disabled with ToolBox::Disable disabled, thus it must be
431  // reenabled with ToolBox::Enable (before the AppWindow is enabled)
432  // for the buttons to be drawn as enabled.
433  SfxChildWindow* pChild = pViewFrm->GetChildWindow(FID_INPUTLINE_STATUS);
434  if (pChild)
435  {
436  ScInputWindow* pWin = static_cast<ScInputWindow*>(pChild->GetWindow());
437  pWin->Enable();
438  }
439  }
440 
441  // find parent view frame to close dialog
442  SfxViewFrame* pMyViewFrm = nullptr;
443  if ( m_pBindings )
444  {
446  if (pMyDisp)
447  pMyViewFrm = pMyDisp->GetFrame();
448  }
449  SC_MOD()->SetRefDialog( nId, false, pMyViewFrm );
450 
451  pSfxApp->Broadcast( SfxHint( SfxHintId::ScKillEditView ) );
452 
454  if ( pScViewShell )
455  pScViewShell->UpdateInputHandler(true);
456 }
457 
459 {
460  // lock / unlock only the dispatcher of Calc document
461  SfxDispatcher* pDisp = nullptr;
462  if ( m_pBindings )
463  {
464  pDisp = m_pBindings->GetDispatcher();
465  }
466  else if(SfxViewFrame* pViewFrame = SfxViewFrame::Current())
467  {
468  if (dynamic_cast< ScTabViewShell* >(pViewFrame->GetViewShell()))
469  pDisp = pViewFrame->GetDispatcher();
470  }
471 
472  if (pDisp)
473  pDisp->Lock(bLock);
474 }
475 
477 {
478  enableInput( false );
479 
481 }
483 {
484  ScDocShell* pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>));
485  while( pDocShell )
486  {
487  SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell );
488  while( pFrame )
489  {
490  // enable everything except InPlace, including bean frames
491  if ( !pFrame->GetFrame().IsInPlace() )
492  {
493  SfxViewShell* p = pFrame->GetViewShell();
494  ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( p );
495  if(pViewSh!=nullptr)
496  {
497  vcl::Window *pWin=pViewSh->GetWindow();
498  if(pWin)
499  {
500  vcl::Window *pParent=pWin->GetParent();
501  if(pParent)
502  {
503  pParent->EnableInput(bFlag,false);
504  pViewSh->EnableRefInput(bFlag);
505  }
506  }
507  }
508  }
509  pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell );
510  }
511 
512  pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pDocShell, checkSfxObjectShell<ScDocShell>));
513  }
514 }
515 
517 {
518  ScDocShell* pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>));
519  while( pDocShell )
520  {
521  SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell );
522  while( pFrame )
523  {
524  // enable everything except InPlace, including bean frames
525  if ( !pFrame->GetFrame().IsInPlace() )
526  {
527  SfxViewShell* p = pFrame->GetViewShell();
528  ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( p );
529  if(pViewSh!=nullptr)
530  {
531  vcl::Window *pWin=pViewSh->GetWindow();
532  if(pWin)
533  {
534  vcl::Window *pParent=pWin->GetParent();
535  if(pParent)
536  pParent->Invalidate();
537  }
538  }
539  }
540  pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell );
541  }
542 
543  pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pDocShell, checkSfxObjectShell<ScDocShell>));
544  }
545 }
546 
548 {
549  SfxViewShell* pSh = SfxViewShell::GetFirst( true, checkSfxViewShell<ScTabViewShell> );
550  while ( pSh )
551  {
552  static_cast<ScTabViewShell*>(pSh)->ClearHighlightRanges();
553  pSh = SfxViewShell::GetNext( *pSh, true, checkSfxViewShell<ScTabViewShell> );
554  }
555 }
556 
558  : m_pController(&rController)
559  , m_bInRefMode(false)
560  , m_aHelper(this, pB)
561  , m_pMyBindings(pB)
562 {
563  m_aHelper.SetDialog(rController.getDialog());
564 
565  if( bBindRef ) EnterRefMode();
566 }
567 
569 {
570  if( m_bInRefMode ) return false;
571 
572  SC_MOD()->InputEnterHandler();
573 
574  ScTabViewShell* pScViewShell = nullptr;
575 
576  // title has to be from the view that opened the dialog,
577  // even if it's not the current view
578 
579  SfxObjectShell* pParentDoc = nullptr;
580  if ( m_pMyBindings )
581  {
583  if (pMyDisp)
584  {
585  SfxViewFrame* pMyViewFrm = pMyDisp->GetFrame();
586  if (pMyViewFrm)
587  {
588  pScViewShell = dynamic_cast<ScTabViewShell*>( pMyViewFrm->GetViewShell() );
589  if( pScViewShell )
590  pScViewShell->UpdateInputHandler(true);
591  pParentDoc = pMyViewFrm->GetObjectShell();
592  }
593  }
594  }
595  if ( !pParentDoc && pScViewShell ) // use current only if above fails
596  pParentDoc = pScViewShell->GetObjectShell();
597  if ( pParentDoc )
598  m_aDocName = pParentDoc->GetTitle();
599 
600  ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl(pScViewShell);
601 
602  OSL_ENSURE( pInputHdl, "Missing input handler :-/" );
603 
604  if ( pInputHdl )
605  pInputHdl->NotifyChange( nullptr );
606 
608 
610 
611  m_aHelper.Init();
612 
614 
615  m_bInRefMode = true;
616  return m_bInRefMode;
617 }
618 
619 ScRefHandler::~ScRefHandler() COVERITY_NOEXCEPT_FALSE
620 {
622 }
623 
625 {
626  m_pController = nullptr;
627  LeaveRefMode();
628  m_aHelper.dispose();
629 }
630 
632 {
633  if( !m_bInRefMode ) return false;
634 
636 
637  SetDispatcherLock( false );
638 
640  if( pScViewShell )
641  pScViewShell->UpdateInputHandler(true);
642 
644 
645  m_bInRefMode = false;
646  return true;
647 }
648 
650 {
652  if (pCurrent)
653  {
654  SfxObjectShell* pObjSh = pCurrent->GetObjectShell();
655  if ( pObjSh && pObjSh->GetTitle() == m_aDocName )
656  {
657  // right document already visible -> nothing to do
658  return;
659  }
660  }
661 
662  SfxViewShell* pSh = SfxViewShell::GetFirst( true, checkSfxViewShell<ScTabViewShell> );
663  while ( pSh )
664  {
665  SfxObjectShell* pObjSh = pSh->GetObjectShell();
666  if ( pObjSh && pObjSh->GetTitle() == m_aDocName )
667  {
668  // switch to first TabViewShell for document
669  static_cast<ScTabViewShell*>(pSh)->SetActive();
670  return;
671  }
672  pSh = SfxViewShell::GetNext( *pSh, true, checkSfxViewShell<ScTabViewShell> );
673  }
674 }
675 
676 bool ScRefHandler::IsDocAllowed(SfxObjectShell* pDocSh) const // pDocSh may be 0
677 {
678  // if aDocName isn't initialized, allow
679  if ( m_aDocName.isEmpty() )
680  return true;
681 
682  if ( !pDocSh )
683  return false;
684 
685  // default: allow only same document (overridden in function dialog)
686  return m_aDocName==pDocSh->GetTitle();
687 }
688 
690 {
691  return m_pController->getDialog()->get_visible();
692 }
693 
694 bool ScRefHandler::DoClose( sal_uInt16 nId )
695 {
696  m_aHelper.DoClose(nId);
697  return true;
698 }
699 
701 {
702  m_aHelper.SetDispatcherLock( bLock );
703 }
704 
706 {
708 }
709 
711 {
712  // override this for multi-references
713 }
714 
716 {
717  // the default is that the sheet can be switched during while the reference is edited
718 
719  return false;
720 }
721 
722 // RefInputStart/Done: Zoom-In (AutoHide) on single field
723 // (using button or movement)
724 
726 {
727  m_aHelper.RefInputStart( pEdit, pButton );
728 }
729 
731 {
732  m_aHelper.ToggleCollapsed( pEdit, pButton );
733 }
734 
735 bool ScRefHandler::ParseWithNames( ScRangeList& rRanges, const OUString& rStr, const ScDocument& rDoc )
736 {
737  return m_aHelper.ParseWithNames( rRanges, rStr, rDoc );
738 }
739 
740 void ScRefHandler::HideReference( bool bDoneRefMode )
741 {
742  m_aHelper.HideReference( bDoneRefMode );
743 }
744 
745 void ScRefHandler::ShowReference(const OUString& rStr)
746 {
747  m_aHelper.ShowReference(rStr);
748 }
749 
751 {
752  m_aHelper.ReleaseFocus( pEdit );
753 }
754 
755 void ScRefHandler::RefInputDone( bool bForced )
756 {
757  m_aHelper.RefInputDone( bForced );
758 }
759 
760 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SC_DLLPUBLIC ScRefFlags ParseAny(const OUString &, const ScDocument &, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1)
Definition: address.cxx:1766
OString stripEnd(const OString &rIn, char c)
void DoClose(sal_uInt16 nId)
Definition: anyrefdg.cxx:421
IMPL_LINK_NOARG(ScFormulaReferenceHelper, ActivateHdl, weld::Widget &, bool)
Definition: anyrefdg.cxx:335
sal_Int32 nIndex
ScAddress aStart
Definition: address.hxx:500
bool ParseWithNames(ScRangeList &rRanges, const OUString &rStr, const ScDocument &rDoc)
Definition: anyrefdg.cxx:139
SfxChildWindow * GetChildWindow(sal_uInt16)
virtual bool IsTableLocked() const override
Definition: anyrefdg.cxx:715
virtual bool IsRefInputMode() const override
Definition: anyrefdg.cxx:689
SCROW Row() const
Definition: address.hxx:262
OUString GetTitle(sal_uInt16 nMaxLen=0) const
formula::RefEdit * m_pRefEdit
Definition: anyrefdg.hxx:41
Single reference (one address) into the sheet.
Definition: refdata.hxx:30
void DoneRefMode(bool bContinue=false)
Definition: tabview4.cxx:161
bool m_bInRefMode
Definition: anyrefdg.hxx:87
virtual void undo_collapse()=0
SCROW GetCurY() const
Definition: viewdata.hxx:402
IAnyRefDialog * m_pDlg
Definition: anyrefdg.hxx:39
void SetDialog(weld::Dialog *pDialog)
Definition: anyrefdg.hxx:71
void SetDispatcherLock(bool bLock)
Definition: anyrefdg.cxx:700
virtual void SetActive() override=0
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
ScAddress aEnd
Definition: address.hxx:501
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
void AddHighlightRange(const ScRange &rRange, const Color &rColor)
Definition: tabview3.cxx:2516
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
Definition: document.hxx:985
void SetActivateHdl(const Link< weld::Widget &, bool > &rLink)
virtual SfxObjectShell * GetObjectShell() override
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
Definition: documen3.cxx:489
vcl::Window * GetWindow() const
void disposeRefHandler()
Definition: anyrefdg.cxx:624
SC_DLLPUBLIC void MoveCursorAbs(SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, bool bShift, bool bControl, bool bKeepOld=false, bool bKeepSel=false)
Definition: tabview3.cxx:1185
SfxApplication * SfxGetpApp()
OUString m_aDocName
Definition: anyrefdg.hxx:94
virtual bool IsDocAllowed(SfxObjectShell *pDocSh) const override
Definition: anyrefdg.cxx:676
void ReleaseFocus(formula::RefEdit *pEdit)
Definition: anyrefdg.cxx:283
bool EnterRefMode()
Definition: anyrefdg.cxx:568
void Enable(bool bEnable=true, bool bChild=true)
weld::Button * GetWidget() const
SfxFrame & GetFrame() const
virtual const ScSingleRefData * GetSingleRef() const
static SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
void push_back(const ScRange &rRange)
Definition: rangelst.cxx:1144
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
Definition: tabvwsha.cxx:638
SCTAB Tab() const
Definition: address.hxx:271
void ClearHighlightRanges()
Definition: tabview3.cxx:2526
virtual bool get_visible() const =0
void SetActivateHdl(const Link< weld::Widget &, bool > &rLink)
ScViewData & GetViewData()
Definition: tabview.hxx:332
void ToggleCollapsed(formula::RefEdit *pEdit, formula::RefButton *pButton)
Definition: anyrefdg.cxx:401
~ScFormulaReferenceHelper() COVERITY_NOEXCEPT_FALSE
Definition: anyrefdg.cxx:58
bool empty() const
Definition: rangelst.hxx:89
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:357
void EnableInput(bool bEnable=true, bool bChild=true)
void SetTab(SCTAB nTabP)
Definition: address.hxx:283
weld::Label * GetLabelWidgetForShrinkMode()
static void EnableSpreadsheets(bool bFlag=true)
Definition: anyrefdg.cxx:482
void ShowSimpleReference(const OUString &rStr)
Definition: anyrefdg.cxx:110
virtual const ScComplexRefData * GetDoubleRef() const
::std::unique_ptr< ScCompiler > m_pRefComp
Definition: anyrefdg.hxx:40
int i
virtual void ReleaseFocus(formula::RefEdit *pEdit) override
Definition: anyrefdg.cxx:750
weld::DialogController * m_pController
Definition: anyrefdg.hxx:86
sal_Int16 SCCOL
Definition: types.hxx:22
#define SC_MOD()
Definition: scmod.hxx:253
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
Definition: tabview3.cxx:1793
static SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
size_t size() const
Definition: rangelst.hxx:90
virtual OUString get_title() const =0
virtual void RefInputDone(bool bForced=false) override
Definition: anyrefdg.cxx:755
virtual void HideReference(bool bDoneRefMode=true) override
Definition: anyrefdg.cxx:740
virtual void AddRefEntry() override
Definition: anyrefdg.cxx:710
void HideReference(bool bDoneRefMode=true)
Definition: anyrefdg.cxx:231
OUString GetText() const
void Lock(bool bLock)
weld::Entry * GetWidget() const
virtual void set_title(const OUString &rTitle)=0
SfxBindings * m_pBindings
Definition: anyrefdg.hxx:44
static SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
static ScViewData * GetViewData()
Definition: docsh4.cxx:2540
virtual void ShowReference(const OUString &rStr) override
Definition: anyrefdg.cxx:745
virtual void SetReference(const ScRange &rRef, ScDocument &rDoc)=0
vcl::Window * GetParent() const
virtual void collapse(weld::Widget *pEdit, weld::Widget *pButton)=0
bool CanInputDone(bool bForced)
Definition: anyrefdg.hxx:81
SfxViewShell * GetViewShell() const
static void enableInput(bool _bInput)
Definition: anyrefdg.cxx:76
SCCOL Col() const
Definition: address.hxx:267
static bool MakeRangeFromName(const OUString &rName, const ScDocument &rDoc, SCTAB nCurTab, ScRange &rRange, RutlNameScope eScope=RUTL_NAMES, ScAddress::Details const &rDetails=ScAddress::detailsOOOa1)
Definition: rangeutl.cxx:233
void EnableRefInput(bool bFlag)
Definition: tabview.cxx:2212
static Color GetColorName(const size_t nIndex)
Definition: rfindlst.cxx:48
sal_Int32 SCROW
Definition: types.hxx:18
virtual void ViewShellChanged() override
Definition: anyrefdg.cxx:705
formula::RefButton * m_pRefBtn
Definition: anyrefdg.hxx:42
bool HasChildWindow(sal_uInt16)
static SfxViewFrame * Current()
static ScTabViewShell * GetActiveViewShell()
Definition: tabvwsh4.cxx:1023
void SetDispatcherLock(bool bLock)
Definition: anyrefdg.cxx:458
bool IsInPlace() const
virtual void ToggleCollapsed(formula::RefEdit *pEdit, formula::RefButton *pButton) override
Definition: anyrefdg.cxx:730
static SfxObjectShell * GetFirst(const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
void ResetDelayTimer()
Definition: inputhdl.cxx:4142
void ActiveGrabFocus()
Definition: tabview.cxx:897
ScFormulaReferenceHelper(IAnyRefDialog *_pDlg, SfxBindings *_pBindings)
Definition: anyrefdg.cxx:45
SfxViewFrame * GetFrame() const
static void SendReferenceMarks(const SfxViewShell *pViewShell, const std::vector< ReferenceMark > &rReferenceMarks)
Definition: inputhdl.cxx:268
virtual void RefInputDone(bool bForced=false)=0
virtual Dialog * getDialog()=0
void NotifyChange(const ScInputHdlState *pState, bool bForce=false, ScTabViewShell *pSourceSh=nullptr, bool bStopEditing=true)
Definition: inputhdl.cxx:3942
void * p
void SwitchToDocument()
Definition: anyrefdg.cxx:649
vcl::Window * GetWindow() const
void RefInputStart(formula::RefEdit *pEdit, formula::RefButton *pButton)
Definition: anyrefdg.cxx:370
SfxBindings * m_pMyBindings
Definition: anyrefdg.hxx:92
void RefInputDone(bool bForced)
Definition: anyrefdg.cxx:343
static void ViewShellChanged()
Definition: anyrefdg.cxx:476
Complex reference (a range) into the sheet.
Definition: refdata.hxx:123
virtual ~ScRefHandler() COVERITY_NOEXCEPT_FALSE override
Definition: anyrefdg.cxx:619
virtual SfxObjectShell * GetObjectShell() override
SfxDispatcher * GetDispatcher() const
ScRefHandler(SfxDialogController &rController, SfxBindings *pB, bool bBindRef)
Definition: anyrefdg.cxx:557
bool GetRangeFinder() const
Definition: inputopt.hxx:56
ScRange & front()
Definition: rangelst.hxx:93
static SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
static void lcl_InvalidateWindows()
Definition: anyrefdg.cxx:516
static SfxObjectShell * GetNext(const SfxObjectShell &rPrev, const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
ScRefFlags
Definition: address.hxx:145
void ShowReference(const OUString &rStr)
Definition: anyrefdg.cxx:259
bool LeaveRefMode()
Definition: anyrefdg.cxx:631
virtual void RefInputStart(formula::RefEdit *pEdit, formula::RefButton *pButton=nullptr)=0
bool DoClose(sal_uInt16 nId)
Definition: anyrefdg.cxx:694
bool ParseWithNames(ScRangeList &rRanges, const OUString &rStr, const ScDocument &pDoc)
Definition: anyrefdg.cxx:735
StackVar GetType() const
static void lcl_HideAllReferences()
Definition: anyrefdg.cxx:547
void ShowFormulaReference(const OUString &rStr)
Definition: anyrefdg.cxx:174
weld::Dialog * m_pDialog
Definition: anyrefdg.hxx:43
void RemoveAll()
Definition: rangelst.cxx:1108
ScFormulaReferenceHelper m_aHelper
Definition: anyrefdg.hxx:91
sal_Int16 SCTAB
Definition: types.hxx:23
virtual void RefInputStart(formula::RefEdit *pEdit, formula::RefButton *pButton=nullptr) override
Definition: anyrefdg.cxx:725
SCCOL GetCurX() const
Definition: viewdata.hxx:401