calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / sc / source / ui / miscdlgs / anyrefdg.cxx
blob0ffad93cfe25cc334ca40484a459d6fa824154e0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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 #include <o3tl/string_view.hxx>
30 #include <anyrefdg.hxx>
31 #include <sc.hrc>
32 #include <inputhdl.hxx>
33 #include <scmod.hxx>
34 #include <inputwin.hxx>
35 #include <tabvwsh.hxx>
36 #include <docsh.hxx>
37 #include <rfindlst.hxx>
38 #include <compiler.hxx>
39 #include <inputopt.hxx>
40 #include <rangeutl.hxx>
41 #include <tokenarray.hxx>
42 #include <comphelper/lok.hxx>
43 #include <output.hxx>
45 #include <memory>
47 ScFormulaReferenceHelper::ScFormulaReferenceHelper(IAnyRefDialog* _pDlg,SfxBindings* _pBindings)
48 : m_pDlg(_pDlg)
49 , m_pRefEdit (nullptr)
50 , m_pRefBtn (nullptr)
51 , m_pDialog(nullptr)
52 , m_pBindings(_pBindings)
53 , m_nRefTab(0)
54 , m_bHighlightRef(false)
56 ScInputOptions aInputOption=SC_MOD()->GetInputOptions();
57 m_bEnableColorRef=aInputOption.GetRangeFinder();
60 ScFormulaReferenceHelper::~ScFormulaReferenceHelper() COVERITY_NOEXCEPT_FALSE
62 dispose();
65 void ScFormulaReferenceHelper::dispose()
67 // common cleanup for ScAnyRefDlg and ScFormulaDlg is done here
68 HideReference();
69 enableInput( true );
71 ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl();
72 if ( pInputHdl )
73 pInputHdl->ResetDelayTimer(); // stop the timer for disabling the input line
75 m_pDialog = nullptr;
78 void ScFormulaReferenceHelper::enableInput( bool bEnable )
80 ScDocShell* pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>));
81 while( pDocShell )
83 SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell );
84 while( pFrame )
86 // enable everything except InPlace, including bean frames
87 if ( !pFrame->GetFrame().IsInPlace() )
89 SfxViewShell* p = pFrame->GetViewShell();
90 ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( p );
91 if(pViewSh!=nullptr)
93 vcl::Window *pWin=pViewSh->GetWindow();
94 if(pWin)
96 vcl::Window *pParent=pWin->GetParent();
97 if(pParent)
99 pParent->EnableInput(bEnable);
100 pViewSh->EnableRefInput(bEnable);
105 pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell );
108 pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pDocShell, checkSfxObjectShell<ScDocShell>));
112 void ScFormulaReferenceHelper::ShowSimpleReference(std::u16string_view rStr)
114 if (!m_bEnableColorRef)
115 return;
117 m_bHighlightRef = true;
118 ScViewData* pViewData=ScDocShell::GetViewData();
119 if ( !pViewData )
120 return;
122 ScDocument& rDoc = pViewData->GetDocument();
123 ScTabViewShell* pTabViewShell=pViewData->GetViewShell();
125 ScRangeList aRangeList;
127 pTabViewShell->DoneRefMode();
128 pTabViewShell->ClearHighlightRanges();
130 if( ParseWithNames( aRangeList, rStr, rDoc ) )
132 for ( size_t i = 0, nRanges = aRangeList.size(); i < nRanges; ++i )
134 ScRange const & rRangeEntry = aRangeList[ i ];
135 Color aColName = ScRangeFindList::GetColorName( i );
136 pTabViewShell->AddHighlightRange( rRangeEntry, aColName );
141 bool ScFormulaReferenceHelper::ParseWithNames( ScRangeList& rRanges, std::u16string_view rStr, const ScDocument& rDoc )
143 rRanges.RemoveAll();
145 if (rStr.empty())
146 return true;
148 ScAddress::Details aDetails(rDoc.GetAddressConvention(), 0, 0);
150 bool bError = false;
151 sal_Int32 nIdx {0};
154 ScRange aRange;
155 OUString aRangeStr( o3tl::getToken(rStr, 0, ';', nIdx ) );
157 ScRefFlags nFlags = aRange.ParseAny( aRangeStr, rDoc, aDetails );
158 if ( nFlags & ScRefFlags::VALID )
160 if ( (nFlags & ScRefFlags::TAB_3D) == ScRefFlags::ZERO )
161 aRange.aStart.SetTab( m_nRefTab );
162 if ( (nFlags & ScRefFlags::TAB2_3D) == ScRefFlags::ZERO )
163 aRange.aEnd.SetTab( aRange.aStart.Tab() );
164 rRanges.push_back( aRange );
166 else if ( ScRangeUtil::MakeRangeFromName( aRangeStr, rDoc, m_nRefTab, aRange, RUTL_NAMES, aDetails ) )
167 rRanges.push_back( aRange );
168 else
169 bError = true;
171 while (nIdx>0);
173 return !bError;
176 void ScFormulaReferenceHelper::ShowFormulaReference(const OUString& rStr)
178 if( !m_bEnableColorRef)
179 return;
181 m_bHighlightRef=true;
182 ScViewData* pViewData=ScDocShell::GetViewData();
183 if ( !(pViewData && m_pRefComp) )
184 return;
186 ScTabViewShell* pTabViewShell=pViewData->GetViewShell();
187 SCCOL nCol = pViewData->GetCurX();
188 SCROW nRow = pViewData->GetCurY();
189 SCTAB nTab = pViewData->GetTabNo();
190 ScAddress aPos( nCol, nRow, nTab );
192 std::unique_ptr<ScTokenArray> pScTokA(m_pRefComp->CompileString(rStr));
194 if (!(pTabViewShell && pScTokA))
195 return;
197 const ScViewData& rViewData = pTabViewShell->GetViewData();
198 ScDocument& rDoc = rViewData.GetDocument();
199 pTabViewShell->DoneRefMode();
200 pTabViewShell->ClearHighlightRanges();
202 formula::FormulaTokenArrayPlainIterator aIter(*pScTokA);
203 const formula::FormulaToken* pToken = aIter.GetNextReference();
205 sal_uInt16 nIndex=0;
207 while(pToken!=nullptr)
209 bool bDoubleRef=(pToken->GetType()==formula::svDoubleRef);
211 if(pToken->GetType()==formula::svSingleRef || bDoubleRef)
213 ScRange aRange;
214 if(bDoubleRef)
216 ScComplexRefData aRef( *pToken->GetDoubleRef() );
217 aRange = aRef.toAbs(rDoc, aPos);
219 else
221 ScSingleRefData aRef( *pToken->GetSingleRef() );
222 aRange.aStart = aRef.toAbs(rDoc, aPos);
223 aRange.aEnd = aRange.aStart;
225 Color aColName=ScRangeFindList::GetColorName(nIndex++);
226 pTabViewShell->AddHighlightRange(aRange, aColName);
229 pToken = aIter.GetNextReference();
233 void ScFormulaReferenceHelper::HideReference( bool bDoneRefMode )
235 ScViewData* pViewData=ScDocShell::GetViewData();
237 if( !(pViewData && m_bHighlightRef && m_bEnableColorRef))
238 return;
240 ScTabViewShell* pTabViewShell=pViewData->GetViewShell();
242 if(pTabViewShell!=nullptr)
244 // bDoneRefMode is sal_False when called from before SetReference.
245 // In that case, RefMode was just started and must not be ended now.
247 if ( bDoneRefMode )
248 pTabViewShell->DoneRefMode();
249 pTabViewShell->ClearHighlightRanges();
251 if( comphelper::LibreOfficeKit::isActive() )
253 // Clear
254 std::vector<ReferenceMark> aReferenceMarks;
255 ScInputHandler::SendReferenceMarks( pTabViewShell, aReferenceMarks );
258 m_bHighlightRef=false;
261 void ScFormulaReferenceHelper::ShowReference(const OUString& rStr)
263 if( !m_bEnableColorRef )
264 return;
266 if( 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 rStr.indexOf('^') != -1 )
277 ShowFormulaReference(rStr);
279 else
281 ShowSimpleReference(rStr);
285 void ScFormulaReferenceHelper::ReleaseFocus( formula::RefEdit* pEdit )
287 if( !m_pRefEdit && pEdit )
289 m_pDlg->RefInputStart( pEdit );
292 ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
293 if( !pViewShell )
294 return;
296 pViewShell->ActiveGrabFocus();
297 if( !m_pRefEdit )
298 return;
300 const ScViewData& rViewData = pViewShell->GetViewData();
301 ScDocument& rDoc = rViewData.GetDocument();
302 ScRangeList aRangeList;
303 if( !ParseWithNames( aRangeList, m_pRefEdit->GetText(), rDoc ) )
304 return;
306 if ( !aRangeList.empty() )
308 const ScRange & rRange = aRangeList.front();
309 pViewShell->SetTabNo( rRange.aStart.Tab() );
310 pViewShell->MoveCursorAbs( rRange.aStart.Col(),
311 rRange.aStart.Row(), SC_FOLLOW_JUMP, false, false );
312 pViewShell->MoveCursorAbs( rRange.aEnd.Col(),
313 rRange.aEnd.Row(), SC_FOLLOW_JUMP, true, false );
314 m_pDlg->SetReference( rRange, rDoc );
318 void ScFormulaReferenceHelper::Init()
320 ScViewData* pViewData=ScDocShell::GetViewData(); //! use pScViewShell?
321 if ( !pViewData )
322 return;
324 ScDocument& rDoc = pViewData->GetDocument();
325 SCCOL nCol = pViewData->GetCurX();
326 SCROW nRow = pViewData->GetCurY();
327 SCTAB nTab = pViewData->GetTabNo();
328 ScAddress aCursorPos( nCol, nRow, nTab );
330 m_pRefComp.reset( new ScCompiler( rDoc, aCursorPos, rDoc.GetGrammar()) );
331 m_pRefComp->EnableJumpCommandReorder(false);
332 m_pRefComp->EnableStopOnError(false);
334 m_nRefTab = nTab;
337 IMPL_LINK_NOARG(ScFormulaReferenceHelper, ActivateHdl, weld::Widget&, bool)
339 if (m_pRefEdit)
340 m_pRefEdit->GrabFocus();
341 m_pDlg->RefInputDone(true);
342 return true;
345 void ScFormulaReferenceHelper::RefInputDone( bool bForced )
347 if ( !CanInputDone( bForced ) )
348 return;
350 if (!m_pDialog)
351 return;
353 // Adjust window title
354 m_pDialog->set_title(m_sOldDialogText);
356 if (m_pRefEdit)
357 m_pRefEdit->SetActivateHdl(Link<weld::Widget&, bool>());
359 // set button image
360 if (m_pRefBtn)
362 m_pRefBtn->SetActivateHdl(Link<weld::Widget&, bool>());
363 m_pRefBtn->SetStartImage();
366 m_pDialog->undo_collapse();
368 m_pRefEdit = nullptr;
369 m_pRefBtn = nullptr;
372 void ScFormulaReferenceHelper::RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton )
374 if (m_pRefEdit)
375 return;
377 m_pRefEdit = pEdit;
378 m_pRefBtn = pButton;
380 // Save and adjust window title
381 m_sOldDialogText = m_pDialog->get_title();
382 if (weld::Label *pLabel = m_pRefEdit->GetLabelWidgetForShrinkMode())
384 const OUString sLabel = pLabel->get_label();
385 if (!sLabel.isEmpty())
387 const OUString sNewDialogText = m_sOldDialogText + ": " + comphelper::string::stripEnd(sLabel, ':');
388 m_pDialog->set_title(pLabel->strip_mnemonic(sNewDialogText));
392 m_pDialog->collapse(pEdit->GetWidget(), pButton ? pButton->GetWidget() : nullptr);
394 // set button image
395 if (pButton)
396 pButton->SetEndImage();
398 m_pRefEdit->SetActivateHdl(LINK(this, ScFormulaReferenceHelper, ActivateHdl));
399 if (m_pRefBtn)
400 m_pRefBtn->SetActivateHdl(LINK(this, ScFormulaReferenceHelper, ActivateHdl));
403 void ScFormulaReferenceHelper::ToggleCollapsed( formula::RefEdit* pEdit, formula::RefButton* pButton )
405 if( !pEdit )
406 return;
408 if( m_pRefEdit == pEdit ) // is this the active ref edit field?
410 m_pRefEdit->GrabFocus(); // before RefInputDone()
411 m_pDlg->RefInputDone( true ); // finish ref input
413 else
415 m_pDlg->RefInputDone( true ); // another active ref edit?
416 m_pDlg->RefInputStart( pEdit, pButton ); // start ref input
417 // pRefEdit might differ from pEdit after RefInputStart() (i.e. ScFormulaDlg)
418 if( m_pRefEdit )
419 m_pRefEdit->GrabFocus();
423 void ScFormulaReferenceHelper::DoClose( sal_uInt16 nId )
425 SfxApplication* pSfxApp = SfxGetpApp();
427 SetDispatcherLock( false ); //! here and in dtor ?
429 SfxViewFrame* pViewFrm = SfxViewFrame::Current();
430 if ( pViewFrm && pViewFrm->HasChildWindow(FID_INPUTLINE_STATUS) )
432 // The input row is disabled with ToolBox::Disable disabled, thus it must be
433 // reenabled with ToolBox::Enable (before the AppWindow is enabled)
434 // for the buttons to be drawn as enabled.
435 SfxChildWindow* pChild = pViewFrm->GetChildWindow(FID_INPUTLINE_STATUS);
436 if (pChild)
438 ScInputWindow* pWin = static_cast<ScInputWindow*>(pChild->GetWindow());
439 pWin->Enable();
443 // find parent view frame to close dialog
444 SfxViewFrame* pMyViewFrm = nullptr;
445 if ( m_pBindings )
447 SfxDispatcher* pMyDisp = m_pBindings->GetDispatcher();
448 if (pMyDisp)
449 pMyViewFrm = pMyDisp->GetFrame();
451 SC_MOD()->SetRefDialog( nId, false, pMyViewFrm );
453 pSfxApp->Broadcast( SfxHint( SfxHintId::ScKillEditView ) );
455 ScTabViewShell* pScViewShell = ScTabViewShell::GetActiveViewShell();
456 if ( pScViewShell )
457 pScViewShell->UpdateInputHandler(true);
460 void ScFormulaReferenceHelper::SetDispatcherLock( bool bLock )
462 if (!comphelper::LibreOfficeKit::isActive())
464 // lock / unlock only the dispatchers of Calc documents
465 ScDocShell* pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>));
466 while (pDocShell)
468 SfxViewFrame* pFrame = SfxViewFrame::GetFirst(pDocShell);
469 while (pFrame)
471 SfxDispatcher* pDisp = pFrame->GetDispatcher();
472 if (pDisp)
473 pDisp->Lock(bLock);
474 pFrame = SfxViewFrame::GetNext(*pFrame, pDocShell);
476 pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pDocShell, checkSfxObjectShell<ScDocShell>));
478 return;
479 // if a new view is created while the dialog is open,
480 // that view's dispatcher is locked when trying to create the dialog
481 // for that view (ScTabViewShell::CreateRefDialog)
484 // lock / unlock only the dispatcher of Calc document
485 SfxDispatcher* pDisp = nullptr;
486 if ( m_pBindings )
488 pDisp = m_pBindings->GetDispatcher();
490 else if(SfxViewFrame* pViewFrame = SfxViewFrame::Current())
492 if (dynamic_cast< ScTabViewShell* >(pViewFrame->GetViewShell()))
493 pDisp = pViewFrame->GetDispatcher();
496 if (pDisp)
497 pDisp->Lock(bLock);
500 void ScFormulaReferenceHelper::ViewShellChanged()
502 enableInput( false );
504 EnableSpreadsheets();
506 void ScFormulaReferenceHelper::EnableSpreadsheets(bool bFlag)
508 ScDocShell* pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>));
509 while( pDocShell )
511 SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell );
512 while( pFrame )
514 // enable everything except InPlace, including bean frames
515 if ( !pFrame->GetFrame().IsInPlace() )
517 SfxViewShell* p = pFrame->GetViewShell();
518 ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( p );
519 if(pViewSh!=nullptr)
521 vcl::Window *pWin=pViewSh->GetWindow();
522 if(pWin)
524 vcl::Window *pParent=pWin->GetParent();
525 if(pParent)
527 pParent->EnableInput(bFlag,false);
528 pViewSh->EnableRefInput(bFlag);
533 pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell );
536 pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pDocShell, checkSfxObjectShell<ScDocShell>));
540 static void lcl_InvalidateWindows()
542 ScDocShell* pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>));
543 while( pDocShell )
545 SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell );
546 while( pFrame )
548 // enable everything except InPlace, including bean frames
549 if ( !pFrame->GetFrame().IsInPlace() )
551 SfxViewShell* p = pFrame->GetViewShell();
552 ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( p );
553 if(pViewSh!=nullptr)
555 vcl::Window *pWin=pViewSh->GetWindow();
556 if(pWin)
558 vcl::Window *pParent=pWin->GetParent();
559 if(pParent)
560 pParent->Invalidate();
564 pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell );
567 pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pDocShell, checkSfxObjectShell<ScDocShell>));
571 static void lcl_HideAllReferences()
573 SfxViewShell* pSh = SfxViewShell::GetFirst( true, checkSfxViewShell<ScTabViewShell> );
574 while ( pSh )
576 static_cast<ScTabViewShell*>(pSh)->ClearHighlightRanges();
577 pSh = SfxViewShell::GetNext( *pSh, true, checkSfxViewShell<ScTabViewShell> );
581 ScRefHandler::ScRefHandler(SfxDialogController& rController, SfxBindings* pB, bool bBindRef)
582 : m_pController(&rController)
583 , m_bInRefMode(false)
584 , m_aHelper(this, pB)
585 , m_pMyBindings(pB)
587 m_aHelper.SetDialog(rController.getDialog());
589 if( bBindRef ) EnterRefMode();
592 bool ScRefHandler::EnterRefMode()
594 if( m_bInRefMode ) return false;
596 SC_MOD()->InputEnterHandler();
598 ScTabViewShell* pScViewShell = nullptr;
600 // title has to be from the view that opened the dialog,
601 // even if it's not the current view
603 SfxObjectShell* pParentDoc = nullptr;
604 if ( m_pMyBindings )
606 SfxDispatcher* pMyDisp = m_pMyBindings->GetDispatcher();
607 if (pMyDisp)
609 SfxViewFrame* pMyViewFrm = pMyDisp->GetFrame();
610 if (pMyViewFrm)
612 pScViewShell = dynamic_cast<ScTabViewShell*>( pMyViewFrm->GetViewShell() );
613 if( pScViewShell )
614 pScViewShell->UpdateInputHandler(true);
615 pParentDoc = pMyViewFrm->GetObjectShell();
619 if ( !pParentDoc && pScViewShell ) // use current only if above fails
620 pParentDoc = pScViewShell->GetObjectShell();
621 if ( pParentDoc )
622 m_aDocName = pParentDoc->GetTitle();
624 ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl(pScViewShell);
626 OSL_ENSURE( pInputHdl, "Missing input handler :-/" );
628 if ( pInputHdl )
629 pInputHdl->NotifyChange( nullptr );
631 ScFormulaReferenceHelper::enableInput( false );
633 ScFormulaReferenceHelper::EnableSpreadsheets();
635 m_aHelper.Init();
637 m_aHelper.SetDispatcherLock( true );
639 m_bInRefMode = true;
640 return m_bInRefMode;
643 ScRefHandler::~ScRefHandler() COVERITY_NOEXCEPT_FALSE
645 disposeRefHandler();
648 void ScRefHandler::disposeRefHandler()
650 m_pController = nullptr;
651 LeaveRefMode();
652 m_aHelper.dispose();
655 bool ScRefHandler::LeaveRefMode()
657 if( !m_bInRefMode ) return false;
659 lcl_HideAllReferences();
661 SetDispatcherLock( false ); //! here and in DoClose ?
663 ScTabViewShell* pScViewShell = ScTabViewShell::GetActiveViewShell();
664 if( pScViewShell )
665 pScViewShell->UpdateInputHandler(true);
667 lcl_InvalidateWindows();
669 m_bInRefMode = false;
670 return true;
673 void ScRefHandler::SwitchToDocument()
675 ScTabViewShell* pCurrent = ScTabViewShell::GetActiveViewShell();
676 if (pCurrent)
678 SfxObjectShell* pObjSh = pCurrent->GetObjectShell();
679 if ( pObjSh && pObjSh->GetTitle() == m_aDocName )
681 // right document already visible -> nothing to do
682 return;
686 SfxViewShell* pSh = SfxViewShell::GetFirst( true, checkSfxViewShell<ScTabViewShell> );
687 while ( pSh )
689 SfxObjectShell* pObjSh = pSh->GetObjectShell();
690 if ( pObjSh && pObjSh->GetTitle() == m_aDocName )
692 // switch to first TabViewShell for document
693 static_cast<ScTabViewShell*>(pSh)->SetActive();
694 return;
696 pSh = SfxViewShell::GetNext( *pSh, true, checkSfxViewShell<ScTabViewShell> );
700 bool ScRefHandler::IsDocAllowed(SfxObjectShell* pDocSh) const // pDocSh may be 0
702 // if aDocName isn't initialized, allow
703 if ( m_aDocName.isEmpty() )
704 return true;
706 if ( !pDocSh )
707 return false;
709 // default: allow only same document (overridden in function dialog)
710 return m_aDocName==pDocSh->GetTitle();
713 bool ScRefHandler::IsRefInputMode() const
715 return m_pController->getDialog()->get_visible();
718 bool ScRefHandler::DoClose( sal_uInt16 nId )
720 m_aHelper.DoClose(nId);
721 return true;
724 void ScRefHandler::SetDispatcherLock( bool bLock )
726 m_aHelper.SetDispatcherLock( bLock );
729 void ScRefHandler::ViewShellChanged()
731 ScFormulaReferenceHelper::ViewShellChanged();
734 void ScRefHandler::AddRefEntry()
736 // override this for multi-references
739 bool ScRefHandler::IsTableLocked() const
741 // the default is that the sheet can be switched during while the reference is edited
743 return false;
746 // RefInputStart/Done: Zoom-In (AutoHide) on single field
747 // (using button or movement)
749 void ScRefHandler::RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton )
751 m_aHelper.RefInputStart( pEdit, pButton );
754 void ScRefHandler::ToggleCollapsed( formula::RefEdit* pEdit, formula::RefButton* pButton )
756 m_aHelper.ToggleCollapsed( pEdit, pButton );
759 bool ScRefHandler::ParseWithNames( ScRangeList& rRanges, std::u16string_view rStr, const ScDocument& rDoc )
761 return m_aHelper.ParseWithNames( rRanges, rStr, rDoc );
764 void ScRefHandler::HideReference( bool bDoneRefMode )
766 m_aHelper.HideReference( bDoneRefMode );
769 void ScRefHandler::ShowReference(const OUString& rStr)
771 m_aHelper.ShowReference(rStr);
774 void ScRefHandler::ReleaseFocus( formula::RefEdit* pEdit )
776 m_aHelper.ReleaseFocus( pEdit );
779 void ScRefHandler::RefInputDone( bool bForced )
781 m_aHelper.RefInputDone( bForced );
784 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */