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