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 <svx/extrusionbar.hxx>
34 : : #include <svx/fontworkbar.hxx>
35 : : #include <editeng/boxitem.hxx>
36 : : #include <svx/fmshell.hxx>
37 : : #include <editeng/sizeitem.hxx>
38 : : #include <svx/prtqry.hxx>
39 : : #include <sfx2/request.hxx>
40 : : #include <sfx2/printer.hxx>
41 : : #include <sfx2/dispatch.hxx>
42 : : #include <svl/whiter.hxx>
43 : : #include <unotools/moduleoptions.hxx>
44 : : #include <rtl/logfile.hxx>
45 : : #include <tools/urlobj.hxx>
46 : : #include <sfx2/docfile.hxx>
47 : :
48 : : #include "tabvwsh.hxx"
49 : : #include "sc.hrc"
50 : : #include "globstr.hrc"
51 : : #include "stlpool.hxx"
52 : : #include "stlsheet.hxx"
53 : : #include "docsh.hxx"
54 : : #include "scmod.hxx"
55 : : #include "appoptio.hxx"
56 : : #include "rangeutl.hxx"
57 : : #include "printfun.hxx"
58 : : #include "drawsh.hxx"
59 : : #include "drformsh.hxx"
60 : : #include "editsh.hxx"
61 : : #include "pivotsh.hxx"
62 : : #include "auditsh.hxx"
63 : : #include "drtxtob.hxx"
64 : : #include "inputhdl.hxx"
65 : : #include "editutil.hxx"
66 : : #include "inputopt.hxx"
67 : : #include "inputwin.hxx"
68 : : #include "scresid.hxx"
69 : : #include "dbdata.hxx" // fuer ReImport
70 : : #include "reffact.hxx"
71 : : #include "viewuno.hxx"
72 : : #include "dispuno.hxx"
73 : : #include "anyrefdg.hxx"
74 : : #include "chgtrack.hxx"
75 : : #include "cellsh.hxx"
76 : : #include "oleobjsh.hxx"
77 : : #include "chartsh.hxx"
78 : : #include "graphsh.hxx"
79 : : #include "mediash.hxx"
80 : : #include "pgbrksh.hxx"
81 : : #include "dpobject.hxx"
82 : : #include "prevwsh.hxx"
83 : : #include "tpprint.hxx"
84 : : #include "scextopt.hxx"
85 : : #include "printopt.hxx"
86 : : #include "drawview.hxx"
87 : : #include "fupoor.hxx"
88 : : #include "navsett.hxx"
89 : : #include "scabstdlg.hxx"
90 : : #include "externalrefmgr.hxx"
91 : : #include "defaultsoptions.hxx"
92 : : #include "markdata.hxx"
93 : : #include "preview.hxx"
94 : :
95 : : #include <com/sun/star/document/XDocumentProperties.hpp>
96 : :
97 : : void ActivateOlk( ScViewData* pViewData );
98 : : void DeActivateOlk( ScViewData* pViewData );
99 : :
100 : : extern SfxViewShell* pScActiveViewShell; // global.cxx
101 : :
102 : : using namespace com::sun::star;
103 : :
104 : : // STATIC DATA -----------------------------------------------------------
105 : :
106 : : sal_uInt16 ScTabViewShell::nInsertCtrlState = SID_INSERT_GRAPHIC;
107 : : sal_uInt16 ScTabViewShell::nInsCellsCtrlState = 0;
108 : : sal_uInt16 ScTabViewShell::nInsObjCtrlState = SID_INSERT_DIAGRAM;
109 : :
110 : : // -----------------------------------------------------------------------
111 : :
112 : 229 : void ScTabViewShell::Activate(sal_Bool bMDI)
113 : : {
114 : 229 : SfxViewShell::Activate(bMDI);
115 : :
116 : : // hier kein GrabFocus, sonst gibt's Probleme wenn etwas inplace editiert wird!
117 : :
118 [ + - ]: 229 : if ( bMDI )
119 : : {
120 : : // fuer Eingabezeile (ClearCache)
121 : 229 : ScModule* pScMod = SC_MOD();
122 : 229 : pScMod->ViewShellChanged();
123 : :
124 : 229 : ActivateView( sal_True, bFirstActivate );
125 : 229 : ActivateOlk( GetViewData() );
126 : :
127 : : // AutoCorrect umsetzen, falls der Writer seins neu angelegt hat
128 : 229 : UpdateDrawTextOutliner();
129 : :
130 : : // RegisterNewTargetNames gibts nicht mehr
131 : :
132 : 229 : SfxViewFrame* pThisFrame = GetViewFrame();
133 [ + - ][ + - ]: 229 : if ( pInputHandler && pThisFrame->HasChildWindow(FID_INPUTLINE_STATUS) )
[ + - ]
134 : : {
135 : : // eigentlich nur beim Reload (letzte Version) noetig:
136 : : // Das InputWindow bleibt stehen, aber die View mitsamt InputHandler wird
137 : : // neu angelegt, darum muss der InputHandler am InputWindow gesetzt werden.
138 : 229 : SfxChildWindow* pChild = pThisFrame->GetChildWindow(FID_INPUTLINE_STATUS);
139 [ + - ]: 229 : if (pChild)
140 : : {
141 : 229 : ScInputWindow* pWin = (ScInputWindow*)pChild->GetWindow();
142 [ + + ][ + + ]: 229 : if (pWin && pWin->IsVisible())
[ + - ]
143 : : {
144 : :
145 : 32 : ScInputHandler* pOldHdl=pWin->GetInputHandler();
146 : :
147 [ + - ]: 32 : TypeId aScType = TYPE(ScTabViewShell);
148 : :
149 [ + - ]: 32 : SfxViewShell* pSh = SfxViewShell::GetFirst( &aScType );
150 [ + - ][ + - ]: 37 : while ( pSh!=NULL && pOldHdl!=NULL)
[ + - ]
151 : : {
152 [ + - ][ + + ]: 37 : if (((ScTabViewShell*)pSh)->GetInputHandler() == pOldHdl)
153 : : {
154 [ + - ]: 32 : pOldHdl->ResetDelayTimer();
155 : 32 : break;
156 : : }
157 [ + - ]: 5 : pSh = SfxViewShell::GetNext( *pSh, &aScType );
158 : : }
159 : :
160 [ + - ]: 32 : pWin->SetInputHandler( pInputHandler );
161 : : }
162 : : }
163 : : }
164 : :
165 : 229 : UpdateInputHandler( sal_True );
166 : :
167 [ + - ]: 229 : if ( bFirstActivate )
168 : : {
169 [ + - ][ + - ]: 229 : SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_NAVIGATOR_UPDATEALL ) );
170 : 229 : bFirstActivate = false;
171 : :
172 : : // ReadExtOptions (view settings from Excel import) must also be done
173 : : // after the ctor, because of the potential calls to Window::Show.
174 : : // Even after a bugfix (Window::Show no longer notifies the access
175 : : // bridge, it's done in ImplSetReallyVisible), there are problems if Window::Show
176 : : // is called during the ViewShell ctor and reschedules asynchronous calls
177 : : // (for example from the FmFormShell ctor).
178 : 229 : ScExtDocOptions* pExtOpt = GetViewData()->GetDocument()->GetExtDocOptions();
179 [ + - ][ + + ]: 229 : if ( pExtOpt && pExtOpt->IsChanged() )
[ + + ]
180 : : {
181 : 4 : GetViewData()->ReadExtOptions(*pExtOpt); // Excel view settings
182 : 4 : SetTabNo( GetViewData()->GetTabNo(), sal_True );
183 : 4 : pExtOpt->SetChanged( false );
184 : : }
185 : : }
186 : :
187 : 229 : pScActiveViewShell = this;
188 : :
189 : 229 : ScInputHandler* pHdl = pScMod->GetInputHdl(this);
190 [ + - ]: 229 : if (pHdl)
191 : : {
192 : 229 : pHdl->SetRefScale( GetViewData()->GetZoomX(), GetViewData()->GetZoomY() );
193 : : }
194 : :
195 : : // Aenderungs-Dialog aktualisieren
196 : :
197 [ - + ]: 229 : if ( pThisFrame->HasChildWindow(FID_CHG_ACCEPT) )
198 : : {
199 : 0 : SfxChildWindow* pChild = pThisFrame->GetChildWindow(FID_CHG_ACCEPT);
200 [ # # ]: 0 : if (pChild)
201 : : {
202 : 0 : ((ScAcceptChgDlgWrapper*)pChild)->ReInitDlg();
203 : : }
204 : : }
205 : :
206 [ - + ]: 229 : if(pScMod->IsRefDialogOpen())
207 : : {
208 : 0 : sal_uInt16 nModRefDlgId=pScMod->GetCurRefDlgId();
209 : 0 : SfxChildWindow* pChildWnd = pThisFrame->GetChildWindow( nModRefDlgId );
210 [ # # ]: 0 : if ( pChildWnd )
211 : : {
212 [ # # ]: 0 : IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
213 : 0 : pRefDlg->ViewShellChanged(this);
214 : : }
215 : : }
216 : : }
217 : :
218 : : // don't call CheckSelectionTransfer here - activating a view should not change the
219 : : // primary selection (may be happening just because the mouse was moved over the window)
220 : :
221 : : // Wenn Referenzeingabe-Tip-Hilfe hier wieder angezeigt werden soll (ShowRefTip),
222 : : // muss sie beim Verschieben der View angepasst werden (gibt sonst Probleme unter OS/2
223 : : // beim Umschalten zwischen Dokumenten)
224 : 229 : }
225 : :
226 : 225 : void ScTabViewShell::Deactivate(sal_Bool bMDI)
227 : : {
228 : 225 : HideTip();
229 : :
230 : 225 : ScDocument* pDoc=GetViewData()->GetDocument();
231 : :
232 : 225 : ScChangeTrack* pChanges=pDoc->GetChangeTrack();
233 : :
234 [ - + ]: 225 : if(pChanges!=NULL)
235 : : {
236 [ # # ]: 0 : Link aLink;
237 [ # # ]: 0 : pChanges->SetModifiedLink(aLink);
238 : : }
239 : :
240 : 225 : SfxViewShell::Deactivate(bMDI);
241 : :
242 : 225 : ScInputHandler* pHdl = SC_MOD()->GetInputHdl(this);
243 : :
244 [ + - ]: 225 : if( bMDI )
245 : : {
246 : : // during shell deactivation, shells must not be switched, or the loop
247 : : // through the shell stack (in SfxDispatcher::DoDeactivate_Impl) will not work
248 : 225 : sal_Bool bOldDontSwitch = bDontSwitch;
249 : 225 : bDontSwitch = sal_True;
250 : :
251 : 225 : DeActivateOlk( GetViewData() );
252 : 225 : ActivateView( false, false );
253 : :
254 [ - + ]: 225 : if ( GetViewFrame()->GetFrame().IsInPlace() ) // inplace
255 : 0 : GetViewData()->GetDocShell()->UpdateOle(GetViewData(),sal_True);
256 : :
257 [ + - ]: 225 : if ( pHdl )
258 : 225 : pHdl->NotifyChange( NULL, sal_True ); // Timer-verzoegert wg. Dokumentwechsel
259 : :
260 [ + - ]: 225 : if (pScActiveViewShell == this)
261 : 225 : pScActiveViewShell = NULL;
262 : :
263 : 225 : bDontSwitch = bOldDontSwitch;
264 : : }
265 : : else
266 : : {
267 : 0 : HideNoteMarker(); // Notiz-Anzeige
268 : :
269 [ # # ]: 0 : if ( pHdl )
270 : 0 : pHdl->HideTip(); // Formel-AutoEingabe-Tip abschalten
271 : : }
272 : 225 : }
273 : :
274 : 0 : void ScTabViewShell::SetActive()
275 : : {
276 : : // Die Sfx-View moechte sich gerne selbst aktivieren, weil dabei noch
277 : : // magische Dinge geschehen (z.B. stuerzt sonst evtl. der Gestalter ab)
278 : 0 : ActiveGrabFocus();
279 : 0 : }
280 : :
281 : 434 : sal_uInt16 ScTabViewShell::PrepareClose(sal_Bool bUI, sal_Bool bForBrowsing)
282 : : {
283 : : // Call EnterHandler even in formula mode here,
284 : : // so a formula change in an embedded object isn't lost
285 : : // (ScDocShell::PrepareClose isn't called then).
286 : 434 : ScInputHandler* pHdl = SC_MOD()->GetInputHdl( this );
287 [ - + ][ - + ]: 434 : if ( pHdl && pHdl->IsInputMode() )
[ + - ]
288 : 0 : pHdl->EnterHandler();
289 : :
290 : : // draw text edit mode must be closed
291 : 434 : FuPoor* pPoor = GetDrawFuncPtr();
292 [ + - ][ - + ]: 434 : if ( pPoor && ( IsDrawTextShell() || pPoor->GetSlotID() == SID_DRAW_NOTEEDIT ) )
[ - + ][ + - ]
293 : : {
294 : : // "clean" end of text edit, including note handling, subshells and draw func switching,
295 : : // as in FuDraw and ScTabView::DrawDeselectAll
296 : 0 : GetViewData()->GetDispatcher().Execute( pPoor->GetSlotID(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD );
297 : : }
298 : 434 : ScDrawView* pDrView = GetScDrawView();
299 [ + - ]: 434 : if ( pDrView )
300 : : {
301 : : // force end of text edit, to be safe
302 : : // ScEndTextEdit must always be used, to ensure correct UndoManager
303 : 434 : pDrView->ScEndTextEdit();
304 : : }
305 : :
306 [ + - ]: 434 : if ( pFormShell )
307 : : {
308 : 434 : sal_uInt16 nRet = pFormShell->PrepareClose(bUI, bForBrowsing);
309 [ - + ]: 434 : if (nRet!=sal_True)
310 : 0 : return nRet;
311 : : }
312 : 434 : return SfxViewShell::PrepareClose(bUI,bForBrowsing);
313 : : }
314 : :
315 : : //------------------------------------------------------------------
316 : :
317 : 0 : Size ScTabViewShell::GetOptimalSizePixel() const
318 : : {
319 : 0 : Size aOptSize;
320 : :
321 : 0 : SCTAB nCurTab = GetViewData()->GetTabNo();
322 : 0 : ScDocument* pDoc = GetViewData()->GetDocument();
323 : 0 : ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
324 : : SfxStyleSheetBase* pStyleSheet = pStylePool->Find(
325 : : pDoc->GetPageStyle( nCurTab ),
326 [ # # ][ # # ]: 0 : SFX_STYLE_FAMILY_PAGE );
[ # # ]
327 : :
328 : : OSL_ENSURE( pStyleSheet, "PageStyle not found :-/" );
329 : :
330 [ # # ]: 0 : if ( pStyleSheet )
331 : : {
332 : 0 : const SfxItemSet& rSet = pStyleSheet->GetItemSet();
333 : 0 : const SvxSizeItem& rItem = (const SvxSizeItem&)rSet.Get( ATTR_PAGE_SIZE );
334 : 0 : const Size& rPageSize = rItem.GetSize();
335 : :
336 : 0 : aOptSize.Width() = (long) (rPageSize.Width() * GetViewData()->GetPPTX());
337 : 0 : aOptSize.Height() = (long) (rPageSize.Height() * GetViewData()->GetPPTY());
338 : : }
339 : :
340 : 0 : return aOptSize;
341 : : }
342 : :
343 : : //------------------------------------------------------------------
344 : :
345 : : // Zoom fuer In-Place berechnen
346 : : // aus Verhaeltnis von VisArea und Fenstergroesse des GridWin
347 : :
348 : 0 : void ScTabViewShell::UpdateOleZoom()
349 : : {
350 : 0 : ScDocShell* pDocSh = GetViewData()->GetDocShell();
351 [ # # ]: 0 : if ( pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
352 : : {
353 : : //TODO/LATER: is there a difference between the two GetVisArea methods?
354 [ # # ][ # # ]: 0 : Size aObjSize = ((const SfxObjectShell*)pDocSh)->GetVisArea().GetSize();
355 [ # # ][ # # ]: 0 : if ( aObjSize.Width() > 0 && aObjSize.Height() > 0 )
[ # # ]
356 : : {
357 [ # # ]: 0 : Window* pWin = GetActiveWin();
358 [ # # ][ # # ]: 0 : Size aWinHMM = pWin->PixelToLogic( pWin->GetOutputSizePixel(), MAP_100TH_MM );
[ # # ]
359 : 0 : SetZoomFactor( Fraction( aWinHMM.Width(),aObjSize.Width() ),
360 [ # # # # ]: 0 : Fraction( aWinHMM.Height(),aObjSize.Height() ) );
[ # # ]
361 : : }
362 : : }
363 : 0 : }
364 : :
365 : 0 : void ScTabViewShell::AdjustPosSizePixel( const Point &rPos, const Size &rSize )
366 : : {
367 : 0 : OuterResizePixel( rPos, rSize );
368 : 0 : }
369 : :
370 : 0 : void ScTabViewShell::InnerResizePixel( const Point &rOfs, const Size &rSize )
371 : : {
372 : 0 : Size aNewSize( rSize );
373 [ # # ][ # # ]: 0 : if ( GetViewFrame()->GetFrame().IsInPlace() )
[ # # ]
374 : : {
375 : 0 : SvBorder aBorder;
376 [ # # ]: 0 : GetBorderSize( aBorder, rSize );
377 [ # # ]: 0 : SetBorderPixel( aBorder );
378 : :
379 [ # # ][ # # ]: 0 : Size aObjSize = GetObjectShell()->GetVisArea().GetSize();
[ # # ]
380 : :
381 : 0 : Size aSize( rSize );
382 : 0 : aSize.Width() -= (aBorder.Left() + aBorder.Right());
383 : 0 : aSize.Height() -= (aBorder.Top() + aBorder.Bottom());
384 : :
385 [ # # ][ # # ]: 0 : if ( aObjSize.Width() > 0 && aObjSize.Height() > 0 )
[ # # ]
386 : : {
387 [ # # ][ # # ]: 0 : Size aLogicSize = GetWindow()->PixelToLogic( aSize, MAP_100TH_MM );
[ # # ]
388 : 0 : SfxViewShell::SetZoomFactor( Fraction( aLogicSize.Width(),aObjSize.Width() ),
389 [ # # # # ]: 0 : Fraction( aLogicSize.Height(),aObjSize.Height() ) );
[ # # ]
390 : : }
391 : :
392 : 0 : Point aPos( rOfs );
393 : 0 : aPos.X() += aBorder.Left();
394 : 0 : aPos.Y() += aBorder.Top();
395 [ # # ]: 0 : GetWindow()->SetPosSizePixel( aPos, aSize );
396 : : }
397 : : else
398 : : {
399 : 0 : SvBorder aBorder;
400 [ # # ]: 0 : GetBorderSize( aBorder, rSize );
401 [ # # ]: 0 : SetBorderPixel( aBorder );
402 : 0 : aNewSize.Width() += aBorder.Left() + aBorder.Right();
403 : 0 : aNewSize.Height() += aBorder.Top() + aBorder.Bottom();
404 : : }
405 : :
406 [ # # ]: 0 : DoResize( rOfs, aNewSize, sal_True ); // rSize = Groesse von gridwin
407 : :
408 [ # # ]: 0 : UpdateOleZoom(); // Zoom fuer In-Place berechnen
409 : :
410 [ # # ]: 0 : GetViewData()->GetDocShell()->SetDocumentModified();
411 : 0 : }
412 : :
413 : 524 : void ScTabViewShell::OuterResizePixel( const Point &rOfs, const Size &rSize )
414 : : {
415 : 524 : SvBorder aBorder;
416 [ + - ]: 524 : GetBorderSize( aBorder, rSize );
417 [ + - ]: 524 : SetBorderPixel( aBorder );
418 : :
419 [ + - ]: 524 : DoResize( rOfs, rSize ); // Position und Groesse von tabview wie uebergeben
420 : :
421 : : // ForceMove als Ersatz fuer den Sfx-Move-Mechanismus
422 : : // (aWinPos muss aktuell gehalten werden, damit ForceMove beim Ole-Deaktivieren klappt)
423 : :
424 [ + - ]: 524 : ForceMove();
425 : 524 : }
426 : :
427 : 0 : void ScTabViewShell::SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY )
428 : : {
429 : : // fuer OLE...
430 : :
431 [ # # ]: 0 : Fraction aFrac20( 1,5 );
432 [ # # ]: 0 : Fraction aFrac400( 4,1 );
433 : :
434 [ # # ]: 0 : Fraction aNewX( rZoomX );
435 [ # # ][ # # ]: 0 : if ( aNewX < aFrac20 )
436 [ # # ]: 0 : aNewX = aFrac20;
437 [ # # ][ # # ]: 0 : if ( aNewX > aFrac400 )
438 [ # # ]: 0 : aNewX = aFrac400;
439 [ # # ]: 0 : Fraction aNewY( rZoomY );
440 [ # # ][ # # ]: 0 : if ( aNewY < aFrac20 )
441 [ # # ]: 0 : aNewY = aFrac20;
442 [ # # ][ # # ]: 0 : if ( aNewY > aFrac400 )
443 [ # # ]: 0 : aNewY = aFrac400;
444 : :
445 [ # # ]: 0 : GetViewData()->UpdateScreenZoom( aNewX, aNewY );
446 [ # # ]: 0 : SetZoom( aNewX, aNewY, sal_True );
447 : :
448 [ # # ]: 0 : PaintGrid();
449 [ # # ]: 0 : PaintTop();
450 [ # # ]: 0 : PaintLeft();
451 : :
452 [ # # ]: 0 : SfxViewShell::SetZoomFactor( rZoomX, rZoomY );
453 : 0 : }
454 : :
455 : 0 : void ScTabViewShell::QueryObjAreaPixel( Rectangle& rRect ) const
456 : : {
457 : : // auf ganze Zellen anpassen (in 1/100 mm)
458 : :
459 [ # # ]: 0 : Size aPixelSize = rRect.GetSize();
460 [ # # ]: 0 : Window* pWin = ((ScTabViewShell*)this)->GetActiveWin();
461 [ # # ]: 0 : Size aLogicSize = pWin->PixelToLogic( aPixelSize );
462 : :
463 : 0 : const ScViewData* pViewData = GetViewData();
464 [ # # ]: 0 : ScDocument* pDoc = pViewData->GetDocument();
465 : 0 : ScSplitPos ePos = pViewData->GetActivePart();
466 : 0 : SCCOL nCol = pViewData->GetPosX(WhichH(ePos));
467 : 0 : SCROW nRow = pViewData->GetPosY(WhichV(ePos));
468 : 0 : SCTAB nTab = pViewData->GetTabNo();
469 [ # # ]: 0 : sal_Bool bNegativePage = pDoc->IsNegativePage( nTab );
470 : :
471 [ # # ]: 0 : Rectangle aLogicRect = pDoc->GetMMRect( nCol, nRow, nCol, nRow, nTab );
472 [ # # ]: 0 : if ( bNegativePage )
473 : : {
474 : : // use right edge of aLogicRect, and aLogicSize
475 : 0 : aLogicRect.Left() = aLogicRect.Right() - aLogicSize.Width() + 1; // Right() is set below
476 : : }
477 [ # # ]: 0 : aLogicRect.SetSize( aLogicSize );
478 : :
479 [ # # ]: 0 : pDoc->SnapVisArea( aLogicRect );
480 : :
481 [ # # ][ # # ]: 0 : rRect.SetSize( pWin->LogicToPixel( aLogicRect.GetSize() ) );
[ # # ]
482 : 0 : }
483 : :
484 : : //------------------------------------------------------------------
485 : :
486 : 524 : void ScTabViewShell::Move()
487 : : {
488 [ + - ][ + - ]: 524 : Point aNewPos = GetViewFrame()->GetWindow().OutputToScreenPixel(Point());
489 : :
490 [ + + ]: 524 : if (aNewPos != aWinPos)
491 : : {
492 [ + - ]: 458 : StopMarking();
493 : 458 : aWinPos = aNewPos;
494 : : }
495 : 524 : }
496 : :
497 : : //------------------------------------------------------------------
498 : :
499 : 8 : void ScTabViewShell::ShowCursor(bool /* bOn */)
500 : : {
501 : : /*!!! ShowCursor wird nicht paarweise wie im gridwin gerufen.
502 : : Der CursorLockCount am Gridwin muss hier direkt auf 0 gesetzt werden
503 : :
504 : : if (bOn)
505 : : ShowAllCursors();
506 : : else
507 : : HideAllCursors();
508 : : */
509 : 8 : }
510 : :
511 : : //------------------------------------------------------------------
512 : :
513 : 2 : void ScTabViewShell::WriteUserData(String& rData, sal_Bool /* bBrowse */)
514 : : {
515 : 2 : GetViewData()->WriteUserData(rData);
516 : 2 : }
517 : :
518 : 219 : void ScTabViewShell::WriteUserDataSequence (uno::Sequence < beans::PropertyValue >& rSettings, sal_Bool /* bBrowse */ )
519 : : {
520 : 219 : GetViewData()->WriteUserDataSequence (rSettings);
521 : 219 : }
522 : :
523 : 0 : void ScTabViewShell::ReadUserData(const String& rData, sal_Bool /* bBrowse */)
524 : : {
525 [ # # ]: 0 : if ( !GetViewData()->GetDocShell()->IsPreview() )
526 : 0 : DoReadUserData( rData );
527 : 0 : }
528 : :
529 : 229 : void ScTabViewShell::ReadUserDataSequence (const uno::Sequence < beans::PropertyValue >& rSettings, sal_Bool /* bBrowse */ )
530 : : {
531 [ + - ]: 229 : if ( !GetViewData()->GetDocShell()->IsPreview() )
532 : 229 : DoReadUserDataSequence( rSettings );
533 : 229 : }
534 : :
535 : 229 : void ScTabViewShell::DoReadUserDataSequence( const uno::Sequence < beans::PropertyValue >& rSettings )
536 : : {
537 : 229 : Window* pOldWin = GetActiveWin();
538 [ + + ][ + - ]: 229 : sal_Bool bFocus = pOldWin && pOldWin->HasFocus();
539 : :
540 : 229 : GetViewData()->ReadUserDataSequence(rSettings);
541 : 229 : SetTabNo( GetViewData()->GetTabNo(), sal_True );
542 : :
543 [ - + ]: 229 : if ( GetViewData()->IsPagebreakMode() )
544 : 0 : SetCurSubShell( GetCurObjectSelectionType(), sal_True );
545 : :
546 : 229 : Window* pNewWin = GetActiveWin();
547 [ - + ][ + - ]: 229 : if (pNewWin && pNewWin != pOldWin)
548 : : {
549 : 0 : SetWindow( pNewWin ); //! ist diese ViewShell immer aktiv???
550 [ # # ]: 0 : if (bFocus)
551 : 0 : pNewWin->GrabFocus();
552 : 0 : WindowChanged(); // Drawing-Layer (z.B. #56771#)
553 : : }
554 : :
555 [ + - - + ]: 458 : if (GetViewData()->GetHSplitMode() == SC_SPLIT_FIX ||
[ - + ]
556 : 229 : GetViewData()->GetVSplitMode() == SC_SPLIT_FIX)
557 : : {
558 : 0 : InvalidateSplit();
559 : : }
560 : :
561 : 229 : ZoomChanged();
562 : :
563 : 229 : TestHintWindow();
564 : :
565 : : //! if ViewData has more tables than document, remove tables in ViewData
566 : 229 : }
567 : :
568 : : // DoReadUserData is also called from ctor when switching from print preview
569 : :
570 : 0 : void ScTabViewShell::DoReadUserData( const String& rData )
571 : : {
572 : 0 : Window* pOldWin = GetActiveWin();
573 [ # # ][ # # ]: 0 : sal_Bool bFocus = pOldWin && pOldWin->HasFocus();
574 : :
575 : 0 : GetViewData()->ReadUserData(rData);
576 : 0 : SetTabNo( GetViewData()->GetTabNo(), sal_True );
577 : :
578 [ # # ]: 0 : if ( GetViewData()->IsPagebreakMode() )
579 : 0 : SetCurSubShell( GetCurObjectSelectionType(), sal_True );
580 : :
581 : 0 : Window* pNewWin = GetActiveWin();
582 [ # # ][ # # ]: 0 : if (pNewWin && pNewWin != pOldWin)
583 : : {
584 : 0 : SetWindow( pNewWin ); //! ist diese ViewShell immer aktiv???
585 [ # # ]: 0 : if (bFocus)
586 : 0 : pNewWin->GrabFocus();
587 : 0 : WindowChanged(); // Drawing-Layer (z.B. #56771#)
588 : : }
589 : :
590 [ # # # # ]: 0 : if (GetViewData()->GetHSplitMode() == SC_SPLIT_FIX ||
[ # # ]
591 : 0 : GetViewData()->GetVSplitMode() == SC_SPLIT_FIX)
592 : : {
593 : 0 : InvalidateSplit();
594 : : }
595 : :
596 : 0 : ZoomChanged();
597 : :
598 : 0 : TestHintWindow();
599 : :
600 : : //! if ViewData has more tables than document, remove tables in ViewData
601 : 0 : }
602 : :
603 : : //------------------------------------------------------------------
604 : :
605 : 0 : void ScTabViewShell::UpdateDrawShell()
606 : : {
607 : : // Called after user interaction that may delete the selected drawing object.
608 : : // Remove DrawShell if nothing is selected.
609 : :
610 : 0 : SdrView* pDrView = GetSdrView();
611 [ # # ][ # # ]: 0 : if ( pDrView && !pDrView->AreObjectsMarked() && !IsDrawSelMode() )
[ # # ][ # # ]
612 : 0 : SetDrawShell( false );
613 : 0 : }
614 : :
615 : 0 : void ScTabViewShell::SetDrawShellOrSub()
616 : : {
617 : 0 : bActiveDrawSh = sal_True;
618 : :
619 [ # # ]: 0 : if(bActiveDrawFormSh)
620 : : {
621 : 0 : SetCurSubShell(OST_DrawForm);
622 : : }
623 [ # # ]: 0 : else if(bActiveGraphicSh)
624 : : {
625 : 0 : SetCurSubShell(OST_Graphic);
626 : : }
627 [ # # ]: 0 : else if(bActiveMediaSh)
628 : : {
629 : 0 : SetCurSubShell(OST_Media);
630 : : }
631 [ # # ]: 0 : else if(bActiveChartSh)
632 : : {
633 : 0 : SetCurSubShell(OST_Chart);
634 : : }
635 [ # # ]: 0 : else if(bActiveOleObjectSh)
636 : : {
637 : 0 : SetCurSubShell(OST_OleObject);
638 : : }
639 : : else
640 : : {
641 : : SetCurSubShell(OST_Drawing, true /* force: different toolbars are
642 : : visible concerning shape type
643 : 0 : and shape state */);
644 : : }
645 : 0 : }
646 : :
647 : 607 : void ScTabViewShell::SetDrawShell( sal_Bool bActive )
648 : : {
649 [ - + ]: 607 : if(bActive)
650 : : {
651 : : SetCurSubShell(OST_Drawing, true /* force: different toolbars are
652 : : visible concerning shape type
653 : 0 : and shape state */);
654 : : }
655 : : else
656 : : {
657 [ + - ][ + - ]: 607 : if(bActiveDrawFormSh || bActiveDrawSh ||
[ + - ][ + - ]
[ + - ][ + - ]
[ - + ]
658 : : bActiveGraphicSh || bActiveMediaSh || bActiveOleObjectSh||
659 : : bActiveChartSh || bActiveDrawTextSh)
660 : : {
661 : 0 : SetCurSubShell(OST_Cell);
662 : : }
663 : 607 : bActiveDrawFormSh=false;
664 : 607 : bActiveGraphicSh=false;
665 : 607 : bActiveMediaSh=false;
666 : 607 : bActiveOleObjectSh=false;
667 : 607 : bActiveChartSh=false;
668 : : }
669 : :
670 [ + - ][ - + ]: 607 : sal_Bool bWasDraw = bActiveDrawSh || bActiveDrawTextSh;
671 : :
672 : 607 : bActiveDrawSh = bActive;
673 : 607 : bActiveDrawTextSh = false;
674 : :
675 [ + - ]: 607 : if ( !bActive )
676 : : {
677 : 607 : ResetDrawDragMode(); // Mirror / Rotate aus
678 : :
679 [ # # # # ]: 607 : if (bWasDraw && (GetViewData()->GetHSplitMode() == SC_SPLIT_FIX ||
[ - + ][ - + ]
680 : 0 : GetViewData()->GetVSplitMode() == SC_SPLIT_FIX))
681 : : {
682 : : // Aktiven Teil an Cursor anpassen, etc.
683 : 0 : MoveCursorAbs( GetViewData()->GetCurX(), GetViewData()->GetCurY(),
684 : 0 : SC_FOLLOW_NONE, false, false, sal_True );
685 : : }
686 : : }
687 : 607 : }
688 : :
689 : 0 : void ScTabViewShell::SetDrawTextShell( sal_Bool bActive )
690 : : {
691 : 0 : bActiveDrawTextSh = bActive;
692 [ # # ]: 0 : if ( bActive )
693 : : {
694 : 0 : bActiveDrawFormSh=false;
695 : 0 : bActiveGraphicSh=false;
696 : 0 : bActiveMediaSh=false;
697 : 0 : bActiveOleObjectSh=false;
698 : 0 : bActiveChartSh=false;
699 : 0 : bActiveDrawSh = false;
700 : 0 : SetCurSubShell(OST_DrawText);
701 : : }
702 : : else
703 : 0 : SetCurSubShell(OST_Cell);
704 : :
705 : 0 : }
706 : :
707 : 306 : void ScTabViewShell::SetPivotShell( sal_Bool bActive )
708 : : {
709 : 306 : bActivePivotSh = bActive;
710 : :
711 : : // SetPivotShell is called from CursorPosChanged every time
712 : : // -> don't change anything except switching between cell and pivot shell
713 : :
714 [ + - ][ + - ]: 306 : if ( eCurOST == OST_Pivot || eCurOST == OST_Cell )
715 : : {
716 [ + + ]: 306 : if ( bActive )
717 : : {
718 : 2 : bActiveDrawTextSh = bActiveDrawSh = false;
719 : 2 : bActiveDrawFormSh=false;
720 : 2 : bActiveGraphicSh=false;
721 : 2 : bActiveMediaSh=false;
722 : 2 : bActiveOleObjectSh=false;
723 : 2 : bActiveChartSh=false;
724 : 2 : SetCurSubShell(OST_Pivot);
725 : : }
726 : : else
727 : 304 : SetCurSubShell(OST_Cell);
728 : : }
729 : 306 : }
730 : :
731 : 0 : void ScTabViewShell::SetAuditShell( sal_Bool bActive )
732 : : {
733 : 0 : bActiveAuditingSh = bActive;
734 [ # # ]: 0 : if ( bActive )
735 : : {
736 : 0 : bActiveDrawTextSh = bActiveDrawSh = false;
737 : 0 : bActiveDrawFormSh=false;
738 : 0 : bActiveGraphicSh=false;
739 : 0 : bActiveMediaSh=false;
740 : 0 : bActiveOleObjectSh=false;
741 : 0 : bActiveChartSh=false;
742 : 0 : SetCurSubShell(OST_Auditing);
743 : : }
744 : : else
745 : 0 : SetCurSubShell(OST_Cell);
746 : 0 : }
747 : :
748 : 0 : void ScTabViewShell::SetDrawFormShell( sal_Bool bActive )
749 : : {
750 : 0 : bActiveDrawFormSh = bActive;
751 : :
752 [ # # ]: 0 : if(bActiveDrawFormSh)
753 : 0 : SetCurSubShell(OST_DrawForm);
754 : 0 : }
755 : 0 : void ScTabViewShell::SetChartShell( sal_Bool bActive )
756 : : {
757 : 0 : bActiveChartSh = bActive;
758 : :
759 [ # # ]: 0 : if(bActiveChartSh)
760 : 0 : SetCurSubShell(OST_Chart);
761 : 0 : }
762 : :
763 : 0 : void ScTabViewShell::SetGraphicShell( sal_Bool bActive )
764 : : {
765 : 0 : bActiveGraphicSh = bActive;
766 : :
767 [ # # ]: 0 : if(bActiveGraphicSh)
768 : 0 : SetCurSubShell(OST_Graphic);
769 : 0 : }
770 : :
771 : 0 : void ScTabViewShell::SetMediaShell( sal_Bool bActive )
772 : : {
773 : 0 : bActiveMediaSh = bActive;
774 : :
775 [ # # ]: 0 : if(bActiveMediaSh)
776 : 0 : SetCurSubShell(OST_Media);
777 : 0 : }
778 : :
779 : 0 : void ScTabViewShell::SetOleObjectShell( sal_Bool bActive )
780 : : {
781 : 0 : bActiveOleObjectSh = bActive;
782 : :
783 [ # # ]: 0 : if(bActiveOleObjectSh)
784 : 0 : SetCurSubShell(OST_OleObject);
785 : : else
786 : 0 : SetCurSubShell(OST_Cell);
787 : 0 : }
788 : :
789 : 0 : void ScTabViewShell::SetEditShell(EditView* pView, sal_Bool bActive )
790 : : {
791 [ # # ]: 0 : if(bActive)
792 : : {
793 [ # # ]: 0 : if (pEditShell)
794 : 0 : pEditShell->SetEditView( pView );
795 : : else
796 [ # # ]: 0 : pEditShell = new ScEditShell( pView, GetViewData() );
797 : :
798 : 0 : SetCurSubShell(OST_Editing);
799 : : }
800 [ # # ]: 0 : else if(bActiveEditSh)
801 : : {
802 : 0 : SetCurSubShell(OST_Cell);
803 : : }
804 : 0 : bActiveEditSh = bActive;
805 : 0 : }
806 : :
807 : 535 : void ScTabViewShell::SetCurSubShell(ObjectSelectionType eOST, sal_Bool bForce)
808 : : {
809 : 535 : ScViewData* pViewData = GetViewData();
810 : 535 : ScDocShell* pDocSh = pViewData->GetDocShell();
811 : :
812 [ - + ]: 1070 : if(bDontSwitch) return;
813 : :
814 [ + + ]: 535 : if(!pCellShell) //Wird eh immer gebraucht.
815 : : {
816 [ + - ]: 229 : pCellShell = new ScCellShell( GetViewData() );
817 : 229 : pCellShell->SetRepeatTarget( &aTarget );
818 : : }
819 : :
820 : 535 : sal_Bool bPgBrk=pViewData->IsPagebreakMode();
821 : :
822 [ # # ][ - + ]: 535 : if(bPgBrk && !pPageBreakShell)
823 : : {
824 [ # # ]: 0 : pPageBreakShell = new ScPageBreakShell( this );
825 : 0 : pPageBreakShell->SetRepeatTarget( &aTarget );
826 : : }
827 : :
828 : :
829 [ + + ][ - + ]: 535 : if ( eOST!=eCurOST || bForce )
830 : : {
831 : 231 : sal_Bool bCellBrush = false; // "format paint brush" allowed for cells
832 : 231 : sal_Bool bDrawBrush = false; // "format paint brush" allowed for drawing objects
833 : :
834 [ + + ]: 231 : if(eCurOST!=OST_NONE) RemoveSubShell();
835 : :
836 [ + - ][ + - ]: 231 : if (pFormShell && !bFormShellAtTop)
837 : 231 : AddSubShell(*pFormShell); // add below own subshells
838 : :
839 [ + - - - : 231 : switch(eOST)
- - - - -
+ - - ]
840 : : {
841 : : case OST_Cell:
842 : : {
843 : 229 : AddSubShell(*pCellShell);
844 [ - + ]: 229 : if(bPgBrk) AddSubShell(*pPageBreakShell);
845 : 229 : bCellBrush = sal_True;
846 : : }
847 : 229 : break;
848 : : case OST_Editing:
849 : : {
850 : 0 : AddSubShell(*pCellShell);
851 [ # # ]: 0 : if(bPgBrk) AddSubShell(*pPageBreakShell);
852 : :
853 [ # # ]: 0 : if(pEditShell)
854 : : {
855 : 0 : AddSubShell(*pEditShell);
856 : : }
857 : : }
858 : 0 : break;
859 : : case OST_DrawText:
860 : : {
861 [ # # ]: 0 : if ( !pDrawTextShell )
862 : : {
863 : 0 : pDocSh->MakeDrawLayer();
864 [ # # ]: 0 : pDrawTextShell = new ScDrawTextObjectBar( GetViewData() );
865 : : }
866 : 0 : AddSubShell(*pDrawTextShell);
867 : : }
868 : 0 : break;
869 : : case OST_Drawing:
870 : : {
871 [ # # ][ # # ]: 0 : if (svx::checkForSelectedCustomShapes(
872 : 0 : GetScDrawView(), true /* bOnlyExtruded */ )) {
873 [ # # ]: 0 : if (pExtrusionBarShell == 0)
874 [ # # ][ # # ]: 0 : pExtrusionBarShell = new svx::ExtrusionBar(this);
875 [ # # ]: 0 : AddSubShell( *pExtrusionBarShell );
876 : : }
877 : 0 : sal_uInt32 nCheckStatus = 0;
878 [ # # ][ # # ]: 0 : if (svx::checkForSelectedFontWork(
879 : 0 : GetScDrawView(), nCheckStatus )) {
880 [ # # ]: 0 : if (pFontworkBarShell == 0)
881 [ # # ][ # # ]: 0 : pFontworkBarShell = new svx::FontworkBar(this);
882 [ # # ]: 0 : AddSubShell( *pFontworkBarShell );
883 : : }
884 : :
885 [ # # ]: 0 : if ( !pDrawShell )
886 : : {
887 [ # # ]: 0 : pDocSh->MakeDrawLayer();
888 [ # # ][ # # ]: 0 : pDrawShell = new ScDrawShell( GetViewData() );
889 [ # # ]: 0 : pDrawShell->SetRepeatTarget( &aTarget );
890 : : }
891 [ # # ]: 0 : AddSubShell(*pDrawShell);
892 : 0 : bDrawBrush = sal_True;
893 : : }
894 : 0 : break;
895 : :
896 : : case OST_DrawForm:
897 : : {
898 [ # # ]: 0 : if ( !pDrawFormShell )
899 : : {
900 : 0 : pDocSh->MakeDrawLayer();
901 [ # # ]: 0 : pDrawFormShell = new ScDrawFormShell( GetViewData() );
902 : 0 : pDrawFormShell->SetRepeatTarget( &aTarget );
903 : : }
904 : 0 : AddSubShell(*pDrawFormShell);
905 : 0 : bDrawBrush = sal_True;
906 : : }
907 : 0 : break;
908 : :
909 : : case OST_Chart:
910 : : {
911 [ # # ]: 0 : if ( !pChartShell )
912 : : {
913 : 0 : pDocSh->MakeDrawLayer();
914 [ # # ]: 0 : pChartShell = new ScChartShell( GetViewData() );
915 : 0 : pChartShell->SetRepeatTarget( &aTarget );
916 : : }
917 : 0 : AddSubShell(*pChartShell);
918 : 0 : bDrawBrush = sal_True;
919 : : }
920 : 0 : break;
921 : :
922 : : case OST_OleObject:
923 : : {
924 [ # # ]: 0 : if ( !pOleObjectShell )
925 : : {
926 : 0 : pDocSh->MakeDrawLayer();
927 [ # # ]: 0 : pOleObjectShell = new ScOleObjectShell( GetViewData() );
928 : 0 : pOleObjectShell->SetRepeatTarget( &aTarget );
929 : : }
930 : 0 : AddSubShell(*pOleObjectShell);
931 : 0 : bDrawBrush = sal_True;
932 : : }
933 : 0 : break;
934 : :
935 : : case OST_Graphic:
936 : : {
937 [ # # ]: 0 : if ( !pGraphicShell)
938 : : {
939 : 0 : pDocSh->MakeDrawLayer();
940 [ # # ]: 0 : pGraphicShell = new ScGraphicShell( GetViewData() );
941 : 0 : pGraphicShell->SetRepeatTarget( &aTarget );
942 : : }
943 : 0 : AddSubShell(*pGraphicShell);
944 : 0 : bDrawBrush = sal_True;
945 : : }
946 : 0 : break;
947 : :
948 : : case OST_Media:
949 : : {
950 [ # # ]: 0 : if ( !pMediaShell)
951 : : {
952 : 0 : pDocSh->MakeDrawLayer();
953 [ # # ]: 0 : pMediaShell = new ScMediaShell( GetViewData() );
954 : 0 : pMediaShell->SetRepeatTarget( &aTarget );
955 : : }
956 : 0 : AddSubShell(*pMediaShell);
957 : : }
958 : 0 : break;
959 : :
960 : : case OST_Pivot:
961 : : {
962 : 2 : AddSubShell(*pCellShell);
963 [ - + ]: 2 : if(bPgBrk) AddSubShell(*pPageBreakShell);
964 : :
965 [ + - ]: 2 : if ( !pPivotShell )
966 : : {
967 [ + - ]: 2 : pPivotShell = new ScPivotShell( this );
968 : 2 : pPivotShell->SetRepeatTarget( &aTarget );
969 : : }
970 : 2 : AddSubShell(*pPivotShell);
971 : 2 : bCellBrush = sal_True;
972 : : }
973 : 2 : break;
974 : : case OST_Auditing:
975 : : {
976 : 0 : AddSubShell(*pCellShell);
977 [ # # ]: 0 : if(bPgBrk) AddSubShell(*pPageBreakShell);
978 : :
979 [ # # ]: 0 : if ( !pAuditingShell )
980 : : {
981 : 0 : pDocSh->MakeDrawLayer(); // die Wartezeit lieber jetzt als beim Klick
982 : :
983 [ # # ]: 0 : pAuditingShell = new ScAuditingShell( GetViewData() );
984 : 0 : pAuditingShell->SetRepeatTarget( &aTarget );
985 : : }
986 : 0 : AddSubShell(*pAuditingShell);
987 : 0 : bCellBrush = sal_True;
988 : : }
989 : 0 : break;
990 : : default:
991 : : OSL_FAIL("Falsche Shell angefordert");
992 : 0 : break;
993 : : }
994 : :
995 [ + - ][ - + ]: 231 : if (pFormShell && bFormShellAtTop)
996 : 0 : AddSubShell(*pFormShell); // add on top of own subshells
997 : :
998 : 231 : eCurOST=eOST;
999 : :
1000 : : // abort "format paint brush" when switching to an incompatible shell
1001 [ - + ][ # # ]: 231 : if ( ( GetBrushDocument() && !bCellBrush ) || ( GetDrawBrushSet() && !bDrawBrush ) )
[ - + ][ # # ]
[ - + ]
1002 : 0 : ResetBrushDocument();
1003 : : }
1004 : : }
1005 : :
1006 : 223 : void ScTabViewShell::SetFormShellAtTop( sal_Bool bSet )
1007 : : {
1008 [ + - ][ + - ]: 223 : if ( pFormShell && !bSet )
1009 : 223 : pFormShell->ForgetActiveControl(); // let the FormShell know it no longer has the focus
1010 : :
1011 [ - + ]: 223 : if ( bFormShellAtTop != bSet )
1012 : : {
1013 : 0 : bFormShellAtTop = bSet;
1014 : 0 : SetCurSubShell( GetCurObjectSelectionType(), sal_True );
1015 : : }
1016 : 223 : }
1017 : :
1018 : 0 : IMPL_LINK_NOARG(ScTabViewShell, FormControlActivated)
1019 : : {
1020 : : // a form control got the focus, so the form shell has to be on top
1021 : 0 : SetFormShellAtTop( sal_True );
1022 : 0 : return 0;
1023 : : }
1024 : :
1025 : 0 : ObjectSelectionType ScTabViewShell::GetCurObjectSelectionType()
1026 : : {
1027 : 0 : return eCurOST;
1028 : : }
1029 : :
1030 : : // GetMySubShell / SetMySubShell: altes Verhalten simulieren,
1031 : : // dass es nur eine SubShell gibt (nur innerhalb der 5 eignenen SubShells)
1032 : :
1033 : 0 : SfxShell* ScTabViewShell::GetMySubShell() const
1034 : : {
1035 : : // GetSubShell() war frueher const, und GetSubShell(sal_uInt16) sollte es auch sein...
1036 : :
1037 : 0 : sal_uInt16 nPos = 0;
1038 : 0 : SfxShell* pSub = ((ScTabViewShell*)this)->GetSubShell(nPos);
1039 [ # # ]: 0 : while (pSub)
1040 : : {
1041 [ # # ][ # # ]: 0 : if ( pSub == pDrawShell || pSub == pDrawTextShell || pSub == pEditShell ||
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
1042 : : pSub == pPivotShell || pSub == pAuditingShell || pSub == pDrawFormShell ||
1043 : : pSub == pCellShell || pSub == pOleObjectShell|| pSub == pChartShell ||
1044 : : pSub == pGraphicShell || pSub == pMediaShell || pSub == pPageBreakShell)
1045 : 0 : return pSub; // gefunden
1046 : :
1047 : 0 : pSub = ((ScTabViewShell*)this)->GetSubShell(++nPos);
1048 : : }
1049 : 0 : return NULL; // keine von meinen dabei
1050 : : }
1051 : :
1052 : :
1053 : 1040 : sal_Bool ScTabViewShell::IsDrawTextShell() const
1054 : : {
1055 [ - + ][ # # ]: 1040 : return ( pDrawTextShell && ( GetMySubShell() == pDrawTextShell ) );
1056 : : }
1057 : :
1058 : 0 : sal_Bool ScTabViewShell::IsAuditShell() const
1059 : : {
1060 [ # # ][ # # ]: 0 : return ( pAuditingShell && ( GetMySubShell() == pAuditingShell ) );
1061 : : }
1062 : :
1063 : 0 : void ScTabViewShell::SetDrawTextUndo( ::svl::IUndoManager* pNewUndoMgr )
1064 : : {
1065 : : // Default: Undo-Manager der DocShell
1066 [ # # ]: 0 : if (!pNewUndoMgr)
1067 : 0 : pNewUndoMgr = GetViewData()->GetDocShell()->GetUndoManager();
1068 : :
1069 [ # # ]: 0 : if (pDrawTextShell)
1070 : : {
1071 : 0 : pDrawTextShell->SetUndoManager(pNewUndoMgr);
1072 : 0 : ScDocShell* pDocSh = GetViewData()->GetDocShell();
1073 [ # # ]: 0 : if ( pNewUndoMgr == pDocSh->GetUndoManager() &&
[ # # # # ]
1074 : 0 : !pDocSh->GetDocument()->IsUndoEnabled() )
1075 : : {
1076 : 0 : pNewUndoMgr->SetMaxUndoActionCount( 0 );
1077 : : }
1078 : : }
1079 : : else
1080 : : {
1081 : : OSL_FAIL("SetDrawTextUndo ohne DrawTextShell");
1082 : : }
1083 : 0 : }
1084 : :
1085 : : //------------------------------------------------------------------
1086 : :
1087 : 18496 : ScTabViewShell* ScTabViewShell::GetActiveViewShell()
1088 : : {
1089 [ + + ][ + + ]: 18496 : return PTR_CAST(ScTabViewShell,Current());
1090 : : }
1091 : :
1092 : : //------------------------------------------------------------------
1093 : :
1094 : 751 : SfxPrinter* ScTabViewShell::GetPrinter( sal_Bool bCreate )
1095 : : {
1096 : : // Drucker ist immer da (wird fuer die FontListe schon beim Starten angelegt)
1097 : 751 : return GetViewData()->GetDocShell()->GetPrinter(bCreate);
1098 : : }
1099 : :
1100 : 0 : sal_uInt16 ScTabViewShell::SetPrinter( SfxPrinter *pNewPrinter, sal_uInt16 nDiffFlags, bool )
1101 : : {
1102 : 0 : return GetViewData()->GetDocShell()->SetPrinter( pNewPrinter, nDiffFlags );
1103 : : }
1104 : :
1105 : 0 : SfxTabPage* ScTabViewShell::CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions )
1106 : : {
1107 : 0 : ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
1108 : : OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
1109 : 0 : ::CreateTabPage ScTpPrintOptionsCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_PRINT );
1110 [ # # ]: 0 : if ( ScTpPrintOptionsCreate )
1111 : 0 : return (*ScTpPrintOptionsCreate)( pParent, rOptions);
1112 : 0 : return 0;
1113 : : }
1114 : :
1115 : 1315 : void ScTabViewShell::StopEditShell()
1116 : : {
1117 [ - + ][ # # ]: 1315 : if ( pEditShell != NULL && !bDontSwitch )
1118 : 0 : SetEditShell(NULL, false );
1119 : 1315 : }
1120 : :
1121 : : //------------------------------------------------------------------
1122 : :
1123 : : // close handler to ensure function of dialog:
1124 : :
1125 : 0 : IMPL_LINK_NOARG(ScTabViewShell, SimpleRefClose)
1126 : : {
1127 : 0 : SfxInPlaceClient* pClient = GetIPClient();
1128 [ # # ][ # # ]: 0 : if ( pClient && pClient->IsObjectInPlaceActive() )
[ # # ]
1129 : : {
1130 : : // If range selection was started with an active embedded object,
1131 : : // switch back to original sheet (while the dialog is still open).
1132 : :
1133 : 0 : SetTabNo( GetViewData()->GetRefTabNo() );
1134 : : }
1135 : :
1136 : 0 : ScSimpleRefDlgWrapper::SetAutoReOpen( sal_True );
1137 : 0 : return 0;
1138 : : }
1139 : :
1140 : : // handlers to call UNO listeners:
1141 : :
1142 : 0 : ScTabViewObj* lcl_GetViewObj( ScTabViewShell& rShell )
1143 : : {
1144 : 0 : ScTabViewObj* pRet = NULL;
1145 : 0 : SfxViewFrame* pViewFrame = rShell.GetViewFrame();
1146 [ # # ]: 0 : if (pViewFrame)
1147 : : {
1148 [ # # ]: 0 : SfxFrame& rFrame = pViewFrame->GetFrame();
1149 [ # # ]: 0 : uno::Reference<frame::XController> xController = rFrame.GetController();
1150 [ # # ]: 0 : if (xController.is())
1151 [ # # ]: 0 : pRet = ScTabViewObj::getImplementation( xController );
1152 : : }
1153 : 0 : return pRet;
1154 : : }
1155 : :
1156 : 0 : IMPL_LINK( ScTabViewShell, SimpleRefDone, String*, pResult )
1157 : : {
1158 : 0 : ScTabViewObj* pImpObj = lcl_GetViewObj( *this );
1159 [ # # ][ # # ]: 0 : if ( pImpObj && pResult )
1160 : 0 : pImpObj->RangeSelDone( *pResult );
1161 : 0 : return 0;
1162 : : }
1163 : :
1164 : 0 : IMPL_LINK( ScTabViewShell, SimpleRefAborted, String*, pResult )
1165 : : {
1166 : 0 : ScTabViewObj* pImpObj = lcl_GetViewObj( *this );
1167 [ # # ][ # # ]: 0 : if ( pImpObj && pResult )
1168 : 0 : pImpObj->RangeSelAborted( *pResult );
1169 : 0 : return 0;
1170 : : }
1171 : :
1172 : 0 : IMPL_LINK( ScTabViewShell, SimpleRefChange, String*, pResult )
1173 : : {
1174 : 0 : ScTabViewObj* pImpObj = lcl_GetViewObj( *this );
1175 [ # # ][ # # ]: 0 : if ( pImpObj && pResult )
1176 : 0 : pImpObj->RangeSelChanged( *pResult );
1177 : 0 : return 0;
1178 : : }
1179 : :
1180 : 0 : void ScTabViewShell::StartSimpleRefDialog(
1181 : : const String& rTitle, const String& rInitVal,
1182 : : sal_Bool bCloseOnButtonUp, sal_Bool bSingleCell, sal_Bool bMultiSelection )
1183 : : {
1184 : 0 : SfxViewFrame* pViewFrm = GetViewFrame();
1185 : :
1186 [ # # ]: 0 : if ( GetActiveViewShell() != this )
1187 : : {
1188 : : // #i18833# / #i34499# The API method can be called for a view that's not active.
1189 : : // Then the view has to be activated first, the same way as in Execute for SID_CURRENTDOC.
1190 : : // Can't use GrabFocus here, because it needs to take effect immediately.
1191 : :
1192 : 0 : pViewFrm->GetFrame().Appear();
1193 : : }
1194 : :
1195 : 0 : sal_uInt16 nId = ScSimpleRefDlgWrapper::GetChildWindowId();
1196 : :
1197 : 0 : SC_MOD()->SetRefDialog( nId, sal_True, pViewFrm );
1198 : :
1199 : 0 : ScSimpleRefDlgWrapper* pWnd = (ScSimpleRefDlgWrapper*)pViewFrm->GetChildWindow( nId );
1200 [ # # ]: 0 : if (pWnd)
1201 : : {
1202 [ # # ]: 0 : pWnd->SetCloseHdl( LINK( this, ScTabViewShell, SimpleRefClose ) );
1203 : : pWnd->SetUnoLinks( LINK( this, ScTabViewShell, SimpleRefDone ),
1204 : : LINK( this, ScTabViewShell, SimpleRefAborted ),
1205 [ # # ][ # # ]: 0 : LINK( this, ScTabViewShell, SimpleRefChange ) );
[ # # ]
1206 : 0 : pWnd->SetRefString( rInitVal );
1207 : 0 : pWnd->SetFlags( bCloseOnButtonUp, bSingleCell, bMultiSelection );
1208 : 0 : pWnd->SetAutoReOpen( false );
1209 : 0 : Window* pWin = pWnd->GetWindow();
1210 : 0 : pWin->SetText( rTitle );
1211 : 0 : pWnd->StartRefInput();
1212 : : }
1213 : 0 : }
1214 : :
1215 : 0 : void ScTabViewShell::StopSimpleRefDialog()
1216 : : {
1217 : 0 : SfxViewFrame* pViewFrm = GetViewFrame();
1218 : 0 : sal_uInt16 nId = ScSimpleRefDlgWrapper::GetChildWindowId();
1219 : :
1220 : 0 : ScSimpleRefDlgWrapper* pWnd = (ScSimpleRefDlgWrapper*)pViewFrm->GetChildWindow( nId );
1221 [ # # ]: 0 : if (pWnd)
1222 : : {
1223 : 0 : Window* pWin = pWnd->GetWindow();
1224 [ # # ][ # # ]: 0 : if (pWin && pWin->IsSystemWindow())
[ # # ]
1225 : 0 : ((SystemWindow*)pWin)->Close(); // calls abort handler
1226 : : }
1227 : 0 : }
1228 : :
1229 : : //------------------------------------------------------------------
1230 : :
1231 : 0 : sal_Bool ScTabViewShell::TabKeyInput(const KeyEvent& rKEvt)
1232 : : {
1233 [ # # ]: 0 : ScModule* pScMod = SC_MOD();
1234 : :
1235 : 0 : SfxViewFrame* pThisFrame = GetViewFrame();
1236 [ # # ][ # # ]: 0 : if ( pThisFrame->GetChildWindow( SID_OPENDLG_FUNCTION ) )
1237 : 0 : return false;
1238 : :
1239 : 0 : KeyCode aCode = rKEvt.GetKeyCode();
1240 : 0 : sal_Bool bShift = aCode.IsShift();
1241 : 0 : sal_Bool bControl = aCode.IsMod1();
1242 : 0 : sal_Bool bAlt = aCode.IsMod2();
1243 : 0 : sal_uInt16 nCode = aCode.GetCode();
1244 : 0 : sal_Bool bUsed = false;
1245 [ # # ]: 0 : sal_Bool bInPlace = pScMod->IsEditMode(); // Editengine bekommt alles
1246 [ # # ]: 0 : sal_Bool bAnyEdit = pScMod->IsInputMode(); // nur Zeichen & Backspace
1247 [ # # ]: 0 : sal_Bool bDraw = IsDrawTextEdit();
1248 : :
1249 [ # # ]: 0 : HideNoteMarker(); // Notiz-Anzeige
1250 : :
1251 : : // don't do extra HideCursor/ShowCursor calls if EnterHandler will switch to a different sheet
1252 : 0 : sal_Bool bOnRefSheet = ( GetViewData()->GetRefTabNo() == GetViewData()->GetTabNo() );
1253 [ # # ][ # # ]: 0 : sal_Bool bHideCursor = ( ( nCode == KEY_RETURN && bInPlace ) || nCode == KEY_TAB ) && bOnRefSheet;
[ # # ][ # # ]
1254 : :
1255 [ # # ]: 0 : if (bHideCursor)
1256 [ # # ]: 0 : HideAllCursors();
1257 : :
1258 [ # # ]: 0 : ScDocument* pDoc = GetViewData()->GetDocument();
1259 [ # # ]: 0 : if ( pDoc )
1260 [ # # ]: 0 : pDoc->KeyInput( rKEvt ); // TimerDelays etc.
1261 : :
1262 [ # # ]: 0 : if( bInPlace )
1263 : : {
1264 [ # # ]: 0 : bUsed = pScMod->InputKeyEvent( rKEvt ); // Eingabe
1265 [ # # ]: 0 : if( !bUsed )
1266 [ # # ]: 0 : bUsed = sal::static_int_cast<sal_Bool>(SfxViewShell::KeyInput( rKEvt )); // accelerators
1267 : : }
1268 [ # # ]: 0 : else if( bAnyEdit )
1269 : : {
1270 : 0 : sal_Bool bIsType = false;
1271 : 0 : sal_uInt16 nModi = aCode.GetModifier();
1272 : 0 : sal_uInt16 nGroup = aCode.GetGroup();
1273 : :
1274 [ # # ][ # # ]: 0 : if ( nGroup == KEYGROUP_NUM || nGroup == KEYGROUP_ALPHA || nGroup == 0 )
[ # # ]
1275 [ # # ][ # # ]: 0 : if ( !bControl && !bAlt )
1276 : 0 : bIsType = sal_True;
1277 : :
1278 [ # # ]: 0 : if ( nGroup == KEYGROUP_MISC )
1279 [ # # # # ]: 0 : switch ( nCode )
1280 : : {
1281 : : case KEY_RETURN:
1282 [ # # ][ # # ]: 0 : bIsType = bControl && !bAlt; // Control, Shift-Control-Return
1283 [ # # ][ # # ]: 0 : if ( !bIsType && nModi == 0 )
1284 : : {
1285 : : // Will der InputHandler auch ein einfaches Return?
1286 : :
1287 [ # # ]: 0 : ScInputHandler* pHdl = pScMod->GetInputHdl(this);
1288 [ # # ][ # # ]: 0 : bIsType = pHdl && pHdl->TakesReturn();
1289 : : }
1290 : 0 : break;
1291 : : case KEY_SPACE:
1292 [ # # ][ # # ]: 0 : bIsType = !bControl && !bAlt; // ohne Modifier oder Shift-Space
1293 : 0 : break;
1294 : : case KEY_ESCAPE:
1295 : 0 : bIsType = (nModi == 0); // nur ohne Modifier
1296 : 0 : break;
1297 : : default:
1298 : 0 : bIsType = sal_True;
1299 : : }
1300 : :
1301 [ # # ]: 0 : if( bIsType )
1302 [ # # ]: 0 : bUsed = pScMod->InputKeyEvent( rKEvt ); // Eingabe
1303 : :
1304 [ # # ]: 0 : if( !bUsed )
1305 [ # # ]: 0 : bUsed = sal::static_int_cast<sal_Bool>(SfxViewShell::KeyInput( rKEvt )); // accelerators
1306 : :
1307 [ # # ][ # # ]: 0 : if ( !bUsed && !bIsType && nCode != KEY_RETURN ) // Eingabe nochmal hinterher
[ # # ]
1308 [ # # ]: 0 : bUsed = pScMod->InputKeyEvent( rKEvt );
1309 : : }
1310 : : else
1311 : : {
1312 : : // Spezialfall: Copy/Cut bei Mehrfachselektion -> Fehlermeldung
1313 : : // (Slot ist disabled, SfxViewShell::KeyInput wuerde also kommentarlos verschluckt)
1314 [ # # ]: 0 : KeyFuncType eFunc = aCode.GetFunction();
1315 [ # # ]: 0 : if ( eFunc == KEYFUNC_CUT )
1316 : : {
1317 : 0 : ScRange aDummy;
1318 [ # # ]: 0 : ScMarkType eMarkType = GetViewData()->GetSimpleArea( aDummy );
1319 [ # # ][ # # ]: 0 : if ( eMarkType != SC_MARK_SIMPLE &&
1320 [ # # ]: 0 : !(eFunc == KEYFUNC_COPY && eMarkType == SC_MARK_SIMPLE_FILTERED) )
1321 : : {
1322 [ # # ]: 0 : ErrorMessage(STR_NOMULTISELECT);
1323 : 0 : bUsed = sal_True;
1324 : : }
1325 : : }
1326 [ # # ]: 0 : if (!bUsed)
1327 [ # # ]: 0 : bUsed = sal::static_int_cast<sal_Bool>(SfxViewShell::KeyInput( rKEvt )); // accelerators
1328 : :
1329 : : // during inplace editing, some slots are handled by the
1330 : : // container app and are executed during Window::KeyInput.
1331 : : // -> don't pass keys to input handler that would be used there
1332 : : // but should call slots instead.
1333 [ # # ][ # # ]: 0 : sal_Bool bParent = ( GetViewFrame()->GetFrame().IsInPlace() && eFunc != KEYFUNC_DONTKNOW );
[ # # ][ # # ]
1334 : :
1335 [ # # ][ # # ]: 0 : if( !bUsed && !bDraw && nCode != KEY_RETURN && !bParent )
[ # # ][ # # ]
1336 [ # # ]: 0 : bUsed = pScMod->InputKeyEvent( rKEvt, sal_True ); // Eingabe
1337 : : }
1338 : :
1339 [ # # ][ # # ]: 0 : if (!bInPlace && !bUsed && !bDraw)
[ # # ]
1340 : : {
1341 [ # # ]: 0 : switch (nCode)
1342 : : {
1343 : : case KEY_RETURN:
1344 : : {
1345 [ # # ][ # # ]: 0 : sal_Bool bNormal = !bControl && !bAlt;
1346 [ # # ][ # # ]: 0 : if ( !bAnyEdit && bNormal )
1347 : : {
1348 : : // je nach Optionen mit Enter in den Edit-Modus schalten
1349 : :
1350 [ # # ]: 0 : const ScInputOptions& rOpt = pScMod->GetInputOptions();
1351 [ # # ]: 0 : if ( rOpt.GetEnterEdit() )
1352 : : {
1353 [ # # ]: 0 : pScMod->SetInputMode( SC_INPUT_TABLE );
1354 : 0 : bUsed = sal_True;
1355 : : }
1356 : : }
1357 : :
1358 [ # # ][ # # ]: 0 : sal_Bool bEditReturn = bControl && !bShift; // An Edit-Engine weiter
1359 [ # # ][ # # ]: 0 : if ( !bUsed && !bEditReturn )
1360 : : {
1361 [ # # ]: 0 : if ( bOnRefSheet )
1362 [ # # ]: 0 : HideAllCursors();
1363 : :
1364 : 0 : sal_uInt8 nMode = SC_ENTER_NORMAL;
1365 [ # # ][ # # ]: 0 : if ( bShift && bControl )
1366 : 0 : nMode = SC_ENTER_MATRIX;
1367 [ # # ]: 0 : else if ( bAlt )
1368 : 0 : nMode = SC_ENTER_BLOCK;
1369 [ # # ]: 0 : pScMod->InputEnterHandler(nMode);
1370 : :
1371 [ # # ]: 0 : if (nMode == SC_ENTER_NORMAL)
1372 : : {
1373 [ # # ]: 0 : if( bShift )
1374 [ # # ]: 0 : GetViewData()->GetDispatcher().Execute( SID_CURSORENTERUP,
1375 [ # # ]: 0 : SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD );
1376 : : else
1377 [ # # ]: 0 : GetViewData()->GetDispatcher().Execute( SID_CURSORENTERDOWN,
1378 [ # # ]: 0 : SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD );
1379 : : }
1380 : : else
1381 [ # # ]: 0 : UpdateInputHandler(sal_True);
1382 : :
1383 [ # # ]: 0 : if ( bOnRefSheet )
1384 [ # # ]: 0 : ShowAllCursors();
1385 : :
1386 : : // hier kein UpdateInputHandler, weil bei Referenzeingabe auf ein
1387 : : // anderes Dokument diese ViewShell nicht die ist, auf der eingegeben
1388 : : // wird!
1389 : :
1390 : 0 : bUsed = sal_True;
1391 : : }
1392 : : }
1393 : 0 : break;
1394 : : }
1395 : : }
1396 : :
1397 : : // Alt-Cursortasten hart codiert, weil Alt nicht konfigurierbar ist
1398 : :
1399 [ # # ][ # # ]: 0 : if ( !bUsed && bAlt && !bControl )
[ # # ]
1400 : : {
1401 : 0 : sal_uInt16 nSlotId = 0;
1402 [ # # # # : 0 : switch (nCode)
# # # ]
1403 : : {
1404 : : case KEY_UP:
1405 [ # # ]: 0 : ModifyCellSize( DIR_TOP, bShift );
1406 : 0 : bUsed = sal_True;
1407 : 0 : break;
1408 : : case KEY_DOWN:
1409 [ # # ]: 0 : ModifyCellSize( DIR_BOTTOM, bShift );
1410 : 0 : bUsed = sal_True;
1411 : 0 : break;
1412 : : case KEY_LEFT:
1413 [ # # ]: 0 : ModifyCellSize( DIR_LEFT, bShift );
1414 : 0 : bUsed = sal_True;
1415 : 0 : break;
1416 : : case KEY_RIGHT:
1417 [ # # ]: 0 : ModifyCellSize( DIR_RIGHT, bShift );
1418 : 0 : bUsed = sal_True;
1419 : 0 : break;
1420 : : case KEY_PAGEUP:
1421 [ # # ]: 0 : nSlotId = bShift ? SID_CURSORPAGELEFT_SEL : SID_CURSORPAGELEFT_;
1422 : 0 : break;
1423 : : case KEY_PAGEDOWN:
1424 [ # # ]: 0 : nSlotId = bShift ? SID_CURSORPAGERIGHT_SEL : SID_CURSORPAGERIGHT_;
1425 : 0 : break;
1426 : : }
1427 [ # # ]: 0 : if ( nSlotId )
1428 : : {
1429 [ # # ][ # # ]: 0 : GetViewData()->GetDispatcher().Execute( nSlotId, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD );
1430 : 0 : bUsed = sal_True;
1431 : : }
1432 : : }
1433 : :
1434 [ # # ]: 0 : if (bHideCursor)
1435 [ # # ]: 0 : ShowAllCursors();
1436 : :
1437 : 0 : return bUsed;
1438 : : }
1439 : :
1440 : 0 : sal_Bool ScTabViewShell::SfxKeyInput(const KeyEvent& rKeyEvent)
1441 : : {
1442 : 0 : return sal::static_int_cast<sal_Bool>(SfxViewShell::KeyInput( rKeyEvent ));
1443 : : }
1444 : :
1445 : 0 : bool ScTabViewShell::KeyInput( const KeyEvent &rKeyEvent )
1446 : : {
1447 : 0 : return TabKeyInput( rKeyEvent );
1448 : : }
1449 : :
1450 : : //------------------------------------------------------------------
1451 : :
1452 : : #define __INIT_ScTabViewShell \
1453 : : eCurOST(OST_NONE), \
1454 : : nDrawSfxId(0), \
1455 : : nCtrlSfxId(USHRT_MAX), \
1456 : : nFormSfxId(USHRT_MAX), \
1457 : : pDrawShell(NULL), \
1458 : : pDrawTextShell(NULL), \
1459 : : pEditShell(NULL), \
1460 : : pPivotShell(NULL), \
1461 : : pAuditingShell(NULL), \
1462 : : pDrawFormShell(NULL), \
1463 : : pCellShell(NULL), \
1464 : : pOleObjectShell(NULL), \
1465 : : pChartShell(NULL), \
1466 : : pGraphicShell(NULL), \
1467 : : pMediaShell(NULL), \
1468 : : pPageBreakShell(NULL), \
1469 : : pExtrusionBarShell(NULL), \
1470 : : pFontworkBarShell(NULL), \
1471 : : pFormShell(NULL), \
1472 : : pInputHandler(NULL), \
1473 : : pCurFrameLine(NULL), \
1474 : : aTarget( this ), \
1475 : : pDialogDPObject(NULL), \
1476 : : pNavSettings(NULL), \
1477 : : bActiveDrawSh(false), \
1478 : : bActiveDrawTextSh(false), \
1479 : : bActivePivotSh(false), \
1480 : : bActiveAuditingSh(false), \
1481 : : bActiveDrawFormSh(false), \
1482 : : bActiveOleObjectSh(false), \
1483 : : bActiveChartSh(false), \
1484 : : bActiveGraphicSh(false), \
1485 : : bActiveMediaSh(false), \
1486 : : bActiveEditSh(false), \
1487 : : bFormShellAtTop(false), \
1488 : : bDontSwitch(false), \
1489 : : bInFormatDialog(false), \
1490 : : bPrintSelected(false), \
1491 : : bReadOnly(false), \
1492 : : pScSbxObject(NULL), \
1493 : : bChartAreaValid(false), \
1494 : : nCurRefDlgId(0), \
1495 : : pAccessibilityBroadcaster(NULL), \
1496 : : mbInSwitch(false)
1497 : :
1498 : :
1499 : : //------------------------------------------------------------------
1500 : :
1501 : 229 : void ScTabViewShell::Construct( sal_uInt8 nForceDesignMode )
1502 : : {
1503 [ + - ]: 229 : SfxApplication* pSfxApp = SFX_APP();
1504 : 229 : ScDocShell* pDocSh = GetViewData()->GetDocShell();
1505 : 229 : ScDocument* pDoc = pDocSh->GetDocument();
1506 : :
1507 [ + - ]: 229 : bReadOnly = pDocSh->IsReadOnly();
1508 : :
1509 [ + - ][ + - ]: 229 : SetName(rtl::OUString("View")); // fuer SBX
[ + - ]
1510 : 229 : Color aColBlack( COL_BLACK );
1511 [ + - ]: 229 : SetPool( &SC_MOD()->GetPool() );
1512 [ + - ][ + - ]: 229 : SetWindow( GetActiveWin() );
1513 : :
1514 : : pCurFrameLine = new ::editeng::SvxBorderLine(&aColBlack, 20,
1515 [ + - ][ + - ]: 229 : table::BorderLineStyle::SOLID);
1516 [ + - ][ + - ]: 229 : pPivotSource = new ScArea;
1517 [ + - ]: 229 : StartListening(*GetViewData()->GetDocShell(),sal_True);
1518 [ + - ]: 229 : StartListening(*GetViewFrame(),sal_True);
1519 [ + - ]: 229 : StartListening(*pSfxApp,sal_True); // #i62045# #i62046# application is needed for Calc's own hints
1520 : :
1521 [ + - ]: 229 : SfxViewFrame* pFirst = SfxViewFrame::GetFirst(pDocSh);
1522 : : sal_Bool bFirstView = !pFirst
1523 [ + + ][ - + ]: 229 : || (pFirst == GetViewFrame() && !SfxViewFrame::GetNext(*pFirst,pDocSh));
[ # # ][ # # ]
1524 : :
1525 [ - + ]: 229 : if ( pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
1526 : : {
1527 : : //TODO/LATER: is there a difference between the two GetVisArea methods?
1528 [ # # ]: 0 : Rectangle aVisArea = ((const SfxObjectShell*)pDocSh)->GetVisArea();
1529 : :
1530 : 0 : SCTAB nVisTab = pDoc->GetVisibleTab();
1531 [ # # ][ # # ]: 0 : if (!pDoc->HasTable(nVisTab))
1532 : : {
1533 : 0 : nVisTab = 0;
1534 [ # # ]: 0 : pDoc->SetVisibleTab(nVisTab);
1535 : : }
1536 [ # # ]: 0 : SetTabNo( nVisTab );
1537 [ # # ]: 0 : sal_Bool bNegativePage = pDoc->IsNegativePage( nVisTab );
1538 : : // show the right cells
1539 [ # # ][ # # ]: 0 : GetViewData()->SetScreenPos( bNegativePage ? aVisArea.TopRight() : aVisArea.TopLeft() );
[ # # ]
1540 : :
1541 [ # # ][ # # ]: 0 : if ( GetViewFrame()->GetFrame().IsInPlace() ) // inplace
[ # # ]
1542 : : {
1543 [ # # ]: 0 : pDocSh->SetInplace( sal_True ); // schon so initialisiert
1544 [ # # ][ # # ]: 0 : if (pDoc->IsEmbedded())
1545 [ # # ]: 0 : pDoc->ResetEmbedded(); // keine blaue Markierung
1546 : : }
1547 [ # # ]: 0 : else if ( bFirstView )
1548 : : {
1549 [ # # ]: 0 : pDocSh->SetInplace( false );
1550 [ # # ]: 0 : GetViewData()->RefreshZoom(); // recalculate PPT
1551 [ # # ][ # # ]: 0 : if (!pDoc->IsEmbedded())
1552 [ # # ]: 0 : pDoc->SetEmbedded( aVisArea ); // VisArea markieren
1553 : : }
1554 : : }
1555 : :
1556 : : // ViewInputHandler
1557 : : // jeder Task hat neuerdings sein eigenes InputWindow,
1558 : : // darum muesste eigentlich entweder jeder Task seinen InputHandler bekommen,
1559 : : // oder das InputWindow muesste sich beim App-InputHandler anmelden, wenn der
1560 : : // Task aktiv wird, oder das InputWindow muesste sich den InputHandler selbst
1561 : : // anlegen (dann immer ueber das InputWindow suchen, und nur wenn das nicht da
1562 : : // ist, den InputHandler von der App nehmen).
1563 : : // Als Sofortloesung bekommt erstmal jede View ihren Inputhandler, das gibt
1564 : : // nur noch Probleme, wenn zwei Views in einem Task-Fenster sind.
1565 : :
1566 [ + - ][ + - ]: 229 : pInputHandler = new ScInputHandler;
1567 : :
1568 : : // Alte Version:
1569 : : // if ( !GetViewFrame()->ISA(SfxTopViewFrame) ) // OLE oder Plug-In
1570 : : // pInputHandler = new ScInputHandler;
1571 : :
1572 : : // FormShell vor MakeDrawView anlegen, damit die DrawView auf jeden Fall
1573 : : // an der FormShell angemeldet werden kann
1574 : : // Gepusht wird die FormShell im ersten Activate
1575 [ + - ][ + - ]: 229 : pFormShell = new FmFormShell(this);
1576 [ + - ][ + - ]: 229 : pFormShell->SetControlActivationHandler( LINK( this, ScTabViewShell, FormControlActivated ) );
1577 : :
1578 : : // DrawView darf nicht im TabView - ctor angelegt werden,
1579 : : // wenn die ViewShell noch nicht kostruiert ist...
1580 [ + - ][ + + ]: 229 : if (pDoc->GetDrawLayer())
1581 [ + - ]: 19 : MakeDrawView( nForceDesignMode );
1582 [ + - ]: 229 : ViewOptionsHasChanged(false); // legt auch evtl. DrawView an
1583 : :
1584 [ + - ]: 229 : ::svl::IUndoManager* pMgr = pDocSh->GetUndoManager();
1585 [ + - ]: 229 : SetUndoManager( pMgr );
1586 [ + - ]: 229 : pFormShell->SetUndoManager( pMgr );
1587 [ - + ]: 229 : if ( !pDoc->IsUndoEnabled() )
1588 : : {
1589 [ # # ]: 0 : pMgr->SetMaxUndoActionCount( 0 );
1590 : : }
1591 [ + - ]: 229 : SetRepeatTarget( &aTarget );
1592 [ + - ]: 229 : pFormShell->SetRepeatTarget( &aTarget );
1593 [ + - ]: 229 : SetHelpId( HID_SCSHELL_TABVWSH );
1594 : :
1595 [ + + ]: 229 : if ( bFirstView ) // first view?
1596 : : {
1597 [ + - ]: 227 : pDoc->SetDocVisible( sal_True ); // used when creating new sheets
1598 [ + - ][ + + ]: 227 : if ( pDocSh->IsEmpty() )
1599 : : {
1600 : : // set first sheet's RTL flag (following will already be initialized because of SetDocVisible)
1601 [ + - ][ + - ]: 195 : pDoc->SetLayoutRTL( 0, ScGlobal::IsSystemRTL() );
1602 : :
1603 : : // append additional sheets (not for OLE object)
1604 [ + - ]: 195 : if ( pDocSh->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
1605 : : {
1606 : : // Get the customized initial tab count
1607 [ + - ][ + - ]: 195 : const ScDefaultsOptions& rOpt = SC_MOD()->GetDefaultsOptions();
1608 : 195 : SCTAB nInitTabCount = rOpt.GetInitTabCount();
1609 : :
1610 [ - + ]: 195 : for (SCTAB i=1; i<nInitTabCount; i++)
1611 [ # # ]: 0 : pDoc->MakeTable(i,false);
1612 : : }
1613 : :
1614 [ + - ]: 195 : pDocSh->SetEmpty( false ); // #i6232# make sure this is done only once
1615 : : }
1616 : :
1617 : : // ReadExtOptions is now in Activate
1618 : :
1619 : : // Link-Update nicht verschachteln
1620 [ + - + - ]: 454 : if ( pDocSh->GetCreateMode() != SFX_CREATE_MODE_INTERNAL &&
[ + - ]
1621 : 227 : pDocSh->IsUpdateEnabled() ) // #105575#; update only in the first creation of the ViewShell
1622 : : {
1623 : : // Check if there are any external data.
1624 [ + - ][ + - ]: 227 : bool bLink = pDoc->GetExternalRefManager()->hasExternalData();
1625 [ + - ]: 227 : if (!bLink)
1626 : : {
1627 : : // #i100042# sheet links can still exist independently from external formula references
1628 [ + - ]: 227 : SCTAB nTabCount = pDoc->GetTableCount();
1629 [ + + ][ + - ]: 502 : for (SCTAB i=0; i<nTabCount && !bLink; i++)
[ + + ]
1630 [ + - ][ - + ]: 275 : if (pDoc->IsLinked(i))
1631 : 0 : bLink = true;
1632 : : }
1633 [ + - ]: 227 : if (!bLink)
1634 [ + - ][ + - ]: 227 : if (pDoc->HasDdeLinks() || pDoc->HasAreaLinks())
[ + - ][ - + ]
[ - + ]
1635 : 0 : bLink = sal_True;
1636 [ - + ]: 227 : if (bLink)
1637 : : {
1638 [ # # ]: 0 : if ( !pFirst )
1639 : 0 : pFirst = GetViewFrame();
1640 : :
1641 [ # # ][ # # ]: 0 : if(SC_MOD()->GetCurRefDlgId()==0)
1642 : : {
1643 : : pFirst->GetDispatcher()->Execute( SID_UPDATETABLINKS,
1644 [ # # ]: 0 : SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
1645 : : }
1646 : : }
1647 : :
1648 : 227 : bool bReImport = false; // importierte Daten aktualisieren
1649 [ + - ]: 227 : ScDBCollection* pDBColl = pDoc->GetDBCollection();
1650 [ + - ]: 227 : if ( pDBColl )
1651 : : {
1652 [ + - ]: 227 : const ScDBCollection::NamedDBs& rDBs = pDBColl->getNamedDBs();
1653 [ + - ][ + - ]: 227 : ScDBCollection::NamedDBs::const_iterator itr = rDBs.begin(), itrEnd = rDBs.end();
1654 [ + - ][ + - ]: 241 : for (; itr != itrEnd; ++itr)
[ + + ]
1655 : : {
1656 [ + - ][ - + ]: 14 : if (itr->IsStripData() && itr->HasImportParam() && !itr->HasImportSelection())
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ - + ]
1657 : : {
1658 : 0 : bReImport = true;
1659 : 0 : break;
1660 : : }
1661 : : }
1662 : : }
1663 [ - + ]: 227 : if (bReImport)
1664 : : {
1665 [ # # ]: 0 : if ( !pFirst )
1666 : 0 : pFirst = GetViewFrame();
1667 [ # # ][ # # ]: 0 : if(SC_MOD()->GetCurRefDlgId()==0)
1668 : : {
1669 : : pFirst->GetDispatcher()->Execute( SID_REIMPORT_AFTER_LOAD,
1670 [ # # ]: 0 : SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
1671 : : }
1672 : : }
1673 : : }
1674 : : }
1675 : :
1676 [ + - ]: 229 : UpdateAutoFillMark();
1677 : :
1678 : : // ScDispatchProviderInterceptor registers itself in ctor
1679 [ + - ][ + - ]: 229 : xDisProvInterceptor = new ScDispatchProviderInterceptor( this );
[ + - ]
1680 : :
1681 : 229 : bFirstActivate = sal_True; // NavigatorUpdate aufschieben bis Activate()
1682 : :
1683 : : // #105575#; update only in the first creation of the ViewShell
1684 : 229 : pDocSh->SetUpdateEnabled(false);
1685 : :
1686 [ + - ][ - + ]: 229 : if ( GetViewFrame()->GetFrame().IsInPlace() )
[ + - ]
1687 [ # # ]: 0 : UpdateHeaderWidth(); // The implace activation requires headers to be calculated
1688 : :
1689 : 229 : SvBorder aBorder;
1690 [ + - ]: 229 : GetBorderSize( aBorder, Size() );
1691 [ + - ]: 229 : SetBorderPixel( aBorder );
1692 : 229 : }
1693 : :
1694 : : //------------------------------------------------------------------
1695 : :
1696 : :
1697 : : //------------------------------------------------------------------
1698 : :
1699 : 229 : ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame,
1700 : : SfxViewShell* pOldSh ) :
1701 : : SfxViewShell( pViewFrame, SFX_VIEW_CAN_PRINT | SFX_VIEW_HAS_PRINTOPTIONS ),
1702 [ + - ][ + - ]: 229 : ScDBFunc( &pViewFrame->GetWindow(), (ScDocShell&)*pViewFrame->GetObjectShell(), this ),
1703 [ + - ][ + - ]: 1832 : __INIT_ScTabViewShell
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + + ]
[ + - ]
[ # # # # ]
1704 : : {
1705 : : RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScTabViewShell::ScTabViewShell" );
1706 : :
1707 [ + - ][ + - ]: 229 : const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions();
1708 : :
1709 : : // if switching back from print preview,
1710 : : // restore the view settings that were active when creating the preview
1711 : : // ReadUserData must not happen from ctor, because the view's edit window
1712 : : // has to be shown by the sfx. ReadUserData is deferred until the first Activate call.
1713 : : // old DesignMode state from form layer must be restored, too
1714 : :
1715 : 229 : sal_uInt8 nForceDesignMode = SC_FORCEMODE_NONE;
1716 [ - + ][ # # ]: 229 : if ( pOldSh && pOldSh->ISA( ScPreviewShell ) )
[ # # ][ # # ]
[ - + ]
1717 : : {
1718 : 0 : ScPreviewShell* pPreviewShell = ((ScPreviewShell*)pOldSh);
1719 : 0 : nForceDesignMode = pPreviewShell->GetSourceDesignMode();
1720 [ # # ]: 0 : ScPreview* p = pPreviewShell->GetPreview();
1721 [ # # ]: 0 : if (p)
1722 [ # # ][ # # ]: 0 : GetViewData()->GetMarkData().SetSelectedTabs(p->GetSelectedTabs());
[ # # ]
1723 : : }
1724 : :
1725 [ + - ]: 229 : Construct( nForceDesignMode );
1726 : :
1727 [ + - ][ - + ]: 229 : if ( GetViewData()->GetDocShell()->IsPreview() )
1728 : : {
1729 : : // preview for template dialog: always show whole page
1730 [ # # ]: 0 : SetZoomType( SVX_ZOOM_WHOLEPAGE, sal_True ); // zoom value is recalculated at next Resize
1731 : : }
1732 : : else
1733 : : {
1734 [ + - ]: 229 : Fraction aFract( rAppOpt.GetZoom(), 100 );
1735 [ + - ]: 229 : SetZoom( aFract, aFract, sal_True );
1736 [ + - ]: 229 : SetZoomType( rAppOpt.GetZoomType(), sal_True );
1737 : : }
1738 : :
1739 : : // make Controller known to SFX
1740 [ + - ]: 229 : new ScTabViewObj( this );
1741 : :
1742 [ + - ]: 229 : SetCurSubShell(OST_Cell);
1743 : 229 : SvBorder aBorder;
1744 [ + - ]: 229 : GetBorderSize( aBorder, Size() );
1745 [ + - ]: 229 : SetBorderPixel( aBorder );
1746 : :
1747 : : // #114409#
1748 [ + - ]: 229 : MakeDrawLayer();
1749 [ # # # # ]: 229 : }
1750 : :
1751 : : #undef __INIT_ScTabViewShell
1752 : :
1753 : : //------------------------------------------------------------------
1754 : :
1755 [ + - ][ + - ]: 1800 : ScTabViewShell::~ScTabViewShell()
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
1756 : : {
1757 : 225 : ScDocShell* pDocSh = GetViewData()->GetDocShell();
1758 [ + - ]: 225 : EndListening(*pDocSh);
1759 [ + - ]: 225 : EndListening(*GetViewFrame());
1760 [ + - ][ + - ]: 225 : EndListening(*SFX_APP()); // #i62045# #i62046# needed now - SfxViewShell no longer does it
1761 : :
1762 [ + - ][ + - ]: 225 : SC_MOD()->ViewShellGone(this);
1763 : :
1764 [ + - ]: 225 : RemoveSubShell(); // alle
1765 [ + - ]: 225 : SetWindow(0);
1766 : :
1767 : : // alles auf NULL, falls aus dem TabView-dtor noch darauf zugegriffen wird
1768 : : //! (soll eigentlich nicht !??!?!)
1769 : :
1770 [ - + ][ # # ]: 225 : DELETEZ(pFontworkBarShell);
1771 [ - + ][ # # ]: 225 : DELETEZ(pExtrusionBarShell);
1772 [ + - ][ + - ]: 225 : DELETEZ(pCellShell);
1773 [ - + ][ # # ]: 225 : DELETEZ(pPageBreakShell);
1774 [ - + ][ # # ]: 225 : DELETEZ(pDrawShell);
1775 [ - + ][ # # ]: 225 : DELETEZ(pDrawFormShell);
1776 [ - + ][ # # ]: 225 : DELETEZ(pOleObjectShell);
1777 [ - + ][ # # ]: 225 : DELETEZ(pChartShell);
1778 [ - + ][ # # ]: 225 : DELETEZ(pGraphicShell);
1779 [ - + ][ # # ]: 225 : DELETEZ(pMediaShell);
1780 [ - + ][ # # ]: 225 : DELETEZ(pDrawTextShell);
1781 [ - + ][ # # ]: 225 : DELETEZ(pEditShell);
1782 [ + + ][ + - ]: 225 : DELETEZ(pPivotShell);
1783 [ - + ][ # # ]: 225 : DELETEZ(pAuditingShell);
1784 : 225 : DELETEZ(pCurFrameLine);
1785 [ + - ][ + - ]: 225 : DELETEZ(pInputHandler);
1786 : 225 : DELETEZ(pPivotSource);
1787 [ # # ][ - + ]: 225 : DELETEZ(pDialogDPObject);
1788 [ - + ]: 225 : DELETEZ(pNavSettings);
1789 : :
1790 [ + - ][ + - ]: 225 : DELETEZ(pFormShell);
1791 [ + + ][ + - ]: 225 : DELETEZ(pAccessibilityBroadcaster);
1792 [ + - ][ + + ]: 2025 : }
[ - + ]
[ # # # # ]
1793 : :
1794 : : //------------------------------------------------------------------
1795 : :
1796 : 0 : void ScTabViewShell::SetDialogDPObject( const ScDPObject* pObj )
1797 : : {
1798 [ # # ]: 0 : delete pDialogDPObject;
1799 [ # # ]: 0 : if (pObj)
1800 [ # # ]: 0 : pDialogDPObject = new ScDPObject( *pObj );
1801 : : else
1802 : 0 : pDialogDPObject = NULL;
1803 : 0 : }
1804 : :
1805 : : //------------------------------------------------------------------
1806 : :
1807 : 0 : void ScTabViewShell::FillFieldData( ScHeaderFieldData& rData )
1808 : : {
1809 : 0 : ScDocShell* pDocShell = GetViewData()->GetDocShell();
1810 : 0 : ScDocument* pDoc = pDocShell->GetDocument();
1811 : 0 : SCTAB nTab = GetViewData()->GetTabNo();
1812 : 0 : rtl::OUString aTmp;
1813 [ # # ]: 0 : pDoc->GetName(nTab, aTmp);
1814 [ # # ]: 0 : rData.aTabName = aTmp;
1815 : :
1816 [ # # ][ # # ]: 0 : if( pDocShell->getDocProperties()->getTitle().getLength() != 0 )
[ # # ][ # # ]
1817 [ # # ][ # # ]: 0 : rData.aTitle = pDocShell->getDocProperties()->getTitle();
[ # # ][ # # ]
1818 : : else
1819 [ # # ][ # # ]: 0 : rData.aTitle = pDocShell->GetTitle();
[ # # ]
1820 : :
1821 [ # # ]: 0 : const INetURLObject& rURLObj = pDocShell->GetMedium()->GetURLObject();
1822 [ # # ][ # # ]: 0 : rData.aLongDocName = rURLObj.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS );
1823 [ # # ]: 0 : if ( rData.aLongDocName.Len() )
1824 [ # # ][ # # ]: 0 : rData.aShortDocName = rURLObj.GetName( INetURLObject::DECODE_UNAMBIGUOUS );
1825 : : else
1826 [ # # ][ # # ]: 0 : rData.aShortDocName = rData.aLongDocName = rData.aTitle;
1827 : 0 : rData.nPageNo = 1;
1828 : 0 : rData.nTotalPages = 99;
1829 : :
1830 : : // eNumType kennt der Dialog selber
1831 : 0 : }
1832 : :
1833 : : //------------------------------------------------------------------
1834 : :
1835 : 0 : void ScTabViewShell::SetChartArea( const ScRangeListRef& rSource, const Rectangle& rDest )
1836 : : {
1837 : 0 : bChartAreaValid = sal_True;
1838 : 0 : aChartSource = rSource;
1839 : 0 : aChartPos = rDest;
1840 : 0 : nChartDestTab = GetViewData()->GetTabNo();
1841 : 0 : }
1842 : :
1843 : 0 : sal_Bool ScTabViewShell::GetChartArea( ScRangeListRef& rSource, Rectangle& rDest, SCTAB& rTab ) const
1844 : : {
1845 : 0 : rSource = aChartSource;
1846 : 0 : rDest = aChartPos;
1847 : 0 : rTab = nChartDestTab;
1848 : 0 : return bChartAreaValid;
1849 : : }
1850 : :
1851 : 0 : ScNavigatorSettings* ScTabViewShell::GetNavigatorSettings()
1852 : : {
1853 [ # # ]: 0 : if( !pNavSettings )
1854 [ # # ]: 0 : pNavSettings = new ScNavigatorSettings;
1855 : 0 : return pNavSettings;
1856 : : }
1857 : :
1858 : :
1859 : : //------------------------------------------------------------------
1860 : :
1861 : 0 : void ScTabViewShell::ExecTbx( SfxRequest& rReq )
1862 : : {
1863 : 0 : const SfxItemSet* pReqArgs = rReq.GetArgs();
1864 : 0 : sal_uInt16 nSlot = rReq.GetSlot();
1865 : 0 : const SfxPoolItem* pItem = NULL;
1866 [ # # ]: 0 : if ( pReqArgs )
1867 [ # # ]: 0 : pReqArgs->GetItemState( nSlot, sal_True, &pItem );
1868 : :
1869 [ # # # # ]: 0 : switch ( nSlot )
1870 : : {
1871 : : case SID_TBXCTL_INSERT:
1872 [ # # ]: 0 : if ( pItem )
1873 : 0 : nInsertCtrlState = ((const SfxUInt16Item*)pItem)->GetValue();
1874 : 0 : break;
1875 : : case SID_TBXCTL_INSCELLS:
1876 [ # # ]: 0 : if ( pItem )
1877 : 0 : nInsCellsCtrlState = ((const SfxUInt16Item*)pItem)->GetValue();
1878 : 0 : break;
1879 : : case SID_TBXCTL_INSOBJ:
1880 [ # # ]: 0 : if ( pItem )
1881 : 0 : nInsObjCtrlState = ((const SfxUInt16Item*)pItem)->GetValue();
1882 : 0 : break;
1883 : : default:
1884 : : OSL_FAIL("Slot im Wald");
1885 : : }
1886 [ # # ]: 0 : GetViewFrame()->GetBindings().Invalidate( nSlot );
1887 : 0 : }
1888 : :
1889 : 0 : void ScTabViewShell::GetTbxState( SfxItemSet& rSet )
1890 : : {
1891 [ # # ]: 0 : rSet.Put( SfxUInt16Item( SID_TBXCTL_INSERT, nInsertCtrlState ) );
1892 [ # # ]: 0 : rSet.Put( SfxUInt16Item( SID_TBXCTL_INSCELLS, nInsCellsCtrlState ) );
1893 : :
1894 : : // ohne installiertes Chart darf Chart nicht Default sein...
1895 [ # # ][ # # ]: 0 : if ( nInsObjCtrlState == SID_DRAW_CHART && !SvtModuleOptions().IsChart() )
[ # # ][ # # ]
[ # # # # ]
[ # # ]
1896 : 0 : nInsObjCtrlState = SID_INSERT_OBJECT;
1897 : :
1898 [ # # ]: 0 : rSet.Put( SfxUInt16Item( SID_TBXCTL_INSOBJ, nInsObjCtrlState ) );
1899 : 0 : }
1900 : :
1901 : :
1902 : :
1903 : :
1904 : :
1905 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|