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  if ( nSlot == SID_JUMPTOMARK )
317  {
318  // URL has to be decoded for escaped characters (%20)
319  aAddress = INetURLObject::decode( aAddress,
321  }
322 
323  bool bFound = false;
324  ScViewData& rViewData = GetViewData();
325  ScDocument& rDoc = rViewData.GetDocument();
326  ScMarkData& rMark = rViewData.GetMarkData();
327  ScRange aScRange;
328  ScAddress aScAddress;
329  ScRefFlagsAndType aResult = lcl_ParseRangeOrAddress(aScRange, aScAddress, aAddress, rDoc);
330  ScRefFlags nResult = aResult.nResult;
331  SCTAB nTab = rViewData.GetTabNo();
332  bool bMark = true;
333 
334  // Is this a range ?
335  if (aResult.eDetected == DetectFlags::RANGE)
336  {
337  if ( nResult & ScRefFlags::TAB_3D )
338  {
339  if( aScRange.aStart.Tab() != nTab )
340  {
341  nTab = aScRange.aStart.Tab();
342  SetTabNo( nTab );
343  }
344  }
345  else
346  {
347  aScRange.aStart.SetTab( nTab );
348  aScRange.aEnd.SetTab( nTab );
349  }
350  }
351  // Is this a cell ?
352  else if (aResult.eDetected == DetectFlags::ADDRESS)
353  {
354  if ( nResult & ScRefFlags::TAB_3D )
355  {
356  if( aScAddress.Tab() != nTab )
357  {
358  nTab = aScAddress.Tab();
359  SetTabNo( nTab );
360  }
361  }
362  else
363  aScAddress.SetTab( nTab );
364 
365  aScRange = ScRange( aScAddress, aScAddress );
366  // cells should not be marked
367  bMark = false;
368  }
369  // Is it a named area (first named ranges then database ranges)?
370  else
371  {
373  if( ScRangeUtil::MakeRangeFromName( aAddress, rDoc, nTab, aScRange, RUTL_NAMES, eConv ) ||
374  ScRangeUtil::MakeRangeFromName( aAddress, rDoc, nTab, aScRange, RUTL_DBASE, eConv ) )
375  {
376  nResult |= ScRefFlags::VALID;
377  if( aScRange.aStart.Tab() != nTab )
378  {
379  nTab = aScRange.aStart.Tab();
380  SetTabNo( nTab );
381  }
382  }
383  }
384 
385  if ( !(nResult & ScRefFlags::VALID) && comphelper::string::isdigitAsciiString(aAddress) )
386  {
387  sal_Int32 nNumeric = aAddress.toInt32();
388  if ( nNumeric > 0 && nNumeric <= rDoc.MaxRow()+1 )
389  {
390  // one-based row numbers
391 
392  aScAddress.SetRow( static_cast<SCROW>(nNumeric - 1) );
393  aScAddress.SetCol( rViewData.GetCurX() );
394  aScAddress.SetTab( nTab );
395  aScRange = ScRange( aScAddress, aScAddress );
396  bMark = false;
397  nResult = ScRefFlags::VALID;
398  }
399  }
400 
401  if ( !rDoc.ValidRow(aScRange.aStart.Row()) || !rDoc.ValidRow(aScRange.aEnd.Row()) )
402  nResult = ScRefFlags::ZERO;
403 
404  // we have found something
405  if( nResult & ScRefFlags::VALID )
406  {
407  bFound = true;
408  SCCOL nCol = aScRange.aStart.Col();
409  SCROW nRow = aScRange.aStart.Row();
410  bool bNothing = ( rViewData.GetCurX()==nCol && rViewData.GetCurY()==nRow );
411 
412  // mark
413  if( bMark )
414  {
415  if (rMark.IsMarked()) // is the same range already marked?
416  {
417  ScRange aOldMark;
418  rMark.GetMarkArea( aOldMark );
419  aOldMark.PutInOrder();
420  ScRange aCurrent = aScRange;
421  aCurrent.PutInOrder();
422  bNothing = ( aCurrent == aOldMark );
423  }
424  else
425  bNothing = false;
426 
427  if (!bNothing)
428  MarkRange( aScRange, false ); // cursor comes after...
429  }
430  else
431  {
432  // remove old selection, unless bUnmark argument is sal_False (from navigator)
433  if( bUnmark )
434  {
435  MoveCursorAbs( nCol, nRow,
436  SC_FOLLOW_NONE, false, false );
437  }
438  }
439 
440  // and set cursor
441 
442  // consider merged cells:
443  rDoc.SkipOverlapped(nCol, nRow, nTab);
444 
445  // navigator calls are not part of the API!!!
446 
447  if( bNothing )
448  {
449  if (rReq.IsAPI())
450  rReq.Ignore(); // if macro, then nothing
451  else
452  rReq.Done(); // then at least paint it
453  }
454  else
455  {
456  rViewData.ResetOldCursor();
457  SetCursor( nCol, nRow );
458  rBindings.Invalidate( SID_CURRENTCELL );
459  rBindings.Update( nSlot );
460 
461  if (!rReq.IsAPI())
462  rReq.Done();
463  }
464 
465  if (bAlignToCursor)
466  {
467  // align to cursor even if the cursor position hasn't changed,
468  // because the cursor may be set outside the visible area.
469  AlignToCursor( nCol, nRow, SC_FOLLOW_JUMP );
470  }
471 
472  rReq.SetReturnValue( SfxStringItem( SID_CURRENTCELL, aAddress ) );
473  }
474 
475  if (!bFound) // no valid range
476  {
477  // if it is a sheet name, then switch (for Navigator/URL)
478 
479  SCTAB nNameTab;
480  if ( rDoc.GetTable( aAddress, nNameTab ) )
481  {
482  bFound = true;
483  if ( nNameTab != nTab )
484  SetTabNo( nNameTab );
485  }
486  }
487 
488  if ( !bFound && nSlot == SID_JUMPTOMARK )
489  {
490  // test graphics objects (only for URL)
491 
492  bFound = SelectObject( aAddress );
493  }
494 
495  if (!bFound && !rReq.IsAPI())
496  ErrorMessage( STR_ERR_INVALID_AREA );
497  }
498  break;
499 
500  case SID_CURRENTOBJECT:
501  if ( pReqArgs )
502  {
503  OUString aName = static_cast<const SfxStringItem&>(pReqArgs->Get(nSlot)).GetValue();
504  SelectObject( aName );
505  }
506  break;
507 
508  case SID_CURRENTTAB:
509  if ( pReqArgs )
510  {
511  // sheet for basic is one-based
512  SCTAB nTab = static_cast<const SfxUInt16Item&>(pReqArgs->Get(nSlot)).GetValue() - 1;
513  ScDocument& rDoc = GetViewData().GetDocument();
514  if ( nTab < rDoc.GetTableCount() )
515  {
516  SetTabNo( nTab );
517  rBindings.Update( nSlot );
518 
519  if( ! rReq.IsAPI() )
520  rReq.Done();
521  }
523  }
524  break;
525 
526  case SID_CURRENTDOC:
527  if ( pReqArgs )
528  {
529  OUString aStrDocName( static_cast<const SfxStringItem&>(pReqArgs->
530  Get(nSlot)).GetValue() );
531 
532  SfxViewFrame* pViewFrame = nullptr;
533  ScDocShell* pDocSh = static_cast<ScDocShell*>(SfxObjectShell::GetFirst());
534  bool bFound = false;
535 
536  // search for ViewFrame to be activated
537 
538  while ( pDocSh && !bFound )
539  {
540  if ( pDocSh->GetTitle() == aStrDocName )
541  {
542  pViewFrame = SfxViewFrame::GetFirst( pDocSh );
543  bFound = ( nullptr != pViewFrame );
544  }
545 
546  pDocSh = static_cast<ScDocShell*>(SfxObjectShell::GetNext( *pDocSh ));
547  }
548 
549  if ( bFound )
550  pViewFrame->GetFrame().Appear();
551 
552  rReq.Ignore();//XXX is handled by SFX
553  }
554  break;
555 
556  case SID_PRINTPREVIEW:
557  {
558  if ( !pThisFrame->GetFrame().IsInPlace() ) // not for OLE
559  {
560  // print preview is now always in the same frame as the tab view
561  // -> always switch this frame back to normal view
562  // (ScPreviewShell ctor reads view data)
563 
564  // #102785#; finish input
565  pScMod->InputEnterHandler();
566 
567  pThisFrame->GetDispatcher()->Execute( SID_VIEWSHELL1, SfxCallMode::ASYNCHRON );
568  }
569  // else error (e.g. Ole)
570  }
571  break;
572 
573  case SID_DETECTIVE_DEL_ALL:
574  DetectiveDelAll();
575  rReq.Done();
576  break;
577 
578  // SID_TABLE_ACTIVATE and SID_MARKAREA are called by basic for the
579  // hidden View, to mark/switch on the visible View:
580 
581  case SID_TABLE_ACTIVATE:
582  OSL_FAIL("old slot SID_TABLE_ACTIVATE");
583  break;
584 
585  case SID_REPAINT:
586  PaintGrid();
587  PaintTop();
588  PaintLeft();
589  PaintExtras();
590  rReq.Done();
591  break;
592 
593  case FID_NORMALVIEWMODE:
594  case FID_PAGEBREAKMODE:
595  {
596  bool bWantPageBreak = nSlot == FID_PAGEBREAKMODE;
597 
598  // check whether there is an explicit argument, use it
599  const SfxPoolItem* pItem;
600  if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET )
601  {
602  bool bItemValue = static_cast<const SfxBoolItem*>(pItem)->GetValue();
603  bWantPageBreak = (nSlot == FID_PAGEBREAKMODE) == bItemValue;
604  }
605 
606  if( GetViewData().IsPagebreakMode() != bWantPageBreak )
607  {
608  SetPagebreakMode( bWantPageBreak );
611  PaintGrid();
612  PaintTop();
613  PaintLeft();
614  rBindings.Invalidate( nSlot );
615  rReq.AppendItem( SfxBoolItem( nSlot, true ) );
616  rReq.Done();
617  }
618  }
619  break;
620 
621  case FID_FUNCTION_BOX:
622  {
623  // First make sure that the sidebar is visible
624  pThisFrame->ShowChildWindow(SID_SIDEBAR);
625 
626  ::sfx2::sidebar::Sidebar::ShowPanel(u"ScFunctionsPanel",
627  pThisFrame->GetFrame().GetFrameInterface());
628  rReq.Done ();
629  }
630  break;
631 
632  case FID_TOGGLESYNTAX:
633  {
634  bool bSet = !GetViewData().IsSyntaxMode();
635  const SfxPoolItem* pItem;
636  if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET )
637  bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue();
638  GetViewData().SetSyntaxMode( bSet );
639  PaintGrid();
640  rBindings.Invalidate( FID_TOGGLESYNTAX );
641  rReq.AppendItem( SfxBoolItem( nSlot, bSet ) );
642  rReq.Done();
643  }
644  break;
645  case FID_TOGGLEHEADERS:
646  {
647  bool bSet = !GetViewData().IsHeaderMode();
648  const SfxPoolItem* pItem;
649  if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET )
650  bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue();
651  GetViewData().SetHeaderMode( bSet );
652  RepeatResize();
653  rBindings.Invalidate( FID_TOGGLEHEADERS );
654  rReq.AppendItem( SfxBoolItem( nSlot, bSet ) );
655  rReq.Done();
656  }
657  break;
658 
659  case FID_TOGGLEFORMULA:
660  {
661  ScViewData& rViewData = GetViewData();
662  const ScViewOptions& rOpts = rViewData.GetOptions();
663  bool bFormulaMode = !rOpts.GetOption( VOPT_FORMULAS );
664  const SfxPoolItem *pItem;
665  if( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET )
666  bFormulaMode = static_cast<const SfxBoolItem *>(pItem)->GetValue();
667 
668  ScViewOptions aSetOpts = rOpts;
669  aSetOpts.SetOption( VOPT_FORMULAS, bFormulaMode );
670  rViewData.SetOptions( aSetOpts );
671 
672  rViewData.GetDocShell()->PostPaintGridAll();
673 
674  rBindings.Invalidate( FID_TOGGLEFORMULA );
675  rReq.AppendItem( SfxBoolItem( nSlot, bFormulaMode ) );
676  rReq.Done();
677  }
678  break;
679 
680  case FID_TOGGLEINPUTLINE:
681  {
682  sal_uInt16 nId = ScInputWindowWrapper::GetChildWindowId();
683  SfxChildWindow* pWnd = pThisFrame->GetChildWindow( nId );
684  bool bSet = ( pWnd == nullptr );
685  const SfxPoolItem* pItem;
686  if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET )
687  bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue();
688 
689  pThisFrame->SetChildWindow( nId, bSet );
690  rBindings.Invalidate( FID_TOGGLEINPUTLINE );
691  rReq.AppendItem( SfxBoolItem( nSlot, bSet ) );
692  rReq.Done();
693  }
694  break;
695 
696  // handling for SID_ZOOM_IN and SID_ZOOM_OUT is ScTabView::ScrollCommand
697  // CommandWheelMode::ZOOM inspired
698  case SID_ZOOM_IN:
699  case SID_ZOOM_OUT:
700  {
701  HideNoteMarker();
702 
703  if (!GetViewData().GetViewShell()->GetViewFrame()->GetFrame().IsInPlace())
704  {
705  // for ole inplace editing, the scale is defined by the visarea and client size
706  // and can't be changed directly
707 
708  const Fraction& rOldY = GetViewData().GetZoomY();
709  tools::Long nOld = tools::Long(rOldY * 100);
710  tools::Long nNew;
711  if (SID_ZOOM_OUT == nSlot)
712  nNew = std::max(tools::Long(MINZOOM), basegfx::zoomtools::zoomOut(nOld));
713  else
714  nNew = std::min(tools::Long(MAXZOOM), basegfx::zoomtools::zoomIn(nOld));
715  if ( nNew != nOld)
716  {
717  bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom();
718  SetZoomType(SvxZoomType::PERCENT, bSyncZoom);
719  Fraction aFract(nNew, 100);
720  SetZoom(aFract, aFract, bSyncZoom);
721  PaintGrid();
722  PaintTop();
723  PaintLeft();
724  rBindings.Invalidate(SID_ATTR_ZOOM);
725  rBindings.Invalidate(SID_ATTR_ZOOMSLIDER);
726  rBindings.Invalidate(SID_ZOOM_IN);
727  rBindings.Invalidate(SID_ZOOM_OUT);
728  rReq.Done();
729  }
730  }
731  }
732  break;
733 
734  case SID_ATTR_ZOOM: // status row
735  case FID_SCALE:
736  {
737  bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom();
738  SvxZoomType eOldZoomType = GetZoomType();
739  SvxZoomType eNewZoomType = eOldZoomType;
740  const Fraction& rOldY = GetViewData().GetZoomY(); // Y is shown
741  sal_uInt16 nOldZoom = static_cast<sal_uInt16>(tools::Long( rOldY * 100 ));
742  sal_uInt16 nZoom = nOldZoom;
743  bool bCancel = false;
744 
745  if ( pReqArgs )
746  {
747  const SvxZoomItem& rZoomItem = pReqArgs->Get(SID_ATTR_ZOOM);
748 
749  eNewZoomType = rZoomItem.GetType();
750  nZoom = rZoomItem.GetValue();
751  }
752  else
753  {
755  SvxZoomItem aZoomItem( eOldZoomType, nOldZoom, SID_ATTR_ZOOM );
757  ScMarkData& rMark = GetViewData().GetMarkData();
758  SvxZoomEnableFlags nBtnFlags = SvxZoomEnableFlags::N50
759  | SvxZoomEnableFlags::N75
760  | SvxZoomEnableFlags::N100
761  | SvxZoomEnableFlags::N150
762  | SvxZoomEnableFlags::N200
763  | SvxZoomEnableFlags::WHOLEPAGE
764  | SvxZoomEnableFlags::PAGEWIDTH;
765 
766  if ( rMark.IsMarked() || rMark.IsMultiMarked() )
767  nBtnFlags = nBtnFlags | SvxZoomEnableFlags::OPTIMAL;
768 
769  aZoomItem.SetValueSet( nBtnFlags );
770  aSet.Put( aZoomItem );
772  pDlg.disposeAndReset(pFact->CreateSvxZoomDialog(GetFrameWeld(), aSet));
773  pDlg->SetLimits( MINZOOM, MAXZOOM );
774 
775  bCancel = ( RET_CANCEL == pDlg->Execute() );
776 
777  // bCancel is True only if we were in the previous if block,
778  // so no need to check again pDlg
779  if ( !bCancel )
780  {
781  const SvxZoomItem& rZoomItem = pDlg->GetOutputItemSet()->
782  Get( SID_ATTR_ZOOM );
783 
784  eNewZoomType = rZoomItem.GetType();
785  nZoom = rZoomItem.GetValue();
786  }
787  }
788 
789  if ( !bCancel )
790  {
791  if ( eNewZoomType == SvxZoomType::PERCENT )
792  {
793  if ( nZoom < MINZOOM ) nZoom = MINZOOM;
794  if ( nZoom > MAXZOOM ) nZoom = MAXZOOM;
795  }
796  else
797  {
798  nZoom = CalcZoom( eNewZoomType, nOldZoom );
799  bCancel = nZoom == 0;
800  }
801 
802  switch ( eNewZoomType )
803  {
804  case SvxZoomType::WHOLEPAGE:
805  case SvxZoomType::PAGEWIDTH:
806  SetZoomType( eNewZoomType, bSyncZoom );
807  break;
808 
809  default:
810  SetZoomType( SvxZoomType::PERCENT, bSyncZoom );
811  }
812  }
813 
814  if ( nZoom != nOldZoom && !bCancel )
815  {
816  if (!GetViewData().IsPagebreakMode())
817  {
818  ScAppOptions aNewOpt = pScMod->GetAppOptions();
819  aNewOpt.SetZoom( nZoom );
820  aNewOpt.SetZoomType( GetZoomType() );
821  pScMod->SetAppOptions( aNewOpt );
822  }
823  Fraction aFract( nZoom, 100 );
824  SetZoom( aFract, aFract, bSyncZoom );
825  PaintGrid();
826  PaintTop();
827  PaintLeft();
828  rBindings.Invalidate( SID_ATTR_ZOOM );
829  rReq.AppendItem( SvxZoomItem( GetZoomType(), nZoom, nSlot ) );
830  rReq.Done();
831  }
832  }
833  break;
834 
835  case SID_ATTR_ZOOMSLIDER:
836  {
837  const SfxPoolItem* pItem = nullptr;
838  bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom();
839  if ( pReqArgs && pReqArgs->GetItemState(SID_ATTR_ZOOMSLIDER, true, &pItem) == SfxItemState::SET )
840  {
841  const sal_uInt16 nCurrentZoom = static_cast<const SvxZoomSliderItem *>(pItem)->GetValue();
842  if( nCurrentZoom )
843  {
844  SetZoomType( SvxZoomType::PERCENT, bSyncZoom );
845  if (!GetViewData().IsPagebreakMode())
846  {
847  ScAppOptions aNewOpt = pScMod->GetAppOptions();
848  aNewOpt.SetZoom( nCurrentZoom );
849  collectUIInformation(OUString::number(nCurrentZoom));
850  aNewOpt.SetZoomType( GetZoomType() );
851  pScMod->SetAppOptions( aNewOpt );
852  }
853  Fraction aFract( nCurrentZoom,100 );
854  SetZoom( aFract, aFract, bSyncZoom );
855  PaintGrid();
856  PaintTop();
857  PaintLeft();
858  rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
859  rBindings.Invalidate( SID_ZOOM_IN );
860  rBindings.Invalidate( SID_ZOOM_OUT );
861  rReq.Done();
862  }
863  }
864  }
865  break;
866 
867  case FID_TAB_SELECTALL:
868  SelectAllTables();
869  rReq.Done();
870  break;
871 
872  case FID_TAB_DESELECTALL:
874  rReq.Done();
875  break;
876 
877  case SID_SELECT_TABLES:
878  {
879  ScViewData& rViewData = GetViewData();
880  ScDocument& rDoc = rViewData.GetDocument();
881  ScMarkData& rMark = rViewData.GetMarkData();
882  SCTAB nTabCount = rDoc.GetTableCount();
883  SCTAB nTab;
884 
885  ::std::vector < sal_Int32 > aIndexList;
886  const SfxIntegerListItem* pItem = rReq.GetArg<SfxIntegerListItem>(SID_SELECT_TABLES);
887  if ( pItem )
888  aIndexList = pItem->GetList();
889  else
890  {
892 
894  pDlg->SetDescription(
895  ScResId( STR_DLG_SELECTTABLES_TITLE ),
896  ScResId( STR_DLG_SELECTTABLES_LBNAME ),
897  GetStaticInterface()->GetSlot(SID_SELECT_TABLES)->GetCommand(), HID_SELECTTABLES );
898 
899  // fill all table names with selection state
900  OUString aTabName;
901  for( nTab = 0; nTab < nTabCount; ++nTab )
902  {
903  rDoc.GetName( nTab, aTabName );
904  pDlg->Insert( aTabName, rMark.GetTableSelect( nTab ) );
905  }
906 
907  if( pDlg->Execute() == RET_OK )
908  {
909  aIndexList = pDlg->GetSelectedRows();
910  pDlg.disposeAndClear();
911  rReq.AppendItem( SfxIntegerListItem( SID_SELECT_TABLES, aIndexList ) );
912  }
913  else
914  rReq.Ignore();
915  }
916 
917  if ( !aIndexList.empty() )
918  {
919  sal_uInt16 nSelCount = aIndexList.size();
920  sal_uInt16 nSelIx;
921  SCTAB nFirstVisTab = 0;
922 
923  // special case: only hidden tables selected -> do nothing
924  bool bVisSelected = false;
925  for( nSelIx = 0; !bVisSelected && (nSelIx < nSelCount); ++nSelIx )
926  {
927  nFirstVisTab = static_cast<SCTAB>(aIndexList[nSelIx]);
928  bVisSelected = rDoc.IsVisible( nFirstVisTab );
929  }
930  if( !bVisSelected )
931  nSelCount = 0;
932 
933  // select the tables
934  if( nSelCount )
935  {
936  for( nTab = 0; nTab < nTabCount; ++nTab )
937  rMark.SelectTable( nTab, false );
938 
939  for( nSelIx = 0; nSelIx < nSelCount; ++nSelIx )
940  rMark.SelectTable( static_cast<SCTAB>(aIndexList[nSelIx]), true );
941 
942  // activate another table, if current is deselected
943  if( !rMark.GetTableSelect( rViewData.GetTabNo() ) )
944  {
945  rMark.SelectTable( nFirstVisTab, true );
946  SetTabNo( nFirstVisTab );
947  }
948 
949  rViewData.GetDocShell()->PostPaintExtras();
950  SfxBindings& rBind = rViewData.GetBindings();
951  rBind.Invalidate( FID_FILL_TAB );
952  rBind.Invalidate( FID_TAB_DESELECTALL );
953  }
954 
955  rReq.Done();
956  }
957  }
958  break;
959 
960  case SID_OUTLINE_DELETEALL:
962  rReq.Done();
963  break;
964 
965  case SID_AUTO_OUTLINE:
966  AutoOutline();
967  rReq.Done();
968  break;
969 
970  case SID_WINDOW_SPLIT:
971  {
972  ScSplitMode eHSplit = GetViewData().GetHSplitMode();
973  ScSplitMode eVSplit = GetViewData().GetVSplitMode();
974  if ( eHSplit == SC_SPLIT_NORMAL || eVSplit == SC_SPLIT_NORMAL ) // remove
975  RemoveSplit();
976  else if ( eHSplit == SC_SPLIT_FIX || eVSplit == SC_SPLIT_FIX ) // normal
977  FreezeSplitters( false );
978  else // create
979  SplitAtCursor();
980  rReq.Done();
981 
982  InvalidateSplit();
983  }
984  break;
985 
986  case SID_WINDOW_FIX:
987  {
989  {
990  ScSplitMode eHSplit = GetViewData().GetHSplitMode();
991  ScSplitMode eVSplit = GetViewData().GetVSplitMode();
992  if ( eHSplit == SC_SPLIT_FIX || eVSplit == SC_SPLIT_FIX ) // remove
993  RemoveSplit();
994  else
995  FreezeSplitters( true, SC_SPLIT_METHOD_CURSOR); // create or fixate
996  rReq.Done();
997  InvalidateSplit();
998  }
999  else
1000  {
1001  ScViewData& rViewData = GetViewData();
1002  SCTAB nThisTab = rViewData.GetTabNo();
1003  bool bChangedX = false, bChangedY = false;
1004  if (rViewData.GetLOKSheetFreezeIndex(true) > 0 ||
1005  rViewData.GetLOKSheetFreezeIndex(false) > 0 ) // remove freeze
1006  {
1007  bChangedX = rViewData.RemoveLOKFreeze();
1008  } // create or fixate
1009  else
1010  {
1011  bChangedX = rViewData.SetLOKSheetFreezeIndex(rViewData.GetCurX(), true); // Freeze column
1012  bChangedY = rViewData.SetLOKSheetFreezeIndex(rViewData.GetCurY(), false); // Freeze row
1013  }
1014 
1015  rReq.Done();
1016  if (bChangedX || bChangedY)
1017  {
1018  rBindings.Invalidate( SID_WINDOW_FIX );
1019  rBindings.Invalidate( SID_WINDOW_FIX_COL );
1020  rBindings.Invalidate( SID_WINDOW_FIX_ROW );
1021  // Invalidate the slot for all views on the same tab of the document.
1022  SfxLokHelper::forEachOtherView(this, [nThisTab](ScTabViewShell* pOther) {
1023  ScViewData& rOtherViewData = pOther->GetViewData();
1024  if (rOtherViewData.GetTabNo() != nThisTab)
1025  return;
1026 
1027  SfxBindings& rOtherBind = rOtherViewData.GetBindings();
1028  rOtherBind.Invalidate( SID_WINDOW_FIX );
1029  rOtherBind.Invalidate( SID_WINDOW_FIX_COL );
1030  rOtherBind.Invalidate( SID_WINDOW_FIX_ROW );
1031  });
1032  }
1033  }
1034  }
1035  break;
1036 
1037  case SID_WINDOW_FIX_COL:
1038  case SID_WINDOW_FIX_ROW:
1039  {
1040  bool bIsCol = (nSlot == SID_WINDOW_FIX_COL);
1041  sal_Int32 nFreezeIndex = 1;
1042  if (const SfxInt32Item* pItem = rReq.GetArg<SfxInt32Item>(nSlot))
1043  {
1044  nFreezeIndex = pItem->GetValue();
1045  if (nFreezeIndex < 0)
1046  nFreezeIndex = 0;
1047  }
1048 
1050  {
1051  ScViewData& rViewData = GetViewData();
1052  SCTAB nThisTab = rViewData.GetTabNo();
1053  bool bChanged = rViewData.SetLOKSheetFreezeIndex(nFreezeIndex, bIsCol);
1054  rReq.Done();
1055  if (bChanged)
1056  {
1057  rBindings.Invalidate( SID_WINDOW_FIX );
1058  rBindings.Invalidate(nSlot);
1059  // Invalidate the slot for all views on the same tab of the document.
1060  SfxLokHelper::forEachOtherView(this, [nSlot, nThisTab](ScTabViewShell* pOther) {
1061  ScViewData& rOtherViewData = pOther->GetViewData();
1062  if (rOtherViewData.GetTabNo() != nThisTab)
1063  return;
1064 
1065  SfxBindings& rOtherBind = rOtherViewData.GetBindings();
1066  rOtherBind.Invalidate( SID_WINDOW_FIX );
1067  rOtherBind.Invalidate(nSlot);
1068  });
1069  }
1070  }
1071  else
1072  {
1073  FreezeSplitters( true, bIsCol ? SC_SPLIT_METHOD_COL : SC_SPLIT_METHOD_ROW, nFreezeIndex);
1074  rReq.Done();
1075  InvalidateSplit();
1076  }
1077  }
1078  break;
1079 
1080  case FID_CHG_SHOW:
1081  {
1082  sal_uInt16 nId = ScHighlightChgDlgWrapper::GetChildWindowId();
1083  SfxChildWindow* pWnd = pThisFrame->GetChildWindow( nId );
1084 
1085  pScMod->SetRefDialog( nId, pWnd == nullptr );
1086  }
1087  break;
1088 
1089  case FID_CHG_ACCEPT:
1090  {
1091  pThisFrame->ToggleChildWindow(ScAcceptChgDlgWrapper::GetChildWindowId());
1092  GetViewFrame()->GetBindings().Invalidate(FID_CHG_ACCEPT);
1093  rReq.Done ();
1094 
1095  /*
1096  sal_uInt16 nId = ScAcceptChgDlgWrapper::GetChildWindowId();
1097  SfxChildWindow* pWnd = pThisFrame->GetChildWindow( nId );
1098 
1099  pScMod->SetRefDialog( nId, pWnd ? sal_False : sal_True );
1100  */
1101  }
1102  break;
1103 
1104  case FID_CHG_COMMENT:
1105  {
1107  ScAddress aCursorPos( rData.GetCurX(), rData.GetCurY(), rData.GetTabNo() );
1108  ScDocShell* pDocSh = rData.GetDocShell();
1109 
1110  ScChangeAction* pAction = pDocSh->GetChangeAction( aCursorPos );
1111  if ( pAction )
1112  {
1113  const SfxPoolItem* pItem;
1114  if ( pReqArgs &&
1115  pReqArgs->GetItemState( nSlot, true, &pItem ) == SfxItemState::SET &&
1116  dynamic_cast<const SfxStringItem*>( pItem) != nullptr )
1117  {
1118  OUString aComment = static_cast<const SfxStringItem*>(pItem)->GetValue();
1119  pDocSh->SetChangeComment( pAction, aComment );
1120  rReq.Done();
1121  }
1122  else
1123  {
1124  pDocSh->ExecuteChangeCommentDialog(pAction, GetFrameWeld());
1125  rReq.Done();
1126  }
1127  }
1128  }
1129  break;
1130 
1131  case SID_CREATE_SW_DRAWVIEW:
1132  // is called by Forms, when the DrawView has to be created with all
1133  // the extras
1134  if (!GetScDrawView())
1135  {
1137  rBindings.InvalidateAll(false);
1138  }
1139  break;
1140 
1141  case FID_PROTECT_DOC:
1142  {
1143  ScDocument& rDoc = GetViewData().GetDocument();
1144 
1145  if( pReqArgs )
1146  {
1147  const SfxPoolItem* pItem;
1148  if( pReqArgs->HasItem( FID_PROTECT_DOC, &pItem ) &&
1149  static_cast<const SfxBoolItem*>(pItem)->GetValue() == rDoc.IsDocProtected() )
1150  {
1151  rReq.Ignore();
1152  break;
1153  }
1154  }
1155 
1156  ScDocProtection* pProtect = rDoc.GetDocProtection();
1157  if (pProtect && pProtect->isProtected())
1158  {
1159  bool bCancel = false;
1160  OUString aPassword;
1161 
1162  if (pProtect->isProtectedWithPass())
1163  {
1164  OUString aText(ScResId(SCSTR_PASSWORD));
1165 
1166  SfxPasswordDialog aDlg(GetFrameWeld(), &aText);
1167  aDlg.set_title(ScResId(SCSTR_UNPROTECTDOC));
1168  aDlg.SetMinLen(0);
1169  aDlg.set_help_id(GetStaticInterface()->GetSlot(FID_PROTECT_DOC)->GetCommand());
1171 
1172  if (aDlg.run() == RET_OK)
1173  aPassword = aDlg.GetPassword();
1174  else
1175  bCancel = true;
1176  }
1177  if (!bCancel)
1178  {
1179  Unprotect( TABLEID_DOC, aPassword );
1180  rReq.AppendItem( SfxBoolItem( FID_PROTECT_DOC, false ) );
1181  rReq.Done();
1182  }
1183  }
1184  else
1185  {
1186  OUString aText(ScResId(SCSTR_PASSWORDOPT));
1187 
1188  SfxPasswordDialog aDlg(GetFrameWeld(), &aText);
1189  aDlg.set_title(ScResId(SCSTR_PROTECTDOC));
1190  aDlg.SetMinLen( 0 );
1191  aDlg.set_help_id(GetStaticInterface()->GetSlot(FID_PROTECT_DOC)->GetCommand());
1193  aDlg.ShowExtras(SfxShowExtras::CONFIRM);
1195 
1196  if (aDlg.run() == RET_OK)
1197  {
1198  OUString aPassword = aDlg.GetPassword();
1199  Protect( TABLEID_DOC, aPassword );
1200  rReq.AppendItem( SfxBoolItem( FID_PROTECT_DOC, true ) );
1201  rReq.Done();
1202  }
1203  }
1204  rBindings.Invalidate( FID_PROTECT_DOC );
1205  }
1206  break;
1207 
1208  case FID_PROTECT_TABLE:
1209  {
1210  ScDocument& rDoc = GetViewData().GetDocument();
1211  SCTAB nTab = GetViewData().GetTabNo();
1212  bool bOldProtection = rDoc.IsTabProtected(nTab);
1213 
1214  if( pReqArgs )
1215  {
1216  const SfxPoolItem* pItem;
1217  bool bNewProtection = !bOldProtection;
1218  if( pReqArgs->HasItem( FID_PROTECT_TABLE, &pItem ) )
1219  bNewProtection = static_cast<const SfxBoolItem*>(pItem)->GetValue();
1220  if( bNewProtection == bOldProtection )
1221  {
1222  rReq.Ignore();
1223  break;
1224  }
1225  }
1226 
1227  if (bOldProtection)
1228  {
1229  // Unprotect a protected sheet.
1230 
1231  const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
1232  if (pProtect && pProtect->isProtectedWithPass())
1233  {
1234  OUString aText( ScResId(SCSTR_PASSWORDOPT) );
1235  SfxPasswordDialog aDlg(GetFrameWeld(), &aText);
1236  aDlg.set_title(ScResId(SCSTR_UNPROTECTTAB));
1237  aDlg.SetMinLen(0);
1238  aDlg.set_help_id(GetStaticInterface()->GetSlot(FID_PROTECT_TABLE)->GetCommand());
1240 
1241  if (aDlg.run() == RET_OK)
1242  {
1243  OUString aPassword = aDlg.GetPassword();
1244  Unprotect(nTab, aPassword);
1245  }
1246  }
1247  else
1248  // this sheet is not password-protected.
1249  Unprotect(nTab, OUString());
1250 
1251  if (!pReqArgs)
1252  {
1253  rReq.AppendItem( SfxBoolItem(FID_PROTECT_TABLE, false) );
1254  rReq.Done();
1255  }
1256  }
1257  else
1258  {
1259  // Protect a current sheet.
1260 
1262 
1263  const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
1264  if (pProtect)
1265  aDlg.SetDialogData(*pProtect);
1266 
1267  if (aDlg.run() == RET_OK)
1268  {
1269  pScMod->InputEnterHandler();
1270 
1271  ScTableProtection aNewProtect;
1272  aDlg.WriteData(aNewProtect);
1273  ProtectSheet(nTab, aNewProtect);
1274  if (!pReqArgs)
1275  {
1276  rReq.AppendItem( SfxBoolItem(FID_PROTECT_TABLE, true) );
1277  rReq.Done();
1278  }
1279  }
1280  }
1281  TabChanged();
1282  UpdateInputHandler(true); // to immediately enable input again
1283  SelectionChanged();
1284  }
1285  break;
1286 
1287  case SID_OPT_LOCALE_CHANGED :
1288  { // locale changed, SYSTEM number formats changed => repaint cell contents
1289  PaintGrid();
1290  rReq.Done();
1291  }
1292  break;
1293 
1294  default:
1295  OSL_FAIL("Unknown Slot at ScTabViewShell::Execute");
1296  break;
1297  }
1298 }
1299 
1300 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SC_DLLPUBLIC bool IsDocProtected() const
Definition: documen3.cxx:1878
#define MAXZOOM
Definition: global.hxx:78
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3046
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:408
void SetOption(ScViewOption eOpt, bool bNew)
Definition: viewopti.hxx:87
void Appear()
ScAddress aStart
Definition: address.hxx:500
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:354
void FreezeSplitters(bool bFreeze, SplitMethod eSplitMethod=SC_SPLIT_METHOD_CURSOR, SCCOLROW nFreezeIndex=-1)
Definition: tabview.cxx:1910
void RemoveManualBreaks()
Definition: viewfun2.cxx:975
SC_DLLPUBLIC bool IsTabProtected(SCTAB nTab) const
Definition: documen3.cxx:1889
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
SfxChildWindow * GetChildWindow(sal_uInt16)
static SfxInterface * GetStaticInterface()
SfxViewFrame * GetFrame() const
SCROW Row() const
Definition: address.hxx:262
OUString GetTitle(sal_uInt16 nMaxLen=0) const
void PostPaintGridAll()
Definition: docsh3.cxx:180
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:2751
bool SelectObject(std::u16string_view rName)
Definition: tabvwsh2.cxx:449
void MarkRange(const ScRange &rRange, bool bSetCursor=true, bool bContinue=false)
Definition: tabview3.cxx:1683
#define HID_PASSWD_TABLE
Definition: helpids.h:58
sheet protection state container
void SetHeaderMode(bool bNewMode)
Definition: viewdata.hxx:544
void SelectAllTables()
Definition: tabview2.cxx:1084
SfxDispatcher * GetDispatcher()
void SetPagebreakMode(bool bSet)
Definition: tabview5.cxx:434
static SvxAbstractDialogFactory * Create()
void RepeatResize(bool bUpdateFix=true)
Definition: tabview.cxx:770
long Long
void HideNoteMarker()
Definition: tabview2.cxx:1386
SCROW GetCurY() const
Definition: viewdata.hxx:402
SCCOLROW GetLOKSheetFreezeIndex(bool bIsCol) const
Definition: viewdata.cxx:4099
virtual bool isProtected() const override
sal_Int16 nId
const ContentProperties & rData
void PostPaintExtras()
Definition: docsh3.cxx:195
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
void PaintGrid()
Definition: tabview3.cxx:2624
bool IsSyntaxMode() const
Definition: viewdata.hxx:541
ScAddress aEnd
Definition: address.hxx:501
void Done(bool bRemove=false)
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
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:281
static void forEachOtherView(ViewShellType *pThisViewShell, FunctionType f)
SC_DLLPUBLIC void SetCursor(SCCOL nPosX, SCROW nPosY, bool bNew=false)
Definition: tabview3.cxx:359
RET_CANCEL
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
Definition: documen3.cxx:488
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:1186
NONE
void GetMarkArea(ScRange &rRange) const
Definition: markdata.cxx:112
void DeselectAllTables()
Definition: tabview2.cxx:1102
void ToggleChildWindow(sal_uInt16)
#define HID_PASSWD_DOC_CONFIRM
Definition: helpids.h:60
static UITestLogger & getInstance()
void logEvent(const EventDescription &rDescription)
void disposeAndReset(reference_type *pBody)
void PaintLeft()
Definition: tabview3.cxx:2700
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:870
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:312
void SetConfirmHelpId(const OString &rId)
bool Unprotect(SCTAB nTab, const OUString &rPassword)
Definition: viewfunc.cxx:2552
bool IsMultiMarked() const
Definition: markdata.hxx:83
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:3870
SC_DLLPUBLIC bool GetTable(const OUString &rName, SCTAB &rTab) const
Definition: document.cxx:258
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
Definition: tabvwsha.cxx:653
SCTAB Tab() const
Definition: address.hxx:271
void SetRow(SCROW nRowP)
Definition: address.hxx:275
ScSplitMode GetHSplitMode() const
Definition: viewdata.hxx:416
bool isdigitAsciiString(const OString &rString)
const Fraction & GetZoomY() const
Definition: viewdata.hxx:460
void SetCol(SCCOL nColP)
Definition: address.hxx:279
ScDrawLayer * MakeDrawLayer()
Definition: docsh2.cxx:166
ScViewData & GetViewData()
Definition: tabview.hxx:334
void PaintTop()
Definition: tabview3.cxx:2635
void SelectionChanged(bool bFromPaste=false)
Definition: tabview3.cxx:529
SfxItemPool & GetPool() const
bool PasteFile(const Point &, const OUString &, bool bLink)
Definition: viewfun4.cxx:578
tools::Long zoomOut(tools::Long nCurrent)
SC_DLLPUBLIC void SetAppOptions(const ScAppOptions &rOpt)
Definition: scmod.cxx:715
void AutoOutline()
Definition: dbfunc3.cxx:212
SC_DLLPUBLIC ScDocProtection * GetDocProtection() const
Definition: documen3.cxx:1865
void SetTab(SCTAB nTabP)
Definition: address.hxx:283
void SetZoom(const Fraction &rNewX, const Fraction &rNewY, bool bAll)
Definition: tabview5.cxx:418
bool IsMarked() const
Definition: markdata.hxx:82
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:3034
virtual VclPtr< AbstractScShowTabDlg > CreateScShowTabDlg(weld::Window *pParent)=0
sal_Int16 SCCOL
Definition: types.hxx:22
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:1794
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:88
void RemoveAllOutlines(bool bRecord=true)
Definition: dbfunc3.cxx:192
void InvalidateSplit()
Definition: tabview.cxx:2109
sal_uInt16 CalcZoom(SvxZoomType eType, sal_uInt16 nOldZoom)
Definition: tabview2.cxx:1180
void RemoveSplit()
Definition: tabview.cxx:2065
void SplitAtCursor()
Definition: tabview.cxx:2072
void SetDialogData(const ScTableProtection &rData)
void SetZoom(sal_uInt16 nNew)
Definition: appoptio.hxx:42
bool SetLOKSheetFreezeIndex(const SCCOLROW nFreezeIndex, bool bIsCol, SCTAB nForTab=-1)
Definition: viewdata.cxx:4105
SfxViewShell * GetViewShell() const
const SCTAB TABLEID_DOC
Definition: address.hxx:85
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
SCCOL Col() const
Definition: address.hxx:267
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
#define HID_SELECTTABLES
Definition: helpids.h:64
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:999
void Update(sal_uInt16 nId)
void SkipOverlapped(SCCOL &rCol, SCROW &rRow, SCTAB nTab) const
Definition: document.cxx:5714
sal_Int32 SCROW
Definition: types.hxx:18
sal_uInt16 GetSlot() const
SC_DLLPUBLIC void PutInOrder()
Definition: address.cxx:1582
bool ValidRow(SCROW nRow) const
Definition: document.hxx:873
weld::Window * GetFrameWeld() const
void SetCurSubShell(ObjectSelectionType eOST, bool bForce=false)
Definition: tabvwsh4.cxx:750
void ProtectSheet(SCTAB nTab, const ScTableProtection &rProtect)
Definition: viewfunc.cxx:2492
ScDrawView * GetScDrawView()
Definition: tabview.hxx:342
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:1412
SvxZoomType GetType() const
bool IsHeaderMode() const
Definition: viewdata.hxx:543
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
void Protect(SCTAB nTab, const OUString &rPassword)
Definition: viewfunc.cxx:2522
OUString GetPassword() const
const ScViewOptions & GetOptions() const
Definition: viewdata.hxx:537
virtual short run()
void SetZoomType(SvxZoomType eNew)
Definition: appoptio.hxx:44
void AlignToCursor(SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, const ScSplitPos *pWhich=nullptr)
Definition: tabview3.cxx:912
void ShowChildWindow(sal_uInt16, bool bVisible=true)
ScSplitMode
Definition: viewdata.hxx:43
void HideListBox()
Definition: tabview3.cxx:2960
void SetZoomType(SvxZoomType eNew, bool bAll)
Definition: tabview5.cxx:413
ObjectSelectionType GetCurObjectSelectionType() const
Definition: tabvwsh.hxx:298
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:906
void AppendItem(const SfxPoolItem &)
Point GetInsertPos() const
Definition: tabview.cxx:1667
void SetSyntaxMode(bool bNewMode)
Definition: viewdata.hxx:542
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:145
bool GetTableSelect(SCTAB nTab) const
Definition: markdata.cxx:184
std::map< OUString, OUString > aParameters
bool IsPagebreakMode() const
Definition: viewdata.hxx:425
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:211
void UpdatePageBreakData(bool bForcePaint=false)
Definition: tabview2.cxx:1445
ScSplitMode GetVSplitMode() const
Definition: viewdata.hxx:417
virtual VclPtr< AbstractSvxZoomDialog > CreateSvxZoomDialog(weld::Window *pParent, const SfxItemSet &rCoreSet)=0
virtual bool isProtectedWithPass() const override
sal_Int16 SCTAB
Definition: types.hxx:23
void AdjustPrintZoom()
Definition: viewfun2.cxx:1006
void ResetOldCursor()
Definition: viewdata.cxx:1336
bool RemoveLOKFreeze()
Definition: viewdata.cxx:4121
SCCOL GetCurX() const
Definition: viewdata.hxx:401
SC_DLLPUBLIC const ScTableProtection * GetTabProtection(SCTAB nTab) const
Definition: documen3.cxx:1898
#define HID_PASSWD_DOC
Definition: helpids.h:59
static OUString decode(OUString const &rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)