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* 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
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 ( pThisFrame->HasChildWindow(FID_CHG_ACCEPT) )
194 {
195 SfxChildWindow* pChild = pThisFrame->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 = pThisFrame->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* pViewFrame = rShell.GetViewFrame();
1134 if (pViewFrame)
1135 {
1136 SfxFrame& rFrame = pViewFrame->GetFrame();
1137 uno::Reference<frame::XController> xController = rFrame.GetController();
1138 if (xController.is())
1139 pRet = comphelper::getFromUnoTunnel<ScTabViewObj>( xController );
1140 }
1141 return pRet;
1142}
1143
1144IMPL_LINK( ScTabViewShell, SimpleRefDone, const OUString&, aResult, void )
1145{
1146 ScTabViewObj* pImpObj = lcl_GetViewObj( *this );
1147 if ( pImpObj )
1148 pImpObj->RangeSelDone( aResult );
1149}
1150
1151IMPL_LINK( ScTabViewShell, SimpleRefAborted, const OUString&, rResult, void )
1152{
1153 ScTabViewObj* pImpObj = lcl_GetViewObj( *this );
1154 if ( pImpObj )
1155 pImpObj->RangeSelAborted( rResult );
1156}
1157
1158IMPL_LINK( ScTabViewShell, SimpleRefChange, const OUString&, rResult, void )
1159{
1160 ScTabViewObj* pImpObj = lcl_GetViewObj( *this );
1161 if ( pImpObj )
1162 pImpObj->RangeSelChanged( rResult );
1163}
1164
1166 const OUString& rTitle, const OUString& rInitVal,
1167 bool bCloseOnButtonUp, bool bSingleCell, bool bMultiSelection )
1168{
1169 SfxViewFrame* pViewFrm = GetViewFrame();
1170
1171 if ( GetActiveViewShell() != this )
1172 {
1173 // #i18833# / #i34499# The API method can be called for a view that's not active.
1174 // Then the view has to be activated first, the same way as in Execute for SID_CURRENTDOC.
1175 // Can't use GrabFocus here, because it needs to take effect immediately.
1176
1177 pViewFrm->GetFrame().Appear();
1178 }
1179
1180 sal_uInt16 nId = ScSimpleRefDlgWrapper::GetChildWindowId();
1181
1182 SC_MOD()->SetRefDialog( nId, true, pViewFrm );
1183
1184 ScSimpleRefDlgWrapper* pWnd = static_cast<ScSimpleRefDlgWrapper*>(pViewFrm->GetChildWindow( nId ));
1185 if (!pWnd)
1186 return;
1187
1188 pWnd->SetCloseHdl( LINK( this, ScTabViewShell, SimpleRefClose ) );
1189 pWnd->SetUnoLinks( LINK( this, ScTabViewShell, SimpleRefDone ),
1190 LINK( this, ScTabViewShell, SimpleRefAborted ),
1191 LINK( this, ScTabViewShell, SimpleRefChange ) );
1192 pWnd->SetRefString( rInitVal );
1193 pWnd->SetFlags( bCloseOnButtonUp, bSingleCell, bMultiSelection );
1195 if (auto xWin = pWnd->GetController())
1196 xWin->set_title(rTitle);
1197 pWnd->StartRefInput();
1198}
1199
1201{
1202 SfxViewFrame* pViewFrm = GetViewFrame();
1203 sal_uInt16 nId = ScSimpleRefDlgWrapper::GetChildWindowId();
1204
1205 ScSimpleRefDlgWrapper* pWnd = static_cast<ScSimpleRefDlgWrapper*>(pViewFrm->GetChildWindow( nId ));
1206 if (pWnd)
1207 {
1208 if (auto pWin = pWnd->GetController())
1209 pWin->response(RET_CLOSE);
1210 }
1211}
1212
1214{
1215 ScModule* pScMod = SC_MOD();
1216
1217 SfxViewFrame* pThisFrame = GetViewFrame();
1218 if ( pThisFrame->GetChildWindow( SID_OPENDLG_FUNCTION ) )
1219 return false;
1220
1221 vcl::KeyCode aCode = rKEvt.GetKeyCode();
1222 bool bShift = aCode.IsShift();
1223 bool bControl = aCode.IsMod1();
1224 bool bAlt = aCode.IsMod2();
1225 sal_uInt16 nCode = aCode.GetCode();
1226 bool bUsed = false;
1227 bool bInPlace = pScMod->IsEditMode(); // Editengine gets all
1228 bool bAnyEdit = pScMod->IsInputMode(); // only characters & backspace
1229 bool bDraw = IsDrawTextEdit();
1230
1231 HideNoteMarker(); // note marker
1232
1233 // don't do extra HideCursor/ShowCursor calls if EnterHandler will switch to a different sheet
1234 bool bOnRefSheet = ( GetViewData().GetRefTabNo() == GetViewData().GetTabNo() );
1235 bool bHideCursor = ( ( nCode == KEY_RETURN && bInPlace ) || nCode == KEY_TAB ) && bOnRefSheet;
1236
1237 if (bHideCursor)
1239
1241 rDoc.KeyInput(); // TimerDelays etc.
1242
1243 if( bInPlace )
1244 {
1245 bUsed = pScMod->InputKeyEvent( rKEvt ); // input
1246 if( !bUsed )
1247 bUsed = SfxViewShell::KeyInput( rKEvt ); // accelerators
1248 }
1249 else if( bAnyEdit )
1250 {
1251 bool bIsType = false;
1252 sal_uInt16 nModi = aCode.GetModifier();
1253 sal_uInt16 nGroup = aCode.GetGroup();
1254
1255 if ( nGroup == KEYGROUP_NUM || nGroup == KEYGROUP_ALPHA || nGroup == 0 )
1256 if ( !bControl && !bAlt )
1257 bIsType = true;
1258
1259 if ( nGroup == KEYGROUP_MISC )
1260 switch ( nCode )
1261 {
1262 case KEY_RETURN:
1263 bIsType = bControl && !bAlt; // Control, Shift-Control-Return
1264 if ( !bIsType && nModi == 0 )
1265 {
1266 // Does the Input Handler also want a simple Return?
1267
1268 ScInputHandler* pHdl = pScMod->GetInputHdl(this);
1269 bIsType = pHdl && pHdl->TakesReturn();
1270 }
1271 break;
1272 case KEY_SPACE:
1273 bIsType = !bControl && !bAlt; // without modifier or Shift-Space
1274 break;
1275 case KEY_ESCAPE:
1276 bIsType = (nModi == 0); // only without modifier
1277 break;
1278 default:
1279 bIsType = true;
1280 }
1281 else if (nCode == KEY_RIGHT && !bControl && !bShift && !bAlt)
1282 {
1283 ScInputHandler* pHdl = pScMod->GetInputHdl(this);
1284 bIsType = pHdl && pHdl->HasPartialComplete();
1285 }
1286
1287 if( bIsType )
1288 bUsed = pScMod->InputKeyEvent( rKEvt ); // input
1289
1290 if( !bUsed )
1291 bUsed = SfxViewShell::KeyInput( rKEvt ); // accelerators
1292
1293 if ( !bUsed && !bIsType && nCode != KEY_RETURN ) // input once again afterwards
1294 bUsed = pScMod->InputKeyEvent( rKEvt );
1295 }
1296 else
1297 {
1298 // special case: copy/cut for multiselect -> error message
1299 // (Slot is disabled, so SfxViewShell::KeyInput would be swallowed without a comment)
1300 KeyFuncType eFunc = aCode.GetFunction();
1301 if ( eFunc == KeyFuncType::CUT )
1302 {
1303 ScRange aDummy;
1304 ScMarkType eMarkType = GetViewData().GetSimpleArea( aDummy );
1305 if (eMarkType != SC_MARK_SIMPLE)
1306 {
1307 ErrorMessage(STR_NOMULTISELECT);
1308 bUsed = true;
1309 }
1310 }
1311 if (!bUsed)
1312 bUsed = SfxViewShell::KeyInput( rKEvt ); // accelerators
1313
1314 // during inplace editing, some slots are handled by the
1315 // container app and are executed during Window::KeyInput.
1316 // -> don't pass keys to input handler that would be used there
1317 // but should call slots instead.
1318 bool bParent = ( GetViewFrame()->GetFrame().IsInPlace() && eFunc != KeyFuncType::DONTKNOW );
1319
1320 if( !bUsed && !bDraw && nCode != KEY_RETURN && !bParent )
1321 bUsed = pScMod->InputKeyEvent( rKEvt, true ); // input
1322 }
1323
1324 if (!bInPlace && !bUsed && !bDraw)
1325 {
1326 switch (nCode)
1327 {
1328 case KEY_RETURN:
1329 {
1330 bool bNormal = !bControl && !bAlt;
1331 if ( !bAnyEdit && bNormal )
1332 {
1333 // Depending on options, Enter switches to edit mode.
1334 const ScInputOptions& rOpt = pScMod->GetInputOptions();
1335 if ( rOpt.GetEnterEdit() )
1336 {
1337 pScMod->SetInputMode( SC_INPUT_TABLE );
1338 bUsed = true;
1339 }
1340 }
1341
1342 bool bEditReturn = bControl && !bShift; // pass on to edit engine
1343 if ( !bUsed && !bEditReturn )
1344 {
1345 if ( bOnRefSheet )
1347
1349 if ( bShift && bControl )
1350 nMode = ScEnterMode::MATRIX;
1351 else if ( bAlt )
1352 nMode = ScEnterMode::BLOCK;
1353 pScMod->InputEnterHandler(nMode);
1354
1355 if (nMode == ScEnterMode::NORMAL)
1356 {
1357 if( bShift )
1358 GetViewData().GetDispatcher().Execute( SID_CURSORENTERUP,
1359 SfxCallMode::SLOT | SfxCallMode::RECORD );
1360 else
1361 GetViewData().GetDispatcher().Execute( SID_CURSORENTERDOWN,
1362 SfxCallMode::SLOT | SfxCallMode::RECORD );
1363 }
1364 else
1365 UpdateInputHandler(true);
1366
1367 if ( bOnRefSheet )
1369
1370 // here no UpdateInputHandler, since during reference input on another
1371 // document this ViewShell is not the one that is used for input.
1372
1373 bUsed = true;
1374 }
1375 }
1376 break;
1377 }
1378 }
1379
1380 // hard-code Alt-Cursor key, since Alt is not configurable
1381
1382 if ( !bUsed && bAlt && !bControl )
1383 {
1384 sal_uInt16 nSlotId = 0;
1385 switch (nCode)
1386 {
1387 case KEY_UP:
1388 ModifyCellSize( DIR_TOP, bShift );
1389 bUsed = true;
1390 break;
1391 case KEY_DOWN:
1392 ModifyCellSize( DIR_BOTTOM, bShift );
1393 bUsed = true;
1394 break;
1395 case KEY_LEFT:
1396 ModifyCellSize( DIR_LEFT, bShift );
1397 bUsed = true;
1398 break;
1399 case KEY_RIGHT:
1400 ModifyCellSize( DIR_RIGHT, bShift );
1401 bUsed = true;
1402 break;
1403 case KEY_PAGEUP:
1404 nSlotId = bShift ? SID_CURSORPAGELEFT_SEL : SID_CURSORPAGELEFT_;
1405 break;
1406 case KEY_PAGEDOWN:
1407 nSlotId = bShift ? SID_CURSORPAGERIGHT_SEL : SID_CURSORPAGERIGHT_;
1408 break;
1409 case KEY_EQUAL:
1410 {
1411 // #tdf39302: Use "Alt + =" for autosum
1412 if ( !bAnyEdit ) // Ignore shortcut if currently editing a cell
1413 {
1414 ScInputHandler* pHdl = pScMod->GetInputHdl(this);
1415 if ( pHdl )
1416 {
1417 ScInputWindow* pWin = pHdl->GetInputWindow();
1418 if ( pWin )
1419 {
1420 bool bRangeFinder = false;
1421 bool bSubTotal = false;
1422 pWin->AutoSum( bRangeFinder, bSubTotal, ocSum );
1423 }
1424 }
1425
1426 bUsed = true;
1427 break;
1428 }
1429 }
1430 }
1431 if ( nSlotId )
1432 {
1433 GetViewData().GetDispatcher().Execute( nSlotId, SfxCallMode::SLOT | SfxCallMode::RECORD );
1434 bUsed = true;
1435 }
1436 }
1437
1438 // use Ctrl+Alt+Shift+arrow keys to move the cursor in cells
1439 // while keeping the last selection
1440 if ( !bUsed && bAlt && bControl && bShift)
1441 {
1442 sal_uInt16 nSlotId = 0;
1443 switch (nCode)
1444 {
1445 case KEY_UP:
1446 nSlotId = SID_CURSORUP;
1447 break;
1448 case KEY_DOWN:
1449 nSlotId = SID_CURSORDOWN;
1450 break;
1451 case KEY_LEFT:
1452 nSlotId = SID_CURSORLEFT;
1453 break;
1454 case KEY_RIGHT:
1455 nSlotId = SID_CURSORRIGHT;
1456 break;
1457 case KEY_PAGEUP:
1458 nSlotId = SID_CURSORPAGEUP;
1459 break;
1460 case KEY_PAGEDOWN:
1461 nSlotId = SID_CURSORPAGEDOWN;
1462 break;
1463 case KEY_HOME:
1464 nSlotId = SID_CURSORHOME;
1465 break;
1466 case KEY_END:
1467 nSlotId = SID_CURSOREND;
1468 break;
1469 default:
1470 nSlotId = 0;
1471 break;
1472 }
1473 if ( nSlotId )
1474 {
1475 sal_uInt16 nMode = GetLockedModifiers();
1477 GetViewData().GetDispatcher().Execute( nSlotId, SfxCallMode::SLOT | SfxCallMode::RECORD );
1478 LockModifiers(nMode);
1479 bUsed = true;
1480 }
1481 }
1482 if (bHideCursor)
1484
1485 return bUsed;
1486}
1487
1489{
1490 return SfxViewShell::KeyInput( rKeyEvent );
1491}
1492
1493bool ScTabViewShell::KeyInput( const KeyEvent &rKeyEvent )
1494{
1495 return TabKeyInput( rKeyEvent );
1496}
1497
1498void ScTabViewShell::Construct( TriState nForceDesignMode )
1499{
1500 SfxApplication* pSfxApp = SfxGetpApp();
1501 ScDocShell* pDocSh = GetViewData().GetDocShell();
1502 ScDocument& rDoc = pDocSh->GetDocument();
1503 bReadOnly = pDocSh->IsReadOnly();
1504 bIsActive = false;
1505
1507
1508 SetName("View"); // for SBX
1509 Color aColBlack( COL_BLACK );
1510 SetPool( &SC_MOD()->GetPool() );
1512
1513 pCurFrameLine.reset( new ::editeng::SvxBorderLine(&aColBlack, 20, SvxBorderLineStyle::SOLID) );
1514 StartListening(*GetViewData().GetDocShell(), DuplicateHandling::Prevent);
1515 StartListening(*GetViewFrame(), DuplicateHandling::Prevent);
1516 StartListening(*pSfxApp, DuplicateHandling::Prevent); // #i62045# #i62046# application is needed for Calc's own hints
1517
1518 SfxViewFrame* pFirst = SfxViewFrame::GetFirst(pDocSh);
1519 bool bFirstView = !pFirst
1520 || (pFirst == GetViewFrame() && !SfxViewFrame::GetNext(*pFirst,pDocSh));
1521
1522 if ( pDocSh->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
1523 {
1524 //TODO/LATER: is there a difference between the two GetVisArea methods?
1525 tools::Rectangle aVisArea = static_cast<const SfxObjectShell*>(pDocSh)->GetVisArea();
1526
1527 SCTAB nVisTab = rDoc.GetVisibleTab();
1528 if (!rDoc.HasTable(nVisTab))
1529 {
1530 nVisTab = 0;
1531 rDoc.SetVisibleTab(nVisTab);
1532 }
1533 SetTabNo( nVisTab );
1534 bool bNegativePage = rDoc.IsNegativePage( nVisTab );
1535 // show the right cells
1536 GetViewData().SetScreenPos( bNegativePage ? aVisArea.TopRight() : aVisArea.TopLeft() );
1537
1538 if ( GetViewFrame()->GetFrame().IsInPlace() ) // inplace
1539 {
1540 pDocSh->SetInplace( true ); // already initiated like this
1541 if (rDoc.IsEmbedded())
1542 rDoc.ResetEmbedded(); // no blue mark
1543 }
1544 else if ( bFirstView )
1545 {
1546 pDocSh->SetInplace( false );
1547 GetViewData().RefreshZoom(); // recalculate PPT
1548 if (!rDoc.IsEmbedded())
1549 rDoc.SetEmbedded( rDoc.GetVisibleTab(), aVisArea ); // mark VisArea
1550 }
1551 }
1552
1553 // ViewInputHandler
1554 // Each task now has its own InputWindow,
1555 // therefore either should each task get its own InputHandler,
1556 // or the InputWindow should create its own InputHandler
1557 // (then always search via InputWindow and only if not found
1558 // use the InputHandler of the App).
1559 // As an intermediate solution each View gets its own InputHandler,
1560 // which only yields problems if two Views are in one task window.
1561 mpInputHandler.reset(new ScInputHandler);
1562
1563 // old version:
1564 // if ( !GetViewFrame()->ISA(SfxTopViewFrame) ) // OLE or Plug-In
1565 // pInputHandler = new ScInputHandler;
1566
1567 // create FormShell before MakeDrawView, so that DrawView can be registered at the
1568 // FormShell in every case
1569 // the FormShell is pushed in the first activate
1570 pFormShell.reset( new FmFormShell(this) );
1571 pFormShell->SetControlActivationHandler( LINK( this, ScTabViewShell, FormControlActivated ) );
1572
1573 // DrawView must not be created in TabView - ctor,
1574 // if the ViewShell is not yet constructed...
1575 if (rDoc.GetDrawLayer())
1576 MakeDrawView( nForceDesignMode );
1577 ViewOptionsHasChanged(false, false); // possibly also creates DrawView
1578
1579 SfxUndoManager* pMgr = pDocSh->GetUndoManager();
1580 SetUndoManager( pMgr );
1581 pFormShell->SetUndoManager( pMgr );
1582 if ( !rDoc.IsUndoEnabled() )
1583 {
1584 pMgr->SetMaxUndoActionCount( 0 );
1585 }
1587 pFormShell->SetRepeatTarget( &aTarget );
1588
1589 if ( bFirstView ) // first view?
1590 {
1591 rDoc.SetDocVisible( true ); // used when creating new sheets
1592 if ( pDocSh->IsEmpty() )
1593 {
1594 // set first sheet's RTL flag (following will already be initialized because of SetDocVisible)
1596
1597 // append additional sheets (not for OLE object)
1598 if ( pDocSh->GetCreateMode() != SfxObjectCreateMode::EMBEDDED )
1599 {
1600 // Get the customized initial tab count
1601 const ScDefaultsOptions& rOpt = SC_MOD()->GetDefaultsOptions();
1602 SCTAB nInitTabCount = rOpt.GetInitTabCount();
1603
1604 for (SCTAB i=1; i<nInitTabCount; i++)
1605 rDoc.MakeTable(i,false);
1606 }
1607
1608 pDocSh->SetEmpty( false ); // #i6232# make sure this is done only once
1609 }
1610
1611 // ReadExtOptions is now in Activate
1612
1613 // link update no nesting
1614 if ( pDocSh->GetCreateMode() != SfxObjectCreateMode::INTERNAL &&
1615 pDocSh->IsUpdateEnabled() ) // #105575#; update only in the first creation of the ViewShell
1616 {
1617 // Check if there are any external data.
1618 bool bLink = rDoc.GetExternalRefManager()->hasExternalData();
1619 if (!bLink)
1620 {
1621 // #i100042# sheet links can still exist independently from external formula references
1622 SCTAB nTabCount = rDoc.GetTableCount();
1623 for (SCTAB i=0; i<nTabCount && !bLink; i++)
1624 if (rDoc.IsLinked(i))
1625 bLink = true;
1626 }
1627 if (!bLink)
1628 {
1629 const sc::DocumentLinkManager& rMgr = rDoc.GetDocLinkManager();
1631 bLink = true;
1632 }
1633 if (bLink)
1634 {
1635 if ( !pFirst )
1636 pFirst = GetViewFrame();
1637
1638 if(SC_MOD()->GetCurRefDlgId()==0)
1639 {
1640 pFirst->GetDispatcher()->Execute( SID_UPDATETABLINKS,
1641 SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
1642 }
1643 }
1644 else
1645 {
1646 // No links yet, but loading an existing document may have
1647 // disabled link update but there's no "Allow updating" infobar
1648 // that could enable it again. So in order to enable the user
1649 // to add formulas with external references allow link updates
1650 // again.
1651 pDocSh->AllowLinkUpdate();
1652 }
1653
1654 bool bReImport = false; // update imported data
1655 ScDBCollection* pDBColl = rDoc.GetDBCollection();
1656 if ( pDBColl )
1657 {
1658 const ScDBCollection::NamedDBs& rDBs = pDBColl->getNamedDBs();
1659 bReImport = std::any_of(rDBs.begin(), rDBs.end(),
1660 [](const std::unique_ptr<ScDBData>& rxDB) { return rxDB->IsStripData() && rxDB->HasImportParam() && !rxDB->HasImportSelection(); });
1661 }
1662 if (bReImport)
1663 {
1664 if ( !pFirst )
1665 pFirst = GetViewFrame();
1666 if(SC_MOD()->GetCurRefDlgId()==0)
1667 {
1668 pFirst->GetDispatcher()->Execute( SID_REIMPORT_AFTER_LOAD,
1669 SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
1670 }
1671 }
1672 }
1673 }
1674
1676
1677 // ScDispatchProviderInterceptor registers itself in ctor
1679
1680 bFirstActivate = true; // delay NavigatorUpdate until Activate()
1681
1682 // #105575#; update only in the first creation of the ViewShell
1683 pDocSh->SetUpdateEnabled(false);
1684
1685 if ( GetViewFrame()->GetFrame().IsInPlace() )
1686 UpdateHeaderWidth(); // The inplace activation requires headers to be calculated
1687
1688 SvBorder aBorder;
1689 GetBorderSize( aBorder, Size() );
1690 SetBorderPixel( aBorder );
1691}
1692
1694 SfxViewShell* pOldSh ) :
1696 ScDBFunc( &pViewFrame->GetWindow(), static_cast<ScDocShell&>(*pViewFrame->GetObjectShell()), this ),
1697 eCurOST(OST_NONE),
1698 nDrawSfxId(0),
1699 aTarget(this),
1700 bActiveDrawSh(false),
1701 bActiveDrawTextSh(false),
1702 bActiveDrawFormSh(false),
1703 bActiveOleObjectSh(false),
1704 bActiveChartSh(false),
1705 bActiveGraphicSh(false),
1706 bActiveMediaSh(false),
1707 bFormShellAtTop(false),
1708 bDontSwitch(false),
1709 bInFormatDialog(false),
1710 bReadOnly(false),
1711 bForceFocusOnCurCell(false),
1712 bInPrepareClose(false),
1713 bInDispose(false),
1714 nCurRefDlgId(0),
1715 mbInSwitch(false),
1716 m_pDragData(new ScDragData)
1717{
1718 const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions();
1719
1720 // if switching back from print preview,
1721 // restore the view settings that were active when creating the preview
1722 // ReadUserData must not happen from ctor, because the view's edit window
1723 // has to be shown by the sfx. ReadUserData is deferred until the first Activate call.
1724 // old DesignMode state from form layer must be restored, too
1725
1726 TriState nForceDesignMode = TRISTATE_INDET;
1727 if ( auto pPreviewShell = dynamic_cast<ScPreviewShell*>( pOldSh) )
1728 {
1729 nForceDesignMode = pPreviewShell->GetSourceDesignMode();
1730 ScPreview* p = pPreviewShell->GetPreview();
1731 if (p)
1732 GetViewData().GetMarkData().SetSelectedTabs(p->GetSelectedTabs());
1733 }
1734
1735 Construct( nForceDesignMode );
1736
1737 // make Controller known to SFX
1738 new ScTabViewObj( this );
1739
1740 // Resolves: tdf#53899 if there is no controller, register the above
1741 // ScTabViewObj as the current controller for the duration of the first
1742 // round of calculations triggered here by SetZoom. That way any StarBasic
1743 // macros triggered while the document is loading have a CurrentController
1744 // available to them.
1745 bool bInstalledScTabViewObjAsTempController = false;
1746 uno::Reference<frame::XController> xCurrentController(GetViewData().GetDocShell()->GetModel()->getCurrentController());
1747 if (!xCurrentController)
1748 {
1749 //GetController here returns the ScTabViewObj above
1750 GetViewData().GetDocShell()->GetModel()->setCurrentController(GetController());
1751 bInstalledScTabViewObjAsTempController = true;
1752 }
1753 xCurrentController.clear();
1754
1755 if ( GetViewData().GetDocShell()->IsPreview() )
1756 {
1757 // preview for template dialog: always show whole page
1758 SetZoomType( SvxZoomType::WHOLEPAGE, true ); // zoom value is recalculated at next Resize
1759 }
1760 else
1761 {
1762 Fraction aFract( rAppOpt.GetZoom(), 100 );
1763 SetZoom( aFract, aFract, true );
1764 SetZoomType( rAppOpt.GetZoomType(), true );
1765 }
1766
1768 SvBorder aBorder;
1769 GetBorderSize( aBorder, Size() );
1770 SetBorderPixel( aBorder );
1771
1772 MakeDrawLayer();
1773
1774 //put things back as we found them
1775 if (bInstalledScTabViewObjAsTempController)
1776 GetViewData().GetDocShell()->GetModel()->setCurrentController(nullptr);
1777
1778 // formula mode in online is not usable in collaborative mode,
1779 // this is a workaround for disabling formula mode in online
1780 // when there is more than a single view
1782 return;
1783
1784 SfxViewShell* pViewShell = SfxViewShell::GetFirst();
1785 // have we already one view ?
1786 if (!pViewShell)
1787 return;
1788
1789 // this view is not yet visible at this stage, so we look for not visible views, too, for this same document
1790 SfxViewShell* pViewShell2 = pViewShell;
1791 do
1792 {
1793 pViewShell2 = SfxViewShell::GetNext(*pViewShell2, /*only visible shells*/ false);
1794 } while (pViewShell2 && pViewShell2->GetDocId() != pViewShell->GetDocId());
1795 // if the second view is not this one, it means that there is
1796 // already more than one active view and so the formula mode
1797 // has already been disabled
1798 if (pViewShell2 && pViewShell2 == this)
1799 {
1800 ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
1801 assert(pTabViewShell);
1802 ScInputHandler* pInputHdl = pTabViewShell->GetInputHandler();
1803 if (pInputHdl && pInputHdl->IsFormulaMode())
1804 {
1805 pInputHdl->SetMode(SC_INPUT_NONE);
1806 }
1807 }
1808}
1809
1811{
1812 bInDispose = true;
1813
1814 // Notify other LOK views that we are going away.
1815 SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible", "false");
1816 SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", "");
1817 SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", "EMPTY");
1818 SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", "EMPTY");
1819
1820 // all to NULL, in case the TabView-dtor tries to access them
1822 if (mpInputHandler)
1823 {
1824 mpInputHandler->SetDocumentDisposing(true);
1825 }
1826
1827 ScDocShell* pDocSh = GetViewData().GetDocShell();
1828 EndListening(*pDocSh);
1829 EndListening(*GetViewFrame());
1830 EndListening(*SfxGetpApp()); // #i62045# #i62046# needed now - SfxViewShell no longer does it
1831
1832 SC_MOD()->ViewShellGone(this);
1833
1834 RemoveSubShell(); // all
1835 SetWindow(nullptr);
1836
1837 // need kill editview or we will touch the editengine after it has been freed by the ScInputHandler
1838 KillEditView(true);
1839
1840 pFontworkBarShell.reset();
1841 pExtrusionBarShell.reset();
1842 pCellShell.reset();
1843 pPageBreakShell.reset();
1844 pDrawShell.reset();
1845 pDrawFormShell.reset();
1846 pOleObjectShell.reset();
1847 pChartShell.reset();
1848 pGraphicShell.reset();
1849 pMediaShell.reset();
1850 pDrawTextShell.reset();
1851 pEditShell.reset();
1852 pPivotShell.reset();
1853 m_pSparklineShell.reset();
1854 pAuditingShell.reset();
1855 pCurFrameLine.reset();
1856 mpFormEditData.reset();
1857 mpInputHandler.reset();
1858 pDialogDPObject.reset();
1859 pNavSettings.reset();
1860
1861 pFormShell.reset();
1863}
1864
1865void ScTabViewShell::SetDialogDPObject( std::unique_ptr<ScDPObject> pObj )
1866{
1867 pDialogDPObject = std::move(pObj);
1868}
1869
1871{
1872 ScDocShell* pDocShell = GetViewData().GetDocShell();
1873 ScDocument& rDoc = pDocShell->GetDocument();
1874 SCTAB nTab = GetViewData().GetTabNo();
1875 OUString aTmp;
1876 rDoc.GetName(nTab, aTmp);
1877 rData.aTabName = aTmp;
1878
1879 if( pDocShell->getDocProperties()->getTitle().getLength() != 0 )
1880 rData.aTitle = pDocShell->getDocProperties()->getTitle();
1881 else
1882 rData.aTitle = pDocShell->GetTitle();
1883
1884 const INetURLObject& rURLObj = pDocShell->GetMedium()->GetURLObject();
1886 if ( !rData.aLongDocName.isEmpty() )
1888 else
1889 rData.aShortDocName = rData.aLongDocName = rData.aTitle;
1890 rData.nPageNo = 1;
1891 rData.nTotalPages = 99;
1892
1893 // eNumType is known by the dialog
1894}
1895
1897{
1898 if( !pNavSettings )
1900 return pNavSettings.get();
1901}
1902
1904{
1905 return GetViewData().getLOKVisibleArea();
1906}
1907
1909{
1911 m_pDragData->pCellTransfer = pCellObj;
1912 m_pDragData->pDrawTransfer = pDrawObj;
1913}
1914
1916{
1917 m_pDragData->pCellTransfer = nullptr;
1918 m_pDragData->pDrawTransfer = nullptr;
1919 m_pDragData->pJumpLocalDoc = nullptr;
1920 m_pDragData->aLinkDoc.clear();
1921 m_pDragData->aLinkTable.clear();
1922 m_pDragData->aLinkArea.clear();
1923 m_pDragData->aJumpTarget.clear();
1924 m_pDragData->aJumpText.clear();
1925}
1926
1927void ScTabViewShell::SetDragLink(const OUString& rDoc, const OUString& rTab, const OUString& rArea)
1928{
1930 m_pDragData->aLinkDoc = rDoc;
1931 m_pDragData->aLinkTable = rTab;
1932 m_pDragData->aLinkArea = rArea;
1933}
1934
1935void ScTabViewShell::SetDragJump(ScDocument* pLocalDoc, const OUString& rTarget, const OUString& rText)
1936{
1938 m_pDragData->pJumpLocalDoc = pLocalDoc;
1939 m_pDragData->aJumpTarget = rTarget;
1940 m_pDragData->aJumpText = rText;
1941}
1942
1943/* 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:2961
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:2947
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:961
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:1005
SC_DLLPUBLIC ScExternalRefManager * GetExternalRefManager() const
Definition: documen3.cxx:633
bool IsEmbedded() const
Definition: document.hxx:951
bool HasLinkFormulaNeedingCheck() const
Definition: document.hxx:2208
ScExtDocOptions * GetExtDocOptions()
Definition: document.hxx:643
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1082
SC_DLLPUBLIC void SetDocVisible(bool bSet)
Definition: documen2.cxx:261
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
Definition: document.hxx:826
SC_DLLPUBLIC void MakeTable(SCTAB nTab, bool _bNeedsNameCheck=true)
Definition: document.cxx:171
void ResetEmbedded()
Definition: documen3.cxx:1758
sc::DocumentLinkManager & GetDocLinkManager()
Definition: documen2.cxx:241
bool IsLinked(SCTAB nTab) const
Definition: documen3.cxx:491
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2487
SC_DLLPUBLIC bool HasTable(SCTAB nTab) const
Definition: document.cxx:194
bool IsUndoEnabled() const
Definition: document.hxx:1593
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
Definition: document.cxx:216
bool HasAreaLinks() const
Definition: documen8.cxx:1034
SC_DLLPUBLIC const ScDocOptions & GetDocOptions() const
Definition: documen3.cxx:1952
SC_DLLPUBLIC tools::Rectangle GetMMRect(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: documen3.cxx:2002
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:316
void SetEmbedded(const ScRange &rRange)
Definition: documen3.cxx:1752
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:893
bool IsInputMode() const
Definition: inputhdl.hxx:186
void ResetDelayTimer()
Definition: inputhdl.cxx:4357
void NotifyChange(const ScInputHdlState *pState, bool bForce=false, ScTabViewShell *pSourceSh=nullptr, bool bStopEditing=true)
Definition: inputhdl.cxx:4135
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:2923
bool IsFormulaMode() const
Definition: inputhdl.hxx:263
void SetRefScale(const Fraction &rX, const Fraction &rY)
Definition: inputhdl.cxx:861
void EnterHandler(ScEnterMode nBlockMode=ScEnterMode::NORMAL, bool bBeforeSavingInLOK=false)
Definition: inputhdl.cxx:3032
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:321
ScInputHandler * GetInputHandler()
Definition: inputwin.hxx:329
void AutoSum(bool &bRangeFinder, bool &bSubTotal, OpCode eCode)
Definition: inputwin.cxx:807
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:2037
void RangeSelAborted(const OUString &rText)
Definition: viewuno.cxx:2024
void RangeSelDone(const OUString &rText)
Definition: viewuno.cxx:2011
virtual SfxPrinter * GetPrinter(bool bCreate=false) override
Definition: tabvwsh4.cxx:1081
ScTabViewShell(SfxViewFrame *pViewFrame, SfxViewShell *pOldSh)
-> Clone Method for Factory Created from a general shell and inherit as much as possible
Definition: tabvwsh4.cxx:1693
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:1200
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:1903
void SetDrawTextUndo(SfxUndoManager *pUndoMgr)
Definition: tabvwsh4.cxx:1054
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: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:666
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:1213
void SetDialogDPObject(std::unique_ptr< ScDPObject > pObj)
Definition: tabvwsh4.cxx:1865
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:1915
ScNavigatorSettings * GetNavigatorSettings()
Definition: tabvwsh4.cxx:1896
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:1908
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:1493
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:1810
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:1870
void ShowCursor()
Definition: tabview3.cxx:246
virtual void Move() override
Definition: tabvwsh4.cxx:458
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:1935
ObjectSelectionType GetCurObjectSelectionType() const
Definition: tabvwsh.hxx:305
void Construct(TriState nForceDesignMode)
Definition: tabvwsh4.cxx:1498
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:1165
std::unique_ptr< ScEditShell > pEditShell
Definition: tabvwsh.hxx:103
bool SfxKeyInput(const KeyEvent &rKEvt)
Definition: tabvwsh4.cxx:1488
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:1927
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:1899
sal_uInt16 GetLockedModifiers() const
Definition: tabview.cxx:1905
void PaintLeft()
Definition: tabview3.cxx:2734
bool IsDrawTextEdit() const
Definition: tabview5.cxx:409
FuPoor * GetDrawFuncPtr()
Definition: tabview.hxx:323
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:588
SfxItemSet * GetDrawBrushSet() const
Definition: tabview.hxx:589
void MakeDrawView(TriState nForceDesignMode)
Definition: tabview5.cxx:227
void EnableAutoSpell(bool bEnable)
Definition: tabview.cxx:2249
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:2831
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:585
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:335
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:877
void DoResize(const Point &rOffset, const Size &rSize, bool bInner=false)
Definition: tabview.cxx:274
void ZoomChanged()
Definition: tabview3.cxx:3064
ScDrawView * GetScDrawView()
Definition: tabview.hxx:343
void HideNoteMarker()
Definition: tabview2.cxx:1420
bool IsDrawSelMode() const
Definition: tabview.hxx:318
void InvalidateSplit()
Definition: tabview.cxx:2120
void KillEditView(bool bNoPaint)
Definition: tabview3.cxx:2196
void PaintTop()
Definition: tabview3.cxx:2667
void ActiveGrabFocus()
Definition: tabview.cxx:891
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
Definition: tabview3.cxx:1822
void HideAllCursors()
Definition: tabview3.cxx:220
void HideTip()
Definition: tabview4.cxx:34
void GetBorderSize(SvBorder &rBorder, const Size &rSize)
Definition: tabview.cxx:786
void PaintGrid()
Definition: tabview3.cxx:2656
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:2423
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.
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:360
@ SC_INPUT_TABLE
Definition: global.hxx:362
@ DIR_LEFT
Definition: global.hxx:346
@ DIR_TOP
Definition: global.hxx:345
@ DIR_RIGHT
Definition: global.hxx:344
@ DIR_BOTTOM
Definition: global.hxx:343
ScEnterMode
Definition: global.hxx:218
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
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
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:1144
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