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 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> 31*cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir // INCLUDE --------------------------------------------------------------- 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #include "scitems.hxx" 40*cdf0e10cSrcweir #include <sfx2/app.hxx> 41*cdf0e10cSrcweir #include <editeng/eeitem.hxx> 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir #include <editeng/flditem.hxx> 44*cdf0e10cSrcweir #include <editeng/outliner.hxx> 45*cdf0e10cSrcweir #include <basic/sbstar.hxx> 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir #include <sfx2/sfxdlg.hxx> 48*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 49*cdf0e10cSrcweir #include <sfx2/objface.hxx> 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir #include <svx/hyprlink.hxx> 52*cdf0e10cSrcweir #include "IAnyRefDialog.hxx" 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir #include <svtools/ehdl.hxx> 55*cdf0e10cSrcweir #include <svtools/accessibilityoptions.hxx> 56*cdf0e10cSrcweir #include <svl/ctloptions.hxx> 57*cdf0e10cSrcweir #include <unotools/useroptions.hxx> 58*cdf0e10cSrcweir #include <vcl/status.hxx> 59*cdf0e10cSrcweir #include <sfx2/bindings.hxx> 60*cdf0e10cSrcweir #include <sfx2/request.hxx> 61*cdf0e10cSrcweir #include <sfx2/printer.hxx> 62*cdf0e10cSrcweir #include <editeng/langitem.hxx> 63*cdf0e10cSrcweir #include <svtools/colorcfg.hxx> 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir #include <svl/whiter.hxx> 66*cdf0e10cSrcweir #include <svx/selctrl.hxx> 67*cdf0e10cSrcweir #include <svx/insctrl.hxx> 68*cdf0e10cSrcweir #include <svx/zoomctrl.hxx> 69*cdf0e10cSrcweir #include <svx/modctrl.hxx> 70*cdf0e10cSrcweir #include <svx/pszctrl.hxx> 71*cdf0e10cSrcweir #include <svx/zoomsliderctrl.hxx> 72*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 73*cdf0e10cSrcweir #include <svl/inethist.hxx> 74*cdf0e10cSrcweir #include <vcl/waitobj.hxx> 75*cdf0e10cSrcweir #include <svx/svxerr.hxx> 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir #include "scmod.hxx" 80*cdf0e10cSrcweir #include "global.hxx" 81*cdf0e10cSrcweir #include "viewopti.hxx" 82*cdf0e10cSrcweir #include "docoptio.hxx" 83*cdf0e10cSrcweir #include "appoptio.hxx" 84*cdf0e10cSrcweir #include "inputopt.hxx" 85*cdf0e10cSrcweir #include "printopt.hxx" 86*cdf0e10cSrcweir #include "navicfg.hxx" 87*cdf0e10cSrcweir #include "addincfg.hxx" 88*cdf0e10cSrcweir #include "tabvwsh.hxx" 89*cdf0e10cSrcweir #include "prevwsh.hxx" 90*cdf0e10cSrcweir #include "docsh.hxx" 91*cdf0e10cSrcweir #include "drwlayer.hxx" 92*cdf0e10cSrcweir #include "uiitems.hxx" 93*cdf0e10cSrcweir #include "sc.hrc" 94*cdf0e10cSrcweir #include "cfgids.hxx" 95*cdf0e10cSrcweir #include "inputhdl.hxx" 96*cdf0e10cSrcweir #include "inputwin.hxx" 97*cdf0e10cSrcweir #include "msgpool.hxx" 98*cdf0e10cSrcweir #include "scresid.hxx" 99*cdf0e10cSrcweir #include "anyrefdg.hxx" 100*cdf0e10cSrcweir #include "dwfunctr.hxx" 101*cdf0e10cSrcweir #include "formdata.hxx" 102*cdf0e10cSrcweir //CHINA001 #include "tpview.hxx" 103*cdf0e10cSrcweir //CHINA001 #include "tpusrlst.hxx" 104*cdf0e10cSrcweir //CHINA001 #include "tpcalc.hxx" 105*cdf0e10cSrcweir #include "tpprint.hxx" 106*cdf0e10cSrcweir //CHINA001 #include "opredlin.hxx" 107*cdf0e10cSrcweir #include "transobj.hxx" 108*cdf0e10cSrcweir #include "detfunc.hxx" 109*cdf0e10cSrcweir #include "preview.hxx" 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir #include <svx/xmlsecctrl.hxx> 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir #define ScModule 115*cdf0e10cSrcweir #include "scslots.hxx" 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir #include "scabstdlg.hxx" //CHINA001 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir #define SC_IDLE_MIN 150 120*cdf0e10cSrcweir #define SC_IDLE_MAX 3000 121*cdf0e10cSrcweir #define SC_IDLE_STEP 75 122*cdf0e10cSrcweir #define SC_IDLE_COUNT 50 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir static sal_uInt16 nIdleCount = 0; 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir //------------------------------------------------------------------ 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir SFX_IMPL_INTERFACE( ScModule, SfxShell, ScResId(RID_APPTITLE) ) 129*cdf0e10cSrcweir { 130*cdf0e10cSrcweir SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_APPLICATION | SFX_VISIBILITY_DESKTOP | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_CLIENT | SFX_VISIBILITY_VIEWER, 131*cdf0e10cSrcweir ScResId(RID_OBJECTBAR_APP) ); 132*cdf0e10cSrcweir SFX_STATUSBAR_REGISTRATION( ScResId(SCCFG_STATUSBAR) ); // nur ID wichtig 133*cdf0e10cSrcweir SFX_CHILDWINDOW_REGISTRATION( SvxHyperlinkDlgWrapper::GetChildWindowId() ); 134*cdf0e10cSrcweir } 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir //------------------------------------------------------------------ 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir ScModule::ScModule( SfxObjectFactory* pFact ) : 139*cdf0e10cSrcweir SfxModule( SfxApplication::CreateResManager( "sc" ), sal_False, pFact, NULL ), 140*cdf0e10cSrcweir pSelTransfer( NULL ), 141*cdf0e10cSrcweir pMessagePool( NULL ), 142*cdf0e10cSrcweir pRefInputHandler( NULL ), 143*cdf0e10cSrcweir pViewCfg( NULL ), 144*cdf0e10cSrcweir pDocCfg( NULL ), 145*cdf0e10cSrcweir pAppCfg( NULL ), 146*cdf0e10cSrcweir pInputCfg( NULL ), 147*cdf0e10cSrcweir pPrintCfg( NULL ), 148*cdf0e10cSrcweir pNavipiCfg( NULL ), 149*cdf0e10cSrcweir pAddInCfg( NULL ), 150*cdf0e10cSrcweir pColorConfig( NULL ), 151*cdf0e10cSrcweir pAccessOptions( NULL ), 152*cdf0e10cSrcweir pCTLOptions( NULL ), 153*cdf0e10cSrcweir pUserOptions( NULL ), 154*cdf0e10cSrcweir pErrorHdl( NULL ), 155*cdf0e10cSrcweir pSvxErrorHdl( NULL ), 156*cdf0e10cSrcweir pFormEditData( NULL ), 157*cdf0e10cSrcweir nCurRefDlgId( 0 ), 158*cdf0e10cSrcweir bIsWaterCan( sal_False ), 159*cdf0e10cSrcweir bIsInEditCommand( sal_False ), 160*cdf0e10cSrcweir bIsInExecuteDrop( sal_False ), 161*cdf0e10cSrcweir mbIsInSharedDocLoading( false ), 162*cdf0e10cSrcweir mbIsInSharedDocSaving( false ) 163*cdf0e10cSrcweir { 164*cdf0e10cSrcweir // im ctor ist der ResManager (DLL-Daten) noch nicht initialisiert! 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("StarCalc"))); // fuer Basic 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir ResetDragObject(); 169*cdf0e10cSrcweir SetClipObject( NULL, NULL ); 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir // InputHandler braucht nicht mehr angelegt zu werden 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir // ErrorHandler anlegen - war in Init() 174*cdf0e10cSrcweir // zwischen OfficeApplication::Init und ScGlobal::Init 175*cdf0e10cSrcweir SvxErrorHandler::Get(); 176*cdf0e10cSrcweir pErrorHdl = new SfxErrorHandler( RID_ERRHDLSC, 177*cdf0e10cSrcweir ERRCODE_AREA_SC, 178*cdf0e10cSrcweir ERRCODE_AREA_APP2-1, 179*cdf0e10cSrcweir GetResMgr() ); 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir aSpellTimer.SetTimeout(10); 182*cdf0e10cSrcweir aSpellTimer.SetTimeoutHdl( LINK( this, ScModule, SpellTimerHdl ) ); 183*cdf0e10cSrcweir aIdleTimer.SetTimeout(SC_IDLE_MIN); 184*cdf0e10cSrcweir aIdleTimer.SetTimeoutHdl( LINK( this, ScModule, IdleHandler ) ); 185*cdf0e10cSrcweir aIdleTimer.Start(); 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir pMessagePool = new ScMessagePool; 188*cdf0e10cSrcweir pMessagePool->FreezeIdRanges(); 189*cdf0e10cSrcweir SetPool( pMessagePool ); 190*cdf0e10cSrcweir ScGlobal::InitTextHeight( pMessagePool ); 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir StartListening( *SFX_APP() ); // for SFX_HINT_DEINITIALIZING 193*cdf0e10cSrcweir } 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir ScModule::~ScModule() 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir DBG_ASSERT( !pSelTransfer, "Selection Transfer object not deleted" ); 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir // InputHandler braucht nicht mehr geloescht zu werden (gibt keinen an der App mehr) 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir SfxItemPool::Free(pMessagePool); 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir DELETEZ( pFormEditData ); 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir delete pErrorHdl; 206*cdf0e10cSrcweir // delete pSvxErrorHdl; 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir ScGlobal::Clear(); // ruft auch ScDocumentPool::DeleteVersionMaps(); 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir DeleteCfg(); // wurde mal aus Exit() gerufen 211*cdf0e10cSrcweir } 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir //------------------------------------------------------------------ 214*cdf0e10cSrcweir void ScModule::ConfigurationChanged( utl::ConfigurationBroadcaster* p, sal_uInt32 ) 215*cdf0e10cSrcweir { 216*cdf0e10cSrcweir if ( p == pColorConfig || p == pAccessOptions ) 217*cdf0e10cSrcweir { 218*cdf0e10cSrcweir // Test if detective objects have to be updated with new colors 219*cdf0e10cSrcweir // (if the detective colors haven't been used yet, there's nothing to update) 220*cdf0e10cSrcweir if ( ScDetectiveFunc::IsColorsInitialized() ) 221*cdf0e10cSrcweir { 222*cdf0e10cSrcweir const svtools::ColorConfig& rColors = GetColorConfig(); 223*cdf0e10cSrcweir sal_Bool bArrows = 224*cdf0e10cSrcweir ( ScDetectiveFunc::GetArrowColor() != (ColorData)rColors.GetColorValue(svtools::CALCDETECTIVE).nColor || 225*cdf0e10cSrcweir ScDetectiveFunc::GetErrorColor() != (ColorData)rColors.GetColorValue(svtools::CALCDETECTIVEERROR).nColor ); 226*cdf0e10cSrcweir sal_Bool bComments = 227*cdf0e10cSrcweir ( ScDetectiveFunc::GetCommentColor() != (ColorData)rColors.GetColorValue(svtools::CALCNOTESBACKGROUND).nColor ); 228*cdf0e10cSrcweir if ( bArrows || bComments ) 229*cdf0e10cSrcweir { 230*cdf0e10cSrcweir ScDetectiveFunc::InitializeColors(); // get the new colors 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir // update detective objects in all open documents 233*cdf0e10cSrcweir SfxObjectShell* pObjSh = SfxObjectShell::GetFirst(); 234*cdf0e10cSrcweir while ( pObjSh ) 235*cdf0e10cSrcweir { 236*cdf0e10cSrcweir if ( pObjSh->Type() == TYPE(ScDocShell) ) 237*cdf0e10cSrcweir { 238*cdf0e10cSrcweir ScDocShell* pDocSh = ((ScDocShell*)pObjSh); 239*cdf0e10cSrcweir if ( bArrows ) 240*cdf0e10cSrcweir ScDetectiveFunc( pDocSh->GetDocument(), 0 ).UpdateAllArrowColors(); 241*cdf0e10cSrcweir if ( bComments ) 242*cdf0e10cSrcweir ScDetectiveFunc::UpdateAllComments( *pDocSh->GetDocument() ); 243*cdf0e10cSrcweir } 244*cdf0e10cSrcweir pObjSh = SfxObjectShell::GetNext( *pObjSh ); 245*cdf0e10cSrcweir } 246*cdf0e10cSrcweir } 247*cdf0e10cSrcweir } 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir // force all views to repaint, using the new options 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir SfxViewShell* pViewShell = SfxViewShell::GetFirst(); 252*cdf0e10cSrcweir while(pViewShell) 253*cdf0e10cSrcweir { 254*cdf0e10cSrcweir if ( pViewShell->ISA(ScTabViewShell) ) 255*cdf0e10cSrcweir { 256*cdf0e10cSrcweir ScTabViewShell* pViewSh = (ScTabViewShell*)pViewShell; 257*cdf0e10cSrcweir pViewSh->PaintGrid(); 258*cdf0e10cSrcweir pViewSh->PaintTop(); 259*cdf0e10cSrcweir pViewSh->PaintLeft(); 260*cdf0e10cSrcweir pViewSh->PaintExtras(); 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir ScInputHandler* pHdl = pViewSh->GetInputHandler(); 263*cdf0e10cSrcweir if ( pHdl ) 264*cdf0e10cSrcweir pHdl->ForgetLastPattern(); // EditEngine BackgroundColor may change 265*cdf0e10cSrcweir } 266*cdf0e10cSrcweir else if ( pViewShell->ISA(ScPreviewShell) ) 267*cdf0e10cSrcweir { 268*cdf0e10cSrcweir Window* pWin = pViewShell->GetWindow(); 269*cdf0e10cSrcweir if (pWin) 270*cdf0e10cSrcweir pWin->Invalidate(); 271*cdf0e10cSrcweir } 272*cdf0e10cSrcweir pViewShell = SfxViewShell::GetNext( *pViewShell ); 273*cdf0e10cSrcweir } 274*cdf0e10cSrcweir } 275*cdf0e10cSrcweir else if ( p == pCTLOptions ) 276*cdf0e10cSrcweir { 277*cdf0e10cSrcweir // for all documents: set digit language for printer, recalc output factor, update row heights 278*cdf0e10cSrcweir SfxObjectShell* pObjSh = SfxObjectShell::GetFirst(); 279*cdf0e10cSrcweir while ( pObjSh ) 280*cdf0e10cSrcweir { 281*cdf0e10cSrcweir if ( pObjSh->Type() == TYPE(ScDocShell) ) 282*cdf0e10cSrcweir { 283*cdf0e10cSrcweir ScDocShell* pDocSh = ((ScDocShell*)pObjSh); 284*cdf0e10cSrcweir OutputDevice* pPrinter = pDocSh->GetPrinter(); 285*cdf0e10cSrcweir if ( pPrinter ) 286*cdf0e10cSrcweir pPrinter->SetDigitLanguage( GetOptDigitLanguage() ); 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir pDocSh->CalcOutputFactor(); 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir SCTAB nTabCount = pDocSh->GetDocument()->GetTableCount(); 291*cdf0e10cSrcweir for (SCTAB nTab=0; nTab<nTabCount; nTab++) 292*cdf0e10cSrcweir pDocSh->AdjustRowHeight( 0, MAXROW, nTab ); 293*cdf0e10cSrcweir } 294*cdf0e10cSrcweir pObjSh = SfxObjectShell::GetNext( *pObjSh ); 295*cdf0e10cSrcweir } 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir // for all views (table and preview): update digit language 298*cdf0e10cSrcweir SfxViewShell* pSh = SfxViewShell::GetFirst(); 299*cdf0e10cSrcweir while ( pSh ) 300*cdf0e10cSrcweir { 301*cdf0e10cSrcweir if ( pSh->ISA( ScTabViewShell ) ) 302*cdf0e10cSrcweir { 303*cdf0e10cSrcweir ScTabViewShell* pViewSh = (ScTabViewShell*)pSh; 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir // set ref-device for EditEngine (re-evaluates digit settings) 306*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(pViewSh); 307*cdf0e10cSrcweir if (pHdl) 308*cdf0e10cSrcweir pHdl->UpdateRefDevice(); 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir pViewSh->DigitLanguageChanged(); 311*cdf0e10cSrcweir pViewSh->PaintGrid(); 312*cdf0e10cSrcweir } 313*cdf0e10cSrcweir else if ( pSh->ISA( ScPreviewShell ) ) 314*cdf0e10cSrcweir { 315*cdf0e10cSrcweir ScPreviewShell* pPreviewSh = (ScPreviewShell*)pSh; 316*cdf0e10cSrcweir ScPreview* pPreview = pPreviewSh->GetPreview(); 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir pPreview->SetDigitLanguage( GetOptDigitLanguage() ); 319*cdf0e10cSrcweir pPreview->Invalidate(); 320*cdf0e10cSrcweir } 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir pSh = SfxViewShell::GetNext( *pSh ); 323*cdf0e10cSrcweir } 324*cdf0e10cSrcweir } 325*cdf0e10cSrcweir } 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir void ScModule::Notify( SfxBroadcaster&, const SfxHint& rHint ) 328*cdf0e10cSrcweir { 329*cdf0e10cSrcweir if ( rHint.ISA(SfxSimpleHint) ) 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir sal_uLong nHintId = ((SfxSimpleHint&)rHint).GetId(); 332*cdf0e10cSrcweir if ( nHintId == SFX_HINT_DEINITIALIZING ) 333*cdf0e10cSrcweir { 334*cdf0e10cSrcweir // ConfigItems must be removed before ConfigManager 335*cdf0e10cSrcweir DeleteCfg(); 336*cdf0e10cSrcweir } 337*cdf0e10cSrcweir } 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir //------------------------------------------------------------------ 341*cdf0e10cSrcweir 342*cdf0e10cSrcweir void ScModule::DeleteCfg() 343*cdf0e10cSrcweir { 344*cdf0e10cSrcweir DELETEZ( pViewCfg ); // Speichern passiert vor Exit() automatisch 345*cdf0e10cSrcweir DELETEZ( pDocCfg ); 346*cdf0e10cSrcweir DELETEZ( pAppCfg ); 347*cdf0e10cSrcweir DELETEZ( pInputCfg ); 348*cdf0e10cSrcweir DELETEZ( pPrintCfg ); 349*cdf0e10cSrcweir DELETEZ( pNavipiCfg ); 350*cdf0e10cSrcweir DELETEZ( pAddInCfg ); 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir if ( pColorConfig ) 353*cdf0e10cSrcweir { 354*cdf0e10cSrcweir pColorConfig->RemoveListener(this); 355*cdf0e10cSrcweir DELETEZ( pColorConfig ); 356*cdf0e10cSrcweir } 357*cdf0e10cSrcweir if ( pAccessOptions ) 358*cdf0e10cSrcweir { 359*cdf0e10cSrcweir pAccessOptions->RemoveListener(this); 360*cdf0e10cSrcweir DELETEZ( pAccessOptions ); 361*cdf0e10cSrcweir } 362*cdf0e10cSrcweir if ( pCTLOptions ) 363*cdf0e10cSrcweir { 364*cdf0e10cSrcweir pCTLOptions->RemoveListener(this); 365*cdf0e10cSrcweir DELETEZ( pCTLOptions ); 366*cdf0e10cSrcweir } 367*cdf0e10cSrcweir if( pUserOptions ) 368*cdf0e10cSrcweir { 369*cdf0e10cSrcweir DELETEZ( pUserOptions ); 370*cdf0e10cSrcweir } 371*cdf0e10cSrcweir } 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir //------------------------------------------------------------------ 374*cdf0e10cSrcweir // 375*cdf0e10cSrcweir // von der Applikation verschoben: 376*cdf0e10cSrcweir // 377*cdf0e10cSrcweir //------------------------------------------------------------------ 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir void ScModule::Execute( SfxRequest& rReq ) 380*cdf0e10cSrcweir { 381*cdf0e10cSrcweir SfxViewFrame* pViewFrm = SfxViewFrame::Current(); 382*cdf0e10cSrcweir SfxBindings* pBindings = pViewFrm ? &pViewFrm->GetBindings() : NULL; 383*cdf0e10cSrcweir 384*cdf0e10cSrcweir const SfxItemSet* pReqArgs = rReq.GetArgs(); 385*cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 386*cdf0e10cSrcweir 387*cdf0e10cSrcweir switch ( nSlot ) 388*cdf0e10cSrcweir { 389*cdf0e10cSrcweir case SID_CHOOSE_DESIGN: 390*cdf0e10cSrcweir { 391*cdf0e10cSrcweir String aMacroName = 392*cdf0e10cSrcweir String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("Template.Samples.ShowStyles")); 393*cdf0e10cSrcweir SfxApplication::CallAppBasic( aMacroName ); 394*cdf0e10cSrcweir } 395*cdf0e10cSrcweir break; 396*cdf0e10cSrcweir case SID_EURO_CONVERTER: 397*cdf0e10cSrcweir { 398*cdf0e10cSrcweir String aMacroName = 399*cdf0e10cSrcweir String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("Euro.ConvertRun.Main")); 400*cdf0e10cSrcweir SfxApplication::CallAppBasic( aMacroName ); 401*cdf0e10cSrcweir } 402*cdf0e10cSrcweir break; 403*cdf0e10cSrcweir case SID_AUTOSPELL_CHECK: 404*cdf0e10cSrcweir { 405*cdf0e10cSrcweir sal_Bool bSet; 406*cdf0e10cSrcweir const SfxPoolItem* pItem; 407*cdf0e10cSrcweir if ( pReqArgs && SFX_ITEM_SET == pReqArgs->GetItemState( nSlot, sal_True, &pItem ) ) 408*cdf0e10cSrcweir bSet = ((const SfxBoolItem*)pItem)->GetValue(); 409*cdf0e10cSrcweir else 410*cdf0e10cSrcweir { // Toggle 411*cdf0e10cSrcweir ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current()); 412*cdf0e10cSrcweir if ( pDocSh ) 413*cdf0e10cSrcweir bSet = !pDocSh->GetDocument()->GetDocOptions().IsAutoSpell(); 414*cdf0e10cSrcweir else 415*cdf0e10cSrcweir bSet = !GetDocOptions().IsAutoSpell(); 416*cdf0e10cSrcweir } 417*cdf0e10cSrcweir 418*cdf0e10cSrcweir SfxItemSet aSet( GetPool(), SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK ); 419*cdf0e10cSrcweir aSet.Put( SfxBoolItem( SID_AUTOSPELL_CHECK, bSet ) ); 420*cdf0e10cSrcweir ModifyOptions( aSet ); 421*cdf0e10cSrcweir rReq.Done(); 422*cdf0e10cSrcweir } 423*cdf0e10cSrcweir break; 424*cdf0e10cSrcweir 425*cdf0e10cSrcweir case SID_ATTR_METRIC: 426*cdf0e10cSrcweir { 427*cdf0e10cSrcweir const SfxPoolItem* pItem; 428*cdf0e10cSrcweir if ( pReqArgs && SFX_ITEM_SET == pReqArgs->GetItemState( nSlot, sal_True, &pItem ) ) 429*cdf0e10cSrcweir { 430*cdf0e10cSrcweir FieldUnit eUnit = (FieldUnit)((const SfxUInt16Item*)pItem)->GetValue(); 431*cdf0e10cSrcweir switch( eUnit ) 432*cdf0e10cSrcweir { 433*cdf0e10cSrcweir case FUNIT_MM: // nur die Einheiten, die auch im Dialog stehen 434*cdf0e10cSrcweir case FUNIT_CM: 435*cdf0e10cSrcweir case FUNIT_INCH: 436*cdf0e10cSrcweir case FUNIT_PICA: 437*cdf0e10cSrcweir case FUNIT_POINT: 438*cdf0e10cSrcweir { 439*cdf0e10cSrcweir PutItem( *pItem ); 440*cdf0e10cSrcweir ScAppOptions aNewOpts( GetAppOptions() ); 441*cdf0e10cSrcweir aNewOpts.SetAppMetric( eUnit ); 442*cdf0e10cSrcweir SetAppOptions( aNewOpts ); 443*cdf0e10cSrcweir rReq.Done(); 444*cdf0e10cSrcweir } 445*cdf0e10cSrcweir break; 446*cdf0e10cSrcweir default: 447*cdf0e10cSrcweir { 448*cdf0e10cSrcweir // added to avoid warnings 449*cdf0e10cSrcweir } 450*cdf0e10cSrcweir } 451*cdf0e10cSrcweir } 452*cdf0e10cSrcweir } 453*cdf0e10cSrcweir break; 454*cdf0e10cSrcweir 455*cdf0e10cSrcweir case FID_AUTOCOMPLETE: 456*cdf0e10cSrcweir { 457*cdf0e10cSrcweir ScAppOptions aNewOpts( GetAppOptions() ); 458*cdf0e10cSrcweir sal_Bool bNew = !aNewOpts.GetAutoComplete(); 459*cdf0e10cSrcweir aNewOpts.SetAutoComplete( bNew ); 460*cdf0e10cSrcweir SetAppOptions( aNewOpts ); 461*cdf0e10cSrcweir ScInputHandler::SetAutoComplete( bNew ); 462*cdf0e10cSrcweir if (pBindings) 463*cdf0e10cSrcweir pBindings->Invalidate( FID_AUTOCOMPLETE ); 464*cdf0e10cSrcweir rReq.Done(); 465*cdf0e10cSrcweir } 466*cdf0e10cSrcweir break; 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir case SID_DETECTIVE_AUTO: 469*cdf0e10cSrcweir { 470*cdf0e10cSrcweir ScAppOptions aNewOpts( GetAppOptions() ); 471*cdf0e10cSrcweir sal_Bool bNew = !aNewOpts.GetDetectiveAuto(); 472*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pAuto, SfxBoolItem, SID_DETECTIVE_AUTO, sal_False ); 473*cdf0e10cSrcweir if ( pAuto ) 474*cdf0e10cSrcweir bNew = pAuto->GetValue(); 475*cdf0e10cSrcweir 476*cdf0e10cSrcweir aNewOpts.SetDetectiveAuto( bNew ); 477*cdf0e10cSrcweir SetAppOptions( aNewOpts ); 478*cdf0e10cSrcweir if (pBindings) 479*cdf0e10cSrcweir pBindings->Invalidate( SID_DETECTIVE_AUTO ); 480*cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( SID_DETECTIVE_AUTO, bNew ) ); 481*cdf0e10cSrcweir rReq.Done(); 482*cdf0e10cSrcweir } 483*cdf0e10cSrcweir break; 484*cdf0e10cSrcweir 485*cdf0e10cSrcweir case SID_PSZ_FUNCTION: 486*cdf0e10cSrcweir if (pReqArgs) 487*cdf0e10cSrcweir { 488*cdf0e10cSrcweir const SfxUInt16Item& rItem = (const SfxUInt16Item&)pReqArgs->Get(SID_PSZ_FUNCTION); 489*cdf0e10cSrcweir DBG_ASSERT(rItem.ISA(SfxUInt16Item),"falscher Parameter"); 490*cdf0e10cSrcweir 491*cdf0e10cSrcweir ScAppOptions aNewOpts( GetAppOptions() ); 492*cdf0e10cSrcweir aNewOpts.SetStatusFunc( rItem.GetValue() ); 493*cdf0e10cSrcweir SetAppOptions( aNewOpts ); 494*cdf0e10cSrcweir 495*cdf0e10cSrcweir if (pBindings) 496*cdf0e10cSrcweir { 497*cdf0e10cSrcweir pBindings->Invalidate( SID_TABLE_CELL ); 498*cdf0e10cSrcweir pBindings->Update( SID_TABLE_CELL ); // sofort 499*cdf0e10cSrcweir 500*cdf0e10cSrcweir pBindings->Invalidate( SID_PSZ_FUNCTION ); 501*cdf0e10cSrcweir pBindings->Update( SID_PSZ_FUNCTION ); 502*cdf0e10cSrcweir // falls Menue gleich wieder aufgeklappt wird 503*cdf0e10cSrcweir } 504*cdf0e10cSrcweir } 505*cdf0e10cSrcweir break; 506*cdf0e10cSrcweir 507*cdf0e10cSrcweir case SID_ATTR_LANGUAGE: 508*cdf0e10cSrcweir case SID_ATTR_CHAR_CJK_LANGUAGE: 509*cdf0e10cSrcweir case SID_ATTR_CHAR_CTL_LANGUAGE: 510*cdf0e10cSrcweir { 511*cdf0e10cSrcweir const SfxPoolItem* pItem; 512*cdf0e10cSrcweir if ( pReqArgs && SFX_ITEM_SET == pReqArgs->GetItemState( GetPool().GetWhich(nSlot), sal_True, &pItem ) ) 513*cdf0e10cSrcweir { 514*cdf0e10cSrcweir ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current()); 515*cdf0e10cSrcweir ScDocument* pDoc = pDocSh ? pDocSh->GetDocument() : NULL; 516*cdf0e10cSrcweir if ( pDoc ) 517*cdf0e10cSrcweir { 518*cdf0e10cSrcweir LanguageType eNewLang = ((SvxLanguageItem*)pItem)->GetLanguage(); 519*cdf0e10cSrcweir LanguageType eLatin, eCjk, eCtl; 520*cdf0e10cSrcweir pDoc->GetLanguage( eLatin, eCjk, eCtl ); 521*cdf0e10cSrcweir LanguageType eOld = ( nSlot == SID_ATTR_CHAR_CJK_LANGUAGE ) ? eCjk : 522*cdf0e10cSrcweir ( ( nSlot == SID_ATTR_CHAR_CTL_LANGUAGE ) ? eCtl : eLatin ); 523*cdf0e10cSrcweir if ( eNewLang != eOld ) 524*cdf0e10cSrcweir { 525*cdf0e10cSrcweir if ( nSlot == SID_ATTR_CHAR_CJK_LANGUAGE ) 526*cdf0e10cSrcweir eCjk = eNewLang; 527*cdf0e10cSrcweir else if ( nSlot == SID_ATTR_CHAR_CTL_LANGUAGE ) 528*cdf0e10cSrcweir eCtl = eNewLang; 529*cdf0e10cSrcweir else 530*cdf0e10cSrcweir eLatin = eNewLang; 531*cdf0e10cSrcweir 532*cdf0e10cSrcweir pDoc->SetLanguage( eLatin, eCjk, eCtl ); 533*cdf0e10cSrcweir 534*cdf0e10cSrcweir ScInputHandler* pInputHandler = GetInputHdl(); 535*cdf0e10cSrcweir if ( pInputHandler ) 536*cdf0e10cSrcweir pInputHandler->UpdateSpellSettings(); // EditEngine-Flags 537*cdf0e10cSrcweir ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell, SfxViewShell::Current()); 538*cdf0e10cSrcweir if ( pViewSh ) 539*cdf0e10cSrcweir pViewSh->UpdateDrawTextOutliner(); // EditEngine-Flags 540*cdf0e10cSrcweir 541*cdf0e10cSrcweir pDocSh->SetDocumentModified(); 542*cdf0e10cSrcweir } 543*cdf0e10cSrcweir } 544*cdf0e10cSrcweir } 545*cdf0e10cSrcweir } 546*cdf0e10cSrcweir break; 547*cdf0e10cSrcweir 548*cdf0e10cSrcweir case FID_FOCUS_POSWND: 549*cdf0e10cSrcweir { 550*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(); 551*cdf0e10cSrcweir if (pHdl) 552*cdf0e10cSrcweir { 553*cdf0e10cSrcweir ScInputWindow* pWin = pHdl->GetInputWindow(); 554*cdf0e10cSrcweir if (pWin) 555*cdf0e10cSrcweir pWin->PosGrabFocus(); 556*cdf0e10cSrcweir } 557*cdf0e10cSrcweir rReq.Done(); 558*cdf0e10cSrcweir } 559*cdf0e10cSrcweir break; 560*cdf0e10cSrcweir 561*cdf0e10cSrcweir case SID_OPEN_XML_FILTERSETTINGS: 562*cdf0e10cSrcweir { 563*cdf0e10cSrcweir try 564*cdf0e10cSrcweir { 565*cdf0e10cSrcweir com::sun::star::uno::Reference < ::com::sun::star::ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.comp.ui.XSLTFilterDialog")), com::sun::star::uno::UNO_QUERY); 566*cdf0e10cSrcweir if( xDialog.is() ) 567*cdf0e10cSrcweir { 568*cdf0e10cSrcweir xDialog->execute(); 569*cdf0e10cSrcweir } 570*cdf0e10cSrcweir } 571*cdf0e10cSrcweir catch( ::com::sun::star::uno::RuntimeException& ) 572*cdf0e10cSrcweir { 573*cdf0e10cSrcweir } 574*cdf0e10cSrcweir } 575*cdf0e10cSrcweir break; 576*cdf0e10cSrcweir 577*cdf0e10cSrcweir default: 578*cdf0e10cSrcweir DBG_ERROR( "ScApplication: Unknown Message." ); 579*cdf0e10cSrcweir break; 580*cdf0e10cSrcweir } 581*cdf0e10cSrcweir } 582*cdf0e10cSrcweir 583*cdf0e10cSrcweir void ScModule::GetState( SfxItemSet& rSet ) 584*cdf0e10cSrcweir { 585*cdf0e10cSrcweir SfxWhichIter aIter(rSet); 586*cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 587*cdf0e10cSrcweir while ( nWhich ) 588*cdf0e10cSrcweir { 589*cdf0e10cSrcweir switch ( nWhich ) 590*cdf0e10cSrcweir { 591*cdf0e10cSrcweir case FID_AUTOCOMPLETE: 592*cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, GetAppOptions().GetAutoComplete() ) ); 593*cdf0e10cSrcweir break; 594*cdf0e10cSrcweir case SID_DETECTIVE_AUTO: 595*cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, GetAppOptions().GetDetectiveAuto() ) ); 596*cdf0e10cSrcweir break; 597*cdf0e10cSrcweir case SID_PSZ_FUNCTION: 598*cdf0e10cSrcweir rSet.Put( SfxUInt16Item( nWhich, GetAppOptions().GetStatusFunc() ) ); 599*cdf0e10cSrcweir break; 600*cdf0e10cSrcweir case SID_ATTR_METRIC: 601*cdf0e10cSrcweir rSet.Put( SfxUInt16Item( nWhich, sal::static_int_cast<sal_uInt16>(GetAppOptions().GetAppMetric()) ) ); 602*cdf0e10cSrcweir break; 603*cdf0e10cSrcweir case SID_AUTOSPELL_CHECK: 604*cdf0e10cSrcweir { 605*cdf0e10cSrcweir sal_Bool bAuto; 606*cdf0e10cSrcweir ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current()); 607*cdf0e10cSrcweir if ( pDocSh ) 608*cdf0e10cSrcweir bAuto = pDocSh->GetDocument()->GetDocOptions().IsAutoSpell(); 609*cdf0e10cSrcweir else 610*cdf0e10cSrcweir { 611*cdf0e10cSrcweir sal_uInt16 nDummyLang, nDummyCjk, nDummyCtl; 612*cdf0e10cSrcweir GetSpellSettings( nDummyLang, nDummyCjk, nDummyCtl, bAuto ); 613*cdf0e10cSrcweir } 614*cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, bAuto ) ); 615*cdf0e10cSrcweir } 616*cdf0e10cSrcweir break; 617*cdf0e10cSrcweir case SID_ATTR_LANGUAGE: 618*cdf0e10cSrcweir case ATTR_CJK_FONT_LANGUAGE: // WID for SID_ATTR_CHAR_CJK_LANGUAGE 619*cdf0e10cSrcweir case ATTR_CTL_FONT_LANGUAGE: // WID for SID_ATTR_CHAR_CTL_LANGUAGE 620*cdf0e10cSrcweir { 621*cdf0e10cSrcweir ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current()); 622*cdf0e10cSrcweir ScDocument* pDoc = pDocSh ? pDocSh->GetDocument() : NULL; 623*cdf0e10cSrcweir if ( pDoc ) 624*cdf0e10cSrcweir { 625*cdf0e10cSrcweir LanguageType eLatin, eCjk, eCtl; 626*cdf0e10cSrcweir pDoc->GetLanguage( eLatin, eCjk, eCtl ); 627*cdf0e10cSrcweir LanguageType eLang = ( nWhich == ATTR_CJK_FONT_LANGUAGE ) ? eCjk : 628*cdf0e10cSrcweir ( ( nWhich == ATTR_CTL_FONT_LANGUAGE ) ? eCtl : eLatin ); 629*cdf0e10cSrcweir rSet.Put( SvxLanguageItem( eLang, nWhich ) ); 630*cdf0e10cSrcweir } 631*cdf0e10cSrcweir } 632*cdf0e10cSrcweir break; 633*cdf0e10cSrcweir 634*cdf0e10cSrcweir } 635*cdf0e10cSrcweir nWhich = aIter.NextWhich(); 636*cdf0e10cSrcweir } 637*cdf0e10cSrcweir } 638*cdf0e10cSrcweir 639*cdf0e10cSrcweir 640*cdf0e10cSrcweir void ScModule::HideDisabledSlots( SfxItemSet& rSet ) 641*cdf0e10cSrcweir { 642*cdf0e10cSrcweir if( SfxViewFrame* pViewFrm = SfxViewFrame::Current() ) 643*cdf0e10cSrcweir { 644*cdf0e10cSrcweir SfxBindings& rBindings = pViewFrm->GetBindings(); 645*cdf0e10cSrcweir SfxWhichIter aIter( rSet ); 646*cdf0e10cSrcweir for( sal_uInt16 nWhich = aIter.FirstWhich(); nWhich != 0; nWhich = aIter.NextWhich() ) 647*cdf0e10cSrcweir { 648*cdf0e10cSrcweir ScViewUtil::HideDisabledSlot( rSet, rBindings, nWhich ); 649*cdf0e10cSrcweir // always disable the slots 650*cdf0e10cSrcweir rSet.DisableItem( nWhich ); 651*cdf0e10cSrcweir } 652*cdf0e10cSrcweir } 653*cdf0e10cSrcweir } 654*cdf0e10cSrcweir 655*cdf0e10cSrcweir 656*cdf0e10cSrcweir //------------------------------------------------------------------ 657*cdf0e10cSrcweir 658*cdf0e10cSrcweir void ScModule::ResetDragObject() 659*cdf0e10cSrcweir { 660*cdf0e10cSrcweir aDragData.pCellTransfer = NULL; 661*cdf0e10cSrcweir aDragData.pDrawTransfer = NULL; 662*cdf0e10cSrcweir 663*cdf0e10cSrcweir aDragData.aLinkDoc.Erase(); 664*cdf0e10cSrcweir aDragData.aLinkTable.Erase(); 665*cdf0e10cSrcweir aDragData.aLinkArea.Erase(); 666*cdf0e10cSrcweir aDragData.pJumpLocalDoc = NULL; 667*cdf0e10cSrcweir aDragData.aJumpTarget.Erase(); 668*cdf0e10cSrcweir aDragData.aJumpText.Erase(); 669*cdf0e10cSrcweir } 670*cdf0e10cSrcweir 671*cdf0e10cSrcweir void ScModule::SetDragObject( ScTransferObj* pCellObj, ScDrawTransferObj* pDrawObj ) 672*cdf0e10cSrcweir { 673*cdf0e10cSrcweir ResetDragObject(); 674*cdf0e10cSrcweir aDragData.pCellTransfer = pCellObj; 675*cdf0e10cSrcweir aDragData.pDrawTransfer = pDrawObj; 676*cdf0e10cSrcweir } 677*cdf0e10cSrcweir 678*cdf0e10cSrcweir void ScModule::SetDragLink( const String& rDoc, const String& rTab, const String& rArea ) 679*cdf0e10cSrcweir { 680*cdf0e10cSrcweir ResetDragObject(); 681*cdf0e10cSrcweir 682*cdf0e10cSrcweir aDragData.aLinkDoc = rDoc; 683*cdf0e10cSrcweir aDragData.aLinkTable = rTab; 684*cdf0e10cSrcweir aDragData.aLinkArea = rArea; 685*cdf0e10cSrcweir } 686*cdf0e10cSrcweir 687*cdf0e10cSrcweir void ScModule::SetDragJump( ScDocument* pLocalDoc, const String& rTarget, const String& rText ) 688*cdf0e10cSrcweir { 689*cdf0e10cSrcweir ResetDragObject(); 690*cdf0e10cSrcweir 691*cdf0e10cSrcweir aDragData.pJumpLocalDoc = pLocalDoc; 692*cdf0e10cSrcweir aDragData.aJumpTarget = rTarget; 693*cdf0e10cSrcweir aDragData.aJumpText = rText; 694*cdf0e10cSrcweir } 695*cdf0e10cSrcweir 696*cdf0e10cSrcweir //------------------------------------------------------------------ 697*cdf0e10cSrcweir 698*cdf0e10cSrcweir void ScModule::SetClipObject( ScTransferObj* pCellObj, ScDrawTransferObj* pDrawObj ) 699*cdf0e10cSrcweir { 700*cdf0e10cSrcweir DBG_ASSERT( !pCellObj || !pDrawObj, "SetClipObject: not allowed to set both objects" ); 701*cdf0e10cSrcweir 702*cdf0e10cSrcweir aClipData.pCellClipboard = pCellObj; 703*cdf0e10cSrcweir aClipData.pDrawClipboard = pDrawObj; 704*cdf0e10cSrcweir } 705*cdf0e10cSrcweir 706*cdf0e10cSrcweir ScDocument* ScModule::GetClipDoc() 707*cdf0e10cSrcweir { 708*cdf0e10cSrcweir // called from document 709*cdf0e10cSrcweir 710*cdf0e10cSrcweir ScTransferObj* pObj = ScTransferObj::GetOwnClipboard( NULL ); 711*cdf0e10cSrcweir if (pObj) 712*cdf0e10cSrcweir return pObj->GetDocument(); 713*cdf0e10cSrcweir 714*cdf0e10cSrcweir return NULL; 715*cdf0e10cSrcweir } 716*cdf0e10cSrcweir 717*cdf0e10cSrcweir //------------------------------------------------------------------ 718*cdf0e10cSrcweir 719*cdf0e10cSrcweir void ScModule::SetSelectionTransfer( ScSelectionTransferObj* pNew ) 720*cdf0e10cSrcweir { 721*cdf0e10cSrcweir pSelTransfer = pNew; 722*cdf0e10cSrcweir } 723*cdf0e10cSrcweir 724*cdf0e10cSrcweir //------------------------------------------------------------------ 725*cdf0e10cSrcweir 726*cdf0e10cSrcweir void ScModule::InitFormEditData() 727*cdf0e10cSrcweir { 728*cdf0e10cSrcweir pFormEditData = new ScFormEditData; 729*cdf0e10cSrcweir } 730*cdf0e10cSrcweir 731*cdf0e10cSrcweir void ScModule::ClearFormEditData() 732*cdf0e10cSrcweir { 733*cdf0e10cSrcweir DELETEZ( pFormEditData ); 734*cdf0e10cSrcweir } 735*cdf0e10cSrcweir 736*cdf0e10cSrcweir //------------------------------------------------------------------ 737*cdf0e10cSrcweir 738*cdf0e10cSrcweir void ScModule::SetViewOptions( const ScViewOptions& rOpt ) 739*cdf0e10cSrcweir { 740*cdf0e10cSrcweir if ( !pViewCfg ) 741*cdf0e10cSrcweir pViewCfg = new ScViewCfg; 742*cdf0e10cSrcweir 743*cdf0e10cSrcweir pViewCfg->SetOptions( rOpt ); 744*cdf0e10cSrcweir } 745*cdf0e10cSrcweir 746*cdf0e10cSrcweir const ScViewOptions& ScModule::GetViewOptions() 747*cdf0e10cSrcweir { 748*cdf0e10cSrcweir if ( !pViewCfg ) 749*cdf0e10cSrcweir pViewCfg = new ScViewCfg; 750*cdf0e10cSrcweir 751*cdf0e10cSrcweir return *pViewCfg; 752*cdf0e10cSrcweir } 753*cdf0e10cSrcweir 754*cdf0e10cSrcweir void ScModule::SetDocOptions( const ScDocOptions& rOpt ) 755*cdf0e10cSrcweir { 756*cdf0e10cSrcweir if ( !pDocCfg ) 757*cdf0e10cSrcweir pDocCfg = new ScDocCfg; 758*cdf0e10cSrcweir 759*cdf0e10cSrcweir pDocCfg->SetOptions( rOpt ); 760*cdf0e10cSrcweir } 761*cdf0e10cSrcweir 762*cdf0e10cSrcweir const ScDocOptions& ScModule::GetDocOptions() 763*cdf0e10cSrcweir { 764*cdf0e10cSrcweir if ( !pDocCfg ) 765*cdf0e10cSrcweir pDocCfg = new ScDocCfg; 766*cdf0e10cSrcweir 767*cdf0e10cSrcweir return *pDocCfg; 768*cdf0e10cSrcweir } 769*cdf0e10cSrcweir 770*cdf0e10cSrcweir #ifndef LRU_MAX 771*cdf0e10cSrcweir #define LRU_MAX 10 772*cdf0e10cSrcweir #endif 773*cdf0e10cSrcweir 774*cdf0e10cSrcweir void ScModule::InsertEntryToLRUList(sal_uInt16 nFIndex) 775*cdf0e10cSrcweir { 776*cdf0e10cSrcweir if(nFIndex != 0) 777*cdf0e10cSrcweir { 778*cdf0e10cSrcweir const ScAppOptions& rAppOpt = GetAppOptions(); 779*cdf0e10cSrcweir sal_uInt16 nLRUFuncCount = Min( rAppOpt.GetLRUFuncListCount(), (sal_uInt16)LRU_MAX ); 780*cdf0e10cSrcweir sal_uInt16* pLRUListIds = rAppOpt.GetLRUFuncList(); 781*cdf0e10cSrcweir 782*cdf0e10cSrcweir sal_uInt16 aIdxList[LRU_MAX]; 783*cdf0e10cSrcweir sal_uInt16 n = 0; 784*cdf0e10cSrcweir sal_Bool bFound = sal_False; 785*cdf0e10cSrcweir 786*cdf0e10cSrcweir while ((n < LRU_MAX) && n<nLRUFuncCount) // alte Liste abklappern 787*cdf0e10cSrcweir { 788*cdf0e10cSrcweir if (!bFound && (pLRUListIds[n]== nFIndex)) 789*cdf0e10cSrcweir bFound = sal_True; // erster! Treffer 790*cdf0e10cSrcweir else if (bFound) 791*cdf0e10cSrcweir aIdxList[n ] = pLRUListIds[n]; // hinter Treffer kopieren 792*cdf0e10cSrcweir else if ((n+1) < LRU_MAX) 793*cdf0e10cSrcweir aIdxList[n+1] = pLRUListIds[n]; // vor Treffer verschieben 794*cdf0e10cSrcweir n++; 795*cdf0e10cSrcweir } 796*cdf0e10cSrcweir if (!bFound && (n < LRU_MAX)) // Eintrag nicht gefunden? 797*cdf0e10cSrcweir n++; // einen mehr 798*cdf0e10cSrcweir aIdxList[0] = nFIndex; // Current on Top 799*cdf0e10cSrcweir 800*cdf0e10cSrcweir ScAppOptions aNewOpts(rAppOpt); // an App melden 801*cdf0e10cSrcweir aNewOpts.SetLRUFuncList(aIdxList, n); 802*cdf0e10cSrcweir SetAppOptions(aNewOpts); 803*cdf0e10cSrcweir 804*cdf0e10cSrcweir RecentFunctionsChanged(); 805*cdf0e10cSrcweir } 806*cdf0e10cSrcweir } 807*cdf0e10cSrcweir 808*cdf0e10cSrcweir void ScModule::RecentFunctionsChanged() 809*cdf0e10cSrcweir { 810*cdf0e10cSrcweir // update function list window 811*cdf0e10cSrcweir sal_uInt16 nFuncListID = ScFunctionChildWindow::GetChildWindowId(); 812*cdf0e10cSrcweir 813*cdf0e10cSrcweir //! notify all views 814*cdf0e10cSrcweir SfxViewFrame* pViewFrm = SfxViewFrame::Current(); 815*cdf0e10cSrcweir if ( pViewFrm && pViewFrm->HasChildWindow(nFuncListID) ) 816*cdf0e10cSrcweir { 817*cdf0e10cSrcweir ScFunctionChildWindow* pWnd =(ScFunctionChildWindow*)pViewFrm->GetChildWindow( nFuncListID ); 818*cdf0e10cSrcweir 819*cdf0e10cSrcweir ScFunctionDockWin* pFuncList=(ScFunctionDockWin*)pWnd->GetWindow(); 820*cdf0e10cSrcweir 821*cdf0e10cSrcweir pFuncList->InitLRUList(); 822*cdf0e10cSrcweir } 823*cdf0e10cSrcweir } 824*cdf0e10cSrcweir 825*cdf0e10cSrcweir void ScModule::SetAppOptions( const ScAppOptions& rOpt ) 826*cdf0e10cSrcweir { 827*cdf0e10cSrcweir if ( !pAppCfg ) 828*cdf0e10cSrcweir pAppCfg = new ScAppCfg; 829*cdf0e10cSrcweir 830*cdf0e10cSrcweir pAppCfg->SetOptions( rOpt ); 831*cdf0e10cSrcweir } 832*cdf0e10cSrcweir 833*cdf0e10cSrcweir void global_InitAppOptions() 834*cdf0e10cSrcweir { 835*cdf0e10cSrcweir SC_MOD()->GetAppOptions(); 836*cdf0e10cSrcweir } 837*cdf0e10cSrcweir 838*cdf0e10cSrcweir const ScAppOptions& ScModule::GetAppOptions() 839*cdf0e10cSrcweir { 840*cdf0e10cSrcweir if ( !pAppCfg ) 841*cdf0e10cSrcweir pAppCfg = new ScAppCfg; 842*cdf0e10cSrcweir 843*cdf0e10cSrcweir return *pAppCfg; 844*cdf0e10cSrcweir } 845*cdf0e10cSrcweir 846*cdf0e10cSrcweir void ScModule::SetInputOptions( const ScInputOptions& rOpt ) 847*cdf0e10cSrcweir { 848*cdf0e10cSrcweir if ( !pInputCfg ) 849*cdf0e10cSrcweir pInputCfg = new ScInputCfg; 850*cdf0e10cSrcweir 851*cdf0e10cSrcweir pInputCfg->SetOptions( rOpt ); 852*cdf0e10cSrcweir } 853*cdf0e10cSrcweir 854*cdf0e10cSrcweir const ScInputOptions& ScModule::GetInputOptions() 855*cdf0e10cSrcweir { 856*cdf0e10cSrcweir if ( !pInputCfg ) 857*cdf0e10cSrcweir pInputCfg = new ScInputCfg; 858*cdf0e10cSrcweir 859*cdf0e10cSrcweir return *pInputCfg; 860*cdf0e10cSrcweir } 861*cdf0e10cSrcweir 862*cdf0e10cSrcweir void ScModule::SetPrintOptions( const ScPrintOptions& rOpt ) 863*cdf0e10cSrcweir { 864*cdf0e10cSrcweir if ( !pPrintCfg ) 865*cdf0e10cSrcweir pPrintCfg = new ScPrintCfg; 866*cdf0e10cSrcweir 867*cdf0e10cSrcweir pPrintCfg->SetOptions( rOpt ); 868*cdf0e10cSrcweir } 869*cdf0e10cSrcweir 870*cdf0e10cSrcweir const ScPrintOptions& ScModule::GetPrintOptions() 871*cdf0e10cSrcweir { 872*cdf0e10cSrcweir if ( !pPrintCfg ) 873*cdf0e10cSrcweir pPrintCfg = new ScPrintCfg; 874*cdf0e10cSrcweir 875*cdf0e10cSrcweir return *pPrintCfg; 876*cdf0e10cSrcweir } 877*cdf0e10cSrcweir 878*cdf0e10cSrcweir ScNavipiCfg& ScModule::GetNavipiCfg() 879*cdf0e10cSrcweir { 880*cdf0e10cSrcweir if ( !pNavipiCfg ) 881*cdf0e10cSrcweir pNavipiCfg = new ScNavipiCfg; 882*cdf0e10cSrcweir 883*cdf0e10cSrcweir return *pNavipiCfg; 884*cdf0e10cSrcweir } 885*cdf0e10cSrcweir 886*cdf0e10cSrcweir ScAddInCfg& ScModule::GetAddInCfg() 887*cdf0e10cSrcweir { 888*cdf0e10cSrcweir if ( !pAddInCfg ) 889*cdf0e10cSrcweir pAddInCfg = new ScAddInCfg; 890*cdf0e10cSrcweir 891*cdf0e10cSrcweir return *pAddInCfg; 892*cdf0e10cSrcweir } 893*cdf0e10cSrcweir 894*cdf0e10cSrcweir svtools::ColorConfig& ScModule::GetColorConfig() 895*cdf0e10cSrcweir { 896*cdf0e10cSrcweir if ( !pColorConfig ) 897*cdf0e10cSrcweir { 898*cdf0e10cSrcweir pColorConfig = new svtools::ColorConfig; 899*cdf0e10cSrcweir pColorConfig->AddListener(this); 900*cdf0e10cSrcweir } 901*cdf0e10cSrcweir 902*cdf0e10cSrcweir return *pColorConfig; 903*cdf0e10cSrcweir } 904*cdf0e10cSrcweir 905*cdf0e10cSrcweir SvtAccessibilityOptions& ScModule::GetAccessOptions() 906*cdf0e10cSrcweir { 907*cdf0e10cSrcweir if ( !pAccessOptions ) 908*cdf0e10cSrcweir { 909*cdf0e10cSrcweir pAccessOptions = new SvtAccessibilityOptions; 910*cdf0e10cSrcweir pAccessOptions->AddListener(this); 911*cdf0e10cSrcweir } 912*cdf0e10cSrcweir 913*cdf0e10cSrcweir return *pAccessOptions; 914*cdf0e10cSrcweir } 915*cdf0e10cSrcweir 916*cdf0e10cSrcweir SvtCTLOptions& ScModule::GetCTLOptions() 917*cdf0e10cSrcweir { 918*cdf0e10cSrcweir if ( !pCTLOptions ) 919*cdf0e10cSrcweir { 920*cdf0e10cSrcweir pCTLOptions = new SvtCTLOptions; 921*cdf0e10cSrcweir pCTLOptions->AddListener(this); 922*cdf0e10cSrcweir } 923*cdf0e10cSrcweir 924*cdf0e10cSrcweir return *pCTLOptions; 925*cdf0e10cSrcweir } 926*cdf0e10cSrcweir 927*cdf0e10cSrcweir SvtUserOptions& ScModule::GetUserOptions() 928*cdf0e10cSrcweir { 929*cdf0e10cSrcweir if( !pUserOptions ) 930*cdf0e10cSrcweir { 931*cdf0e10cSrcweir pUserOptions = new SvtUserOptions; 932*cdf0e10cSrcweir } 933*cdf0e10cSrcweir return *pUserOptions; 934*cdf0e10cSrcweir } 935*cdf0e10cSrcweir 936*cdf0e10cSrcweir sal_uInt16 ScModule::GetOptDigitLanguage() 937*cdf0e10cSrcweir { 938*cdf0e10cSrcweir SvtCTLOptions::TextNumerals eNumerals = GetCTLOptions().GetCTLTextNumerals(); 939*cdf0e10cSrcweir return ( eNumerals == SvtCTLOptions::NUMERALS_ARABIC ) ? LANGUAGE_ENGLISH_US : 940*cdf0e10cSrcweir ( eNumerals == SvtCTLOptions::NUMERALS_HINDI) ? LANGUAGE_ARABIC_SAUDI_ARABIA : 941*cdf0e10cSrcweir LANGUAGE_SYSTEM; 942*cdf0e10cSrcweir } 943*cdf0e10cSrcweir 944*cdf0e10cSrcweir //------------------------------------------------------------------ 945*cdf0e10cSrcweir // 946*cdf0e10cSrcweir // Optionen 947*cdf0e10cSrcweir // 948*cdf0e10cSrcweir //------------------------------------------------------------------ 949*cdf0e10cSrcweir 950*cdf0e10cSrcweir // 951*cdf0e10cSrcweir // ModifyOptions - Items aus Calc-Options-Dialog 952*cdf0e10cSrcweir // und SID_AUTOSPELL_CHECK 953*cdf0e10cSrcweir // 954*cdf0e10cSrcweir 955*cdf0e10cSrcweir #define IS_AVAILABLE(w,item) (SFX_ITEM_SET==rOptSet.GetItemState((w),sal_True,&item)) 956*cdf0e10cSrcweir 957*cdf0e10cSrcweir void ScModule::ModifyOptions( const SfxItemSet& rOptSet ) 958*cdf0e10cSrcweir { 959*cdf0e10cSrcweir sal_uInt16 nOldSpellLang, nOldCjkLang, nOldCtlLang; 960*cdf0e10cSrcweir sal_Bool bOldAutoSpell; 961*cdf0e10cSrcweir GetSpellSettings( nOldSpellLang, nOldCjkLang, nOldCtlLang, bOldAutoSpell ); 962*cdf0e10cSrcweir 963*cdf0e10cSrcweir if (!pAppCfg) 964*cdf0e10cSrcweir GetAppOptions(); 965*cdf0e10cSrcweir DBG_ASSERT( pAppCfg, "AppOptions not initialised :-(" ); 966*cdf0e10cSrcweir 967*cdf0e10cSrcweir if (!pInputCfg) 968*cdf0e10cSrcweir GetInputOptions(); 969*cdf0e10cSrcweir DBG_ASSERT( pInputCfg, "InputOptions not initialised :-(" ); 970*cdf0e10cSrcweir 971*cdf0e10cSrcweir //-------------------------------------------------------------- 972*cdf0e10cSrcweir 973*cdf0e10cSrcweir SfxViewFrame* pViewFrm = SfxViewFrame::Current(); 974*cdf0e10cSrcweir SfxBindings* pBindings = pViewFrm ? &pViewFrm->GetBindings() : NULL; 975*cdf0e10cSrcweir 976*cdf0e10cSrcweir ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell, SfxViewShell::Current()); 977*cdf0e10cSrcweir ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current()); 978*cdf0e10cSrcweir ScDocument* pDoc = pDocSh ? pDocSh->GetDocument() : NULL; 979*cdf0e10cSrcweir const SfxPoolItem* pItem = NULL; 980*cdf0e10cSrcweir sal_Bool bRepaint = sal_False; 981*cdf0e10cSrcweir sal_Bool bUpdateMarks = sal_False; 982*cdf0e10cSrcweir sal_Bool bUpdateRefDev = sal_False; 983*cdf0e10cSrcweir sal_Bool bCalcAll = sal_False; 984*cdf0e10cSrcweir sal_Bool bSaveSpellCheck = sal_False; 985*cdf0e10cSrcweir sal_Bool bSaveAppOptions = sal_False; 986*cdf0e10cSrcweir sal_Bool bSaveInputOptions = sal_False; 987*cdf0e10cSrcweir 988*cdf0e10cSrcweir //-------------------------------------------------------------------------- 989*cdf0e10cSrcweir 990*cdf0e10cSrcweir // SFX_APP()->SetOptions( rOptSet ); 991*cdf0e10cSrcweir 992*cdf0e10cSrcweir // Linguistik nicht mehr 993*cdf0e10cSrcweir 994*cdf0e10cSrcweir if ( IS_AVAILABLE(SID_ATTR_METRIC,pItem) ) 995*cdf0e10cSrcweir { 996*cdf0e10cSrcweir PutItem( *pItem ); 997*cdf0e10cSrcweir pAppCfg->SetAppMetric( (FieldUnit)((const SfxUInt16Item*)pItem)->GetValue() ); 998*cdf0e10cSrcweir bSaveAppOptions = sal_True; 999*cdf0e10cSrcweir } 1000*cdf0e10cSrcweir 1001*cdf0e10cSrcweir if ( IS_AVAILABLE(SCITEM_USERLIST,pItem) ) 1002*cdf0e10cSrcweir { 1003*cdf0e10cSrcweir ScGlobal::SetUserList( ((const ScUserListItem*)pItem)->GetUserList() ); 1004*cdf0e10cSrcweir bSaveAppOptions = sal_True; 1005*cdf0e10cSrcweir } 1006*cdf0e10cSrcweir 1007*cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SC_OPT_SYNCZOOM,pItem) ) 1008*cdf0e10cSrcweir { 1009*cdf0e10cSrcweir pAppCfg->SetSynchronizeZoom( static_cast<const SfxBoolItem*>(pItem)->GetValue() ); 1010*cdf0e10cSrcweir bSaveAppOptions = sal_True; 1011*cdf0e10cSrcweir } 1012*cdf0e10cSrcweir 1013*cdf0e10cSrcweir //============================================ 1014*cdf0e10cSrcweir // ViewOptions 1015*cdf0e10cSrcweir //============================================ 1016*cdf0e10cSrcweir 1017*cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SCVIEWOPTIONS,pItem) ) 1018*cdf0e10cSrcweir { 1019*cdf0e10cSrcweir const ScViewOptions& rNewOpt = ((const ScTpViewItem*)pItem)->GetViewOptions(); 1020*cdf0e10cSrcweir 1021*cdf0e10cSrcweir if ( pViewSh ) 1022*cdf0e10cSrcweir { 1023*cdf0e10cSrcweir ScViewData* pViewData = pViewSh->GetViewData(); 1024*cdf0e10cSrcweir const ScViewOptions& rOldOpt = pViewData->GetOptions(); 1025*cdf0e10cSrcweir 1026*cdf0e10cSrcweir sal_Bool bAnchorList = ( rOldOpt.GetOption( VOPT_ANCHOR ) != 1027*cdf0e10cSrcweir rNewOpt.GetOption( VOPT_ANCHOR ) ); 1028*cdf0e10cSrcweir 1029*cdf0e10cSrcweir if ( rOldOpt != rNewOpt ) 1030*cdf0e10cSrcweir { 1031*cdf0e10cSrcweir pViewData->SetOptions( rNewOpt ); // veraendert rOldOpt 1032*cdf0e10cSrcweir pViewData->GetDocument()->SetViewOptions( rNewOpt ); 1033*cdf0e10cSrcweir pDocSh->SetDocumentModified(); 1034*cdf0e10cSrcweir bRepaint = sal_True; 1035*cdf0e10cSrcweir } 1036*cdf0e10cSrcweir if ( bAnchorList ) 1037*cdf0e10cSrcweir pViewSh->UpdateAnchorHandles(); 1038*cdf0e10cSrcweir } 1039*cdf0e10cSrcweir SetViewOptions( rNewOpt ); 1040*cdf0e10cSrcweir if (pBindings) 1041*cdf0e10cSrcweir pBindings->Invalidate(SID_HELPLINES_MOVE); 1042*cdf0e10cSrcweir } 1043*cdf0e10cSrcweir 1044*cdf0e10cSrcweir //============================================ 1045*cdf0e10cSrcweir // GridOptions, Auswertung nach ViewOptions, 1046*cdf0e10cSrcweir // da GridOptions Member der ViewOptions ist! 1047*cdf0e10cSrcweir //============================================ 1048*cdf0e10cSrcweir 1049*cdf0e10cSrcweir if ( IS_AVAILABLE(SID_ATTR_GRID_OPTIONS,pItem) ) 1050*cdf0e10cSrcweir { 1051*cdf0e10cSrcweir ScGridOptions aNewGridOpt( (const SvxOptionsGrid&)((const SvxGridItem&)*pItem) ); 1052*cdf0e10cSrcweir 1053*cdf0e10cSrcweir if ( pViewSh ) 1054*cdf0e10cSrcweir { 1055*cdf0e10cSrcweir ScViewData* pViewData = pViewSh->GetViewData(); 1056*cdf0e10cSrcweir ScViewOptions aNewViewOpt( pViewData->GetOptions() ); 1057*cdf0e10cSrcweir const ScGridOptions& rOldGridOpt = aNewViewOpt.GetGridOptions(); 1058*cdf0e10cSrcweir 1059*cdf0e10cSrcweir if ( rOldGridOpt != aNewGridOpt ) 1060*cdf0e10cSrcweir { 1061*cdf0e10cSrcweir aNewViewOpt.SetGridOptions( aNewGridOpt ); 1062*cdf0e10cSrcweir pViewData->SetOptions( aNewViewOpt ); 1063*cdf0e10cSrcweir pViewData->GetDocument()->SetViewOptions( aNewViewOpt ); 1064*cdf0e10cSrcweir pDocSh->SetDocumentModified(); 1065*cdf0e10cSrcweir bRepaint = sal_True; 1066*cdf0e10cSrcweir } 1067*cdf0e10cSrcweir } 1068*cdf0e10cSrcweir ScViewOptions aNewViewOpt ( GetViewOptions() ); 1069*cdf0e10cSrcweir aNewViewOpt.SetGridOptions( aNewGridOpt ); 1070*cdf0e10cSrcweir SetViewOptions( aNewViewOpt ); 1071*cdf0e10cSrcweir if (pBindings) 1072*cdf0e10cSrcweir { 1073*cdf0e10cSrcweir pBindings->Invalidate(SID_GRID_VISIBLE); 1074*cdf0e10cSrcweir pBindings->Invalidate(SID_GRID_USE); 1075*cdf0e10cSrcweir } 1076*cdf0e10cSrcweir } 1077*cdf0e10cSrcweir 1078*cdf0e10cSrcweir 1079*cdf0e10cSrcweir //============================================ 1080*cdf0e10cSrcweir // DocOptions 1081*cdf0e10cSrcweir //============================================ 1082*cdf0e10cSrcweir 1083*cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SCDOCOPTIONS,pItem) ) 1084*cdf0e10cSrcweir { 1085*cdf0e10cSrcweir const ScDocOptions& rNewOpt = ((const ScTpCalcItem*)pItem)->GetDocOptions(); 1086*cdf0e10cSrcweir 1087*cdf0e10cSrcweir if ( pDoc ) 1088*cdf0e10cSrcweir { 1089*cdf0e10cSrcweir const ScDocOptions& rOldOpt = pDoc->GetDocOptions(); 1090*cdf0e10cSrcweir 1091*cdf0e10cSrcweir bRepaint = ( bRepaint || ( rOldOpt != rNewOpt ) ); 1092*cdf0e10cSrcweir bCalcAll = bRepaint && 1093*cdf0e10cSrcweir ( rOldOpt.IsIter() != rNewOpt.IsIter() 1094*cdf0e10cSrcweir || rOldOpt.GetIterCount() != rNewOpt.GetIterCount() 1095*cdf0e10cSrcweir || rOldOpt.GetIterEps() != rNewOpt.GetIterEps() 1096*cdf0e10cSrcweir || rOldOpt.IsIgnoreCase() != rNewOpt.IsIgnoreCase() 1097*cdf0e10cSrcweir || rOldOpt.IsCalcAsShown() != rNewOpt.IsCalcAsShown() 1098*cdf0e10cSrcweir || (rNewOpt.IsCalcAsShown() && 1099*cdf0e10cSrcweir rOldOpt.GetStdPrecision() != rNewOpt.GetStdPrecision()) 1100*cdf0e10cSrcweir || rOldOpt.IsMatchWholeCell() != rNewOpt.IsMatchWholeCell() 1101*cdf0e10cSrcweir || rOldOpt.GetYear2000() != rNewOpt.GetYear2000() 1102*cdf0e10cSrcweir || rOldOpt.IsFormulaRegexEnabled() != rNewOpt.IsFormulaRegexEnabled() 1103*cdf0e10cSrcweir ); 1104*cdf0e10cSrcweir pDoc->SetDocOptions( rNewOpt ); 1105*cdf0e10cSrcweir pDocSh->SetDocumentModified(); 1106*cdf0e10cSrcweir } 1107*cdf0e10cSrcweir SetDocOptions( rNewOpt ); 1108*cdf0e10cSrcweir } 1109*cdf0e10cSrcweir 1110*cdf0e10cSrcweir // nach den eigentlichen DocOptions auch noch die TabDistance setzen 1111*cdf0e10cSrcweir if ( IS_AVAILABLE(SID_ATTR_DEFTABSTOP,pItem) ) 1112*cdf0e10cSrcweir { 1113*cdf0e10cSrcweir sal_uInt16 nTabDist = ((SfxUInt16Item*)pItem)->GetValue(); 1114*cdf0e10cSrcweir ScDocOptions aOpt(GetDocOptions()); 1115*cdf0e10cSrcweir aOpt.SetTabDistance(nTabDist); 1116*cdf0e10cSrcweir SetDocOptions( aOpt ); 1117*cdf0e10cSrcweir 1118*cdf0e10cSrcweir if ( pDoc ) 1119*cdf0e10cSrcweir { 1120*cdf0e10cSrcweir ScDocOptions aDocOpt(pDoc->GetDocOptions()); 1121*cdf0e10cSrcweir aDocOpt.SetTabDistance(nTabDist); 1122*cdf0e10cSrcweir pDoc->SetDocOptions( aDocOpt ); 1123*cdf0e10cSrcweir pDocSh->SetDocumentModified(); 1124*cdf0e10cSrcweir if(pDoc->GetDrawLayer()) 1125*cdf0e10cSrcweir pDoc->GetDrawLayer()->SetDefaultTabulator(nTabDist); 1126*cdf0e10cSrcweir } 1127*cdf0e10cSrcweir } 1128*cdf0e10cSrcweir 1129*cdf0e10cSrcweir // AutoSpell nach den Doc-Options (weil Member) 1130*cdf0e10cSrcweir 1131*cdf0e10cSrcweir if ( IS_AVAILABLE(SID_AUTOSPELL_CHECK,pItem) ) // an Doc-Options 1132*cdf0e10cSrcweir { 1133*cdf0e10cSrcweir sal_Bool bDoAutoSpell = ((const SfxBoolItem*)pItem)->GetValue(); 1134*cdf0e10cSrcweir 1135*cdf0e10cSrcweir if (pDoc) 1136*cdf0e10cSrcweir { 1137*cdf0e10cSrcweir ScDocOptions aNewOpt = pDoc->GetDocOptions(); 1138*cdf0e10cSrcweir if ( aNewOpt.IsAutoSpell() != bDoAutoSpell ) 1139*cdf0e10cSrcweir { 1140*cdf0e10cSrcweir aNewOpt.SetAutoSpell( bDoAutoSpell ); 1141*cdf0e10cSrcweir pDoc->SetDocOptions( aNewOpt ); 1142*cdf0e10cSrcweir 1143*cdf0e10cSrcweir if (bDoAutoSpell) 1144*cdf0e10cSrcweir pDoc->SetOnlineSpellPos( ScAddress(0,0,0) ); // vorne anfangen 1145*cdf0e10cSrcweir else 1146*cdf0e10cSrcweir { 1147*cdf0e10cSrcweir WaitObject aWait( pDocSh->GetActiveDialogParent() ); 1148*cdf0e10cSrcweir pDoc->RemoveAutoSpellObj(); // Edit-Text-Objekte wieder zurueckwandeln 1149*cdf0e10cSrcweir } 1150*cdf0e10cSrcweir 1151*cdf0e10cSrcweir //#92038#; don't set document modified, because this flag is no longer saved 1152*cdf0e10cSrcweir // pDocSh->SetDocumentModified(); 1153*cdf0e10cSrcweir 1154*cdf0e10cSrcweir bRepaint = sal_True; // weil HideAutoSpell evtl. ungueltig 1155*cdf0e10cSrcweir //! alle Views painten ??? 1156*cdf0e10cSrcweir } 1157*cdf0e10cSrcweir } 1158*cdf0e10cSrcweir 1159*cdf0e10cSrcweir if ( bOldAutoSpell != bDoAutoSpell ) 1160*cdf0e10cSrcweir { 1161*cdf0e10cSrcweir SetAutoSpellProperty( bDoAutoSpell ); 1162*cdf0e10cSrcweir bSaveSpellCheck = sal_True; 1163*cdf0e10cSrcweir } 1164*cdf0e10cSrcweir if ( pDocSh ) 1165*cdf0e10cSrcweir pDocSh->PostPaintGridAll(); // wegen Markierungen 1166*cdf0e10cSrcweir ScInputHandler* pInputHandler = GetInputHdl(); 1167*cdf0e10cSrcweir if ( pInputHandler ) 1168*cdf0e10cSrcweir pInputHandler->UpdateSpellSettings(); // EditEngine-Flags 1169*cdf0e10cSrcweir if ( pViewSh ) 1170*cdf0e10cSrcweir pViewSh->UpdateDrawTextOutliner(); // EditEngine-Flags 1171*cdf0e10cSrcweir 1172*cdf0e10cSrcweir if (pBindings) 1173*cdf0e10cSrcweir pBindings->Invalidate( SID_AUTOSPELL_CHECK ); 1174*cdf0e10cSrcweir } 1175*cdf0e10cSrcweir 1176*cdf0e10cSrcweir //============================================ 1177*cdf0e10cSrcweir // InputOptions 1178*cdf0e10cSrcweir //============================================ 1179*cdf0e10cSrcweir 1180*cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SC_INPUT_SELECTIONPOS,pItem) ) 1181*cdf0e10cSrcweir { 1182*cdf0e10cSrcweir pInputCfg->SetMoveDir( ((const SfxUInt16Item*)pItem)->GetValue() ); 1183*cdf0e10cSrcweir bSaveInputOptions = sal_True; 1184*cdf0e10cSrcweir } 1185*cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SC_INPUT_SELECTION,pItem) ) 1186*cdf0e10cSrcweir { 1187*cdf0e10cSrcweir pInputCfg->SetMoveSelection( ((const SfxBoolItem*)pItem)->GetValue() ); 1188*cdf0e10cSrcweir bSaveInputOptions = sal_True; 1189*cdf0e10cSrcweir } 1190*cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SC_INPUT_EDITMODE,pItem) ) 1191*cdf0e10cSrcweir { 1192*cdf0e10cSrcweir pInputCfg->SetEnterEdit( ((const SfxBoolItem*)pItem)->GetValue() ); 1193*cdf0e10cSrcweir bSaveInputOptions = sal_True; 1194*cdf0e10cSrcweir } 1195*cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SC_INPUT_FMT_EXPAND,pItem) ) 1196*cdf0e10cSrcweir { 1197*cdf0e10cSrcweir pInputCfg->SetExtendFormat( ((const SfxBoolItem*)pItem)->GetValue() ); 1198*cdf0e10cSrcweir bSaveInputOptions = sal_True; 1199*cdf0e10cSrcweir } 1200*cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SC_INPUT_RANGEFINDER,pItem) ) 1201*cdf0e10cSrcweir { 1202*cdf0e10cSrcweir pInputCfg->SetRangeFinder( ((const SfxBoolItem*)pItem)->GetValue() ); 1203*cdf0e10cSrcweir bSaveInputOptions = sal_True; 1204*cdf0e10cSrcweir } 1205*cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SC_INPUT_REF_EXPAND,pItem) ) 1206*cdf0e10cSrcweir { 1207*cdf0e10cSrcweir pInputCfg->SetExpandRefs( ((const SfxBoolItem*)pItem)->GetValue() ); 1208*cdf0e10cSrcweir bSaveInputOptions = sal_True; 1209*cdf0e10cSrcweir } 1210*cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SC_INPUT_MARK_HEADER,pItem) ) 1211*cdf0e10cSrcweir { 1212*cdf0e10cSrcweir pInputCfg->SetMarkHeader( ((const SfxBoolItem*)pItem)->GetValue() ); 1213*cdf0e10cSrcweir bSaveInputOptions = sal_True; 1214*cdf0e10cSrcweir bUpdateMarks = sal_True; 1215*cdf0e10cSrcweir } 1216*cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SC_INPUT_TEXTWYSIWYG,pItem) ) 1217*cdf0e10cSrcweir { 1218*cdf0e10cSrcweir sal_Bool bNew = ((const SfxBoolItem*)pItem)->GetValue(); 1219*cdf0e10cSrcweir if ( bNew != pInputCfg->GetTextWysiwyg() ) 1220*cdf0e10cSrcweir { 1221*cdf0e10cSrcweir pInputCfg->SetTextWysiwyg( bNew ); 1222*cdf0e10cSrcweir bSaveInputOptions = sal_True; 1223*cdf0e10cSrcweir bUpdateRefDev = sal_True; 1224*cdf0e10cSrcweir } 1225*cdf0e10cSrcweir } 1226*cdf0e10cSrcweir if( IS_AVAILABLE( SID_SC_INPUT_REPLCELLSWARN, pItem ) ) 1227*cdf0e10cSrcweir { 1228*cdf0e10cSrcweir pInputCfg->SetReplaceCellsWarn( ((const SfxBoolItem*)pItem)->GetValue() ); 1229*cdf0e10cSrcweir bSaveInputOptions = sal_True; 1230*cdf0e10cSrcweir } 1231*cdf0e10cSrcweir 1232*cdf0e10cSrcweir //============================================ 1233*cdf0e10cSrcweir // PrintOptions 1234*cdf0e10cSrcweir //============================================ 1235*cdf0e10cSrcweir 1236*cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SCPRINTOPTIONS,pItem) ) 1237*cdf0e10cSrcweir { 1238*cdf0e10cSrcweir const ScPrintOptions& rNewOpt = ((const ScTpPrintItem*)pItem)->GetPrintOptions(); 1239*cdf0e10cSrcweir SetPrintOptions( rNewOpt ); 1240*cdf0e10cSrcweir 1241*cdf0e10cSrcweir // broadcast causes all previews to recalc page numbers 1242*cdf0e10cSrcweir SFX_APP()->Broadcast( SfxSimpleHint( SID_SCPRINTOPTIONS ) ); 1243*cdf0e10cSrcweir } 1244*cdf0e10cSrcweir 1245*cdf0e10cSrcweir //---------------------------------------------------------- 1246*cdf0e10cSrcweir 1247*cdf0e10cSrcweir // if ( bSaveSpellCheck ) 1248*cdf0e10cSrcweir // { 1249*cdf0e10cSrcweir // currently LinguProperties are saved only at program exit. 1250*cdf0e10cSrcweir // if a save method becomes available, it should be called here. 1251*cdf0e10cSrcweir // } 1252*cdf0e10cSrcweir 1253*cdf0e10cSrcweir if ( bSaveAppOptions ) 1254*cdf0e10cSrcweir pAppCfg->OptionsChanged(); 1255*cdf0e10cSrcweir 1256*cdf0e10cSrcweir if ( bSaveInputOptions ) 1257*cdf0e10cSrcweir pInputCfg->OptionsChanged(); 1258*cdf0e10cSrcweir 1259*cdf0e10cSrcweir // Neuberechnung anstossen? 1260*cdf0e10cSrcweir 1261*cdf0e10cSrcweir if ( pDoc && bCalcAll ) 1262*cdf0e10cSrcweir { 1263*cdf0e10cSrcweir WaitObject aWait( pDocSh->GetActiveDialogParent() ); 1264*cdf0e10cSrcweir pDoc->CalcAll(); 1265*cdf0e10cSrcweir if ( pViewSh ) 1266*cdf0e10cSrcweir pViewSh->UpdateCharts( sal_True ); 1267*cdf0e10cSrcweir else 1268*cdf0e10cSrcweir ScDBFunc::DoUpdateCharts( ScAddress(), pDoc, sal_True ); 1269*cdf0e10cSrcweir if (pBindings) 1270*cdf0e10cSrcweir pBindings->Invalidate( SID_ATTR_SIZE ); //SvxPosSize-StatusControl-Update 1271*cdf0e10cSrcweir } 1272*cdf0e10cSrcweir 1273*cdf0e10cSrcweir if ( pViewSh && bUpdateMarks ) 1274*cdf0e10cSrcweir pViewSh->UpdateAutoFillMark(); 1275*cdf0e10cSrcweir 1276*cdf0e10cSrcweir // View neuzeichnen? 1277*cdf0e10cSrcweir 1278*cdf0e10cSrcweir if ( pViewSh && bRepaint ) 1279*cdf0e10cSrcweir { 1280*cdf0e10cSrcweir pViewSh->UpdateFixPos(); 1281*cdf0e10cSrcweir pViewSh->PaintGrid(); 1282*cdf0e10cSrcweir pViewSh->PaintTop(); 1283*cdf0e10cSrcweir pViewSh->PaintLeft(); 1284*cdf0e10cSrcweir pViewSh->PaintExtras(); 1285*cdf0e10cSrcweir pViewSh->InvalidateBorder(); 1286*cdf0e10cSrcweir if (pBindings) 1287*cdf0e10cSrcweir { 1288*cdf0e10cSrcweir pBindings->Invalidate( FID_TOGGLEHEADERS ); // -> Checks im Menue 1289*cdf0e10cSrcweir pBindings->Invalidate( FID_TOGGLESYNTAX ); 1290*cdf0e10cSrcweir } 1291*cdf0e10cSrcweir } 1292*cdf0e10cSrcweir 1293*cdf0e10cSrcweir // update ref device (for all documents) 1294*cdf0e10cSrcweir 1295*cdf0e10cSrcweir if ( bUpdateRefDev ) 1296*cdf0e10cSrcweir { 1297*cdf0e10cSrcweir // for all documents: recalc output factor, update row heights 1298*cdf0e10cSrcweir SfxObjectShell* pObjSh = SfxObjectShell::GetFirst(); 1299*cdf0e10cSrcweir while ( pObjSh ) 1300*cdf0e10cSrcweir { 1301*cdf0e10cSrcweir if ( pObjSh->Type() == TYPE(ScDocShell) ) 1302*cdf0e10cSrcweir { 1303*cdf0e10cSrcweir ScDocShell* pOneDocSh = ((ScDocShell*)pObjSh); 1304*cdf0e10cSrcweir pOneDocSh->CalcOutputFactor(); 1305*cdf0e10cSrcweir SCTAB nTabCount = pOneDocSh->GetDocument()->GetTableCount(); 1306*cdf0e10cSrcweir for (SCTAB nTab=0; nTab<nTabCount; nTab++) 1307*cdf0e10cSrcweir pOneDocSh->AdjustRowHeight( 0, MAXROW, nTab ); 1308*cdf0e10cSrcweir } 1309*cdf0e10cSrcweir pObjSh = SfxObjectShell::GetNext( *pObjSh ); 1310*cdf0e10cSrcweir } 1311*cdf0e10cSrcweir 1312*cdf0e10cSrcweir // for all (tab-) views: 1313*cdf0e10cSrcweir TypeId aScType = TYPE(ScTabViewShell); 1314*cdf0e10cSrcweir SfxViewShell* pSh = SfxViewShell::GetFirst( &aScType ); 1315*cdf0e10cSrcweir while ( pSh ) 1316*cdf0e10cSrcweir { 1317*cdf0e10cSrcweir ScTabViewShell* pOneViewSh = (ScTabViewShell*)pSh; 1318*cdf0e10cSrcweir 1319*cdf0e10cSrcweir // set ref-device for EditEngine 1320*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(pOneViewSh); 1321*cdf0e10cSrcweir if (pHdl) 1322*cdf0e10cSrcweir pHdl->UpdateRefDevice(); 1323*cdf0e10cSrcweir 1324*cdf0e10cSrcweir // update view scale 1325*cdf0e10cSrcweir ScViewData* pViewData = pOneViewSh->GetViewData(); 1326*cdf0e10cSrcweir pOneViewSh->SetZoom( pViewData->GetZoomX(), pViewData->GetZoomY(), sal_False ); 1327*cdf0e10cSrcweir 1328*cdf0e10cSrcweir // repaint 1329*cdf0e10cSrcweir pOneViewSh->PaintGrid(); 1330*cdf0e10cSrcweir pOneViewSh->PaintTop(); 1331*cdf0e10cSrcweir pOneViewSh->PaintLeft(); 1332*cdf0e10cSrcweir 1333*cdf0e10cSrcweir pSh = SfxViewShell::GetNext( *pSh, &aScType ); 1334*cdf0e10cSrcweir } 1335*cdf0e10cSrcweir } 1336*cdf0e10cSrcweir } 1337*cdf0e10cSrcweir 1338*cdf0e10cSrcweir #undef IS_AVAILABLE 1339*cdf0e10cSrcweir 1340*cdf0e10cSrcweir //------------------------------------------------------------------ 1341*cdf0e10cSrcweir // 1342*cdf0e10cSrcweir // Input-Handler 1343*cdf0e10cSrcweir // 1344*cdf0e10cSrcweir //------------------------------------------------------------------ 1345*cdf0e10cSrcweir 1346*cdf0e10cSrcweir ScInputHandler* ScModule::GetInputHdl( ScTabViewShell* pViewSh, sal_Bool bUseRef ) 1347*cdf0e10cSrcweir { 1348*cdf0e10cSrcweir if ( pRefInputHandler && bUseRef ) 1349*cdf0e10cSrcweir return pRefInputHandler; 1350*cdf0e10cSrcweir 1351*cdf0e10cSrcweir ScInputHandler* pHdl = NULL; 1352*cdf0e10cSrcweir if ( !pViewSh ) 1353*cdf0e10cSrcweir { 1354*cdf0e10cSrcweir // in case a UIActive embedded object has no ViewShell ( UNO component ) 1355*cdf0e10cSrcweir // the own calc view shell will be set as current, but no handling should happen 1356*cdf0e10cSrcweir 1357*cdf0e10cSrcweir ScTabViewShell* pCurViewSh = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); 1358*cdf0e10cSrcweir if ( pCurViewSh && !pCurViewSh->GetUIActiveClient() ) 1359*cdf0e10cSrcweir pViewSh = pCurViewSh; 1360*cdf0e10cSrcweir } 1361*cdf0e10cSrcweir 1362*cdf0e10cSrcweir if ( pViewSh ) 1363*cdf0e10cSrcweir pHdl = pViewSh->GetInputHandler(); // Viewshell hat jetzt immer einen 1364*cdf0e10cSrcweir 1365*cdf0e10cSrcweir // #57989# wenn keine ViewShell uebergeben oder aktiv, kann NULL herauskommen 1366*cdf0e10cSrcweir DBG_ASSERT( pHdl || !pViewSh, "GetInputHdl: kein InputHandler gefunden" ); 1367*cdf0e10cSrcweir return pHdl; 1368*cdf0e10cSrcweir } 1369*cdf0e10cSrcweir 1370*cdf0e10cSrcweir void ScModule::ViewShellChanged() 1371*cdf0e10cSrcweir { 1372*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(); 1373*cdf0e10cSrcweir ScTabViewShell* pShell = ScTabViewShell::GetActiveViewShell(); 1374*cdf0e10cSrcweir if ( pShell && pHdl ) 1375*cdf0e10cSrcweir pShell->UpdateInputHandler(); 1376*cdf0e10cSrcweir } 1377*cdf0e10cSrcweir 1378*cdf0e10cSrcweir void ScModule::SetInputMode( ScInputMode eMode ) 1379*cdf0e10cSrcweir { 1380*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(); 1381*cdf0e10cSrcweir if (pHdl) 1382*cdf0e10cSrcweir pHdl->SetMode( eMode ); 1383*cdf0e10cSrcweir } 1384*cdf0e10cSrcweir 1385*cdf0e10cSrcweir sal_Bool ScModule::IsEditMode() 1386*cdf0e10cSrcweir { 1387*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(); 1388*cdf0e10cSrcweir return pHdl && pHdl->IsEditMode(); 1389*cdf0e10cSrcweir } 1390*cdf0e10cSrcweir 1391*cdf0e10cSrcweir sal_Bool ScModule::IsInputMode() 1392*cdf0e10cSrcweir { 1393*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(); 1394*cdf0e10cSrcweir return pHdl && pHdl->IsInputMode(); 1395*cdf0e10cSrcweir } 1396*cdf0e10cSrcweir 1397*cdf0e10cSrcweir sal_Bool ScModule::InputKeyEvent( const KeyEvent& rKEvt, sal_Bool bStartEdit ) 1398*cdf0e10cSrcweir { 1399*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(); 1400*cdf0e10cSrcweir return ( pHdl ? pHdl->KeyInput( rKEvt, bStartEdit ) : sal_False ); 1401*cdf0e10cSrcweir } 1402*cdf0e10cSrcweir 1403*cdf0e10cSrcweir void ScModule::InputEnterHandler( sal_uInt8 nBlockMode ) 1404*cdf0e10cSrcweir { 1405*cdf0e10cSrcweir if ( !SFX_APP()->IsDowning() ) // nicht beim Programmende 1406*cdf0e10cSrcweir { 1407*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(); 1408*cdf0e10cSrcweir if (pHdl) 1409*cdf0e10cSrcweir pHdl->EnterHandler( nBlockMode ); 1410*cdf0e10cSrcweir } 1411*cdf0e10cSrcweir } 1412*cdf0e10cSrcweir 1413*cdf0e10cSrcweir void ScModule::InputCancelHandler() 1414*cdf0e10cSrcweir { 1415*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(); 1416*cdf0e10cSrcweir if (pHdl) 1417*cdf0e10cSrcweir pHdl->CancelHandler(); 1418*cdf0e10cSrcweir } 1419*cdf0e10cSrcweir 1420*cdf0e10cSrcweir void ScModule::InputSelection( EditView* pView ) 1421*cdf0e10cSrcweir { 1422*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(); 1423*cdf0e10cSrcweir if (pHdl) 1424*cdf0e10cSrcweir pHdl->InputSelection( pView ); 1425*cdf0e10cSrcweir } 1426*cdf0e10cSrcweir 1427*cdf0e10cSrcweir void ScModule::InputChanged( EditView* pView ) 1428*cdf0e10cSrcweir { 1429*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(); 1430*cdf0e10cSrcweir if (pHdl) 1431*cdf0e10cSrcweir pHdl->InputChanged( pView ); 1432*cdf0e10cSrcweir } 1433*cdf0e10cSrcweir 1434*cdf0e10cSrcweir void ScModule::ViewShellGone( ScTabViewShell* pViewSh ) 1435*cdf0e10cSrcweir { 1436*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(); 1437*cdf0e10cSrcweir if (pHdl) 1438*cdf0e10cSrcweir pHdl->ViewShellGone( pViewSh ); 1439*cdf0e10cSrcweir } 1440*cdf0e10cSrcweir 1441*cdf0e10cSrcweir void ScModule::SetRefInputHdl( ScInputHandler* pNew ) 1442*cdf0e10cSrcweir { 1443*cdf0e10cSrcweir pRefInputHandler = pNew; 1444*cdf0e10cSrcweir } 1445*cdf0e10cSrcweir 1446*cdf0e10cSrcweir ScInputHandler* ScModule::GetRefInputHdl() 1447*cdf0e10cSrcweir { 1448*cdf0e10cSrcweir return pRefInputHandler; 1449*cdf0e10cSrcweir } 1450*cdf0e10cSrcweir 1451*cdf0e10cSrcweir //------------------------------------------------------------------------ 1452*cdf0e10cSrcweir // Olk's Krempel: 1453*cdf0e10cSrcweir 1454*cdf0e10cSrcweir void ScModule::InputGetSelection( xub_StrLen& rStart, xub_StrLen& rEnd ) 1455*cdf0e10cSrcweir { 1456*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(); 1457*cdf0e10cSrcweir if (pHdl) 1458*cdf0e10cSrcweir pHdl->InputGetSelection( rStart, rEnd ); 1459*cdf0e10cSrcweir } 1460*cdf0e10cSrcweir 1461*cdf0e10cSrcweir void ScModule::InputSetSelection( xub_StrLen nStart, xub_StrLen nEnd ) 1462*cdf0e10cSrcweir { 1463*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(); 1464*cdf0e10cSrcweir if (pHdl) 1465*cdf0e10cSrcweir pHdl->InputSetSelection( nStart, nEnd ); 1466*cdf0e10cSrcweir } 1467*cdf0e10cSrcweir 1468*cdf0e10cSrcweir void ScModule::InputReplaceSelection( const String& rStr ) 1469*cdf0e10cSrcweir { 1470*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(); 1471*cdf0e10cSrcweir if (pHdl) 1472*cdf0e10cSrcweir pHdl->InputReplaceSelection( rStr ); 1473*cdf0e10cSrcweir } 1474*cdf0e10cSrcweir 1475*cdf0e10cSrcweir String ScModule::InputGetFormulaStr() 1476*cdf0e10cSrcweir { 1477*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(); 1478*cdf0e10cSrcweir String aStr; 1479*cdf0e10cSrcweir if ( pHdl ) 1480*cdf0e10cSrcweir aStr = pHdl->InputGetFormulaStr(); 1481*cdf0e10cSrcweir return aStr; 1482*cdf0e10cSrcweir } 1483*cdf0e10cSrcweir 1484*cdf0e10cSrcweir void ScModule::ActivateInputWindow( const String* pStrFormula, sal_Bool bMatrix ) 1485*cdf0e10cSrcweir { 1486*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(); 1487*cdf0e10cSrcweir if ( pHdl ) 1488*cdf0e10cSrcweir { 1489*cdf0e10cSrcweir ScInputWindow* pWin = pHdl->GetInputWindow(); 1490*cdf0e10cSrcweir if ( pStrFormula ) 1491*cdf0e10cSrcweir { 1492*cdf0e10cSrcweir // Formel uebernehmen 1493*cdf0e10cSrcweir if ( pWin ) 1494*cdf0e10cSrcweir { 1495*cdf0e10cSrcweir pWin->SetFuncString( *pStrFormula, sal_False ); 1496*cdf0e10cSrcweir // SetSumAssignMode wegen sal_False nicht noetig 1497*cdf0e10cSrcweir } 1498*cdf0e10cSrcweir sal_uInt8 nMode = bMatrix ? SC_ENTER_MATRIX : SC_ENTER_NORMAL; 1499*cdf0e10cSrcweir pHdl->EnterHandler( nMode ); 1500*cdf0e10cSrcweir 1501*cdf0e10cSrcweir // ohne Invalidate bleibt die Selektion stehen, wenn die Formel unveraendert ist 1502*cdf0e10cSrcweir if (pWin) 1503*cdf0e10cSrcweir pWin->TextInvalidate(); 1504*cdf0e10cSrcweir } 1505*cdf0e10cSrcweir else 1506*cdf0e10cSrcweir { 1507*cdf0e10cSrcweir // Abbrechen 1508*cdf0e10cSrcweir if ( pWin ) 1509*cdf0e10cSrcweir { 1510*cdf0e10cSrcweir pWin->SetFuncString( EMPTY_STRING, sal_False ); 1511*cdf0e10cSrcweir // SetSumAssignMode wegen sal_False nicht noetig 1512*cdf0e10cSrcweir } 1513*cdf0e10cSrcweir pHdl->CancelHandler(); 1514*cdf0e10cSrcweir } 1515*cdf0e10cSrcweir } 1516*cdf0e10cSrcweir } 1517*cdf0e10cSrcweir 1518*cdf0e10cSrcweir //------------------------------------------------------------------ 1519*cdf0e10cSrcweir // 1520*cdf0e10cSrcweir // Referenz - Dialoge 1521*cdf0e10cSrcweir // 1522*cdf0e10cSrcweir //------------------------------------------------------------------ 1523*cdf0e10cSrcweir 1524*cdf0e10cSrcweir void ScModule::SetRefDialog( sal_uInt16 nId, sal_Bool bVis, SfxViewFrame* pViewFrm ) 1525*cdf0e10cSrcweir { 1526*cdf0e10cSrcweir //! move reference dialog handling to view 1527*cdf0e10cSrcweir //! (only keep function autopilot here for references to other documents) 1528*cdf0e10cSrcweir 1529*cdf0e10cSrcweir if(nCurRefDlgId==0 || (nId==nCurRefDlgId && !bVis)) 1530*cdf0e10cSrcweir { 1531*cdf0e10cSrcweir if ( !pViewFrm ) 1532*cdf0e10cSrcweir pViewFrm = SfxViewFrame::Current(); 1533*cdf0e10cSrcweir 1534*cdf0e10cSrcweir // #79379# bindings update causes problems with update of stylist if 1535*cdf0e10cSrcweir // current style family has changed 1536*cdf0e10cSrcweir //if ( pViewFrm ) 1537*cdf0e10cSrcweir // pViewFrm->GetBindings().Update(); // to avoid trouble in LockDispatcher 1538*cdf0e10cSrcweir 1539*cdf0e10cSrcweir nCurRefDlgId = bVis ? nId : 0 ; // before SetChildWindow 1540*cdf0e10cSrcweir 1541*cdf0e10cSrcweir if ( pViewFrm ) 1542*cdf0e10cSrcweir { 1543*cdf0e10cSrcweir // store the dialog id also in the view shell 1544*cdf0e10cSrcweir SfxViewShell* pViewSh = pViewFrm->GetViewShell(); 1545*cdf0e10cSrcweir if ( pViewSh && pViewSh->ISA( ScTabViewShell ) ) 1546*cdf0e10cSrcweir ((ScTabViewShell*)pViewSh)->SetCurRefDlgId( nCurRefDlgId ); 1547*cdf0e10cSrcweir else 1548*cdf0e10cSrcweir { 1549*cdf0e10cSrcweir // no ScTabViewShell - possible for example from a Basic macro 1550*cdf0e10cSrcweir bVis = sal_False; 1551*cdf0e10cSrcweir nCurRefDlgId = 0; // don't set nCurRefDlgId if no dialog is created 1552*cdf0e10cSrcweir } 1553*cdf0e10cSrcweir 1554*cdf0e10cSrcweir pViewFrm->SetChildWindow( nId, bVis ); 1555*cdf0e10cSrcweir } 1556*cdf0e10cSrcweir 1557*cdf0e10cSrcweir SfxApplication* pSfxApp = SFX_APP(); 1558*cdf0e10cSrcweir pSfxApp->Broadcast( SfxSimpleHint( FID_REFMODECHANGED ) ); 1559*cdf0e10cSrcweir } 1560*cdf0e10cSrcweir } 1561*cdf0e10cSrcweir 1562*cdf0e10cSrcweir SfxChildWindow* lcl_GetChildWinFromAnyView( sal_uInt16 nId ) 1563*cdf0e10cSrcweir { 1564*cdf0e10cSrcweir // first try the current view 1565*cdf0e10cSrcweir 1566*cdf0e10cSrcweir SfxViewFrame* pViewFrm = SfxViewFrame::Current(); 1567*cdf0e10cSrcweir // #i46999# current view frame can be null (for example, when closing help) 1568*cdf0e10cSrcweir SfxChildWindow* pChildWnd = pViewFrm ? pViewFrm->GetChildWindow( nId ) : NULL; 1569*cdf0e10cSrcweir if ( pChildWnd ) 1570*cdf0e10cSrcweir return pChildWnd; // found in the current view 1571*cdf0e10cSrcweir 1572*cdf0e10cSrcweir // if not found there, get the child window from any open view 1573*cdf0e10cSrcweir // it can be open only in one view because nCurRefDlgId is global 1574*cdf0e10cSrcweir 1575*cdf0e10cSrcweir pViewFrm = SfxViewFrame::GetFirst(); 1576*cdf0e10cSrcweir while ( pViewFrm ) 1577*cdf0e10cSrcweir { 1578*cdf0e10cSrcweir pChildWnd = pViewFrm->GetChildWindow( nId ); 1579*cdf0e10cSrcweir if ( pChildWnd ) 1580*cdf0e10cSrcweir return pChildWnd; // found in any view 1581*cdf0e10cSrcweir 1582*cdf0e10cSrcweir pViewFrm = SfxViewFrame::GetNext( *pViewFrm ); 1583*cdf0e10cSrcweir } 1584*cdf0e10cSrcweir 1585*cdf0e10cSrcweir return NULL; // none found 1586*cdf0e10cSrcweir } 1587*cdf0e10cSrcweir 1588*cdf0e10cSrcweir sal_Bool ScModule::IsModalMode(SfxObjectShell* pDocSh) 1589*cdf0e10cSrcweir { 1590*cdf0e10cSrcweir //! move reference dialog handling to view 1591*cdf0e10cSrcweir //! (only keep function autopilot here for references to other documents) 1592*cdf0e10cSrcweir 1593*cdf0e10cSrcweir sal_Bool bIsModal = sal_False; 1594*cdf0e10cSrcweir 1595*cdf0e10cSrcweir if ( nCurRefDlgId ) 1596*cdf0e10cSrcweir { 1597*cdf0e10cSrcweir SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId ); 1598*cdf0e10cSrcweir if ( pChildWnd ) 1599*cdf0e10cSrcweir { 1600*cdf0e10cSrcweir IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow()); 1601*cdf0e10cSrcweir bIsModal = pChildWnd->IsVisible() && 1602*cdf0e10cSrcweir !( pRefDlg->IsRefInputMode() && pRefDlg->IsDocAllowed(pDocSh) ); 1603*cdf0e10cSrcweir } 1604*cdf0e10cSrcweir else 1605*cdf0e10cSrcweir { 1606*cdf0e10cSrcweir // in 592 and above, the dialog isn't visible in other views 1607*cdf0e10cSrcweir // if the dialog is open but can't be accessed, disable input 1608*cdf0e10cSrcweir 1609*cdf0e10cSrcweir bIsModal = sal_True; 1610*cdf0e10cSrcweir } 1611*cdf0e10cSrcweir 1612*cdf0e10cSrcweir // pChildWnd kann 0 sein, wenn der Dialog nach dem Umschalten 1613*cdf0e10cSrcweir // von einer anderen Shell noch nicht erzeugt wurde (z.B. in GetFocus) 1614*cdf0e10cSrcweir } 1615*cdf0e10cSrcweir else if (pDocSh) 1616*cdf0e10cSrcweir { 1617*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(); 1618*cdf0e10cSrcweir if ( pHdl ) 1619*cdf0e10cSrcweir bIsModal = pHdl->IsModalMode(pDocSh); 1620*cdf0e10cSrcweir } 1621*cdf0e10cSrcweir 1622*cdf0e10cSrcweir return bIsModal; 1623*cdf0e10cSrcweir } 1624*cdf0e10cSrcweir 1625*cdf0e10cSrcweir sal_Bool ScModule::IsTableLocked() 1626*cdf0e10cSrcweir { 1627*cdf0e10cSrcweir //! move reference dialog handling to view 1628*cdf0e10cSrcweir //! (only keep function autopilot here for references to other documents) 1629*cdf0e10cSrcweir 1630*cdf0e10cSrcweir sal_Bool bLocked = sal_False; 1631*cdf0e10cSrcweir 1632*cdf0e10cSrcweir // bisher nur bei ScAnyRefDlg 1633*cdf0e10cSrcweir 1634*cdf0e10cSrcweir if ( nCurRefDlgId ) 1635*cdf0e10cSrcweir { 1636*cdf0e10cSrcweir SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId ); 1637*cdf0e10cSrcweir if ( pChildWnd ) 1638*cdf0e10cSrcweir bLocked = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow())->IsTableLocked(); 1639*cdf0e10cSrcweir else 1640*cdf0e10cSrcweir bLocked = sal_True; // for other views, see IsModalMode 1641*cdf0e10cSrcweir } 1642*cdf0e10cSrcweir 1643*cdf0e10cSrcweir return bLocked; 1644*cdf0e10cSrcweir } 1645*cdf0e10cSrcweir 1646*cdf0e10cSrcweir sal_Bool ScModule::IsRefDialogOpen() 1647*cdf0e10cSrcweir { 1648*cdf0e10cSrcweir //! move reference dialog handling to view 1649*cdf0e10cSrcweir //! (only keep function autopilot here for references to other documents) 1650*cdf0e10cSrcweir 1651*cdf0e10cSrcweir sal_Bool bIsOpen = sal_False; 1652*cdf0e10cSrcweir 1653*cdf0e10cSrcweir if ( nCurRefDlgId ) 1654*cdf0e10cSrcweir { 1655*cdf0e10cSrcweir SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId ); 1656*cdf0e10cSrcweir if ( pChildWnd ) 1657*cdf0e10cSrcweir bIsOpen = pChildWnd->IsVisible(); 1658*cdf0e10cSrcweir else 1659*cdf0e10cSrcweir bIsOpen = sal_True; // for other views, see IsModalMode 1660*cdf0e10cSrcweir } 1661*cdf0e10cSrcweir 1662*cdf0e10cSrcweir return bIsOpen; 1663*cdf0e10cSrcweir } 1664*cdf0e10cSrcweir 1665*cdf0e10cSrcweir sal_Bool ScModule::IsFormulaMode() 1666*cdf0e10cSrcweir { 1667*cdf0e10cSrcweir //! move reference dialog handling to view 1668*cdf0e10cSrcweir //! (only keep function autopilot here for references to other documents) 1669*cdf0e10cSrcweir 1670*cdf0e10cSrcweir sal_Bool bIsFormula = sal_False; 1671*cdf0e10cSrcweir 1672*cdf0e10cSrcweir if ( nCurRefDlgId ) 1673*cdf0e10cSrcweir { 1674*cdf0e10cSrcweir SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId ); 1675*cdf0e10cSrcweir if ( pChildWnd ) 1676*cdf0e10cSrcweir { 1677*cdf0e10cSrcweir IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow()); 1678*cdf0e10cSrcweir bIsFormula = pChildWnd->IsVisible() && pRefDlg->IsRefInputMode(); 1679*cdf0e10cSrcweir } 1680*cdf0e10cSrcweir } 1681*cdf0e10cSrcweir else 1682*cdf0e10cSrcweir { 1683*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(); 1684*cdf0e10cSrcweir if ( pHdl ) 1685*cdf0e10cSrcweir bIsFormula = pHdl->IsFormulaMode(); 1686*cdf0e10cSrcweir } 1687*cdf0e10cSrcweir 1688*cdf0e10cSrcweir if (bIsInEditCommand) 1689*cdf0e10cSrcweir bIsFormula = sal_True; 1690*cdf0e10cSrcweir 1691*cdf0e10cSrcweir return bIsFormula; 1692*cdf0e10cSrcweir } 1693*cdf0e10cSrcweir 1694*cdf0e10cSrcweir void lcl_MarkedTabs( const ScMarkData& rMark, SCTAB& rStartTab, SCTAB& rEndTab ) 1695*cdf0e10cSrcweir { 1696*cdf0e10cSrcweir if (rMark.GetSelectCount() > 1) 1697*cdf0e10cSrcweir { 1698*cdf0e10cSrcweir sal_Bool bFirst = sal_True; 1699*cdf0e10cSrcweir for (SCTAB i=0; i<=MAXTAB; i++) 1700*cdf0e10cSrcweir if (rMark.GetTableSelect(i)) 1701*cdf0e10cSrcweir { 1702*cdf0e10cSrcweir if (bFirst) 1703*cdf0e10cSrcweir rStartTab = i; 1704*cdf0e10cSrcweir rEndTab = i; 1705*cdf0e10cSrcweir bFirst = sal_False; 1706*cdf0e10cSrcweir } 1707*cdf0e10cSrcweir } 1708*cdf0e10cSrcweir } 1709*cdf0e10cSrcweir 1710*cdf0e10cSrcweir void ScModule::SetReference( const ScRange& rRef, ScDocument* pDoc, 1711*cdf0e10cSrcweir const ScMarkData* pMarkData ) 1712*cdf0e10cSrcweir { 1713*cdf0e10cSrcweir //! move reference dialog handling to view 1714*cdf0e10cSrcweir //! (only keep function autopilot here for references to other documents) 1715*cdf0e10cSrcweir 1716*cdf0e10cSrcweir // in Ref-Dialogen wird hiermit auch das Zoom-In ausgeloest, 1717*cdf0e10cSrcweir // wenn Start und Ende der Ref unterschiedlich sind 1718*cdf0e10cSrcweir 1719*cdf0e10cSrcweir ScRange aNew = rRef; 1720*cdf0e10cSrcweir aNew.Justify(); // immer "richtig herum" 1721*cdf0e10cSrcweir 1722*cdf0e10cSrcweir if( nCurRefDlgId ) 1723*cdf0e10cSrcweir { 1724*cdf0e10cSrcweir SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId ); 1725*cdf0e10cSrcweir DBG_ASSERT( pChildWnd, "NoChildWin" ); 1726*cdf0e10cSrcweir if ( pChildWnd ) 1727*cdf0e10cSrcweir { 1728*cdf0e10cSrcweir if ( nCurRefDlgId == SID_OPENDLG_CONSOLIDATE && pMarkData ) 1729*cdf0e10cSrcweir { 1730*cdf0e10cSrcweir SCTAB nStartTab = aNew.aStart.Tab(); 1731*cdf0e10cSrcweir SCTAB nEndTab = aNew.aEnd.Tab(); 1732*cdf0e10cSrcweir lcl_MarkedTabs( *pMarkData, nStartTab, nEndTab ); 1733*cdf0e10cSrcweir aNew.aStart.SetTab(nStartTab); 1734*cdf0e10cSrcweir aNew.aEnd.SetTab(nEndTab); 1735*cdf0e10cSrcweir } 1736*cdf0e10cSrcweir 1737*cdf0e10cSrcweir IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow()); 1738*cdf0e10cSrcweir 1739*cdf0e10cSrcweir // hide the (color) selection now instead of later from LoseFocus, 1740*cdf0e10cSrcweir // don't abort the ref input that causes this call (bDoneRefMode = sal_False) 1741*cdf0e10cSrcweir pRefDlg->HideReference( sal_False ); 1742*cdf0e10cSrcweir pRefDlg->SetReference( aNew, pDoc ); 1743*cdf0e10cSrcweir } 1744*cdf0e10cSrcweir } 1745*cdf0e10cSrcweir else 1746*cdf0e10cSrcweir { 1747*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(); 1748*cdf0e10cSrcweir if (pHdl) 1749*cdf0e10cSrcweir pHdl->SetReference( aNew, pDoc ); 1750*cdf0e10cSrcweir else 1751*cdf0e10cSrcweir { 1752*cdf0e10cSrcweir DBG_ERROR("SetReference ohne Empfaenger"); 1753*cdf0e10cSrcweir } 1754*cdf0e10cSrcweir } 1755*cdf0e10cSrcweir } 1756*cdf0e10cSrcweir 1757*cdf0e10cSrcweir void ScModule::AddRefEntry() // "Mehrfachselektion" 1758*cdf0e10cSrcweir { 1759*cdf0e10cSrcweir //! move reference dialog handling to view 1760*cdf0e10cSrcweir //! (only keep function autopilot here for references to other documents) 1761*cdf0e10cSrcweir 1762*cdf0e10cSrcweir if ( nCurRefDlgId ) 1763*cdf0e10cSrcweir { 1764*cdf0e10cSrcweir SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId ); 1765*cdf0e10cSrcweir DBG_ASSERT( pChildWnd, "NoChildWin" ); 1766*cdf0e10cSrcweir if ( pChildWnd ) 1767*cdf0e10cSrcweir { 1768*cdf0e10cSrcweir IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow()); 1769*cdf0e10cSrcweir pRefDlg->AddRefEntry(); 1770*cdf0e10cSrcweir } 1771*cdf0e10cSrcweir } 1772*cdf0e10cSrcweir else 1773*cdf0e10cSrcweir { 1774*cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(); 1775*cdf0e10cSrcweir if (pHdl) 1776*cdf0e10cSrcweir pHdl->AddRefEntry(); 1777*cdf0e10cSrcweir } 1778*cdf0e10cSrcweir } 1779*cdf0e10cSrcweir 1780*cdf0e10cSrcweir void ScModule::EndReference() 1781*cdf0e10cSrcweir { 1782*cdf0e10cSrcweir //! move reference dialog handling to view 1783*cdf0e10cSrcweir //! (only keep function autopilot here for references to other documents) 1784*cdf0e10cSrcweir 1785*cdf0e10cSrcweir // in Ref-Dialogen wird hiermit auch das Zoom-In wieder aufgehoben 1786*cdf0e10cSrcweir 1787*cdf0e10cSrcweir //! ShowRefFrame am InputHdl, wenn der Funktions-AP offen ist ??? 1788*cdf0e10cSrcweir 1789*cdf0e10cSrcweir if ( nCurRefDlgId ) 1790*cdf0e10cSrcweir { 1791*cdf0e10cSrcweir SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId ); 1792*cdf0e10cSrcweir DBG_ASSERT( pChildWnd, "NoChildWin" ); 1793*cdf0e10cSrcweir if ( pChildWnd ) 1794*cdf0e10cSrcweir { 1795*cdf0e10cSrcweir IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow()); 1796*cdf0e10cSrcweir pRefDlg->SetActive(); 1797*cdf0e10cSrcweir } 1798*cdf0e10cSrcweir } 1799*cdf0e10cSrcweir } 1800*cdf0e10cSrcweir 1801*cdf0e10cSrcweir //------------------------------------------------------------------ 1802*cdf0e10cSrcweir // 1803*cdf0e10cSrcweir // Idle / Online-Spelling 1804*cdf0e10cSrcweir // 1805*cdf0e10cSrcweir //------------------------------------------------------------------ 1806*cdf0e10cSrcweir 1807*cdf0e10cSrcweir void ScModule::AnythingChanged() 1808*cdf0e10cSrcweir { 1809*cdf0e10cSrcweir sal_uLong nOldTime = aIdleTimer.GetTimeout(); 1810*cdf0e10cSrcweir if ( nOldTime != SC_IDLE_MIN ) 1811*cdf0e10cSrcweir aIdleTimer.SetTimeout( SC_IDLE_MIN ); 1812*cdf0e10cSrcweir 1813*cdf0e10cSrcweir nIdleCount = 0; 1814*cdf0e10cSrcweir } 1815*cdf0e10cSrcweir 1816*cdf0e10cSrcweir void lcl_CheckNeedsRepaint( ScDocShell* pDocShell ) 1817*cdf0e10cSrcweir { 1818*cdf0e10cSrcweir SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell ); 1819*cdf0e10cSrcweir while ( pFrame ) 1820*cdf0e10cSrcweir { 1821*cdf0e10cSrcweir SfxViewShell* p = pFrame->GetViewShell(); 1822*cdf0e10cSrcweir ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell,p); 1823*cdf0e10cSrcweir if ( pViewSh ) 1824*cdf0e10cSrcweir pViewSh->CheckNeedsRepaint(); 1825*cdf0e10cSrcweir pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell ); 1826*cdf0e10cSrcweir } 1827*cdf0e10cSrcweir } 1828*cdf0e10cSrcweir 1829*cdf0e10cSrcweir IMPL_LINK( ScModule, IdleHandler, Timer*, EMPTYARG ) 1830*cdf0e10cSrcweir { 1831*cdf0e10cSrcweir if ( Application::AnyInput( INPUT_MOUSEANDKEYBOARD ) ) 1832*cdf0e10cSrcweir { 1833*cdf0e10cSrcweir aIdleTimer.Start(); // Timeout unveraendert 1834*cdf0e10cSrcweir return 0; 1835*cdf0e10cSrcweir } 1836*cdf0e10cSrcweir 1837*cdf0e10cSrcweir sal_Bool bMore = sal_False; 1838*cdf0e10cSrcweir ScDocShell* pDocSh = PTR_CAST( ScDocShell, SfxObjectShell::Current() ); 1839*cdf0e10cSrcweir if ( pDocSh ) 1840*cdf0e10cSrcweir { 1841*cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument(); 1842*cdf0e10cSrcweir 1843*cdf0e10cSrcweir sal_Bool bLinks = pDoc->IdleCheckLinks(); 1844*cdf0e10cSrcweir sal_Bool bWidth = pDoc->IdleCalcTextWidth(); 1845*cdf0e10cSrcweir sal_Bool bSpell = pDoc->ContinueOnlineSpelling(); 1846*cdf0e10cSrcweir if ( bSpell ) 1847*cdf0e10cSrcweir aSpellTimer.Start(); // da ist noch was 1848*cdf0e10cSrcweir 1849*cdf0e10cSrcweir bMore = bLinks || bWidth || bSpell; // ueberhaupt noch was? 1850*cdf0e10cSrcweir 1851*cdf0e10cSrcweir // While calculating a Basic formula, a paint event may have occured, 1852*cdf0e10cSrcweir // so check the bNeedsRepaint flags for this document's views 1853*cdf0e10cSrcweir if (bWidth) 1854*cdf0e10cSrcweir lcl_CheckNeedsRepaint( pDocSh ); 1855*cdf0e10cSrcweir } 1856*cdf0e10cSrcweir 1857*cdf0e10cSrcweir sal_uLong nOldTime = aIdleTimer.GetTimeout(); 1858*cdf0e10cSrcweir sal_uLong nNewTime = nOldTime; 1859*cdf0e10cSrcweir if ( bMore ) 1860*cdf0e10cSrcweir { 1861*cdf0e10cSrcweir nNewTime = SC_IDLE_MIN; 1862*cdf0e10cSrcweir nIdleCount = 0; 1863*cdf0e10cSrcweir } 1864*cdf0e10cSrcweir else 1865*cdf0e10cSrcweir { 1866*cdf0e10cSrcweir // SC_IDLE_COUNT mal mit initialem Timeout, dann hochzaehlen 1867*cdf0e10cSrcweir 1868*cdf0e10cSrcweir if ( nIdleCount < SC_IDLE_COUNT ) 1869*cdf0e10cSrcweir ++nIdleCount; 1870*cdf0e10cSrcweir else 1871*cdf0e10cSrcweir { 1872*cdf0e10cSrcweir nNewTime += SC_IDLE_STEP; 1873*cdf0e10cSrcweir if ( nNewTime > SC_IDLE_MAX ) 1874*cdf0e10cSrcweir nNewTime = SC_IDLE_MAX; 1875*cdf0e10cSrcweir } 1876*cdf0e10cSrcweir } 1877*cdf0e10cSrcweir if ( nNewTime != nOldTime ) 1878*cdf0e10cSrcweir aIdleTimer.SetTimeout( nNewTime ); 1879*cdf0e10cSrcweir 1880*cdf0e10cSrcweir aIdleTimer.Start(); 1881*cdf0e10cSrcweir return 0; 1882*cdf0e10cSrcweir } 1883*cdf0e10cSrcweir 1884*cdf0e10cSrcweir IMPL_LINK( ScModule, SpellTimerHdl, Timer*, EMPTYARG ) 1885*cdf0e10cSrcweir { 1886*cdf0e10cSrcweir if ( Application::AnyInput( INPUT_KEYBOARD ) ) 1887*cdf0e10cSrcweir { 1888*cdf0e10cSrcweir aSpellTimer.Start(); 1889*cdf0e10cSrcweir return 0; // dann spaeter wieder... 1890*cdf0e10cSrcweir } 1891*cdf0e10cSrcweir 1892*cdf0e10cSrcweir ScDocShell* pDocSh = PTR_CAST( ScDocShell, SfxObjectShell::Current() ); 1893*cdf0e10cSrcweir if ( pDocSh ) 1894*cdf0e10cSrcweir { 1895*cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument(); 1896*cdf0e10cSrcweir if ( pDoc->ContinueOnlineSpelling() ) 1897*cdf0e10cSrcweir aSpellTimer.Start(); 1898*cdf0e10cSrcweir } 1899*cdf0e10cSrcweir return 0; 1900*cdf0e10cSrcweir } 1901*cdf0e10cSrcweir 1902*cdf0e10cSrcweir //virtuelle Methoden fuer den Optionendialog 1903*cdf0e10cSrcweir SfxItemSet* ScModule::CreateItemSet( sal_uInt16 nId ) 1904*cdf0e10cSrcweir { 1905*cdf0e10cSrcweir SfxItemSet* pRet = 0; 1906*cdf0e10cSrcweir if(SID_SC_EDITOPTIONS == nId) 1907*cdf0e10cSrcweir { 1908*cdf0e10cSrcweir pRet = new SfxItemSet( GetPool(), 1909*cdf0e10cSrcweir // TP_CALC: 1910*cdf0e10cSrcweir SID_SCDOCOPTIONS, SID_SCDOCOPTIONS, 1911*cdf0e10cSrcweir // TP_VIEW: 1912*cdf0e10cSrcweir SID_SCVIEWOPTIONS, SID_SCVIEWOPTIONS, 1913*cdf0e10cSrcweir SID_SC_OPT_SYNCZOOM, SID_SC_OPT_SYNCZOOM, 1914*cdf0e10cSrcweir // TP_INPUT: 1915*cdf0e10cSrcweir SID_SC_INPUT_SELECTION,SID_SC_INPUT_MARK_HEADER, 1916*cdf0e10cSrcweir SID_SC_INPUT_TEXTWYSIWYG,SID_SC_INPUT_TEXTWYSIWYG, 1917*cdf0e10cSrcweir SID_SC_INPUT_REPLCELLSWARN,SID_SC_INPUT_REPLCELLSWARN, 1918*cdf0e10cSrcweir // TP_USERLISTS: 1919*cdf0e10cSrcweir SCITEM_USERLIST, SCITEM_USERLIST, 1920*cdf0e10cSrcweir // TP_PRINT: 1921*cdf0e10cSrcweir SID_SCPRINTOPTIONS, SID_SCPRINTOPTIONS, 1922*cdf0e10cSrcweir // TP_GRID: 1923*cdf0e10cSrcweir SID_ATTR_GRID_OPTIONS, SID_ATTR_GRID_OPTIONS, 1924*cdf0e10cSrcweir // 1925*cdf0e10cSrcweir SID_ATTR_METRIC, SID_ATTR_METRIC, 1926*cdf0e10cSrcweir SID_ATTR_DEFTABSTOP, SID_ATTR_DEFTABSTOP, 1927*cdf0e10cSrcweir 0 ); 1928*cdf0e10cSrcweir 1929*cdf0e10cSrcweir ScDocShell* pDocSh = PTR_CAST(ScDocShell, 1930*cdf0e10cSrcweir SfxObjectShell::Current()); 1931*cdf0e10cSrcweir ScDocOptions aCalcOpt = pDocSh 1932*cdf0e10cSrcweir ? pDocSh->GetDocument()->GetDocOptions() 1933*cdf0e10cSrcweir : GetDocOptions(); 1934*cdf0e10cSrcweir 1935*cdf0e10cSrcweir ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell, 1936*cdf0e10cSrcweir SfxViewShell::Current()); 1937*cdf0e10cSrcweir ScViewOptions aViewOpt = pViewSh 1938*cdf0e10cSrcweir ? pViewSh->GetViewData()->GetOptions() 1939*cdf0e10cSrcweir : GetViewOptions(); 1940*cdf0e10cSrcweir 1941*cdf0e10cSrcweir ScUserListItem aULItem( SCITEM_USERLIST ); 1942*cdf0e10cSrcweir ScUserList* pUL = ScGlobal::GetUserList(); 1943*cdf0e10cSrcweir 1944*cdf0e10cSrcweir // SFX_APP()->GetOptions( aSet ); 1945*cdf0e10cSrcweir 1946*cdf0e10cSrcweir pRet->Put( SfxUInt16Item( SID_ATTR_METRIC, 1947*cdf0e10cSrcweir sal::static_int_cast<sal_uInt16>(GetAppOptions().GetAppMetric()) ) ); 1948*cdf0e10cSrcweir 1949*cdf0e10cSrcweir // TP_CALC 1950*cdf0e10cSrcweir pRet->Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP, 1951*cdf0e10cSrcweir aCalcOpt.GetTabDistance())); 1952*cdf0e10cSrcweir pRet->Put( ScTpCalcItem( SID_SCDOCOPTIONS, aCalcOpt ) ); 1953*cdf0e10cSrcweir 1954*cdf0e10cSrcweir // TP_VIEW 1955*cdf0e10cSrcweir pRet->Put( ScTpViewItem( SID_SCVIEWOPTIONS, aViewOpt ) ); 1956*cdf0e10cSrcweir pRet->Put( SfxBoolItem( SID_SC_OPT_SYNCZOOM, GetAppOptions().GetSynchronizeZoom() ) ); 1957*cdf0e10cSrcweir 1958*cdf0e10cSrcweir // TP_INPUT 1959*cdf0e10cSrcweir const ScInputOptions& rInpOpt = GetInputOptions(); 1960*cdf0e10cSrcweir pRet->Put( SfxUInt16Item( SID_SC_INPUT_SELECTIONPOS, 1961*cdf0e10cSrcweir rInpOpt.GetMoveDir() ) ); 1962*cdf0e10cSrcweir pRet->Put( SfxBoolItem( SID_SC_INPUT_SELECTION, 1963*cdf0e10cSrcweir rInpOpt.GetMoveSelection() ) ); 1964*cdf0e10cSrcweir pRet->Put( SfxBoolItem( SID_SC_INPUT_EDITMODE, 1965*cdf0e10cSrcweir rInpOpt.GetEnterEdit() ) ); 1966*cdf0e10cSrcweir pRet->Put( SfxBoolItem( SID_SC_INPUT_FMT_EXPAND, 1967*cdf0e10cSrcweir rInpOpt.GetExtendFormat() ) ); 1968*cdf0e10cSrcweir pRet->Put( SfxBoolItem( SID_SC_INPUT_RANGEFINDER, 1969*cdf0e10cSrcweir rInpOpt.GetRangeFinder() ) ); 1970*cdf0e10cSrcweir pRet->Put( SfxBoolItem( SID_SC_INPUT_REF_EXPAND, 1971*cdf0e10cSrcweir rInpOpt.GetExpandRefs() ) ); 1972*cdf0e10cSrcweir pRet->Put( SfxBoolItem( SID_SC_INPUT_MARK_HEADER, 1973*cdf0e10cSrcweir rInpOpt.GetMarkHeader() ) ); 1974*cdf0e10cSrcweir pRet->Put( SfxBoolItem( SID_SC_INPUT_TEXTWYSIWYG, 1975*cdf0e10cSrcweir rInpOpt.GetTextWysiwyg() ) ); 1976*cdf0e10cSrcweir pRet->Put( SfxBoolItem( SID_SC_INPUT_REPLCELLSWARN, 1977*cdf0e10cSrcweir rInpOpt.GetReplaceCellsWarn() ) ); 1978*cdf0e10cSrcweir 1979*cdf0e10cSrcweir // RID_SC_TP_PRINT 1980*cdf0e10cSrcweir pRet->Put( ScTpPrintItem( SID_SCPRINTOPTIONS, GetPrintOptions() ) ); 1981*cdf0e10cSrcweir 1982*cdf0e10cSrcweir // TP_GRID 1983*cdf0e10cSrcweir SvxGridItem* pSvxGridItem = aViewOpt.CreateGridItem(); 1984*cdf0e10cSrcweir pRet->Put( *pSvxGridItem ); 1985*cdf0e10cSrcweir delete pSvxGridItem; 1986*cdf0e10cSrcweir 1987*cdf0e10cSrcweir // TP_USERLISTS 1988*cdf0e10cSrcweir if ( pUL ) 1989*cdf0e10cSrcweir aULItem.SetUserList( *pUL ); 1990*cdf0e10cSrcweir pRet->Put( aULItem ); 1991*cdf0e10cSrcweir 1992*cdf0e10cSrcweir } 1993*cdf0e10cSrcweir return pRet; 1994*cdf0e10cSrcweir } 1995*cdf0e10cSrcweir 1996*cdf0e10cSrcweir void ScModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) 1997*cdf0e10cSrcweir { 1998*cdf0e10cSrcweir if(SID_SC_EDITOPTIONS == nId) 1999*cdf0e10cSrcweir { 2000*cdf0e10cSrcweir ModifyOptions( rSet ); 2001*cdf0e10cSrcweir } 2002*cdf0e10cSrcweir } 2003*cdf0e10cSrcweir 2004*cdf0e10cSrcweir SfxTabPage* ScModule::CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet ) 2005*cdf0e10cSrcweir { 2006*cdf0e10cSrcweir SfxTabPage* pRet = NULL; 2007*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 2008*cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 2009*cdf0e10cSrcweir switch(nId) 2010*cdf0e10cSrcweir { 2011*cdf0e10cSrcweir case SID_SC_TP_LAYOUT: 2012*cdf0e10cSrcweir { 2013*cdf0e10cSrcweir //CHINA001 pRet = ScTpLayoutOptions::Create(pParent, rSet); 2014*cdf0e10cSrcweir ::CreateTabPage ScTpLayoutOptionsCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_LAYOUT ); 2015*cdf0e10cSrcweir if ( ScTpLayoutOptionsCreate ) 2016*cdf0e10cSrcweir pRet = (*ScTpLayoutOptionsCreate) (pParent, rSet); 2017*cdf0e10cSrcweir } 2018*cdf0e10cSrcweir break; 2019*cdf0e10cSrcweir case SID_SC_TP_CONTENT: 2020*cdf0e10cSrcweir { 2021*cdf0e10cSrcweir //CHINA001 pRet = ScTpContentOptions::Create(pParent, rSet); 2022*cdf0e10cSrcweir ::CreateTabPage ScTpContentOptionsCreate = pFact->GetTabPageCreatorFunc(RID_SCPAGE_CONTENT); 2023*cdf0e10cSrcweir if ( ScTpContentOptionsCreate ) 2024*cdf0e10cSrcweir pRet = (*ScTpContentOptionsCreate)(pParent, rSet); 2025*cdf0e10cSrcweir } 2026*cdf0e10cSrcweir break; 2027*cdf0e10cSrcweir case SID_SC_TP_GRID: pRet = SvxGridTabPage::Create(pParent, rSet); break; 2028*cdf0e10cSrcweir case SID_SC_TP_USERLISTS: 2029*cdf0e10cSrcweir { 2030*cdf0e10cSrcweir //CHINA001 pRet = ScTpUserLists::Create(pParent, rSet); 2031*cdf0e10cSrcweir ::CreateTabPage ScTpUserListsCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_USERLISTS ); 2032*cdf0e10cSrcweir if ( ScTpUserListsCreate ) 2033*cdf0e10cSrcweir pRet = (*ScTpUserListsCreate)( pParent, rSet); 2034*cdf0e10cSrcweir } 2035*cdf0e10cSrcweir break; 2036*cdf0e10cSrcweir case SID_SC_TP_CALC: 2037*cdf0e10cSrcweir { //CHINA001 pRet = ScTpCalcOptions::Create(pParent, rSet); 2038*cdf0e10cSrcweir ::CreateTabPage ScTpCalcOptionsCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_CALC ); 2039*cdf0e10cSrcweir if ( ScTpCalcOptionsCreate ) 2040*cdf0e10cSrcweir pRet = (*ScTpCalcOptionsCreate)(pParent, rSet); 2041*cdf0e10cSrcweir } 2042*cdf0e10cSrcweir break; 2043*cdf0e10cSrcweir case SID_SC_TP_CHANGES: 2044*cdf0e10cSrcweir { //CHINA001 pRet = ScRedlineOptionsTabPage::Create(pParent, rSet); 2045*cdf0e10cSrcweir ::CreateTabPage ScRedlineOptionsTabPageCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_OPREDLINE ); 2046*cdf0e10cSrcweir if ( ScRedlineOptionsTabPageCreate ) 2047*cdf0e10cSrcweir pRet =(*ScRedlineOptionsTabPageCreate)(pParent, rSet); 2048*cdf0e10cSrcweir } 2049*cdf0e10cSrcweir break; 2050*cdf0e10cSrcweir case RID_SC_TP_PRINT: 2051*cdf0e10cSrcweir {//CHINA001 pRet = ScTpPrintOptions::Create(pParent, rSet); 2052*cdf0e10cSrcweir ::CreateTabPage ScTpPrintOptionsCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_PRINT ); 2053*cdf0e10cSrcweir if ( ScTpPrintOptionsCreate ) 2054*cdf0e10cSrcweir pRet = (*ScTpPrintOptionsCreate)( pParent, rSet); 2055*cdf0e10cSrcweir } 2056*cdf0e10cSrcweir break; 2057*cdf0e10cSrcweir case RID_OFA_TP_INTERNATIONAL: 2058*cdf0e10cSrcweir { 2059*cdf0e10cSrcweir SfxAbstractDialogFactory* pSfxFact = SfxAbstractDialogFactory::Create(); 2060*cdf0e10cSrcweir if ( pSfxFact ) 2061*cdf0e10cSrcweir { 2062*cdf0e10cSrcweir ::CreateTabPage fnCreatePage = pSfxFact->GetTabPageCreatorFunc( nId ); 2063*cdf0e10cSrcweir if ( fnCreatePage ) 2064*cdf0e10cSrcweir pRet = (*fnCreatePage)( pParent, rSet ); 2065*cdf0e10cSrcweir } 2066*cdf0e10cSrcweir } 2067*cdf0e10cSrcweir } 2068*cdf0e10cSrcweir 2069*cdf0e10cSrcweir DBG_ASSERT( pRet, "ScModule::CreateTabPage(): no valid ID for TabPage!" ); 2070*cdf0e10cSrcweir 2071*cdf0e10cSrcweir return pRet; 2072*cdf0e10cSrcweir } 2073*cdf0e10cSrcweir 2074*cdf0e10cSrcweir //------------------------------------------------------------------ 2075*cdf0e10cSrcweir 2076*cdf0e10cSrcweir IMPL_LINK( ScModule, CalcFieldValueHdl, EditFieldInfo*, pInfo ) 2077*cdf0e10cSrcweir { 2078*cdf0e10cSrcweir //! mit ScFieldEditEngine zusammenfassen !!! 2079*cdf0e10cSrcweir 2080*cdf0e10cSrcweir if (pInfo) 2081*cdf0e10cSrcweir { 2082*cdf0e10cSrcweir const SvxFieldItem& rField = pInfo->GetField(); 2083*cdf0e10cSrcweir const SvxFieldData* pField = rField.GetField(); 2084*cdf0e10cSrcweir 2085*cdf0e10cSrcweir if (pField && pField->ISA(SvxURLField)) 2086*cdf0e10cSrcweir { 2087*cdf0e10cSrcweir /****************************************************************** 2088*cdf0e10cSrcweir * URL-Field 2089*cdf0e10cSrcweir ******************************************************************/ 2090*cdf0e10cSrcweir 2091*cdf0e10cSrcweir const SvxURLField* pURLField = (const SvxURLField*) pField; 2092*cdf0e10cSrcweir String aURL = pURLField->GetURL(); 2093*cdf0e10cSrcweir 2094*cdf0e10cSrcweir switch ( pURLField->GetFormat() ) 2095*cdf0e10cSrcweir { 2096*cdf0e10cSrcweir case SVXURLFORMAT_APPDEFAULT: //!!! einstellbar an App??? 2097*cdf0e10cSrcweir case SVXURLFORMAT_REPR: 2098*cdf0e10cSrcweir { 2099*cdf0e10cSrcweir pInfo->SetRepresentation( pURLField->GetRepresentation() ); 2100*cdf0e10cSrcweir } 2101*cdf0e10cSrcweir break; 2102*cdf0e10cSrcweir 2103*cdf0e10cSrcweir case SVXURLFORMAT_URL: 2104*cdf0e10cSrcweir { 2105*cdf0e10cSrcweir pInfo->SetRepresentation( aURL ); 2106*cdf0e10cSrcweir } 2107*cdf0e10cSrcweir break; 2108*cdf0e10cSrcweir } 2109*cdf0e10cSrcweir 2110*cdf0e10cSrcweir svtools::ColorConfigEntry eEntry = 2111*cdf0e10cSrcweir INetURLHistory::GetOrCreate()->QueryUrl( aURL ) ? svtools::LINKSVISITED : svtools::LINKS; 2112*cdf0e10cSrcweir pInfo->SetTxtColor( GetColorConfig().GetColorValue(eEntry).nColor ); 2113*cdf0e10cSrcweir } 2114*cdf0e10cSrcweir else 2115*cdf0e10cSrcweir { 2116*cdf0e10cSrcweir DBG_ERROR("unbekannter Feldbefehl"); 2117*cdf0e10cSrcweir pInfo->SetRepresentation(String('?')); 2118*cdf0e10cSrcweir } 2119*cdf0e10cSrcweir } 2120*cdf0e10cSrcweir 2121*cdf0e10cSrcweir return 0; 2122*cdf0e10cSrcweir } 2123*cdf0e10cSrcweir 2124*cdf0e10cSrcweir sal_Bool ScModule::RegisterRefWindow( sal_uInt16 nSlotId, Window *pWnd ) 2125*cdf0e10cSrcweir { 2126*cdf0e10cSrcweir std::list<Window*> & rlRefWindow = m_mapRefWindow[nSlotId]; 2127*cdf0e10cSrcweir 2128*cdf0e10cSrcweir if( std::find( rlRefWindow.begin(), rlRefWindow.end(), pWnd ) == rlRefWindow.end() ) 2129*cdf0e10cSrcweir { 2130*cdf0e10cSrcweir rlRefWindow.push_back( pWnd ); 2131*cdf0e10cSrcweir return sal_True; 2132*cdf0e10cSrcweir } 2133*cdf0e10cSrcweir 2134*cdf0e10cSrcweir return sal_False; 2135*cdf0e10cSrcweir } 2136*cdf0e10cSrcweir 2137*cdf0e10cSrcweir sal_Bool ScModule::UnregisterRefWindow( sal_uInt16 nSlotId, Window *pWnd ) 2138*cdf0e10cSrcweir { 2139*cdf0e10cSrcweir std::map<sal_uInt16, std::list<Window*> >::iterator iSlot = m_mapRefWindow.find( nSlotId ); 2140*cdf0e10cSrcweir 2141*cdf0e10cSrcweir if( iSlot == m_mapRefWindow.end() ) 2142*cdf0e10cSrcweir return sal_False; 2143*cdf0e10cSrcweir 2144*cdf0e10cSrcweir std::list<Window*> & rlRefWindow = iSlot->second; 2145*cdf0e10cSrcweir 2146*cdf0e10cSrcweir std::list<Window*>::iterator i = std::find( rlRefWindow.begin(), rlRefWindow.end(), pWnd ); 2147*cdf0e10cSrcweir 2148*cdf0e10cSrcweir if( i == rlRefWindow.end() ) 2149*cdf0e10cSrcweir return sal_False; 2150*cdf0e10cSrcweir 2151*cdf0e10cSrcweir rlRefWindow.erase( i ); 2152*cdf0e10cSrcweir 2153*cdf0e10cSrcweir if( !rlRefWindow.size() ) 2154*cdf0e10cSrcweir m_mapRefWindow.erase( nSlotId ); 2155*cdf0e10cSrcweir 2156*cdf0e10cSrcweir return sal_True; 2157*cdf0e10cSrcweir } 2158*cdf0e10cSrcweir 2159*cdf0e10cSrcweir sal_Bool ScModule::IsAliveRefDlg( sal_uInt16 nSlotId, Window *pWnd ) 2160*cdf0e10cSrcweir { 2161*cdf0e10cSrcweir std::map<sal_uInt16, std::list<Window*> >::iterator iSlot = m_mapRefWindow.find( nSlotId ); 2162*cdf0e10cSrcweir 2163*cdf0e10cSrcweir if( iSlot == m_mapRefWindow.end() ) 2164*cdf0e10cSrcweir return sal_False; 2165*cdf0e10cSrcweir 2166*cdf0e10cSrcweir std::list<Window*> & rlRefWindow = iSlot->second; 2167*cdf0e10cSrcweir 2168*cdf0e10cSrcweir return rlRefWindow.end() != std::find( rlRefWindow.begin(), rlRefWindow.end(), pWnd ); 2169*cdf0e10cSrcweir } 2170*cdf0e10cSrcweir 2171*cdf0e10cSrcweir Window * ScModule::Find1RefWindow( sal_uInt16 nSlotId, Window *pWndAncestor ) 2172*cdf0e10cSrcweir { 2173*cdf0e10cSrcweir if (!pWndAncestor) 2174*cdf0e10cSrcweir return NULL; 2175*cdf0e10cSrcweir 2176*cdf0e10cSrcweir std::map<sal_uInt16, std::list<Window*> >::iterator iSlot = m_mapRefWindow.find( nSlotId ); 2177*cdf0e10cSrcweir 2178*cdf0e10cSrcweir if( iSlot == m_mapRefWindow.end() ) 2179*cdf0e10cSrcweir return NULL; 2180*cdf0e10cSrcweir 2181*cdf0e10cSrcweir std::list<Window*> & rlRefWindow = iSlot->second; 2182*cdf0e10cSrcweir 2183*cdf0e10cSrcweir while( Window *pParent = pWndAncestor->GetParent() ) pWndAncestor = pParent; 2184*cdf0e10cSrcweir 2185*cdf0e10cSrcweir for( std::list<Window*>::iterator i = rlRefWindow.begin(); i!=rlRefWindow.end(); i++ ) 2186*cdf0e10cSrcweir if ( pWndAncestor->IsWindowOrChild( *i, (*i)->IsSystemWindow() ) ) 2187*cdf0e10cSrcweir return *i; 2188*cdf0e10cSrcweir 2189*cdf0e10cSrcweir return NULL; 2190*cdf0e10cSrcweir } 2191*cdf0e10cSrcweir 2192*cdf0e10cSrcweir Window * ScModule::Find1RefWindow( Window *pWndAncestor ) 2193*cdf0e10cSrcweir { 2194*cdf0e10cSrcweir if (!pWndAncestor) 2195*cdf0e10cSrcweir return NULL; 2196*cdf0e10cSrcweir 2197*cdf0e10cSrcweir while( Window *pParent = pWndAncestor->GetParent() ) pWndAncestor = pParent; 2198*cdf0e10cSrcweir 2199*cdf0e10cSrcweir for( std::map<sal_uInt16, std::list<Window*> >::iterator i = m_mapRefWindow.begin(); 2200*cdf0e10cSrcweir i!=m_mapRefWindow.end(); i++ ) 2201*cdf0e10cSrcweir for( std::list<Window*>::iterator j = i->second.begin(); j!=i->second.end(); j++ ) 2202*cdf0e10cSrcweir if ( pWndAncestor->IsWindowOrChild( *j, (*j)->IsSystemWindow() ) ) 2203*cdf0e10cSrcweir return *j; 2204*cdf0e10cSrcweir 2205*cdf0e10cSrcweir return NULL; 2206*cdf0e10cSrcweir } 2207*cdf0e10cSrcweir 2208