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