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