LibreOffice Module sc (master)  1
tabvwsh3.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/bindings.hxx>
21 #include <sfx2/dispatch.hxx>
22 #include <sfx2/passwd.hxx>
23 #include <sfx2/request.hxx>
24 #include <sfx2/sidebar/Sidebar.hxx>
25 #include <svl/ptitem.hxx>
26 #include <svl/stritem.hxx>
27 #include <tools/urlobj.hxx>
28 #include <sfx2/objface.hxx>
29 #include <vcl/vclenum.hxx>
30 #include <vcl/uitest/logger.hxx>
32 
33 #include <globstr.hrc>
34 #include <strings.hrc>
35 #include <scmod.hxx>
36 #include <appoptio.hxx>
37 #include <tabvwsh.hxx>
38 #include <document.hxx>
39 #include <sc.hrc>
40 #include <helpids.h>
41 #include <inputwin.hxx>
42 #include <scresid.hxx>
43 #include <docsh.hxx>
44 #include <rangeutl.hxx>
45 #include <reffact.hxx>
46 #include <tabprotection.hxx>
47 #include <protectiondlg.hxx>
48 #include <markdata.hxx>
49 
50 #include <svl/ilstitem.hxx>
51 #include <vector>
52 
53 #include <svx/zoomslideritem.hxx>
54 #include <svx/svxdlg.hxx>
55 #include <comphelper/lok.hxx>
56 #include <comphelper/string.hxx>
57 #include <sfx2/lokhelper.hxx>
58 #include <scabstdlg.hxx>
59 
61 
62 namespace
63 {
64  void collectUIInformation(const OUString& aZoom)
65  {
66  EventDescription aDescription;
67  aDescription.aID = "grid_window";
68  aDescription.aParameters = {{"ZOOM", aZoom}};
69  aDescription.aAction = "SET";
70  aDescription.aKeyWord = "ScGridWinUIObject";
71  aDescription.aParent = "MainWindow";
72  UITestLogger::getInstance().logEvent(aDescription);
73  }
74 
75  enum class DetectFlags
76  {
77  NONE,
78  RANGE,
79  ADDRESS
80  };
81 
82  struct ScRefFlagsAndType
83  {
84  ScRefFlags nResult;
85  DetectFlags eDetected;
86  };
87 
88  ScRefFlagsAndType lcl_ParseRangeOrAddress(ScRange& rScRange, ScAddress& rScAddress,
89  const OUString& aAddress, const ScDocument& rDoc)
90  {
91  ScRefFlagsAndType aRet;
92 
94 
95  // start with the address convention set in the document
96  eConv = rDoc.GetAddressConvention();
97  aRet.nResult = rScRange.Parse(aAddress, rDoc, eConv);
98  if (aRet.nResult & ScRefFlags::VALID)
99  {
100  aRet.eDetected = DetectFlags::RANGE;
101  return aRet;
102  }
103 
104  aRet.nResult = rScAddress.Parse(aAddress, rDoc, eConv);
105  if (aRet.nResult & ScRefFlags::VALID)
106  {
107  aRet.eDetected = DetectFlags::ADDRESS;
108  return aRet;
109  }
110 
111  // try the default Calc (A1) address convention
112  aRet.nResult = rScRange.Parse(aAddress, rDoc);
113  if (aRet.nResult & ScRefFlags::VALID)
114  {
115  aRet.eDetected = DetectFlags::RANGE;
116  return aRet;
117  }
118 
119  aRet.nResult = rScAddress.Parse(aAddress, rDoc);
120  if (aRet.nResult & ScRefFlags::VALID)
121  {
122  aRet.eDetected = DetectFlags::ADDRESS;
123  return aRet;
124  }
125 
126  // try the Excel A1 address convention
127  aRet.nResult = rScRange.Parse(aAddress, rDoc, formula::FormulaGrammar::CONV_XL_A1);
128  if (aRet.nResult & ScRefFlags::VALID)
129  {
130  aRet.eDetected = DetectFlags::RANGE;
131  return aRet;
132  }
133 
134  // try the Excel A1 address convention
135  aRet.nResult = rScAddress.Parse(aAddress, rDoc, formula::FormulaGrammar::CONV_XL_A1);
136  if (aRet.nResult & ScRefFlags::VALID)
137  {
138  aRet.eDetected = DetectFlags::ADDRESS;
139  return aRet;
140  }
141 
142  // try Excel R1C1 address convention
143  aRet.nResult = rScRange.Parse(aAddress, rDoc, formula::FormulaGrammar::CONV_XL_R1C1);
144  if (aRet.nResult & ScRefFlags::VALID)
145  {
146  aRet.eDetected = DetectFlags::RANGE;
147  return aRet;
148  }
149 
150  aRet.nResult = rScAddress.Parse(aAddress, rDoc, formula::FormulaGrammar::CONV_XL_R1C1);
151  if (aRet.nResult & ScRefFlags::VALID)
152  {
153  aRet.eDetected = DetectFlags::ADDRESS;
154  return aRet;
155  }
156 
157  aRet.nResult = ScRefFlags::ZERO;
158  aRet.eDetected = DetectFlags::NONE;
159 
160  return aRet;
161  }
162 }
163 
165 {
166  SfxViewFrame* pThisFrame = GetViewFrame();
167  SfxBindings& rBindings = pThisFrame->GetBindings();
168  ScModule* pScMod = SC_MOD();
169  const SfxItemSet* pReqArgs = rReq.GetArgs();
170  sal_uInt16 nSlot = rReq.GetSlot();
171 
172  if (nSlot != SID_CURRENTCELL) // comes with MouseButtonUp
173  HideListBox(); // Autofilter-DropDown-Listbox
174 
175  switch ( nSlot )
176  {
177  case FID_INSERT_FILE:
178  {
179  const SfxPoolItem* pItem;
180  if ( pReqArgs &&
181  pReqArgs->GetItemState(FID_INSERT_FILE,true,&pItem) == SfxItemState::SET )
182  {
183  OUString aFileName = static_cast<const SfxStringItem*>(pItem)->GetValue();
184 
185  // insert position
186 
187  Point aInsertPos;
188  if ( pReqArgs->GetItemState(FN_PARAM_1,true,&pItem) == SfxItemState::SET )
189  aInsertPos = static_cast<const SfxPointItem*>(pItem)->GetValue();
190  else
191  aInsertPos = GetInsertPos();
192 
193  // as Link?
194 
195  bool bAsLink = false;
196  if ( pReqArgs->GetItemState(FN_PARAM_2,true,&pItem) == SfxItemState::SET )
197  bAsLink = static_cast<const SfxBoolItem*>(pItem)->GetValue();
198 
199  // execute
200 
201  PasteFile( aInsertPos, aFileName, bAsLink );
202  }
203  }
204  break;
205 
206  case SID_OPENDLG_EDIT_PRINTAREA:
207  {
208  sal_uInt16 nId = ScPrintAreasDlgWrapper::GetChildWindowId();
209  SfxChildWindow* pWnd = pThisFrame->GetChildWindow( nId );
210 
211  pScMod->SetRefDialog( nId, pWnd == nullptr );
212  }
213  break;
214 
215  case SID_CHANGE_PRINTAREA:
216  {
217  if ( pReqArgs ) // OK from dialog
218  {
219  OUString aPrintStr;
220  OUString aRowStr;
221  OUString aColStr;
222  bool bEntire = false;
223  const SfxPoolItem* pItem;
224  if ( pReqArgs->GetItemState( SID_CHANGE_PRINTAREA, true, &pItem ) == SfxItemState::SET )
225  aPrintStr = static_cast<const SfxStringItem*>(pItem)->GetValue();
226  if ( pReqArgs->GetItemState( FN_PARAM_2, true, &pItem ) == SfxItemState::SET )
227  aRowStr = static_cast<const SfxStringItem*>(pItem)->GetValue();
228  if ( pReqArgs->GetItemState( FN_PARAM_3, true, &pItem ) == SfxItemState::SET )
229  aColStr = static_cast<const SfxStringItem*>(pItem)->GetValue();
230  if ( pReqArgs->GetItemState( FN_PARAM_4, true, &pItem ) == SfxItemState::SET )
231  bEntire = static_cast<const SfxBoolItem*>(pItem)->GetValue();
232 
233  SetPrintRanges( bEntire, &aPrintStr, &aColStr, &aRowStr, false );
234 
235  rReq.Done();
236  }
237  }
238  break;
239 
240  case SID_ADD_PRINTAREA:
241  case SID_DEFINE_PRINTAREA: // menu or basic
242  {
243  bool bAdd = ( nSlot == SID_ADD_PRINTAREA );
244  if ( pReqArgs )
245  {
246  OUString aPrintStr;
247  const SfxPoolItem* pItem;
248  if ( pReqArgs->GetItemState( SID_DEFINE_PRINTAREA, true, &pItem ) == SfxItemState::SET )
249  aPrintStr = static_cast<const SfxStringItem*>(pItem)->GetValue();
250  SetPrintRanges( false, &aPrintStr, nullptr, nullptr, bAdd );
251  }
252  else
253  {
254  SetPrintRanges( false, nullptr, nullptr, nullptr, bAdd ); // from selection
255  rReq.Done();
256  }
257  }
258  break;
259 
260  case SID_DELETE_PRINTAREA:
261  {
262  // Clear currently defined print range if any, and reset it to
263  // print entire sheet which is the default.
264  OUString aEmpty;
265  SetPrintRanges(true, &aEmpty, nullptr, nullptr, false);
266  rReq.Done();
267  }
268  break;
269 
270  case FID_DEL_MANUALBREAKS:
272  rReq.Done();
273  break;
274 
275  case FID_ADJUST_PRINTZOOM:
276  AdjustPrintZoom();
277  rReq.Done();
278  break;
279 
280  case FID_RESET_PRINTZOOM:
281  SetPrintZoom( 100 ); // 100%, not on pages
282  rReq.Done();
283  break;
284 
285  case SID_FORMATPAGE:
286  case SID_STATUS_PAGESTYLE:
287  case SID_HFEDIT:
289  ExecutePageStyle( *this, rReq, GetViewData().GetTabNo() );
290  break;
291 
292  case SID_JUMPTOMARK:
293  case SID_CURRENTCELL:
294  if ( pReqArgs )
295  {
296  OUString aAddress;
297  const SfxPoolItem* pItem;
298  if ( pReqArgs->GetItemState( nSlot, true, &pItem ) == SfxItemState::SET )
299  aAddress = static_cast<const SfxStringItem*>(pItem)->GetValue();
300  else if ( nSlot == SID_JUMPTOMARK && pReqArgs->GetItemState(
301  SID_JUMPTOMARK, true, &pItem ) == SfxItemState::SET )
302  aAddress = static_cast<const SfxStringItem*>(pItem)->GetValue();
303 
304  // #i14927# SID_CURRENTCELL with a single cell must unmark if FN_PARAM_1
305  // isn't set (for recorded macros, because IsAPI is no longer available).
306  // ScGridWindow::MouseButtonUp no longer executes the slot for a single
307  // cell if there is a multi selection.
308  bool bUnmark = ( nSlot == SID_CURRENTCELL );
309  if ( pReqArgs->GetItemState( FN_PARAM_1, true, &pItem ) == SfxItemState::SET )
310  bUnmark = static_cast<const SfxBoolItem*>(pItem)->GetValue();
311 
312  bool bAlignToCursor = true;
313  if (pReqArgs->GetItemState(FN_PARAM_2, true, &pItem) == SfxItemState::SET)
314  bAlignToCursor = static_cast<const SfxBoolItem*>(pItem)->GetValue();
315 
316  bool bForceGlobalName = false;
317  if (pReqArgs->GetItemState(FN_PARAM_3, true, &pItem) == SfxItemState::SET)
318  bForceGlobalName = static_cast<const SfxBoolItem*>(pItem)->GetValue();
319 
320  if ( nSlot == SID_JUMPTOMARK )
321  {
322  // URL has to be decoded for escaped characters (%20)
323  aAddress = INetURLObject::decode( aAddress,
325  }
326 
327  bool bFound = false;
328  ScViewData& rViewData = GetViewData();
329  ScDocument& rDoc = rViewData.GetDocument();
330  ScMarkData& rMark = rViewData.GetMarkData();
331  ScRange aScRange;
332  ScAddress aScAddress;
333  ScRefFlagsAndType aResult = lcl_ParseRangeOrAddress(aScRange, aScAddress, aAddress, rDoc);
334  ScRefFlags nResult = aResult.nResult;
335  SCTAB nTab = rViewData.GetTabNo();
336  bool bMark = true;
337 
338  // Is this a range ?
339  if (aResult.eDetected == DetectFlags::RANGE)
340  {
341  if ( nResult & ScRefFlags::TAB_3D )
342  {
343  if( aScRange.aStart.Tab() != nTab )
344  {
345  nTab = aScRange.aStart.Tab();
346  SetTabNo( nTab );
347  }
348  }
349  else
350  {
351  aScRange.aStart.SetTab( nTab );
352  aScRange.aEnd.SetTab( nTab );
353  }
354  }
355  // Is this a cell ?
356  else if (aResult.eDetected == DetectFlags::ADDRESS)
357  {
358  if ( nResult & ScRefFlags::TAB_3D )
359  {
360  if( aScAddress.Tab() != nTab )
361  {
362  nTab = aScAddress.Tab();
363  SetTabNo( nTab );
364  }
365  }
366  else
367  aScAddress.SetTab( nTab );
368 
369  aScRange = ScRange( aScAddress, aScAddress );
370  // cells should not be marked
371  bMark = false;
372  }
373  // Is it a named area (first named ranges then database ranges)?
374  else
375  {
376  const RutlNameScope eScope = (bForceGlobalName ? RUTL_NAMES_GLOBAL : RUTL_NAMES);
378  if( ScRangeUtil::MakeRangeFromName( aAddress, rDoc, nTab, aScRange, eScope, eConv ) ||
379  ScRangeUtil::MakeRangeFromName( aAddress, rDoc, nTab, aScRange, RUTL_DBASE, eConv ) )
380  {
381  nResult |= ScRefFlags::VALID;
382  if( aScRange.aStart.Tab() != nTab )
383  {
384  nTab = aScRange.aStart.Tab();
385  SetTabNo( nTab );
386  }
387  }
388  }
389 
390  if ( !(nResult & ScRefFlags::VALID) && comphelper::string::isdigitAsciiString(aAddress) )
391  {
392  sal_Int32 nNumeric = aAddress.toInt32();
393  if ( nNumeric > 0 && nNumeric <= rDoc.MaxRow()+1 )
394  {
395  // one-based row numbers
396 
397  aScAddress.SetRow( static_cast<SCROW>(nNumeric - 1) );
398  aScAddress.SetCol( rViewData.GetCurX() );
399  aScAddress.SetTab( nTab );
400  aScRange = ScRange( aScAddress, aScAddress );
401  bMark = false;
402  nResult = ScRefFlags::VALID;
403  }
404  }
405 
406  if ( !rDoc.ValidRow(aScRange.aStart.Row()) || !rDoc.ValidRow(aScRange.aEnd.Row()) )
407  nResult = ScRefFlags::ZERO;
408 
409  // we have found something
410  if( nResult & ScRefFlags::VALID )
411  {
412  bFound = true;
413  SCCOL nCol = aScRange.aStart.Col();
414  SCROW nRow = aScRange.aStart.Row();
415  bool bNothing = ( rViewData.GetCurX()==nCol && rViewData.GetCurY()==nRow );
416 
417  // mark
418  if( bMark )
419  {
420  if (rMark.IsMarked()) // is the same range already marked?
421  {
422  ScRange aOldMark;
423  rMark.GetMarkArea( aOldMark );
424  aOldMark.PutInOrder();
425  ScRange aCurrent = aScRange;
426  aCurrent.PutInOrder();
427  bNothing = ( aCurrent == aOldMark );
428  }
429  else
430  bNothing = false;
431 
432  if (!bNothing)
433  MarkRange( aScRange, false ); // cursor comes after...
434  }
435  else
436  {
437  // remove old selection, unless bUnmark argument is sal_False (from navigator)
438  if( bUnmark )
439  {
440  MoveCursorAbs( nCol, nRow,
441  SC_FOLLOW_NONE, false, false );
442  }
443  }
444 
445  // and set cursor
446 
447  // consider merged cells:
448  rDoc.SkipOverlapped(nCol, nRow, nTab);
449 
450  // navigator calls are not part of the API!!!
451 
452  if( bNothing )
453  {
454  if (rReq.IsAPI())
455  rReq.Ignore(); // if macro, then nothing
456  else
457  rReq.Done(); // then at least paint it
458  }
459  else
460  {
461  rViewData.ResetOldCursor();
462  SetCursor( nCol, nRow );
463  rBindings.Invalidate( SID_CURRENTCELL );
464  rBindings.Update( nSlot );
465 
466  if (!rReq.IsAPI())
467  rReq.Done();
468  }
469 
470  if (bAlignToCursor)
471  {
472  // align to cursor even if the cursor position hasn't changed,
473  // because the cursor may be set outside the visible area.
474  AlignToCursor( nCol, nRow, SC_FOLLOW_JUMP );
475  }
476 
477  rReq.SetReturnValue( SfxStringItem( SID_CURRENTCELL, aAddress ) );
478  }
479 
480  if (!bFound) // no valid range
481  {
482  // if it is a sheet name, then switch (for Navigator/URL)
483 
484  SCTAB nNameTab;
485  if ( rDoc.GetTable( aAddress, nNameTab ) )
486  {
487  bFound = true;
488  if ( nNameTab != nTab )
489  SetTabNo( nNameTab );
490  }
491  }
492 
493  if ( !bFound && nSlot == SID_JUMPTOMARK )
494  {
495  // test graphics objects (only for URL)
496 
497  bFound = SelectObject( aAddress );
498  }
499 
500  if (!bFound && !rReq.IsAPI())
501  ErrorMessage( STR_ERR_INVALID_AREA );
502  }
503  break;
504 
505  case SID_CURRENTOBJECT:
506  if ( pReqArgs )
507  {
508  OUString aName = static_cast<const SfxStringItem&>(pReqArgs->Get(nSlot)).GetValue();
509  SelectObject( aName );
510  }
511  break;
512 
513  case SID_CURRENTTAB:
514  if ( pReqArgs )
515  {
516  // sheet for basic is one-based
517  SCTAB nTab = static_cast<const SfxUInt16Item&>(pReqArgs->Get(nSlot)).GetValue() - 1;
518  ScDocument& rDoc = GetViewData().GetDocument();
519  if ( nTab < rDoc.GetTableCount() )
520  {
521  SetTabNo( nTab );
522  rBindings.Update( nSlot );
523 
524  if( ! rReq.IsAPI() )
525  rReq.Done();
526  }
528  }
529  break;
530 
531  case SID_CURRENTDOC:
532  if ( pReqArgs )
533  {
534  OUString aStrDocName( static_cast<const SfxStringItem&>(pReqArgs->
535  Get(nSlot)).GetValue() );
536 
537  SfxViewFrame* pViewFrame = nullptr;
538  ScDocShell* pDocSh = static_cast<ScDocShell*>(SfxObjectShell::GetFirst());
539  bool bFound = false;
540 
541  // search for ViewFrame to be activated
542 
543  while ( pDocSh && !bFound )
544  {
545  if ( pDocSh->GetTitle() == aStrDocName )
546  {
547  pViewFrame = SfxViewFrame::GetFirst( pDocSh );
548  bFound = ( nullptr != pViewFrame );
549  }
550 
551  pDocSh = static_cast<ScDocShell*>(SfxObjectShell::GetNext( *pDocSh ));
552  }
553 
554  if ( bFound )
555  pViewFrame->GetFrame().Appear();
556 
557  rReq.Ignore();//XXX is handled by SFX
558  }
559  break;
560 
561  case SID_PRINTPREVIEW:
562  {
563  if ( !pThisFrame->GetFrame().IsInPlace() ) // not for OLE
564  {
565  // print preview is now always in the same frame as the tab view
566  // -> always switch this frame back to normal view
567  // (ScPreviewShell ctor reads view data)
568 
569  // #102785#; finish input
570  pScMod->InputEnterHandler();
571 
572  pThisFrame->GetDispatcher()->Execute( SID_VIEWSHELL1, SfxCallMode::ASYNCHRON );
573  }
574  // else error (e.g. Ole)
575  }
576  break;
577 
578  case SID_DETECTIVE_DEL_ALL:
579  DetectiveDelAll();
580  rReq.Done();
581  break;
582 
583  // SID_TABLE_ACTIVATE and SID_MARKAREA are called by basic for the
584  // hidden View, to mark/switch on the visible View:
585 
586  case SID_TABLE_ACTIVATE:
587  OSL_FAIL("old slot SID_TABLE_ACTIVATE");
588  break;
589 
590  case SID_REPAINT:
591  PaintGrid();
592  PaintTop();
593  PaintLeft();
594  PaintExtras();
595  rReq.Done();
596  break;
597 
598  case FID_NORMALVIEWMODE:
599  case FID_PAGEBREAKMODE:
600  {
601  bool bWantPageBreak = nSlot == FID_PAGEBREAKMODE;
602 
603  // check whether there is an explicit argument, use it
604  const SfxPoolItem* pItem;
605  if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET )
606  {
607  bool bItemValue = static_cast<const SfxBoolItem*>(pItem)->GetValue();
608  bWantPageBreak = (nSlot == FID_PAGEBREAKMODE) == bItemValue;
609  }
610 
611  if( GetViewData().IsPagebreakMode() != bWantPageBreak )
612  {
613  SetPagebreakMode( bWantPageBreak );
616  PaintGrid();
617  PaintTop();
618  PaintLeft();
619  rBindings.Invalidate( nSlot );
620  rReq.AppendItem( SfxBoolItem( nSlot, true ) );
621  rReq.Done();
622  }
623  }
624  break;
625 
626  case FID_FUNCTION_BOX:
627  {
628  // First make sure that the sidebar is visible
629  pThisFrame->ShowChildWindow(SID_SIDEBAR);
630 
631  ::sfx2::sidebar::Sidebar::ShowPanel(u"ScFunctionsPanel",
632  pThisFrame->GetFrame().GetFrameInterface());
633  rReq.Done ();
634  }
635  break;
636 
637  case FID_TOGGLESYNTAX:
638  {
639  bool bSet = !GetViewData().IsSyntaxMode();
640  const SfxPoolItem* pItem;
641  if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET )
642  bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue();
643  GetViewData().SetSyntaxMode( bSet );
644  PaintGrid();
645  rBindings.Invalidate( FID_TOGGLESYNTAX );
646  rReq.AppendItem( SfxBoolItem( nSlot, bSet ) );
647  rReq.Done();
648  }
649  break;
650  case FID_TOGGLEHEADERS:
651  {
652  bool bSet = !GetViewData().IsHeaderMode();
653  const SfxPoolItem* pItem;
654  if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET )
655  bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue();
656  GetViewData().SetHeaderMode( bSet );
657  RepeatResize();
658  rBindings.Invalidate( FID_TOGGLEHEADERS );
659  rReq.AppendItem( SfxBoolItem( nSlot, bSet ) );
660  rReq.Done();
661  }
662  break;
663 
664  case FID_TOGGLEFORMULA:
665  {
666  ScViewData& rViewData = GetViewData();
667  const ScViewOptions& rOpts = rViewData.GetOptions();
668  bool bFormulaMode = !rOpts.GetOption( VOPT_FORMULAS );
669  const SfxPoolItem *pItem;
670  if( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET )
671  bFormulaMode = static_cast<const SfxBoolItem *>(pItem)->GetValue();
672 
673  ScViewOptions aSetOpts = rOpts;
674  aSetOpts.SetOption( VOPT_FORMULAS, bFormulaMode );
675  rViewData.SetOptions( aSetOpts );
676 
677  rViewData.GetDocShell()->PostPaintGridAll();
678 
679  rBindings.Invalidate( FID_TOGGLEFORMULA );
680  rReq.AppendItem( SfxBoolItem( nSlot, bFormulaMode ) );
681  rReq.Done();
682  }
683  break;
684 
685  case FID_TOGGLEINPUTLINE:
686  {
687  sal_uInt16 nId = ScInputWindowWrapper::GetChildWindowId();
688  SfxChildWindow* pWnd = pThisFrame->GetChildWindow( nId );
689  bool bSet = ( pWnd == nullptr );
690  const SfxPoolItem* pItem;
691  if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET )
692  bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue();
693 
694  pThisFrame->SetChildWindow( nId, bSet );
695  rBindings.Invalidate( FID_TOGGLEINPUTLINE );
696  rReq.AppendItem( SfxBoolItem( nSlot, bSet ) );
697  rReq.Done();
698  }
699  break;
700 
701  // handling for SID_ZOOM_IN and SID_ZOOM_OUT is ScTabView::ScrollCommand
702  // CommandWheelMode::ZOOM inspired
703  case SID_ZOOM_IN:
704  case SID_ZOOM_OUT:
705  {
706  HideNoteMarker();
707 
708  if (!GetViewData().GetViewShell()->GetViewFrame()->GetFrame().IsInPlace())
709  {
710  // for ole inplace editing, the scale is defined by the visarea and client size
711  // and can't be changed directly
712 
713  const Fraction& rOldY = GetViewData().GetZoomY();
714  tools::Long nOld = tools::Long(rOldY * 100);
715  tools::Long nNew;
716  if (SID_ZOOM_OUT == nSlot)
717  nNew = std::max(tools::Long(MINZOOM), basegfx::zoomtools::zoomOut(nOld));
718  else
719  nNew = std::min(tools::Long(MAXZOOM), basegfx::zoomtools::zoomIn(nOld));
720  if ( nNew != nOld)
721  {
722  bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom();
723  SetZoomType(SvxZoomType::PERCENT, bSyncZoom);
724  Fraction aFract(nNew, 100);
725  SetZoom(aFract, aFract, bSyncZoom);
726  PaintGrid();
727  PaintTop();
728  PaintLeft();
729  rBindings.Invalidate(SID_ATTR_ZOOM);
730  rBindings.Invalidate(SID_ATTR_ZOOMSLIDER);
731  rBindings.Invalidate(SID_ZOOM_IN);
732  rBindings.Invalidate(SID_ZOOM_OUT);
733  rReq.Done();
734  }
735  }
736  }
737  break;
738 
739  case SID_ATTR_ZOOM: // status row
740  case FID_SCALE:
741  {
742  bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom();
743  SvxZoomType eOldZoomType = GetZoomType();
744  SvxZoomType eNewZoomType = eOldZoomType;
745  const Fraction& rOldY = GetViewData().GetZoomY(); // Y is shown
746  sal_uInt16 nOldZoom = static_cast<sal_uInt16>(tools::Long( rOldY * 100 ));
747  sal_uInt16 nZoom = nOldZoom;
748  bool bCancel = false;
749 
750  if ( pReqArgs )
751  {
752  const SvxZoomItem& rZoomItem = pReqArgs->Get(SID_ATTR_ZOOM);
753 
754  eNewZoomType = rZoomItem.GetType();
755  nZoom = rZoomItem.GetValue();
756  }
757  else
758  {
760  SvxZoomItem aZoomItem( eOldZoomType, nOldZoom, SID_ATTR_ZOOM );
762  ScMarkData& rMark = GetViewData().GetMarkData();
763  SvxZoomEnableFlags nBtnFlags = SvxZoomEnableFlags::N50
764  | SvxZoomEnableFlags::N75
765  | SvxZoomEnableFlags::N100
766  | SvxZoomEnableFlags::N150
767  | SvxZoomEnableFlags::N200
768  | SvxZoomEnableFlags::WHOLEPAGE
769  | SvxZoomEnableFlags::PAGEWIDTH;
770 
771  if ( rMark.IsMarked() || rMark.IsMultiMarked() )
772  nBtnFlags = nBtnFlags | SvxZoomEnableFlags::OPTIMAL;
773 
774  aZoomItem.SetValueSet( nBtnFlags );
775  aSet.Put( aZoomItem );
777  pDlg.disposeAndReset(pFact->CreateSvxZoomDialog(GetFrameWeld(), aSet));
778  pDlg->SetLimits( MINZOOM, MAXZOOM );
779 
780  bCancel = ( RET_CANCEL == pDlg->Execute() );
781 
782  // bCancel is True only if we were in the previous if block,
783  // so no need to check again pDlg
784  if ( !bCancel )
785  {
786  const SvxZoomItem& rZoomItem = pDlg->GetOutputItemSet()->
787  Get( SID_ATTR_ZOOM );
788 
789  eNewZoomType = rZoomItem.GetType();
790  nZoom = rZoomItem.GetValue();
791  }
792  }
793 
794  if ( !bCancel )
795  {
796  if ( eNewZoomType == SvxZoomType::PERCENT )
797  {
798  if ( nZoom < MINZOOM ) nZoom = MINZOOM;
799  if ( nZoom > MAXZOOM ) nZoom = MAXZOOM;
800  }
801  else
802  {
803  nZoom = CalcZoom( eNewZoomType, nOldZoom );
804  bCancel = nZoom == 0;
805  }
806 
807  switch ( eNewZoomType )
808  {
809  case SvxZoomType::WHOLEPAGE:
810  case SvxZoomType::PAGEWIDTH:
811  SetZoomType( eNewZoomType, bSyncZoom );
812  break;
813 
814  default:
815  SetZoomType( SvxZoomType::PERCENT, bSyncZoom );
816  }
817  }
818 
819  if ( nZoom != nOldZoom && !bCancel )
820  {
821  if (!GetViewData().IsPagebreakMode())
822  {
823  ScAppOptions aNewOpt = pScMod->GetAppOptions();
824  aNewOpt.SetZoom( nZoom );
825  aNewOpt.SetZoomType( GetZoomType() );
826  pScMod->SetAppOptions( aNewOpt );
827  }
828  Fraction aFract( nZoom, 100 );
829  SetZoom( aFract, aFract, bSyncZoom );
830  PaintGrid();
831  PaintTop();
832  PaintLeft();
833  rBindings.Invalidate( SID_ATTR_ZOOM );
834  rReq.AppendItem( SvxZoomItem( GetZoomType(), nZoom, nSlot ) );
835  rReq.Done();
836  }
837  }
838  break;
839 
840  case SID_ATTR_ZOOMSLIDER:
841  {
842  const SfxPoolItem* pItem = nullptr;
843  bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom();
844  if ( pReqArgs && pReqArgs->GetItemState(SID_ATTR_ZOOMSLIDER, true, &pItem) == SfxItemState::SET )
845  {
846  const sal_uInt16 nCurrentZoom = static_cast<const SvxZoomSliderItem *>(pItem)->GetValue();
847  if( nCurrentZoom )
848  {
849  SetZoomType( SvxZoomType::PERCENT, bSyncZoom );
850  if (!GetViewData().IsPagebreakMode())
851  {
852  ScAppOptions aNewOpt = pScMod->GetAppOptions();
853  aNewOpt.SetZoom( nCurrentZoom );
854  collectUIInformation(OUString::number(nCurrentZoom));
855  aNewOpt.SetZoomType( GetZoomType() );
856  pScMod->SetAppOptions( aNewOpt );
857  }
858  Fraction aFract( nCurrentZoom,100 );
859  SetZoom( aFract, aFract, bSyncZoom );
860  PaintGrid();
861  PaintTop();
862  PaintLeft();
863  rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
864  rBindings.Invalidate( SID_ZOOM_IN );
865  rBindings.Invalidate( SID_ZOOM_OUT );
866  rReq.Done();
867  }
868  }
869  }
870  break;
871 
872  case FID_TAB_SELECTALL:
873  SelectAllTables();
874  rReq.Done();
875  break;
876 
877  case FID_TAB_DESELECTALL:
879  rReq.Done();
880  break;
881 
882  case SID_SELECT_TABLES:
883  {
884  ScViewData& rViewData = GetViewData();
885  ScDocument& rDoc = rViewData.GetDocument();
886  ScMarkData& rMark = rViewData.GetMarkData();
887  SCTAB nTabCount = rDoc.GetTableCount();
888  SCTAB nTab;
889 
890  ::std::vector < sal_Int32 > aIndexList;
891  const SfxIntegerListItem* pItem = rReq.GetArg<SfxIntegerListItem>(SID_SELECT_TABLES);
892  if ( pItem )
893  aIndexList = pItem->GetList();
894  else
895  {
897 
899  pDlg->SetDescription(
900  ScResId( STR_DLG_SELECTTABLES_TITLE ),
901  ScResId( STR_DLG_SELECTTABLES_LBNAME ),
902  GetStaticInterface()->GetSlot(SID_SELECT_TABLES)->GetCommand(), HID_SELECTTABLES );
903 
904  // fill all table names with selection state
905  OUString aTabName;
906  for( nTab = 0; nTab < nTabCount; ++nTab )
907  {
908  rDoc.GetName( nTab, aTabName );
909  pDlg->Insert( aTabName, rMark.GetTableSelect( nTab ) );
910  }
911 
912  if( pDlg->Execute() == RET_OK )
913  {
914  aIndexList = pDlg->GetSelectedRows();
915  pDlg.disposeAndClear();
916  rReq.AppendItem( SfxIntegerListItem( SID_SELECT_TABLES, aIndexList ) );
917  }
918  else
919  rReq.Ignore();
920  }
921 
922  if ( !aIndexList.empty() )
923  {
924  sal_uInt16 nSelCount = aIndexList.size();
925  sal_uInt16 nSelIx;
926  SCTAB nFirstVisTab = 0;
927 
928  // special case: only hidden tables selected -> do nothing
929  bool bVisSelected = false;
930  for( nSelIx = 0; !bVisSelected && (nSelIx < nSelCount); ++nSelIx )
931  {
932  nFirstVisTab = static_cast<SCTAB>(aIndexList[nSelIx]);
933  bVisSelected = rDoc.IsVisible( nFirstVisTab );
934  }
935  if( !bVisSelected )
936  nSelCount = 0;
937 
938  // select the tables
939  if( nSelCount )
940  {
941  for( nTab = 0; nTab < nTabCount; ++nTab )
942  rMark.SelectTable( nTab, false );
943 
944  for( nSelIx = 0; nSelIx < nSelCount; ++nSelIx )
945  rMark.SelectTable( static_cast<SCTAB>(aIndexList[nSelIx]), true );
946 
947  // activate another table, if current is deselected
948  if( !rMark.GetTableSelect( rViewData.GetTabNo() ) )
949  {
950  rMark.SelectTable( nFirstVisTab, true );
951  SetTabNo( nFirstVisTab );
952  }
953 
954  rViewData.GetDocShell()->PostPaintExtras();
955  SfxBindings& rBind = rViewData.GetBindings();
956  rBind.Invalidate( FID_FILL_TAB );
957  rBind.Invalidate( FID_TAB_DESELECTALL );
958  }
959 
960  rReq.Done();
961  }
962  }
963  break;
964 
965  case SID_OUTLINE_DELETEALL:
967  rReq.Done();
968  break;
969 
970  case SID_AUTO_OUTLINE:
971  AutoOutline();
972  rReq.Done();
973  break;
974 
975  case SID_WINDOW_SPLIT:
976  {
977  ScSplitMode eHSplit = GetViewData().GetHSplitMode();
978  ScSplitMode eVSplit = GetViewData().GetVSplitMode();
979  if ( eHSplit == SC_SPLIT_NORMAL || eVSplit == SC_SPLIT_NORMAL ) // remove
980  RemoveSplit();
981  else if ( eHSplit == SC_SPLIT_FIX || eVSplit == SC_SPLIT_FIX ) // normal
982  FreezeSplitters( false );
983  else // create
984  SplitAtCursor();
985  rReq.Done();
986 
987  InvalidateSplit();
988  }
989  break;
990 
991  case SID_WINDOW_FIX:
992  {
994  {
995  ScSplitMode eHSplit = GetViewData().GetHSplitMode();
996  ScSplitMode eVSplit = GetViewData().GetVSplitMode();
997  if ( eHSplit == SC_SPLIT_FIX || eVSplit == SC_SPLIT_FIX ) // remove
998  RemoveSplit();
999  else
1000  FreezeSplitters( true, SC_SPLIT_METHOD_CURSOR); // create or fixate
1001  rReq.Done();
1002  InvalidateSplit();
1003  }
1004  else
1005  {
1006  ScViewData& rViewData = GetViewData();
1007  SCTAB nThisTab = rViewData.GetTabNo();
1008  bool bChangedX = false, bChangedY = false;
1009  if (rViewData.GetLOKSheetFreezeIndex(true) > 0 ||
1010  rViewData.GetLOKSheetFreezeIndex(false) > 0 ) // remove freeze
1011  {
1012  bChangedX = rViewData.RemoveLOKFreeze();
1013  } // create or fixate
1014  else
1015  {
1016  bChangedX = rViewData.SetLOKSheetFreezeIndex(rViewData.GetCurX(), true); // Freeze column
1017  bChangedY = rViewData.SetLOKSheetFreezeIndex(rViewData.GetCurY(), false); // Freeze row
1018  }
1019 
1020  rReq.Done();
1021  if (bChangedX || bChangedY)
1022  {
1023  rBindings.Invalidate( SID_WINDOW_FIX );
1024  rBindings.Invalidate( SID_WINDOW_FIX_COL );
1025  rBindings.Invalidate( SID_WINDOW_FIX_ROW );
1026  // Invalidate the slot for all views on the same tab of the document.
1027  SfxLokHelper::forEachOtherView(this, [nThisTab](ScTabViewShell* pOther) {
1028  ScViewData& rOtherViewData = pOther->GetViewData();
1029  if (rOtherViewData.GetTabNo() != nThisTab)
1030  return;
1031 
1032  SfxBindings& rOtherBind = rOtherViewData.GetBindings();
1033  rOtherBind.Invalidate( SID_WINDOW_FIX );
1034  rOtherBind.Invalidate( SID_WINDOW_FIX_COL );
1035  rOtherBind.Invalidate( SID_WINDOW_FIX_ROW );
1036  });
1037  if (!GetViewData().GetDocShell()->IsReadOnly())
1039  }
1040  }
1041  }
1042  break;
1043 
1044  case SID_WINDOW_FIX_COL:
1045  case SID_WINDOW_FIX_ROW:
1046  {
1047  bool bIsCol = (nSlot == SID_WINDOW_FIX_COL);
1048  sal_Int32 nFreezeIndex = 1;
1049  if (const SfxInt32Item* pItem = rReq.GetArg<SfxInt32Item>(nSlot))
1050  {
1051  nFreezeIndex = pItem->GetValue();
1052  if (nFreezeIndex < 0)
1053  nFreezeIndex = 0;
1054  }
1055 
1057  {
1058  ScViewData& rViewData = GetViewData();
1059  SCTAB nThisTab = rViewData.GetTabNo();
1060  bool bChanged = rViewData.SetLOKSheetFreezeIndex(nFreezeIndex, bIsCol);
1061  rReq.Done();
1062  if (bChanged)
1063  {
1064  rBindings.Invalidate( SID_WINDOW_FIX );
1065  rBindings.Invalidate(nSlot);
1066  // Invalidate the slot for all views on the same tab of the document.
1067  SfxLokHelper::forEachOtherView(this, [nSlot, nThisTab](ScTabViewShell* pOther) {
1068  ScViewData& rOtherViewData = pOther->GetViewData();
1069  if (rOtherViewData.GetTabNo() != nThisTab)
1070  return;
1071 
1072  SfxBindings& rOtherBind = rOtherViewData.GetBindings();
1073  rOtherBind.Invalidate( SID_WINDOW_FIX );
1074  rOtherBind.Invalidate(nSlot);
1075  });
1076  if (!GetViewData().GetDocShell()->IsReadOnly())
1078  }
1079  }
1080  else
1081  {
1082  FreezeSplitters( true, bIsCol ? SC_SPLIT_METHOD_COL : SC_SPLIT_METHOD_ROW, nFreezeIndex);
1083  rReq.Done();
1084  InvalidateSplit();
1085  }
1086  }
1087  break;
1088 
1089  case FID_CHG_SHOW:
1090  {
1091  sal_uInt16 nId = ScHighlightChgDlgWrapper::GetChildWindowId();
1092  SfxChildWindow* pWnd = pThisFrame->GetChildWindow( nId );
1093 
1094  pScMod->SetRefDialog( nId, pWnd == nullptr );
1095  }
1096  break;
1097 
1098  case FID_CHG_ACCEPT:
1099  {
1100  pThisFrame->ToggleChildWindow(ScAcceptChgDlgWrapper::GetChildWindowId());
1101  GetViewFrame()->GetBindings().Invalidate(FID_CHG_ACCEPT);
1102  rReq.Done ();
1103 
1104  /*
1105  sal_uInt16 nId = ScAcceptChgDlgWrapper::GetChildWindowId();
1106  SfxChildWindow* pWnd = pThisFrame->GetChildWindow( nId );
1107 
1108  pScMod->SetRefDialog( nId, pWnd ? sal_False : sal_True );
1109  */
1110  }
1111  break;
1112 
1113  case FID_CHG_COMMENT:
1114  {
1116  ScAddress aCursorPos( rData.GetCurX(), rData.GetCurY(), rData.GetTabNo() );
1117  ScDocShell* pDocSh = rData.GetDocShell();
1118 
1119  ScChangeAction* pAction = pDocSh->GetChangeAction( aCursorPos );
1120  if ( pAction )
1121  {
1122  const SfxPoolItem* pItem;
1123  if ( pReqArgs &&
1124  pReqArgs->GetItemState( nSlot, true, &pItem ) == SfxItemState::SET &&
1125  dynamic_cast<const SfxStringItem*>( pItem) != nullptr )
1126  {
1127  OUString aComment = static_cast<const SfxStringItem*>(pItem)->GetValue();
1128  pDocSh->SetChangeComment( pAction, aComment );
1129  rReq.Done();
1130  }
1131  else
1132  {
1133  pDocSh->ExecuteChangeCommentDialog(pAction, GetFrameWeld());
1134  rReq.Done();
1135  }
1136  }
1137  }
1138  break;
1139 
1140  case SID_CREATE_SW_DRAWVIEW:
1141  // is called by Forms, when the DrawView has to be created with all
1142  // the extras
1143  if (!GetScDrawView())
1144  {
1146  rBindings.InvalidateAll(false);
1147  }
1148  break;
1149 
1150  case FID_PROTECT_DOC:
1151  {
1152  ScDocument& rDoc = GetViewData().GetDocument();
1153 
1154  if( pReqArgs )
1155  {
1156  const SfxPoolItem* pItem;
1157  if( pReqArgs->HasItem( FID_PROTECT_DOC, &pItem ) &&
1158  static_cast<const SfxBoolItem*>(pItem)->GetValue() == rDoc.IsDocProtected() )
1159  {
1160  rReq.Ignore();
1161  break;
1162  }
1163  }
1164 
1165  ScDocProtection* pProtect = rDoc.GetDocProtection();
1166  if (pProtect && pProtect->isProtected())
1167  {
1168  bool bCancel = false;
1169  OUString aPassword;
1170 
1171  if (pProtect->isProtectedWithPass())
1172  {
1173  OUString aText(ScResId(SCSTR_PASSWORD));
1174 
1175  SfxPasswordDialog aDlg(GetFrameWeld(), &aText);
1176  aDlg.set_title(ScResId(SCSTR_UNPROTECTDOC));
1177  aDlg.SetMinLen(0);
1178  aDlg.set_help_id(GetStaticInterface()->GetSlot(FID_PROTECT_DOC)->GetCommand());
1180 
1181  if (aDlg.run() == RET_OK)
1182  aPassword = aDlg.GetPassword();
1183  else
1184  bCancel = true;
1185  }
1186  if (!bCancel)
1187  {
1188  Unprotect( TABLEID_DOC, aPassword );
1189  rReq.AppendItem( SfxBoolItem( FID_PROTECT_DOC, false ) );
1190  rReq.Done();
1191  }
1192  }
1193  else
1194  {
1195  OUString aText(ScResId(SCSTR_PASSWORDOPT));
1196 
1197  SfxPasswordDialog aDlg(GetFrameWeld(), &aText);
1198  aDlg.set_title(ScResId(SCSTR_PROTECTDOC));
1199  aDlg.SetMinLen( 0 );
1200  aDlg.set_help_id(GetStaticInterface()->GetSlot(FID_PROTECT_DOC)->GetCommand());
1202  aDlg.ShowExtras(SfxShowExtras::CONFIRM);
1204 
1205  if (aDlg.run() == RET_OK)
1206  {
1207  OUString aPassword = aDlg.GetPassword();
1208  ProtectDoc( aPassword );
1209  rReq.AppendItem( SfxBoolItem( FID_PROTECT_DOC, true ) );
1210  rReq.Done();
1211  }
1212  }
1213  rBindings.Invalidate( FID_PROTECT_DOC );
1214  }
1215  break;
1216 
1217  case FID_PROTECT_TABLE:
1218  {
1219  ScDocument& rDoc = GetViewData().GetDocument();
1220  SCTAB nTab = GetViewData().GetTabNo();
1221  bool bOldProtection = rDoc.IsTabProtected(nTab);
1222 
1223  if( pReqArgs )
1224  {
1225  const SfxPoolItem* pItem;
1226  bool bNewProtection = !bOldProtection;
1227  if( pReqArgs->HasItem( FID_PROTECT_TABLE, &pItem ) )
1228  bNewProtection = static_cast<const SfxBoolItem*>(pItem)->GetValue();
1229  if( bNewProtection == bOldProtection )
1230  {
1231  rReq.Ignore();
1232  break;
1233  }
1234  }
1235 
1236  if (bOldProtection)
1237  {
1238  // Unprotect a protected sheet.
1239 
1240  const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
1241  if (pProtect && pProtect->isProtectedWithPass())
1242  {
1243  OUString aText( ScResId(SCSTR_PASSWORDOPT) );
1244  SfxPasswordDialog aDlg(GetFrameWeld(), &aText);
1245  aDlg.set_title(ScResId(SCSTR_UNPROTECTTAB));
1246  aDlg.SetMinLen(0);
1247  aDlg.set_help_id(GetStaticInterface()->GetSlot(FID_PROTECT_TABLE)->GetCommand());
1249 
1250  if (aDlg.run() == RET_OK)
1251  {
1252  OUString aPassword = aDlg.GetPassword();
1253  Unprotect(nTab, aPassword);
1254  }
1255  }
1256  else
1257  // this sheet is not password-protected.
1258  Unprotect(nTab, OUString());
1259 
1260  if (!pReqArgs)
1261  {
1262  rReq.AppendItem( SfxBoolItem(FID_PROTECT_TABLE, false) );
1263  rReq.Done();
1264  }
1265  }
1266  else
1267  {
1268  // Protect a current sheet.
1269 
1271 
1272  const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
1273  if (pProtect)
1274  aDlg.SetDialogData(*pProtect);
1275 
1276  if (aDlg.run() == RET_OK)
1277  {
1278  pScMod->InputEnterHandler();
1279 
1280  ScTableProtection aNewProtect;
1281  aDlg.WriteData(aNewProtect);
1282  ProtectSheet(nTab, aNewProtect);
1283  if (!pReqArgs)
1284  {
1285  rReq.AppendItem( SfxBoolItem(FID_PROTECT_TABLE, true) );
1286  rReq.Done();
1287  }
1288  }
1289  }
1290  TabChanged();
1291  UpdateInputHandler(true); // to immediately enable input again
1292  SelectionChanged();
1293  }
1294  break;
1295 
1296  case SID_OPT_LOCALE_CHANGED :
1297  { // locale changed, SYSTEM number formats changed => repaint cell contents
1298  PaintGrid();
1299  rReq.Done();
1300  }
1301  break;
1302 
1303  default:
1304  OSL_FAIL("Unknown Slot at ScTabViewShell::Execute");
1305  break;
1306  }
1307 }
1308 
1309 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SC_DLLPUBLIC bool IsDocProtected() const
Definition: documen3.cxx:1895
#define MAXZOOM
Definition: global.hxx:77
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3047
static void ShowPanel(std::u16string_view rsPanelId, const css::uno::Reference< css::frame::XFrame > &rxFrame, bool bFocus=false)
void SetEditHelpId(const OString &rId)
SfxViewFrame * GetViewFrame() const
SvxZoomType GetZoomType() const
Definition: tabview5.cxx:409
void SetOption(ScViewOption eOpt, bool bNew)
Definition: viewopti.hxx:86
void Appear()
ScAddress aStart
Definition: address.hxx:499
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:353
void FreezeSplitters(bool bFreeze, SplitMethod eSplitMethod=SC_SPLIT_METHOD_CURSOR, SCCOLROW nFreezeIndex=-1)
Definition: tabview.cxx:1912
void RemoveManualBreaks()
Definition: viewfun2.cxx:974
SC_DLLPUBLIC bool IsTabProtected(SCTAB nTab) const
Definition: documen3.cxx:1906
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:42
SfxChildWindow * GetChildWindow(sal_uInt16)
static SfxInterface * GetStaticInterface()
RutlNameScope
Definition: rangeutl.hxx:35
SfxViewFrame * GetFrame() const
SCROW Row() const
Definition: address.hxx:261
OUString GetTitle(sal_uInt16 nMaxLen=0) const
void PostPaintGridAll()
Definition: docsh3.cxx:182
void SetPrintRanges(bool bEntireSheet, const OUString *pPrint, const OUString *pRepCol, const OUString *pRepRow, bool bAddPrint)
Definition: viewfun2.cxx:1013
std::string GetValue
bool PaintExtras()
Definition: tabview3.cxx:2753
bool SelectObject(std::u16string_view rName)
Definition: tabvwsh2.cxx:450
void MarkRange(const ScRange &rRange, bool bSetCursor=true, bool bContinue=false)
Definition: tabview3.cxx:1685
#define HID_PASSWD_TABLE
Definition: helpids.h:57
sheet protection state container
void SetHeaderMode(bool bNewMode)
Definition: viewdata.hxx:543
void SelectAllTables()
Definition: tabview2.cxx:1085
SfxDispatcher * GetDispatcher()
void SetPagebreakMode(bool bSet)
Definition: tabview5.cxx:435
static SvxAbstractDialogFactory * Create()
void RepeatResize(bool bUpdateFix=true)
Definition: tabview.cxx:772
long Long
void HideNoteMarker()
Definition: tabview2.cxx:1387
SCROW GetCurY() const
Definition: viewdata.hxx:401
SCCOLROW GetLOKSheetFreezeIndex(bool bIsCol) const
Definition: viewdata.cxx:4100
virtual bool isProtected() const override
void SetDocumentModified()
Definition: docsh.cxx:2820
sal_Int16 nId
const ContentProperties & rData
void PostPaintExtras()
Definition: docsh3.cxx:197
SCTAB GetTabNo() const
Definition: viewdata.hxx:394
void PaintGrid()
Definition: tabview3.cxx:2626
bool IsSyntaxMode() const
Definition: viewdata.hxx:540
ScAddress aEnd
Definition: address.hxx:500
void Done(bool bRemove=false)
ScDocument & GetDocument() const
Definition: viewdata.hxx:379
virtual bool isProtectedWithPass() const override
virtual short run() override
const SfxItemSet * GetArgs() const
void Invalidate(sal_uInt16 nId)
void TabChanged(bool bSameTabButMoved=false)
Called after moving, copying, inserting or deleting a sheet.
Definition: tabview5.cxx:282
static void forEachOtherView(ViewShellType *pThisViewShell, FunctionType f)
SC_DLLPUBLIC void SetCursor(SCCOL nPosX, SCROW nPosY, bool bNew=false)
Definition: tabview3.cxx:361
RET_CANCEL
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
Definition: documen3.cxx:494
virtual const SfxItemSet * GetOutputItemSet() const =0
SC_DLLPUBLIC void InputEnterHandler(ScEnterMode nBlockMode=ScEnterMode::NORMAL)
Definition: scmod.cxx:1360
SC_DLLPUBLIC void MoveCursorAbs(SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, bool bShift, bool bControl, bool bKeepOld=false, bool bKeepSel=false)
Definition: tabview3.cxx:1188
NONE
void GetMarkArea(ScRange &rRange) const
Definition: markdata.cxx:112
void DeselectAllTables()
Definition: tabview2.cxx:1103
void ToggleChildWindow(sal_uInt16)
#define HID_PASSWD_DOC_CONFIRM
Definition: helpids.h:59
static UITestLogger & getInstance()
void logEvent(const EventDescription &rDescription)
void disposeAndReset(reference_type *pBody)
void PaintLeft()
Definition: tabview3.cxx:2702
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:871
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:313
void SetConfirmHelpId(const OString &rId)
bool Unprotect(SCTAB nTab, const OUString &rPassword)
Definition: viewfunc.cxx:2555
bool IsMultiMarked() const
Definition: markdata.hxx:82
SfxFrame & GetFrame() const
SC_DLLPUBLIC void SetRefDialog(sal_uInt16 nId, bool bVis, SfxViewFrame *pViewFrm=nullptr)
Reference dialogs.
Definition: scmod.cxx:1468
void SetOptions(const ScViewOptions &rOpt)
Definition: viewdata.cxx:3871
SC_DLLPUBLIC bool GetTable(const OUString &rName, SCTAB &rTab) const
Definition: document.cxx:259
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
Definition: tabvwsha.cxx:653
SCTAB Tab() const
Definition: address.hxx:270
void SetRow(SCROW nRowP)
Definition: address.hxx:274
ScSplitMode GetHSplitMode() const
Definition: viewdata.hxx:415
bool isdigitAsciiString(const OString &rString)
const Fraction & GetZoomY() const
Definition: viewdata.hxx:459
void SetCol(SCCOL nColP)
Definition: address.hxx:278
ScDrawLayer * MakeDrawLayer()
Definition: docsh2.cxx:169
ScViewData & GetViewData()
Definition: tabview.hxx:333
void PaintTop()
Definition: tabview3.cxx:2637
void SelectionChanged(bool bFromPaste=false)
Definition: tabview3.cxx:531
SfxItemPool & GetPool() const
bool PasteFile(const Point &, const OUString &, bool bLink)
Definition: viewfun4.cxx:580
tools::Long zoomOut(tools::Long nCurrent)
SC_DLLPUBLIC void SetAppOptions(const ScAppOptions &rOpt)
Definition: scmod.cxx:715
void AutoOutline()
Definition: dbfunc3.cxx:213
SC_DLLPUBLIC ScDocProtection * GetDocProtection() const
Definition: documen3.cxx:1882
void SetTab(SCTAB nTabP)
Definition: address.hxx:282
void SetZoom(const Fraction &rNewX, const Fraction &rNewY, bool bAll)
Definition: tabview5.cxx:419
bool IsMarked() const
Definition: markdata.hxx:81
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
void SelectTable(SCTAB nTab, bool bNew)
Definition: markdata.cxx:172
SfxBindings & GetBindings()
Definition: viewdata.cxx:3035
virtual VclPtr< AbstractScShowTabDlg > CreateScShowTabDlg(weld::Window *pParent)=0
sal_Int16 SCCOL
Definition: types.hxx:21
tools::Long zoomIn(tools::Long nCurrent)
#define SC_MOD()
Definition: scmod.hxx:249
SfxBindings & GetBindings()
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
Definition: tabview3.cxx:1796
SC_DLLPUBLIC const ScAppOptions & GetAppOptions()
Definition: scmod.cxx:728
const T * GetArg(sal_uInt16 nSlotId) const
void ShowExtras(SfxShowExtras nExtras)
float u
OUString ScResId(const char *pId)
Definition: scdll.cxx:89
bool GetOption(ScViewOption eOpt) const
Definition: viewopti.hxx:87
void RemoveAllOutlines(bool bRecord=true)
Definition: dbfunc3.cxx:193
void InvalidateSplit()
Definition: tabview.cxx:2111
sal_uInt16 CalcZoom(SvxZoomType eType, sal_uInt16 nOldZoom)
Definition: tabview2.cxx:1181
void RemoveSplit()
Definition: tabview.cxx:2067
void SplitAtCursor()
Definition: tabview.cxx:2074
void SetDialogData(const ScTableProtection &rData)
void SetZoom(sal_uInt16 nNew)
Definition: appoptio.hxx:41
bool SetLOKSheetFreezeIndex(const SCCOLROW nFreezeIndex, bool bIsCol, SCTAB nForTab=-1)
Definition: viewdata.cxx:4106
SfxViewShell * GetViewShell() const
const SCTAB TABLEID_DOC
Definition: address.hxx:84
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
SCCOL Col() const
Definition: address.hxx:266
static bool MakeRangeFromName(const OUString &rName, const ScDocument &rDoc, SCTAB nCurTab, ScRange &rRange, RutlNameScope eScope=RUTL_NAMES, ScAddress::Details const &rDetails=ScAddress::detailsOOOa1)
Definition: rangeutl.cxx:233
bool IsReadOnly() const
#define HID_SELECTTABLES
Definition: helpids.h:63
void SetMinLen(sal_uInt16 Len)
virtual void SetLimits(sal_uInt16 nMin, sal_uInt16 nMax)=0
void DetectiveDelAll()
Definition: viewfun6.cxx:104
void SetReturnValue(const SfxPoolItem &)
void SetPrintZoom(sal_uInt16 nScale)
Definition: viewfun2.cxx:998
void Update(sal_uInt16 nId)
void SkipOverlapped(SCCOL &rCol, SCROW &rRow, SCTAB nTab) const
Definition: document.cxx:5707
sal_Int32 SCROW
Definition: types.hxx:17
sal_uInt16 GetSlot() const
SC_DLLPUBLIC void PutInOrder()
Definition: address.cxx:1582
bool ValidRow(SCROW nRow) const
Definition: document.hxx:874
weld::Window * GetFrameWeld() const
void SetCurSubShell(ObjectSelectionType eOST, bool bForce=false)
Definition: tabvwsh4.cxx:768
void ProtectSheet(SCTAB nTab, const ScTableProtection &rProtect)
Definition: viewfunc.cxx:2515
ScDrawView * GetScDrawView()
Definition: tabview.hxx:341
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
SvxZoomEnableFlags
bool IsInPlace() const
static SfxObjectShell * GetFirst(const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
void ErrorMessage(const char *pGlobStrId)
Definition: tabview2.cxx:1413
SvxZoomType GetType() const
bool IsHeaderMode() const
Definition: viewdata.hxx:542
static SfxViewShell * Get(const css::uno::Reference< css::frame::XController > &i_rController)
OUString aName
static SC_DLLPUBLIC ScAbstractDialogFactory * Create()
Definition: scabstdlg.cxx:37
RET_OK
SC_DLLPUBLIC ScRefFlags Parse(const OUString &, const ScDocument &, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, ScAddress::ExternalInfo *pExtInfo=nullptr, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks=nullptr, const OUString *pErrRef=nullptr)
Definition: address.cxx:1742
void SetChildWindow(sal_uInt16 nId, bool bVisible, bool bSetFocus=true)
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
OUString GetPassword() const
const ScViewOptions & GetOptions() const
Definition: viewdata.hxx:536
virtual short run()
void SetZoomType(SvxZoomType eNew)
Definition: appoptio.hxx:43
void AlignToCursor(SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, const ScSplitPos *pWhich=nullptr)
Definition: tabview3.cxx:914
void ShowChildWindow(sal_uInt16, bool bVisible=true)
ScSplitMode
Definition: viewdata.hxx:42
void HideListBox()
Definition: tabview3.cxx:2962
void SetZoomType(SvxZoomType eNew, bool bAll)
Definition: tabview5.cxx:414
ObjectSelectionType GetCurObjectSelectionType() const
Definition: tabvwsh.hxx:297
void Execute(SfxRequest &rReq)
Definition: tabvwsh3.cxx:164
static SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
void InvalidateAll(bool bWithMsg)
SC_DLLPUBLIC bool IsVisible(SCTAB nTab) const
Definition: document.cxx:907
void AppendItem(const SfxPoolItem &)
Point GetInsertPos() const
Definition: tabview.cxx:1669
void SetSyntaxMode(bool bNewMode)
Definition: viewdata.hxx:541
DetectFlags
Definition: tabvwsh3.cxx:75
#define MINZOOM
Definition: global.hxx:76
static SfxObjectShell * GetNext(const SfxObjectShell &rPrev, const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
bool IsAPI() const
SC_DLLPUBLIC ScRefFlags Parse(const OUString &, const ScDocument &, const Details &rDetails=detailsOOOa1, ExternalInfo *pExtInfo=nullptr, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks=nullptr, sal_Int32 *pSheetEndPos=nullptr, const OUString *pErrRef=nullptr)
Definition: address.cxx:1548
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
SvxZoomType
ScRefFlags
Definition: address.hxx:144
bool GetTableSelect(SCTAB nTab) const
Definition: markdata.cxx:184
void ProtectDoc(const OUString &rPassword)
Definition: viewfunc.cxx:2545
std::map< OUString, OUString > aParameters
bool IsPagebreakMode() const
Definition: viewdata.hxx:424
const std::vector< sal_Int32 > & GetList() const
void WriteData(ScTableProtection &rData) const
void Ignore()
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
Definition: document.cxx:212
void UpdatePageBreakData(bool bForcePaint=false)
Definition: tabview2.cxx:1446
ScSplitMode GetVSplitMode() const
Definition: viewdata.hxx:416
virtual VclPtr< AbstractSvxZoomDialog > CreateSvxZoomDialog(weld::Window *pParent, const SfxItemSet &rCoreSet)=0
virtual bool isProtectedWithPass() const override
sal_Int16 SCTAB
Definition: types.hxx:22
void AdjustPrintZoom()
Definition: viewfun2.cxx:1005
void ResetOldCursor()
Definition: viewdata.cxx:1337
bool RemoveLOKFreeze()
Definition: viewdata.cxx:4122
SCCOL GetCurX() const
Definition: viewdata.hxx:400
SC_DLLPUBLIC const ScTableProtection * GetTabProtection(SCTAB nTab) const
Definition: documen3.cxx:1915
#define HID_PASSWD_DOC
Definition: helpids.h:58
static OUString decode(OUString const &rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)