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