LibreOffice Module sc (master)  1
tabvwsh4.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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 <sal/config.h>
21 
22 #include <formdata.hxx>
23 
24 #include <sfx2/app.hxx>
25 #include <svx/dialogs.hrc>
26 #include <svx/extrusionbar.hxx>
27 #include <svx/fontworkbar.hxx>
28 #include <editeng/borderline.hxx>
29 #include <svx/fmshell.hxx>
31 #include <sfx2/printer.hxx>
32 #include <sfx2/dispatch.hxx>
33 #include <sfx2/ipclient.hxx>
34 #include <tools/urlobj.hxx>
35 #include <sfx2/docfile.hxx>
36 #include <tools/svborder.hxx>
37 
38 #include <IAnyRefDialog.hxx>
39 #include <tabvwsh.hxx>
40 #include <sc.hrc>
41 #include <globstr.hrc>
42 #include <docsh.hxx>
43 #include <scmod.hxx>
44 #include <appoptio.hxx>
45 #include <drawsh.hxx>
46 #include <drformsh.hxx>
47 #include <editsh.hxx>
48 #include <pivotsh.hxx>
49 #include <auditsh.hxx>
50 #include <drtxtob.hxx>
51 #include <inputhdl.hxx>
52 #include <editutil.hxx>
53 #include <inputopt.hxx>
54 #include <inputwin.hxx>
55 #include <dbdata.hxx>
56 #include <reffact.hxx>
57 #include <viewuno.hxx>
58 #include <dispuno.hxx>
59 #include <chgtrack.hxx>
60 #include <cellsh.hxx>
61 #include <oleobjsh.hxx>
62 #include <chartsh.hxx>
63 #include <graphsh.hxx>
64 #include <mediash.hxx>
65 #include <pgbrksh.hxx>
66 #include <dpobject.hxx>
67 #include <prevwsh.hxx>
68 #include <scextopt.hxx>
69 #include <drawview.hxx>
70 #include <fupoor.hxx>
71 #include <navsett.hxx>
72 #include <scabstdlg.hxx>
73 #include <externalrefmgr.hxx>
74 #include <defaultsoptions.hxx>
75 #include <markdata.hxx>
76 #include <preview.hxx>
77 #include <docoptio.hxx>
78 #include <documentlinkmgr.hxx>
79 #include <gridwin.hxx>
80 
81 #include <com/sun/star/document/XDocumentProperties.hpp>
82 #include <sfx2/lokhelper.hxx>
83 #include <comphelper/flagguard.hxx>
84 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
85 #include <comphelper/lok.hxx>
87 
88 using namespace com::sun::star;
89 using namespace sfx2::sidebar;
90 
91 namespace {
92 
93 bool inChartContext(ScTabViewShell* pViewShell)
94 {
95  SidebarController* pSidebar = SidebarController::GetSidebarControllerForView(pViewShell);
96  if (pSidebar)
97  return pSidebar->hasChartContextCurrently();
98 
99  return false;
100 }
101 
102 } // anonymous namespace
103 
105 {
107  bIsActive = true;
108  // here no GrabFocus, otherwise there will be problems when something is edited inplace!
109 
110  if ( bMDI )
111  {
112  // for input row (ClearCache)
113  ScModule* pScMod = SC_MOD();
114  pScMod->ViewShellChanged(/*bStopEditing=*/ !comphelper::LibreOfficeKit::isActive());
115 
116  ActivateView( true, bFirstActivate );
117 
118  // update AutoCorrect, if Writer has newly created this
119  UpdateDrawTextOutliner();
120 
121  // RegisterNewTargetNames does not exist anymore
122 
123  SfxViewFrame* pThisFrame = GetViewFrame();
124  if ( mpInputHandler && pThisFrame->HasChildWindow(FID_INPUTLINE_STATUS) )
125  {
126  // actually only required for Reload (last version):
127  // The InputWindow remains, but the View along with the InputHandler is newly created,
128  // that is why the InputHandler must be set at the InputWindow.
129  SfxChildWindow* pChild = pThisFrame->GetChildWindow(FID_INPUTLINE_STATUS);
130  if (pChild)
131  {
132  ScInputWindow* pWin = static_cast<ScInputWindow*>(pChild->GetWindow());
133  if (pWin && pWin->IsVisible())
134  {
135 
136  ScInputHandler* pOldHdl=pWin->GetInputHandler();
137 
138  SfxViewShell* pSh = SfxViewShell::GetFirst( true, checkSfxViewShell<ScTabViewShell> );
139  while ( pSh!=nullptr && pOldHdl!=nullptr)
140  {
141  // Hmm, what if pSh is a shell for a different document? But as this code
142  // does not seem to be LibreOfficeKit-specific, probably that doesn't
143  // happen, because having multiple documents open simultaneously has of
144  // course not been a problem at all in traditional desktop LibreOffice.
145  // (Unlike in a LibreOfficeKit-based process where it has been a problem.)
146  if (static_cast<ScTabViewShell*>(pSh)->GetInputHandler() == pOldHdl)
147  {
148  pOldHdl->ResetDelayTimer();
149  break;
150  }
151  pSh = SfxViewShell::GetNext( *pSh, true, checkSfxViewShell<ScTabViewShell> );
152  }
153 
154  pWin->SetInputHandler( mpInputHandler.get() );
155  }
156  }
157  }
158 
159  UpdateInputHandler( /*bForce=*/ true, /*bStopEditing=*/ !comphelper::LibreOfficeKit::isActive() );
160 
161  if ( bFirstActivate )
162  {
163  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScNavigatorUpdateAll ) );
164  bFirstActivate = false;
165 
166  // ReadExtOptions (view settings from Excel import) must also be done
167  // after the ctor, because of the potential calls to Window::Show.
168  // Even after a bugfix (Window::Show no longer notifies the access
169  // bridge, it's done in ImplSetReallyVisible), there are problems if Window::Show
170  // is called during the ViewShell ctor and reschedules asynchronous calls
171  // (for example from the FmFormShell ctor).
172  ScExtDocOptions* pExtOpt = GetViewData().GetDocument().GetExtDocOptions();
173  if ( pExtOpt && pExtOpt->IsChanged() )
174  {
175  GetViewData().ReadExtOptions(*pExtOpt); // Excel view settings
176  SetTabNo( GetViewData().GetTabNo(), true );
177  pExtOpt->SetChanged( false );
178  }
179  }
180 
181  pScActiveViewShell = this;
182 
183  ScInputHandler* pHdl = pScMod->GetInputHdl(this);
184  if (pHdl)
185  {
186  pHdl->SetRefScale( GetViewData().GetZoomX(), GetViewData().GetZoomY() );
187  }
188 
189  // update change dialog
190 
191  if ( pThisFrame->HasChildWindow(FID_CHG_ACCEPT) )
192  {
193  SfxChildWindow* pChild = pThisFrame->GetChildWindow(FID_CHG_ACCEPT);
194  if (pChild)
195  {
196  static_cast<ScAcceptChgDlgWrapper*>(pChild)->ReInitDlg();
197  }
198  }
199 
200  if(pScMod->IsRefDialogOpen())
201  {
202  sal_uInt16 nModRefDlgId=pScMod->GetCurRefDlgId();
203  SfxChildWindow* pChildWnd = pThisFrame->GetChildWindow( nModRefDlgId );
204  if ( pChildWnd )
205  {
206  if (auto pController = pChildWnd->GetController())
207  {
208  IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pController.get());
209  if (pRefDlg)
210  pRefDlg->ViewShellChanged();
211  }
212  }
213  }
214  }
215 
216  // don't call CheckSelectionTransfer here - activating a view should not change the
217  // primary selection (may be happening just because the mouse was moved over the window)
218 
219  if (!inChartContext(this))
220  {
222  GetController(),
224  }
225 }
226 
228 {
229  HideTip();
230 
231  ScDocument& rDoc = GetViewData().GetDocument();
232 
233  ScChangeTrack* pChanges = rDoc.GetChangeTrack();
234 
235  if(pChanges!=nullptr)
236  {
238  pChanges->SetModifiedLink(aLink);
239  }
240 
242  bIsActive = false;
243  ScInputHandler* pHdl = SC_MOD()->GetInputHdl(this);
244 
246  {
247  // during shell deactivation, shells must not be switched, or the loop
248  // through the shell stack (in SfxDispatcher::DoDeactivate_Impl) will not work
249  bool bOldDontSwitch = bDontSwitch;
250  bDontSwitch = true;
251 
252  ActivateView( false, false );
253 
254  if ( GetViewFrame()->GetFrame().IsInPlace() ) // inplace
255  GetViewData().GetDocShell()->UpdateOle(GetViewData(), true);
256 
257  if ( pHdl )
258  pHdl->NotifyChange( nullptr, true ); // timer-delayed due to document switching
259 
260  if (pScActiveViewShell == this)
261  pScActiveViewShell = nullptr;
262 
263  bDontSwitch = bOldDontSwitch;
264  }
265  else
266  {
267  HideNoteMarker(); // note marker
268 
269  if ( pHdl )
270  pHdl->HideTip(); // Hide formula auto input tip
271  }
272 }
273 
275 {
276  // SFX-View would like to activate itself, since then magical things would happen
277  // (eg else the designer may crash)
278  ActiveGrabFocus();
279 }
280 
282 {
283  comphelper::FlagRestorationGuard aFlagGuard(bInPrepareClose, true);
284 
285  // Call EnterHandler even in formula mode here,
286  // so a formula change in an embedded object isn't lost
287  // (ScDocShell::PrepareClose isn't called then).
288  ScInputHandler* pHdl = SC_MOD()->GetInputHdl( this );
289  if ( pHdl && pHdl->IsInputMode() )
290  {
291  pHdl->EnterHandler();
292  }
293 
294  // draw text edit mode must be closed
295  FuPoor* pPoor = GetDrawFuncPtr();
296  if (pPoor && IsDrawTextShell())
297  {
298  // "clean" end of text edit, including note handling, subshells and draw func switching,
299  // as in FuDraw and ScTabView::DrawDeselectAll
300  GetViewData().GetDispatcher().Execute( pPoor->GetSlotID(), SfxCallMode::SLOT | SfxCallMode::RECORD );
301  }
302  ScDrawView* pDrView = GetScDrawView();
303  if ( pDrView )
304  {
305  // force end of text edit, to be safe
306  // ScEndTextEdit must always be used, to ensure correct UndoManager
307  pDrView->ScEndTextEdit();
308  }
309 
310  if ( pFormShell )
311  {
312  bool bRet = pFormShell->PrepareClose(bUI);
313  if (!bRet)
314  return bRet;
315  }
316  return SfxViewShell::PrepareClose(bUI);
317 }
318 
319 // calculate zoom for in-place
320 // from the ratio of VisArea and window size of GridWin
321 
323 {
324  ScDocShell* pDocSh = GetViewData().GetDocShell();
325  if ( pDocSh->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
326  {
327  //TODO/LATER: is there a difference between the two GetVisArea methods?
328  Size aObjSize = static_cast<const SfxObjectShell*>(pDocSh)->GetVisArea().GetSize();
329  if ( !aObjSize.IsEmpty() )
330  {
331  vcl::Window* pWin = GetActiveWin();
332  Size aWinHMM = pWin->PixelToLogic(pWin->GetOutputSizePixel(), MapMode(MapUnit::Map100thMM));
333  SetZoomFactor( Fraction( aWinHMM.Width(),aObjSize.Width() ),
334  Fraction( aWinHMM.Height(),aObjSize.Height() ) );
335  }
336  }
337 }
338 
339 void ScTabViewShell::InnerResizePixel( const Point &rOfs, const Size &rSize, bool inplaceEditModeChange )
340 {
341  Size aNewSize( rSize );
342  if ( GetViewFrame()->GetFrame().IsInPlace() )
343  {
344  SvBorder aBorder;
345  GetBorderSize( aBorder, rSize );
346  SetBorderPixel( aBorder );
347 
348  Size aObjSize = GetObjectShell()->GetVisArea().GetSize();
349 
350  Size aSize( rSize );
351  aSize.AdjustWidth( -(aBorder.Left() + aBorder.Right()) );
352  aSize.AdjustHeight( -(aBorder.Top() + aBorder.Bottom()) );
353 
354  if ( !aObjSize.IsEmpty() )
355  {
356  Size aLogicSize = GetWindow()->PixelToLogic(aSize, MapMode(MapUnit::Map100thMM));
357  SfxViewShell::SetZoomFactor( Fraction( aLogicSize.Width(),aObjSize.Width() ),
358  Fraction( aLogicSize.Height(),aObjSize.Height() ) );
359  }
360 
361  Point aPos( rOfs );
362  aPos.AdjustX(aBorder.Left() );
363  aPos.AdjustY(aBorder.Top() );
364  GetWindow()->SetPosSizePixel( aPos, aSize );
365  }
366  else
367  {
368  SvBorder aBorder;
369  GetBorderSize( aBorder, rSize );
370  SetBorderPixel( aBorder );
371  aNewSize.AdjustWidth(aBorder.Left() + aBorder.Right() );
372  aNewSize.AdjustHeight(aBorder.Top() + aBorder.Bottom() );
373  }
374 
375  DoResize( rOfs, aNewSize, true ); // rSize = size of gridwin
376 
377  UpdateOleZoom(); // calculate zoom for in-place
378 
379  if (!inplaceEditModeChange)
380  {
381  GetViewData().GetDocShell()->SetDocumentModified();
382  }
383 }
384 
385 void ScTabViewShell::OuterResizePixel( const Point &rOfs, const Size &rSize )
386 {
387  SvBorder aBorder;
388  GetBorderSize( aBorder, rSize );
389  SetBorderPixel( aBorder );
390 
391  DoResize( rOfs, rSize ); // position and size of tabview as passed
392 
393  // ForceMove as replacement for Sfx-Move mechanism
394  // (aWinPos must be kept current, so that ForceMove works for Ole deactivation)
395 
396  ForceMove();
397 }
398 
399 void ScTabViewShell::SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY )
400 {
401  // for OLE...
402 
403  Fraction aFrac20( 1,5 );
404  Fraction aFrac400( 4,1 );
405 
406  Fraction aNewX( rZoomX );
407  if ( aNewX < aFrac20 )
408  aNewX = aFrac20;
409  if ( aNewX > aFrac400 )
410  aNewX = aFrac400;
411  Fraction aNewY( rZoomY );
412  if ( aNewY < aFrac20 )
413  aNewY = aFrac20;
414  if ( aNewY > aFrac400 )
415  aNewY = aFrac400;
416 
417  GetViewData().UpdateScreenZoom( aNewX, aNewY );
418  SetZoom( aNewX, aNewY, true );
419 
420  PaintGrid();
421  PaintTop();
422  PaintLeft();
423 
424  SfxViewShell::SetZoomFactor( rZoomX, rZoomY );
425 }
426 
428 {
429  // adjust to entire cells (in 1/100 mm)
430 
431  Size aPixelSize = rRect.GetSize();
432  vcl::Window* pWin = const_cast<ScTabViewShell*>(this)->GetActiveWin();
433  Size aLogicSize = pWin->PixelToLogic( aPixelSize );
434 
435  const ScViewData& rViewData = GetViewData();
436  ScDocument& rDoc = rViewData.GetDocument();
437  ScSplitPos ePos = rViewData.GetActivePart();
438  SCCOL nCol = rViewData.GetPosX(WhichH(ePos));
439  SCROW nRow = rViewData.GetPosY(WhichV(ePos));
440  SCTAB nTab = rViewData.GetTabNo();
441  bool bNegativePage = rDoc.IsNegativePage( nTab );
442 
443  tools::Rectangle aLogicRect = rDoc.GetMMRect( nCol, nRow, nCol, nRow, nTab );
444  if ( bNegativePage )
445  {
446  // use right edge of aLogicRect, and aLogicSize
447  aLogicRect.SetLeft( aLogicRect.Right() - aLogicSize.Width() + 1 ); // Right() is set below
448  }
449  aLogicRect.SetSize( aLogicSize );
450 
451  rViewData.GetDocShell()->SnapVisArea( aLogicRect );
452 
453  rRect.SetSize( pWin->LogicToPixel( aLogicRect.GetSize() ) );
454 }
455 
457 {
458  Point aNewPos = GetViewFrame()->GetWindow().OutputToScreenPixel(Point());
459 
460  if (aNewPos != aWinPos)
461  {
462  StopMarking();
463  aWinPos = aNewPos;
464  }
465 }
466 
467 void ScTabViewShell::ShowCursor(bool /* bOn */)
468 {
477 }
478 
479 void ScTabViewShell::WriteUserData(OUString& rData, bool /* bBrowse */)
480 {
481  GetViewData().WriteUserData(rData);
482 }
483 
484 void ScTabViewShell::WriteUserDataSequence (uno::Sequence < beans::PropertyValue >& rSettings )
485 {
486  GetViewData().WriteUserDataSequence(rSettings);
487 }
488 
489 void ScTabViewShell::ReadUserData(const OUString& rData, bool /* bBrowse */)
490 {
491  if ( !GetViewData().GetDocShell()->IsPreview() )
492  DoReadUserData( rData );
493 }
494 
495 void ScTabViewShell::ReadUserDataSequence (const uno::Sequence < beans::PropertyValue >& rSettings )
496 {
497  if ( !GetViewData().GetDocShell()->IsPreview() )
498  DoReadUserDataSequence( rSettings );
499 }
500 
501 void ScTabViewShell::DoReadUserDataSequence( const uno::Sequence < beans::PropertyValue >& rSettings )
502 {
503  vcl::Window* pOldWin = GetActiveWin();
504  bool bFocus = pOldWin && pOldWin->HasFocus();
505 
506  GetViewData().ReadUserDataSequence(rSettings);
507  SetTabNo( GetViewData().GetTabNo(), true );
508 
509  if ( GetViewData().IsPagebreakMode() )
510  SetCurSubShell( GetCurObjectSelectionType(), true );
511 
512  vcl::Window* pNewWin = GetActiveWin();
513  if (pNewWin && pNewWin != pOldWin)
514  {
515  SetWindow( pNewWin );
516  if (bFocus)
517  pNewWin->GrabFocus();
518  WindowChanged(); // drawing layer (for instance #56771#)
519  }
520 
521  if (GetViewData().GetHSplitMode() == SC_SPLIT_FIX ||
522  GetViewData().GetVSplitMode() == SC_SPLIT_FIX)
523  {
524  InvalidateSplit();
525  }
526 
527  ZoomChanged();
528 
529  TestHintWindow();
530 
532 }
533 
534 // DoReadUserData is also called from ctor when switching from print preview
535 
536 void ScTabViewShell::DoReadUserData( const OUString& rData )
537 {
538  vcl::Window* pOldWin = GetActiveWin();
539  bool bFocus = pOldWin && pOldWin->HasFocus();
540 
541  GetViewData().ReadUserData(rData);
542  SetTabNo( GetViewData().GetTabNo(), true );
543 
544  if ( GetViewData().IsPagebreakMode() )
545  SetCurSubShell( GetCurObjectSelectionType(), true );
546 
547  vcl::Window* pNewWin = GetActiveWin();
548  if (pNewWin && pNewWin != pOldWin)
549  {
550  SetWindow( pNewWin );
551  if (bFocus)
552  pNewWin->GrabFocus();
553  WindowChanged(); // drawing layer (for instance #56771#)
554  }
555 
556  if (GetViewData().GetHSplitMode() == SC_SPLIT_FIX ||
557  GetViewData().GetVSplitMode() == SC_SPLIT_FIX)
558  {
559  InvalidateSplit();
560  }
561 
562  ZoomChanged();
563 
564  TestHintWindow();
565 
567 }
568 
570 {
571  // Called after user interaction that may delete the selected drawing object.
572  // Remove DrawShell if nothing is selected.
573 
574  SdrView* pDrView = GetScDrawView();
575  if ( pDrView && !pDrView->AreObjectsMarked() && !IsDrawSelMode() )
576  SetDrawShell( false );
577 }
578 
580 {
581  bActiveDrawSh = true;
582 
583  if(bActiveDrawFormSh)
584  {
585  SetCurSubShell(OST_DrawForm);
586  }
587  else if(bActiveGraphicSh)
588  {
589  SetCurSubShell(OST_Graphic);
590  }
591  else if(bActiveMediaSh)
592  {
593  SetCurSubShell(OST_Media);
594  }
595  else if(bActiveChartSh)
596  {
597  SetCurSubShell(OST_Chart);
598  }
599  else if(bActiveOleObjectSh)
600  {
601  SetCurSubShell(OST_OleObject);
602  }
603  else
604  {
605  SetCurSubShell(OST_Drawing, true /* force: different toolbars are
606  visible concerning shape type
607  and shape state */);
608  }
609 }
610 
611 void ScTabViewShell::SetDrawShell( bool bActive )
612 {
613  if(bActive)
614  {
615  SetCurSubShell(OST_Drawing, true /* force: different toolbars are
616  visible concerning shape type
617  and shape state */);
618  }
619  else
620  {
621  if(bActiveDrawFormSh || bActiveDrawSh ||
622  bActiveGraphicSh || bActiveMediaSh || bActiveOleObjectSh||
623  bActiveChartSh || bActiveDrawTextSh)
624  {
625  SetCurSubShell(OST_Cell);
626  }
627  bActiveDrawFormSh=false;
628  bActiveGraphicSh=false;
629  bActiveMediaSh=false;
630  bActiveOleObjectSh=false;
631  bActiveChartSh=false;
632  }
633 
634  bool bWasDraw = bActiveDrawSh || bActiveDrawTextSh;
635 
636  bActiveDrawSh = bActive;
637  bActiveDrawTextSh = false;
638 
639  if ( !bActive )
640  {
641  ResetDrawDragMode(); // switch off Mirror / Rotate
642 
643  if (bWasDraw && (GetViewData().GetHSplitMode() == SC_SPLIT_FIX ||
644  GetViewData().GetVSplitMode() == SC_SPLIT_FIX))
645  {
646  // adjust active part to cursor, etc.
647  MoveCursorAbs( GetViewData().GetCurX(), GetViewData().GetCurY(),
648  SC_FOLLOW_NONE, false, false, true );
649  }
650  }
651 }
652 
654 {
655  bActiveDrawTextSh = bActive;
656  if ( bActive )
657  {
658  bActiveDrawFormSh=false;
659  bActiveGraphicSh=false;
660  bActiveMediaSh=false;
661  bActiveOleObjectSh=false;
662  bActiveChartSh=false;
663  bActiveDrawSh = false;
664  SetCurSubShell(OST_DrawText);
665  }
666  else
667  SetCurSubShell(OST_Cell);
668 
669 }
670 
671 void ScTabViewShell::SetPivotShell( bool bActive )
672 {
673  // SetPivotShell is called from CursorPosChanged every time
674  // -> don't change anything except switching between cell and pivot shell
675 
676  if (eCurOST != OST_Pivot && eCurOST != OST_Cell)
677  return;
678 
679  if ( bActive )
680  {
681  bActiveDrawTextSh = bActiveDrawSh = false;
682  bActiveDrawFormSh=false;
683  bActiveGraphicSh=false;
684  bActiveMediaSh=false;
685  bActiveOleObjectSh=false;
686  bActiveChartSh=false;
687  SetCurSubShell(OST_Pivot);
688  }
689  else
690  SetCurSubShell(OST_Cell);
691 }
692 
693 void ScTabViewShell::SetAuditShell( bool bActive )
694 {
695  if ( bActive )
696  {
697  bActiveDrawTextSh = bActiveDrawSh = false;
698  bActiveDrawFormSh=false;
699  bActiveGraphicSh=false;
700  bActiveMediaSh=false;
701  bActiveOleObjectSh=false;
702  bActiveChartSh=false;
703  SetCurSubShell(OST_Auditing);
704  }
705  else
706  SetCurSubShell(OST_Cell);
707 }
708 
710 {
711  bActiveDrawFormSh = bActive;
712 
713  if(bActiveDrawFormSh)
714  SetCurSubShell(OST_DrawForm);
715 }
716 void ScTabViewShell::SetChartShell( bool bActive )
717 {
718  bActiveChartSh = bActive;
719 
720  if(bActiveChartSh)
721  SetCurSubShell(OST_Chart);
722 }
723 
725 {
726  bActiveGraphicSh = bActive;
727 
728  if(bActiveGraphicSh)
729  SetCurSubShell(OST_Graphic);
730 }
731 
732 void ScTabViewShell::SetMediaShell( bool bActive )
733 {
734  bActiveMediaSh = bActive;
735 
736  if(bActiveMediaSh)
737  SetCurSubShell(OST_Media);
738 }
739 
741 {
742  bActiveOleObjectSh = bActive;
743 
744  if(bActiveOleObjectSh)
745  SetCurSubShell(OST_OleObject);
746  else
747  SetCurSubShell(OST_Cell);
748 }
749 
750 void ScTabViewShell::SetEditShell(EditView* pView, bool bActive )
751 {
752  if(bActive)
753  {
754  if (pEditShell)
755  pEditShell->SetEditView( pView );
756  else
757  pEditShell.reset( new ScEditShell(pView, GetViewData()) );
758 
759  SetCurSubShell(OST_Editing);
760  }
761  else if(bActiveEditSh)
762  {
763  SetCurSubShell(OST_Cell);
764  }
765  bActiveEditSh = bActive;
766 }
767 
769 {
770  ScViewData& rViewData = GetViewData();
771  ScDocShell* pDocSh = rViewData.GetDocShell();
772 
773  if(bDontSwitch) return;
774 
775  if(!pCellShell) // is anyway always used
776  {
777  pCellShell.reset(new ScCellShell(GetViewData(), GetFrameWin()));
778  pCellShell->SetRepeatTarget( &aTarget );
779  }
780 
781  bool bPgBrk = rViewData.IsPagebreakMode();
782 
783  if(bPgBrk && !pPageBreakShell)
784  {
785  pPageBreakShell.reset( new ScPageBreakShell( this ) );
786  pPageBreakShell->SetRepeatTarget( &aTarget );
787  }
788 
789  if ( !(eOST!=eCurOST || bForce) )
790  return;
791 
792  bool bCellBrush = false; // "format paint brush" allowed for cells
793  bool bDrawBrush = false; // "format paint brush" allowed for drawing objects
794 
795  if(eCurOST!=OST_NONE) RemoveSubShell();
796 
797  if (pFormShell && !bFormShellAtTop)
798  AddSubShell(*pFormShell); // add below own subshells
799 
800  switch(eOST)
801  {
802  case OST_Cell:
803  {
804  AddSubShell(*pCellShell);
805  if(bPgBrk) AddSubShell(*pPageBreakShell);
806  bCellBrush = true;
807  }
808  break;
809  case OST_Editing:
810  {
811  AddSubShell(*pCellShell);
812  if(bPgBrk) AddSubShell(*pPageBreakShell);
813 
814  if(pEditShell)
815  {
816  AddSubShell(*pEditShell);
817  }
818  }
819  break;
820  case OST_DrawText:
821  {
822  if ( !pDrawTextShell )
823  {
824  pDocSh->MakeDrawLayer();
825  pDrawTextShell.reset( new ScDrawTextObjectBar(GetViewData()) );
826  }
827  AddSubShell(*pDrawTextShell);
828  }
829  break;
830  case OST_Drawing:
831  {
833  GetScDrawView(), true /* bOnlyExtruded */ )) {
834  if (pExtrusionBarShell == nullptr)
835  pExtrusionBarShell.reset( new svx::ExtrusionBar(this) );
836  AddSubShell( *pExtrusionBarShell );
837  }
838 
840  GetScDrawView() )) {
841  if (pFontworkBarShell == nullptr)
842  pFontworkBarShell.reset( new svx::FontworkBar(this) );
843  AddSubShell( *pFontworkBarShell );
844  }
845 
846  if ( !pDrawShell )
847  {
848  pDocSh->MakeDrawLayer();
849  pDrawShell.reset(new ScDrawShell(GetViewData()));
850  pDrawShell->SetRepeatTarget( &aTarget );
851  }
852  AddSubShell(*pDrawShell);
853  bDrawBrush = true;
854  }
855  break;
856 
857  case OST_DrawForm:
858  {
859  if ( !pDrawFormShell )
860  {
861  pDocSh->MakeDrawLayer();
862  pDrawFormShell.reset( new ScDrawFormShell(GetViewData()) );
863  pDrawFormShell->SetRepeatTarget( &aTarget );
864  }
865  AddSubShell(*pDrawFormShell);
866  bDrawBrush = true;
867  }
868  break;
869 
870  case OST_Chart:
871  {
872  if ( !pChartShell )
873  {
874  pDocSh->MakeDrawLayer();
875  pChartShell.reset( new ScChartShell(GetViewData()) );
876  pChartShell->SetRepeatTarget( &aTarget );
877  }
878  AddSubShell(*pChartShell);
879  bDrawBrush = true;
880  }
881  break;
882 
883  case OST_OleObject:
884  {
885  if ( !pOleObjectShell )
886  {
887  pDocSh->MakeDrawLayer();
888  pOleObjectShell.reset( new ScOleObjectShell(GetViewData()) );
889  pOleObjectShell->SetRepeatTarget( &aTarget );
890  }
891  AddSubShell(*pOleObjectShell);
892  bDrawBrush = true;
893  }
894  break;
895 
896  case OST_Graphic:
897  {
898  if ( !pGraphicShell)
899  {
900  pDocSh->MakeDrawLayer();
901  pGraphicShell.reset( new ScGraphicShell(GetViewData()) );
902  pGraphicShell->SetRepeatTarget( &aTarget );
903  }
904  AddSubShell(*pGraphicShell);
905  bDrawBrush = true;
906  }
907  break;
908 
909  case OST_Media:
910  {
911  if ( !pMediaShell)
912  {
913  pDocSh->MakeDrawLayer();
914  pMediaShell.reset( new ScMediaShell(GetViewData()) );
915  pMediaShell->SetRepeatTarget( &aTarget );
916  }
917  AddSubShell(*pMediaShell);
918  }
919  break;
920 
921  case OST_Pivot:
922  {
923  AddSubShell(*pCellShell);
924  if(bPgBrk) AddSubShell(*pPageBreakShell);
925 
926  if ( !pPivotShell )
927  {
928  pPivotShell.reset( new ScPivotShell( this ) );
929  pPivotShell->SetRepeatTarget( &aTarget );
930  }
931  AddSubShell(*pPivotShell);
932  bCellBrush = true;
933  }
934  break;
935  case OST_Auditing:
936  {
937  AddSubShell(*pCellShell);
938  if(bPgBrk) AddSubShell(*pPageBreakShell);
939 
940  if ( !pAuditingShell )
941  {
942  pDocSh->MakeDrawLayer(); // the waiting time rather now as on the click
943 
944  pAuditingShell.reset( new ScAuditingShell(GetViewData()) );
945  pAuditingShell->SetRepeatTarget( &aTarget );
946  }
947  AddSubShell(*pAuditingShell);
948  bCellBrush = true;
949  }
950  break;
951  default:
952  OSL_FAIL("wrong shell requested");
953  break;
954  }
955 
956  if (pFormShell && bFormShellAtTop)
957  AddSubShell(*pFormShell); // add on top of own subshells
958 
959  eCurOST=eOST;
960 
961  // abort "format paint brush" when switching to an incompatible shell
962  if ( ( GetBrushDocument() && !bCellBrush ) || ( GetDrawBrushSet() && !bDrawBrush ) )
963  ResetBrushDocument();
964 }
965 
967 {
968  if ( pFormShell && !bSet )
969  pFormShell->ForgetActiveControl(); // let the FormShell know it no longer has the focus
970 
971  if ( bFormShellAtTop != bSet )
972  {
973  bFormShellAtTop = bSet;
974  SetCurSubShell( GetCurObjectSelectionType(), true );
975  }
976 }
977 
978 IMPL_LINK_NOARG(ScTabViewShell, FormControlActivated, LinkParamNone*, void)
979 {
980  // a form control got the focus, so the form shell has to be on top
981  SetFormShellAtTop( true );
982 }
983 
984 // GetMySubShell / SetMySubShell: simulate old behavior,
985 // so that there is only one SubShell (only within the 5 own SubShells)
986 
988 {
989  // GetSubShell() was const before, and GetSubShell(sal_uInt16) should also be const...
990 
991  sal_uInt16 nPos = 0;
992  SfxShell* pSub = const_cast<ScTabViewShell*>(this)->GetSubShell(nPos);
993  while (pSub)
994  {
995  if ( pSub == pDrawShell.get() || pSub == pDrawTextShell.get() || pSub == pEditShell.get() ||
996  pSub == pPivotShell.get() || pSub == pAuditingShell.get() || pSub == pDrawFormShell.get() ||
997  pSub == pCellShell.get() || pSub == pOleObjectShell.get() || pSub == pChartShell.get() ||
998  pSub == pGraphicShell.get() || pSub == pMediaShell.get() || pSub == pPageBreakShell.get())
999  return pSub; // found
1000 
1001  pSub = const_cast<ScTabViewShell*>(this)->GetSubShell(++nPos);
1002  }
1003  return nullptr; // none from mine present
1004 }
1005 
1007 {
1008  return ( pDrawTextShell && ( GetMySubShell() == pDrawTextShell.get() ) );
1009 }
1010 
1012 {
1013  return ( pAuditingShell && ( GetMySubShell() == pAuditingShell.get() ) );
1014 }
1015 
1017 {
1018  // Default: undo manager for DocShell
1019  if (!pNewUndoMgr)
1020  pNewUndoMgr = GetViewData().GetDocShell()->GetUndoManager();
1021 
1022  if (pDrawTextShell)
1023  {
1024  pDrawTextShell->SetUndoManager(pNewUndoMgr);
1025  ScDocShell* pDocSh = GetViewData().GetDocShell();
1026  if ( pNewUndoMgr == pDocSh->GetUndoManager() &&
1027  !pDocSh->GetDocument().IsUndoEnabled() )
1028  {
1029  pNewUndoMgr->SetMaxUndoActionCount( 0 );
1030  }
1031  }
1032  else
1033  {
1034  OSL_FAIL("SetDrawTextUndo without DrawTextShell");
1035  }
1036 }
1037 
1039 {
1040  return dynamic_cast< ScTabViewShell *>( Current() );
1041 }
1042 
1044 {
1045  // printer is always present (is created for the FontList already on start-up)
1046  return GetViewData().GetDocShell()->GetPrinter(bCreate);
1047 }
1048 
1049 sal_uInt16 ScTabViewShell::SetPrinter( SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags )
1050 {
1051  return GetViewData().GetDocShell()->SetPrinter( pNewPrinter, nDiffFlags );
1052 }
1053 
1055 {
1056  return true;
1057 }
1058 
1059 std::unique_ptr<SfxTabPage> ScTabViewShell::CreatePrintOptionsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rOptions )
1060 {
1062  ::CreateTabPage ScTpPrintOptionsCreate = pFact->GetTabPageCreatorFunc(RID_SC_TP_PRINT);
1063  if ( ScTpPrintOptionsCreate )
1064  return ScTpPrintOptionsCreate(pPage, pController, &rOptions);
1065  return nullptr;
1066 }
1067 
1069 {
1070  if ( pEditShell != nullptr && !bDontSwitch )
1071  SetEditShell(nullptr, false );
1072 }
1073 
1074 // close handler to ensure function of dialog:
1075 
1076 IMPL_LINK_NOARG(ScTabViewShell, SimpleRefClose, const OUString*, void)
1077 {
1078  SfxInPlaceClient* pClient = GetIPClient();
1079  if ( pClient && pClient->IsObjectInPlaceActive() )
1080  {
1081  // If range selection was started with an active embedded object,
1082  // switch back to original sheet (while the dialog is still open).
1083 
1084  SetTabNo( GetViewData().GetRefTabNo() );
1085  }
1086 
1088 }
1089 
1090 // handlers to call UNO listeners:
1091 
1093 {
1094  ScTabViewObj* pRet = nullptr;
1095  SfxViewFrame* pViewFrame = rShell.GetViewFrame();
1096  if (pViewFrame)
1097  {
1098  SfxFrame& rFrame = pViewFrame->GetFrame();
1099  uno::Reference<frame::XController> xController = rFrame.GetController();
1100  if (xController.is())
1101  pRet = comphelper::getUnoTunnelImplementation<ScTabViewObj>( xController );
1102  }
1103  return pRet;
1104 }
1105 
1106 IMPL_LINK( ScTabViewShell, SimpleRefDone, const OUString&, aResult, void )
1107 {
1108  ScTabViewObj* pImpObj = lcl_GetViewObj( *this );
1109  if ( pImpObj )
1110  pImpObj->RangeSelDone( aResult );
1111 }
1112 
1113 IMPL_LINK( ScTabViewShell, SimpleRefAborted, const OUString&, rResult, void )
1114 {
1115  ScTabViewObj* pImpObj = lcl_GetViewObj( *this );
1116  if ( pImpObj )
1117  pImpObj->RangeSelAborted( rResult );
1118 }
1119 
1120 IMPL_LINK( ScTabViewShell, SimpleRefChange, const OUString&, rResult, void )
1121 {
1122  ScTabViewObj* pImpObj = lcl_GetViewObj( *this );
1123  if ( pImpObj )
1124  pImpObj->RangeSelChanged( rResult );
1125 }
1126 
1128  const OUString& rTitle, const OUString& rInitVal,
1129  bool bCloseOnButtonUp, bool bSingleCell, bool bMultiSelection )
1130 {
1131  SfxViewFrame* pViewFrm = GetViewFrame();
1132 
1133  if ( GetActiveViewShell() != this )
1134  {
1135  // #i18833# / #i34499# The API method can be called for a view that's not active.
1136  // Then the view has to be activated first, the same way as in Execute for SID_CURRENTDOC.
1137  // Can't use GrabFocus here, because it needs to take effect immediately.
1138 
1139  pViewFrm->GetFrame().Appear();
1140  }
1141 
1142  sal_uInt16 nId = ScSimpleRefDlgWrapper::GetChildWindowId();
1143 
1144  SC_MOD()->SetRefDialog( nId, true, pViewFrm );
1145 
1146  ScSimpleRefDlgWrapper* pWnd = static_cast<ScSimpleRefDlgWrapper*>(pViewFrm->GetChildWindow( nId ));
1147  if (!pWnd)
1148  return;
1149 
1150  pWnd->SetCloseHdl( LINK( this, ScTabViewShell, SimpleRefClose ) );
1151  pWnd->SetUnoLinks( LINK( this, ScTabViewShell, SimpleRefDone ),
1152  LINK( this, ScTabViewShell, SimpleRefAborted ),
1153  LINK( this, ScTabViewShell, SimpleRefChange ) );
1154  pWnd->SetRefString( rInitVal );
1155  pWnd->SetFlags( bCloseOnButtonUp, bSingleCell, bMultiSelection );
1157  if (auto xWin = pWnd->GetController())
1158  xWin->set_title(rTitle);
1159  pWnd->StartRefInput();
1160 }
1161 
1163 {
1164  SfxViewFrame* pViewFrm = GetViewFrame();
1165  sal_uInt16 nId = ScSimpleRefDlgWrapper::GetChildWindowId();
1166 
1167  ScSimpleRefDlgWrapper* pWnd = static_cast<ScSimpleRefDlgWrapper*>(pViewFrm->GetChildWindow( nId ));
1168  if (pWnd)
1169  {
1170  if (auto pWin = pWnd->GetController())
1171  pWin->response(RET_CLOSE);
1172  }
1173 }
1174 
1176 {
1177  ScModule* pScMod = SC_MOD();
1178 
1179  SfxViewFrame* pThisFrame = GetViewFrame();
1180  if ( pThisFrame->GetChildWindow( SID_OPENDLG_FUNCTION ) )
1181  return false;
1182 
1183  vcl::KeyCode aCode = rKEvt.GetKeyCode();
1184  bool bShift = aCode.IsShift();
1185  bool bControl = aCode.IsMod1();
1186  bool bAlt = aCode.IsMod2();
1187  sal_uInt16 nCode = aCode.GetCode();
1188  bool bUsed = false;
1189  bool bInPlace = pScMod->IsEditMode(); // Editengine gets all
1190  bool bAnyEdit = pScMod->IsInputMode(); // only characters & backspace
1191  bool bDraw = IsDrawTextEdit();
1192 
1193  HideNoteMarker(); // note marker
1194 
1195  // don't do extra HideCursor/ShowCursor calls if EnterHandler will switch to a different sheet
1196  bool bOnRefSheet = ( GetViewData().GetRefTabNo() == GetViewData().GetTabNo() );
1197  bool bHideCursor = ( ( nCode == KEY_RETURN && bInPlace ) || nCode == KEY_TAB ) && bOnRefSheet;
1198 
1199  if (bHideCursor)
1200  HideAllCursors();
1201 
1202  ScDocument& rDoc = GetViewData().GetDocument();
1203  rDoc.KeyInput(); // TimerDelays etc.
1204 
1205  if( bInPlace )
1206  {
1207  bUsed = pScMod->InputKeyEvent( rKEvt ); // input
1208  if( !bUsed )
1209  bUsed = SfxViewShell::KeyInput( rKEvt ); // accelerators
1210  }
1211  else if( bAnyEdit )
1212  {
1213  bool bIsType = false;
1214  sal_uInt16 nModi = aCode.GetModifier();
1215  sal_uInt16 nGroup = aCode.GetGroup();
1216 
1217  if ( nGroup == KEYGROUP_NUM || nGroup == KEYGROUP_ALPHA || nGroup == 0 )
1218  if ( !bControl && !bAlt )
1219  bIsType = true;
1220 
1221  if ( nGroup == KEYGROUP_MISC )
1222  switch ( nCode )
1223  {
1224  case KEY_RETURN:
1225  bIsType = bControl && !bAlt; // Control, Shift-Control-Return
1226  if ( !bIsType && nModi == 0 )
1227  {
1228  // Does the Input Handler also want a simple Return?
1229 
1230  ScInputHandler* pHdl = pScMod->GetInputHdl(this);
1231  bIsType = pHdl && pHdl->TakesReturn();
1232  }
1233  break;
1234  case KEY_SPACE:
1235  bIsType = !bControl && !bAlt; // without modifier or Shift-Space
1236  break;
1237  case KEY_ESCAPE:
1238  bIsType = (nModi == 0); // only without modifier
1239  break;
1240  default:
1241  bIsType = true;
1242  }
1243 
1244  if( bIsType )
1245  bUsed = pScMod->InputKeyEvent( rKEvt ); // input
1246 
1247  if( !bUsed )
1248  bUsed = SfxViewShell::KeyInput( rKEvt ); // accelerators
1249 
1250  if ( !bUsed && !bIsType && nCode != KEY_RETURN ) // input once again afterwards
1251  bUsed = pScMod->InputKeyEvent( rKEvt );
1252  }
1253  else
1254  {
1255  // special case: copy/cut for multiselect -> error message
1256  // (Slot is disabled, so SfxViewShell::KeyInput would be swallowed without a comment)
1257  KeyFuncType eFunc = aCode.GetFunction();
1258  if ( eFunc == KeyFuncType::CUT )
1259  {
1260  ScRange aDummy;
1261  ScMarkType eMarkType = GetViewData().GetSimpleArea( aDummy );
1262  if (eMarkType != SC_MARK_SIMPLE)
1263  {
1264  ErrorMessage(STR_NOMULTISELECT);
1265  bUsed = true;
1266  }
1267  }
1268  if (!bUsed)
1269  bUsed = SfxViewShell::KeyInput( rKEvt ); // accelerators
1270 
1271  // during inplace editing, some slots are handled by the
1272  // container app and are executed during Window::KeyInput.
1273  // -> don't pass keys to input handler that would be used there
1274  // but should call slots instead.
1275  bool bParent = ( GetViewFrame()->GetFrame().IsInPlace() && eFunc != KeyFuncType::DONTKNOW );
1276 
1277  if( !bUsed && !bDraw && nCode != KEY_RETURN && !bParent )
1278  bUsed = pScMod->InputKeyEvent( rKEvt, true ); // input
1279  }
1280 
1281  if (!bInPlace && !bUsed && !bDraw)
1282  {
1283  switch (nCode)
1284  {
1285  case KEY_RETURN:
1286  {
1287  bool bNormal = !bControl && !bAlt;
1288  if ( !bAnyEdit && bNormal )
1289  {
1290  // Depending on options, Enter switches to edit mode.
1291  const ScInputOptions& rOpt = pScMod->GetInputOptions();
1292  if ( rOpt.GetEnterEdit() )
1293  {
1294  pScMod->SetInputMode( SC_INPUT_TABLE );
1295  bUsed = true;
1296  }
1297  }
1298 
1299  bool bEditReturn = bControl && !bShift; // pass on to edit engine
1300  if ( !bUsed && !bEditReturn )
1301  {
1302  if ( bOnRefSheet )
1303  HideAllCursors();
1304 
1306  if ( bShift && bControl )
1307  nMode = ScEnterMode::MATRIX;
1308  else if ( bAlt )
1309  nMode = ScEnterMode::BLOCK;
1310  pScMod->InputEnterHandler(nMode);
1311 
1312  if (nMode == ScEnterMode::NORMAL)
1313  {
1314  if( bShift )
1315  GetViewData().GetDispatcher().Execute( SID_CURSORENTERUP,
1316  SfxCallMode::SLOT | SfxCallMode::RECORD );
1317  else
1318  GetViewData().GetDispatcher().Execute( SID_CURSORENTERDOWN,
1319  SfxCallMode::SLOT | SfxCallMode::RECORD );
1320  }
1321  else
1322  UpdateInputHandler(true);
1323 
1324  if ( bOnRefSheet )
1325  ShowAllCursors();
1326 
1327  // here no UpdateInputHandler, since during reference input on another
1328  // document this ViewShell is not the one that is used for input.
1329 
1330  bUsed = true;
1331  }
1332  }
1333  break;
1334  }
1335  }
1336 
1337  // hard-code Alt-Cursor key, since Alt is not configurable
1338 
1339  if ( !bUsed && bAlt && !bControl )
1340  {
1341  sal_uInt16 nSlotId = 0;
1342  switch (nCode)
1343  {
1344  case KEY_UP:
1345  ModifyCellSize( DIR_TOP, bShift );
1346  bUsed = true;
1347  break;
1348  case KEY_DOWN:
1349  ModifyCellSize( DIR_BOTTOM, bShift );
1350  bUsed = true;
1351  break;
1352  case KEY_LEFT:
1353  ModifyCellSize( DIR_LEFT, bShift );
1354  bUsed = true;
1355  break;
1356  case KEY_RIGHT:
1357  ModifyCellSize( DIR_RIGHT, bShift );
1358  bUsed = true;
1359  break;
1360  case KEY_PAGEUP:
1361  nSlotId = bShift ? SID_CURSORPAGELEFT_SEL : SID_CURSORPAGELEFT_;
1362  break;
1363  case KEY_PAGEDOWN:
1364  nSlotId = bShift ? SID_CURSORPAGERIGHT_SEL : SID_CURSORPAGERIGHT_;
1365  break;
1366  case KEY_EQUAL:
1367  {
1368  // #tdf39302: Use "Alt + =" for autosum
1369  if ( !bAnyEdit ) // Ignore shortcut if currently editing a cell
1370  {
1371  ScInputHandler* pHdl = pScMod->GetInputHdl(this);
1372  if ( pHdl )
1373  {
1374  ScInputWindow* pWin = pHdl->GetInputWindow();
1375  if ( pWin )
1376  {
1377  bool bRangeFinder = false;
1378  bool bSubTotal = false;
1379  pWin->AutoSum( bRangeFinder, bSubTotal, ocSum );
1380  }
1381  }
1382 
1383  bUsed = true;
1384  break;
1385  }
1386  }
1387  }
1388  if ( nSlotId )
1389  {
1390  GetViewData().GetDispatcher().Execute( nSlotId, SfxCallMode::SLOT | SfxCallMode::RECORD );
1391  bUsed = true;
1392  }
1393  }
1394 
1395  // use Ctrl+Alt+Shift+arrow keys to move the cursor in cells
1396  // while keeping the last selection
1397  if ( !bUsed && bAlt && bControl && bShift)
1398  {
1399  sal_uInt16 nSlotId = 0;
1400  switch (nCode)
1401  {
1402  case KEY_UP:
1403  nSlotId = SID_CURSORUP;
1404  break;
1405  case KEY_DOWN:
1406  nSlotId = SID_CURSORDOWN;
1407  break;
1408  case KEY_LEFT:
1409  nSlotId = SID_CURSORLEFT;
1410  break;
1411  case KEY_RIGHT:
1412  nSlotId = SID_CURSORRIGHT;
1413  break;
1414  case KEY_PAGEUP:
1415  nSlotId = SID_CURSORPAGEUP;
1416  break;
1417  case KEY_PAGEDOWN:
1418  nSlotId = SID_CURSORPAGEDOWN;
1419  break;
1420  case KEY_HOME:
1421  nSlotId = SID_CURSORHOME;
1422  break;
1423  case KEY_END:
1424  nSlotId = SID_CURSOREND;
1425  break;
1426  default:
1427  nSlotId = 0;
1428  break;
1429  }
1430  if ( nSlotId )
1431  {
1432  sal_uInt16 nMode = GetLockedModifiers();
1433  LockModifiers(KEY_MOD1);
1434  GetViewData().GetDispatcher().Execute( nSlotId, SfxCallMode::SLOT | SfxCallMode::RECORD );
1435  LockModifiers(nMode);
1436  bUsed = true;
1437  }
1438  }
1439  if (bHideCursor)
1440  ShowAllCursors();
1441 
1442  return bUsed;
1443 }
1444 
1446 {
1447  return SfxViewShell::KeyInput( rKeyEvent );
1448 }
1449 
1450 bool ScTabViewShell::KeyInput( const KeyEvent &rKeyEvent )
1451 {
1452  return TabKeyInput( rKeyEvent );
1453 }
1454 
1455 void ScTabViewShell::Construct( TriState nForceDesignMode )
1456 {
1457  SfxApplication* pSfxApp = SfxGetpApp();
1458  ScDocShell* pDocSh = GetViewData().GetDocShell();
1459  ScDocument& rDoc = pDocSh->GetDocument();
1460  bReadOnly = pDocSh->IsReadOnly();
1461  bIsActive = false;
1462 
1463  EnableAutoSpell(rDoc.GetDocOptions().IsAutoSpell());
1464 
1465  SetName("View"); // for SBX
1466  Color aColBlack( COL_BLACK );
1467  SetPool( &SC_MOD()->GetPool() );
1468  SetWindow( GetActiveWin() );
1469 
1470  pCurFrameLine.reset( new ::editeng::SvxBorderLine(&aColBlack, 20, SvxBorderLineStyle::SOLID) );
1471  StartListening(*GetViewData().GetDocShell(), DuplicateHandling::Prevent);
1472  StartListening(*GetViewFrame(), DuplicateHandling::Prevent);
1473  StartListening(*pSfxApp, DuplicateHandling::Prevent); // #i62045# #i62046# application is needed for Calc's own hints
1474 
1475  SfxViewFrame* pFirst = SfxViewFrame::GetFirst(pDocSh);
1476  bool bFirstView = !pFirst
1477  || (pFirst == GetViewFrame() && !SfxViewFrame::GetNext(*pFirst,pDocSh));
1478 
1479  if ( pDocSh->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
1480  {
1481  //TODO/LATER: is there a difference between the two GetVisArea methods?
1482  tools::Rectangle aVisArea = static_cast<const SfxObjectShell*>(pDocSh)->GetVisArea();
1483 
1484  SCTAB nVisTab = rDoc.GetVisibleTab();
1485  if (!rDoc.HasTable(nVisTab))
1486  {
1487  nVisTab = 0;
1488  rDoc.SetVisibleTab(nVisTab);
1489  }
1490  SetTabNo( nVisTab );
1491  bool bNegativePage = rDoc.IsNegativePage( nVisTab );
1492  // show the right cells
1493  GetViewData().SetScreenPos( bNegativePage ? aVisArea.TopRight() : aVisArea.TopLeft() );
1494 
1495  if ( GetViewFrame()->GetFrame().IsInPlace() ) // inplace
1496  {
1497  pDocSh->SetInplace( true ); // already initiated like this
1498  if (rDoc.IsEmbedded())
1499  rDoc.ResetEmbedded(); // no blue mark
1500  }
1501  else if ( bFirstView )
1502  {
1503  pDocSh->SetInplace( false );
1504  GetViewData().RefreshZoom(); // recalculate PPT
1505  if (!rDoc.IsEmbedded())
1506  rDoc.SetEmbedded( rDoc.GetVisibleTab(), aVisArea ); // mark VisArea
1507  }
1508  }
1509 
1510  // ViewInputHandler
1511  // Each task now has its own InputWindow,
1512  // therefore either should each task get its own InputHandler,
1513  // or the InputWindow should create its own InputHandler
1514  // (then always search via InputWindow and only if not found
1515  // use the InputHandler of the App).
1516  // As an intermediate solution each View gets its own InputHandler,
1517  // which only yields problems if two Views are in one task window.
1518  mpInputHandler.reset(new ScInputHandler);
1519 
1520  // old version:
1521  // if ( !GetViewFrame()->ISA(SfxTopViewFrame) ) // OLE or Plug-In
1522  // pInputHandler = new ScInputHandler;
1523 
1524  // create FormShell before MakeDrawView, so that DrawView can be registered at the
1525  // FormShell in every case
1526  // the FormShell is pushed in the first activate
1527  pFormShell.reset( new FmFormShell(this) );
1528  pFormShell->SetControlActivationHandler( LINK( this, ScTabViewShell, FormControlActivated ) );
1529 
1530  // DrawView must not be created in TabView - ctor,
1531  // if the ViewShell is not yet constructed...
1532  if (rDoc.GetDrawLayer())
1533  MakeDrawView( nForceDesignMode );
1534  ViewOptionsHasChanged(false, false); // possibly also creates DrawView
1535 
1536  SfxUndoManager* pMgr = pDocSh->GetUndoManager();
1537  SetUndoManager( pMgr );
1538  pFormShell->SetUndoManager( pMgr );
1539  if ( !rDoc.IsUndoEnabled() )
1540  {
1541  pMgr->SetMaxUndoActionCount( 0 );
1542  }
1543  SetRepeatTarget( &aTarget );
1544  pFormShell->SetRepeatTarget( &aTarget );
1545 
1546  if ( bFirstView ) // first view?
1547  {
1548  rDoc.SetDocVisible( true ); // used when creating new sheets
1549  if ( pDocSh->IsEmpty() )
1550  {
1551  // set first sheet's RTL flag (following will already be initialized because of SetDocVisible)
1552  rDoc.SetLayoutRTL( 0, ScGlobal::IsSystemRTL() );
1553 
1554  // append additional sheets (not for OLE object)
1555  if ( pDocSh->GetCreateMode() != SfxObjectCreateMode::EMBEDDED )
1556  {
1557  // Get the customized initial tab count
1558  const ScDefaultsOptions& rOpt = SC_MOD()->GetDefaultsOptions();
1559  SCTAB nInitTabCount = rOpt.GetInitTabCount();
1560 
1561  for (SCTAB i=1; i<nInitTabCount; i++)
1562  rDoc.MakeTable(i,false);
1563  }
1564 
1565  pDocSh->SetEmpty( false ); // #i6232# make sure this is done only once
1566  }
1567 
1568  // ReadExtOptions is now in Activate
1569 
1570  // link update no nesting
1571  if ( pDocSh->GetCreateMode() != SfxObjectCreateMode::INTERNAL &&
1572  pDocSh->IsUpdateEnabled() ) // #105575#; update only in the first creation of the ViewShell
1573  {
1574  // Check if there are any external data.
1575  bool bLink = rDoc.GetExternalRefManager()->hasExternalData();
1576  if (!bLink)
1577  {
1578  // #i100042# sheet links can still exist independently from external formula references
1579  SCTAB nTabCount = rDoc.GetTableCount();
1580  for (SCTAB i=0; i<nTabCount && !bLink; i++)
1581  if (rDoc.IsLinked(i))
1582  bLink = true;
1583  }
1584  if (!bLink)
1585  {
1586  const sc::DocumentLinkManager& rMgr = rDoc.GetDocLinkManager();
1588  bLink = true;
1589  }
1590  if (bLink)
1591  {
1592  if ( !pFirst )
1593  pFirst = GetViewFrame();
1594 
1595  if(SC_MOD()->GetCurRefDlgId()==0)
1596  {
1597  pFirst->GetDispatcher()->Execute( SID_UPDATETABLINKS,
1598  SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
1599  }
1600  }
1601  else
1602  {
1603  // No links yet, but loading an existing document may have
1604  // disabled link update but there's no "Allow updating" infobar
1605  // that could enable it again. So in order to enable the user
1606  // to add formulas with external references allow link updates
1607  // again.
1608  pDocSh->AllowLinkUpdate();
1609  }
1610 
1611  bool bReImport = false; // update imported data
1612  ScDBCollection* pDBColl = rDoc.GetDBCollection();
1613  if ( pDBColl )
1614  {
1615  const ScDBCollection::NamedDBs& rDBs = pDBColl->getNamedDBs();
1616  bReImport = std::any_of(rDBs.begin(), rDBs.end(),
1617  [](const std::unique_ptr<ScDBData>& rxDB) { return rxDB->IsStripData() && rxDB->HasImportParam() && !rxDB->HasImportSelection(); });
1618  }
1619  if (bReImport)
1620  {
1621  if ( !pFirst )
1622  pFirst = GetViewFrame();
1623  if(SC_MOD()->GetCurRefDlgId()==0)
1624  {
1625  pFirst->GetDispatcher()->Execute( SID_REIMPORT_AFTER_LOAD,
1626  SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
1627  }
1628  }
1629  }
1630  }
1631 
1632  UpdateAutoFillMark();
1633 
1634  // ScDispatchProviderInterceptor registers itself in ctor
1635  xDisProvInterceptor = new ScDispatchProviderInterceptor( this );
1636 
1637  bFirstActivate = true; // delay NavigatorUpdate until Activate()
1638 
1639  // #105575#; update only in the first creation of the ViewShell
1640  pDocSh->SetUpdateEnabled(false);
1641 
1642  if ( GetViewFrame()->GetFrame().IsInPlace() )
1643  UpdateHeaderWidth(); // The inplace activation requires headers to be calculated
1644 
1645  SvBorder aBorder;
1646  GetBorderSize( aBorder, Size() );
1647  SetBorderPixel( aBorder );
1648 }
1649 
1651  SfxViewShell* pOldSh ) :
1653  ScDBFunc( &pViewFrame->GetWindow(), static_cast<ScDocShell&>(*pViewFrame->GetObjectShell()), this ),
1654  eCurOST(OST_NONE),
1655  nDrawSfxId(0),
1656  aTarget(this),
1657  bActiveDrawSh(false),
1658  bActiveDrawTextSh(false),
1659  bActiveDrawFormSh(false),
1660  bActiveOleObjectSh(false),
1661  bActiveChartSh(false),
1662  bActiveGraphicSh(false),
1663  bActiveMediaSh(false),
1664  bFormShellAtTop(false),
1665  bDontSwitch(false),
1666  bInFormatDialog(false),
1667  bReadOnly(false),
1668  bForceFocusOnCurCell(false),
1669  bInPrepareClose(false),
1670  bInDispose(false),
1671  nCurRefDlgId(0),
1672  mbInSwitch(false)
1673 {
1674  const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions();
1675 
1676  // if switching back from print preview,
1677  // restore the view settings that were active when creating the preview
1678  // ReadUserData must not happen from ctor, because the view's edit window
1679  // has to be shown by the sfx. ReadUserData is deferred until the first Activate call.
1680  // old DesignMode state from form layer must be restored, too
1681 
1682  TriState nForceDesignMode = TRISTATE_INDET;
1683  if ( auto pPreviewShell = dynamic_cast<ScPreviewShell*>( pOldSh) )
1684  {
1685  nForceDesignMode = pPreviewShell->GetSourceDesignMode();
1686  ScPreview* p = pPreviewShell->GetPreview();
1687  if (p)
1689  }
1690 
1691  Construct( nForceDesignMode );
1692 
1693  // make Controller known to SFX
1694  new ScTabViewObj( this );
1695 
1696  // Resolves: tdf#53899 if there is no controller, register the above
1697  // ScTabViewObj as the current controller for the duration of the first
1698  // round of calculations triggered here by SetZoom. That way any StarBasic
1699  // macros triggered while the document is loading have a CurrentController
1700  // available to them.
1701  bool bInstalledScTabViewObjAsTempController = false;
1702  uno::Reference<frame::XController> xCurrentController(GetViewData().GetDocShell()->GetModel()->getCurrentController());
1703  if (!xCurrentController)
1704  {
1705  //GetController here returns the ScTabViewObj above
1706  GetViewData().GetDocShell()->GetModel()->setCurrentController(GetController());
1707  bInstalledScTabViewObjAsTempController = true;
1708  }
1709  xCurrentController.clear();
1710 
1711  if ( GetViewData().GetDocShell()->IsPreview() )
1712  {
1713  // preview for template dialog: always show whole page
1714  SetZoomType( SvxZoomType::WHOLEPAGE, true ); // zoom value is recalculated at next Resize
1715  }
1716  else
1717  {
1718  Fraction aFract( rAppOpt.GetZoom(), 100 );
1719  SetZoom( aFract, aFract, true );
1720  SetZoomType( rAppOpt.GetZoomType(), true );
1721  }
1722 
1724  SvBorder aBorder;
1725  GetBorderSize( aBorder, Size() );
1726  SetBorderPixel( aBorder );
1727 
1728  MakeDrawLayer();
1729 
1730  //put things back as we found them
1731  if (bInstalledScTabViewObjAsTempController)
1732  GetViewData().GetDocShell()->GetModel()->setCurrentController(nullptr);
1733 
1734  // formula mode in online is not usable in collaborative mode,
1735  // this is a workaround for disabling formula mode in online
1736  // when there is more than a single view
1738  return;
1739 
1740  SfxViewShell* pViewShell = SfxViewShell::GetFirst();
1741  // have we already one view ?
1742  if (!pViewShell)
1743  return;
1744 
1745  // this view is not yet visible at this stage, so we look for not visible views, too, for this same document
1746  SfxViewShell* pViewShell2 = pViewShell;
1747  do
1748  {
1749  pViewShell2 = SfxViewShell::GetNext(*pViewShell2, /*only visible shells*/ false);
1750  } while (pViewShell2 && pViewShell2->GetDocId() != pViewShell->GetDocId());
1751  // if the second view is not this one, it means that there is
1752  // already more than one active view and so the formula mode
1753  // has already been disabled
1754  if (pViewShell2 && pViewShell2 == this)
1755  {
1756  ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
1757  assert(pTabViewShell);
1758  ScInputHandler* pInputHdl = pTabViewShell->GetInputHandler();
1759  if (pInputHdl && pInputHdl->IsFormulaMode())
1760  {
1761  pInputHdl->SetMode(SC_INPUT_NONE);
1762  }
1763  }
1764 }
1765 
1767 {
1768  bInDispose = true;
1769 
1770  // Notify other LOK views that we are going away.
1771  SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible", "false");
1772  SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", "");
1773  SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", "EMPTY");
1774  SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", "EMPTY");
1775 
1776  // all to NULL, in case the TabView-dtor tries to access them
1778  if (mpInputHandler)
1779  {
1780  mpInputHandler->SetDocumentDisposing(true);
1781  }
1782 
1783  ScDocShell* pDocSh = GetViewData().GetDocShell();
1784  EndListening(*pDocSh);
1785  EndListening(*GetViewFrame());
1786  EndListening(*SfxGetpApp()); // #i62045# #i62046# needed now - SfxViewShell no longer does it
1787 
1788  SC_MOD()->ViewShellGone(this);
1789 
1790  RemoveSubShell(); // all
1791  SetWindow(nullptr);
1792 
1793  // need kill editview or we will touch the editengine after it has been freed by the ScInputHandler
1794  KillEditView(true);
1795 
1796  pFontworkBarShell.reset();
1797  pExtrusionBarShell.reset();
1798  pCellShell.reset();
1799  pPageBreakShell.reset();
1800  pDrawShell.reset();
1801  pDrawFormShell.reset();
1802  pOleObjectShell.reset();
1803  pChartShell.reset();
1804  pGraphicShell.reset();
1805  pMediaShell.reset();
1806  pDrawTextShell.reset();
1807  pEditShell.reset();
1808  pPivotShell.reset();
1809  pAuditingShell.reset();
1810  pCurFrameLine.reset();
1811  mpFormEditData.reset();
1812  mpInputHandler.reset();
1813  pDialogDPObject.reset();
1814  pNavSettings.reset();
1815 
1816  pFormShell.reset();
1817  pAccessibilityBroadcaster.reset();
1818 }
1819 
1820 void ScTabViewShell::SetDialogDPObject( std::unique_ptr<ScDPObject> pObj )
1821 {
1822  pDialogDPObject = std::move(pObj);
1823 }
1824 
1826 {
1827  ScDocShell* pDocShell = GetViewData().GetDocShell();
1828  ScDocument& rDoc = pDocShell->GetDocument();
1829  SCTAB nTab = GetViewData().GetTabNo();
1830  OUString aTmp;
1831  rDoc.GetName(nTab, aTmp);
1832  rData.aTabName = aTmp;
1833 
1834  if( pDocShell->getDocProperties()->getTitle().getLength() != 0 )
1835  rData.aTitle = pDocShell->getDocProperties()->getTitle();
1836  else
1837  rData.aTitle = pDocShell->GetTitle();
1838 
1839  const INetURLObject& rURLObj = pDocShell->GetMedium()->GetURLObject();
1841  if ( !rData.aLongDocName.isEmpty() )
1843  else
1844  rData.aShortDocName = rData.aLongDocName = rData.aTitle;
1845  rData.nPageNo = 1;
1846  rData.nTotalPages = 99;
1847 
1848  // eNumType is known by the dialog
1849 }
1850 
1852 {
1853  if( !pNavSettings )
1854  pNavSettings.reset(new ScNavigatorSettings);
1855  return pNavSettings.get();
1856 }
1857 
1859 {
1860  return GetViewData().getLOKVisibleArea();
1861 }
1862 
1863 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetChanged(bool bChanged)
If set to true, the data will be copied to the view data after import.
Definition: scextopt.cxx:165
If set, cloned formula cells will start to listen to the document.
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3099
static bool IsSystemRTL()
Definition: global.cxx:845
std::shared_ptr< SfxDialogController > & GetController()
constexpr sal_uInt16 KEYGROUP_MISC
SfxViewFrame * GetViewFrame() const
virtual void OuterResizePixel(const Point &rOfs, const Size &rSize) override
Definition: tabvwsh4.cxx:385
SCTAB GetInitTabCount() const
OUString aLongDocName
Definition: editutil.hxx:208
virtual void ReadUserData(const OUString &, bool bBrowse=false) override
Definition: tabvwsh4.cxx:489
void Appear()
static void notifyOtherViews(const SfxViewShell *pThisView, int nType, std::string_view rKey, const OString &rPayload)
virtual void SetZoomFactor(const Fraction &rZoomX, const Fraction &rZoomY) override
Definition: tabvwsh4.cxx:399
void UpdateDrawShell()
Definition: tabvwsh4.cxx:569
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
Definition: document.hxx:814
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:353
std::unique_ptr< ScInputHandler, o3tl::default_delete< ScInputHandler > > mpInputHandler
Definition: tabvwsh.hxx:115
void RangeSelAborted(const OUString &rText)
Definition: viewuno.cxx:2012
SfxChildWindow * GetChildWindow(sal_uInt16)
ScVSplitPos WhichV(ScSplitPos ePos)
Definition: viewdata.hxx:718
constexpr sal_uInt16 KEY_MOD1
bool IsEditMode()
Definition: scmod.cxx:1341
SC_DLLPUBLIC bool IsNegativePage(SCTAB nTab) const
Definition: document.cxx:993
void UpdateOleZoom()
Definition: tabvwsh4.cxx:322
std::unique_ptr< ScGraphicShell > pGraphicShell
Definition: tabvwsh.hxx:106
OUString GetTitle(sal_uInt16 nMaxLen=0) const
virtual bool PrepareClose(bool bUI=true) override
Definition: tabvwsh4.cxx:281
const tools::Rectangle & getLOKVisibleArea() const
The visible area in the client (set by setClientVisibleArea).
Definition: viewdata.hxx:563
void SetDialogDPObject(std::unique_ptr< ScDPObject > pObj)
Definition: tabvwsh4.cxx:1820
bool IsFormulaMode() const
Definition: inputhdl.hxx:261
bool IsObjectInPlaceActive() const
virtual std::unique_ptr< SfxTabPage > CreatePrintOptionsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rOptions) override
Definition: tabvwsh4.cxx:1059
bool SfxKeyInput(const KeyEvent &rKEvt)
Definition: tabvwsh4.cxx:1445
void SetMediaShell(bool bActive)
Definition: tabvwsh4.cxx:732
bool IsChanged() const
Definition: scextopt.cxx:160
std::unique_ptr< ScDPObject > pDialogDPObject
Definition: tabvwsh.hxx:125
bool IsInputMode() const
Definition: inputhdl.hxx:184
SfxDispatcher * GetDispatcher()
bool AreObjectsMarked() const
SC_DLLPUBLIC void SetLayoutRTL(SCTAB nTab, bool bRTL, ScObjectHandling eObjectHandling=ScObjectHandling::RecalcPosMode)
Definition: document.cxx:949
bool IsUpdateEnabled() const
Definition: docsh.hxx:379
ScHSplitPos WhichH(ScSplitPos ePos)
Definition: viewdata.hxx:712
css::uno::Reference< css::frame::XModel3 > GetModel() const
ViewShellDocId GetDocId() const override
std::unique_ptr< ScMediaShell > pMediaShell
Definition: tabvwsh.hxx:107
virtual void QueryObjAreaPixel(tools::Rectangle &rRect) const override
Definition: tabvwsh4.cxx:427
std::unique_ptr< ScOleObjectShell > pOleObjectShell
Definition: tabvwsh.hxx:104
sal_Int16 nId
void SetPivotShell(bool bActive)
Definition: tabvwsh4.cxx:671
sal_uInt16 GetGroup() const
void SetAuditShell(bool bActive)
Definition: tabvwsh4.cxx:693
sal_uInt16 GetCode() const
SCTAB GetTabNo() const
Definition: viewdata.hxx:394
Contains settings of the navigator listbox.
Definition: navsett.hxx:29
static ScTabViewObj * lcl_GetViewObj(const ScTabViewShell &rShell)
Definition: tabvwsh4.cxx:1092
Extended options held by an ScDocument containing additional settings for filters.
Definition: scextopt.hxx:76
ScSplitPos GetActivePart() const
Definition: viewdata.hxx:397
void GetBorderSize(SvBorder &rBorder, const Size &rSize)
Definition: tabview.cxx:796
IMPL_LINK(ScTabViewShell, SimpleRefDone, const OUString &, aResult, void)
Definition: tabvwsh4.cxx:1106
void DoReadUserDataSequence(const css::uno::Sequence< css::beans::PropertyValue > &rSettings)
Definition: tabvwsh4.cxx:501
ScDocument & GetDocument() const
Definition: viewdata.hxx:379
OUString GetLastName(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
void SetModifiedLink(const Link< ScChangeTrack &, void > &r)
Definition: chgtrack.hxx:1115
KeyFuncType
std::unique_ptr< ScCellShell > pCellShell
Definition: tabvwsh.hxx:103
constexpr sal_uInt16 KEYGROUP_ALPHA
constexpr sal_uInt16 KEY_SPACE
sc::DocumentLinkManager & GetDocLinkManager()
Definition: documen2.cxx:227
bool bReadOnly
bool IsLinked(SCTAB nTab) const
Definition: documen3.cxx:485
SvxZoomType GetZoomType() const
Definition: appoptio.hxx:44
void ViewShellChanged(bool bStopEditing)
Definition: scmod.cxx:1326
virtual bool HasPrintOptionsPage() const override
Definition: tabvwsh4.cxx:1054
void SetDrawTextUndo(SfxUndoManager *pUndoMgr)
Definition: tabvwsh4.cxx:1016
virtual tools::Rectangle getLOKVisibleArea() const override
Definition: tabvwsh4.cxx:1858
css::chart::ChartAxisLabelPosition ePos
SCCOL GetPosX(ScHSplitPos eWhich, SCTAB nForTab=-1) const
Definition: viewdata.cxx:1394
vcl::Window * GetWindow() const
void SetBorderPixel(const SvBorder &rBorder)
std::unique_ptr< FmFormShell > pFormShell
Definition: tabvwsh.hxx:112
virtual void WriteUserData(OUString &, bool bBrowse=false) override
Definition: tabvwsh4.cxx:479
constexpr sal_uInt16 KEY_UP
css::uno::Reference< css::document::XDocumentProperties > getDocProperties() const
SC_DLLPUBLIC void InputEnterHandler(ScEnterMode nBlockMode=ScEnterMode::NORMAL)
Definition: scmod.cxx:1359
ScSplitPos
Definition: viewdata.hxx:44
void SetRefString(const OUString &rStr)
Definition: reffact.cxx:168
SfxApplication * SfxGetpApp()
constexpr sal_uInt16 KEY_END
virtual SfxUndoManager * GetUndoManager() override
Definition: docsh.cxx:2901
bool IsInputMode()
Definition: scmod.cxx:1347
constexpr tools::Long Width() const
void KillEditView(bool bNoPaint)
Definition: tabview3.cxx:2171
Reference< XController > xController
SfxPrinterChangeFlags
std::unique_ptr< ScEditShell > pEditShell
Definition: tabvwsh.hxx:99
void SetLeft(tools::Long v)
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:313
void RangeSelChanged(const OUString &rText)
Definition: viewuno.cxx:2025
IMPL_LINK_NOARG(ScTabViewShell, FormControlActivated, LinkParamNone *, void)
Definition: tabvwsh4.cxx:978
sal_uInt16 GetZoom() const
Definition: appoptio.hxx:42
SfxFrame & GetFrame() const
virtual ~ScTabViewShell() override
Definition: tabvwsh4.cxx:1766
static SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
void SetEmpty(bool bSet)
Definition: docsh2.cxx:89
constexpr sal_uInt16 KEY_PAGEUP
SfxViewShellFlags
ScInputWindow * GetInputWindow()
Definition: inputhdl.hxx:262
SC_DLLPUBLIC ScExternalRefManager * GetExternalRefManager() const
Definition: documen3.cxx:623
bool checkForSelectedFontWork(SdrView const *pSdrView)
void FillFieldData(ScHeaderFieldData &rData)
Definition: tabvwsh4.cxx:1825
SC_DLLPUBLIC bool HasTable(SCTAB nTab) const
Definition: document.cxx:190
void SetUnoLinks(const Link< const OUString &, void > &rDone, const Link< const OUString &, void > &rAbort, const Link< const OUString &, void > &rChange)
Definition: reffact.cxx:186
bool IsDrawTextShell() const
Definition: tabvwsh4.cxx:1006
sal_uInt16 GetModifier() const
OUString aShortDocName
Definition: editutil.hxx:209
static void NotifyContextChange(const css::uno::Reference< css::frame::XController > &rxController, const vcl::EnumContext::Context eContext)
void Construct(TriState nForceDesignMode)
Definition: tabvwsh4.cxx:1455
tools::Long & Bottom()
void SetFlags(bool bCloseOnButtonUp, bool bSingleCell, bool bMultiSelection)
Definition: reffact.cxx:196
std::unique_ptr< ScDrawFormShell > pDrawFormShell
Definition: tabvwsh.hxx:102
SfxObjectCreateMode GetCreateMode() const
bool checkForSelectedCustomShapes(SdrView const *pSdrView, bool bOnlyExtruded)
SCROW GetPosY(ScVSplitPos eWhich, SCTAB nForTab=-1) const
Definition: viewdata.cxx:1408
tools::Long & Top()
sal_uInt16 nCode
TRISTATE_INDET
ScDrawLayer * MakeDrawLayer()
Definition: docsh2.cxx:169
ScViewData & GetViewData()
Definition: tabview.hxx:333
sal_uInt16 GetSlotID() const
Definition: fupoor.hxx:90
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2404
void ResetEmbedded()
Definition: documen3.cxx:1745
void SetFormShellAtTop(bool bSet)
Definition: tabvwsh4.cxx:966
bool InputKeyEvent(const KeyEvent &rKEvt, bool bStartEdit=false)
Definition: scmod.cxx:1353
std::unique_ptr< ScNavigatorSettings > pNavSettings
Definition: tabvwsh.hxx:127
std::unique_ptr< ScDrawTextObjectBar > pDrawTextShell
Definition: tabvwsh.hxx:98
void SetGraphicShell(bool bActive)
Definition: tabvwsh4.cxx:724
SC_DLLPUBLIC const ScDocOptions & GetDocOptions() const
Definition: documen3.cxx:1939
constexpr sal_uInt16 KEY_DOWN
SC_DLLPUBLIC void SetVisibleTab(SCTAB nTab)
Definition: document.hxx:859
void SetZoom(const Fraction &rNewX, const Fraction &rNewY, bool bAll)
Definition: tabview5.cxx:426
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1058
void SetChartShell(bool bActive)
Definition: tabvwsh4.cxx:716
void SetDrawTextShell(bool bActive)
Definition: tabvwsh4.cxx:653
sal_uInt16 GetCurRefDlgId() const
Definition: scmod.hxx:229
tools::Long nTotalPages
Definition: editutil.hxx:213
Point LogicToPixel(const Point &rLogicPt) const
void DoReadUserData(const OUString &rData)
Definition: tabvwsh4.cxx:536
void StopSimpleRefDialog()
Definition: tabvwsh4.cxx:1162
bool IsEmpty() const
void SetWindow(vcl::Window *pViewPort)
void SetRepeatTarget(SfxRepeatTarget *pTarget)
int i
bool GetEnterEdit() const
Definition: inputopt.hxx:51
void AutoSum(bool &bRangeFinder, bool &bSubTotal, OpCode eCode)
Definition: inputwin.cxx:844
void SetInputHandler(ScInputHandler *pNew)
Definition: inputwin.cxx:325
std::unique_ptr< svx::FontworkBar > pFontworkBarShell
Definition: tabvwsh.hxx:110
ScMarkType
States GetSimpleArea() returns for the underlying selection marks, so the caller can react if the res...
Definition: viewdata.hxx:60
sal_Int16 SCCOL
Definition: types.hxx:21
constexpr sal_uInt16 KEY_HOME
static void SetAutoReOpen(bool bFlag)
Definition: reffact.cxx:163
#define SC_MOD()
Definition: scmod.hxx:250
bool HasAreaLinks() const
Definition: documen8.cxx:1034
void SetSize(const Size &rSize)
void EnterHandler(ScEnterMode nBlockMode=ScEnterMode::NORMAL)
Definition: inputhdl.cxx:2935
OUString aTabName
Definition: editutil.hxx:210
std::unique_ptr< ScPivotShell > pPivotShell
Definition: tabvwsh.hxx:100
ScNavigatorSettings * GetNavigatorSettings()
Definition: tabvwsh4.cxx:1851
ScInputHandler * GetInputHandler()
Definition: inputwin.hxx:327
static SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
void SetDrawShell(bool bActive)
Definition: tabvwsh4.cxx:611
bool hasExternalData() const
void SetActive()
Definition: tabvwsh4.cxx:274
void StopEditShell()
Definition: tabvwsh4.cxx:1068
constexpr sal_uInt16 KEY_PAGEDOWN
void AllowLinkUpdate()
Definition: docsh4.cxx:113
const ScMarkData::MarkedTabsType & GetSelectedTabs() const
Definition: preview.hxx:160
virtual void Activate(bool IsMDIActivate) override
virtual void ViewShellChanged()=0
SC_DLLPUBLIC tools::Rectangle GetMMRect(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: documen3.cxx:1988
Point PixelToLogic(const Point &rDevicePt) const
virtual void ReadUserDataSequence(const css::uno::Sequence< css::beans::PropertyValue > &) override
Definition: tabvwsh4.cxx:495
static SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
bool HasLinkFormulaNeedingCheck() const
Definition: document.hxx:2135
Base class for all functions.
Definition: fupoor.hxx:39
KeyFuncType GetFunction() const
void GrabFocus()
virtual void Deactivate(bool IsMDIActivate) override
void RangeSelDone(const OUString &rText)
Definition: viewuno.cxx:1999
bool IsReadOnly() const
constexpr sal_uInt16 KEY_RETURN
constexpr Point TopLeft() const
void SetInputMode(ScInputMode eMode, const OUString *pInitText=nullptr)
Definition: scmod.cxx:1334
void SetUpdateEnabled(bool bValue)
Definition: docsh.hxx:381
constexpr sal_uInt16 KEY_RIGHT
bool IsAuditShell() const
Definition: tabvwsh4.cxx:1011
std::unique_ptr< ScDrawShell > pDrawShell
Definition: tabvwsh.hxx:97
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
tools::Long & Right()
Stores global named database ranges.
Definition: dbdata.hxx:235
void SetDrawFormShell(bool bActive)
Definition: tabvwsh4.cxx:709
void SetEmbedded(const ScRange &rRange)
Definition: documen3.cxx:1739
sal_Int32 SCROW
Definition: types.hxx:17
const vcl::KeyCode & GetKeyCode() const
RET_CLOSE
std::unique_ptr< ScChartShell > pChartShell
Definition: tabvwsh.hxx:105
void MakeDrawLayer()
Definition: tabview2.cxx:1394
constexpr Size GetSize() const
SC_DLLPUBLIC void SetDocVisible(bool bSet)
Definition: documen2.cxx:247
bool HasChildWindow(sal_uInt16)
bool IsShift() const
virtual sal_uInt16 SetPrinter(SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags=SFX_PRINTER_ALL) override
Definition: tabvwsh4.cxx:1049
std::unique_ptr< ScFormEditData > mpFormEditData
Definition: tabvwsh.hxx:114
static ScTabViewShell * GetActiveViewShell()
Definition: tabvwsh4.cxx:1038
void StartSimpleRefDialog(const OUString &rTitle, const OUString &rInitVal, bool bCloseOnButtonUp, bool bSingleCell, bool bMultiSelection)
Definition: tabvwsh4.cxx:1127
SfxShell * GetMySubShell() const
Definition: tabvwsh4.cxx:987
void SetCurSubShell(ObjectSelectionType eOST, bool bForce=false)
Definition: tabvwsh4.cxx:768
void RemoveSubShell(SfxShell *pShell=nullptr)
constexpr tools::Long Height() const
void SetDrawShellOrSub()
Definition: tabvwsh4.cxx:579
constexpr sal_uInt16 KEY_ESCAPE
bool TakesReturn() const
Definition: inputhdl.hxx:242
bool IsVisible() const
virtual void Deactivate(bool bMDI) override
Definition: tabvwsh4.cxx:227
void ResetDelayTimer()
Definition: inputhdl.cxx:4220
css::uno::Reference< css::frame::XController > GetController() const
void SetInplace(bool bInplace)
Definition: docsh3.cxx:345
static SC_DLLPUBLIC ScAbstractDialogFactory * Create()
Definition: scabstdlg.cxx:37
constexpr Point TopRight() const
tools::Long AdjustWidth(tools::Long n)
bool hasDdeOrOleOrWebServiceLinks() const
bool IsMod1() const
bool IsEmbedded() const
Definition: document.hxx:927
void SetOleObjectShell(bool bActive)
Definition: tabvwsh4.cxx:740
SfxViewShell * pScActiveViewShell
Definition: global.cxx:111
void NotifyChange(const ScInputHdlState *pState, bool bForce=false, ScTabViewShell *pSourceSh=nullptr, bool bStopEditing=true)
Definition: inputhdl.cxx:4012
const INetURLObject & GetURLObject() const
virtual CreateTabPage GetTabPageCreatorFunc(sal_uInt16 nId)=0
std::unique_ptr< SfxBroadcaster > pAccessibilityBroadcaster
Definition: tabvwsh.hxx:157
void * p
SC_DLLPUBLIC const ScInputOptions & GetInputOptions()
Definition: scmod.cxx:775
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
const ScDocument & GetDocument() const
Definition: docsh.hxx:216
bool IsAutoSpell() const
Definition: docoptio.hxx:53
bool TabKeyInput(const KeyEvent &rKEvt)
Definition: tabvwsh4.cxx:1175
SdrEndTextEditKind ScEndTextEdit()
Definition: drawview.cxx:894
tools::Long AdjustHeight(tools::Long n)
NamedDBs & getNamedDBs()
Definition: dbdata.hxx:315
constexpr sal_uInt16 KEYGROUP_NUM
Size GetOutputSizePixel() const
void ShowCursor()
Definition: tabview3.cxx:246
tools::Long nPageNo
Definition: editutil.hxx:212
virtual void WriteUserDataSequence(css::uno::Sequence< css::beans::PropertyValue > &) override
Definition: tabvwsh4.cxx:484
std::unique_ptr< svx::ExtrusionBar > pExtrusionBarShell
Definition: tabvwsh.hxx:109
void SetZoomType(SvxZoomType eNew, bool bAll)
Definition: tabview5.cxx:421
ScEnterMode
Definition: global.hxx:228
virtual bool KeyInput(const KeyEvent &rKeyEvent)
constexpr sal_uInt16 KEY_EQUAL
static SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
bool IsEmpty() const
Definition: docsh.hxx:346
bool IsUndoEnabled() const
Definition: document.hxx:1535
ScInputHandler * GetInputHdl(ScTabViewShell *pViewSh=nullptr, bool bUseRef=true)
Input-Handler.
Definition: scmod.cxx:1303
std::unique_ptr<::editeng::SvxBorderLine > pCurFrameLine
Definition: tabvwsh.hxx:117
constexpr sal_uInt16 KEY_LEFT
virtual SfxPrinter * GetPrinter(bool bCreate=false) override
Definition: tabvwsh4.cxx:1043
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
SC_DLLPUBLIC void MakeTable(SCTAB nTab, bool _bNeedsNameCheck=true)
Definition: document.cxx:167
void SetMode(ScInputMode eNewMode, const OUString *pInitText=nullptr, ScEditEngineDefaulter *pTopEngine=nullptr)
Definition: inputhdl.cxx:2826
bool IsRefDialogOpen()
Definition: scmod.cxx:1605
SCTAB GetVisibleTab() const
Definition: document.hxx:858
bool IsPagebreakMode() const
Definition: viewdata.hxx:424
TriState
std::unique_ptr< ScAuditingShell > pAuditingShell
Definition: tabvwsh.hxx:101
tools::Long & Left()
bool HasFocus() const
ObjectSelectionType
Definition: tabvwsh.hxx:73
void SetCloseHdl(const Link< const OUString *, void > &rLink)
Definition: reffact.cxx:177
ScTabViewShell(SfxViewFrame *pViewFrame, SfxViewShell *pOldSh)
-> Clone Method for Factory Created from a general shell and inherit as much as possible ...
Definition: tabvwsh4.cxx:1650
virtual bool KeyInput(const KeyEvent &rKeyEvent) override
Definition: tabvwsh4.cxx:1450
const ScInputHandler * GetInputHandler() const
Definition: tabvwsh.hxx:231
virtual void Move() override
Definition: tabvwsh4.cxx:456
void SnapVisArea(tools::Rectangle &rRect) const
Definition: docsh4.cxx:2299
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
Definition: document.cxx:212
void SetMaxUndoActionCount(size_t nMaxUndoActionCount)
void SetEditShell(EditView *pView, bool bActive)
Definition: tabvwsh4.cxx:750
tools::Long Right() const
std::unique_ptr< ScPageBreakShell > pPageBreakShell
Definition: tabvwsh.hxx:108
virtual bool PrepareClose(bool bUI=true)
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:22
virtual void SetZoomFactor(const Fraction &rZoomX, const Fraction &rZoomY)
constexpr sal_uInt16 KEY_TAB
void SetSelectedTabs(const MarkedTabsType &rTabs)
Definition: markdata.cxx:218
virtual void Activate(bool bMDI) override
Definition: tabvwsh4.cxx:104
css::uno::Reference< css::frame::XController > GetController() const
void SetRefScale(const Fraction &rX, const Fraction &rY)
Definition: inputhdl.cxx:829
void KeyInput()
Definition: documen8.cxx:1180
bool IsMod2() const
ocSum
SfxMedium * GetMedium() const
virtual void InnerResizePixel(const Point &rOfs, const Size &rSize, bool inplaceEditModeChange) override
Definition: tabvwsh4.cxx:339