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