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