1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cellsh1.cxx,v $
10 * $Revision: 1.54.102.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
35 //------------------------------------------------------------------
40 #define _SDR_NOTRANSFORM
41 #define _SI_NOSBXCONTROLS
43 #define _SI_NOOTHERFORMS
48 #define _SI_NOSBXCONTROLS
50 //------------------------------------------------------------------
51 #include <com/sun/star/i18n/TextConversionOption.hpp>
52 #include <com/sun/star/sheet/DataPilotFieldFilter.hpp>
54 #include "scitems.hxx"
55 #include <sfx2/viewfrm.hxx>
57 #define _ZFORLIST_DECLARE_TABLE
58 #include <svtools/stritem.hxx>
59 #include <svtools/whiter.hxx>
60 #include <svtools/zforlist.hxx>
61 #include <svtools/zformat.hxx>
62 #include <sfx2/dispatch.hxx>
63 #include <sfx2/request.hxx>
64 #include <vcl/msgbox.hxx>
65 #include <svx/svxdlg.hxx>
66 #include <sot/formats.hxx>
67 #include <svx/postattr.hxx>
68 #include <svx/fontitem.hxx>
69 #include <svx/clipfmtitem.hxx>
70 #include <sfx2/passwd.hxx>
71 #include <svx/hlnkitem.hxx>
72 #include <basic/sbxcore.hxx>
73 #include <svtools/useroptions.hxx>
74 #include <vcl/waitobj.hxx>
75 #include <unotools/localedatawrapper.hxx>
79 #include "document.hxx"
80 #include "patattr.hxx"
82 #include "scresid.hxx"
83 #include "tabvwsh.hxx"
84 //CHINA001 #include "inscldlg.hxx"
85 //CHINA001 #include "inscodlg.hxx"
86 //CHINA001 #include "delcldlg.hxx"
87 //CHINA001 #include "delcodlg.hxx"
88 //CHINA001 #include "filldlg.hxx"
89 //CHINA001 #include "groupdlg.hxx"
91 #include "reffind.hxx"
92 //CHINA001 #include "namecrea.hxx"
93 #include "uiitems.hxx"
94 #include "reffact.hxx"
95 //CHINA001 #include "namepast.hxx"
96 #include "inputhdl.hxx"
97 #include "transobj.hxx"
98 #include "drwtrans.hxx"
99 //CHINA001 #include "linkarea.hxx"
100 #include "docfunc.hxx"
101 #include "editable.hxx"
102 #include "dpobject.hxx"
103 #include "dpsave.hxx"
104 #include "dpgroup.hxx" // for ScDPNumGroupInfo
105 #include "spellparam.hxx"
106 #include "postit.hxx"
107 #include "clipparam.hxx"
109 #include "globstr.hrc"
110 #include "scui_def.hxx" //CHINA001
111 #include <svx/svxdlg.hxx> //CHINA001
112 #include <svx/dialogs.hrc> //CHINA001
113 #include "scabstdlg.hxx" //CHINA001
114 #define IS_AVAILABLE(WhichId,ppItem) \
115 (pReqArgs->GetItemState((WhichId), TRUE, ppItem ) == SFX_ITEM_SET)
117 #define C2U(cChar) rtl::OUString::createFromAscii(cChar)
119 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
120 #include <com/sun/star/lang/XInitialization.hpp>
121 #include <com/sun/star/beans/PropertyValue.hpp>
122 #include <com/sun/star/beans/XPropertySet.hpp>
123 #include <cppuhelper/bootstrap.hxx>
125 using namespace ::com::sun::star
;
126 using namespace ::com::sun::star::beans
;
127 using namespace ::com::sun::star::uno
;
129 //------------------------------------------------------------------
130 void ScCellShell::ExecuteEdit( SfxRequest
& rReq
)
132 ScModule
* pScMod
= SC_MOD();
133 ScTabViewShell
* pTabViewShell
= GetViewData()->GetViewShell();
134 SfxBindings
& rBindings
= pTabViewShell
->GetViewFrame()->GetBindings();
135 const SfxItemSet
* pReqArgs
= rReq
.GetArgs();
136 USHORT nSlot
= rReq
.GetSlot();
138 pTabViewShell
->HideListBox(); // Autofilter-DropDown-Listbox
141 if ( GetViewData()->HasEditView( GetViewData()->GetActivePart() ) )
145 case FID_DEFINE_NAME
:
147 case FID_INSERT_NAME
:
148 case SID_SPELL_DIALOG
:
149 case SID_HANGUL_HANJA_CONVERSION
:
151 pScMod
->InputEnterHandler();
152 pTabViewShell
->UpdateInputHandler();
163 // Einfuegen / Loeschen von Zellen / Zeilen / Spalten
167 pTabViewShell
->InsertCells(INS_INSROWS
);
172 pTabViewShell
->InsertCells(INS_INSCOLS
);
176 case FID_INS_CELLSDOWN
:
177 pTabViewShell
->InsertCells(INS_CELLSDOWN
);
181 case FID_INS_CELLSRIGHT
:
182 pTabViewShell
->InsertCells(INS_CELLSRIGHT
);
187 pTabViewShell
->DeleteCells( DEL_DELROWS
);
192 pTabViewShell
->DeleteCells( DEL_DELCOLS
);
198 InsCellCmd eCmd
=INS_NONE
;
202 const SfxPoolItem
* pItem
;
205 if( IS_AVAILABLE( FID_INS_CELL
, &pItem
) )
206 aFlags
= ((const SfxStringItem
*)pItem
)->GetValue();
209 switch( aFlags
.GetChar(0) )
211 case 'V': eCmd
= INS_CELLSDOWN
;break;
212 case '>': eCmd
= INS_CELLSRIGHT
;break;
213 case 'R': eCmd
= INS_INSROWS
;break;
214 case 'C': eCmd
= INS_INSCOLS
;break;
220 if ( GetViewData()->SimpleColMarked() )
222 else if ( GetViewData()->SimpleRowMarked() )
226 ScDocument
* pDoc
= GetViewData()->GetDocument();
227 BOOL bTheFlag
=(pDoc
->GetChangeTrack()!=NULL
);
229 //CHINA001 ScInsertCellDlg* pDlg = new ScInsertCellDlg( pTabViewShell->GetDialogParent(),
230 //CHINA001 bTheFlag);
231 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
232 DBG_ASSERT(pFact
, "ScAbstractFactory create fail!");//CHINA001
234 AbstractScInsertCellDlg
* pDlg
= pFact
->CreateScInsertCellDlg( pTabViewShell
->GetDialogParent(), RID_SCDLG_INSCELL
, bTheFlag
);
235 DBG_ASSERT(pDlg
, "Dialog create fail!");//CHINA001
236 if (pDlg
->Execute() == RET_OK
)
237 eCmd
= pDlg
->GetInsCellCmd();
244 pTabViewShell
->InsertCells( eCmd
);
252 case INS_CELLSDOWN
: aParam
='V'; break;
253 case INS_CELLSRIGHT
: aParam
='>'; break;
254 case INS_INSROWS
: aParam
='R'; break;
255 case INS_INSCOLS
: aParam
='C'; break;
258 // added to avoid warnings
261 rReq
.AppendItem( SfxStringItem( FID_INS_CELL
, aParam
) );
268 case FID_DELETE_CELL
:
270 DelCellCmd eCmd
= DEL_NONE
;
274 const SfxPoolItem
* pItem
;
277 if( IS_AVAILABLE( FID_DELETE_CELL
, &pItem
) )
278 aFlags
= ((const SfxStringItem
*)pItem
)->GetValue();
281 switch( aFlags
.GetChar(0) )
283 case 'U': eCmd
= DEL_CELLSUP
;break;
284 case 'L': eCmd
= DEL_CELLSLEFT
;break;
285 case 'R': eCmd
= DEL_DELROWS
;break;
286 case 'C': eCmd
= DEL_DELCOLS
;break;
292 if ( GetViewData()->SimpleColMarked() )
294 else if ( GetViewData()->SimpleRowMarked() )
299 ScDocument
* pDoc
= GetViewData()->GetDocument();
300 BOOL bTheFlag
=GetViewData()->IsMultiMarked() ||
301 (GetViewData()->GetSimpleArea(aRange
) == SC_MARK_SIMPLE_FILTERED
) ||
302 (pDoc
->GetChangeTrack() != NULL
);
304 //CHINA001 ScDeleteCellDlg* pDlg = new ScDeleteCellDlg(
305 //CHINA001 pTabViewShell->GetDialogParent(),bTheFlag);
306 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
307 DBG_ASSERT(pFact
, "ScAbstractFactory create fail!");//CHINA001
309 AbstractScDeleteCellDlg
* pDlg
= pFact
->CreateScDeleteCellDlg( pTabViewShell
->GetDialogParent(), RID_SCDLG_DELCELL
, bTheFlag
);
310 DBG_ASSERT(pDlg
, "Dialog create fail!");//CHINA001
312 if (pDlg
->Execute() == RET_OK
)
313 eCmd
= pDlg
->GetDelCellCmd();
318 if (eCmd
!= DEL_NONE
)
320 pTabViewShell
->DeleteCells( eCmd
);
328 case DEL_CELLSUP
: aParam
='U'; break;
329 case DEL_CELLSLEFT
: aParam
='L'; break;
330 case DEL_DELROWS
: aParam
='R'; break;
331 case DEL_DELCOLS
: aParam
='C'; break;
334 // added to avoid warnings
337 rReq
.AppendItem( SfxStringItem( FID_DELETE_CELL
, aParam
) );
345 // Inhalte von Zellen loeschen
348 case SID_DELETE_CONTENTS
:
349 pTabViewShell
->DeleteContents( IDF_CONTENTS
);
355 USHORT nFlags
= IDF_NONE
;
357 if ( pReqArgs
!=NULL
&& pTabViewShell
->SelectionEditable() )
359 const SfxPoolItem
* pItem
;
362 if( IS_AVAILABLE( SID_DELETE
, &pItem
) )
363 aFlags
= ((const SfxStringItem
*)pItem
)->GetValue();
365 aFlags
.ToUpperAscii();
368 for( xub_StrLen i
=0 ; bCont
&& i
<aFlags
.Len() ; i
++ )
370 switch( aFlags
.GetChar(i
) )
374 bCont
= FALSE
; // nicht mehr weitermachen!
376 case 'S': nFlags
|= IDF_STRING
; break;
377 case 'V': nFlags
|= IDF_VALUE
; break;
378 case 'D': nFlags
|= IDF_DATETIME
; break;
379 case 'F': nFlags
|= IDF_FORMULA
; break;
380 case 'N': nFlags
|= IDF_NOTE
; break;
381 case 'T': nFlags
|= IDF_ATTRIB
; break;
382 case 'O': nFlags
|= IDF_OBJECTS
; break;
388 ScEditableTester
aTester( pTabViewShell
);
389 if (aTester
.IsEditable())
391 //CHINA001 ScDeleteContentsDlg* pDlg = new ScDeleteContentsDlg( pTabViewShell->GetDialogParent() );
392 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
393 DBG_ASSERT(pFact
, "ScAbstractFactory create fail!");//CHINA001
395 AbstractScDeleteContentsDlg
* pDlg
= pFact
->CreateScDeleteContentsDlg( pTabViewShell
->GetDialogParent(), RID_SCDLG_DELCONT
);
396 DBG_ASSERT(pDlg
, "Dialog create fail!");//CHINA001
397 ScDocument
* pDoc
= GetViewData()->GetDocument();
398 SCTAB nTab
= GetViewData()->GetTabNo();
399 if ( pDoc
->IsTabProtected(nTab
) )
400 pDlg
->DisableObjects();
401 if (pDlg
->Execute() == RET_OK
)
403 nFlags
= pDlg
->GetDelContentsCmdBits();
408 pTabViewShell
->ErrorMessage(aTester
.GetMessageId());
411 if( nFlags
!= IDF_NONE
)
413 pTabViewShell
->DeleteContents( nFlags
);
419 if( nFlags
== IDF_ALL
)
425 if( nFlags
& IDF_STRING
) aFlags
+= 'S';
426 if( nFlags
& IDF_VALUE
) aFlags
+= 'V';
427 if( nFlags
& IDF_DATETIME
) aFlags
+= 'D';
428 if( nFlags
& IDF_FORMULA
) aFlags
+= 'F';
429 if( nFlags
& IDF_NOTE
) aFlags
+= 'N';
430 if( nFlags
& IDF_ATTRIB
) aFlags
+= 'T';
431 if( nFlags
& IDF_OBJECTS
) aFlags
+= 'O';
434 rReq
.AppendItem( SfxStringItem( SID_DELETE
, aFlags
) );
445 case FID_FILL_TO_BOTTOM
:
446 pTabViewShell
->FillSimple( FILL_TO_BOTTOM
);
450 case FID_FILL_TO_RIGHT
:
451 pTabViewShell
->FillSimple( FILL_TO_RIGHT
);
455 case FID_FILL_TO_TOP
:
456 pTabViewShell
->FillSimple( FILL_TO_TOP
);
460 case FID_FILL_TO_LEFT
:
461 pTabViewShell
->FillSimple( FILL_TO_LEFT
);
467 USHORT nFlags
= IDF_NONE
;
468 USHORT nFunction
= PASTE_NOFUNC
;
469 BOOL bSkipEmpty
= FALSE
;
470 BOOL bAsLink
= FALSE
;
472 if ( pReqArgs
!=NULL
&& pTabViewShell
->SelectionEditable() )
474 const SfxPoolItem
* pItem
;
477 if( IS_AVAILABLE( FID_FILL_TAB
, &pItem
) )
478 aFlags
= ((const SfxStringItem
*)pItem
)->GetValue();
480 aFlags
.ToUpperAscii();
483 for( xub_StrLen i
=0 ; bCont
&& i
<aFlags
.Len() ; i
++ )
485 switch( aFlags
.GetChar(i
) )
489 bCont
= FALSE
; // nicht mehr weitermachen!
491 case 'S': nFlags
|= IDF_STRING
; break;
492 case 'V': nFlags
|= IDF_VALUE
; break;
493 case 'D': nFlags
|= IDF_DATETIME
; break;
494 case 'F': nFlags
|= IDF_FORMULA
; break;
495 case 'N': nFlags
|= IDF_NOTE
; break;
496 case 'T': nFlags
|= IDF_ATTRIB
; break;
502 //CHINA001 ScInsertContentsDlg* pDlg =
503 //CHINA001 new ScInsertContentsDlg(pTabViewShell->GetDialogParent(),
504 //CHINA001 0, /* nCheckDefaults */
505 //CHINA001 &ScGlobal::GetRscString(STR_FILL_TAB) );
506 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
507 DBG_ASSERT(pFact
, "ScAbstractFactory create fail!");//CHINA001
509 AbstractScInsertContentsDlg
* pDlg
= pFact
->CreateScInsertContentsDlg( pTabViewShell
->GetDialogParent(),
510 RID_SCDLG_INSCONT
, 0, /* nCheckDefaults */
511 &ScGlobal::GetRscString(STR_FILL_TAB
));
512 DBG_ASSERT(pDlg
, "Dialog create fail!");//CHINA001
513 pDlg
->SetFillMode(TRUE
);
515 if (pDlg
->Execute() == RET_OK
)
517 nFlags
= pDlg
->GetInsContentsCmdBits();
518 nFunction
= pDlg
->GetFormulaCmdBits();
519 bSkipEmpty
= pDlg
->IsSkipEmptyCells();
520 bAsLink
= pDlg
->IsLink();
521 // MoveMode gibt's bei Tabelle fuellen nicht
526 if( nFlags
!= IDF_NONE
)
528 pTabViewShell
->FillTab( nFlags
, nFunction
, bSkipEmpty
, bAsLink
);
534 if( nFlags
== IDF_ALL
)
540 if( nFlags
& IDF_STRING
) aFlags
+= 'S';
541 if( nFlags
& IDF_VALUE
) aFlags
+= 'V';
542 if( nFlags
& IDF_DATETIME
) aFlags
+= 'D';
543 if( nFlags
& IDF_FORMULA
) aFlags
+= 'F';
544 if( nFlags
& IDF_NOTE
) aFlags
+= 'N';
545 if( nFlags
& IDF_ATTRIB
) aFlags
+= 'T';
548 rReq
.AppendItem( SfxStringItem( FID_FILL_TAB
, aFlags
) );
555 case FID_FILL_SERIES
:
563 USHORT nPossDir
= FDS_OPT_NONE
;
564 FillDir eFillDir
= FILL_TO_BOTTOM
;
565 FillCmd eFillCmd
= FILL_LINEAR
;
566 FillDateCmd eFillDateCmd
= FILL_DAY
;
567 double fStartVal
= MAXDOUBLE
;
569 double fMaxVal
= MAXDOUBLE
;
572 GetViewData()->GetSimpleArea( nStartCol
, nStartRow
, nStartTab
,
573 nEndCol
, nEndRow
, nEndTab
);
575 if( nStartCol
!=nEndCol
)
577 nPossDir
|= FDS_OPT_HORZ
;
578 eFillDir
=FILL_TO_RIGHT
;
581 if( nStartRow
!=nEndRow
)
583 nPossDir
|= FDS_OPT_VERT
;
584 eFillDir
=FILL_TO_BOTTOM
;
587 ScDocument
* pDoc
= GetViewData()->GetDocument();
588 SvNumberFormatter
* pFormatter
= pDoc
->GetFormatTable();
592 const SfxPoolItem
* pItem
;
593 String aFillDir
, aFillCmd
, aFillDateCmd
;
594 String aFillStep
, aFillStart
, aFillMax
;
600 if( IS_AVAILABLE( FID_FILL_SERIES
, &pItem
) )
601 aFillDir
= ((const SfxStringItem
*)pItem
)->GetValue();
602 if( IS_AVAILABLE( FN_PARAM_1
, &pItem
) )
603 aFillCmd
= ((const SfxStringItem
*)pItem
)->GetValue();
604 if( IS_AVAILABLE( FN_PARAM_2
, &pItem
) )
605 aFillDateCmd
= ((const SfxStringItem
*)pItem
)->GetValue();
606 if( IS_AVAILABLE( FN_PARAM_3
, &pItem
) )
607 aFillStep
= ((const SfxStringItem
*)pItem
)->GetValue();
608 if( IS_AVAILABLE( FN_PARAM_4
, &pItem
) )
609 aFillStart
= ((const SfxStringItem
*)pItem
)->GetValue();
610 if( IS_AVAILABLE( FN_PARAM_5
, &pItem
) )
611 aFillMax
= ((const SfxStringItem
*)pItem
)->GetValue();
614 switch( aFillDir
.GetChar(0) )
616 case 'B': case 'b': eFillDir
=FILL_TO_BOTTOM
; break;
617 case 'R': case 'r': eFillDir
=FILL_TO_RIGHT
; break;
618 case 'T': case 't': eFillDir
=FILL_TO_TOP
; break;
619 case 'L': case 'l': eFillDir
=FILL_TO_LEFT
; break;
623 switch( aFillCmd
.GetChar(0) )
625 case 'S': case 's': eFillCmd
=FILL_SIMPLE
; break;
626 case 'L': case 'l': eFillCmd
=FILL_LINEAR
; break;
627 case 'G': case 'g': eFillCmd
=FILL_GROWTH
; break;
628 case 'D': case 'd': eFillCmd
=FILL_DATE
; break;
629 case 'A': case 'a': eFillCmd
=FILL_AUTO
; break;
632 if( aFillDateCmd
.Len() )
633 switch( aFillDateCmd
.GetChar(0) )
635 case 'D': case 'd': eFillDateCmd
=FILL_DAY
; break;
636 case 'W': case 'w': eFillDateCmd
=FILL_WEEKDAY
; break;
637 case 'M': case 'm': eFillDateCmd
=FILL_MONTH
; break;
638 case 'Y': case 'y': eFillDateCmd
=FILL_YEAR
; break;
642 if( pFormatter
->IsNumberFormat( aFillStart
, nKey
, fTmpVal
))
646 if( pFormatter
->IsNumberFormat( aFillStep
, nKey
, fTmpVal
))
650 if( pFormatter
->IsNumberFormat( aFillMax
, nKey
, fTmpVal
))
656 else // (pReqArgs == NULL) => Dialog hochziehen
659 sal_uInt32 nPrivFormat
;
661 pDoc
->GetNumberFormat( nStartCol
, nStartRow
, nStartTab
, nPrivFormat
);
662 pDoc
->GetCellType( nStartCol
, nStartRow
, nStartTab
,eCellType
);
663 const SvNumberformat
* pPrivEntry
= pFormatter
->GetEntry( nPrivFormat
);
666 DBG_ERROR("Zahlformat nicht gefunden !!!");
670 short nPrivType
= pPrivEntry
->GetType();
671 if ( ( nPrivType
& NUMBERFORMAT_DATE
)>0)
675 else if(eCellType
==CELLTYPE_STRING
)
684 // Startwert nur vorbelegen, wenn nur 1 Zeile oder Spalte:
685 if ( nStartCol
== nEndCol
|| nStartRow
== nEndRow
)
687 double fInputEndVal
= 0.0;
690 pDoc
->GetInputString( nStartCol
, nStartRow
, nStartTab
, aStartStr
);
691 pDoc
->GetValue( nStartCol
, nStartRow
, nStartTab
, fStartVal
);
694 if(eFillDir
==FILL_TO_BOTTOM
&& nStartRow
< nEndRow
)
696 pDoc
->GetInputString( nStartCol
, nStartRow
+1, nStartTab
, aEndStr
);
699 pDoc
->GetValue( nStartCol
, nStartRow
+1, nStartTab
, fInputEndVal
);
700 fIncVal
=fInputEndVal
-fStartVal
;
705 if(nStartCol
< nEndCol
)
707 pDoc
->GetInputString( nStartCol
+1, nStartRow
, nStartTab
, aEndStr
);
710 pDoc
->GetValue( nStartCol
+1, nStartRow
, nStartTab
, fInputEndVal
);
711 fIncVal
=fInputEndVal
-fStartVal
;
715 if(eFillCmd
==FILL_DATE
)
717 Date aNullDate
= *pDoc
->GetFormatTable()->GetNullDate();
718 Date aStartDate
= aNullDate
;
719 aStartDate
+= (long)fStartVal
;
720 Date aEndDate
= aNullDate
;
721 aEndDate
+= (long)fInputEndVal
;
724 if(aStartDate
.GetYear()!=aEndDate
.GetYear())
726 eFillDateCmd
= FILL_YEAR
;
727 fTempDate
=aEndDate
.GetYear()-aStartDate
.GetYear();
729 if(aStartDate
.GetMonth()!=aEndDate
.GetMonth())
731 eFillDateCmd
= FILL_MONTH
;
732 fTempDate
=fTempDate
*12+aEndDate
.GetMonth()-aStartDate
.GetMonth();
734 if(aStartDate
.GetDay()==aEndDate
.GetDay())
740 //CHINA001 ScFillSeriesDlg* pDlg = new ScFillSeriesDlg(
741 //CHINA001 pTabViewShell->GetDialogParent(), *pDoc,
742 //CHINA001 eFillDir, eFillCmd, eFillDateCmd,
743 //CHINA001 aStartStr, fIncVal, fMaxVal,
744 //CHINA001 nPossDir);
745 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
746 DBG_ASSERT(pFact
, "ScAbstractFactory create fail!");//CHINA001
748 AbstractScFillSeriesDlg
* pDlg
= pFact
->CreateScFillSeriesDlg( pTabViewShell
->GetDialogParent(),
750 eFillDir
, eFillCmd
, eFillDateCmd
,
751 aStartStr
, fIncVal
, fMaxVal
,
753 RID_SCDLG_FILLSERIES
);
754 DBG_ASSERT(pDlg
, "Dialog create fail!");//CHINA001
756 if ( nStartCol
!= nEndCol
&& nStartRow
!= nEndRow
)
758 pDlg
->SetEdStartValEnabled(FALSE
);
761 if ( pDlg
->Execute() == RET_OK
)
763 eFillDir
= pDlg
->GetFillDir();
764 eFillCmd
= pDlg
->GetFillCmd();
765 eFillDateCmd
= pDlg
->GetFillDateCmd();
767 if(eFillCmd
==FILL_AUTO
)
769 String aStr
=pDlg
->GetStartStr();
771 pTabViewShell
->EnterData( nStartCol
, nStartRow
, nStartTab
, aStr
);
773 fStartVal
= pDlg
->GetStart();
774 fIncVal
= pDlg
->GetStep();
775 fMaxVal
= pDlg
->GetMax();
783 //nScFillModeMouseModifier = 0; // kein Ctrl/Copy
784 pTabViewShell
->FillSeries( eFillDir
, eFillCmd
, eFillDateCmd
, fStartVal
, fIncVal
, fMaxVal
);
793 case FILL_TO_BOTTOM
: aPara
= 'B'; break;
794 case FILL_TO_RIGHT
: aPara
= 'R'; break;
795 case FILL_TO_TOP
: aPara
= 'T'; break;
796 case FILL_TO_LEFT
: aPara
= 'L'; break;
797 default: aPara
.Erase(); break;
799 rReq
.AppendItem( SfxStringItem( FID_FILL_SERIES
, aPara
) );
803 case FILL_SIMPLE
: aPara
= 'S'; break;
804 case FILL_LINEAR
: aPara
= 'L'; break;
805 case FILL_GROWTH
: aPara
= 'G'; break;
806 case FILL_DATE
: aPara
= 'D'; break;
807 case FILL_AUTO
: aPara
= 'A'; break;
808 default: aPara
.Erase(); break;
810 rReq
.AppendItem( SfxStringItem( FN_PARAM_1
, aPara
) );
812 switch( eFillDateCmd
)
814 case FILL_DAY
: aPara
= 'D'; break;
815 case FILL_WEEKDAY
: aPara
= 'W'; break;
816 case FILL_MONTH
: aPara
= 'M'; break;
817 case FILL_YEAR
: aPara
= 'Y'; break;
818 default: aPara
.Erase(); break;
820 rReq
.AppendItem( SfxStringItem( FN_PARAM_2
, aPara
) );
822 ULONG nFormatKey
= pFormatter
->GetStandardFormat(NUMBERFORMAT_NUMBER
,
825 pFormatter
->GetOutputString( fIncVal
, nFormatKey
, aPara
, &pColor
);
826 rReq
.AppendItem( SfxStringItem( FN_PARAM_3
, aPara
) );
828 pFormatter
->GetOutputString( fStartVal
, nFormatKey
, aPara
, &pColor
);
829 rReq
.AppendItem( SfxStringItem( FN_PARAM_4
, aPara
) );
831 pFormatter
->GetOutputString( fMaxVal
, nFormatKey
, aPara
, &pColor
);
832 rReq
.AppendItem( SfxStringItem( FN_PARAM_5
, aPara
) );
846 SCTAB nStartTab
, nEndTab
;
848 GetViewData()->GetFillData( nStartCol
, nStartRow
, nEndCol
, nEndRow
);
849 SCCOL nFillCol
= GetViewData()->GetRefEndX();
850 SCROW nFillRow
= GetViewData()->GetRefEndY();
851 ScDocument
* pDoc
= GetViewData()->GetDocument();
853 if( pReqArgs
!= NULL
)
855 const SfxPoolItem
* pItem
;
857 if( IS_AVAILABLE( FID_FILL_AUTO
, &pItem
) )
859 ScAddress aScAddress
;
860 String aArg
= ((const SfxStringItem
*)pItem
)->GetValue();
862 if( aScAddress
.Parse( aArg
, pDoc
, pDoc
->GetAddressConvention() ) & SCA_VALID
)
864 nFillRow
= aScAddress
.Row();
865 nFillCol
= aScAddress
.Col();
869 GetViewData()->GetSimpleArea( nStartCol
,nStartRow
,nStartTab
,
870 nEndCol
,nEndRow
,nEndTab
);
872 else // Aufruf per Maus
874 // #55284# nicht innerhalb einer zusammengefassten Zelle
876 if ( nStartCol
== nEndCol
&& nStartRow
== nEndRow
)
878 SCCOL nMergeCol
= nStartCol
;
879 SCROW nMergeRow
= nStartRow
;
880 if ( GetViewData()->GetDocument()->ExtendMerge(
881 nStartCol
, nStartRow
, nMergeCol
, nMergeRow
,
882 GetViewData()->GetTabNo() ) )
884 if ( nFillCol
>= nStartCol
&& nFillCol
<= nMergeCol
&& nFillRow
== nStartRow
)
885 nFillCol
= nStartCol
;
886 if ( nFillRow
>= nStartRow
&& nFillRow
<= nMergeRow
&& nFillCol
== nStartCol
)
887 nFillRow
= nStartRow
;
892 if ( nFillCol
!= nEndCol
|| nFillRow
!= nEndRow
)
894 if ( nFillCol
==nEndCol
|| nFillRow
==nEndRow
)
896 FillDir eDir
= FILL_TO_BOTTOM
;
899 if ( nFillCol
==nEndCol
)
901 if ( nFillRow
> nEndRow
)
903 eDir
= FILL_TO_BOTTOM
;
904 nCount
= nFillRow
- nEndRow
;
906 else if ( nFillRow
< nStartRow
)
909 nCount
= nStartRow
- nFillRow
;
914 if ( nFillCol
> nEndCol
)
916 eDir
= FILL_TO_RIGHT
;
917 nCount
= nFillCol
- nEndCol
;
919 else if ( nFillCol
< nStartCol
)
922 nCount
= nStartCol
- nFillCol
;
928 pTabViewShell
->FillAuto( eDir
, nStartCol
, nStartRow
, nEndCol
, nEndRow
, nCount
);
933 ScAddress
aAdr( nFillCol
, nFillRow
, 0 );
934 aAdr
.Format( aAdrStr
, SCR_ABS
, pDoc
, pDoc
->GetAddressConvention() );
936 rReq
.AppendItem( SfxStringItem( FID_FILL_AUTO
, aAdrStr
) );
944 DBG_ERROR( "Richtung nicht eindeutig fuer AutoFill" );
951 // Gliederung (Outlines)
952 // SID_AUTO_OUTLINE, SID_OUTLINE_DELETEALL in Execute (in docsh.idl)
955 case SID_OUTLINE_HIDE
:
956 if ( GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(),
957 GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) )
958 pTabViewShell
->SetDataPilotDetails( FALSE
);
960 pTabViewShell
->HideMarkedOutlines();
964 case SID_OUTLINE_SHOW
:
966 ScDPObject
* pDPObj
= GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(),
967 GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
970 Sequence
<sheet::DataPilotFieldFilter
> aFilters
;
972 if ( pTabViewShell
->HasSelectionForDrillDown( nOrientation
) )
974 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
975 DBG_ASSERT(pFact
, "ScAbstractFactory create fail!");//CHINA001
977 AbstractScDPShowDetailDlg
* pDlg
= pFact
->CreateScDPShowDetailDlg(
978 pTabViewShell
->GetDialogParent(), RID_SCDLG_DPSHOWDETAIL
, *pDPObj
, nOrientation
);
979 DBG_ASSERT(pDlg
, "Dialog create fail!");//CHINA001
980 if ( pDlg
->Execute() == RET_OK
)
982 String
aNewDimName( pDlg
->GetDimensionName() );
983 pTabViewShell
->SetDataPilotDetails( TRUE
, &aNewDimName
);
986 else if ( !pDPObj
->IsServiceData() &&
987 pDPObj
->GetDataFieldPositionData(
988 ScAddress( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ),
990 pTabViewShell
->ShowDataPilotSourceData( *pDPObj
, aFilters
);
992 pTabViewShell
->SetDataPilotDetails( TRUE
);
995 pTabViewShell
->ShowMarkedOutlines();
1000 case SID_OUTLINE_MAKE
:
1002 BOOL bColumns
= FALSE
;
1005 if ( GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(),
1006 GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) )
1008 ScDPNumGroupInfo aNumInfo
;
1009 aNumInfo
.Enable
= sal_True
;
1010 aNumInfo
.AutoStart
= sal_True
;
1011 aNumInfo
.AutoEnd
= sal_True
;
1012 sal_Int32 nParts
= 0;
1013 if ( pTabViewShell
->HasSelectionForDateGroup( aNumInfo
, nParts
) )
1015 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
1016 DBG_ASSERT( pFact
, "ScAbstractFactory create fail!" );
1017 Date
aNullDate( *GetViewData()->GetDocument()->GetFormatTable()->GetNullDate() );
1018 AbstractScDPDateGroupDlg
* pDlg
= pFact
->CreateScDPDateGroupDlg(
1019 pTabViewShell
->GetDialogParent(), RID_SCDLG_DPDATEGROUP
,
1020 aNumInfo
, nParts
, aNullDate
);
1021 DBG_ASSERT( pDlg
, "Dialog create fail!" );
1022 if( pDlg
->Execute() == RET_OK
)
1024 aNumInfo
= pDlg
->GetGroupInfo();
1025 pTabViewShell
->DateGroupDataPilot( aNumInfo
, pDlg
->GetDatePart() );
1028 else if ( pTabViewShell
->HasSelectionForNumGroup( aNumInfo
) )
1030 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
1031 DBG_ASSERT( pFact
, "ScAbstractFactory create fail!" );
1032 AbstractScDPNumGroupDlg
* pDlg
= pFact
->CreateScDPNumGroupDlg(
1033 pTabViewShell
->GetDialogParent(), RID_SCDLG_DPNUMGROUP
, aNumInfo
);
1034 DBG_ASSERT( pDlg
, "Dialog create fail!" );
1035 if( pDlg
->Execute() == RET_OK
)
1036 pTabViewShell
->NumGroupDataPilot( pDlg
->GetGroupInfo() );
1039 pTabViewShell
->GroupDataPilot();
1043 else if( pReqArgs
!= NULL
)
1045 const SfxPoolItem
* pItem
;
1048 if( IS_AVAILABLE( SID_OUTLINE_MAKE
, &pItem
) )
1050 String aCol
= ((const SfxStringItem
*)pItem
)->GetValue();
1051 aCol
.ToUpperAscii();
1053 switch( aCol
.GetChar(0) )
1055 case 'R': bColumns
=FALSE
; bOk
= TRUE
;break;
1056 case 'C': bColumns
=TRUE
; bOk
= TRUE
;break;
1060 else // Dialog, wenn nicht ganze Zeilen/Spalten markiert
1062 if ( GetViewData()->SimpleColMarked() && !GetViewData()->SimpleRowMarked() )
1064 else if ( !GetViewData()->SimpleColMarked() && GetViewData()->SimpleRowMarked() )
1068 //CHINA001 ScGroupDlg* pDlg = new ScGroupDlg(pTabViewShell->GetDialogParent(),
1069 //CHINA001 RID_SCDLG_GRP_MAKE, FALSE );
1070 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
1071 DBG_ASSERT(pFact
, "ScAbstractFactory create fail!");//CHINA001
1073 AbstractScGroupDlg
* pDlg
= pFact
->CreateAbstractScGroupDlg( pTabViewShell
->GetDialogParent(), RID_SCDLG_GRP_MAKE
, RID_SCDLG_GRP_MAKE
,FALSE
);
1074 DBG_ASSERT(pDlg
, "Dialog create fail!");//CHINA001
1075 if ( pDlg
->Execute() == RET_OK
)
1076 bColumns
= pDlg
->GetColsChecked();
1084 pTabViewShell
->MakeOutline( bColumns
);
1086 if( ! rReq
.IsAPI() )
1088 String aCol
= bColumns
? 'C' : 'R';
1089 rReq
.AppendItem( SfxStringItem( SID_OUTLINE_MAKE
, aCol
) );
1096 case SID_OUTLINE_REMOVE
:
1098 BOOL bColumns
= FALSE
;
1101 if ( GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(),
1102 GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) )
1104 pTabViewShell
->UngroupDataPilot();
1107 else if( pReqArgs
!= NULL
)
1109 const SfxPoolItem
* pItem
;
1112 if( IS_AVAILABLE( SID_OUTLINE_REMOVE
, &pItem
) )
1114 String aCol
= ((const SfxStringItem
*)pItem
)->GetValue();
1115 aCol
.ToUpperAscii();
1117 switch( aCol
.GetChar(0) )
1119 case 'R': bColumns
=FALSE
; bOk
= TRUE
;break;
1120 case 'C': bColumns
=TRUE
; bOk
= TRUE
;break;
1124 else // Dialog nur, wenn Aufheben fuer Zeilen und Spalten moeglich
1126 BOOL bColPoss
, bRowPoss
;
1127 pTabViewShell
->TestRemoveOutline( bColPoss
, bRowPoss
);
1128 if ( bColPoss
&& bRowPoss
)
1130 //CHINA001 ScGroupDlg* pDlg = new ScGroupDlg( pTabViewShell->GetDialogParent(),
1131 //CHINA001 RID_SCDLG_GRP_KILL, TRUE );
1132 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
1133 DBG_ASSERT(pFact
, "ScAbstractFactory create fail!");//CHINA001
1135 AbstractScGroupDlg
* pDlg
= pFact
->CreateAbstractScGroupDlg( pTabViewShell
->GetDialogParent(), RID_SCDLG_GRP_KILL
, RID_SCDLG_GRP_KILL
,TRUE
);
1136 DBG_ASSERT(pDlg
, "Dialog create fail!");//CHINA001
1137 if ( pDlg
->Execute() == RET_OK
)
1138 bColumns
= pDlg
->GetColsChecked();
1143 else if ( bColPoss
)
1145 else if ( bRowPoss
)
1152 pTabViewShell
->RemoveOutline( bColumns
);
1154 if( ! rReq
.IsAPI() )
1156 String aCol
= bColumns
? 'C' : 'R';
1157 rReq
.AppendItem( SfxStringItem( SID_OUTLINE_REMOVE
, aCol
) );
1168 case SID_COPY
: // fuer Grafiken in DrawShell
1170 WaitObject
aWait( GetViewData()->GetDialogParent() );
1171 pTabViewShell
->CopyToClip( NULL
, FALSE
, FALSE
, TRUE
);
1173 GetViewData()->SetPasteMode( (ScPasteFlags
) (SC_PASTE_MODE
| SC_PASTE_BORDER
) );
1174 pTabViewShell
->ShowCursor();
1178 case SID_CUT
: // fuer Grafiken in DrawShell
1180 WaitObject
aWait( GetViewData()->GetDialogParent() );
1181 pTabViewShell
->CutToClip( NULL
, TRUE
);
1183 GetViewData()->SetPasteMode( SC_PASTE_MODE
);
1189 PasteFromClipboard ( GetViewData(), pTabViewShell
, true );
1194 case SID_CLIPBOARD_FORMAT_ITEMS
:
1196 WaitObject
aWait( GetViewData()->GetDialogParent() );
1199 const SfxPoolItem
* pItem
;
1201 pReqArgs
->GetItemState(nSlot
, TRUE
, &pItem
) == SFX_ITEM_SET
&&
1202 pItem
->ISA(SfxUInt32Item
) )
1204 nFormat
= ((const SfxUInt32Item
*)pItem
)->GetValue();
1209 Window
* pWin
= GetViewData()->GetActiveWin();
1210 BOOL bCells
= ( ScTransferObj::GetOwnClipboard( pWin
) != NULL
);
1211 BOOL bDraw
= ( ScDrawTransferObj::GetOwnClipboard( pWin
) != NULL
);
1212 BOOL bOle
= ( nFormat
== SOT_FORMATSTR_ID_EMBED_SOURCE
);
1214 if ( bCells
&& bOle
)
1215 pTabViewShell
->PasteFromSystem();
1216 else if ( bDraw
&& bOle
)
1217 pTabViewShell
->PasteDraw();
1219 pTabViewShell
->PasteFromSystem(nFormat
);
1222 //? pTabViewShell->PasteFromSystem();
1226 pTabViewShell
->CellContentChanged();
1229 case FID_INS_CELL_CONTENTS
:
1231 USHORT nFlags
= IDF_NONE
;
1232 USHORT nFunction
= PASTE_NOFUNC
;
1233 BOOL bSkipEmpty
= FALSE
;
1234 BOOL bTranspose
= FALSE
;
1235 BOOL bAsLink
= FALSE
;
1236 InsCellCmd eMoveMode
= INS_NONE
;
1238 Window
* pWin
= GetViewData()->GetActiveWin();
1239 ScDocument
* pDoc
= GetViewData()->GetDocument();
1240 BOOL bOtherDoc
= !pDoc
->IsClipboardSource();
1241 ScTransferObj
* pOwnClip
= ScTransferObj::GetOwnClipboard( pWin
);
1244 // #129384# keep a reference in case the clipboard is changed during dialog or PasteFromClip
1245 uno::Reference
<datatransfer::XTransferable
> aOwnClipRef( pOwnClip
);
1246 if ( pReqArgs
!=NULL
&& pTabViewShell
->SelectionEditable() )
1248 const SfxPoolItem
* pItem
;
1249 String aFlags
= 'A';
1251 if( IS_AVAILABLE( FID_INS_CELL_CONTENTS
, &pItem
) )
1252 aFlags
= ((const SfxStringItem
*)pItem
)->GetValue();
1254 aFlags
.ToUpperAscii();
1257 for( xub_StrLen i
=0 ; bCont
&& i
<aFlags
.Len() ; i
++ )
1259 switch( aFlags
.GetChar(i
) )
1263 bCont
= FALSE
; // nicht mehr weitermachen!
1265 case 'S': nFlags
|= IDF_STRING
; break;
1266 case 'V': nFlags
|= IDF_VALUE
; break;
1267 case 'D': nFlags
|= IDF_DATETIME
; break;
1268 case 'F': nFlags
|= IDF_FORMULA
; break;
1269 case 'N': nFlags
|= IDF_NOTE
; break;
1270 case 'T': nFlags
|= IDF_ATTRIB
; break;
1274 SFX_REQUEST_ARG( rReq
, pFuncItem
, SfxUInt16Item
, FN_PARAM_1
, sal_False
);
1275 SFX_REQUEST_ARG( rReq
, pSkipItem
, SfxBoolItem
, FN_PARAM_2
, sal_False
);
1276 SFX_REQUEST_ARG( rReq
, pTransposeItem
, SfxBoolItem
, FN_PARAM_3
, sal_False
);
1277 SFX_REQUEST_ARG( rReq
, pLinkItem
, SfxBoolItem
, FN_PARAM_4
, sal_False
);
1278 SFX_REQUEST_ARG( rReq
, pMoveItem
, SfxInt16Item
, FN_PARAM_5
, sal_False
);
1280 nFunction
= pFuncItem
->GetValue();
1282 bSkipEmpty
= pSkipItem
->GetValue();
1283 if ( pTransposeItem
)
1284 bTranspose
= pTransposeItem
->GetValue();
1286 bAsLink
= pLinkItem
->GetValue();
1288 eMoveMode
= (InsCellCmd
) pMoveItem
->GetValue();
1292 ScEditableTester
aTester( pTabViewShell
);
1293 if (aTester
.IsEditable())
1295 //CHINA001 ScInsertContentsDlg* pDlg = new ScInsertContentsDlg( pTabViewShell->GetDialogParent() );
1296 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
1297 DBG_ASSERT(pFact
, "ScAbstractFactory create fail!");//CHINA001
1299 AbstractScInsertContentsDlg
* pDlg
= pFact
->CreateScInsertContentsDlg( pTabViewShell
->GetDialogParent(),
1301 DBG_ASSERT(pDlg
, "Dialog create fail!");//CHINA001
1302 pDlg
->SetOtherDoc( bOtherDoc
);
1303 // #53661# bei ChangeTrack MoveMode disablen
1304 pDlg
->SetChangeTrack( pDoc
->GetChangeTrack() != NULL
);
1305 // #72930# cut/move references may disable shift
1306 // directions if source and destination ranges intersect
1309 if ( pOwnClip
&& pOwnClip
->GetDocument()->IsCutMode() )
1311 ScViewData
* pData
= GetViewData();
1312 if ( pData
->GetMarkData().GetTableSelect(
1313 pData
->GetTabNo() ) )
1315 SCCOL nPosX
= pData
->GetCurX();
1316 SCROW nPosY
= pData
->GetCurY();
1317 SCCOL nClipStartX
, nClipSizeX
;
1318 SCROW nClipStartY
, nClipSizeY
;
1319 pOwnClip
->GetDocument()->GetClipStart( nClipStartX
, nClipStartY
);
1320 // for CutMode, filtered rows can always be included
1321 pOwnClip
->GetDocument()->GetClipArea( nClipSizeX
, nClipSizeY
, TRUE
);
1322 int nDisableShift
= 0;
1323 if ( nClipStartX
<= nPosX
+ nClipSizeX
&&
1324 nPosX
<= nClipStartX
+ nClipSizeX
)
1325 nDisableShift
|= SC_CELL_SHIFT_DISABLE_DOWN
;
1326 if ( nClipStartY
<= nPosY
+ nClipSizeY
&&
1327 nPosY
<= nClipStartY
+ nClipSizeY
)
1328 nDisableShift
|= SC_CELL_SHIFT_DISABLE_RIGHT
;
1329 if ( nDisableShift
)
1330 pDlg
->SetCellShiftDisabled( nDisableShift
);
1334 if (pDlg
->Execute() == RET_OK
)
1336 nFlags
= pDlg
->GetInsContentsCmdBits();
1337 nFunction
= pDlg
->GetFormulaCmdBits();
1338 bSkipEmpty
= pDlg
->IsSkipEmptyCells();
1339 bTranspose
= pDlg
->IsTranspose();
1340 bAsLink
= pDlg
->IsLink();
1341 eMoveMode
= pDlg
->GetMoveMode();
1346 pTabViewShell
->ErrorMessage(aTester
.GetMessageId());
1349 if( nFlags
!= IDF_NONE
)
1352 WaitObject
aWait( GetViewData()->GetDialogParent() );
1353 if ( bAsLink
&& bOtherDoc
)
1354 pTabViewShell
->PasteFromSystem(SOT_FORMATSTR_ID_LINK
); // DDE einfuegen
1356 pTabViewShell
->PasteFromClip( nFlags
, pOwnClip
->GetDocument(),
1357 nFunction
, bSkipEmpty
, bTranspose
, bAsLink
,
1358 eMoveMode
, IDF_NONE
, TRUE
); // allow warning dialog
1365 if( nFlags
== IDF_ALL
)
1371 if( nFlags
& IDF_STRING
) aFlags
+= 'S';
1372 if( nFlags
& IDF_VALUE
) aFlags
+= 'V';
1373 if( nFlags
& IDF_DATETIME
) aFlags
+= 'D';
1374 if( nFlags
& IDF_FORMULA
) aFlags
+= 'F';
1375 if( nFlags
& IDF_NOTE
) aFlags
+= 'N';
1376 if( nFlags
& IDF_ATTRIB
) aFlags
+= 'T';
1379 rReq
.AppendItem( SfxStringItem( FID_INS_CELL_CONTENTS
, aFlags
) );
1380 rReq
.AppendItem( SfxBoolItem( FN_PARAM_2
, bSkipEmpty
) );
1381 rReq
.AppendItem( SfxBoolItem( FN_PARAM_3
, bTranspose
) );
1382 rReq
.AppendItem( SfxBoolItem( FN_PARAM_4
, bAsLink
) );
1383 rReq
.AppendItem( SfxUInt16Item( FN_PARAM_1
, nFunction
) );
1384 rReq
.AppendItem( SfxInt16Item( FN_PARAM_5
, (sal_Int16
) eMoveMode
) );
1390 pTabViewShell
->CellContentChanged(); // => PasteFromXXX ???
1393 case FID_PASTE_CONTENTS
:
1394 // Unterscheidung, ob eigene oder fremde Daten,
1395 // dadurch FID_INS_CELL_CONTENTS ueberfluessig
1397 Window
* pWin
= GetViewData()->GetActiveWin();
1399 // Clipboard-ID als Parameter angegeben? Basic "PasteSpecial(Format)"
1400 const SfxPoolItem
* pItem
=NULL
;
1402 pReqArgs
->GetItemState(nSlot
, TRUE
, &pItem
) == SFX_ITEM_SET
&&
1403 pItem
->ISA(SfxUInt32Item
) )
1405 ULONG nFormat
= ((const SfxUInt32Item
*)pItem
)->GetValue();
1408 WaitObject
aWait( GetViewData()->GetDialogParent() );
1409 BOOL bDraw
= ( ScDrawTransferObj::GetOwnClipboard( pWin
) != NULL
);
1410 if ( bDraw
&& nFormat
== SOT_FORMATSTR_ID_EMBED_SOURCE
)
1411 pTabViewShell
->PasteDraw();
1413 bRet
= pTabViewShell
->PasteFromSystem(nFormat
, TRUE
); // TRUE: keine Fehlermeldungen
1418 rReq
.SetReturnValue(SfxInt16Item(nSlot
, bRet
)); // 1 = Erfolg, 0 = Fehler
1422 // if format is not available -> fallback to request without parameters
1428 if ( ScTransferObj::GetOwnClipboard( pWin
) ) // own cell data
1430 rReq
.SetSlot( FID_INS_CELL_CONTENTS
);
1431 ExecuteSlot( rReq
, GetInterface() );
1432 rReq
.SetReturnValue(SfxInt16Item(nSlot
, 1)); // 1 = Erfolg
1434 else // Zeichenobjekte oder fremde Daten
1436 BOOL bDraw
= ( ScDrawTransferObj::GetOwnClipboard( pWin
) != NULL
);
1438 SvxClipboardFmtItem
aFormats( SID_CLIPBOARD_FORMAT_ITEMS
);
1439 GetPossibleClipboardFormats( aFormats
);
1441 USHORT nFormatCount
= aFormats
.Count();
1444 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
1445 SfxAbstractPasteDialog
* pDlg
= pFact
->CreatePasteDialog( pTabViewShell
->GetDialogParent() );
1448 for (USHORT i
=0; i
<nFormatCount
; i
++)
1450 ULONG nFormatId
= aFormats
.GetClipbrdFormatId( i
);
1451 String aName
= aFormats
.GetClipbrdFormatName( i
);
1452 // special case for paste dialog: '*' is replaced by object type
1453 if ( nFormatId
== SOT_FORMATSTR_ID_EMBED_SOURCE
)
1454 aName
.Assign((sal_Unicode
)'*');
1455 pDlg
->Insert( nFormatId
, aName
);
1458 TransferableDataHelper
aDataHelper(
1459 TransferableDataHelper::CreateFromSystemClipboard( pWin
) );
1460 ULONG nFormat
= pDlg
->GetFormat( aDataHelper
.GetTransferable() );
1464 WaitObject
aWait( GetViewData()->GetDialogParent() );
1465 if ( bDraw
&& nFormat
== SOT_FORMATSTR_ID_EMBED_SOURCE
)
1466 pTabViewShell
->PasteDraw();
1468 pTabViewShell
->PasteFromSystem(nFormat
);
1470 rReq
.SetReturnValue(SfxInt16Item(nSlot
, 1)); // 1 = Erfolg
1471 rReq
.AppendItem( SfxUInt32Item( nSlot
, nFormat
) );
1476 rReq
.SetReturnValue(SfxInt16Item(nSlot
, 0)); // 0 = Fehler
1484 rReq
.SetReturnValue(SfxInt16Item(nSlot
, 0)); // 0 = Fehler
1488 pTabViewShell
->CellContentChanged(); // => PasteFromSystem() ???
1492 // clipboard slots were used only for old basic:
1494 case SID_GET_CLPBRD_FORMAT_COUNT
:
1495 rReq
.SetReturnValue( SfxUInt16Item( nSlot
, Clipboard::GetFormatCount() ) );
1498 case SID_GET_CLPBRD_FORMAT_BY_IDX
:
1501 const SfxPoolItem
* pItem
;
1502 if ( pReqArgs
->GetItemState(nSlot
, TRUE
, &pItem
) == SFX_ITEM_SET
&&
1503 pItem
->ISA(SfxUInt16Item
) )
1505 USHORT nCount
= Clipboard::GetFormatCount();
1506 USHORT nPos
= ((const SfxUInt16Item
*)pItem
)->GetValue(); // 1-based
1507 if ( nPos
&& nPos
<= nCount
)
1508 rReq
.SetReturnValue( SfxUInt32Item( nSlot
, Clipboard::GetFormat(--nPos
) ) );
1513 case SID_GET_CLPBRD_FORMAT_NAME
:
1516 const SfxPoolItem
* pItem
;
1517 if ( pReqArgs
->GetItemState(nSlot
, TRUE
, &pItem
) == SFX_ITEM_SET
&&
1518 pItem
->ISA(SfxUInt32Item
) )
1520 String aName
= Exchange::GetFormatName(
1521 ((const SfxUInt32Item
*)pItem
)->GetValue() );
1522 rReq
.SetReturnValue( SfxStringItem( nSlot
, aName
) );
1532 case FID_INS_ROWBRK
:
1533 pTabViewShell
->InsertPageBreak( FALSE
);
1537 case FID_INS_COLBRK
:
1538 pTabViewShell
->InsertPageBreak( TRUE
);
1542 case FID_DEL_ROWBRK
:
1543 pTabViewShell
->DeletePageBreak( FALSE
);
1547 case FID_DEL_COLBRK
:
1548 pTabViewShell
->DeletePageBreak( TRUE
);
1552 case SID_DETECTIVE_ADD_PRED
:
1553 pTabViewShell
->DetectiveAddPred();
1557 case SID_DETECTIVE_DEL_PRED
:
1558 pTabViewShell
->DetectiveDelPred();
1562 case SID_DETECTIVE_ADD_SUCC
:
1563 pTabViewShell
->DetectiveAddSucc();
1567 case SID_DETECTIVE_DEL_SUCC
:
1568 pTabViewShell
->DetectiveDelSucc();
1572 case SID_DETECTIVE_ADD_ERR
:
1573 pTabViewShell
->DetectiveAddError();
1577 case SID_DETECTIVE_INVALID
:
1578 pTabViewShell
->DetectiveMarkInvalid();
1582 case SID_DETECTIVE_REFRESH
:
1583 pTabViewShell
->DetectiveRefresh();
1587 case SID_DETECTIVE_MARK_PRED
:
1588 pTabViewShell
->DetectiveMarkPred();
1590 case SID_DETECTIVE_MARK_SUCC
:
1591 pTabViewShell
->DetectiveMarkSucc();
1594 case SID_SPELL_DIALOG
:
1595 // pTabViewShell->DoSpellingChecker();
1597 SfxViewFrame
* pViewFrame
= pTabViewShell
->GetViewFrame();
1598 if( rReq
.GetArgs() )
1599 pViewFrame
->SetChildWindow( SID_SPELL_DIALOG
,
1600 static_cast< const SfxBoolItem
& >( rReq
.GetArgs()->
1601 Get( SID_SPELL_DIALOG
) ).GetValue() );
1603 pViewFrame
->ToggleChildWindow( SID_SPELL_DIALOG
);
1605 pViewFrame
->GetBindings().Invalidate( SID_SPELL_DIALOG
);
1610 case SID_HANGUL_HANJA_CONVERSION
:
1611 pTabViewShell
->DoHangulHanjaConversion();
1614 case SID_CHINESE_CONVERSION
:
1616 //open ChineseTranslationDialog
1617 Reference
< XComponentContext
> xContext(
1618 ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one
1621 Reference
< lang::XMultiComponentFactory
> xMCF( xContext
->getServiceManager() );
1624 Reference
< ui::dialogs::XExecutableDialog
> xDialog(
1625 xMCF
->createInstanceWithContext(
1626 rtl::OUString::createFromAscii("com.sun.star.linguistic2.ChineseTranslationDialog")
1627 , xContext
), UNO_QUERY
);
1628 Reference
< lang::XInitialization
> xInit( xDialog
, UNO_QUERY
);
1631 // initialize dialog
1632 Reference
< awt::XWindow
> xDialogParentWindow(0);
1633 Sequence
<Any
> aSeq(1);
1634 Any
* pArray
= aSeq
.getArray();
1635 PropertyValue aParam
;
1636 aParam
.Name
= rtl::OUString::createFromAscii("ParentWindow");
1637 aParam
.Value
<<= makeAny(xDialogParentWindow
);
1638 pArray
[0] <<= makeAny(aParam
);
1639 xInit
->initialize( aSeq
);
1642 sal_Int16 nDialogRet
= xDialog
->execute();
1643 if( RET_OK
== nDialogRet
)
1645 //get some parameters from the dialog
1646 sal_Bool bToSimplified
= sal_True
;
1647 sal_Bool bUseVariants
= sal_True
;
1648 sal_Bool bCommonTerms
= sal_True
;
1649 Reference
< beans::XPropertySet
> xProp( xDialog
, UNO_QUERY
);
1654 xProp
->getPropertyValue( C2U("IsDirectionToSimplified") ) >>= bToSimplified
;
1655 xProp
->getPropertyValue( C2U("IsUseCharacterVariants") ) >>= bUseVariants
;
1656 xProp
->getPropertyValue( C2U("IsTranslateCommonTerms") ) >>= bCommonTerms
;
1663 //execute translation
1664 LanguageType eSourceLang
= bToSimplified
? LANGUAGE_CHINESE_TRADITIONAL
: LANGUAGE_CHINESE_SIMPLIFIED
;
1665 LanguageType eTargetLang
= bToSimplified
? LANGUAGE_CHINESE_SIMPLIFIED
: LANGUAGE_CHINESE_TRADITIONAL
;
1666 sal_Int32 nOptions
= bUseVariants
? i18n::TextConversionOption::USE_CHARACTER_VARIANTS
: 0;
1668 nOptions
|= i18n::TextConversionOption::CHARACTER_BY_CHARACTER
;
1670 Font aTargetFont
= GetViewData()->GetActiveWin()->GetDefaultFont(
1671 DEFAULTFONT_CJK_SPREADSHEET
,
1672 eTargetLang
, DEFAULTFONT_FLAGS_ONLYONE
);
1673 ScConversionParam
aConvParam( SC_CONVERSION_CHINESE_TRANSL
,
1674 eSourceLang
, eTargetLang
, aTargetFont
, nOptions
, false );
1675 pTabViewShell
->DoSheetConversion( aConvParam
);
1678 Reference
< lang::XComponent
> xComponent( xDialog
, UNO_QUERY
);
1679 if( xComponent
.is() )
1680 xComponent
->dispose();
1687 pTabViewShell
->DoThesaurus();
1690 case SID_TOGGLE_REL
:
1691 pTabViewShell
->DoRefConversion();
1694 case SID_DEC_INDENT
:
1695 pTabViewShell
->ChangeIndent( FALSE
);
1697 case SID_INC_INDENT
:
1698 pTabViewShell
->ChangeIndent( TRUE
);
1703 USHORT nFlags
= pTabViewShell
->GetCreateNameFlags();
1705 //CHINA001 ScNameCreateDlg* pDlg = new ScNameCreateDlg( pTabViewShell->GetDialogParent(), nFlags );
1706 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
1707 DBG_ASSERT(pFact
, "ScAbstractFactory create fail!");//CHINA001
1709 AbstractScNameCreateDlg
* pDlg
= pFact
->CreateScNameCreateDlg(pTabViewShell
->GetDialogParent(), nFlags
, RID_SCDLG_NAMES_CREATE
);
1710 DBG_ASSERT(pDlg
, "Dialog create fail!");//CHINA001
1712 if( pDlg
->Execute() )
1714 nFlags
= pDlg
->GetFlags();
1715 pTabViewShell
->CreateNames(nFlags
);
1722 case SID_CONSOLIDATE
:
1724 const SfxPoolItem
* pItem
;
1725 if ( pReqArgs
&& SFX_ITEM_SET
==
1726 pReqArgs
->GetItemState( SCITEM_CONSOLIDATEDATA
, TRUE
, &pItem
) )
1728 const ScConsolidateParam
& rParam
=
1729 ((const ScConsolidateItem
*)pItem
)->GetData();
1731 pTabViewShell
->Consolidate( rParam
);
1732 GetViewData()->GetDocument()->SetConsolidateDlgData( &rParam
);
1736 else if (rReq
.IsAPI())
1737 SbxBase::SetError(SbxERR_BAD_PARAMETER
);
1741 case SID_INS_FUNCTION
:
1743 const SfxBoolItem
* pOkItem
= (const SfxBoolItem
*)&pReqArgs
->Get( SID_DLG_RETOK
);
1745 // pScMod->SetFunctionDlg( NULL );
1747 if ( pOkItem
->GetValue() ) // OK
1750 const SfxStringItem
* pSItem
= (const SfxStringItem
*)&pReqArgs
->Get( SCITEM_STRING
);
1751 const SfxBoolItem
* pMatrixItem
= (const SfxBoolItem
*) &pReqArgs
->Get( SID_DLG_MATRIX
);
1753 aFormula
+= pSItem
->GetValue();
1754 pScMod
->ActivateInputWindow( &aFormula
, pMatrixItem
->GetValue() );
1758 pScMod
->ActivateInputWindow( NULL
);
1760 rReq
.Ignore(); // only SID_ENTER_STRING is recorded
1764 case FID_DEFINE_NAME
:
1767 const SfxPoolItem
* pItem
;
1768 String aName
, aSymbol
, aAttrib
;
1770 if( IS_AVAILABLE( FID_DEFINE_NAME
, &pItem
) )
1771 aName
= ((const SfxStringItem
*)pItem
)->GetValue();
1773 if( IS_AVAILABLE( FN_PARAM_1
, &pItem
) )
1774 aSymbol
= ((const SfxStringItem
*)pItem
)->GetValue();
1776 if( IS_AVAILABLE( FN_PARAM_2
, &pItem
) )
1777 aAttrib
= ((const SfxStringItem
*)pItem
)->GetValue();
1779 if ( aName
.Len() && aSymbol
.Len() )
1781 if (pTabViewShell
->InsertName( aName
, aSymbol
, aAttrib
))
1784 SbxBase::SetError( SbxERR_BAD_PARAMETER
); // Basic-Fehler
1789 USHORT nId
= ScNameDlgWrapper::GetChildWindowId();
1790 SfxViewFrame
* pViewFrm
= pTabViewShell
->GetViewFrame();
1791 SfxChildWindow
* pWnd
= pViewFrm
->GetChildWindow( nId
);
1793 pScMod
->SetRefDialog( nId
, pWnd
? FALSE
: TRUE
);
1797 case SID_DEFINE_COLROWNAMERANGES
:
1800 USHORT nId
= ScColRowNameRangesDlgWrapper::GetChildWindowId();
1801 SfxViewFrame
* pViewFrm
= pTabViewShell
->GetViewFrame();
1802 SfxChildWindow
* pWnd
= pViewFrm
->GetChildWindow( nId
);
1804 pScMod
->SetRefDialog( nId
, pWnd
? FALSE
: TRUE
);
1809 case SID_UPDATECHART
:
1815 const SfxPoolItem
* pItem
;
1817 if( IS_AVAILABLE( SID_UPDATECHART
, &pItem
) )
1818 bAll
= ((const SfxBoolItem
*)pItem
)->GetValue();
1821 pTabViewShell
->UpdateCharts( bAll
);
1823 if( ! rReq
.IsAPI() )
1825 rReq
.AppendItem( SfxBoolItem( SID_UPDATECHART
, bAll
) );
1835 const ScTabOpItem
& rItem
=
1836 (const ScTabOpItem
&)
1837 pReqArgs
->Get( SID_TABOP
);
1839 pTabViewShell
->TabOp( rItem
.GetData() );
1841 rReq
.Done( *pReqArgs
);
1848 const ScSolveItem
& rItem
=
1849 (const ScSolveItem
&)
1850 pReqArgs
->Get( SCITEM_SOLVEDATA
);
1852 pTabViewShell
->Solve( rItem
.GetData() );
1854 rReq
.Done( *pReqArgs
);
1858 case FID_INSERT_NAME
:
1860 ScDocument
* pDoc
= GetViewData()->GetDocument();
1861 //CHINA001 ScNamePasteDlg* pDlg = new ScNamePasteDlg( pTabViewShell->GetDialogParent(), pDoc->GetRangeName() );
1862 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
1863 DBG_ASSERT(pFact
, "ScAbstractFactory create fail!");//CHINA001
1865 AbstractScNamePasteDlg
* pDlg
= pFact
->CreateScNamePasteDlg( pTabViewShell
->GetDialogParent(), pDoc
->GetRangeName(), RID_SCDLG_NAMES_PASTE
);
1866 DBG_ASSERT(pDlg
, "Dialog create fail!");//CHINA001
1867 switch( pDlg
->Execute() )
1869 case BTN_PASTE_LIST
:
1870 pTabViewShell
->InsertNameList();
1872 case BTN_PASTE_NAME
:
1874 ScInputHandler
* pHdl
= pScMod
->GetInputHdl( pTabViewShell
);
1877 // das "=" per Key-Event, schaltet in den Eingabe-Modus
1878 pScMod
->InputKeyEvent( KeyEvent('=',KeyCode()) );
1880 String aName
= pDlg
->GetSelectedName();
1881 pHdl
->InsertFunction( aName
, FALSE
); // ohne "()"
1890 case SID_RANGE_NOTETEXT
:
1893 const SfxStringItem
& rTextItem
= (const SfxStringItem
&)pReqArgs
->Get( SID_RANGE_NOTETEXT
);
1895 // #43343# immer Cursorposition
1896 ScAddress
aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
1897 pTabViewShell
->SetNoteText( aPos
, rTextItem
.GetValue() );
1902 case SID_INSERT_POSTIT
:
1905 const SvxPostItAuthorItem
& rAuthorItem
= (const SvxPostItAuthorItem
&)pReqArgs
->Get( SID_ATTR_POSTIT_AUTHOR
);
1906 const SvxPostItDateItem
& rDateItem
= (const SvxPostItDateItem
&) pReqArgs
->Get( SID_ATTR_POSTIT_DATE
);
1907 const SvxPostItTextItem
& rTextItem
= (const SvxPostItTextItem
&) pReqArgs
->Get( SID_ATTR_POSTIT_TEXT
);
1909 ScAddress
aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
1910 pTabViewShell
->ReplaceNote( aPos
, rTextItem
.GetValue(), &rAuthorItem
.GetValue(), &rDateItem
.GetValue() );
1915 pTabViewShell
->EditNote(); // Zeichenobjekt zum Editieren
1919 case FID_NOTE_VISIBLE
:
1921 ScDocument
* pDoc
= GetViewData()->GetDocument();
1922 ScAddress
aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
1923 if( ScPostIt
* pNote
= pDoc
->GetNote( aPos
) )
1926 const SfxPoolItem
* pItem
;
1927 if ( pReqArgs
&& (pReqArgs
->GetItemState( FID_NOTE_VISIBLE
, TRUE
, &pItem
) == SFX_ITEM_SET
) )
1928 bShow
= ((const SfxBoolItem
*) pItem
)->GetValue();
1930 bShow
= !pNote
->IsCaptionShown();
1932 pTabViewShell
->ShowNote( bShow
);
1935 rReq
.AppendItem( SfxBoolItem( FID_NOTE_VISIBLE
, bShow
) );
1938 rBindings
.Invalidate( FID_NOTE_VISIBLE
);
1945 case SID_DELETE_NOTE
:
1946 pTabViewShell
->DeleteContents( IDF_NOTE
); // delete all notes in selection
1951 if( pReqArgs
!= NULL
)
1953 String aChars
, aFontName
;
1954 const SfxItemSet
*pArgs
= rReq
.GetArgs();
1955 const SfxPoolItem
* pItem
= 0;
1957 pArgs
->GetItemState(GetPool().GetWhich(SID_CHARMAP
), FALSE
, &pItem
);
1960 const SfxStringItem
* pStringItem
= PTR_CAST( SfxStringItem
, pItem
);
1962 aChars
= pStringItem
->GetValue();
1963 const SfxPoolItem
* pFtItem
= NULL
;
1964 pArgs
->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR
), FALSE
, &pFtItem
);
1965 const SfxStringItem
* pFontItem
= PTR_CAST( SfxStringItem
, pFtItem
);
1967 aFontName
= pFontItem
->GetValue();
1973 pTabViewShell
->GetSelectionPattern()->GetFont( aFont
, SC_AUTOCOL_BLACK
, NULL
, NULL
, NULL
,
1974 pTabViewShell
->GetSelectionScriptType() );
1975 if ( aFontName
.Len() )
1976 aFont
= Font( aFontName
, Size(1,1) );
1977 pTabViewShell
->InsertSpecialChar( aChars
, aFont
);
1978 if( ! rReq
.IsAPI() )
1984 //CHINA001 SvxCharacterMap* pDlg = new SvxCharacterMap( pTabViewShell->GetDialogParent(), FALSE );
1985 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
1987 // font color doesn't matter here
1989 pTabViewShell
->GetSelectionPattern()->GetFont( aCurFont
, SC_AUTOCOL_BLACK
, NULL
, NULL
, NULL
,
1990 pTabViewShell
->GetSelectionScriptType() );
1992 SfxAllItemSet
aSet( GetPool() );
1993 aSet
.Put( SfxBoolItem( FN_PARAM_1
, FALSE
) );
1994 aSet
.Put( SvxFontItem( aCurFont
.GetFamily(), aCurFont
.GetName(), aCurFont
.GetStyleName(), aCurFont
.GetPitch(), aCurFont
.GetCharSet(), GetPool().GetWhich(SID_ATTR_CHAR_FONT
) ) );
1996 SfxAbstractDialog
* pDlg
= pFact
->CreateSfxDialog( pTabViewShell
->GetDialogParent(), aSet
,
1997 pTabViewShell
->GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP
);
1999 if ( pDlg
->Execute() == RET_OK
)
2001 SFX_ITEMSET_ARG( pDlg
->GetOutputItemSet(), pItem
, SfxStringItem
, SID_CHARMAP
, FALSE
);
2002 SFX_ITEMSET_ARG( pDlg
->GetOutputItemSet(), pFontItem
, SvxFontItem
, SID_ATTR_CHAR_FONT
, FALSE
);
2004 if ( pItem
&& pFontItem
)
2006 Font
aNewFont( pFontItem
->GetFamilyName(), pFontItem
->GetStyleName(), Size(1,1) );
2007 aNewFont
.SetCharSet( pFontItem
->GetCharSet() );
2008 aNewFont
.SetPitch( pFontItem
->GetPitch() );
2009 pTabViewShell
->InsertSpecialChar( pItem
->GetValue(), aNewFont
);
2010 rReq
.AppendItem( *pFontItem
);
2011 rReq
.AppendItem( *pItem
);
2019 case SID_SELECT_SCENARIO
:
2025 const SfxStringItem
* pItem
=
2026 (const SfxStringItem
*)&pReqArgs
->Get( SID_SELECT_SCENARIO
);
2030 pTabViewShell
->UseScenario( pItem
->GetValue() );
2031 //! wofuer soll der Return-Wert gut sein?!?!
2032 rReq
.SetReturnValue( SfxStringItem( SID_SELECT_SCENARIO
, pItem
->GetValue() ) );
2043 case SID_HYPERLINK_SETLINK
:
2046 const SfxPoolItem
* pItem
;
2047 if( IS_AVAILABLE( SID_HYPERLINK_SETLINK
, &pItem
) )
2049 const SvxHyperlinkItem
* pHyper
= (const SvxHyperlinkItem
*) pItem
;
2050 const String
& rName
= pHyper
->GetName();
2051 const String
& rURL
= pHyper
->GetURL();
2052 const String
& rTarget
= pHyper
->GetTargetFrame();
2053 USHORT nType
= (USHORT
) pHyper
->GetInsertMode();
2055 pTabViewShell
->InsertURL( rName
, rURL
, rTarget
, nType
);
2063 case FID_CONDITIONAL_FORMAT
:
2066 const SfxPoolItem
* pItem
;
2067 if( IS_AVAILABLE( FID_CONDITIONAL_FORMAT
, &pItem
) )
2069 // Wenn RefInput auf andere Tabelle als Datentabelle umgeschaltet
2070 // hat wieder zurueckschalten:
2071 if ( GetViewData()->GetTabNo() != GetViewData()->GetRefTabNo() )
2073 pTabViewShell
->SetTabNo( GetViewData()->GetRefTabNo() );
2074 pTabViewShell
->PaintExtras();
2077 const ScCondFrmtItem
* pCndFmtItem
= (const ScCondFrmtItem
*) pItem
;
2078 pTabViewShell
->SetConditionalFormat( pCndFmtItem
->GetData() );
2084 case SID_EXTERNAL_SOURCE
:
2092 SFX_REQUEST_ARG( rReq
, pFile
, SfxStringItem
, SID_FILE_NAME
, sal_False
);
2093 SFX_REQUEST_ARG( rReq
, pSource
, SfxStringItem
, FN_PARAM_1
, sal_False
);
2094 if ( pFile
&& pSource
)
2096 aFile
= pFile
->GetValue();
2097 aSource
= pSource
->GetValue();
2098 SFX_REQUEST_ARG( rReq
, pFilter
, SfxStringItem
, SID_FILTER_NAME
, sal_False
);
2100 aFilter
= pFilter
->GetValue();
2101 SFX_REQUEST_ARG( rReq
, pOptions
, SfxStringItem
, SID_FILE_FILTEROPTIONS
, sal_False
);
2103 aOptions
= pOptions
->GetValue();
2104 SFX_REQUEST_ARG( rReq
, pRefresh
, SfxUInt32Item
, FN_PARAM_2
, sal_False
);
2106 nRefresh
= pRefresh
->GetValue();
2110 //CHINA001 ScLinkedAreaDlg* pDlg = new ScLinkedAreaDlg( pTabViewShell->GetDialogParent() );
2111 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
2112 DBG_ASSERT(pFact
, "ScAbstractFactory create fail!");//CHINA001
2114 delete pImpl
->m_pLinkedDlg
;
2115 pImpl
->m_pLinkedDlg
=
2116 pFact
->CreateScLinkedAreaDlg( pTabViewShell
->GetDialogParent(),
2117 RID_SCDLG_LINKAREA
);
2118 DBG_ASSERT(pImpl
->m_pLinkedDlg
, "Dialog create fail!");//CHINA001
2119 delete pImpl
->m_pRequest
;
2120 pImpl
->m_pRequest
= new SfxRequest( rReq
);
2121 pImpl
->m_pLinkedDlg
->StartExecuteModal( LINK( this, ScCellShell
, DialogClosed
) );
2125 ExecuteExternalSource( aFile
, aFilter
, aOptions
, aSource
, nRefresh
, rReq
);
2134 DBG_ERROR("falscher Slot bei ExecuteEdit");
2139 void ScCellShell::ExecuteTrans( SfxRequest
& rReq
)
2141 sal_Int32 nType
= ScViewUtil::GetTransliterationType( rReq
.GetSlot() );
2144 GetViewData()->GetView()->TransliterateText( nType
);
2149 void ScCellShell::ExecuteExternalSource(
2150 const String
& _rFile
, const String
& _rFilter
, const String
& _rOptions
,
2151 const String
& _rSource
, ULONG _nRefresh
, SfxRequest
& _rRequest
)
2153 if ( _rFile
.Len() && _rSource
.Len() ) // filter may be empty
2158 ScViewData
* pData
= GetViewData();
2159 ScMarkData
& rMark
= pData
->GetMarkData();
2160 rMark
.MarkToSimple();
2161 if ( rMark
.IsMarked() )
2163 rMark
.GetMarkArea( aLinkRange
);
2164 bMove
= TRUE
; // insert/delete cells to fit range
2167 aLinkRange
= ScRange( pData
->GetCurX(), pData
->GetCurY(), pData
->GetTabNo() );
2169 ScDocFunc
aFunc(*pData
->GetDocShell());
2170 aFunc
.InsertAreaLink( _rFile
, _rFilter
, _rOptions
, _rSource
,
2171 aLinkRange
, _nRefresh
, bMove
, FALSE
);
2178 IMPL_LINK( ScCellShell
, DialogClosed
, AbstractScLinkedAreaDlg
*, EMPTYARG
)
2180 DBG_ASSERT( pImpl
->m_pLinkedDlg
, "ScCellShell::DialogClosed(): invalid request" );
2181 DBG_ASSERT( pImpl
->m_pRequest
, "ScCellShell::DialogClosed(): invalid request" );
2182 String sFile
, sFilter
, sOptions
, sSource
;
2185 if ( pImpl
->m_pLinkedDlg
->GetResult() == RET_OK
)
2187 sFile
= pImpl
->m_pLinkedDlg
->GetURL();
2188 sFilter
= pImpl
->m_pLinkedDlg
->GetFilter();
2189 sOptions
= pImpl
->m_pLinkedDlg
->GetOptions();
2190 sSource
= pImpl
->m_pLinkedDlg
->GetSource();
2191 nRefresh
= pImpl
->m_pLinkedDlg
->GetRefresh();
2193 pImpl
->m_pRequest
->AppendItem( SfxStringItem( SID_FILE_NAME
, sFile
) );
2194 if ( sFilter
.Len() )
2195 pImpl
->m_pRequest
->AppendItem( SfxStringItem( SID_FILTER_NAME
, sFilter
) );
2196 if ( sOptions
.Len() )
2197 pImpl
->m_pRequest
->AppendItem( SfxStringItem( SID_FILE_FILTEROPTIONS
, sOptions
) );
2198 if ( sSource
.Len() )
2199 pImpl
->m_pRequest
->AppendItem( SfxStringItem( FN_PARAM_1
, sSource
) );
2201 pImpl
->m_pRequest
->AppendItem( SfxUInt32Item( FN_PARAM_2
, nRefresh
) );
2204 ExecuteExternalSource( sFile
, sFilter
, sOptions
, sSource
, nRefresh
, *(pImpl
->m_pRequest
) );
2208 void ScCellShell::PasteFromClipboard( ScViewData
* pViewData
, ScTabViewShell
* pTabViewShell
, bool bShowDialog
)
2210 Window
* pWin
= pViewData
->GetActiveWin();
2211 ScTransferObj
* pOwnClip
= ScTransferObj::GetOwnClipboard( pWin
);
2212 ScDocument
* pThisDoc
= pViewData
->GetDocument();
2213 ScDPObject
* pDPObj
= pThisDoc
->GetDPAtCursor( pViewData
->GetCurX(),
2214 pViewData
->GetCurY(), pViewData
->GetTabNo() );
2215 if ( pOwnClip
&& pDPObj
)
2217 // paste from Calc into DataPilot table: sort (similar to drag & drop)
2219 ScDocument
* pClipDoc
= pOwnClip
->GetDocument();
2220 SCTAB nSourceTab
= pOwnClip
->GetVisibleTab();
2226 pClipDoc
->GetClipStart( nClipStartX
, nClipStartY
);
2227 pClipDoc
->GetClipArea( nClipEndX
, nClipEndY
, TRUE
);
2228 nClipEndX
= nClipEndX
+ nClipStartX
;
2229 nClipEndY
= nClipEndY
+ nClipStartY
; // GetClipArea returns the difference
2231 ScRange
aSource( nClipStartX
, nClipStartY
, nSourceTab
, nClipEndX
, nClipEndY
, nSourceTab
);
2232 BOOL bDone
= pTabViewShell
->DataPilotMove( aSource
, pViewData
->GetCurPos() );
2234 pTabViewShell
->ErrorMessage( STR_ERR_DATAPILOT_INPUT
);
2239 WaitObject
aWait( pViewData
->GetDialogParent() );
2241 pTabViewShell
->PasteFromSystem();
2244 ScDocument
* pClipDoc
= pOwnClip
->GetDocument();
2245 sal_uInt16 nFlags
= IDF_ALL
;
2246 if (pClipDoc
->GetClipParam().isMultiRange())
2247 // For multi-range paste, we paste values by default.
2248 nFlags
&= ~IDF_FORMULA
;
2250 pTabViewShell
->PasteFromClip( nFlags
, pClipDoc
,
2251 PASTE_NOFUNC
, FALSE
, FALSE
, FALSE
, INS_NONE
, IDF_NONE
,
2252 bShowDialog
); // allow warning dialog
2255 pTabViewShell
->CellContentChanged(); // => PasteFromSystem() ???