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 {
461  // lock / unlock only the dispatcher of Calc document
462  SfxDispatcher* pDisp = nullptr;
463  if ( m_pBindings )
464  {
465  pDisp = m_pBindings->GetDispatcher();
466  }
467  else if(SfxViewFrame* pViewFrame = SfxViewFrame::Current())
468  {
469  if (dynamic_cast< ScTabViewShell* >(pViewFrame->GetViewShell()))
470  pDisp = pViewFrame->GetDispatcher();
471  }
472 
473  if (pDisp)
474  pDisp->Lock(bLock);
475 }
476 
478 {
479  enableInput( false );
480 
482 }
484 {
485  ScDocShell* pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>));
486  while( pDocShell )
487  {
488  SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell );
489  while( pFrame )
490  {
491  // enable everything except InPlace, including bean frames
492  if ( !pFrame->GetFrame().IsInPlace() )
493  {
494  SfxViewShell* p = pFrame->GetViewShell();
495  ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( p );
496  if(pViewSh!=nullptr)
497  {
498  vcl::Window *pWin=pViewSh->GetWindow();
499  if(pWin)
500  {
501  vcl::Window *pParent=pWin->GetParent();
502  if(pParent)
503  {
504  pParent->EnableInput(bFlag,false);
505  pViewSh->EnableRefInput(bFlag);
506  }
507  }
508  }
509  }
510  pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell );
511  }
512 
513  pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pDocShell, checkSfxObjectShell<ScDocShell>));
514  }
515 }
516 
518 {
519  ScDocShell* pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>));
520  while( pDocShell )
521  {
522  SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell );
523  while( pFrame )
524  {
525  // enable everything except InPlace, including bean frames
526  if ( !pFrame->GetFrame().IsInPlace() )
527  {
528  SfxViewShell* p = pFrame->GetViewShell();
529  ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( p );
530  if(pViewSh!=nullptr)
531  {
532  vcl::Window *pWin=pViewSh->GetWindow();
533  if(pWin)
534  {
535  vcl::Window *pParent=pWin->GetParent();
536  if(pParent)
537  pParent->Invalidate();
538  }
539  }
540  }
541  pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell );
542  }
543 
544  pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pDocShell, checkSfxObjectShell<ScDocShell>));
545  }
546 }
547 
549 {
550  SfxViewShell* pSh = SfxViewShell::GetFirst( true, checkSfxViewShell<ScTabViewShell> );
551  while ( pSh )
552  {
553  static_cast<ScTabViewShell*>(pSh)->ClearHighlightRanges();
554  pSh = SfxViewShell::GetNext( *pSh, true, checkSfxViewShell<ScTabViewShell> );
555  }
556 }
557 
559  : m_pController(&rController)
560  , m_bInRefMode(false)
561  , m_aHelper(this, pB)
562  , m_pMyBindings(pB)
563 {
564  m_aHelper.SetDialog(rController.getDialog());
565 
566  if( bBindRef ) EnterRefMode();
567 }
568 
570 {
571  if( m_bInRefMode ) return false;
572 
573  SC_MOD()->InputEnterHandler();
574 
575  ScTabViewShell* pScViewShell = nullptr;
576 
577  // title has to be from the view that opened the dialog,
578  // even if it's not the current view
579 
580  SfxObjectShell* pParentDoc = nullptr;
581  if ( m_pMyBindings )
582  {
584  if (pMyDisp)
585  {
586  SfxViewFrame* pMyViewFrm = pMyDisp->GetFrame();
587  if (pMyViewFrm)
588  {
589  pScViewShell = dynamic_cast<ScTabViewShell*>( pMyViewFrm->GetViewShell() );
590  if( pScViewShell )
591  pScViewShell->UpdateInputHandler(true);
592  pParentDoc = pMyViewFrm->GetObjectShell();
593  }
594  }
595  }
596  if ( !pParentDoc && pScViewShell ) // use current only if above fails
597  pParentDoc = pScViewShell->GetObjectShell();
598  if ( pParentDoc )
599  m_aDocName = pParentDoc->GetTitle();
600 
601  ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl(pScViewShell);
602 
603  OSL_ENSURE( pInputHdl, "Missing input handler :-/" );
604 
605  if ( pInputHdl )
606  pInputHdl->NotifyChange( nullptr );
607 
609 
611 
612  m_aHelper.Init();
613 
615 
616  m_bInRefMode = true;
617  return m_bInRefMode;
618 }
619 
620 ScRefHandler::~ScRefHandler() COVERITY_NOEXCEPT_FALSE
621 {
623 }
624 
626 {
627  m_pController = nullptr;
628  LeaveRefMode();
629  m_aHelper.dispose();
630 }
631 
633 {
634  if( !m_bInRefMode ) return false;
635 
637 
638  SetDispatcherLock( false );
639 
641  if( pScViewShell )
642  pScViewShell->UpdateInputHandler(true);
643 
645 
646  m_bInRefMode = false;
647  return true;
648 }
649 
651 {
653  if (pCurrent)
654  {
655  SfxObjectShell* pObjSh = pCurrent->GetObjectShell();
656  if ( pObjSh && pObjSh->GetTitle() == m_aDocName )
657  {
658  // right document already visible -> nothing to do
659  return;
660  }
661  }
662 
663  SfxViewShell* pSh = SfxViewShell::GetFirst( true, checkSfxViewShell<ScTabViewShell> );
664  while ( pSh )
665  {
666  SfxObjectShell* pObjSh = pSh->GetObjectShell();
667  if ( pObjSh && pObjSh->GetTitle() == m_aDocName )
668  {
669  // switch to first TabViewShell for document
670  static_cast<ScTabViewShell*>(pSh)->SetActive();
671  return;
672  }
673  pSh = SfxViewShell::GetNext( *pSh, true, checkSfxViewShell<ScTabViewShell> );
674  }
675 }
676 
677 bool ScRefHandler::IsDocAllowed(SfxObjectShell* pDocSh) const // pDocSh may be 0
678 {
679  // if aDocName isn't initialized, allow
680  if ( m_aDocName.isEmpty() )
681  return true;
682 
683  if ( !pDocSh )
684  return false;
685 
686  // default: allow only same document (overridden in function dialog)
687  return m_aDocName==pDocSh->GetTitle();
688 }
689 
691 {
692  return m_pController->getDialog()->get_visible();
693 }
694 
695 bool ScRefHandler::DoClose( sal_uInt16 nId )
696 {
697  m_aHelper.DoClose(nId);
698  return true;
699 }
700 
702 {
703  m_aHelper.SetDispatcherLock( bLock );
704 }
705 
707 {
709 }
710 
712 {
713  // override this for multi-references
714 }
715 
717 {
718  // the default is that the sheet can be switched during while the reference is edited
719 
720  return false;
721 }
722 
723 // RefInputStart/Done: Zoom-In (AutoHide) on single field
724 // (using button or movement)
725 
727 {
728  m_aHelper.RefInputStart( pEdit, pButton );
729 }
730 
732 {
733  m_aHelper.ToggleCollapsed( pEdit, pButton );
734 }
735 
736 bool ScRefHandler::ParseWithNames( ScRangeList& rRanges, const OUString& rStr, const ScDocument& rDoc )
737 {
738  return m_aHelper.ParseWithNames( rRanges, rStr, rDoc );
739 }
740 
741 void ScRefHandler::HideReference( bool bDoneRefMode )
742 {
743  m_aHelper.HideReference( bDoneRefMode );
744 }
745 
746 void ScRefHandler::ShowReference(const OUString& rStr)
747 {
748  m_aHelper.ShowReference(rStr);
749 }
750 
752 {
753  m_aHelper.ReleaseFocus( pEdit );
754 }
755 
756 void ScRefHandler::RefInputDone( bool bForced )
757 {
758  m_aHelper.RefInputDone( bForced );
759 }
760 
761 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScRefFlags ParseAny(const OUString &, const ScDocument &, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1)
Definition: address.cxx:1775
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:716
virtual bool IsRefInputMode() const override
Definition: anyrefdg.cxx:690
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
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:701
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:984
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:625
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:677
void ReleaseFocus(formula::RefEdit *pEdit)
Definition: anyrefdg.cxx:284
bool EnterRefMode()
Definition: anyrefdg.cxx:569
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:1142
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:483
void ShowSimpleReference(const OUString &rStr)
Definition: anyrefdg.cxx:111
virtual const ScComplexRefData * GetDoubleRef() const
::std::unique_ptr< ScCompiler > m_pRefComp
Definition: anyrefdg.hxx:37
int i
virtual void ReleaseFocus(formula::RefEdit *pEdit) override
Definition: anyrefdg.cxx:751
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:756
virtual void HideReference(bool bDoneRefMode=true) override
Definition: anyrefdg.cxx:741
virtual void AddRefEntry() override
Definition: anyrefdg.cxx:711
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:2558
virtual void ShowReference(const OUString &rStr) override
Definition: anyrefdg.cxx:746
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:78
SfxViewShell * GetViewShell() const
static void enableInput(bool _bInput)
Definition: anyrefdg.cxx:77
SCCOL Col() const
Definition: address.hxx:266
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: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:706
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:731
static SfxObjectShell * GetFirst(const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
void ResetDelayTimer()
Definition: inputhdl.cxx:4220
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:269
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:4012
void * p
void SwitchToDocument()
Definition: anyrefdg.cxx:650
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:477
Complex reference (a range) into the sheet.
Definition: refdata.hxx:122
virtual ~ScRefHandler() COVERITY_NOEXCEPT_FALSE override
Definition: anyrefdg.cxx:620
virtual SfxObjectShell * GetObjectShell() override
SfxDispatcher * GetDispatcher() const
ScRefHandler(SfxDialogController &rController, SfxBindings *pB, bool bBindRef)
Definition: anyrefdg.cxx:558
bool GetRangeFinder() const
Definition: inputopt.hxx:55
ScRange & front()
Definition: rangelst.hxx:92
static SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
static void lcl_InvalidateWindows()
Definition: anyrefdg.cxx:517
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:632
virtual void RefInputStart(formula::RefEdit *pEdit, formula::RefButton *pButton=nullptr)=0
bool DoClose(sal_uInt16 nId)
Definition: anyrefdg.cxx:695
bool ParseWithNames(ScRangeList &rRanges, const OUString &rStr, const ScDocument &pDoc)
Definition: anyrefdg.cxx:736
StackVar GetType() const
static void lcl_HideAllReferences()
Definition: anyrefdg.cxx:548
void ShowFormulaReference(const OUString &rStr)
Definition: anyrefdg.cxx:175
weld::Dialog * m_pDialog
Definition: anyrefdg.hxx:40
void RemoveAll()
Definition: rangelst.cxx:1106
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:726
SCCOL GetCurX() const
Definition: viewdata.hxx:400