1b3f79822SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3b3f79822SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4b3f79822SAndrew Rist * or more contributor license agreements. See the NOTICE file 5b3f79822SAndrew Rist * distributed with this work for additional information 6b3f79822SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7b3f79822SAndrew Rist * to you under the Apache License, Version 2.0 (the 8b3f79822SAndrew Rist * "License"); you may not use this file except in compliance 9b3f79822SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11b3f79822SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13b3f79822SAndrew Rist * Unless required by applicable law or agreed to in writing, 14b3f79822SAndrew Rist * software distributed under the License is distributed on an 15b3f79822SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16b3f79822SAndrew Rist * KIND, either express or implied. See the License for the 17b3f79822SAndrew Rist * specific language governing permissions and limitations 18b3f79822SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20b3f79822SAndrew Rist *************************************************************/ 21b3f79822SAndrew Rist 22b3f79822SAndrew 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 363*d9a8b508SZheng Fan case SID_CHAR_DLG_EFFECT: 364*d9a8b508SZheng Fan pTabViewShell->ExecuteCellFormatDlg( rReq, TP_FONTEFF ); 365*d9a8b508SZheng Fan break; 366*d9a8b508SZheng Fan 367cdf0e10cSrcweir case SID_OPENDLG_SOLVE: 368cdf0e10cSrcweir { 369cdf0e10cSrcweir sal_uInt16 nId = ScSolverDlgWrapper::GetChildWindowId(); 370cdf0e10cSrcweir SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame(); 371cdf0e10cSrcweir SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId ); 372cdf0e10cSrcweir 373cdf0e10cSrcweir pScMod->SetRefDialog( nId, pWnd ? sal_False : sal_True ); 374cdf0e10cSrcweir } 375cdf0e10cSrcweir break; 376cdf0e10cSrcweir 377cdf0e10cSrcweir case SID_OPENDLG_OPTSOLVER: 378cdf0e10cSrcweir { 379cdf0e10cSrcweir sal_uInt16 nId = ScOptSolverDlgWrapper::GetChildWindowId(); 380cdf0e10cSrcweir SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame(); 381cdf0e10cSrcweir SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId ); 382cdf0e10cSrcweir 383cdf0e10cSrcweir pScMod->SetRefDialog( nId, pWnd ? sal_False : sal_True ); 384cdf0e10cSrcweir } 385cdf0e10cSrcweir break; 386cdf0e10cSrcweir 387cdf0e10cSrcweir case SID_OPENDLG_TABOP: 388cdf0e10cSrcweir { 389cdf0e10cSrcweir sal_uInt16 nId = ScTabOpDlgWrapper::GetChildWindowId(); 390cdf0e10cSrcweir SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame(); 391cdf0e10cSrcweir SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId ); 392cdf0e10cSrcweir 393cdf0e10cSrcweir pScMod->SetRefDialog( nId, pWnd ? sal_False : sal_True ); 394cdf0e10cSrcweir } 395cdf0e10cSrcweir break; 396cdf0e10cSrcweir 397cdf0e10cSrcweir case SID_SCENARIOS: 398cdf0e10cSrcweir { 399cdf0e10cSrcweir ScDocument* pDoc = GetViewData()->GetDocument(); 400cdf0e10cSrcweir ScMarkData& rMark = GetViewData()->GetMarkData(); 401cdf0e10cSrcweir SCTAB nTab = GetViewData()->GetTabNo(); 402cdf0e10cSrcweir 403cdf0e10cSrcweir if ( pDoc->IsScenario(nTab) ) 404cdf0e10cSrcweir { 405cdf0e10cSrcweir rMark.MarkToMulti(); 406cdf0e10cSrcweir if ( rMark.IsMultiMarked() ) 407cdf0e10cSrcweir { 408cdf0e10cSrcweir if ( rReq.IsAPI() 409cdf0e10cSrcweir || RET_YES == 410cdf0e10cSrcweir QueryBox( pTabViewShell->GetDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), 411cdf0e10cSrcweir ScGlobal::GetRscString(STR_UPDATE_SCENARIO) ). 412cdf0e10cSrcweir Execute() ) 413cdf0e10cSrcweir { 414cdf0e10cSrcweir pTabViewShell->ExtendScenario(); 415cdf0e10cSrcweir rReq.Done(); 416cdf0e10cSrcweir } 417cdf0e10cSrcweir } 418cdf0e10cSrcweir else if( ! rReq.IsAPI() ) 419cdf0e10cSrcweir { 420cdf0e10cSrcweir ErrorBox aErrorBox( pTabViewShell->GetDialogParent(), WinBits(WB_OK | WB_DEF_OK), 421cdf0e10cSrcweir ScGlobal::GetRscString(STR_NOAREASELECTED) ); 422cdf0e10cSrcweir aErrorBox.Execute(); 423cdf0e10cSrcweir } 424cdf0e10cSrcweir } 425cdf0e10cSrcweir else 426cdf0e10cSrcweir { 427cdf0e10cSrcweir rMark.MarkToMulti(); 428cdf0e10cSrcweir if ( rMark.IsMultiMarked() ) 429cdf0e10cSrcweir { 430cdf0e10cSrcweir SCTAB i=1; 431cdf0e10cSrcweir String aBaseName; 432cdf0e10cSrcweir String aName; 433cdf0e10cSrcweir String aComment; 434cdf0e10cSrcweir Color aColor; 435cdf0e10cSrcweir sal_uInt16 nFlags; 436cdf0e10cSrcweir 437cdf0e10cSrcweir pDoc->GetName( nTab, aBaseName ); 438cdf0e10cSrcweir aBaseName += '_'; 439cdf0e10cSrcweir aBaseName += ScGlobal::GetRscString(STR_SCENARIO); 440cdf0e10cSrcweir aBaseName += '_'; 441cdf0e10cSrcweir 442cdf0e10cSrcweir // vorneweg testen, ob der Prefix als gueltig erkannt wird 443cdf0e10cSrcweir // wenn nicht, nur doppelte vermeiden 444cdf0e10cSrcweir sal_Bool bPrefix = pDoc->ValidTabName( aBaseName ); 445cdf0e10cSrcweir DBG_ASSERT(bPrefix, "ungueltiger Tabellenname"); 446cdf0e10cSrcweir 447cdf0e10cSrcweir while ( pDoc->IsScenario(nTab+i) ) 448cdf0e10cSrcweir i++; 449cdf0e10cSrcweir 450cdf0e10cSrcweir sal_Bool bValid; 451cdf0e10cSrcweir SCTAB nDummy; 452cdf0e10cSrcweir do 453cdf0e10cSrcweir { 454cdf0e10cSrcweir aName = aBaseName; 455cdf0e10cSrcweir aName += String::CreateFromInt32( i ); 456cdf0e10cSrcweir if (bPrefix) 457cdf0e10cSrcweir bValid = pDoc->ValidNewTabName( aName ); 458cdf0e10cSrcweir else 459cdf0e10cSrcweir bValid = !pDoc->GetTable( aName, nDummy ); 460cdf0e10cSrcweir ++i; 461cdf0e10cSrcweir } 462cdf0e10cSrcweir while ( !bValid && i <= 2*MAXTAB ); 463cdf0e10cSrcweir 464cdf0e10cSrcweir if ( pReqArgs != NULL ) 465cdf0e10cSrcweir { 466cdf0e10cSrcweir String aArgName; 467cdf0e10cSrcweir String aArgComment; 468cdf0e10cSrcweir const SfxPoolItem* pItem; 469cdf0e10cSrcweir if ( pReqArgs->GetItemState( SID_SCENARIOS, sal_True, &pItem ) == SFX_ITEM_SET ) 470cdf0e10cSrcweir aArgName = ((const SfxStringItem*)pItem)->GetValue(); 471cdf0e10cSrcweir if ( pReqArgs->GetItemState( SID_NEW_TABLENAME, sal_True, &pItem ) == SFX_ITEM_SET ) 472cdf0e10cSrcweir aArgComment = ((const SfxStringItem*)pItem)->GetValue(); 473cdf0e10cSrcweir 474cdf0e10cSrcweir aColor = Color( COL_LIGHTGRAY ); // Default 475cdf0e10cSrcweir nFlags = 0; // nicht-TwoWay 476cdf0e10cSrcweir 477cdf0e10cSrcweir pTabViewShell->MakeScenario( aArgName, aArgComment, aColor, nFlags ); 478cdf0e10cSrcweir if( ! rReq.IsAPI() ) 479cdf0e10cSrcweir rReq.Done(); 480cdf0e10cSrcweir } 481cdf0e10cSrcweir else 482cdf0e10cSrcweir { 483cdf0e10cSrcweir sal_Bool bSheetProtected = pDoc->IsTabProtected(nTab); 484cdf0e10cSrcweir //CHINA001 ScNewScenarioDlg* pNewDlg = 485cdf0e10cSrcweir //CHINA001 new ScNewScenarioDlg( pTabViewShell->GetDialogParent(), aName, sal_False, bSheetProtected ); 486cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 487cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 488cdf0e10cSrcweir 489cdf0e10cSrcweir AbstractScNewScenarioDlg* pNewDlg = pFact->CreateScNewScenarioDlg( pTabViewShell->GetDialogParent(), aName, RID_SCDLG_NEWSCENARIO, sal_False,bSheetProtected); 490cdf0e10cSrcweir DBG_ASSERT(pNewDlg, "Dialog create fail!");//CHINA001 491cdf0e10cSrcweir if ( pNewDlg->Execute() == RET_OK ) 492cdf0e10cSrcweir { 493cdf0e10cSrcweir pNewDlg->GetScenarioData( aName, aComment, aColor, nFlags ); 494cdf0e10cSrcweir pTabViewShell->MakeScenario( aName, aComment, aColor, nFlags ); 495cdf0e10cSrcweir 496cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( SID_SCENARIOS, aName ) ); 497cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( SID_NEW_TABLENAME, aComment ) ); 498cdf0e10cSrcweir rReq.Done(); 499cdf0e10cSrcweir } 500cdf0e10cSrcweir delete pNewDlg; 501cdf0e10cSrcweir } 502cdf0e10cSrcweir } 503cdf0e10cSrcweir else if( ! rReq.IsAPI() ) 504cdf0e10cSrcweir { 505cdf0e10cSrcweir pTabViewShell->ErrorMessage(STR_ERR_NEWSCENARIO); 506cdf0e10cSrcweir } 507cdf0e10cSrcweir } 508cdf0e10cSrcweir } 509cdf0e10cSrcweir break; 510cdf0e10cSrcweir 511cdf0e10cSrcweir 512cdf0e10cSrcweir case SID_SELECTALL: 513cdf0e10cSrcweir { 514cdf0e10cSrcweir pTabViewShell->SelectAll(); 515cdf0e10cSrcweir rReq.Done(); 516cdf0e10cSrcweir } 517cdf0e10cSrcweir break; 518cdf0e10cSrcweir 519cdf0e10cSrcweir //---------------------------------------------------------------- 520cdf0e10cSrcweir 521cdf0e10cSrcweir case FID_ROW_HEIGHT: 522cdf0e10cSrcweir { 523cdf0e10cSrcweir if ( pReqArgs ) 524cdf0e10cSrcweir { 525cdf0e10cSrcweir const SfxUInt16Item& rUInt16Item = (const SfxUInt16Item&)pReqArgs->Get( FID_ROW_HEIGHT ); 526cdf0e10cSrcweir 527cdf0e10cSrcweir // #101390#; the value of the macro is in HMM so use HMMToTwips to convert 528cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_False, SC_SIZE_DIRECT, 529cdf0e10cSrcweir sal::static_int_cast<sal_uInt16>( HMMToTwips(rUInt16Item.GetValue()) ) ); 530cdf0e10cSrcweir if( ! rReq.IsAPI() ) 531cdf0e10cSrcweir rReq.Done(); 532cdf0e10cSrcweir } 533cdf0e10cSrcweir else 534cdf0e10cSrcweir { 535cdf0e10cSrcweir ScViewData* pData = GetViewData(); 536cdf0e10cSrcweir FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); 537cdf0e10cSrcweir sal_uInt16 nCurHeight = pData->GetDocument()-> 538cdf0e10cSrcweir GetRowHeight( pData->GetCurY(), 539cdf0e10cSrcweir pData->GetTabNo() ); 540cdf0e10cSrcweir //CHINA001 ScMetricInputDlg* pDlg = 541cdf0e10cSrcweir //CHINA001 new ScMetricInputDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_ROW_MAN, 542cdf0e10cSrcweir //CHINA001 nCurHeight, 543cdf0e10cSrcweir //CHINA001 ScGlobal::nStdRowHeight, 544cdf0e10cSrcweir //CHINA001 eMetric, 545cdf0e10cSrcweir //CHINA001 2, 546cdf0e10cSrcweir //CHINA001 MAX_COL_HEIGHT ); 547cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 548cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 549cdf0e10cSrcweir 550cdf0e10cSrcweir AbstractScMetricInputDlg* pDlg = pFact->CreateScMetricInputDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_ROW_MAN, 551cdf0e10cSrcweir nCurHeight, 552cdf0e10cSrcweir ScGlobal::nStdRowHeight, 553cdf0e10cSrcweir RID_SCDLG_ROW_MAN, 554cdf0e10cSrcweir eMetric, 555cdf0e10cSrcweir 2, 556cdf0e10cSrcweir MAX_COL_HEIGHT); 557cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 558cdf0e10cSrcweir 559cdf0e10cSrcweir if ( pDlg->Execute() == RET_OK ) 560cdf0e10cSrcweir { 561cdf0e10cSrcweir long nVal = pDlg->GetInputValue(); 562cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_False, SC_SIZE_DIRECT, (sal_uInt16)nVal ); 563cdf0e10cSrcweir 564cdf0e10cSrcweir // #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert 565cdf0e10cSrcweir rReq.AppendItem( SfxUInt16Item( FID_ROW_HEIGHT, (sal_uInt16)TwipsToEvenHMM(nVal) ) ); 566cdf0e10cSrcweir rReq.Done(); 567cdf0e10cSrcweir 568cdf0e10cSrcweir } 569cdf0e10cSrcweir delete pDlg; 570cdf0e10cSrcweir } 571cdf0e10cSrcweir } 572cdf0e10cSrcweir break; 573cdf0e10cSrcweir 574cdf0e10cSrcweir case FID_ROW_OPT_HEIGHT: 575cdf0e10cSrcweir { 576cdf0e10cSrcweir if ( pReqArgs ) 577cdf0e10cSrcweir { 578cdf0e10cSrcweir const SfxUInt16Item& rUInt16Item = (const SfxUInt16Item&)pReqArgs->Get( FID_ROW_OPT_HEIGHT ); 579cdf0e10cSrcweir 580cdf0e10cSrcweir // #101390#; the value of the macro is in HMM so use HMMToTwips to convert 581cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_False, SC_SIZE_OPTIMAL, 582cdf0e10cSrcweir sal::static_int_cast<sal_uInt16>( HMMToTwips(rUInt16Item.GetValue()) ) ); 583cdf0e10cSrcweir ScGlobal::nLastRowHeightExtra = rUInt16Item.GetValue(); 584cdf0e10cSrcweir 585cdf0e10cSrcweir if( ! rReq.IsAPI() ) 586cdf0e10cSrcweir rReq.Done(); 587cdf0e10cSrcweir } 588cdf0e10cSrcweir else 589cdf0e10cSrcweir { 590cdf0e10cSrcweir FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); 591cdf0e10cSrcweir 592cdf0e10cSrcweir //CHINA001 ScMetricInputDlg* pDlg = 593cdf0e10cSrcweir //CHINA001 new ScMetricInputDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_ROW_OPT, 594cdf0e10cSrcweir //CHINA001 ScGlobal::nLastRowHeightExtra, 595cdf0e10cSrcweir //CHINA001 0, 596cdf0e10cSrcweir //CHINA001 eMetric, 597cdf0e10cSrcweir //CHINA001 1, 598cdf0e10cSrcweir //CHINA001 MAX_EXTRA_HEIGHT ); 599cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 600cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 601cdf0e10cSrcweir 602cdf0e10cSrcweir AbstractScMetricInputDlg* pDlg = pFact->CreateScMetricInputDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_ROW_OPT, 603cdf0e10cSrcweir ScGlobal::nLastRowHeightExtra, 604cdf0e10cSrcweir 0, 605cdf0e10cSrcweir RID_SCDLG_ROW_OPT, 606cdf0e10cSrcweir eMetric, 607cdf0e10cSrcweir 1, 608cdf0e10cSrcweir MAX_EXTRA_HEIGHT); 609cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 610cdf0e10cSrcweir 611cdf0e10cSrcweir if ( pDlg->Execute() == RET_OK ) 612cdf0e10cSrcweir { 613cdf0e10cSrcweir long nVal = pDlg->GetInputValue(); 614cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_False, SC_SIZE_OPTIMAL, (sal_uInt16)nVal ); 615cdf0e10cSrcweir ScGlobal::nLastRowHeightExtra = nVal; 616cdf0e10cSrcweir 617cdf0e10cSrcweir // #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert 618cdf0e10cSrcweir rReq.AppendItem( SfxUInt16Item( FID_ROW_OPT_HEIGHT, (sal_uInt16)TwipsToEvenHMM(nVal) ) ); 619cdf0e10cSrcweir rReq.Done(); 620cdf0e10cSrcweir 621cdf0e10cSrcweir } 622cdf0e10cSrcweir delete pDlg; 623cdf0e10cSrcweir } 624cdf0e10cSrcweir } 625cdf0e10cSrcweir break; 626cdf0e10cSrcweir 627cdf0e10cSrcweir case FID_COL_WIDTH: 628cdf0e10cSrcweir { 629cdf0e10cSrcweir if ( pReqArgs ) 630cdf0e10cSrcweir { 631cdf0e10cSrcweir const SfxUInt16Item& rUInt16Item = (const SfxUInt16Item&)pReqArgs->Get( FID_COL_WIDTH ); 632cdf0e10cSrcweir 633cdf0e10cSrcweir // #101390#; the value of the macro is in HMM so use HMMToTwips to convert 634cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_True, SC_SIZE_DIRECT, 635cdf0e10cSrcweir sal::static_int_cast<sal_uInt16>( HMMToTwips(rUInt16Item.GetValue()) ) ); 636cdf0e10cSrcweir if( ! rReq.IsAPI() ) 637cdf0e10cSrcweir rReq.Done(); 638cdf0e10cSrcweir } 639cdf0e10cSrcweir else 640cdf0e10cSrcweir { 641cdf0e10cSrcweir FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); 642cdf0e10cSrcweir ScViewData* pData = GetViewData(); 643cdf0e10cSrcweir sal_uInt16 nCurHeight = pData->GetDocument()-> 644cdf0e10cSrcweir GetColWidth( pData->GetCurX(), 645cdf0e10cSrcweir pData->GetTabNo() ); 646cdf0e10cSrcweir //CHINA001 ScMetricInputDlg* pDlg = 647cdf0e10cSrcweir //CHINA001 new ScMetricInputDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_COL_MAN, 648cdf0e10cSrcweir //CHINA001 nCurHeight, 649cdf0e10cSrcweir //CHINA001 STD_COL_WIDTH, 650cdf0e10cSrcweir //CHINA001 eMetric, 651cdf0e10cSrcweir //CHINA001 2, 652cdf0e10cSrcweir //CHINA001 MAX_COL_WIDTH ); 653cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 654cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 655cdf0e10cSrcweir 656cdf0e10cSrcweir AbstractScMetricInputDlg* pDlg = pFact->CreateScMetricInputDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_COL_MAN, 657cdf0e10cSrcweir nCurHeight, 658cdf0e10cSrcweir STD_COL_WIDTH, 659cdf0e10cSrcweir RID_SCDLG_COL_MAN, 660cdf0e10cSrcweir eMetric, 661cdf0e10cSrcweir 2, 662cdf0e10cSrcweir MAX_COL_WIDTH); 663cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 664cdf0e10cSrcweir 665cdf0e10cSrcweir if ( pDlg->Execute() == RET_OK ) 666cdf0e10cSrcweir { 667cdf0e10cSrcweir long nVal = pDlg->GetInputValue(); 668cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_True, SC_SIZE_DIRECT, (sal_uInt16)nVal ); 669cdf0e10cSrcweir 670cdf0e10cSrcweir // #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert 671cdf0e10cSrcweir rReq.AppendItem( SfxUInt16Item( FID_COL_WIDTH, (sal_uInt16)TwipsToEvenHMM(nVal)) ); 672cdf0e10cSrcweir rReq.Done(); 673cdf0e10cSrcweir 674cdf0e10cSrcweir } 675cdf0e10cSrcweir delete pDlg; 676cdf0e10cSrcweir } 677cdf0e10cSrcweir } 678cdf0e10cSrcweir break; 679cdf0e10cSrcweir 680cdf0e10cSrcweir case FID_COL_OPT_WIDTH: 681cdf0e10cSrcweir { 682cdf0e10cSrcweir if ( pReqArgs ) 683cdf0e10cSrcweir { 684cdf0e10cSrcweir const SfxUInt16Item& rUInt16Item = (const SfxUInt16Item&)pReqArgs->Get( FID_COL_OPT_WIDTH ); 685cdf0e10cSrcweir 686cdf0e10cSrcweir // #101390#; the value of the macro is in HMM so use HMMToTwips to convert 687cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_True, SC_SIZE_OPTIMAL, 688cdf0e10cSrcweir sal::static_int_cast<sal_uInt16>( HMMToTwips(rUInt16Item.GetValue()) ) ); 689cdf0e10cSrcweir ScGlobal::nLastColWidthExtra = rUInt16Item.GetValue(); 690cdf0e10cSrcweir 691cdf0e10cSrcweir if( ! rReq.IsAPI() ) 692cdf0e10cSrcweir rReq.Done(); 693cdf0e10cSrcweir } 694cdf0e10cSrcweir else 695cdf0e10cSrcweir { 696cdf0e10cSrcweir FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); 697cdf0e10cSrcweir 698cdf0e10cSrcweir //CHINA001 ScMetricInputDlg* pDlg = 699cdf0e10cSrcweir //CHINA001 new ScMetricInputDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_COL_OPT, 700cdf0e10cSrcweir //CHINA001 ScGlobal::nLastColWidthExtra, 701cdf0e10cSrcweir //CHINA001 STD_EXTRA_WIDTH, 702cdf0e10cSrcweir //CHINA001 eMetric, 703cdf0e10cSrcweir //CHINA001 1, 704cdf0e10cSrcweir //CHINA001 MAX_EXTRA_WIDTH ); 705cdf0e10cSrcweir 706cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 707cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 708cdf0e10cSrcweir 709cdf0e10cSrcweir AbstractScMetricInputDlg* pDlg = pFact->CreateScMetricInputDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_COL_OPT, 710cdf0e10cSrcweir ScGlobal::nLastColWidthExtra, 711cdf0e10cSrcweir STD_EXTRA_WIDTH, 712cdf0e10cSrcweir RID_SCDLG_COL_OPT, 713cdf0e10cSrcweir eMetric, 714cdf0e10cSrcweir 1, 715cdf0e10cSrcweir MAX_EXTRA_WIDTH); 716cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 717cdf0e10cSrcweir if ( pDlg->Execute() == RET_OK ) 718cdf0e10cSrcweir { 719cdf0e10cSrcweir long nVal = pDlg->GetInputValue(); 720cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_True, SC_SIZE_OPTIMAL, (sal_uInt16)nVal ); 721cdf0e10cSrcweir ScGlobal::nLastColWidthExtra = nVal; 722cdf0e10cSrcweir 723cdf0e10cSrcweir // #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert 724cdf0e10cSrcweir rReq.AppendItem( SfxUInt16Item( FID_COL_OPT_WIDTH, (sal_uInt16)TwipsToEvenHMM(nVal) ) ); 725cdf0e10cSrcweir rReq.Done(); 726cdf0e10cSrcweir } 727cdf0e10cSrcweir delete pDlg; 728cdf0e10cSrcweir } 729cdf0e10cSrcweir } 730cdf0e10cSrcweir break; 731cdf0e10cSrcweir 732cdf0e10cSrcweir case FID_COL_OPT_DIRECT: 733cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_True, SC_SIZE_OPTIMAL, STD_EXTRA_WIDTH ); 734cdf0e10cSrcweir rReq.Done(); 735cdf0e10cSrcweir break; 736cdf0e10cSrcweir 737cdf0e10cSrcweir case FID_ROW_HIDE: 738cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_False, SC_SIZE_DIRECT, 0 ); 739cdf0e10cSrcweir rReq.Done(); 740cdf0e10cSrcweir break; 741cdf0e10cSrcweir case FID_ROW_SHOW: 742cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_False, SC_SIZE_SHOW, 0 ); 743cdf0e10cSrcweir rReq.Done(); 744cdf0e10cSrcweir break; 745cdf0e10cSrcweir case FID_COL_HIDE: 746cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_True, SC_SIZE_DIRECT, 0 ); 747cdf0e10cSrcweir rReq.Done(); 748cdf0e10cSrcweir break; 749cdf0e10cSrcweir case FID_COL_SHOW: 750cdf0e10cSrcweir pTabViewShell->SetMarkedWidthOrHeight( sal_True, SC_SIZE_SHOW, 0 ); 751cdf0e10cSrcweir rReq.Done(); 752cdf0e10cSrcweir break; 753cdf0e10cSrcweir 754cdf0e10cSrcweir //---------------------------------------------------------------- 755cdf0e10cSrcweir 756cdf0e10cSrcweir 757cdf0e10cSrcweir case SID_CELL_FORMAT_RESET: 758cdf0e10cSrcweir { 759cdf0e10cSrcweir pTabViewShell->DeleteContents( IDF_HARDATTR | IDF_EDITATTR ); 760cdf0e10cSrcweir rReq.Done(); 761cdf0e10cSrcweir } 762cdf0e10cSrcweir break; 763cdf0e10cSrcweir 764cdf0e10cSrcweir case FID_MERGE_ON: 765cdf0e10cSrcweir case FID_MERGE_OFF: 766cdf0e10cSrcweir case FID_MERGE_TOGGLE: 767cdf0e10cSrcweir { 768cdf0e10cSrcweir if ( !GetViewData()->GetDocument()->GetChangeTrack() ) 769cdf0e10cSrcweir { 770cdf0e10cSrcweir // test whether to merge or to split 771cdf0e10cSrcweir bool bMerge = false; 772cdf0e10cSrcweir switch( nSlot ) 773cdf0e10cSrcweir { 774cdf0e10cSrcweir case FID_MERGE_ON: 775cdf0e10cSrcweir bMerge = true; 776cdf0e10cSrcweir break; 777cdf0e10cSrcweir case FID_MERGE_OFF: 778cdf0e10cSrcweir bMerge = false; 779cdf0e10cSrcweir break; 780cdf0e10cSrcweir case FID_MERGE_TOGGLE: 781cdf0e10cSrcweir { 782cdf0e10cSrcweir SfxPoolItem* pItem = 0; 783cdf0e10cSrcweir if( rBindings.QueryState( nSlot, pItem ) >= SFX_ITEM_DEFAULT ) 784cdf0e10cSrcweir bMerge = !static_cast< SfxBoolItem* >( pItem )->GetValue(); 785cdf0e10cSrcweir } 786cdf0e10cSrcweir break; 787cdf0e10cSrcweir } 788cdf0e10cSrcweir 789cdf0e10cSrcweir if( bMerge ) 790cdf0e10cSrcweir { 791cdf0e10cSrcweir // merge - check if to move contents of covered cells 792cdf0e10cSrcweir sal_Bool bMoveContents = sal_False; 793cdf0e10cSrcweir sal_Bool bApi = rReq.IsAPI(); 794cdf0e10cSrcweir const SfxPoolItem* pItem; 795cdf0e10cSrcweir if ( pReqArgs && 796cdf0e10cSrcweir pReqArgs->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET ) 797cdf0e10cSrcweir { 798cdf0e10cSrcweir DBG_ASSERT(pItem && pItem->ISA(SfxBoolItem), "falsches Item"); 799cdf0e10cSrcweir bMoveContents = ((const SfxBoolItem*)pItem)->GetValue(); 800cdf0e10cSrcweir } 801cdf0e10cSrcweir 802cdf0e10cSrcweir if (pTabViewShell->MergeCells( bApi, bMoveContents )) 803cdf0e10cSrcweir { 804cdf0e10cSrcweir if (!bApi && bMoveContents) // "ja" im Dialog geklickt 805cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( nSlot, bMoveContents ) ); 806cdf0e10cSrcweir rBindings.Invalidate( nSlot ); 807cdf0e10cSrcweir rReq.Done(); 808cdf0e10cSrcweir } 809cdf0e10cSrcweir } 810cdf0e10cSrcweir else 811cdf0e10cSrcweir { 812cdf0e10cSrcweir // split cells 813cdf0e10cSrcweir if (pTabViewShell->RemoveMerge()) 814cdf0e10cSrcweir { 815cdf0e10cSrcweir rBindings.Invalidate( nSlot ); 816cdf0e10cSrcweir rReq.Done(); 817cdf0e10cSrcweir } 818cdf0e10cSrcweir } 819cdf0e10cSrcweir break; 820cdf0e10cSrcweir } 821cdf0e10cSrcweir } 822cdf0e10cSrcweir break; 823cdf0e10cSrcweir 824cdf0e10cSrcweir case SID_AUTOFORMAT: 825cdf0e10cSrcweir { 826cdf0e10cSrcweir Window* pDlgParent = pTabViewShell->GetDialogParent(); 827cdf0e10cSrcweir SCCOL nStartCol; 828cdf0e10cSrcweir SCROW nStartRow; 829cdf0e10cSrcweir SCTAB nStartTab; 830cdf0e10cSrcweir SCCOL nEndCol; 831cdf0e10cSrcweir SCROW nEndRow; 832cdf0e10cSrcweir SCTAB nEndTab; 833cdf0e10cSrcweir 834cdf0e10cSrcweir const ScMarkData& rMark = GetViewData()->GetMarkData(); 835cdf0e10cSrcweir if ( !rMark.IsMarked() && !rMark.IsMultiMarked() ) 836cdf0e10cSrcweir pTabViewShell->MarkDataArea( sal_True ); 837cdf0e10cSrcweir 838cdf0e10cSrcweir GetViewData()->GetSimpleArea( nStartCol,nStartRow,nStartTab, 839cdf0e10cSrcweir nEndCol,nEndRow,nEndTab ); 840cdf0e10cSrcweir 841cdf0e10cSrcweir if ( ( Abs((SCsCOL)nEndCol-(SCsCOL)nStartCol) > 1 ) 842cdf0e10cSrcweir && ( Abs((SCsROW)nEndRow-(SCsROW)nStartRow) > 1 ) ) 843cdf0e10cSrcweir { 844cdf0e10cSrcweir if ( pReqArgs ) 845cdf0e10cSrcweir { 846cdf0e10cSrcweir const SfxStringItem& rNameItem = (const SfxStringItem&)pReqArgs->Get( SID_AUTOFORMAT ); 847cdf0e10cSrcweir ScAutoFormat* pFormat = ScGlobal::GetAutoFormat(); 848cdf0e10cSrcweir sal_uInt16 nIndex = pFormat->FindIndexPerName( rNameItem.GetValue() ); 849cdf0e10cSrcweir 850cdf0e10cSrcweir pTabViewShell->AutoFormat( nIndex ); 851cdf0e10cSrcweir 852cdf0e10cSrcweir if( ! rReq.IsAPI() ) 853cdf0e10cSrcweir rReq.Done(); 854cdf0e10cSrcweir } 855cdf0e10cSrcweir else 856cdf0e10cSrcweir { 857cdf0e10cSrcweir ScGlobal::ClearAutoFormat(); 858cdf0e10cSrcweir ScAutoFormatData* pNewEntry = pTabViewShell->CreateAutoFormatData(); 859cdf0e10cSrcweir //CHINA001 ScAutoFormatDlg* pDlg = new ScAutoFormatDlg( 860cdf0e10cSrcweir //CHINA001 pDlgParent, 861cdf0e10cSrcweir //CHINA001 ScGlobal::GetAutoFormat(), 862cdf0e10cSrcweir //CHINA001 pNewEntry, 863cdf0e10cSrcweir //CHINA001 GetViewData()->GetDocument() ); 864cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 865cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 866cdf0e10cSrcweir 867cdf0e10cSrcweir AbstractScAutoFormatDlg* pDlg = pFact->CreateScAutoFormatDlg( pDlgParent, ScGlobal::GetAutoFormat(), pNewEntry,GetViewData()->GetDocument(), RID_SCDLG_AUTOFORMAT ); 868cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 869cdf0e10cSrcweir 870cdf0e10cSrcweir if ( pDlg->Execute() == RET_OK ) 871cdf0e10cSrcweir { 872cdf0e10cSrcweir ScEditableTester aTester( pTabViewShell ); 873cdf0e10cSrcweir if ( !aTester.IsEditable() ) 874cdf0e10cSrcweir { 875cdf0e10cSrcweir pTabViewShell->ErrorMessage(aTester.GetMessageId()); 876cdf0e10cSrcweir } 877cdf0e10cSrcweir else 878cdf0e10cSrcweir { 879cdf0e10cSrcweir pTabViewShell->AutoFormat( pDlg->GetIndex() ); 880cdf0e10cSrcweir 881cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( SID_AUTOFORMAT, pDlg->GetCurrFormatName() ) ); 882cdf0e10cSrcweir rReq.Done(); 883cdf0e10cSrcweir } 884cdf0e10cSrcweir } 885cdf0e10cSrcweir delete pDlg; 886cdf0e10cSrcweir delete pNewEntry; 887cdf0e10cSrcweir } 888cdf0e10cSrcweir } 889cdf0e10cSrcweir else 890cdf0e10cSrcweir ErrorBox( pDlgParent, WinBits( WB_OK | WB_DEF_OK ), 891cdf0e10cSrcweir ScGlobal::GetRscString(STR_INVALID_AFAREA) ).Execute(); 892cdf0e10cSrcweir } 893cdf0e10cSrcweir break; 894cdf0e10cSrcweir 895cdf0e10cSrcweir case SID_CANCEL: 896cdf0e10cSrcweir { 897cdf0e10cSrcweir if (GetViewData()->HasEditView(GetViewData()->GetActivePart())) 898cdf0e10cSrcweir pScMod->InputCancelHandler(); 899cdf0e10cSrcweir else if (pTabViewShell->HasPaintBrush()) 900cdf0e10cSrcweir pTabViewShell->ResetBrushDocument(); // abort format paint brush 901cdf0e10cSrcweir else if (pTabViewShell->HasHintWindow()) 902cdf0e10cSrcweir pTabViewShell->RemoveHintWindow(); // Eingabemeldung abschalten 903cdf0e10cSrcweir else if( ScViewUtil::IsFullScreen( *pTabViewShell ) ) 904cdf0e10cSrcweir ScViewUtil::SetFullScreen( *pTabViewShell, false ); 905cdf0e10cSrcweir else 906cdf0e10cSrcweir { 907cdf0e10cSrcweir // TODO/LATER: when is this code executed? 908cdf0e10cSrcweir pTabViewShell->Escape(); 909cdf0e10cSrcweir //SfxObjectShell* pObjSh = GetViewData()->GetSfxDocShell(); 910cdf0e10cSrcweir //if (pObjSh->GetInPlaceObject() && 911cdf0e10cSrcweir // pObjSh->GetInPlaceObject()->GetIPClient()) 912cdf0e10cSrcweir //{ 913cdf0e10cSrcweir // GetViewData()->GetDocShell()-> 914cdf0e10cSrcweir // DoInPlaceActivate(sal_False); // OLE beenden 915cdf0e10cSrcweir //} 916cdf0e10cSrcweir } 917cdf0e10cSrcweir 918cdf0e10cSrcweir // SetSumAssignMode(); //ScInputWindow 919cdf0e10cSrcweir } 920cdf0e10cSrcweir break; 921cdf0e10cSrcweir 922cdf0e10cSrcweir case SID_DATA_SELECT: 923cdf0e10cSrcweir pTabViewShell->StartDataSelect(); 924cdf0e10cSrcweir break; 925cdf0e10cSrcweir 926cdf0e10cSrcweir case SID_DETECTIVE_FILLMODE: 927cdf0e10cSrcweir { 928cdf0e10cSrcweir sal_Bool bOldMode = pTabViewShell->IsAuditShell(); 929cdf0e10cSrcweir pTabViewShell->SetAuditShell( !bOldMode ); 930cdf0e10cSrcweir pTabViewShell->Invalidate( nSlot ); 931cdf0e10cSrcweir } 932cdf0e10cSrcweir break; 933cdf0e10cSrcweir 934cdf0e10cSrcweir case SID_OPENDLG_CONDFRMT: 935cdf0e10cSrcweir { 936cdf0e10cSrcweir sal_uInt16 nId = ScCondFormatDlgWrapper::GetChildWindowId(); 937cdf0e10cSrcweir SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame(); 938cdf0e10cSrcweir SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId ); 939cdf0e10cSrcweir 940cdf0e10cSrcweir pScMod->SetRefDialog( nId, pWnd ? sal_False : sal_True ); 941cdf0e10cSrcweir } 942cdf0e10cSrcweir break; 943cdf0e10cSrcweir 944cdf0e10cSrcweir // ---------------------------------------------------------------- 945cdf0e10cSrcweir 946cdf0e10cSrcweir case FID_INPUTLINE_STATUS: 947cdf0e10cSrcweir DBG_ERROR("Execute von InputLine-Status"); 948cdf0e10cSrcweir break; 949cdf0e10cSrcweir 950cdf0e10cSrcweir case SID_STATUS_DOCPOS: 951cdf0e10cSrcweir // Launch navigator. 952cdf0e10cSrcweir GetViewData()->GetDispatcher().Execute( 953cdf0e10cSrcweir SID_NAVIGATOR, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD ); 954cdf0e10cSrcweir break; 955cdf0e10cSrcweir 956cdf0e10cSrcweir case SID_MARKAREA: 957cdf0e10cSrcweir // called from Basic at the hidden view to select a range in the visible view 958cdf0e10cSrcweir DBG_ERROR("old slot SID_MARKAREA"); 959cdf0e10cSrcweir break; 960cdf0e10cSrcweir 961cdf0e10cSrcweir default: 962cdf0e10cSrcweir DBG_ERROR("Unbekannter Slot bei ScCellShell::Execute"); 963cdf0e10cSrcweir break; 964cdf0e10cSrcweir } 965cdf0e10cSrcweir } 966cdf0e10cSrcweir 967