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