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