xref: /aoo41x/main/sc/source/ui/view/tabvwsh3.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sc.hxx"
30 
31 
32 
33 // INCLUDE ---------------------------------------------------------------
34 
35 #include "scitems.hxx"
36 #include <editeng/eeitem.hxx>
37 
38 #include <sfx2/app.hxx>
39 //CHINA001 #include <svx/zoom.hxx>
40 #include <sfx2/bindings.hxx>
41 #include <sfx2/dispatch.hxx>
42 #include <sfx2/passwd.hxx>
43 #include <sfx2/request.hxx>
44 #include <svl/ptitem.hxx>
45 #include <svl/stritem.hxx>
46 #include <tools/urlobj.hxx>
47 #include <sfx2/objface.hxx>
48 #include <vcl/msgbox.hxx>
49 #include <vcl/vclenum.hxx>
50 
51 #include "globstr.hrc"
52 #include "scmod.hxx"
53 #include "appoptio.hxx"
54 #include "tabvwsh.hxx"
55 #include "document.hxx"
56 #include "sc.hrc"
57 #include "inputwin.hxx"
58 #include "scresid.hxx"
59 #include "printfun.hxx"
60 #include "docsh.hxx"
61 #include "rangelst.hxx"
62 #include "prevwsh.hxx"
63 #include "rangeutl.hxx"
64 #include "reffact.hxx"
65 #include "uiitems.hxx"
66 #include "cell.hxx"
67 #include "inputhdl.hxx"
68 //CHINA001 #include "scendlg.hxx"
69 //CHINA001 #include "mtrindlg.hxx"
70 #include "autoform.hxx"
71 #include "autofmt.hxx"
72 #include "dwfunctr.hxx"
73 #include "shtabdlg.hxx"
74 #include "tabprotection.hxx"
75 #include "protectiondlg.hxx"
76 
77 #include <svl/ilstitem.hxx>
78 #define _SVSTDARR_ULONGS
79 #include <svl/svstdarr.hxx>
80 
81 #include <svx/zoomslideritem.hxx>
82 #include <svx/svxdlg.hxx> //CHINA001
83 #include <svx/dialogs.hrc> //CHINA001
84 #include "scabstdlg.hxx" //CHINA001
85 
86 #include <memory>
87 
88 using ::std::auto_ptr;
89 
90 #define IS_EDITMODE() GetViewData()->HasEditView( GetViewData()->GetActivePart() )
91 #define IS_AVAILABLE(WhichId,ppItem) \
92     (pReqArgs->GetItemState((WhichId), sal_True, ppItem ) == SFX_ITEM_SET)
93 #define GET_STRING(nid) ((const SfxStringItem&)pReqArgs->Get(nid)).GetValue()
94 #define GET_UINT16(nid) ((const SfxUInt16Item&)pReqArgs->Get(nid)).GetValue()
95 #define GET_BOOL(nid)   ((const SfxBoolItem&)pReqArgs->Get(nid)).GetValue()
96 #define RECALC_PAGE(pDocSh) ScPrintFunc( pDocSh, GetPrinter(), nCurTab ).UpdatePages()
97 
98 //------------------------------------------------------------------
99 
100 /** Try to parse the given range using Calc-style syntax first, then
101     Excel-style if that fails. */
102 sal_uInt16 lcl_ParseRange(ScRange& rScRange, const String& aAddress, ScDocument* pDoc, sal_uInt16 /* nSlot */)
103 {
104     sal_uInt16 nResult = rScRange.Parse(aAddress, pDoc);
105     if ( (nResult & SCA_VALID) )
106         return nResult;
107 
108     return rScRange.Parse(aAddress, pDoc, ScAddress::Details(formula::FormulaGrammar::CONV_XL_A1, 0, 0));
109 }
110 
111 /** Try to parse the given address using Calc-style syntax first, then
112     Excel-style if that fails. */
113 sal_uInt16 lcl_ParseAddress(ScAddress& rScAddress, const String& aAddress, ScDocument* pDoc, sal_uInt16 /* nSlot */)
114 {
115     sal_uInt16 nResult = rScAddress.Parse(aAddress, pDoc);
116     if ( (nResult & SCA_VALID) )
117         return nResult;
118 
119     return rScAddress.Parse(aAddress, pDoc, ScAddress::Details(formula::FormulaGrammar::CONV_XL_A1, 0, 0));
120 }
121 
122 void ScTabViewShell::Execute( SfxRequest& rReq )
123 {
124 	SfxViewFrame*		pThisFrame  = GetViewFrame();
125 	SfxBindings&		rBindings	= pThisFrame->GetBindings();
126 	ScModule*			pScMod		= SC_MOD();
127 	const SfxItemSet*	pReqArgs	= rReq.GetArgs();
128 	sal_uInt16				nSlot		= rReq.GetSlot();
129 
130 	if (nSlot != SID_CURRENTCELL)		// der kommt beim MouseButtonUp
131 		HideListBox();					// Autofilter-DropDown-Listbox
132 
133 	switch ( nSlot )
134 	{
135 		case FID_INSERT_FILE:
136 			{
137 				const SfxPoolItem* pItem;
138 				if ( pReqArgs &&
139 					 pReqArgs->GetItemState(FID_INSERT_FILE,sal_True,&pItem) == SFX_ITEM_SET )
140 				{
141 					String aFileName = ((const SfxStringItem*)pItem)->GetValue();
142 
143 						// Einfuege-Position
144 
145 					Point aInsertPos;
146 					if ( pReqArgs->GetItemState(FN_PARAM_1,sal_True,&pItem) == SFX_ITEM_SET )
147 						aInsertPos = ((const SfxPointItem*)pItem)->GetValue();
148 					else
149 						aInsertPos = GetInsertPos();
150 
151 						//	als Link?
152 
153 					sal_Bool bAsLink = sal_False;
154 					if ( pReqArgs->GetItemState(FN_PARAM_2,sal_True,&pItem) == SFX_ITEM_SET )
155 						bAsLink = ((const SfxBoolItem*)pItem)->GetValue();
156 
157 						// ausfuehren
158 
159 					PasteFile( aInsertPos, aFileName, bAsLink );
160 				}
161 			}
162 			break;
163 
164 		case SID_OPENDLG_EDIT_PRINTAREA:
165 			{
166 				sal_uInt16			nId  = ScPrintAreasDlgWrapper::GetChildWindowId();
167 				SfxChildWindow* pWnd = pThisFrame->GetChildWindow( nId );
168 
169 				pScMod->SetRefDialog( nId, pWnd ? sal_False : sal_True );
170 			}
171 			break;
172 
173 		case SID_CHANGE_PRINTAREA:
174 			{
175 				if ( pReqArgs )			// OK aus Dialog
176 				{
177                     String aPrintStr;
178                     String aRowStr;
179                     String aColStr;
180                     sal_Bool bEntire = sal_False;
181                     const SfxPoolItem* pItem;
182                     if ( pReqArgs->GetItemState( SID_CHANGE_PRINTAREA, sal_True, &pItem ) == SFX_ITEM_SET )
183                         aPrintStr = static_cast<const SfxStringItem*>(pItem)->GetValue();
184                     if ( pReqArgs->GetItemState( FN_PARAM_2, sal_True, &pItem ) == SFX_ITEM_SET )
185                         aRowStr = static_cast<const SfxStringItem*>(pItem)->GetValue();
186                     if ( pReqArgs->GetItemState( FN_PARAM_3, sal_True, &pItem ) == SFX_ITEM_SET )
187                         aColStr = static_cast<const SfxStringItem*>(pItem)->GetValue();
188                     if ( pReqArgs->GetItemState( FN_PARAM_4, sal_True, &pItem ) == SFX_ITEM_SET )
189                         bEntire = static_cast<const SfxBoolItem*>(pItem)->GetValue();
190 
191                     SetPrintRanges( bEntire, &aPrintStr, &aColStr, &aRowStr, sal_False );
192 
193 					rReq.Done();
194 				}
195 			}
196 			break;
197 
198 		case SID_ADD_PRINTAREA:
199 		case SID_DEFINE_PRINTAREA:		// Menue oder Basic
200 			{
201 				sal_Bool bAdd = ( nSlot == SID_ADD_PRINTAREA );
202 				if ( pReqArgs )
203 				{
204                     String aPrintStr;
205                     const SfxPoolItem* pItem;
206                     if ( pReqArgs->GetItemState( SID_DEFINE_PRINTAREA, sal_True, &pItem ) == SFX_ITEM_SET )
207                         aPrintStr = static_cast<const SfxStringItem*>(pItem)->GetValue();
208                     SetPrintRanges( sal_False, &aPrintStr, NULL, NULL, bAdd );
209 				}
210 				else
211 				{
212                     SetPrintRanges( sal_False, NULL, NULL, NULL, bAdd );      // aus Selektion
213 					rReq.Done();
214 				}
215 			}
216 			break;
217 
218 		case SID_DELETE_PRINTAREA:
219 			{
220 				String aEmpty;
221                 SetPrintRanges( sal_False, &aEmpty, NULL, NULL, sal_False );        // Druckbereich loeschen
222 				rReq.Done();
223 			}
224 			break;
225 
226 		case FID_DEL_MANUALBREAKS:
227 			RemoveManualBreaks();
228 			rReq.Done();
229 			break;
230 
231 		case FID_ADJUST_PRINTZOOM:
232 			AdjustPrintZoom();
233 			rReq.Done();
234 			break;
235 
236 		case FID_RESET_PRINTZOOM:
237 			SetPrintZoom( 100, 0 );		// 100%, nicht auf Seiten
238 			rReq.Done();
239 			break;
240 
241 		case SID_FORMATPAGE:
242 		case SID_STATUS_PAGESTYLE:
243 		case SID_HFEDIT:
244 			GetViewData()->GetDocShell()->
245 				ExecutePageStyle( *this, rReq, GetViewData()->GetTabNo() );
246 			break;
247 
248 		case SID_JUMPTOMARK:
249 		case SID_CURRENTCELL:
250 			if ( pReqArgs )
251 			{
252 				String aAddress;
253 				const SfxPoolItem* pItem;
254 				if ( pReqArgs->GetItemState( nSlot, sal_True, &pItem ) == SFX_ITEM_SET )
255 					aAddress = ((const SfxStringItem*)pItem)->GetValue();
256 				else if ( nSlot == SID_JUMPTOMARK && pReqArgs->GetItemState(
257 											SID_JUMPTOMARK, sal_True, &pItem ) == SFX_ITEM_SET )
258 					aAddress = ((const SfxStringItem*)pItem)->GetValue();
259 
260 				//	#i14927# SID_CURRENTCELL with a single cell must unmark if FN_PARAM_1
261 				//	isn't set (for recorded macros, because IsAPI is no longer available).
262 				//	ScGridWindow::MouseButtonUp no longer executes the slot for a single
263 				//	cell if there is a multi selection.
264 				sal_Bool bUnmark = ( nSlot == SID_CURRENTCELL );
265 				if ( pReqArgs->GetItemState( FN_PARAM_1, sal_True, &pItem ) == SFX_ITEM_SET )
266 					bUnmark = ((const SfxBoolItem*)pItem)->GetValue();
267 
268 				if ( nSlot == SID_JUMPTOMARK )
269 				{
270 					//	#106586# URL has to be decoded for escaped characters (%20)
271 					aAddress = INetURLObject::decode( aAddress, INET_HEX_ESCAPE,
272 							   				INetURLObject::DECODE_WITH_CHARSET,
273 											RTL_TEXTENCODING_UTF8 );
274 				}
275 
276 				sal_Bool bFound = sal_False;
277 				ScViewData* pViewData = GetViewData();
278 				ScDocument* pDoc	  = pViewData->GetDocument();
279 				ScMarkData& rMark	  = pViewData->GetMarkData();
280 				ScRange		aScRange;
281 				ScAddress	aScAddress;
282                 sal_uInt16      nResult = lcl_ParseRange(aScRange, aAddress, pDoc, nSlot);
283 				SCTAB		nTab = pViewData->GetTabNo();
284 				sal_Bool		bMark = sal_True;
285 
286                 // Is this a range ?
287 				if( nResult & SCA_VALID )
288 				{
289 					if ( nResult & SCA_TAB_3D )
290 					{
291 						if( aScRange.aStart.Tab() != nTab )
292 							SetTabNo( nTab = aScRange.aStart.Tab() );
293 					}
294 					else
295 					{
296 						aScRange.aStart.SetTab( nTab );
297 						aScRange.aEnd.SetTab( nTab );
298 					}
299 				}
300                 // Is this a cell ?
301                 else if ( (nResult = lcl_ParseAddress(aScAddress, aAddress, pDoc, nSlot)) & SCA_VALID )
302 				{
303 					if ( nResult & SCA_TAB_3D )
304 					{
305 						if( aScAddress.Tab() != nTab )
306 							SetTabNo( nTab = aScAddress.Tab() );
307 					}
308 					else
309 						aScAddress.SetTab( nTab );
310 
311 					aScRange = ScRange( aScAddress, aScAddress );
312 					// Zellen sollen nicht markiert werden
313 					bMark = sal_False;
314 				}
315 				// Ist es benahmster Bereich (erst Namen dann DBBereiche) ?
316 				else
317 				{
318 					ScRangeUtil		aRangeUtil;
319                     formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
320 					if(	aRangeUtil.MakeRangeFromName( aAddress, pDoc, nTab, aScRange, RUTL_NAMES, eConv ) ||
321 						aRangeUtil.MakeRangeFromName( aAddress, pDoc, nTab, aScRange, RUTL_DBASE, eConv ) )
322 					{
323 						nResult |= SCA_VALID;
324 						if( aScRange.aStart.Tab() != nTab )
325 							SetTabNo( nTab = aScRange.aStart.Tab() );
326 					}
327 				}
328 
329 				if ( !(nResult & SCA_VALID) &&
330 						ByteString(aAddress, RTL_TEXTENCODING_ASCII_US).IsNumericAscii() )
331 				{
332 					sal_Int32 nNumeric = aAddress.ToInt32();
333 					if ( nNumeric > 0 && nNumeric <= MAXROW+1 )
334 					{
335 						//	1-basierte Zeilennummer
336 
337 						aScAddress.SetRow( (SCROW)(nNumeric - 1) );
338 						aScAddress.SetCol( pViewData->GetCurX() );
339 						aScAddress.SetTab( nTab );
340 						aScRange = ScRange( aScAddress, aScAddress );
341 						bMark	 = sal_False;
342 						nResult  = SCA_VALID;
343 					}
344 				}
345 
346 				if ( !ValidRow(aScRange.aStart.Row()) || !ValidRow(aScRange.aEnd.Row()) )
347 					nResult = 0;
348 
349 				// wir haben was gefunden
350 				if( nResult & SCA_VALID )
351 				{
352 					bFound = sal_True;
353 					SCCOL nCol = aScRange.aStart.Col();
354 					SCROW nRow = aScRange.aStart.Row();
355 					sal_Bool bNothing = ( pViewData->GetCurX()==nCol && pViewData->GetCurY()==nRow );
356 
357 					// markieren
358 					if( bMark )
359 					{
360 						if (rMark.IsMarked())			// ist derselbe Bereich schon markiert?
361 						{
362 							ScRange aOldMark;
363 							rMark.GetMarkArea( aOldMark );
364 							aOldMark.Justify();
365 							ScRange aCurrent = aScRange;
366 							aCurrent.Justify();
367 							bNothing = ( aCurrent == aOldMark );
368 						}
369 						else
370 							bNothing = sal_False;
371 
372 						if (!bNothing)
373 							MarkRange( aScRange, sal_False );	// Cursor kommt hinterher...
374 					}
375 					else
376 					{
377 						//	remove old selection, unless bUnmark argument is sal_False (from navigator)
378 						if( bUnmark )
379 						{
380 							MoveCursorAbs( nCol, nRow,
381 								SC_FOLLOW_NONE, sal_False, sal_False );
382 						}
383 					}
384 
385 					// und Cursor setzen
386 
387 					// zusammengefasste Zellen beruecksichtigen:
388 					while ( pDoc->IsHorOverlapped( nCol, nRow, nTab ) )		//! ViewData !!!
389 						--nCol;
390 					while ( pDoc->IsVerOverlapped( nCol, nRow, nTab ) )
391 						--nRow;
392 
393 					//	Navigator-Aufrufe sind nicht API!!!
394 
395 					if( bNothing )
396 					{
397 						if (rReq.IsAPI())
398 							rReq.Ignore();		// wenn Makro, dann gar nix
399 						else
400 							rReq.Done();		// sonst wenigstens aufzeichnen
401 					}
402 					else
403 					{
404 						pViewData->ResetOldCursor();
405 						SetCursor( nCol, nRow );
406 						AlignToCursor( nCol, nRow, SC_FOLLOW_JUMP );
407 						rBindings.Invalidate( SID_CURRENTCELL );
408 						rBindings.Update( nSlot );
409 
410 						if (!rReq.IsAPI())
411 							rReq.Done();
412 					}
413 
414 					rReq.SetReturnValue( SfxStringItem( SID_CURRENTCELL, aAddress ) );
415 				}
416 
417 				if (!bFound)	// kein gueltiger Bereich
418 				{
419 					//	wenn es ein Tabellenname ist, umschalten (fuer Navigator/URL's)
420 
421 					SCTAB nNameTab;
422 					if ( pDoc->GetTable( aAddress, nNameTab ) )
423 					{
424 						bFound = sal_True;
425 						if ( nNameTab != nTab )
426 							SetTabNo( nNameTab );
427 					}
428 				}
429 
430 				if ( !bFound && nSlot == SID_JUMPTOMARK )
431 				{
432 					//	Grafik-Objekte probieren (nur bei URL's)
433 
434 					bFound = SelectObject( aAddress );
435 				}
436 
437 				if (!bFound && !rReq.IsAPI())
438 					ErrorMessage( STR_ERR_INVALID_AREA );
439 			}
440 			break;
441 
442 		case SID_CURRENTOBJECT:
443 			if ( pReqArgs )
444 			{
445 				String aName = ((const SfxStringItem&)pReqArgs->Get(nSlot)).GetValue();
446 				SelectObject( aName );
447 			}
448 			break;
449 
450 		case SID_CURRENTTAB:
451 			if ( pReqArgs )
452 			{
453 				//	Tabelle fuer Basic ist 1-basiert
454 				SCTAB nTab = ((const SfxUInt16Item&)pReqArgs->Get(nSlot)).GetValue() - 1;
455 				ScDocument* pDoc = GetViewData()->GetDocument();
456 				if ( nTab < pDoc->GetTableCount() )
457 				{
458 					SetTabNo( nTab );
459 					rBindings.Update( nSlot );
460 
461 					if( ! rReq.IsAPI() )
462 						rReq.Done();
463 				}
464 				//!	sonst Fehler ?
465 			}
466 			break;
467 
468 		case SID_CURRENTDOC:
469 			if ( pReqArgs )
470 			{
471 				String aStrDocName( ((const SfxStringItem&)pReqArgs->
472 										Get(nSlot)).GetValue() );
473 
474 				SfxViewFrame*	pViewFrame = NULL;
475 				ScDocShell* 	pDocSh = (ScDocShell*)SfxObjectShell::GetFirst();
476 				sal_Bool			bFound = sal_False;
477 
478 				// zu aktivierenden ViewFrame suchen
479 
480 				while ( pDocSh && !bFound )
481 				{
482 					if ( pDocSh->GetTitle() == aStrDocName )
483 					{
484 						pViewFrame = SfxViewFrame::GetFirst( pDocSh );
485 						bFound = ( NULL != pViewFrame );
486 					}
487 
488 					pDocSh = (ScDocShell*)SfxObjectShell::GetNext( *pDocSh );
489 				}
490 
491 				if ( bFound )
492 					pViewFrame->GetFrame().Appear();
493 
494 				rReq.Ignore();//XXX wird von SFX erledigt
495 			}
496 
497 		case SID_ATTR_SIZE://XXX ???
498 			break;
499 
500 
501 		case SID_PRINTPREVIEW:
502 			{
503                 if ( !pThisFrame->GetFrame().IsInPlace() )          // nicht bei OLE
504 				{
505 					//	print preview is now always in the same frame as the tab view
506 					//	-> always switch this frame back to normal view
507 					//	(ScPreviewShell ctor reads view data)
508 
509                     // #102785#; finish input
510                     pScMod->InputEnterHandler();
511 
512                     pThisFrame->GetDispatcher()->Execute( SID_VIEWSHELL1, SFX_CALLMODE_ASYNCHRON );
513 				}
514 				//	else Fehler (z.B. Ole)
515 			}
516 			break;
517 
518 		case SID_DETECTIVE_DEL_ALL:
519 			DetectiveDelAll();
520 			rReq.Done();
521 			break;
522 
523 		//	SID_TABLE_ACTIVATE und SID_MARKAREA werden von Basic aus an der versteckten
524 		//	View aufgerufen, um auf der sichtbaren View zu markieren/umzuschalten:
525 
526 		case SID_TABLE_ACTIVATE:
527 			DBG_ERROR("old slot SID_TABLE_ACTIVATE");
528 			break;
529 
530 		case SID_REPAINT:
531 			PaintGrid();
532 			PaintTop();
533 			PaintLeft();
534 			PaintExtras();
535 			rReq.Done();
536 			break;
537 
538         case FID_NORMALVIEWMODE:
539 		case FID_PAGEBREAKMODE:
540 			{
541                 sal_Bool bWantPageBreak = nSlot == FID_PAGEBREAKMODE;
542 
543                 // check whether there is an explicit argument, use it
544 				const SfxPoolItem* pItem;
545                 if ( pReqArgs && pReqArgs->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET )
546                 {
547                     sal_Bool bItemValue = ((const SfxBoolItem*)pItem)->GetValue();
548                     bWantPageBreak = (nSlot == FID_PAGEBREAKMODE) == bItemValue;
549                 }
550 
551                 if( GetViewData()->IsPagebreakMode() != bWantPageBreak )
552                 {
553                     SetPagebreakMode( bWantPageBreak );
554                     UpdatePageBreakData();
555                     SetCurSubShell( GetCurObjectSelectionType(), sal_True );
556                     PaintGrid();
557                     PaintTop();
558                     PaintLeft();
559                     rBindings.Invalidate( nSlot );
560                     rReq.AppendItem( SfxBoolItem( nSlot, sal_True ) );
561                     rReq.Done();
562                 }
563 			}
564 			break;
565 
566 		case FID_FUNCTION_BOX:
567 			{
568                 sal_uInt16 nChildId = ScFunctionChildWindow::GetChildWindowId();
569 				if ( rReq.GetArgs() )
570                     pThisFrame->SetChildWindow( nChildId, ((const SfxBoolItem&) (rReq.GetArgs()->Get(FID_FUNCTION_BOX))).GetValue());
571 				else
572                 {
573                     pThisFrame->ToggleChildWindow( nChildId );
574                     rReq.AppendItem( SfxBoolItem( FID_FUNCTION_BOX , pThisFrame->HasChildWindow( nChildId ) ) );
575                 }
576 
577 				GetViewFrame()->GetBindings().Invalidate(FID_FUNCTION_BOX);
578 				rReq.Done ();
579 			}
580 			break;
581 
582 
583 		case FID_TOGGLESYNTAX:
584 			{
585 				sal_Bool bSet = !GetViewData()->IsSyntaxMode();
586 				const SfxPoolItem* pItem;
587 				if ( pReqArgs && pReqArgs->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET )
588 					bSet = ((const SfxBoolItem*)pItem)->GetValue();
589 				GetViewData()->SetSyntaxMode( bSet );
590 				PaintGrid();
591 				rBindings.Invalidate( FID_TOGGLESYNTAX );
592                 rReq.AppendItem( SfxBoolItem( nSlot, bSet ) );
593 				rReq.Done();
594 			}
595 			break;
596 		case FID_TOGGLEHEADERS:
597 			{
598 				sal_Bool bSet = !GetViewData()->IsHeaderMode();
599 				const SfxPoolItem* pItem;
600 				if ( pReqArgs && pReqArgs->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET )
601 					bSet = ((const SfxBoolItem*)pItem)->GetValue();
602 				GetViewData()->SetHeaderMode( bSet );
603 				RepeatResize();
604 				rBindings.Invalidate( FID_TOGGLEHEADERS );
605                 rReq.AppendItem( SfxBoolItem( nSlot, bSet ) );
606 				rReq.Done();
607 			}
608 			break;
609 
610         case FID_TOGGLEFORMULA:
611             {
612                 ScViewData* pViewData = GetViewData();
613                 const ScViewOptions& rOpts = pViewData->GetOptions();
614                 sal_Bool bFormulaMode = !rOpts.GetOption( VOPT_FORMULAS );
615                 const SfxPoolItem *pItem;
616                 if( pReqArgs && pReqArgs->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET )
617                     bFormulaMode = ((const SfxBoolItem *)pItem)->GetValue();
618 
619                 ScViewOptions rSetOpts = ScViewOptions( rOpts );
620                 rSetOpts.SetOption( VOPT_FORMULAS, bFormulaMode );
621                 pViewData->SetOptions( rSetOpts );
622 
623                 pViewData->GetDocShell()->PostPaintGridAll();
624 
625                 rBindings.Invalidate( FID_TOGGLEFORMULA );
626                 rReq.AppendItem( SfxBoolItem( nSlot, bFormulaMode ) );
627                 rReq.Done();
628             }
629             break;
630 
631 		case FID_TOGGLEINPUTLINE:
632 			{
633 				sal_uInt16			nId  = ScInputWindowWrapper::GetChildWindowId();
634 				SfxChildWindow* pWnd = pThisFrame->GetChildWindow( nId );
635 				sal_Bool bSet = ( pWnd == NULL );
636 				const SfxPoolItem* pItem;
637 				if ( pReqArgs && pReqArgs->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET )
638 					bSet = ((const SfxBoolItem*)pItem)->GetValue();
639 
640 				pThisFrame->SetChildWindow( nId, bSet );
641 				rBindings.Invalidate( FID_TOGGLEINPUTLINE );
642                 rReq.AppendItem( SfxBoolItem( nSlot, bSet ) );
643                 rReq.Done();
644 			}
645 			break;
646 
647 		case SID_ATTR_ZOOM: // Statuszeile
648 		case FID_SCALE:
649 			{
650                 sal_Bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom();
651 				SvxZoomType	eOldZoomType = GetZoomType();
652 				SvxZoomType	eNewZoomType = eOldZoomType;
653 				const Fraction& rOldY = GetViewData()->GetZoomY();	// Y wird angezeigt
654 				sal_uInt16 nOldZoom = (sal_uInt16)(( rOldY.GetNumerator() * 100 )
655 											/ rOldY.GetDenominator());
656 				sal_uInt16 nZoom = nOldZoom;
657 				sal_Bool bCancel = sal_False;
658 
659 				if ( pReqArgs )
660 				{
661 					const SvxZoomItem& rZoomItem = (const SvxZoomItem&)
662 												   pReqArgs->Get(SID_ATTR_ZOOM);
663 
664 					eNewZoomType = rZoomItem.GetType();
665 					nZoom	  = rZoomItem.GetValue();
666 				}
667 				else
668 				{
669 					SfxItemSet		aSet	 ( GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM );
670 					SvxZoomItem		aZoomItem( eOldZoomType, nOldZoom, SID_ATTR_ZOOM );
671 					//CHINA001 SvxZoomDialog*	pDlg = NULL;
672 					AbstractSvxZoomDialog* pDlg = NULL;
673 					ScMarkData&		rMark = GetViewData()->GetMarkData();
674 					sal_uInt16			nBtnFlags =   SVX_ZOOM_ENABLE_50
675 												| SVX_ZOOM_ENABLE_75
676 												| SVX_ZOOM_ENABLE_100
677 												| SVX_ZOOM_ENABLE_150
678 												| SVX_ZOOM_ENABLE_200
679 												| SVX_ZOOM_ENABLE_WHOLEPAGE
680 												| SVX_ZOOM_ENABLE_PAGEWIDTH;
681 
682 					if ( rMark.IsMarked() || rMark.IsMultiMarked() )
683 						nBtnFlags = nBtnFlags | SVX_ZOOM_ENABLE_OPTIMAL;
684 
685 					aZoomItem.SetValueSet( nBtnFlags );
686 					aSet.Put( aZoomItem );
687 					//CHINA001 pDlg = new SvxZoomDialog( GetDialogParent(), aSet );
688 					SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
689 					if(pFact)
690 					{
691 						pDlg = pFact->CreateSvxZoomDialog(GetDialogParent(), aSet );
692 						DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
693 					}
694 					pDlg->SetLimits( MINZOOM, MAXZOOM );
695 
696 					bCancel = ( RET_CANCEL == pDlg->Execute() );
697 
698 					if ( !bCancel )
699 					{
700 						const SvxZoomItem&	rZoomItem = (const SvxZoomItem&)
701 												pDlg->GetOutputItemSet()->
702 													Get( SID_ATTR_ZOOM );
703 
704 						eNewZoomType = rZoomItem.GetType();
705 						nZoom	  = rZoomItem.GetValue();
706 					}
707 
708 					delete pDlg;
709 				}
710 
711 				if ( !bCancel )
712 				{
713 					if ( eNewZoomType == SVX_ZOOM_PERCENT )
714 					{
715 						if ( nZoom < MINZOOM )	nZoom = MINZOOM;
716 						if ( nZoom > MAXZOOM )	nZoom = MAXZOOM;
717 					}
718 					else
719 					{
720 						nZoom = CalcZoom( eNewZoomType, nOldZoom );
721 						bCancel = nZoom == 0;
722 					}
723 
724 					switch ( eNewZoomType )
725 					{
726 						case SVX_ZOOM_WHOLEPAGE:
727 						case SVX_ZOOM_PAGEWIDTH:
728                             SetZoomType( eNewZoomType, bSyncZoom );
729 							break;
730 
731 						default:
732                             SetZoomType( SVX_ZOOM_PERCENT, bSyncZoom );
733 					}
734 				}
735 
736 				if ( nZoom != nOldZoom && !bCancel )
737 				{
738 					if (!GetViewData()->IsPagebreakMode())
739 					{
740 						ScAppOptions aNewOpt = pScMod->GetAppOptions();
741 						aNewOpt.SetZoom( nZoom );
742 						aNewOpt.SetZoomType( GetZoomType() );
743 						pScMod->SetAppOptions( aNewOpt );
744 					}
745 					Fraction aFract( nZoom, 100 );
746                     SetZoom( aFract, aFract, bSyncZoom );
747 					PaintGrid();
748 					PaintTop();
749 					PaintLeft();
750 					rBindings.Invalidate( SID_ATTR_ZOOM );
751                     rReq.AppendItem( SvxZoomItem( GetZoomType(), nZoom, nSlot ) );
752 					rReq.Done();
753 				}
754 			}
755 			break;
756 
757         case SID_ATTR_ZOOMSLIDER:
758             {
759                 const SfxPoolItem* pItem = NULL;
760                 sal_Bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom();
761                 if ( pReqArgs && pReqArgs->GetItemState(SID_ATTR_ZOOMSLIDER, sal_True, &pItem) == SFX_ITEM_SET )
762                 {
763                     const sal_uInt16 nCurrentZoom = ((const SvxZoomSliderItem *)pItem)->GetValue();
764                     if( nCurrentZoom )
765                     {
766                         SetZoomType( SVX_ZOOM_PERCENT, bSyncZoom );
767                         if (!GetViewData()->IsPagebreakMode())
768                         {
769                             ScAppOptions aNewOpt = pScMod->GetAppOptions();
770                             aNewOpt.SetZoom( nCurrentZoom );
771                             aNewOpt.SetZoomType( GetZoomType() );
772                             pScMod->SetAppOptions( aNewOpt );
773                         }
774                         Fraction aFract( nCurrentZoom,100 );
775                         SetZoom( aFract, aFract, bSyncZoom );
776                         PaintGrid();
777                         PaintTop();
778                         PaintLeft();
779                         rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
780                         rReq.Done();
781                     }
782                 }
783             }
784             break;
785 
786 		//----------------------------------------------------------------
787 
788 		case FID_TAB_SELECTALL:
789 			SelectAllTables();
790 			rReq.Done();
791 			break;
792 
793         case FID_TAB_DESELECTALL:
794             DeselectAllTables();
795             rReq.Done();
796             break;
797 
798         case SID_SELECT_TABLES:
799         {
800             ScViewData& rViewData = *GetViewData();
801             ScDocument& rDoc = *rViewData.GetDocument();
802             ScMarkData& rMark = rViewData.GetMarkData();
803             SCTAB nTabCount = rDoc.GetTableCount();
804             SCTAB nTab;
805 
806             SvULongs aIndexList( 4, 4 );
807             SFX_REQUEST_ARG( rReq, pItem, SfxIntegerListItem, SID_SELECT_TABLES, sal_False );
808             if ( pItem )
809                 pItem->GetList( aIndexList );
810             else
811             {
812                 //CHINA001 ScShowTabDlg* pDlg = new ScShowTabDlg( GetDialogParent() );
813 				ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
814 				DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
815 
816 				AbstractScShowTabDlg* pDlg = pFact->CreateScShowTabDlg( GetDialogParent(), RID_SCDLG_SHOW_TAB);
817 				DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
818                 pDlg->SetDescription(
819                     String( ScResId( STR_DLG_SELECTTABLES_TITLE ) ),
820                     String( ScResId( STR_DLG_SELECTTABLES_LBNAME ) ),
821                     GetStaticInterface()->GetSlot(SID_SELECT_TABLES)->GetCommand(), HID_SELECTTABLES );
822 
823                 // fill all table names with selection state
824                 String aTabName;
825                 for( nTab = 0; nTab < nTabCount; ++nTab )
826                 {
827                     rDoc.GetName( nTab, aTabName );
828                     pDlg->Insert( aTabName, rMark.GetTableSelect( nTab ) );
829                 }
830 
831                 if( pDlg->Execute() == RET_OK )
832                 {
833                     sal_uInt16 nSelCount = pDlg->GetSelectEntryCount();
834                     sal_uInt16 nSelIx;
835                     for( nSelIx = 0; nSelIx < nSelCount; ++nSelIx )
836                         aIndexList.Insert( pDlg->GetSelectEntryPos( nSelIx ), nSelIx );
837                     delete pDlg;
838                     rReq.AppendItem( SfxIntegerListItem( SID_SELECT_TABLES, aIndexList ) );
839                 }
840                 else
841                     rReq.Ignore();
842             }
843 
844             if ( aIndexList.Count() )
845             {
846                 sal_uInt16 nSelCount = aIndexList.Count();
847                 sal_uInt16 nSelIx;
848                 SCTAB nFirstVisTab = 0;
849 
850                 // special case: only hidden tables selected -> do nothing
851                 sal_Bool bVisSelected = sal_False;
852                 for( nSelIx = 0; !bVisSelected && (nSelIx < nSelCount); ++nSelIx )
853                     bVisSelected = rDoc.IsVisible( nFirstVisTab = static_cast<SCTAB>(aIndexList[nSelIx]) );
854                 if( !bVisSelected )
855                     nSelCount = 0;
856 
857                 // select the tables
858                 if( nSelCount )
859                 {
860                     for( nTab = 0; nTab < nTabCount; ++nTab )
861                         rMark.SelectTable( nTab, sal_False );
862 
863                     for( nSelIx = 0; nSelIx < nSelCount; ++nSelIx )
864                         rMark.SelectTable( static_cast<SCTAB>(aIndexList[nSelIx]), sal_True );
865 
866                     // activate another table, if current is deselected
867                     if( !rMark.GetTableSelect( rViewData.GetTabNo() ) )
868                     {
869                         rMark.SelectTable( nFirstVisTab, sal_True );
870                         SetTabNo( nFirstVisTab );
871                     }
872 
873                     rViewData.GetDocShell()->PostPaintExtras();
874                     SfxBindings& rBind = rViewData.GetBindings();
875                     rBind.Invalidate( FID_FILL_TAB );
876                     rBind.Invalidate( FID_TAB_DESELECTALL );
877                 }
878 
879                 rReq.Done();
880             }
881         }
882         break;
883 
884 
885 		case SID_OUTLINE_DELETEALL:
886 			RemoveAllOutlines();
887 			rReq.Done();
888 			break;
889 
890 		case SID_AUTO_OUTLINE:
891 			AutoOutline();
892 			rReq.Done();
893 			break;
894 
895 
896 		case SID_WINDOW_SPLIT:
897 			{
898 				ScSplitMode eHSplit = GetViewData()->GetHSplitMode();
899 				ScSplitMode eVSplit = GetViewData()->GetVSplitMode();
900 				if ( eHSplit == SC_SPLIT_NORMAL || eVSplit == SC_SPLIT_NORMAL )		// aufheben
901 					RemoveSplit();
902 				else if ( eHSplit == SC_SPLIT_FIX || eVSplit == SC_SPLIT_FIX )		// normal
903 					FreezeSplitters( sal_False );
904 				else																// erzeugen
905 					SplitAtCursor();
906 				rReq.Done();
907 
908 				InvalidateSplit();
909 			}
910 			break;
911 
912 		case SID_WINDOW_FIX:
913 			{
914 				ScSplitMode eHSplit = GetViewData()->GetHSplitMode();
915 				ScSplitMode eVSplit = GetViewData()->GetVSplitMode();
916 				if ( eHSplit == SC_SPLIT_FIX || eVSplit == SC_SPLIT_FIX )			// aufheben
917 					RemoveSplit();
918 				else
919 					FreezeSplitters( sal_True );		// erzeugen oder fixieren
920 				rReq.Done();
921 
922 				InvalidateSplit();
923 			}
924 			break;
925 
926 		//	----------------------------------------------------------------
927 
928 		case FID_CHG_SHOW:
929 			{
930 				sal_uInt16			nId  = ScHighlightChgDlgWrapper::GetChildWindowId();
931 				SfxChildWindow* pWnd = pThisFrame->GetChildWindow( nId );
932 
933 				pScMod->SetRefDialog( nId, pWnd ? sal_False : sal_True );
934 			}
935 			break;
936 
937 		case FID_CHG_ACCEPT:
938 			{
939 				pThisFrame->ToggleChildWindow(ScAcceptChgDlgWrapper::GetChildWindowId());
940 				GetViewFrame()->GetBindings().Invalidate(FID_CHG_ACCEPT);
941 				rReq.Done ();
942 
943 				/*
944 				sal_uInt16			nId  = ScAcceptChgDlgWrapper::GetChildWindowId();
945 				SfxChildWindow* pWnd = pThisFrame->GetChildWindow( nId );
946 
947 				pScMod->SetRefDialog( nId, pWnd ? sal_False : sal_True );
948 				*/
949 			}
950 			break;
951 
952 		case FID_CHG_COMMENT:
953 			{
954 				ScViewData* pData = GetViewData();
955 				ScAddress aCursorPos( pData->GetCurX(), pData->GetCurY(), pData->GetTabNo() );
956 				ScDocShell* pDocSh = pData->GetDocShell();
957 
958 				ScChangeAction*	pAction = pDocSh->GetChangeAction( aCursorPos );
959 				if ( pAction )
960 				{
961 					const SfxPoolItem* pItem;
962 					if ( pReqArgs &&
963 						 pReqArgs->GetItemState( nSlot, sal_True, &pItem ) == SFX_ITEM_SET &&
964 						 pItem->ISA( SfxStringItem ) )
965 					{
966 						String aComment = ((const SfxStringItem*)pItem)->GetValue();
967 						pDocSh->SetChangeComment( pAction, aComment );
968 						rReq.Done();
969 					}
970 					else
971 					{
972 						pDocSh->ExecuteChangeCommentDialog( pAction, GetDialogParent() );
973 						rReq.Done();
974 					}
975 				}
976 			}
977 			break;
978 
979 		case SID_CREATE_SW_DRAWVIEW:
980 			//	wird von den Forms gerufen, wenn die DrawView mit allem Zubehoer
981 			//	angelegt werden muss
982 			if (!GetScDrawView())
983 			{
984 				GetViewData()->GetDocShell()->MakeDrawLayer();
985 				rBindings.InvalidateAll(sal_False);
986 			}
987 			break;
988 
989 		case FID_PROTECT_DOC:
990 			{
991 				ScDocument* 		pDoc = GetViewData()->GetDocument();
992 				SfxPasswordDialog*	pDlg;
993 
994 				if( pReqArgs )
995 				{
996 					const SfxPoolItem* pItem;
997                     if( IS_AVAILABLE( FID_PROTECT_DOC, &pItem ) &&
998                         ((const SfxBoolItem*)pItem)->GetValue() == pDoc->IsDocProtected() )
999                     {
1000                         rReq.Ignore();
1001                         break;
1002                     }
1003                 }
1004 
1005                 ScDocProtection* pProtect = pDoc->GetDocProtection();
1006                 if (pProtect && pProtect->isProtected())
1007 				{
1008 					sal_Bool	bCancel = sal_False;
1009 					String	aPassword;
1010 
1011                     if (pProtect->isProtectedWithPass())
1012 					{
1013 						String	aText( ScResId(SCSTR_PASSWORD) );
1014 
1015 						pDlg = new SfxPasswordDialog( 	GetDialogParent(), &aText );
1016 						pDlg->SetText( ScResId(SCSTR_UNPROTECTDOC) );
1017 						pDlg->SetMinLen( 0 );
1018 						pDlg->SetHelpId( GetStaticInterface()->GetSlot(FID_PROTECT_DOC)->GetCommand() );
1019 						pDlg->SetEditHelpId( HID_PASSWD_DOC );
1020 
1021 						if (pDlg->Execute() == RET_OK)
1022 							aPassword = pDlg->GetPassword();
1023 						else
1024 							bCancel = sal_True;
1025 						delete pDlg;
1026 					}
1027 					if (!bCancel)
1028 					{
1029 						Unprotect( TABLEID_DOC, aPassword );
1030                         rReq.AppendItem( SfxBoolItem( FID_PROTECT_DOC, sal_False ) );
1031 						rReq.Done();
1032 					}
1033 				}
1034 				else
1035 				{
1036 					String aText( ScResId(SCSTR_PASSWORDOPT) );
1037 
1038 					pDlg = new SfxPasswordDialog( 	GetDialogParent(), &aText );
1039 					pDlg->SetText( ScResId(SCSTR_PROTECTDOC) );
1040 					pDlg->SetMinLen( 0 );
1041     				pDlg->SetHelpId( GetStaticInterface()->GetSlot(FID_PROTECT_DOC)->GetCommand() );
1042 					pDlg->SetEditHelpId( HID_PASSWD_DOC );
1043 					pDlg->ShowExtras( SHOWEXTRAS_CONFIRM );
1044 
1045 					if (pDlg->Execute() == RET_OK)
1046 					{
1047 						String aPassword = pDlg->GetPassword();
1048                         Protect( TABLEID_DOC, aPassword );
1049                         rReq.AppendItem( SfxBoolItem( FID_PROTECT_DOC, sal_True ) );
1050                         rReq.Done();
1051 					}
1052 
1053 					delete pDlg;
1054 				}
1055 				rBindings.Invalidate( FID_PROTECT_DOC );
1056 			}
1057 			break;
1058 
1059 
1060 		case FID_PROTECT_TABLE:
1061         {
1062             ScDocument* pDoc = GetViewData()->GetDocument();
1063             SCTAB		nTab = GetViewData()->GetTabNo();
1064             bool        bOldProtection = pDoc->IsTabProtected(nTab);
1065 
1066 #if ENABLE_SHEET_PROTECTION
1067 
1068             if( pReqArgs )
1069             {
1070                 const SfxPoolItem* pItem;
1071                 bool bNewProtection = !bOldProtection;
1072                 if( IS_AVAILABLE( FID_PROTECT_TABLE, &pItem ) )
1073                     bNewProtection = ((const SfxBoolItem*)pItem)->GetValue();
1074                 if( bNewProtection == bOldProtection )
1075                 {
1076                     rReq.Ignore();
1077                     break;
1078                 }
1079             }
1080 
1081             if (bOldProtection)
1082             {
1083                 // Unprotect a protected sheet.
1084 
1085                 ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
1086                 if (pProtect && pProtect->isProtectedWithPass())
1087                 {
1088                     String aText( ScResId(SCSTR_PASSWORDOPT) );
1089                     auto_ptr<SfxPasswordDialog> pDlg(new SfxPasswordDialog(GetDialogParent(), &aText));
1090                     pDlg->SetText( ScResId(SCSTR_UNPROTECTTAB) );
1091                     pDlg->SetMinLen( 0 );
1092 					pDlg->SetHelpId( GetStaticInterface()->GetSlot(FID_PROTECT_TABLE)->GetCommand() );
1093                     pDlg->SetEditHelpId( HID_PASSWD_TABLE );
1094 
1095                     if (pDlg->Execute() == RET_OK)
1096                     {
1097                         String aPassword = pDlg->GetPassword();
1098                         Unprotect(nTab, aPassword);
1099                     }
1100                 }
1101                 else
1102                     // this sheet is not password-protected.
1103                     Unprotect(nTab, String());
1104 
1105                 if (!pReqArgs)
1106                 {
1107                     rReq.AppendItem( SfxBoolItem(FID_PROTECT_TABLE, false) );
1108                     rReq.Done();
1109                 }
1110             }
1111             else
1112             {
1113                 // Protect a current sheet.
1114 
1115                 auto_ptr<ScTableProtectionDlg> pDlg(new ScTableProtectionDlg(GetDialogParent()));
1116 
1117                 ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
1118                 if (pProtect)
1119                     pDlg->SetDialogData(*pProtect);
1120 
1121                 if (pDlg->Execute() == RET_OK)
1122                 {
1123                     pScMod->InputEnterHandler();
1124 
1125                     ScTableProtection aNewProtect;
1126                     pDlg->WriteData(aNewProtect);
1127                     ProtectSheet(nTab, aNewProtect);
1128                     if (!pReqArgs)
1129                     {
1130                         rReq.AppendItem( SfxBoolItem(FID_PROTECT_TABLE, true) );
1131                         rReq.Done();
1132                     }
1133                 }
1134             }
1135 #else
1136             auto_ptr<SfxPasswordDialog> pDlg;
1137             String				aPassword;
1138             sal_Bool				bCancel = sal_False;
1139             bool                bNewProtection = ! bOldProtection;
1140 
1141             if( pReqArgs )
1142             {
1143                 const SfxPoolItem* pItem;
1144                 if( IS_AVAILABLE( FID_PROTECT_TABLE, &pItem ) )
1145                     bNewProtection = ((const SfxBoolItem*)pItem)->GetValue();
1146                 if( bNewProtection == bOldProtection )
1147                 {
1148                     rReq.Ignore();
1149                     break;
1150                 }
1151             }
1152 
1153             if ( bOldProtection)
1154             {
1155                 // Unprotect a protected sheet.
1156 
1157                 ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
1158                 if (pProtect && pProtect->isProtectedWithPass())
1159                 {
1160                     String aText( ScResId(SCSTR_PASSWORDOPT) );
1161                     pDlg.reset(new SfxPasswordDialog(GetDialogParent(), &aText));
1162                     pDlg->SetText( ScResId(SCSTR_UNPROTECTTAB) );
1163                     pDlg->SetMinLen( 0 );
1164 					pDlg->SetHelpId( GetStaticInterface()->GetSlot(FID_PROTECT_TABLE)->GetCommand() );
1165                     pDlg->SetEditHelpId( HID_PASSWD_TABLE );
1166 
1167                     if (pDlg->Execute() == RET_OK)
1168                         aPassword = pDlg->GetPassword();
1169                     else
1170                         bCancel = sal_True;
1171                 }
1172 
1173                 if (!pReqArgs)
1174                 {
1175                     rReq.AppendItem( SfxBoolItem(FID_PROTECT_TABLE, false) );
1176                     rReq.Done();
1177                 }
1178             }
1179             else
1180             {
1181                 String aText( ScResId(SCSTR_PASSWORDOPT) );
1182 
1183                 pDlg.reset(new SfxPasswordDialog(GetDialogParent(), &aText));
1184                 pDlg->SetText( ScResId(SCSTR_PROTECTTAB) );
1185                 pDlg->SetMinLen( 0 );
1186                 pDlg->SetHelpId( GetStaticInterface()->GetSlot(FID_PROTECT_TABLE)->GetCommand() );
1187                 pDlg->SetEditHelpId( HID_PASSWD_TABLE );
1188                 pDlg->ShowExtras( SHOWEXTRAS_CONFIRM );
1189 
1190                 if (pDlg->Execute() == RET_OK)
1191                     aPassword = pDlg->GetPassword();
1192                 else
1193                     bCancel = sal_True;
1194             }
1195 
1196             if( !bCancel )
1197             {
1198                 if ( bOldProtection )
1199                     Unprotect( nTab, aPassword );
1200                 else
1201                 {
1202                     pScMod->InputEnterHandler();
1203 
1204                     Protect( nTab, aPassword );
1205                 }
1206 
1207                 if( !pReqArgs )
1208                 {
1209                     rReq.AppendItem( SfxBoolItem( FID_PROTECT_TABLE, bNewProtection ) );
1210                     rReq.Done();
1211                 }
1212             }
1213 #endif
1214             TabChanged();
1215             UpdateInputHandler(true);   // damit sofort wieder eingegeben werden kann
1216             SelectionChanged();
1217         }
1218         break;
1219 
1220         case SID_OPT_LOCALE_CHANGED :
1221             {   // locale changed, SYSTEM number formats changed => repaint cell contents
1222                 PaintGrid();
1223 				rReq.Done();
1224 			}
1225             break;
1226 
1227 		default:
1228 			DBG_ERROR("Unbekannter Slot bei ScTabViewShell::Execute");
1229 			break;
1230 	}
1231 }
1232 
1233 
1234 
1235