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