LibreOffice Module sc (master)  1
tabcont.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <sfx2/viewfrm.hxx>
21 #include <sfx2/dispatch.hxx>
22 #include <sfx2/docfile.hxx>
23 #include <tools/urlobj.hxx>
24 #include <vcl/commandevent.hxx>
25 #include <vcl/svapp.hxx>
26 #include <tabcont.hxx>
27 #include <tabvwsh.hxx>
28 #include <docsh.hxx>
29 #include <scmod.hxx>
30 #include <sc.hrc>
31 #include <globstr.hrc>
32 #include <transobj.hxx>
33 #include <clipparam.hxx>
34 #include <dragdata.hxx>
35 #include <markdata.hxx>
36 #include <gridwin.hxx>
37 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
38 #include <comphelper/lok.hxx>
39 
42  , DropTargetHelper(this)
43  , DragSourceHelper(this)
44  , pViewData(pData)
45  , nMouseClickPageId(TabBar::PAGE_NOT_FOUND)
46  , nSelPageIdByMouse(TabBar::PAGE_NOT_FOUND)
47  , bErrorShown(false)
48 {
49  ScDocument& rDoc = pViewData->GetDocument();
50 
51  OUString aString;
52  Color aTabBgColor;
53  SCTAB nCount = rDoc.GetTableCount();
54  for (SCTAB i=0; i<nCount; i++)
55  {
56  if (rDoc.IsVisible(i))
57  {
58  if (rDoc.GetName(i,aString))
59  {
60  if ( rDoc.IsScenario(i) )
61  InsertPage( static_cast<sal_uInt16>(i)+1, aString, TabBarPageBits::Blue);
62  else
63  InsertPage( static_cast<sal_uInt16>(i)+1, aString );
64 
65  if ( rDoc.IsTabProtected(i) )
66  SetProtectionSymbol(static_cast<sal_uInt16>(i)+1, true);
67 
68  if ( !rDoc.IsDefaultTabBgColor(i) )
69  {
70  aTabBgColor = rDoc.GetTabBgColor(i);
71  SetTabBgColor( static_cast<sal_uInt16>(i)+1, aTabBgColor );
72  }
73  }
74  }
75  }
76 
77  SetCurPageId( static_cast<sal_uInt16>(pViewData->GetTabNo()) + 1 );
78 
79  SetSizePixel( Size(SC_TABBAR_DEFWIDTH, 0) );
80 
81  SetSplitHdl( LINK( pViewData->GetView(), ScTabView, TabBarResize ) );
82 
85 
87 
88  SetScrollAreaContextHdl( LINK( this, ScTabControl, ShowPageList ) );
89 }
90 
91 IMPL_LINK(ScTabControl, ShowPageList, const CommandEvent &, rEvent, void)
92 {
94 
95  sal_uInt16 nCurPageId = GetCurPageId();
96 
97  ScDocument& rDoc = pViewData->GetDocument();
98  SCTAB nCount = rDoc.GetTableCount();
99  for (SCTAB i=0; i<nCount; ++i)
100  {
101  if (rDoc.IsVisible(i))
102  {
103  OUString aString;
104  if (rDoc.GetName(i, aString))
105  {
106  sal_uInt16 nId = static_cast<sal_uInt16>(i)+1;
107  aPopup->InsertItem(nId, aString, MenuItemBits::CHECKABLE);
108  if (nId == nCurPageId)
109  aPopup->CheckItem(nId);
110  }
111  }
112  }
113 
114  sal_uInt16 nItemId = aPopup->Execute( this, rEvent.GetMousePosPixel() );
115  SwitchToPageId(nItemId);
116 }
117 
119 {
120  disposeOnce();
121 }
122 
124 {
127  TabBar::dispose();
128 }
129 
130 sal_uInt16 ScTabControl::GetMaxId() const
131 {
132  sal_uInt16 nVisCnt = GetPageCount();
133  if (nVisCnt)
134  return GetPageId(nVisCnt-1);
135 
136  return 0;
137 }
138 
140 {
141  sal_uInt16 nPos = ShowDropPos(rPos);
142 
143  SCTAB nRealPos = static_cast<SCTAB>(nPos);
144 
145  if(nPos !=0 )
146  {
147  ScDocument& rDoc = pViewData->GetDocument();
148 
149  SCTAB nCount = rDoc.GetTableCount();
150 
151  sal_uInt16 nViewPos=0;
152  nRealPos = nCount;
153  for (SCTAB i=0; i<nCount; i++)
154  {
155  if (rDoc.IsVisible(i))
156  {
157  nViewPos++;
158  if(nViewPos==nPos)
159  {
160  SCTAB j;
161  for (j=i+1; j<nCount; j++)
162  {
163  if (rDoc.IsVisible(j))
164  {
165  break;
166  }
167  }
168  nRealPos =j;
169  break;
170  }
171  }
172  }
173  }
174  return nRealPos ;
175 }
176 
178 {
179  ScModule* pScMod = SC_MOD();
180  if ( !pScMod->IsModalMode() && !pScMod->IsFormulaMode() && !IsInEditMode() )
181  {
182  // activate View
183  pViewData->GetViewShell()->SetActive(); // Appear and SetViewFrame
185  }
186 
187  if (rMEvt.IsLeft() && rMEvt.GetModifier() == 0)
189 
190  TabBar::MouseButtonDown( rMEvt );
191 }
192 
194 {
195  Point aPos = PixelToLogic( rMEvt.GetPosPixel() );
196 
197  // mouse button down and up on same page?
198  if( nMouseClickPageId != GetPageId(aPos))
200 
201  if ( rMEvt.GetClicks() == 2 && rMEvt.IsLeft() && nMouseClickPageId != 0 && nMouseClickPageId != TabBar::PAGE_NOT_FOUND )
202  {
204  pDispatcher->Execute( FID_TAB_MENU_RENAME, SfxCallMode::SYNCHRON | SfxCallMode::RECORD );
205  return;
206  }
207 
208  if( nMouseClickPageId == 0 )
209  {
210  // Click in the area next to the existing tabs:
211  // #i70320# if several sheets are selected, deselect all except the current sheet,
212  // otherwise add new sheet
213  sal_uInt16 nSlot = ( GetSelectPageCount() > 1 ) ? FID_TAB_DESELECTALL : FID_INS_TABLE;
215  pDispatcher->Execute( nSlot, SfxCallMode::SYNCHRON | SfxCallMode::RECORD );
216  // forget page ID, to be really sure that the dialog is not called twice
218  }
219 
220  TabBar::MouseButtonUp( rMEvt );
221 }
222 
224 {
226 
227  // Insert a new sheet at the right end, with default name.
228  ScDocument& rDoc = pViewData->GetDocument();
229  ScModule* pScMod = SC_MOD();
230  if (!rDoc.IsDocEditable() || pScMod->IsTableLocked())
231  return;
232  OUString aName;
233  rDoc.CreateValidTabName(aName);
234  SCTAB nTabCount = rDoc.GetTableCount();
235  pViewData->GetViewShell()->InsertTable(aName, nTabCount);
236 }
237 
239 {
240  /* Remember last clicked page ID. */
242  /* Reset nMouseClickPageId, so that next Select() call may invalidate
243  nSelPageIdByMouse (i.e. if called from keyboard). */
245 
246  ScModule* pScMod = SC_MOD();
247  ScDocument& rDoc = pViewData->GetDocument();
248  ScMarkData& rMark = pViewData->GetMarkData();
249  SCTAB nCount = rDoc.GetTableCount();
250  SCTAB i;
251 
252  if ( pScMod->IsTableLocked() ) // may not be switched now ?
253  {
254  // restore the old state of TabControls
255 
256  for (i=0; i<nCount; i++)
257  SelectPage( static_cast<sal_uInt16>(i)+1, rMark.GetTableSelect(i) );
258  SetCurPageId( static_cast<sal_uInt16>(pViewData->GetTabNo()) + 1 );
259 
260  return;
261  }
262 
263  sal_uInt16 nCurId = GetCurPageId();
264  if (!nCurId) return; // for Excel import it can happen that everything is hidden
265  sal_uInt16 nPage = nCurId - 1;
266 
267  // OLE-inplace deactivate
268  if ( nPage != static_cast<sal_uInt16>(pViewData->GetTabNo()) )
270 
271  // InputEnterHandler onlw when not reference input
272 
273  bool bRefMode = pScMod->IsFormulaMode();
274  if (!bRefMode)
275  pScMod->InputEnterHandler();
276 
277  for (i=0; i<nCount; i++)
278  rMark.SelectTable( i, IsPageSelected(static_cast<sal_uInt16>(i)+1) );
279 
281  if (rDisp.IsLocked())
282  pViewData->GetView()->SetTabNo( static_cast<SCTAB>(nPage) );
283  else
284  {
285  // sheet for basic is 1-based
286  SfxUInt16Item aItem( SID_CURRENTTAB, nPage + 1 );
287  rDisp.ExecuteList(SID_CURRENTTAB,
288  SfxCallMode::SLOT | SfxCallMode::RECORD, { &aItem });
289  }
290 
291  SfxBindings& rBind = pViewData->GetBindings();
292  rBind.Invalidate( FID_FILL_TAB );
293  rBind.Invalidate( FID_TAB_DESELECTALL );
294 
295  rBind.Invalidate( FID_INS_TABLE );
296  rBind.Invalidate( FID_TAB_APPEND );
297  rBind.Invalidate( FID_TAB_MOVE );
298  rBind.Invalidate( FID_TAB_RENAME );
299  rBind.Invalidate( FID_DELETE_TABLE );
300  rBind.Invalidate( FID_TABLE_SHOW );
301  rBind.Invalidate( FID_TABLE_HIDE );
302  rBind.Invalidate( FID_TAB_SET_TAB_BG_COLOR );
303 
304  // Recalculate status bar functions.
305  rBind.Invalidate( SID_TABLE_CELL );
306 
307  // SetReference onlw when the consolidate dialog is open
308  // (for references over multiple sheets)
309  // for others this is only needed fidgeting
310 
311  if ( bRefMode && pViewData->GetRefType() == SC_REFTYPE_REF )
312  if ( pViewData->GetViewShell()->GetViewFrame()->HasChildWindow(SID_OPENDLG_CONSOLIDATE) )
313  {
314  ScRange aRange(
317  pScMod->SetReference( aRange, rDoc, &rMark );
318  pScMod->EndReference(); // due to Auto-Hide
319  }
320 }
321 
323 {
324  ScDocument& rDoc = pViewData->GetDocument();
325  WinBits nStyle = GetStyle();
326  if (rDoc.GetDocumentShell()->IsReadOnly())
327  // no insert sheet tab for readonly doc.
328  SetStyle(nStyle & ~WB_INSERTTAB);
329  else
330  SetStyle(nStyle | WB_INSERTTAB);
331 }
332 
334 {
335  ScDocument& rDoc = pViewData->GetDocument();
336  ScMarkData& rMark = pViewData->GetMarkData();
337  bool bActive = pViewData->IsActive();
338 
339  SCTAB nCount = rDoc.GetTableCount();
340  SCTAB i;
341  OUString aString;
342  SCTAB nMaxCnt = std::max( nCount, static_cast<SCTAB>(GetMaxId()) );
343  Color aTabBgColor;
344 
345  bool bModified = false; // sheet name
346  for (i=0; i<nMaxCnt && !bModified; i++)
347  {
348  if (rDoc.IsVisible(i))
349  {
350  rDoc.GetName(i,aString);
351  aTabBgColor = rDoc.GetTabBgColor(i);
352  }
353  else
354  {
355  aString.clear();
356  }
357 
358  if ( aString != GetPageText(static_cast<sal_uInt16>(i)+1) || (GetTabBgColor(static_cast<sal_uInt16>(i)+1) != aTabBgColor) )
359  bModified = true;
360  }
361 
362  if (bModified)
363  {
364  Clear();
365  for (i=0; i<nCount; i++)
366  {
367  if (rDoc.IsVisible(i))
368  {
369  if (rDoc.GetName(i,aString))
370  {
371  if ( rDoc.IsScenario(i) )
372  InsertPage(static_cast<sal_uInt16>(i)+1, aString, TabBarPageBits::Blue);
373  else
374  InsertPage( static_cast<sal_uInt16>(i)+1, aString );
375 
376  if ( rDoc.IsTabProtected(i) )
377  SetProtectionSymbol(static_cast<sal_uInt16>(i)+1, true);
378 
379  if ( !rDoc.IsDefaultTabBgColor(i) )
380  {
381  aTabBgColor = rDoc.GetTabBgColor(i);
382  SetTabBgColor(static_cast<sal_uInt16>(i)+1, aTabBgColor );
383  }
384  }
385  }
386  }
387  }
388  SetCurPageId( static_cast<sal_uInt16>(pViewData->GetTabNo()) + 1 );
389 
390  if (bActive)
391  {
392  bModified = false; // selection
393  for (i=0; i<nMaxCnt && !bModified; i++)
394  if ( rMark.GetTableSelect(i) != IsPageSelected(static_cast<sal_uInt16>(i)+1) )
395  bModified = true;
396 
397  if ( bModified )
398  for (i=0; i<nCount; i++)
399  SelectPage( static_cast<sal_uInt16>(i)+1, rMark.GetTableSelect(i) );
400  }
401 }
402 
403 void ScTabControl::SetSheetLayoutRTL( bool bSheetRTL )
404 {
405  SetEffectiveRTL( bSheetRTL );
407 }
408 
409 void ScTabControl::SwitchToPageId(sal_uInt16 nId)
410 {
411  if (!nId)
412  return;
413 
414  bool bAlreadySelected = IsPageSelected( nId );
415  //make the clicked page the current one
416  SetCurPageId( nId );
417  //change the selection when the current one is not already
418  //selected or part of a multi selection
419  if(bAlreadySelected)
420  return;
421 
422  sal_uInt16 nCount = GetMaxId();
423 
424  for (sal_uInt16 i=1; i<=nCount; i++)
425  SelectPage( i, i==nId );
426  Select();
427 
429  {
430  // notify LibreOfficeKit about changed page
431  OString aPayload = OString::number(nId - 1);
432  pViewData->GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr());
433  }
434 }
435 
437 {
438  ScModule* pScMod = SC_MOD();
439  ScTabViewShell* pViewSh = pViewData->GetViewShell();
440  bool bDisable = pScMod->IsFormulaMode() || pScMod->IsModalMode();
441 
442  // first activate ViewFrame (Bug 19493):
443  pViewSh->SetActive();
444 
445  if (rCEvt.GetCommand() != CommandEventId::ContextMenu || bDisable)
446  return;
447 
448  // #i18735# select the page that is under the mouse cursor
449  // if multiple tables are selected and the one under the cursor
450  // is not part of them then unselect them
451  sal_uInt16 nId = GetPageId( rCEvt.GetMousePosPixel() );
452  SwitchToPageId(nId);
453 
454  // #i52073# OLE inplace editing has to be stopped before showing the sheet tab context menu
455  pViewSh->DeactivateOle();
456 
457  // Popup-Menu:
458  // get Dispatcher from ViewData (ViewFrame) instead of Shell (Frame), so it can't be null
459  pViewData->GetDispatcher().ExecutePopup( "sheettab" );
460 }
461 
462 void ScTabControl::StartDrag( sal_Int8 /* nAction */, const Point& rPosPixel )
463 {
464  ScModule* pScMod = SC_MOD();
465  bool bDisable = pScMod->IsFormulaMode() || pScMod->IsModalMode();
466 
467  if (!bDisable)
468  {
469  vcl::Region aRegion( tools::Rectangle(0,0,0,0) );
470  CommandEvent aCEvt( rPosPixel, CommandEventId::StartDrag, true ); // needed for StartDrag
471  if (TabBar::StartDrag( aCEvt, aRegion ))
472  DoDrag();
473  }
474 }
475 
477 {
478  ScDocShell* pDocSh = pViewData->GetDocShell();
479  ScDocument& rDoc = pDocSh->GetDocument();
480 
481  SCTAB nTab = pViewData->GetTabNo();
482  ScRange aTabRange( 0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab );
483  ScMarkData aTabMark = pViewData->GetMarkData();
484  aTabMark.ResetMark(); // doesn't change marked table information
485  aTabMark.SetMarkArea( aTabRange );
486 
488  ScClipParam aClipParam(aTabRange, false);
489  rDoc.CopyToClip(aClipParam, pClipDoc.get(), &aTabMark, false, false);
490 
492  pDocSh->FillTransferableObjectDescriptor( aObjDesc );
493  aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
494  // maSize is set in ScTransferObj ctor
495 
496  rtl::Reference<ScTransferObj> pTransferObj = new ScTransferObj( std::move(pClipDoc), aObjDesc );
497 
498  pTransferObj->SetDragSourceFlags(ScDragSrc::Table);
499 
500  pTransferObj->SetDragSource( pDocSh, aTabMark );
501 
502  pTransferObj->SetSourceCursorPos( pViewData->GetCurX(), pViewData->GetCurY() );
503 
504  vcl::Window* pWindow = pViewData->GetActiveWin();
505  SC_MOD()->SetDragObject( pTransferObj.get(), nullptr ); // for internal D&D
506  pTransferObj->StartDrag( pWindow, DND_ACTION_COPYMOVE | DND_ACTION_LINK );
507 }
508 
509 static sal_uInt16 lcl_DocShellNr( const ScDocument& rDoc )
510 {
511  sal_uInt16 nShellCnt = 0;
513  while ( pShell )
514  {
515  if ( auto pDocShell = dynamic_cast<const ScDocShell *>(pShell) )
516  {
517  if ( &pDocShell->GetDocument() == &rDoc )
518  return nShellCnt;
519 
520  ++nShellCnt;
521  }
522  pShell = SfxObjectShell::GetNext( *pShell );
523  }
524 
525  OSL_FAIL("Document not found");
526  return 0;
527 }
528 
530 {
531  EndSwitchPage();
532 
533  ScDocument& rDoc = pViewData->GetDocument();
534  const ScDragData& rData = SC_MOD()->GetDragData();
535  if ( rData.pCellTransfer && (rData.pCellTransfer->GetDragSourceFlags() & ScDragSrc::Table) &&
536  rData.pCellTransfer->GetSourceDocument() == &rDoc )
537  {
538  // moving of tables within the document
540  HideDropPos();
541 
542  if ( nPos == rData.pCellTransfer->GetVisibleTab() && rEvt.mnAction == DND_ACTION_MOVE )
543  {
544  // #i83005# do nothing - don't move to the same position
545  // (too easily triggered unintentionally, and might take a long time in large documents)
546  }
547  else
548  {
549  if ( !rDoc.GetChangeTrack() && rDoc.IsDocEditable() )
550  {
553 
554  rData.pCellTransfer->SetDragWasInternal(); // don't delete
555  return DND_ACTION_COPY;
556  }
557  }
558  }
559 
560  return DND_ACTION_NONE;
561 }
562 
564 {
565  if ( rEvt.mbLeaving )
566  {
567  EndSwitchPage();
568  HideDropPos();
569  return rEvt.mnAction;
570  }
571 
572  const ScDocument& rDoc = pViewData->GetDocument();
573  const ScDragData& rData = SC_MOD()->GetDragData();
574  if ( rData.pCellTransfer && (rData.pCellTransfer->GetDragSourceFlags() & ScDragSrc::Table) &&
575  rData.pCellTransfer->GetSourceDocument() == &rDoc )
576  {
577  // moving of tables within the document
578  if ( !rDoc.GetChangeTrack() && rDoc.IsDocEditable() )
579  {
580  ShowDropPos( rEvt.maPosPixel );
581  return rEvt.mnAction;
582  }
583  }
584  else // switch sheets for all formats
585  {
586  SwitchPage( rEvt.maPosPixel ); // switch sheet after timeout
587  return 0; // nothing can be dropped here
588  }
589 
590  return 0;
591 }
592 
594 {
595  return pViewData->GetDocument().IsDocEditable();
596 }
597 
599 {
600  ScTabViewShell* pViewSh = pViewData->GetViewShell();
601  OSL_ENSURE( pViewSh, "pViewData->GetViewShell()" );
602 
604  sal_uInt16 nId = GetEditPageId();
605  if ( nId )
606  {
607  SCTAB nTab = nId - 1;
608  OUString aNewName = GetEditText();
609  bool bDone = pViewSh->RenameTable( aNewName, nTab );
610  if ( bDone )
611  nRet = TABBAR_RENAMING_YES;
612  else if ( bErrorShown )
613  {
614  // if the error message from this TabControl is currently visible,
615  // don't end edit mode now, to avoid problems when returning to
616  // the other call (showing the error) - this should not happen
617  OSL_FAIL("ScTabControl::AllowRenaming: nested calls");
618  nRet = TABBAR_RENAMING_NO;
619  }
620  else if ( Application::IsInModalMode() )
621  {
622  // don't show error message above any modal dialog
623  // instead cancel renaming without error message
624  nRet = TABBAR_RENAMING_CANCEL;
625  }
626  else
627  {
628  bErrorShown = true;
629  pViewSh->ErrorMessage( STR_INVALIDTABNAME );
630  bErrorShown = false;
631  nRet = TABBAR_RENAMING_NO;
632  }
633  }
634  return nRet;
635 }
636 
638 {
639  if ( HasFocus() )
641 }
642 
644 {
645  TabBar::Mirror();
647  {
649  if( !aRect.IsEmpty() )
650  SetPointerPosPixel( aRect.Center() );
651  nSelPageIdByMouse = TabBar::PAGE_NOT_FOUND; // only once after a Select()
652  }
653 }
654 
655 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3046
SfxViewFrame * GetViewFrame() const
virtual void InsertPage(sal_uInt16 nPageId, const OUString &rText, TabBarPageBits nBits=TabBarPageBits::NONE, sal_uInt16 nPos=TabBar::APPEND)
bool InsertTable(const OUString &rName, SCTAB nTabNr, bool bRecord=true)
Definition: viewfun2.cxx:2300
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
void MoveTable(sal_uInt16 nDestDocNo, SCTAB nDestTab, bool bCopy, const OUString *pNewTabName=nullptr)
Definition: viewfun2.cxx:2764
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:354
#define WB_MULTISELECT
virtual ~ScTabControl() override
Definition: tabcont.cxx:118
SC_DLLPUBLIC bool IsTabProtected(SCTAB nTab) const
Definition: documen3.cxx:1890
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
ScRefType GetRefType() const
Definition: viewdata.hxx:514
#define SC_TABBAR_DEFWIDTH
Definition: tabcont.hxx:30
SCROW GetRefEndY() const
Definition: viewdata.hxx:519
#define DND_ACTION_COPY
void SetSheetLayoutRTL(bool bSheetRTL)
Definition: tabcont.cxx:403
signed char sal_Int8
void ResetMark()
Definition: markdata.cxx:85
SfxDispatcher * GetDispatcher()
void EndReference()
Definition: scmod.cxx:1751
bool IsPageSelected(sal_uInt16 nPageId) const
SCROW GetRefStartY() const
Definition: viewdata.hxx:516
void SetSplitHdl(const Link< TabBar *, void > &rLink)
SCROW GetCurY() const
Definition: viewdata.hxx:402
#define WB_MINSCROLL
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
Definition: tabcont.cxx:563
sal_Int16 nId
const ContentProperties & rData
#define DND_ACTION_COPYMOVE
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
void SetProtectionSymbol(sal_uInt16 nPageId, bool bProtection)
sal_uInt16 Execute(vcl::Window *pWindow, const Point &rPopupPos)
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
SCTAB GetVisibleTab() const
Definition: transobj.hxx:89
virtual void StartDrag(sal_Int8 nAction, const Point &rPosPixel) override
Definition: tabcont.cxx:462
void UpdateStatus()
Definition: tabcont.cxx:333
virtual void AddTabClick()
void Invalidate(sal_uInt16 nId)
void FillTransferableObjectDescriptor(TransferableObjectDescriptor &rDesc) const
void HideDropPos()
#define WB_INSERTTAB
void ExecutePopup(const OUString &rResName, vcl::Window *pWin=nullptr, const Point *pPos=nullptr)
ScTransferObj * pCellTransfer
Definition: dragdata.hxx:21
sal_uInt16 GetMaxId() const
Definition: tabcont.cxx:130
SC_DLLPUBLIC void InputEnterHandler(ScEnterMode nBlockMode=ScEnterMode::NORMAL)
Definition: scmod.cxx:1359
void SetReference(const ScRange &rRef, ScDocument &rDoc, const ScMarkData *pMarkData=nullptr)
Definition: scmod.cxx:1668
bool RenameTable(const OUString &rName, SCTAB nTabNr)
Definition: viewfun2.cxx:2563
virtual void Mirror() override
Definition: tabcont.cxx:643
ScDocument * GetSourceDocument()
Definition: transobj.cxx:626
#define DND_ACTION_MOVE
bool IsEmpty() const
virtual void AddTabClick() override
Definition: tabcont.cxx:223
void SetEffectiveRTL(bool bRTL)
sal_uInt16 GetClicks() const
sal_Int64 WinBits
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
virtual TabBarAllowRenamingReturnCode AllowRenaming() override
Definition: tabcont.cxx:598
bool IsFormulaMode()
Definition: scmod.cxx:1621
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:873
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:314
int nCount
#define DND_ACTION_NONE
void libreOfficeKitViewCallback(int nType, const char *pPayload) const override
void DrawMarkListHasChanged()
Definition: tabview5.cxx:472
sal_uInt16 GetPageId(sal_uInt16 nPos) const
TABBAR_RENAMING_CANCEL
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2392
bool IsInEditMode() const
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:357
static sal_uInt16 lcl_DocShellNr(const ScDocument &rDoc)
Definition: tabcont.cxx:509
void UpdateInputContext()
Definition: tabcont.cxx:322
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:872
virtual void Select() override
Definition: tabcont.cxx:238
bool IsModalMode(SfxObjectShell *pDocSh=nullptr)
Definition: scmod.cxx:1545
SCTAB GetRefEndZ() const
Definition: viewdata.hxx:520
SC_DLLPUBLIC bool IsDefaultTabBgColor(SCTAB nTab) const
Definition: documen3.cxx:456
int i
void SetDragWasInternal()
Definition: transobj.cxx:616
WinBits const WB_SCROLL
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
void SelectTable(SCTAB nTab, bool bNew)
Definition: markdata.cxx:172
SfxBindings & GetBindings()
Definition: viewdata.cxx:3034
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
Definition: document.hxx:2613
#define SC_MOD()
Definition: scmod.hxx:253
IMPL_LINK(ScTabControl, ShowPageList, const CommandEvent &, rEvent, void)
Definition: tabcont.cxx:91
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: tabcont.cxx:193
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
Definition: tabview3.cxx:1793
SC_DLLPUBLIC void CreateValidTabName(OUString &rName) const
Definition: document.cxx:392
static const sal_uInt16 PAGE_NOT_FOUND
void EndSwitchPage()
sal_uInt16 nSelPageIdByMouse
Last page ID after mouse button down/up.
Definition: tabcont.hxx:37
CommandEventId GetCommand() const
void SetStyle(WinBits nStyle)
ScDragSrc GetDragSourceFlags() const
Definition: transobj.hxx:90
bool IsActive() const
Definition: viewdata.hxx:382
void SetActive()
Definition: tabvwsh4.cxx:259
ScGridWindow * GetActiveWin()
Definition: viewdata.cxx:3062
void SetTabBgColor(sal_uInt16 nPageId, const Color &aTabBgColor)
bool StartDrag(const CommandEvent &rCEvt, vcl::Region &rRegion)
#define DND_ACTION_LINK
sal_uInt16 GetModifier() const
SCCOL GetRefEndX() const
Definition: viewdata.hxx:518
void SetScrollAlwaysEnabled(bool bScrollAlwaysEnabled)
TABBAR_RENAMING_NO
virtual bool StartRenaming() override
Definition: tabcont.cxx:593
void DeactivateOle()
Definition: tabvwshb.cxx:290
bool IsReadOnly() const
void CheckItem(sal_uInt16 nItemId, bool bCheck=true)
ScDBFunc * GetView() const
Definition: viewdata.cxx:852
sal_uInt16 GetSelectPageCount() const
SCCOL GetRefStartX() const
Definition: viewdata.hxx:515
virtual void Command(const CommandEvent &rCEvt) override
Definition: tabcont.cxx:436
const Point & GetMousePosPixel() const
WinBits const WB_3DLOOK
void DoDrag()
Definition: tabcont.cxx:476
SCTAB GetRefStartZ() const
Definition: viewdata.hxx:517
Color GetTabBgColor(sal_uInt16 nPageId) const
SC_DLLPUBLIC Color GetTabBgColor(SCTAB nTab) const
Definition: documen3.cxx:443
void InsertItem(sal_uInt16 nItemId, const OUString &rStr, MenuItemBits nItemBits=MenuItemBits::NONE, const OString &rIdent=OString(), sal_uInt16 nPos=MENU_APPEND)
ScTabControl(vcl::Window *pParent, ScViewData *pData)
Definition: tabcont.cxx:40
bool HasChildWindow(sal_uInt16)
virtual void EndRenaming() override
Definition: tabcont.cxx:637
static bool IsInModalMode()
#define WB_RANGESELECT
bool IsTableLocked()
Definition: scmod.cxx:1575
SC_DLLPUBLIC bool IsScenario(SCTAB nTab) const
Definition: documen3.cxx:427
void SetScrollAreaContextHdl(const Link< const CommandEvent &, void > &rLink)
static SfxObjectShell * GetFirst(const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
void ErrorMessage(const char *pGlobStrId)
Definition: tabview2.cxx:1412
void EnableEditMode()
OUString aName
void ActiveGrabFocus()
Definition: tabview.cxx:897
sal_uInt16 GetEditPageId() const
bool IsDocEditable() const
Definition: documen3.cxx:1884
bool IsLeft() const
SfxDispatcher & GetDispatcher()
Definition: viewdata.cxx:3040
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt) override
Definition: tabcont.cxx:529
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: tabcont.cxx:177
virtual void dispose() override
const INetURLObject & GetURLObject() const
TabBarAllowRenamingReturnCode
WinBits GetStyle() const
const ScDocument & GetDocument() const
Definition: docsh.hxx:216
const Point & GetPosPixel() const
TABBAR_RENAMING_YES
sal_uInt16 nMouseClickPageId
Definition: tabcont.hxx:36
OUString GetURLNoPass(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool IsLocked() const
sal_uInt16 GetPageCount() const
ScViewData * pViewData
Definition: tabcont.hxx:35
virtual void Mirror()
void Clear()
void SetCurPageId(sal_uInt16 nPageId)
void SelectPage(sal_uInt16 nPageId, bool bSelect)
SfxObjectShell * GetDocumentShell() const
Definition: document.hxx:1058
SC_DLLPUBLIC bool IsVisible(SCTAB nTab) const
Definition: document.cxx:908
SCTAB GetPrivatDropPos(const Point &rPos)
Definition: tabcont.cxx:139
static SfxObjectShell * GetNext(const SfxObjectShell &rPrev, const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
tools::Rectangle GetPageRect(sal_uInt16 nPageId) const
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
sal_uInt16 ShowDropPos(const Point &rPos)
bool GetTableSelect(SCTAB nTab) const
Definition: markdata.cxx:184
void SwitchPage(const Point &rPos)
This struct stores general clipboard parameters associated with a ScDocument instance created in clip...
Definition: clipparam.hxx:30
sal_Int8 mnAction
void SwitchToPageId(sal_uInt16 nId)
Definition: tabcont.cxx:409
sal_uInt16 GetCurPageId() const
const OUString & GetEditText() const
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
Definition: document.cxx:213
Point Center() const
OUString GetPageText(sal_uInt16 nPageId) const
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:23
SC_DLLPUBLIC void CopyToClip(const ScClipParam &rClipParam, ScDocument *pClipDoc, const ScMarkData *pMarks, bool bKeepScenarioFlags, bool bIncludeObjects)
Definition: document.cxx:2175
SCCOL GetCurX() const
Definition: viewdata.hxx:401
virtual void dispose() override
Definition: tabcont.cxx:123
bool bErrorShown
Selected page ID, if selected with mouse.
Definition: tabcont.hxx:38
WinBits const WB_DRAG
SfxMedium * GetMedium() const