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