1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sc.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir // INCLUDE --------------------------------------------------------------- 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include "scitems.hxx" 36*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 37*cdf0e10cSrcweir #include <sfx2/bindings.hxx> 38*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 39*cdf0e10cSrcweir #include <sfx2/request.hxx> 40*cdf0e10cSrcweir #include <svl/stritem.hxx> 41*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 42*cdf0e10cSrcweir #include <sfx2/app.hxx> 43*cdf0e10cSrcweir #include "globstr.hrc" 44*cdf0e10cSrcweir #include "scmod.hxx" 45*cdf0e10cSrcweir #include "appoptio.hxx" 46*cdf0e10cSrcweir #include "tabvwsh.hxx" 47*cdf0e10cSrcweir #include "document.hxx" 48*cdf0e10cSrcweir #include "sc.hrc" 49*cdf0e10cSrcweir #include "docsh.hxx" 50*cdf0e10cSrcweir #include "reffact.hxx" 51*cdf0e10cSrcweir #include "uiitems.hxx" 52*cdf0e10cSrcweir //CHINA001 #include "scendlg.hxx" 53*cdf0e10cSrcweir //CHINA001 #include "mtrindlg.hxx" 54*cdf0e10cSrcweir #include "autoform.hxx" 55*cdf0e10cSrcweir #include "autofmt.hxx" 56*cdf0e10cSrcweir #include "cellsh.hxx" 57*cdf0e10cSrcweir #include "attrdlg.hrc" // TP_ALIGNMENT 58*cdf0e10cSrcweir #include "inputhdl.hxx" 59*cdf0e10cSrcweir #include "editable.hxx" 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir #include "scabstdlg.hxx" //CHINA001 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir #define IS_EDITMODE() GetViewData()->HasEditView( GetViewData()->GetActivePart() ) 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir inline long TwipsToHMM(long nTwips) { return (nTwips * 127 + 36) / 72; } 66*cdf0e10cSrcweir inline long HMMToTwips(long nHMM) { return (nHMM * 72 + 63) / 127; } 67*cdf0e10cSrcweir inline long TwipsToEvenHMM(long nTwips) { return ( (nTwips * 127 + 72) / 144 ) * 2; } 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir //------------------------------------------------------------------ 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir void ScCellShell::Execute( SfxRequest& rReq ) 72*cdf0e10cSrcweir { 73*cdf0e10cSrcweir ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); 74*cdf0e10cSrcweir SfxBindings& rBindings = pTabViewShell->GetViewFrame()->GetBindings(); 75*cdf0e10cSrcweir ScModule* pScMod = SC_MOD(); 76*cdf0e10cSrcweir const SfxItemSet* pReqArgs = rReq.GetArgs(); 77*cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir if (nSlot != SID_CURRENTCELL) // der kommt beim MouseButtonUp 80*cdf0e10cSrcweir pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir if ( IS_EDITMODE() ) 83*cdf0e10cSrcweir { 84*cdf0e10cSrcweir switch ( nSlot ) 85*cdf0e10cSrcweir { 86*cdf0e10cSrcweir // beim Oeffnen eines Referenz-Dialogs darf die SubShell nicht umgeschaltet werden 87*cdf0e10cSrcweir // (beim Schliessen des Dialogs wird StopEditShell gerufen) 88*cdf0e10cSrcweir case SID_OPENDLG_FUNCTION: 89*cdf0e10cSrcweir // #53318# inplace macht die EditShell Aerger... 90*cdf0e10cSrcweir //! kann nicht immer umgeschaltet werden ???? 91*cdf0e10cSrcweir if (!pTabViewShell->GetViewFrame()->GetFrame().IsInPlace()) 92*cdf0e10cSrcweir pTabViewShell->SetDontSwitch(sal_True); // EditShell nicht abschalten 93*cdf0e10cSrcweir // kein break 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir case FID_CELL_FORMAT: 96*cdf0e10cSrcweir case SID_ENABLE_HYPHENATION: 97*cdf0e10cSrcweir case SID_DATA_SELECT: 98*cdf0e10cSrcweir case SID_OPENDLG_CONSOLIDATE: 99*cdf0e10cSrcweir case SID_OPENDLG_SOLVE: 100*cdf0e10cSrcweir case SID_OPENDLG_OPTSOLVER: 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir pScMod->InputEnterHandler(); 103*cdf0e10cSrcweir pTabViewShell->UpdateInputHandler(); 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir pTabViewShell->SetDontSwitch(sal_False); 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir break; 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir default: 110*cdf0e10cSrcweir break; 111*cdf0e10cSrcweir } 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir switch ( nSlot ) 115*cdf0e10cSrcweir { 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir case SID_ATTR_SIZE://XXX ??? 120*cdf0e10cSrcweir break; 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir case SID_STATUS_SELMODE: 123*cdf0e10cSrcweir if ( pReqArgs ) 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir /* 0: STD Click hebt Sel auf 126*cdf0e10cSrcweir * 1: ER Click erweitert Selektion 127*cdf0e10cSrcweir * 2: ERG Click definiert weitere Selektion 128*cdf0e10cSrcweir */ 129*cdf0e10cSrcweir sal_uInt16 nMode = ((const SfxUInt16Item&)pReqArgs->Get( nSlot )).GetValue(); 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir switch ( nMode ) 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir case 1: nMode = KEY_SHIFT; break; 134*cdf0e10cSrcweir case 2: nMode = KEY_MOD1; break; // Control-Taste 135*cdf0e10cSrcweir case 0: 136*cdf0e10cSrcweir default: 137*cdf0e10cSrcweir nMode = 0; 138*cdf0e10cSrcweir } 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir pTabViewShell->LockModifiers( nMode ); 141*cdf0e10cSrcweir } 142*cdf0e10cSrcweir else 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir // no arguments (also executed by double click on the status bar controller): 145*cdf0e10cSrcweir // advance to next selection mode 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir sal_uInt16 nModifiers = pTabViewShell->GetLockedModifiers(); 148*cdf0e10cSrcweir switch ( nModifiers ) 149*cdf0e10cSrcweir { 150*cdf0e10cSrcweir case KEY_SHIFT: nModifiers = KEY_MOD1; break; // EXT -> ADD 151*cdf0e10cSrcweir case KEY_MOD1: nModifiers = 0; break; // ADD -> STD 152*cdf0e10cSrcweir default: nModifiers = KEY_SHIFT; break; // STD -> EXT 153*cdf0e10cSrcweir } 154*cdf0e10cSrcweir pTabViewShell->LockModifiers( nModifiers ); 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir rBindings.Invalidate( SID_STATUS_SELMODE ); 158*cdf0e10cSrcweir rReq.Done(); 159*cdf0e10cSrcweir break; 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir // SID_STATUS_SELMODE_NORM wird nicht benutzt ??? 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir case SID_STATUS_SELMODE_NORM: 164*cdf0e10cSrcweir pTabViewShell->LockModifiers( 0 ); 165*cdf0e10cSrcweir rBindings.Invalidate( SID_STATUS_SELMODE ); 166*cdf0e10cSrcweir break; 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir // SID_STATUS_SELMODE_ERG / SID_STATUS_SELMODE_ERW als Toggles: 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir case SID_STATUS_SELMODE_ERG: 171*cdf0e10cSrcweir if ( pTabViewShell->GetLockedModifiers() & KEY_MOD1 ) 172*cdf0e10cSrcweir pTabViewShell->LockModifiers( 0 ); 173*cdf0e10cSrcweir else 174*cdf0e10cSrcweir pTabViewShell->LockModifiers( KEY_MOD1 ); 175*cdf0e10cSrcweir rBindings.Invalidate( SID_STATUS_SELMODE ); 176*cdf0e10cSrcweir break; 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir case SID_STATUS_SELMODE_ERW: 179*cdf0e10cSrcweir if ( pTabViewShell->GetLockedModifiers() & KEY_SHIFT ) 180*cdf0e10cSrcweir pTabViewShell->LockModifiers( 0 ); 181*cdf0e10cSrcweir else 182*cdf0e10cSrcweir pTabViewShell->LockModifiers( KEY_SHIFT ); 183*cdf0e10cSrcweir rBindings.Invalidate( SID_STATUS_SELMODE ); 184*cdf0e10cSrcweir break; 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir case SID_ENTER_STRING: 187*cdf0e10cSrcweir { 188*cdf0e10cSrcweir if ( pReqArgs ) 189*cdf0e10cSrcweir { 190*cdf0e10cSrcweir String aStr( ((const SfxStringItem&)pReqArgs-> 191*cdf0e10cSrcweir Get( SID_ENTER_STRING )).GetValue() ); 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir pTabViewShell->EnterData( GetViewData()->GetCurX(), 194*cdf0e10cSrcweir GetViewData()->GetCurY(), 195*cdf0e10cSrcweir GetViewData()->GetTabNo(), 196*cdf0e10cSrcweir aStr ); 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir ScInputHandler* pHdl = SC_MOD()->GetInputHdl( pTabViewShell ); 199*cdf0e10cSrcweir if ( !pHdl || !pHdl->IsInEnterHandler() ) 200*cdf0e10cSrcweir { 201*cdf0e10cSrcweir // #101061# UpdateInputHandler is needed after the cell content 202*cdf0e10cSrcweir // has changed, but if called from EnterHandler, UpdateInputHandler 203*cdf0e10cSrcweir // will be called later when moving the cursor. 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir pTabViewShell->UpdateInputHandler(); 206*cdf0e10cSrcweir } 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir rReq.Done(); 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir // hier kein GrabFocus, weil sonst auf dem Mac die Tabelle vor die 211*cdf0e10cSrcweir // Seitenansicht springt, wenn die Eingabe nicht abgeschlossen war 212*cdf0e10cSrcweir // (GrabFocus passiert in KillEditView) 213*cdf0e10cSrcweir } 214*cdf0e10cSrcweir } 215*cdf0e10cSrcweir break; 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir case SID_INSERT_MATRIX: 218*cdf0e10cSrcweir { 219*cdf0e10cSrcweir if ( pReqArgs ) 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir String aStr = ((const SfxStringItem&)pReqArgs-> 222*cdf0e10cSrcweir Get( SID_INSERT_MATRIX )).GetValue(); 223*cdf0e10cSrcweir pTabViewShell->EnterMatrix( aStr ); 224*cdf0e10cSrcweir rReq.Done(); 225*cdf0e10cSrcweir } 226*cdf0e10cSrcweir } 227*cdf0e10cSrcweir break; 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir case FID_INPUTLINE_ENTER: 230*cdf0e10cSrcweir case FID_INPUTLINE_BLOCK: 231*cdf0e10cSrcweir case FID_INPUTLINE_MATRIX: 232*cdf0e10cSrcweir { 233*cdf0e10cSrcweir if( pReqArgs == 0 ) //XXX vorlaufiger HACK um GPF zu vermeiden 234*cdf0e10cSrcweir break; 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir const ScInputStatusItem* pStatusItem 237*cdf0e10cSrcweir = (const ScInputStatusItem*)&pReqArgs-> 238*cdf0e10cSrcweir Get( FID_INPUTLINE_STATUS ); 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir ScAddress aCursorPos = pStatusItem->GetPos(); 241*cdf0e10cSrcweir String aString = pStatusItem->GetString(); 242*cdf0e10cSrcweir const EditTextObject* pData = pStatusItem->GetEditData(); 243*cdf0e10cSrcweir if (pData) 244*cdf0e10cSrcweir { 245*cdf0e10cSrcweir if (nSlot == FID_INPUTLINE_BLOCK) 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir pTabViewShell->EnterBlock( aString, pData ); 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir else if ( aString.Len() > 0 && ( aString.GetChar(0) == '=' || aString.GetChar(0) == '+' || aString.GetChar(0) == '-' ) ) 250*cdf0e10cSrcweir { 251*cdf0e10cSrcweir pTabViewShell->EnterData( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(), aString, sal_True, pData ); 252*cdf0e10cSrcweir } 253*cdf0e10cSrcweir else 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir pTabViewShell->EnterData( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(), pData ); 256*cdf0e10cSrcweir } 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir else 259*cdf0e10cSrcweir { 260*cdf0e10cSrcweir if (nSlot == FID_INPUTLINE_ENTER) 261*cdf0e10cSrcweir { 262*cdf0e10cSrcweir if ( 263*cdf0e10cSrcweir aCursorPos.Col() == GetViewData()->GetCurX() && 264*cdf0e10cSrcweir aCursorPos.Row() == GetViewData()->GetCurY() && 265*cdf0e10cSrcweir aCursorPos.Tab() == GetViewData()->GetTabNo() 266*cdf0e10cSrcweir ) 267*cdf0e10cSrcweir { 268*cdf0e10cSrcweir SfxStringItem aItem( SID_ENTER_STRING, aString ); 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir // SfxBindings& rBindings = pTabViewShell->GetViewFrame()->GetBindings(); 271*cdf0e10cSrcweir const SfxPoolItem* aArgs[2]; 272*cdf0e10cSrcweir aArgs[0] = &aItem; 273*cdf0e10cSrcweir aArgs[1] = NULL; 274*cdf0e10cSrcweir rBindings.Execute( SID_ENTER_STRING, aArgs ); 275*cdf0e10cSrcweir } 276*cdf0e10cSrcweir else 277*cdf0e10cSrcweir { 278*cdf0e10cSrcweir pTabViewShell->EnterData( aCursorPos.Col(), 279*cdf0e10cSrcweir aCursorPos.Row(), 280*cdf0e10cSrcweir aCursorPos.Tab(), 281*cdf0e10cSrcweir aString ); 282*cdf0e10cSrcweir rReq.Done(); 283*cdf0e10cSrcweir } 284*cdf0e10cSrcweir } 285*cdf0e10cSrcweir else if (nSlot == FID_INPUTLINE_BLOCK) 286*cdf0e10cSrcweir { 287*cdf0e10cSrcweir pTabViewShell->EnterBlock( aString, NULL ); 288*cdf0e10cSrcweir rReq.Done(); 289*cdf0e10cSrcweir } 290*cdf0e10cSrcweir else 291*cdf0e10cSrcweir { 292*cdf0e10cSrcweir pTabViewShell->EnterMatrix( aString ); 293*cdf0e10cSrcweir rReq.Done(); 294*cdf0e10cSrcweir } 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir } 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir // hier kein GrabFocus, weil sonst auf dem Mac die Tabelle vor die 299*cdf0e10cSrcweir // Seitenansicht springt, wenn die Eingabe nicht abgeschlossen war 300*cdf0e10cSrcweir // (GrabFocus passiert in KillEditView) 301*cdf0e10cSrcweir } 302*cdf0e10cSrcweir break; 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir case SID_OPENDLG_FUNCTION: 305*cdf0e10cSrcweir { 306*cdf0e10cSrcweir sal_uInt16 nId = SID_OPENDLG_FUNCTION; 307*cdf0e10cSrcweir SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame(); 308*cdf0e10cSrcweir SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId ); 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir pScMod->SetRefDialog( nId, pWnd ? sal_False : sal_True ); 311*cdf0e10cSrcweir rReq.Ignore(); 312*cdf0e10cSrcweir } 313*cdf0e10cSrcweir break; 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir case SID_OPENDLG_CONSOLIDATE: 316*cdf0e10cSrcweir { 317*cdf0e10cSrcweir sal_uInt16 nId = ScConsolidateDlgWrapper::GetChildWindowId(); 318*cdf0e10cSrcweir SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame(); 319*cdf0e10cSrcweir SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId ); 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir pScMod->SetRefDialog( nId, pWnd ? sal_False : sal_True ); 322*cdf0e10cSrcweir } 323*cdf0e10cSrcweir break; 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir case FID_CELL_FORMAT: 326*cdf0e10cSrcweir { 327*cdf0e10cSrcweir if ( pReqArgs != NULL ) 328*cdf0e10cSrcweir { 329*cdf0e10cSrcweir //---------------------------------- 330*cdf0e10cSrcweir // Zellattribute ohne Dialog setzen: 331*cdf0e10cSrcweir //---------------------------------- 332*cdf0e10cSrcweir SfxItemSet* pEmptySet = 333*cdf0e10cSrcweir new SfxItemSet( *pReqArgs->GetPool(), 334*cdf0e10cSrcweir ATTR_PATTERN_START, 335*cdf0e10cSrcweir ATTR_PATTERN_END ); 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir SfxItemSet* pNewSet = 338*cdf0e10cSrcweir new SfxItemSet( *pReqArgs->GetPool(), 339*cdf0e10cSrcweir ATTR_PATTERN_START, 340*cdf0e10cSrcweir ATTR_PATTERN_END ); 341*cdf0e10cSrcweir 342*cdf0e10cSrcweir const SfxPoolItem* pAttr = NULL; 343*cdf0e10cSrcweir sal_uInt16 nWhich = 0; 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir for ( nWhich=ATTR_PATTERN_START; nWhich<=ATTR_PATTERN_END; nWhich++ ) 346*cdf0e10cSrcweir if ( pReqArgs->GetItemState( nWhich, sal_True, &pAttr ) == SFX_ITEM_SET ) 347*cdf0e10cSrcweir pNewSet->Put( *pAttr ); 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir pTabViewShell->ApplyAttributes( pNewSet, pEmptySet ); 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir delete pNewSet; 352*cdf0e10cSrcweir delete pEmptySet; 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir rReq.Done(); 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir else if ( pReqArgs == NULL ) 357*cdf0e10cSrcweir { 358*cdf0e10cSrcweir pTabViewShell->ExecuteCellFormatDlg( rReq ); 359*cdf0e10cSrcweir } 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir break; 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir case SID_ENABLE_HYPHENATION: 364*cdf0e10cSrcweir pTabViewShell->ExecuteCellFormatDlg( rReq, TP_ALIGNMENT ); 365*cdf0e10cSrcweir break; 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir case SID_OPENDLG_SOLVE: 368*cdf0e10cSrcweir { 369*cdf0e10cSrcweir sal_uInt16 nId = ScSolverDlgWrapper::GetChildWindowId(); 370*cdf0e10cSrcweir SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame(); 371*cdf0e10cSrcweir SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId ); 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir pScMod->SetRefDialog( nId, pWnd ? sal_False : sal_True ); 374*cdf0e10cSrcweir } 375*cdf0e10cSrcweir break; 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir case SID_OPENDLG_OPTSOLVER: 378*cdf0e10cSrcweir { 379*cdf0e10cSrcweir sal_uInt16 nId = ScOptSolverDlgWrapper::GetChildWindowId(); 380*cdf0e10cSrcweir SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame(); 381*cdf0e10cSrcweir SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId ); 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir pScMod->SetRefDialog( nId, pWnd ? sal_False : sal_True ); 384*cdf0e10cSrcweir } 385*cdf0e10cSrcweir break; 386*cdf0e10cSrcweir 387*cdf0e10cSrcweir case SID_OPENDLG_TABOP: 388*cdf0e10cSrcweir { 389*cdf0e10cSrcweir sal_uInt16 nId = ScTabOpDlgWrapper::GetChildWindowId(); 390*cdf0e10cSrcweir SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame(); 391*cdf0e10cSrcweir SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId ); 392*cdf0e10cSrcweir 393*cdf0e10cSrcweir pScMod->SetRefDialog( nId, pWnd ? sal_False : sal_True ); 394*cdf0e10cSrcweir } 395*cdf0e10cSrcweir break; 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir case SID_SCENARIOS: 398*cdf0e10cSrcweir { 399*cdf0e10cSrcweir ScDocument* pDoc = GetViewData()->GetDocument(); 400*cdf0e10cSrcweir ScMarkData& rMark = GetViewData()->GetMarkData(); 401*cdf0e10cSrcweir SCTAB nTab = GetViewData()->GetTabNo(); 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir if ( pDoc->IsScenario(nTab) ) 404*cdf0e10cSrcweir { 405*cdf0e10cSrcweir rMark.MarkToMulti(); 406*cdf0e10cSrcweir if ( rMark.IsMultiMarked() ) 407*cdf0e10cSrcweir { 408*cdf0e10cSrcweir if ( rReq.IsAPI() 409*cdf0e10cSrcweir || RET_YES == 410*cdf0e10cSrcweir QueryBox( pTabViewShell->GetDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), 411*cdf0e10cSrcweir ScGlobal::GetRscString(STR_UPDATE_SCENARIO) ). 412*cdf0e10cSrcweir Execute() ) 413*cdf0e10cSrcweir { 414*cdf0e10cSrcweir pTabViewShell->ExtendScenario(); 415*cdf0e10cSrcweir rReq.Done(); 416*cdf0e10cSrcweir } 417*cdf0e10cSrcweir } 418*cdf0e10cSrcweir else if( ! rReq.IsAPI() ) 419*cdf0e10cSrcweir { 420*cdf0e10cSrcweir ErrorBox aErrorBox( pTabViewShell->GetDialogParent(), WinBits(WB_OK | WB_DEF_OK), 421*cdf0e10cSrcweir ScGlobal::GetRscString(STR_NOAREASELECTED) ); 422*cdf0e10cSrcweir aErrorBox.Execute(); 423*cdf0e10cSrcweir } 424*cdf0e10cSrcweir } 425*cdf0e10cSrcweir else 426*cdf0e10cSrcweir { 427*cdf0e10cSrcweir rMark.MarkToMulti(); 428*cdf0e10cSrcweir if ( rMark.IsMultiMarked() ) 429*cdf0e10cSrcweir { 430*cdf0e10cSrcweir SCTAB i=1; 431*cdf0e10cSrcweir String aBaseName; 432*cdf0e10cSrcweir String aName; 433*cdf0e10cSrcweir String aComment; 434*cdf0e10cSrcweir Color aColor; 435*cdf0e10cSrcweir sal_uInt16 nFlags; 436*cdf0e10cSrcweir 437*cdf0e10cSrcweir pDoc->GetName( nTab, aBaseName ); 438*cdf0e10cSrcweir aBaseName += '_'; 439*cdf0e10cSrcweir aBaseName += ScGlobal::GetRscString(STR_SCENARIO); 440*cdf0e10cSrcweir aBaseName += '_'; 441*cdf0e10cSrcweir 442*cdf0e10cSrcweir // vorneweg testen, ob der Prefix als gueltig erkannt wird 443*cdf0e10cSrcweir // wenn nicht, nur doppelte vermeiden 444*cdf0e10cSrcweir sal_Bool bPrefix = pDoc->ValidTabName( aBaseName ); 445*cdf0e10cSrcweir DBG_ASSERT(bPrefix, "ungueltiger Tabellenname"); 446*cdf0e10cSrcweir 447*cdf0e10cSrcweir while ( pDoc->IsScenario(nTab+i) ) 448*cdf0e10cSrcweir i++; 449*cdf0e10cSrcweir 450*cdf0e10cSrcweir sal_Bool bValid; 451*cdf0e10cSrcweir SCTAB nDummy; 452*cdf0e10cSrcweir do 453*cdf0e10cSrcweir { 454*cdf0e10cSrcweir aName = aBaseName; 455*cdf0e10cSrcweir aName += String::CreateFromInt32( i ); 456*cdf0e10cSrcweir if (bPrefix) 457*cdf0e10cSrcweir bValid = pDoc->ValidNewTabName( aName ); 458*cdf0e10cSrcweir else 459*cdf0e10cSrcweir bValid = !pDoc->GetTable( aName, nDummy ); 460*cdf0e10cSrcweir ++i; 461*cdf0e10cSrcweir } 462*cdf0e10cSrcweir while ( !bValid && i <= 2*MAXTAB ); 463*cdf0e10cSrcweir 464*cdf0e10cSrcweir if ( pReqArgs != NULL ) 465*cdf0e10cSrcweir { 466*cdf0e10cSrcweir String aArgName; 467*cdf0e10cSrcweir String aArgComment; 468*cdf0e10cSrcweir const SfxPoolItem* pItem; 469*cdf0e10cSrcweir if ( pReqArgs->GetItemState( SID_SCENARIOS, sal_True, &pItem ) == SFX_ITEM_SET ) 470*cdf0e10cSrcweir aArgName = ((const SfxStringItem*)pItem)->GetValue(); 471*cdf0e10cSrcweir if ( pReqArgs->GetItemState( SID_NEW_TABLENAME, sal_True, &pItem ) == SFX_ITEM_SET ) 472*cdf0e10cSrcweir aArgComment = ((const SfxStringItem*)pItem)->GetValue(); 473*cdf0e10cSrcweir 474*cdf0e10cSrcweir aColor = Color( COL_LIGHTGRAY ); // Default 475*cdf0e10cSrcweir nFlags = 0; // nicht-TwoWay 476*cdf0e10cSrcweir 477*cdf0e10cSrcweir pTabViewShell->MakeScenario( aArgName, aArgComment, aColor, nFlags ); 478*cdf0e10cSrcweir if( ! rReq.IsAPI() ) 479*cdf0e10cSrcweir rReq.Done(); 480*cdf0e10cSrcweir } 481*cdf0e10cSrcweir else 482*cdf0e10cSrcweir { 483*cdf0e10cSrcweir sal_Bool bSheetProtected = pDoc->IsTabProtected(nTab); 484*cdf0e10cSrcweir //CHINA001 ScNewScenarioDlg* pNewDlg = 485*cdf0e10cSrcweir //CHINA001 new ScNewScenarioDlg( pTabViewShell->GetDialogParent(), aName, sal_False, bSheetProtected ); 486*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 487*cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 488*cdf0e10cSrcweir 489*cdf0e10cSrcweir AbstractScNewScenarioDlg* pNewDlg = pFact->CreateScNewScenarioDlg( pTabViewShell->GetDialogParent(), aName, RID_SCDLG_NEWSCENARIO, sal_False,bSheetProtected); 490*cdf0e10cSrcweir DBG_ASSERT(pNewDlg, "Dialog create fail!");//CHINA001 491*cdf0e10cSrcweir if ( pNewDlg->Execute() == RET_OK ) 492*cdf0e10cSrcweir { 493*cdf0e10cSrcweir pNewDlg->GetScenarioData( aName, aComment, aColor, nFlags ); 494*cdf0e10cSrcweir pTabViewShell->MakeScenario( aName, aComment, aColor, nFlags ); 495*cdf0e10cSrcweir 496*cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( SID_SCENARIOS, aName ) ); 497*cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( SID_NEW_TABLENAME, aComment ) ); 498*cdf0e10cSrcweir rReq.Done(); 499*cdf0e10cSrcweir } 500*cdf0e10cSrcweir delete pNewDlg; 501*cdf0e10cSrcweir } 502*cdf0e10cSrcweir } 503*cdf0e10cSrcweir else if( ! rReq.IsAPI() ) 504*cdf0e10cSrcweir { 505*cdf0e10cSrcweir pTabViewShell->ErrorMessage(STR_ERR_NEWSCENARIO); 506*cdf0e10cSrcweir } 507*cdf0e10cSrcweir } 508*cdf0e10cSrcweir } 509*cdf0e10cSrcweir break; 510*cdf0e10cSrcweir 511*cdf0e10cSrcweir 512*cdf0e10cSrcweir case SID_SELECTALL: 513*cdf0e10cSrcweir { 514*cdf0e10cSrcweir pTabViewShell->SelectAll(); 515*cdf0e10cSrcweir rReq.Done(); 516*cdf0e10cSrcweir } 517*cdf0e10cSrcweir break; 518*cdf0e10cSrcweir 519*cdf0e10cSrcweir //---------------------------------------------------------------- 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir case FID_ROW_HEIGHT: 522*cdf0e10cSrcweir { 523*cdf0e10cSrcweir if ( pReqArgs ) 524*cdf0e10cSrcweir { 525*cdf0e10cSrcweir const SfxUInt16Item& rUInt16Item = (const SfxUInt16Item&)pReqArgs->Get( FID_ROW_HEIGHT ); 526*cdf0e10cSrcweir 527*cdf0e10cSrcweir // #101390#; the value of the macro is in HMM so use HMMToTwips to convert 528*cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_False, SC_SIZE_DIRECT, 529*cdf0e10cSrcweir sal::static_int_cast<sal_uInt16>( HMMToTwips(rUInt16Item.GetValue()) ) ); 530*cdf0e10cSrcweir if( ! rReq.IsAPI() ) 531*cdf0e10cSrcweir rReq.Done(); 532*cdf0e10cSrcweir } 533*cdf0e10cSrcweir else 534*cdf0e10cSrcweir { 535*cdf0e10cSrcweir ScViewData* pData = GetViewData(); 536*cdf0e10cSrcweir FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); 537*cdf0e10cSrcweir sal_uInt16 nCurHeight = pData->GetDocument()-> 538*cdf0e10cSrcweir GetRowHeight( pData->GetCurY(), 539*cdf0e10cSrcweir pData->GetTabNo() ); 540*cdf0e10cSrcweir //CHINA001 ScMetricInputDlg* pDlg = 541*cdf0e10cSrcweir //CHINA001 new ScMetricInputDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_ROW_MAN, 542*cdf0e10cSrcweir //CHINA001 nCurHeight, 543*cdf0e10cSrcweir //CHINA001 ScGlobal::nStdRowHeight, 544*cdf0e10cSrcweir //CHINA001 eMetric, 545*cdf0e10cSrcweir //CHINA001 2, 546*cdf0e10cSrcweir //CHINA001 MAX_COL_HEIGHT ); 547*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 548*cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 549*cdf0e10cSrcweir 550*cdf0e10cSrcweir AbstractScMetricInputDlg* pDlg = pFact->CreateScMetricInputDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_ROW_MAN, 551*cdf0e10cSrcweir nCurHeight, 552*cdf0e10cSrcweir ScGlobal::nStdRowHeight, 553*cdf0e10cSrcweir RID_SCDLG_ROW_MAN, 554*cdf0e10cSrcweir eMetric, 555*cdf0e10cSrcweir 2, 556*cdf0e10cSrcweir MAX_COL_HEIGHT); 557*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 558*cdf0e10cSrcweir 559*cdf0e10cSrcweir if ( pDlg->Execute() == RET_OK ) 560*cdf0e10cSrcweir { 561*cdf0e10cSrcweir long nVal = pDlg->GetInputValue(); 562*cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_False, SC_SIZE_DIRECT, (sal_uInt16)nVal ); 563*cdf0e10cSrcweir 564*cdf0e10cSrcweir // #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert 565*cdf0e10cSrcweir rReq.AppendItem( SfxUInt16Item( FID_ROW_HEIGHT, (sal_uInt16)TwipsToEvenHMM(nVal) ) ); 566*cdf0e10cSrcweir rReq.Done(); 567*cdf0e10cSrcweir 568*cdf0e10cSrcweir } 569*cdf0e10cSrcweir delete pDlg; 570*cdf0e10cSrcweir } 571*cdf0e10cSrcweir } 572*cdf0e10cSrcweir break; 573*cdf0e10cSrcweir 574*cdf0e10cSrcweir case FID_ROW_OPT_HEIGHT: 575*cdf0e10cSrcweir { 576*cdf0e10cSrcweir if ( pReqArgs ) 577*cdf0e10cSrcweir { 578*cdf0e10cSrcweir const SfxUInt16Item& rUInt16Item = (const SfxUInt16Item&)pReqArgs->Get( FID_ROW_OPT_HEIGHT ); 579*cdf0e10cSrcweir 580*cdf0e10cSrcweir // #101390#; the value of the macro is in HMM so use HMMToTwips to convert 581*cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_False, SC_SIZE_OPTIMAL, 582*cdf0e10cSrcweir sal::static_int_cast<sal_uInt16>( HMMToTwips(rUInt16Item.GetValue()) ) ); 583*cdf0e10cSrcweir ScGlobal::nLastRowHeightExtra = rUInt16Item.GetValue(); 584*cdf0e10cSrcweir 585*cdf0e10cSrcweir if( ! rReq.IsAPI() ) 586*cdf0e10cSrcweir rReq.Done(); 587*cdf0e10cSrcweir } 588*cdf0e10cSrcweir else 589*cdf0e10cSrcweir { 590*cdf0e10cSrcweir FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); 591*cdf0e10cSrcweir 592*cdf0e10cSrcweir //CHINA001 ScMetricInputDlg* pDlg = 593*cdf0e10cSrcweir //CHINA001 new ScMetricInputDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_ROW_OPT, 594*cdf0e10cSrcweir //CHINA001 ScGlobal::nLastRowHeightExtra, 595*cdf0e10cSrcweir //CHINA001 0, 596*cdf0e10cSrcweir //CHINA001 eMetric, 597*cdf0e10cSrcweir //CHINA001 1, 598*cdf0e10cSrcweir //CHINA001 MAX_EXTRA_HEIGHT ); 599*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 600*cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 601*cdf0e10cSrcweir 602*cdf0e10cSrcweir AbstractScMetricInputDlg* pDlg = pFact->CreateScMetricInputDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_ROW_OPT, 603*cdf0e10cSrcweir ScGlobal::nLastRowHeightExtra, 604*cdf0e10cSrcweir 0, 605*cdf0e10cSrcweir RID_SCDLG_ROW_OPT, 606*cdf0e10cSrcweir eMetric, 607*cdf0e10cSrcweir 1, 608*cdf0e10cSrcweir MAX_EXTRA_HEIGHT); 609*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 610*cdf0e10cSrcweir 611*cdf0e10cSrcweir if ( pDlg->Execute() == RET_OK ) 612*cdf0e10cSrcweir { 613*cdf0e10cSrcweir long nVal = pDlg->GetInputValue(); 614*cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_False, SC_SIZE_OPTIMAL, (sal_uInt16)nVal ); 615*cdf0e10cSrcweir ScGlobal::nLastRowHeightExtra = nVal; 616*cdf0e10cSrcweir 617*cdf0e10cSrcweir // #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert 618*cdf0e10cSrcweir rReq.AppendItem( SfxUInt16Item( FID_ROW_OPT_HEIGHT, (sal_uInt16)TwipsToEvenHMM(nVal) ) ); 619*cdf0e10cSrcweir rReq.Done(); 620*cdf0e10cSrcweir 621*cdf0e10cSrcweir } 622*cdf0e10cSrcweir delete pDlg; 623*cdf0e10cSrcweir } 624*cdf0e10cSrcweir } 625*cdf0e10cSrcweir break; 626*cdf0e10cSrcweir 627*cdf0e10cSrcweir case FID_COL_WIDTH: 628*cdf0e10cSrcweir { 629*cdf0e10cSrcweir if ( pReqArgs ) 630*cdf0e10cSrcweir { 631*cdf0e10cSrcweir const SfxUInt16Item& rUInt16Item = (const SfxUInt16Item&)pReqArgs->Get( FID_COL_WIDTH ); 632*cdf0e10cSrcweir 633*cdf0e10cSrcweir // #101390#; the value of the macro is in HMM so use HMMToTwips to convert 634*cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_True, SC_SIZE_DIRECT, 635*cdf0e10cSrcweir sal::static_int_cast<sal_uInt16>( HMMToTwips(rUInt16Item.GetValue()) ) ); 636*cdf0e10cSrcweir if( ! rReq.IsAPI() ) 637*cdf0e10cSrcweir rReq.Done(); 638*cdf0e10cSrcweir } 639*cdf0e10cSrcweir else 640*cdf0e10cSrcweir { 641*cdf0e10cSrcweir FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); 642*cdf0e10cSrcweir ScViewData* pData = GetViewData(); 643*cdf0e10cSrcweir sal_uInt16 nCurHeight = pData->GetDocument()-> 644*cdf0e10cSrcweir GetColWidth( pData->GetCurX(), 645*cdf0e10cSrcweir pData->GetTabNo() ); 646*cdf0e10cSrcweir //CHINA001 ScMetricInputDlg* pDlg = 647*cdf0e10cSrcweir //CHINA001 new ScMetricInputDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_COL_MAN, 648*cdf0e10cSrcweir //CHINA001 nCurHeight, 649*cdf0e10cSrcweir //CHINA001 STD_COL_WIDTH, 650*cdf0e10cSrcweir //CHINA001 eMetric, 651*cdf0e10cSrcweir //CHINA001 2, 652*cdf0e10cSrcweir //CHINA001 MAX_COL_WIDTH ); 653*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 654*cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 655*cdf0e10cSrcweir 656*cdf0e10cSrcweir AbstractScMetricInputDlg* pDlg = pFact->CreateScMetricInputDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_COL_MAN, 657*cdf0e10cSrcweir nCurHeight, 658*cdf0e10cSrcweir STD_COL_WIDTH, 659*cdf0e10cSrcweir RID_SCDLG_COL_MAN, 660*cdf0e10cSrcweir eMetric, 661*cdf0e10cSrcweir 2, 662*cdf0e10cSrcweir MAX_COL_WIDTH); 663*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 664*cdf0e10cSrcweir 665*cdf0e10cSrcweir if ( pDlg->Execute() == RET_OK ) 666*cdf0e10cSrcweir { 667*cdf0e10cSrcweir long nVal = pDlg->GetInputValue(); 668*cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_True, SC_SIZE_DIRECT, (sal_uInt16)nVal ); 669*cdf0e10cSrcweir 670*cdf0e10cSrcweir // #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert 671*cdf0e10cSrcweir rReq.AppendItem( SfxUInt16Item( FID_COL_WIDTH, (sal_uInt16)TwipsToEvenHMM(nVal)) ); 672*cdf0e10cSrcweir rReq.Done(); 673*cdf0e10cSrcweir 674*cdf0e10cSrcweir } 675*cdf0e10cSrcweir delete pDlg; 676*cdf0e10cSrcweir } 677*cdf0e10cSrcweir } 678*cdf0e10cSrcweir break; 679*cdf0e10cSrcweir 680*cdf0e10cSrcweir case FID_COL_OPT_WIDTH: 681*cdf0e10cSrcweir { 682*cdf0e10cSrcweir if ( pReqArgs ) 683*cdf0e10cSrcweir { 684*cdf0e10cSrcweir const SfxUInt16Item& rUInt16Item = (const SfxUInt16Item&)pReqArgs->Get( FID_COL_OPT_WIDTH ); 685*cdf0e10cSrcweir 686*cdf0e10cSrcweir // #101390#; the value of the macro is in HMM so use HMMToTwips to convert 687*cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_True, SC_SIZE_OPTIMAL, 688*cdf0e10cSrcweir sal::static_int_cast<sal_uInt16>( HMMToTwips(rUInt16Item.GetValue()) ) ); 689*cdf0e10cSrcweir ScGlobal::nLastColWidthExtra = rUInt16Item.GetValue(); 690*cdf0e10cSrcweir 691*cdf0e10cSrcweir if( ! rReq.IsAPI() ) 692*cdf0e10cSrcweir rReq.Done(); 693*cdf0e10cSrcweir } 694*cdf0e10cSrcweir else 695*cdf0e10cSrcweir { 696*cdf0e10cSrcweir FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); 697*cdf0e10cSrcweir 698*cdf0e10cSrcweir //CHINA001 ScMetricInputDlg* pDlg = 699*cdf0e10cSrcweir //CHINA001 new ScMetricInputDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_COL_OPT, 700*cdf0e10cSrcweir //CHINA001 ScGlobal::nLastColWidthExtra, 701*cdf0e10cSrcweir //CHINA001 STD_EXTRA_WIDTH, 702*cdf0e10cSrcweir //CHINA001 eMetric, 703*cdf0e10cSrcweir //CHINA001 1, 704*cdf0e10cSrcweir //CHINA001 MAX_EXTRA_WIDTH ); 705*cdf0e10cSrcweir 706*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 707*cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 708*cdf0e10cSrcweir 709*cdf0e10cSrcweir AbstractScMetricInputDlg* pDlg = pFact->CreateScMetricInputDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_COL_OPT, 710*cdf0e10cSrcweir ScGlobal::nLastColWidthExtra, 711*cdf0e10cSrcweir STD_EXTRA_WIDTH, 712*cdf0e10cSrcweir RID_SCDLG_COL_OPT, 713*cdf0e10cSrcweir eMetric, 714*cdf0e10cSrcweir 1, 715*cdf0e10cSrcweir MAX_EXTRA_WIDTH); 716*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 717*cdf0e10cSrcweir if ( pDlg->Execute() == RET_OK ) 718*cdf0e10cSrcweir { 719*cdf0e10cSrcweir long nVal = pDlg->GetInputValue(); 720*cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_True, SC_SIZE_OPTIMAL, (sal_uInt16)nVal ); 721*cdf0e10cSrcweir ScGlobal::nLastColWidthExtra = nVal; 722*cdf0e10cSrcweir 723*cdf0e10cSrcweir // #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert 724*cdf0e10cSrcweir rReq.AppendItem( SfxUInt16Item( FID_COL_OPT_WIDTH, (sal_uInt16)TwipsToEvenHMM(nVal) ) ); 725*cdf0e10cSrcweir rReq.Done(); 726*cdf0e10cSrcweir } 727*cdf0e10cSrcweir delete pDlg; 728*cdf0e10cSrcweir } 729*cdf0e10cSrcweir } 730*cdf0e10cSrcweir break; 731*cdf0e10cSrcweir 732*cdf0e10cSrcweir case FID_COL_OPT_DIRECT: 733*cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_True, SC_SIZE_OPTIMAL, STD_EXTRA_WIDTH ); 734*cdf0e10cSrcweir rReq.Done(); 735*cdf0e10cSrcweir break; 736*cdf0e10cSrcweir 737*cdf0e10cSrcweir case FID_ROW_HIDE: 738*cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_False, SC_SIZE_DIRECT, 0 ); 739*cdf0e10cSrcweir rReq.Done(); 740*cdf0e10cSrcweir break; 741*cdf0e10cSrcweir case FID_ROW_SHOW: 742*cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_False, SC_SIZE_SHOW, 0 ); 743*cdf0e10cSrcweir rReq.Done(); 744*cdf0e10cSrcweir break; 745*cdf0e10cSrcweir case FID_COL_HIDE: 746*cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_True, SC_SIZE_DIRECT, 0 ); 747*cdf0e10cSrcweir rReq.Done(); 748*cdf0e10cSrcweir break; 749*cdf0e10cSrcweir case FID_COL_SHOW: 750*cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_True, SC_SIZE_SHOW, 0 ); 751*cdf0e10cSrcweir rReq.Done(); 752*cdf0e10cSrcweir break; 753*cdf0e10cSrcweir 754*cdf0e10cSrcweir //---------------------------------------------------------------- 755*cdf0e10cSrcweir 756*cdf0e10cSrcweir 757*cdf0e10cSrcweir case SID_CELL_FORMAT_RESET: 758*cdf0e10cSrcweir { 759*cdf0e10cSrcweir pTabViewShell->DeleteContents( IDF_HARDATTR | IDF_EDITATTR ); 760*cdf0e10cSrcweir rReq.Done(); 761*cdf0e10cSrcweir } 762*cdf0e10cSrcweir break; 763*cdf0e10cSrcweir 764*cdf0e10cSrcweir case FID_MERGE_ON: 765*cdf0e10cSrcweir case FID_MERGE_OFF: 766*cdf0e10cSrcweir case FID_MERGE_TOGGLE: 767*cdf0e10cSrcweir { 768*cdf0e10cSrcweir if ( !GetViewData()->GetDocument()->GetChangeTrack() ) 769*cdf0e10cSrcweir { 770*cdf0e10cSrcweir // test whether to merge or to split 771*cdf0e10cSrcweir bool bMerge = false; 772*cdf0e10cSrcweir switch( nSlot ) 773*cdf0e10cSrcweir { 774*cdf0e10cSrcweir case FID_MERGE_ON: 775*cdf0e10cSrcweir bMerge = true; 776*cdf0e10cSrcweir break; 777*cdf0e10cSrcweir case FID_MERGE_OFF: 778*cdf0e10cSrcweir bMerge = false; 779*cdf0e10cSrcweir break; 780*cdf0e10cSrcweir case FID_MERGE_TOGGLE: 781*cdf0e10cSrcweir { 782*cdf0e10cSrcweir SfxPoolItem* pItem = 0; 783*cdf0e10cSrcweir if( rBindings.QueryState( nSlot, pItem ) >= SFX_ITEM_DEFAULT ) 784*cdf0e10cSrcweir bMerge = !static_cast< SfxBoolItem* >( pItem )->GetValue(); 785*cdf0e10cSrcweir } 786*cdf0e10cSrcweir break; 787*cdf0e10cSrcweir } 788*cdf0e10cSrcweir 789*cdf0e10cSrcweir if( bMerge ) 790*cdf0e10cSrcweir { 791*cdf0e10cSrcweir // merge - check if to move contents of covered cells 792*cdf0e10cSrcweir sal_Bool bMoveContents = sal_False; 793*cdf0e10cSrcweir sal_Bool bApi = rReq.IsAPI(); 794*cdf0e10cSrcweir const SfxPoolItem* pItem; 795*cdf0e10cSrcweir if ( pReqArgs && 796*cdf0e10cSrcweir pReqArgs->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET ) 797*cdf0e10cSrcweir { 798*cdf0e10cSrcweir DBG_ASSERT(pItem && pItem->ISA(SfxBoolItem), "falsches Item"); 799*cdf0e10cSrcweir bMoveContents = ((const SfxBoolItem*)pItem)->GetValue(); 800*cdf0e10cSrcweir } 801*cdf0e10cSrcweir 802*cdf0e10cSrcweir if (pTabViewShell->MergeCells( bApi, bMoveContents )) 803*cdf0e10cSrcweir { 804*cdf0e10cSrcweir if (!bApi && bMoveContents) // "ja" im Dialog geklickt 805*cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( nSlot, bMoveContents ) ); 806*cdf0e10cSrcweir rBindings.Invalidate( nSlot ); 807*cdf0e10cSrcweir rReq.Done(); 808*cdf0e10cSrcweir } 809*cdf0e10cSrcweir } 810*cdf0e10cSrcweir else 811*cdf0e10cSrcweir { 812*cdf0e10cSrcweir // split cells 813*cdf0e10cSrcweir if (pTabViewShell->RemoveMerge()) 814*cdf0e10cSrcweir { 815*cdf0e10cSrcweir rBindings.Invalidate( nSlot ); 816*cdf0e10cSrcweir rReq.Done(); 817*cdf0e10cSrcweir } 818*cdf0e10cSrcweir } 819*cdf0e10cSrcweir break; 820*cdf0e10cSrcweir } 821*cdf0e10cSrcweir } 822*cdf0e10cSrcweir break; 823*cdf0e10cSrcweir 824*cdf0e10cSrcweir case SID_AUTOFORMAT: 825*cdf0e10cSrcweir { 826*cdf0e10cSrcweir Window* pDlgParent = pTabViewShell->GetDialogParent(); 827*cdf0e10cSrcweir SCCOL nStartCol; 828*cdf0e10cSrcweir SCROW nStartRow; 829*cdf0e10cSrcweir SCTAB nStartTab; 830*cdf0e10cSrcweir SCCOL nEndCol; 831*cdf0e10cSrcweir SCROW nEndRow; 832*cdf0e10cSrcweir SCTAB nEndTab; 833*cdf0e10cSrcweir 834*cdf0e10cSrcweir const ScMarkData& rMark = GetViewData()->GetMarkData(); 835*cdf0e10cSrcweir if ( !rMark.IsMarked() && !rMark.IsMultiMarked() ) 836*cdf0e10cSrcweir pTabViewShell->MarkDataArea( sal_True ); 837*cdf0e10cSrcweir 838*cdf0e10cSrcweir GetViewData()->GetSimpleArea( nStartCol,nStartRow,nStartTab, 839*cdf0e10cSrcweir nEndCol,nEndRow,nEndTab ); 840*cdf0e10cSrcweir 841*cdf0e10cSrcweir if ( ( Abs((SCsCOL)nEndCol-(SCsCOL)nStartCol) > 1 ) 842*cdf0e10cSrcweir && ( Abs((SCsROW)nEndRow-(SCsROW)nStartRow) > 1 ) ) 843*cdf0e10cSrcweir { 844*cdf0e10cSrcweir if ( pReqArgs ) 845*cdf0e10cSrcweir { 846*cdf0e10cSrcweir const SfxStringItem& rNameItem = (const SfxStringItem&)pReqArgs->Get( SID_AUTOFORMAT ); 847*cdf0e10cSrcweir ScAutoFormat* pFormat = ScGlobal::GetAutoFormat(); 848*cdf0e10cSrcweir sal_uInt16 nIndex = pFormat->FindIndexPerName( rNameItem.GetValue() ); 849*cdf0e10cSrcweir 850*cdf0e10cSrcweir pTabViewShell->AutoFormat( nIndex ); 851*cdf0e10cSrcweir 852*cdf0e10cSrcweir if( ! rReq.IsAPI() ) 853*cdf0e10cSrcweir rReq.Done(); 854*cdf0e10cSrcweir } 855*cdf0e10cSrcweir else 856*cdf0e10cSrcweir { 857*cdf0e10cSrcweir ScGlobal::ClearAutoFormat(); 858*cdf0e10cSrcweir ScAutoFormatData* pNewEntry = pTabViewShell->CreateAutoFormatData(); 859*cdf0e10cSrcweir //CHINA001 ScAutoFormatDlg* pDlg = new ScAutoFormatDlg( 860*cdf0e10cSrcweir //CHINA001 pDlgParent, 861*cdf0e10cSrcweir //CHINA001 ScGlobal::GetAutoFormat(), 862*cdf0e10cSrcweir //CHINA001 pNewEntry, 863*cdf0e10cSrcweir //CHINA001 GetViewData()->GetDocument() ); 864*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 865*cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 866*cdf0e10cSrcweir 867*cdf0e10cSrcweir AbstractScAutoFormatDlg* pDlg = pFact->CreateScAutoFormatDlg( pDlgParent, ScGlobal::GetAutoFormat(), pNewEntry,GetViewData()->GetDocument(), RID_SCDLG_AUTOFORMAT ); 868*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 869*cdf0e10cSrcweir 870*cdf0e10cSrcweir if ( pDlg->Execute() == RET_OK ) 871*cdf0e10cSrcweir { 872*cdf0e10cSrcweir ScEditableTester aTester( pTabViewShell ); 873*cdf0e10cSrcweir if ( !aTester.IsEditable() ) 874*cdf0e10cSrcweir { 875*cdf0e10cSrcweir pTabViewShell->ErrorMessage(aTester.GetMessageId()); 876*cdf0e10cSrcweir } 877*cdf0e10cSrcweir else 878*cdf0e10cSrcweir { 879*cdf0e10cSrcweir pTabViewShell->AutoFormat( pDlg->GetIndex() ); 880*cdf0e10cSrcweir 881*cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( SID_AUTOFORMAT, pDlg->GetCurrFormatName() ) ); 882*cdf0e10cSrcweir rReq.Done(); 883*cdf0e10cSrcweir } 884*cdf0e10cSrcweir } 885*cdf0e10cSrcweir delete pDlg; 886*cdf0e10cSrcweir delete pNewEntry; 887*cdf0e10cSrcweir } 888*cdf0e10cSrcweir } 889*cdf0e10cSrcweir else 890*cdf0e10cSrcweir ErrorBox( pDlgParent, WinBits( WB_OK | WB_DEF_OK ), 891*cdf0e10cSrcweir ScGlobal::GetRscString(STR_INVALID_AFAREA) ).Execute(); 892*cdf0e10cSrcweir } 893*cdf0e10cSrcweir break; 894*cdf0e10cSrcweir 895*cdf0e10cSrcweir case SID_CANCEL: 896*cdf0e10cSrcweir { 897*cdf0e10cSrcweir if (GetViewData()->HasEditView(GetViewData()->GetActivePart())) 898*cdf0e10cSrcweir pScMod->InputCancelHandler(); 899*cdf0e10cSrcweir else if (pTabViewShell->HasPaintBrush()) 900*cdf0e10cSrcweir pTabViewShell->ResetBrushDocument(); // abort format paint brush 901*cdf0e10cSrcweir else if (pTabViewShell->HasHintWindow()) 902*cdf0e10cSrcweir pTabViewShell->RemoveHintWindow(); // Eingabemeldung abschalten 903*cdf0e10cSrcweir else if( ScViewUtil::IsFullScreen( *pTabViewShell ) ) 904*cdf0e10cSrcweir ScViewUtil::SetFullScreen( *pTabViewShell, false ); 905*cdf0e10cSrcweir else 906*cdf0e10cSrcweir { 907*cdf0e10cSrcweir // TODO/LATER: when is this code executed? 908*cdf0e10cSrcweir pTabViewShell->Escape(); 909*cdf0e10cSrcweir //SfxObjectShell* pObjSh = GetViewData()->GetSfxDocShell(); 910*cdf0e10cSrcweir //if (pObjSh->GetInPlaceObject() && 911*cdf0e10cSrcweir // pObjSh->GetInPlaceObject()->GetIPClient()) 912*cdf0e10cSrcweir //{ 913*cdf0e10cSrcweir // GetViewData()->GetDocShell()-> 914*cdf0e10cSrcweir // DoInPlaceActivate(sal_False); // OLE beenden 915*cdf0e10cSrcweir //} 916*cdf0e10cSrcweir } 917*cdf0e10cSrcweir 918*cdf0e10cSrcweir // SetSumAssignMode(); //ScInputWindow 919*cdf0e10cSrcweir } 920*cdf0e10cSrcweir break; 921*cdf0e10cSrcweir 922*cdf0e10cSrcweir case SID_DATA_SELECT: 923*cdf0e10cSrcweir pTabViewShell->StartDataSelect(); 924*cdf0e10cSrcweir break; 925*cdf0e10cSrcweir 926*cdf0e10cSrcweir case SID_DETECTIVE_FILLMODE: 927*cdf0e10cSrcweir { 928*cdf0e10cSrcweir sal_Bool bOldMode = pTabViewShell->IsAuditShell(); 929*cdf0e10cSrcweir pTabViewShell->SetAuditShell( !bOldMode ); 930*cdf0e10cSrcweir pTabViewShell->Invalidate( nSlot ); 931*cdf0e10cSrcweir } 932*cdf0e10cSrcweir break; 933*cdf0e10cSrcweir 934*cdf0e10cSrcweir case SID_OPENDLG_CONDFRMT: 935*cdf0e10cSrcweir { 936*cdf0e10cSrcweir sal_uInt16 nId = ScCondFormatDlgWrapper::GetChildWindowId(); 937*cdf0e10cSrcweir SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame(); 938*cdf0e10cSrcweir SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId ); 939*cdf0e10cSrcweir 940*cdf0e10cSrcweir pScMod->SetRefDialog( nId, pWnd ? sal_False : sal_True ); 941*cdf0e10cSrcweir } 942*cdf0e10cSrcweir break; 943*cdf0e10cSrcweir 944*cdf0e10cSrcweir // ---------------------------------------------------------------- 945*cdf0e10cSrcweir 946*cdf0e10cSrcweir case FID_INPUTLINE_STATUS: 947*cdf0e10cSrcweir DBG_ERROR("Execute von InputLine-Status"); 948*cdf0e10cSrcweir break; 949*cdf0e10cSrcweir 950*cdf0e10cSrcweir case SID_STATUS_DOCPOS: 951*cdf0e10cSrcweir // Launch navigator. 952*cdf0e10cSrcweir GetViewData()->GetDispatcher().Execute( 953*cdf0e10cSrcweir SID_NAVIGATOR, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD ); 954*cdf0e10cSrcweir break; 955*cdf0e10cSrcweir 956*cdf0e10cSrcweir case SID_MARKAREA: 957*cdf0e10cSrcweir // called from Basic at the hidden view to select a range in the visible view 958*cdf0e10cSrcweir DBG_ERROR("old slot SID_MARKAREA"); 959*cdf0e10cSrcweir break; 960*cdf0e10cSrcweir 961*cdf0e10cSrcweir default: 962*cdf0e10cSrcweir DBG_ERROR("Unbekannter Slot bei ScCellShell::Execute"); 963*cdf0e10cSrcweir break; 964*cdf0e10cSrcweir } 965*cdf0e10cSrcweir } 966*cdf0e10cSrcweir 967