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& rDoc = GetViewData().GetDocument();
217 
218  ScChangeTrack* pChanges = rDoc.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& rDoc = 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 = rDoc.IsNegativePage( nTab );
427 
428  tools::Rectangle aLogicRect = rDoc.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  return;
663 
664  if ( bActive )
665  {
666  bActiveDrawTextSh = bActiveDrawSh = false;
667  bActiveDrawFormSh=false;
668  bActiveGraphicSh=false;
669  bActiveMediaSh=false;
670  bActiveOleObjectSh=false;
671  bActiveChartSh=false;
672  SetCurSubShell(OST_Pivot);
673  }
674  else
675  SetCurSubShell(OST_Cell);
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  return;
776 
777  bool bCellBrush = false; // "format paint brush" allowed for cells
778  bool bDrawBrush = false; // "format paint brush" allowed for drawing objects
779 
780  if(eCurOST!=OST_NONE) RemoveSubShell();
781 
782  if (pFormShell && !bFormShellAtTop)
783  AddSubShell(*pFormShell); // add below own subshells
784 
785  switch(eOST)
786  {
787  case OST_Cell:
788  {
789  AddSubShell(*pCellShell);
790  if(bPgBrk) AddSubShell(*pPageBreakShell);
791  bCellBrush = true;
792  }
793  break;
794  case OST_Editing:
795  {
796  AddSubShell(*pCellShell);
797  if(bPgBrk) AddSubShell(*pPageBreakShell);
798 
799  if(pEditShell)
800  {
801  AddSubShell(*pEditShell);
802  }
803  }
804  break;
805  case OST_DrawText:
806  {
807  if ( !pDrawTextShell )
808  {
809  pDocSh->MakeDrawLayer();
810  pDrawTextShell.reset( new ScDrawTextObjectBar(GetViewData()) );
811  }
812  AddSubShell(*pDrawTextShell);
813  }
814  break;
815  case OST_Drawing:
816  {
818  GetScDrawView(), true /* bOnlyExtruded */ )) {
819  if (pExtrusionBarShell == nullptr)
820  pExtrusionBarShell.reset( new svx::ExtrusionBar(this) );
821  AddSubShell( *pExtrusionBarShell );
822  }
823  sal_uInt32 nCheckStatus = 0;
825  GetScDrawView(), nCheckStatus )) {
826  if (pFontworkBarShell == nullptr)
827  pFontworkBarShell.reset( new svx::FontworkBar(this) );
828  AddSubShell( *pFontworkBarShell );
829  }
830 
831  if ( !pDrawShell )
832  {
833  pDocSh->MakeDrawLayer();
834  pDrawShell.reset(new ScDrawShell(GetViewData()));
835  pDrawShell->SetRepeatTarget( &aTarget );
836  }
837  AddSubShell(*pDrawShell);
838  bDrawBrush = true;
839  }
840  break;
841 
842  case OST_DrawForm:
843  {
844  if ( !pDrawFormShell )
845  {
846  pDocSh->MakeDrawLayer();
847  pDrawFormShell.reset( new ScDrawFormShell(GetViewData()) );
848  pDrawFormShell->SetRepeatTarget( &aTarget );
849  }
850  AddSubShell(*pDrawFormShell);
851  bDrawBrush = true;
852  }
853  break;
854 
855  case OST_Chart:
856  {
857  if ( !pChartShell )
858  {
859  pDocSh->MakeDrawLayer();
860  pChartShell.reset( new ScChartShell(GetViewData()) );
861  pChartShell->SetRepeatTarget( &aTarget );
862  }
863  AddSubShell(*pChartShell);
864  bDrawBrush = true;
865  }
866  break;
867 
868  case OST_OleObject:
869  {
870  if ( !pOleObjectShell )
871  {
872  pDocSh->MakeDrawLayer();
873  pOleObjectShell.reset( new ScOleObjectShell(GetViewData()) );
874  pOleObjectShell->SetRepeatTarget( &aTarget );
875  }
876  AddSubShell(*pOleObjectShell);
877  bDrawBrush = true;
878  }
879  break;
880 
881  case OST_Graphic:
882  {
883  if ( !pGraphicShell)
884  {
885  pDocSh->MakeDrawLayer();
886  pGraphicShell.reset( new ScGraphicShell(GetViewData()) );
887  pGraphicShell->SetRepeatTarget( &aTarget );
888  }
889  AddSubShell(*pGraphicShell);
890  bDrawBrush = true;
891  }
892  break;
893 
894  case OST_Media:
895  {
896  if ( !pMediaShell)
897  {
898  pDocSh->MakeDrawLayer();
899  pMediaShell.reset( new ScMediaShell(GetViewData()) );
900  pMediaShell->SetRepeatTarget( &aTarget );
901  }
902  AddSubShell(*pMediaShell);
903  }
904  break;
905 
906  case OST_Pivot:
907  {
908  AddSubShell(*pCellShell);
909  if(bPgBrk) AddSubShell(*pPageBreakShell);
910 
911  if ( !pPivotShell )
912  {
913  pPivotShell.reset( new ScPivotShell( this ) );
914  pPivotShell->SetRepeatTarget( &aTarget );
915  }
916  AddSubShell(*pPivotShell);
917  bCellBrush = true;
918  }
919  break;
920  case OST_Auditing:
921  {
922  AddSubShell(*pCellShell);
923  if(bPgBrk) AddSubShell(*pPageBreakShell);
924 
925  if ( !pAuditingShell )
926  {
927  pDocSh->MakeDrawLayer(); // the waiting time rather now as on the click
928 
929  pAuditingShell.reset( new ScAuditingShell(GetViewData()) );
930  pAuditingShell->SetRepeatTarget( &aTarget );
931  }
932  AddSubShell(*pAuditingShell);
933  bCellBrush = true;
934  }
935  break;
936  default:
937  OSL_FAIL("wrong shell requested");
938  break;
939  }
940 
941  if (pFormShell && bFormShellAtTop)
942  AddSubShell(*pFormShell); // add on top of own subshells
943 
944  eCurOST=eOST;
945 
946  // abort "format paint brush" when switching to an incompatible shell
947  if ( ( GetBrushDocument() && !bCellBrush ) || ( GetDrawBrushSet() && !bDrawBrush ) )
948  ResetBrushDocument();
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  return;
1134 
1135  pWnd->SetCloseHdl( LINK( this, ScTabViewShell, SimpleRefClose ) );
1136  pWnd->SetUnoLinks( LINK( this, ScTabViewShell, SimpleRefDone ),
1137  LINK( this, ScTabViewShell, SimpleRefAborted ),
1138  LINK( this, ScTabViewShell, SimpleRefChange ) );
1139  pWnd->SetRefString( rInitVal );
1140  pWnd->SetFlags( bCloseOnButtonUp, bSingleCell, bMultiSelection );
1142  if (auto xWin = pWnd->GetController())
1143  xWin->set_title(rTitle);
1144  pWnd->StartRefInput();
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& rDoc = GetViewData().GetDocument();
1188  rDoc.KeyInput(); // TimerDelays etc.
1189 
1190  if( bInPlace )
1191  {
1192  bUsed = pScMod->InputKeyEvent( rKEvt ); // input
1193  if( !bUsed )
1194  bUsed = SfxViewShell::KeyInput( rKEvt ); // accelerators
1195  }
1196  else if( bAnyEdit )
1197  {
1198  bool bIsType = false;
1199  sal_uInt16 nModi = aCode.GetModifier();
1200  sal_uInt16 nGroup = aCode.GetGroup();
1201 
1202  if ( nGroup == KEYGROUP_NUM || nGroup == KEYGROUP_ALPHA || nGroup == 0 )
1203  if ( !bControl && !bAlt )
1204  bIsType = true;
1205 
1206  if ( nGroup == KEYGROUP_MISC )
1207  switch ( nCode )
1208  {
1209  case KEY_RETURN:
1210  bIsType = bControl && !bAlt; // Control, Shift-Control-Return
1211  if ( !bIsType && nModi == 0 )
1212  {
1213  // Does the Input Handler also want a simple Return?
1214 
1215  ScInputHandler* pHdl = pScMod->GetInputHdl(this);
1216  bIsType = pHdl && pHdl->TakesReturn();
1217  }
1218  break;
1219  case KEY_SPACE:
1220  bIsType = !bControl && !bAlt; // without modifier or Shift-Space
1221  break;
1222  case KEY_ESCAPE:
1223  bIsType = (nModi == 0); // only without modifier
1224  break;
1225  default:
1226  bIsType = true;
1227  }
1228 
1229  if( bIsType )
1230  bUsed = pScMod->InputKeyEvent( rKEvt ); // input
1231 
1232  if( !bUsed )
1233  bUsed = SfxViewShell::KeyInput( rKEvt ); // accelerators
1234 
1235  if ( !bUsed && !bIsType && nCode != KEY_RETURN ) // input once again afterwards
1236  bUsed = pScMod->InputKeyEvent( rKEvt );
1237  }
1238  else
1239  {
1240  // special case: copy/cut for multiselect -> error message
1241  // (Slot is disabled, so SfxViewShell::KeyInput would be swallowed without a comment)
1242  KeyFuncType eFunc = aCode.GetFunction();
1243  if ( eFunc == KeyFuncType::CUT )
1244  {
1245  ScRange aDummy;
1246  ScMarkType eMarkType = GetViewData().GetSimpleArea( aDummy );
1247  if (eMarkType != SC_MARK_SIMPLE)
1248  {
1249  ErrorMessage(STR_NOMULTISELECT);
1250  bUsed = true;
1251  }
1252  }
1253  if (!bUsed)
1254  bUsed = SfxViewShell::KeyInput( rKEvt ); // accelerators
1255 
1256  // during inplace editing, some slots are handled by the
1257  // container app and are executed during Window::KeyInput.
1258  // -> don't pass keys to input handler that would be used there
1259  // but should call slots instead.
1260  bool bParent = ( GetViewFrame()->GetFrame().IsInPlace() && eFunc != KeyFuncType::DONTKNOW );
1261 
1262  if( !bUsed && !bDraw && nCode != KEY_RETURN && !bParent )
1263  bUsed = pScMod->InputKeyEvent( rKEvt, true ); // input
1264  }
1265 
1266  if (!bInPlace && !bUsed && !bDraw)
1267  {
1268  switch (nCode)
1269  {
1270  case KEY_RETURN:
1271  {
1272  bool bNormal = !bControl && !bAlt;
1273  if ( !bAnyEdit && bNormal )
1274  {
1275  // Depending on options, Enter switches to edit mode.
1276  const ScInputOptions& rOpt = pScMod->GetInputOptions();
1277  if ( rOpt.GetEnterEdit() )
1278  {
1279  pScMod->SetInputMode( SC_INPUT_TABLE );
1280  bUsed = true;
1281  }
1282  }
1283 
1284  bool bEditReturn = bControl && !bShift; // pass on to edit engine
1285  if ( !bUsed && !bEditReturn )
1286  {
1287  if ( bOnRefSheet )
1288  HideAllCursors();
1289 
1291  if ( bShift && bControl )
1292  nMode = ScEnterMode::MATRIX;
1293  else if ( bAlt )
1294  nMode = ScEnterMode::BLOCK;
1295  pScMod->InputEnterHandler(nMode);
1296 
1297  if (nMode == ScEnterMode::NORMAL)
1298  {
1299  if( bShift )
1300  GetViewData().GetDispatcher().Execute( SID_CURSORENTERUP,
1301  SfxCallMode::SLOT | SfxCallMode::RECORD );
1302  else
1303  GetViewData().GetDispatcher().Execute( SID_CURSORENTERDOWN,
1304  SfxCallMode::SLOT | SfxCallMode::RECORD );
1305  }
1306  else
1307  UpdateInputHandler(true);
1308 
1309  if ( bOnRefSheet )
1310  ShowAllCursors();
1311 
1312  // here no UpdateInputHandler, since during reference input on another
1313  // document this ViewShell is not the one that is used for input.
1314 
1315  bUsed = true;
1316  }
1317  }
1318  break;
1319  }
1320  }
1321 
1322  // hard-code Alt-Cursor key, since Alt is not configurable
1323 
1324  if ( !bUsed && bAlt && !bControl )
1325  {
1326  sal_uInt16 nSlotId = 0;
1327  switch (nCode)
1328  {
1329  case KEY_UP:
1330  ModifyCellSize( DIR_TOP, bShift );
1331  bUsed = true;
1332  break;
1333  case KEY_DOWN:
1334  ModifyCellSize( DIR_BOTTOM, bShift );
1335  bUsed = true;
1336  break;
1337  case KEY_LEFT:
1338  ModifyCellSize( DIR_LEFT, bShift );
1339  bUsed = true;
1340  break;
1341  case KEY_RIGHT:
1342  ModifyCellSize( DIR_RIGHT, bShift );
1343  bUsed = true;
1344  break;
1345  case KEY_PAGEUP:
1346  nSlotId = bShift ? SID_CURSORPAGELEFT_SEL : SID_CURSORPAGELEFT_;
1347  break;
1348  case KEY_PAGEDOWN:
1349  nSlotId = bShift ? SID_CURSORPAGERIGHT_SEL : SID_CURSORPAGERIGHT_;
1350  break;
1351  case KEY_EQUAL:
1352  {
1353  // #tdf39302: Use "Alt + =" for autosum
1354  if ( !bAnyEdit ) // Ignore shortcut if currently editing a cell
1355  {
1356  ScInputHandler* pHdl = pScMod->GetInputHdl(this);
1357  if ( pHdl )
1358  {
1359  ScInputWindow* pWin = pHdl->GetInputWindow();
1360  if ( pWin )
1361  {
1362  bool bRangeFinder = false;
1363  bool bSubTotal = false;
1364  pWin->AutoSum( bRangeFinder, bSubTotal, ocSum );
1365  }
1366  }
1367 
1368  bUsed = true;
1369  break;
1370  }
1371  }
1372  }
1373  if ( nSlotId )
1374  {
1375  GetViewData().GetDispatcher().Execute( nSlotId, SfxCallMode::SLOT | SfxCallMode::RECORD );
1376  bUsed = true;
1377  }
1378  }
1379 
1380  // use Ctrl+Alt+Shift+arrow keys to move the cursor in cells
1381  // while keeping the last selection
1382  if ( !bUsed && bAlt && bControl && bShift)
1383  {
1384  sal_uInt16 nSlotId = 0;
1385  switch (nCode)
1386  {
1387  case KEY_UP:
1388  nSlotId = SID_CURSORUP;
1389  break;
1390  case KEY_DOWN:
1391  nSlotId = SID_CURSORDOWN;
1392  break;
1393  case KEY_LEFT:
1394  nSlotId = SID_CURSORLEFT;
1395  break;
1396  case KEY_RIGHT:
1397  nSlotId = SID_CURSORRIGHT;
1398  break;
1399  case KEY_PAGEUP:
1400  nSlotId = SID_CURSORPAGEUP;
1401  break;
1402  case KEY_PAGEDOWN:
1403  nSlotId = SID_CURSORPAGEDOWN;
1404  break;
1405  case KEY_HOME:
1406  nSlotId = SID_CURSORHOME;
1407  break;
1408  case KEY_END:
1409  nSlotId = SID_CURSOREND;
1410  break;
1411  default:
1412  nSlotId = 0;
1413  break;
1414  }
1415  if ( nSlotId )
1416  {
1417  sal_uInt16 nMode = GetLockedModifiers();
1418  LockModifiers(KEY_MOD1);
1419  GetViewData().GetDispatcher().Execute( nSlotId, SfxCallMode::SLOT | SfxCallMode::RECORD );
1420  LockModifiers(nMode);
1421  bUsed = true;
1422  }
1423  }
1424  if (bHideCursor)
1425  ShowAllCursors();
1426 
1427  return bUsed;
1428 }
1429 
1431 {
1432  return SfxViewShell::KeyInput( rKeyEvent );
1433 }
1434 
1435 bool ScTabViewShell::KeyInput( const KeyEvent &rKeyEvent )
1436 {
1437  return TabKeyInput( rKeyEvent );
1438 }
1439 
1440 void ScTabViewShell::Construct( TriState nForceDesignMode )
1441 {
1442  SfxApplication* pSfxApp = SfxGetpApp();
1443  ScDocShell* pDocSh = GetViewData().GetDocShell();
1444  ScDocument& rDoc = pDocSh->GetDocument();
1445  bReadOnly = pDocSh->IsReadOnly();
1446  bIsActive = false;
1447 
1448  EnableAutoSpell(rDoc.GetDocOptions().IsAutoSpell());
1449 
1450  SetName("View"); // for SBX
1451  Color aColBlack( COL_BLACK );
1452  SetPool( &SC_MOD()->GetPool() );
1453  SetWindow( GetActiveWin() );
1454 
1455  pCurFrameLine.reset( new ::editeng::SvxBorderLine(&aColBlack, 20, SvxBorderLineStyle::SOLID) );
1456  StartListening(*GetViewData().GetDocShell(), DuplicateHandling::Prevent);
1457  StartListening(*GetViewFrame(), DuplicateHandling::Prevent);
1458  StartListening(*pSfxApp, DuplicateHandling::Prevent); // #i62045# #i62046# application is needed for Calc's own hints
1459 
1460  SfxViewFrame* pFirst = SfxViewFrame::GetFirst(pDocSh);
1461  bool bFirstView = !pFirst
1462  || (pFirst == GetViewFrame() && !SfxViewFrame::GetNext(*pFirst,pDocSh));
1463 
1464  if ( pDocSh->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
1465  {
1466  //TODO/LATER: is there a difference between the two GetVisArea methods?
1467  tools::Rectangle aVisArea = static_cast<const SfxObjectShell*>(pDocSh)->GetVisArea();
1468 
1469  SCTAB nVisTab = rDoc.GetVisibleTab();
1470  if (!rDoc.HasTable(nVisTab))
1471  {
1472  nVisTab = 0;
1473  rDoc.SetVisibleTab(nVisTab);
1474  }
1475  SetTabNo( nVisTab );
1476  bool bNegativePage = rDoc.IsNegativePage( nVisTab );
1477  // show the right cells
1478  GetViewData().SetScreenPos( bNegativePage ? aVisArea.TopRight() : aVisArea.TopLeft() );
1479 
1480  if ( GetViewFrame()->GetFrame().IsInPlace() ) // inplace
1481  {
1482  pDocSh->SetInplace( true ); // already initiated like this
1483  if (rDoc.IsEmbedded())
1484  rDoc.ResetEmbedded(); // no blue mark
1485  }
1486  else if ( bFirstView )
1487  {
1488  pDocSh->SetInplace( false );
1489  GetViewData().RefreshZoom(); // recalculate PPT
1490  if (!rDoc.IsEmbedded())
1491  rDoc.SetEmbedded( rDoc.GetVisibleTab(), aVisArea ); // mark VisArea
1492  }
1493  }
1494 
1495  // ViewInputHandler
1496  // Each task now has its own InputWindow,
1497  // therefore either should each task get its own InputHandler,
1498  // or the InputWindow should create its own InputHandler
1499  // (then always search via InputWindow and only if not found
1500  // use the InputHandler of the App).
1501  // As an intermediate solution each View gets its own InputHandler,
1502  // which only yields problems if two Views are in one task window.
1503  mpInputHandler.reset(new ScInputHandler);
1504 
1505  // old version:
1506  // if ( !GetViewFrame()->ISA(SfxTopViewFrame) ) // OLE or Plug-In
1507  // pInputHandler = new ScInputHandler;
1508 
1509  // create FormShell before MakeDrawView, so that DrawView can be registered at the
1510  // FormShell in every case
1511  // the FormShell is pushed in the first activate
1512  pFormShell.reset( new FmFormShell(this) );
1513  pFormShell->SetControlActivationHandler( LINK( this, ScTabViewShell, FormControlActivated ) );
1514 
1515  // DrawView must not be created in TabView - ctor,
1516  // if the ViewShell is not yet constructed...
1517  if (rDoc.GetDrawLayer())
1518  MakeDrawView( nForceDesignMode );
1519  ViewOptionsHasChanged(false, false); // possibly also creates DrawView
1520 
1521  SfxUndoManager* pMgr = pDocSh->GetUndoManager();
1522  SetUndoManager( pMgr );
1523  pFormShell->SetUndoManager( pMgr );
1524  if ( !rDoc.IsUndoEnabled() )
1525  {
1526  pMgr->SetMaxUndoActionCount( 0 );
1527  }
1528  SetRepeatTarget( &aTarget );
1529  pFormShell->SetRepeatTarget( &aTarget );
1530 
1531  if ( bFirstView ) // first view?
1532  {
1533  rDoc.SetDocVisible( true ); // used when creating new sheets
1534  if ( pDocSh->IsEmpty() )
1535  {
1536  // set first sheet's RTL flag (following will already be initialized because of SetDocVisible)
1537  rDoc.SetLayoutRTL( 0, ScGlobal::IsSystemRTL() );
1538 
1539  // append additional sheets (not for OLE object)
1540  if ( pDocSh->GetCreateMode() != SfxObjectCreateMode::EMBEDDED )
1541  {
1542  // Get the customized initial tab count
1543  const ScDefaultsOptions& rOpt = SC_MOD()->GetDefaultsOptions();
1544  SCTAB nInitTabCount = rOpt.GetInitTabCount();
1545 
1546  for (SCTAB i=1; i<nInitTabCount; i++)
1547  rDoc.MakeTable(i,false);
1548  }
1549 
1550  pDocSh->SetEmpty( false ); // #i6232# make sure this is done only once
1551  }
1552 
1553  // ReadExtOptions is now in Activate
1554 
1555  // link update no nesting
1556  if ( pDocSh->GetCreateMode() != SfxObjectCreateMode::INTERNAL &&
1557  pDocSh->IsUpdateEnabled() ) // #105575#; update only in the first creation of the ViewShell
1558  {
1559  // Check if there are any external data.
1560  bool bLink = rDoc.GetExternalRefManager()->hasExternalData();
1561  if (!bLink)
1562  {
1563  // #i100042# sheet links can still exist independently from external formula references
1564  SCTAB nTabCount = rDoc.GetTableCount();
1565  for (SCTAB i=0; i<nTabCount && !bLink; i++)
1566  if (rDoc.IsLinked(i))
1567  bLink = true;
1568  }
1569  if (!bLink)
1570  {
1571  const sc::DocumentLinkManager& rMgr = rDoc.GetDocLinkManager();
1573  bLink = true;
1574  }
1575  if (bLink)
1576  {
1577  if ( !pFirst )
1578  pFirst = GetViewFrame();
1579 
1580  if(SC_MOD()->GetCurRefDlgId()==0)
1581  {
1582  pFirst->GetDispatcher()->Execute( SID_UPDATETABLINKS,
1583  SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
1584  }
1585  }
1586 
1587  bool bReImport = false; // update imported data
1588  ScDBCollection* pDBColl = rDoc.GetDBCollection();
1589  if ( pDBColl )
1590  {
1591  const ScDBCollection::NamedDBs& rDBs = pDBColl->getNamedDBs();
1592  bReImport = std::any_of(rDBs.begin(), rDBs.end(),
1593  [](const std::unique_ptr<ScDBData>& rxDB) { return rxDB->IsStripData() && rxDB->HasImportParam() && !rxDB->HasImportSelection(); });
1594  }
1595  if (bReImport)
1596  {
1597  if ( !pFirst )
1598  pFirst = GetViewFrame();
1599  if(SC_MOD()->GetCurRefDlgId()==0)
1600  {
1601  pFirst->GetDispatcher()->Execute( SID_REIMPORT_AFTER_LOAD,
1602  SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
1603  }
1604  }
1605  }
1606  }
1607 
1608  UpdateAutoFillMark();
1609 
1610  // ScDispatchProviderInterceptor registers itself in ctor
1611  xDisProvInterceptor = new ScDispatchProviderInterceptor( this );
1612 
1613  bFirstActivate = true; // delay NavigatorUpdate until Activate()
1614 
1615  // #105575#; update only in the first creation of the ViewShell
1616  pDocSh->SetUpdateEnabled(false);
1617 
1618  if ( GetViewFrame()->GetFrame().IsInPlace() )
1619  UpdateHeaderWidth(); // The inplace activation requires headers to be calculated
1620 
1621  SvBorder aBorder;
1622  GetBorderSize( aBorder, Size() );
1623  SetBorderPixel( aBorder );
1624 }
1625 
1627  SfxViewShell* pOldSh ) :
1629  ScDBFunc( &pViewFrame->GetWindow(), static_cast<ScDocShell&>(*pViewFrame->GetObjectShell()), this ),
1630  eCurOST(OST_NONE),
1631  nDrawSfxId(0),
1632  aTarget(this),
1633  bActiveDrawSh(false),
1634  bActiveDrawTextSh(false),
1635  bActiveDrawFormSh(false),
1636  bActiveOleObjectSh(false),
1637  bActiveChartSh(false),
1638  bActiveGraphicSh(false),
1639  bActiveMediaSh(false),
1640  bFormShellAtTop(false),
1641  bDontSwitch(false),
1642  bInFormatDialog(false),
1643  bReadOnly(false),
1644  bForceFocusOnCurCell(false),
1645  bInPrepareClose(false),
1646  bInDispose(false),
1647  nCurRefDlgId(0),
1648  mbInSwitch(false)
1649 {
1650  const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions();
1651 
1652  // if switching back from print preview,
1653  // restore the view settings that were active when creating the preview
1654  // ReadUserData must not happen from ctor, because the view's edit window
1655  // has to be shown by the sfx. ReadUserData is deferred until the first Activate call.
1656  // old DesignMode state from form layer must be restored, too
1657 
1658  TriState nForceDesignMode = TRISTATE_INDET;
1659  if ( auto pPreviewShell = dynamic_cast<ScPreviewShell*>( pOldSh) )
1660  {
1661  nForceDesignMode = pPreviewShell->GetSourceDesignMode();
1662  ScPreview* p = pPreviewShell->GetPreview();
1663  if (p)
1665  }
1666 
1667  Construct( nForceDesignMode );
1668 
1669  // make Controller known to SFX
1670  new ScTabViewObj( this );
1671 
1672  // Resolves: tdf#53899 if there is no controller, register the above
1673  // ScTabViewObj as the current controller for the duration of the first
1674  // round of calculations triggered here by SetZoom. That way any StarBasic
1675  // macros triggered while the document is loading have a CurrentController
1676  // available to them.
1677  bool bInstalledScTabViewObjAsTempController = false;
1678  uno::Reference<frame::XController> xCurrentController(GetViewData().GetDocShell()->GetModel()->getCurrentController());
1679  if (!xCurrentController)
1680  {
1681  //GetController here returns the ScTabViewObj above
1682  GetViewData().GetDocShell()->GetModel()->setCurrentController(GetController());
1683  bInstalledScTabViewObjAsTempController = true;
1684  }
1685  xCurrentController.clear();
1686 
1687  if ( GetViewData().GetDocShell()->IsPreview() )
1688  {
1689  // preview for template dialog: always show whole page
1690  SetZoomType( SvxZoomType::WHOLEPAGE, true ); // zoom value is recalculated at next Resize
1691  }
1692  else
1693  {
1694  Fraction aFract( rAppOpt.GetZoom(), 100 );
1695  SetZoom( aFract, aFract, true );
1696  SetZoomType( rAppOpt.GetZoomType(), true );
1697  }
1698 
1700  SvBorder aBorder;
1701  GetBorderSize( aBorder, Size() );
1702  SetBorderPixel( aBorder );
1703 
1704  MakeDrawLayer();
1705 
1706  //put things back as we found them
1707  if (bInstalledScTabViewObjAsTempController)
1708  GetViewData().GetDocShell()->GetModel()->setCurrentController(nullptr);
1709 
1710  // formula mode in online is not usable in collaborative mode,
1711  // this is a workaround for disabling formula mode in online
1712  // when there is more than a single view
1714  return;
1715 
1716  SfxViewShell* pViewShell = SfxViewShell::GetFirst();
1717  // have we already one view ?
1718  if (!pViewShell)
1719  return;
1720 
1721  // this view is not yet visible at this stage, so we look for not visible views, too, for this same document
1722  SfxViewShell* pViewShell2 = pViewShell;
1723  do
1724  {
1725  pViewShell2 = SfxViewShell::GetNext(*pViewShell2, /*only visible shells*/ false);
1726  } while (pViewShell2 && pViewShell2->GetDocId() != pViewShell->GetDocId());
1727  // if the second view is not this one, it means that there is
1728  // already more than one active view and so the formula mode
1729  // has already been disabled
1730  if (pViewShell2 && pViewShell2 == this)
1731  {
1732  ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
1733  assert(pTabViewShell);
1734  ScInputHandler* pInputHdl = pTabViewShell->GetInputHandler();
1735  if (pInputHdl && pInputHdl->IsFormulaMode())
1736  {
1737  pInputHdl->SetMode(SC_INPUT_NONE);
1738  }
1739  }
1740 }
1741 
1743 {
1744  bInDispose = true;
1745 
1746  // Notify other LOK views that we are going away.
1747  SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible", "false");
1748  SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", "");
1749  SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", "EMPTY");
1750  SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", "EMPTY");
1751 
1752  // all to NULL, in case the TabView-dtor tries to access them
1754  if (mpInputHandler)
1755  {
1756  mpInputHandler->SetDocumentDisposing(true);
1757  }
1758 
1759  ScDocShell* pDocSh = GetViewData().GetDocShell();
1760  EndListening(*pDocSh);
1761  EndListening(*GetViewFrame());
1762  EndListening(*SfxGetpApp()); // #i62045# #i62046# needed now - SfxViewShell no longer does it
1763 
1764  SC_MOD()->ViewShellGone(this);
1765 
1766  RemoveSubShell(); // all
1767  SetWindow(nullptr);
1768 
1769  // need kill editview or we will touch the editengine after it has been freed by the ScInputHandler
1770  KillEditView(true);
1771 
1772  pFontworkBarShell.reset();
1773  pExtrusionBarShell.reset();
1774  pCellShell.reset();
1775  pPageBreakShell.reset();
1776  pDrawShell.reset();
1777  pDrawFormShell.reset();
1778  pOleObjectShell.reset();
1779  pChartShell.reset();
1780  pGraphicShell.reset();
1781  pMediaShell.reset();
1782  pDrawTextShell.reset();
1783  pEditShell.reset();
1784  pPivotShell.reset();
1785  pAuditingShell.reset();
1786  pCurFrameLine.reset();
1787  mpFormEditData.reset();
1788  mpInputHandler.reset();
1789  pDialogDPObject.reset();
1790  pNavSettings.reset();
1791 
1792  pFormShell.reset();
1793  pAccessibilityBroadcaster.reset();
1794 }
1795 
1796 void ScTabViewShell::SetDialogDPObject( std::unique_ptr<ScDPObject> pObj )
1797 {
1798  pDialogDPObject = std::move(pObj);
1799 }
1800 
1802 {
1803  ScDocShell* pDocShell = GetViewData().GetDocShell();
1804  ScDocument& rDoc = pDocShell->GetDocument();
1805  SCTAB nTab = GetViewData().GetTabNo();
1806  OUString aTmp;
1807  rDoc.GetName(nTab, aTmp);
1808  rData.aTabName = aTmp;
1809 
1810  if( pDocShell->getDocProperties()->getTitle().getLength() != 0 )
1811  rData.aTitle = pDocShell->getDocProperties()->getTitle();
1812  else
1813  rData.aTitle = pDocShell->GetTitle();
1814 
1815  const INetURLObject& rURLObj = pDocShell->GetMedium()->GetURLObject();
1817  if ( !rData.aLongDocName.isEmpty() )
1819  else
1820  rData.aShortDocName = rData.aLongDocName = rData.aTitle;
1821  rData.nPageNo = 1;
1822  rData.nTotalPages = 99;
1823 
1824  // eNumType is known by the dialog
1825 }
1826 
1828 {
1829  if( !pNavSettings )
1830  pNavSettings.reset(new ScNavigatorSettings);
1831  return pNavSettings.get();
1832 }
1833 
1834 /* 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:845
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
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
void RangeSelAborted(const OUString &rText)
Definition: viewuno.cxx:2014
SfxChildWindow * GetChildWindow(sal_uInt16)
ScVSplitPos WhichV(ScSplitPos ePos)
Definition: viewdata.hxx:710
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
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:1796
bool IsFormulaMode() const
Definition: inputhdl.hxx:258
bool IsObjectInPlaceActive() 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:1430
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:704
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
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:105
constexpr sal_uInt16 KEYGROUP_ALPHA
constexpr sal_uInt16 KEY_SPACE
sc::DocumentLinkManager & GetDocLinkManager()
Definition: documen2.cxx:225
static void notifyOtherViews(SfxViewShell *pThisView, int nType, const OString &rKey, const OString &rPayload)
bool bReadOnly
bool IsLinked(SCTAB nTab) const
Definition: documen3.cxx:480
SvxZoomType GetZoomType() const
Definition: appoptio.hxx:45
void ViewShellChanged(bool bStopEditing)
Definition: scmod.cxx:1326
virtual bool HasPrintOptionsPage() const override
Definition: tabvwsh4.cxx:1039
void SetDrawTextUndo(SfxUndoManager *pUndoMgr)
Definition: tabvwsh4.cxx:1001
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: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:2164
Reference< XController > xController
SfxPrinterChangeFlags
std::unique_ptr< ScEditShell > pEditShell
Definition: tabvwsh.hxx:101
void SetLeft(tools::Long v)
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:314
void RangeSelChanged(const OUString &rText)
Definition: viewuno.cxx:2027
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:1742
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:259
SC_DLLPUBLIC ScExternalRefManager * GetExternalRefManager() const
Definition: documen3.cxx:618
void FillFieldData(ScHeaderFieldData &rData)
Definition: tabvwsh4.cxx:1801
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:1440
tools::Long & Bottom()
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:1355
tools::Long & Top()
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:1729
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:1923
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:413
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
tools::Long nTotalPages
Definition: editutil.hxx:212
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:818
void SetInputHandler(ScInputHandler *pNew)
Definition: inputwin.cxx:318
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:2907
OUString aTabName
Definition: editutil.hxx:209
std::unique_ptr< ScPivotShell > pPivotShell
Definition: tabvwsh.hxx:102
ScNavigatorSettings * GetNavigatorSettings()
Definition: tabvwsh4.cxx:1827
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: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:1972
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:2001
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
tools::Long & Right()
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:1723
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
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:4142
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
tools::Long AdjustWidth(tools::Long n)
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:111
void NotifyChange(const ScInputHdlState *pState, bool bForce=false, ScTabViewShell *pSourceSh=nullptr, bool bStopEditing=true)
Definition: inputhdl.cxx:3942
tools::Long Height() const
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 ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
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
tools::Long AdjustHeight(tools::Long n)
NamedDBs & getNamedDBs()
Definition: dbdata.hxx:315
constexpr sal_uInt16 KEYGROUP_NUM
void ShowCursor()
Definition: tabview3.cxx:241
tools::Long nPageNo
Definition: editutil.hxx:211
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:408
ScEnterMode
Definition: global.hxx:230
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: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:2798
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
tools::Long & Left()
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:1626
virtual bool KeyInput(const KeyEvent &rKeyEvent) override
Definition: tabvwsh4.cxx:1435
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:2281
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
tools::Long Right() const
std::unique_ptr< ScPageBreakShell > pPageBreakShell
Definition: tabvwsh.hxx:110
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