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