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