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