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