1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <config_features.h>
22 #include <com/sun/star/i18n/TextConversionOption.hpp>
23 #include <com/sun/star/sheet/DataPilotFieldFilter.hpp>
25 #include <scitems.hxx>
26 #include <sfx2/viewfrm.hxx>
28 #include <basic/sberrors.hxx>
29 #include <comphelper/lok.hxx>
30 #include <comphelper/propertysequence.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>
37 #include <vcl/commandinfoprovider.hxx>
38 #include <vcl/unohelp2.hxx>
39 #include <vcl/svapp.hxx>
40 #include <vcl/weld.hxx>
41 #include <svx/svxdlg.hxx>
42 #include <sot/formats.hxx>
43 #include <svx/postattr.hxx>
44 #include <editeng/fontitem.hxx>
45 #include <svx/clipfmtitem.hxx>
46 #include <svx/hlnkitem.hxx>
47 #include <basic/sbxcore.hxx>
48 #include <editeng/editview.hxx>
49 #include <editeng/urlfieldhelper.hxx>
50 #include <svtools/cliplistener.hxx>
55 #include <document.hxx>
56 #include <patattr.hxx>
58 #include <tabvwsh.hxx>
59 #include <uiitems.hxx>
60 #include <reffact.hxx>
61 #include <inputhdl.hxx>
62 #include <transobj.hxx>
63 #include <drwtrans.hxx>
64 #include <docfunc.hxx>
65 #include <editable.hxx>
66 #include <dpobject.hxx>
68 #include <spellparam.hxx>
70 #include <dpsdbtab.hxx>
71 #include <dpshttab.hxx>
74 #include <cliputil.hxx>
75 #include <markdata.hxx>
76 #include <colorscale.hxx>
77 #include <condformatdlg.hxx>
79 #include <condformatdlgdata.hxx>
82 #include <globstr.hrc>
83 #include <scresid.hxx>
84 #include <scui_def.hxx>
85 #include <scabstdlg.hxx>
86 #include <tokenstringcontext.hxx>
87 #include <cellvalue.hxx>
88 #include <tokenarray.hxx>
89 #include <formulacell.hxx>
90 #include <gridwin.hxx>
91 #include <searchresults.hxx>
92 #include <Sparkline.hxx>
94 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
95 #include <com/sun/star/lang/XInitialization.hpp>
96 #include <com/sun/star/beans/XPropertySet.hpp>
97 #include <com/sun/star/uno/XComponentContext.hpp>
98 #include <cppuhelper/bootstrap.hxx>
99 #include <o3tl/string_view.hxx>
103 using namespace ::com::sun::star
;
104 using namespace ::com::sun::star::beans
;
105 using namespace ::com::sun::star::uno
;
108 InsertDeleteFlags
FlagsFromString(const OUString
& rFlagsStr
,
109 InsertDeleteFlags nFlagsMask
= InsertDeleteFlags::CONTENTS
| InsertDeleteFlags::ATTRIB
)
111 OUString aFlagsStr
= rFlagsStr
.toAsciiUpperCase();
112 InsertDeleteFlags nFlags
= InsertDeleteFlags::NONE
;
114 for (sal_Int32 i
=0 ; i
< aFlagsStr
.getLength(); ++i
)
116 switch (aFlagsStr
[i
])
118 case 'A': return InsertDeleteFlags::ALL
;
119 case 'S': nFlags
|= InsertDeleteFlags::STRING
& nFlagsMask
; break;
120 case 'V': nFlags
|= InsertDeleteFlags::VALUE
& nFlagsMask
; break;
121 case 'D': nFlags
|= InsertDeleteFlags::DATETIME
& nFlagsMask
; break;
122 case 'F': nFlags
|= InsertDeleteFlags::FORMULA
& nFlagsMask
; break;
123 case 'N': nFlags
|= InsertDeleteFlags::NOTE
& nFlagsMask
; break;
124 case 'T': nFlags
|= InsertDeleteFlags::ATTRIB
& nFlagsMask
; break;
125 case 'O': nFlags
|= InsertDeleteFlags::OBJECTS
& nFlagsMask
; break;
131 OUString
FlagsToString( InsertDeleteFlags nFlags
,
132 InsertDeleteFlags nFlagsMask
= InsertDeleteFlags::CONTENTS
| InsertDeleteFlags::ATTRIB
)
136 if( nFlags
== InsertDeleteFlags::ALL
)
142 nFlags
&= nFlagsMask
;
144 if( nFlags
& InsertDeleteFlags::STRING
) aFlagsStr
+= "S";
145 if( nFlags
& InsertDeleteFlags::VALUE
) aFlagsStr
+= "V";
146 if( nFlags
& InsertDeleteFlags::DATETIME
) aFlagsStr
+= "D";
147 if( nFlags
& InsertDeleteFlags::FORMULA
) aFlagsStr
+= "F";
148 if( nFlags
& InsertDeleteFlags::NOTE
) aFlagsStr
+= "N";
149 if( nFlags
& InsertDeleteFlags::ATTRIB
) aFlagsStr
+= "T";
150 if( nFlags
& InsertDeleteFlags::OBJECTS
) aFlagsStr
+= "O";
155 void SetTabNoAndCursor( const ScViewData
& rViewData
, std::u16string_view rCellId
)
157 ScTabViewShell
* pTabViewShell
= rViewData
.GetViewShell();
158 assert(pTabViewShell
);
159 const ScDocument
& rDoc
= rViewData
.GetDocShell()->GetDocument();
160 std::vector
<sc::NoteEntry
> aNotes
;
161 rDoc
.GetAllNoteEntries(aNotes
);
163 sal_uInt32 nId
= o3tl::toUInt32(rCellId
);
164 auto lComp
= [nId
](const sc::NoteEntry
& rNote
) { return rNote
.mpNote
->GetId() == nId
; };
166 const auto aFoundNoteIt
= std::find_if(aNotes
.begin(), aNotes
.end(), lComp
);
167 if (aFoundNoteIt
!= aNotes
.end())
169 ScAddress aFoundPos
= aFoundNoteIt
->maPos
;
170 pTabViewShell
->SetTabNo(aFoundPos
.Tab());
171 pTabViewShell
->SetCursor(aFoundPos
.Col(), aFoundPos
.Row());
175 void HandleConditionalFormat(sal_uInt32 nIndex
, bool bCondFormatDlg
, bool bContainsCondFormat
,
176 const sal_uInt16 nSlot
, ScTabViewShell
* pTabViewShell
)
178 condformat::dialog::ScCondFormatDialogType eType
= condformat::dialog::NONE
;
181 case SID_OPENDLG_CONDFRMT
:
182 case SID_OPENDLG_CURRENTCONDFRMT
:
183 eType
= condformat::dialog::CONDITION
;
185 case SID_OPENDLG_COLORSCALE
:
186 eType
= condformat::dialog::COLORSCALE
;
188 case SID_OPENDLG_DATABAR
:
189 eType
= condformat::dialog::DATABAR
;
191 case SID_OPENDLG_ICONSET
:
192 eType
= condformat::dialog::ICONSET
;
194 case SID_OPENDLG_CONDDATE
:
195 eType
= condformat::dialog::DATE
;
202 if (bCondFormatDlg
|| !bContainsCondFormat
)
204 // Put the xml string parameter to initialize the
205 // Conditional Format Dialog.
206 std::shared_ptr
<ScCondFormatDlgData
> pDlgItem(std::make_shared
<ScCondFormatDlgData
>(nullptr, nIndex
, false));
207 pDlgItem
->SetDialogType(eType
);
208 pTabViewShell
->setScCondFormatDlgItem(pDlgItem
);
210 sal_uInt16 nId
= ScCondFormatDlgWrapper::GetChildWindowId();
211 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
212 SfxChildWindow
* pWnd
= rViewFrm
.GetChildWindow(nId
);
214 ScModule::get()->SetRefDialog(nId
, pWnd
== nullptr);
218 void InsertCells(ScTabViewShell
* pTabViewShell
, SfxRequest
&rReq
, InsCellCmd eCmd
, size_t nCount
= 0)
222 pTabViewShell
->InsertCells( eCmd
, true, false, nCount
);
230 case INS_CELLSDOWN
: aParam
= "V"; break;
231 case INS_CELLSRIGHT
: aParam
= ">"; break;
232 case INS_INSROWS_BEFORE
: aParam
= "R"; break;
233 case INS_INSCOLS_BEFORE
: aParam
= "C"; break;
236 // added to avoid warnings
239 rReq
.AppendItem( SfxStringItem( FID_INS_CELL
, aParam
) );
245 void DeleteCells(ScTabViewShell
* pTabViewShell
, SfxRequest
&rReq
, DelCellCmd eCmd
)
247 if (eCmd
!= DelCellCmd::NONE
)
249 pTabViewShell
->DeleteCells( eCmd
);
257 case DelCellCmd::CellsUp
: aParam
= "U"; break;
258 case DelCellCmd::CellsLeft
: aParam
= "L"; break;
259 case DelCellCmd::Rows
: aParam
= "R"; break;
260 case DelCellCmd::Cols
: aParam
= "C"; break;
263 // added to avoid warnings
266 rReq
.AppendItem( SfxStringItem( FID_DELETE_CELL
, aParam
) );
273 void ScCellShell::ExecuteEdit( SfxRequest
& rReq
)
275 ScModule
* pScMod
= ScModule::get();
276 ScTabViewShell
* pTabViewShell
= GetViewData().GetViewShell();
277 SfxBindings
& rBindings
= pTabViewShell
->GetViewFrame().GetBindings();
278 const SfxItemSet
* pReqArgs
= rReq
.GetArgs();
279 sal_uInt16 nSlot
= rReq
.GetSlot();
281 pTabViewShell
->HideListBox(); // Autofilter-DropDown-Listbox
284 if ( GetViewData().HasEditView( GetViewData().GetActivePart() ) )
288 case FID_DEFINE_NAME
:
291 case FID_INSERT_NAME
:
292 case SID_SPELL_DIALOG
:
293 case SID_HANGUL_HANJA_CONVERSION
:
294 case SID_OPENDLG_CONDFRMT
:
295 case SID_OPENDLG_CURRENTCONDFRMT
:
296 case SID_OPENDLG_COLORSCALE
:
297 case SID_OPENDLG_DATABAR
:
298 pScMod
->InputEnterHandler();
299 pTabViewShell
->UpdateInputHandler();
310 // insert / delete cells / rows / columns
313 case FID_INS_ROWS_BEFORE
:
314 pTabViewShell
->InsertCells(INS_INSROWS_BEFORE
);
319 case FID_INS_COLUMNS_BEFORE
:
320 pTabViewShell
->InsertCells(INS_INSCOLS_BEFORE
);
324 case FID_INS_ROWS_AFTER
:
325 pTabViewShell
->InsertCells(INS_INSROWS_AFTER
);
329 case FID_INS_COLUMNS_AFTER
:
330 pTabViewShell
->InsertCells(INS_INSCOLS_AFTER
);
334 case FID_INS_CELLSDOWN
:
335 pTabViewShell
->InsertCells(INS_CELLSDOWN
);
339 case FID_INS_CELLSRIGHT
:
340 pTabViewShell
->InsertCells(INS_CELLSRIGHT
);
345 pTabViewShell
->DeleteCells( DelCellCmd::Rows
);
350 pTabViewShell
->DeleteCells( DelCellCmd::Cols
);
356 InsCellCmd eCmd
=INS_NONE
;
360 const SfxPoolItem
* pItem
;
363 if( pReqArgs
->HasItem( FID_INS_CELL
, &pItem
) )
364 aFlags
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
365 if( !aFlags
.isEmpty() )
369 case 'V': eCmd
= INS_CELLSDOWN
;break;
370 case '>': eCmd
= INS_CELLSRIGHT
;break;
371 case 'R': eCmd
= INS_INSROWS_BEFORE
;break;
372 case 'C': eCmd
= INS_INSCOLS_BEFORE
;break;
378 if ( GetViewData().SimpleColMarked() )
379 eCmd
= INS_INSCOLS_BEFORE
;
380 else if ( GetViewData().SimpleRowMarked() )
381 eCmd
= INS_INSROWS_BEFORE
;
384 ScDocument
& rDoc
= GetViewData().GetDocument();
385 bool bTheFlag
=(rDoc
.GetChangeTrack()!=nullptr);
387 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
389 VclPtr
<AbstractScInsertCellDlg
> pDlg(pFact
->CreateScInsertCellDlg(pTabViewShell
->GetFrameWeld(), bTheFlag
));
390 pDlg
->StartExecuteAsync([pDlg
, pTabViewShell
](sal_Int32 nResult
){
391 if (nResult
== RET_OK
)
393 SfxRequest
aRequest(pTabViewShell
->GetViewFrame(), FID_INS_CELL
);
394 InsCellCmd eTmpCmd
= pDlg
->GetInsCellCmd();
395 size_t nInsCount
= pDlg
->GetCount();
396 InsertCells(pTabViewShell
, aRequest
, eTmpCmd
, nInsCount
);
404 InsertCells(pTabViewShell
, rReq
, eCmd
);
408 case FID_DELETE_CELL
:
410 DelCellCmd eCmd
= DelCellCmd::NONE
;
414 const SfxPoolItem
* pItem
;
417 if( pReqArgs
->HasItem( FID_DELETE_CELL
, &pItem
) )
418 aFlags
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
419 if( !aFlags
.isEmpty() )
423 case 'U': eCmd
= DelCellCmd::CellsUp
;break;
424 case 'L': eCmd
= DelCellCmd::CellsLeft
;break;
425 case 'R': eCmd
= DelCellCmd::Rows
;break;
426 case 'C': eCmd
= DelCellCmd::Cols
;break;
432 if ( GetViewData().SimpleColMarked() )
433 eCmd
= DelCellCmd::Cols
;
434 else if ( GetViewData().SimpleRowMarked() )
435 eCmd
= DelCellCmd::Rows
;
439 ScDocument
& rDoc
= GetViewData().GetDocument();
440 bool bTheFlag
=GetViewData().IsMultiMarked() ||
441 (GetViewData().GetSimpleArea(aRange
) == SC_MARK_SIMPLE_FILTERED
) ||
442 (rDoc
.GetChangeTrack() != nullptr);
444 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
445 VclPtr
<AbstractScDeleteCellDlg
> pDlg(pFact
->CreateScDeleteCellDlg( pTabViewShell
->GetFrameWeld(), bTheFlag
));
447 pDlg
->StartExecuteAsync([pDlg
, pTabViewShell
](sal_Int32 nResult
){
448 if (nResult
== RET_OK
)
450 SfxRequest
aRequest(pTabViewShell
->GetViewFrame(), FID_INS_CELL
);
451 DeleteCells(pTabViewShell
, aRequest
, pDlg
->GetDelCellCmd());
457 DeleteCells(pTabViewShell
, rReq
, eCmd
);
461 // delete contents from cells
463 case SID_DELETE_CONTENTS
:
464 pTabViewShell
->DeleteContents( InsertDeleteFlags::CONTENTS
);
470 InsertDeleteFlags nFlags
= InsertDeleteFlags::NONE
;
472 if ( pReqArgs
!=nullptr && pTabViewShell
->SelectionEditable() )
474 const SfxPoolItem
* pItem
;
475 OUString
aFlags('A');
477 if( pReqArgs
->HasItem( SID_DELETE
, &pItem
) )
478 aFlags
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
480 nFlags
|= FlagsFromString(aFlags
, InsertDeleteFlags::ALL
);
484 ScEditableTester
aTester( pTabViewShell
);
485 if (aTester
.IsEditable())
487 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
489 ScopedVclPtr
<AbstractScDeleteContentsDlg
> pDlg(pFact
->CreateScDeleteContentsDlg(pTabViewShell
->GetFrameWeld()));
490 ScDocument
& rDoc
= GetViewData().GetDocument();
491 SCTAB nTab
= GetViewData().GetTabNo();
492 if ( rDoc
.IsTabProtected(nTab
) )
493 pDlg
->DisableObjects();
494 if (pDlg
->Execute() == RET_OK
)
496 nFlags
= pDlg
->GetDelContentsCmdBits();
500 pTabViewShell
->ErrorMessage(aTester
.GetMessageId());
503 if( nFlags
!= InsertDeleteFlags::NONE
)
505 pTabViewShell
->DeleteContents( nFlags
);
509 OUString aFlags
= FlagsToString( nFlags
, InsertDeleteFlags::ALL
);
511 rReq
.AppendItem( SfxStringItem( SID_DELETE
, aFlags
) );
520 case FID_FILL_TO_BOTTOM
:
521 pTabViewShell
->FillSimple( FILL_TO_BOTTOM
);
525 case FID_FILL_TO_RIGHT
:
526 pTabViewShell
->FillSimple( FILL_TO_RIGHT
);
530 case FID_FILL_TO_TOP
:
531 pTabViewShell
->FillSimple( FILL_TO_TOP
);
535 case FID_FILL_TO_LEFT
:
536 pTabViewShell
->FillSimple( FILL_TO_LEFT
);
542 InsertDeleteFlags nFlags
= InsertDeleteFlags::NONE
;
543 ScPasteFunc nFunction
= ScPasteFunc::NONE
;
544 bool bSkipEmpty
= false;
545 bool bAsLink
= false;
547 if ( pReqArgs
!=nullptr && pTabViewShell
->SelectionEditable() )
549 const SfxPoolItem
* pItem
;
550 OUString
aFlags('A');
552 if( pReqArgs
->HasItem( FID_FILL_TAB
, &pItem
) )
553 aFlags
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
555 nFlags
|= FlagsFromString(aFlags
);
559 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
561 ScopedVclPtr
<AbstractScInsertContentsDlg
> pDlg(pFact
->CreateScInsertContentsDlg(pTabViewShell
->GetFrameWeld(),
562 new OUString(ScResId(STR_FILL_TAB
))));
563 pDlg
->SetFillMode(true);
565 if (pDlg
->Execute() == RET_OK
)
567 nFlags
= pDlg
->GetInsContentsCmdBits();
568 nFunction
= pDlg
->GetFormulaCmdBits();
569 bSkipEmpty
= pDlg
->IsSkipEmptyCells();
570 bAsLink
= pDlg
->IsLink();
571 // there is no MoveMode with fill tabs
575 if( nFlags
!= InsertDeleteFlags::NONE
)
577 pTabViewShell
->FillTab( nFlags
, nFunction
, bSkipEmpty
, bAsLink
);
581 OUString aFlags
= FlagsToString( nFlags
);
583 rReq
.AppendItem( SfxStringItem( FID_FILL_TAB
, aFlags
) );
590 case FID_FILL_SERIES
:
592 if (GetViewData().SelectionForbidsCellFill())
593 // Slot should be already disabled, but in case it wasn't
594 // don't even attempt to do the evaluation and popup a
604 sal_uInt16 nPossDir
= FDS_OPT_NONE
;
605 FillDir eFillDir
= FILL_TO_BOTTOM
;
606 FillCmd eFillCmd
= FILL_LINEAR
;
607 FillDateCmd eFillDateCmd
= FILL_DAY
;
608 double fStartVal
= MAXDOUBLE
;
610 double fMaxVal
= MAXDOUBLE
;
613 GetViewData().GetSimpleArea( nStartCol
, nStartRow
, nStartTab
,
614 nEndCol
, nEndRow
, nEndTab
);
616 if( nStartCol
!=nEndCol
)
618 nPossDir
|= FDS_OPT_HORZ
;
619 eFillDir
=FILL_TO_RIGHT
;
622 if( nStartRow
!=nEndRow
)
624 nPossDir
|= FDS_OPT_VERT
;
625 eFillDir
=FILL_TO_BOTTOM
;
628 ScDocument
& rDoc
= GetViewData().GetDocument();
629 SvNumberFormatter
* pFormatter
= rDoc
.GetFormatTable();
633 const SfxPoolItem
* pItem
;
634 OUString aFillDir
, aFillCmd
, aFillDateCmd
;
635 OUString aFillStep
, aFillStart
, aFillMax
;
639 if( pReqArgs
->HasItem( FID_FILL_SERIES
, &pItem
) )
640 aFillDir
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
641 if( pReqArgs
->HasItem( FN_PARAM_1
, &pItem
) )
642 aFillCmd
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
643 if( pReqArgs
->HasItem( FN_PARAM_2
, &pItem
) )
644 aFillDateCmd
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
645 if( pReqArgs
->HasItem( FN_PARAM_3
, &pItem
) )
646 aFillStep
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
647 if( pReqArgs
->HasItem( FN_PARAM_4
, &pItem
) )
648 aFillStart
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
649 if( pReqArgs
->HasItem( FN_PARAM_5
, &pItem
) )
650 aFillMax
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
652 if( !aFillDir
.isEmpty() )
653 switch( aFillDir
[0] )
655 case 'B': case 'b': eFillDir
=FILL_TO_BOTTOM
; break;
656 case 'R': case 'r': eFillDir
=FILL_TO_RIGHT
; break;
657 case 'T': case 't': eFillDir
=FILL_TO_TOP
; break;
658 case 'L': case 'l': eFillDir
=FILL_TO_LEFT
; break;
661 if( !aFillCmd
.isEmpty() )
662 switch( aFillCmd
[0] )
664 case 'S': case 's': eFillCmd
=FILL_SIMPLE
; break;
665 case 'L': case 'l': eFillCmd
=FILL_LINEAR
; break;
666 case 'G': case 'g': eFillCmd
=FILL_GROWTH
; break;
667 case 'D': case 'd': eFillCmd
=FILL_DATE
; break;
668 case 'A': case 'a': eFillCmd
=FILL_AUTO
; break;
671 if( !aFillDateCmd
.isEmpty() )
672 switch( aFillDateCmd
[0] )
674 case 'D': case 'd': eFillDateCmd
=FILL_DAY
; break;
675 case 'W': case 'w': eFillDateCmd
=FILL_WEEKDAY
; break;
676 case 'M': case 'm': eFillDateCmd
=FILL_MONTH
; break;
677 case 'Y': case 'y': eFillDateCmd
=FILL_YEAR
; break;
681 if( pFormatter
->IsNumberFormat( aFillStart
, nKey
, fTmpVal
))
685 if( pFormatter
->IsNumberFormat( aFillStep
, nKey
, fTmpVal
))
689 if( pFormatter
->IsNumberFormat( aFillMax
, nKey
, fTmpVal
))
695 else // (pReqArgs == nullptr) => raise Dialog
697 sal_uInt32 nPrivFormat
= rDoc
.GetNumberFormat( nStartCol
, nStartRow
, nStartTab
);
698 CellType eCellType
= rDoc
.GetCellType( nStartCol
, nStartRow
, nStartTab
);
699 const SvNumberformat
* pPrivEntry
= pFormatter
->GetEntry( nPrivFormat
);
700 const SCSIZE nSelectHeight
= nEndRow
- nStartRow
+ 1;
701 const SCSIZE nSelectWidth
= nEndCol
- nStartCol
+ 1;
705 OSL_FAIL("Numberformat not found !!!");
709 SvNumFormatType nPrivType
= pPrivEntry
->GetType();
710 if (nPrivType
& SvNumFormatType::DATE
)
714 else if(eCellType
==CELLTYPE_STRING
)
722 // suggest default Startvalue only, when just 1 row or column
723 if ( nStartCol
== nEndCol
|| nStartRow
== nEndRow
)
725 double fInputEndVal
= 0.0;
728 const bool forceSystemLocale
= true;
729 aStartStr
= rDoc
.GetInputString( nStartCol
, nStartRow
, nStartTab
, forceSystemLocale
);
730 fStartVal
= rDoc
.GetValue( nStartCol
, nStartRow
, nStartTab
);
732 if(eFillDir
==FILL_TO_BOTTOM
&& nStartRow
< nEndRow
)
734 aEndStr
= rDoc
.GetInputString( nStartCol
, nStartRow
+1, nStartTab
, forceSystemLocale
);
735 if(!aEndStr
.isEmpty())
737 fInputEndVal
= rDoc
.GetValue( nStartCol
, nStartRow
+1, nStartTab
);
738 fIncVal
=fInputEndVal
-fStartVal
;
743 if(nStartCol
< nEndCol
)
745 aEndStr
= rDoc
.GetInputString( nStartCol
+1, nStartRow
, nStartTab
, forceSystemLocale
);
746 if(!aEndStr
.isEmpty())
748 fInputEndVal
= rDoc
.GetValue( nStartCol
+1, nStartRow
, nStartTab
);
749 fIncVal
=fInputEndVal
-fStartVal
;
753 if(eFillCmd
==FILL_DATE
)
755 const Date
& rNullDate
= rDoc
.GetFormatTable()->GetNullDate();
756 Date aStartDate
= rNullDate
;
757 aStartDate
.AddDays(fStartVal
);
758 Date aEndDate
= rNullDate
;
759 aEndDate
.AddDays(fInputEndVal
);
762 if(aStartDate
.GetYear()!=aEndDate
.GetYear())
764 eFillDateCmd
= FILL_YEAR
;
765 fTempDate
=aEndDate
.GetYear()-aStartDate
.GetYear();
767 if(aStartDate
.GetMonth()!=aEndDate
.GetMonth())
769 eFillDateCmd
= FILL_MONTH
;
770 fTempDate
=fTempDate
*12+aEndDate
.GetMonth()-aStartDate
.GetMonth();
772 if(aStartDate
.GetDay()==aEndDate
.GetDay())
778 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
780 ScopedVclPtr
<AbstractScFillSeriesDlg
> pDlg(pFact
->CreateScFillSeriesDlg( pTabViewShell
->GetFrameWeld(),
782 eFillDir
, eFillCmd
, eFillDateCmd
,
783 aStartStr
, fIncVal
, fMaxVal
,
784 nSelectHeight
, nSelectWidth
, nPossDir
));
786 if ( nStartCol
!= nEndCol
&& nStartRow
!= nEndRow
)
788 pDlg
->SetEdStartValEnabled(false);
791 if ( pDlg
->Execute() == RET_OK
)
793 eFillDir
= pDlg
->GetFillDir();
794 eFillCmd
= pDlg
->GetFillCmd();
795 eFillDateCmd
= pDlg
->GetFillDateCmd();
797 if(eFillCmd
==FILL_AUTO
)
799 OUString aStr
= pDlg
->GetStartStr();
801 pTabViewShell
->EnterData( nStartCol
, nStartRow
, nStartTab
, aStr
);
803 fStartVal
= pDlg
->GetStart();
804 fIncVal
= pDlg
->GetStep();
805 fMaxVal
= pDlg
->GetMax();
812 //nScFillModeMouseModifier = 0; // no Ctrl/Copy
813 pTabViewShell
->FillSeries( eFillDir
, eFillCmd
, eFillDateCmd
, fStartVal
, fIncVal
, fMaxVal
);
818 const Color
* pColor
= nullptr;
822 case FILL_TO_BOTTOM
: aPara
= "B"; break;
823 case FILL_TO_RIGHT
: aPara
= "R"; break;
824 case FILL_TO_TOP
: aPara
= "T"; break;
825 case FILL_TO_LEFT
: aPara
= "L"; break;
828 rReq
.AppendItem( SfxStringItem( FID_FILL_SERIES
, aPara
) );
832 case FILL_SIMPLE
: aPara
= "S"; break;
833 case FILL_LINEAR
: aPara
= "L"; break;
834 case FILL_GROWTH
: aPara
= "G"; break;
835 case FILL_DATE
: aPara
= "D"; break;
836 case FILL_AUTO
: aPara
= "A"; break;
839 rReq
.AppendItem( SfxStringItem( FN_PARAM_1
, aPara
) );
841 switch( eFillDateCmd
)
843 case FILL_DAY
: aPara
= "D"; break;
844 case FILL_WEEKDAY
: aPara
= "W"; break;
845 case FILL_MONTH
: aPara
= "M"; break;
846 case FILL_YEAR
: aPara
= "Y"; break;
849 rReq
.AppendItem( SfxStringItem( FN_PARAM_2
, aPara
) );
851 sal_uInt32 nFormatKey
= pFormatter
->GetStandardFormat(SvNumFormatType::NUMBER
,
854 pFormatter
->GetOutputString( fIncVal
, nFormatKey
, aPara
, &pColor
);
855 rReq
.AppendItem( SfxStringItem( FN_PARAM_3
, aPara
) );
857 pFormatter
->GetOutputString( fStartVal
, nFormatKey
, aPara
, &pColor
);
858 rReq
.AppendItem( SfxStringItem( FN_PARAM_4
, aPara
) );
860 pFormatter
->GetOutputString( fMaxVal
, nFormatKey
, aPara
, &pColor
);
861 rReq
.AppendItem( SfxStringItem( FN_PARAM_5
, aPara
) );
876 GetViewData().GetFillData( nStartCol
, nStartRow
, nEndCol
, nEndRow
);
877 SCCOL nFillCol
= GetViewData().GetRefEndX();
878 SCROW nFillRow
= GetViewData().GetRefEndY();
879 ScDocument
& rDoc
= GetViewData().GetDocument();
881 sal_uInt16 nOrigScFillModeMouseModifier
= nScFillModeMouseModifier
;
882 bool bUseSelection
= true;
884 if( pReqArgs
!= nullptr )
886 if( const SfxStringItem
* pItem
= pReqArgs
->GetItemIfSet( FID_FILL_AUTO
) )
888 ScAddress aScAddress
;
889 OUString aArg
= pItem
->GetValue();
891 if( aScAddress
.Parse( aArg
, rDoc
, rDoc
.GetAddressConvention() ) & ScRefFlags::VALID
)
893 nFillRow
= aScAddress
.Row();
894 nFillCol
= aScAddress
.Col();
897 SCTAB nStartTab
, nEndTab
;
898 GetViewData().GetSimpleArea(nStartCol
, nStartRow
, nStartTab
, nEndCol
,
900 bUseSelection
= false;
903 const SfxPoolItem
* pItem
;
904 if (pReqArgs
->HasItem(FN_PARAM_1
, &pItem
))
907 nScFillModeMouseModifier controls if we "Copy cells" or "Fill series"
908 - if nScFillModeMouseModifier is set to "KEY_MOD1", use "Copy cells"
909 - otherwise use "Fill series"
911 This is also the same with auto fill by dragging mouse
912 - dragging with Ctrl key will set nScFillModeMouseModifier to KEY_MOD1, use "Copy cells"
913 - only dragging will use "Fill series" (no Ctrl key)
915 const bool bCopyCells
= static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
916 nScFillModeMouseModifier
&= ~KEY_MOD1
; // turn off, reset to 0
919 nScFillModeMouseModifier
|= KEY_MOD1
; // turn on
922 if (bUseSelection
) // call via mouse or if FN_PARAM_1 exists
924 // not in a merged cell
926 if ( nStartCol
== nEndCol
&& nStartRow
== nEndRow
)
928 SCCOL nMergeCol
= nStartCol
;
929 SCROW nMergeRow
= nStartRow
;
930 if ( GetViewData().GetDocument().ExtendMerge(
931 nStartCol
, nStartRow
, nMergeCol
, nMergeRow
,
932 GetViewData().GetTabNo() ) )
934 if ( nFillCol
>= nStartCol
&& nFillCol
<= nMergeCol
&& nFillRow
== nStartRow
)
935 nFillCol
= nStartCol
;
936 if ( nFillRow
>= nStartRow
&& nFillRow
<= nMergeRow
&& nFillCol
== nStartCol
)
937 nFillRow
= nStartRow
;
942 if ( nFillCol
!= nEndCol
|| nFillRow
!= nEndRow
)
944 if ( nFillCol
==nEndCol
|| nFillRow
==nEndRow
)
946 FillDir eDir
= FILL_TO_BOTTOM
;
949 if ( nFillCol
==nEndCol
)
951 if ( nFillRow
> nEndRow
)
953 eDir
= FILL_TO_BOTTOM
;
954 nCount
= nFillRow
- nEndRow
;
956 else if ( nFillRow
< nStartRow
)
959 nCount
= nStartRow
- nFillRow
;
964 if ( nFillCol
> nEndCol
)
966 eDir
= FILL_TO_RIGHT
;
967 nCount
= nFillCol
- nEndCol
;
969 else if ( nFillCol
< nStartCol
)
972 nCount
= nStartCol
- nFillCol
;
978 pTabViewShell
->FillAuto( eDir
, nStartCol
, nStartRow
, nEndCol
, nEndRow
, nCount
);
982 ScAddress
aAdr( nFillCol
, nFillRow
, 0 );
983 OUString
aAdrStr(aAdr
.Format(ScRefFlags::RANGE_ABS
, &rDoc
, rDoc
.GetAddressConvention()));
985 rReq
.AppendItem( SfxStringItem( FID_FILL_AUTO
, aAdrStr
) );
993 OSL_FAIL( "Direction not unique for autofill" );
997 // reset nScFillModeMouseModifier to its original state
998 // otherwise, auto fill by dragging will not work as expected
999 nScFillModeMouseModifier
= nOrigScFillModeMouseModifier
;
1002 case FID_FILL_SINGLE_EDIT
:
1003 ExecuteFillSingleEdit();
1005 case SID_RANDOM_NUMBER_GENERATOR_DIALOG
:
1007 sal_uInt16 nId
= ScRandomNumberGeneratorDialogWrapper::GetChildWindowId();
1008 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
1009 SfxChildWindow
* pWnd
= rViewFrm
.GetChildWindow( nId
);
1011 pScMod
->SetRefDialog( nId
, pWnd
== nullptr );
1015 case SID_SAMPLING_DIALOG
:
1017 sal_uInt16 nId
= ScSamplingDialogWrapper::GetChildWindowId();
1018 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
1019 SfxChildWindow
* pWnd
= rViewFrm
.GetChildWindow( nId
);
1021 pScMod
->SetRefDialog( nId
, pWnd
== nullptr );
1024 case SID_DESCRIPTIVE_STATISTICS_DIALOG
:
1026 sal_uInt16 nId
= ScDescriptiveStatisticsDialogWrapper::GetChildWindowId();
1027 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
1028 SfxChildWindow
* pWnd
= rViewFrm
.GetChildWindow( nId
);
1030 pScMod
->SetRefDialog( nId
, pWnd
== nullptr );
1033 case SID_ANALYSIS_OF_VARIANCE_DIALOG
:
1035 sal_uInt16 nId
= ScAnalysisOfVarianceDialogWrapper::GetChildWindowId();
1036 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
1037 SfxChildWindow
* pWnd
= rViewFrm
.GetChildWindow( nId
);
1039 pScMod
->SetRefDialog( nId
, pWnd
== nullptr );
1042 case SID_CORRELATION_DIALOG
:
1044 sal_uInt16 nId
= ScCorrelationDialogWrapper::GetChildWindowId();
1045 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
1046 SfxChildWindow
* pWnd
= rViewFrm
.GetChildWindow( nId
);
1048 pScMod
->SetRefDialog( nId
, pWnd
== nullptr );
1051 case SID_COVARIANCE_DIALOG
:
1053 sal_uInt16 nId
= ScCovarianceDialogWrapper::GetChildWindowId();
1054 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
1055 SfxChildWindow
* pWnd
= rViewFrm
.GetChildWindow( nId
);
1057 pScMod
->SetRefDialog( nId
, pWnd
== nullptr );
1060 case SID_EXPONENTIAL_SMOOTHING_DIALOG
:
1062 sal_uInt16 nId
= ScExponentialSmoothingDialogWrapper::GetChildWindowId();
1063 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
1064 SfxChildWindow
* pWnd
= rViewFrm
.GetChildWindow( nId
);
1066 pScMod
->SetRefDialog( nId
, pWnd
== nullptr );
1069 case SID_MOVING_AVERAGE_DIALOG
:
1071 sal_uInt16 nId
= ScMovingAverageDialogWrapper::GetChildWindowId();
1072 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
1073 SfxChildWindow
* pWnd
= rViewFrm
.GetChildWindow( nId
);
1075 pScMod
->SetRefDialog( nId
, pWnd
== nullptr );
1078 case SID_REGRESSION_DIALOG
:
1080 sal_uInt16 nId
= ScRegressionDialogWrapper::GetChildWindowId();
1081 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
1082 SfxChildWindow
* pWnd
= rViewFrm
.GetChildWindow( nId
);
1084 pScMod
->SetRefDialog( nId
, pWnd
== nullptr );
1087 case SID_TTEST_DIALOG
:
1089 sal_uInt16 nId
= ScTTestDialogWrapper::GetChildWindowId();
1090 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
1091 SfxChildWindow
* pWnd
= rViewFrm
.GetChildWindow( nId
);
1093 pScMod
->SetRefDialog( nId
, pWnd
== nullptr );
1097 case SID_FTEST_DIALOG
:
1099 sal_uInt16 nId
= ScFTestDialogWrapper::GetChildWindowId();
1100 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
1101 SfxChildWindow
* pWnd
= rViewFrm
.GetChildWindow( nId
);
1103 pScMod
->SetRefDialog( nId
, pWnd
== nullptr );
1107 case SID_ZTEST_DIALOG
:
1109 sal_uInt16 nId
= ScZTestDialogWrapper::GetChildWindowId();
1110 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
1111 SfxChildWindow
* pWnd
= rViewFrm
.GetChildWindow( nId
);
1113 pScMod
->SetRefDialog( nId
, pWnd
== nullptr );
1117 case SID_CHI_SQUARE_TEST_DIALOG
:
1119 sal_uInt16 nId
= ScChiSquareTestDialogWrapper::GetChildWindowId();
1120 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
1121 SfxChildWindow
* pWnd
= rViewFrm
.GetChildWindow( nId
);
1123 pScMod
->SetRefDialog( nId
, pWnd
== nullptr );
1127 case SID_FOURIER_ANALYSIS_DIALOG
:
1129 sal_uInt16 nId
= ScFourierAnalysisDialogWrapper::GetChildWindowId();
1130 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
1131 SfxChildWindow
* pWnd
= rViewFrm
.GetChildWindow( nId
);
1133 pScMod
->SetRefDialog( nId
, pWnd
== nullptr );
1137 case SID_SEARCH_RESULTS_DIALOG
:
1139 const SfxPoolItem
* pItem
= nullptr;
1140 if (pReqArgs
&& pReqArgs
->HasItem(SID_SEARCH_RESULTS_DIALOG
, &pItem
))
1142 bool bVisible
= static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
1143 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
1144 // The window ID should equal the slot ID, but not a biggie if it wasn't.
1145 sal_uInt16 nId
= sc::SearchResultsDlgWrapper::GetChildWindowId();
1146 rViewFrm
.SetChildWindow(nId
, bVisible
, false);
1152 case SID_INSERT_SPARKLINE
:
1153 case SID_EDIT_SPARKLINE_GROUP
:
1155 sal_uInt16 nId
= sc::SparklineDialogWrapper::GetChildWindowId();
1156 SfxViewFrame
& rViewFrame
= pTabViewShell
->GetViewFrame();
1157 SfxChildWindow
* pWindow
= rViewFrame
.GetChildWindow(nId
);
1158 pScMod
->SetRefDialog(nId
, pWindow
== nullptr);
1163 case SID_EDIT_SPARKLINE
:
1165 sal_uInt16 nId
= sc::SparklineDataRangeDialogWrapper::GetChildWindowId();
1166 SfxViewFrame
& rViewFrame
= pTabViewShell
->GetViewFrame();
1167 SfxChildWindow
* pWindow
= rViewFrame
.GetChildWindow(nId
);
1168 pScMod
->SetRefDialog(nId
, pWindow
== nullptr);
1173 case SID_DELETE_SPARKLINE
:
1175 pTabViewShell
->DeleteContents(InsertDeleteFlags::SPARKLINES
);
1181 case SID_DELETE_SPARKLINE_GROUP
:
1184 ScMarkType eMarkType
= GetViewData().GetSimpleArea(aMarkRange
);
1185 if (eMarkType
== SC_MARK_SIMPLE
)
1187 std::shared_ptr
<sc::SparklineGroup
> pSparklineGroup
;
1188 if (GetViewData().GetDocument().GetSparklineGroupInRange(aMarkRange
, pSparklineGroup
) && pSparklineGroup
)
1190 GetViewData().GetDocShell()->GetDocFunc().DeleteSparklineGroup(pSparklineGroup
, GetViewData().GetTabNo());
1197 case SID_GROUP_SPARKLINES
:
1200 if (GetViewData().GetSimpleArea(aRange
) == SC_MARK_SIMPLE
)
1202 ScAddress
aCursorAddress(GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo());
1203 auto pSparkline
= GetViewData().GetDocument().GetSparkline(aCursorAddress
);
1206 auto const& rpSparklineGroup
= pSparkline
->getSparklineGroup();
1207 GetViewData().GetDocShell()->GetDocFunc().GroupSparklines(aRange
, rpSparklineGroup
);
1214 case SID_UNGROUP_SPARKLINES
:
1217 if (GetViewData().GetSimpleArea(aRange
) == SC_MARK_SIMPLE
)
1219 GetViewData().GetDocShell()->GetDocFunc().UngroupSparklines(aRange
);
1225 // disposal (Outlines)
1226 // SID_AUTO_OUTLINE, SID_OUTLINE_DELETEALL in Execute (in docsh.idl)
1228 case SID_OUTLINE_HIDE
:
1229 if ( GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(),
1230 GetViewData().GetCurY(), GetViewData().GetTabNo() ) )
1231 pTabViewShell
->SetDataPilotDetails( false );
1233 pTabViewShell
->HideMarkedOutlines();
1237 case SID_OUTLINE_SHOW
:
1239 ScDPObject
* pDPObj
= GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(),
1240 GetViewData().GetCurY(), GetViewData().GetTabNo() );
1243 Sequence
<sheet::DataPilotFieldFilter
> aFilters
;
1244 css::sheet::DataPilotFieldOrientation nOrientation
;
1245 if ( pTabViewShell
->HasSelectionForDrillDown( nOrientation
) )
1247 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
1248 ScopedVclPtr
<AbstractScDPShowDetailDlg
> pDlg( pFact
->CreateScDPShowDetailDlg(
1249 pTabViewShell
->GetFrameWeld(), *pDPObj
, nOrientation
) );
1250 if ( pDlg
->Execute() == RET_OK
)
1252 OUString
aNewDimName( pDlg
->GetDimensionName() );
1253 pTabViewShell
->SetDataPilotDetails( true, &aNewDimName
);
1256 else if ( !pDPObj
->IsServiceData() &&
1257 pDPObj
->GetDataFieldPositionData(
1258 ScAddress( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() ),
1260 pTabViewShell
->ShowDataPilotSourceData( *pDPObj
, aFilters
);
1262 pTabViewShell
->SetDataPilotDetails(true);
1265 pTabViewShell
->ShowMarkedOutlines();
1270 case SID_OUTLINE_MAKE
:
1272 bool bColumns
= false;
1275 if ( GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(),
1276 GetViewData().GetCurY(), GetViewData().GetTabNo() ) )
1278 ScDPNumGroupInfo aNumInfo
;
1279 aNumInfo
.mbEnable
= true;
1280 aNumInfo
.mbAutoStart
= true;
1281 aNumInfo
.mbAutoEnd
= true;
1282 sal_Int32 nParts
= 0;
1283 if ( pTabViewShell
->HasSelectionForDateGroup( aNumInfo
, nParts
) )
1285 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
1286 const Date
& rNullDate( GetViewData().GetDocument().GetFormatTable()->GetNullDate() );
1287 ScopedVclPtr
<AbstractScDPDateGroupDlg
> pDlg( pFact
->CreateScDPDateGroupDlg(
1288 pTabViewShell
->GetFrameWeld(),
1289 aNumInfo
, nParts
, rNullDate
) );
1290 if( pDlg
->Execute() == RET_OK
)
1292 aNumInfo
= pDlg
->GetGroupInfo();
1293 pTabViewShell
->DateGroupDataPilot( aNumInfo
, pDlg
->GetDatePart() );
1296 else if ( pTabViewShell
->HasSelectionForNumGroup( aNumInfo
) )
1298 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
1299 ScopedVclPtr
<AbstractScDPNumGroupDlg
> pDlg( pFact
->CreateScDPNumGroupDlg(
1300 pTabViewShell
->GetFrameWeld(), aNumInfo
) );
1301 if( pDlg
->Execute() == RET_OK
)
1302 pTabViewShell
->NumGroupDataPilot( pDlg
->GetGroupInfo() );
1305 pTabViewShell
->GroupDataPilot();
1309 else if( pReqArgs
!= nullptr )
1311 const SfxPoolItem
* pItem
;
1314 if( pReqArgs
->HasItem( SID_OUTLINE_MAKE
, &pItem
) )
1316 OUString aCol
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1317 aCol
= aCol
.toAsciiUpperCase();
1321 case 'R': bColumns
=false; bOk
= true;break;
1322 case 'C': bColumns
=true; bOk
= true;break;
1326 else // Dialog, when not whole rows/columns are marked
1328 if ( GetViewData().SimpleColMarked() && !GetViewData().SimpleRowMarked() )
1330 else if ( !GetViewData().SimpleColMarked() && GetViewData().SimpleRowMarked() )
1334 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
1336 VclPtr
<AbstractScGroupDlg
> pDlg(pFact
->CreateAbstractScGroupDlg(pTabViewShell
->GetFrameWeld()));
1338 pDlg
->StartExecuteAsync(
1339 [pDlg
, pTabViewShell
] (sal_Int32 nResult
) {
1340 if( RET_OK
== nResult
)
1342 bool bColumn
= pDlg
->GetColsChecked();
1343 pTabViewShell
->MakeOutline( bColumn
);
1345 pDlg
->disposeOnce();
1354 pTabViewShell
->MakeOutline( bColumns
);
1356 if( ! rReq
.IsAPI() )
1358 OUString aCol
= bColumns
? OUString('C') : OUString('R');
1359 rReq
.AppendItem( SfxStringItem( SID_OUTLINE_MAKE
, aCol
) );
1366 case SID_OUTLINE_REMOVE
:
1368 bool bColumns
= false;
1371 if ( GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(),
1372 GetViewData().GetCurY(), GetViewData().GetTabNo() ) )
1374 pTabViewShell
->UngroupDataPilot();
1377 else if( pReqArgs
!= nullptr )
1379 const SfxPoolItem
* pItem
;
1382 if( pReqArgs
->HasItem( SID_OUTLINE_REMOVE
, &pItem
) )
1384 OUString aCol
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1385 aCol
= aCol
.toAsciiUpperCase();
1389 case 'R': bColumns
=false; bOk
= true;break;
1390 case 'C': bColumns
=true; bOk
= true;break;
1394 else // Dialog only when removal for rows and columns is possible
1396 bool bColPoss
, bRowPoss
;
1397 pTabViewShell
->TestRemoveOutline( bColPoss
, bRowPoss
);
1398 // TODO: handle this case in LOK too
1399 if ( bColPoss
&& bRowPoss
&& !comphelper::LibreOfficeKit::isActive() )
1401 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
1403 VclPtr
<AbstractScGroupDlg
> pDlg(pFact
->CreateAbstractScGroupDlg(pTabViewShell
->GetFrameWeld(), true));
1405 pDlg
->StartExecuteAsync(
1406 [pDlg
, pTabViewShell
] (sal_Int32 nResult
) {
1407 if( RET_OK
== nResult
)
1409 bool bColumn
= pDlg
->GetColsChecked();
1410 pTabViewShell
->RemoveOutline( bColumn
);
1412 pDlg
->disposeOnce();
1418 else if ( bColPoss
)
1420 else if ( bRowPoss
)
1427 pTabViewShell
->RemoveOutline( bColumns
);
1429 if( ! rReq
.IsAPI() )
1431 OUString aCol
= bColumns
? OUString('C') : OUString('R');
1432 rReq
.AppendItem( SfxStringItem( SID_OUTLINE_REMOVE
, aCol
) );
1441 case SID_COPY
: // for graphs in DrawShell
1443 weld::WaitObject
aWait( GetViewData().GetDialogParent() );
1444 pTabViewShell
->CopyToClip( nullptr, false, false, true );
1446 GetViewData().SetPasteMode( ScPasteFlags::Mode
| ScPasteFlags::Border
);
1447 pTabViewShell
->ShowCursor();
1448 pTabViewShell
->UpdateCopySourceOverlay();
1452 case SID_CUT
: // for graphs in DrawShell
1454 weld::WaitObject
aWait( GetViewData().GetDialogParent() );
1455 pTabViewShell
->CutToClip();
1457 GetViewData().SetPasteMode( ScPasteFlags::Mode
| ScPasteFlags::Border
);
1458 pTabViewShell
->ShowCursor();
1459 pTabViewShell
->UpdateCopySourceOverlay();
1463 case SID_COPYDELETE
: // for graphs in DrawShell
1465 weld::WaitObject
aWait( GetViewData().GetDialogParent() );
1466 pTabViewShell
->CopyToClip( nullptr, true, false, true );
1467 pTabViewShell
->DeleteContents( InsertDeleteFlags::CONTENTS
);
1469 GetViewData().SetPasteMode( ScPasteFlags::Mode
| ScPasteFlags::Border
);
1470 pTabViewShell
->ShowCursor();
1471 pTabViewShell
->UpdateCopySourceOverlay();
1476 ScClipUtil::PasteFromClipboard( GetViewData(), pTabViewShell
, true );
1481 case SID_CLIPBOARD_FORMAT_ITEMS
:
1483 weld::WaitObject
aWait( GetViewData().GetDialogParent() );
1485 SotClipboardFormatId nFormat
= SotClipboardFormatId::NONE
;
1486 const SfxPoolItem
* pItem
;
1487 if ( pReqArgs
&& pReqArgs
->GetItemState(nSlot
, true, &pItem
) == SfxItemState::SET
)
1488 if (auto pIntItem
= dynamic_cast<const SfxUInt32Item
*>(pItem
) )
1489 nFormat
= static_cast<SotClipboardFormatId
>(pIntItem
->GetValue());
1491 if ( nFormat
!= SotClipboardFormatId::NONE
)
1493 css::uno::Reference
<css::datatransfer::XTransferable2
> xTransferable(ScTabViewShell::GetClipData(GetViewData().GetActiveWin()));
1494 bool bCells
= ( ScTransferObj::GetOwnClipboard(xTransferable
) != nullptr );
1495 bool bDraw
= ( ScDrawTransferObj::GetOwnClipboard(xTransferable
) != nullptr );
1496 bool bOle
= ( nFormat
== SotClipboardFormatId::EMBED_SOURCE
);
1498 if ( bCells
&& bOle
)
1499 pTabViewShell
->PasteFromSystem();
1500 else if ( bDraw
&& bOle
)
1501 pTabViewShell
->PasteDraw();
1503 pTabViewShell
->PasteFromSystem(nFormat
);
1506 //? pTabViewShell->PasteFromSystem();
1510 pTabViewShell
->CellContentChanged();
1513 case FID_INS_CELL_CONTENTS
:
1515 ScDocument
& rDoc
= GetViewData().GetDocument();
1516 bool bOtherDoc
= !rDoc
.IsClipboardSource();
1517 // keep a reference in case the clipboard is changed during dialog or PasteFromClip
1518 const ScTransferObj
* pOwnClip
= ScTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(GetViewData().GetActiveWin()));
1521 InsertDeleteFlags nFlags
= InsertDeleteFlags::NONE
;
1522 ScPasteFunc nFunction
= ScPasteFunc::NONE
;
1523 InsCellCmd eMoveMode
= INS_NONE
;
1524 bool bSkipEmpty
= false;
1525 bool bTranspose
= false;
1526 bool bAsLink
= false;
1528 if ( pReqArgs
!=nullptr && pTabViewShell
->SelectionEditable() )
1530 const SfxPoolItem
* pItem
;
1531 OUString
aFlags('A');
1533 if( pReqArgs
->HasItem( FID_INS_CELL_CONTENTS
, &pItem
) )
1534 aFlags
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1536 nFlags
|= FlagsFromString(aFlags
);
1538 const SfxUInt16Item
* pFuncItem
= rReq
.GetArg
<SfxUInt16Item
>(FN_PARAM_1
);
1539 const SfxBoolItem
* pSkipItem
= rReq
.GetArg
<SfxBoolItem
>(FN_PARAM_2
);
1540 const SfxBoolItem
* pTransposeItem
= rReq
.GetArg
<SfxBoolItem
>(FN_PARAM_3
);
1541 const SfxBoolItem
* pLinkItem
= rReq
.GetArg
<SfxBoolItem
>(FN_PARAM_4
);
1542 const SfxInt16Item
* pMoveItem
= rReq
.GetArg
<SfxInt16Item
>(FN_PARAM_5
);
1544 nFunction
= static_cast<ScPasteFunc
>(pFuncItem
->GetValue());
1546 bSkipEmpty
= pSkipItem
->GetValue();
1547 if ( pTransposeItem
)
1548 bTranspose
= pTransposeItem
->GetValue();
1550 bAsLink
= pLinkItem
->GetValue();
1552 eMoveMode
= static_cast<InsCellCmd
>(pMoveItem
->GetValue());
1556 ScEditableTester
aTester( pTabViewShell
);
1557 if (aTester
.IsEditable())
1559 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
1561 ScopedVclPtr
<AbstractScInsertContentsDlg
> pDlg(pFact
->CreateScInsertContentsDlg(pTabViewShell
->GetFrameWeld()));
1562 pDlg
->SetOtherDoc( bOtherDoc
);
1563 // if ChangeTrack MoveMode disable
1564 pDlg
->SetChangeTrack( rDoc
.GetChangeTrack() != nullptr );
1565 // fdo#56098 disable shift if necessary
1568 ScViewData
& rData
= GetViewData();
1569 if ( rData
.GetMarkData().GetTableSelect( rData
.GetTabNo() ) )
1571 SCCOL nStartX
, nEndX
, nClipStartX
, nClipSizeX
, nRangeSizeX
;
1572 SCROW nStartY
, nEndY
, nClipStartY
, nClipSizeY
, nRangeSizeY
;
1573 SCTAB nStartTab
, nEndTab
;
1574 pOwnClip
->GetDocument()->GetClipStart( nClipStartX
, nClipStartY
);
1575 pOwnClip
->GetDocument()->GetClipArea( nClipSizeX
, nClipSizeY
, true );
1577 if ( rData
.GetSimpleArea( nStartX
, nStartY
, nStartTab
,
1578 nEndX
, nEndY
, nEndTab
) != SC_MARK_SIMPLE
||
1579 nStartTab
!= nEndTab
)
1581 // the destination is not a simple range,
1582 // assume the destination as the current cell
1583 nStartX
= nEndX
= rData
.GetCurX();
1584 nStartY
= nEndY
= rData
.GetCurY();
1585 nStartTab
= rData
.GetTabNo();
1587 // we now have clip- and range dimensions
1588 // the size of the destination area is the larger of the two
1589 nRangeSizeX
= nClipSizeX
>= nEndX
- nStartX
? nClipSizeX
: nEndX
- nStartX
;
1590 nRangeSizeY
= nClipSizeY
>= nEndY
- nStartY
? nClipSizeY
: nEndY
- nStartY
;
1591 // When the source and destination areas intersect things may go wrong,
1592 // especially if the area contains references. This may produce data loss
1593 // (e.g. formulas that get wrong references), this scenario _must_ be avoided.
1594 ScRange
aSource( nClipStartX
, nClipStartY
, nStartTab
,
1595 nClipStartX
+ nClipSizeX
, nClipStartY
+ nClipSizeY
, nStartTab
);
1596 ScRange
aDest( nStartX
, nStartY
, nStartTab
,
1597 nStartX
+ nRangeSizeX
, nStartY
+ nRangeSizeY
, nStartTab
);
1598 if ( pOwnClip
->GetDocument()->IsCutMode() && aSource
.Intersects( aDest
) )
1599 pDlg
->SetCellShiftDisabled( CellShiftDisabledFlags::Down
| CellShiftDisabledFlags::Right
);
1602 //no conflict with intersecting ranges,
1603 //check if paste plus shift will fit on sheet
1604 //and disable shift-option if no fit
1605 CellShiftDisabledFlags nDisableShiftX
= CellShiftDisabledFlags::NONE
;
1606 CellShiftDisabledFlags nDisableShiftY
= CellShiftDisabledFlags::NONE
;
1608 //check if horizontal shift will fit
1609 if ( !rData
.GetDocument().IsBlockEmpty(
1610 rDoc
.MaxCol() - nRangeSizeX
, nStartY
,
1611 rDoc
.MaxCol(), nStartY
+ nRangeSizeY
,
1613 nDisableShiftX
= CellShiftDisabledFlags::Right
;
1615 //check if vertical shift will fit
1616 if ( !rData
.GetDocument().IsBlockEmpty(
1617 nStartX
, rDoc
.MaxRow() - nRangeSizeY
,
1618 nStartX
+ nRangeSizeX
, rDoc
.MaxRow(),
1620 nDisableShiftY
= CellShiftDisabledFlags::Down
;
1622 if ( nDisableShiftX
!= CellShiftDisabledFlags::NONE
|| nDisableShiftY
!= CellShiftDisabledFlags::NONE
)
1623 pDlg
->SetCellShiftDisabled( nDisableShiftX
| nDisableShiftY
);
1627 if (pDlg
->Execute() == RET_OK
)
1629 nFlags
= pDlg
->GetInsContentsCmdBits();
1630 nFunction
= pDlg
->GetFormulaCmdBits();
1631 bSkipEmpty
= pDlg
->IsSkipEmptyCells();
1632 bTranspose
= pDlg
->IsTranspose();
1633 bAsLink
= pDlg
->IsLink();
1634 eMoveMode
= pDlg
->GetMoveMode();
1638 pTabViewShell
->ErrorMessage(aTester
.GetMessageId());
1641 if( nFlags
!= InsertDeleteFlags::NONE
)
1644 weld::WaitObject
aWait( GetViewData().GetDialogParent() );
1645 if ( bAsLink
&& bOtherDoc
)
1646 pTabViewShell
->PasteFromSystem(SotClipboardFormatId::LINK
); // DDE insert
1649 pTabViewShell
->PasteFromClip( nFlags
, pOwnClip
->GetDocument(),
1650 nFunction
, bSkipEmpty
, bTranspose
, bAsLink
,
1651 eMoveMode
, InsertDeleteFlags::NONE
, true ); // allow warning dialog
1657 OUString aFlags
= FlagsToString( nFlags
);
1659 rReq
.AppendItem( SfxStringItem( FID_INS_CELL_CONTENTS
, aFlags
) );
1660 rReq
.AppendItem( SfxBoolItem( FN_PARAM_2
, bSkipEmpty
) );
1661 rReq
.AppendItem( SfxBoolItem( FN_PARAM_3
, bTranspose
) );
1662 rReq
.AppendItem( SfxBoolItem( FN_PARAM_4
, bAsLink
) );
1663 rReq
.AppendItem( SfxUInt16Item( FN_PARAM_1
, static_cast<sal_uInt16
>(nFunction
) ) );
1664 rReq
.AppendItem( SfxInt16Item( FN_PARAM_5
, static_cast<sal_Int16
>(eMoveMode
) ) );
1670 pTabViewShell
->CellContentChanged(); // => PasteFromXXX ???
1672 case SID_PASTE_ONLY_VALUE
:
1673 case SID_PASTE_ONLY_TEXT
:
1674 case SID_PASTE_ONLY_FORMULA
:
1676 if ( ScTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(GetViewData().GetActiveWin())) ) // own cell data
1678 rReq
.SetSlot( FID_INS_CELL_CONTENTS
);
1680 if ( nSlot
== SID_PASTE_ONLY_VALUE
)
1682 else if ( nSlot
== SID_PASTE_ONLY_TEXT
)
1686 rReq
.AppendItem( SfxStringItem( FID_INS_CELL_CONTENTS
, aFlags
) );
1687 ExecuteSlot( rReq
, GetInterface() );
1688 rReq
.SetReturnValue(SfxInt16Item(nSlot
, 1)); // 1 = success
1689 pTabViewShell
->CellContentChanged();
1692 rReq
.SetReturnValue(SfxInt16Item(nSlot
, 0)); // 0 = fail
1695 case SID_PASTE_TRANSPOSED
:
1697 if (ScTransferObj::GetOwnClipboard(
1698 ScTabViewShell::GetClipData(GetViewData().GetActiveWin()))) // own cell data
1700 rReq
.SetSlot(FID_INS_CELL_CONTENTS
);
1701 // By default content (values/numbers, strings, formulas and dates),
1702 // attributes and notes are pasted
1703 rReq
.AppendItem(SfxBoolItem(FN_PARAM_3
, true)); // transpose
1704 ExecuteSlot(rReq
, GetInterface());
1705 rReq
.SetReturnValue(SfxInt16Item(nSlot
, 1)); // 1 = success
1706 pTabViewShell
->CellContentChanged();
1709 rReq
.SetReturnValue(SfxInt16Item(nSlot
, 0)); // 0 = fail
1712 case SID_PASTE_AS_LINK
:
1714 if (ScTransferObj::GetOwnClipboard(
1715 ScTabViewShell::GetClipData(GetViewData().GetActiveWin()))) // own cell data
1717 rReq
.SetSlot(FID_INS_CELL_CONTENTS
);
1718 // paste links to values/numbers, strings, formulas and dates
1719 // do not paste attributes, notes and objects
1720 rReq
.AppendItem(SfxStringItem(FID_INS_CELL_CONTENTS
, u
"VSFD"_ustr
));
1721 rReq
.AppendItem(SfxBoolItem(FN_PARAM_4
, true)); // as link
1722 ExecuteSlot(rReq
, GetInterface());
1723 rReq
.SetReturnValue(SfxInt16Item(nSlot
, 1)); // 1 = success
1724 pTabViewShell
->CellContentChanged();
1727 rReq
.SetReturnValue(SfxInt16Item(nSlot
, 0)); // 0 = fail
1730 case SID_PASTE_TEXTIMPORT_DIALOG
:
1732 vcl::Window
* pWin
= GetViewData().GetActiveWin();
1733 TransferableDataHelper
aDataHelper(
1734 TransferableDataHelper::CreateFromSystemClipboard(pWin
));
1735 const uno::Reference
<datatransfer::XTransferable
>& xTransferable
1736 = aDataHelper
.GetTransferable();
1737 SotClipboardFormatId format
= SotClipboardFormatId::STRING
;
1738 bool bSuccess
= false;
1739 if (xTransferable
.is() && HasClipboardFormat(format
))
1741 OUString sStrBuffer
;
1742 bSuccess
= aDataHelper
.GetString(format
, sStrBuffer
);
1745 auto pStrm
= std::make_shared
<ScImportStringStream
>(sStrBuffer
);
1746 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
1747 VclPtr
<AbstractScImportAsciiDlg
> pDlg(pFact
->CreateScImportAsciiDlg(
1748 pWin
? pWin
->GetFrameWeld() : nullptr, OUString(), pStrm
.get(), SC_PASTETEXT
));
1752 if (GetViewData().GetSimpleArea(aRange
) == SC_MARK_SIMPLE
)
1754 nPosX
= aRange
.aStart
.Col();
1755 nPosY
= aRange
.aStart
.Row();
1759 nPosX
= GetViewData().GetCurX();
1760 nPosY
= GetViewData().GetCurY();
1762 ScAddress
aCellPos(nPosX
, nPosY
, GetViewData().GetTabNo());
1763 auto pObj
= std::make_shared
<ScImportExport
>(GetViewData().GetDocument(), aCellPos
);
1764 pObj
->SetOverwriting(true);
1765 if (pDlg
->Execute()) {
1766 ScAsciiOptions aOptions
;
1767 pDlg
->GetOptions(aOptions
);
1768 pDlg
->SaveParameters();
1769 pObj
->SetExtOptions(aOptions
);
1770 pObj
->ImportString(sStrBuffer
, format
);
1772 pDlg
->disposeOnce();
1773 rReq
.SetReturnValue(SfxInt16Item(nSlot
, 1)); // 1 = success, 0 = fail
1779 rReq
.SetReturnValue(SfxInt16Item(nSlot
, 0)); // 0 = fail
1784 case SID_PASTE_SPECIAL
:
1785 // differentiate between own cell data and draw objects/external data
1786 // this makes FID_INS_CELL_CONTENTS superfluous
1788 vcl::Window
* pWin
= GetViewData().GetActiveWin();
1789 css::uno::Reference
<css::datatransfer::XTransferable2
> xTransferable(ScTabViewShell::GetClipData(pWin
));
1791 // Clipboard-ID given as parameter? Basic "PasteSpecial(Format)"
1792 const SfxPoolItem
* pItem
=nullptr;
1794 pReqArgs
->GetItemState(nSlot
, true, &pItem
) == SfxItemState::SET
&&
1795 dynamic_cast<const SfxUInt32Item
*>( pItem
) != nullptr )
1797 SotClipboardFormatId nFormat
= static_cast<SotClipboardFormatId
>(static_cast<const SfxUInt32Item
*>(pItem
)->GetValue());
1800 weld::WaitObject
aWait( GetViewData().GetDialogParent() );
1801 bool bDraw
= ( ScDrawTransferObj::GetOwnClipboard(xTransferable
) != nullptr );
1802 if ( bDraw
&& nFormat
== SotClipboardFormatId::EMBED_SOURCE
)
1803 pTabViewShell
->PasteDraw();
1805 bRet
= pTabViewShell
->PasteFromSystem(nFormat
, true); // TRUE: no error messages
1810 rReq
.SetReturnValue(SfxInt16Item(nSlot
, 1)); // 1 = success, 0 = fail
1814 // if format is not available -> fallback to request without parameters
1820 if ( ScTransferObj::GetOwnClipboard(xTransferable
) ) // own cell data
1822 rReq
.SetSlot( FID_INS_CELL_CONTENTS
);
1823 ExecuteSlot( rReq
, GetInterface() );
1824 rReq
.SetReturnValue(SfxInt16Item(nSlot
, 1)); // 1 = success
1826 else // draw objects or external data
1828 bool bDraw
= ( ScDrawTransferObj::GetOwnClipboard(xTransferable
) != nullptr );
1830 SvxClipboardFormatItem
aFormats( SID_CLIPBOARD_FORMAT_ITEMS
);
1831 GetPossibleClipboardFormats( aFormats
);
1833 sal_uInt16 nFormatCount
= aFormats
.Count();
1836 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
1837 ScopedVclPtr
<SfxAbstractPasteDialog
> pDlg(pFact
->CreatePasteDialog(pTabViewShell
->GetFrameWeld()));
1838 for (sal_uInt16 i
=0; i
<nFormatCount
; i
++)
1840 SotClipboardFormatId nFormatId
= aFormats
.GetClipbrdFormatId( i
);
1841 OUString aName
= aFormats
.GetClipbrdFormatName( i
);
1842 // special case for paste dialog: '*' is replaced by object type
1843 if ( nFormatId
== SotClipboardFormatId::EMBED_SOURCE
)
1845 pDlg
->Insert( nFormatId
, aName
);
1848 SfxViewFrame
& rViewFrame
= pTabViewShell
->GetViewFrame();
1849 auto xFrame
= rViewFrame
.GetFrame().GetFrameInterface();
1850 const OUString
aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(xFrame
));
1851 auto aProperties
= vcl::CommandInfoProvider::GetCommandProperties(u
".uno:PasteTextImportDialog"_ustr
, aModuleName
);
1852 OUString
sLabel(vcl::CommandInfoProvider::GetTooltipLabelForCommand(aProperties
));
1853 pDlg
->InsertUno(u
".uno:PasteTextImportDialog"_ustr
, sLabel
);
1855 TransferableDataHelper
aDataHelper(
1856 TransferableDataHelper::CreateFromSystemClipboard( pWin
) );
1857 SotClipboardFormatId nFormat
= pDlg
->GetFormat( aDataHelper
.GetTransferable() );
1858 if (nFormat
!= SotClipboardFormatId::NONE
)
1861 weld::WaitObject
aWait( GetViewData().GetDialogParent() );
1862 if ( bDraw
&& nFormat
== SotClipboardFormatId::EMBED_SOURCE
)
1863 pTabViewShell
->PasteDraw();
1865 pTabViewShell
->PasteFromSystem(nFormat
);
1867 rReq
.SetReturnValue(SfxInt16Item(nSlot
, 1)); // 1 = success
1868 rReq
.AppendItem( SfxUInt32Item( nSlot
, static_cast<sal_uInt32
>(nFormat
) ) );
1873 rReq
.SetReturnValue(SfxInt16Item(nSlot
, 0)); // 0 = fail
1878 rReq
.SetReturnValue(SfxInt16Item(nSlot
, 0)); // 0 = fail
1882 pTabViewShell
->CellContentChanged(); // => PasteFromSystem() ???
1885 case SID_PASTE_UNFORMATTED
:
1886 // differentiate between own cell data and draw objects/external data
1887 // this makes FID_INS_CELL_CONTENTS superfluous
1889 weld::WaitObject
aWait( GetViewData().GetDialogParent() );
1891 // we should differentiate between SotClipboardFormatId::STRING and SotClipboardFormatId::STRING_TSVC,
1892 // and paste the SotClipboardFormatId::STRING_TSVC if it is available.
1893 // Which makes a difference if the clipboard contains cells with embedded line breaks.
1895 SotClipboardFormatId nFormat
= HasClipboardFormat( SotClipboardFormatId::STRING_TSVC
) ?
1896 SotClipboardFormatId::STRING_TSVC
: SotClipboardFormatId::STRING
;
1898 const bool bRet
= pTabViewShell
->PasteFromSystem(nFormat
, true); // TRUE: no error messages
1901 rReq
.SetReturnValue(SfxInt16Item(nSlot
, 1)); // 1 = success
1906 rReq
.SetReturnValue(SfxInt16Item(nSlot
, 0)); // 0 = fail
1909 pTabViewShell
->CellContentChanged(); // => PasteFromSystem() ???
1915 case FID_INS_ROWBRK
:
1916 pTabViewShell
->InsertPageBreak( false );
1920 case FID_INS_COLBRK
:
1921 pTabViewShell
->InsertPageBreak( true );
1925 case FID_DEL_ROWBRK
:
1926 pTabViewShell
->DeletePageBreak( false );
1930 case FID_DEL_COLBRK
:
1931 pTabViewShell
->DeletePageBreak( true );
1935 case SID_DETECTIVE_ADD_PRED
:
1936 pTabViewShell
->DetectiveAddPred();
1940 case SID_DETECTIVE_DEL_PRED
:
1941 pTabViewShell
->DetectiveDelPred();
1945 case SID_DETECTIVE_ADD_SUCC
:
1946 pTabViewShell
->DetectiveAddSucc();
1950 case SID_DETECTIVE_DEL_SUCC
:
1951 pTabViewShell
->DetectiveDelSucc();
1955 case SID_DETECTIVE_ADD_ERR
:
1956 pTabViewShell
->DetectiveAddError();
1960 case SID_DETECTIVE_INVALID
:
1961 pTabViewShell
->DetectiveMarkInvalid();
1965 case SID_DETECTIVE_REFRESH
:
1966 pTabViewShell
->DetectiveRefresh();
1970 case SID_DETECTIVE_MARK_PRED
:
1971 pTabViewShell
->DetectiveMarkPred();
1973 case SID_DETECTIVE_MARK_SUCC
:
1974 pTabViewShell
->DetectiveMarkSucc();
1976 case SID_INSERT_CURRENT_DATE
:
1977 pTabViewShell
->InsertCurrentTime(
1978 SvNumFormatType::DATE
, ScResId(STR_UNDO_INSERT_CURRENT_DATE
));
1980 case SID_INSERT_CURRENT_TIME
:
1981 pTabViewShell
->InsertCurrentTime(
1982 SvNumFormatType::TIME
, ScResId(STR_UNDO_INSERT_CURRENT_TIME
));
1985 case SID_SPELL_DIALOG
:
1987 SfxViewFrame
& rViewFrame
= pTabViewShell
->GetViewFrame();
1988 if( rReq
.GetArgs() )
1989 rViewFrame
.SetChildWindow( SID_SPELL_DIALOG
,
1990 static_cast< const SfxBoolItem
& >( rReq
.GetArgs()->
1991 Get( SID_SPELL_DIALOG
) ).GetValue() );
1993 rViewFrame
.ToggleChildWindow( SID_SPELL_DIALOG
);
1995 rViewFrame
.GetBindings().Invalidate( SID_SPELL_DIALOG
);
2000 case SID_HANGUL_HANJA_CONVERSION
:
2001 pTabViewShell
->DoHangulHanjaConversion();
2004 case SID_CHINESE_CONVERSION
:
2006 //open ChineseTranslationDialog
2007 Reference
< XComponentContext
> xContext(
2008 ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one
2011 Reference
< lang::XMultiComponentFactory
> xMCF( xContext
->getServiceManager() );
2014 Reference
< ui::dialogs::XExecutableDialog
> xDialog(
2015 xMCF
->createInstanceWithContext(
2016 u
"com.sun.star.linguistic2.ChineseTranslationDialog"_ustr
2019 Reference
< lang::XInitialization
> xInit( xDialog
, UNO_QUERY
);
2022 // initialize dialog
2023 uno::Sequence
<uno::Any
> aSeq(comphelper::InitAnyPropertySequence(
2025 {"ParentWindow", uno::Any(Reference
< awt::XWindow
>())}
2027 xInit
->initialize( aSeq
);
2030 sal_Int16 nDialogRet
= xDialog
->execute();
2031 if( RET_OK
== nDialogRet
)
2033 //get some parameters from the dialog
2034 bool bToSimplified
= true;
2035 bool bUseVariants
= true;
2036 bool bCommonTerms
= true;
2037 Reference
< beans::XPropertySet
> xProp( xDialog
, UNO_QUERY
);
2042 xProp
->getPropertyValue(u
"IsDirectionToSimplified"_ustr
) >>= bToSimplified
;
2043 xProp
->getPropertyValue(u
"IsUseCharacterVariants"_ustr
) >>= bUseVariants
;
2044 xProp
->getPropertyValue(u
"IsTranslateCommonTerms"_ustr
) >>= bCommonTerms
;
2051 //execute translation
2052 LanguageType eSourceLang
= bToSimplified
? LANGUAGE_CHINESE_TRADITIONAL
: LANGUAGE_CHINESE_SIMPLIFIED
;
2053 LanguageType eTargetLang
= bToSimplified
? LANGUAGE_CHINESE_SIMPLIFIED
: LANGUAGE_CHINESE_TRADITIONAL
;
2054 sal_Int32 nOptions
= bUseVariants
? i18n::TextConversionOption::USE_CHARACTER_VARIANTS
: 0;
2056 nOptions
|= i18n::TextConversionOption::CHARACTER_BY_CHARACTER
;
2058 vcl::Font aTargetFont
= OutputDevice::GetDefaultFont(
2059 DefaultFontType::CJK_SPREADSHEET
,
2060 eTargetLang
, GetDefaultFontFlags::OnlyOne
);
2061 ScConversionParam
aConvParam( SC_CONVERSION_CHINESE_TRANSL
,
2062 eSourceLang
, eTargetLang
, std::move(aTargetFont
), nOptions
, false );
2063 pTabViewShell
->DoSheetConversion( aConvParam
);
2066 Reference
< lang::XComponent
> xComponent( xDialog
, UNO_QUERY
);
2067 if( xComponent
.is() )
2068 xComponent
->dispose();
2074 case SID_CONVERT_FORMULA_TO_VALUE
:
2076 pTabViewShell
->ConvertFormulaToValue();
2080 pTabViewShell
->DoThesaurus();
2083 case SID_TOGGLE_REL
:
2084 pTabViewShell
->DoRefConversion();
2087 case SID_DEC_INDENT
:
2088 pTabViewShell
->ChangeIndent( false );
2090 case SID_INC_INDENT
:
2091 pTabViewShell
->ChangeIndent( true );
2096 CreateNameFlags nFlags
= pTabViewShell
->GetCreateNameFlags();
2098 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
2100 ScopedVclPtr
<AbstractScNameCreateDlg
> pDlg(pFact
->CreateScNameCreateDlg(pTabViewShell
->GetFrameWeld(), nFlags
));
2102 if( pDlg
->Execute() )
2104 pTabViewShell
->CreateNames(pDlg
->GetFlags());
2110 case SID_CONSOLIDATE
:
2112 const ScConsolidateItem
* pItem
;
2113 if ( pReqArgs
&& (pItem
=
2114 pReqArgs
->GetItemIfSet( SCITEM_CONSOLIDATEDATA
)) )
2116 const ScConsolidateParam
& rParam
= pItem
->GetData();
2118 pTabViewShell
->Consolidate( rParam
);
2119 GetViewData().GetDocument().SetConsolidateDlgData( std::unique_ptr
<ScConsolidateParam
>(new ScConsolidateParam(rParam
)) );
2123 #if HAVE_FEATURE_SCRIPTING
2124 else if (rReq
.IsAPI())
2125 SbxBase::SetError(ERRCODE_BASIC_BAD_PARAMETER
);
2130 case SID_INS_FUNCTION
:
2132 const SfxBoolItem
* pOkItem
= static_cast<const SfxBoolItem
*>(&pReqArgs
->Get( SID_DLG_RETOK
));
2134 if ( pOkItem
->GetValue() ) // OK
2137 const SfxStringItem
* pSItem
= &pReqArgs
->Get( SCITEM_STRING
);
2138 const SfxBoolItem
* pMatrixItem
= static_cast<const SfxBoolItem
*>(&pReqArgs
->Get( SID_DLG_MATRIX
));
2140 aFormula
+= pSItem
->GetValue();
2141 pScMod
->ActivateInputWindow( &aFormula
, pMatrixItem
->GetValue() );
2145 pScMod
->ActivateInputWindow();
2147 rReq
.Ignore(); // only SID_ENTER_STRING is recorded
2151 case FID_DEFINE_NAME
:
2152 case FID_DEFINE_CURRENT_NAME
:
2155 const SfxPoolItem
* pItem
;
2156 OUString aName
, aSymbol
, aAttrib
;
2158 if( pReqArgs
->HasItem( FID_DEFINE_NAME
, &pItem
) )
2159 aName
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
2161 if( pReqArgs
->HasItem( FN_PARAM_1
, &pItem
) )
2162 aSymbol
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
2164 if( pReqArgs
->HasItem( FN_PARAM_2
, &pItem
) )
2165 aAttrib
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
2167 if ( !aName
.isEmpty() && !aSymbol
.isEmpty() )
2169 if (pTabViewShell
->InsertName( aName
, aSymbol
, aAttrib
))
2171 #if HAVE_FEATURE_SCRIPTING
2173 SbxBase::SetError( ERRCODE_BASIC_BAD_PARAMETER
); // Basic-error
2179 sal_uInt16 nId
= ScNameDlgWrapper::GetChildWindowId();
2180 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
2181 SfxChildWindow
* pWnd
= rViewFrm
.GetChildWindow( nId
);
2183 pScMod
->SetRefDialog( nId
, pWnd
== nullptr );
2188 sal_uInt16 nId
= ScNameDefDlgWrapper::GetChildWindowId();
2189 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
2190 SfxChildWindow
* pWnd
= rViewFrm
.GetChildWindow( nId
);
2192 pScMod
->SetRefDialog( nId
, pWnd
== nullptr );
2196 case SID_OPENDLG_CONDFRMT
:
2197 case SID_OPENDLG_CURRENTCONDFRMT
:
2198 case SID_OPENDLG_COLORSCALE
:
2199 case SID_OPENDLG_DATABAR
:
2200 case SID_OPENDLG_ICONSET
:
2201 case SID_OPENDLG_CONDDATE
:
2203 sal_uInt32 nIndex
= sal_uInt32(-1);
2204 bool bManaged
= false;
2206 const std::shared_ptr
<ScCondFormatDlgData
>& rDlgItem(pTabViewShell
->getScCondFormatDlgItem());
2209 nIndex
= rDlgItem
->GetIndex();
2213 // Check if the Conditional Manager Dialog is editing or adding
2214 // conditional format item.
2217 sal_uInt16 nId
= ScCondFormatDlgWrapper::GetChildWindowId();
2218 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
2219 SfxChildWindow
* pWnd
= rViewFrm
.GetChildWindow( nId
);
2221 pScMod
->SetRefDialog( nId
, pWnd
== nullptr );
2225 ScRangeList aRangeList
;
2226 ScViewData
& rData
= GetViewData();
2227 rData
.GetMarkData().FillRangeListWithMarks(&aRangeList
, false);
2229 ScDocument
& rDoc
= GetViewData().GetDocument();
2230 if(rDoc
.IsTabProtected(rData
.GetTabNo()))
2232 pTabViewShell
->ErrorMessage( STR_ERR_CONDFORMAT_PROTECTED
);
2236 ScAddress
aPos(rData
.GetCurX(), rData
.GetCurY(), rData
.GetTabNo());
2237 if(aRangeList
.empty())
2239 aRangeList
.push_back(ScRange(aPos
));
2242 // try to find an existing conditional format
2243 const ScPatternAttr
* pPattern
= rDoc
.GetPattern(aPos
.Col(), aPos
.Row(), aPos
.Tab());
2244 ScConditionalFormatList
* pList
= rDoc
.GetCondFormList(aPos
.Tab());
2245 const ScCondFormatIndexes
& rCondFormats
= pPattern
->GetItem(ATTR_CONDITIONAL
).GetCondFormatData();
2246 bool bContainsCondFormat
= !rCondFormats
.empty();
2247 bool bCondFormatDlg
= false;
2248 bool bContainsExistingCondFormat
= false;
2249 if(bContainsCondFormat
)
2251 for (const auto& rCondFormat
: rCondFormats
)
2253 // check if at least one existing conditional format has the same range
2254 const ScConditionalFormat
* pCondFormat
= pList
->GetFormat(rCondFormat
);
2258 bContainsExistingCondFormat
= true;
2259 const ScRangeList
& rCondFormatRange
= pCondFormat
->GetRange();
2260 if(rCondFormatRange
== aRangeList
)
2262 // found a matching range, edit this conditional format
2263 bCondFormatDlg
= true;
2264 nIndex
= pCondFormat
->GetKey();
2270 // do we have a parameter with the conditional formatting type?
2271 const SfxInt16Item
* pParam
= rReq
.GetArg
<SfxInt16Item
>(FN_PARAM_1
);
2274 auto pFormat
= std::make_unique
<ScConditionalFormat
>(0, &rDoc
);
2275 pFormat
->SetRange(aRangeList
);
2277 if (nSlot
== SID_OPENDLG_ICONSET
)
2279 ScIconSetType eIconSetType
= limit_cast
<ScIconSetType
>(pParam
->GetValue(), IconSet_3Arrows
, IconSet_5Boxes
);
2280 const int nSteps
= ScIconSetFormat::getIconSetElements(eIconSetType
);
2282 ScIconSetFormat
* pEntry
= new ScIconSetFormat(&rDoc
);
2283 ScIconSetFormatData
* pIconSetFormatData
= new ScIconSetFormatData(eIconSetType
);
2285 pIconSetFormatData
->m_Entries
.emplace_back(new ScColorScaleEntry(0, COL_RED
, COLORSCALE_PERCENT
));
2286 pIconSetFormatData
->m_Entries
.emplace_back(new ScColorScaleEntry(round(100. / nSteps
), COL_BROWN
, COLORSCALE_PERCENT
));
2287 pIconSetFormatData
->m_Entries
.emplace_back(new ScColorScaleEntry(round(200. / nSteps
), COL_YELLOW
, COLORSCALE_PERCENT
));
2289 pIconSetFormatData
->m_Entries
.emplace_back(new ScColorScaleEntry(round(300. / nSteps
), COL_WHITE
, COLORSCALE_PERCENT
));
2291 pIconSetFormatData
->m_Entries
.emplace_back(new ScColorScaleEntry(round(400. / nSteps
), COL_GREEN
, COLORSCALE_PERCENT
));
2293 pEntry
->SetIconSetData(pIconSetFormatData
);
2294 pFormat
->AddEntry(pEntry
);
2296 else if (nSlot
== SID_OPENDLG_COLORSCALE
)
2298 typedef std::tuple
<double, Color
, ScColorScaleEntryType
> ScaleEntry
;
2299 static std::vector
<std::vector
<ScaleEntry
>> aScaleThemes
=
2302 { 0, Color(0xF8696B), COLORSCALE_MIN
},
2303 { 0, Color(0x63BE7B), COLORSCALE_MAX
},
2304 { 50, Color(0xFFEB84), COLORSCALE_PERCENTILE
}
2307 { 0, Color(0x63BE7B), COLORSCALE_MIN
},
2308 { 0, Color(0xF8696B), COLORSCALE_MAX
},
2309 { 50, Color(0xFFEB84), COLORSCALE_PERCENTILE
}
2312 { 0, Color(0xF8696B), COLORSCALE_MIN
},
2313 { 0, Color(0x63BE7B), COLORSCALE_MAX
},
2314 { 50, Color(0xFCFCFF), COLORSCALE_PERCENTILE
}
2317 { 0, Color(0x63BE7B), COLORSCALE_MIN
},
2318 { 0, Color(0xF8696B), COLORSCALE_MAX
},
2319 { 50, Color(0xFCFCFF), COLORSCALE_PERCENTILE
}
2322 { 0, Color(0xF8696B), COLORSCALE_MIN
},
2323 { 0, Color(0x5A8AC6), COLORSCALE_MAX
},
2324 { 50, Color(0xFCFCFF), COLORSCALE_PERCENTILE
}
2327 { 0, Color(0x5A8AC6), COLORSCALE_MIN
},
2328 { 0, Color(0xF8696B), COLORSCALE_MAX
},
2329 { 50, Color(0xFCFCFF), COLORSCALE_PERCENTILE
}
2332 { 0, Color(0xF8696B), COLORSCALE_MIN
},
2333 { 0, Color(0xFCFCFF), COLORSCALE_MAX
}
2336 { 0, Color(0xFCFCFF), COLORSCALE_MIN
},
2337 { 0, Color(0xF8696B), COLORSCALE_MAX
}
2340 { 0, Color(0x63BE7B), COLORSCALE_MIN
},
2341 { 0, Color(0xFCFCFF), COLORSCALE_MAX
}
2344 { 0, Color(0xFCFCFF), COLORSCALE_MIN
},
2345 { 0, Color(0x63BE7B), COLORSCALE_MAX
}
2348 { 0, Color(0x63BE7B), COLORSCALE_MIN
},
2349 { 0, Color(0xFFEF9C), COLORSCALE_MAX
}
2352 { 0, Color(0xFFEF9C), COLORSCALE_MIN
},
2353 { 0, Color(0x63BE7B), COLORSCALE_MAX
}
2357 sal_uInt16 nTheme
= pParam
->GetValue();
2358 if (nTheme
< aScaleThemes
.size())
2360 ScColorScaleFormat
* pFormatEntry
= new ScColorScaleFormat(&rDoc
);
2362 auto& aTheme
= aScaleThemes
[nTheme
];
2364 ScColorScaleEntry
* pMin
= new ScColorScaleEntry(std::get
<0>(aTheme
[0]), std::get
<1>(aTheme
[0]), std::get
<2>(aTheme
[0]));
2365 ScColorScaleEntry
* pMax
= new ScColorScaleEntry(std::get
<0>(aTheme
[1]), std::get
<1>(aTheme
[1]), std::get
<2>(aTheme
[1]));
2367 pFormatEntry
->AddEntry(pMin
);
2369 // COLORSCALE_PERCENTILE has to be in the middle
2370 if (aTheme
.size() > 2)
2372 ScColorScaleEntry
* pPer
= new ScColorScaleEntry(std::get
<0>(aTheme
[2]), std::get
<1>(aTheme
[2]), std::get
<2>(aTheme
[2]));
2373 pFormatEntry
->AddEntry(pPer
);
2376 pFormatEntry
->AddEntry(pMax
);
2378 pFormat
->AddEntry(pFormatEntry
);
2382 else if (nSlot
== SID_OPENDLG_DATABAR
)
2384 typedef std::tuple
<Color
, bool> DatabarEntry
;
2385 static std::vector
<DatabarEntry
> aDatabarThemes
=
2387 { Color(0x638EC6), true },
2388 { Color(0x63C384), true },
2389 { Color(0xFF555A), true },
2390 { Color(0xFFB628), true },
2391 { Color(0x008AEF), true },
2392 { Color(0xD6007B), true },
2393 { Color(0x638EC6), false },
2394 { Color(0x63C384), false },
2395 { Color(0xFF555A), false },
2396 { Color(0xFFB628), false },
2397 { Color(0x008AEF), false },
2398 { Color(0xD6007B), false }
2401 sal_uInt16 nTheme
= pParam
->GetValue();
2402 if (nTheme
< aDatabarThemes
.size())
2404 ScDataBarFormat
* pFormatEntry
= new ScDataBarFormat(&rDoc
);
2406 auto& aTheme
= aDatabarThemes
[nTheme
];
2408 ScDataBarFormatData
* pData
= new ScDataBarFormatData();
2409 pData
->maPositiveColor
= std::get
<0>(aTheme
);
2410 pData
->mbGradient
= std::get
<1>(aTheme
);
2411 pData
->mxNegativeColor
= Color(0xFF0000);
2412 pData
->mpLowerLimit
.reset(new ScColorScaleEntry(0, 0, COLORSCALE_AUTO
));
2413 pData
->mpUpperLimit
.reset(new ScColorScaleEntry(0, 0, COLORSCALE_AUTO
));
2415 pFormatEntry
->SetDataBarData(pData
);
2417 pFormat
->AddEntry(pFormatEntry
);
2421 // use the new conditional formatting
2422 GetViewData().GetDocShell()->GetDocFunc().ReplaceConditionalFormat(nIndex
, std::move(pFormat
), aPos
.Tab(), aRangeList
);
2427 // if not found a conditional format ask whether we should edit one of the existing
2428 // or should create a new overlapping conditional format
2429 if(bContainsCondFormat
&& !bCondFormatDlg
&& bContainsExistingCondFormat
)
2431 std::shared_ptr
<weld::MessageDialog
> xQueryBox(Application::CreateMessageDialog(pTabViewShell
->GetFrameWeld(),
2432 VclMessageType::Question
, VclButtonsType::YesNo
,
2433 ScResId(STR_EDIT_EXISTING_COND_FORMATS
), pTabViewShell
));
2434 xQueryBox
->set_default_response(RET_YES
);
2435 xQueryBox
->runAsync(xQueryBox
, [this, nIndex
, nSlot
, aPos
, pTabViewShell
] (int nResult
) {
2436 sal_uInt32 nNewIndex
= nIndex
;
2437 bool bNewCondFormatDlg
= false;
2440 ScDocument
& rInnerDoc
= GetViewData().GetDocument();
2441 const ScPatternAttr
* pInnerPattern
= rInnerDoc
.GetPattern(aPos
.Col(), aPos
.Row(), aPos
.Tab());
2442 ScConditionalFormatList
* pInnerList
= rInnerDoc
.GetCondFormList(aPos
.Tab());
2443 const ScCondFormatIndexes
& rInnerCondFormats
= pInnerPattern
->GetItem(ATTR_CONDITIONAL
).GetCondFormatData();
2444 bool bInnerContainsCondFormat
= !rInnerCondFormats
.empty();
2446 bool bEditExisting
= nResult
== RET_YES
;
2449 // differentiate between ranges where one conditional format is defined
2450 // and several formats are defined
2451 // if we have only one => open the cond format dlg to edit it
2452 // otherwise open the manage cond format dlg
2453 if (rInnerCondFormats
.size() == 1)
2455 const ScConditionalFormat
* pCondFormat
= pInnerList
->GetFormat(rInnerCondFormats
[0]);
2456 assert(pCondFormat
);
2457 nNewIndex
= pCondFormat
->GetKey();
2458 bNewCondFormatDlg
= true;
2462 // Queue message to open Conditional Format Manager Dialog.
2463 GetViewData().GetDispatcher().Execute(
2464 SID_OPENDLG_CONDFRMT_MANAGER
, SfxCallMode::ASYNCHRON
);
2470 // define an overlapping conditional format
2471 assert(pInnerList
->GetFormat(rInnerCondFormats
[0]));
2472 bNewCondFormatDlg
= true;
2475 HandleConditionalFormat(nNewIndex
, bNewCondFormatDlg
, bInnerContainsCondFormat
,
2476 nSlot
, pTabViewShell
);
2481 HandleConditionalFormat(nIndex
, bCondFormatDlg
, bContainsCondFormat
, nSlot
, pTabViewShell
);
2486 case SID_DEFINE_COLROWNAMERANGES
:
2489 sal_uInt16 nId
= ScColRowNameRangesDlgWrapper::GetChildWindowId();
2490 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
2491 SfxChildWindow
* pWnd
= rViewFrm
.GetChildWindow( nId
);
2493 pScMod
->SetRefDialog( nId
, pWnd
== nullptr );
2498 case SID_UPDATECHART
:
2504 const SfxPoolItem
* pItem
;
2506 if( pReqArgs
->HasItem( SID_UPDATECHART
, &pItem
) )
2507 bAll
= static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
2510 pTabViewShell
->UpdateCharts( bAll
);
2512 if( ! rReq
.IsAPI() )
2514 rReq
.AppendItem( SfxBoolItem( SID_UPDATECHART
, bAll
) );
2523 const ScTabOpItem
& rItem
=
2524 static_cast<const ScTabOpItem
&>(
2525 pReqArgs
->Get( SID_TABOP
));
2527 pTabViewShell
->TabOp( rItem
.GetData() );
2529 rReq
.Done( *pReqArgs
);
2536 const ScSolveItem
& rItem
=
2537 pReqArgs
->Get( SCITEM_SOLVEDATA
);
2539 pTabViewShell
->Solve( rItem
.GetData() );
2541 rReq
.Done( *pReqArgs
);
2545 case FID_INSERT_NAME
:
2547 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
2549 ScopedVclPtr
<AbstractScNamePasteDlg
> pDlg(pFact
->CreateScNamePasteDlg(pTabViewShell
->GetFrameWeld(), GetViewData().GetDocShell()));
2550 switch( pDlg
->Execute() )
2552 case BTN_PASTE_LIST
:
2553 pTabViewShell
->InsertNameList();
2555 case BTN_PASTE_NAME
:
2557 ScInputHandler
* pHdl
= pScMod
->GetInputHdl( pTabViewShell
);
2560 // "=" in KeyEvent, switches to input-mode
2561 (void)pScMod
->InputKeyEvent( KeyEvent('=', vcl::KeyCode()) );
2563 std::vector
<OUString
> aNames
= pDlg
->GetSelectedNames();
2564 if (!aNames
.empty())
2566 OUStringBuffer aBuffer
;
2567 for (const auto& rName
: aNames
)
2569 aBuffer
.append(rName
+ " ");
2571 pHdl
->InsertFunction( aBuffer
.makeStringAndClear(), false ); // without "()"
2580 case SID_RANGE_NOTETEXT
:
2583 const SfxStringItem
& rTextItem
= pReqArgs
->Get( SID_RANGE_NOTETEXT
);
2585 // always cursor position
2586 ScAddress
aPos( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() );
2587 pTabViewShell
->SetNoteText( aPos
, rTextItem
.GetValue() );
2592 case SID_INSERT_POSTIT
:
2593 case SID_EDIT_POSTIT
:
2595 const SvxPostItTextItem
* pTextItem
;
2596 if ( pReqArgs
&& (pTextItem
= pReqArgs
->GetItemIfSet( SID_ATTR_POSTIT_TEXT
)) )
2599 // SID_ATTR_POSTIT_ID only argument for SID_EDIT_POSTIT
2600 if (const SvxPostItIdItem
* pCellId
= pReqArgs
->GetItemIfSet( SID_ATTR_POSTIT_ID
))
2601 aCellId
= pCellId
->GetValue();
2603 const SvxPostItAuthorItem
* pAuthorItem
= pReqArgs
->GetItem( SID_ATTR_POSTIT_AUTHOR
);
2604 const SvxPostItDateItem
* pDateItem
= pReqArgs
->GetItem( SID_ATTR_POSTIT_DATE
);
2606 if (!aCellId
.isEmpty())
2608 SetTabNoAndCursor( GetViewData(), aCellId
);
2611 ScAddress
aPos( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() );
2612 pTabViewShell
->ReplaceNote( aPos
, pTextItem
->GetValue(),
2613 pAuthorItem
? &pAuthorItem
->GetValue() : nullptr,
2614 pDateItem
? &pDateItem
->GetValue() : nullptr );
2616 else if (!comphelper::LibreOfficeKit::isActive() || comphelper::LibreOfficeKit::isTiledAnnotations())
2618 pTabViewShell
->EditNote(); // note object to edit
2624 case FID_NOTE_VISIBLE
:
2626 ScDocument
& rDoc
= GetViewData().GetDocument();
2627 ScAddress
aPos( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() );
2628 if( ScPostIt
* pNote
= rDoc
.GetNote(aPos
) )
2631 const SfxPoolItem
* pItem
;
2632 if ( pReqArgs
&& (pReqArgs
->GetItemState( FID_NOTE_VISIBLE
, true, &pItem
) == SfxItemState::SET
) )
2633 bShow
= static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
2635 bShow
= !pNote
->IsCaptionShown();
2637 pTabViewShell
->ShowNote( bShow
);
2640 rReq
.AppendItem( SfxBoolItem( FID_NOTE_VISIBLE
, bShow
) );
2643 rBindings
.Invalidate( FID_NOTE_VISIBLE
);
2653 bool bShowNote
= nSlot
== FID_SHOW_NOTE
;
2654 ScViewData
& rData
= GetViewData();
2655 ScDocument
& rDoc
= rData
.GetDocument();
2656 ScMarkData
& rMark
= rData
.GetMarkData();
2658 if (!rMark
.IsMarked() && !rMark
.IsMultiMarked())
2660 // Check current cell
2661 ScAddress
aPos( rData
.GetCurX(), rData
.GetCurY(), rData
.GetTabNo() );
2662 if( rDoc
.GetNote(aPos
) )
2664 rData
.GetDocShell()->GetDocFunc().ShowNote( aPos
, bShowNote
);
2669 // Check selection range
2671 ScRangeListRef aRangesRef
;
2672 rData
.GetMultiArea(aRangesRef
);
2673 const ScRangeList aRanges
= *aRangesRef
;
2675 OUString aUndo
= ScResId( bShowNote
? STR_UNDO_SHOWNOTE
: STR_UNDO_HIDENOTE
);
2676 rData
.GetDocShell()->GetUndoManager()->EnterListAction( aUndo
, aUndo
, 0, rData
.GetViewShell()->GetViewShellId() );
2678 for (auto const& rTab
: rMark
.GetSelectedTabs())
2681 std::vector
<sc::NoteEntry
> aNotes
;
2682 rDoc
.GetAllNoteEntries(rTab
, aNotes
);
2684 for (const sc::NoteEntry
& rNote
: aNotes
)
2686 // check if note is in our selection range
2687 const ScAddress
& rAdr
= rNote
.maPos
;
2688 const ScRange
* rRange
= aRanges
.Find(rAdr
);
2692 // check if cell is editable
2693 const SCTAB nRangeTab
= rRange
->aStart
.Tab();
2694 if (rDoc
.IsBlockEditable( nRangeTab
, rAdr
.Col(), rAdr
.Row(), rAdr
.Col(), rAdr
.Row() ))
2696 rData
.GetDocShell()->GetDocFunc().ShowNote( rAdr
, bShowNote
);
2702 rData
.GetDocShell()->GetUndoManager()->LeaveListAction();
2707 rBindings
.Invalidate( nSlot
);
2716 case FID_SHOW_ALL_NOTES
:
2717 case FID_HIDE_ALL_NOTES
:
2719 bool bShowNote
= nSlot
== FID_SHOW_ALL_NOTES
;
2720 ScViewData
& rData
= GetViewData();
2721 ScMarkData
& rMark
= rData
.GetMarkData();
2722 ScDocument
& rDoc
= rData
.GetDocument();
2723 std::vector
<sc::NoteEntry
> aNotes
;
2725 OUString aUndo
= ScResId( bShowNote
? STR_UNDO_SHOWALLNOTES
: STR_UNDO_HIDEALLNOTES
);
2726 rData
.GetDocShell()->GetUndoManager()->EnterListAction( aUndo
, aUndo
, 0, rData
.GetViewShell()->GetViewShellId() );
2728 for (auto const& rTab
: rMark
.GetSelectedTabs())
2730 rDoc
.GetAllNoteEntries(rTab
, aNotes
);
2733 for (const sc::NoteEntry
& rNote
: aNotes
)
2735 const ScAddress
& rAdr
= rNote
.maPos
;
2736 rData
.GetDocShell()->GetDocFunc().ShowNote( rAdr
, bShowNote
);
2739 rData
.GetDocShell()->GetUndoManager()->LeaveListAction();
2743 case SID_TOGGLE_NOTES
:
2745 ScViewData
& rData
= GetViewData();
2746 ScMarkData
& rMark
= rData
.GetMarkData();
2747 ScDocument
& rDoc
= rData
.GetDocument();
2748 ScRangeList aRanges
;
2749 std::vector
<sc::NoteEntry
> aNotes
;
2751 for (auto const& rTab
: rMark
.GetSelectedTabs())
2752 aRanges
.push_back(ScRange(0,0,rTab
,rDoc
.MaxCol(),rDoc
.MaxRow(),rTab
));
2754 CommentCaptionState eState
= rDoc
.GetAllNoteCaptionsState( aRanges
);
2755 rDoc
.GetNotesInRange(aRanges
, aNotes
);
2756 bool bShowNote
= (eState
== ALLHIDDEN
|| eState
== MIXED
);
2758 OUString aUndo
= ScResId( bShowNote
? STR_UNDO_SHOWALLNOTES
: STR_UNDO_HIDEALLNOTES
);
2759 rData
.GetDocShell()->GetUndoManager()->EnterListAction( aUndo
, aUndo
, 0, rData
.GetViewShell()->GetViewShellId() );
2761 for(const auto& rNote
: aNotes
)
2763 const ScAddress
& rAdr
= rNote
.maPos
;
2764 rData
.GetDocShell()->GetDocFunc().ShowNote( rAdr
, bShowNote
);
2767 rData
.GetDocShell()->GetUndoManager()->LeaveListAction();
2770 rReq
.AppendItem( SfxBoolItem( SID_TOGGLE_NOTES
, bShowNote
) );
2773 rBindings
.Invalidate( SID_TOGGLE_NOTES
);
2777 case SID_DELETE_NOTE
:
2779 const SvxPostItIdItem
* pIdItem
;
2780 // If Id is mentioned, select the appropriate cell first
2781 if ( pReqArgs
&& (pIdItem
= pReqArgs
->GetItemIfSet( SID_ATTR_POSTIT_ID
)) )
2783 const OUString
& aCellId
= pIdItem
->GetValue();
2784 if (!aCellId
.isEmpty())
2786 SetTabNoAndCursor( GetViewData(), aCellId
);
2790 pTabViewShell
->DeleteContents( InsertDeleteFlags::NOTE
); // delete all notes in selection
2795 case FID_DELETE_ALL_NOTES
:
2797 ScViewData
& rData
= GetViewData();
2798 ScMarkData
& rMark
= rData
.GetMarkData();
2799 ScDocument
& rDoc
= rData
.GetDocument();
2800 ScMarkData
aNewMark(rDoc
.GetSheetLimits());
2801 ScRangeList aRangeList
;
2803 for (auto const& rTab
: rMark
.GetSelectedTabs())
2805 aRangeList
.push_back(ScRange(0,0,rTab
,rDoc
.MaxCol(),rDoc
.MaxRow(),rTab
));
2808 aNewMark
.MarkFromRangeList( aRangeList
, true );
2809 rData
.GetDocShell()->GetDocFunc().DeleteContents(aNewMark
, InsertDeleteFlags::NOTE
, true, false );
2814 if( pReqArgs
!= nullptr )
2816 OUString aChars
, aFontName
;
2817 const SfxItemSet
*pArgs
= rReq
.GetArgs();
2818 const SfxPoolItem
* pItem
= nullptr;
2820 pArgs
->GetItemState(SID_CHARMAP
, false, &pItem
);
2823 const SfxStringItem
* pStringItem
= dynamic_cast<const SfxStringItem
*>( pItem
);
2825 aChars
= pStringItem
->GetValue();
2826 const SfxStringItem
* pFontItem
=
2827 pArgs
->GetItemIfSet( SID_ATTR_SPECIALCHAR
, false);
2829 aFontName
= pFontItem
->GetValue();
2832 if ( !aChars
.isEmpty() )
2835 pTabViewShell
->GetSelectionPattern()->fillFontOnly(aFont
, nullptr, nullptr, nullptr,
2836 pTabViewShell
->GetSelectionScriptType() );
2837 if ( !aFontName
.isEmpty() )
2838 aFont
= vcl::Font( aFontName
, Size(1,1) );
2839 pTabViewShell
->InsertSpecialChar( aChars
, aFont
);
2840 if( ! rReq
.IsAPI() )
2846 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
2848 // font color doesn't matter here
2850 pTabViewShell
->GetSelectionPattern()->fillFontOnly(aCurFont
, nullptr, nullptr, nullptr,
2851 pTabViewShell
->GetSelectionScriptType());
2853 SfxAllItemSet
aSet( GetPool() );
2854 aSet
.Put( SfxBoolItem( FN_PARAM_1
, false ) );
2855 aSet
.Put( SvxFontItem( aCurFont
.GetFamilyType(), aCurFont
.GetFamilyName(), aCurFont
.GetStyleName(), aCurFont
.GetPitch(), aCurFont
.GetCharSet(), GetPool().GetWhichIDFromSlotID(SID_ATTR_CHAR_FONT
) ) );
2856 SfxViewFrame
& rViewFrame
= pTabViewShell
->GetViewFrame();
2857 auto xFrame
= rViewFrame
.GetFrame().GetFrameInterface();
2858 VclPtr
<SfxAbstractDialog
> pDlg(pFact
->CreateCharMapDialog(pTabViewShell
->GetFrameWeld(), aSet
, xFrame
));
2859 pDlg
->StartExecuteAsync(
2860 [pDlg
] (sal_Int32
/*nResult*/)->void
2862 pDlg
->disposeOnce();
2868 case SID_SELECT_SCENARIO
:
2874 const SfxStringItem
& rItem
= pReqArgs
->Get(SID_SELECT_SCENARIO
);
2875 pTabViewShell
->UseScenario(rItem
.GetValue());
2876 //! why should the return value be valid?!?!
2877 rReq
.SetReturnValue(SfxStringItem(SID_SELECT_SCENARIO
, rItem
.GetValue()));
2883 case SID_HYPERLINK_SETLINK
:
2886 const SfxPoolItem
* pItem
;
2887 if( pReqArgs
->HasItem( SID_HYPERLINK_SETLINK
, &pItem
) )
2889 const SvxHyperlinkItem
* pHyper
= static_cast<const SvxHyperlinkItem
*>(pItem
);
2890 const OUString
& rName
= pHyper
->GetName();
2891 const OUString
& rURL
= pHyper
->GetURL();
2892 const OUString
& rTarget
= pHyper
->GetTargetFrame();
2893 sal_uInt16 nType
= static_cast<sal_uInt16
>(pHyper
->GetInsertMode());
2895 pTabViewShell
->InsertURL( rName
, rURL
, rTarget
, nType
);
2903 case SID_OPENDLG_CONDFRMT_MANAGER
:
2904 case SID_OPENDLG_CURRENTCONDFRMT_MANAGER
:
2906 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
2908 ScViewData
& rData
= GetViewData();
2909 ScDocument
& rDoc
= rData
.GetDocument();
2911 if (rDoc
.IsTabProtected(rData
.GetTabNo()))
2913 pTabViewShell
->ErrorMessage( STR_ERR_CONDFORMAT_PROTECTED
);
2917 ScAddress
aPos(rData
.GetCurX(), rData
.GetCurY(), rData
.GetTabNo());
2919 ScConditionalFormatList
* pList
= nullptr;
2920 const std::shared_ptr
<ScCondFormatDlgData
>& rDlgItem(pTabViewShell
->getScCondFormatDlgItem());
2923 pList
= rDlgItem
->GetConditionalFormatList();
2927 pList
= rDoc
.GetCondFormList( aPos
.Tab() );
2929 VclPtr
<AbstractScCondFormatManagerDlg
> pDlg(pFact
->CreateScCondFormatMgrDlg(
2930 pTabViewShell
->GetFrameWeld(), rDoc
, pList
));
2933 pDlg
->SetModified();
2935 pDlg
->StartExecuteAsync(
2936 [this, pDlg
, &rData
, pTabViewShell
, rDlgItem
, aPos
](sal_Int32 nRet
)
2938 std::unique_ptr
<ScConditionalFormatList
> pCondFormatList
2939 = pDlg
->GetConditionalFormatList();
2940 if (nRet
== RET_OK
&& pDlg
->CondFormatsChanged())
2942 rData
.GetDocShell()->GetDocFunc().SetConditionalFormatList(
2943 pCondFormatList
.release(), aPos
.Tab());
2945 else if (nRet
== DLG_RET_ADD
)
2947 // Put the xml string parameter to initialize the
2948 // Conditional Format Dialog. ( add new )
2949 pTabViewShell
->setScCondFormatDlgItem(
2950 std::make_shared
<ScCondFormatDlgData
>(
2951 std::shared_ptr
<ScConditionalFormatList
>(
2952 pCondFormatList
.release()),
2954 // Queue message to open Conditional Format Dialog
2955 GetViewData().GetDispatcher().Execute(SID_OPENDLG_CONDFRMT
,
2956 SfxCallMode::ASYNCHRON
);
2958 else if (nRet
== DLG_RET_EDIT
)
2960 ScConditionalFormat
* pFormat
= pDlg
->GetCondFormatSelected();
2961 sal_uInt32 nIndex
= pFormat
? pFormat
->GetKey() : sal_uInt32(-1);
2962 // Put the xml string parameter to initialize the
2963 // Conditional Format Dialog. ( edit selected conditional format )
2964 pTabViewShell
->setScCondFormatDlgItem(
2965 std::make_shared
<ScCondFormatDlgData
>(
2966 std::shared_ptr
<ScConditionalFormatList
>(
2967 pCondFormatList
.release()),
2969 // Queue message to open Conditional Format Dialog
2970 GetViewData().GetDispatcher().Execute(SID_OPENDLG_CONDFRMT
,
2971 SfxCallMode::ASYNCHRON
);
2974 pCondFormatList
.reset();
2977 pTabViewShell
->setScCondFormatDlgItem(nullptr);
2979 pDlg
->disposeOnce();
2984 case SID_EXTERNAL_SOURCE
:
2986 const SfxStringItem
* pFile
= rReq
.GetArg
<SfxStringItem
>(SID_FILE_NAME
);
2987 const SfxStringItem
* pSource
= rReq
.GetArg
<SfxStringItem
>(FN_PARAM_1
);
2988 if ( pFile
&& pSource
)
2994 sal_Int32 nRefreshDelaySeconds
=0;
2996 aFile
= pFile
->GetValue();
2997 aSource
= pSource
->GetValue();
2998 const SfxStringItem
* pFilter
= rReq
.GetArg
<SfxStringItem
>(SID_FILTER_NAME
);
3000 aFilter
= pFilter
->GetValue();
3001 const SfxStringItem
* pOptions
= rReq
.GetArg
<SfxStringItem
>(SID_FILE_FILTEROPTIONS
);
3003 aOptions
= pOptions
->GetValue();
3004 const SfxUInt32Item
* pRefresh
= rReq
.GetArg
<SfxUInt32Item
>(FN_PARAM_2
);
3006 nRefreshDelaySeconds
= pRefresh
->GetValue();
3008 ExecuteExternalSource( aFile
, aFilter
, aOptions
, aSource
, nRefreshDelaySeconds
, rReq
);
3012 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
3014 pImpl
->m_pLinkedDlg
.disposeAndClear();
3015 pImpl
->m_pLinkedDlg
=
3016 pFact
->CreateScLinkedAreaDlg(pTabViewShell
->GetFrameWeld());
3017 delete pImpl
->m_pRequest
;
3018 pImpl
->m_pRequest
= new SfxRequest( rReq
);
3019 OUString sFile
, sFilter
, sOptions
, sSource
;
3020 sal_Int32 nRefreshDelaySeconds
= 0;
3021 if (pImpl
->m_pLinkedDlg
->Execute() == RET_OK
)
3023 sFile
= pImpl
->m_pLinkedDlg
->GetURL();
3024 sFilter
= pImpl
->m_pLinkedDlg
->GetFilter();
3025 sOptions
= pImpl
->m_pLinkedDlg
->GetOptions();
3026 sSource
= pImpl
->m_pLinkedDlg
->GetSource();
3027 nRefreshDelaySeconds
= pImpl
->m_pLinkedDlg
->GetRefreshDelaySeconds();
3028 if ( !sFile
.isEmpty() )
3029 pImpl
->m_pRequest
->AppendItem( SfxStringItem( SID_FILE_NAME
, sFile
) );
3030 if ( !sFilter
.isEmpty() )
3031 pImpl
->m_pRequest
->AppendItem( SfxStringItem( SID_FILTER_NAME
, sFilter
) );
3032 if ( !sOptions
.isEmpty() )
3033 pImpl
->m_pRequest
->AppendItem( SfxStringItem( SID_FILE_FILTEROPTIONS
, sOptions
) );
3034 if ( !sSource
.isEmpty() )
3035 pImpl
->m_pRequest
->AppendItem( SfxStringItem( FN_PARAM_1
, sSource
) );
3036 if ( nRefreshDelaySeconds
)
3037 pImpl
->m_pRequest
->AppendItem( SfxUInt32Item( FN_PARAM_2
, nRefreshDelaySeconds
) );
3040 ExecuteExternalSource( sFile
, sFilter
, sOptions
, sSource
, nRefreshDelaySeconds
, *(pImpl
->m_pRequest
) );
3047 const SfxItemSet
*pArgs
= rReq
.GetArgs();
3048 const OUString sFunction
= pArgs
?
3049 static_cast<const SfxStringItem
&>( pArgs
->Get( SID_AUTO_SUM
) ).GetValue()
3052 OpCode eFunction
= ocSum
;
3053 if (sFunction
== "average")
3054 eFunction
= ocAverage
;
3055 else if (sFunction
== "count")
3056 eFunction
= ocCount
;
3057 else if (sFunction
== "min")
3059 if (sFunction
== "max")
3062 bool bSubTotal
= false;
3063 bool bRangeFinder
= false;
3064 const OUString aFormula
= pTabViewShell
->DoAutoSum( bRangeFinder
, bSubTotal
, eFunction
);
3065 if ( !aFormula
.isEmpty() )
3067 const sal_Int32 nPar
= aFormula
.indexOf( '(' );
3068 const sal_Int32 nLen
= aFormula
.getLength();
3069 ScInputHandler
* pHdl
= pScMod
->GetInputHdl( pTabViewShell
);
3071 if ( pHdl
&& nPar
!= -1 )
3073 if ( !pScMod
->IsEditMode() )
3075 pScMod
->SetInputMode( SC_INPUT_TABLE
);
3078 EditView
*pEditView
=pHdl
->GetActiveView();
3081 ESelection aTextSel
= pEditView
->GetSelection();
3082 aTextSel
.start
.nIndex
= 0;
3083 aTextSel
.end
.nIndex
= EE_TEXTPOS_MAX
;
3084 pHdl
->DataChanging();
3085 pEditView
->SetSelection(aTextSel
);
3086 pEditView
->InsertText(aFormula
);
3087 pEditView
->SetSelection( bRangeFinder
? ESelection( 0, nPar
+ ( bSubTotal
? 3 : 1 ), 0, nLen
- 1 ) : ESelection( 0, nLen
- 1, 0, nLen
- 1 ) );
3088 pHdl
->DataChanged();
3092 pHdl
->InitRangeFinder( aFormula
);
3100 case SID_SELECT_UNPROTECTED_CELLS
:
3102 ScViewData
& rData
= GetViewData();
3103 SCTAB aTab
= rData
.GetTabNo();
3104 ScMarkData
& rMark
= rData
.GetMarkData();
3105 ScDocument
& rDoc
= rData
.GetDocument();
3106 ScRangeList rRangeList
;
3108 rDoc
.GetUnprotectedCells(rRangeList
, aTab
);
3109 rMark
.MarkFromRangeList(rRangeList
, true);
3110 pTabViewShell
->SetMarkData(rMark
);
3114 case SID_SELECT_VISIBLE_ROWS
:
3116 ScViewData
& rData
= GetViewData();
3117 ScMarkData
& rMark
= rData
.GetMarkData();
3118 ScDocument
& rDoc
= rData
.GetDocument();
3120 rMark
.MarkToMulti();
3122 const ScRange
& aMultiArea
= rMark
.GetMultiMarkArea();
3123 SCCOL nStartCol
= aMultiArea
.aStart
.Col();
3124 SCROW nStartRow
= aMultiArea
.aStart
.Row();
3125 SCCOL nEndCol
= aMultiArea
.aEnd
.Col();
3126 SCROW nEndRow
= aMultiArea
.aEnd
.Row();
3128 bool bChanged
= false;
3129 for (const SCTAB
& nTab
: rMark
)
3131 for (SCROW nRow
= nStartRow
; nRow
<= nEndRow
; ++nRow
)
3133 SCROW nLastRow
= nRow
;
3134 if (rDoc
.RowHidden(nRow
, nTab
, nullptr, &nLastRow
))
3136 rMark
.SetMultiMarkArea(
3137 ScRange(nStartCol
, nRow
, nTab
, nEndCol
, nLastRow
, nTab
), false);
3144 if (bChanged
&& !rMark
.HasAnyMultiMarks())
3147 rMark
.MarkToSimple();
3149 pTabViewShell
->SelectionChanged();
3153 case SID_SELECT_VISIBLE_COLUMNS
:
3155 ScViewData
& rData
= GetViewData();
3156 ScMarkData
& rMark
= rData
.GetMarkData();
3157 ScDocument
& rDoc
= rData
.GetDocument();
3159 rMark
.MarkToMulti();
3161 const ScRange
& aMultiArea
= rMark
.GetMultiMarkArea();
3162 SCCOL nStartCol
= aMultiArea
.aStart
.Col();
3163 SCROW nStartRow
= aMultiArea
.aStart
.Row();
3164 SCCOL nEndCol
= aMultiArea
.aEnd
.Col();
3165 SCROW nEndRow
= aMultiArea
.aEnd
.Row();
3167 bool bChanged
= false;
3168 for (const SCTAB
& nTab
: rMark
)
3170 for (SCCOL nCol
= nStartCol
; nCol
<= nEndCol
; ++nCol
)
3172 SCCOL nLastCol
= nCol
;
3173 if (rDoc
.ColHidden(nCol
, nTab
, nullptr, &nLastCol
))
3175 rMark
.SetMultiMarkArea(
3176 ScRange(nCol
, nStartRow
, nTab
, nLastCol
, nEndRow
, nTab
), false);
3183 if (bChanged
&& !rMark
.HasAnyMultiMarks())
3186 rMark
.MarkToSimple();
3188 pTabViewShell
->SelectionChanged();
3192 case SID_CURRENT_FORMULA_RANGE
:
3194 const SfxInt32Item
* param1
= rReq
.GetArg
<SfxInt32Item
>(FN_PARAM_1
);
3195 SCCOL colStart
= param1
? param1
->GetValue() : 0;
3197 const SfxInt32Item
* param2
= rReq
.GetArg
<SfxInt32Item
>(FN_PARAM_2
);
3198 SCROW rowStart
= param2
? param2
->GetValue() : 0;
3200 const SfxInt32Item
* param3
= rReq
.GetArg
<SfxInt32Item
>(FN_PARAM_3
);
3201 SCCOL colEnd
= param3
? param3
->GetValue() : 0;
3203 const SfxInt32Item
* param4
= rReq
.GetArg
<SfxInt32Item
>(FN_PARAM_4
);
3204 SCROW rowEnd
= param4
? param4
->GetValue() : 0;
3206 const SfxInt32Item
* param5
= rReq
.GetArg
<SfxInt32Item
>(FN_PARAM_5
);
3207 SCROW table
= param5
? param5
->GetValue() : 0;
3209 ScInputHandler
* pInputHdl
= pScMod
->GetInputHdl();
3211 if (param3
&& param4
&& pInputHdl
)
3213 ScViewData
& rData
= pTabViewShell
->GetViewData();
3214 ScTabView
* pTabView
= rData
.GetView();
3216 if (param1
&& param2
)
3217 rData
.SetRefStart(colStart
, rowStart
, table
);
3219 pTabView
->UpdateRef( colEnd
, rowEnd
, table
); // setup the end & refresh formula
3222 colStart
, rowStart
, rData
.GetRefStartZ(),
3223 colEnd
, rowEnd
, rData
.GetRefEndZ() );
3224 pScMod
->SetReference( aRef
, rData
.GetDocument(), &rData
.GetMarkData() );
3226 pInputHdl
->UpdateLokReferenceMarks();
3231 case SID_COPY_HYPERLINK_LOCATION
:
3233 ScViewData
& rData
= GetViewData();
3234 ScGridWindow
* pWindow
= rData
.GetActiveWin();
3235 const SfxInt32Item
* pPosX
= rReq
.GetArg
<SfxInt32Item
>(FN_PARAM_1
);
3236 const SfxInt32Item
* pPosY
= rReq
.GetArg
<SfxInt32Item
>(FN_PARAM_2
);
3237 if (pWindow
&& pPosX
&& pPosY
)
3239 const Point
aPoint(pPosX
->GetValue() * rData
.GetPPTX(),
3240 pPosY
->GetValue() * rData
.GetPPTY());
3242 if (pWindow
->GetEditUrl(aPoint
, nullptr, &aUrl
))
3244 uno::Reference
<datatransfer::clipboard::XClipboard
> xClipboard
3245 = pWindow
->GetClipboard();
3246 vcl::unohelper::TextDataObject::CopyStringTo(aUrl
, xClipboard
,
3247 rData
.GetViewShell());
3254 case SID_EDIT_HYPERLINK
:
3255 case SID_REMOVE_HYPERLINK
:
3257 ScViewData
& rData
= GetViewData();
3258 ScGridWindow
* pWindow
= rData
.GetActiveWin();
3259 const SfxInt32Item
* pPosX
= rReq
.GetArg
<SfxInt32Item
>(FN_PARAM_1
);
3260 const SfxInt32Item
* pPosY
= rReq
.GetArg
<SfxInt32Item
>(FN_PARAM_2
);
3261 if (pWindow
&& pPosX
&& pPosY
)
3263 const Point
aPoint(pPosX
->GetValue() * rData
.GetPPTX(),
3264 pPosY
->GetValue() * rData
.GetPPTY());
3267 ScSplitPos eWhich
= rData
.GetActivePart();
3268 rData
.GetPosFromPixel(aPoint
.X(), aPoint
.Y(), eWhich
, nPosX
, nPosY
);
3269 if (pWindow
->GetEditUrl(aPoint
, nullptr, nullptr, nullptr, &nPosX
))
3271 pTabViewShell
->SetCursor(nPosX
, nPosY
);
3272 pTabViewShell
->UpdateInputHandler();
3273 pScMod
->SetInputMode(SC_INPUT_TABLE
);
3274 ScInputHandler
* pHdl
= pScMod
->GetInputHdl(pTabViewShell
);
3275 if (rData
.HasEditView(eWhich
) && pHdl
)
3277 // Set text cursor where clicked
3278 EditView
* pEditView
= rData
.GetEditView(eWhich
);
3279 MouseEvent
aEditEvt(aPoint
, 1, MouseEventModifiers::SYNTHETIC
,
3281 pEditView
->MouseButtonDown(aEditEvt
);
3282 pEditView
->MouseButtonUp(aEditEvt
);
3283 if (nSlot
== SID_REMOVE_HYPERLINK
)
3285 pHdl
->DataChanging();
3286 URLFieldHelper::RemoveURLField(*pEditView
);
3287 pHdl
->DataChanged();
3288 pHdl
->EnterHandler();
3292 pEditView
->SelectFieldAtCursor();
3293 rData
.GetViewShell()->GetViewFrame().GetDispatcher()->Execute(
3294 SID_HYPERLINK_DIALOG
);
3304 OSL_FAIL("incorrect slot in ExecuteEdit");
3309 void ScCellShell::ExecuteTrans( SfxRequest
& rReq
)
3311 TransliterationFlags nType
= ScViewUtil::GetTransliterationType( rReq
.GetSlot() );
3312 if ( nType
!= TransliterationFlags::NONE
)
3314 GetViewData().GetView()->TransliterateText( nType
);
3319 void ScCellShell::ExecuteRotateTrans( const SfxRequest
& rReq
)
3321 if( rReq
.GetSlot() == SID_TRANSLITERATE_ROTATE_CASE
)
3322 GetViewData().GetView()->TransliterateText( m_aRotateCase
.getNextMode() );
3325 void ScCellShell::ExecuteExternalSource(
3326 const OUString
& _rFile
, const OUString
& _rFilter
, const OUString
& _rOptions
,
3327 const OUString
& _rSource
, sal_Int32 _nRefreshDelaySeconds
, SfxRequest
& _rRequest
)
3329 if ( !_rFile
.isEmpty() && !_rSource
.isEmpty() ) // filter may be empty
3334 ScViewData
& rData
= GetViewData();
3335 ScMarkData
& rMark
= rData
.GetMarkData();
3336 rMark
.MarkToSimple();
3337 if ( rMark
.IsMarked() )
3339 aLinkRange
= rMark
.GetMarkArea();
3340 bMove
= true; // insert/delete cells to fit range
3343 aLinkRange
= ScRange( rData
.GetCurX(), rData
.GetCurY(), rData
.GetTabNo() );
3345 rData
.GetDocFunc().InsertAreaLink( _rFile
, _rFilter
, _rOptions
, _rSource
,
3346 aLinkRange
, _nRefreshDelaySeconds
, bMove
, false );
3355 bool isDPSourceValid(const ScDPObject
& rDPObj
)
3357 if (rDPObj
.IsImportData())
3359 // If the data type is database, check if the database is still valid.
3360 const ScImportSourceDesc
* pDesc
= rDPObj
.GetImportSourceDesc();
3364 const ScDPSaveData
* pSaveData
= rDPObj
.GetSaveData();
3365 const ScDPDimensionSaveData
* pDimData
= nullptr;
3367 pDimData
= pSaveData
->GetExistingDimensionData();
3369 const ScDPCache
* pCache
= pDesc
->CreateCache(pDimData
);
3371 // cache creation failed, probably due to invalid connection.
3377 void RunPivotLayoutDialog(ScModule
* pScMod
,
3378 ScTabViewShell
* pTabViewShell
,
3379 std::unique_ptr
<ScDPObject
>& pNewDPObject
)
3381 bool bHadNewDPObject
= pNewDPObject
!= nullptr;
3382 pTabViewShell
->SetDialogDPObject( std::move(pNewDPObject
) );
3383 if ( bHadNewDPObject
)
3385 // start layout dialog
3387 sal_uInt16 nId
= ScPivotLayoutWrapper::GetChildWindowId();
3388 SfxViewFrame
& rViewFrm
= pTabViewShell
->GetViewFrame();
3389 SfxChildWindow
* pWnd
= rViewFrm
.GetChildWindow( nId
);
3390 pScMod
->SetRefDialog( nId
, pWnd
== nullptr );
3394 void SetupRangeForPivotTableDialog(const ScRange
& rRange
,
3395 ScAddress
& rDestPos
,
3397 TranslateId
& rSrcErrorId
,
3398 std::unique_ptr
<ScDPObject
>& pNewDPObject
)
3400 ScSheetSourceDesc
aShtDesc(pDoc
);
3401 aShtDesc
.SetSourceRange(rRange
);
3402 rSrcErrorId
= aShtDesc
.CheckSourceRange();
3405 pNewDPObject
.reset(new ScDPObject(pDoc
));
3406 pNewDPObject
->SetSheetDesc( aShtDesc
);
3409 // output below source data
3410 if ( rRange
.aEnd
.Row()+2 <= pDoc
->MaxRow() - 4 )
3411 rDestPos
= ScAddress( rRange
.aStart
.Col(),
3412 rRange
.aEnd
.Row()+2,
3413 rRange
.aStart
.Tab() );
3416 void ErrorOrRunPivotLayoutDialog(TranslateId pSrcErrorId
,
3417 const ScAddress
& rDestPos
,
3419 ScTabViewShell
* pTabViewShell
,
3420 std::unique_ptr
<ScDPObject
>& pNewDPObject
)
3424 // Error occurred during data creation. Launch an error and bail out.
3425 std::shared_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(pTabViewShell
->GetFrameWeld(),
3426 VclMessageType::Info
, VclButtonsType::Ok
,
3427 ScResId(pSrcErrorId
)));
3428 xInfoBox
->runAsync(xInfoBox
, [] (int) {});
3433 pNewDPObject
->SetOutRange( ScRange(rDestPos
) );
3435 RunPivotLayoutDialog(pScMod
, pTabViewShell
, pNewDPObject
);
3440 void ScCellShell::ExecuteDataPilotDialog()
3442 ScModule
* pScMod
= ScModule::get();
3443 ScTabViewShell
* pTabViewShell
= GetViewData().GetViewShell();
3444 ScViewData
& rData
= GetViewData();
3445 ScDocument
& rDoc
= rData
.GetDocument();
3447 // ScPivot is no longer used...
3448 ScDPObject
* pDPObj
= rDoc
.GetDPAtCursor(
3449 rData
.GetCurX(), rData
.GetCurY(),
3451 if ( pDPObj
) // on an existing table?
3453 std::unique_ptr
<ScDPObject
> pNewDPObject
;
3455 if (isDPSourceValid(*pDPObj
))
3456 pNewDPObject
.reset(new ScDPObject(*pDPObj
));
3458 RunPivotLayoutDialog(pScMod
, pTabViewShell
, pNewDPObject
);
3460 else // create new table
3462 // select database range or data
3463 pTabViewShell
->GetDBData( true, SC_DB_OLD
);
3464 ScMarkData
& rMark
= GetViewData().GetMarkData();
3465 if ( !rMark
.IsMarked() && !rMark
.IsMultiMarked() )
3466 pTabViewShell
->MarkDataArea( false );
3468 // output to cursor position for non-sheet data
3469 ScAddress
aDestPos( rData
.GetCurX(), rData
.GetCurY(),
3472 // first select type of source data
3474 bool bEnableExt
= ScDPObject::HasRegisteredSources();
3476 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
3478 VclPtr
<AbstractScDataPilotSourceTypeDlg
> pTypeDlg(
3479 pFact
->CreateScDataPilotSourceTypeDlg(
3480 pTabViewShell
->GetFrameWeld(), bEnableExt
));
3482 // Populate named ranges (if any).
3483 ScRangeName
* pRangeName
= rDoc
.GetRangeName();
3486 ScRangeName::const_iterator itr
= pRangeName
->begin(), itrEnd
= pRangeName
->end();
3487 for (; itr
!= itrEnd
; ++itr
)
3488 pTypeDlg
->AppendNamedRange(itr
->second
->GetName());
3491 pTypeDlg
->StartExecuteAsync([this, pTypeDlg
, pTabViewShell
,
3492 pScMod
, pFact
, &rDoc
, &rMark
, aDestPos
](int nResult
) mutable {
3494 if (nResult
== RET_OK
)
3496 if ( pTypeDlg
->IsExternal() )
3498 std::vector
<OUString
> aSources
= ScDPObject::GetRegisteredSources();
3499 VclPtr
<AbstractScDataPilotServiceDlg
> pServDlg(
3500 pFact
->CreateScDataPilotServiceDlg(
3501 pTabViewShell
->GetFrameWeld(), aSources
));
3503 pServDlg
->StartExecuteAsync([pServDlg
, pScMod
, pTabViewShell
,
3504 aDestPos
, &rDoc
](int nResult2
) mutable {
3505 if ( nResult2
== RET_OK
)
3507 ScDPServiceDesc
aServDesc(
3508 pServDlg
->GetServiceName(),
3509 pServDlg
->GetParSource(),
3510 pServDlg
->GetParName(),
3511 pServDlg
->GetParUser(),
3512 pServDlg
->GetParPass() );
3513 std::unique_ptr
<ScDPObject
> pNewDPObject(new ScDPObject(&rDoc
));
3514 pNewDPObject
->SetServiceData( aServDesc
);
3515 pNewDPObject
->SetOutRange(ScRange(aDestPos
));
3517 RunPivotLayoutDialog(pScMod
, pTabViewShell
, pNewDPObject
);
3520 pServDlg
->disposeOnce();
3523 else if ( pTypeDlg
->IsDatabase() )
3525 assert(pFact
&& "ScAbstractFactory create fail!");
3526 VclPtr
<AbstractScDataPilotDatabaseDlg
> pDataDlg(
3527 pFact
->CreateScDataPilotDatabaseDlg(pTabViewShell
->GetFrameWeld()));
3528 assert(pDataDlg
&& "Dialog create fail!");
3530 pDataDlg
->StartExecuteAsync([pDataDlg
, pScMod
, pTabViewShell
,
3531 aDestPos
, &rDoc
](int nResult2
) mutable {
3532 if ( nResult2
== RET_OK
)
3534 ScImportSourceDesc
aImpDesc(&rDoc
);
3535 pDataDlg
->GetValues( aImpDesc
);
3536 std::unique_ptr
<ScDPObject
> pNewDPObject(new ScDPObject(&rDoc
));
3537 pNewDPObject
->SetImportDesc( aImpDesc
);
3538 pNewDPObject
->SetOutRange(ScRange(aDestPos
));
3540 RunPivotLayoutDialog(pScMod
, pTabViewShell
, pNewDPObject
);
3543 pDataDlg
->disposeOnce();
3548 TranslateId pSrcErrorId
;
3550 if (pTypeDlg
->IsNamedRange())
3552 std::unique_ptr
<ScDPObject
> pNewDPObject
;
3553 OUString aName
= pTypeDlg
->GetSelectedNamedRange();
3554 ScSheetSourceDesc
aShtDesc(&rDoc
);
3555 aShtDesc
.SetRangeName(aName
);
3556 pSrcErrorId
= aShtDesc
.CheckSourceRange();
3559 pNewDPObject
.reset(new ScDPObject(&rDoc
));
3560 pNewDPObject
->SetSheetDesc(aShtDesc
);
3563 ErrorOrRunPivotLayoutDialog(pSrcErrorId
, aDestPos
, pScMod
, pTabViewShell
, pNewDPObject
);
3567 //! use database ranges (select before type dialog?)
3569 ScMarkType eType
= GetViewData().GetSimpleArea(aRange
);
3570 if ( (eType
& SC_MARK_SIMPLE
) == SC_MARK_SIMPLE
)
3572 ScDocument
* pDoc
= &rDoc
;
3574 // Shrink the range to the data area.
3575 SCCOL nStartCol
= aRange
.aStart
.Col(), nEndCol
= aRange
.aEnd
.Col();
3576 SCROW nStartRow
= aRange
.aStart
.Row(), nEndRow
= aRange
.aEnd
.Row();
3577 if (rDoc
.ShrinkToDataArea(aRange
.aStart
.Tab(), nStartCol
, nStartRow
, nEndCol
, nEndRow
))
3579 aRange
.aStart
.SetCol(nStartCol
);
3580 aRange
.aStart
.SetRow(nStartRow
);
3581 aRange
.aEnd
.SetCol(nEndCol
);
3582 aRange
.aEnd
.SetRow(nEndRow
);
3583 rMark
.SetMarkArea(aRange
);
3584 pTabViewShell
->MarkRange(aRange
);
3587 if ( rDoc
.HasSubTotalCells( aRange
) )
3589 // confirm selection if it contains SubTotal cells
3590 std::shared_ptr
<weld::MessageDialog
> xQueryBox(Application::CreateMessageDialog(pTabViewShell
->GetFrameWeld(),
3591 VclMessageType::Question
, VclButtonsType::YesNo
,
3592 ScResId(STR_DATAPILOT_SUBTOTAL
)));
3593 xQueryBox
->set_default_response(RET_YES
);
3594 xQueryBox
->runAsync(xQueryBox
, [aRange
, pDoc
, pTypeDlg
, aDestPos
,
3595 pScMod
, pTabViewShell
, pSrcErrorId
] (int nResult2
) mutable {
3596 if (nResult2
== RET_NO
)
3599 std::unique_ptr
<ScDPObject
> pNewDPObject
;
3600 SetupRangeForPivotTableDialog(aRange
, aDestPos
, pDoc
, pSrcErrorId
, pNewDPObject
);
3601 ErrorOrRunPivotLayoutDialog(pSrcErrorId
, aDestPos
, pScMod
, pTabViewShell
, pNewDPObject
);
3604 pTypeDlg
->disposeOnce();
3608 std::unique_ptr
<ScDPObject
> pNewDPObject
;
3609 SetupRangeForPivotTableDialog(aRange
, aDestPos
, pDoc
, pSrcErrorId
, pNewDPObject
);
3610 ErrorOrRunPivotLayoutDialog(pSrcErrorId
, aDestPos
, pScMod
, pTabViewShell
, pNewDPObject
);
3616 pTypeDlg
->disposeOnce();
3621 void ScCellShell::ExecuteXMLSourceDialog()
3623 ScTabViewShell
* pTabViewShell
= GetViewData().GetViewShell();
3627 sal_uInt16 nId
= ScXMLSourceDlgWrapper::GetChildWindowId();
3628 SfxViewFrame
& rViewFrame
= pTabViewShell
->GetViewFrame();
3629 SfxChildWindow
* pWnd
= rViewFrame
.GetChildWindow(nId
);
3630 ScModule::get()->SetRefDialog(nId
, pWnd
== nullptr);
3633 void ScCellShell::ExecuteSubtotals(SfxRequest
& rReq
)
3635 ScTabViewShell
* pTabViewShell
= GetViewData().GetViewShell();
3636 const SfxItemSet
* pArgs
= rReq
.GetArgs();
3639 pTabViewShell
->DoSubTotals( pArgs
->Get( SCITEM_SUBTDATA
).
3640 GetSubTotalData() );
3645 ScopedVclPtr
<SfxAbstractTabDialog
> pDlg
;
3646 ScSubTotalParam aSubTotalParam
;
3647 SfxItemSetFixed
<SCITEM_SUBTDATA
, SCITEM_SUBTDATA
> aArgSet( GetPool() );
3651 // Only get existing named database range.
3652 ScDBData
* pDBData
= pTabViewShell
->GetDBData(true, SC_DB_OLD
);
3657 // No existing DB data at this position. Create an
3660 pDBData
= pTabViewShell
->GetAnonymousDBData();
3662 pDBData
->GetArea(aDataRange
);
3663 pTabViewShell
->MarkRange(aDataRange
, false);
3666 pDBData
->GetSubTotalParam( aSubTotalParam
);
3668 ScDocument
& rDoc
= GetViewData().GetDocument();
3669 SCTAB nTab
= GetViewData().GetTabNo();
3670 if (!rDoc
.GetTotalsRowBelow(nTab
))
3671 aSubTotalParam
.bSummaryBelow
= false;
3673 aSubTotalParam
.bRemoveOnly
= false;
3676 // Preset sort formatting along with values and also create formula
3677 // cells with "needs formatting". Subtotals on data of different types
3678 // doesn't make much sense anyway.
3679 aSubTotalParam
.bIncludePattern
= true;
3682 aArgSet
.Put( ScSubTotalItem( SCITEM_SUBTDATA
, &GetViewData(), &aSubTotalParam
) );
3683 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
3684 pDlg
.disposeAndReset(pFact
->CreateScSubTotalDlg(pTabViewShell
->GetFrameWeld(), aArgSet
));
3685 pDlg
->SetCurPageId(u
"1stgroup"_ustr
);
3687 short bResult
= pDlg
->Execute();
3689 if ( (bResult
== RET_OK
) || (bResult
== SCRET_REMOVE
) )
3691 const SfxItemSet
* pOutSet
= nullptr;
3693 if ( bResult
== RET_OK
)
3695 pOutSet
= pDlg
->GetOutputItemSet();
3697 pOutSet
->Get( SCITEM_SUBTDATA
).GetSubTotalData();
3699 else // if (bResult == SCRET_REMOVE)
3702 aSubTotalParam
.bRemoveOnly
= true;
3703 aSubTotalParam
.bReplace
= true;
3704 aArgSet
.Put( ScSubTotalItem( SCITEM_SUBTDATA
,
3706 &aSubTotalParam
) );
3709 pTabViewShell
->DoSubTotals( aSubTotalParam
);
3710 rReq
.Done( *pOutSet
);
3713 GetViewData().GetDocShell()->CancelAutoDBRange();
3716 void ScCellShell::ExecuteFillSingleEdit()
3718 ScAddress aCurPos
= GetViewData().GetCurPos();
3722 if (aCurPos
.Row() > 0)
3724 // Get the initial text value from the above cell.
3726 ScDocument
& rDoc
= GetViewData().GetDocument();
3727 ScAddress aPrevPos
= aCurPos
;
3728 aPrevPos
.IncRow(-1);
3729 ScRefCellValue
aCell(rDoc
, aPrevPos
);
3731 if (aCell
.getType() == CELLTYPE_FORMULA
)
3734 const ScTokenArray
* pCode
= aCell
.getFormula()->GetCode();
3735 sc::TokenStringContext
aCxt(rDoc
, rDoc
.GetGrammar());
3736 aInit
+= pCode
->CreateString(aCxt
, aCurPos
);
3739 aInit
= aCell
.getString(&rDoc
);
3742 ScModule::get()->SetInputMode(SC_INPUT_TABLE
, &aInit
);
3745 CellShell_Impl::CellShell_Impl() :
3746 m_pRequest( nullptr ) {}
3748 CellShell_Impl::~CellShell_Impl()
3751 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */