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);
377  ScAddress::Details aDetails( rDoc.GetAddressConvention(), rViewData.GetCurY(), rViewData.GetCurX());
378  if (ScRangeUtil::MakeRangeFromName( aAddress, rDoc, nTab, aScRange, eScope, aDetails, true) ||
379  ScRangeUtil::MakeRangeFromName( aAddress, rDoc, nTab, aScRange, RUTL_DBASE, aDetails, true))
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  if ( nSlot == SID_JUMPTOMARK && comphelper::LibreOfficeKit::isActive() )
476  rViewData.GetActiveWin()->notifyKitCellFollowJump();
477  }
478 
479  rReq.SetReturnValue( SfxStringItem( SID_CURRENTCELL, aAddress ) );
480  }
481 
482  if (!bFound) // no valid range
483  {
484  // if it is a sheet name, then switch (for Navigator/URL)
485 
486  SCTAB nNameTab;
487  if ( rDoc.GetTable( aAddress, nNameTab ) )
488  {
489  bFound = true;
490  if ( nNameTab != nTab )
491  SetTabNo( nNameTab );
492  }
493  }
494 
495  if ( !bFound && nSlot == SID_JUMPTOMARK )
496  {
497  // test graphics objects (only for URL)
498 
499  bFound = SelectObject( aAddress );
500  }
501 
502  if (!bFound && !rReq.IsAPI())
503  ErrorMessage( STR_ERR_INVALID_AREA );
504  }
505  break;
506 
507  case SID_CURRENTOBJECT:
508  if ( pReqArgs )
509  {
510  OUString aName = static_cast<const SfxStringItem&>(pReqArgs->Get(nSlot)).GetValue();
511  SelectObject( aName );
512  }
513  break;
514 
515  case SID_CURRENTTAB:
516  if ( pReqArgs )
517  {
518  // sheet for basic is one-based
519  SCTAB nTab = static_cast<const SfxUInt16Item&>(pReqArgs->Get(nSlot)).GetValue() - 1;
520  ScDocument& rDoc = GetViewData().GetDocument();
521  if ( nTab < rDoc.GetTableCount() )
522  {
523  SetTabNo( nTab );
524  rBindings.Update( nSlot );
525 
526  if( ! rReq.IsAPI() )
527  rReq.Done();
528  }
530  }
531  break;
532 
533  case SID_CURRENTDOC:
534  if ( pReqArgs )
535  {
536  OUString aStrDocName( static_cast<const SfxStringItem&>(pReqArgs->
537  Get(nSlot)).GetValue() );
538 
539  SfxViewFrame* pViewFrame = nullptr;
540  ScDocShell* pDocSh = static_cast<ScDocShell*>(SfxObjectShell::GetFirst());
541  bool bFound = false;
542 
543  // search for ViewFrame to be activated
544 
545  while ( pDocSh && !bFound )
546  {
547  if ( pDocSh->GetTitle() == aStrDocName )
548  {
549  pViewFrame = SfxViewFrame::GetFirst( pDocSh );
550  bFound = ( nullptr != pViewFrame );
551  }
552 
553  pDocSh = static_cast<ScDocShell*>(SfxObjectShell::GetNext( *pDocSh ));
554  }
555 
556  if ( bFound )
557  pViewFrame->GetFrame().Appear();
558 
559  rReq.Ignore();//XXX is handled by SFX
560  }
561  break;
562 
563  case SID_PRINTPREVIEW:
564  {
565  if ( !pThisFrame->GetFrame().IsInPlace() ) // not for OLE
566  {
567  // print preview is now always in the same frame as the tab view
568  // -> always switch this frame back to normal view
569  // (ScPreviewShell ctor reads view data)
570 
571  // #102785#; finish input
572  pScMod->InputEnterHandler();
573 
574  pThisFrame->GetDispatcher()->Execute( SID_VIEWSHELL1, SfxCallMode::ASYNCHRON );
575  }
576  // else error (e.g. Ole)
577  }
578  break;
579 
580  case SID_DETECTIVE_DEL_ALL:
581  DetectiveDelAll();
582  rReq.Done();
583  break;
584 
585  // SID_TABLE_ACTIVATE and SID_MARKAREA are called by basic for the
586  // hidden View, to mark/switch on the visible View:
587 
588  case SID_TABLE_ACTIVATE:
589  OSL_FAIL("old slot SID_TABLE_ACTIVATE");
590  break;
591 
592  case SID_REPAINT:
593  PaintGrid();
594  PaintTop();
595  PaintLeft();
596  PaintExtras();
597  rReq.Done();
598  break;
599 
600  case FID_NORMALVIEWMODE:
601  case FID_PAGEBREAKMODE:
602  {
603  bool bWantPageBreak = nSlot == FID_PAGEBREAKMODE;
604 
605  // check whether there is an explicit argument, use it
606  const SfxPoolItem* pItem;
607  if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET )
608  {
609  bool bItemValue = static_cast<const SfxBoolItem*>(pItem)->GetValue();
610  bWantPageBreak = (nSlot == FID_PAGEBREAKMODE) == bItemValue;
611  }
612 
613  if( GetViewData().IsPagebreakMode() != bWantPageBreak )
614  {
615  SetPagebreakMode( bWantPageBreak );
618  PaintGrid();
619  PaintTop();
620  PaintLeft();
621  rBindings.Invalidate( nSlot );
622  rReq.AppendItem( SfxBoolItem( nSlot, true ) );
623  rReq.Done();
624  }
625  }
626  break;
627 
628  case FID_FUNCTION_BOX:
629  {
630  // First make sure that the sidebar is visible
631  pThisFrame->ShowChildWindow(SID_SIDEBAR);
632 
633  ::sfx2::sidebar::Sidebar::ShowPanel(u"ScFunctionsPanel",
634  pThisFrame->GetFrame().GetFrameInterface());
635  rReq.Done ();
636  }
637  break;
638 
639  case FID_TOGGLESYNTAX:
640  {
641  bool bSet = !GetViewData().IsSyntaxMode();
642  const SfxPoolItem* pItem;
643  if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET )
644  bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue();
645  GetViewData().SetSyntaxMode( bSet );
646  PaintGrid();
647  rBindings.Invalidate( FID_TOGGLESYNTAX );
648  rReq.AppendItem( SfxBoolItem( nSlot, bSet ) );
649  rReq.Done();
650  }
651  break;
652  case FID_TOGGLEHEADERS:
653  {
654  bool bSet = !GetViewData().IsHeaderMode();
655  const SfxPoolItem* pItem;
656  if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET )
657  bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue();
658  GetViewData().SetHeaderMode( bSet );
659  RepeatResize();
660  rBindings.Invalidate( FID_TOGGLEHEADERS );
661  rReq.AppendItem( SfxBoolItem( nSlot, bSet ) );
662  rReq.Done();
663  }
664  break;
665 
666  case FID_TOGGLEFORMULA:
667  {
668  ScViewData& rViewData = GetViewData();
669  const ScViewOptions& rOpts = rViewData.GetOptions();
670  bool bFormulaMode = !rOpts.GetOption( VOPT_FORMULAS );
671  const SfxPoolItem *pItem;
672  if( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET )
673  bFormulaMode = static_cast<const SfxBoolItem *>(pItem)->GetValue();
674 
675  ScViewOptions aSetOpts = rOpts;
676  aSetOpts.SetOption( VOPT_FORMULAS, bFormulaMode );
677  rViewData.SetOptions( aSetOpts );
678 
679  rViewData.GetDocShell()->PostPaintGridAll();
680 
681  rBindings.Invalidate( FID_TOGGLEFORMULA );
682  rReq.AppendItem( SfxBoolItem( nSlot, bFormulaMode ) );
683  rReq.Done();
684  }
685  break;
686 
687  case FID_TOGGLEINPUTLINE:
688  {
689  sal_uInt16 nId = ScInputWindowWrapper::GetChildWindowId();
690  SfxChildWindow* pWnd = pThisFrame->GetChildWindow( nId );
691  bool bSet = ( pWnd == nullptr );
692  const SfxPoolItem* pItem;
693  if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET )
694  bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue();
695 
696  pThisFrame->SetChildWindow( nId, bSet );
697  rBindings.Invalidate( FID_TOGGLEINPUTLINE );
698  rReq.AppendItem( SfxBoolItem( nSlot, bSet ) );
699  rReq.Done();
700  }
701  break;
702 
703  // handling for SID_ZOOM_IN and SID_ZOOM_OUT is ScTabView::ScrollCommand
704  // CommandWheelMode::ZOOM inspired
705  case SID_ZOOM_IN:
706  case SID_ZOOM_OUT:
707  {
708  HideNoteMarker();
709 
710  if (!GetViewData().GetViewShell()->GetViewFrame()->GetFrame().IsInPlace())
711  {
712  // for ole inplace editing, the scale is defined by the visarea and client size
713  // and can't be changed directly
714 
715  const Fraction& rOldY = GetViewData().GetZoomY();
716  tools::Long nOld = tools::Long(rOldY * 100);
717  tools::Long nNew;
718  if (SID_ZOOM_OUT == nSlot)
719  nNew = std::max(tools::Long(MINZOOM), basegfx::zoomtools::zoomOut(nOld));
720  else
721  nNew = std::min(tools::Long(MAXZOOM), basegfx::zoomtools::zoomIn(nOld));
722  if ( nNew != nOld)
723  {
724  bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom();
725  SetZoomType(SvxZoomType::PERCENT, bSyncZoom);
726  Fraction aFract(nNew, 100);
727  SetZoom(aFract, aFract, bSyncZoom);
728  PaintGrid();
729  PaintTop();
730  PaintLeft();
731  rBindings.Invalidate(SID_ATTR_ZOOM);
732  rBindings.Invalidate(SID_ATTR_ZOOMSLIDER);
733  rBindings.Invalidate(SID_ZOOM_IN);
734  rBindings.Invalidate(SID_ZOOM_OUT);
735  rReq.Done();
736  }
737  }
738  }
739  break;
740 
741  case SID_ATTR_ZOOM: // status row
742  case FID_SCALE:
743  {
744  bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom();
745  SvxZoomType eOldZoomType = GetZoomType();
746  SvxZoomType eNewZoomType = eOldZoomType;
747  const Fraction& rOldY = GetViewData().GetZoomY(); // Y is shown
748  sal_uInt16 nOldZoom = static_cast<sal_uInt16>(tools::Long( rOldY * 100 ));
749  sal_uInt16 nZoom = nOldZoom;
750  bool bCancel = false;
751 
752  if ( pReqArgs )
753  {
754  const SvxZoomItem& rZoomItem = pReqArgs->Get(SID_ATTR_ZOOM);
755 
756  eNewZoomType = rZoomItem.GetType();
757  nZoom = rZoomItem.GetValue();
758  }
759  else
760  {
762  SvxZoomItem aZoomItem( eOldZoomType, nOldZoom, SID_ATTR_ZOOM );
764  ScMarkData& rMark = GetViewData().GetMarkData();
765  SvxZoomEnableFlags nBtnFlags = SvxZoomEnableFlags::N50
766  | SvxZoomEnableFlags::N75
767  | SvxZoomEnableFlags::N100
768  | SvxZoomEnableFlags::N150
769  | SvxZoomEnableFlags::N200
770  | SvxZoomEnableFlags::WHOLEPAGE
771  | SvxZoomEnableFlags::PAGEWIDTH;
772 
773  if ( rMark.IsMarked() || rMark.IsMultiMarked() )
774  nBtnFlags = nBtnFlags | SvxZoomEnableFlags::OPTIMAL;
775 
776  aZoomItem.SetValueSet( nBtnFlags );
777  aSet.Put( aZoomItem );
779  pDlg.disposeAndReset(pFact->CreateSvxZoomDialog(GetFrameWeld(), aSet));
780  pDlg->SetLimits( MINZOOM, MAXZOOM );
781 
782  bCancel = ( RET_CANCEL == pDlg->Execute() );
783 
784  // bCancel is True only if we were in the previous if block,
785  // so no need to check again pDlg
786  if ( !bCancel )
787  {
788  const SvxZoomItem& rZoomItem = pDlg->GetOutputItemSet()->
789  Get( SID_ATTR_ZOOM );
790 
791  eNewZoomType = rZoomItem.GetType();
792  nZoom = rZoomItem.GetValue();
793  }
794  }
795 
796  if ( !bCancel )
797  {
798  if ( eNewZoomType == SvxZoomType::PERCENT )
799  {
800  if ( nZoom < MINZOOM ) nZoom = MINZOOM;
801  if ( nZoom > MAXZOOM ) nZoom = MAXZOOM;
802  }
803  else
804  {
805  nZoom = CalcZoom( eNewZoomType, nOldZoom );
806  bCancel = nZoom == 0;
807  }
808 
809  switch ( eNewZoomType )
810  {
811  case SvxZoomType::WHOLEPAGE:
812  case SvxZoomType::PAGEWIDTH:
813  SetZoomType( eNewZoomType, bSyncZoom );
814  break;
815 
816  default:
817  SetZoomType( SvxZoomType::PERCENT, bSyncZoom );
818  }
819  }
820 
821  if ( nZoom != nOldZoom && !bCancel )
822  {
823  if (!GetViewData().IsPagebreakMode())
824  {
825  ScAppOptions aNewOpt = pScMod->GetAppOptions();
826  aNewOpt.SetZoom( nZoom );
827  aNewOpt.SetZoomType( GetZoomType() );
828  pScMod->SetAppOptions( aNewOpt );
829  }
830  Fraction aFract( nZoom, 100 );
831  SetZoom( aFract, aFract, bSyncZoom );
832  PaintGrid();
833  PaintTop();
834  PaintLeft();
835  rBindings.Invalidate( SID_ATTR_ZOOM );
836  rReq.AppendItem( SvxZoomItem( GetZoomType(), nZoom, nSlot ) );
837  rReq.Done();
838  }
839  }
840  break;
841 
842  case SID_ATTR_ZOOMSLIDER:
843  {
844  const SfxPoolItem* pItem = nullptr;
845  bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom();
846  if ( pReqArgs && pReqArgs->GetItemState(SID_ATTR_ZOOMSLIDER, true, &pItem) == SfxItemState::SET )
847  {
848  const sal_uInt16 nCurrentZoom = static_cast<const SvxZoomSliderItem *>(pItem)->GetValue();
849  if( nCurrentZoom )
850  {
851  SetZoomType( SvxZoomType::PERCENT, bSyncZoom );
852  if (!GetViewData().IsPagebreakMode())
853  {
854  ScAppOptions aNewOpt = pScMod->GetAppOptions();
855  aNewOpt.SetZoom( nCurrentZoom );
856  collectUIInformation(OUString::number(nCurrentZoom));
857  aNewOpt.SetZoomType( GetZoomType() );
858  pScMod->SetAppOptions( aNewOpt );
859  }
860  Fraction aFract( nCurrentZoom,100 );
861  SetZoom( aFract, aFract, bSyncZoom );
862  PaintGrid();
863  PaintTop();
864  PaintLeft();
865  rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
866  rBindings.Invalidate( SID_ZOOM_IN );
867  rBindings.Invalidate( SID_ZOOM_OUT );
868  rReq.Done();
869  }
870  }
871  }
872  break;
873 
874  case FID_TAB_SELECTALL:
875  SelectAllTables();
876  rReq.Done();
877  break;
878 
879  case FID_TAB_DESELECTALL:
881  rReq.Done();
882  break;
883 
884  case SID_SELECT_TABLES:
885  {
886  ScViewData& rViewData = GetViewData();
887  ScDocument& rDoc = rViewData.GetDocument();
888  ScMarkData& rMark = rViewData.GetMarkData();
889  SCTAB nTabCount = rDoc.GetTableCount();
890  SCTAB nTab;
891 
892  ::std::vector < sal_Int32 > aIndexList;
893  const SfxIntegerListItem* pItem = rReq.GetArg<SfxIntegerListItem>(SID_SELECT_TABLES);
894  if ( pItem )
895  aIndexList = pItem->GetList();
896  else
897  {
899 
901  pDlg->SetDescription(
902  ScResId( STR_DLG_SELECTTABLES_TITLE ),
903  ScResId( STR_DLG_SELECTTABLES_LBNAME ),
904  GetStaticInterface()->GetSlot(SID_SELECT_TABLES)->GetCommand(), HID_SELECTTABLES );
905 
906  // fill all table names with selection state
907  OUString aTabName;
908  for( nTab = 0; nTab < nTabCount; ++nTab )
909  {
910  rDoc.GetName( nTab, aTabName );
911  pDlg->Insert( aTabName, rMark.GetTableSelect( nTab ) );
912  }
913 
914  if( pDlg->Execute() == RET_OK )
915  {
916  aIndexList = pDlg->GetSelectedRows();
917  pDlg.disposeAndClear();
918  rReq.AppendItem( SfxIntegerListItem( SID_SELECT_TABLES, std::vector(aIndexList) ) );
919  }
920  else
921  rReq.Ignore();
922  }
923 
924  if ( !aIndexList.empty() )
925  {
926  sal_uInt16 nSelCount = aIndexList.size();
927  sal_uInt16 nSelIx;
928  SCTAB nFirstVisTab = 0;
929 
930  // special case: only hidden tables selected -> do nothing
931  bool bVisSelected = false;
932  for( nSelIx = 0; !bVisSelected && (nSelIx < nSelCount); ++nSelIx )
933  {
934  nFirstVisTab = static_cast<SCTAB>(aIndexList[nSelIx]);
935  bVisSelected = rDoc.IsVisible( nFirstVisTab );
936  }
937  if( !bVisSelected )
938  nSelCount = 0;
939 
940  // select the tables
941  if( nSelCount )
942  {
943  for( nTab = 0; nTab < nTabCount; ++nTab )
944  rMark.SelectTable( nTab, false );
945 
946  for( nSelIx = 0; nSelIx < nSelCount; ++nSelIx )
947  rMark.SelectTable( static_cast<SCTAB>(aIndexList[nSelIx]), true );
948 
949  // activate another table, if current is deselected
950  if( !rMark.GetTableSelect( rViewData.GetTabNo() ) )
951  {
952  rMark.SelectTable( nFirstVisTab, true );
953  SetTabNo( nFirstVisTab );
954  }
955 
956  rViewData.GetDocShell()->PostPaintExtras();
957  SfxBindings& rBind = rViewData.GetBindings();
958  rBind.Invalidate( FID_FILL_TAB );
959  rBind.Invalidate( FID_TAB_DESELECTALL );
960  }
961 
962  rReq.Done();
963  }
964  }
965  break;
966 
967  case SID_OUTLINE_DELETEALL:
969  rReq.Done();
970  break;
971 
972  case SID_AUTO_OUTLINE:
973  AutoOutline();
974  rReq.Done();
975  break;
976 
977  case SID_WINDOW_SPLIT:
978  {
979  ScSplitMode eHSplit = GetViewData().GetHSplitMode();
980  ScSplitMode eVSplit = GetViewData().GetVSplitMode();
981  if ( eHSplit == SC_SPLIT_NORMAL || eVSplit == SC_SPLIT_NORMAL ) // remove
982  RemoveSplit();
983  else if ( eHSplit == SC_SPLIT_FIX || eVSplit == SC_SPLIT_FIX ) // normal
984  FreezeSplitters( false );
985  else // create
986  SplitAtCursor();
987  rReq.Done();
988 
989  InvalidateSplit();
990  }
991  break;
992 
993  case SID_WINDOW_FIX:
994  {
996  {
997  ScSplitMode eHSplit = GetViewData().GetHSplitMode();
998  ScSplitMode eVSplit = GetViewData().GetVSplitMode();
999  if ( eHSplit == SC_SPLIT_FIX || eVSplit == SC_SPLIT_FIX ) // remove
1000  RemoveSplit();
1001  else
1002  FreezeSplitters( true, SC_SPLIT_METHOD_CURSOR); // create or fixate
1003  rReq.Done();
1004  InvalidateSplit();
1005  }
1006  else
1007  {
1008  ScViewData& rViewData = GetViewData();
1009  SCTAB nThisTab = rViewData.GetTabNo();
1010  bool bChangedX = false, bChangedY = false;
1011  if (rViewData.GetLOKSheetFreezeIndex(true) > 0 ||
1012  rViewData.GetLOKSheetFreezeIndex(false) > 0 ) // remove freeze
1013  {
1014  bChangedX = rViewData.RemoveLOKFreeze();
1015  } // create or fixate
1016  else
1017  {
1018  bChangedX = rViewData.SetLOKSheetFreezeIndex(rViewData.GetCurX(), true); // Freeze column
1019  bChangedY = rViewData.SetLOKSheetFreezeIndex(rViewData.GetCurY(), false); // Freeze row
1020  }
1021 
1022  rReq.Done();
1023  if (bChangedX || bChangedY)
1024  {
1025  rBindings.Invalidate( SID_WINDOW_FIX );
1026  rBindings.Invalidate( SID_WINDOW_FIX_COL );
1027  rBindings.Invalidate( SID_WINDOW_FIX_ROW );
1028  // Invalidate the slot for all views on the same tab of the document.
1029  SfxLokHelper::forEachOtherView(this, [nThisTab](ScTabViewShell* pOther) {
1030  ScViewData& rOtherViewData = pOther->GetViewData();
1031  if (rOtherViewData.GetTabNo() != nThisTab)
1032  return;
1033 
1034  SfxBindings& rOtherBind = rOtherViewData.GetBindings();
1035  rOtherBind.Invalidate( SID_WINDOW_FIX );
1036  rOtherBind.Invalidate( SID_WINDOW_FIX_COL );
1037  rOtherBind.Invalidate( SID_WINDOW_FIX_ROW );
1038  });
1039  if (!GetViewData().GetDocShell()->IsReadOnly())
1041  }
1042  }
1043  }
1044  break;
1045 
1046  case SID_WINDOW_FIX_COL:
1047  case SID_WINDOW_FIX_ROW:
1048  {
1049  bool bIsCol = (nSlot == SID_WINDOW_FIX_COL);
1050  sal_Int32 nFreezeIndex = 1;
1051  if (const SfxInt32Item* pItem = rReq.GetArg<SfxInt32Item>(nSlot))
1052  {
1053  nFreezeIndex = pItem->GetValue();
1054  if (nFreezeIndex < 0)
1055  nFreezeIndex = 0;
1056  }
1057 
1059  {
1060  ScViewData& rViewData = GetViewData();
1061  SCTAB nThisTab = rViewData.GetTabNo();
1062  bool bChanged = rViewData.SetLOKSheetFreezeIndex(nFreezeIndex, bIsCol);
1063  rReq.Done();
1064  if (bChanged)
1065  {
1066  rBindings.Invalidate( SID_WINDOW_FIX );
1067  rBindings.Invalidate(nSlot);
1068  // Invalidate the slot for all views on the same tab of the document.
1069  SfxLokHelper::forEachOtherView(this, [nSlot, nThisTab](ScTabViewShell* pOther) {
1070  ScViewData& rOtherViewData = pOther->GetViewData();
1071  if (rOtherViewData.GetTabNo() != nThisTab)
1072  return;
1073 
1074  SfxBindings& rOtherBind = rOtherViewData.GetBindings();
1075  rOtherBind.Invalidate( SID_WINDOW_FIX );
1076  rOtherBind.Invalidate(nSlot);
1077  });
1078  if (!GetViewData().GetDocShell()->IsReadOnly())
1080  }
1081  }
1082  else
1083  {
1084  FreezeSplitters( true, bIsCol ? SC_SPLIT_METHOD_COL : SC_SPLIT_METHOD_ROW, nFreezeIndex);
1085  rReq.Done();
1086  InvalidateSplit();
1087  }
1088  }
1089  break;
1090 
1091  case FID_CHG_SHOW:
1092  {
1093  sal_uInt16 nId = ScHighlightChgDlgWrapper::GetChildWindowId();
1094  SfxChildWindow* pWnd = pThisFrame->GetChildWindow( nId );
1095 
1096  pScMod->SetRefDialog( nId, pWnd == nullptr );
1097  }
1098  break;
1099 
1100  case FID_CHG_ACCEPT:
1101  {
1102  pThisFrame->ToggleChildWindow(ScAcceptChgDlgWrapper::GetChildWindowId());
1103  GetViewFrame()->GetBindings().Invalidate(FID_CHG_ACCEPT);
1104  rReq.Done ();
1105 
1106  /*
1107  sal_uInt16 nId = ScAcceptChgDlgWrapper::GetChildWindowId();
1108  SfxChildWindow* pWnd = pThisFrame->GetChildWindow( nId );
1109 
1110  pScMod->SetRefDialog( nId, pWnd ? sal_False : sal_True );
1111  */
1112  }
1113  break;
1114 
1115  case FID_CHG_COMMENT:
1116  {
1118  ScAddress aCursorPos( rData.GetCurX(), rData.GetCurY(), rData.GetTabNo() );
1119  ScDocShell* pDocSh = rData.GetDocShell();
1120 
1121  ScChangeAction* pAction = pDocSh->GetChangeAction( aCursorPos );
1122  if ( pAction )
1123  {
1124  const SfxPoolItem* pItem;
1125  if ( pReqArgs &&
1126  pReqArgs->GetItemState( nSlot, true, &pItem ) == SfxItemState::SET &&
1127  dynamic_cast<const SfxStringItem*>( pItem) != nullptr )
1128  {
1129  OUString aComment = static_cast<const SfxStringItem*>(pItem)->GetValue();
1130  pDocSh->SetChangeComment( pAction, aComment );
1131  rReq.Done();
1132  }
1133  else
1134  {
1135  pDocSh->ExecuteChangeCommentDialog(pAction, GetFrameWeld());
1136  rReq.Done();
1137  }
1138  }
1139  }
1140  break;
1141 
1142  case SID_CREATE_SW_DRAWVIEW:
1143  // is called by Forms, when the DrawView has to be created with all
1144  // the extras
1145  if (!GetScDrawView())
1146  {
1148  rBindings.InvalidateAll(false);
1149  }
1150  break;
1151 
1152  case FID_PROTECT_DOC:
1153  {
1154  ScDocument& rDoc = GetViewData().GetDocument();
1155 
1156  if( pReqArgs )
1157  {
1158  const SfxPoolItem* pItem;
1159  if( pReqArgs->HasItem( FID_PROTECT_DOC, &pItem ) &&
1160  static_cast<const SfxBoolItem*>(pItem)->GetValue() == rDoc.IsDocProtected() )
1161  {
1162  rReq.Ignore();
1163  break;
1164  }
1165  }
1166 
1167  ScDocProtection* pProtect = rDoc.GetDocProtection();
1168  if (pProtect && pProtect->isProtected())
1169  {
1170  bool bCancel = false;
1171  OUString aPassword;
1172 
1173  if (pProtect->isProtectedWithPass())
1174  {
1175  OUString aText(ScResId(SCSTR_PASSWORD));
1176 
1177  SfxPasswordDialog aDlg(GetFrameWeld(), &aText);
1178  aDlg.set_title(ScResId(SCSTR_UNPROTECTDOC));
1179  aDlg.SetMinLen(0);
1180  aDlg.set_help_id(GetStaticInterface()->GetSlot(FID_PROTECT_DOC)->GetCommand());
1182 
1183  if (aDlg.run() == RET_OK)
1184  aPassword = aDlg.GetPassword();
1185  else
1186  bCancel = true;
1187  }
1188  if (!bCancel)
1189  {
1190  Unprotect( TABLEID_DOC, aPassword );
1191  rReq.AppendItem( SfxBoolItem( FID_PROTECT_DOC, false ) );
1192  rReq.Done();
1193  }
1194  }
1195  else
1196  {
1197  OUString aText(ScResId(SCSTR_PASSWORDOPT));
1198 
1199  SfxPasswordDialog aDlg(GetFrameWeld(), &aText);
1200  aDlg.set_title(ScResId(SCSTR_PROTECTDOC));
1201  aDlg.SetMinLen( 0 );
1202  aDlg.set_help_id(GetStaticInterface()->GetSlot(FID_PROTECT_DOC)->GetCommand());
1204  aDlg.ShowExtras(SfxShowExtras::CONFIRM);
1206 
1207  if (aDlg.run() == RET_OK)
1208  {
1209  OUString aPassword = aDlg.GetPassword();
1210  ProtectDoc( aPassword );
1211  rReq.AppendItem( SfxBoolItem( FID_PROTECT_DOC, true ) );
1212  rReq.Done();
1213  }
1214  }
1215  rBindings.Invalidate( FID_PROTECT_DOC );
1216  }
1217  break;
1218 
1219  case FID_PROTECT_TABLE:
1220  {
1221  ScDocument& rDoc = GetViewData().GetDocument();
1222  SCTAB nTab = GetViewData().GetTabNo();
1223  bool bOldProtection = rDoc.IsTabProtected(nTab);
1224 
1225  if( pReqArgs )
1226  {
1227  const SfxPoolItem* pItem;
1228  bool bNewProtection = !bOldProtection;
1229  if( pReqArgs->HasItem( FID_PROTECT_TABLE, &pItem ) )
1230  bNewProtection = static_cast<const SfxBoolItem*>(pItem)->GetValue();
1231  if( bNewProtection == bOldProtection )
1232  {
1233  rReq.Ignore();
1234  break;
1235  }
1236  }
1237 
1238  if (bOldProtection)
1239  {
1240  // Unprotect a protected sheet.
1241 
1242  const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
1243  if (pProtect && pProtect->isProtectedWithPass())
1244  {
1245  OUString aText( ScResId(SCSTR_PASSWORDOPT) );
1246  SfxPasswordDialog aDlg(GetFrameWeld(), &aText);
1247  aDlg.set_title(ScResId(SCSTR_UNPROTECTTAB));
1248  aDlg.SetMinLen(0);
1249  aDlg.set_help_id(GetStaticInterface()->GetSlot(FID_PROTECT_TABLE)->GetCommand());
1251 
1252  if (aDlg.run() == RET_OK)
1253  {
1254  OUString aPassword = aDlg.GetPassword();
1255  Unprotect(nTab, aPassword);
1256  }
1257  }
1258  else
1259  // this sheet is not password-protected.
1260  Unprotect(nTab, OUString());
1261 
1262  if (!pReqArgs)
1263  {
1264  rReq.AppendItem( SfxBoolItem(FID_PROTECT_TABLE, false) );
1265  rReq.Done();
1266  }
1267  }
1268  else
1269  {
1270  // Protect a current sheet.
1271 
1273 
1274  const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
1275  if (pProtect)
1276  aDlg.SetDialogData(*pProtect);
1277 
1278  if (aDlg.run() == RET_OK)
1279  {
1280  pScMod->InputEnterHandler();
1281 
1282  ScTableProtection aNewProtect;
1283  aDlg.WriteData(aNewProtect);
1284  ProtectSheet(nTab, aNewProtect);
1285  if (!pReqArgs)
1286  {
1287  rReq.AppendItem( SfxBoolItem(FID_PROTECT_TABLE, true) );
1288  rReq.Done();
1289  }
1290  }
1291  }
1292  TabChanged();
1293  UpdateInputHandler(true); // to immediately enable input again
1294  SelectionChanged();
1295  }
1296  break;
1297 
1298  case SID_OPT_LOCALE_CHANGED :
1299  { // locale changed, SYSTEM number formats changed => repaint cell contents
1300  PaintGrid();
1301  rReq.Done();
1302  }
1303  break;
1304 
1305  default:
1306  OSL_FAIL("Unknown Slot at ScTabViewShell::Execute");
1307  break;
1308  }
1309 }
1310 
1311 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SC_DLLPUBLIC bool IsDocProtected() const
Definition: documen3.cxx:1903
#define MAXZOOM
Definition: global.hxx:78
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3108
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:418
void SetOption(ScViewOption eOpt, bool bNew)
Definition: viewopti.hxx:87
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 notifyKitCellFollowJump() const
Definition: gridwin.cxx:4889
void RemoveManualBreaks()
Definition: viewfun2.cxx:975
SC_DLLPUBLIC bool IsTabProtected(SCTAB nTab) const
Definition: documen3.cxx:1914
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)
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:89
void ErrorMessage(TranslateId pGlobStrId)
Definition: tabview2.cxx:1413
static SfxInterface * GetStaticInterface()
RutlNameScope
Definition: rangeutl.hxx:35
SfxViewFrame * GetFrame() const
static bool MakeRangeFromName(const OUString &rName, const ScDocument &rDoc, SCTAB nCurTab, ScRange &rRange, RutlNameScope eScope=RUTL_NAMES, ScAddress::Details const &rDetails=ScAddress::detailsOOOa1, bool bUseDetailsPos=false)
Definition: rangeutl.cxx:233
SCROW Row() const
Definition: address.hxx:261
OUString GetTitle(sal_uInt16 nMaxLen=0) const
void PostPaintGridAll()
Definition: docsh3.cxx:183
void SetPrintRanges(bool bEntireSheet, const OUString *pPrint, const OUString *pRepCol, const OUString *pRepRow, bool bAddPrint)
Definition: viewfun2.cxx:1014
std::string GetValue
bool PaintExtras()
Definition: tabview3.cxx:2759
bool SelectObject(std::u16string_view rName)
Definition: tabvwsh2.cxx:454
void MarkRange(const ScRange &rRange, bool bSetCursor=true, bool bContinue=false)
Definition: tabview3.cxx:1687
#define HID_PASSWD_TABLE
Definition: helpids.h:57
sheet protection state container
bool isdigitAsciiString(std::string_view rString)
void SetHeaderMode(bool bNewMode)
Definition: viewdata.hxx:551
void SelectAllTables()
Definition: tabview2.cxx:1085
SfxDispatcher * GetDispatcher()
void SetPagebreakMode(bool bSet)
Definition: tabview5.cxx:444
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:4173
virtual bool isProtected() const override
void SetDocumentModified()
Definition: docsh.cxx:2941
sal_Int16 nId
const ContentProperties & rData
void PostPaintExtras()
Definition: docsh3.cxx:198
SCTAB GetTabNo() const
Definition: viewdata.hxx:394
void PaintGrid()
Definition: tabview3.cxx:2628
bool IsSyntaxMode() const
Definition: viewdata.hxx:548
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
static OUString decode(std::u16string_view rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
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:363
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:1359
SC_DLLPUBLIC void MoveCursorAbs(SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, bool bShift, bool bControl, bool bKeepOld=false, bool bKeepSel=false)
Definition: tabview3.cxx:1190
NONE
void GetMarkArea(ScRange &rRange) const
Definition: markdata.cxx:111
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:2706
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:872
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:314
void SetConfirmHelpId(const OString &rId)
bool Unprotect(SCTAB nTab, const OUString &rPassword)
Definition: viewfunc.cxx:2547
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:1467
void SetOptions(const ScViewOptions &rOpt)
Definition: viewdata.cxx:3939
SC_DLLPUBLIC bool GetTable(const OUString &rName, SCTAB &rTab) const
Definition: document.cxx:260
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
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:2639
void SelectionChanged(bool bFromPaste=false)
Definition: tabview3.cxx:533
SfxItemPool & GetPool() const
bool PasteFile(const Point &, const OUString &, bool bLink)
Definition: viewfun4.cxx:579
tools::Long zoomOut(tools::Long nCurrent)
SC_DLLPUBLIC void SetAppOptions(const ScAppOptions &rOpt)
Definition: scmod.cxx:714
void AutoOutline()
Definition: dbfunc3.cxx:214
SC_DLLPUBLIC ScDocProtection * GetDocProtection() const
Definition: documen3.cxx:1890
void SetTab(SCTAB nTabP)
Definition: address.hxx:282
void SetZoom(const Fraction &rNewX, const Fraction &rNewY, bool bAll)
Definition: tabview5.cxx:428
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:171
SfxBindings & GetBindings()
Definition: viewdata.cxx:3096
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:250
SfxBindings & GetBindings()
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
Definition: tabview3.cxx:1798
SC_DLLPUBLIC const ScAppOptions & GetAppOptions()
Definition: scmod.cxx:727
const T * GetArg(sal_uInt16 nSlotId) const
void ShowExtras(SfxShowExtras nExtras)
float u
bool GetOption(ScViewOption eOpt) const
Definition: viewopti.hxx:88
ScGridWindow * GetActiveWin()
Definition: viewdata.cxx:3124
void RemoveAllOutlines(bool bRecord=true)
Definition: dbfunc3.cxx:194
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:4179
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
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:105
void SetReturnValue(const SfxPoolItem &)
void SetPrintZoom(sal_uInt16 nScale)
Definition: viewfun2.cxx:999
void Update(sal_uInt16 nId)
void SkipOverlapped(SCCOL &rCol, SCROW &rRow, SCTAB nTab) const
Definition: document.cxx:5747
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_Int32 SCROW
Definition: types.hxx:17
sal_uInt16 GetSlot() const
void PutInOrder()
Definition: address.cxx:1582
bool ValidRow(SCROW nRow) const
Definition: document.hxx:875
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:2507
ScDrawView * GetScDrawView()
Definition: tabview.hxx:341
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
SvxZoomEnableFlags
bool IsInPlace() const
void SetValueSet(SvxZoomEnableFlags nValues)
static SfxObjectShell * GetFirst(const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
SvxZoomType GetType() const
bool IsHeaderMode() const
Definition: viewdata.hxx:550
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
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:544
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:916
void ShowChildWindow(sal_uInt16, bool bVisible=true)
ScSplitMode
Definition: viewdata.hxx:42
void HideListBox()
Definition: tabview3.cxx:2968
void SetZoomType(SvxZoomType eNew, bool bAll)
Definition: tabview5.cxx:423
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:908
void AppendItem(const SfxPoolItem &)
Point GetInsertPos() const
Definition: tabview.cxx:1669
void SetSyntaxMode(bool bNewMode)
Definition: viewdata.hxx:549
DetectFlags
Definition: tabvwsh3.cxx:75
#define MINZOOM
Definition: global.hxx:77
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:183
void ProtectDoc(const OUString &rPassword)
Definition: viewfunc.cxx:2537
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:213
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:1006
void ResetOldCursor()
Definition: viewdata.cxx:1395
bool RemoveLOKFreeze()
Definition: viewdata.cxx:4195
SCCOL GetCurX() const
Definition: viewdata.hxx:400
SC_DLLPUBLIC const ScTableProtection * GetTabProtection(SCTAB nTab) const
Definition: documen3.cxx:1923
#define HID_PASSWD_DOC
Definition: helpids.h:58