xref: /AOO41X/main/sc/source/ui/view/cellsh1.cxx (revision c2857b95e5f4cde836dca91cd13741b8a72f78e7)
1b3f79822SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3b3f79822SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4b3f79822SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5b3f79822SAndrew Rist  * distributed with this work for additional information
6b3f79822SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7b3f79822SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8b3f79822SAndrew Rist  * "License"); you may not use this file except in compliance
9b3f79822SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11b3f79822SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13b3f79822SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14b3f79822SAndrew Rist  * software distributed under the License is distributed on an
15b3f79822SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16b3f79822SAndrew Rist  * KIND, either express or implied.  See the License for the
17b3f79822SAndrew Rist  * specific language governing permissions and limitations
18b3f79822SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20b3f79822SAndrew Rist  *************************************************************/
21b3f79822SAndrew Rist 
22b3f79822SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sc.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir //------------------------------------------------------------------
29cdf0e10cSrcweir 
30cdf0e10cSrcweir //svdraw.hxx
31cdf0e10cSrcweir #define _SDR_NOITEMS
32cdf0e10cSrcweir #define _SDR_NOTOUCH
33cdf0e10cSrcweir #define _SDR_NOTRANSFORM
34cdf0e10cSrcweir #define _SI_NOSBXCONTROLS
35cdf0e10cSrcweir #define _VCONT_HXX
36cdf0e10cSrcweir #define _SI_NOOTHERFORMS
37cdf0e10cSrcweir #define _VCTRLS_HXX
38cdf0e10cSrcweir #define _SI_NOCONTROL
39cdf0e10cSrcweir #define _SETBRW_HXX
40cdf0e10cSrcweir #define _VCBRW_HXX
41cdf0e10cSrcweir #define _SI_NOSBXCONTROLS
42cdf0e10cSrcweir 
43cdf0e10cSrcweir //------------------------------------------------------------------
44cdf0e10cSrcweir #include <com/sun/star/i18n/TextConversionOption.hpp>
45cdf0e10cSrcweir #include <com/sun/star/sheet/DataPilotFieldFilter.hpp>
46cdf0e10cSrcweir 
47cdf0e10cSrcweir #include "scitems.hxx"
48cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
49cdf0e10cSrcweir 
50cdf0e10cSrcweir #define _ZFORLIST_DECLARE_TABLE
51cdf0e10cSrcweir #include <svl/stritem.hxx>
52cdf0e10cSrcweir #include <svl/whiter.hxx>
53cdf0e10cSrcweir #include <svl/zforlist.hxx>
54cdf0e10cSrcweir #include <svl/zformat.hxx>
55cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
56cdf0e10cSrcweir #include <sfx2/request.hxx>
57cdf0e10cSrcweir #include <vcl/msgbox.hxx>
58cdf0e10cSrcweir #include <svx/svxdlg.hxx>
59cdf0e10cSrcweir #include <sot/formats.hxx>
60cdf0e10cSrcweir #include <svx/postattr.hxx>
61cdf0e10cSrcweir #include <editeng/fontitem.hxx>
62cdf0e10cSrcweir #include <svx/clipfmtitem.hxx>
63cdf0e10cSrcweir #include <sfx2/passwd.hxx>
64cdf0e10cSrcweir #include <svx/hlnkitem.hxx>
65cdf0e10cSrcweir #include <basic/sbxcore.hxx>
66cdf0e10cSrcweir #include <unotools/useroptions.hxx>
67cdf0e10cSrcweir #include <vcl/waitobj.hxx>
68cdf0e10cSrcweir #include <unotools/localedatawrapper.hxx>
69cdf0e10cSrcweir 
70cdf0e10cSrcweir #include "cellsh.hxx"
71cdf0e10cSrcweir #include "sc.hrc"
72cdf0e10cSrcweir #include "document.hxx"
73cdf0e10cSrcweir #include "patattr.hxx"
74cdf0e10cSrcweir #include "scmod.hxx"
75cdf0e10cSrcweir #include "scresid.hxx"
76cdf0e10cSrcweir #include "tabvwsh.hxx"
77cdf0e10cSrcweir //CHINA001 #include "inscldlg.hxx"
78cdf0e10cSrcweir //CHINA001 #include "inscodlg.hxx"
79cdf0e10cSrcweir //CHINA001 #include "delcldlg.hxx"
80cdf0e10cSrcweir //CHINA001 #include "delcodlg.hxx"
81cdf0e10cSrcweir //CHINA001 #include "filldlg.hxx"
82cdf0e10cSrcweir //CHINA001 #include "groupdlg.hxx"
83cdf0e10cSrcweir #include "impex.hxx"
84cdf0e10cSrcweir #include "reffind.hxx"
85cdf0e10cSrcweir //CHINA001 #include "namecrea.hxx"
86cdf0e10cSrcweir #include "uiitems.hxx"
87cdf0e10cSrcweir #include "reffact.hxx"
88cdf0e10cSrcweir //CHINA001 #include "namepast.hxx"
89cdf0e10cSrcweir #include "inputhdl.hxx"
90cdf0e10cSrcweir #include "transobj.hxx"
91cdf0e10cSrcweir #include "drwtrans.hxx"
92cdf0e10cSrcweir //CHINA001 #include "linkarea.hxx"
93cdf0e10cSrcweir #include "docfunc.hxx"
94cdf0e10cSrcweir #include "editable.hxx"
95cdf0e10cSrcweir #include "dpobject.hxx"
96cdf0e10cSrcweir #include "dpsave.hxx"
97cdf0e10cSrcweir #include "dpgroup.hxx"      // for ScDPNumGroupInfo
98cdf0e10cSrcweir #include "spellparam.hxx"
99cdf0e10cSrcweir #include "postit.hxx"
100cdf0e10cSrcweir #include "clipparam.hxx"
101cdf0e10cSrcweir 
102cdf0e10cSrcweir #include "globstr.hrc"
103cdf0e10cSrcweir #include "scui_def.hxx" //CHINA001
104cdf0e10cSrcweir #include <svx/svxdlg.hxx> //CHINA001
105cdf0e10cSrcweir #include <svx/dialogs.hrc> //CHINA001
106cdf0e10cSrcweir #include "scabstdlg.hxx" //CHINA001
107cdf0e10cSrcweir #define IS_AVAILABLE(WhichId,ppItem) \
108cdf0e10cSrcweir     (pReqArgs->GetItemState((WhichId), sal_True, ppItem ) == SFX_ITEM_SET)
109cdf0e10cSrcweir 
110cdf0e10cSrcweir #define C2U(cChar)  rtl::OUString::createFromAscii(cChar)
111cdf0e10cSrcweir 
112cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
113cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
114cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
115cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
116cdf0e10cSrcweir #include <cppuhelper/bootstrap.hxx>
117cdf0e10cSrcweir 
118cdf0e10cSrcweir using namespace ::com::sun::star;
119cdf0e10cSrcweir using namespace ::com::sun::star::beans;
120cdf0e10cSrcweir using namespace ::com::sun::star::uno;
121cdf0e10cSrcweir 
122cdf0e10cSrcweir //------------------------------------------------------------------
ExecuteEdit(SfxRequest & rReq)123cdf0e10cSrcweir void ScCellShell::ExecuteEdit( SfxRequest& rReq )
124cdf0e10cSrcweir {
125cdf0e10cSrcweir 	ScModule*			pScMod		= SC_MOD();
126cdf0e10cSrcweir 	ScTabViewShell*	pTabViewShell  	= GetViewData()->GetViewShell();
127cdf0e10cSrcweir 	SfxBindings&		rBindings	= pTabViewShell->GetViewFrame()->GetBindings();
128cdf0e10cSrcweir 	const SfxItemSet*	pReqArgs	= rReq.GetArgs();
129cdf0e10cSrcweir 	sal_uInt16				nSlot		= rReq.GetSlot();
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 	pTabViewShell->HideListBox();					// Autofilter-DropDown-Listbox
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 									// Eingabe beenden
134cdf0e10cSrcweir 	if ( GetViewData()->HasEditView( GetViewData()->GetActivePart() ) )
135cdf0e10cSrcweir 	{
136cdf0e10cSrcweir 		switch ( nSlot )
137cdf0e10cSrcweir 		{
138cdf0e10cSrcweir 			case FID_DEFINE_NAME:
139cdf0e10cSrcweir 			case FID_USE_NAME:
140cdf0e10cSrcweir 			case FID_INSERT_NAME:
141cdf0e10cSrcweir             case SID_SPELL_DIALOG:
142cdf0e10cSrcweir             case SID_HANGUL_HANJA_CONVERSION:
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 			pScMod->InputEnterHandler();
145cdf0e10cSrcweir 			pTabViewShell->UpdateInputHandler();
146cdf0e10cSrcweir 			break;
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 			default:
149cdf0e10cSrcweir 			break;
150cdf0e10cSrcweir 		}
151cdf0e10cSrcweir 	}
152cdf0e10cSrcweir 
153cdf0e10cSrcweir 	switch ( nSlot )
154cdf0e10cSrcweir 	{
155cdf0e10cSrcweir 		//
156cdf0e10cSrcweir 		//	Einfuegen / Loeschen von Zellen / Zeilen / Spalten
157cdf0e10cSrcweir 		//
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 		case FID_INS_ROW:
160cdf0e10cSrcweir 			pTabViewShell->InsertCells(INS_INSROWS);
161cdf0e10cSrcweir 			rReq.Done();
162cdf0e10cSrcweir 			break;
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 		case FID_INS_COLUMN:
165cdf0e10cSrcweir 			pTabViewShell->InsertCells(INS_INSCOLS);
166cdf0e10cSrcweir 			rReq.Done();
167cdf0e10cSrcweir 			break;
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 		case FID_INS_CELLSDOWN:
170cdf0e10cSrcweir 			pTabViewShell->InsertCells(INS_CELLSDOWN);
171cdf0e10cSrcweir 			rReq.Done();
172cdf0e10cSrcweir 			break;
173cdf0e10cSrcweir 
174cdf0e10cSrcweir 		case FID_INS_CELLSRIGHT:
175cdf0e10cSrcweir 			pTabViewShell->InsertCells(INS_CELLSRIGHT);
176cdf0e10cSrcweir 			rReq.Done();
177cdf0e10cSrcweir 			break;
178cdf0e10cSrcweir 
179cdf0e10cSrcweir 		case SID_DEL_ROWS:
180cdf0e10cSrcweir 			pTabViewShell->DeleteCells( DEL_DELROWS );
181cdf0e10cSrcweir 			rReq.Done();
182cdf0e10cSrcweir 			break;
183cdf0e10cSrcweir 
184cdf0e10cSrcweir 		case SID_DEL_COLS:
185cdf0e10cSrcweir 			pTabViewShell->DeleteCells( DEL_DELCOLS );
186cdf0e10cSrcweir 			rReq.Done();
187cdf0e10cSrcweir 			break;
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 		case FID_INS_CELL:
190cdf0e10cSrcweir 			{
191cdf0e10cSrcweir 				InsCellCmd eCmd=INS_NONE;
192cdf0e10cSrcweir 
193cdf0e10cSrcweir 				if ( pReqArgs )
194cdf0e10cSrcweir 				{
195cdf0e10cSrcweir 					const SfxPoolItem* pItem;
196cdf0e10cSrcweir 					String aFlags;
197cdf0e10cSrcweir 
198cdf0e10cSrcweir 					if( IS_AVAILABLE( FID_INS_CELL, &pItem ) )
199cdf0e10cSrcweir 						aFlags = ((const SfxStringItem*)pItem)->GetValue();
200cdf0e10cSrcweir 					if( aFlags.Len() )
201cdf0e10cSrcweir 					{
202cdf0e10cSrcweir 						switch( aFlags.GetChar(0) )
203cdf0e10cSrcweir 						{
204cdf0e10cSrcweir 							case 'V': eCmd = INS_CELLSDOWN ;break;
205cdf0e10cSrcweir 							case '>': eCmd = INS_CELLSRIGHT ;break;
206cdf0e10cSrcweir 							case 'R': eCmd = INS_INSROWS ;break;
207cdf0e10cSrcweir 							case 'C': eCmd = INS_INSCOLS ;break;
208cdf0e10cSrcweir 						}
209cdf0e10cSrcweir 					}
210cdf0e10cSrcweir 				}
211cdf0e10cSrcweir 				else
212cdf0e10cSrcweir 				{
213cdf0e10cSrcweir 					if ( GetViewData()->SimpleColMarked() )
214cdf0e10cSrcweir 						eCmd = INS_INSCOLS;
215cdf0e10cSrcweir 					else if ( GetViewData()->SimpleRowMarked() )
216cdf0e10cSrcweir 						eCmd = INS_INSROWS;
217cdf0e10cSrcweir 					else
218cdf0e10cSrcweir 					{
219cdf0e10cSrcweir 						ScDocument* pDoc = GetViewData()->GetDocument();
220cdf0e10cSrcweir 						sal_Bool bTheFlag=(pDoc->GetChangeTrack()!=NULL);
221cdf0e10cSrcweir 
222cdf0e10cSrcweir //CHINA001						ScInsertCellDlg* pDlg = new ScInsertCellDlg( pTabViewShell->GetDialogParent(),
223cdf0e10cSrcweir //CHINA001						bTheFlag);
224cdf0e10cSrcweir 						ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
225cdf0e10cSrcweir 						DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
226cdf0e10cSrcweir 
227cdf0e10cSrcweir 						AbstractScInsertCellDlg* pDlg = pFact->CreateScInsertCellDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_INSCELL, bTheFlag);
228cdf0e10cSrcweir 						DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
229cdf0e10cSrcweir 						if (pDlg->Execute() == RET_OK)
230cdf0e10cSrcweir 							eCmd = pDlg->GetInsCellCmd();
231cdf0e10cSrcweir 						delete pDlg;
232cdf0e10cSrcweir 					}
233cdf0e10cSrcweir 				}
234cdf0e10cSrcweir 
235cdf0e10cSrcweir 				if (eCmd!=INS_NONE)
236cdf0e10cSrcweir 				{
237cdf0e10cSrcweir 					pTabViewShell->InsertCells( eCmd );
238cdf0e10cSrcweir 
239cdf0e10cSrcweir 					if( ! rReq.IsAPI() )
240cdf0e10cSrcweir 					{
241cdf0e10cSrcweir 						String aParam;
242cdf0e10cSrcweir 
243cdf0e10cSrcweir 						switch( eCmd )
244cdf0e10cSrcweir 						{
245cdf0e10cSrcweir 							case INS_CELLSDOWN: aParam='V'; break;
246cdf0e10cSrcweir 							case INS_CELLSRIGHT: aParam='>'; break;
247cdf0e10cSrcweir 							case INS_INSROWS: aParam='R'; break;
248cdf0e10cSrcweir 							case INS_INSCOLS: aParam='C'; break;
249cdf0e10cSrcweir                             default:
250cdf0e10cSrcweir                             {
251cdf0e10cSrcweir                                 // added to avoid warnings
252cdf0e10cSrcweir                             }
253cdf0e10cSrcweir 						}
254cdf0e10cSrcweir 						rReq.AppendItem( SfxStringItem( FID_INS_CELL, aParam ) );
255cdf0e10cSrcweir 						rReq.Done();
256cdf0e10cSrcweir 					}
257cdf0e10cSrcweir 				}
258cdf0e10cSrcweir 			}
259cdf0e10cSrcweir 			break;
260cdf0e10cSrcweir 
261cdf0e10cSrcweir 		case FID_DELETE_CELL:
262cdf0e10cSrcweir 			{
263cdf0e10cSrcweir 				DelCellCmd eCmd = DEL_NONE;
264cdf0e10cSrcweir 
265cdf0e10cSrcweir 				if ( pReqArgs )
266cdf0e10cSrcweir 				{
267cdf0e10cSrcweir 					const SfxPoolItem* pItem;
268cdf0e10cSrcweir 					String aFlags;
269cdf0e10cSrcweir 
270cdf0e10cSrcweir 					if( IS_AVAILABLE( FID_DELETE_CELL, &pItem ) )
271cdf0e10cSrcweir 						aFlags = ((const SfxStringItem*)pItem)->GetValue();
272cdf0e10cSrcweir 					if( aFlags.Len() )
273cdf0e10cSrcweir 					{
274cdf0e10cSrcweir 						switch( aFlags.GetChar(0) )
275cdf0e10cSrcweir 						{
276cdf0e10cSrcweir 							case 'U': eCmd = DEL_CELLSUP ;break;
277cdf0e10cSrcweir 							case 'L': eCmd = DEL_CELLSLEFT ;break;
278cdf0e10cSrcweir 							case 'R': eCmd = DEL_DELROWS ;break;
279cdf0e10cSrcweir 							case 'C': eCmd = DEL_DELCOLS ;break;
280cdf0e10cSrcweir 						}
281cdf0e10cSrcweir 					}
282cdf0e10cSrcweir 				}
283cdf0e10cSrcweir 				else
284cdf0e10cSrcweir 				{
285cdf0e10cSrcweir 					if ( GetViewData()->SimpleColMarked() )
286cdf0e10cSrcweir 						eCmd = DEL_DELCOLS;
287cdf0e10cSrcweir 					else if ( GetViewData()->SimpleRowMarked() )
288cdf0e10cSrcweir 						eCmd = DEL_DELROWS;
289cdf0e10cSrcweir 					else
290cdf0e10cSrcweir 					{
291cdf0e10cSrcweir                         ScRange aRange;
292cdf0e10cSrcweir 						ScDocument* pDoc = GetViewData()->GetDocument();
293cdf0e10cSrcweir 						sal_Bool bTheFlag=GetViewData()->IsMultiMarked() ||
294cdf0e10cSrcweir                             (GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE_FILTERED) ||
295cdf0e10cSrcweir                             (pDoc->GetChangeTrack() != NULL);
296cdf0e10cSrcweir 
297cdf0e10cSrcweir 						//CHINA001 ScDeleteCellDlg* pDlg = new ScDeleteCellDlg(
298cdf0e10cSrcweir 						//CHINA001 		pTabViewShell->GetDialogParent(),bTheFlag);
299cdf0e10cSrcweir 						ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
300cdf0e10cSrcweir 						DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
301cdf0e10cSrcweir 
302cdf0e10cSrcweir 						AbstractScDeleteCellDlg* pDlg = pFact->CreateScDeleteCellDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_DELCELL, bTheFlag );
303cdf0e10cSrcweir 						DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
304cdf0e10cSrcweir 
305cdf0e10cSrcweir 						if (pDlg->Execute() == RET_OK)
306cdf0e10cSrcweir 							eCmd = pDlg->GetDelCellCmd();
307cdf0e10cSrcweir 						delete pDlg;
308cdf0e10cSrcweir 					}
309cdf0e10cSrcweir 				}
310cdf0e10cSrcweir 
311cdf0e10cSrcweir 				if (eCmd != DEL_NONE )
312cdf0e10cSrcweir 				{
313cdf0e10cSrcweir 					pTabViewShell->DeleteCells( eCmd );
314cdf0e10cSrcweir 
315cdf0e10cSrcweir 					if( ! rReq.IsAPI() )
316cdf0e10cSrcweir 					{
317cdf0e10cSrcweir 						String aParam;
318cdf0e10cSrcweir 
319cdf0e10cSrcweir 						switch( eCmd )
320cdf0e10cSrcweir 						{
321cdf0e10cSrcweir 							case DEL_CELLSUP: aParam='U'; break;
322cdf0e10cSrcweir 							case DEL_CELLSLEFT: aParam='L'; break;
323cdf0e10cSrcweir 							case DEL_DELROWS: aParam='R'; break;
324cdf0e10cSrcweir 							case DEL_DELCOLS: aParam='C'; break;
325cdf0e10cSrcweir                             default:
326cdf0e10cSrcweir                             {
327cdf0e10cSrcweir                                 // added to avoid warnings
328cdf0e10cSrcweir                             }
329cdf0e10cSrcweir 						}
330cdf0e10cSrcweir 						rReq.AppendItem( SfxStringItem( FID_DELETE_CELL, aParam ) );
331cdf0e10cSrcweir 						rReq.Done();
332cdf0e10cSrcweir 					}
333cdf0e10cSrcweir 				}
334cdf0e10cSrcweir 			}
335cdf0e10cSrcweir 			break;
336cdf0e10cSrcweir 
337cdf0e10cSrcweir 		//
338cdf0e10cSrcweir 		//	Inhalte von Zellen loeschen
339cdf0e10cSrcweir 		//
340cdf0e10cSrcweir 
341cdf0e10cSrcweir 		case SID_DELETE_CONTENTS:
342cdf0e10cSrcweir 			pTabViewShell->DeleteContents( IDF_CONTENTS );
343cdf0e10cSrcweir 			rReq.Done();
344cdf0e10cSrcweir 			break;
345cdf0e10cSrcweir 
346cdf0e10cSrcweir 		case SID_DELETE:
347cdf0e10cSrcweir 			{
348cdf0e10cSrcweir 				sal_uInt16	nFlags = IDF_NONE;
349cdf0e10cSrcweir 
350cdf0e10cSrcweir 				if ( pReqArgs!=NULL && pTabViewShell->SelectionEditable() )
351cdf0e10cSrcweir 				{
352cdf0e10cSrcweir 					const	SfxPoolItem* pItem;
353cdf0e10cSrcweir 					String	aFlags = 'A';
354cdf0e10cSrcweir 
355cdf0e10cSrcweir 					if( IS_AVAILABLE( SID_DELETE, &pItem ) )
356cdf0e10cSrcweir 						aFlags = ((const SfxStringItem*)pItem)->GetValue();
357cdf0e10cSrcweir 
358cdf0e10cSrcweir 					aFlags.ToUpperAscii();
359cdf0e10cSrcweir 					sal_Bool	bCont = sal_True;
360cdf0e10cSrcweir 
361cdf0e10cSrcweir 					for( xub_StrLen i=0 ; bCont && i<aFlags.Len() ; i++ )
362cdf0e10cSrcweir 					{
363cdf0e10cSrcweir 						switch( aFlags.GetChar(i) )
364cdf0e10cSrcweir 						{
365cdf0e10cSrcweir 							case 'A': // Alle
366cdf0e10cSrcweir 							nFlags |= IDF_ALL;
367cdf0e10cSrcweir 							bCont = sal_False; // nicht mehr weitermachen!
368cdf0e10cSrcweir 							break;
369cdf0e10cSrcweir 							case 'S': nFlags |= IDF_STRING;	break;
370cdf0e10cSrcweir 							case 'V': nFlags |= IDF_VALUE; break;
371cdf0e10cSrcweir 							case 'D': nFlags |= IDF_DATETIME; break;
372cdf0e10cSrcweir 							case 'F': nFlags |= IDF_FORMULA; break;
373cdf0e10cSrcweir 							case 'N': nFlags |= IDF_NOTE; break;
374cdf0e10cSrcweir 							case 'T': nFlags |= IDF_ATTRIB; break;
375cdf0e10cSrcweir 							case 'O': nFlags |= IDF_OBJECTS; break;
376cdf0e10cSrcweir 						}
377cdf0e10cSrcweir 					}
378cdf0e10cSrcweir 				}
379cdf0e10cSrcweir 				else
380cdf0e10cSrcweir 				{
381cdf0e10cSrcweir 					ScEditableTester aTester( pTabViewShell );
382cdf0e10cSrcweir 					if (aTester.IsEditable())
383cdf0e10cSrcweir 					{
384cdf0e10cSrcweir 						//CHINA001 ScDeleteContentsDlg* pDlg = new ScDeleteContentsDlg( 	pTabViewShell->GetDialogParent() );
385cdf0e10cSrcweir 						ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
386cdf0e10cSrcweir 						DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
387cdf0e10cSrcweir 
388cdf0e10cSrcweir 						AbstractScDeleteContentsDlg* pDlg = pFact->CreateScDeleteContentsDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_DELCONT );
389cdf0e10cSrcweir 						DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
390cdf0e10cSrcweir 						ScDocument* pDoc = GetViewData()->GetDocument();
391cdf0e10cSrcweir 						SCTAB nTab = GetViewData()->GetTabNo();
392cdf0e10cSrcweir 						if ( pDoc->IsTabProtected(nTab) )
393cdf0e10cSrcweir 							pDlg->DisableObjects();
394cdf0e10cSrcweir 						if (pDlg->Execute() == RET_OK)
395cdf0e10cSrcweir 						{
396cdf0e10cSrcweir 							nFlags = pDlg->GetDelContentsCmdBits();
397cdf0e10cSrcweir 						}
398cdf0e10cSrcweir 						delete pDlg;
399cdf0e10cSrcweir 					}
400cdf0e10cSrcweir 					else
401cdf0e10cSrcweir 						pTabViewShell->ErrorMessage(aTester.GetMessageId());
402cdf0e10cSrcweir 				}
403cdf0e10cSrcweir 
404cdf0e10cSrcweir 				if( nFlags != IDF_NONE )
405cdf0e10cSrcweir 				{
406cdf0e10cSrcweir 					pTabViewShell->DeleteContents( nFlags );
407cdf0e10cSrcweir 
408cdf0e10cSrcweir 					if( ! rReq.IsAPI() )
409cdf0e10cSrcweir 					{
410cdf0e10cSrcweir 						String	aFlags;
411cdf0e10cSrcweir 
412cdf0e10cSrcweir 						if( nFlags == IDF_ALL )
413cdf0e10cSrcweir 						{
414cdf0e10cSrcweir 							aFlags += 'A';
415cdf0e10cSrcweir 						}
416cdf0e10cSrcweir 						else
417cdf0e10cSrcweir 						{
418cdf0e10cSrcweir 							if( nFlags & IDF_STRING ) aFlags += 'S';
419cdf0e10cSrcweir 							if( nFlags & IDF_VALUE ) aFlags += 'V';
420cdf0e10cSrcweir 							if( nFlags & IDF_DATETIME ) aFlags += 'D';
421cdf0e10cSrcweir 							if( nFlags & IDF_FORMULA ) aFlags += 'F';
422cdf0e10cSrcweir 							if( nFlags & IDF_NOTE ) aFlags += 'N';
423cdf0e10cSrcweir 							if( nFlags & IDF_ATTRIB ) aFlags += 'T';
424cdf0e10cSrcweir 							if( nFlags & IDF_OBJECTS ) aFlags += 'O';
425cdf0e10cSrcweir 						}
426cdf0e10cSrcweir 
427cdf0e10cSrcweir 						rReq.AppendItem( SfxStringItem( SID_DELETE, aFlags ) );
428cdf0e10cSrcweir 						rReq.Done();
429cdf0e10cSrcweir 					}
430cdf0e10cSrcweir 				}
431cdf0e10cSrcweir 			}
432cdf0e10cSrcweir 			break;
433cdf0e10cSrcweir 
434cdf0e10cSrcweir 		//
435cdf0e10cSrcweir 		//	Ausfuellen...
436cdf0e10cSrcweir 		//
437cdf0e10cSrcweir 
438cdf0e10cSrcweir 		case FID_FILL_TO_BOTTOM:
439cdf0e10cSrcweir 			pTabViewShell->FillSimple( FILL_TO_BOTTOM );
440cdf0e10cSrcweir 			rReq.Done();
441cdf0e10cSrcweir 			break;
442cdf0e10cSrcweir 
443cdf0e10cSrcweir 		case FID_FILL_TO_RIGHT:
444cdf0e10cSrcweir 			pTabViewShell->FillSimple( FILL_TO_RIGHT );
445cdf0e10cSrcweir 			rReq.Done();
446cdf0e10cSrcweir 			break;
447cdf0e10cSrcweir 
448cdf0e10cSrcweir 		case FID_FILL_TO_TOP:
449cdf0e10cSrcweir 			pTabViewShell->FillSimple( FILL_TO_TOP );
450cdf0e10cSrcweir 			rReq.Done();
451cdf0e10cSrcweir 			break;
452cdf0e10cSrcweir 
453cdf0e10cSrcweir 		case FID_FILL_TO_LEFT:
454cdf0e10cSrcweir 			pTabViewShell->FillSimple( FILL_TO_LEFT );
455cdf0e10cSrcweir 			rReq.Done();
456cdf0e10cSrcweir 			break;
457cdf0e10cSrcweir 
458cdf0e10cSrcweir 		case FID_FILL_TAB:
459cdf0e10cSrcweir 			{
460cdf0e10cSrcweir 				sal_uInt16 nFlags = IDF_NONE;
461cdf0e10cSrcweir 				sal_uInt16 nFunction = PASTE_NOFUNC;
462cdf0e10cSrcweir 				sal_Bool bSkipEmpty = sal_False;
463cdf0e10cSrcweir 				sal_Bool bAsLink	= sal_False;
464cdf0e10cSrcweir 
465cdf0e10cSrcweir 				if ( pReqArgs!=NULL && pTabViewShell->SelectionEditable() )
466cdf0e10cSrcweir 				{
467cdf0e10cSrcweir 					const	SfxPoolItem* pItem;
468cdf0e10cSrcweir 					String	aFlags = 'A';
469cdf0e10cSrcweir 
470cdf0e10cSrcweir 					if( IS_AVAILABLE( FID_FILL_TAB, &pItem ) )
471cdf0e10cSrcweir 						aFlags = ((const SfxStringItem*)pItem)->GetValue();
472cdf0e10cSrcweir 
473cdf0e10cSrcweir 					aFlags.ToUpperAscii();
474cdf0e10cSrcweir 					sal_Bool	bCont = sal_True;
475cdf0e10cSrcweir 
476cdf0e10cSrcweir 					for( xub_StrLen i=0 ; bCont && i<aFlags.Len() ; i++ )
477cdf0e10cSrcweir 					{
478cdf0e10cSrcweir 						switch( aFlags.GetChar(i) )
479cdf0e10cSrcweir 						{
480cdf0e10cSrcweir 							case 'A': // Alle
481cdf0e10cSrcweir 							nFlags |= IDF_ALL;
482cdf0e10cSrcweir 							bCont = sal_False; // nicht mehr weitermachen!
483cdf0e10cSrcweir 							break;
484cdf0e10cSrcweir 							case 'S': nFlags |= IDF_STRING;	break;
485cdf0e10cSrcweir 							case 'V': nFlags |= IDF_VALUE; break;
486cdf0e10cSrcweir 							case 'D': nFlags |= IDF_DATETIME; break;
487cdf0e10cSrcweir 							case 'F': nFlags |= IDF_FORMULA; break;
488cdf0e10cSrcweir 							case 'N': nFlags |= IDF_NOTE; break;
489cdf0e10cSrcweir 							case 'T': nFlags |= IDF_ATTRIB; break;
490cdf0e10cSrcweir 						}
491cdf0e10cSrcweir 					}
492cdf0e10cSrcweir 				}
493cdf0e10cSrcweir 				else
494cdf0e10cSrcweir 				{
495cdf0e10cSrcweir //CHINA001					ScInsertContentsDlg* pDlg =
496cdf0e10cSrcweir //CHINA001					new ScInsertContentsDlg(pTabViewShell->GetDialogParent(),
497cdf0e10cSrcweir //CHINA001					0, /* nCheckDefaults */
498cdf0e10cSrcweir //CHINA001					&ScGlobal::GetRscString(STR_FILL_TAB) );
499cdf0e10cSrcweir 					ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
500cdf0e10cSrcweir 					DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
501cdf0e10cSrcweir 
502cdf0e10cSrcweir 					AbstractScInsertContentsDlg* pDlg = pFact->CreateScInsertContentsDlg( pTabViewShell->GetDialogParent(),
503cdf0e10cSrcweir 																							RID_SCDLG_INSCONT, 0, /* nCheckDefaults */
504cdf0e10cSrcweir 																							&ScGlobal::GetRscString(STR_FILL_TAB));
505cdf0e10cSrcweir 					DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
506cdf0e10cSrcweir 					pDlg->SetFillMode(sal_True);
507cdf0e10cSrcweir 
508cdf0e10cSrcweir 					if (pDlg->Execute() == RET_OK)
509cdf0e10cSrcweir 					{
510cdf0e10cSrcweir 						nFlags	   = pDlg->GetInsContentsCmdBits();
511cdf0e10cSrcweir 						nFunction  = pDlg->GetFormulaCmdBits();
512cdf0e10cSrcweir 						bSkipEmpty = pDlg->IsSkipEmptyCells();
513cdf0e10cSrcweir 						bAsLink	   = pDlg->IsLink();
514cdf0e10cSrcweir 						//	MoveMode gibt's bei Tabelle fuellen nicht
515cdf0e10cSrcweir 					}
516cdf0e10cSrcweir 					delete pDlg;
517cdf0e10cSrcweir 				}
518cdf0e10cSrcweir 
519cdf0e10cSrcweir 				if( nFlags != IDF_NONE )
520cdf0e10cSrcweir 				{
521cdf0e10cSrcweir 					pTabViewShell->FillTab( nFlags, nFunction, bSkipEmpty, bAsLink );
522cdf0e10cSrcweir 
523cdf0e10cSrcweir 					if( ! rReq.IsAPI() )
524cdf0e10cSrcweir 					{
525cdf0e10cSrcweir 						String	aFlags;
526cdf0e10cSrcweir 
527cdf0e10cSrcweir 						if( nFlags == IDF_ALL )
528cdf0e10cSrcweir 						{
529cdf0e10cSrcweir 							aFlags += 'A';
530cdf0e10cSrcweir 						}
531cdf0e10cSrcweir 						else
532cdf0e10cSrcweir 						{
533cdf0e10cSrcweir 							if( nFlags & IDF_STRING ) aFlags += 'S';
534cdf0e10cSrcweir 							if( nFlags & IDF_VALUE ) aFlags += 'V';
535cdf0e10cSrcweir 							if( nFlags & IDF_DATETIME ) aFlags += 'D';
536cdf0e10cSrcweir 							if( nFlags & IDF_FORMULA ) aFlags += 'F';
537cdf0e10cSrcweir 							if( nFlags & IDF_NOTE ) aFlags += 'N';
538cdf0e10cSrcweir 							if( nFlags & IDF_ATTRIB ) aFlags += 'T';
539cdf0e10cSrcweir 						}
540cdf0e10cSrcweir 
541cdf0e10cSrcweir 						rReq.AppendItem( SfxStringItem( FID_FILL_TAB, aFlags ) );
542cdf0e10cSrcweir 						rReq.Done();
543cdf0e10cSrcweir 					}
544cdf0e10cSrcweir 				}
545cdf0e10cSrcweir 			}
546cdf0e10cSrcweir 			break;
547cdf0e10cSrcweir 
548cdf0e10cSrcweir 		case FID_FILL_SERIES:
549cdf0e10cSrcweir 			{
550cdf0e10cSrcweir 				SCCOL nStartCol;
551cdf0e10cSrcweir 				SCROW nStartRow;
552cdf0e10cSrcweir 				SCTAB nStartTab;
553cdf0e10cSrcweir 				SCCOL nEndCol;
554cdf0e10cSrcweir 				SCROW nEndRow;
555cdf0e10cSrcweir 				SCTAB nEndTab;
556cdf0e10cSrcweir 				sal_uInt16 nPossDir = FDS_OPT_NONE;
557cdf0e10cSrcweir 				FillDir		eFillDir	 = FILL_TO_BOTTOM;
558cdf0e10cSrcweir 				FillCmd		eFillCmd	 = FILL_LINEAR;
559cdf0e10cSrcweir 				FillDateCmd	eFillDateCmd = FILL_DAY;
560cdf0e10cSrcweir 				double fStartVal = MAXDOUBLE;
561cdf0e10cSrcweir 				double fIncVal	 = 1;
562cdf0e10cSrcweir 				double fMaxVal	 = MAXDOUBLE;
563cdf0e10cSrcweir 				sal_Bool   bDoIt	 = sal_False;
564cdf0e10cSrcweir 
565cdf0e10cSrcweir 				GetViewData()->GetSimpleArea( nStartCol, nStartRow, nStartTab,
566cdf0e10cSrcweir 											  nEndCol, nEndRow, nEndTab );
567cdf0e10cSrcweir 
568cdf0e10cSrcweir 				if( nStartCol!=nEndCol )
569cdf0e10cSrcweir 				{
570cdf0e10cSrcweir 					nPossDir |= FDS_OPT_HORZ;
571cdf0e10cSrcweir 					eFillDir=FILL_TO_RIGHT;
572cdf0e10cSrcweir 				}
573cdf0e10cSrcweir 
574cdf0e10cSrcweir 				if( nStartRow!=nEndRow )
575cdf0e10cSrcweir 				{
576cdf0e10cSrcweir 					nPossDir |= FDS_OPT_VERT;
577cdf0e10cSrcweir 					eFillDir=FILL_TO_BOTTOM;
578cdf0e10cSrcweir 				}
579cdf0e10cSrcweir 
580cdf0e10cSrcweir 				ScDocument* 	 pDoc = GetViewData()->GetDocument();
581cdf0e10cSrcweir 				SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
582cdf0e10cSrcweir 
583cdf0e10cSrcweir 				if( pReqArgs )
584cdf0e10cSrcweir 				{
585cdf0e10cSrcweir 					const SfxPoolItem* pItem;
586cdf0e10cSrcweir 					String	aFillDir, aFillCmd, aFillDateCmd;
587cdf0e10cSrcweir 					String	aFillStep, aFillStart, aFillMax;
588cdf0e10cSrcweir 					sal_uInt32 nKey;
589cdf0e10cSrcweir 					double	fTmpVal;
590cdf0e10cSrcweir 
591cdf0e10cSrcweir 					bDoIt=sal_False;
592cdf0e10cSrcweir 
593cdf0e10cSrcweir 					if( IS_AVAILABLE( FID_FILL_SERIES, &pItem ) )
594cdf0e10cSrcweir 						aFillDir = ((const SfxStringItem*)pItem)->GetValue();
595cdf0e10cSrcweir 					if( IS_AVAILABLE( FN_PARAM_1, &pItem ) )
596cdf0e10cSrcweir 						aFillCmd = ((const SfxStringItem*)pItem)->GetValue();
597cdf0e10cSrcweir 					if( IS_AVAILABLE( FN_PARAM_2, &pItem ) )
598cdf0e10cSrcweir 						aFillDateCmd = ((const SfxStringItem*)pItem)->GetValue();
599cdf0e10cSrcweir 					if( IS_AVAILABLE( FN_PARAM_3, &pItem ) )
600cdf0e10cSrcweir 						aFillStep = ((const SfxStringItem*)pItem)->GetValue();
601cdf0e10cSrcweir 					if( IS_AVAILABLE( FN_PARAM_4, &pItem ) )
602cdf0e10cSrcweir 						aFillStart = ((const SfxStringItem*)pItem)->GetValue();
603cdf0e10cSrcweir 					if( IS_AVAILABLE( FN_PARAM_5, &pItem ) )
604cdf0e10cSrcweir 						aFillMax = ((const SfxStringItem*)pItem)->GetValue();
605cdf0e10cSrcweir 
606cdf0e10cSrcweir 					if( aFillDir.Len() )
607cdf0e10cSrcweir 						switch( aFillDir.GetChar(0) )
608cdf0e10cSrcweir 						{
609cdf0e10cSrcweir 							case 'B': case 'b': eFillDir=FILL_TO_BOTTOM; break;
610cdf0e10cSrcweir 							case 'R': case 'r': eFillDir=FILL_TO_RIGHT; break;
611cdf0e10cSrcweir 							case 'T': case 't': eFillDir=FILL_TO_TOP; break;
612cdf0e10cSrcweir 							case 'L': case 'l': eFillDir=FILL_TO_LEFT; break;
613cdf0e10cSrcweir 						}
614cdf0e10cSrcweir 
615cdf0e10cSrcweir 					if( aFillCmd.Len() )
616cdf0e10cSrcweir 						switch( aFillCmd.GetChar(0) )
617cdf0e10cSrcweir 						{
618cdf0e10cSrcweir 							case 'S': case 's': eFillCmd=FILL_SIMPLE; break;
619cdf0e10cSrcweir 							case 'L': case 'l': eFillCmd=FILL_LINEAR; break;
620cdf0e10cSrcweir 							case 'G': case 'g': eFillCmd=FILL_GROWTH; break;
621cdf0e10cSrcweir 							case 'D': case 'd': eFillCmd=FILL_DATE; break;
622cdf0e10cSrcweir 							case 'A': case 'a': eFillCmd=FILL_AUTO; break;
623cdf0e10cSrcweir 						}
624cdf0e10cSrcweir 
625cdf0e10cSrcweir 					if( aFillDateCmd.Len() )
626cdf0e10cSrcweir 						switch( aFillDateCmd.GetChar(0) )
627cdf0e10cSrcweir 						{
628cdf0e10cSrcweir 							case 'D': case 'd': eFillDateCmd=FILL_DAY; break;
629cdf0e10cSrcweir 							case 'W': case 'w': eFillDateCmd=FILL_WEEKDAY; break;
630cdf0e10cSrcweir 							case 'M': case 'm': eFillDateCmd=FILL_MONTH; break;
631cdf0e10cSrcweir 							case 'Y': case 'y': eFillDateCmd=FILL_YEAR; break;
632cdf0e10cSrcweir 						}
633cdf0e10cSrcweir 
634cdf0e10cSrcweir 					nKey = 0;
635cdf0e10cSrcweir 					if( pFormatter->IsNumberFormat( aFillStart, nKey, fTmpVal ))
636cdf0e10cSrcweir 						fStartVal = fTmpVal;
637cdf0e10cSrcweir 
638cdf0e10cSrcweir 					nKey = 0;
639cdf0e10cSrcweir 					if( pFormatter->IsNumberFormat( aFillStep, nKey, fTmpVal ))
640cdf0e10cSrcweir 						fIncVal = fTmpVal;
641cdf0e10cSrcweir 
642cdf0e10cSrcweir 					nKey = 0;
643cdf0e10cSrcweir 					if( pFormatter->IsNumberFormat( aFillMax, nKey, fTmpVal ))
644cdf0e10cSrcweir 						fMaxVal = fTmpVal;
645cdf0e10cSrcweir 
646cdf0e10cSrcweir 					bDoIt	= sal_True;
647cdf0e10cSrcweir 
648cdf0e10cSrcweir 				}
649cdf0e10cSrcweir 				else // (pReqArgs == NULL) => Dialog hochziehen
650cdf0e10cSrcweir 				{
651cdf0e10cSrcweir 					//
652cdf0e10cSrcweir 					sal_uInt32 nPrivFormat;
653cdf0e10cSrcweir 					CellType eCellType;
654cdf0e10cSrcweir 					pDoc->GetNumberFormat( nStartCol, nStartRow, nStartTab, nPrivFormat );
655cdf0e10cSrcweir 					pDoc->GetCellType( nStartCol, nStartRow, nStartTab,eCellType );
656cdf0e10cSrcweir 					const SvNumberformat* pPrivEntry = pFormatter->GetEntry( nPrivFormat );
657cdf0e10cSrcweir 					if (!pPrivEntry)
658cdf0e10cSrcweir 					{
659cdf0e10cSrcweir 						DBG_ERROR("Zahlformat nicht gefunden !!!");
660cdf0e10cSrcweir 					}
661cdf0e10cSrcweir 					else
662cdf0e10cSrcweir 					{
663cdf0e10cSrcweir 						short nPrivType = pPrivEntry->GetType();
664cdf0e10cSrcweir 						if ( ( nPrivType & NUMBERFORMAT_DATE)>0)
665cdf0e10cSrcweir 						{
666cdf0e10cSrcweir 						   eFillCmd=FILL_DATE;
667cdf0e10cSrcweir 						}
668cdf0e10cSrcweir 						else if(eCellType==CELLTYPE_STRING)
669cdf0e10cSrcweir 						{
670cdf0e10cSrcweir 						   eFillCmd=FILL_AUTO;
671cdf0e10cSrcweir 						}
672cdf0e10cSrcweir 					}
673cdf0e10cSrcweir 
674cdf0e10cSrcweir 					//
675cdf0e10cSrcweir 					String aStartStr;
676cdf0e10cSrcweir 
677cdf0e10cSrcweir 					//	Startwert nur vorbelegen, wenn nur 1 Zeile oder Spalte:
678cdf0e10cSrcweir 					if ( nStartCol == nEndCol || nStartRow == nEndRow )
679cdf0e10cSrcweir 					{
680cdf0e10cSrcweir                         double fInputEndVal = 0.0;
681cdf0e10cSrcweir 						String aEndStr;
682cdf0e10cSrcweir 
683cdf0e10cSrcweir 						pDoc->GetInputString( nStartCol, nStartRow, nStartTab, aStartStr);
684cdf0e10cSrcweir 						pDoc->GetValue( nStartCol, nStartRow, nStartTab, fStartVal );
685cdf0e10cSrcweir 
686cdf0e10cSrcweir 
687cdf0e10cSrcweir 						if(eFillDir==FILL_TO_BOTTOM && nStartRow < nEndRow )
688cdf0e10cSrcweir 						{
689cdf0e10cSrcweir 							pDoc->GetInputString( nStartCol, nStartRow+1, nStartTab, aEndStr);
690cdf0e10cSrcweir 							if(aEndStr.Len()>0)
691cdf0e10cSrcweir 							{
692cdf0e10cSrcweir 								pDoc->GetValue( nStartCol, nStartRow+1, nStartTab, fInputEndVal);
693cdf0e10cSrcweir 								fIncVal=fInputEndVal-fStartVal;
694cdf0e10cSrcweir 							}
695cdf0e10cSrcweir 						}
696cdf0e10cSrcweir 						else
697cdf0e10cSrcweir 						{
698cdf0e10cSrcweir 							if(nStartCol < nEndCol)
699cdf0e10cSrcweir 							{
700cdf0e10cSrcweir 								pDoc->GetInputString( nStartCol+1, nStartRow, nStartTab, aEndStr);
701cdf0e10cSrcweir 								if(aEndStr.Len()>0)
702cdf0e10cSrcweir 								{
703cdf0e10cSrcweir 									pDoc->GetValue( nStartCol+1, nStartRow, nStartTab, fInputEndVal);
704cdf0e10cSrcweir 									fIncVal=fInputEndVal-fStartVal;
705cdf0e10cSrcweir 								}
706cdf0e10cSrcweir 							}
707cdf0e10cSrcweir 						}
708cdf0e10cSrcweir 						if(eFillCmd==FILL_DATE)
709cdf0e10cSrcweir 						{
710cdf0e10cSrcweir 							Date aNullDate = *pDoc->GetFormatTable()->GetNullDate();
711cdf0e10cSrcweir 							Date aStartDate = aNullDate;
712cdf0e10cSrcweir 							aStartDate+= (long)fStartVal;
713cdf0e10cSrcweir 							Date aEndDate = aNullDate;
714cdf0e10cSrcweir 							aEndDate+= (long)fInputEndVal;
715cdf0e10cSrcweir 							double fTempDate=0;
716cdf0e10cSrcweir 
717cdf0e10cSrcweir 							if(aStartDate.GetYear()!=aEndDate.GetYear())
718cdf0e10cSrcweir 							{
719cdf0e10cSrcweir 								eFillDateCmd = FILL_YEAR;
720cdf0e10cSrcweir 								fTempDate=aEndDate.GetYear()-aStartDate.GetYear();
721cdf0e10cSrcweir 							}
722cdf0e10cSrcweir 							if(aStartDate.GetMonth()!=aEndDate.GetMonth())
723cdf0e10cSrcweir 							{
724cdf0e10cSrcweir 								eFillDateCmd = FILL_MONTH;
725cdf0e10cSrcweir 								fTempDate=fTempDate*12+aEndDate.GetMonth()-aStartDate.GetMonth();
726cdf0e10cSrcweir 							}
727cdf0e10cSrcweir 							if(aStartDate.GetDay()==aEndDate.GetDay())
728cdf0e10cSrcweir 							{
729cdf0e10cSrcweir 								fIncVal=fTempDate;
730cdf0e10cSrcweir 							}
731cdf0e10cSrcweir 						}
732cdf0e10cSrcweir 					}
733cdf0e10cSrcweir //CHINA001					ScFillSeriesDlg* pDlg = new ScFillSeriesDlg(
734cdf0e10cSrcweir //CHINA001					pTabViewShell->GetDialogParent(), *pDoc,
735cdf0e10cSrcweir //CHINA001					eFillDir, eFillCmd, eFillDateCmd,
736cdf0e10cSrcweir //CHINA001					aStartStr, fIncVal, fMaxVal,
737cdf0e10cSrcweir //CHINA001					nPossDir);
738cdf0e10cSrcweir 					ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
739cdf0e10cSrcweir 					DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
740cdf0e10cSrcweir 
741cdf0e10cSrcweir 					AbstractScFillSeriesDlg* pDlg = pFact->CreateScFillSeriesDlg( pTabViewShell->GetDialogParent(),
742cdf0e10cSrcweir 															*pDoc,
743cdf0e10cSrcweir 															eFillDir, eFillCmd, eFillDateCmd,
744cdf0e10cSrcweir 															aStartStr, fIncVal, fMaxVal,
745cdf0e10cSrcweir 															nPossDir,
746cdf0e10cSrcweir 															RID_SCDLG_FILLSERIES);
747cdf0e10cSrcweir 					DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
748cdf0e10cSrcweir 
749cdf0e10cSrcweir 					if ( nStartCol != nEndCol && nStartRow != nEndRow )
750cdf0e10cSrcweir 					{
751cdf0e10cSrcweir 						pDlg->SetEdStartValEnabled(sal_False);
752cdf0e10cSrcweir 					}
753cdf0e10cSrcweir 
754cdf0e10cSrcweir 					if ( pDlg->Execute() == RET_OK )
755cdf0e10cSrcweir 					{
756cdf0e10cSrcweir 						eFillDir		= pDlg->GetFillDir();
757cdf0e10cSrcweir 						eFillCmd		= pDlg->GetFillCmd();
758cdf0e10cSrcweir 						eFillDateCmd	= pDlg->GetFillDateCmd();
759cdf0e10cSrcweir 
760cdf0e10cSrcweir 						if(eFillCmd==FILL_AUTO)
761cdf0e10cSrcweir 						{
762cdf0e10cSrcweir 							String aStr=pDlg->GetStartStr();
763cdf0e10cSrcweir 							if(aStr.Len()>0)
764cdf0e10cSrcweir 								pTabViewShell->EnterData( nStartCol, nStartRow, nStartTab, aStr );
765cdf0e10cSrcweir 						}
766cdf0e10cSrcweir 						fStartVal		= pDlg->GetStart();
767cdf0e10cSrcweir 						fIncVal			= pDlg->GetStep();
768cdf0e10cSrcweir 						fMaxVal			= pDlg->GetMax();
769cdf0e10cSrcweir 						bDoIt			= sal_True;
770cdf0e10cSrcweir 					}
771cdf0e10cSrcweir 					delete pDlg;
772cdf0e10cSrcweir 				}
773cdf0e10cSrcweir 
774cdf0e10cSrcweir 				if( bDoIt )
775cdf0e10cSrcweir 				{
776cdf0e10cSrcweir 					//nScFillModeMouseModifier = 0;	// kein Ctrl/Copy
777cdf0e10cSrcweir 					pTabViewShell->FillSeries( eFillDir, eFillCmd, eFillDateCmd, fStartVal, fIncVal, fMaxVal );
778cdf0e10cSrcweir 
779cdf0e10cSrcweir 					if( ! rReq.IsAPI() )
780cdf0e10cSrcweir 					{
781cdf0e10cSrcweir 						String	aPara;
782cdf0e10cSrcweir 						Color*	pColor=0;
783cdf0e10cSrcweir 
784cdf0e10cSrcweir 						switch( eFillDir )
785cdf0e10cSrcweir 						{
786cdf0e10cSrcweir 							case FILL_TO_BOTTOM:	aPara = 'B'; break;
787cdf0e10cSrcweir 							case FILL_TO_RIGHT:		aPara = 'R'; break;
788cdf0e10cSrcweir 							case FILL_TO_TOP:		aPara = 'T'; break;
789cdf0e10cSrcweir 							case FILL_TO_LEFT:		aPara = 'L'; break;
790cdf0e10cSrcweir 							default: aPara.Erase(); break;
791cdf0e10cSrcweir 						}
792cdf0e10cSrcweir 						rReq.AppendItem( SfxStringItem( FID_FILL_SERIES, aPara ) );
793cdf0e10cSrcweir 
794cdf0e10cSrcweir 						switch( eFillCmd )
795cdf0e10cSrcweir 						{
796cdf0e10cSrcweir 							case FILL_SIMPLE:		aPara = 'S'; break;
797cdf0e10cSrcweir 							case FILL_LINEAR:		aPara = 'L'; break;
798cdf0e10cSrcweir 							case FILL_GROWTH:		aPara = 'G'; break;
799cdf0e10cSrcweir 							case FILL_DATE:			aPara = 'D'; break;
800cdf0e10cSrcweir 							case FILL_AUTO:			aPara = 'A'; break;
801cdf0e10cSrcweir 							default: aPara.Erase(); break;
802cdf0e10cSrcweir 						}
803cdf0e10cSrcweir 						rReq.AppendItem( SfxStringItem( FN_PARAM_1, aPara ) );
804cdf0e10cSrcweir 
805cdf0e10cSrcweir 						switch( eFillDateCmd )
806cdf0e10cSrcweir 						{
807cdf0e10cSrcweir 							case FILL_DAY:			aPara = 'D'; break;
808cdf0e10cSrcweir 							case FILL_WEEKDAY:		aPara = 'W'; break;
809cdf0e10cSrcweir 							case FILL_MONTH:		aPara = 'M'; break;
810cdf0e10cSrcweir 							case FILL_YEAR:			aPara = 'Y'; break;
811cdf0e10cSrcweir 							default: aPara.Erase(); break;
812cdf0e10cSrcweir 						}
813cdf0e10cSrcweir 						rReq.AppendItem( SfxStringItem( FN_PARAM_2, aPara ) );
814cdf0e10cSrcweir 
815cdf0e10cSrcweir 						sal_uLong nFormatKey = pFormatter->GetStandardFormat(NUMBERFORMAT_NUMBER,
816cdf0e10cSrcweir 									ScGlobal::eLnge );
817cdf0e10cSrcweir 
818cdf0e10cSrcweir 						pFormatter->GetOutputString( fIncVal, nFormatKey, aPara, &pColor );
819cdf0e10cSrcweir 						rReq.AppendItem( SfxStringItem( FN_PARAM_3, aPara ) );
820cdf0e10cSrcweir 
821cdf0e10cSrcweir 						pFormatter->GetOutputString( fStartVal, nFormatKey, aPara, &pColor );
822cdf0e10cSrcweir 						rReq.AppendItem( SfxStringItem( FN_PARAM_4, aPara ) );
823cdf0e10cSrcweir 
824cdf0e10cSrcweir 						pFormatter->GetOutputString( fMaxVal, nFormatKey, aPara, &pColor );
825cdf0e10cSrcweir 						rReq.AppendItem( SfxStringItem( FN_PARAM_5, aPara ) );
826cdf0e10cSrcweir 
827cdf0e10cSrcweir 						rReq.Done();
828cdf0e10cSrcweir 					}
829cdf0e10cSrcweir 				}
830cdf0e10cSrcweir 			}
831cdf0e10cSrcweir 			break;
832cdf0e10cSrcweir 
833cdf0e10cSrcweir 		case FID_FILL_AUTO:
834cdf0e10cSrcweir 			{
835cdf0e10cSrcweir 				SCCOL nStartCol;
836cdf0e10cSrcweir 				SCROW nStartRow;
837cdf0e10cSrcweir 				SCCOL nEndCol;
838cdf0e10cSrcweir 				SCROW nEndRow;
839cdf0e10cSrcweir 				SCTAB nStartTab, nEndTab;
840cdf0e10cSrcweir 
841cdf0e10cSrcweir 				GetViewData()->GetFillData( nStartCol, nStartRow, nEndCol, nEndRow );
842cdf0e10cSrcweir 				SCCOL nFillCol = GetViewData()->GetRefEndX();
843cdf0e10cSrcweir 				SCROW nFillRow = GetViewData()->GetRefEndY();
844cdf0e10cSrcweir                 ScDocument* pDoc = GetViewData()->GetDocument();
845cdf0e10cSrcweir 
846cdf0e10cSrcweir 				if( pReqArgs != NULL )
847cdf0e10cSrcweir 				{
848cdf0e10cSrcweir 					const SfxPoolItem* pItem;
849cdf0e10cSrcweir 
850cdf0e10cSrcweir 					if( IS_AVAILABLE( FID_FILL_AUTO, &pItem ) )
851cdf0e10cSrcweir 					{
852cdf0e10cSrcweir 						ScAddress aScAddress;
853cdf0e10cSrcweir 						String aArg = ((const SfxStringItem*)pItem)->GetValue();
854cdf0e10cSrcweir 
855cdf0e10cSrcweir 						if( aScAddress.Parse( aArg, pDoc, pDoc->GetAddressConvention() ) & SCA_VALID )
856cdf0e10cSrcweir 						{
857cdf0e10cSrcweir 							nFillRow = aScAddress.Row();
858cdf0e10cSrcweir 							nFillCol = aScAddress.Col();
859cdf0e10cSrcweir 						}
860cdf0e10cSrcweir 					}
861cdf0e10cSrcweir 
862cdf0e10cSrcweir 					GetViewData()->GetSimpleArea( nStartCol,nStartRow,nStartTab,
863cdf0e10cSrcweir 											  nEndCol,nEndRow,nEndTab );
864cdf0e10cSrcweir 				}
865cdf0e10cSrcweir 				else	// Aufruf per Maus
866cdf0e10cSrcweir 				{
867cdf0e10cSrcweir 					//	#55284# nicht innerhalb einer zusammengefassten Zelle
868cdf0e10cSrcweir 
869cdf0e10cSrcweir 					if ( nStartCol == nEndCol && nStartRow == nEndRow )
870cdf0e10cSrcweir 					{
871cdf0e10cSrcweir 						SCCOL nMergeCol = nStartCol;
872cdf0e10cSrcweir 						SCROW nMergeRow = nStartRow;
873cdf0e10cSrcweir 						if ( GetViewData()->GetDocument()->ExtendMerge(
874cdf0e10cSrcweir 								nStartCol, nStartRow, nMergeCol, nMergeRow,
875cdf0e10cSrcweir 								GetViewData()->GetTabNo() ) )
876cdf0e10cSrcweir 						{
877cdf0e10cSrcweir 							if ( nFillCol >= nStartCol && nFillCol <= nMergeCol && nFillRow == nStartRow )
878cdf0e10cSrcweir 								nFillCol = nStartCol;
879cdf0e10cSrcweir 							if ( nFillRow >= nStartRow && nFillRow <= nMergeRow && nFillCol == nStartCol )
880cdf0e10cSrcweir 								nFillRow = nStartRow;
881cdf0e10cSrcweir 						}
882cdf0e10cSrcweir 					}
883cdf0e10cSrcweir 				}
884cdf0e10cSrcweir 
885cdf0e10cSrcweir 				if ( nFillCol != nEndCol || nFillRow != nEndRow )
886cdf0e10cSrcweir 				{
887cdf0e10cSrcweir 					if ( nFillCol==nEndCol || nFillRow==nEndRow )
888cdf0e10cSrcweir 					{
889cdf0e10cSrcweir                         FillDir eDir = FILL_TO_BOTTOM;
890cdf0e10cSrcweir 						SCCOLROW nCount = 0;
891cdf0e10cSrcweir 
892cdf0e10cSrcweir 						if ( nFillCol==nEndCol )
893cdf0e10cSrcweir 						{
894cdf0e10cSrcweir 							if ( nFillRow > nEndRow )
895cdf0e10cSrcweir 							{
896cdf0e10cSrcweir 								eDir = FILL_TO_BOTTOM;
897cdf0e10cSrcweir 								nCount = nFillRow - nEndRow;
898cdf0e10cSrcweir 							}
899cdf0e10cSrcweir 							else if ( nFillRow < nStartRow )
900cdf0e10cSrcweir 							{
901cdf0e10cSrcweir 								eDir = FILL_TO_TOP;
902cdf0e10cSrcweir 								nCount = nStartRow - nFillRow;
903cdf0e10cSrcweir 							}
904cdf0e10cSrcweir 						}
905cdf0e10cSrcweir 						else
906cdf0e10cSrcweir 						{
907cdf0e10cSrcweir 							if ( nFillCol > nEndCol )
908cdf0e10cSrcweir 							{
909cdf0e10cSrcweir 								eDir = FILL_TO_RIGHT;
910cdf0e10cSrcweir 								nCount = nFillCol - nEndCol;
911cdf0e10cSrcweir 							}
912cdf0e10cSrcweir 							else if ( nFillCol < nStartCol )
913cdf0e10cSrcweir 							{
914cdf0e10cSrcweir 								eDir = FILL_TO_LEFT;
915cdf0e10cSrcweir 								nCount = nStartCol - nFillCol;
916cdf0e10cSrcweir 							}
917cdf0e10cSrcweir 						}
918cdf0e10cSrcweir 
919cdf0e10cSrcweir 						if ( nCount != 0)
920cdf0e10cSrcweir 						{
921cdf0e10cSrcweir 							pTabViewShell->FillAuto( eDir, nStartCol, nStartRow, nEndCol, nEndRow, nCount );
922cdf0e10cSrcweir 
923cdf0e10cSrcweir 							if( ! rReq.IsAPI() )
924cdf0e10cSrcweir 							{
925cdf0e10cSrcweir 								String	aAdrStr;
926cdf0e10cSrcweir 								ScAddress aAdr( nFillCol, nFillRow, 0 );
927cdf0e10cSrcweir 								aAdr.Format( aAdrStr, SCR_ABS, pDoc, pDoc->GetAddressConvention() );
928cdf0e10cSrcweir 
929cdf0e10cSrcweir 								rReq.AppendItem( SfxStringItem( FID_FILL_AUTO, aAdrStr ) );
930cdf0e10cSrcweir 								rReq.Done();
931cdf0e10cSrcweir 							}
932cdf0e10cSrcweir 						}
933cdf0e10cSrcweir 
934cdf0e10cSrcweir 					}
935cdf0e10cSrcweir 					else
936cdf0e10cSrcweir 					{
937cdf0e10cSrcweir 						DBG_ERROR( "Richtung nicht eindeutig fuer AutoFill" );
938cdf0e10cSrcweir 					}
939cdf0e10cSrcweir 				}
940cdf0e10cSrcweir 			}
941cdf0e10cSrcweir 			break;
942cdf0e10cSrcweir 
943cdf0e10cSrcweir 		//
944cdf0e10cSrcweir 		//	Gliederung (Outlines)
945cdf0e10cSrcweir 		//	SID_AUTO_OUTLINE, SID_OUTLINE_DELETEALL in Execute (in docsh.idl)
946cdf0e10cSrcweir 		//
947cdf0e10cSrcweir 
948cdf0e10cSrcweir 		case SID_OUTLINE_HIDE:
949cdf0e10cSrcweir             if ( GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(),
950cdf0e10cSrcweir                                     GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) )
951cdf0e10cSrcweir                 pTabViewShell->SetDataPilotDetails( sal_False );
952cdf0e10cSrcweir             else
953cdf0e10cSrcweir                 pTabViewShell->HideMarkedOutlines();
954cdf0e10cSrcweir 			rReq.Done();
955cdf0e10cSrcweir 			break;
956cdf0e10cSrcweir 
957cdf0e10cSrcweir 		case SID_OUTLINE_SHOW:
958cdf0e10cSrcweir             {
959cdf0e10cSrcweir                 ScDPObject* pDPObj = GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(),
960cdf0e10cSrcweir                                     GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
961cdf0e10cSrcweir                 if ( pDPObj )
962cdf0e10cSrcweir                 {
963cdf0e10cSrcweir                     Sequence<sheet::DataPilotFieldFilter> aFilters;
964cdf0e10cSrcweir                     sal_uInt16 nOrientation;
965cdf0e10cSrcweir                     if ( pTabViewShell->HasSelectionForDrillDown( nOrientation ) )
966cdf0e10cSrcweir                     {
967cdf0e10cSrcweir                         ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
968cdf0e10cSrcweir                         DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
969cdf0e10cSrcweir 
970cdf0e10cSrcweir                         AbstractScDPShowDetailDlg* pDlg = pFact->CreateScDPShowDetailDlg(
971cdf0e10cSrcweir                             pTabViewShell->GetDialogParent(), RID_SCDLG_DPSHOWDETAIL, *pDPObj, nOrientation );
972cdf0e10cSrcweir                         DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
973cdf0e10cSrcweir                         if ( pDlg->Execute() == RET_OK )
974cdf0e10cSrcweir                         {
975cdf0e10cSrcweir                             String aNewDimName( pDlg->GetDimensionName() );
976cdf0e10cSrcweir                             pTabViewShell->SetDataPilotDetails( sal_True, &aNewDimName );
977cdf0e10cSrcweir                         }
978cdf0e10cSrcweir                     }
979cdf0e10cSrcweir                     else if ( !pDPObj->IsServiceData() &&
980cdf0e10cSrcweir                                pDPObj->GetDataFieldPositionData(
981cdf0e10cSrcweir                                    ScAddress( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ),
982cdf0e10cSrcweir                                    aFilters ) )
983cdf0e10cSrcweir                         pTabViewShell->ShowDataPilotSourceData( *pDPObj, aFilters );
984cdf0e10cSrcweir                     else
985cdf0e10cSrcweir                         pTabViewShell->SetDataPilotDetails( sal_True );
986cdf0e10cSrcweir                 }
987cdf0e10cSrcweir                 else
988cdf0e10cSrcweir                     pTabViewShell->ShowMarkedOutlines();
989cdf0e10cSrcweir     			rReq.Done();
990cdf0e10cSrcweir             }
991cdf0e10cSrcweir 			break;
992cdf0e10cSrcweir 
993cdf0e10cSrcweir 		case SID_OUTLINE_MAKE:
994cdf0e10cSrcweir 			{
995cdf0e10cSrcweir                 sal_Bool bColumns = sal_False;
996cdf0e10cSrcweir 				sal_Bool bOk = sal_True;
997cdf0e10cSrcweir 
998cdf0e10cSrcweir 				if ( GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(),
999cdf0e10cSrcweir             							GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) )
1000cdf0e10cSrcweir             	{
1001cdf0e10cSrcweir                     ScDPNumGroupInfo aNumInfo;
1002cdf0e10cSrcweir                     aNumInfo.Enable    = sal_True;
1003cdf0e10cSrcweir                     aNumInfo.AutoStart = sal_True;
1004cdf0e10cSrcweir                     aNumInfo.AutoEnd   = sal_True;
1005cdf0e10cSrcweir                     sal_Int32 nParts = 0;
1006cdf0e10cSrcweir                     if ( pTabViewShell->HasSelectionForDateGroup( aNumInfo, nParts ) )
1007cdf0e10cSrcweir                     {
1008cdf0e10cSrcweir                         ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
1009cdf0e10cSrcweir                         DBG_ASSERT( pFact, "ScAbstractFactory create fail!" );
1010cdf0e10cSrcweir                         Date aNullDate( *GetViewData()->GetDocument()->GetFormatTable()->GetNullDate() );
1011cdf0e10cSrcweir                         AbstractScDPDateGroupDlg* pDlg = pFact->CreateScDPDateGroupDlg(
1012cdf0e10cSrcweir                             pTabViewShell->GetDialogParent(), RID_SCDLG_DPDATEGROUP,
1013cdf0e10cSrcweir                             aNumInfo, nParts, aNullDate );
1014cdf0e10cSrcweir                         DBG_ASSERT( pDlg, "Dialog create fail!" );
1015cdf0e10cSrcweir                         if( pDlg->Execute() == RET_OK )
1016cdf0e10cSrcweir                         {
1017cdf0e10cSrcweir                             aNumInfo = pDlg->GetGroupInfo();
1018cdf0e10cSrcweir                             pTabViewShell->DateGroupDataPilot( aNumInfo, pDlg->GetDatePart() );
1019cdf0e10cSrcweir                         }
1020cdf0e10cSrcweir                     }
1021cdf0e10cSrcweir                     else if ( pTabViewShell->HasSelectionForNumGroup( aNumInfo ) )
1022cdf0e10cSrcweir                     {
1023cdf0e10cSrcweir                         ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
1024cdf0e10cSrcweir                         DBG_ASSERT( pFact, "ScAbstractFactory create fail!" );
1025cdf0e10cSrcweir                         AbstractScDPNumGroupDlg* pDlg = pFact->CreateScDPNumGroupDlg(
1026cdf0e10cSrcweir                             pTabViewShell->GetDialogParent(), RID_SCDLG_DPNUMGROUP, aNumInfo );
1027cdf0e10cSrcweir                         DBG_ASSERT( pDlg, "Dialog create fail!" );
1028cdf0e10cSrcweir                         if( pDlg->Execute() == RET_OK )
1029cdf0e10cSrcweir                             pTabViewShell->NumGroupDataPilot( pDlg->GetGroupInfo() );
1030cdf0e10cSrcweir                     }
1031cdf0e10cSrcweir                     else
1032cdf0e10cSrcweir                         pTabViewShell->GroupDataPilot();
1033cdf0e10cSrcweir 
1034cdf0e10cSrcweir             	    bOk = sal_False;
1035cdf0e10cSrcweir             	}
1036cdf0e10cSrcweir 				else if( pReqArgs != NULL )
1037cdf0e10cSrcweir 				{
1038cdf0e10cSrcweir 					const SfxPoolItem* pItem;
1039cdf0e10cSrcweir 					bOk = sal_False;
1040cdf0e10cSrcweir 
1041cdf0e10cSrcweir 					if( IS_AVAILABLE( SID_OUTLINE_MAKE, &pItem ) )
1042cdf0e10cSrcweir 					{
1043cdf0e10cSrcweir 						String aCol = ((const SfxStringItem*)pItem)->GetValue();
1044cdf0e10cSrcweir 						aCol.ToUpperAscii();
1045cdf0e10cSrcweir 
1046cdf0e10cSrcweir 						switch( aCol.GetChar(0) )
1047cdf0e10cSrcweir 						{
1048cdf0e10cSrcweir 							case 'R': bColumns=sal_False; bOk = sal_True;break;
1049cdf0e10cSrcweir 							case 'C': bColumns=sal_True; bOk = sal_True;break;
1050cdf0e10cSrcweir 						}
1051cdf0e10cSrcweir 					}
1052cdf0e10cSrcweir 				}
1053cdf0e10cSrcweir 				else			// Dialog, wenn nicht ganze Zeilen/Spalten markiert
1054cdf0e10cSrcweir 				{
1055cdf0e10cSrcweir 					if ( GetViewData()->SimpleColMarked() && !GetViewData()->SimpleRowMarked() )
1056cdf0e10cSrcweir 						bColumns = sal_True;
1057cdf0e10cSrcweir 					else if ( !GetViewData()->SimpleColMarked() && GetViewData()->SimpleRowMarked() )
1058cdf0e10cSrcweir 						bColumns = sal_False;
1059cdf0e10cSrcweir 					else
1060cdf0e10cSrcweir 					{
1061cdf0e10cSrcweir //CHINA001						ScGroupDlg* pDlg = new ScGroupDlg(pTabViewShell->GetDialogParent(),
1062cdf0e10cSrcweir //CHINA001						RID_SCDLG_GRP_MAKE, sal_False );
1063cdf0e10cSrcweir 						ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
1064cdf0e10cSrcweir 						DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
1065cdf0e10cSrcweir 
1066cdf0e10cSrcweir 						AbstractScGroupDlg* pDlg = pFact->CreateAbstractScGroupDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_GRP_MAKE, RID_SCDLG_GRP_MAKE,sal_False);
1067cdf0e10cSrcweir 						DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
1068cdf0e10cSrcweir 						if ( pDlg->Execute() == RET_OK )
1069cdf0e10cSrcweir 							bColumns = pDlg->GetColsChecked();
1070cdf0e10cSrcweir 						else
1071cdf0e10cSrcweir 							bOk = sal_False;
1072cdf0e10cSrcweir 						delete pDlg;
1073cdf0e10cSrcweir 					}
1074cdf0e10cSrcweir 				}
1075cdf0e10cSrcweir 				if (bOk)
1076cdf0e10cSrcweir 				{
1077cdf0e10cSrcweir 					pTabViewShell->MakeOutline( bColumns );
1078cdf0e10cSrcweir 
1079cdf0e10cSrcweir 					if( ! rReq.IsAPI() )
1080cdf0e10cSrcweir 					{
1081cdf0e10cSrcweir 						String aCol = bColumns ? 'C' : 'R';
1082cdf0e10cSrcweir 						rReq.AppendItem( SfxStringItem( SID_OUTLINE_MAKE, aCol ) );
1083cdf0e10cSrcweir 						rReq.Done();
1084cdf0e10cSrcweir 					}
1085cdf0e10cSrcweir 				}
1086cdf0e10cSrcweir 			}
1087cdf0e10cSrcweir 			break;
1088cdf0e10cSrcweir 
1089cdf0e10cSrcweir 		case SID_OUTLINE_REMOVE:
1090cdf0e10cSrcweir 			{
1091cdf0e10cSrcweir                 sal_Bool bColumns = sal_False;
1092cdf0e10cSrcweir 				sal_Bool bOk = sal_True;
1093cdf0e10cSrcweir 
1094cdf0e10cSrcweir 				if ( GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(),
1095cdf0e10cSrcweir             							GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) )
1096cdf0e10cSrcweir             	{
1097cdf0e10cSrcweir             	    pTabViewShell->UngroupDataPilot();
1098cdf0e10cSrcweir             	    bOk = sal_False;
1099cdf0e10cSrcweir             	}
1100cdf0e10cSrcweir 				else if( pReqArgs != NULL )
1101cdf0e10cSrcweir 				{
1102cdf0e10cSrcweir 					const SfxPoolItem* pItem;
1103cdf0e10cSrcweir 					bOk = sal_False;
1104cdf0e10cSrcweir 
1105cdf0e10cSrcweir 					if( IS_AVAILABLE( SID_OUTLINE_REMOVE, &pItem ) )
1106cdf0e10cSrcweir 					{
1107cdf0e10cSrcweir 						String aCol = ((const SfxStringItem*)pItem)->GetValue();
1108cdf0e10cSrcweir 						aCol.ToUpperAscii();
1109cdf0e10cSrcweir 
1110cdf0e10cSrcweir 						switch( aCol.GetChar(0) )
1111cdf0e10cSrcweir 						{
1112cdf0e10cSrcweir 							case 'R': bColumns=sal_False; bOk = sal_True;break;
1113cdf0e10cSrcweir 							case 'C': bColumns=sal_True; bOk = sal_True;break;
1114cdf0e10cSrcweir 						}
1115cdf0e10cSrcweir 					}
1116cdf0e10cSrcweir 				}
1117cdf0e10cSrcweir 				else			// Dialog nur, wenn Aufheben fuer Zeilen und Spalten moeglich
1118cdf0e10cSrcweir 				{
1119cdf0e10cSrcweir 					sal_Bool bColPoss, bRowPoss;
1120cdf0e10cSrcweir 					pTabViewShell->TestRemoveOutline( bColPoss, bRowPoss );
1121cdf0e10cSrcweir 					if ( bColPoss && bRowPoss )
1122cdf0e10cSrcweir 					{
1123cdf0e10cSrcweir 						//CHINA001 ScGroupDlg* pDlg = new ScGroupDlg( 	pTabViewShell->GetDialogParent(),
1124cdf0e10cSrcweir 						//CHINA001 									RID_SCDLG_GRP_KILL, sal_True );
1125cdf0e10cSrcweir 						ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
1126cdf0e10cSrcweir 						DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
1127cdf0e10cSrcweir 
1128cdf0e10cSrcweir 						AbstractScGroupDlg* pDlg = pFact->CreateAbstractScGroupDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_GRP_KILL, RID_SCDLG_GRP_KILL,sal_True);
1129cdf0e10cSrcweir 						DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
1130cdf0e10cSrcweir 						if ( pDlg->Execute() == RET_OK )
1131cdf0e10cSrcweir 							bColumns = pDlg->GetColsChecked();
1132cdf0e10cSrcweir 						else
1133cdf0e10cSrcweir 							bOk = sal_False;
1134cdf0e10cSrcweir 						delete pDlg;
1135cdf0e10cSrcweir 					}
1136cdf0e10cSrcweir 					else if ( bColPoss )
1137cdf0e10cSrcweir 						bColumns = sal_True;
1138cdf0e10cSrcweir 					else if ( bRowPoss )
1139cdf0e10cSrcweir 						bColumns = sal_False;
1140cdf0e10cSrcweir 					else
1141cdf0e10cSrcweir 						bOk = sal_False;
1142cdf0e10cSrcweir 				}
1143cdf0e10cSrcweir 				if (bOk)
1144cdf0e10cSrcweir 				{
1145cdf0e10cSrcweir 					pTabViewShell->RemoveOutline( bColumns );
1146cdf0e10cSrcweir 
1147cdf0e10cSrcweir 					if( ! rReq.IsAPI() )
1148cdf0e10cSrcweir 					{
1149cdf0e10cSrcweir 						String aCol = bColumns ? 'C' : 'R';
1150cdf0e10cSrcweir 						rReq.AppendItem( SfxStringItem( SID_OUTLINE_REMOVE, aCol ) );
1151cdf0e10cSrcweir 						rReq.Done();
1152cdf0e10cSrcweir 					}
1153cdf0e10cSrcweir 				}
1154cdf0e10cSrcweir 			}
1155cdf0e10cSrcweir 			break;
1156cdf0e10cSrcweir 
1157cdf0e10cSrcweir 		//
1158cdf0e10cSrcweir 		//	Clipboard
1159cdf0e10cSrcweir 		//
1160cdf0e10cSrcweir 
1161cdf0e10cSrcweir 		case SID_COPY:				// fuer Grafiken in DrawShell
1162cdf0e10cSrcweir 			{
1163cdf0e10cSrcweir 				WaitObject aWait( GetViewData()->GetDialogParent() );
1164cdf0e10cSrcweir 				pTabViewShell->CopyToClip( NULL, sal_False, sal_False, sal_True );
1165cdf0e10cSrcweir 				rReq.Done();
1166cdf0e10cSrcweir 			}
1167cdf0e10cSrcweir 			break;
1168cdf0e10cSrcweir 
1169cdf0e10cSrcweir 		case SID_CUT:				// fuer Grafiken in DrawShell
1170cdf0e10cSrcweir 			{
1171cdf0e10cSrcweir 				WaitObject aWait( GetViewData()->GetDialogParent() );
1172cdf0e10cSrcweir 				pTabViewShell->CutToClip( NULL, sal_True );
1173cdf0e10cSrcweir 				rReq.Done();
1174cdf0e10cSrcweir 			}
1175cdf0e10cSrcweir 			break;
1176cdf0e10cSrcweir 
1177cdf0e10cSrcweir 		case SID_PASTE:
1178cdf0e10cSrcweir             {
1179cdf0e10cSrcweir 				PasteFromClipboard ( GetViewData(), pTabViewShell, true );
1180cdf0e10cSrcweir                 rReq.Done();
1181cdf0e10cSrcweir             }
1182cdf0e10cSrcweir 			break;
1183cdf0e10cSrcweir 
1184cdf0e10cSrcweir 		case SID_CLIPBOARD_FORMAT_ITEMS:
1185cdf0e10cSrcweir 			{
1186cdf0e10cSrcweir 				WaitObject aWait( GetViewData()->GetDialogParent() );
1187cdf0e10cSrcweir 
1188cdf0e10cSrcweir 				sal_uLong nFormat = 0;
1189cdf0e10cSrcweir 				const SfxPoolItem* pItem;
1190cdf0e10cSrcweir 				if ( pReqArgs &&
1191cdf0e10cSrcweir 					 pReqArgs->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET &&
1192cdf0e10cSrcweir 					 pItem->ISA(SfxUInt32Item) )
1193cdf0e10cSrcweir 				{
1194cdf0e10cSrcweir 					nFormat = ((const SfxUInt32Item*)pItem)->GetValue();
1195cdf0e10cSrcweir 				}
1196cdf0e10cSrcweir 
1197cdf0e10cSrcweir 				if ( nFormat )
1198cdf0e10cSrcweir 				{
1199cdf0e10cSrcweir 					Window* pWin = GetViewData()->GetActiveWin();
1200cdf0e10cSrcweir 					sal_Bool bCells = ( ScTransferObj::GetOwnClipboard( pWin ) != NULL );
1201cdf0e10cSrcweir 					sal_Bool bDraw = ( ScDrawTransferObj::GetOwnClipboard( pWin ) != NULL );
1202cdf0e10cSrcweir 					sal_Bool bOle = ( nFormat == SOT_FORMATSTR_ID_EMBED_SOURCE );
1203cdf0e10cSrcweir 
1204cdf0e10cSrcweir 					if ( bCells && bOle )
1205cdf0e10cSrcweir 						pTabViewShell->PasteFromSystem();
1206cdf0e10cSrcweir 					else if ( bDraw && bOle )
1207cdf0e10cSrcweir 						pTabViewShell->PasteDraw();
1208cdf0e10cSrcweir 					else
1209cdf0e10cSrcweir 						pTabViewShell->PasteFromSystem(nFormat);
1210cdf0e10cSrcweir 				}
1211cdf0e10cSrcweir 				//?else
1212cdf0e10cSrcweir 				//?	pTabViewShell->PasteFromSystem();
1213cdf0e10cSrcweir 
1214cdf0e10cSrcweir 				rReq.Done();
1215cdf0e10cSrcweir 			}
1216cdf0e10cSrcweir 			pTabViewShell->CellContentChanged();
1217cdf0e10cSrcweir 			break;
1218cdf0e10cSrcweir 
1219cdf0e10cSrcweir 		case FID_INS_CELL_CONTENTS:
1220cdf0e10cSrcweir 			{
1221cdf0e10cSrcweir 				sal_uInt16 nFlags = IDF_NONE;
1222cdf0e10cSrcweir 				sal_uInt16 nFunction = PASTE_NOFUNC;
1223cdf0e10cSrcweir 				sal_Bool bSkipEmpty = sal_False;
1224cdf0e10cSrcweir 				sal_Bool bTranspose = sal_False;
1225cdf0e10cSrcweir 				sal_Bool bAsLink	= sal_False;
1226cdf0e10cSrcweir 				InsCellCmd eMoveMode = INS_NONE;
1227cdf0e10cSrcweir 
1228cdf0e10cSrcweir 				Window* pWin = GetViewData()->GetActiveWin();
1229cdf0e10cSrcweir 				ScDocument* pDoc = GetViewData()->GetDocument();
1230cdf0e10cSrcweir 				sal_Bool bOtherDoc = !pDoc->IsClipboardSource();
1231cdf0e10cSrcweir 				ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
1232cdf0e10cSrcweir 				if ( pOwnClip )
1233cdf0e10cSrcweir 				{
1234cdf0e10cSrcweir                     // #129384# keep a reference in case the clipboard is changed during dialog or PasteFromClip
1235cdf0e10cSrcweir                     uno::Reference<datatransfer::XTransferable> aOwnClipRef( pOwnClip );
1236cdf0e10cSrcweir 					if ( pReqArgs!=NULL && pTabViewShell->SelectionEditable() )
1237cdf0e10cSrcweir 					{
1238cdf0e10cSrcweir 						const	SfxPoolItem* pItem;
1239cdf0e10cSrcweir 						String	aFlags = 'A';
1240cdf0e10cSrcweir 
1241cdf0e10cSrcweir 						if( IS_AVAILABLE( FID_INS_CELL_CONTENTS, &pItem ) )
1242cdf0e10cSrcweir 							aFlags = ((const SfxStringItem*)pItem)->GetValue();
1243cdf0e10cSrcweir 
1244cdf0e10cSrcweir 						aFlags.ToUpperAscii();
1245cdf0e10cSrcweir 						sal_Bool	bCont = sal_True;
1246cdf0e10cSrcweir 
1247cdf0e10cSrcweir 						for( xub_StrLen i=0 ; bCont && i<aFlags.Len() ; i++ )
1248cdf0e10cSrcweir 						{
1249cdf0e10cSrcweir 							switch( aFlags.GetChar(i) )
1250cdf0e10cSrcweir 							{
1251cdf0e10cSrcweir 								case 'A': // Alle
1252cdf0e10cSrcweir 								nFlags |= IDF_ALL;
1253cdf0e10cSrcweir 								bCont = sal_False; // nicht mehr weitermachen!
1254cdf0e10cSrcweir 								break;
1255cdf0e10cSrcweir 								case 'S': nFlags |= IDF_STRING;	break;
1256cdf0e10cSrcweir 								case 'V': nFlags |= IDF_VALUE; break;
1257cdf0e10cSrcweir 								case 'D': nFlags |= IDF_DATETIME; break;
1258cdf0e10cSrcweir 								case 'F': nFlags |= IDF_FORMULA; break;
1259cdf0e10cSrcweir 								case 'N': nFlags |= IDF_NOTE; break;
1260cdf0e10cSrcweir 								case 'T': nFlags |= IDF_ATTRIB; break;
1261cdf0e10cSrcweir 							}
1262cdf0e10cSrcweir 						}
1263cdf0e10cSrcweir 
1264cdf0e10cSrcweir                         SFX_REQUEST_ARG( rReq, pFuncItem, SfxUInt16Item, FN_PARAM_1, sal_False );
1265cdf0e10cSrcweir                         SFX_REQUEST_ARG( rReq, pSkipItem, SfxBoolItem, FN_PARAM_2, sal_False );
1266cdf0e10cSrcweir                         SFX_REQUEST_ARG( rReq, pTransposeItem, SfxBoolItem, FN_PARAM_3, sal_False );
1267cdf0e10cSrcweir                         SFX_REQUEST_ARG( rReq, pLinkItem, SfxBoolItem, FN_PARAM_4, sal_False );
1268cdf0e10cSrcweir                         SFX_REQUEST_ARG( rReq, pMoveItem, SfxInt16Item, FN_PARAM_5, sal_False );
1269cdf0e10cSrcweir                         if ( pFuncItem )
1270cdf0e10cSrcweir                             nFunction = pFuncItem->GetValue();
1271cdf0e10cSrcweir                         if ( pSkipItem )
1272cdf0e10cSrcweir                             bSkipEmpty = pSkipItem->GetValue();
1273cdf0e10cSrcweir                         if ( pTransposeItem )
1274cdf0e10cSrcweir                             bTranspose = pTransposeItem->GetValue();
1275cdf0e10cSrcweir                         if ( pLinkItem )
1276cdf0e10cSrcweir                             bAsLink = pLinkItem->GetValue();
1277cdf0e10cSrcweir                         if ( pMoveItem )
1278cdf0e10cSrcweir                             eMoveMode = (InsCellCmd) pMoveItem->GetValue();
1279cdf0e10cSrcweir 					}
1280cdf0e10cSrcweir 					else
1281cdf0e10cSrcweir 					{
1282cdf0e10cSrcweir 						ScEditableTester aTester( pTabViewShell );
1283cdf0e10cSrcweir 						if (aTester.IsEditable())
1284cdf0e10cSrcweir 						{
1285cdf0e10cSrcweir 							//CHINA001 ScInsertContentsDlg* pDlg = new ScInsertContentsDlg( pTabViewShell->GetDialogParent() );
1286cdf0e10cSrcweir 							ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
1287cdf0e10cSrcweir 							DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
1288cdf0e10cSrcweir 
1289cdf0e10cSrcweir 							AbstractScInsertContentsDlg* pDlg = pFact->CreateScInsertContentsDlg( pTabViewShell->GetDialogParent(),
1290cdf0e10cSrcweir 																									RID_SCDLG_INSCONT);
1291cdf0e10cSrcweir 							DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
1292cdf0e10cSrcweir 							pDlg->SetOtherDoc( bOtherDoc );
1293cdf0e10cSrcweir 							// #53661# bei ChangeTrack MoveMode disablen
1294cdf0e10cSrcweir 							pDlg->SetChangeTrack( pDoc->GetChangeTrack() != NULL );
1295cdf0e10cSrcweir 							// #72930# cut/move references may disable shift
1296cdf0e10cSrcweir 							// directions if source and destination ranges intersect
1297cdf0e10cSrcweir 							if ( !bOtherDoc )
1298cdf0e10cSrcweir 							{
1299*c2857b95SJürgen Schmidt 								if ( pOwnClip )
1300cdf0e10cSrcweir 								{
1301cdf0e10cSrcweir 									ScViewData* pData = GetViewData();
1302cdf0e10cSrcweir 									if ( pData->GetMarkData().GetTableSelect(
1303cdf0e10cSrcweir 											pData->GetTabNo() ) )
1304cdf0e10cSrcweir 									{
1305cdf0e10cSrcweir 										SCCOL nPosX = pData->GetCurX();
1306cdf0e10cSrcweir 										SCROW nPosY = pData->GetCurY();
1307cdf0e10cSrcweir                                         SCCOL nClipStartX, nClipSizeX;
1308cdf0e10cSrcweir                                         SCROW  nClipStartY, nClipSizeY;
1309cdf0e10cSrcweir                                         pOwnClip->GetDocument()->GetClipStart( nClipStartX, nClipStartY );
1310cdf0e10cSrcweir 										pOwnClip->GetDocument()->GetClipArea( nClipSizeX, nClipSizeY, sal_True );
1311cdf0e10cSrcweir 										int nDisableShift = 0;
1312*c2857b95SJürgen Schmidt 										if ( MAXCOL <= nPosX + nClipSizeX )
1313cdf0e10cSrcweir 											nDisableShift |= SC_CELL_SHIFT_DISABLE_RIGHT;
1314*c2857b95SJürgen Schmidt 										if ( MAXROW <= nPosY + nClipSizeY )
1315*c2857b95SJürgen Schmidt 											nDisableShift |= SC_CELL_SHIFT_DISABLE_DOWN;
1316cdf0e10cSrcweir 										if ( nDisableShift )
1317cdf0e10cSrcweir 											pDlg->SetCellShiftDisabled( nDisableShift );
1318cdf0e10cSrcweir 									}
1319cdf0e10cSrcweir 								}
1320cdf0e10cSrcweir 							}
1321cdf0e10cSrcweir 							if (pDlg->Execute() == RET_OK)
1322cdf0e10cSrcweir 							{
1323cdf0e10cSrcweir 								nFlags	   = pDlg->GetInsContentsCmdBits();
1324cdf0e10cSrcweir 								nFunction  = pDlg->GetFormulaCmdBits();
1325cdf0e10cSrcweir 								bSkipEmpty = pDlg->IsSkipEmptyCells();
1326cdf0e10cSrcweir 								bTranspose = pDlg->IsTranspose();
1327cdf0e10cSrcweir 								bAsLink	   = pDlg->IsLink();
1328cdf0e10cSrcweir 								eMoveMode  = pDlg->GetMoveMode();
1329cdf0e10cSrcweir 							}
1330cdf0e10cSrcweir 							delete pDlg;
1331cdf0e10cSrcweir 						}
1332cdf0e10cSrcweir 						else
1333cdf0e10cSrcweir 							pTabViewShell->ErrorMessage(aTester.GetMessageId());
1334cdf0e10cSrcweir 					}
1335cdf0e10cSrcweir 
1336cdf0e10cSrcweir 					if( nFlags != IDF_NONE )
1337cdf0e10cSrcweir 					{
1338cdf0e10cSrcweir 						{
1339cdf0e10cSrcweir 							WaitObject aWait( GetViewData()->GetDialogParent() );
1340cdf0e10cSrcweir 							if ( bAsLink && bOtherDoc )
1341cdf0e10cSrcweir 								pTabViewShell->PasteFromSystem(SOT_FORMATSTR_ID_LINK);	// DDE einfuegen
1342cdf0e10cSrcweir 							else
1343cdf0e10cSrcweir 								pTabViewShell->PasteFromClip( nFlags, pOwnClip->GetDocument(),
1344cdf0e10cSrcweir 									nFunction, bSkipEmpty, bTranspose, bAsLink,
1345cdf0e10cSrcweir 									eMoveMode, IDF_NONE, sal_True );	// allow warning dialog
1346cdf0e10cSrcweir 						}
1347cdf0e10cSrcweir 
1348cdf0e10cSrcweir                         if( !pReqArgs )
1349cdf0e10cSrcweir 						{
1350cdf0e10cSrcweir 							String	aFlags;
1351cdf0e10cSrcweir 
1352cdf0e10cSrcweir 							if( nFlags == IDF_ALL )
1353cdf0e10cSrcweir 							{
1354cdf0e10cSrcweir 								aFlags += 'A';
1355cdf0e10cSrcweir 							}
1356cdf0e10cSrcweir 							else
1357cdf0e10cSrcweir 							{
1358cdf0e10cSrcweir 								if( nFlags & IDF_STRING ) aFlags += 'S';
1359cdf0e10cSrcweir 								if( nFlags & IDF_VALUE ) aFlags += 'V';
1360cdf0e10cSrcweir 								if( nFlags & IDF_DATETIME ) aFlags += 'D';
1361cdf0e10cSrcweir 								if( nFlags & IDF_FORMULA ) aFlags += 'F';
1362cdf0e10cSrcweir 								if( nFlags & IDF_NOTE ) aFlags += 'N';
1363cdf0e10cSrcweir 								if( nFlags & IDF_ATTRIB ) aFlags += 'T';
1364cdf0e10cSrcweir 							}
1365cdf0e10cSrcweir 
1366cdf0e10cSrcweir 							rReq.AppendItem( SfxStringItem( FID_INS_CELL_CONTENTS, aFlags ) );
1367cdf0e10cSrcweir                             rReq.AppendItem( SfxBoolItem( FN_PARAM_2, bSkipEmpty ) );
1368cdf0e10cSrcweir                             rReq.AppendItem( SfxBoolItem( FN_PARAM_3, bTranspose ) );
1369cdf0e10cSrcweir                             rReq.AppendItem( SfxBoolItem( FN_PARAM_4, bAsLink ) );
1370cdf0e10cSrcweir                             rReq.AppendItem( SfxUInt16Item( FN_PARAM_1, nFunction ) );
1371cdf0e10cSrcweir                             rReq.AppendItem( SfxInt16Item( FN_PARAM_5, (sal_Int16) eMoveMode ) );
1372cdf0e10cSrcweir 							rReq.Done();
1373cdf0e10cSrcweir 						}
1374cdf0e10cSrcweir 					}
1375cdf0e10cSrcweir 				}
1376cdf0e10cSrcweir 			}
1377cdf0e10cSrcweir 			pTabViewShell->CellContentChanged();		// => PasteFromXXX ???
1378cdf0e10cSrcweir 			break;
1379cdf0e10cSrcweir 
1380cdf0e10cSrcweir         case SID_PASTE_SPECIAL:
1381cdf0e10cSrcweir 			// Unterscheidung, ob eigene oder fremde Daten,
1382cdf0e10cSrcweir 			// dadurch FID_INS_CELL_CONTENTS ueberfluessig
1383cdf0e10cSrcweir 			{
1384cdf0e10cSrcweir 				Window* pWin = GetViewData()->GetActiveWin();
1385cdf0e10cSrcweir 
1386cdf0e10cSrcweir 				//	Clipboard-ID als Parameter angegeben? Basic "PasteSpecial(Format)"
1387cdf0e10cSrcweir                 const SfxPoolItem* pItem=NULL;
1388cdf0e10cSrcweir 				if ( pReqArgs &&
1389cdf0e10cSrcweir 					 pReqArgs->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET &&
1390cdf0e10cSrcweir 					 pItem->ISA(SfxUInt32Item) )
1391cdf0e10cSrcweir 				{
1392cdf0e10cSrcweir 					sal_uLong nFormat = ((const SfxUInt32Item*)pItem)->GetValue();
1393cdf0e10cSrcweir                     sal_Bool bRet=sal_True;
1394cdf0e10cSrcweir 					{
1395cdf0e10cSrcweir 						WaitObject aWait( GetViewData()->GetDialogParent() );
1396cdf0e10cSrcweir                         sal_Bool bDraw = ( ScDrawTransferObj::GetOwnClipboard( pWin ) != NULL );
1397cdf0e10cSrcweir                         if ( bDraw && nFormat == SOT_FORMATSTR_ID_EMBED_SOURCE )
1398cdf0e10cSrcweir                             pTabViewShell->PasteDraw();
1399cdf0e10cSrcweir                         else
1400cdf0e10cSrcweir                             bRet = pTabViewShell->PasteFromSystem(nFormat, sal_True);       // TRUE: keine Fehlermeldungen
1401cdf0e10cSrcweir 					}
1402cdf0e10cSrcweir 
1403cdf0e10cSrcweir                     if ( bRet )
1404cdf0e10cSrcweir                     {
1405cdf0e10cSrcweir                         rReq.SetReturnValue(SfxInt16Item(nSlot, bRet)); // 1 = Erfolg, 0 = Fehler
1406cdf0e10cSrcweir                         rReq.Done();
1407cdf0e10cSrcweir                     }
1408cdf0e10cSrcweir                     else
1409cdf0e10cSrcweir                         // if format is not available -> fallback to request without parameters
1410cdf0e10cSrcweir                         pItem = NULL;
1411cdf0e10cSrcweir 				}
1412cdf0e10cSrcweir 
1413cdf0e10cSrcweir                 if ( !pItem )
1414cdf0e10cSrcweir                 {
1415cdf0e10cSrcweir                     if ( ScTransferObj::GetOwnClipboard( pWin ) )  // own cell data
1416cdf0e10cSrcweir                     {
1417cdf0e10cSrcweir                         rReq.SetSlot( FID_INS_CELL_CONTENTS );
1418cdf0e10cSrcweir                         ExecuteSlot( rReq, GetInterface() );
1419cdf0e10cSrcweir                         rReq.SetReturnValue(SfxInt16Item(nSlot, 1));    // 1 = Erfolg
1420cdf0e10cSrcweir                     }
1421cdf0e10cSrcweir                     else                                    // Zeichenobjekte oder fremde Daten
1422cdf0e10cSrcweir                     {
1423cdf0e10cSrcweir                         sal_Bool bDraw = ( ScDrawTransferObj::GetOwnClipboard( pWin ) != NULL );
1424cdf0e10cSrcweir 
1425cdf0e10cSrcweir                         SvxClipboardFmtItem aFormats( SID_CLIPBOARD_FORMAT_ITEMS );
1426cdf0e10cSrcweir                         GetPossibleClipboardFormats( aFormats );
1427cdf0e10cSrcweir 
1428cdf0e10cSrcweir                         sal_uInt16 nFormatCount = aFormats.Count();
1429cdf0e10cSrcweir                         if ( nFormatCount )
1430cdf0e10cSrcweir                         {
1431cdf0e10cSrcweir                             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
1432cdf0e10cSrcweir                             SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( pTabViewShell->GetDialogParent() );
1433cdf0e10cSrcweir                             if ( pDlg )
1434cdf0e10cSrcweir                             {
1435cdf0e10cSrcweir                             for (sal_uInt16 i=0; i<nFormatCount; i++)
1436cdf0e10cSrcweir                             {
1437cdf0e10cSrcweir                                 sal_uLong nFormatId = aFormats.GetClipbrdFormatId( i );
1438cdf0e10cSrcweir                                 String aName = aFormats.GetClipbrdFormatName( i );
1439cdf0e10cSrcweir                                 // special case for paste dialog: '*' is replaced by object type
1440cdf0e10cSrcweir                                 if ( nFormatId == SOT_FORMATSTR_ID_EMBED_SOURCE )
1441cdf0e10cSrcweir                                     aName.Assign((sal_Unicode)'*');
1442cdf0e10cSrcweir                                 pDlg->Insert( nFormatId, aName );
1443cdf0e10cSrcweir                             }
1444cdf0e10cSrcweir 
1445cdf0e10cSrcweir                             TransferableDataHelper aDataHelper(
1446cdf0e10cSrcweir                                 TransferableDataHelper::CreateFromSystemClipboard( pWin ) );
1447cdf0e10cSrcweir                             sal_uLong nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() );
1448cdf0e10cSrcweir                             if (nFormat > 0)
1449cdf0e10cSrcweir                             {
1450cdf0e10cSrcweir                                 {
1451cdf0e10cSrcweir                                     WaitObject aWait( GetViewData()->GetDialogParent() );
1452cdf0e10cSrcweir                                     if ( bDraw && nFormat == SOT_FORMATSTR_ID_EMBED_SOURCE )
1453cdf0e10cSrcweir                                         pTabViewShell->PasteDraw();
1454cdf0e10cSrcweir                                     else
1455cdf0e10cSrcweir                                         pTabViewShell->PasteFromSystem(nFormat);
1456cdf0e10cSrcweir                                 }
1457cdf0e10cSrcweir                                 rReq.SetReturnValue(SfxInt16Item(nSlot, 1));    // 1 = Erfolg
1458cdf0e10cSrcweir                                 rReq.AppendItem( SfxUInt32Item( nSlot, nFormat ) );
1459cdf0e10cSrcweir                                 rReq.Done();
1460cdf0e10cSrcweir                             }
1461cdf0e10cSrcweir                             else
1462cdf0e10cSrcweir                             {
1463cdf0e10cSrcweir                                 rReq.SetReturnValue(SfxInt16Item(nSlot, 0));    // 0 = Fehler
1464cdf0e10cSrcweir                                 rReq.Ignore();
1465cdf0e10cSrcweir                             }
1466cdf0e10cSrcweir 
1467cdf0e10cSrcweir                             delete pDlg;
1468cdf0e10cSrcweir                             }
1469cdf0e10cSrcweir                         }
1470cdf0e10cSrcweir                         else
1471cdf0e10cSrcweir                             rReq.SetReturnValue(SfxInt16Item(nSlot, 0));        // 0 = Fehler
1472cdf0e10cSrcweir                     }
1473cdf0e10cSrcweir                 }
1474cdf0e10cSrcweir 			}
1475cdf0e10cSrcweir 			pTabViewShell->CellContentChanged();		// => PasteFromSystem() ???
1476cdf0e10cSrcweir 			break;
1477cdf0e10cSrcweir 
1478cdf0e10cSrcweir 		//
1479cdf0e10cSrcweir 		//	sonstiges
1480cdf0e10cSrcweir 		//
1481cdf0e10cSrcweir 
1482cdf0e10cSrcweir 		case FID_INS_ROWBRK:
1483cdf0e10cSrcweir 			pTabViewShell->InsertPageBreak( sal_False );
1484cdf0e10cSrcweir 			rReq.Done();
1485cdf0e10cSrcweir 			break;
1486cdf0e10cSrcweir 
1487cdf0e10cSrcweir 		case FID_INS_COLBRK:
1488cdf0e10cSrcweir 			pTabViewShell->InsertPageBreak( sal_True );
1489cdf0e10cSrcweir 			rReq.Done();
1490cdf0e10cSrcweir 			break;
1491cdf0e10cSrcweir 
1492cdf0e10cSrcweir 		case FID_DEL_ROWBRK:
1493cdf0e10cSrcweir 			pTabViewShell->DeletePageBreak( sal_False );
1494cdf0e10cSrcweir 			rReq.Done();
1495cdf0e10cSrcweir 			break;
1496cdf0e10cSrcweir 
1497cdf0e10cSrcweir 		case FID_DEL_COLBRK:
1498cdf0e10cSrcweir 			pTabViewShell->DeletePageBreak( sal_True );
1499cdf0e10cSrcweir 			rReq.Done();
1500cdf0e10cSrcweir 			break;
1501cdf0e10cSrcweir 
1502cdf0e10cSrcweir 		case SID_DETECTIVE_ADD_PRED:
1503cdf0e10cSrcweir 			pTabViewShell->DetectiveAddPred();
1504cdf0e10cSrcweir 			rReq.Done();
1505cdf0e10cSrcweir 			break;
1506cdf0e10cSrcweir 
1507cdf0e10cSrcweir 		case SID_DETECTIVE_DEL_PRED:
1508cdf0e10cSrcweir 			pTabViewShell->DetectiveDelPred();
1509cdf0e10cSrcweir 			rReq.Done();
1510cdf0e10cSrcweir 			break;
1511cdf0e10cSrcweir 
1512cdf0e10cSrcweir 		case SID_DETECTIVE_ADD_SUCC:
1513cdf0e10cSrcweir 			pTabViewShell->DetectiveAddSucc();
1514cdf0e10cSrcweir 			rReq.Done();
1515cdf0e10cSrcweir 			break;
1516cdf0e10cSrcweir 
1517cdf0e10cSrcweir 		case SID_DETECTIVE_DEL_SUCC:
1518cdf0e10cSrcweir 			pTabViewShell->DetectiveDelSucc();
1519cdf0e10cSrcweir 			rReq.Done();
1520cdf0e10cSrcweir 			break;
1521cdf0e10cSrcweir 
1522cdf0e10cSrcweir 		case SID_DETECTIVE_ADD_ERR:
1523cdf0e10cSrcweir 			pTabViewShell->DetectiveAddError();
1524cdf0e10cSrcweir 			rReq.Done();
1525cdf0e10cSrcweir 			break;
1526cdf0e10cSrcweir 
1527cdf0e10cSrcweir 		case SID_DETECTIVE_INVALID:
1528cdf0e10cSrcweir 			pTabViewShell->DetectiveMarkInvalid();
1529cdf0e10cSrcweir 			rReq.Done();
1530cdf0e10cSrcweir 			break;
1531cdf0e10cSrcweir 
1532cdf0e10cSrcweir 		case SID_DETECTIVE_REFRESH:
1533cdf0e10cSrcweir 			pTabViewShell->DetectiveRefresh();
1534cdf0e10cSrcweir 			rReq.Done();
1535cdf0e10cSrcweir 			break;
1536cdf0e10cSrcweir 
1537cdf0e10cSrcweir         case SID_SPELL_DIALOG:
1538cdf0e10cSrcweir //           pTabViewShell->DoSpellingChecker();
1539cdf0e10cSrcweir             {
1540cdf0e10cSrcweir                 SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame();
1541cdf0e10cSrcweir                 if( rReq.GetArgs() )
1542cdf0e10cSrcweir                     pViewFrame->SetChildWindow( SID_SPELL_DIALOG,
1543cdf0e10cSrcweir                         static_cast< const SfxBoolItem& >( rReq.GetArgs()->
1544cdf0e10cSrcweir                             Get( SID_SPELL_DIALOG ) ).GetValue() );
1545cdf0e10cSrcweir                 else
1546cdf0e10cSrcweir                     pViewFrame->ToggleChildWindow( SID_SPELL_DIALOG );
1547cdf0e10cSrcweir 
1548cdf0e10cSrcweir                 pViewFrame->GetBindings().Invalidate( SID_SPELL_DIALOG );
1549cdf0e10cSrcweir                 rReq.Ignore();
1550cdf0e10cSrcweir             }
1551cdf0e10cSrcweir 			break;
1552cdf0e10cSrcweir 
1553cdf0e10cSrcweir         case SID_HANGUL_HANJA_CONVERSION:
1554cdf0e10cSrcweir             pTabViewShell->DoHangulHanjaConversion();
1555cdf0e10cSrcweir             break;
1556cdf0e10cSrcweir 
1557cdf0e10cSrcweir         case SID_CHINESE_CONVERSION:
1558cdf0e10cSrcweir             {
1559cdf0e10cSrcweir                 //open ChineseTranslationDialog
1560cdf0e10cSrcweir                 Reference< XComponentContext > xContext(
1561cdf0e10cSrcweir                     ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one
1562cdf0e10cSrcweir                 if(xContext.is())
1563cdf0e10cSrcweir                 {
1564cdf0e10cSrcweir                     Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
1565cdf0e10cSrcweir                     if(xMCF.is())
1566cdf0e10cSrcweir                     {
1567cdf0e10cSrcweir                         Reference< ui::dialogs::XExecutableDialog > xDialog(
1568cdf0e10cSrcweir                                 xMCF->createInstanceWithContext(
1569cdf0e10cSrcweir                                     rtl::OUString::createFromAscii("com.sun.star.linguistic2.ChineseTranslationDialog")
1570cdf0e10cSrcweir                                     , xContext), UNO_QUERY);
1571cdf0e10cSrcweir                         Reference< lang::XInitialization > xInit( xDialog, UNO_QUERY );
1572cdf0e10cSrcweir                         if( xInit.is() )
1573cdf0e10cSrcweir                         {
1574cdf0e10cSrcweir                             //  initialize dialog
1575cdf0e10cSrcweir                             Reference< awt::XWindow > xDialogParentWindow(0);
1576cdf0e10cSrcweir                             Sequence<Any> aSeq(1);
1577cdf0e10cSrcweir                             Any* pArray = aSeq.getArray();
1578cdf0e10cSrcweir                             PropertyValue aParam;
1579cdf0e10cSrcweir                             aParam.Name = rtl::OUString::createFromAscii("ParentWindow");
1580cdf0e10cSrcweir                             aParam.Value <<= makeAny(xDialogParentWindow);
1581cdf0e10cSrcweir                             pArray[0] <<= makeAny(aParam);
1582cdf0e10cSrcweir                             xInit->initialize( aSeq );
1583cdf0e10cSrcweir 
1584cdf0e10cSrcweir                             //execute dialog
1585cdf0e10cSrcweir                             sal_Int16 nDialogRet = xDialog->execute();
1586cdf0e10cSrcweir                             if( RET_OK == nDialogRet )
1587cdf0e10cSrcweir                             {
1588cdf0e10cSrcweir                                 //get some parameters from the dialog
1589cdf0e10cSrcweir                                 sal_Bool bToSimplified = sal_True;
1590cdf0e10cSrcweir                                 sal_Bool bUseVariants = sal_True;
1591cdf0e10cSrcweir                                 sal_Bool bCommonTerms = sal_True;
1592cdf0e10cSrcweir                                 Reference< beans::XPropertySet >  xProp( xDialog, UNO_QUERY );
1593cdf0e10cSrcweir                                 if( xProp.is() )
1594cdf0e10cSrcweir                                 {
1595cdf0e10cSrcweir                                     try
1596cdf0e10cSrcweir                                     {
1597cdf0e10cSrcweir                                         xProp->getPropertyValue( C2U("IsDirectionToSimplified") ) >>= bToSimplified;
1598cdf0e10cSrcweir                                         xProp->getPropertyValue( C2U("IsUseCharacterVariants") ) >>= bUseVariants;
1599cdf0e10cSrcweir                                         xProp->getPropertyValue( C2U("IsTranslateCommonTerms") ) >>= bCommonTerms;
1600cdf0e10cSrcweir                                     }
1601cdf0e10cSrcweir                                     catch( Exception& )
1602cdf0e10cSrcweir                                     {
1603cdf0e10cSrcweir                                     }
1604cdf0e10cSrcweir                                 }
1605cdf0e10cSrcweir 
1606cdf0e10cSrcweir                                 //execute translation
1607cdf0e10cSrcweir                                 LanguageType eSourceLang = bToSimplified ? LANGUAGE_CHINESE_TRADITIONAL : LANGUAGE_CHINESE_SIMPLIFIED;
1608cdf0e10cSrcweir                                 LanguageType eTargetLang = bToSimplified ? LANGUAGE_CHINESE_SIMPLIFIED : LANGUAGE_CHINESE_TRADITIONAL;
1609cdf0e10cSrcweir                                 sal_Int32 nOptions = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
1610cdf0e10cSrcweir                                 if( !bCommonTerms )
1611cdf0e10cSrcweir                                     nOptions |= i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
1612cdf0e10cSrcweir 
1613cdf0e10cSrcweir                                 Font aTargetFont = GetViewData()->GetActiveWin()->GetDefaultFont(
1614cdf0e10cSrcweir                                                     DEFAULTFONT_CJK_SPREADSHEET,
1615cdf0e10cSrcweir                                                     eTargetLang, DEFAULTFONT_FLAGS_ONLYONE );
1616cdf0e10cSrcweir                                 ScConversionParam aConvParam( SC_CONVERSION_CHINESE_TRANSL,
1617cdf0e10cSrcweir                                     eSourceLang, eTargetLang, aTargetFont, nOptions, false );
1618cdf0e10cSrcweir                                 pTabViewShell->DoSheetConversion( aConvParam );
1619cdf0e10cSrcweir                             }
1620cdf0e10cSrcweir                         }
1621cdf0e10cSrcweir                         Reference< lang::XComponent > xComponent( xDialog, UNO_QUERY );
1622cdf0e10cSrcweir                         if( xComponent.is() )
1623cdf0e10cSrcweir                             xComponent->dispose();
1624cdf0e10cSrcweir                     }
1625cdf0e10cSrcweir                 }
1626cdf0e10cSrcweir             }
1627cdf0e10cSrcweir             break;
1628cdf0e10cSrcweir 
1629cdf0e10cSrcweir         case SID_THESAURUS:
1630cdf0e10cSrcweir 			pTabViewShell->DoThesaurus();
1631cdf0e10cSrcweir 			break;
1632cdf0e10cSrcweir 
1633cdf0e10cSrcweir 		case SID_TOGGLE_REL:
1634cdf0e10cSrcweir             pTabViewShell->DoRefConversion();
1635cdf0e10cSrcweir 			break;
1636cdf0e10cSrcweir 
1637cdf0e10cSrcweir 		case SID_DEC_INDENT:
1638cdf0e10cSrcweir 			pTabViewShell->ChangeIndent( sal_False );
1639cdf0e10cSrcweir 			break;
1640cdf0e10cSrcweir 		case SID_INC_INDENT:
1641cdf0e10cSrcweir 			pTabViewShell->ChangeIndent( sal_True );
1642cdf0e10cSrcweir 			break;
1643cdf0e10cSrcweir 
1644cdf0e10cSrcweir 		case FID_USE_NAME:
1645cdf0e10cSrcweir 			{
1646cdf0e10cSrcweir 				sal_uInt16 nFlags = pTabViewShell->GetCreateNameFlags();
1647cdf0e10cSrcweir 
1648cdf0e10cSrcweir 				//CHINA001 ScNameCreateDlg* pDlg = new ScNameCreateDlg( 	pTabViewShell->GetDialogParent(), nFlags );
1649cdf0e10cSrcweir 				ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
1650cdf0e10cSrcweir 				DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
1651cdf0e10cSrcweir 
1652cdf0e10cSrcweir 				AbstractScNameCreateDlg* pDlg = pFact->CreateScNameCreateDlg(pTabViewShell->GetDialogParent(), nFlags, RID_SCDLG_NAMES_CREATE );
1653cdf0e10cSrcweir 				DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
1654cdf0e10cSrcweir 
1655cdf0e10cSrcweir 				if( pDlg->Execute() )
1656cdf0e10cSrcweir 				{
1657cdf0e10cSrcweir 					nFlags = pDlg->GetFlags();
1658cdf0e10cSrcweir 					pTabViewShell->CreateNames(nFlags);
1659cdf0e10cSrcweir 					rReq.Done();
1660cdf0e10cSrcweir 				}
1661cdf0e10cSrcweir 				delete pDlg;
1662cdf0e10cSrcweir 			}
1663cdf0e10cSrcweir 			break;
1664cdf0e10cSrcweir 
1665cdf0e10cSrcweir 		case SID_CONSOLIDATE:
1666cdf0e10cSrcweir 			{
1667cdf0e10cSrcweir 				const SfxPoolItem* pItem;
1668cdf0e10cSrcweir 				if ( pReqArgs && SFX_ITEM_SET ==
1669cdf0e10cSrcweir 						pReqArgs->GetItemState( SCITEM_CONSOLIDATEDATA, sal_True, &pItem ) )
1670cdf0e10cSrcweir 				{
1671cdf0e10cSrcweir 					const ScConsolidateParam& rParam =
1672cdf0e10cSrcweir 							((const ScConsolidateItem*)pItem)->GetData();
1673cdf0e10cSrcweir 
1674cdf0e10cSrcweir 					pTabViewShell->Consolidate( rParam );
1675cdf0e10cSrcweir 					GetViewData()->GetDocument()->SetConsolidateDlgData( &rParam );
1676cdf0e10cSrcweir 
1677cdf0e10cSrcweir 					rReq.Done();
1678cdf0e10cSrcweir 				}
1679cdf0e10cSrcweir 				else if (rReq.IsAPI())
1680cdf0e10cSrcweir 					SbxBase::SetError(SbxERR_BAD_PARAMETER);
1681cdf0e10cSrcweir 			}
1682cdf0e10cSrcweir 			break;
1683cdf0e10cSrcweir 
1684cdf0e10cSrcweir 		case SID_INS_FUNCTION:
1685cdf0e10cSrcweir 			{
1686cdf0e10cSrcweir 				const SfxBoolItem* pOkItem = (const SfxBoolItem*)&pReqArgs->Get( SID_DLG_RETOK );
1687cdf0e10cSrcweir 
1688cdf0e10cSrcweir //				pScMod->SetFunctionDlg( NULL );
1689cdf0e10cSrcweir 
1690cdf0e10cSrcweir 				if ( pOkItem->GetValue() )		// OK
1691cdf0e10cSrcweir 				{
1692cdf0e10cSrcweir 					String				 aFormula;
1693cdf0e10cSrcweir 					const SfxStringItem* pSItem 	 = (const SfxStringItem*)&pReqArgs->Get( SCITEM_STRING );
1694cdf0e10cSrcweir 					const SfxBoolItem* 	 pMatrixItem = (const SfxBoolItem*)  &pReqArgs->Get( SID_DLG_MATRIX );
1695cdf0e10cSrcweir 
1696cdf0e10cSrcweir 					aFormula += pSItem->GetValue();
1697cdf0e10cSrcweir 					pScMod->ActivateInputWindow( &aFormula, pMatrixItem->GetValue() );
1698cdf0e10cSrcweir 				}
1699cdf0e10cSrcweir 				else							// CANCEL
1700cdf0e10cSrcweir 				{
1701cdf0e10cSrcweir 					pScMod->ActivateInputWindow( NULL );
1702cdf0e10cSrcweir 				}
1703cdf0e10cSrcweir 				rReq.Ignore();		// only SID_ENTER_STRING is recorded
1704cdf0e10cSrcweir 			}
1705cdf0e10cSrcweir 			break;
1706cdf0e10cSrcweir 
1707cdf0e10cSrcweir 		case FID_DEFINE_NAME:
1708cdf0e10cSrcweir 			if ( pReqArgs )
1709cdf0e10cSrcweir 			{
1710cdf0e10cSrcweir 				const SfxPoolItem* pItem;
1711cdf0e10cSrcweir 				String	aName, aSymbol, aAttrib;
1712cdf0e10cSrcweir 
1713cdf0e10cSrcweir 				if( IS_AVAILABLE( FID_DEFINE_NAME, &pItem ) )
1714cdf0e10cSrcweir 					aName = ((const SfxStringItem*)pItem)->GetValue();
1715cdf0e10cSrcweir 
1716cdf0e10cSrcweir 				if( IS_AVAILABLE( FN_PARAM_1, &pItem ) )
1717cdf0e10cSrcweir 					aSymbol = ((const SfxStringItem*)pItem)->GetValue();
1718cdf0e10cSrcweir 
1719cdf0e10cSrcweir 				if( IS_AVAILABLE( FN_PARAM_2, &pItem ) )
1720cdf0e10cSrcweir 					aAttrib = ((const SfxStringItem*)pItem)->GetValue();
1721cdf0e10cSrcweir 
1722cdf0e10cSrcweir 				if ( aName.Len() && aSymbol.Len() )
1723cdf0e10cSrcweir 				{
1724cdf0e10cSrcweir 					if (pTabViewShell->InsertName( aName, aSymbol, aAttrib ))
1725cdf0e10cSrcweir 						rReq.Done();
1726cdf0e10cSrcweir 					else
1727cdf0e10cSrcweir 						SbxBase::SetError( SbxERR_BAD_PARAMETER );	// Basic-Fehler
1728cdf0e10cSrcweir 				}
1729cdf0e10cSrcweir 			}
1730cdf0e10cSrcweir 			else
1731cdf0e10cSrcweir 			{
1732cdf0e10cSrcweir 				sal_uInt16			nId  = ScNameDlgWrapper::GetChildWindowId();
1733cdf0e10cSrcweir 				SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
1734cdf0e10cSrcweir 				SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
1735cdf0e10cSrcweir 
1736cdf0e10cSrcweir 				pScMod->SetRefDialog( nId, pWnd ? sal_False : sal_True );
1737cdf0e10cSrcweir 			}
1738cdf0e10cSrcweir 			break;
1739cdf0e10cSrcweir 
1740cdf0e10cSrcweir 		case SID_DEFINE_COLROWNAMERANGES:
1741cdf0e10cSrcweir 			{
1742cdf0e10cSrcweir 
1743cdf0e10cSrcweir 				sal_uInt16			nId  = ScColRowNameRangesDlgWrapper::GetChildWindowId();
1744cdf0e10cSrcweir 				SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
1745cdf0e10cSrcweir 				SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
1746cdf0e10cSrcweir 
1747cdf0e10cSrcweir 				pScMod->SetRefDialog( nId, pWnd ? sal_False : sal_True );
1748cdf0e10cSrcweir 
1749cdf0e10cSrcweir 			}
1750cdf0e10cSrcweir 			break;
1751cdf0e10cSrcweir 
1752cdf0e10cSrcweir 		case SID_UPDATECHART:
1753cdf0e10cSrcweir 			{
1754cdf0e10cSrcweir 				sal_Bool bAll = sal_False;
1755cdf0e10cSrcweir 
1756cdf0e10cSrcweir 				if( pReqArgs )
1757cdf0e10cSrcweir 				{
1758cdf0e10cSrcweir 					const SfxPoolItem* pItem;
1759cdf0e10cSrcweir 
1760cdf0e10cSrcweir 					if( IS_AVAILABLE( SID_UPDATECHART, &pItem ) )
1761cdf0e10cSrcweir 						bAll = ((const SfxBoolItem*)pItem)->GetValue();
1762cdf0e10cSrcweir 				}
1763cdf0e10cSrcweir 
1764cdf0e10cSrcweir 				pTabViewShell->UpdateCharts( bAll );
1765cdf0e10cSrcweir 
1766cdf0e10cSrcweir 				if( ! rReq.IsAPI() )
1767cdf0e10cSrcweir 				{
1768cdf0e10cSrcweir 					rReq.AppendItem( SfxBoolItem( SID_UPDATECHART, bAll ) );
1769cdf0e10cSrcweir 					rReq.Done();
1770cdf0e10cSrcweir 				}
1771cdf0e10cSrcweir 			}
1772cdf0e10cSrcweir 			break;
1773cdf0e10cSrcweir 
1774cdf0e10cSrcweir 
1775cdf0e10cSrcweir 		case SID_TABOP:
1776cdf0e10cSrcweir 			if (pReqArgs)
1777cdf0e10cSrcweir 			{
1778cdf0e10cSrcweir 				const ScTabOpItem& rItem =
1779cdf0e10cSrcweir 						(const ScTabOpItem&)
1780cdf0e10cSrcweir 							pReqArgs->Get( SID_TABOP );
1781cdf0e10cSrcweir 
1782cdf0e10cSrcweir 				pTabViewShell->TabOp( rItem.GetData() );
1783cdf0e10cSrcweir 
1784cdf0e10cSrcweir 				rReq.Done( *pReqArgs );
1785cdf0e10cSrcweir 			}
1786cdf0e10cSrcweir 			break;
1787cdf0e10cSrcweir 
1788cdf0e10cSrcweir 		case SID_SOLVE:
1789cdf0e10cSrcweir 			if (pReqArgs)
1790cdf0e10cSrcweir 			{
1791cdf0e10cSrcweir 				const ScSolveItem& rItem =
1792cdf0e10cSrcweir 						(const ScSolveItem&)
1793cdf0e10cSrcweir 							pReqArgs->Get( SCITEM_SOLVEDATA );
1794cdf0e10cSrcweir 
1795cdf0e10cSrcweir 				pTabViewShell->Solve( rItem.GetData() );
1796cdf0e10cSrcweir 
1797cdf0e10cSrcweir 				rReq.Done( *pReqArgs );
1798cdf0e10cSrcweir 			}
1799cdf0e10cSrcweir 			break;
1800cdf0e10cSrcweir 
1801cdf0e10cSrcweir 		case FID_INSERT_NAME:
1802cdf0e10cSrcweir 			{
1803cdf0e10cSrcweir 				ScDocument*		pDoc = GetViewData()->GetDocument();
1804cdf0e10cSrcweir 				//CHINA001 ScNamePasteDlg* pDlg = new ScNamePasteDlg( 	pTabViewShell->GetDialogParent(), pDoc->GetRangeName() );
1805cdf0e10cSrcweir 				ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
1806cdf0e10cSrcweir 				DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
1807cdf0e10cSrcweir 
1808cdf0e10cSrcweir 				AbstractScNamePasteDlg* pDlg = pFact->CreateScNamePasteDlg( pTabViewShell->GetDialogParent(), pDoc->GetRangeName(), RID_SCDLG_NAMES_PASTE );
1809cdf0e10cSrcweir 				DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
1810cdf0e10cSrcweir 				switch( pDlg->Execute() )
1811cdf0e10cSrcweir 				{
1812cdf0e10cSrcweir 					case BTN_PASTE_LIST:
1813cdf0e10cSrcweir 						pTabViewShell->InsertNameList();
1814cdf0e10cSrcweir 						break;
1815cdf0e10cSrcweir 					case BTN_PASTE_NAME:
1816cdf0e10cSrcweir 						{
1817cdf0e10cSrcweir 							ScInputHandler* pHdl = pScMod->GetInputHdl( pTabViewShell );
1818cdf0e10cSrcweir 							if (pHdl)
1819cdf0e10cSrcweir 							{
1820cdf0e10cSrcweir 								//	das "=" per Key-Event, schaltet in den Eingabe-Modus
1821cdf0e10cSrcweir 								pScMod->InputKeyEvent( KeyEvent('=',KeyCode()) );
1822cdf0e10cSrcweir 
1823cdf0e10cSrcweir 								String aName = pDlg->GetSelectedName();
1824cdf0e10cSrcweir 								pHdl->InsertFunction( aName, sal_False );		// ohne "()"
1825cdf0e10cSrcweir 							}
1826cdf0e10cSrcweir 						}
1827cdf0e10cSrcweir 						break;
1828cdf0e10cSrcweir 				}
1829cdf0e10cSrcweir 				delete pDlg;
1830cdf0e10cSrcweir 			}
1831cdf0e10cSrcweir 			break;
1832cdf0e10cSrcweir 
1833cdf0e10cSrcweir 		case SID_RANGE_NOTETEXT:
1834cdf0e10cSrcweir 			if (pReqArgs)
1835cdf0e10cSrcweir 			{
1836cdf0e10cSrcweir                 const SfxStringItem& rTextItem = (const SfxStringItem&)pReqArgs->Get( SID_RANGE_NOTETEXT );
1837cdf0e10cSrcweir 
1838cdf0e10cSrcweir 				//	#43343# immer Cursorposition
1839cdf0e10cSrcweir                 ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
1840cdf0e10cSrcweir                 pTabViewShell->SetNoteText( aPos, rTextItem.GetValue() );
1841cdf0e10cSrcweir 				rReq.Done();
1842cdf0e10cSrcweir 			}
1843cdf0e10cSrcweir 			break;
1844cdf0e10cSrcweir 
1845cdf0e10cSrcweir 		case SID_INSERT_POSTIT:
1846cdf0e10cSrcweir             if ( pReqArgs )
1847cdf0e10cSrcweir             {
1848cdf0e10cSrcweir                 const SvxPostItAuthorItem&  rAuthorItem = (const SvxPostItAuthorItem&)pReqArgs->Get( SID_ATTR_POSTIT_AUTHOR );
1849cdf0e10cSrcweir                 const SvxPostItDateItem&    rDateItem   = (const SvxPostItDateItem&)  pReqArgs->Get( SID_ATTR_POSTIT_DATE );
1850cdf0e10cSrcweir                 const SvxPostItTextItem&    rTextItem   = (const SvxPostItTextItem&)  pReqArgs->Get( SID_ATTR_POSTIT_TEXT );
1851cdf0e10cSrcweir 
1852cdf0e10cSrcweir                 ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
1853cdf0e10cSrcweir                 pTabViewShell->ReplaceNote( aPos, rTextItem.GetValue(), &rAuthorItem.GetValue(), &rDateItem.GetValue() );
1854cdf0e10cSrcweir                 rReq.Done();
1855cdf0e10cSrcweir             }
1856cdf0e10cSrcweir             else
1857cdf0e10cSrcweir             {
1858cdf0e10cSrcweir                 pTabViewShell->EditNote();                  // Zeichenobjekt zum Editieren
1859cdf0e10cSrcweir             }
1860cdf0e10cSrcweir 			break;
1861cdf0e10cSrcweir 
1862cdf0e10cSrcweir 		case FID_NOTE_VISIBLE:
1863cdf0e10cSrcweir 			{
1864cdf0e10cSrcweir 				ScDocument* pDoc = GetViewData()->GetDocument();
1865cdf0e10cSrcweir 				ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
1866cdf0e10cSrcweir 				if( ScPostIt* pNote = pDoc->GetNote( aPos ) )
1867cdf0e10cSrcweir 				{
1868cdf0e10cSrcweir 					bool bShow;
1869cdf0e10cSrcweir 					const SfxPoolItem* pItem;
1870cdf0e10cSrcweir 					if ( pReqArgs && (pReqArgs->GetItemState( FID_NOTE_VISIBLE, sal_True, &pItem ) == SFX_ITEM_SET) )
1871cdf0e10cSrcweir 						bShow = ((const SfxBoolItem*) pItem)->GetValue();
1872cdf0e10cSrcweir 					else
1873cdf0e10cSrcweir 						bShow = !pNote->IsCaptionShown();
1874cdf0e10cSrcweir 
1875cdf0e10cSrcweir 					pTabViewShell->ShowNote( bShow );
1876cdf0e10cSrcweir 
1877cdf0e10cSrcweir 					if (!pReqArgs)
1878cdf0e10cSrcweir 						rReq.AppendItem( SfxBoolItem( FID_NOTE_VISIBLE, bShow ) );
1879cdf0e10cSrcweir 
1880cdf0e10cSrcweir 					rReq.Done();
1881cdf0e10cSrcweir 					rBindings.Invalidate( FID_NOTE_VISIBLE );
1882cdf0e10cSrcweir 				}
1883cdf0e10cSrcweir 				else
1884cdf0e10cSrcweir 					rReq.Ignore();
1885cdf0e10cSrcweir 			}
1886cdf0e10cSrcweir 			break;
1887cdf0e10cSrcweir 
1888cdf0e10cSrcweir         case SID_DELETE_NOTE:
1889cdf0e10cSrcweir             pTabViewShell->DeleteContents( IDF_NOTE );      // delete all notes in selection
1890cdf0e10cSrcweir             rReq.Done();
1891cdf0e10cSrcweir             break;
1892cdf0e10cSrcweir 
1893cdf0e10cSrcweir 		case SID_CHARMAP:
1894cdf0e10cSrcweir 			if( pReqArgs != NULL )
1895cdf0e10cSrcweir 			{
1896cdf0e10cSrcweir 				String aChars, aFontName;
1897cdf0e10cSrcweir 				const SfxItemSet *pArgs = rReq.GetArgs();
1898cdf0e10cSrcweir 				const SfxPoolItem* pItem = 0;
1899cdf0e10cSrcweir 				if ( pArgs )
1900cdf0e10cSrcweir 					pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), sal_False, &pItem);
1901cdf0e10cSrcweir 				if ( pItem )
1902cdf0e10cSrcweir 				{
1903cdf0e10cSrcweir 					const SfxStringItem* pStringItem = PTR_CAST( SfxStringItem, pItem );
1904cdf0e10cSrcweir 					if ( pStringItem )
1905cdf0e10cSrcweir 						aChars = pStringItem->GetValue();
1906cdf0e10cSrcweir 					const SfxPoolItem* pFtItem = NULL;
1907cdf0e10cSrcweir 					pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), sal_False, &pFtItem);
1908cdf0e10cSrcweir 					const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem );
1909cdf0e10cSrcweir 					if ( pFontItem )
1910cdf0e10cSrcweir 						aFontName = pFontItem->GetValue();
1911cdf0e10cSrcweir 				}
1912cdf0e10cSrcweir 
1913cdf0e10cSrcweir 				if ( aChars.Len() )
1914cdf0e10cSrcweir 				{
1915cdf0e10cSrcweir 					Font aFont;
1916cdf0e10cSrcweir 					pTabViewShell->GetSelectionPattern()->GetFont( aFont, SC_AUTOCOL_BLACK, NULL, NULL, NULL,
1917cdf0e10cSrcweir 																pTabViewShell->GetSelectionScriptType() );
1918cdf0e10cSrcweir 					if ( aFontName.Len() )
1919cdf0e10cSrcweir 						aFont = Font( aFontName, Size(1,1) );
1920cdf0e10cSrcweir 					pTabViewShell->InsertSpecialChar( aChars, aFont );
1921cdf0e10cSrcweir 					if( ! rReq.IsAPI() )
1922cdf0e10cSrcweir 						rReq.Done();
1923cdf0e10cSrcweir 				}
1924cdf0e10cSrcweir 			}
1925cdf0e10cSrcweir 			else
1926cdf0e10cSrcweir 			{
1927cdf0e10cSrcweir 				//CHINA001 SvxCharacterMap* pDlg = new SvxCharacterMap( 	pTabViewShell->GetDialogParent(), sal_False );
1928cdf0e10cSrcweir 				SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
1929cdf0e10cSrcweir 
1930cdf0e10cSrcweir 				// font color doesn't matter here
1931cdf0e10cSrcweir 				Font			 aCurFont;
1932cdf0e10cSrcweir 				pTabViewShell->GetSelectionPattern()->GetFont( aCurFont, SC_AUTOCOL_BLACK, NULL, NULL, NULL,
1933cdf0e10cSrcweir 																pTabViewShell->GetSelectionScriptType() );
1934cdf0e10cSrcweir 
1935cdf0e10cSrcweir 				SfxAllItemSet aSet( GetPool() );
1936cdf0e10cSrcweir 				aSet.Put( SfxBoolItem( FN_PARAM_1, sal_False ) );
1937cdf0e10cSrcweir 				aSet.Put( SvxFontItem( aCurFont.GetFamily(), aCurFont.GetName(), aCurFont.GetStyleName(), aCurFont.GetPitch(), aCurFont.GetCharSet(), GetPool().GetWhich(SID_ATTR_CHAR_FONT) ) );
1938cdf0e10cSrcweir 
1939cdf0e10cSrcweir 				SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( pTabViewShell->GetDialogParent(), aSet,
1940cdf0e10cSrcweir 					pTabViewShell->GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP );
1941cdf0e10cSrcweir 
1942cdf0e10cSrcweir 				if ( pDlg->Execute() == RET_OK )
1943cdf0e10cSrcweir 				{
1944cdf0e10cSrcweir 					SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pItem, SfxStringItem, SID_CHARMAP, sal_False );
1945cdf0e10cSrcweir 					SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, sal_False );
1946cdf0e10cSrcweir 
1947cdf0e10cSrcweir 					if ( pItem && pFontItem )
1948cdf0e10cSrcweir 					{
1949cdf0e10cSrcweir 						Font aNewFont( pFontItem->GetFamilyName(), pFontItem->GetStyleName(), Size(1,1) );
1950cdf0e10cSrcweir 						aNewFont.SetCharSet( pFontItem->GetCharSet() );
1951cdf0e10cSrcweir 						aNewFont.SetPitch( pFontItem->GetPitch() );
1952cdf0e10cSrcweir 						pTabViewShell->InsertSpecialChar( pItem->GetValue(), aNewFont );
1953cdf0e10cSrcweir 						rReq.AppendItem( *pFontItem );
1954cdf0e10cSrcweir 						rReq.AppendItem( *pItem );
1955cdf0e10cSrcweir 						rReq.Done();
1956cdf0e10cSrcweir 					}
1957cdf0e10cSrcweir 				}
1958cdf0e10cSrcweir 				delete pDlg;
1959cdf0e10cSrcweir 			}
1960cdf0e10cSrcweir 			break;
1961cdf0e10cSrcweir 
1962cdf0e10cSrcweir 		case SID_SELECT_SCENARIO:
1963cdf0e10cSrcweir 			{
1964cdf0e10cSrcweir 				// Testing
1965cdf0e10cSrcweir 
1966cdf0e10cSrcweir 				if ( pReqArgs )
1967cdf0e10cSrcweir 				{
1968cdf0e10cSrcweir 					const SfxStringItem* pItem =
1969cdf0e10cSrcweir 						(const SfxStringItem*)&pReqArgs->Get( SID_SELECT_SCENARIO );
1970cdf0e10cSrcweir 
1971cdf0e10cSrcweir 					if( pItem )
1972cdf0e10cSrcweir 					{
1973cdf0e10cSrcweir 						pTabViewShell->UseScenario( pItem->GetValue() );
1974cdf0e10cSrcweir 						//!	wofuer soll der Return-Wert gut sein?!?!
1975cdf0e10cSrcweir 						rReq.SetReturnValue( SfxStringItem( SID_SELECT_SCENARIO, pItem->GetValue() ) );
1976cdf0e10cSrcweir 						rReq.Done();
1977cdf0e10cSrcweir 					}
1978cdf0e10cSrcweir 					else
1979cdf0e10cSrcweir 					{
1980cdf0e10cSrcweir 						DBG_ERROR("NULL");
1981cdf0e10cSrcweir 					}
1982cdf0e10cSrcweir 				}
1983cdf0e10cSrcweir 			}
1984cdf0e10cSrcweir 			break;
1985cdf0e10cSrcweir 
1986cdf0e10cSrcweir 		case SID_HYPERLINK_SETLINK:
1987cdf0e10cSrcweir 			if( pReqArgs )
1988cdf0e10cSrcweir 			{
1989cdf0e10cSrcweir 				const SfxPoolItem* pItem;
1990cdf0e10cSrcweir 				if( IS_AVAILABLE( SID_HYPERLINK_SETLINK, &pItem ) )
1991cdf0e10cSrcweir 				{
1992cdf0e10cSrcweir 					const SvxHyperlinkItem* pHyper = (const SvxHyperlinkItem*) pItem;
1993cdf0e10cSrcweir 					const String& rName	  = pHyper->GetName();
1994cdf0e10cSrcweir 					const String& rURL	  = pHyper->GetURL();
1995cdf0e10cSrcweir 					const String& rTarget = pHyper->GetTargetFrame();
1996cdf0e10cSrcweir 					sal_uInt16 nType = (sal_uInt16) pHyper->GetInsertMode();
1997cdf0e10cSrcweir 
1998cdf0e10cSrcweir 					pTabViewShell->InsertURL( rName, rURL, rTarget, nType );
1999cdf0e10cSrcweir                     rReq.Done();
2000cdf0e10cSrcweir 				}
2001cdf0e10cSrcweir                 else
2002cdf0e10cSrcweir                     rReq.Ignore();
2003cdf0e10cSrcweir 			}
2004cdf0e10cSrcweir 			break;
2005cdf0e10cSrcweir 
2006cdf0e10cSrcweir 		case FID_CONDITIONAL_FORMAT:
2007cdf0e10cSrcweir 			if( pReqArgs )
2008cdf0e10cSrcweir 			{
2009cdf0e10cSrcweir 				const SfxPoolItem* pItem;
2010cdf0e10cSrcweir 				if( IS_AVAILABLE( FID_CONDITIONAL_FORMAT, &pItem ) )
2011cdf0e10cSrcweir 				{
2012cdf0e10cSrcweir 					// Wenn RefInput auf andere Tabelle als Datentabelle umgeschaltet
2013cdf0e10cSrcweir 					// hat wieder zurueckschalten:
2014cdf0e10cSrcweir 					if ( GetViewData()->GetTabNo() != GetViewData()->GetRefTabNo() )
2015cdf0e10cSrcweir 					{
2016cdf0e10cSrcweir 						pTabViewShell->SetTabNo( GetViewData()->GetRefTabNo() );
2017cdf0e10cSrcweir 						pTabViewShell->PaintExtras();
2018cdf0e10cSrcweir 					}
2019cdf0e10cSrcweir 
2020cdf0e10cSrcweir 					const ScCondFrmtItem* pCndFmtItem = (const ScCondFrmtItem*) pItem;
2021cdf0e10cSrcweir 					pTabViewShell->SetConditionalFormat( pCndFmtItem->GetData() );
2022cdf0e10cSrcweir 					rReq.Done();
2023cdf0e10cSrcweir 				}
2024cdf0e10cSrcweir 			}
2025cdf0e10cSrcweir 			break;
2026cdf0e10cSrcweir 
2027cdf0e10cSrcweir 		case SID_EXTERNAL_SOURCE:
2028cdf0e10cSrcweir 			{
2029cdf0e10cSrcweir                 String aFile;
2030cdf0e10cSrcweir                 String aFilter;
2031cdf0e10cSrcweir                 String aOptions;
2032cdf0e10cSrcweir                 String aSource;
2033cdf0e10cSrcweir                 sal_uLong nRefresh=0;
2034cdf0e10cSrcweir 
2035cdf0e10cSrcweir                 SFX_REQUEST_ARG( rReq, pFile, SfxStringItem, SID_FILE_NAME, sal_False );
2036cdf0e10cSrcweir                 SFX_REQUEST_ARG( rReq, pSource, SfxStringItem, FN_PARAM_1, sal_False );
2037cdf0e10cSrcweir                 if ( pFile && pSource )
2038cdf0e10cSrcweir                 {
2039cdf0e10cSrcweir                     aFile = pFile->GetValue();
2040cdf0e10cSrcweir                     aSource = pSource->GetValue();
2041cdf0e10cSrcweir                     SFX_REQUEST_ARG( rReq, pFilter, SfxStringItem, SID_FILTER_NAME, sal_False );
2042cdf0e10cSrcweir                     if ( pFilter )
2043cdf0e10cSrcweir                         aFilter = pFilter->GetValue();
2044cdf0e10cSrcweir                     SFX_REQUEST_ARG( rReq, pOptions, SfxStringItem, SID_FILE_FILTEROPTIONS, sal_False );
2045cdf0e10cSrcweir                     if ( pOptions )
2046cdf0e10cSrcweir                         aOptions = pOptions->GetValue();
2047cdf0e10cSrcweir                     SFX_REQUEST_ARG( rReq, pRefresh, SfxUInt32Item, FN_PARAM_2, sal_False );
2048cdf0e10cSrcweir                     if ( pRefresh )
2049cdf0e10cSrcweir                         nRefresh = pRefresh->GetValue();
2050cdf0e10cSrcweir                 }
2051cdf0e10cSrcweir                 else
2052cdf0e10cSrcweir                 {
2053cdf0e10cSrcweir                     //CHINA001 ScLinkedAreaDlg* pDlg = new ScLinkedAreaDlg( pTabViewShell->GetDialogParent() );
2054cdf0e10cSrcweir 					ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
2055cdf0e10cSrcweir 					DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
2056cdf0e10cSrcweir 
2057cdf0e10cSrcweir                     delete pImpl->m_pLinkedDlg;
2058cdf0e10cSrcweir                     pImpl->m_pLinkedDlg =
2059cdf0e10cSrcweir                         pFact->CreateScLinkedAreaDlg( pTabViewShell->GetDialogParent(),
2060cdf0e10cSrcweir                                                       RID_SCDLG_LINKAREA);
2061cdf0e10cSrcweir                     DBG_ASSERT(pImpl->m_pLinkedDlg, "Dialog create fail!");//CHINA001
2062cdf0e10cSrcweir                     delete pImpl->m_pRequest;
2063cdf0e10cSrcweir                     pImpl->m_pRequest = new SfxRequest( rReq );
2064cdf0e10cSrcweir                     pImpl->m_pLinkedDlg->StartExecuteModal( LINK( this, ScCellShell, DialogClosed ) );
2065cdf0e10cSrcweir                     return;
2066cdf0e10cSrcweir                 }
2067cdf0e10cSrcweir 
2068cdf0e10cSrcweir                 ExecuteExternalSource( aFile, aFilter, aOptions, aSource, nRefresh, rReq );
2069cdf0e10cSrcweir 			}
2070cdf0e10cSrcweir 			break;
2071cdf0e10cSrcweir 
2072cdf0e10cSrcweir 		//
2073cdf0e10cSrcweir 		//
2074cdf0e10cSrcweir 		//
2075cdf0e10cSrcweir 
2076cdf0e10cSrcweir 		default:
2077cdf0e10cSrcweir 			DBG_ERROR("falscher Slot bei ExecuteEdit");
2078cdf0e10cSrcweir 			break;
2079cdf0e10cSrcweir 	}
2080cdf0e10cSrcweir }
2081cdf0e10cSrcweir 
ExecuteTrans(SfxRequest & rReq)2082cdf0e10cSrcweir void ScCellShell::ExecuteTrans( SfxRequest& rReq )
2083cdf0e10cSrcweir {
2084cdf0e10cSrcweir 	sal_Int32 nType = ScViewUtil::GetTransliterationType( rReq.GetSlot() );
2085cdf0e10cSrcweir 	if ( nType )
2086cdf0e10cSrcweir 	{
2087cdf0e10cSrcweir 		GetViewData()->GetView()->TransliterateText( nType );
2088cdf0e10cSrcweir 		rReq.Done();
2089cdf0e10cSrcweir 	}
2090cdf0e10cSrcweir }
2091cdf0e10cSrcweir 
ExecuteExternalSource(const String & _rFile,const String & _rFilter,const String & _rOptions,const String & _rSource,sal_uLong _nRefresh,SfxRequest & _rRequest)2092cdf0e10cSrcweir void ScCellShell::ExecuteExternalSource(
2093cdf0e10cSrcweir     const String& _rFile, const String& _rFilter, const String& _rOptions,
2094cdf0e10cSrcweir     const String& _rSource, sal_uLong _nRefresh, SfxRequest& _rRequest )
2095cdf0e10cSrcweir {
2096cdf0e10cSrcweir     if ( _rFile.Len() && _rSource.Len() )         // filter may be empty
2097cdf0e10cSrcweir     {
2098cdf0e10cSrcweir         ScRange aLinkRange;
2099cdf0e10cSrcweir         sal_Bool bMove = sal_False;
2100cdf0e10cSrcweir 
2101cdf0e10cSrcweir         ScViewData* pData = GetViewData();
2102cdf0e10cSrcweir         ScMarkData& rMark = pData->GetMarkData();
2103cdf0e10cSrcweir         rMark.MarkToSimple();
2104cdf0e10cSrcweir         if ( rMark.IsMarked() )
2105cdf0e10cSrcweir         {
2106cdf0e10cSrcweir             rMark.GetMarkArea( aLinkRange );
2107cdf0e10cSrcweir             bMove = sal_True;                       // insert/delete cells to fit range
2108cdf0e10cSrcweir         }
2109cdf0e10cSrcweir         else
2110cdf0e10cSrcweir             aLinkRange = ScRange( pData->GetCurX(), pData->GetCurY(), pData->GetTabNo() );
2111cdf0e10cSrcweir 
2112cdf0e10cSrcweir         ScDocFunc aFunc(*pData->GetDocShell());
2113cdf0e10cSrcweir         aFunc.InsertAreaLink( _rFile, _rFilter, _rOptions, _rSource,
2114cdf0e10cSrcweir                                 aLinkRange, _nRefresh, bMove, sal_False );
2115cdf0e10cSrcweir         _rRequest.Done();
2116cdf0e10cSrcweir     }
2117cdf0e10cSrcweir     else
2118cdf0e10cSrcweir         _rRequest.Ignore();
2119cdf0e10cSrcweir }
2120cdf0e10cSrcweir 
IMPL_LINK(ScCellShell,DialogClosed,AbstractScLinkedAreaDlg *,EMPTYARG)2121cdf0e10cSrcweir IMPL_LINK( ScCellShell, DialogClosed, AbstractScLinkedAreaDlg*, EMPTYARG )
2122cdf0e10cSrcweir {
2123cdf0e10cSrcweir     DBG_ASSERT( pImpl->m_pLinkedDlg, "ScCellShell::DialogClosed(): invalid request" );
2124cdf0e10cSrcweir     DBG_ASSERT( pImpl->m_pRequest, "ScCellShell::DialogClosed(): invalid request" );
2125cdf0e10cSrcweir     String sFile, sFilter, sOptions, sSource;
2126cdf0e10cSrcweir     sal_uLong nRefresh = 0;
2127cdf0e10cSrcweir 
2128cdf0e10cSrcweir     if ( pImpl->m_pLinkedDlg->GetResult() == RET_OK )
2129cdf0e10cSrcweir     {
2130cdf0e10cSrcweir         sFile = pImpl->m_pLinkedDlg->GetURL();
2131cdf0e10cSrcweir         sFilter = pImpl->m_pLinkedDlg->GetFilter();
2132cdf0e10cSrcweir         sOptions = pImpl->m_pLinkedDlg->GetOptions();
2133cdf0e10cSrcweir         sSource = pImpl->m_pLinkedDlg->GetSource();
2134cdf0e10cSrcweir         nRefresh = pImpl->m_pLinkedDlg->GetRefresh();
2135cdf0e10cSrcweir         if ( sFile.Len() )
2136cdf0e10cSrcweir             pImpl->m_pRequest->AppendItem( SfxStringItem( SID_FILE_NAME, sFile ) );
2137cdf0e10cSrcweir         if ( sFilter.Len() )
2138cdf0e10cSrcweir             pImpl->m_pRequest->AppendItem( SfxStringItem( SID_FILTER_NAME, sFilter ) );
2139cdf0e10cSrcweir         if ( sOptions.Len() )
2140cdf0e10cSrcweir             pImpl->m_pRequest->AppendItem( SfxStringItem( SID_FILE_FILTEROPTIONS, sOptions ) );
2141cdf0e10cSrcweir         if ( sSource.Len() )
2142cdf0e10cSrcweir             pImpl->m_pRequest->AppendItem( SfxStringItem( FN_PARAM_1, sSource ) );
2143cdf0e10cSrcweir         if ( nRefresh )
2144cdf0e10cSrcweir             pImpl->m_pRequest->AppendItem( SfxUInt32Item( FN_PARAM_2, nRefresh ) );
2145cdf0e10cSrcweir     }
2146cdf0e10cSrcweir 
2147cdf0e10cSrcweir     ExecuteExternalSource( sFile, sFilter, sOptions, sSource, nRefresh, *(pImpl->m_pRequest) );
2148cdf0e10cSrcweir     return 0;
2149cdf0e10cSrcweir }
2150cdf0e10cSrcweir 
PasteFromClipboard(ScViewData * pViewData,ScTabViewShell * pTabViewShell,bool bShowDialog)2151cdf0e10cSrcweir void ScCellShell::PasteFromClipboard( ScViewData* pViewData, ScTabViewShell* pTabViewShell, bool bShowDialog )
2152cdf0e10cSrcweir {
2153cdf0e10cSrcweir     Window* pWin = pViewData->GetActiveWin();
2154cdf0e10cSrcweir     ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
2155cdf0e10cSrcweir     ScDocument* pThisDoc = pViewData->GetDocument();
2156cdf0e10cSrcweir     ScDPObject* pDPObj = pThisDoc->GetDPAtCursor( pViewData->GetCurX(),
2157cdf0e10cSrcweir                          pViewData->GetCurY(), pViewData->GetTabNo() );
2158cdf0e10cSrcweir     if ( pOwnClip && pDPObj )
2159cdf0e10cSrcweir     {
2160cdf0e10cSrcweir         // paste from Calc into DataPilot table: sort (similar to drag & drop)
2161cdf0e10cSrcweir 
2162cdf0e10cSrcweir         ScDocument* pClipDoc = pOwnClip->GetDocument();
2163cdf0e10cSrcweir         SCTAB nSourceTab = pOwnClip->GetVisibleTab();
2164cdf0e10cSrcweir 
2165cdf0e10cSrcweir         SCCOL nClipStartX;
2166cdf0e10cSrcweir         SCROW nClipStartY;
2167cdf0e10cSrcweir         SCCOL nClipEndX;
2168cdf0e10cSrcweir         SCROW nClipEndY;
2169cdf0e10cSrcweir         pClipDoc->GetClipStart( nClipStartX, nClipStartY );
2170cdf0e10cSrcweir         pClipDoc->GetClipArea( nClipEndX, nClipEndY, sal_True );
2171cdf0e10cSrcweir         nClipEndX = nClipEndX + nClipStartX;
2172cdf0e10cSrcweir         nClipEndY = nClipEndY + nClipStartY;   // GetClipArea returns the difference
2173cdf0e10cSrcweir 
2174cdf0e10cSrcweir         ScRange aSource( nClipStartX, nClipStartY, nSourceTab, nClipEndX, nClipEndY, nSourceTab );
2175cdf0e10cSrcweir         sal_Bool bDone = pTabViewShell->DataPilotMove( aSource, pViewData->GetCurPos() );
2176cdf0e10cSrcweir         if ( !bDone )
2177cdf0e10cSrcweir             pTabViewShell->ErrorMessage( STR_ERR_DATAPILOT_INPUT );
2178cdf0e10cSrcweir     }
2179cdf0e10cSrcweir     else
2180cdf0e10cSrcweir     {
2181cdf0e10cSrcweir         // normal paste
2182cdf0e10cSrcweir         WaitObject aWait( pViewData->GetDialogParent() );
2183cdf0e10cSrcweir         if (!pOwnClip)
2184cdf0e10cSrcweir             pTabViewShell->PasteFromSystem();
2185cdf0e10cSrcweir         else
2186cdf0e10cSrcweir         {
2187cdf0e10cSrcweir             ScDocument* pClipDoc = pOwnClip->GetDocument();
2188cdf0e10cSrcweir             sal_uInt16 nFlags = IDF_ALL;
2189cdf0e10cSrcweir             if (pClipDoc->GetClipParam().isMultiRange())
2190cdf0e10cSrcweir                 // For multi-range paste, we paste values by default.
2191cdf0e10cSrcweir                 nFlags &= ~IDF_FORMULA;
2192cdf0e10cSrcweir 
2193cdf0e10cSrcweir             pTabViewShell->PasteFromClip( nFlags, pClipDoc,
2194cdf0e10cSrcweir                     PASTE_NOFUNC, sal_False, sal_False, sal_False, INS_NONE, IDF_NONE,
2195cdf0e10cSrcweir                     bShowDialog );		// allow warning dialog
2196cdf0e10cSrcweir         }
2197cdf0e10cSrcweir     }
2198cdf0e10cSrcweir     pTabViewShell->CellContentChanged();		// => PasteFromSystem() ???
2199cdf0e10cSrcweir }
2200