LibreOffice Module sc (master) 1
cellsh1.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 <config_features.h>
21
22#include <com/sun/star/i18n/TextConversionOption.hpp>
23#include <com/sun/star/sheet/DataPilotFieldFilter.hpp>
24
25#include <scitems.hxx>
26#include <sfx2/viewfrm.hxx>
27
28#include <basic/sberrors.hxx>
29#include <comphelper/lok.hxx>
31#include <svl/stritem.hxx>
32#include <svl/numformat.hxx>
33#include <svl/zforlist.hxx>
34#include <svl/zformat.hxx>
35#include <sfx2/dispatch.hxx>
36#include <sfx2/request.hxx>
38#include <vcl/svapp.hxx>
39#include <vcl/weld.hxx>
40#include <svx/svxdlg.hxx>
41#include <sot/formats.hxx>
42#include <svx/postattr.hxx>
43#include <editeng/fontitem.hxx>
44#include <svx/clipfmtitem.hxx>
45#include <svx/hlnkitem.hxx>
46#include <basic/sbxcore.hxx>
47#include <editeng/editview.hxx>
49
50#include <cellsh.hxx>
51#include <ftools.hxx>
52#include <sc.hrc>
53#include <document.hxx>
54#include <patattr.hxx>
55#include <scmod.hxx>
56#include <tabvwsh.hxx>
57#include <uiitems.hxx>
58#include <reffact.hxx>
59#include <inputhdl.hxx>
60#include <transobj.hxx>
61#include <drwtrans.hxx>
62#include <docfunc.hxx>
63#include <editable.hxx>
64#include <dpobject.hxx>
65#include <dpsave.hxx>
66#include <spellparam.hxx>
67#include <postit.hxx>
68#include <dpsdbtab.hxx>
69#include <dpshttab.hxx>
70#include <dbdata.hxx>
71#include <docsh.hxx>
72#include <cliputil.hxx>
73#include <markdata.hxx>
74#include <colorscale.hxx>
75#include <condformatdlg.hxx>
76#include <attrib.hxx>
77#include <condformatdlgitem.hxx>
78#include <impex.hxx>
79
80#include <globstr.hrc>
81#include <scresid.hxx>
82#include <scui_def.hxx>
83#include <scabstdlg.hxx>
85#include <cellvalue.hxx>
86#include <tokenarray.hxx>
87#include <formulacell.hxx>
88#include <gridwin.hxx>
89#include <searchresults.hxx>
90#include <Sparkline.hxx>
91
92#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
93#include <com/sun/star/lang/XInitialization.hpp>
94#include <com/sun/star/beans/XPropertySet.hpp>
95#include <com/sun/star/uno/XComponentContext.hpp>
97#include <o3tl/string_view.hxx>
98
99#include <memory>
100
101using namespace ::com::sun::star;
102using namespace ::com::sun::star::beans;
103using namespace ::com::sun::star::uno;
104
105namespace{
106InsertDeleteFlags FlagsFromString(const OUString& rFlagsStr,
108{
109 OUString aFlagsStr = rFlagsStr.toAsciiUpperCase();
111
112 for (sal_Int32 i=0 ; i < aFlagsStr.getLength(); ++i)
113 {
114 switch (aFlagsStr[i])
115 {
116 case 'A': return InsertDeleteFlags::ALL;
117 case 'S': nFlags |= InsertDeleteFlags::STRING & nFlagsMask; break;
118 case 'V': nFlags |= InsertDeleteFlags::VALUE & nFlagsMask; break;
119 case 'D': nFlags |= InsertDeleteFlags::DATETIME & nFlagsMask; break;
120 case 'F': nFlags |= InsertDeleteFlags::FORMULA & nFlagsMask; break;
121 case 'N': nFlags |= InsertDeleteFlags::NOTE & nFlagsMask; break;
122 case 'T': nFlags |= InsertDeleteFlags::ATTRIB & nFlagsMask; break;
123 case 'O': nFlags |= InsertDeleteFlags::OBJECTS & nFlagsMask; break;
124 }
125 }
126 return nFlags;
127}
128
129OUString FlagsToString( InsertDeleteFlags nFlags,
131{
132 OUString aFlagsStr;
133
134 if( nFlags == InsertDeleteFlags::ALL )
135 {
136 aFlagsStr = "A";
137 }
138 else
139 {
140 nFlags &= nFlagsMask;
141
142 if( nFlags & InsertDeleteFlags::STRING ) aFlagsStr += "S";
143 if( nFlags & InsertDeleteFlags::VALUE ) aFlagsStr += "V";
144 if( nFlags & InsertDeleteFlags::DATETIME ) aFlagsStr += "D";
145 if( nFlags & InsertDeleteFlags::FORMULA ) aFlagsStr += "F";
146 if( nFlags & InsertDeleteFlags::NOTE ) aFlagsStr += "N";
147 if( nFlags & InsertDeleteFlags::ATTRIB ) aFlagsStr += "T";
148 if( nFlags & InsertDeleteFlags::OBJECTS ) aFlagsStr += "O";
149 }
150 return aFlagsStr;
151}
152
153void SetTabNoAndCursor( const ScViewData& rViewData, std::u16string_view rCellId )
154{
155 ScTabViewShell* pTabViewShell = rViewData.GetViewShell();
156 assert(pTabViewShell);
157 const ScDocument& rDoc = rViewData.GetDocShell()->GetDocument();
158 std::vector<sc::NoteEntry> aNotes;
159 rDoc.GetAllNoteEntries(aNotes);
160
161 sal_uInt32 nId = o3tl::toUInt32(rCellId);
162 auto lComp = [nId](const sc::NoteEntry& rNote) { return rNote.mpNote->GetId() == nId; };
163
164 const auto& aFoundNoteIt = std::find_if(aNotes.begin(), aNotes.end(), lComp);
165 if (aFoundNoteIt != aNotes.end())
166 {
167 ScAddress aFoundPos = aFoundNoteIt->maPos;
168 pTabViewShell->SetTabNo(aFoundPos.Tab());
169 pTabViewShell->SetCursor(aFoundPos.Col(), aFoundPos.Row());
170 }
171}
172
173void InsertCells(ScTabViewShell* pTabViewShell, SfxRequest &rReq, InsCellCmd eCmd)
174{
175 if (eCmd!=INS_NONE)
176 {
177 pTabViewShell->InsertCells( eCmd );
178
179 if( ! rReq.IsAPI() )
180 {
181 OUString aParam;
182
183 switch( eCmd )
184 {
185 case INS_CELLSDOWN: aParam = "V"; break;
186 case INS_CELLSRIGHT: aParam = ">"; break;
187 case INS_INSROWS_BEFORE: aParam = "R"; break;
188 case INS_INSCOLS_BEFORE: aParam = "C"; break;
189 default:
190 {
191 // added to avoid warnings
192 }
193 }
194 rReq.AppendItem( SfxStringItem( FID_INS_CELL, aParam ) );
195 rReq.Done();
196 }
197 }
198}
199
200void DeleteCells(ScTabViewShell* pTabViewShell, SfxRequest &rReq, DelCellCmd eCmd)
201{
202 if (eCmd != DelCellCmd::NONE )
203 {
204 pTabViewShell->DeleteCells( eCmd );
205
206 if( ! rReq.IsAPI() )
207 {
208 OUString aParam;
209
210 switch( eCmd )
211 {
212 case DelCellCmd::CellsUp: aParam = "U"; break;
213 case DelCellCmd::CellsLeft: aParam = "L"; break;
214 case DelCellCmd::Rows: aParam = "R"; break;
215 case DelCellCmd::Cols: aParam = "C"; break;
216 default:
217 {
218 // added to avoid warnings
219 }
220 }
221 rReq.AppendItem( SfxStringItem( FID_DELETE_CELL, aParam ) );
222 rReq.Done();
223 }
224 }
225}
226}
227
229{
230 ScModule* pScMod = SC_MOD();
231 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
232 SfxBindings& rBindings = pTabViewShell->GetViewFrame()->GetBindings();
233 const SfxItemSet* pReqArgs = rReq.GetArgs();
234 sal_uInt16 nSlot = rReq.GetSlot();
235
236 pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox
237
238 // finish input
239 if ( GetViewData().HasEditView( GetViewData().GetActivePart() ) )
240 {
241 switch ( nSlot )
242 {
243 case FID_DEFINE_NAME:
244 case FID_ADD_NAME:
245 case FID_USE_NAME:
246 case FID_INSERT_NAME:
247 case SID_SPELL_DIALOG:
248 case SID_HANGUL_HANJA_CONVERSION:
249 case SID_OPENDLG_CONDFRMT:
250 case SID_OPENDLG_CURRENTCONDFRMT:
251 case SID_OPENDLG_COLORSCALE:
252 case SID_OPENDLG_DATABAR:
253 pScMod->InputEnterHandler();
254 pTabViewShell->UpdateInputHandler();
255 break;
256
257 default:
258 break;
259 }
260 }
261
262 switch ( nSlot )
263 {
264
265 // insert / delete cells / rows / columns
266
267 case FID_INS_ROW:
268 case FID_INS_ROWS_BEFORE:
269 pTabViewShell->InsertCells(INS_INSROWS_BEFORE);
270 rReq.Done();
271 break;
272
273 case FID_INS_COLUMN:
274 case FID_INS_COLUMNS_BEFORE:
275 pTabViewShell->InsertCells(INS_INSCOLS_BEFORE);
276 rReq.Done();
277 break;
278
279 case FID_INS_ROWS_AFTER:
280 pTabViewShell->InsertCells(INS_INSROWS_AFTER);
281 rReq.Done();
282 break;
283
284 case FID_INS_COLUMNS_AFTER:
285 pTabViewShell->InsertCells(INS_INSCOLS_AFTER);
286 rReq.Done();
287 break;
288
289 case FID_INS_CELLSDOWN:
290 pTabViewShell->InsertCells(INS_CELLSDOWN);
291 rReq.Done();
292 break;
293
294 case FID_INS_CELLSRIGHT:
295 pTabViewShell->InsertCells(INS_CELLSRIGHT);
296 rReq.Done();
297 break;
298
299 case SID_DEL_ROWS:
300 pTabViewShell->DeleteCells( DelCellCmd::Rows );
301 rReq.Done();
302 break;
303
304 case SID_DEL_COLS:
305 pTabViewShell->DeleteCells( DelCellCmd::Cols );
306 rReq.Done();
307 break;
308
309 case FID_INS_CELL:
310 {
311 InsCellCmd eCmd=INS_NONE;
312
313 if ( pReqArgs )
314 {
315 const SfxPoolItem* pItem;
316 OUString aFlags;
317
318 if( pReqArgs->HasItem( FID_INS_CELL, &pItem ) )
319 aFlags = static_cast<const SfxStringItem*>(pItem)->GetValue();
320 if( !aFlags.isEmpty() )
321 {
322 switch( aFlags[0] )
323 {
324 case 'V': eCmd = INS_CELLSDOWN ;break;
325 case '>': eCmd = INS_CELLSRIGHT ;break;
326 case 'R': eCmd = INS_INSROWS_BEFORE ;break;
327 case 'C': eCmd = INS_INSCOLS_BEFORE ;break;
328 }
329 }
330 }
331 else
332 {
334 eCmd = INS_INSCOLS_BEFORE;
335 else if ( GetViewData().SimpleRowMarked() )
336 eCmd = INS_INSROWS_BEFORE;
337 else
338 {
340 bool bTheFlag=(rDoc.GetChangeTrack()!=nullptr);
341
343
344 VclPtr<AbstractScInsertCellDlg> pDlg(pFact->CreateScInsertCellDlg(pTabViewShell->GetFrameWeld(), bTheFlag));
345 pDlg->StartExecuteAsync([pDlg, pTabViewShell](sal_Int32 nResult){
346 if (nResult == RET_OK)
347 {
348 SfxRequest aRequest(pTabViewShell->GetViewFrame(), FID_INS_CELL);
349 InsertCells(pTabViewShell, aRequest, pDlg->GetInsCellCmd());
350 }
351 pDlg->disposeOnce();
352 });
353 }
354 }
355
356 InsertCells(pTabViewShell, rReq, eCmd);
357 }
358 break;
359
360 case FID_DELETE_CELL:
361 {
363
364 if ( pReqArgs )
365 {
366 const SfxPoolItem* pItem;
367 OUString aFlags;
368
369 if( pReqArgs->HasItem( FID_DELETE_CELL, &pItem ) )
370 aFlags = static_cast<const SfxStringItem*>(pItem)->GetValue();
371 if( !aFlags.isEmpty() )
372 {
373 switch( aFlags[0] )
374 {
375 case 'U': eCmd = DelCellCmd::CellsUp ;break;
376 case 'L': eCmd = DelCellCmd::CellsLeft ;break;
377 case 'R': eCmd = DelCellCmd::Rows ;break;
378 case 'C': eCmd = DelCellCmd::Cols ;break;
379 }
380 }
381 }
382 else
383 {
385 eCmd = DelCellCmd::Cols;
386 else if ( GetViewData().SimpleRowMarked() )
387 eCmd = DelCellCmd::Rows;
388 else
389 {
390 ScRange aRange;
392 bool bTheFlag=GetViewData().IsMultiMarked() ||
394 (rDoc.GetChangeTrack() != nullptr);
395
397 VclPtr<AbstractScDeleteCellDlg> pDlg(pFact->CreateScDeleteCellDlg( pTabViewShell->GetFrameWeld(), bTheFlag ));
398
399 pDlg->StartExecuteAsync([pDlg, pTabViewShell](sal_Int32 nResult){
400 if (nResult == RET_OK)
401 {
402 SfxRequest aRequest(pTabViewShell->GetViewFrame(), FID_INS_CELL);
403 DeleteCells(pTabViewShell, aRequest, pDlg->GetDelCellCmd());
404 }
405 pDlg->disposeOnce();
406 });
407 }
408 }
409 DeleteCells(pTabViewShell, rReq, eCmd);
410 }
411 break;
412
413 // delete contents from cells
414
415 case SID_DELETE_CONTENTS:
417 rReq.Done();
418 break;
419
420 case SID_DELETE:
421 {
423
424 if ( pReqArgs!=nullptr && pTabViewShell->SelectionEditable() )
425 {
426 const SfxPoolItem* pItem;
427 OUString aFlags('A');
428
429 if( pReqArgs->HasItem( SID_DELETE, &pItem ) )
430 aFlags = static_cast<const SfxStringItem*>(pItem)->GetValue();
431
432 nFlags |= FlagsFromString(aFlags, InsertDeleteFlags::ALL);
433 }
434 else
435 {
436 ScEditableTester aTester( pTabViewShell );
437 if (aTester.IsEditable())
438 {
440
443 SCTAB nTab = GetViewData().GetTabNo();
444 if ( rDoc.IsTabProtected(nTab) )
445 pDlg->DisableObjects();
446 if (pDlg->Execute() == RET_OK)
447 {
448 nFlags = pDlg->GetDelContentsCmdBits();
449 }
450 }
451 else
452 pTabViewShell->ErrorMessage(aTester.GetMessageId());
453 }
454
455 if( nFlags != InsertDeleteFlags::NONE )
456 {
457 pTabViewShell->DeleteContents( nFlags );
458
459 if( ! rReq.IsAPI() )
460 {
461 OUString aFlags = FlagsToString( nFlags, InsertDeleteFlags::ALL );
462
463 rReq.AppendItem( SfxStringItem( SID_DELETE, aFlags ) );
464 rReq.Done();
465 }
466 }
467 }
468 break;
469
470 // fill...
471
472 case FID_FILL_TO_BOTTOM:
473 pTabViewShell->FillSimple( FILL_TO_BOTTOM );
474 rReq.Done();
475 break;
476
477 case FID_FILL_TO_RIGHT:
478 pTabViewShell->FillSimple( FILL_TO_RIGHT );
479 rReq.Done();
480 break;
481
482 case FID_FILL_TO_TOP:
483 pTabViewShell->FillSimple( FILL_TO_TOP );
484 rReq.Done();
485 break;
486
487 case FID_FILL_TO_LEFT:
488 pTabViewShell->FillSimple( FILL_TO_LEFT );
489 rReq.Done();
490 break;
491
492 case FID_FILL_TAB:
493 {
495 ScPasteFunc nFunction = ScPasteFunc::NONE;
496 bool bSkipEmpty = false;
497 bool bAsLink = false;
498
499 if ( pReqArgs!=nullptr && pTabViewShell->SelectionEditable() )
500 {
501 const SfxPoolItem* pItem;
502 OUString aFlags('A');
503
504 if( pReqArgs->HasItem( FID_FILL_TAB, &pItem ) )
505 aFlags = static_cast<const SfxStringItem*>(pItem)->GetValue();
506
507 nFlags |= FlagsFromString(aFlags);
508 }
509 else
510 {
512
514 new OUString(ScResId(STR_FILL_TAB))));
515 pDlg->SetFillMode(true);
516
517 if (pDlg->Execute() == RET_OK)
518 {
519 nFlags = pDlg->GetInsContentsCmdBits();
520 nFunction = pDlg->GetFormulaCmdBits();
521 bSkipEmpty = pDlg->IsSkipEmptyCells();
522 bAsLink = pDlg->IsLink();
523 // there is no MoveMode with fill tabs
524 }
525 }
526
527 if( nFlags != InsertDeleteFlags::NONE )
528 {
529 pTabViewShell->FillTab( nFlags, nFunction, bSkipEmpty, bAsLink );
530
531 if( ! rReq.IsAPI() )
532 {
533 OUString aFlags = FlagsToString( nFlags );
534
535 rReq.AppendItem( SfxStringItem( FID_FILL_TAB, aFlags ) );
536 rReq.Done();
537 }
538 }
539 }
540 break;
541
542 case FID_FILL_SERIES:
543 {
544 if (GetViewData().SelectionForbidsCellFill())
545 // Slot should be already disabled, but in case it wasn't
546 // don't even attempt to do the evaluation and popup a
547 // dialog.
548 break;
549
550 SCCOL nStartCol;
551 SCROW nStartRow;
552 SCTAB nStartTab;
553 SCCOL nEndCol;
554 SCROW nEndRow;
555 SCTAB nEndTab;
556 sal_uInt16 nPossDir = FDS_OPT_NONE;
557 FillDir eFillDir = FILL_TO_BOTTOM;
558 FillCmd eFillCmd = FILL_LINEAR;
559 FillDateCmd eFillDateCmd = FILL_DAY;
560 double fStartVal = MAXDOUBLE;
561 double fIncVal = 1;
562 double fMaxVal = MAXDOUBLE;
563 bool bDoIt = false;
564
565 GetViewData().GetSimpleArea( nStartCol, nStartRow, nStartTab,
566 nEndCol, nEndRow, nEndTab );
567
568 if( nStartCol!=nEndCol )
569 {
570 nPossDir |= FDS_OPT_HORZ;
571 eFillDir=FILL_TO_RIGHT;
572 }
573
574 if( nStartRow!=nEndRow )
575 {
576 nPossDir |= FDS_OPT_VERT;
577 eFillDir=FILL_TO_BOTTOM;
578 }
579
581 SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
582
583 if( pReqArgs )
584 {
585 const SfxPoolItem* pItem;
586 OUString aFillDir, aFillCmd, aFillDateCmd;
587 OUString aFillStep, aFillStart, aFillMax;
588 sal_uInt32 nKey;
589 double fTmpVal;
590
591 if( pReqArgs->HasItem( FID_FILL_SERIES, &pItem ) )
592 aFillDir = static_cast<const SfxStringItem*>(pItem)->GetValue();
593 if( pReqArgs->HasItem( FN_PARAM_1, &pItem ) )
594 aFillCmd = static_cast<const SfxStringItem*>(pItem)->GetValue();
595 if( pReqArgs->HasItem( FN_PARAM_2, &pItem ) )
596 aFillDateCmd = static_cast<const SfxStringItem*>(pItem)->GetValue();
597 if( pReqArgs->HasItem( FN_PARAM_3, &pItem ) )
598 aFillStep = static_cast<const SfxStringItem*>(pItem)->GetValue();
599 if( pReqArgs->HasItem( FN_PARAM_4, &pItem ) )
600 aFillStart = static_cast<const SfxStringItem*>(pItem)->GetValue();
601 if( pReqArgs->HasItem( FN_PARAM_5, &pItem ) )
602 aFillMax = static_cast<const SfxStringItem*>(pItem)->GetValue();
603
604 if( !aFillDir.isEmpty() )
605 switch( aFillDir[0] )
606 {
607 case 'B': case 'b': eFillDir=FILL_TO_BOTTOM; break;
608 case 'R': case 'r': eFillDir=FILL_TO_RIGHT; break;
609 case 'T': case 't': eFillDir=FILL_TO_TOP; break;
610 case 'L': case 'l': eFillDir=FILL_TO_LEFT; break;
611 }
612
613 if( !aFillCmd.isEmpty() )
614 switch( aFillCmd[0] )
615 {
616 case 'S': case 's': eFillCmd=FILL_SIMPLE; break;
617 case 'L': case 'l': eFillCmd=FILL_LINEAR; break;
618 case 'G': case 'g': eFillCmd=FILL_GROWTH; break;
619 case 'D': case 'd': eFillCmd=FILL_DATE; break;
620 case 'A': case 'a': eFillCmd=FILL_AUTO; break;
621 }
622
623 if( !aFillDateCmd.isEmpty() )
624 switch( aFillDateCmd[0] )
625 {
626 case 'D': case 'd': eFillDateCmd=FILL_DAY; break;
627 case 'W': case 'w': eFillDateCmd=FILL_WEEKDAY; break;
628 case 'M': case 'm': eFillDateCmd=FILL_MONTH; break;
629 case 'Y': case 'y': eFillDateCmd=FILL_YEAR; break;
630 }
631
632 nKey = 0;
633 if( pFormatter->IsNumberFormat( aFillStart, nKey, fTmpVal ))
634 fStartVal = fTmpVal;
635
636 nKey = 0;
637 if( pFormatter->IsNumberFormat( aFillStep, nKey, fTmpVal ))
638 fIncVal = fTmpVal;
639
640 nKey = 0;
641 if( pFormatter->IsNumberFormat( aFillMax, nKey, fTmpVal ))
642 fMaxVal = fTmpVal;
643
644 bDoIt = true;
645
646 }
647 else // (pReqArgs == nullptr) => raise Dialog
648 {
649 sal_uInt32 nPrivFormat = rDoc.GetNumberFormat( nStartCol, nStartRow, nStartTab );
650 CellType eCellType = rDoc.GetCellType( nStartCol, nStartRow, nStartTab );
651 const SvNumberformat* pPrivEntry = pFormatter->GetEntry( nPrivFormat );
652 const SCSIZE nSelectHeight = nEndRow - nStartRow + 1;
653 const SCSIZE nSelectWidth = nEndCol - nStartCol + 1;
654
655 if (!pPrivEntry)
656 {
657 OSL_FAIL("Numberformat not found !!!");
658 }
659 else
660 {
661 SvNumFormatType nPrivType = pPrivEntry->GetType();
662 if (nPrivType & SvNumFormatType::DATE)
663 {
664 eFillCmd=FILL_DATE;
665 }
666 else if(eCellType==CELLTYPE_STRING)
667 {
668 eFillCmd=FILL_AUTO;
669 }
670 }
671
672 OUString aStartStr;
673
674 // suggest default Startvalue only, when just 1 row or column
675 if ( nStartCol == nEndCol || nStartRow == nEndRow )
676 {
677 double fInputEndVal = 0.0;
678 OUString aEndStr;
679
680 const bool forceSystemLocale = true;
681 aStartStr = rDoc.GetInputString( nStartCol, nStartRow, nStartTab, forceSystemLocale );
682 fStartVal = rDoc.GetValue( nStartCol, nStartRow, nStartTab );
683
684 if(eFillDir==FILL_TO_BOTTOM && nStartRow < nEndRow )
685 {
686 aEndStr = rDoc.GetInputString( nStartCol, nStartRow+1, nStartTab, forceSystemLocale );
687 if(!aEndStr.isEmpty())
688 {
689 fInputEndVal = rDoc.GetValue( nStartCol, nStartRow+1, nStartTab );
690 fIncVal=fInputEndVal-fStartVal;
691 }
692 }
693 else
694 {
695 if(nStartCol < nEndCol)
696 {
697 aEndStr = rDoc.GetInputString( nStartCol+1, nStartRow, nStartTab, forceSystemLocale );
698 if(!aEndStr.isEmpty())
699 {
700 fInputEndVal = rDoc.GetValue( nStartCol+1, nStartRow, nStartTab );
701 fIncVal=fInputEndVal-fStartVal;
702 }
703 }
704 }
705 if(eFillCmd==FILL_DATE)
706 {
707 const Date& rNullDate = rDoc.GetFormatTable()->GetNullDate();
708 Date aStartDate = rNullDate;
709 aStartDate.AddDays(fStartVal);
710 Date aEndDate = rNullDate;
711 aEndDate.AddDays(fInputEndVal);
712 double fTempDate=0;
713
714 if(aStartDate.GetYear()!=aEndDate.GetYear())
715 {
716 eFillDateCmd = FILL_YEAR;
717 fTempDate=aEndDate.GetYear()-aStartDate.GetYear();
718 }
719 if(aStartDate.GetMonth()!=aEndDate.GetMonth())
720 {
721 eFillDateCmd = FILL_MONTH;
722 fTempDate=fTempDate*12+aEndDate.GetMonth()-aStartDate.GetMonth();
723 }
724 if(aStartDate.GetDay()==aEndDate.GetDay())
725 {
726 fIncVal=fTempDate;
727 }
728 }
729 }
731
733 rDoc,
734 eFillDir, eFillCmd, eFillDateCmd,
735 aStartStr, fIncVal, fMaxVal,
736 nSelectHeight, nSelectWidth, nPossDir));
737
738 if ( nStartCol != nEndCol && nStartRow != nEndRow )
739 {
740 pDlg->SetEdStartValEnabled(false);
741 }
742
743 if ( pDlg->Execute() == RET_OK )
744 {
745 eFillDir = pDlg->GetFillDir();
746 eFillCmd = pDlg->GetFillCmd();
747 eFillDateCmd = pDlg->GetFillDateCmd();
748
749 if(eFillCmd==FILL_AUTO)
750 {
751 OUString aStr = pDlg->GetStartStr();
752 if(!aStr.isEmpty())
753 pTabViewShell->EnterData( nStartCol, nStartRow, nStartTab, aStr );
754 }
755 fStartVal = pDlg->GetStart();
756 fIncVal = pDlg->GetStep();
757 fMaxVal = pDlg->GetMax();
758 bDoIt = true;
759 }
760 }
761
762 if( bDoIt )
763 {
764 //nScFillModeMouseModifier = 0; // no Ctrl/Copy
765 pTabViewShell->FillSeries( eFillDir, eFillCmd, eFillDateCmd, fStartVal, fIncVal, fMaxVal );
766
767 if( ! rReq.IsAPI() )
768 {
769 OUString aPara;
770 const Color* pColor = nullptr;
771
772 switch( eFillDir )
773 {
774 case FILL_TO_BOTTOM: aPara = "B"; break;
775 case FILL_TO_RIGHT: aPara = "R"; break;
776 case FILL_TO_TOP: aPara = "T"; break;
777 case FILL_TO_LEFT: aPara = "L"; break;
778 default: break;
779 }
780 rReq.AppendItem( SfxStringItem( FID_FILL_SERIES, aPara ) );
781
782 switch( eFillCmd )
783 {
784 case FILL_SIMPLE: aPara = "S"; break;
785 case FILL_LINEAR: aPara = "L"; break;
786 case FILL_GROWTH: aPara = "G"; break;
787 case FILL_DATE: aPara = "D"; break;
788 case FILL_AUTO: aPara = "A"; break;
789 default: break;
790 }
791 rReq.AppendItem( SfxStringItem( FN_PARAM_1, aPara ) );
792
793 switch( eFillDateCmd )
794 {
795 case FILL_DAY: aPara = "D"; break;
796 case FILL_WEEKDAY: aPara = "W"; break;
797 case FILL_MONTH: aPara = "M"; break;
798 case FILL_YEAR: aPara = "Y"; break;
799 default: break;
800 }
801 rReq.AppendItem( SfxStringItem( FN_PARAM_2, aPara ) );
802
803 sal_uInt32 nFormatKey = pFormatter->GetStandardFormat(SvNumFormatType::NUMBER,
805
806 pFormatter->GetOutputString( fIncVal, nFormatKey, aPara, &pColor );
807 rReq.AppendItem( SfxStringItem( FN_PARAM_3, aPara ) );
808
809 pFormatter->GetOutputString( fStartVal, nFormatKey, aPara, &pColor );
810 rReq.AppendItem( SfxStringItem( FN_PARAM_4, aPara ) );
811
812 pFormatter->GetOutputString( fMaxVal, nFormatKey, aPara, &pColor );
813 rReq.AppendItem( SfxStringItem( FN_PARAM_5, aPara ) );
814
815 rReq.Done();
816 }
817 }
818 }
819 break;
820
821 case FID_FILL_AUTO:
822 {
823 SCCOL nStartCol;
824 SCROW nStartRow;
825 SCCOL nEndCol;
826 SCROW nEndRow;
827
828 GetViewData().GetFillData( nStartCol, nStartRow, nEndCol, nEndRow );
829 SCCOL nFillCol = GetViewData().GetRefEndX();
830 SCROW nFillRow = GetViewData().GetRefEndY();
832
833 if( pReqArgs != nullptr )
834 {
835 if( const SfxStringItem* pItem = pReqArgs->GetItemIfSet( FID_FILL_AUTO ) )
836 {
837 ScAddress aScAddress;
838 OUString aArg = pItem->GetValue();
839
840 if( aScAddress.Parse( aArg, rDoc, rDoc.GetAddressConvention() ) & ScRefFlags::VALID )
841 {
842 nFillRow = aScAddress.Row();
843 nFillCol = aScAddress.Col();
844 }
845 }
846
847 SCTAB nStartTab, nEndTab;
848 GetViewData().GetSimpleArea( nStartCol,nStartRow,nStartTab,
849 nEndCol,nEndRow,nEndTab );
850 }
851 else // call via mouse
852 {
853 // not in a merged cell
854
855 if ( nStartCol == nEndCol && nStartRow == nEndRow )
856 {
857 SCCOL nMergeCol = nStartCol;
858 SCROW nMergeRow = nStartRow;
859 if ( GetViewData().GetDocument().ExtendMerge(
860 nStartCol, nStartRow, nMergeCol, nMergeRow,
861 GetViewData().GetTabNo() ) )
862 {
863 if ( nFillCol >= nStartCol && nFillCol <= nMergeCol && nFillRow == nStartRow )
864 nFillCol = nStartCol;
865 if ( nFillRow >= nStartRow && nFillRow <= nMergeRow && nFillCol == nStartCol )
866 nFillRow = nStartRow;
867 }
868 }
869 }
870
871 if ( nFillCol != nEndCol || nFillRow != nEndRow )
872 {
873 if ( nFillCol==nEndCol || nFillRow==nEndRow )
874 {
875 FillDir eDir = FILL_TO_BOTTOM;
876 SCCOLROW nCount = 0;
877
878 if ( nFillCol==nEndCol )
879 {
880 if ( nFillRow > nEndRow )
881 {
882 eDir = FILL_TO_BOTTOM;
883 nCount = nFillRow - nEndRow;
884 }
885 else if ( nFillRow < nStartRow )
886 {
887 eDir = FILL_TO_TOP;
888 nCount = nStartRow - nFillRow;
889 }
890 }
891 else
892 {
893 if ( nFillCol > nEndCol )
894 {
895 eDir = FILL_TO_RIGHT;
896 nCount = nFillCol - nEndCol;
897 }
898 else if ( nFillCol < nStartCol )
899 {
900 eDir = FILL_TO_LEFT;
901 nCount = nStartCol - nFillCol;
902 }
903 }
904
905 if ( nCount != 0)
906 {
907 pTabViewShell->FillAuto( eDir, nStartCol, nStartRow, nEndCol, nEndRow, nCount );
908
909 if( ! rReq.IsAPI() )
910 {
911 ScAddress aAdr( nFillCol, nFillRow, 0 );
912 OUString aAdrStr(aAdr.Format(ScRefFlags::RANGE_ABS, &rDoc, rDoc.GetAddressConvention()));
913
914 rReq.AppendItem( SfxStringItem( FID_FILL_AUTO, aAdrStr ) );
915 rReq.Done();
916 }
917 }
918
919 }
920 else
921 {
922 OSL_FAIL( "Direction not unique for autofill" );
923 }
924 }
925 }
926 break;
927 case FID_FILL_SINGLE_EDIT:
929 break;
930 case SID_RANDOM_NUMBER_GENERATOR_DIALOG:
931 {
933 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
934 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
935
936 pScMod->SetRefDialog( nId, pWnd == nullptr );
937
938 }
939 break;
940 case SID_SAMPLING_DIALOG:
941 {
943 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
944 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
945
946 pScMod->SetRefDialog( nId, pWnd == nullptr );
947 }
948 break;
949 case SID_DESCRIPTIVE_STATISTICS_DIALOG:
950 {
952 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
953 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
954
955 pScMod->SetRefDialog( nId, pWnd == nullptr );
956 }
957 break;
958 case SID_ANALYSIS_OF_VARIANCE_DIALOG:
959 {
961 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
962 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
963
964 pScMod->SetRefDialog( nId, pWnd == nullptr );
965 }
966 break;
967 case SID_CORRELATION_DIALOG:
968 {
970 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
971 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
972
973 pScMod->SetRefDialog( nId, pWnd == nullptr );
974 }
975 break;
976 case SID_COVARIANCE_DIALOG:
977 {
979 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
980 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
981
982 pScMod->SetRefDialog( nId, pWnd == nullptr );
983 }
984 break;
985 case SID_EXPONENTIAL_SMOOTHING_DIALOG:
986 {
988 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
989 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
990
991 pScMod->SetRefDialog( nId, pWnd == nullptr );
992 }
993 break;
994 case SID_MOVING_AVERAGE_DIALOG:
995 {
997 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
998 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
999
1000 pScMod->SetRefDialog( nId, pWnd == nullptr );
1001 }
1002 break;
1003 case SID_REGRESSION_DIALOG:
1004 {
1006 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
1007 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
1008
1009 pScMod->SetRefDialog( nId, pWnd == nullptr );
1010 }
1011 break;
1012 case SID_TTEST_DIALOG:
1013 {
1015 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
1016 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
1017
1018 pScMod->SetRefDialog( nId, pWnd == nullptr );
1019
1020 }
1021 break;
1022 case SID_FTEST_DIALOG:
1023 {
1025 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
1026 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
1027
1028 pScMod->SetRefDialog( nId, pWnd == nullptr );
1029
1030 }
1031 break;
1032 case SID_ZTEST_DIALOG:
1033 {
1035 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
1036 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
1037
1038 pScMod->SetRefDialog( nId, pWnd == nullptr );
1039
1040 }
1041 break;
1042 case SID_CHI_SQUARE_TEST_DIALOG:
1043 {
1045 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
1046 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
1047
1048 pScMod->SetRefDialog( nId, pWnd == nullptr );
1049
1050 }
1051 break;
1052 case SID_FOURIER_ANALYSIS_DIALOG:
1053 {
1055 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
1056 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
1057
1058 pScMod->SetRefDialog( nId, pWnd == nullptr );
1059
1060 }
1061 break;
1062 case SID_SEARCH_RESULTS_DIALOG:
1063 {
1064 const SfxPoolItem* pItem = nullptr;
1065 if (pReqArgs && pReqArgs->HasItem(SID_SEARCH_RESULTS_DIALOG, &pItem))
1066 {
1067 bool bVisible = static_cast<const SfxBoolItem*>(pItem)->GetValue();
1068 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
1069 // The window ID should equal the slot ID, but not a biggie if it wasn't.
1070 sal_uInt16 nId = sc::SearchResultsDlgWrapper::GetChildWindowId();
1071 pViewFrm->SetChildWindow(nId, bVisible, false);
1072 }
1073 rReq.Done();
1074 }
1075 break;
1076
1077 case SID_INSERT_SPARKLINE:
1078 case SID_EDIT_SPARKLINE_GROUP:
1079 {
1081 SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame();
1082 SfxChildWindow* pWindow = pViewFrame->GetChildWindow(nId);
1083 pScMod->SetRefDialog(nId, pWindow == nullptr);
1084 rReq.Done();
1085 }
1086 break;
1087
1088 case SID_EDIT_SPARKLINE:
1089 {
1091 SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame();
1092 SfxChildWindow* pWindow = pViewFrame->GetChildWindow(nId);
1093 pScMod->SetRefDialog(nId, pWindow == nullptr);
1094 rReq.Done();
1095 }
1096 break;
1097
1098 case SID_DELETE_SPARKLINE:
1099 {
1101
1102 rReq.Done();
1103 }
1104 break;
1105
1106 case SID_DELETE_SPARKLINE_GROUP:
1107 {
1108 ScRange aMarkRange;
1109 ScMarkType eMarkType = GetViewData().GetSimpleArea(aMarkRange);
1110 if (eMarkType == SC_MARK_SIMPLE)
1111 {
1112 std::shared_ptr<sc::SparklineGroup> pSparklineGroup;
1113 if (GetViewData().GetDocument().GetSparklineGroupInRange(aMarkRange, pSparklineGroup) && pSparklineGroup)
1114 {
1115 GetViewData().GetDocShell()->GetDocFunc().DeleteSparklineGroup(pSparklineGroup, GetViewData().GetTabNo());
1116 }
1117 }
1118 rReq.Done();
1119 }
1120 break;
1121
1122 case SID_GROUP_SPARKLINES:
1123 {
1124 ScRange aRange;
1125 if (GetViewData().GetSimpleArea(aRange) == SC_MARK_SIMPLE)
1126 {
1127 ScAddress aCursorAddress(GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo());
1128 auto pSparkline = GetViewData().GetDocument().GetSparkline(aCursorAddress);
1129 if (pSparkline)
1130 {
1131 auto const& rpSparklineGroup = pSparkline->getSparklineGroup();
1132 GetViewData().GetDocShell()->GetDocFunc().GroupSparklines(aRange, rpSparklineGroup);
1133 }
1134 }
1135 rReq.Done();
1136 }
1137 break;
1138
1139 case SID_UNGROUP_SPARKLINES:
1140 {
1141 ScRange aRange;
1142 if (GetViewData().GetSimpleArea(aRange) == SC_MARK_SIMPLE)
1143 {
1145 }
1146 rReq.Done();
1147 }
1148 break;
1149
1150 // disposal (Outlines)
1151 // SID_AUTO_OUTLINE, SID_OUTLINE_DELETEALL in Execute (in docsh.idl)
1152
1153 case SID_OUTLINE_HIDE:
1154 if ( GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(),
1155 GetViewData().GetCurY(), GetViewData().GetTabNo() ) )
1156 pTabViewShell->SetDataPilotDetails( false );
1157 else
1158 pTabViewShell->HideMarkedOutlines();
1159 rReq.Done();
1160 break;
1161
1162 case SID_OUTLINE_SHOW:
1163 {
1164 ScDPObject* pDPObj = GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(),
1165 GetViewData().GetCurY(), GetViewData().GetTabNo() );
1166 if ( pDPObj )
1167 {
1168 Sequence<sheet::DataPilotFieldFilter> aFilters;
1169 css::sheet::DataPilotFieldOrientation nOrientation;
1170 if ( pTabViewShell->HasSelectionForDrillDown( nOrientation ) )
1171 {
1174 pTabViewShell->GetFrameWeld(), *pDPObj, nOrientation ) );
1175 if ( pDlg->Execute() == RET_OK )
1176 {
1177 OUString aNewDimName( pDlg->GetDimensionName() );
1178 pTabViewShell->SetDataPilotDetails( true, &aNewDimName );
1179 }
1180 }
1181 else if ( !pDPObj->IsServiceData() &&
1183 ScAddress( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() ),
1184 aFilters ) )
1185 pTabViewShell->ShowDataPilotSourceData( *pDPObj, aFilters );
1186 else
1187 pTabViewShell->SetDataPilotDetails(true);
1188 }
1189 else
1190 pTabViewShell->ShowMarkedOutlines();
1191 rReq.Done();
1192 }
1193 break;
1194
1195 case SID_OUTLINE_MAKE:
1196 {
1197 bool bColumns = false;
1198 bool bOk = true;
1199
1200 if ( GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(),
1201 GetViewData().GetCurY(), GetViewData().GetTabNo() ) )
1202 {
1203 ScDPNumGroupInfo aNumInfo;
1204 aNumInfo.mbEnable = true;
1205 aNumInfo.mbAutoStart = true;
1206 aNumInfo.mbAutoEnd = true;
1207 sal_Int32 nParts = 0;
1208 if ( pTabViewShell->HasSelectionForDateGroup( aNumInfo, nParts ) )
1209 {
1211 const Date& rNullDate( GetViewData().GetDocument().GetFormatTable()->GetNullDate() );
1213 pTabViewShell->GetFrameWeld(),
1214 aNumInfo, nParts, rNullDate ) );
1215 if( pDlg->Execute() == RET_OK )
1216 {
1217 aNumInfo = pDlg->GetGroupInfo();
1218 pTabViewShell->DateGroupDataPilot( aNumInfo, pDlg->GetDatePart() );
1219 }
1220 }
1221 else if ( pTabViewShell->HasSelectionForNumGroup( aNumInfo ) )
1222 {
1225 pTabViewShell->GetFrameWeld(), aNumInfo ) );
1226 if( pDlg->Execute() == RET_OK )
1227 pTabViewShell->NumGroupDataPilot( pDlg->GetGroupInfo() );
1228 }
1229 else
1230 pTabViewShell->GroupDataPilot();
1231
1232 bOk = false;
1233 }
1234 else if( pReqArgs != nullptr )
1235 {
1236 const SfxPoolItem* pItem;
1237 bOk = false;
1238
1239 if( pReqArgs->HasItem( SID_OUTLINE_MAKE, &pItem ) )
1240 {
1241 OUString aCol = static_cast<const SfxStringItem*>(pItem)->GetValue();
1242 aCol = aCol.toAsciiUpperCase();
1243
1244 switch( aCol[0] )
1245 {
1246 case 'R': bColumns=false; bOk = true;break;
1247 case 'C': bColumns=true; bOk = true;break;
1248 }
1249 }
1250 }
1251 else // Dialog, when not whole rows/columns are marked
1252 {
1254 bColumns = true;
1256 bColumns = false;
1257 else
1258 {
1260
1262
1263 pDlg->StartExecuteAsync(
1264 [pDlg, pTabViewShell] (sal_Int32 nResult) {
1265 if( RET_OK == nResult )
1266 {
1267 bool bColumn = pDlg->GetColsChecked();
1268 pTabViewShell->MakeOutline( bColumn );
1269 }
1270 pDlg->disposeOnce();
1271 }
1272 );
1273
1274 bOk = false;
1275 }
1276 }
1277 if (bOk)
1278 {
1279 pTabViewShell->MakeOutline( bColumns );
1280
1281 if( ! rReq.IsAPI() )
1282 {
1283 OUString aCol = bColumns ? OUString('C') : OUString('R');
1284 rReq.AppendItem( SfxStringItem( SID_OUTLINE_MAKE, aCol ) );
1285 rReq.Done();
1286 }
1287 }
1288 }
1289 break;
1290
1291 case SID_OUTLINE_REMOVE:
1292 {
1293 bool bColumns = false;
1294 bool bOk = true;
1295
1296 if ( GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(),
1297 GetViewData().GetCurY(), GetViewData().GetTabNo() ) )
1298 {
1299 pTabViewShell->UngroupDataPilot();
1300 bOk = false;
1301 }
1302 else if( pReqArgs != nullptr )
1303 {
1304 const SfxPoolItem* pItem;
1305 bOk = false;
1306
1307 if( pReqArgs->HasItem( SID_OUTLINE_REMOVE, &pItem ) )
1308 {
1309 OUString aCol = static_cast<const SfxStringItem*>(pItem)->GetValue();
1310 aCol = aCol.toAsciiUpperCase();
1311
1312 switch (aCol[0])
1313 {
1314 case 'R': bColumns=false; bOk = true;break;
1315 case 'C': bColumns=true; bOk = true;break;
1316 }
1317 }
1318 }
1319 else // Dialog only when removal for rows and columns is possible
1320 {
1321 bool bColPoss, bRowPoss;
1322 pTabViewShell->TestRemoveOutline( bColPoss, bRowPoss );
1323 // TODO: handle this case in LOK too
1324 if ( bColPoss && bRowPoss && !comphelper::LibreOfficeKit::isActive() )
1325 {
1327
1328 VclPtr<AbstractScGroupDlg> pDlg(pFact->CreateAbstractScGroupDlg(pTabViewShell->GetFrameWeld(), true));
1329
1330 pDlg->StartExecuteAsync(
1331 [pDlg, pTabViewShell] (sal_Int32 nResult) {
1332 if( RET_OK == nResult )
1333 {
1334 bool bColumn = pDlg->GetColsChecked();
1335 pTabViewShell->RemoveOutline( bColumn );
1336 }
1337 pDlg->disposeOnce();
1338 }
1339 );
1340
1341 bOk = false;
1342 }
1343 else if ( bColPoss )
1344 bColumns = true;
1345 else if ( bRowPoss )
1346 bColumns = false;
1347 else
1348 bOk = false;
1349 }
1350 if (bOk)
1351 {
1352 pTabViewShell->RemoveOutline( bColumns );
1353
1354 if( ! rReq.IsAPI() )
1355 {
1356 OUString aCol = bColumns ? OUString('C') : OUString('R');
1357 rReq.AppendItem( SfxStringItem( SID_OUTLINE_REMOVE, aCol ) );
1358 rReq.Done();
1359 }
1360 }
1361 }
1362 break;
1363
1364 // Clipboard
1365
1366 case SID_COPY: // for graphs in DrawShell
1367 {
1368 weld::WaitObject aWait( GetViewData().GetDialogParent() );
1369 pTabViewShell->CopyToClip( nullptr, false, false, true );
1370 rReq.Done();
1372 pTabViewShell->ShowCursor();
1373 pTabViewShell->UpdateCopySourceOverlay();
1374 }
1375 break;
1376
1377 case SID_CUT: // for graphs in DrawShell
1378 {
1379 weld::WaitObject aWait( GetViewData().GetDialogParent() );
1380 pTabViewShell->CutToClip();
1381 rReq.Done();
1383 pTabViewShell->ShowCursor();
1384 pTabViewShell->UpdateCopySourceOverlay();
1385 }
1386 break;
1387
1388 case SID_PASTE:
1389 {
1390 ScClipUtil::PasteFromClipboard( GetViewData(), pTabViewShell, true );
1391 rReq.Done();
1392 }
1393 break;
1394
1395 case SID_CLIPBOARD_FORMAT_ITEMS:
1396 {
1397 weld::WaitObject aWait( GetViewData().GetDialogParent() );
1398
1399 SotClipboardFormatId nFormat = SotClipboardFormatId::NONE;
1400 const SfxPoolItem* pItem;
1401 if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET )
1402 if (auto pIntItem = dynamic_cast<const SfxUInt32Item*>(pItem) )
1403 nFormat = static_cast<SotClipboardFormatId>(pIntItem->GetValue());
1404
1405 if ( nFormat != SotClipboardFormatId::NONE )
1406 {
1407 css::uno::Reference<css::datatransfer::XTransferable2> xTransferable(ScTabViewShell::GetClipData(GetViewData().GetActiveWin()));
1408 bool bCells = ( ScTransferObj::GetOwnClipboard(xTransferable) != nullptr );
1409 bool bDraw = ( ScDrawTransferObj::GetOwnClipboard(xTransferable) != nullptr );
1410 bool bOle = ( nFormat == SotClipboardFormatId::EMBED_SOURCE );
1411
1412 if ( bCells && bOle )
1413 pTabViewShell->PasteFromSystem();
1414 else if ( bDraw && bOle )
1415 pTabViewShell->PasteDraw();
1416 else
1417 pTabViewShell->PasteFromSystem(nFormat);
1418 }
1419 //?else
1420 //? pTabViewShell->PasteFromSystem();
1421
1422 rReq.Done();
1423 }
1424 pTabViewShell->CellContentChanged();
1425 break;
1426
1427 case FID_INS_CELL_CONTENTS:
1428 {
1430 bool bOtherDoc = !rDoc.IsClipboardSource();
1431 // keep a reference in case the clipboard is changed during dialog or PasteFromClip
1433 if ( pOwnClip )
1434 {
1436 ScPasteFunc nFunction = ScPasteFunc::NONE;
1437 InsCellCmd eMoveMode = INS_NONE;
1438 bool bSkipEmpty = false;
1439 bool bTranspose = false;
1440 bool bAsLink = false;
1441
1442 if ( pReqArgs!=nullptr && pTabViewShell->SelectionEditable() )
1443 {
1444 const SfxPoolItem* pItem;
1445 OUString aFlags('A');
1446
1447 if( pReqArgs->HasItem( FID_INS_CELL_CONTENTS, &pItem ) )
1448 aFlags = static_cast<const SfxStringItem*>(pItem)->GetValue();
1449
1450 nFlags |= FlagsFromString(aFlags);
1451
1452 const SfxUInt16Item* pFuncItem = rReq.GetArg<SfxUInt16Item>(FN_PARAM_1);
1453 const SfxBoolItem* pSkipItem = rReq.GetArg<SfxBoolItem>(FN_PARAM_2);
1454 const SfxBoolItem* pTransposeItem = rReq.GetArg<SfxBoolItem>(FN_PARAM_3);
1455 const SfxBoolItem* pLinkItem = rReq.GetArg<SfxBoolItem>(FN_PARAM_4);
1456 const SfxInt16Item* pMoveItem = rReq.GetArg<SfxInt16Item>(FN_PARAM_5);
1457 if ( pFuncItem )
1458 nFunction = static_cast<ScPasteFunc>(pFuncItem->GetValue());
1459 if ( pSkipItem )
1460 bSkipEmpty = pSkipItem->GetValue();
1461 if ( pTransposeItem )
1462 bTranspose = pTransposeItem->GetValue();
1463 if ( pLinkItem )
1464 bAsLink = pLinkItem->GetValue();
1465 if ( pMoveItem )
1466 eMoveMode = static_cast<InsCellCmd>(pMoveItem->GetValue());
1467 }
1468 else
1469 {
1470 ScEditableTester aTester( pTabViewShell );
1471 if (aTester.IsEditable())
1472 {
1474
1476 pDlg->SetOtherDoc( bOtherDoc );
1477 // if ChangeTrack MoveMode disable
1478 pDlg->SetChangeTrack( rDoc.GetChangeTrack() != nullptr );
1479 // fdo#56098 disable shift if necessary
1480 if (!bOtherDoc)
1481 {
1482 ScViewData& rData = GetViewData();
1483 if ( rData.GetMarkData().GetTableSelect( rData.GetTabNo() ) )
1484 {
1485 SCCOL nStartX, nEndX, nClipStartX, nClipSizeX, nRangeSizeX;
1486 SCROW nStartY, nEndY, nClipStartY, nClipSizeY, nRangeSizeY;
1487 SCTAB nStartTab, nEndTab;
1488 pOwnClip->GetDocument()->GetClipStart( nClipStartX, nClipStartY );
1489 pOwnClip->GetDocument()->GetClipArea( nClipSizeX, nClipSizeY, true );
1490
1491 if ( rData.GetSimpleArea( nStartX, nStartY, nStartTab,
1492 nEndX, nEndY, nEndTab ) != SC_MARK_SIMPLE ||
1493 nStartTab != nEndTab )
1494 {
1495 // the destination is not a simple range,
1496 // assume the destination as the current cell
1497 nStartX = nEndX = rData.GetCurX();
1498 nStartY = nEndY = rData.GetCurY();
1499 nStartTab = rData.GetTabNo();
1500 }
1501 // we now have clip- and range dimensions
1502 // the size of the destination area is the larger of the two
1503 nRangeSizeX = nClipSizeX >= nEndX - nStartX ? nClipSizeX : nEndX - nStartX;
1504 nRangeSizeY = nClipSizeY >= nEndY - nStartY ? nClipSizeY : nEndY - nStartY;
1505 // When the source and destination areas intersect things may go wrong,
1506 // especially if the area contains references. This may produce data loss
1507 // (e.g. formulas that get wrong references), this scenario _must_ be avoided.
1508 ScRange aSource( nClipStartX, nClipStartY, nStartTab,
1509 nClipStartX + nClipSizeX, nClipStartY + nClipSizeY, nStartTab );
1510 ScRange aDest( nStartX, nStartY, nStartTab,
1511 nStartX + nRangeSizeX, nStartY + nRangeSizeY, nStartTab );
1512 if ( pOwnClip->GetDocument()->IsCutMode() && aSource.Intersects( aDest ) )
1513 pDlg->SetCellShiftDisabled( CellShiftDisabledFlags::Down | CellShiftDisabledFlags::Right );
1514 else
1515 {
1516 //no conflict with intersecting ranges,
1517 //check if paste plus shift will fit on sheet
1518 //and disable shift-option if no fit
1521
1522 //check if horizontal shift will fit
1523 if ( !rData.GetDocument().IsBlockEmpty(
1524 rDoc.MaxCol() - nRangeSizeX, nStartY,
1525 rDoc.MaxCol(), nStartY + nRangeSizeY,
1526 nStartTab ) )
1527 nDisableShiftX = CellShiftDisabledFlags::Right;
1528
1529 //check if vertical shift will fit
1530 if ( !rData.GetDocument().IsBlockEmpty(
1531 nStartX, rDoc.MaxRow() - nRangeSizeY,
1532 nStartX + nRangeSizeX, rDoc.MaxRow(),
1533 nStartTab ) )
1534 nDisableShiftY = CellShiftDisabledFlags::Down;
1535
1536 if ( nDisableShiftX != CellShiftDisabledFlags::NONE || nDisableShiftY != CellShiftDisabledFlags::NONE)
1537 pDlg->SetCellShiftDisabled( nDisableShiftX | nDisableShiftY );
1538 }
1539 }
1540 }
1541 if (pDlg->Execute() == RET_OK)
1542 {
1543 nFlags = pDlg->GetInsContentsCmdBits();
1544 nFunction = pDlg->GetFormulaCmdBits();
1545 bSkipEmpty = pDlg->IsSkipEmptyCells();
1546 bTranspose = pDlg->IsTranspose();
1547 bAsLink = pDlg->IsLink();
1548 eMoveMode = pDlg->GetMoveMode();
1549 }
1550 }
1551 else
1552 pTabViewShell->ErrorMessage(aTester.GetMessageId());
1553 }
1554
1555 if( nFlags != InsertDeleteFlags::NONE )
1556 {
1557 {
1558 weld::WaitObject aWait( GetViewData().GetDialogParent() );
1559 if ( bAsLink && bOtherDoc )
1560 pTabViewShell->PasteFromSystem(SotClipboardFormatId::LINK); // DDE insert
1561 else
1562 {
1563 pTabViewShell->PasteFromClip( nFlags, pOwnClip->GetDocument(),
1564 nFunction, bSkipEmpty, bTranspose, bAsLink,
1565 eMoveMode, InsertDeleteFlags::NONE, true ); // allow warning dialog
1566 }
1567 }
1568
1569 if( !pReqArgs )
1570 {
1571 OUString aFlags = FlagsToString( nFlags );
1572
1573 rReq.AppendItem( SfxStringItem( FID_INS_CELL_CONTENTS, aFlags ) );
1574 rReq.AppendItem( SfxBoolItem( FN_PARAM_2, bSkipEmpty ) );
1575 rReq.AppendItem( SfxBoolItem( FN_PARAM_3, bTranspose ) );
1576 rReq.AppendItem( SfxBoolItem( FN_PARAM_4, bAsLink ) );
1577 rReq.AppendItem( SfxUInt16Item( FN_PARAM_1, static_cast<sal_uInt16>(nFunction) ) );
1578 rReq.AppendItem( SfxInt16Item( FN_PARAM_5, static_cast<sal_Int16>(eMoveMode) ) );
1579 rReq.Done();
1580 }
1581 }
1582 }
1583 }
1584 pTabViewShell->CellContentChanged(); // => PasteFromXXX ???
1585 break;
1586 case SID_PASTE_ONLY_VALUE:
1587 case SID_PASTE_ONLY_TEXT:
1588 case SID_PASTE_ONLY_FORMULA:
1589 {
1590 if ( ScTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(GetViewData().GetActiveWin())) ) // own cell data
1591 {
1592 rReq.SetSlot( FID_INS_CELL_CONTENTS );
1593 OUString aFlags;
1594 if ( nSlot == SID_PASTE_ONLY_VALUE )
1595 aFlags = "V";
1596 else if ( nSlot == SID_PASTE_ONLY_TEXT )
1597 aFlags = "S";
1598 else
1599 aFlags = "F";
1600 rReq.AppendItem( SfxStringItem( FID_INS_CELL_CONTENTS, aFlags ) );
1601 ExecuteSlot( rReq, GetInterface() );
1602 rReq.SetReturnValue(SfxInt16Item(nSlot, 1)); // 1 = success
1603 pTabViewShell->CellContentChanged();
1604 }
1605 else
1606 rReq.SetReturnValue(SfxInt16Item(nSlot, 0)); // 0 = fail
1607 break;
1608 }
1609 case SID_PASTE_TRANSPOSED:
1610 {
1612 ScTabViewShell::GetClipData(GetViewData().GetActiveWin()))) // own cell data
1613 {
1614 rReq.SetSlot(FID_INS_CELL_CONTENTS);
1615 // By default content (values/numbers, strings, formulas and dates),
1616 // attributes and notes are pasted
1617 rReq.AppendItem(SfxBoolItem(FN_PARAM_3, true)); // transpose
1618 ExecuteSlot(rReq, GetInterface());
1619 rReq.SetReturnValue(SfxInt16Item(nSlot, 1)); // 1 = success
1620 pTabViewShell->CellContentChanged();
1621 }
1622 else
1623 rReq.SetReturnValue(SfxInt16Item(nSlot, 0)); // 0 = fail
1624 break;
1625 }
1626 case SID_PASTE_AS_LINK:
1627 {
1629 ScTabViewShell::GetClipData(GetViewData().GetActiveWin()))) // own cell data
1630 {
1631 rReq.SetSlot(FID_INS_CELL_CONTENTS);
1632 // paste links to values/numbers, strings, formulas and dates
1633 // do not paste attributes, notes and objects
1634 rReq.AppendItem(SfxStringItem(FID_INS_CELL_CONTENTS, "VSFD"));
1635 rReq.AppendItem(SfxBoolItem(FN_PARAM_4, true)); // as link
1636 ExecuteSlot(rReq, GetInterface());
1637 rReq.SetReturnValue(SfxInt16Item(nSlot, 1)); // 1 = success
1638 pTabViewShell->CellContentChanged();
1639 }
1640 else
1641 rReq.SetReturnValue(SfxInt16Item(nSlot, 0)); // 0 = fail
1642 break;
1643 }
1644 case SID_PASTE_TEXTIMPORT_DIALOG:
1645 {
1647 TransferableDataHelper aDataHelper(
1649 const uno::Reference<datatransfer::XTransferable>& xTransferable
1650 = aDataHelper.GetTransferable();
1651 SotClipboardFormatId format = SotClipboardFormatId::STRING;
1652 bool bSuccess = false;
1653 if (xTransferable.is() && HasClipboardFormat(format))
1654 {
1655 OUString sStrBuffer;
1656 bSuccess = aDataHelper.GetString(format, sStrBuffer);
1657 if (bSuccess)
1658 {
1659 auto pStrm = std::make_shared<ScImportStringStream>(sStrBuffer);
1662 pWin ? pWin->GetFrameWeld() : nullptr, OUString(), pStrm.get(), SC_PASTETEXT));
1663 ScRange aRange;
1664 SCCOL nPosX = 0;
1665 SCROW nPosY = 0;
1666 if (GetViewData().GetSimpleArea(aRange) == SC_MARK_SIMPLE)
1667 {
1668 nPosX = aRange.aStart.Col();
1669 nPosY = aRange.aStart.Row();
1670 }
1671 else
1672 {
1673 nPosX = GetViewData().GetCurX();
1674 nPosY = GetViewData().GetCurY();
1675 }
1676 ScAddress aCellPos(nPosX, nPosY, GetViewData().GetTabNo());
1677 auto pObj = std::make_shared<ScImportExport>(GetViewData().GetDocument(), aCellPos);
1678 pObj->SetOverwriting(true);
1679 if (pDlg->Execute()) {
1680 ScAsciiOptions aOptions;
1681 pDlg->GetOptions(aOptions);
1682 pDlg->SaveParameters();
1683 pObj->SetExtOptions(aOptions);
1684 pObj->ImportString(sStrBuffer, format);
1685 }
1686 pDlg->disposeOnce();
1687 rReq.SetReturnValue(SfxInt16Item(nSlot, 1)); // 1 = success, 0 = fail
1688 rReq.Done();
1689 }
1690 }
1691 if (!bSuccess)
1692 {
1693 rReq.SetReturnValue(SfxInt16Item(nSlot, 0)); // 0 = fail
1694 rReq.Ignore();
1695 }
1696 }
1697 break;
1698 case SID_PASTE_SPECIAL:
1699 // differentiate between own cell data and draw objects/external data
1700 // this makes FID_INS_CELL_CONTENTS superfluous
1701 {
1703 css::uno::Reference<css::datatransfer::XTransferable2> xTransferable(ScTabViewShell::GetClipData(pWin));
1704
1705 // Clipboard-ID given as parameter? Basic "PasteSpecial(Format)"
1706 const SfxPoolItem* pItem=nullptr;
1707 if ( pReqArgs &&
1708 pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET &&
1709 dynamic_cast<const SfxUInt32Item*>( pItem) != nullptr )
1710 {
1711 SotClipboardFormatId nFormat = static_cast<SotClipboardFormatId>(static_cast<const SfxUInt32Item*>(pItem)->GetValue());
1712 bool bRet=true;
1713 {
1714 weld::WaitObject aWait( GetViewData().GetDialogParent() );
1715 bool bDraw = ( ScDrawTransferObj::GetOwnClipboard(xTransferable) != nullptr );
1716 if ( bDraw && nFormat == SotClipboardFormatId::EMBED_SOURCE )
1717 pTabViewShell->PasteDraw();
1718 else
1719 bRet = pTabViewShell->PasteFromSystem(nFormat, true); // TRUE: no error messages
1720 }
1721
1722 if ( bRet )
1723 {
1724 rReq.SetReturnValue(SfxInt16Item(nSlot, 1)); // 1 = success, 0 = fail
1725 rReq.Done();
1726 }
1727 else
1728 // if format is not available -> fallback to request without parameters
1729 pItem = nullptr;
1730 }
1731
1732 if ( !pItem )
1733 {
1734 if ( ScTransferObj::GetOwnClipboard(xTransferable) ) // own cell data
1735 {
1736 rReq.SetSlot( FID_INS_CELL_CONTENTS );
1737 ExecuteSlot( rReq, GetInterface() );
1738 rReq.SetReturnValue(SfxInt16Item(nSlot, 1)); // 1 = success
1739 }
1740 else // draw objects or external data
1741 {
1742 bool bDraw = ( ScDrawTransferObj::GetOwnClipboard(xTransferable) != nullptr );
1743
1744 SvxClipboardFormatItem aFormats( SID_CLIPBOARD_FORMAT_ITEMS );
1745 GetPossibleClipboardFormats( aFormats );
1746
1747 sal_uInt16 nFormatCount = aFormats.Count();
1748 if ( nFormatCount )
1749 {
1751 ScopedVclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog(pTabViewShell->GetFrameWeld()));
1752 for (sal_uInt16 i=0; i<nFormatCount; i++)
1753 {
1754 SotClipboardFormatId nFormatId = aFormats.GetClipbrdFormatId( i );
1755 OUString aName = aFormats.GetClipbrdFormatName( i );
1756 // special case for paste dialog: '*' is replaced by object type
1757 if ( nFormatId == SotClipboardFormatId::EMBED_SOURCE )
1758 aName = "*";
1759 pDlg->Insert( nFormatId, aName );
1760 }
1761
1762 SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame();
1763 auto xFrame = pViewFrame->GetFrame().GetFrameInterface();
1764 const OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(xFrame));
1765 auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:PasteTextImportDialog", aModuleName);
1767 pDlg->InsertUno(".uno:PasteTextImportDialog", sLabel);
1768
1769 TransferableDataHelper aDataHelper(
1771 SotClipboardFormatId nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() );
1772 if (nFormat != SotClipboardFormatId::NONE)
1773 {
1774 {
1775 weld::WaitObject aWait( GetViewData().GetDialogParent() );
1776 if ( bDraw && nFormat == SotClipboardFormatId::EMBED_SOURCE )
1777 pTabViewShell->PasteDraw();
1778 else
1779 pTabViewShell->PasteFromSystem(nFormat);
1780 }
1781 rReq.SetReturnValue(SfxInt16Item(nSlot, 1)); // 1 = success
1782 rReq.AppendItem( SfxUInt32Item( nSlot, static_cast<sal_uInt32>(nFormat) ) );
1783 rReq.Done();
1784 }
1785 else
1786 {
1787 rReq.SetReturnValue(SfxInt16Item(nSlot, 0)); // 0 = fail
1788 rReq.Ignore();
1789 }
1790 }
1791 else
1792 rReq.SetReturnValue(SfxInt16Item(nSlot, 0)); // 0 = fail
1793 }
1794 }
1795 }
1796 pTabViewShell->CellContentChanged(); // => PasteFromSystem() ???
1797 break;
1798
1799 case SID_PASTE_UNFORMATTED:
1800 // differentiate between own cell data and draw objects/external data
1801 // this makes FID_INS_CELL_CONTENTS superfluous
1802 {
1803 weld::WaitObject aWait( GetViewData().GetDialogParent() );
1804
1805 // we should differentiate between SotClipboardFormatId::STRING and SotClipboardFormatId::STRING_TSVC,
1806 // and paste the SotClipboardFormatId::STRING_TSVC if it is available.
1807 // Which makes a difference if the clipboard contains cells with embedded line breaks.
1808
1809 SotClipboardFormatId nFormat = HasClipboardFormat( SotClipboardFormatId::STRING_TSVC) ?
1810 SotClipboardFormatId::STRING_TSVC : SotClipboardFormatId::STRING;
1811
1812 const bool bRet = pTabViewShell->PasteFromSystem(nFormat, true); // TRUE: no error messages
1813 if ( bRet )
1814 {
1815 rReq.SetReturnValue(SfxInt16Item(nSlot, 1)); // 1 = success
1816 rReq.Done();
1817 }
1818 else
1819 {
1820 rReq.SetReturnValue(SfxInt16Item(nSlot, 0)); // 0 = fail
1821 }
1822
1823 pTabViewShell->CellContentChanged(); // => PasteFromSystem() ???
1824 }
1825 break;
1826
1827 // other
1828
1829 case FID_INS_ROWBRK:
1830 pTabViewShell->InsertPageBreak( false );
1831 rReq.Done();
1832 break;
1833
1834 case FID_INS_COLBRK:
1835 pTabViewShell->InsertPageBreak( true );
1836 rReq.Done();
1837 break;
1838
1839 case FID_DEL_ROWBRK:
1840 pTabViewShell->DeletePageBreak( false );
1841 rReq.Done();
1842 break;
1843
1844 case FID_DEL_COLBRK:
1845 pTabViewShell->DeletePageBreak( true );
1846 rReq.Done();
1847 break;
1848
1849 case SID_DETECTIVE_ADD_PRED:
1850 pTabViewShell->DetectiveAddPred();
1851 rReq.Done();
1852 break;
1853
1854 case SID_DETECTIVE_DEL_PRED:
1855 pTabViewShell->DetectiveDelPred();
1856 rReq.Done();
1857 break;
1858
1859 case SID_DETECTIVE_ADD_SUCC:
1860 pTabViewShell->DetectiveAddSucc();
1861 rReq.Done();
1862 break;
1863
1864 case SID_DETECTIVE_DEL_SUCC:
1865 pTabViewShell->DetectiveDelSucc();
1866 rReq.Done();
1867 break;
1868
1869 case SID_DETECTIVE_ADD_ERR:
1870 pTabViewShell->DetectiveAddError();
1871 rReq.Done();
1872 break;
1873
1874 case SID_DETECTIVE_INVALID:
1875 pTabViewShell->DetectiveMarkInvalid();
1876 rReq.Done();
1877 break;
1878
1879 case SID_DETECTIVE_REFRESH:
1880 pTabViewShell->DetectiveRefresh();
1881 rReq.Done();
1882 break;
1883
1884 case SID_DETECTIVE_MARK_PRED:
1885 pTabViewShell->DetectiveMarkPred();
1886 break;
1887 case SID_DETECTIVE_MARK_SUCC:
1888 pTabViewShell->DetectiveMarkSucc();
1889 break;
1890 case SID_INSERT_CURRENT_DATE:
1891 pTabViewShell->InsertCurrentTime(
1892 SvNumFormatType::DATE, ScResId(STR_UNDO_INSERT_CURRENT_DATE));
1893 break;
1894 case SID_INSERT_CURRENT_TIME:
1895 pTabViewShell->InsertCurrentTime(
1896 SvNumFormatType::TIME, ScResId(STR_UNDO_INSERT_CURRENT_TIME));
1897 break;
1898
1899 case SID_SPELL_DIALOG:
1900 {
1901 SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame();
1902 if( rReq.GetArgs() )
1903 pViewFrame->SetChildWindow( SID_SPELL_DIALOG,
1904 static_cast< const SfxBoolItem& >( rReq.GetArgs()->
1905 Get( SID_SPELL_DIALOG ) ).GetValue() );
1906 else
1907 pViewFrame->ToggleChildWindow( SID_SPELL_DIALOG );
1908
1909 pViewFrame->GetBindings().Invalidate( SID_SPELL_DIALOG );
1910 rReq.Ignore();
1911 }
1912 break;
1913
1914 case SID_HANGUL_HANJA_CONVERSION:
1915 pTabViewShell->DoHangulHanjaConversion();
1916 break;
1917
1918 case SID_CHINESE_CONVERSION:
1919 {
1920 //open ChineseTranslationDialog
1921 Reference< XComponentContext > xContext(
1922 ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one
1923 if(xContext.is())
1924 {
1925 Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
1926 if(xMCF.is())
1927 {
1928 Reference< ui::dialogs::XExecutableDialog > xDialog(
1929 xMCF->createInstanceWithContext(
1930 "com.sun.star.linguistic2.ChineseTranslationDialog"
1931 , xContext),
1932 UNO_QUERY);
1933 Reference< lang::XInitialization > xInit( xDialog, UNO_QUERY );
1934 if( xInit.is() )
1935 {
1936 // initialize dialog
1937 uno::Sequence<uno::Any> aSeq(comphelper::InitAnyPropertySequence(
1938 {
1939 {"ParentWindow", uno::Any(Reference< awt::XWindow >())}
1940 }));
1941 xInit->initialize( aSeq );
1942
1943 //execute dialog
1944 sal_Int16 nDialogRet = xDialog->execute();
1945 if( RET_OK == nDialogRet )
1946 {
1947 //get some parameters from the dialog
1948 bool bToSimplified = true;
1949 bool bUseVariants = true;
1950 bool bCommonTerms = true;
1951 Reference< beans::XPropertySet > xProp( xDialog, UNO_QUERY );
1952 if( xProp.is() )
1953 {
1954 try
1955 {
1956 xProp->getPropertyValue("IsDirectionToSimplified") >>= bToSimplified;
1957 xProp->getPropertyValue("IsUseCharacterVariants") >>= bUseVariants;
1958 xProp->getPropertyValue("IsTranslateCommonTerms") >>= bCommonTerms;
1959 }
1960 catch( Exception& )
1961 {
1962 }
1963 }
1964
1965 //execute translation
1968 sal_Int32 nOptions = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
1969 if( !bCommonTerms )
1970 nOptions |= i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
1971
1973 DefaultFontType::CJK_SPREADSHEET,
1974 eTargetLang, GetDefaultFontFlags::OnlyOne );
1976 eSourceLang, eTargetLang, std::move(aTargetFont), nOptions, false );
1977 pTabViewShell->DoSheetConversion( aConvParam );
1978 }
1979 }
1980 Reference< lang::XComponent > xComponent( xDialog, UNO_QUERY );
1981 if( xComponent.is() )
1982 xComponent->dispose();
1983 }
1984 }
1985 }
1986 break;
1987
1988 case SID_CONVERT_FORMULA_TO_VALUE:
1989 {
1990 pTabViewShell->ConvertFormulaToValue();
1991 }
1992 break;
1993 case SID_THESAURUS:
1994 pTabViewShell->DoThesaurus();
1995 break;
1996
1997 case SID_TOGGLE_REL:
1998 pTabViewShell->DoRefConversion();
1999 break;
2000
2001 case SID_DEC_INDENT:
2002 pTabViewShell->ChangeIndent( false );
2003 break;
2004 case SID_INC_INDENT:
2005 pTabViewShell->ChangeIndent( true );
2006 break;
2007
2008 case FID_USE_NAME:
2009 {
2010 CreateNameFlags nFlags = pTabViewShell->GetCreateNameFlags();
2011
2013
2014 ScopedVclPtr<AbstractScNameCreateDlg> pDlg(pFact->CreateScNameCreateDlg(pTabViewShell->GetFrameWeld(), nFlags));
2015
2016 if( pDlg->Execute() )
2017 {
2018 pTabViewShell->CreateNames(pDlg->GetFlags());
2019 rReq.Done();
2020 }
2021 }
2022 break;
2023
2024 case SID_CONSOLIDATE:
2025 {
2026 const ScConsolidateItem* pItem;
2027 if ( pReqArgs && (pItem =
2028 pReqArgs->GetItemIfSet( SCITEM_CONSOLIDATEDATA )) )
2029 {
2030 const ScConsolidateParam& rParam = pItem->GetData();
2031
2032 pTabViewShell->Consolidate( rParam );
2033 GetViewData().GetDocument().SetConsolidateDlgData( std::unique_ptr<ScConsolidateParam>(new ScConsolidateParam(rParam)) );
2034
2035 rReq.Done();
2036 }
2037#if HAVE_FEATURE_SCRIPTING
2038 else if (rReq.IsAPI())
2040#endif
2041 }
2042 break;
2043
2044 case SID_INS_FUNCTION:
2045 {
2046 const SfxBoolItem* pOkItem = static_cast<const SfxBoolItem*>(&pReqArgs->Get( SID_DLG_RETOK ));
2047
2048 if ( pOkItem->GetValue() ) // OK
2049 {
2050 OUString aFormula;
2051 const SfxStringItem* pSItem = &pReqArgs->Get( SCITEM_STRING );
2052 const SfxBoolItem* pMatrixItem = static_cast<const SfxBoolItem*>(&pReqArgs->Get( SID_DLG_MATRIX ));
2053
2054 aFormula += pSItem->GetValue();
2055 pScMod->ActivateInputWindow( &aFormula, pMatrixItem->GetValue() );
2056 }
2057 else // CANCEL
2058 {
2059 pScMod->ActivateInputWindow();
2060 }
2061 rReq.Ignore(); // only SID_ENTER_STRING is recorded
2062 }
2063 break;
2064
2065 case FID_DEFINE_NAME:
2066 case FID_DEFINE_CURRENT_NAME:
2067 if ( pReqArgs )
2068 {
2069 const SfxPoolItem* pItem;
2070 OUString aName, aSymbol, aAttrib;
2071
2072 if( pReqArgs->HasItem( FID_DEFINE_NAME, &pItem ) )
2073 aName = static_cast<const SfxStringItem*>(pItem)->GetValue();
2074
2075 if( pReqArgs->HasItem( FN_PARAM_1, &pItem ) )
2076 aSymbol = static_cast<const SfxStringItem*>(pItem)->GetValue();
2077
2078 if( pReqArgs->HasItem( FN_PARAM_2, &pItem ) )
2079 aAttrib = static_cast<const SfxStringItem*>(pItem)->GetValue();
2080
2081 if ( !aName.isEmpty() && !aSymbol.isEmpty() )
2082 {
2083 if (pTabViewShell->InsertName( aName, aSymbol, aAttrib ))
2084 rReq.Done();
2085#if HAVE_FEATURE_SCRIPTING
2086 else
2088#endif
2089 }
2090 }
2091 else
2092 {
2093 sal_uInt16 nId = ScNameDlgWrapper::GetChildWindowId();
2094 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
2095 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
2096
2097 pScMod->SetRefDialog( nId, pWnd == nullptr );
2098 }
2099 break;
2100 case FID_ADD_NAME:
2101 {
2102 sal_uInt16 nId = ScNameDefDlgWrapper::GetChildWindowId();
2103 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
2104 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
2105
2106 pScMod->SetRefDialog( nId, pWnd == nullptr );
2107 }
2108 break;
2109
2110 case SID_OPENDLG_CONDFRMT:
2111 case SID_OPENDLG_CURRENTCONDFRMT:
2112 case SID_OPENDLG_COLORSCALE:
2113 case SID_OPENDLG_DATABAR:
2114 case SID_OPENDLG_ICONSET:
2115 case SID_OPENDLG_CONDDATE:
2116 {
2117 sal_uInt32 nIndex = sal_uInt32(-1);
2118 bool bManaged = false;
2119
2120 // Get the pool item stored by Conditional Format Manager Dialog.
2121 auto itemsRange = pTabViewShell->GetPool().GetItemSurrogates(SCITEM_CONDFORMATDLGDATA);
2122 if (itemsRange.begin() != itemsRange.end())
2123 {
2124 const ScCondFormatDlgItem* pDlgItem = static_cast<const ScCondFormatDlgItem*>(*itemsRange.begin());
2125 nIndex = pDlgItem->GetIndex();
2126 bManaged = true;
2127 }
2128
2129 // Check if the Conditional Manager Dialog is editing or adding
2130 // conditional format item.
2131 if ( bManaged )
2132 {
2133 sal_uInt16 nId = ScCondFormatDlgWrapper::GetChildWindowId();
2134 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
2135 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
2136
2137 pScMod->SetRefDialog( nId, pWnd == nullptr );
2138 break;
2139 }
2140
2141 ScRangeList aRangeList;
2142 ScViewData& rData = GetViewData();
2143 rData.GetMarkData().FillRangeListWithMarks(&aRangeList, false);
2144
2146 if(rDoc.IsTabProtected(rData.GetTabNo()))
2147 {
2148 pTabViewShell->ErrorMessage( STR_ERR_CONDFORMAT_PROTECTED );
2149 break;
2150 }
2151
2152 ScAddress aPos(rData.GetCurX(), rData.GetCurY(), rData.GetTabNo());
2153 if(aRangeList.empty())
2154 {
2155 aRangeList.push_back(ScRange(aPos));
2156 }
2157
2158 // try to find an existing conditional format
2159 const ScConditionalFormat* pCondFormat = nullptr;
2160 const ScPatternAttr* pPattern = rDoc.GetPattern(aPos.Col(), aPos.Row(), aPos.Tab());
2161 ScConditionalFormatList* pList = rDoc.GetCondFormList(aPos.Tab());
2162 const ScCondFormatIndexes& rCondFormats = pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData();
2163 bool bContainsCondFormat = !rCondFormats.empty();
2164 bool bCondFormatDlg = false;
2165 bool bContainsExistingCondFormat = false;
2166 if(bContainsCondFormat)
2167 {
2168 for (const auto& rCondFormat : rCondFormats)
2169 {
2170 // check if at least one existing conditional format has the same range
2171 pCondFormat = pList->GetFormat(rCondFormat);
2172 if(!pCondFormat)
2173 continue;
2174
2175 bContainsExistingCondFormat = true;
2176 const ScRangeList& rCondFormatRange = pCondFormat->GetRange();
2177 if(rCondFormatRange == aRangeList)
2178 {
2179 // found a matching range, edit this conditional format
2180 bCondFormatDlg = true;
2181 nIndex = pCondFormat->GetKey();
2182 break;
2183 }
2184 }
2185 }
2186
2187 // do we have a parameter with the conditional formatting type?
2188 const SfxInt16Item* pParam = rReq.GetArg<SfxInt16Item>(FN_PARAM_1);
2189 if (pParam && nSlot == SID_OPENDLG_ICONSET)
2190 {
2191 auto pFormat = std::make_unique<ScConditionalFormat>(0, &rDoc);
2192 pFormat->SetRange(aRangeList);
2193
2194 ScIconSetType eIconSetType = limit_cast<ScIconSetType>(pParam->GetValue(), IconSet_3Arrows, IconSet_5Boxes);
2195 const int nSteps = ScIconSetFormat::getIconSetElements(eIconSetType);
2196
2197 ScIconSetFormat* pEntry = new ScIconSetFormat(&rDoc);
2198 ScIconSetFormatData* pIconSetFormatData = new ScIconSetFormatData(eIconSetType);
2199
2200 pIconSetFormatData->m_Entries.emplace_back(new ScColorScaleEntry(0, COL_RED, COLORSCALE_PERCENT));
2201 pIconSetFormatData->m_Entries.emplace_back(new ScColorScaleEntry(round(100. / nSteps), COL_BROWN, COLORSCALE_PERCENT));
2202 pIconSetFormatData->m_Entries.emplace_back(new ScColorScaleEntry(round(200. / nSteps), COL_YELLOW, COLORSCALE_PERCENT));
2203 if (nSteps > 3)
2204 pIconSetFormatData->m_Entries.emplace_back(new ScColorScaleEntry(round(300. / nSteps), COL_WHITE, COLORSCALE_PERCENT));
2205 if (nSteps > 4)
2206 pIconSetFormatData->m_Entries.emplace_back(new ScColorScaleEntry(round(400. / nSteps), COL_GREEN, COLORSCALE_PERCENT));
2207
2208 pEntry->SetIconSetData(pIconSetFormatData);
2209 pFormat->AddEntry(pEntry);
2210
2211 // use the new conditional formatting
2212 GetViewData().GetDocShell()->GetDocFunc().ReplaceConditionalFormat(nIndex, std::move(pFormat), aPos.Tab(), aRangeList);
2213
2214 break;
2215 }
2216
2217 // if not found a conditional format ask whether we should edit one of the existing
2218 // or should create a new overlapping conditional format
2219 if(bContainsCondFormat && !bCondFormatDlg && bContainsExistingCondFormat)
2220 {
2221 std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pTabViewShell->GetFrameWeld(),
2222 VclMessageType::Question, VclButtonsType::YesNo,
2223 ScResId(STR_EDIT_EXISTING_COND_FORMATS)));
2224 xQueryBox->set_default_response(RET_YES);
2225 bool bEditExisting = xQueryBox->run() == RET_YES;
2226 if (bEditExisting)
2227 {
2228 // differentiate between ranges where one conditional format is defined
2229 // and several formats are defined
2230 // if we have only one => open the cond format dlg to edit it
2231 // otherwise open the manage cond format dlg
2232 if (rCondFormats.size() == 1)
2233 {
2234 pCondFormat = pList->GetFormat(rCondFormats[0]);
2235 assert(pCondFormat);
2236 nIndex = pCondFormat->GetKey();
2237 bCondFormatDlg = true;
2238 }
2239 else
2240 {
2241 // Queue message to open Conditional Format Manager Dialog.
2242 GetViewData().GetDispatcher().Execute( SID_OPENDLG_CONDFRMT_MANAGER, SfxCallMode::ASYNCHRON );
2243 break;
2244 }
2245 }
2246 else
2247 {
2248 // define an overlapping conditional format
2249 pCondFormat = pList->GetFormat(rCondFormats[0]);
2250 assert(pCondFormat);
2251 bCondFormatDlg = true;
2252 }
2253 }
2254
2256 switch(nSlot)
2257 {
2258 case SID_OPENDLG_CONDFRMT:
2259 case SID_OPENDLG_CURRENTCONDFRMT:
2261 break;
2262 case SID_OPENDLG_COLORSCALE:
2264 break;
2265 case SID_OPENDLG_DATABAR:
2267 break;
2268 case SID_OPENDLG_ICONSET:
2270 break;
2271 case SID_OPENDLG_CONDDATE:
2273 break;
2274 default:
2275 assert(false);
2276 break;
2277 }
2278
2279
2280 if(bCondFormatDlg || !bContainsCondFormat)
2281 {
2282 // Put the xml string parameter to initialize the
2283 // Conditional Format Dialog.
2284 ScCondFormatDlgItem aDlgItem(nullptr, nIndex, false);
2285 aDlgItem.SetDialogType(eType);
2286 pTabViewShell->GetPool().Put(aDlgItem);
2287
2288 sal_uInt16 nId = ScCondFormatDlgWrapper::GetChildWindowId();
2289 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
2290 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
2291
2292 pScMod->SetRefDialog( nId, pWnd == nullptr );
2293 }
2294 }
2295 break;
2296
2297 case SID_DEFINE_COLROWNAMERANGES:
2298 {
2299
2300 sal_uInt16 nId = ScColRowNameRangesDlgWrapper::GetChildWindowId();
2301 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
2302 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
2303
2304 pScMod->SetRefDialog( nId, pWnd == nullptr );
2305
2306 }
2307 break;
2308
2309 case SID_UPDATECHART:
2310 {
2311 bool bAll = false;
2312
2313 if( pReqArgs )
2314 {
2315 const SfxPoolItem* pItem;
2316
2317 if( pReqArgs->HasItem( SID_UPDATECHART, &pItem ) )
2318 bAll = static_cast<const SfxBoolItem*>(pItem)->GetValue();
2319 }
2320
2321 pTabViewShell->UpdateCharts( bAll );
2322
2323 if( ! rReq.IsAPI() )
2324 {
2325 rReq.AppendItem( SfxBoolItem( SID_UPDATECHART, bAll ) );
2326 rReq.Done();
2327 }
2328 }
2329 break;
2330
2331 case SID_TABOP:
2332 if (pReqArgs)
2333 {
2334 const ScTabOpItem& rItem =
2335 static_cast<const ScTabOpItem&>(
2336 pReqArgs->Get( SID_TABOP ));
2337
2338 pTabViewShell->TabOp( rItem.GetData() );
2339
2340 rReq.Done( *pReqArgs );
2341 }
2342 break;
2343
2344 case SID_SOLVE:
2345 if (pReqArgs)
2346 {
2347 const ScSolveItem& rItem =
2348 pReqArgs->Get( SCITEM_SOLVEDATA );
2349
2350 pTabViewShell->Solve( rItem.GetData() );
2351
2352 rReq.Done( *pReqArgs );
2353 }
2354 break;
2355
2356 case FID_INSERT_NAME:
2357 {
2359
2360 ScopedVclPtr<AbstractScNamePasteDlg> pDlg(pFact->CreateScNamePasteDlg(pTabViewShell->GetFrameWeld(), GetViewData().GetDocShell()));
2361 switch( pDlg->Execute() )
2362 {
2363 case BTN_PASTE_LIST:
2364 pTabViewShell->InsertNameList();
2365 break;
2366 case BTN_PASTE_NAME:
2367 {
2368 ScInputHandler* pHdl = pScMod->GetInputHdl( pTabViewShell );
2369 if (pHdl)
2370 {
2371 // "=" in KeyEvent, switches to input-mode
2372 (void)pScMod->InputKeyEvent( KeyEvent('=', vcl::KeyCode()) );
2373
2374 std::vector<OUString> aNames = pDlg->GetSelectedNames();
2375 if (!aNames.empty())
2376 {
2377 OUStringBuffer aBuffer;
2378 for (const auto& rName : aNames)
2379 {
2380 aBuffer.append(rName).append(' ');
2381 }
2382 pHdl->InsertFunction( aBuffer.makeStringAndClear(), false ); // without "()"
2383 }
2384 }
2385 }
2386 break;
2387 }
2388 }
2389 break;
2390
2391 case SID_RANGE_NOTETEXT:
2392 if (pReqArgs)
2393 {
2394 const SfxStringItem& rTextItem = static_cast<const SfxStringItem&>(pReqArgs->Get( SID_RANGE_NOTETEXT ));
2395
2396 // always cursor position
2397 ScAddress aPos( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() );
2398 pTabViewShell->SetNoteText( aPos, rTextItem.GetValue() );
2399 rReq.Done();
2400 }
2401 break;
2402
2403 case SID_INSERT_POSTIT:
2404 case SID_EDIT_POSTIT:
2405 {
2406 const SvxPostItTextItem* pTextItem;
2407 if ( pReqArgs && (pTextItem = pReqArgs->GetItemIfSet( SID_ATTR_POSTIT_TEXT )) )
2408 {
2409 OUString aCellId;
2410 // SID_ATTR_POSTIT_ID only argument for SID_EDIT_POSTIT
2411 if (const SvxPostItIdItem* pCellId = pReqArgs->GetItemIfSet( SID_ATTR_POSTIT_ID ))
2412 aCellId = pCellId->GetValue();
2413
2414 const SvxPostItAuthorItem* pAuthorItem = pReqArgs->GetItem( SID_ATTR_POSTIT_AUTHOR );
2415 const SvxPostItDateItem* pDateItem = pReqArgs->GetItem( SID_ATTR_POSTIT_DATE );
2416
2417 if (!aCellId.isEmpty())
2418 {
2419 SetTabNoAndCursor( GetViewData(), aCellId );
2420 }
2421
2422 ScAddress aPos( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() );
2423 pTabViewShell->ReplaceNote( aPos, pTextItem->GetValue(),
2424 pAuthorItem ? &pAuthorItem->GetValue() : nullptr,
2425 pDateItem ? &pDateItem->GetValue() : nullptr );
2426 }
2428 {
2429 pTabViewShell->EditNote(); // note object to edit
2430 }
2431 rReq.Done();
2432 }
2433 break;
2434
2435 case FID_NOTE_VISIBLE:
2436 {
2438 ScAddress aPos( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() );
2439 if( ScPostIt* pNote = rDoc.GetNote(aPos) )
2440 {
2441 bool bShow;
2442 const SfxPoolItem* pItem;
2443 if ( pReqArgs && (pReqArgs->GetItemState( FID_NOTE_VISIBLE, true, &pItem ) == SfxItemState::SET) )
2444 bShow = static_cast<const SfxBoolItem*>(pItem)->GetValue();
2445 else
2446 bShow = !pNote->IsCaptionShown();
2447
2448 pTabViewShell->ShowNote( bShow );
2449
2450 if (!pReqArgs)
2451 rReq.AppendItem( SfxBoolItem( FID_NOTE_VISIBLE, bShow ) );
2452
2453 rReq.Done();
2454 rBindings.Invalidate( FID_NOTE_VISIBLE );
2455 }
2456 else
2457 rReq.Ignore();
2458 }
2459 break;
2460
2461 case FID_HIDE_NOTE:
2462 case FID_SHOW_NOTE:
2463 {
2464 bool bShowNote = nSlot == FID_SHOW_NOTE;
2465 ScViewData& rData = GetViewData();
2466 ScDocument& rDoc = rData.GetDocument();
2467 ScMarkData& rMark = rData.GetMarkData();
2468
2469 if (!rMark.IsMarked() && !rMark.IsMultiMarked())
2470 {
2471 // Check current cell
2472 ScAddress aPos( rData.GetCurX(), rData.GetCurY(), rData.GetTabNo() );
2473 if( rDoc.GetNote(aPos) )
2474 {
2475 rData.GetDocShell()->GetDocFunc().ShowNote( aPos, bShowNote );
2476 }
2477 }
2478 else
2479 {
2480 // Check selection range
2481 bool bDone = false;
2482 ScRangeListRef aRangesRef;
2483 rData.GetMultiArea(aRangesRef);
2484 const ScRangeList aRanges = *aRangesRef;
2485
2486 OUString aUndo = ScResId( bShowNote ? STR_UNDO_SHOWNOTE : STR_UNDO_HIDENOTE );
2487 rData.GetDocShell()->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, rData.GetViewShell()->GetViewShellId() );
2488
2489 for (auto const& rTab : rMark.GetSelectedTabs())
2490 {
2491 // get notes
2492 std::vector<sc::NoteEntry> aNotes;
2493 rDoc.GetAllNoteEntries(rTab, aNotes);
2494
2495 for (const sc::NoteEntry& rNote : aNotes)
2496 {
2497 // check if note is in our selection range
2498 const ScAddress& rAdr = rNote.maPos;
2499 const ScRange* rRange = aRanges.Find(rAdr);
2500 if (! rRange)
2501 continue;
2502
2503 // check if cell is editable
2504 const SCTAB nRangeTab = rRange->aStart.Tab();
2505 if (rDoc.IsBlockEditable( nRangeTab, rAdr.Col(), rAdr.Row(), rAdr.Col(), rAdr.Row() ))
2506 {
2507 rData.GetDocShell()->GetDocFunc().ShowNote( rAdr, bShowNote );
2508 bDone = true;
2509 }
2510 }
2511 }
2512
2514
2515 if ( bDone )
2516 {
2517 rReq.Done();
2518 rBindings.Invalidate( nSlot );
2519 }
2520 else
2521 rReq.Ignore();
2522 }
2523
2524 }
2525 break;
2526
2527 case FID_SHOW_ALL_NOTES:
2528 case FID_HIDE_ALL_NOTES:
2529 {
2530 bool bShowNote = nSlot == FID_SHOW_ALL_NOTES;
2531 ScViewData& rData = GetViewData();
2532 ScMarkData& rMark = rData.GetMarkData();
2533 ScDocument& rDoc = rData.GetDocument();
2534 std::vector<sc::NoteEntry> aNotes;
2535
2536 OUString aUndo = ScResId( bShowNote ? STR_UNDO_SHOWALLNOTES : STR_UNDO_HIDEALLNOTES );
2537 rData.GetDocShell()->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, rData.GetViewShell()->GetViewShellId() );
2538
2539 for (auto const& rTab : rMark.GetSelectedTabs())
2540 {
2541 rDoc.GetAllNoteEntries(rTab, aNotes);
2542 }
2543
2544 for (const sc::NoteEntry& rNote : aNotes)
2545 {
2546 const ScAddress& rAdr = rNote.maPos;
2547 rData.GetDocShell()->GetDocFunc().ShowNote( rAdr, bShowNote );
2548 }
2549
2551 }
2552 break;
2553
2554 case SID_TOGGLE_NOTES:
2555 {
2556 ScViewData& rData = GetViewData();
2557 ScMarkData& rMark = rData.GetMarkData();
2558 ScDocument& rDoc = rData.GetDocument();
2559 ScRangeList aRanges;
2560 std::vector<sc::NoteEntry> aNotes;
2561
2562 for (auto const& rTab : rMark.GetSelectedTabs())
2563 aRanges.push_back(ScRange(0,0,rTab,rDoc.MaxCol(),rDoc.MaxRow(),rTab));
2564
2565 CommentCaptionState eState = rDoc.GetAllNoteCaptionsState( aRanges );
2566 rDoc.GetNotesInRange(aRanges, aNotes);
2567 bool bShowNote = (eState == ALLHIDDEN || eState == MIXED);
2568
2569 OUString aUndo = ScResId( bShowNote ? STR_UNDO_SHOWALLNOTES : STR_UNDO_HIDEALLNOTES );
2570 rData.GetDocShell()->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, rData.GetViewShell()->GetViewShellId() );
2571
2572 for(const auto& rNote : aNotes)
2573 {
2574 const ScAddress& rAdr = rNote.maPos;
2575 rData.GetDocShell()->GetDocFunc().ShowNote( rAdr, bShowNote );
2576 }
2577
2579
2580 if (!pReqArgs)
2581 rReq.AppendItem( SfxBoolItem( SID_TOGGLE_NOTES, bShowNote ) );
2582
2583 rReq.Done();
2584 rBindings.Invalidate( SID_TOGGLE_NOTES );
2585 }
2586 break;
2587
2588 case SID_DELETE_NOTE:
2589 {
2590 const SvxPostItIdItem* pIdItem;
2591 // If Id is mentioned, select the appropriate cell first
2592 if ( pReqArgs && (pIdItem = pReqArgs->GetItemIfSet( SID_ATTR_POSTIT_ID )) )
2593 {
2594 const OUString& aCellId = pIdItem->GetValue();
2595 if (!aCellId.isEmpty())
2596 {
2597 SetTabNoAndCursor( GetViewData(), aCellId );
2598 }
2599 }
2600
2601 pTabViewShell->DeleteContents( InsertDeleteFlags::NOTE ); // delete all notes in selection
2602 rReq.Done();
2603 }
2604 break;
2605
2606 case FID_DELETE_ALL_NOTES:
2607 {
2608 ScViewData& rData = GetViewData();
2609 ScMarkData& rMark = rData.GetMarkData();
2610 ScDocument& rDoc = rData.GetDocument();
2611 ScMarkData aNewMark(rDoc.GetSheetLimits());
2612 ScRangeList aRangeList;
2613
2614 for (auto const& rTab : rMark.GetSelectedTabs())
2615 {
2616 aRangeList.push_back(ScRange(0,0,rTab,rDoc.MaxCol(),rDoc.MaxRow(),rTab));
2617 }
2618
2619 aNewMark.MarkFromRangeList( aRangeList, true );
2620 rData.GetDocShell()->GetDocFunc().DeleteContents(aNewMark, InsertDeleteFlags::NOTE, true, false );
2621 }
2622 break;
2623
2624 case SID_CHARMAP:
2625 if( pReqArgs != nullptr )
2626 {
2627 OUString aChars, aFontName;
2628 const SfxItemSet *pArgs = rReq.GetArgs();
2629 const SfxPoolItem* pItem = nullptr;
2630 if ( pArgs )
2631 pArgs->GetItemState(SID_CHARMAP, false, &pItem);
2632 if ( pItem )
2633 {
2634 const SfxStringItem* pStringItem = dynamic_cast<const SfxStringItem*>( pItem );
2635 if ( pStringItem )
2636 aChars = pStringItem->GetValue();
2637 const SfxStringItem* pFontItem =
2638 pArgs->GetItemIfSet( SID_ATTR_SPECIALCHAR, false);
2639 if ( pFontItem )
2640 aFontName = pFontItem->GetValue();
2641 }
2642
2643 if ( !aChars.isEmpty() )
2644 {
2645 vcl::Font aFont;
2646 pTabViewShell->GetSelectionPattern()->GetFont( aFont, SC_AUTOCOL_BLACK, nullptr, nullptr, nullptr,
2647 pTabViewShell->GetSelectionScriptType() );
2648 if ( !aFontName.isEmpty() )
2649 aFont = vcl::Font( aFontName, Size(1,1) );
2650 pTabViewShell->InsertSpecialChar( aChars, aFont );
2651 if( ! rReq.IsAPI() )
2652 rReq.Done();
2653 }
2654 }
2655 else
2656 {
2658
2659 // font color doesn't matter here
2660 vcl::Font aCurFont;
2661 pTabViewShell->GetSelectionPattern()->GetFont( aCurFont, SC_AUTOCOL_BLACK, nullptr, nullptr, nullptr,
2662 pTabViewShell->GetSelectionScriptType() );
2663
2664 SfxAllItemSet aSet( GetPool() );
2665 aSet.Put( SfxBoolItem( FN_PARAM_1, false ) );
2666 aSet.Put( SvxFontItem( aCurFont.GetFamilyType(), aCurFont.GetFamilyName(), aCurFont.GetStyleName(), aCurFont.GetPitch(), aCurFont.GetCharSet(), GetPool().GetWhich(SID_ATTR_CHAR_FONT) ) );
2667 SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame();
2668 auto xFrame = pViewFrame->GetFrame().GetFrameInterface();
2669 ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(pTabViewShell->GetFrameWeld(), aSet, xFrame));
2670 pDlg->Execute();
2671 }
2672 break;
2673
2674 case SID_SELECT_SCENARIO:
2675 {
2676 // Testing
2677
2678 if ( pReqArgs )
2679 {
2680 const SfxStringItem& rItem
2681 = static_cast<const SfxStringItem&>(pReqArgs->Get(SID_SELECT_SCENARIO));
2682 pTabViewShell->UseScenario(rItem.GetValue());
2684 rReq.SetReturnValue(SfxStringItem(SID_SELECT_SCENARIO, rItem.GetValue()));
2685 rReq.Done();
2686 }
2687 }
2688 break;
2689
2690 case SID_HYPERLINK_SETLINK:
2691 if( pReqArgs )
2692 {
2693 const SfxPoolItem* pItem;
2694 if( pReqArgs->HasItem( SID_HYPERLINK_SETLINK, &pItem ) )
2695 {
2696 const SvxHyperlinkItem* pHyper = static_cast<const SvxHyperlinkItem*>(pItem);
2697 const OUString& rName = pHyper->GetName();
2698 const OUString& rURL = pHyper->GetURL();
2699 const OUString& rTarget = pHyper->GetTargetFrame();
2700 sal_uInt16 nType = static_cast<sal_uInt16>(pHyper->GetInsertMode());
2701
2702 pTabViewShell->InsertURL( rName, rURL, rTarget, nType );
2703 rReq.Done();
2704 }
2705 else
2706 rReq.Ignore();
2707 }
2708 break;
2709
2710 case SID_OPENDLG_CONDFRMT_MANAGER:
2711 case SID_OPENDLG_CURRENTCONDFRMT_MANAGER:
2712 {
2714
2715 ScViewData& rData = GetViewData();
2716 ScDocument& rDoc = rData.GetDocument();
2717
2718 if (rDoc.IsTabProtected(rData.GetTabNo()))
2719 {
2720 pTabViewShell->ErrorMessage( STR_ERR_CONDFORMAT_PROTECTED );
2721 break;
2722 }
2723
2724 ScAddress aPos(rData.GetCurX(), rData.GetCurY(), rData.GetTabNo());
2725
2726 ScConditionalFormatList* pList = nullptr;
2727
2728 const ScCondFormatDlgItem* pDlgItem = nullptr;
2729 auto itemsRange = pTabViewShell->GetPool().GetItemSurrogates(SCITEM_CONDFORMATDLGDATA);
2730 if (itemsRange.begin() != itemsRange.end())
2731 {
2732 pDlgItem= static_cast<const ScCondFormatDlgItem*>(*itemsRange.begin());
2733 pList = const_cast<ScCondFormatDlgItem*>(pDlgItem)->GetConditionalFormatList();
2734 }
2735
2736 if (!pList)
2737 pList = rDoc.GetCondFormList( aPos.Tab() );
2738
2740 pTabViewShell->GetFrameWeld(), rDoc, pList));
2741
2742 if (pDlgItem)
2743 pDlg->SetModified();
2744
2745 pDlg->StartExecuteAsync([this, pDlg, &rData, pTabViewShell, pDlgItem, aPos](sal_Int32 nRet){
2746 std::unique_ptr<ScConditionalFormatList> pCondFormatList = pDlg->GetConditionalFormatList();
2747 if(nRet == RET_OK && pDlg->CondFormatsChanged())
2748 {
2749 rData.GetDocShell()->GetDocFunc().SetConditionalFormatList(pCondFormatList.release(), aPos.Tab());
2750 }
2751 else if(nRet == DLG_RET_ADD)
2752 {
2753 // Put the xml string parameter to initialize the
2754 // Conditional Format Dialog. ( add new )
2755 pTabViewShell->GetPool().Put(ScCondFormatDlgItem(
2756 std::shared_ptr<ScConditionalFormatList>(pCondFormatList.release()), -1, true));
2757 // Queue message to open Conditional Format Dialog
2758 GetViewData().GetDispatcher().Execute( SID_OPENDLG_CONDFRMT, SfxCallMode::ASYNCHRON );
2759 }
2760 else if (nRet == DLG_RET_EDIT)
2761 {
2762 ScConditionalFormat* pFormat = pDlg->GetCondFormatSelected();
2763 sal_Int32 nIndex = pFormat ? pFormat->GetKey() : -1;
2764 // Put the xml string parameter to initialize the
2765 // Conditional Format Dialog. ( edit selected conditional format )
2766 pTabViewShell->GetPool().Put(ScCondFormatDlgItem(
2767 std::shared_ptr<ScConditionalFormatList>(pCondFormatList.release()), nIndex, true));
2768
2769 // Queue message to open Conditional Format Dialog
2770 GetViewData().GetDispatcher().Execute( SID_OPENDLG_CONDFRMT, SfxCallMode::ASYNCHRON );
2771 }
2772 else
2773 pCondFormatList.reset();
2774
2775 if (pDlgItem)
2776 pTabViewShell->GetPool().Remove(*pDlgItem);
2777
2778 pDlg->disposeOnce();
2779 });
2780 }
2781 break;
2782
2783 case SID_EXTERNAL_SOURCE:
2784 {
2785 const SfxStringItem* pFile = rReq.GetArg<SfxStringItem>(SID_FILE_NAME);
2786 const SfxStringItem* pSource = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
2787 if ( pFile && pSource )
2788 {
2789 OUString aFile;
2790 OUString aFilter;
2791 OUString aOptions;
2792 OUString aSource;
2793 sal_Int32 nRefreshDelaySeconds=0;
2794
2795 aFile = pFile->GetValue();
2796 aSource = pSource->GetValue();
2797 const SfxStringItem* pFilter = rReq.GetArg<SfxStringItem>(SID_FILTER_NAME);
2798 if ( pFilter )
2799 aFilter = pFilter->GetValue();
2800 const SfxStringItem* pOptions = rReq.GetArg<SfxStringItem>(SID_FILE_FILTEROPTIONS);
2801 if ( pOptions )
2802 aOptions = pOptions->GetValue();
2803 const SfxUInt32Item* pRefresh = rReq.GetArg<SfxUInt32Item>(FN_PARAM_2);
2804 if ( pRefresh )
2805 nRefreshDelaySeconds = pRefresh->GetValue();
2806
2807 ExecuteExternalSource( aFile, aFilter, aOptions, aSource, nRefreshDelaySeconds, rReq );
2808 }
2809 else
2810 {
2812
2813 pImpl->m_pLinkedDlg.disposeAndClear();
2814 pImpl->m_pLinkedDlg =
2815 pFact->CreateScLinkedAreaDlg(pTabViewShell->GetFrameWeld());
2816 delete pImpl->m_pRequest;
2817 pImpl->m_pRequest = new SfxRequest( rReq );
2818 OUString sFile, sFilter, sOptions, sSource;
2819 sal_Int32 nRefreshDelaySeconds = 0;
2820 if (pImpl->m_pLinkedDlg->Execute() == RET_OK)
2821 {
2822 sFile = pImpl->m_pLinkedDlg->GetURL();
2823 sFilter = pImpl->m_pLinkedDlg->GetFilter();
2824 sOptions = pImpl->m_pLinkedDlg->GetOptions();
2825 sSource = pImpl->m_pLinkedDlg->GetSource();
2826 nRefreshDelaySeconds = pImpl->m_pLinkedDlg->GetRefreshDelaySeconds();
2827 if ( !sFile.isEmpty() )
2828 pImpl->m_pRequest->AppendItem( SfxStringItem( SID_FILE_NAME, sFile ) );
2829 if ( !sFilter.isEmpty() )
2830 pImpl->m_pRequest->AppendItem( SfxStringItem( SID_FILTER_NAME, sFilter ) );
2831 if ( !sOptions.isEmpty() )
2832 pImpl->m_pRequest->AppendItem( SfxStringItem( SID_FILE_FILTEROPTIONS, sOptions ) );
2833 if ( !sSource.isEmpty() )
2834 pImpl->m_pRequest->AppendItem( SfxStringItem( FN_PARAM_1, sSource ) );
2835 if ( nRefreshDelaySeconds )
2836 pImpl->m_pRequest->AppendItem( SfxUInt32Item( FN_PARAM_2, nRefreshDelaySeconds ) );
2837 }
2838
2839 ExecuteExternalSource( sFile, sFilter, sOptions, sSource, nRefreshDelaySeconds, *(pImpl->m_pRequest) );
2840 }
2841 }
2842 break;
2843
2844 case SID_AUTO_SUM:
2845 {
2846 const SfxItemSet *pArgs = rReq.GetArgs();
2847 const OUString sFunction = pArgs ?
2848 static_cast<const SfxStringItem&>( pArgs->Get( SID_AUTO_SUM ) ).GetValue()
2849 : "";
2850
2851 OpCode eFunction = ocSum;
2852 if (sFunction == "average")
2853 eFunction = ocAverage;
2854 else if (sFunction == "count")
2855 eFunction = ocCount;
2856 else if (sFunction == "min")
2857 eFunction = ocMin;
2858 if (sFunction == "max")
2859 eFunction = ocMax;
2860
2861 bool bSubTotal = false;
2862 bool bRangeFinder = false;
2863 const OUString aFormula = pTabViewShell->DoAutoSum( bRangeFinder, bSubTotal , eFunction );
2864 if ( !aFormula.isEmpty() )
2865 {
2866 const sal_Int32 nPar = aFormula.indexOf( '(' );
2867 const sal_Int32 nLen = aFormula.getLength();
2868 ScInputHandler* pHdl = pScMod->GetInputHdl( pTabViewShell );
2869
2870 if ( pHdl && nPar != -1 )
2871 {
2872 if ( !pScMod->IsEditMode() )
2873 {
2874 pScMod->SetInputMode( SC_INPUT_TABLE );
2875 }
2876
2877 EditView *pEditView=pHdl->GetActiveView();
2878 if ( pEditView )
2879 {
2880 ESelection aTextSel = pEditView->GetSelection();
2881 aTextSel.nStartPos = 0;
2882 aTextSel.nEndPos = EE_TEXTPOS_ALL;
2883 pHdl->DataChanging();
2884 pEditView->SetSelection(aTextSel);
2885 pEditView->InsertText(aFormula);
2886 pEditView->SetSelection( bRangeFinder ? ESelection( 0, nPar + ( bSubTotal ? 3 : 1 ), 0, nLen - 1 ) : ESelection( 0, nLen - 1, 0, nLen - 1 ) );
2887 pHdl->DataChanged();
2888
2889 if ( bRangeFinder )
2890 {
2891 pHdl->InitRangeFinder( aFormula );
2892 }
2893 }
2894 }
2895 }
2896 }
2897 break;
2898
2899 case SID_SELECT_UNPROTECTED_CELLS:
2900 {
2901 ScViewData& rData = GetViewData();
2902 SCTAB aTab = rData.GetTabNo();
2903 ScMarkData& rMark = rData.GetMarkData();
2904 ScDocument& rDoc = rData.GetDocument();
2905 ScRangeList rRangeList;
2906
2907 rDoc.GetUnprotectedCells(rRangeList, aTab);
2908 rMark.MarkFromRangeList(rRangeList, true);
2909 pTabViewShell->SetMarkData(rMark);
2910 }
2911 break;
2912
2913 case SID_SELECT_VISIBLE_ROWS:
2914 {
2915 ScViewData& rData = GetViewData();
2916 ScMarkData& rMark = rData.GetMarkData();
2917 ScDocument& rDoc = rData.GetDocument();
2918
2919 rMark.MarkToMulti();
2920
2921 const ScRange& aMultiArea = rMark.GetMultiMarkArea();
2922 SCCOL nStartCol = aMultiArea.aStart.Col();
2923 SCROW nStartRow = aMultiArea.aStart.Row();
2924 SCCOL nEndCol = aMultiArea.aEnd.Col();
2925 SCROW nEndRow = aMultiArea.aEnd.Row();
2926
2927 bool bChanged = false;
2928 for (const SCTAB& nTab : rMark)
2929 {
2930 for (SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow)
2931 {
2932 SCROW nLastRow = nRow;
2933 if (rDoc.RowHidden(nRow, nTab, nullptr, &nLastRow))
2934 {
2935 rMark.SetMultiMarkArea(
2936 ScRange(nStartCol, nRow, nTab, nEndCol, nLastRow, nTab), false);
2937 bChanged = true;
2938 nRow = nLastRow;
2939 }
2940 }
2941 }
2942
2943 if (bChanged && !rMark.HasAnyMultiMarks())
2944 rMark.ResetMark();
2945
2946 rMark.MarkToSimple();
2947
2948 pTabViewShell->SelectionChanged();
2949 }
2950 break;
2951
2952 case SID_SELECT_VISIBLE_COLUMNS:
2953 {
2954 ScViewData& rData = GetViewData();
2955 ScMarkData& rMark = rData.GetMarkData();
2956 ScDocument& rDoc = rData.GetDocument();
2957
2958 rMark.MarkToMulti();
2959
2960 const ScRange& aMultiArea = rMark.GetMultiMarkArea();
2961 SCCOL nStartCol = aMultiArea.aStart.Col();
2962 SCROW nStartRow = aMultiArea.aStart.Row();
2963 SCCOL nEndCol = aMultiArea.aEnd.Col();
2964 SCROW nEndRow = aMultiArea.aEnd.Row();
2965
2966 bool bChanged = false;
2967 for (const SCTAB& nTab : rMark)
2968 {
2969 for (SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol)
2970 {
2971 SCCOL nLastCol = nCol;
2972 if (rDoc.ColHidden(nCol, nTab, nullptr, &nLastCol))
2973 {
2974 rMark.SetMultiMarkArea(
2975 ScRange(nCol, nStartRow, nTab, nLastCol, nEndRow, nTab), false);
2976 bChanged = true;
2977 nCol = nLastCol;
2978 }
2979 }
2980 }
2981
2982 if (bChanged && !rMark.HasAnyMultiMarks())
2983 rMark.ResetMark();
2984
2985 rMark.MarkToSimple();
2986
2987 pTabViewShell->SelectionChanged();
2988 }
2989 break;
2990
2991 case SID_CURRENT_FORMULA_RANGE:
2992 {
2993 const SfxInt32Item* param1 = rReq.GetArg<SfxInt32Item>(FN_PARAM_1);
2994 SCCOL colStart = param1 ? param1->GetValue() : 0;
2995
2996 const SfxInt32Item* param2 = rReq.GetArg<SfxInt32Item>(FN_PARAM_2);
2997 SCROW rowStart = param2 ? param2->GetValue() : 0;
2998
2999 const SfxInt32Item* param3 = rReq.GetArg<SfxInt32Item>(FN_PARAM_3);
3000 SCCOL colEnd = param3 ? param3->GetValue() : 0;
3001
3002 const SfxInt32Item* param4 = rReq.GetArg<SfxInt32Item>(FN_PARAM_4);
3003 SCROW rowEnd = param4 ? param4->GetValue() : 0;
3004
3005 const SfxInt32Item* param5 = rReq.GetArg<SfxInt32Item>(FN_PARAM_5);
3006 SCROW table = param5 ? param5->GetValue() : 0;
3007
3008 ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl();
3009
3010 if (param3 && param4 && pInputHdl)
3011 {
3012 ScViewData& rData = pTabViewShell->GetViewData();
3013 ScTabView* pTabView = rData.GetView();
3014
3015 if (param1 && param2)
3016 rData.SetRefStart(colStart, rowStart, table);
3017
3018 pTabView->UpdateRef( colEnd, rowEnd, table ); // setup the end & refresh formula
3019
3020 ScRange aRef(
3021 colStart, rowStart, rData.GetRefStartZ(),
3022 colEnd, rowEnd, rData.GetRefEndZ() );
3023 SC_MOD()->SetReference( aRef, rData.GetDocument(), &rData.GetMarkData() );
3024
3025 pInputHdl->UpdateLokReferenceMarks();
3026 }
3027 }
3028 break;
3029
3030 default:
3031 OSL_FAIL("incorrect slot in ExecuteEdit");
3032 break;
3033 }
3034}
3035
3037{
3039 if ( nType != TransliterationFlags::NONE )
3040 {
3042 rReq.Done();
3043 }
3044}
3045
3047{
3048 if( rReq.GetSlot() == SID_TRANSLITERATE_ROTATE_CASE )
3050}
3051
3053 const OUString& _rFile, const OUString& _rFilter, const OUString& _rOptions,
3054 const OUString& _rSource, sal_Int32 _nRefreshDelaySeconds, SfxRequest& _rRequest )
3055{
3056 if ( !_rFile.isEmpty() && !_rSource.isEmpty() ) // filter may be empty
3057 {
3058 ScRange aLinkRange;
3059 bool bMove = false;
3060
3061 ScViewData& rData = GetViewData();
3062 ScMarkData& rMark = rData.GetMarkData();
3063 rMark.MarkToSimple();
3064 if ( rMark.IsMarked() )
3065 {
3066 aLinkRange = rMark.GetMarkArea();
3067 bMove = true; // insert/delete cells to fit range
3068 }
3069 else
3070 aLinkRange = ScRange( rData.GetCurX(), rData.GetCurY(), rData.GetTabNo() );
3071
3072 rData.GetDocFunc().InsertAreaLink( _rFile, _rFilter, _rOptions, _rSource,
3073 aLinkRange, _nRefreshDelaySeconds, bMove, false );
3074 _rRequest.Done();
3075 }
3076 else
3077 _rRequest.Ignore();
3078}
3079
3080namespace {
3081
3082bool isDPSourceValid(const ScDPObject& rDPObj)
3083{
3084 if (rDPObj.IsImportData())
3085 {
3086 // If the data type is database, check if the database is still valid.
3087 const ScImportSourceDesc* pDesc = rDPObj.GetImportSourceDesc();
3088 if (!pDesc)
3089 return false;
3090
3091 const ScDPSaveData* pSaveData = rDPObj.GetSaveData();
3092 const ScDPDimensionSaveData* pDimData = nullptr;
3093 if (pSaveData)
3094 pDimData = pSaveData->GetExistingDimensionData();
3095
3096 const ScDPCache* pCache = pDesc->CreateCache(pDimData);
3097 if (!pCache)
3098 // cache creation failed, probably due to invalid connection.
3099 return false;
3100 }
3101 return true;
3102}
3103
3104void RunPivotLayoutDialog(ScModule* pScMod,
3105 ScTabViewShell* pTabViewShell,
3106 std::unique_ptr<ScDPObject>& pNewDPObject)
3107{
3108 bool bHadNewDPObject = pNewDPObject != nullptr;
3109 pTabViewShell->SetDialogDPObject( std::move(pNewDPObject) );
3110 if ( bHadNewDPObject )
3111 {
3112 // start layout dialog
3113
3114 sal_uInt16 nId = ScPivotLayoutWrapper::GetChildWindowId();
3115 SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
3116 SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
3117 pScMod->SetRefDialog( nId, pWnd == nullptr );
3118 }
3119}
3120
3121void SetupRangeForPivotTableDialog(const ScRange& rRange,
3122 ScAddress& rDestPos,
3123 ScDocument* pDoc,
3124 TranslateId pSrcErrorId,
3125 std::unique_ptr<ScDPObject>& pNewDPObject)
3126{
3127 ScSheetSourceDesc aShtDesc(pDoc);
3128 aShtDesc.SetSourceRange(rRange);
3129 pSrcErrorId = aShtDesc.CheckSourceRange();
3130 if (!pSrcErrorId)
3131 {
3132 pNewDPObject.reset(new ScDPObject(pDoc));
3133 pNewDPObject->SetSheetDesc( aShtDesc );
3134 }
3135
3136 // output below source data
3137 if ( rRange.aEnd.Row()+2 <= pDoc->MaxRow() - 4 )
3138 rDestPos = ScAddress( rRange.aStart.Col(),
3139 rRange.aEnd.Row()+2,
3140 rRange.aStart.Tab() );
3141}
3142
3143void ErrorOrRunPivotLayoutDialog(TranslateId pSrcErrorId,
3144 const ScAddress& rDestPos,
3145 ScModule* pScMod,
3146 ScTabViewShell* pTabViewShell,
3147 std::unique_ptr<ScDPObject>& pNewDPObject)
3148{
3149 if (pSrcErrorId)
3150 {
3151 // Error occurred during data creation. Launch an error and bail out.
3152 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pTabViewShell->GetFrameWeld(),
3153 VclMessageType::Info, VclButtonsType::Ok,
3154 ScResId(pSrcErrorId)));
3155 xInfoBox->run();
3156 return;
3157 }
3158
3159 if ( pNewDPObject )
3160 pNewDPObject->SetOutRange( rDestPos );
3161
3162 RunPivotLayoutDialog(pScMod, pTabViewShell, pNewDPObject);
3163}
3164
3165}
3166
3168{
3169 ScModule* pScMod = SC_MOD();
3170 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
3171 ScViewData& rData = GetViewData();
3172 ScDocument& rDoc = rData.GetDocument();
3173
3174 // ScPivot is no longer used...
3175 ScDPObject* pDPObj = rDoc.GetDPAtCursor(
3176 rData.GetCurX(), rData.GetCurY(),
3177 rData.GetTabNo() );
3178 if ( pDPObj ) // on an existing table?
3179 {
3180 std::unique_ptr<ScDPObject> pNewDPObject;
3181
3182 if (isDPSourceValid(*pDPObj))
3183 pNewDPObject.reset(new ScDPObject(*pDPObj));
3184
3185 RunPivotLayoutDialog(pScMod, pTabViewShell, pNewDPObject);
3186 }
3187 else // create new table
3188 {
3189 // select database range or data
3190 pTabViewShell->GetDBData( true, SC_DB_OLD );
3191 ScMarkData& rMark = GetViewData().GetMarkData();
3192 if ( !rMark.IsMarked() && !rMark.IsMultiMarked() )
3193 pTabViewShell->MarkDataArea( false );
3194
3195 // output to cursor position for non-sheet data
3196 ScAddress aDestPos( rData.GetCurX(), rData.GetCurY(),
3197 rData.GetTabNo() );
3198
3199 // first select type of source data
3200
3201 bool bEnableExt = ScDPObject::HasRegisteredSources();
3202
3204
3207 pTabViewShell->GetFrameWeld(), bEnableExt));
3208
3209 // Populate named ranges (if any).
3210 ScRangeName* pRangeName = rDoc.GetRangeName();
3211 if (pRangeName)
3212 {
3213 ScRangeName::const_iterator itr = pRangeName->begin(), itrEnd = pRangeName->end();
3214 for (; itr != itrEnd; ++itr)
3215 pTypeDlg->AppendNamedRange(itr->second->GetName());
3216 }
3217
3218 pTypeDlg->StartExecuteAsync([this, pTypeDlg, pTabViewShell,
3219 pScMod, pFact, &rDoc, &rMark, aDestPos](int nResult) mutable {
3220
3221 if (nResult == RET_OK )
3222 {
3223 if ( pTypeDlg->IsExternal() )
3224 {
3225 std::vector<OUString> aSources = ScDPObject::GetRegisteredSources();
3226 VclPtr<AbstractScDataPilotServiceDlg> pServDlg(
3227 pFact->CreateScDataPilotServiceDlg(
3228 pTabViewShell->GetFrameWeld(), aSources));
3229
3230 pServDlg->StartExecuteAsync([pServDlg, pScMod, pTabViewShell,
3231 aDestPos, &rDoc](int nResult2) mutable {
3232 if ( nResult2 == RET_OK )
3233 {
3234 ScDPServiceDesc aServDesc(
3235 pServDlg->GetServiceName(),
3236 pServDlg->GetParSource(),
3237 pServDlg->GetParName(),
3238 pServDlg->GetParUser(),
3239 pServDlg->GetParPass() );
3240 std::unique_ptr<ScDPObject> pNewDPObject(new ScDPObject(&rDoc));
3241 pNewDPObject->SetServiceData( aServDesc );
3242 pNewDPObject->SetOutRange(aDestPos);
3243
3244 RunPivotLayoutDialog(pScMod, pTabViewShell, pNewDPObject);
3245 }
3246
3247 pServDlg->disposeOnce();
3248 });
3249 }
3250 else if ( pTypeDlg->IsDatabase() )
3251 {
3252 assert(pFact && "ScAbstractFactory create fail!");
3254 pFact->CreateScDataPilotDatabaseDlg(pTabViewShell->GetFrameWeld()));
3255 assert(pDataDlg && "Dialog create fail!");
3256
3257 pDataDlg->StartExecuteAsync([pDataDlg, pScMod, pTabViewShell,
3258 aDestPos, &rDoc](int nResult2) mutable {
3259 if ( nResult2 == RET_OK )
3260 {
3261 ScImportSourceDesc aImpDesc(&rDoc);
3262 pDataDlg->GetValues( aImpDesc );
3263 std::unique_ptr<ScDPObject> pNewDPObject(new ScDPObject(&rDoc));
3264 pNewDPObject->SetImportDesc( aImpDesc );
3265 pNewDPObject->SetOutRange(aDestPos);
3266
3267 RunPivotLayoutDialog(pScMod, pTabViewShell, pNewDPObject);
3268 }
3269
3270 pDataDlg->disposeOnce();
3271 });
3272 }
3273 else
3274 {
3275 TranslateId pSrcErrorId;
3276
3277 if (pTypeDlg->IsNamedRange())
3278 {
3279 std::unique_ptr<ScDPObject> pNewDPObject;
3280 OUString aName = pTypeDlg->GetSelectedNamedRange();
3281 ScSheetSourceDesc aShtDesc(&rDoc);
3282 aShtDesc.SetRangeName(aName);
3283 pSrcErrorId = aShtDesc.CheckSourceRange();
3284 if (!pSrcErrorId)
3285 {
3286 pNewDPObject.reset(new ScDPObject(&rDoc));
3287 pNewDPObject->SetSheetDesc(aShtDesc);
3288 }
3289
3290 ErrorOrRunPivotLayoutDialog(pSrcErrorId, aDestPos, pScMod, pTabViewShell, pNewDPObject);
3291 }
3292 else // selection
3293 {
3295 ScRange aRange;
3297 if ( (eType & SC_MARK_SIMPLE) == SC_MARK_SIMPLE )
3298 {
3299 ScDocument* pDoc = &rDoc;
3300
3301 // Shrink the range to the data area.
3302 SCCOL nStartCol = aRange.aStart.Col(), nEndCol = aRange.aEnd.Col();
3303 SCROW nStartRow = aRange.aStart.Row(), nEndRow = aRange.aEnd.Row();
3304 if (rDoc.ShrinkToDataArea(aRange.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow))
3305 {
3306 aRange.aStart.SetCol(nStartCol);
3307 aRange.aStart.SetRow(nStartRow);
3308 aRange.aEnd.SetCol(nEndCol);
3309 aRange.aEnd.SetRow(nEndRow);
3310 rMark.SetMarkArea(aRange);
3311 pTabViewShell->MarkRange(aRange);
3312 }
3313
3314 if ( rDoc.HasSubTotalCells( aRange ) )
3315 {
3316 // confirm selection if it contains SubTotal cells
3317 std::shared_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pTabViewShell->GetFrameWeld(),
3318 VclMessageType::Question, VclButtonsType::YesNo,
3319 ScResId(STR_DATAPILOT_SUBTOTAL)));
3320 xQueryBox->set_default_response(RET_YES);
3321 xQueryBox->runAsync(xQueryBox, [aRange, pDoc, pTypeDlg, aDestPos,
3322 pScMod, pTabViewShell, pSrcErrorId] (int nResult2) mutable {
3323 if (nResult2 == RET_NO)
3324 return;
3325
3326 std::unique_ptr<ScDPObject> pNewDPObject;
3327 SetupRangeForPivotTableDialog(aRange, aDestPos, pDoc, pSrcErrorId, pNewDPObject);
3328 ErrorOrRunPivotLayoutDialog(pSrcErrorId, aDestPos, pScMod, pTabViewShell, pNewDPObject);
3329 });
3330
3331 pTypeDlg->disposeOnce();
3332 return;
3333 }
3334
3335 std::unique_ptr<ScDPObject> pNewDPObject;
3336 SetupRangeForPivotTableDialog(aRange, aDestPos, pDoc, pSrcErrorId, pNewDPObject);
3337 ErrorOrRunPivotLayoutDialog(pSrcErrorId, aDestPos, pScMod, pTabViewShell, pNewDPObject);
3338 }
3339 }
3340 }
3341 }
3342
3343 pTypeDlg->disposeOnce();
3344 });
3345 }
3346}
3347
3349{
3350 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
3351 if (!pTabViewShell)
3352 return;
3353
3354 ScModule* pScMod = SC_MOD();
3355
3356 sal_uInt16 nId = ScXMLSourceDlgWrapper::GetChildWindowId();
3357 SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame();
3358 SfxChildWindow* pWnd = pViewFrame->GetChildWindow(nId);
3359 pScMod->SetRefDialog(nId, pWnd == nullptr);
3360}
3361
3363{
3364 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
3365 const SfxItemSet* pArgs = rReq.GetArgs();
3366 if ( pArgs )
3367 {
3368 pTabViewShell->DoSubTotals( pArgs->Get( SCITEM_SUBTDATA ).
3369 GetSubTotalData() );
3370 rReq.Done();
3371 return;
3372 }
3373
3375 ScSubTotalParam aSubTotalParam;
3377
3378 bool bAnonymous;
3379
3380 // Only get existing named database range.
3381 ScDBData* pDBData = pTabViewShell->GetDBData(true, SC_DB_OLD);
3382 if (pDBData)
3383 bAnonymous = false;
3384 else
3385 {
3386 // No existing DB data at this position. Create an
3387 // anonymous DB.
3388 bAnonymous = true;
3389 pDBData = pTabViewShell->GetAnonymousDBData();
3390 ScRange aDataRange;
3391 pDBData->GetArea(aDataRange);
3392 pTabViewShell->MarkRange(aDataRange, false);
3393 }
3394
3395 pDBData->GetSubTotalParam( aSubTotalParam );
3396 aSubTotalParam.bRemoveOnly = false;
3397 if (bAnonymous)
3398 {
3399 // Preset sort formatting along with values and also create formula
3400 // cells with "needs formatting". Subtotals on data of different types
3401 // doesn't make much sense anyway.
3402 aSubTotalParam.bIncludePattern = true;
3403 }
3404
3405 aArgSet.Put( ScSubTotalItem( SCITEM_SUBTDATA, &GetViewData(), &aSubTotalParam ) );
3407 pDlg.disposeAndReset(pFact->CreateScSubTotalDlg(pTabViewShell->GetFrameWeld(), aArgSet));
3408 pDlg->SetCurPageId("1stgroup");
3409
3410 short bResult = pDlg->Execute();
3411
3412 if ( (bResult == RET_OK) || (bResult == SCRET_REMOVE) )
3413 {
3414 const SfxItemSet* pOutSet = nullptr;
3415
3416 if ( bResult == RET_OK )
3417 {
3418 pOutSet = pDlg->GetOutputItemSet();
3419 aSubTotalParam =
3420 pOutSet->Get( SCITEM_SUBTDATA ).GetSubTotalData();
3421 }
3422 else // if (bResult == SCRET_REMOVE)
3423 {
3424 pOutSet = &aArgSet;
3425 aSubTotalParam.bRemoveOnly = true;
3426 aSubTotalParam.bReplace = true;
3428 &GetViewData(),
3429 &aSubTotalParam ) );
3430 }
3431
3432 pTabViewShell->DoSubTotals( aSubTotalParam );
3433 rReq.Done( *pOutSet );
3434 }
3435 else
3437}
3438
3440{
3441 ScAddress aCurPos = GetViewData().GetCurPos();
3442
3443 OUString aInit;
3444
3445 if (aCurPos.Row() > 0)
3446 {
3447 // Get the initial text value from the above cell.
3448
3450 ScAddress aPrevPos = aCurPos;
3451 aPrevPos.IncRow(-1);
3452 ScRefCellValue aCell(rDoc, aPrevPos);
3453
3454 if (aCell.getType() == CELLTYPE_FORMULA)
3455 {
3456 aInit = "=";
3457 const ScTokenArray* pCode = aCell.getFormula()->GetCode();
3458 sc::TokenStringContext aCxt(rDoc, rDoc.GetGrammar());
3459 aInit += pCode->CreateString(aCxt, aCurPos);
3460 }
3461 else
3462 aInit = aCell.getString(&rDoc);
3463 }
3464
3465 SC_MOD()->SetInputMode(SC_INPUT_TABLE, &aInit);
3466}
3467
3469 m_pRequest( nullptr ) {}
3470
3472{
3473}
3474/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
PropertiesInfo aProperties
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
Definition: address.hxx:44
@ SC_PASTETEXT
Definition: asciiopt.hxx:105
#define GetWhich(nSlot)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
sal_Int32 GetValue() const
sal_uInt16 GetValue() const
sal_uInt32 GetValue() const
const OUString & GetValue() const
void AddDays(sal_Int32 nAddDays)
sal_Int16 GetYear() const
sal_uInt16 GetDay() const
sal_uInt16 GetMonth() const
ESelection GetSelection() const
void SetSelection(const ESelection &rNewSel)
void InsertText(const OUString &rNew, bool bSelect=false, bool bLOKShowSelect=true)
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
TransliterationFlags getNextMode()
static void SetError(ErrCode)
virtual VclPtr< AbstractScDataPilotDatabaseDlg > CreateScDataPilotDatabaseDlg(weld::Window *pParent)=0
virtual VclPtr< AbstractScNamePasteDlg > CreateScNamePasteDlg(weld::Window *pParent, ScDocShell *pShell)=0
virtual VclPtr< AbstractScFillSeriesDlg > CreateScFillSeriesDlg(weld::Window *pParent, ScDocument &rDocument, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd, const OUString &aStartStr, double fStep, double fMax, SCSIZE nSelectHeight, SCSIZE nSelectWidth, sal_uInt16 nPossDir)=0
virtual VclPtr< AbstractScDPDateGroupDlg > CreateScDPDateGroupDlg(weld::Window *pParent, const ScDPNumGroupInfo &rInfo, sal_Int32 nDatePart, const Date &rNullDate)=0
virtual VclPtr< AbstractScDataPilotSourceTypeDlg > CreateScDataPilotSourceTypeDlg(weld::Window *pParent, bool bEnableExternal)=0
virtual VclPtr< AbstractScInsertCellDlg > CreateScInsertCellDlg(weld::Window *pParent, bool bDisallowCellMove)=0
virtual VclPtr< AbstractScNameCreateDlg > CreateScNameCreateDlg(weld::Window *pParent, CreateNameFlags nFlags)=0
virtual VclPtr< AbstractScDPShowDetailDlg > CreateScDPShowDetailDlg(weld::Window *pParent, ScDPObject &rDPObj, css::sheet::DataPilotFieldOrientation nOrient)=0
virtual VclPtr< AbstractScInsertContentsDlg > CreateScInsertContentsDlg(weld::Window *pParent, const OUString *pStrTitle=nullptr)=0
virtual VclPtr< AbstractScDPNumGroupDlg > CreateScDPNumGroupDlg(weld::Window *pParent, const ScDPNumGroupInfo &rInfo)=0
virtual VclPtr< AbstractScGroupDlg > CreateAbstractScGroupDlg(weld::Window *pParent, bool bUnGroup=false)=0
virtual VclPtr< AbstractScDeleteCellDlg > CreateScDeleteCellDlg(weld::Window *pParent, bool bDisallowCellMove)=0
virtual VclPtr< AbstractScLinkedAreaDlg > CreateScLinkedAreaDlg(weld::Widget *pParent)=0
virtual VclPtr< AbstractScDeleteContentsDlg > CreateScDeleteContentsDlg(weld::Window *pParent)=0
virtual VclPtr< SfxAbstractTabDialog > CreateScSubTotalDlg(weld::Window *pParent, const SfxItemSet &rArgSet)=0
static SC_DLLPUBLIC ScAbstractDialogFactory * Create()
Definition: scabstdlg.cxx:37
virtual VclPtr< AbstractScImportAsciiDlg > CreateScImportAsciiDlg(weld::Window *pParent, const OUString &aDatName, SvStream *pInStream, ScImportAsciiCall eCall)=0
virtual VclPtr< AbstractScCondFormatManagerDlg > CreateScCondFormatMgrDlg(weld::Window *pParent, ScDocument &rDoc, const ScConditionalFormatList *pFormatList)=0
SCTAB Tab() const
Definition: address.hxx:283
void SetCol(SCCOL nColP)
Definition: address.hxx:291
SC_DLLPUBLIC void Format(OStringBuffer &r, ScRefFlags nFlags, const ScDocument *pDocument=nullptr, const Details &rDetails=detailsOOOa1) const
Definition: address.cxx:2074
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 IncRow(SCROW nDelta=1)
Definition: address.hxx:312
SCCOL Col() const
Definition: address.hxx:279
void GetPossibleClipboardFormats(SvxClipboardFormatItem &rFormats)
Definition: cellsh.cxx:469
bool HasClipboardFormat(SotClipboardFormatId nFormatId)
Definition: cellsh.cxx:537
void Execute(SfxRequest &)
Definition: cellsh3.cxx:153
std::unique_ptr< CellShell_Impl > pImpl
Definition: cellsh.hxx:52
void ExecuteRotateTrans(const SfxRequest &rReq)
Definition: cellsh1.cxx:3046
RotateTransliteration m_aRotateCase
Definition: cellsh.hxx:69
void ExecuteExternalSource(const OUString &_rFile, const OUString &_rFilter, const OUString &_rOptions, const OUString &_rSource, sal_Int32 _nRefreshDelaySeconds, SfxRequest &_rRequest)
Definition: cellsh1.cxx:3052
void ExecuteEdit(SfxRequest &rReq)
Definition: cellsh1.cxx:228
void ExecuteFillSingleEdit()
Definition: cellsh1.cxx:3439
void ExecuteTrans(SfxRequest &rReq)
Definition: cellsh1.cxx:3036
void ExecuteDataPilotDialog()
Definition: cellsh1.cxx:3167
void ExecuteSubtotals(SfxRequest &rReq)
Definition: cellsh1.cxx:3362
void ExecuteXMLSourceDialog()
Definition: cellsh1.cxx:3348
sal_Int32 GetIndex() const
void SetDialogType(condformat::dialog::ScCondFormatDialogType eType)
ScConditionalFormat * GetFormat(sal_uInt32 nKey)
Definition: conditio.cxx:2084
const ScRangeList & GetRange() const
Definition: conditio.hxx:558
sal_uInt32 GetKey() const
Definition: conditio.hxx:590
const ScConsolidateParam & GetData() const
Definition: uiitems.hxx:220
Parameters for conversion.
Definition: spellparam.hxx:33
void GetArea(SCTAB &rTab, SCCOL &rCol1, SCROW &rRow1, SCCOL &rCol2, SCROW &rRow2) const
Definition: dbdata.cxx:300
void GetSubTotalParam(ScSubTotalParam &rSubTotalParam) const
Definition: dbdata.cxx:463
ScDBData * GetAnonymousDBData()
Definition: dbfunc.cxx:156
ScDBData * GetDBData(bool bMarkArea=true, ScGetDBMode eMode=SC_DB_MAKE, ScGetDBSelection eSel=ScGetDBSelection::Keep)
Definition: dbfunc.cxx:81
void RemoveOutline(bool bColumns, bool bRecord=true)
Definition: dbfunc3.cxx:110
void DoSubTotals(const ScSubTotalParam &rParam, bool bRecord=true, const ScSortParam *pForceNewSort=nullptr)
Definition: dbfunc3.cxx:431
void UngroupDataPilot()
Definition: dbfunc3.cxx:1262
bool HasSelectionForDrillDown(css::sheet::DataPilotFieldOrientation &rOrientation)
Definition: dbfunc3.cxx:1909
bool HasSelectionForDateGroup(ScDPNumGroupInfo &rOldInfo, sal_Int32 &rParts)
Definition: dbfunc3.cxx:806
void NumGroupDataPilot(const ScDPNumGroupInfo &rInfo)
Definition: dbfunc3.cxx:1085
void MakeOutline(bool bColumns, bool bRecord=true)
Definition: dbfunc3.cxx:89
void TestRemoveOutline(bool &rCol, bool &rRow)
Definition: dbfunc3.cxx:131
void DateGroupDataPilot(const ScDPNumGroupInfo &rInfo, sal_Int32 nParts)
Definition: dbfunc3.cxx:987
bool HasSelectionForNumGroup(ScDPNumGroupInfo &rOldInfo)
Definition: dbfunc3.cxx:919
void Consolidate(const ScConsolidateParam &rParam)
Definition: dbfunc3.cxx:606
void ShowMarkedOutlines(bool bRecord=true)
Definition: dbfunc3.cxx:385
void SetDataPilotDetails(bool bShow, const OUString *pNewDimensionName=nullptr)
Definition: dbfunc3.cxx:1946
void GroupDataPilot()
Definition: dbfunc3.cxx:1127
void UpdateCharts(bool bAllCharts)
Definition: dbfunc2.cxx:24
void ShowDataPilotSourceData(ScDPObject &rDPObj, const css::uno::Sequence< css::sheet::DataPilotFieldFilter > &rFilters)
Definition: dbfunc3.cxx:2032
void HideMarkedOutlines(bool bRecord=true)
Definition: dbfunc3.cxx:408
This class represents the cached data part of the datapilot cache table implementation.
Definition: dpcache.hxx:48
This class has to do with handling exclusively grouped dimensions? TODO: Find out what this class doe...
Definition: dpdimsave.hxx:164
bool IsServiceData() const
Definition: dpobject.hxx:164
bool GetDataFieldPositionData(const ScAddress &rPos, css::uno::Sequence< css::sheet::DataPilotFieldFilter > &rFilters)
Definition: dpobject.cxx:1150
static bool HasRegisteredSources()
Definition: dpobject.cxx:2742
ScDPSaveData * GetSaveData() const
Definition: dpobject.hxx:141
bool IsImportData() const
Definition: dpobject.hxx:163
const ScImportSourceDesc * GetImportSourceDesc() const
Definition: dpobject.hxx:157
const ScDPDimensionSaveData * GetExistingDimensionData() const
Definition: dpsave.hxx:348
SC_DLLPUBLIC bool ShowNote(const ScAddress &rPos, bool bShow)
Definition: docfunc.cxx:1288
void ReplaceConditionalFormat(sal_uLong nOldIndex, std::unique_ptr< ScConditionalFormat > pFormat, SCTAB nTab, const ScRangeList &rRanges)
Definition: docfunc.cxx:5603
SC_DLLPUBLIC bool DeleteContents(const ScMarkData &rMark, InsertDeleteFlags nFlags, bool bRecord, bool bApi)
Definition: docfunc.cxx:583
void InsertAreaLink(const OUString &rFile, const OUString &rFilter, const OUString &rOptions, const OUString &rSource, const ScRange &rDestRange, sal_Int32 nRefreshDelaySeconds, bool bFitBlock, bool bApi)
Definition: docfunc.cxx:5514
SC_DLLPUBLIC bool UngroupSparklines(ScRange const &rRange)
Definition: docfunc.cxx:5904
SC_DLLPUBLIC bool DeleteSparklineGroup(std::shared_ptr< sc::SparklineGroup > const &pSparklineGroup, SCTAB nTab)
Definition: docfunc.cxx:5868
SC_DLLPUBLIC bool GroupSparklines(ScRange const &rRange, std::shared_ptr< sc::SparklineGroup > const &rpGroup)
Definition: docfunc.cxx:5895
const ScDocument & GetDocument() const
Definition: docsh.hxx:220
void CancelAutoDBRange()
Definition: docsh5.cxx:368
virtual SfxUndoManager * GetUndoManager() override
Definition: docsh.cxx:2945
ScDocFunc & GetDocFunc()
Definition: docsh.hxx:222
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:897
SC_DLLPUBLIC std::shared_ptr< sc::Sparkline > GetSparkline(ScAddress const &rPosition)
Returns sparkline at the address if it exists.
Definition: document.cxx:6625
SC_DLLPUBLIC sal_uInt32 GetNumberFormat(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:3686
CommentCaptionState GetAllNoteCaptionsState(const ScRangeList &rRanges)
Definition: document.cxx:6897
SC_DLLPUBLIC bool IsTabProtected(SCTAB nTab) const
Definition: documen3.cxx:1919
void GetUnprotectedCells(ScRangeList &rRange, SCTAB nTab) const
Definition: document.cxx:7026
bool ShrinkToDataArea(SCTAB nTab, SCCOL &rStartCol, SCROW &rStartRow, SCCOL &rEndCol, SCROW &rEndRow) const
Shrink a range to only include data area.
Definition: document.cxx:1044
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:891
bool IsCutMode()
Definition: document.cxx:2061
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
Definition: documen3.cxx:500
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:892
SC_DLLPUBLIC double GetValue(const ScAddress &rPos) const
Definition: document.cxx:3672
SC_DLLPUBLIC ScPostIt * GetNote(const ScAddress &rPos)
Definition: document.cxx:6730
void SetConsolidateDlgData(std::unique_ptr< ScConsolidateParam > pData)
Definition: documen2.cxx:1137
SC_DLLPUBLIC void GetAllNoteEntries(std::vector< sc::NoteEntry > &rNotes) const
Definition: document.cxx:6994
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4493
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
Definition: document.hxx:1008
bool IsBlockEditable(SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, bool *pOnlyNotBecauseOfMatrix=nullptr, bool bNoMatrixAtAll=false) const
Definition: document.cxx:5436
SC_DLLPUBLIC OUString GetInputString(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bForceSystemLocale=false) const
Definition: document.cxx:3592
SC_DLLPUBLIC ScDPObject * GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: documen3.cxx:383
void GetClipArea(SCCOL &nClipX, SCROW &nClipY, bool bIncludeFiltered)
Definition: document.cxx:3178
SC_DLLPUBLIC ScConditionalFormatList * GetCondFormList(SCTAB nTab) const
Definition: documen4.cxx:867
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:467
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:174
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
Definition: document.cxx:4509
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2487
SC_DLLPUBLIC CellType GetCellType(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:3790
bool IsBlockEmpty(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab) const
Definition: document.cxx:5405
void GetNotesInRange(const ScRangeList &rRange, std::vector< sc::NoteEntry > &rNotes) const
Definition: document.cxx:7014
bool HasSubTotalCells(const ScRange &rRange)
Definition: documen3.cxx:791
bool IsClipboardSource() const
Definition: document.cxx:2614
SC_DLLPUBLIC const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4813
void GetClipStart(SCCOL &nClipX, SCROW &nClipY)
Definition: document.cxx:3230
static ScDrawTransferObj * GetOwnClipboard(const css::uno::Reference< css::datatransfer::XTransferable2 > &)
Definition: drwtrans.cxx:232
bool IsEditable() const
Definition: editable.hxx:84
TranslateId GetMessageId() const
Definition: editable.cxx:152
ScViewData & GetViewData()
Definition: formatsh.hxx:34
ScTokenArray * GetCode()
static SC_DLLPUBLIC LanguageType eLnge
Definition: global.hxx:559
static sal_Int32 getIconSetElements(ScIconSetType eType)
void SetIconSetData(ScIconSetFormatData *pData)
void DataChanged(bool bFromTopNotify=false, bool bSetModified=true)
Definition: inputhdl.cxx:2688
void UpdateLokReferenceMarks()
Definition: inputhdl.cxx:519
EditView * GetActiveView()
Definition: inputhdl.cxx:2321
void InsertFunction(const OUString &rFuncName, bool bAddPar=true)
Definition: inputhdl.cxx:3629
void InitRangeFinder(const OUString &rFormula)
Definition: inputhdl.cxx:344
bool DataChanging(sal_Unicode cTyped=0, bool bFromCommand=false)
Definition: inputhdl.cxx:2676
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
const ScRange & GetMultiMarkArea() const
Definition: markdata.hxx:84
const ScRange & GetMarkArea() const
Definition: markdata.hxx:83
bool IsMultiMarked() const
Definition: markdata.hxx:81
void FillRangeListWithMarks(ScRangeList *pList, bool bClear, SCTAB nForTab=-1) const
Create a range list of marks.
Definition: markdata.cxx:372
bool HasAnyMultiMarks() const
Definition: markdata.cxx:625
bool GetTableSelect(SCTAB nTab) const
Definition: markdata.cxx:169
void SetMultiMarkArea(const ScRange &rRange, bool bMark=true, bool bSetupMulti=false)
Definition: markdata.cxx:107
void ResetMark()
Definition: markdata.cxx:80
void MarkToMulti()
Definition: markdata.cxx:209
bool IsMarked() const
Definition: markdata.hxx:80
void SetMarkArea(const ScRange &rRange)
Definition: markdata.cxx:92
const MarkedTabsType & GetSelectedTabs() const
Definition: markdata.hxx:97
void MarkFromRangeList(const ScRangeList &rList, bool bReset)
Definition: markdata.cxx:319
void MarkToSimple()
Definition: markdata.cxx:222
ScInputHandler * GetInputHdl(ScTabViewShell *pViewSh=nullptr, bool bUseRef=true)
Input-Handler.
Definition: scmod.cxx:1352
SC_DLLPUBLIC void SetRefDialog(sal_uInt16 nId, bool bVis, SfxViewFrame *pViewFrm=nullptr)
Reference dialogs.
Definition: scmod.cxx:1516
bool InputKeyEvent(const KeyEvent &rKEvt, bool bStartEdit=false)
Definition: scmod.cxx:1402
void SetInputMode(ScInputMode eMode, const OUString *pInitText=nullptr)
Definition: scmod.cxx:1383
void ActivateInputWindow(const OUString *pStr=nullptr, bool bMatrix=false)
Definition: scmod.cxx:1479
bool IsEditMode()
Definition: scmod.cxx:1390
SC_DLLPUBLIC void InputEnterHandler(ScEnterMode nBlockMode=ScEnterMode::NORMAL, bool bBeforeSavingInLOK=false)
Definition: scmod.cxx:1408
static void GetFont(vcl::Font &rFont, const SfxItemSet &rItemSet, ScAutoFontColorMode eAutoMode, const OutputDevice *pOutDev=nullptr, const Fraction *pScale=nullptr, const SfxItemSet *pCondSet=nullptr, SvtScriptType nScript=SvtScriptType::NONE, const Color *pBackConfigColor=nullptr, const Color *pTextConfigColor=nullptr)
Static helper function to fill a font object from the passed item set.
Definition: patattr.cxx:251
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
Definition: patattr.hxx:72
Additional class containing cell annotation data.
Definition: postit.hxx:58
const ScRange * Find(const ScAddress &) const
Definition: rangelst.cxx:1027
bool empty() const
Definition: rangelst.hxx:88
void push_back(const ScRange &rRange)
Definition: rangelst.cxx:1137
SC_DLLPUBLIC const_iterator end() const
Definition: rangenam.hxx:246
DataType::const_iterator const_iterator
Definition: rangenam.hxx:203
SC_DLLPUBLIC const_iterator begin() const
Definition: rangenam.hxx:245
ScAddress aEnd
Definition: address.hxx:498
bool Intersects(const ScRange &rRange) const
Definition: address.hxx:734
ScAddress aStart
Definition: address.hxx:497
This class contains authoritative information on the internal reference used as the data source for d...
Definition: dpshttab.hxx:40
TranslateId CheckSourceRange() const
Check the sanity of the data source range.
Definition: dpshttab.cxx:307
SC_DLLPUBLIC void SetRangeName(const OUString &rName)
Definition: dpshttab.cxx:260
const ScSolveParam & GetData() const
Definition: uiitems.hxx:256
const ScTabOpParam & GetData() const
Definition: uiitems.hxx:271
virtual void ShowCursor(bool bOn) override
Definition: tabvwsh4.cxx:469
static css::uno::Reference< css::datatransfer::XTransferable2 > GetClipData(vcl::Window *pWin)
Definition: tabvwshc.cxx:494
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
Definition: tabvwsha.cxx:666
void SetDialogDPObject(std::unique_ptr< ScDPObject > pObj)
Definition: tabvwsh4.cxx:1865
OUString DoAutoSum(bool &rRangeFinder, bool &rSubTotal, const OpCode eCode)
Definition: tabvwshc.cxx:666
void InsertURL(const OUString &rName, const OUString &rURL, const OUString &rTarget, sal_uInt16 nMode)
Definition: tabvwshe.cxx:139
void MarkDataArea(bool bIncludeCursor=true)
Definition: tabview3.cxx:1680
void ErrorMessage(TranslateId pGlobStrId)
Definition: tabview2.cxx:1446
void SelectionChanged(bool bFromPaste=false)
Definition: tabview3.cxx:532
void MarkRange(const ScRange &rRange, bool bSetCursor=true, bool bContinue=false)
Definition: tabview3.cxx:1711
ScViewData & GetViewData()
Definition: tabview.hxx:335
SC_DLLPUBLIC void SetCursor(SCCOL nPosX, SCROW nPosY, bool bNew=false)
Definition: tabview3.cxx:363
void UpdateCopySourceOverlay()
Definition: tabview2.cxx:1014
SC_DLLPUBLIC void CellContentChanged()
Definition: tabview3.cxx:513
void HideListBox()
Definition: tabview3.cxx:2996
void SetMarkData(const ScMarkData &rNew)
Definition: tabview3.cxx:1761
void UpdateRef(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ)
Definition: tabview4.cxx:186
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
Definition: tabview3.cxx:1822
OUString CreateString(sc::TokenStringContext &rCxt, const ScAddress &rPos) const
Create a string representation of formula token array without modifying the internal state of the tok...
Definition: token.cxx:5217
ScDocument * GetDocument() const
Definition: transobj.hxx:80
static SC_DLLPUBLIC ScTransferObj * GetOwnClipboard(const css::uno::Reference< css::datatransfer::XTransferable2 > &)
Definition: transobj.cxx:199
void GetMultiArea(ScRangeListRef &rRange) const
Definition: viewdata.cxx:1204
SfxDispatcher & GetDispatcher()
Definition: viewdata.cxx:3135
bool SimpleColMarked()
Definition: viewdata.cxx:1229
ScDocFunc & GetDocFunc() const
Definition: viewdata.cxx:3124
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3141
bool SimpleRowMarked()
Definition: viewdata.cxx:1244
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:354
ScGridWindow * GetActiveWin()
Definition: viewdata.cxx:3157
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:357
ScMarkType GetSimpleArea(SCCOL &rStartCol, SCROW &rStartRow, SCTAB &rStartTab, SCCOL &rEndCol, SCROW &rEndRow, SCTAB &rEndTab) const
Definition: viewdata.cxx:1181
ScDBFunc * GetView() const
Definition: viewdata.cxx:863
void GetFillData(SCCOL &rStartCol, SCROW &rStartRow, SCCOL &rEndCol, SCROW &rEndRow)
Definition: viewdata.cxx:1365
SCROW GetRefEndY() const
Definition: viewdata.hxx:536
SCTAB GetRefStartZ() const
Definition: viewdata.hxx:534
void SetPasteMode(ScPasteFlags nFlags)
Definition: viewdata.hxx:448
SCCOL GetRefEndX() const
Definition: viewdata.hxx:535
bool IsMultiMarked() const
Definition: viewdata.cxx:1259
SCTAB GetRefEndZ() const
Definition: viewdata.hxx:537
ScAddress GetCurPos() const
Definition: viewdata.cxx:4127
SCROW GetCurY() const
Definition: viewdata.hxx:402
SCCOL GetCurX() const
Definition: viewdata.hxx:401
void SetRefStart(SCCOL nNewX, SCROW nNewY, SCTAB nNewZ)
Definition: viewdata.cxx:4132
void TabOp(const ScTabOpParam &rParam, bool bRecord=true)
Definition: viewfun2.cxx:2319
bool SelectionEditable(bool *pOnlyNotBecauseOfMatrix=nullptr)
Definition: viewfunc.cxx:274
void DeleteCells(DelCellCmd eCmd)
Definition: viewfunc.cxx:1768
void FillTab(InsertDeleteFlags nFlags, ScPasteFunc nFunction, bool bSkipEmpty, bool bAsLink)
Definition: viewfun2.cxx:1680
void ReplaceNote(const ScAddress &rPos, const OUString &rNoteText, const OUString *pAuthor, const OUString *pDate)
Definition: viewfunc.cxx:2724
SC_DLLPUBLIC void FillSimple(FillDir eDir)
Definition: viewfun2.cxx:1397
void EnterData(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString &rString, const EditTextObject *pData=nullptr, bool bMatrixExpand=false)
Definition: viewfunc.cxx:384
SC_DLLPUBLIC void DeletePageBreak(bool bColumn, bool bRecord=true, const ScAddress *pPos=nullptr, bool bSetModified=true)
Definition: viewfun2.cxx:989
void DetectiveAddError()
Definition: viewfun6.cxx:99
void FillSeries(FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd, double fStart, double fStep, double fMax)
Definition: viewfun2.cxx:1446
void InsertNameList()
Definition: viewfunc.cxx:3098
void DetectiveDelSucc()
Definition: viewfun6.cxx:92
void TransliterateText(TransliterationFlags nType)
Definition: viewfun2.cxx:1884
bool InsertCells(InsCellCmd eCmd, bool bRecord=true, bool bPartOfPaste=false)
Definition: viewfunc.cxx:1714
SC_DLLPUBLIC void CutToClip()
Definition: viewfun3.cxx:90
void DetectiveMarkInvalid()
Definition: viewfun6.cxx:113
SC_DLLPUBLIC void InsertPageBreak(bool bColumn, bool bRecord=true, const ScAddress *pPos=nullptr, bool bSetModified=true)
Definition: viewfun2.cxx:972
SvtScriptType GetSelectionScriptType()
Definition: viewfunc.cxx:881
void ShowNote(bool bShow)
Definition: viewfun6.cxx:482
void DoRefConversion()
Definition: viewfun4.cxx:180
SC_DLLPUBLIC void FillAuto(FillDir eDir, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_uLong nCount)
Definition: viewfun2.cxx:1469
SC_DLLPUBLIC const ScPatternAttr * GetSelectionPattern()
Definition: viewfunc.cxx:907
void DeleteContents(InsertDeleteFlags nFlags)
Definition: viewfunc.cxx:2052
void DetectiveMarkSucc()
Definition: viewfun6.cxx:233
void EditNote()
Definition: viewfun6.cxx:492
void DetectiveDelPred()
Definition: viewfun6.cxx:78
void Solve(const ScSolveParam &rParam)
Definition: viewfun2.cxx:2249
SC_DLLPUBLIC void PasteFromSystem()
Definition: viewfun3.cxx:485
void CreateNames(CreateNameFlags nFlags)
Definition: viewfunc.cxx:3025
void InsertCurrentTime(SvNumFormatType nCellFmt, const OUString &rUndoStr)
Insert date or time into current cell.
Definition: viewfun6.cxx:273
void DoHangulHanjaConversion()
Definition: viewfun4.cxx:433
void DoThesaurus()
Definition: viewfun4.cxx:311
void InsertSpecialChar(const OUString &rStr, const vcl::Font &rFont)
Definition: viewfun2.cxx:3289
void SetNoteText(const ScAddress &rPos, const OUString &rNoteText)
Definition: viewfunc.cxx:2719
void DoSheetConversion(const ScConversionParam &rParam)
Generic implementation of sheet conversion functions.
Definition: viewfun4.cxx:439
bool InsertName(const OUString &rName, const OUString &rSymbol, const OUString &rType)
Definition: viewfunc.cxx:2971
SC_DLLPUBLIC bool CopyToClip(ScDocument *pClipDoc, bool bCut, bool bApi=false, bool bIncludeObjects=false, bool bStopEdit=true)
Definition: viewfun3.cxx:168
CreateNameFlags GetCreateNameFlags()
Definition: viewfunc.cxx:3036
SC_DLLPUBLIC bool PasteFromClip(InsertDeleteFlags nFlags, ScDocument *pClipDoc, ScPasteFunc nFunction=ScPasteFunc::NONE, bool bSkipEmptyCells=false, bool bTranspose=false, bool bAsLink=false, InsCellCmd eMoveMode=INS_NONE, InsertDeleteFlags nUndoExtraFlags=InsertDeleteFlags::NONE, bool bAllowDialogs=false)
Definition: viewfun3.cxx:872
void DetectiveAddPred()
Definition: viewfun6.cxx:71
void DetectiveMarkPred()
Definition: viewfun6.cxx:169
void ChangeIndent(bool bIncrement)
Definition: viewfunc.cxx:2941
void PasteDraw()
Definition: viewfun3.cxx:468
void ConvertFormulaToValue()
Definition: viewfun2.cxx:1871
void UseScenario(const OUString &rName)
Definition: viewfun2.cxx:2371
void DetectiveAddSucc()
Definition: viewfun6.cxx:85
void DetectiveRefresh()
Definition: viewfun6.cxx:120
static TransliterationFlags GetTransliterationType(sal_uInt16 nSlotID)
Definition: viewutil.cxx:99
void disposeAndReset(reference_type *pBody)
void Invalidate(sal_uInt16 nId)
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)
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
sal_Int16 GetValue() const
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const
const T & Put(std::unique_ptr< T > xItem, sal_uInt16 nWhich=0)
void Remove(const SfxPoolItem &)
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) 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 * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 GetSlot() const
void Ignore()
const SfxItemSet * GetArgs() const
void SetSlot(sal_uInt16 nNewSlot)
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
virtual SfxInterface * GetInterface() const
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
SfxDispatcher * GetDispatcher() const
size_t LeaveListAction()
virtual void EnterListAction(const OUString &rComment, const OUString &rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId)
void ToggleChildWindow(sal_uInt16)
SfxBindings & GetBindings()
void SetChildWindow(sal_uInt16 nId, bool bVisible, bool bSetFocus=true)
SfxChildWindow * GetChildWindow(sal_uInt16)
SfxFrame & GetFrame() const
weld::Window * GetFrameWeld() const
ViewShellId GetViewShellId() const override
SfxViewFrame * GetViewFrame() const
sal_uInt32 GetStandardFormat(SvNumFormatType eType, LanguageType eLnge=LANGUAGE_DONTKNOW)
void GetOutputString(const double &fOutNumber, sal_uInt32 nFIndex, OUString &sOutString, const Color **ppColor, bool bUseStarFormat=false)
const Date & GetNullDate() const
const SvNumberformat * GetEntry(sal_uInt32 nKey) const
bool IsNumberFormat(const OUString &sString, sal_uInt32 &F_Index, double &fOutNumber, SvNumInputOptions eInputOptions=SvNumInputOptions::NONE)
SvNumFormatType GetType() const
virtual VclPtr< SfxAbstractDialog > CreateCharMapDialog(weld::Window *pParent, const SfxItemSet &rAttr, const css::uno::Reference< css::frame::XFrame > &rFrame)=0
static SvxAbstractDialogFactory * Create()
OUString const & GetClipbrdFormatName(sal_uInt16 nPos) const
sal_uInt16 Count() const
SotClipboardFormatId GetClipbrdFormatId(sal_uInt16 nPos) const
SvxLinkInsertMode GetInsertMode() const
const OUString & GetName() const
const OUString & GetURL() const
const OUString & GetTargetFrame() const
bool GetString(SotClipboardFormatId nFormat, OUString &rStr) const
static TransferableDataHelper CreateFromSystemClipboard(vcl::Window *pWindow)
const css::uno::Reference< css::datatransfer::XTransferable > & GetTransferable() const
bool empty() const
size_type size() const
FontFamily GetFamilyType()
const OUString & GetStyleName() const
const OUString & GetFamilyName() const
FontPitch GetPitch()
rtl_TextEncoding GetCharSet() const
weld::Window * GetFrameWeld() const
constexpr ::Color COL_GREEN(0x00, 0x80, 0x00)
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_BROWN(0x80, 0x80, 0x00)
constexpr ::Color COL_YELLOW(0xFF, 0xFF, 0x00)
constexpr ::Color COL_RED(0x80, 0x00, 0x00)
ScIconSetType
Definition: colorscale.hxx:189
@ IconSet_3Arrows
Definition: colorscale.hxx:190
@ IconSet_5Boxes
Definition: colorscale.hxx:211
@ COLORSCALE_PERCENT
Definition: colorscale.hxx:38
#define DLG_RET_EDIT
#define DLG_RET_ADD
int nCount
CommentCaptionState
Definition: document.hxx:262
@ MIXED
Definition: document.hxx:265
@ ALLHIDDEN
Definition: document.hxx:264
#define EE_TEXTPOS_ALL
FilterGroup & rTarget
DocumentType eType
SotClipboardFormatId
CellType
Definition: global.hxx:271
@ CELLTYPE_STRING
Definition: global.hxx:274
@ CELLTYPE_FORMULA
Definition: global.hxx:275
DelCellCmd
Definition: global.hxx:280
ScPasteFunc
Definition: global.hxx:180
InsCellCmd
Definition: global.hxx:289
@ INS_INSROWS_AFTER
Definition: global.hxx:295
@ INS_NONE
Definition: global.hxx:294
@ INS_INSCOLS_AFTER
Definition: global.hxx:296
@ INS_CELLSDOWN
Definition: global.hxx:290
@ INS_INSCOLS_BEFORE
Definition: global.hxx:293
@ INS_CELLSRIGHT
Definition: global.hxx:291
@ INS_INSROWS_BEFORE
Definition: global.hxx:292
InsertDeleteFlags
Definition: global.hxx:149
@ SPARKLINES
Sheet / outlining (grouping) information.
@ NOTE
Strings (and string results if InsertDeleteFlags::FORMULA is not set).
@ OBJECTS
Cell styles.
@ STRING
Dates, times, datetime values.
@ DATETIME
Numeric values (and numeric results if InsertDeleteFlags::FORMULA is not set).
@ ATTRIB
Internal use only (d&d undo): do not delete caption objects of cell notes.
@ FORMULA
Cell notes.
FillDateCmd
Definition: global.hxx:333
@ FILL_MONTH
Definition: global.hxx:336
@ FILL_YEAR
Definition: global.hxx:338
@ FILL_WEEKDAY
Definition: global.hxx:335
@ FILL_DAY
Definition: global.hxx:334
@ SC_INPUT_TABLE
Definition: global.hxx:362
#define MAXDOUBLE
Definition: global.hxx:77
@ SC_DB_OLD
don't create
Definition: global.hxx:385
FillCmd
Definition: global.hxx:316
@ FILL_GROWTH
Definition: global.hxx:319
@ FILL_LINEAR
Definition: global.hxx:318
@ FILL_AUTO
Definition: global.hxx:321
@ FILL_SIMPLE
Definition: global.hxx:317
@ FILL_DATE
Definition: global.hxx:320
FillDir
Definition: global.hxx:308
@ FILL_TO_TOP
Definition: global.hxx:311
@ FILL_TO_RIGHT
Definition: global.hxx:310
@ FILL_TO_LEFT
Definition: global.hxx:312
@ FILL_TO_BOTTOM
Definition: global.hxx:309
sal_Int32 nIndex
OUString aName
#define LANGUAGE_CHINESE_TRADITIONAL
#define LANGUAGE_CHINESE_SIMPLIFIED
Sequence< sal_Int8 > aSeq
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
aStr
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
@ table
SC_DLLPUBLIC void PasteFromClipboard(ScViewData &rViewData, ScTabViewShell *pTabViewShell, bool bShowDialog)
Definition: cliputil.cxx:49
@ Exception
css::uno::Sequence< css::uno::Any > InitAnyPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
int i
sal_uInt32 toUInt32(std::u16string_view str, sal_Int16 radix=10)
Put
Sequence< beans::PropertyValue > GetCommandProperties(const OUString &rsCommandName, const OUString &rsModuleName)
OUString GetModuleIdentifier(const Reference< frame::XFrame > &rxFrame)
OUString GetTooltipLabelForCommand(const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
sal_Int16 nId
const char GetNullDate[]
const char GetValue[]
OpCode
ocAverage
ocMin
ocSum
ocCount
ocMax
@ SC_AUTOCOL_BLACK
always use black
Definition: patattr.hxx:45
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:398
#define ERRCODE_BASIC_BAD_PARAMETER
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
#define SCITEM_CONDFORMATDLGDATA
Definition: scitems.hxx:97
#define SCITEM_SUBTDATA
Definition: scitems.hxx:92
#define SCITEM_CONSOLIDATEDATA
Definition: scitems.hxx:93
#define SCITEM_SOLVEDATA
Definition: scitems.hxx:95
#define SCITEM_STRING
Definition: scitems.hxx:88
constexpr TypedWhichId< ScCondFormatItem > ATTR_CONDITIONAL(154)
#define SC_MOD()
Definition: scmod.hxx:249
#define FDS_OPT_VERT
Definition: scui_def.hxx:29
#define BTN_PASTE_NAME
Definition: scui_def.hxx:61
#define SCRET_REMOVE
Definition: scui_def.hxx:67
#define FDS_OPT_NONE
Definition: scui_def.hxx:27
#define BTN_PASTE_LIST
Definition: scui_def.hxx:62
CellShiftDisabledFlags
Definition: scui_def.hxx:41
#define FDS_OPT_HORZ
Definition: scui_def.hxx:28
CreateNameFlags
Definition: scui_def.hxx:50
@ SC_CONVERSION_CHINESE_TRANSL
Hangul-Hanja converter.
Definition: spellparam.hxx:28
sal_Int32 nEndPos
sal_Int32 nStartPos
const ScDPCache * CreateCache(const ScDPDimensionSaveData *pDimData) const
Definition: dpsdbtab.cxx:50
This is very similar to ScCellValue, except that it references the original value instead of copying ...
Definition: cellvalue.hxx:108
ScFormulaCell * getFormula() const
Definition: cellvalue.hxx:137
OUString getString(const ScDocument *pDoc) const
Retrieve string value.
Definition: cellvalue.cxx:657
CellType getType() const
Definition: cellvalue.hxx:133
bool bIncludePattern
sort formats
bool bReplace
replace existing results
Context for creating string from an array of formula tokens, used in ScTokenArray::CreateString().
Reference< XFrame > xFrame
bool bVisible
TransliterationFlags
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:23
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
RET_OK
RET_NO
RET_YES
ScMarkType
States GetSimpleArea() returns for the underlying selection marks, so the caller can react if the res...
Definition: viewdata.hxx:61
@ SC_MARK_SIMPLE
Definition: viewdata.hxx:65
@ SC_MARK_SIMPLE_FILTERED
Definition: viewdata.hxx:67
std::unique_ptr< char[]> aBuffer
SvNumFormatType