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& rViewFrm = pTabViewShell->GetViewFrame();
934 SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
935
936 pScMod->SetRefDialog( nId, pWnd == nullptr );
937
938 }
939 break;
940 case SID_SAMPLING_DIALOG:
941 {
943 SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
944 SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
945
946 pScMod->SetRefDialog( nId, pWnd == nullptr );
947 }
948 break;
949 case SID_DESCRIPTIVE_STATISTICS_DIALOG:
950 {
952 SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
953 SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
954
955 pScMod->SetRefDialog( nId, pWnd == nullptr );
956 }
957 break;
958 case SID_ANALYSIS_OF_VARIANCE_DIALOG:
959 {
961 SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
962 SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
963
964 pScMod->SetRefDialog( nId, pWnd == nullptr );
965 }
966 break;
967 case SID_CORRELATION_DIALOG:
968 {
970 SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
971 SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
972
973 pScMod->SetRefDialog( nId, pWnd == nullptr );
974 }
975 break;
976 case SID_COVARIANCE_DIALOG:
977 {
979 SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
980 SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
981
982 pScMod->SetRefDialog( nId, pWnd == nullptr );
983 }
984 break;
985 case SID_EXPONENTIAL_SMOOTHING_DIALOG:
986 {
988 SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
989 SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
990
991 pScMod->SetRefDialog( nId, pWnd == nullptr );
992 }
993 break;
994 case SID_MOVING_AVERAGE_DIALOG:
995 {
997 SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
998 SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
999
1000 pScMod->SetRefDialog( nId, pWnd == nullptr );
1001 }
1002 break;
1003 case SID_REGRESSION_DIALOG:
1004 {
1006 SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
1007 SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
1008
1009 pScMod->SetRefDialog( nId, pWnd == nullptr );
1010 }
1011 break;
1012 case SID_TTEST_DIALOG:
1013 {
1015 SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
1016 SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
1017
1018 pScMod->SetRefDialog( nId, pWnd == nullptr );
1019
1020 }
1021 break;
1022 case SID_FTEST_DIALOG:
1023 {
1025 SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
1026 SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
1027
1028 pScMod->SetRefDialog( nId, pWnd == nullptr );
1029
1030 }
1031 break;
1032 case SID_ZTEST_DIALOG:
1033 {
1035 SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
1036 SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
1037
1038 pScMod->SetRefDialog( nId, pWnd == nullptr );
1039
1040 }
1041 break;
1042 case SID_CHI_SQUARE_TEST_DIALOG:
1043 {
1045 SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
1046 SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
1047
1048 pScMod->SetRefDialog( nId, pWnd == nullptr );
1049
1050 }
1051 break;
1052 case SID_FOURIER_ANALYSIS_DIALOG:
1053 {
1055 SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
1056 SfxChildWindow* pWnd = rViewFrm.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& rViewFrm = 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 rViewFrm.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& rViewFrame = pTabViewShell->GetViewFrame();
1082 SfxChildWindow* pWindow = rViewFrame.GetChildWindow(nId);
1083 pScMod->SetRefDialog(nId, pWindow == nullptr);
1084 rReq.Done();
1085 }
1086 break;
1087
1088 case SID_EDIT_SPARKLINE:
1089 {
1091 SfxViewFrame& rViewFrame = pTabViewShell->GetViewFrame();
1092 SfxChildWindow* pWindow = rViewFrame.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& rViewFrame = pTabViewShell->GetViewFrame();
1763 auto xFrame = rViewFrame.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& rViewFrame = pTabViewShell->GetViewFrame();
1902 if( rReq.GetArgs() )
1903 rViewFrame.SetChildWindow( SID_SPELL_DIALOG,
1904 static_cast< const SfxBoolItem& >( rReq.GetArgs()->
1905 Get( SID_SPELL_DIALOG ) ).GetValue() );
1906 else
1907 rViewFrame.ToggleChildWindow( SID_SPELL_DIALOG );
1908
1909 rViewFrame.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& rViewFrm = pTabViewShell->GetViewFrame();
2095 SfxChildWindow* pWnd = rViewFrm.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& rViewFrm = pTabViewShell->GetViewFrame();
2104 SfxChildWindow* pWnd = rViewFrm.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& rViewFrm = pTabViewShell->GetViewFrame();
2135 SfxChildWindow* pWnd = rViewFrm.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& rViewFrm = pTabViewShell->GetViewFrame();
2290 SfxChildWindow* pWnd = rViewFrm.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& rViewFrm = pTabViewShell->GetViewFrame();
2302 SfxChildWindow* pWnd = rViewFrm.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 + " ");
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 = 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()->fillFontOnly(aFont, 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()->fillFontOnly(aCurFont, 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& rViewFrame = pTabViewShell->GetViewFrame();
2668 auto xFrame = rViewFrame.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 = pReqArgs->Get(SID_SELECT_SCENARIO);
2681 pTabViewShell->UseScenario(rItem.GetValue());
2683 rReq.SetReturnValue(SfxStringItem(SID_SELECT_SCENARIO, rItem.GetValue()));
2684 rReq.Done();
2685 }
2686 }
2687 break;
2688
2689 case SID_HYPERLINK_SETLINK:
2690 if( pReqArgs )
2691 {
2692 const SfxPoolItem* pItem;
2693 if( pReqArgs->HasItem( SID_HYPERLINK_SETLINK, &pItem ) )
2694 {
2695 const SvxHyperlinkItem* pHyper = static_cast<const SvxHyperlinkItem*>(pItem);
2696 const OUString& rName = pHyper->GetName();
2697 const OUString& rURL = pHyper->GetURL();
2698 const OUString& rTarget = pHyper->GetTargetFrame();
2699 sal_uInt16 nType = static_cast<sal_uInt16>(pHyper->GetInsertMode());
2700
2701 pTabViewShell->InsertURL( rName, rURL, rTarget, nType );
2702 rReq.Done();
2703 }
2704 else
2705 rReq.Ignore();
2706 }
2707 break;
2708
2709 case SID_OPENDLG_CONDFRMT_MANAGER:
2710 case SID_OPENDLG_CURRENTCONDFRMT_MANAGER:
2711 {
2713
2714 ScViewData& rData = GetViewData();
2715 ScDocument& rDoc = rData.GetDocument();
2716
2717 if (rDoc.IsTabProtected(rData.GetTabNo()))
2718 {
2719 pTabViewShell->ErrorMessage( STR_ERR_CONDFORMAT_PROTECTED );
2720 break;
2721 }
2722
2723 ScAddress aPos(rData.GetCurX(), rData.GetCurY(), rData.GetTabNo());
2724
2725 ScConditionalFormatList* pList = nullptr;
2726
2727 const ScCondFormatDlgItem* pDlgItem = nullptr;
2728 auto itemsRange = pTabViewShell->GetPool().GetItemSurrogates(SCITEM_CONDFORMATDLGDATA);
2729 if (itemsRange.begin() != itemsRange.end())
2730 {
2731 pDlgItem= static_cast<const ScCondFormatDlgItem*>(*itemsRange.begin());
2732 pList = const_cast<ScCondFormatDlgItem*>(pDlgItem)->GetConditionalFormatList();
2733 }
2734
2735 if (!pList)
2736 pList = rDoc.GetCondFormList( aPos.Tab() );
2737
2739 pTabViewShell->GetFrameWeld(), rDoc, pList));
2740
2741 if (pDlgItem)
2742 pDlg->SetModified();
2743
2744 pDlg->StartExecuteAsync([this, pDlg, &rData, pTabViewShell, pDlgItem, aPos](sal_Int32 nRet){
2745 std::unique_ptr<ScConditionalFormatList> pCondFormatList = pDlg->GetConditionalFormatList();
2746 if(nRet == RET_OK && pDlg->CondFormatsChanged())
2747 {
2748 rData.GetDocShell()->GetDocFunc().SetConditionalFormatList(pCondFormatList.release(), aPos.Tab());
2749 }
2750 else if(nRet == DLG_RET_ADD)
2751 {
2752 // Put the xml string parameter to initialize the
2753 // Conditional Format Dialog. ( add new )
2754 pTabViewShell->GetPool().Put(ScCondFormatDlgItem(
2755 std::shared_ptr<ScConditionalFormatList>(pCondFormatList.release()), -1, true));
2756 // Queue message to open Conditional Format Dialog
2757 GetViewData().GetDispatcher().Execute( SID_OPENDLG_CONDFRMT, SfxCallMode::ASYNCHRON );
2758 }
2759 else if (nRet == DLG_RET_EDIT)
2760 {
2761 ScConditionalFormat* pFormat = pDlg->GetCondFormatSelected();
2762 sal_Int32 nIndex = pFormat ? pFormat->GetKey() : -1;
2763 // Put the xml string parameter to initialize the
2764 // Conditional Format Dialog. ( edit selected conditional format )
2765 pTabViewShell->GetPool().Put(ScCondFormatDlgItem(
2766 std::shared_ptr<ScConditionalFormatList>(pCondFormatList.release()), nIndex, true));
2767
2768 // Queue message to open Conditional Format Dialog
2769 GetViewData().GetDispatcher().Execute( SID_OPENDLG_CONDFRMT, SfxCallMode::ASYNCHRON );
2770 }
2771 else
2772 pCondFormatList.reset();
2773
2774 if (pDlgItem)
2775 pTabViewShell->GetPool().Remove(*pDlgItem);
2776
2777 pDlg->disposeOnce();
2778 });
2779 }
2780 break;
2781
2782 case SID_EXTERNAL_SOURCE:
2783 {
2784 const SfxStringItem* pFile = rReq.GetArg<SfxStringItem>(SID_FILE_NAME);
2785 const SfxStringItem* pSource = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
2786 if ( pFile && pSource )
2787 {
2788 OUString aFile;
2789 OUString aFilter;
2790 OUString aOptions;
2791 OUString aSource;
2792 sal_Int32 nRefreshDelaySeconds=0;
2793
2794 aFile = pFile->GetValue();
2795 aSource = pSource->GetValue();
2796 const SfxStringItem* pFilter = rReq.GetArg<SfxStringItem>(SID_FILTER_NAME);
2797 if ( pFilter )
2798 aFilter = pFilter->GetValue();
2799 const SfxStringItem* pOptions = rReq.GetArg<SfxStringItem>(SID_FILE_FILTEROPTIONS);
2800 if ( pOptions )
2801 aOptions = pOptions->GetValue();
2802 const SfxUInt32Item* pRefresh = rReq.GetArg<SfxUInt32Item>(FN_PARAM_2);
2803 if ( pRefresh )
2804 nRefreshDelaySeconds = pRefresh->GetValue();
2805
2806 ExecuteExternalSource( aFile, aFilter, aOptions, aSource, nRefreshDelaySeconds, rReq );
2807 }
2808 else
2809 {
2811
2812 pImpl->m_pLinkedDlg.disposeAndClear();
2813 pImpl->m_pLinkedDlg =
2814 pFact->CreateScLinkedAreaDlg(pTabViewShell->GetFrameWeld());
2815 delete pImpl->m_pRequest;
2816 pImpl->m_pRequest = new SfxRequest( rReq );
2817 OUString sFile, sFilter, sOptions, sSource;
2818 sal_Int32 nRefreshDelaySeconds = 0;
2819 if (pImpl->m_pLinkedDlg->Execute() == RET_OK)
2820 {
2821 sFile = pImpl->m_pLinkedDlg->GetURL();
2822 sFilter = pImpl->m_pLinkedDlg->GetFilter();
2823 sOptions = pImpl->m_pLinkedDlg->GetOptions();
2824 sSource = pImpl->m_pLinkedDlg->GetSource();
2825 nRefreshDelaySeconds = pImpl->m_pLinkedDlg->GetRefreshDelaySeconds();
2826 if ( !sFile.isEmpty() )
2827 pImpl->m_pRequest->AppendItem( SfxStringItem( SID_FILE_NAME, sFile ) );
2828 if ( !sFilter.isEmpty() )
2829 pImpl->m_pRequest->AppendItem( SfxStringItem( SID_FILTER_NAME, sFilter ) );
2830 if ( !sOptions.isEmpty() )
2831 pImpl->m_pRequest->AppendItem( SfxStringItem( SID_FILE_FILTEROPTIONS, sOptions ) );
2832 if ( !sSource.isEmpty() )
2833 pImpl->m_pRequest->AppendItem( SfxStringItem( FN_PARAM_1, sSource ) );
2834 if ( nRefreshDelaySeconds )
2835 pImpl->m_pRequest->AppendItem( SfxUInt32Item( FN_PARAM_2, nRefreshDelaySeconds ) );
2836 }
2837
2838 ExecuteExternalSource( sFile, sFilter, sOptions, sSource, nRefreshDelaySeconds, *(pImpl->m_pRequest) );
2839 }
2840 }
2841 break;
2842
2843 case SID_AUTO_SUM:
2844 {
2845 const SfxItemSet *pArgs = rReq.GetArgs();
2846 const OUString sFunction = pArgs ?
2847 static_cast<const SfxStringItem&>( pArgs->Get( SID_AUTO_SUM ) ).GetValue()
2848 : "";
2849
2850 OpCode eFunction = ocSum;
2851 if (sFunction == "average")
2852 eFunction = ocAverage;
2853 else if (sFunction == "count")
2854 eFunction = ocCount;
2855 else if (sFunction == "min")
2856 eFunction = ocMin;
2857 if (sFunction == "max")
2858 eFunction = ocMax;
2859
2860 bool bSubTotal = false;
2861 bool bRangeFinder = false;
2862 const OUString aFormula = pTabViewShell->DoAutoSum( bRangeFinder, bSubTotal , eFunction );
2863 if ( !aFormula.isEmpty() )
2864 {
2865 const sal_Int32 nPar = aFormula.indexOf( '(' );
2866 const sal_Int32 nLen = aFormula.getLength();
2867 ScInputHandler* pHdl = pScMod->GetInputHdl( pTabViewShell );
2868
2869 if ( pHdl && nPar != -1 )
2870 {
2871 if ( !pScMod->IsEditMode() )
2872 {
2873 pScMod->SetInputMode( SC_INPUT_TABLE );
2874 }
2875
2876 EditView *pEditView=pHdl->GetActiveView();
2877 if ( pEditView )
2878 {
2879 ESelection aTextSel = pEditView->GetSelection();
2880 aTextSel.nStartPos = 0;
2881 aTextSel.nEndPos = EE_TEXTPOS_ALL;
2882 pHdl->DataChanging();
2883 pEditView->SetSelection(aTextSel);
2884 pEditView->InsertText(aFormula);
2885 pEditView->SetSelection( bRangeFinder ? ESelection( 0, nPar + ( bSubTotal ? 3 : 1 ), 0, nLen - 1 ) : ESelection( 0, nLen - 1, 0, nLen - 1 ) );
2886 pHdl->DataChanged();
2887
2888 if ( bRangeFinder )
2889 {
2890 pHdl->InitRangeFinder( aFormula );
2891 }
2892 }
2893 }
2894 }
2895 }
2896 break;
2897
2898 case SID_SELECT_UNPROTECTED_CELLS:
2899 {
2900 ScViewData& rData = GetViewData();
2901 SCTAB aTab = rData.GetTabNo();
2902 ScMarkData& rMark = rData.GetMarkData();
2903 ScDocument& rDoc = rData.GetDocument();
2904 ScRangeList rRangeList;
2905
2906 rDoc.GetUnprotectedCells(rRangeList, aTab);
2907 rMark.MarkFromRangeList(rRangeList, true);
2908 pTabViewShell->SetMarkData(rMark);
2909 }
2910 break;
2911
2912 case SID_SELECT_VISIBLE_ROWS:
2913 {
2914 ScViewData& rData = GetViewData();
2915 ScMarkData& rMark = rData.GetMarkData();
2916 ScDocument& rDoc = rData.GetDocument();
2917
2918 rMark.MarkToMulti();
2919
2920 const ScRange& aMultiArea = rMark.GetMultiMarkArea();
2921 SCCOL nStartCol = aMultiArea.aStart.Col();
2922 SCROW nStartRow = aMultiArea.aStart.Row();
2923 SCCOL nEndCol = aMultiArea.aEnd.Col();
2924 SCROW nEndRow = aMultiArea.aEnd.Row();
2925
2926 bool bChanged = false;
2927 for (const SCTAB& nTab : rMark)
2928 {
2929 for (SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow)
2930 {
2931 SCROW nLastRow = nRow;
2932 if (rDoc.RowHidden(nRow, nTab, nullptr, &nLastRow))
2933 {
2934 rMark.SetMultiMarkArea(
2935 ScRange(nStartCol, nRow, nTab, nEndCol, nLastRow, nTab), false);
2936 bChanged = true;
2937 nRow = nLastRow;
2938 }
2939 }
2940 }
2941
2942 if (bChanged && !rMark.HasAnyMultiMarks())
2943 rMark.ResetMark();
2944
2945 rMark.MarkToSimple();
2946
2947 pTabViewShell->SelectionChanged();
2948 }
2949 break;
2950
2951 case SID_SELECT_VISIBLE_COLUMNS:
2952 {
2953 ScViewData& rData = GetViewData();
2954 ScMarkData& rMark = rData.GetMarkData();
2955 ScDocument& rDoc = rData.GetDocument();
2956
2957 rMark.MarkToMulti();
2958
2959 const ScRange& aMultiArea = rMark.GetMultiMarkArea();
2960 SCCOL nStartCol = aMultiArea.aStart.Col();
2961 SCROW nStartRow = aMultiArea.aStart.Row();
2962 SCCOL nEndCol = aMultiArea.aEnd.Col();
2963 SCROW nEndRow = aMultiArea.aEnd.Row();
2964
2965 bool bChanged = false;
2966 for (const SCTAB& nTab : rMark)
2967 {
2968 for (SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol)
2969 {
2970 SCCOL nLastCol = nCol;
2971 if (rDoc.ColHidden(nCol, nTab, nullptr, &nLastCol))
2972 {
2973 rMark.SetMultiMarkArea(
2974 ScRange(nCol, nStartRow, nTab, nLastCol, nEndRow, nTab), false);
2975 bChanged = true;
2976 nCol = nLastCol;
2977 }
2978 }
2979 }
2980
2981 if (bChanged && !rMark.HasAnyMultiMarks())
2982 rMark.ResetMark();
2983
2984 rMark.MarkToSimple();
2985
2986 pTabViewShell->SelectionChanged();
2987 }
2988 break;
2989
2990 case SID_CURRENT_FORMULA_RANGE:
2991 {
2992 const SfxInt32Item* param1 = rReq.GetArg<SfxInt32Item>(FN_PARAM_1);
2993 SCCOL colStart = param1 ? param1->GetValue() : 0;
2994
2995 const SfxInt32Item* param2 = rReq.GetArg<SfxInt32Item>(FN_PARAM_2);
2996 SCROW rowStart = param2 ? param2->GetValue() : 0;
2997
2998 const SfxInt32Item* param3 = rReq.GetArg<SfxInt32Item>(FN_PARAM_3);
2999 SCCOL colEnd = param3 ? param3->GetValue() : 0;
3000
3001 const SfxInt32Item* param4 = rReq.GetArg<SfxInt32Item>(FN_PARAM_4);
3002 SCROW rowEnd = param4 ? param4->GetValue() : 0;
3003
3004 const SfxInt32Item* param5 = rReq.GetArg<SfxInt32Item>(FN_PARAM_5);
3005 SCROW table = param5 ? param5->GetValue() : 0;
3006
3007 ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl();
3008
3009 if (param3 && param4 && pInputHdl)
3010 {
3011 ScViewData& rData = pTabViewShell->GetViewData();
3012 ScTabView* pTabView = rData.GetView();
3013
3014 if (param1 && param2)
3015 rData.SetRefStart(colStart, rowStart, table);
3016
3017 pTabView->UpdateRef( colEnd, rowEnd, table ); // setup the end & refresh formula
3018
3019 ScRange aRef(
3020 colStart, rowStart, rData.GetRefStartZ(),
3021 colEnd, rowEnd, rData.GetRefEndZ() );
3022 SC_MOD()->SetReference( aRef, rData.GetDocument(), &rData.GetMarkData() );
3023
3024 pInputHdl->UpdateLokReferenceMarks();
3025 }
3026 }
3027 break;
3028
3029 default:
3030 OSL_FAIL("incorrect slot in ExecuteEdit");
3031 break;
3032 }
3033}
3034
3036{
3038 if ( nType != TransliterationFlags::NONE )
3039 {
3041 rReq.Done();
3042 }
3043}
3044
3046{
3047 if( rReq.GetSlot() == SID_TRANSLITERATE_ROTATE_CASE )
3049}
3050
3052 const OUString& _rFile, const OUString& _rFilter, const OUString& _rOptions,
3053 const OUString& _rSource, sal_Int32 _nRefreshDelaySeconds, SfxRequest& _rRequest )
3054{
3055 if ( !_rFile.isEmpty() && !_rSource.isEmpty() ) // filter may be empty
3056 {
3057 ScRange aLinkRange;
3058 bool bMove = false;
3059
3060 ScViewData& rData = GetViewData();
3061 ScMarkData& rMark = rData.GetMarkData();
3062 rMark.MarkToSimple();
3063 if ( rMark.IsMarked() )
3064 {
3065 aLinkRange = rMark.GetMarkArea();
3066 bMove = true; // insert/delete cells to fit range
3067 }
3068 else
3069 aLinkRange = ScRange( rData.GetCurX(), rData.GetCurY(), rData.GetTabNo() );
3070
3071 rData.GetDocFunc().InsertAreaLink( _rFile, _rFilter, _rOptions, _rSource,
3072 aLinkRange, _nRefreshDelaySeconds, bMove, false );
3073 _rRequest.Done();
3074 }
3075 else
3076 _rRequest.Ignore();
3077}
3078
3079namespace {
3080
3081bool isDPSourceValid(const ScDPObject& rDPObj)
3082{
3083 if (rDPObj.IsImportData())
3084 {
3085 // If the data type is database, check if the database is still valid.
3086 const ScImportSourceDesc* pDesc = rDPObj.GetImportSourceDesc();
3087 if (!pDesc)
3088 return false;
3089
3090 const ScDPSaveData* pSaveData = rDPObj.GetSaveData();
3091 const ScDPDimensionSaveData* pDimData = nullptr;
3092 if (pSaveData)
3093 pDimData = pSaveData->GetExistingDimensionData();
3094
3095 const ScDPCache* pCache = pDesc->CreateCache(pDimData);
3096 if (!pCache)
3097 // cache creation failed, probably due to invalid connection.
3098 return false;
3099 }
3100 return true;
3101}
3102
3103void RunPivotLayoutDialog(ScModule* pScMod,
3104 ScTabViewShell* pTabViewShell,
3105 std::unique_ptr<ScDPObject>& pNewDPObject)
3106{
3107 bool bHadNewDPObject = pNewDPObject != nullptr;
3108 pTabViewShell->SetDialogDPObject( std::move(pNewDPObject) );
3109 if ( bHadNewDPObject )
3110 {
3111 // start layout dialog
3112
3113 sal_uInt16 nId = ScPivotLayoutWrapper::GetChildWindowId();
3114 SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
3115 SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
3116 pScMod->SetRefDialog( nId, pWnd == nullptr );
3117 }
3118}
3119
3120void SetupRangeForPivotTableDialog(const ScRange& rRange,
3121 ScAddress& rDestPos,
3122 ScDocument* pDoc,
3123 TranslateId pSrcErrorId,
3124 std::unique_ptr<ScDPObject>& pNewDPObject)
3125{
3126 ScSheetSourceDesc aShtDesc(pDoc);
3127 aShtDesc.SetSourceRange(rRange);
3128 pSrcErrorId = aShtDesc.CheckSourceRange();
3129 if (!pSrcErrorId)
3130 {
3131 pNewDPObject.reset(new ScDPObject(pDoc));
3132 pNewDPObject->SetSheetDesc( aShtDesc );
3133 }
3134
3135 // output below source data
3136 if ( rRange.aEnd.Row()+2 <= pDoc->MaxRow() - 4 )
3137 rDestPos = ScAddress( rRange.aStart.Col(),
3138 rRange.aEnd.Row()+2,
3139 rRange.aStart.Tab() );
3140}
3141
3142void ErrorOrRunPivotLayoutDialog(TranslateId pSrcErrorId,
3143 const ScAddress& rDestPos,
3144 ScModule* pScMod,
3145 ScTabViewShell* pTabViewShell,
3146 std::unique_ptr<ScDPObject>& pNewDPObject)
3147{
3148 if (pSrcErrorId)
3149 {
3150 // Error occurred during data creation. Launch an error and bail out.
3151 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pTabViewShell->GetFrameWeld(),
3152 VclMessageType::Info, VclButtonsType::Ok,
3153 ScResId(pSrcErrorId)));
3154 xInfoBox->run();
3155 return;
3156 }
3157
3158 if ( pNewDPObject )
3159 pNewDPObject->SetOutRange( rDestPos );
3160
3161 RunPivotLayoutDialog(pScMod, pTabViewShell, pNewDPObject);
3162}
3163
3164}
3165
3167{
3168 ScModule* pScMod = SC_MOD();
3169 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
3170 ScViewData& rData = GetViewData();
3171 ScDocument& rDoc = rData.GetDocument();
3172
3173 // ScPivot is no longer used...
3174 ScDPObject* pDPObj = rDoc.GetDPAtCursor(
3175 rData.GetCurX(), rData.GetCurY(),
3176 rData.GetTabNo() );
3177 if ( pDPObj ) // on an existing table?
3178 {
3179 std::unique_ptr<ScDPObject> pNewDPObject;
3180
3181 if (isDPSourceValid(*pDPObj))
3182 pNewDPObject.reset(new ScDPObject(*pDPObj));
3183
3184 RunPivotLayoutDialog(pScMod, pTabViewShell, pNewDPObject);
3185 }
3186 else // create new table
3187 {
3188 // select database range or data
3189 pTabViewShell->GetDBData( true, SC_DB_OLD );
3190 ScMarkData& rMark = GetViewData().GetMarkData();
3191 if ( !rMark.IsMarked() && !rMark.IsMultiMarked() )
3192 pTabViewShell->MarkDataArea( false );
3193
3194 // output to cursor position for non-sheet data
3195 ScAddress aDestPos( rData.GetCurX(), rData.GetCurY(),
3196 rData.GetTabNo() );
3197
3198 // first select type of source data
3199
3200 bool bEnableExt = ScDPObject::HasRegisteredSources();
3201
3203
3206 pTabViewShell->GetFrameWeld(), bEnableExt));
3207
3208 // Populate named ranges (if any).
3209 ScRangeName* pRangeName = rDoc.GetRangeName();
3210 if (pRangeName)
3211 {
3212 ScRangeName::const_iterator itr = pRangeName->begin(), itrEnd = pRangeName->end();
3213 for (; itr != itrEnd; ++itr)
3214 pTypeDlg->AppendNamedRange(itr->second->GetName());
3215 }
3216
3217 pTypeDlg->StartExecuteAsync([this, pTypeDlg, pTabViewShell,
3218 pScMod, pFact, &rDoc, &rMark, aDestPos](int nResult) mutable {
3219
3220 if (nResult == RET_OK )
3221 {
3222 if ( pTypeDlg->IsExternal() )
3223 {
3224 std::vector<OUString> aSources = ScDPObject::GetRegisteredSources();
3225 VclPtr<AbstractScDataPilotServiceDlg> pServDlg(
3226 pFact->CreateScDataPilotServiceDlg(
3227 pTabViewShell->GetFrameWeld(), aSources));
3228
3229 pServDlg->StartExecuteAsync([pServDlg, pScMod, pTabViewShell,
3230 aDestPos, &rDoc](int nResult2) mutable {
3231 if ( nResult2 == RET_OK )
3232 {
3233 ScDPServiceDesc aServDesc(
3234 pServDlg->GetServiceName(),
3235 pServDlg->GetParSource(),
3236 pServDlg->GetParName(),
3237 pServDlg->GetParUser(),
3238 pServDlg->GetParPass() );
3239 std::unique_ptr<ScDPObject> pNewDPObject(new ScDPObject(&rDoc));
3240 pNewDPObject->SetServiceData( aServDesc );
3241 pNewDPObject->SetOutRange(aDestPos);
3242
3243 RunPivotLayoutDialog(pScMod, pTabViewShell, pNewDPObject);
3244 }
3245
3246 pServDlg->disposeOnce();
3247 });
3248 }
3249 else if ( pTypeDlg->IsDatabase() )
3250 {
3251 assert(pFact && "ScAbstractFactory create fail!");
3253 pFact->CreateScDataPilotDatabaseDlg(pTabViewShell->GetFrameWeld()));
3254 assert(pDataDlg && "Dialog create fail!");
3255
3256 pDataDlg->StartExecuteAsync([pDataDlg, pScMod, pTabViewShell,
3257 aDestPos, &rDoc](int nResult2) mutable {
3258 if ( nResult2 == RET_OK )
3259 {
3260 ScImportSourceDesc aImpDesc(&rDoc);
3261 pDataDlg->GetValues( aImpDesc );
3262 std::unique_ptr<ScDPObject> pNewDPObject(new ScDPObject(&rDoc));
3263 pNewDPObject->SetImportDesc( aImpDesc );
3264 pNewDPObject->SetOutRange(aDestPos);
3265
3266 RunPivotLayoutDialog(pScMod, pTabViewShell, pNewDPObject);
3267 }
3268
3269 pDataDlg->disposeOnce();
3270 });
3271 }
3272 else
3273 {
3274 TranslateId pSrcErrorId;
3275
3276 if (pTypeDlg->IsNamedRange())
3277 {
3278 std::unique_ptr<ScDPObject> pNewDPObject;
3279 OUString aName = pTypeDlg->GetSelectedNamedRange();
3280 ScSheetSourceDesc aShtDesc(&rDoc);
3281 aShtDesc.SetRangeName(aName);
3282 pSrcErrorId = aShtDesc.CheckSourceRange();
3283 if (!pSrcErrorId)
3284 {
3285 pNewDPObject.reset(new ScDPObject(&rDoc));
3286 pNewDPObject->SetSheetDesc(aShtDesc);
3287 }
3288
3289 ErrorOrRunPivotLayoutDialog(pSrcErrorId, aDestPos, pScMod, pTabViewShell, pNewDPObject);
3290 }
3291 else // selection
3292 {
3294 ScRange aRange;
3296 if ( (eType & SC_MARK_SIMPLE) == SC_MARK_SIMPLE )
3297 {
3298 ScDocument* pDoc = &rDoc;
3299
3300 // Shrink the range to the data area.
3301 SCCOL nStartCol = aRange.aStart.Col(), nEndCol = aRange.aEnd.Col();
3302 SCROW nStartRow = aRange.aStart.Row(), nEndRow = aRange.aEnd.Row();
3303 if (rDoc.ShrinkToDataArea(aRange.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow))
3304 {
3305 aRange.aStart.SetCol(nStartCol);
3306 aRange.aStart.SetRow(nStartRow);
3307 aRange.aEnd.SetCol(nEndCol);
3308 aRange.aEnd.SetRow(nEndRow);
3309 rMark.SetMarkArea(aRange);
3310 pTabViewShell->MarkRange(aRange);
3311 }
3312
3313 if ( rDoc.HasSubTotalCells( aRange ) )
3314 {
3315 // confirm selection if it contains SubTotal cells
3316 std::shared_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pTabViewShell->GetFrameWeld(),
3317 VclMessageType::Question, VclButtonsType::YesNo,
3318 ScResId(STR_DATAPILOT_SUBTOTAL)));
3319 xQueryBox->set_default_response(RET_YES);
3320 xQueryBox->runAsync(xQueryBox, [aRange, pDoc, pTypeDlg, aDestPos,
3321 pScMod, pTabViewShell, pSrcErrorId] (int nResult2) mutable {
3322 if (nResult2 == RET_NO)
3323 return;
3324
3325 std::unique_ptr<ScDPObject> pNewDPObject;
3326 SetupRangeForPivotTableDialog(aRange, aDestPos, pDoc, pSrcErrorId, pNewDPObject);
3327 ErrorOrRunPivotLayoutDialog(pSrcErrorId, aDestPos, pScMod, pTabViewShell, pNewDPObject);
3328 });
3329
3330 pTypeDlg->disposeOnce();
3331 return;
3332 }
3333
3334 std::unique_ptr<ScDPObject> pNewDPObject;
3335 SetupRangeForPivotTableDialog(aRange, aDestPos, pDoc, pSrcErrorId, pNewDPObject);
3336 ErrorOrRunPivotLayoutDialog(pSrcErrorId, aDestPos, pScMod, pTabViewShell, pNewDPObject);
3337 }
3338 }
3339 }
3340 }
3341
3342 pTypeDlg->disposeOnce();
3343 });
3344 }
3345}
3346
3348{
3349 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
3350 if (!pTabViewShell)
3351 return;
3352
3353 ScModule* pScMod = SC_MOD();
3354
3355 sal_uInt16 nId = ScXMLSourceDlgWrapper::GetChildWindowId();
3356 SfxViewFrame& rViewFrame = pTabViewShell->GetViewFrame();
3357 SfxChildWindow* pWnd = rViewFrame.GetChildWindow(nId);
3358 pScMod->SetRefDialog(nId, pWnd == nullptr);
3359}
3360
3362{
3363 ScTabViewShell* pTabViewShell = GetViewData().GetViewShell();
3364 const SfxItemSet* pArgs = rReq.GetArgs();
3365 if ( pArgs )
3366 {
3367 pTabViewShell->DoSubTotals( pArgs->Get( SCITEM_SUBTDATA ).
3368 GetSubTotalData() );
3369 rReq.Done();
3370 return;
3371 }
3372
3374 ScSubTotalParam aSubTotalParam;
3376
3377 bool bAnonymous;
3378
3379 // Only get existing named database range.
3380 ScDBData* pDBData = pTabViewShell->GetDBData(true, SC_DB_OLD);
3381 if (pDBData)
3382 bAnonymous = false;
3383 else
3384 {
3385 // No existing DB data at this position. Create an
3386 // anonymous DB.
3387 bAnonymous = true;
3388 pDBData = pTabViewShell->GetAnonymousDBData();
3389 ScRange aDataRange;
3390 pDBData->GetArea(aDataRange);
3391 pTabViewShell->MarkRange(aDataRange, false);
3392 }
3393
3394 pDBData->GetSubTotalParam( aSubTotalParam );
3395 aSubTotalParam.bRemoveOnly = false;
3396 if (bAnonymous)
3397 {
3398 // Preset sort formatting along with values and also create formula
3399 // cells with "needs formatting". Subtotals on data of different types
3400 // doesn't make much sense anyway.
3401 aSubTotalParam.bIncludePattern = true;
3402 }
3403
3404 aArgSet.Put( ScSubTotalItem( SCITEM_SUBTDATA, &GetViewData(), &aSubTotalParam ) );
3406 pDlg.disposeAndReset(pFact->CreateScSubTotalDlg(pTabViewShell->GetFrameWeld(), aArgSet));
3407 pDlg->SetCurPageId("1stgroup");
3408
3409 short bResult = pDlg->Execute();
3410
3411 if ( (bResult == RET_OK) || (bResult == SCRET_REMOVE) )
3412 {
3413 const SfxItemSet* pOutSet = nullptr;
3414
3415 if ( bResult == RET_OK )
3416 {
3417 pOutSet = pDlg->GetOutputItemSet();
3418 aSubTotalParam =
3419 pOutSet->Get( SCITEM_SUBTDATA ).GetSubTotalData();
3420 }
3421 else // if (bResult == SCRET_REMOVE)
3422 {
3423 pOutSet = &aArgSet;
3424 aSubTotalParam.bRemoveOnly = true;
3425 aSubTotalParam.bReplace = true;
3427 &GetViewData(),
3428 &aSubTotalParam ) );
3429 }
3430
3431 pTabViewShell->DoSubTotals( aSubTotalParam );
3432 rReq.Done( *pOutSet );
3433 }
3434 else
3436}
3437
3439{
3440 ScAddress aCurPos = GetViewData().GetCurPos();
3441
3442 OUString aInit;
3443
3444 if (aCurPos.Row() > 0)
3445 {
3446 // Get the initial text value from the above cell.
3447
3449 ScAddress aPrevPos = aCurPos;
3450 aPrevPos.IncRow(-1);
3451 ScRefCellValue aCell(rDoc, aPrevPos);
3452
3453 if (aCell.getType() == CELLTYPE_FORMULA)
3454 {
3455 aInit = "=";
3456 const ScTokenArray* pCode = aCell.getFormula()->GetCode();
3457 sc::TokenStringContext aCxt(rDoc, rDoc.GetGrammar());
3458 aInit += pCode->CreateString(aCxt, aCurPos);
3459 }
3460 else
3461 aInit = aCell.getString(&rDoc);
3462 }
3463
3464 SC_MOD()->SetInputMode(SC_INPUT_TABLE, &aInit);
3465}
3466
3468 m_pRequest( nullptr ) {}
3469
3471{
3472}
3473/* 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:111
#define GetWhich(nSlot)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
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:470
bool HasClipboardFormat(SotClipboardFormatId nFormatId)
Definition: cellsh.cxx:538
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:3045
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:3051
void ExecuteEdit(SfxRequest &rReq)
Definition: cellsh1.cxx:228
void ExecuteFillSingleEdit()
Definition: cellsh1.cxx:3438
void ExecuteTrans(SfxRequest &rReq)
Definition: cellsh1.cxx:3035
void ExecuteDataPilotDialog()
Definition: cellsh1.cxx:3166
void ExecuteSubtotals(SfxRequest &rReq)
Definition: cellsh1.cxx:3361
void ExecuteXMLSourceDialog()
Definition: cellsh1.cxx:3347
sal_Int32 GetIndex() const
void SetDialogType(condformat::dialog::ScCondFormatDialogType eType)
ScConditionalFormat * GetFormat(sal_uInt32 nKey)
Definition: conditio.cxx:2098
const ScRangeList & GetRange() const
Definition: conditio.hxx:559
sal_uInt32 GetKey() const
Definition: conditio.hxx:591
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:298
void GetSubTotalParam(ScSubTotalParam &rSubTotalParam) const
Definition: dbdata.cxx:461
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:1907
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:1944
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:2030
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:2770
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:353
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:219
void CancelAutoDBRange()
Definition: docsh5.cxx:369
virtual SfxUndoManager * GetUndoManager() override
Definition: docsh.cxx:2968
ScDocFunc & GetDocFunc()
Definition: docsh.hxx:221
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:898
SC_DLLPUBLIC std::shared_ptr< sc::Sparkline > GetSparkline(ScAddress const &rPosition)
Returns sparkline at the address if it exists.
Definition: document.cxx:6495
SC_DLLPUBLIC sal_uInt32 GetNumberFormat(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:3640
CommentCaptionState GetAllNoteCaptionsState(const ScRangeList &rRanges)
Definition: document.cxx:6742
SC_DLLPUBLIC bool IsTabProtected(SCTAB nTab) const
Definition: documen3.cxx:1905
void GetUnprotectedCells(ScRangeList &rRange, SCTAB nTab) const
Definition: document.cxx:6864
bool ShrinkToDataArea(SCTAB nTab, SCCOL &rStartCol, SCROW &rStartRow, SCCOL &rEndCol, SCROW &rEndRow) const
Shrink a range to only include data area.
Definition: document.cxx:1018
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:892
bool IsCutMode()
Definition: document.cxx:2030
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
Definition: documen3.cxx:492
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:893
SC_DLLPUBLIC double GetValue(const ScAddress &rPos) const
Definition: document.cxx:3626
SC_DLLPUBLIC ScPostIt * GetNote(const ScAddress &rPos)
Definition: document.cxx:6587
void SetConsolidateDlgData(std::unique_ptr< ScConsolidateParam > pData)
Definition: documen2.cxx:1168
SC_DLLPUBLIC void GetAllNoteEntries(std::vector< sc::NoteEntry > &rNotes) const
Definition: document.cxx:6837
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4416
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
Definition: document.hxx:1010
bool IsBlockEditable(SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, bool *pOnlyNotBecauseOfMatrix=nullptr, bool bNoMatrixAtAll=false) const
Definition: document.cxx:5317
SC_DLLPUBLIC OUString GetInputString(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bForceSystemLocale=false) const
Definition: document.cxx:3549
SC_DLLPUBLIC ScDPObject * GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: documen3.cxx:377
void GetClipArea(SCCOL &nClipX, SCROW &nClipY, bool bIncludeFiltered)
Definition: document.cxx:3147
SC_DLLPUBLIC ScConditionalFormatList * GetCondFormList(SCTAB nTab) const
Definition: documen4.cxx:860
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:467
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:171
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
Definition: document.cxx:4430
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2494
SC_DLLPUBLIC CellType GetCellType(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:3736
bool IsBlockEmpty(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab) const
Definition: document.cxx:5288
void GetNotesInRange(const ScRangeList &rRange, std::vector< sc::NoteEntry > &rNotes) const
Definition: document.cxx:6852
bool HasSubTotalCells(const ScRange &rRange)
Definition: documen3.cxx:785
bool IsClipboardSource() const
Definition: document.cxx:2577
SC_DLLPUBLIC const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4719
void GetClipStart(SCCOL &nClipX, SCROW &nClipY)
Definition: document.cxx:3199
static ScDrawTransferObj * GetOwnClipboard(const css::uno::Reference< css::datatransfer::XTransferable2 > &)
Definition: drwtrans.cxx:235
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:560
static sal_Int32 getIconSetElements(ScIconSetType eType)
void SetIconSetData(ScIconSetFormatData *pData)
void DataChanged(bool bFromTopNotify=false, bool bSetModified=true)
Definition: inputhdl.cxx:2722
void UpdateLokReferenceMarks()
Definition: inputhdl.cxx:535
EditView * GetActiveView()
Definition: inputhdl.cxx:2355
void InsertFunction(const OUString &rFuncName, bool bAddPar=true)
Definition: inputhdl.cxx:3663
void InitRangeFinder(const OUString &rFormula)
Definition: inputhdl.cxx:358
bool DataChanging(sal_Unicode cTyped=0, bool bFromCommand=false)
Definition: inputhdl.cxx:2710
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:1355
SC_DLLPUBLIC void SetRefDialog(sal_uInt16 nId, bool bVis, SfxViewFrame *pViewFrm=nullptr)
Reference dialogs.
Definition: scmod.cxx:1519
bool InputKeyEvent(const KeyEvent &rKEvt, bool bStartEdit=false)
Definition: scmod.cxx:1405
void SetInputMode(ScInputMode eMode, const OUString *pInitText=nullptr)
Definition: scmod.cxx:1386
void ActivateInputWindow(const OUString *pStr=nullptr, bool bMatrix=false)
Definition: scmod.cxx:1482
bool IsEditMode()
Definition: scmod.cxx:1393
SC_DLLPUBLIC void InputEnterHandler(ScEnterMode nBlockMode=ScEnterMode::NORMAL, bool bBeforeSavingInLOK=false)
Definition: scmod.cxx:1411
static void fillFontOnly(vcl::Font &rFont, const SfxItemSet &rItemSet, const OutputDevice *pOutDev=nullptr, const Fraction *pScale=nullptr, const SfxItemSet *pCondSet=nullptr, SvtScriptType nScript=SvtScriptType::NONE)
Static helper function to fill a font object from the passed item set.
Definition: patattr.cxx:266
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
Definition: patattr.hxx:73
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:519
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
Definition: tabvwsha.cxx:690
void SetDialogDPObject(std::unique_ptr< ScDPObject > pObj)
Definition: tabvwsh4.cxx:1862
OUString DoAutoSum(bool &rRangeFinder, bool &rSubTotal, const OpCode eCode)
Definition: tabvwshc.cxx:691
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:1677
void ErrorMessage(TranslateId pGlobStrId)
Definition: tabview2.cxx:1553
void SelectionChanged(bool bFromPaste=false)
Definition: tabview3.cxx:532
void MarkRange(const ScRange &rRange, bool bSetCursor=true, bool bContinue=false)
Definition: tabview3.cxx:1708
ScViewData & GetViewData()
Definition: tabview.hxx:344
SC_DLLPUBLIC void SetCursor(SCCOL nPosX, SCROW nPosY, bool bNew=false)
Definition: tabview3.cxx:363
void UpdateCopySourceOverlay()
Definition: tabview2.cxx:1116
SC_DLLPUBLIC void CellContentChanged()
Definition: tabview3.cxx:513
void HideListBox()
Definition: tabview3.cxx:2996
void SetMarkData(const ScMarkData &rNew)
Definition: tabview3.cxx:1758
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:1819
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:5238
ScDocument * GetDocument() const
Definition: transobj.hxx:82
static SC_DLLPUBLIC ScTransferObj * GetOwnClipboard(const css::uno::Reference< css::datatransfer::XTransferable2 > &)
Definition: transobj.cxx:199
void GetMultiArea(ScRangeListRef &rRange) const
Definition: viewdata.cxx:1205
SfxDispatcher & GetDispatcher()
Definition: viewdata.cxx:3140
bool SimpleColMarked()
Definition: viewdata.cxx:1230
ScDocFunc & GetDocFunc() const
Definition: viewdata.cxx:3129
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3146
bool SimpleRowMarked()
Definition: viewdata.cxx:1245
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:3162
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:1182
ScDBFunc * GetView() const
Definition: viewdata.cxx:864
void GetFillData(SCCOL &rStartCol, SCROW &rStartRow, SCCOL &rEndCol, SCROW &rEndRow)
Definition: viewdata.cxx:1366
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:1260
SCTAB GetRefEndZ() const
Definition: viewdata.hxx:537
ScAddress GetCurPos() const
Definition: viewdata.cxx:4119
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:4124
void TabOp(const ScTabOpParam &rParam, bool bRecord=true)
Definition: viewfun2.cxx:2317
bool SelectionEditable(bool *pOnlyNotBecauseOfMatrix=nullptr)
Definition: viewfunc.cxx:274
void DeleteCells(DelCellCmd eCmd)
Definition: viewfunc.cxx:1781
void FillTab(InsertDeleteFlags nFlags, ScPasteFunc nFunction, bool bSkipEmpty, bool bAsLink)
Definition: viewfun2.cxx:1678
void ReplaceNote(const ScAddress &rPos, const OUString &rNoteText, const OUString *pAuthor, const OUString *pDate)
Definition: viewfunc.cxx:2737
SC_DLLPUBLIC void FillSimple(FillDir eDir)
Definition: viewfun2.cxx:1395
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:987
void DetectiveAddError()
Definition: viewfun6.cxx:101
void FillSeries(FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd, double fStart, double fStep, double fMax)
Definition: viewfun2.cxx:1444
void InsertNameList()
Definition: viewfunc.cxx:3111
void DetectiveDelSucc()
Definition: viewfun6.cxx:94
void TransliterateText(TransliterationFlags nType)
Definition: viewfun2.cxx:1882
bool InsertCells(InsCellCmd eCmd, bool bRecord=true, bool bPartOfPaste=false)
Definition: viewfunc.cxx:1727
SC_DLLPUBLIC void CutToClip()
Definition: viewfun3.cxx:90
void DetectiveMarkInvalid()
Definition: viewfun6.cxx:115
SC_DLLPUBLIC void InsertPageBreak(bool bColumn, bool bRecord=true, const ScAddress *pPos=nullptr, bool bSetModified=true)
Definition: viewfun2.cxx:970
SvtScriptType GetSelectionScriptType()
Definition: viewfunc.cxx:883
void ShowNote(bool bShow)
Definition: viewfun6.cxx:498
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:1467
SC_DLLPUBLIC const ScPatternAttr * GetSelectionPattern()
Definition: viewfunc.cxx:911
void DeleteContents(InsertDeleteFlags nFlags)
Definition: viewfunc.cxx:2065
void DetectiveMarkSucc()
Definition: viewfun6.cxx:235
void EditNote()
Definition: viewfun6.cxx:508
void DetectiveDelPred()
Definition: viewfun6.cxx:80
void Solve(const ScSolveParam &rParam)
Definition: viewfun2.cxx:2247
SC_DLLPUBLIC void PasteFromSystem()
Definition: viewfun3.cxx:484
void CreateNames(CreateNameFlags nFlags)
Definition: viewfunc.cxx:3038
void InsertCurrentTime(SvNumFormatType nCellFmt, const OUString &rUndoStr)
Insert date or time into current cell.
Definition: viewfun6.cxx:275
void DoHangulHanjaConversion()
Definition: viewfun4.cxx:433
void DoThesaurus()
Definition: viewfun4.cxx:311
void InsertSpecialChar(const OUString &rStr, const vcl::Font &rFont)
Definition: viewfun2.cxx:3287
void SetNoteText(const ScAddress &rPos, const OUString &rNoteText)
Definition: viewfunc.cxx:2732
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:2984
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:3049
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:871
void DetectiveAddPred()
Definition: viewfun6.cxx:73
void DetectiveMarkPred()
Definition: viewfun6.cxx:171
void ChangeIndent(bool bIncrement)
Definition: viewfunc.cxx:2954
void PasteDraw()
Definition: viewfun3.cxx:467
void ConvertFormulaToValue()
Definition: viewfun2.cxx:1869
void UseScenario(const OUString &rName)
Definition: viewfun2.cxx:2369
void DetectiveAddSucc()
Definition: viewfun6.cxx:87
void DetectiveRefresh()
Definition: viewfun6.cxx:122
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:263
@ MIXED
Definition: document.hxx:266
@ ALLHIDDEN
Definition: document.hxx:265
#define EE_TEXTPOS_ALL
FilterGroup & rTarget
DocumentType eType
SotClipboardFormatId
CellType
Definition: global.hxx:272
@ CELLTYPE_STRING
Definition: global.hxx:275
@ CELLTYPE_FORMULA
Definition: global.hxx:276
DelCellCmd
Definition: global.hxx:281
ScPasteFunc
Definition: global.hxx:181
InsCellCmd
Definition: global.hxx:290
@ INS_INSROWS_AFTER
Definition: global.hxx:296
@ INS_NONE
Definition: global.hxx:295
@ INS_INSCOLS_AFTER
Definition: global.hxx:297
@ INS_CELLSDOWN
Definition: global.hxx:291
@ INS_INSCOLS_BEFORE
Definition: global.hxx:294
@ INS_CELLSRIGHT
Definition: global.hxx:292
@ INS_INSROWS_BEFORE
Definition: global.hxx:293
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:334
@ FILL_MONTH
Definition: global.hxx:337
@ FILL_YEAR
Definition: global.hxx:339
@ FILL_WEEKDAY
Definition: global.hxx:336
@ FILL_DAY
Definition: global.hxx:335
@ SC_INPUT_TABLE
Definition: global.hxx:363
#define MAXDOUBLE
Definition: global.hxx:77
@ SC_DB_OLD
don't create
Definition: global.hxx:386
FillCmd
Definition: global.hxx:317
@ FILL_GROWTH
Definition: global.hxx:320
@ FILL_LINEAR
Definition: global.hxx:319
@ FILL_AUTO
Definition: global.hxx:322
@ FILL_SIMPLE
Definition: global.hxx:318
@ FILL_DATE
Definition: global.hxx:321
FillDir
Definition: global.hxx:309
@ FILL_TO_TOP
Definition: global.hxx:312
@ FILL_TO_RIGHT
Definition: global.hxx:311
@ FILL_TO_LEFT
Definition: global.hxx:313
@ FILL_TO_BOTTOM
Definition: global.hxx:310
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
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:247
#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