1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sc.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir //------------------------------------------------------------------ 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir //svdraw.hxx 35*cdf0e10cSrcweir #define _SDR_NOITEMS 36*cdf0e10cSrcweir #define _SDR_NOTOUCH 37*cdf0e10cSrcweir #define _SDR_NOTRANSFORM 38*cdf0e10cSrcweir #define _SI_NOSBXCONTROLS 39*cdf0e10cSrcweir #define _VCONT_HXX 40*cdf0e10cSrcweir #define _SI_NOOTHERFORMS 41*cdf0e10cSrcweir #define _VCTRLS_HXX 42*cdf0e10cSrcweir #define _SI_NOCONTROL 43*cdf0e10cSrcweir #define _SETBRW_HXX 44*cdf0e10cSrcweir #define _VCBRW_HXX 45*cdf0e10cSrcweir #define _SI_NOSBXCONTROLS 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir //------------------------------------------------------------------ 48*cdf0e10cSrcweir #include <com/sun/star/i18n/TextConversionOption.hpp> 49*cdf0e10cSrcweir #include <com/sun/star/sheet/DataPilotFieldFilter.hpp> 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir #include "scitems.hxx" 52*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir #define _ZFORLIST_DECLARE_TABLE 55*cdf0e10cSrcweir #include <svl/stritem.hxx> 56*cdf0e10cSrcweir #include <svl/whiter.hxx> 57*cdf0e10cSrcweir #include <svl/zforlist.hxx> 58*cdf0e10cSrcweir #include <svl/zformat.hxx> 59*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 60*cdf0e10cSrcweir #include <sfx2/request.hxx> 61*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 62*cdf0e10cSrcweir #include <svx/svxdlg.hxx> 63*cdf0e10cSrcweir #include <sot/formats.hxx> 64*cdf0e10cSrcweir #include <svx/postattr.hxx> 65*cdf0e10cSrcweir #include <editeng/fontitem.hxx> 66*cdf0e10cSrcweir #include <svx/clipfmtitem.hxx> 67*cdf0e10cSrcweir #include <sfx2/passwd.hxx> 68*cdf0e10cSrcweir #include <svx/hlnkitem.hxx> 69*cdf0e10cSrcweir #include <basic/sbxcore.hxx> 70*cdf0e10cSrcweir #include <unotools/useroptions.hxx> 71*cdf0e10cSrcweir #include <vcl/waitobj.hxx> 72*cdf0e10cSrcweir #include <unotools/localedatawrapper.hxx> 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir #include "cellsh.hxx" 75*cdf0e10cSrcweir #include "sc.hrc" 76*cdf0e10cSrcweir #include "document.hxx" 77*cdf0e10cSrcweir #include "patattr.hxx" 78*cdf0e10cSrcweir #include "scmod.hxx" 79*cdf0e10cSrcweir #include "scresid.hxx" 80*cdf0e10cSrcweir #include "tabvwsh.hxx" 81*cdf0e10cSrcweir //CHINA001 #include "inscldlg.hxx" 82*cdf0e10cSrcweir //CHINA001 #include "inscodlg.hxx" 83*cdf0e10cSrcweir //CHINA001 #include "delcldlg.hxx" 84*cdf0e10cSrcweir //CHINA001 #include "delcodlg.hxx" 85*cdf0e10cSrcweir //CHINA001 #include "filldlg.hxx" 86*cdf0e10cSrcweir //CHINA001 #include "groupdlg.hxx" 87*cdf0e10cSrcweir #include "impex.hxx" 88*cdf0e10cSrcweir #include "reffind.hxx" 89*cdf0e10cSrcweir //CHINA001 #include "namecrea.hxx" 90*cdf0e10cSrcweir #include "uiitems.hxx" 91*cdf0e10cSrcweir #include "reffact.hxx" 92*cdf0e10cSrcweir //CHINA001 #include "namepast.hxx" 93*cdf0e10cSrcweir #include "inputhdl.hxx" 94*cdf0e10cSrcweir #include "transobj.hxx" 95*cdf0e10cSrcweir #include "drwtrans.hxx" 96*cdf0e10cSrcweir //CHINA001 #include "linkarea.hxx" 97*cdf0e10cSrcweir #include "docfunc.hxx" 98*cdf0e10cSrcweir #include "editable.hxx" 99*cdf0e10cSrcweir #include "dpobject.hxx" 100*cdf0e10cSrcweir #include "dpsave.hxx" 101*cdf0e10cSrcweir #include "dpgroup.hxx" // for ScDPNumGroupInfo 102*cdf0e10cSrcweir #include "spellparam.hxx" 103*cdf0e10cSrcweir #include "postit.hxx" 104*cdf0e10cSrcweir #include "clipparam.hxx" 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir #include "globstr.hrc" 107*cdf0e10cSrcweir #include "scui_def.hxx" //CHINA001 108*cdf0e10cSrcweir #include <svx/svxdlg.hxx> //CHINA001 109*cdf0e10cSrcweir #include <svx/dialogs.hrc> //CHINA001 110*cdf0e10cSrcweir #include "scabstdlg.hxx" //CHINA001 111*cdf0e10cSrcweir #define IS_AVAILABLE(WhichId,ppItem) \ 112*cdf0e10cSrcweir (pReqArgs->GetItemState((WhichId), sal_True, ppItem ) == SFX_ITEM_SET) 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir #define C2U(cChar) rtl::OUString::createFromAscii(cChar) 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> 117*cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 118*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 119*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 120*cdf0e10cSrcweir #include <cppuhelper/bootstrap.hxx> 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir using namespace ::com::sun::star; 123*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 124*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir //------------------------------------------------------------------ 127*cdf0e10cSrcweir void ScCellShell::ExecuteEdit( SfxRequest& rReq ) 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir ScModule* pScMod = SC_MOD(); 130*cdf0e10cSrcweir ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); 131*cdf0e10cSrcweir SfxBindings& rBindings = pTabViewShell->GetViewFrame()->GetBindings(); 132*cdf0e10cSrcweir const SfxItemSet* pReqArgs = rReq.GetArgs(); 133*cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir // Eingabe beenden 138*cdf0e10cSrcweir if ( GetViewData()->HasEditView( GetViewData()->GetActivePart() ) ) 139*cdf0e10cSrcweir { 140*cdf0e10cSrcweir switch ( nSlot ) 141*cdf0e10cSrcweir { 142*cdf0e10cSrcweir case FID_DEFINE_NAME: 143*cdf0e10cSrcweir case FID_USE_NAME: 144*cdf0e10cSrcweir case FID_INSERT_NAME: 145*cdf0e10cSrcweir case SID_SPELL_DIALOG: 146*cdf0e10cSrcweir case SID_HANGUL_HANJA_CONVERSION: 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir pScMod->InputEnterHandler(); 149*cdf0e10cSrcweir pTabViewShell->UpdateInputHandler(); 150*cdf0e10cSrcweir break; 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir default: 153*cdf0e10cSrcweir break; 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir switch ( nSlot ) 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir // 160*cdf0e10cSrcweir // Einfuegen / Loeschen von Zellen / Zeilen / Spalten 161*cdf0e10cSrcweir // 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir case FID_INS_ROW: 164*cdf0e10cSrcweir pTabViewShell->InsertCells(INS_INSROWS); 165*cdf0e10cSrcweir rReq.Done(); 166*cdf0e10cSrcweir break; 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir case FID_INS_COLUMN: 169*cdf0e10cSrcweir pTabViewShell->InsertCells(INS_INSCOLS); 170*cdf0e10cSrcweir rReq.Done(); 171*cdf0e10cSrcweir break; 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir case FID_INS_CELLSDOWN: 174*cdf0e10cSrcweir pTabViewShell->InsertCells(INS_CELLSDOWN); 175*cdf0e10cSrcweir rReq.Done(); 176*cdf0e10cSrcweir break; 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir case FID_INS_CELLSRIGHT: 179*cdf0e10cSrcweir pTabViewShell->InsertCells(INS_CELLSRIGHT); 180*cdf0e10cSrcweir rReq.Done(); 181*cdf0e10cSrcweir break; 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir case SID_DEL_ROWS: 184*cdf0e10cSrcweir pTabViewShell->DeleteCells( DEL_DELROWS ); 185*cdf0e10cSrcweir rReq.Done(); 186*cdf0e10cSrcweir break; 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir case SID_DEL_COLS: 189*cdf0e10cSrcweir pTabViewShell->DeleteCells( DEL_DELCOLS ); 190*cdf0e10cSrcweir rReq.Done(); 191*cdf0e10cSrcweir break; 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir case FID_INS_CELL: 194*cdf0e10cSrcweir { 195*cdf0e10cSrcweir InsCellCmd eCmd=INS_NONE; 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir if ( pReqArgs ) 198*cdf0e10cSrcweir { 199*cdf0e10cSrcweir const SfxPoolItem* pItem; 200*cdf0e10cSrcweir String aFlags; 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir if( IS_AVAILABLE( FID_INS_CELL, &pItem ) ) 203*cdf0e10cSrcweir aFlags = ((const SfxStringItem*)pItem)->GetValue(); 204*cdf0e10cSrcweir if( aFlags.Len() ) 205*cdf0e10cSrcweir { 206*cdf0e10cSrcweir switch( aFlags.GetChar(0) ) 207*cdf0e10cSrcweir { 208*cdf0e10cSrcweir case 'V': eCmd = INS_CELLSDOWN ;break; 209*cdf0e10cSrcweir case '>': eCmd = INS_CELLSRIGHT ;break; 210*cdf0e10cSrcweir case 'R': eCmd = INS_INSROWS ;break; 211*cdf0e10cSrcweir case 'C': eCmd = INS_INSCOLS ;break; 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir } 214*cdf0e10cSrcweir } 215*cdf0e10cSrcweir else 216*cdf0e10cSrcweir { 217*cdf0e10cSrcweir if ( GetViewData()->SimpleColMarked() ) 218*cdf0e10cSrcweir eCmd = INS_INSCOLS; 219*cdf0e10cSrcweir else if ( GetViewData()->SimpleRowMarked() ) 220*cdf0e10cSrcweir eCmd = INS_INSROWS; 221*cdf0e10cSrcweir else 222*cdf0e10cSrcweir { 223*cdf0e10cSrcweir ScDocument* pDoc = GetViewData()->GetDocument(); 224*cdf0e10cSrcweir sal_Bool bTheFlag=(pDoc->GetChangeTrack()!=NULL); 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir //CHINA001 ScInsertCellDlg* pDlg = new ScInsertCellDlg( pTabViewShell->GetDialogParent(), 227*cdf0e10cSrcweir //CHINA001 bTheFlag); 228*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 229*cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir AbstractScInsertCellDlg* pDlg = pFact->CreateScInsertCellDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_INSCELL, bTheFlag); 232*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 233*cdf0e10cSrcweir if (pDlg->Execute() == RET_OK) 234*cdf0e10cSrcweir eCmd = pDlg->GetInsCellCmd(); 235*cdf0e10cSrcweir delete pDlg; 236*cdf0e10cSrcweir } 237*cdf0e10cSrcweir } 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir if (eCmd!=INS_NONE) 240*cdf0e10cSrcweir { 241*cdf0e10cSrcweir pTabViewShell->InsertCells( eCmd ); 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir if( ! rReq.IsAPI() ) 244*cdf0e10cSrcweir { 245*cdf0e10cSrcweir String aParam; 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir switch( eCmd ) 248*cdf0e10cSrcweir { 249*cdf0e10cSrcweir case INS_CELLSDOWN: aParam='V'; break; 250*cdf0e10cSrcweir case INS_CELLSRIGHT: aParam='>'; break; 251*cdf0e10cSrcweir case INS_INSROWS: aParam='R'; break; 252*cdf0e10cSrcweir case INS_INSCOLS: aParam='C'; break; 253*cdf0e10cSrcweir default: 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir // added to avoid warnings 256*cdf0e10cSrcweir } 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( FID_INS_CELL, aParam ) ); 259*cdf0e10cSrcweir rReq.Done(); 260*cdf0e10cSrcweir } 261*cdf0e10cSrcweir } 262*cdf0e10cSrcweir } 263*cdf0e10cSrcweir break; 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir case FID_DELETE_CELL: 266*cdf0e10cSrcweir { 267*cdf0e10cSrcweir DelCellCmd eCmd = DEL_NONE; 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir if ( pReqArgs ) 270*cdf0e10cSrcweir { 271*cdf0e10cSrcweir const SfxPoolItem* pItem; 272*cdf0e10cSrcweir String aFlags; 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir if( IS_AVAILABLE( FID_DELETE_CELL, &pItem ) ) 275*cdf0e10cSrcweir aFlags = ((const SfxStringItem*)pItem)->GetValue(); 276*cdf0e10cSrcweir if( aFlags.Len() ) 277*cdf0e10cSrcweir { 278*cdf0e10cSrcweir switch( aFlags.GetChar(0) ) 279*cdf0e10cSrcweir { 280*cdf0e10cSrcweir case 'U': eCmd = DEL_CELLSUP ;break; 281*cdf0e10cSrcweir case 'L': eCmd = DEL_CELLSLEFT ;break; 282*cdf0e10cSrcweir case 'R': eCmd = DEL_DELROWS ;break; 283*cdf0e10cSrcweir case 'C': eCmd = DEL_DELCOLS ;break; 284*cdf0e10cSrcweir } 285*cdf0e10cSrcweir } 286*cdf0e10cSrcweir } 287*cdf0e10cSrcweir else 288*cdf0e10cSrcweir { 289*cdf0e10cSrcweir if ( GetViewData()->SimpleColMarked() ) 290*cdf0e10cSrcweir eCmd = DEL_DELCOLS; 291*cdf0e10cSrcweir else if ( GetViewData()->SimpleRowMarked() ) 292*cdf0e10cSrcweir eCmd = DEL_DELROWS; 293*cdf0e10cSrcweir else 294*cdf0e10cSrcweir { 295*cdf0e10cSrcweir ScRange aRange; 296*cdf0e10cSrcweir ScDocument* pDoc = GetViewData()->GetDocument(); 297*cdf0e10cSrcweir sal_Bool bTheFlag=GetViewData()->IsMultiMarked() || 298*cdf0e10cSrcweir (GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE_FILTERED) || 299*cdf0e10cSrcweir (pDoc->GetChangeTrack() != NULL); 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir //CHINA001 ScDeleteCellDlg* pDlg = new ScDeleteCellDlg( 302*cdf0e10cSrcweir //CHINA001 pTabViewShell->GetDialogParent(),bTheFlag); 303*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 304*cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir AbstractScDeleteCellDlg* pDlg = pFact->CreateScDeleteCellDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_DELCELL, bTheFlag ); 307*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir if (pDlg->Execute() == RET_OK) 310*cdf0e10cSrcweir eCmd = pDlg->GetDelCellCmd(); 311*cdf0e10cSrcweir delete pDlg; 312*cdf0e10cSrcweir } 313*cdf0e10cSrcweir } 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir if (eCmd != DEL_NONE ) 316*cdf0e10cSrcweir { 317*cdf0e10cSrcweir pTabViewShell->DeleteCells( eCmd ); 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir if( ! rReq.IsAPI() ) 320*cdf0e10cSrcweir { 321*cdf0e10cSrcweir String aParam; 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir switch( eCmd ) 324*cdf0e10cSrcweir { 325*cdf0e10cSrcweir case DEL_CELLSUP: aParam='U'; break; 326*cdf0e10cSrcweir case DEL_CELLSLEFT: aParam='L'; break; 327*cdf0e10cSrcweir case DEL_DELROWS: aParam='R'; break; 328*cdf0e10cSrcweir case DEL_DELCOLS: aParam='C'; break; 329*cdf0e10cSrcweir default: 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir // added to avoid warnings 332*cdf0e10cSrcweir } 333*cdf0e10cSrcweir } 334*cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( FID_DELETE_CELL, aParam ) ); 335*cdf0e10cSrcweir rReq.Done(); 336*cdf0e10cSrcweir } 337*cdf0e10cSrcweir } 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir break; 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir // 342*cdf0e10cSrcweir // Inhalte von Zellen loeschen 343*cdf0e10cSrcweir // 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir case SID_DELETE_CONTENTS: 346*cdf0e10cSrcweir pTabViewShell->DeleteContents( IDF_CONTENTS ); 347*cdf0e10cSrcweir rReq.Done(); 348*cdf0e10cSrcweir break; 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir case SID_DELETE: 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir sal_uInt16 nFlags = IDF_NONE; 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir if ( pReqArgs!=NULL && pTabViewShell->SelectionEditable() ) 355*cdf0e10cSrcweir { 356*cdf0e10cSrcweir const SfxPoolItem* pItem; 357*cdf0e10cSrcweir String aFlags = 'A'; 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir if( IS_AVAILABLE( SID_DELETE, &pItem ) ) 360*cdf0e10cSrcweir aFlags = ((const SfxStringItem*)pItem)->GetValue(); 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir aFlags.ToUpperAscii(); 363*cdf0e10cSrcweir sal_Bool bCont = sal_True; 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir for( xub_StrLen i=0 ; bCont && i<aFlags.Len() ; i++ ) 366*cdf0e10cSrcweir { 367*cdf0e10cSrcweir switch( aFlags.GetChar(i) ) 368*cdf0e10cSrcweir { 369*cdf0e10cSrcweir case 'A': // Alle 370*cdf0e10cSrcweir nFlags |= IDF_ALL; 371*cdf0e10cSrcweir bCont = sal_False; // nicht mehr weitermachen! 372*cdf0e10cSrcweir break; 373*cdf0e10cSrcweir case 'S': nFlags |= IDF_STRING; break; 374*cdf0e10cSrcweir case 'V': nFlags |= IDF_VALUE; break; 375*cdf0e10cSrcweir case 'D': nFlags |= IDF_DATETIME; break; 376*cdf0e10cSrcweir case 'F': nFlags |= IDF_FORMULA; break; 377*cdf0e10cSrcweir case 'N': nFlags |= IDF_NOTE; break; 378*cdf0e10cSrcweir case 'T': nFlags |= IDF_ATTRIB; break; 379*cdf0e10cSrcweir case 'O': nFlags |= IDF_OBJECTS; break; 380*cdf0e10cSrcweir } 381*cdf0e10cSrcweir } 382*cdf0e10cSrcweir } 383*cdf0e10cSrcweir else 384*cdf0e10cSrcweir { 385*cdf0e10cSrcweir ScEditableTester aTester( pTabViewShell ); 386*cdf0e10cSrcweir if (aTester.IsEditable()) 387*cdf0e10cSrcweir { 388*cdf0e10cSrcweir //CHINA001 ScDeleteContentsDlg* pDlg = new ScDeleteContentsDlg( pTabViewShell->GetDialogParent() ); 389*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 390*cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir AbstractScDeleteContentsDlg* pDlg = pFact->CreateScDeleteContentsDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_DELCONT ); 393*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 394*cdf0e10cSrcweir ScDocument* pDoc = GetViewData()->GetDocument(); 395*cdf0e10cSrcweir SCTAB nTab = GetViewData()->GetTabNo(); 396*cdf0e10cSrcweir if ( pDoc->IsTabProtected(nTab) ) 397*cdf0e10cSrcweir pDlg->DisableObjects(); 398*cdf0e10cSrcweir if (pDlg->Execute() == RET_OK) 399*cdf0e10cSrcweir { 400*cdf0e10cSrcweir nFlags = pDlg->GetDelContentsCmdBits(); 401*cdf0e10cSrcweir } 402*cdf0e10cSrcweir delete pDlg; 403*cdf0e10cSrcweir } 404*cdf0e10cSrcweir else 405*cdf0e10cSrcweir pTabViewShell->ErrorMessage(aTester.GetMessageId()); 406*cdf0e10cSrcweir } 407*cdf0e10cSrcweir 408*cdf0e10cSrcweir if( nFlags != IDF_NONE ) 409*cdf0e10cSrcweir { 410*cdf0e10cSrcweir pTabViewShell->DeleteContents( nFlags ); 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir if( ! rReq.IsAPI() ) 413*cdf0e10cSrcweir { 414*cdf0e10cSrcweir String aFlags; 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir if( nFlags == IDF_ALL ) 417*cdf0e10cSrcweir { 418*cdf0e10cSrcweir aFlags += 'A'; 419*cdf0e10cSrcweir } 420*cdf0e10cSrcweir else 421*cdf0e10cSrcweir { 422*cdf0e10cSrcweir if( nFlags & IDF_STRING ) aFlags += 'S'; 423*cdf0e10cSrcweir if( nFlags & IDF_VALUE ) aFlags += 'V'; 424*cdf0e10cSrcweir if( nFlags & IDF_DATETIME ) aFlags += 'D'; 425*cdf0e10cSrcweir if( nFlags & IDF_FORMULA ) aFlags += 'F'; 426*cdf0e10cSrcweir if( nFlags & IDF_NOTE ) aFlags += 'N'; 427*cdf0e10cSrcweir if( nFlags & IDF_ATTRIB ) aFlags += 'T'; 428*cdf0e10cSrcweir if( nFlags & IDF_OBJECTS ) aFlags += 'O'; 429*cdf0e10cSrcweir } 430*cdf0e10cSrcweir 431*cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( SID_DELETE, aFlags ) ); 432*cdf0e10cSrcweir rReq.Done(); 433*cdf0e10cSrcweir } 434*cdf0e10cSrcweir } 435*cdf0e10cSrcweir } 436*cdf0e10cSrcweir break; 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir // 439*cdf0e10cSrcweir // Ausfuellen... 440*cdf0e10cSrcweir // 441*cdf0e10cSrcweir 442*cdf0e10cSrcweir case FID_FILL_TO_BOTTOM: 443*cdf0e10cSrcweir pTabViewShell->FillSimple( FILL_TO_BOTTOM ); 444*cdf0e10cSrcweir rReq.Done(); 445*cdf0e10cSrcweir break; 446*cdf0e10cSrcweir 447*cdf0e10cSrcweir case FID_FILL_TO_RIGHT: 448*cdf0e10cSrcweir pTabViewShell->FillSimple( FILL_TO_RIGHT ); 449*cdf0e10cSrcweir rReq.Done(); 450*cdf0e10cSrcweir break; 451*cdf0e10cSrcweir 452*cdf0e10cSrcweir case FID_FILL_TO_TOP: 453*cdf0e10cSrcweir pTabViewShell->FillSimple( FILL_TO_TOP ); 454*cdf0e10cSrcweir rReq.Done(); 455*cdf0e10cSrcweir break; 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir case FID_FILL_TO_LEFT: 458*cdf0e10cSrcweir pTabViewShell->FillSimple( FILL_TO_LEFT ); 459*cdf0e10cSrcweir rReq.Done(); 460*cdf0e10cSrcweir break; 461*cdf0e10cSrcweir 462*cdf0e10cSrcweir case FID_FILL_TAB: 463*cdf0e10cSrcweir { 464*cdf0e10cSrcweir sal_uInt16 nFlags = IDF_NONE; 465*cdf0e10cSrcweir sal_uInt16 nFunction = PASTE_NOFUNC; 466*cdf0e10cSrcweir sal_Bool bSkipEmpty = sal_False; 467*cdf0e10cSrcweir sal_Bool bAsLink = sal_False; 468*cdf0e10cSrcweir 469*cdf0e10cSrcweir if ( pReqArgs!=NULL && pTabViewShell->SelectionEditable() ) 470*cdf0e10cSrcweir { 471*cdf0e10cSrcweir const SfxPoolItem* pItem; 472*cdf0e10cSrcweir String aFlags = 'A'; 473*cdf0e10cSrcweir 474*cdf0e10cSrcweir if( IS_AVAILABLE( FID_FILL_TAB, &pItem ) ) 475*cdf0e10cSrcweir aFlags = ((const SfxStringItem*)pItem)->GetValue(); 476*cdf0e10cSrcweir 477*cdf0e10cSrcweir aFlags.ToUpperAscii(); 478*cdf0e10cSrcweir sal_Bool bCont = sal_True; 479*cdf0e10cSrcweir 480*cdf0e10cSrcweir for( xub_StrLen i=0 ; bCont && i<aFlags.Len() ; i++ ) 481*cdf0e10cSrcweir { 482*cdf0e10cSrcweir switch( aFlags.GetChar(i) ) 483*cdf0e10cSrcweir { 484*cdf0e10cSrcweir case 'A': // Alle 485*cdf0e10cSrcweir nFlags |= IDF_ALL; 486*cdf0e10cSrcweir bCont = sal_False; // nicht mehr weitermachen! 487*cdf0e10cSrcweir break; 488*cdf0e10cSrcweir case 'S': nFlags |= IDF_STRING; break; 489*cdf0e10cSrcweir case 'V': nFlags |= IDF_VALUE; break; 490*cdf0e10cSrcweir case 'D': nFlags |= IDF_DATETIME; break; 491*cdf0e10cSrcweir case 'F': nFlags |= IDF_FORMULA; break; 492*cdf0e10cSrcweir case 'N': nFlags |= IDF_NOTE; break; 493*cdf0e10cSrcweir case 'T': nFlags |= IDF_ATTRIB; break; 494*cdf0e10cSrcweir } 495*cdf0e10cSrcweir } 496*cdf0e10cSrcweir } 497*cdf0e10cSrcweir else 498*cdf0e10cSrcweir { 499*cdf0e10cSrcweir //CHINA001 ScInsertContentsDlg* pDlg = 500*cdf0e10cSrcweir //CHINA001 new ScInsertContentsDlg(pTabViewShell->GetDialogParent(), 501*cdf0e10cSrcweir //CHINA001 0, /* nCheckDefaults */ 502*cdf0e10cSrcweir //CHINA001 &ScGlobal::GetRscString(STR_FILL_TAB) ); 503*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 504*cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir AbstractScInsertContentsDlg* pDlg = pFact->CreateScInsertContentsDlg( pTabViewShell->GetDialogParent(), 507*cdf0e10cSrcweir RID_SCDLG_INSCONT, 0, /* nCheckDefaults */ 508*cdf0e10cSrcweir &ScGlobal::GetRscString(STR_FILL_TAB)); 509*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 510*cdf0e10cSrcweir pDlg->SetFillMode(sal_True); 511*cdf0e10cSrcweir 512*cdf0e10cSrcweir if (pDlg->Execute() == RET_OK) 513*cdf0e10cSrcweir { 514*cdf0e10cSrcweir nFlags = pDlg->GetInsContentsCmdBits(); 515*cdf0e10cSrcweir nFunction = pDlg->GetFormulaCmdBits(); 516*cdf0e10cSrcweir bSkipEmpty = pDlg->IsSkipEmptyCells(); 517*cdf0e10cSrcweir bAsLink = pDlg->IsLink(); 518*cdf0e10cSrcweir // MoveMode gibt's bei Tabelle fuellen nicht 519*cdf0e10cSrcweir } 520*cdf0e10cSrcweir delete pDlg; 521*cdf0e10cSrcweir } 522*cdf0e10cSrcweir 523*cdf0e10cSrcweir if( nFlags != IDF_NONE ) 524*cdf0e10cSrcweir { 525*cdf0e10cSrcweir pTabViewShell->FillTab( nFlags, nFunction, bSkipEmpty, bAsLink ); 526*cdf0e10cSrcweir 527*cdf0e10cSrcweir if( ! rReq.IsAPI() ) 528*cdf0e10cSrcweir { 529*cdf0e10cSrcweir String aFlags; 530*cdf0e10cSrcweir 531*cdf0e10cSrcweir if( nFlags == IDF_ALL ) 532*cdf0e10cSrcweir { 533*cdf0e10cSrcweir aFlags += 'A'; 534*cdf0e10cSrcweir } 535*cdf0e10cSrcweir else 536*cdf0e10cSrcweir { 537*cdf0e10cSrcweir if( nFlags & IDF_STRING ) aFlags += 'S'; 538*cdf0e10cSrcweir if( nFlags & IDF_VALUE ) aFlags += 'V'; 539*cdf0e10cSrcweir if( nFlags & IDF_DATETIME ) aFlags += 'D'; 540*cdf0e10cSrcweir if( nFlags & IDF_FORMULA ) aFlags += 'F'; 541*cdf0e10cSrcweir if( nFlags & IDF_NOTE ) aFlags += 'N'; 542*cdf0e10cSrcweir if( nFlags & IDF_ATTRIB ) aFlags += 'T'; 543*cdf0e10cSrcweir } 544*cdf0e10cSrcweir 545*cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( FID_FILL_TAB, aFlags ) ); 546*cdf0e10cSrcweir rReq.Done(); 547*cdf0e10cSrcweir } 548*cdf0e10cSrcweir } 549*cdf0e10cSrcweir } 550*cdf0e10cSrcweir break; 551*cdf0e10cSrcweir 552*cdf0e10cSrcweir case FID_FILL_SERIES: 553*cdf0e10cSrcweir { 554*cdf0e10cSrcweir SCCOL nStartCol; 555*cdf0e10cSrcweir SCROW nStartRow; 556*cdf0e10cSrcweir SCTAB nStartTab; 557*cdf0e10cSrcweir SCCOL nEndCol; 558*cdf0e10cSrcweir SCROW nEndRow; 559*cdf0e10cSrcweir SCTAB nEndTab; 560*cdf0e10cSrcweir sal_uInt16 nPossDir = FDS_OPT_NONE; 561*cdf0e10cSrcweir FillDir eFillDir = FILL_TO_BOTTOM; 562*cdf0e10cSrcweir FillCmd eFillCmd = FILL_LINEAR; 563*cdf0e10cSrcweir FillDateCmd eFillDateCmd = FILL_DAY; 564*cdf0e10cSrcweir double fStartVal = MAXDOUBLE; 565*cdf0e10cSrcweir double fIncVal = 1; 566*cdf0e10cSrcweir double fMaxVal = MAXDOUBLE; 567*cdf0e10cSrcweir sal_Bool bDoIt = sal_False; 568*cdf0e10cSrcweir 569*cdf0e10cSrcweir GetViewData()->GetSimpleArea( nStartCol, nStartRow, nStartTab, 570*cdf0e10cSrcweir nEndCol, nEndRow, nEndTab ); 571*cdf0e10cSrcweir 572*cdf0e10cSrcweir if( nStartCol!=nEndCol ) 573*cdf0e10cSrcweir { 574*cdf0e10cSrcweir nPossDir |= FDS_OPT_HORZ; 575*cdf0e10cSrcweir eFillDir=FILL_TO_RIGHT; 576*cdf0e10cSrcweir } 577*cdf0e10cSrcweir 578*cdf0e10cSrcweir if( nStartRow!=nEndRow ) 579*cdf0e10cSrcweir { 580*cdf0e10cSrcweir nPossDir |= FDS_OPT_VERT; 581*cdf0e10cSrcweir eFillDir=FILL_TO_BOTTOM; 582*cdf0e10cSrcweir } 583*cdf0e10cSrcweir 584*cdf0e10cSrcweir ScDocument* pDoc = GetViewData()->GetDocument(); 585*cdf0e10cSrcweir SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); 586*cdf0e10cSrcweir 587*cdf0e10cSrcweir if( pReqArgs ) 588*cdf0e10cSrcweir { 589*cdf0e10cSrcweir const SfxPoolItem* pItem; 590*cdf0e10cSrcweir String aFillDir, aFillCmd, aFillDateCmd; 591*cdf0e10cSrcweir String aFillStep, aFillStart, aFillMax; 592*cdf0e10cSrcweir sal_uInt32 nKey; 593*cdf0e10cSrcweir double fTmpVal; 594*cdf0e10cSrcweir 595*cdf0e10cSrcweir bDoIt=sal_False; 596*cdf0e10cSrcweir 597*cdf0e10cSrcweir if( IS_AVAILABLE( FID_FILL_SERIES, &pItem ) ) 598*cdf0e10cSrcweir aFillDir = ((const SfxStringItem*)pItem)->GetValue(); 599*cdf0e10cSrcweir if( IS_AVAILABLE( FN_PARAM_1, &pItem ) ) 600*cdf0e10cSrcweir aFillCmd = ((const SfxStringItem*)pItem)->GetValue(); 601*cdf0e10cSrcweir if( IS_AVAILABLE( FN_PARAM_2, &pItem ) ) 602*cdf0e10cSrcweir aFillDateCmd = ((const SfxStringItem*)pItem)->GetValue(); 603*cdf0e10cSrcweir if( IS_AVAILABLE( FN_PARAM_3, &pItem ) ) 604*cdf0e10cSrcweir aFillStep = ((const SfxStringItem*)pItem)->GetValue(); 605*cdf0e10cSrcweir if( IS_AVAILABLE( FN_PARAM_4, &pItem ) ) 606*cdf0e10cSrcweir aFillStart = ((const SfxStringItem*)pItem)->GetValue(); 607*cdf0e10cSrcweir if( IS_AVAILABLE( FN_PARAM_5, &pItem ) ) 608*cdf0e10cSrcweir aFillMax = ((const SfxStringItem*)pItem)->GetValue(); 609*cdf0e10cSrcweir 610*cdf0e10cSrcweir if( aFillDir.Len() ) 611*cdf0e10cSrcweir switch( aFillDir.GetChar(0) ) 612*cdf0e10cSrcweir { 613*cdf0e10cSrcweir case 'B': case 'b': eFillDir=FILL_TO_BOTTOM; break; 614*cdf0e10cSrcweir case 'R': case 'r': eFillDir=FILL_TO_RIGHT; break; 615*cdf0e10cSrcweir case 'T': case 't': eFillDir=FILL_TO_TOP; break; 616*cdf0e10cSrcweir case 'L': case 'l': eFillDir=FILL_TO_LEFT; break; 617*cdf0e10cSrcweir } 618*cdf0e10cSrcweir 619*cdf0e10cSrcweir if( aFillCmd.Len() ) 620*cdf0e10cSrcweir switch( aFillCmd.GetChar(0) ) 621*cdf0e10cSrcweir { 622*cdf0e10cSrcweir case 'S': case 's': eFillCmd=FILL_SIMPLE; break; 623*cdf0e10cSrcweir case 'L': case 'l': eFillCmd=FILL_LINEAR; break; 624*cdf0e10cSrcweir case 'G': case 'g': eFillCmd=FILL_GROWTH; break; 625*cdf0e10cSrcweir case 'D': case 'd': eFillCmd=FILL_DATE; break; 626*cdf0e10cSrcweir case 'A': case 'a': eFillCmd=FILL_AUTO; break; 627*cdf0e10cSrcweir } 628*cdf0e10cSrcweir 629*cdf0e10cSrcweir if( aFillDateCmd.Len() ) 630*cdf0e10cSrcweir switch( aFillDateCmd.GetChar(0) ) 631*cdf0e10cSrcweir { 632*cdf0e10cSrcweir case 'D': case 'd': eFillDateCmd=FILL_DAY; break; 633*cdf0e10cSrcweir case 'W': case 'w': eFillDateCmd=FILL_WEEKDAY; break; 634*cdf0e10cSrcweir case 'M': case 'm': eFillDateCmd=FILL_MONTH; break; 635*cdf0e10cSrcweir case 'Y': case 'y': eFillDateCmd=FILL_YEAR; break; 636*cdf0e10cSrcweir } 637*cdf0e10cSrcweir 638*cdf0e10cSrcweir nKey = 0; 639*cdf0e10cSrcweir if( pFormatter->IsNumberFormat( aFillStart, nKey, fTmpVal )) 640*cdf0e10cSrcweir fStartVal = fTmpVal; 641*cdf0e10cSrcweir 642*cdf0e10cSrcweir nKey = 0; 643*cdf0e10cSrcweir if( pFormatter->IsNumberFormat( aFillStep, nKey, fTmpVal )) 644*cdf0e10cSrcweir fIncVal = fTmpVal; 645*cdf0e10cSrcweir 646*cdf0e10cSrcweir nKey = 0; 647*cdf0e10cSrcweir if( pFormatter->IsNumberFormat( aFillMax, nKey, fTmpVal )) 648*cdf0e10cSrcweir fMaxVal = fTmpVal; 649*cdf0e10cSrcweir 650*cdf0e10cSrcweir bDoIt = sal_True; 651*cdf0e10cSrcweir 652*cdf0e10cSrcweir } 653*cdf0e10cSrcweir else // (pReqArgs == NULL) => Dialog hochziehen 654*cdf0e10cSrcweir { 655*cdf0e10cSrcweir // 656*cdf0e10cSrcweir sal_uInt32 nPrivFormat; 657*cdf0e10cSrcweir CellType eCellType; 658*cdf0e10cSrcweir pDoc->GetNumberFormat( nStartCol, nStartRow, nStartTab, nPrivFormat ); 659*cdf0e10cSrcweir pDoc->GetCellType( nStartCol, nStartRow, nStartTab,eCellType ); 660*cdf0e10cSrcweir const SvNumberformat* pPrivEntry = pFormatter->GetEntry( nPrivFormat ); 661*cdf0e10cSrcweir if (!pPrivEntry) 662*cdf0e10cSrcweir { 663*cdf0e10cSrcweir DBG_ERROR("Zahlformat nicht gefunden !!!"); 664*cdf0e10cSrcweir } 665*cdf0e10cSrcweir else 666*cdf0e10cSrcweir { 667*cdf0e10cSrcweir short nPrivType = pPrivEntry->GetType(); 668*cdf0e10cSrcweir if ( ( nPrivType & NUMBERFORMAT_DATE)>0) 669*cdf0e10cSrcweir { 670*cdf0e10cSrcweir eFillCmd=FILL_DATE; 671*cdf0e10cSrcweir } 672*cdf0e10cSrcweir else if(eCellType==CELLTYPE_STRING) 673*cdf0e10cSrcweir { 674*cdf0e10cSrcweir eFillCmd=FILL_AUTO; 675*cdf0e10cSrcweir } 676*cdf0e10cSrcweir } 677*cdf0e10cSrcweir 678*cdf0e10cSrcweir // 679*cdf0e10cSrcweir String aStartStr; 680*cdf0e10cSrcweir 681*cdf0e10cSrcweir // Startwert nur vorbelegen, wenn nur 1 Zeile oder Spalte: 682*cdf0e10cSrcweir if ( nStartCol == nEndCol || nStartRow == nEndRow ) 683*cdf0e10cSrcweir { 684*cdf0e10cSrcweir double fInputEndVal = 0.0; 685*cdf0e10cSrcweir String aEndStr; 686*cdf0e10cSrcweir 687*cdf0e10cSrcweir pDoc->GetInputString( nStartCol, nStartRow, nStartTab, aStartStr); 688*cdf0e10cSrcweir pDoc->GetValue( nStartCol, nStartRow, nStartTab, fStartVal ); 689*cdf0e10cSrcweir 690*cdf0e10cSrcweir 691*cdf0e10cSrcweir if(eFillDir==FILL_TO_BOTTOM && nStartRow < nEndRow ) 692*cdf0e10cSrcweir { 693*cdf0e10cSrcweir pDoc->GetInputString( nStartCol, nStartRow+1, nStartTab, aEndStr); 694*cdf0e10cSrcweir if(aEndStr.Len()>0) 695*cdf0e10cSrcweir { 696*cdf0e10cSrcweir pDoc->GetValue( nStartCol, nStartRow+1, nStartTab, fInputEndVal); 697*cdf0e10cSrcweir fIncVal=fInputEndVal-fStartVal; 698*cdf0e10cSrcweir } 699*cdf0e10cSrcweir } 700*cdf0e10cSrcweir else 701*cdf0e10cSrcweir { 702*cdf0e10cSrcweir if(nStartCol < nEndCol) 703*cdf0e10cSrcweir { 704*cdf0e10cSrcweir pDoc->GetInputString( nStartCol+1, nStartRow, nStartTab, aEndStr); 705*cdf0e10cSrcweir if(aEndStr.Len()>0) 706*cdf0e10cSrcweir { 707*cdf0e10cSrcweir pDoc->GetValue( nStartCol+1, nStartRow, nStartTab, fInputEndVal); 708*cdf0e10cSrcweir fIncVal=fInputEndVal-fStartVal; 709*cdf0e10cSrcweir } 710*cdf0e10cSrcweir } 711*cdf0e10cSrcweir } 712*cdf0e10cSrcweir if(eFillCmd==FILL_DATE) 713*cdf0e10cSrcweir { 714*cdf0e10cSrcweir Date aNullDate = *pDoc->GetFormatTable()->GetNullDate(); 715*cdf0e10cSrcweir Date aStartDate = aNullDate; 716*cdf0e10cSrcweir aStartDate+= (long)fStartVal; 717*cdf0e10cSrcweir Date aEndDate = aNullDate; 718*cdf0e10cSrcweir aEndDate+= (long)fInputEndVal; 719*cdf0e10cSrcweir double fTempDate=0; 720*cdf0e10cSrcweir 721*cdf0e10cSrcweir if(aStartDate.GetYear()!=aEndDate.GetYear()) 722*cdf0e10cSrcweir { 723*cdf0e10cSrcweir eFillDateCmd = FILL_YEAR; 724*cdf0e10cSrcweir fTempDate=aEndDate.GetYear()-aStartDate.GetYear(); 725*cdf0e10cSrcweir } 726*cdf0e10cSrcweir if(aStartDate.GetMonth()!=aEndDate.GetMonth()) 727*cdf0e10cSrcweir { 728*cdf0e10cSrcweir eFillDateCmd = FILL_MONTH; 729*cdf0e10cSrcweir fTempDate=fTempDate*12+aEndDate.GetMonth()-aStartDate.GetMonth(); 730*cdf0e10cSrcweir } 731*cdf0e10cSrcweir if(aStartDate.GetDay()==aEndDate.GetDay()) 732*cdf0e10cSrcweir { 733*cdf0e10cSrcweir fIncVal=fTempDate; 734*cdf0e10cSrcweir } 735*cdf0e10cSrcweir } 736*cdf0e10cSrcweir } 737*cdf0e10cSrcweir //CHINA001 ScFillSeriesDlg* pDlg = new ScFillSeriesDlg( 738*cdf0e10cSrcweir //CHINA001 pTabViewShell->GetDialogParent(), *pDoc, 739*cdf0e10cSrcweir //CHINA001 eFillDir, eFillCmd, eFillDateCmd, 740*cdf0e10cSrcweir //CHINA001 aStartStr, fIncVal, fMaxVal, 741*cdf0e10cSrcweir //CHINA001 nPossDir); 742*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 743*cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 744*cdf0e10cSrcweir 745*cdf0e10cSrcweir AbstractScFillSeriesDlg* pDlg = pFact->CreateScFillSeriesDlg( pTabViewShell->GetDialogParent(), 746*cdf0e10cSrcweir *pDoc, 747*cdf0e10cSrcweir eFillDir, eFillCmd, eFillDateCmd, 748*cdf0e10cSrcweir aStartStr, fIncVal, fMaxVal, 749*cdf0e10cSrcweir nPossDir, 750*cdf0e10cSrcweir RID_SCDLG_FILLSERIES); 751*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 752*cdf0e10cSrcweir 753*cdf0e10cSrcweir if ( nStartCol != nEndCol && nStartRow != nEndRow ) 754*cdf0e10cSrcweir { 755*cdf0e10cSrcweir pDlg->SetEdStartValEnabled(sal_False); 756*cdf0e10cSrcweir } 757*cdf0e10cSrcweir 758*cdf0e10cSrcweir if ( pDlg->Execute() == RET_OK ) 759*cdf0e10cSrcweir { 760*cdf0e10cSrcweir eFillDir = pDlg->GetFillDir(); 761*cdf0e10cSrcweir eFillCmd = pDlg->GetFillCmd(); 762*cdf0e10cSrcweir eFillDateCmd = pDlg->GetFillDateCmd(); 763*cdf0e10cSrcweir 764*cdf0e10cSrcweir if(eFillCmd==FILL_AUTO) 765*cdf0e10cSrcweir { 766*cdf0e10cSrcweir String aStr=pDlg->GetStartStr(); 767*cdf0e10cSrcweir if(aStr.Len()>0) 768*cdf0e10cSrcweir pTabViewShell->EnterData( nStartCol, nStartRow, nStartTab, aStr ); 769*cdf0e10cSrcweir } 770*cdf0e10cSrcweir fStartVal = pDlg->GetStart(); 771*cdf0e10cSrcweir fIncVal = pDlg->GetStep(); 772*cdf0e10cSrcweir fMaxVal = pDlg->GetMax(); 773*cdf0e10cSrcweir bDoIt = sal_True; 774*cdf0e10cSrcweir } 775*cdf0e10cSrcweir delete pDlg; 776*cdf0e10cSrcweir } 777*cdf0e10cSrcweir 778*cdf0e10cSrcweir if( bDoIt ) 779*cdf0e10cSrcweir { 780*cdf0e10cSrcweir //nScFillModeMouseModifier = 0; // kein Ctrl/Copy 781*cdf0e10cSrcweir pTabViewShell->FillSeries( eFillDir, eFillCmd, eFillDateCmd, fStartVal, fIncVal, fMaxVal ); 782*cdf0e10cSrcweir 783*cdf0e10cSrcweir if( ! rReq.IsAPI() ) 784*cdf0e10cSrcweir { 785*cdf0e10cSrcweir String aPara; 786*cdf0e10cSrcweir Color* pColor=0; 787*cdf0e10cSrcweir 788*cdf0e10cSrcweir switch( eFillDir ) 789*cdf0e10cSrcweir { 790*cdf0e10cSrcweir case FILL_TO_BOTTOM: aPara = 'B'; break; 791*cdf0e10cSrcweir case FILL_TO_RIGHT: aPara = 'R'; break; 792*cdf0e10cSrcweir case FILL_TO_TOP: aPara = 'T'; break; 793*cdf0e10cSrcweir case FILL_TO_LEFT: aPara = 'L'; break; 794*cdf0e10cSrcweir default: aPara.Erase(); break; 795*cdf0e10cSrcweir } 796*cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( FID_FILL_SERIES, aPara ) ); 797*cdf0e10cSrcweir 798*cdf0e10cSrcweir switch( eFillCmd ) 799*cdf0e10cSrcweir { 800*cdf0e10cSrcweir case FILL_SIMPLE: aPara = 'S'; break; 801*cdf0e10cSrcweir case FILL_LINEAR: aPara = 'L'; break; 802*cdf0e10cSrcweir case FILL_GROWTH: aPara = 'G'; break; 803*cdf0e10cSrcweir case FILL_DATE: aPara = 'D'; break; 804*cdf0e10cSrcweir case FILL_AUTO: aPara = 'A'; break; 805*cdf0e10cSrcweir default: aPara.Erase(); break; 806*cdf0e10cSrcweir } 807*cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( FN_PARAM_1, aPara ) ); 808*cdf0e10cSrcweir 809*cdf0e10cSrcweir switch( eFillDateCmd ) 810*cdf0e10cSrcweir { 811*cdf0e10cSrcweir case FILL_DAY: aPara = 'D'; break; 812*cdf0e10cSrcweir case FILL_WEEKDAY: aPara = 'W'; break; 813*cdf0e10cSrcweir case FILL_MONTH: aPara = 'M'; break; 814*cdf0e10cSrcweir case FILL_YEAR: aPara = 'Y'; break; 815*cdf0e10cSrcweir default: aPara.Erase(); break; 816*cdf0e10cSrcweir } 817*cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( FN_PARAM_2, aPara ) ); 818*cdf0e10cSrcweir 819*cdf0e10cSrcweir sal_uLong nFormatKey = pFormatter->GetStandardFormat(NUMBERFORMAT_NUMBER, 820*cdf0e10cSrcweir ScGlobal::eLnge ); 821*cdf0e10cSrcweir 822*cdf0e10cSrcweir pFormatter->GetOutputString( fIncVal, nFormatKey, aPara, &pColor ); 823*cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( FN_PARAM_3, aPara ) ); 824*cdf0e10cSrcweir 825*cdf0e10cSrcweir pFormatter->GetOutputString( fStartVal, nFormatKey, aPara, &pColor ); 826*cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( FN_PARAM_4, aPara ) ); 827*cdf0e10cSrcweir 828*cdf0e10cSrcweir pFormatter->GetOutputString( fMaxVal, nFormatKey, aPara, &pColor ); 829*cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( FN_PARAM_5, aPara ) ); 830*cdf0e10cSrcweir 831*cdf0e10cSrcweir rReq.Done(); 832*cdf0e10cSrcweir } 833*cdf0e10cSrcweir } 834*cdf0e10cSrcweir } 835*cdf0e10cSrcweir break; 836*cdf0e10cSrcweir 837*cdf0e10cSrcweir case FID_FILL_AUTO: 838*cdf0e10cSrcweir { 839*cdf0e10cSrcweir SCCOL nStartCol; 840*cdf0e10cSrcweir SCROW nStartRow; 841*cdf0e10cSrcweir SCCOL nEndCol; 842*cdf0e10cSrcweir SCROW nEndRow; 843*cdf0e10cSrcweir SCTAB nStartTab, nEndTab; 844*cdf0e10cSrcweir 845*cdf0e10cSrcweir GetViewData()->GetFillData( nStartCol, nStartRow, nEndCol, nEndRow ); 846*cdf0e10cSrcweir SCCOL nFillCol = GetViewData()->GetRefEndX(); 847*cdf0e10cSrcweir SCROW nFillRow = GetViewData()->GetRefEndY(); 848*cdf0e10cSrcweir ScDocument* pDoc = GetViewData()->GetDocument(); 849*cdf0e10cSrcweir 850*cdf0e10cSrcweir if( pReqArgs != NULL ) 851*cdf0e10cSrcweir { 852*cdf0e10cSrcweir const SfxPoolItem* pItem; 853*cdf0e10cSrcweir 854*cdf0e10cSrcweir if( IS_AVAILABLE( FID_FILL_AUTO, &pItem ) ) 855*cdf0e10cSrcweir { 856*cdf0e10cSrcweir ScAddress aScAddress; 857*cdf0e10cSrcweir String aArg = ((const SfxStringItem*)pItem)->GetValue(); 858*cdf0e10cSrcweir 859*cdf0e10cSrcweir if( aScAddress.Parse( aArg, pDoc, pDoc->GetAddressConvention() ) & SCA_VALID ) 860*cdf0e10cSrcweir { 861*cdf0e10cSrcweir nFillRow = aScAddress.Row(); 862*cdf0e10cSrcweir nFillCol = aScAddress.Col(); 863*cdf0e10cSrcweir } 864*cdf0e10cSrcweir } 865*cdf0e10cSrcweir 866*cdf0e10cSrcweir GetViewData()->GetSimpleArea( nStartCol,nStartRow,nStartTab, 867*cdf0e10cSrcweir nEndCol,nEndRow,nEndTab ); 868*cdf0e10cSrcweir } 869*cdf0e10cSrcweir else // Aufruf per Maus 870*cdf0e10cSrcweir { 871*cdf0e10cSrcweir // #55284# nicht innerhalb einer zusammengefassten Zelle 872*cdf0e10cSrcweir 873*cdf0e10cSrcweir if ( nStartCol == nEndCol && nStartRow == nEndRow ) 874*cdf0e10cSrcweir { 875*cdf0e10cSrcweir SCCOL nMergeCol = nStartCol; 876*cdf0e10cSrcweir SCROW nMergeRow = nStartRow; 877*cdf0e10cSrcweir if ( GetViewData()->GetDocument()->ExtendMerge( 878*cdf0e10cSrcweir nStartCol, nStartRow, nMergeCol, nMergeRow, 879*cdf0e10cSrcweir GetViewData()->GetTabNo() ) ) 880*cdf0e10cSrcweir { 881*cdf0e10cSrcweir if ( nFillCol >= nStartCol && nFillCol <= nMergeCol && nFillRow == nStartRow ) 882*cdf0e10cSrcweir nFillCol = nStartCol; 883*cdf0e10cSrcweir if ( nFillRow >= nStartRow && nFillRow <= nMergeRow && nFillCol == nStartCol ) 884*cdf0e10cSrcweir nFillRow = nStartRow; 885*cdf0e10cSrcweir } 886*cdf0e10cSrcweir } 887*cdf0e10cSrcweir } 888*cdf0e10cSrcweir 889*cdf0e10cSrcweir if ( nFillCol != nEndCol || nFillRow != nEndRow ) 890*cdf0e10cSrcweir { 891*cdf0e10cSrcweir if ( nFillCol==nEndCol || nFillRow==nEndRow ) 892*cdf0e10cSrcweir { 893*cdf0e10cSrcweir FillDir eDir = FILL_TO_BOTTOM; 894*cdf0e10cSrcweir SCCOLROW nCount = 0; 895*cdf0e10cSrcweir 896*cdf0e10cSrcweir if ( nFillCol==nEndCol ) 897*cdf0e10cSrcweir { 898*cdf0e10cSrcweir if ( nFillRow > nEndRow ) 899*cdf0e10cSrcweir { 900*cdf0e10cSrcweir eDir = FILL_TO_BOTTOM; 901*cdf0e10cSrcweir nCount = nFillRow - nEndRow; 902*cdf0e10cSrcweir } 903*cdf0e10cSrcweir else if ( nFillRow < nStartRow ) 904*cdf0e10cSrcweir { 905*cdf0e10cSrcweir eDir = FILL_TO_TOP; 906*cdf0e10cSrcweir nCount = nStartRow - nFillRow; 907*cdf0e10cSrcweir } 908*cdf0e10cSrcweir } 909*cdf0e10cSrcweir else 910*cdf0e10cSrcweir { 911*cdf0e10cSrcweir if ( nFillCol > nEndCol ) 912*cdf0e10cSrcweir { 913*cdf0e10cSrcweir eDir = FILL_TO_RIGHT; 914*cdf0e10cSrcweir nCount = nFillCol - nEndCol; 915*cdf0e10cSrcweir } 916*cdf0e10cSrcweir else if ( nFillCol < nStartCol ) 917*cdf0e10cSrcweir { 918*cdf0e10cSrcweir eDir = FILL_TO_LEFT; 919*cdf0e10cSrcweir nCount = nStartCol - nFillCol; 920*cdf0e10cSrcweir } 921*cdf0e10cSrcweir } 922*cdf0e10cSrcweir 923*cdf0e10cSrcweir if ( nCount != 0) 924*cdf0e10cSrcweir { 925*cdf0e10cSrcweir pTabViewShell->FillAuto( eDir, nStartCol, nStartRow, nEndCol, nEndRow, nCount ); 926*cdf0e10cSrcweir 927*cdf0e10cSrcweir if( ! rReq.IsAPI() ) 928*cdf0e10cSrcweir { 929*cdf0e10cSrcweir String aAdrStr; 930*cdf0e10cSrcweir ScAddress aAdr( nFillCol, nFillRow, 0 ); 931*cdf0e10cSrcweir aAdr.Format( aAdrStr, SCR_ABS, pDoc, pDoc->GetAddressConvention() ); 932*cdf0e10cSrcweir 933*cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( FID_FILL_AUTO, aAdrStr ) ); 934*cdf0e10cSrcweir rReq.Done(); 935*cdf0e10cSrcweir } 936*cdf0e10cSrcweir } 937*cdf0e10cSrcweir 938*cdf0e10cSrcweir } 939*cdf0e10cSrcweir else 940*cdf0e10cSrcweir { 941*cdf0e10cSrcweir DBG_ERROR( "Richtung nicht eindeutig fuer AutoFill" ); 942*cdf0e10cSrcweir } 943*cdf0e10cSrcweir } 944*cdf0e10cSrcweir } 945*cdf0e10cSrcweir break; 946*cdf0e10cSrcweir 947*cdf0e10cSrcweir // 948*cdf0e10cSrcweir // Gliederung (Outlines) 949*cdf0e10cSrcweir // SID_AUTO_OUTLINE, SID_OUTLINE_DELETEALL in Execute (in docsh.idl) 950*cdf0e10cSrcweir // 951*cdf0e10cSrcweir 952*cdf0e10cSrcweir case SID_OUTLINE_HIDE: 953*cdf0e10cSrcweir if ( GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(), 954*cdf0e10cSrcweir GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) ) 955*cdf0e10cSrcweir pTabViewShell->SetDataPilotDetails( sal_False ); 956*cdf0e10cSrcweir else 957*cdf0e10cSrcweir pTabViewShell->HideMarkedOutlines(); 958*cdf0e10cSrcweir rReq.Done(); 959*cdf0e10cSrcweir break; 960*cdf0e10cSrcweir 961*cdf0e10cSrcweir case SID_OUTLINE_SHOW: 962*cdf0e10cSrcweir { 963*cdf0e10cSrcweir ScDPObject* pDPObj = GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(), 964*cdf0e10cSrcweir GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); 965*cdf0e10cSrcweir if ( pDPObj ) 966*cdf0e10cSrcweir { 967*cdf0e10cSrcweir Sequence<sheet::DataPilotFieldFilter> aFilters; 968*cdf0e10cSrcweir sal_uInt16 nOrientation; 969*cdf0e10cSrcweir if ( pTabViewShell->HasSelectionForDrillDown( nOrientation ) ) 970*cdf0e10cSrcweir { 971*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 972*cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 973*cdf0e10cSrcweir 974*cdf0e10cSrcweir AbstractScDPShowDetailDlg* pDlg = pFact->CreateScDPShowDetailDlg( 975*cdf0e10cSrcweir pTabViewShell->GetDialogParent(), RID_SCDLG_DPSHOWDETAIL, *pDPObj, nOrientation ); 976*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 977*cdf0e10cSrcweir if ( pDlg->Execute() == RET_OK ) 978*cdf0e10cSrcweir { 979*cdf0e10cSrcweir String aNewDimName( pDlg->GetDimensionName() ); 980*cdf0e10cSrcweir pTabViewShell->SetDataPilotDetails( sal_True, &aNewDimName ); 981*cdf0e10cSrcweir } 982*cdf0e10cSrcweir } 983*cdf0e10cSrcweir else if ( !pDPObj->IsServiceData() && 984*cdf0e10cSrcweir pDPObj->GetDataFieldPositionData( 985*cdf0e10cSrcweir ScAddress( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ), 986*cdf0e10cSrcweir aFilters ) ) 987*cdf0e10cSrcweir pTabViewShell->ShowDataPilotSourceData( *pDPObj, aFilters ); 988*cdf0e10cSrcweir else 989*cdf0e10cSrcweir pTabViewShell->SetDataPilotDetails( sal_True ); 990*cdf0e10cSrcweir } 991*cdf0e10cSrcweir else 992*cdf0e10cSrcweir pTabViewShell->ShowMarkedOutlines(); 993*cdf0e10cSrcweir rReq.Done(); 994*cdf0e10cSrcweir } 995*cdf0e10cSrcweir break; 996*cdf0e10cSrcweir 997*cdf0e10cSrcweir case SID_OUTLINE_MAKE: 998*cdf0e10cSrcweir { 999*cdf0e10cSrcweir sal_Bool bColumns = sal_False; 1000*cdf0e10cSrcweir sal_Bool bOk = sal_True; 1001*cdf0e10cSrcweir 1002*cdf0e10cSrcweir if ( GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(), 1003*cdf0e10cSrcweir GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) ) 1004*cdf0e10cSrcweir { 1005*cdf0e10cSrcweir ScDPNumGroupInfo aNumInfo; 1006*cdf0e10cSrcweir aNumInfo.Enable = sal_True; 1007*cdf0e10cSrcweir aNumInfo.AutoStart = sal_True; 1008*cdf0e10cSrcweir aNumInfo.AutoEnd = sal_True; 1009*cdf0e10cSrcweir sal_Int32 nParts = 0; 1010*cdf0e10cSrcweir if ( pTabViewShell->HasSelectionForDateGroup( aNumInfo, nParts ) ) 1011*cdf0e10cSrcweir { 1012*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 1013*cdf0e10cSrcweir DBG_ASSERT( pFact, "ScAbstractFactory create fail!" ); 1014*cdf0e10cSrcweir Date aNullDate( *GetViewData()->GetDocument()->GetFormatTable()->GetNullDate() ); 1015*cdf0e10cSrcweir AbstractScDPDateGroupDlg* pDlg = pFact->CreateScDPDateGroupDlg( 1016*cdf0e10cSrcweir pTabViewShell->GetDialogParent(), RID_SCDLG_DPDATEGROUP, 1017*cdf0e10cSrcweir aNumInfo, nParts, aNullDate ); 1018*cdf0e10cSrcweir DBG_ASSERT( pDlg, "Dialog create fail!" ); 1019*cdf0e10cSrcweir if( pDlg->Execute() == RET_OK ) 1020*cdf0e10cSrcweir { 1021*cdf0e10cSrcweir aNumInfo = pDlg->GetGroupInfo(); 1022*cdf0e10cSrcweir pTabViewShell->DateGroupDataPilot( aNumInfo, pDlg->GetDatePart() ); 1023*cdf0e10cSrcweir } 1024*cdf0e10cSrcweir } 1025*cdf0e10cSrcweir else if ( pTabViewShell->HasSelectionForNumGroup( aNumInfo ) ) 1026*cdf0e10cSrcweir { 1027*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 1028*cdf0e10cSrcweir DBG_ASSERT( pFact, "ScAbstractFactory create fail!" ); 1029*cdf0e10cSrcweir AbstractScDPNumGroupDlg* pDlg = pFact->CreateScDPNumGroupDlg( 1030*cdf0e10cSrcweir pTabViewShell->GetDialogParent(), RID_SCDLG_DPNUMGROUP, aNumInfo ); 1031*cdf0e10cSrcweir DBG_ASSERT( pDlg, "Dialog create fail!" ); 1032*cdf0e10cSrcweir if( pDlg->Execute() == RET_OK ) 1033*cdf0e10cSrcweir pTabViewShell->NumGroupDataPilot( pDlg->GetGroupInfo() ); 1034*cdf0e10cSrcweir } 1035*cdf0e10cSrcweir else 1036*cdf0e10cSrcweir pTabViewShell->GroupDataPilot(); 1037*cdf0e10cSrcweir 1038*cdf0e10cSrcweir bOk = sal_False; 1039*cdf0e10cSrcweir } 1040*cdf0e10cSrcweir else if( pReqArgs != NULL ) 1041*cdf0e10cSrcweir { 1042*cdf0e10cSrcweir const SfxPoolItem* pItem; 1043*cdf0e10cSrcweir bOk = sal_False; 1044*cdf0e10cSrcweir 1045*cdf0e10cSrcweir if( IS_AVAILABLE( SID_OUTLINE_MAKE, &pItem ) ) 1046*cdf0e10cSrcweir { 1047*cdf0e10cSrcweir String aCol = ((const SfxStringItem*)pItem)->GetValue(); 1048*cdf0e10cSrcweir aCol.ToUpperAscii(); 1049*cdf0e10cSrcweir 1050*cdf0e10cSrcweir switch( aCol.GetChar(0) ) 1051*cdf0e10cSrcweir { 1052*cdf0e10cSrcweir case 'R': bColumns=sal_False; bOk = sal_True;break; 1053*cdf0e10cSrcweir case 'C': bColumns=sal_True; bOk = sal_True;break; 1054*cdf0e10cSrcweir } 1055*cdf0e10cSrcweir } 1056*cdf0e10cSrcweir } 1057*cdf0e10cSrcweir else // Dialog, wenn nicht ganze Zeilen/Spalten markiert 1058*cdf0e10cSrcweir { 1059*cdf0e10cSrcweir if ( GetViewData()->SimpleColMarked() && !GetViewData()->SimpleRowMarked() ) 1060*cdf0e10cSrcweir bColumns = sal_True; 1061*cdf0e10cSrcweir else if ( !GetViewData()->SimpleColMarked() && GetViewData()->SimpleRowMarked() ) 1062*cdf0e10cSrcweir bColumns = sal_False; 1063*cdf0e10cSrcweir else 1064*cdf0e10cSrcweir { 1065*cdf0e10cSrcweir //CHINA001 ScGroupDlg* pDlg = new ScGroupDlg(pTabViewShell->GetDialogParent(), 1066*cdf0e10cSrcweir //CHINA001 RID_SCDLG_GRP_MAKE, sal_False ); 1067*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 1068*cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 1069*cdf0e10cSrcweir 1070*cdf0e10cSrcweir AbstractScGroupDlg* pDlg = pFact->CreateAbstractScGroupDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_GRP_MAKE, RID_SCDLG_GRP_MAKE,sal_False); 1071*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 1072*cdf0e10cSrcweir if ( pDlg->Execute() == RET_OK ) 1073*cdf0e10cSrcweir bColumns = pDlg->GetColsChecked(); 1074*cdf0e10cSrcweir else 1075*cdf0e10cSrcweir bOk = sal_False; 1076*cdf0e10cSrcweir delete pDlg; 1077*cdf0e10cSrcweir } 1078*cdf0e10cSrcweir } 1079*cdf0e10cSrcweir if (bOk) 1080*cdf0e10cSrcweir { 1081*cdf0e10cSrcweir pTabViewShell->MakeOutline( bColumns ); 1082*cdf0e10cSrcweir 1083*cdf0e10cSrcweir if( ! rReq.IsAPI() ) 1084*cdf0e10cSrcweir { 1085*cdf0e10cSrcweir String aCol = bColumns ? 'C' : 'R'; 1086*cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( SID_OUTLINE_MAKE, aCol ) ); 1087*cdf0e10cSrcweir rReq.Done(); 1088*cdf0e10cSrcweir } 1089*cdf0e10cSrcweir } 1090*cdf0e10cSrcweir } 1091*cdf0e10cSrcweir break; 1092*cdf0e10cSrcweir 1093*cdf0e10cSrcweir case SID_OUTLINE_REMOVE: 1094*cdf0e10cSrcweir { 1095*cdf0e10cSrcweir sal_Bool bColumns = sal_False; 1096*cdf0e10cSrcweir sal_Bool bOk = sal_True; 1097*cdf0e10cSrcweir 1098*cdf0e10cSrcweir if ( GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(), 1099*cdf0e10cSrcweir GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) ) 1100*cdf0e10cSrcweir { 1101*cdf0e10cSrcweir pTabViewShell->UngroupDataPilot(); 1102*cdf0e10cSrcweir bOk = sal_False; 1103*cdf0e10cSrcweir } 1104*cdf0e10cSrcweir else if( pReqArgs != NULL ) 1105*cdf0e10cSrcweir { 1106*cdf0e10cSrcweir const SfxPoolItem* pItem; 1107*cdf0e10cSrcweir bOk = sal_False; 1108*cdf0e10cSrcweir 1109*cdf0e10cSrcweir if( IS_AVAILABLE( SID_OUTLINE_REMOVE, &pItem ) ) 1110*cdf0e10cSrcweir { 1111*cdf0e10cSrcweir String aCol = ((const SfxStringItem*)pItem)->GetValue(); 1112*cdf0e10cSrcweir aCol.ToUpperAscii(); 1113*cdf0e10cSrcweir 1114*cdf0e10cSrcweir switch( aCol.GetChar(0) ) 1115*cdf0e10cSrcweir { 1116*cdf0e10cSrcweir case 'R': bColumns=sal_False; bOk = sal_True;break; 1117*cdf0e10cSrcweir case 'C': bColumns=sal_True; bOk = sal_True;break; 1118*cdf0e10cSrcweir } 1119*cdf0e10cSrcweir } 1120*cdf0e10cSrcweir } 1121*cdf0e10cSrcweir else // Dialog nur, wenn Aufheben fuer Zeilen und Spalten moeglich 1122*cdf0e10cSrcweir { 1123*cdf0e10cSrcweir sal_Bool bColPoss, bRowPoss; 1124*cdf0e10cSrcweir pTabViewShell->TestRemoveOutline( bColPoss, bRowPoss ); 1125*cdf0e10cSrcweir if ( bColPoss && bRowPoss ) 1126*cdf0e10cSrcweir { 1127*cdf0e10cSrcweir //CHINA001 ScGroupDlg* pDlg = new ScGroupDlg( pTabViewShell->GetDialogParent(), 1128*cdf0e10cSrcweir //CHINA001 RID_SCDLG_GRP_KILL, sal_True ); 1129*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 1130*cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 1131*cdf0e10cSrcweir 1132*cdf0e10cSrcweir AbstractScGroupDlg* pDlg = pFact->CreateAbstractScGroupDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_GRP_KILL, RID_SCDLG_GRP_KILL,sal_True); 1133*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 1134*cdf0e10cSrcweir if ( pDlg->Execute() == RET_OK ) 1135*cdf0e10cSrcweir bColumns = pDlg->GetColsChecked(); 1136*cdf0e10cSrcweir else 1137*cdf0e10cSrcweir bOk = sal_False; 1138*cdf0e10cSrcweir delete pDlg; 1139*cdf0e10cSrcweir } 1140*cdf0e10cSrcweir else if ( bColPoss ) 1141*cdf0e10cSrcweir bColumns = sal_True; 1142*cdf0e10cSrcweir else if ( bRowPoss ) 1143*cdf0e10cSrcweir bColumns = sal_False; 1144*cdf0e10cSrcweir else 1145*cdf0e10cSrcweir bOk = sal_False; 1146*cdf0e10cSrcweir } 1147*cdf0e10cSrcweir if (bOk) 1148*cdf0e10cSrcweir { 1149*cdf0e10cSrcweir pTabViewShell->RemoveOutline( bColumns ); 1150*cdf0e10cSrcweir 1151*cdf0e10cSrcweir if( ! rReq.IsAPI() ) 1152*cdf0e10cSrcweir { 1153*cdf0e10cSrcweir String aCol = bColumns ? 'C' : 'R'; 1154*cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( SID_OUTLINE_REMOVE, aCol ) ); 1155*cdf0e10cSrcweir rReq.Done(); 1156*cdf0e10cSrcweir } 1157*cdf0e10cSrcweir } 1158*cdf0e10cSrcweir } 1159*cdf0e10cSrcweir break; 1160*cdf0e10cSrcweir 1161*cdf0e10cSrcweir // 1162*cdf0e10cSrcweir // Clipboard 1163*cdf0e10cSrcweir // 1164*cdf0e10cSrcweir 1165*cdf0e10cSrcweir case SID_COPY: // fuer Grafiken in DrawShell 1166*cdf0e10cSrcweir { 1167*cdf0e10cSrcweir WaitObject aWait( GetViewData()->GetDialogParent() ); 1168*cdf0e10cSrcweir pTabViewShell->CopyToClip( NULL, sal_False, sal_False, sal_True ); 1169*cdf0e10cSrcweir rReq.Done(); 1170*cdf0e10cSrcweir } 1171*cdf0e10cSrcweir break; 1172*cdf0e10cSrcweir 1173*cdf0e10cSrcweir case SID_CUT: // fuer Grafiken in DrawShell 1174*cdf0e10cSrcweir { 1175*cdf0e10cSrcweir WaitObject aWait( GetViewData()->GetDialogParent() ); 1176*cdf0e10cSrcweir pTabViewShell->CutToClip( NULL, sal_True ); 1177*cdf0e10cSrcweir rReq.Done(); 1178*cdf0e10cSrcweir } 1179*cdf0e10cSrcweir break; 1180*cdf0e10cSrcweir 1181*cdf0e10cSrcweir case SID_PASTE: 1182*cdf0e10cSrcweir { 1183*cdf0e10cSrcweir PasteFromClipboard ( GetViewData(), pTabViewShell, true ); 1184*cdf0e10cSrcweir rReq.Done(); 1185*cdf0e10cSrcweir } 1186*cdf0e10cSrcweir break; 1187*cdf0e10cSrcweir 1188*cdf0e10cSrcweir case SID_CLIPBOARD_FORMAT_ITEMS: 1189*cdf0e10cSrcweir { 1190*cdf0e10cSrcweir WaitObject aWait( GetViewData()->GetDialogParent() ); 1191*cdf0e10cSrcweir 1192*cdf0e10cSrcweir sal_uLong nFormat = 0; 1193*cdf0e10cSrcweir const SfxPoolItem* pItem; 1194*cdf0e10cSrcweir if ( pReqArgs && 1195*cdf0e10cSrcweir pReqArgs->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET && 1196*cdf0e10cSrcweir pItem->ISA(SfxUInt32Item) ) 1197*cdf0e10cSrcweir { 1198*cdf0e10cSrcweir nFormat = ((const SfxUInt32Item*)pItem)->GetValue(); 1199*cdf0e10cSrcweir } 1200*cdf0e10cSrcweir 1201*cdf0e10cSrcweir if ( nFormat ) 1202*cdf0e10cSrcweir { 1203*cdf0e10cSrcweir Window* pWin = GetViewData()->GetActiveWin(); 1204*cdf0e10cSrcweir sal_Bool bCells = ( ScTransferObj::GetOwnClipboard( pWin ) != NULL ); 1205*cdf0e10cSrcweir sal_Bool bDraw = ( ScDrawTransferObj::GetOwnClipboard( pWin ) != NULL ); 1206*cdf0e10cSrcweir sal_Bool bOle = ( nFormat == SOT_FORMATSTR_ID_EMBED_SOURCE ); 1207*cdf0e10cSrcweir 1208*cdf0e10cSrcweir if ( bCells && bOle ) 1209*cdf0e10cSrcweir pTabViewShell->PasteFromSystem(); 1210*cdf0e10cSrcweir else if ( bDraw && bOle ) 1211*cdf0e10cSrcweir pTabViewShell->PasteDraw(); 1212*cdf0e10cSrcweir else 1213*cdf0e10cSrcweir pTabViewShell->PasteFromSystem(nFormat); 1214*cdf0e10cSrcweir } 1215*cdf0e10cSrcweir //?else 1216*cdf0e10cSrcweir //? pTabViewShell->PasteFromSystem(); 1217*cdf0e10cSrcweir 1218*cdf0e10cSrcweir rReq.Done(); 1219*cdf0e10cSrcweir } 1220*cdf0e10cSrcweir pTabViewShell->CellContentChanged(); 1221*cdf0e10cSrcweir break; 1222*cdf0e10cSrcweir 1223*cdf0e10cSrcweir case FID_INS_CELL_CONTENTS: 1224*cdf0e10cSrcweir { 1225*cdf0e10cSrcweir sal_uInt16 nFlags = IDF_NONE; 1226*cdf0e10cSrcweir sal_uInt16 nFunction = PASTE_NOFUNC; 1227*cdf0e10cSrcweir sal_Bool bSkipEmpty = sal_False; 1228*cdf0e10cSrcweir sal_Bool bTranspose = sal_False; 1229*cdf0e10cSrcweir sal_Bool bAsLink = sal_False; 1230*cdf0e10cSrcweir InsCellCmd eMoveMode = INS_NONE; 1231*cdf0e10cSrcweir 1232*cdf0e10cSrcweir Window* pWin = GetViewData()->GetActiveWin(); 1233*cdf0e10cSrcweir ScDocument* pDoc = GetViewData()->GetDocument(); 1234*cdf0e10cSrcweir sal_Bool bOtherDoc = !pDoc->IsClipboardSource(); 1235*cdf0e10cSrcweir ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin ); 1236*cdf0e10cSrcweir if ( pOwnClip ) 1237*cdf0e10cSrcweir { 1238*cdf0e10cSrcweir // #129384# keep a reference in case the clipboard is changed during dialog or PasteFromClip 1239*cdf0e10cSrcweir uno::Reference<datatransfer::XTransferable> aOwnClipRef( pOwnClip ); 1240*cdf0e10cSrcweir if ( pReqArgs!=NULL && pTabViewShell->SelectionEditable() ) 1241*cdf0e10cSrcweir { 1242*cdf0e10cSrcweir const SfxPoolItem* pItem; 1243*cdf0e10cSrcweir String aFlags = 'A'; 1244*cdf0e10cSrcweir 1245*cdf0e10cSrcweir if( IS_AVAILABLE( FID_INS_CELL_CONTENTS, &pItem ) ) 1246*cdf0e10cSrcweir aFlags = ((const SfxStringItem*)pItem)->GetValue(); 1247*cdf0e10cSrcweir 1248*cdf0e10cSrcweir aFlags.ToUpperAscii(); 1249*cdf0e10cSrcweir sal_Bool bCont = sal_True; 1250*cdf0e10cSrcweir 1251*cdf0e10cSrcweir for( xub_StrLen i=0 ; bCont && i<aFlags.Len() ; i++ ) 1252*cdf0e10cSrcweir { 1253*cdf0e10cSrcweir switch( aFlags.GetChar(i) ) 1254*cdf0e10cSrcweir { 1255*cdf0e10cSrcweir case 'A': // Alle 1256*cdf0e10cSrcweir nFlags |= IDF_ALL; 1257*cdf0e10cSrcweir bCont = sal_False; // nicht mehr weitermachen! 1258*cdf0e10cSrcweir break; 1259*cdf0e10cSrcweir case 'S': nFlags |= IDF_STRING; break; 1260*cdf0e10cSrcweir case 'V': nFlags |= IDF_VALUE; break; 1261*cdf0e10cSrcweir case 'D': nFlags |= IDF_DATETIME; break; 1262*cdf0e10cSrcweir case 'F': nFlags |= IDF_FORMULA; break; 1263*cdf0e10cSrcweir case 'N': nFlags |= IDF_NOTE; break; 1264*cdf0e10cSrcweir case 'T': nFlags |= IDF_ATTRIB; break; 1265*cdf0e10cSrcweir } 1266*cdf0e10cSrcweir } 1267*cdf0e10cSrcweir 1268*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pFuncItem, SfxUInt16Item, FN_PARAM_1, sal_False ); 1269*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pSkipItem, SfxBoolItem, FN_PARAM_2, sal_False ); 1270*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pTransposeItem, SfxBoolItem, FN_PARAM_3, sal_False ); 1271*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pLinkItem, SfxBoolItem, FN_PARAM_4, sal_False ); 1272*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pMoveItem, SfxInt16Item, FN_PARAM_5, sal_False ); 1273*cdf0e10cSrcweir if ( pFuncItem ) 1274*cdf0e10cSrcweir nFunction = pFuncItem->GetValue(); 1275*cdf0e10cSrcweir if ( pSkipItem ) 1276*cdf0e10cSrcweir bSkipEmpty = pSkipItem->GetValue(); 1277*cdf0e10cSrcweir if ( pTransposeItem ) 1278*cdf0e10cSrcweir bTranspose = pTransposeItem->GetValue(); 1279*cdf0e10cSrcweir if ( pLinkItem ) 1280*cdf0e10cSrcweir bAsLink = pLinkItem->GetValue(); 1281*cdf0e10cSrcweir if ( pMoveItem ) 1282*cdf0e10cSrcweir eMoveMode = (InsCellCmd) pMoveItem->GetValue(); 1283*cdf0e10cSrcweir } 1284*cdf0e10cSrcweir else 1285*cdf0e10cSrcweir { 1286*cdf0e10cSrcweir ScEditableTester aTester( pTabViewShell ); 1287*cdf0e10cSrcweir if (aTester.IsEditable()) 1288*cdf0e10cSrcweir { 1289*cdf0e10cSrcweir //CHINA001 ScInsertContentsDlg* pDlg = new ScInsertContentsDlg( pTabViewShell->GetDialogParent() ); 1290*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 1291*cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 1292*cdf0e10cSrcweir 1293*cdf0e10cSrcweir AbstractScInsertContentsDlg* pDlg = pFact->CreateScInsertContentsDlg( pTabViewShell->GetDialogParent(), 1294*cdf0e10cSrcweir RID_SCDLG_INSCONT); 1295*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 1296*cdf0e10cSrcweir pDlg->SetOtherDoc( bOtherDoc ); 1297*cdf0e10cSrcweir // #53661# bei ChangeTrack MoveMode disablen 1298*cdf0e10cSrcweir pDlg->SetChangeTrack( pDoc->GetChangeTrack() != NULL ); 1299*cdf0e10cSrcweir // #72930# cut/move references may disable shift 1300*cdf0e10cSrcweir // directions if source and destination ranges intersect 1301*cdf0e10cSrcweir if ( !bOtherDoc ) 1302*cdf0e10cSrcweir { 1303*cdf0e10cSrcweir if ( pOwnClip && pOwnClip->GetDocument()->IsCutMode() ) 1304*cdf0e10cSrcweir { 1305*cdf0e10cSrcweir ScViewData* pData = GetViewData(); 1306*cdf0e10cSrcweir if ( pData->GetMarkData().GetTableSelect( 1307*cdf0e10cSrcweir pData->GetTabNo() ) ) 1308*cdf0e10cSrcweir { 1309*cdf0e10cSrcweir SCCOL nPosX = pData->GetCurX(); 1310*cdf0e10cSrcweir SCROW nPosY = pData->GetCurY(); 1311*cdf0e10cSrcweir SCCOL nClipStartX, nClipSizeX; 1312*cdf0e10cSrcweir SCROW nClipStartY, nClipSizeY; 1313*cdf0e10cSrcweir pOwnClip->GetDocument()->GetClipStart( nClipStartX, nClipStartY ); 1314*cdf0e10cSrcweir // for CutMode, filtered rows can always be included 1315*cdf0e10cSrcweir pOwnClip->GetDocument()->GetClipArea( nClipSizeX, nClipSizeY, sal_True ); 1316*cdf0e10cSrcweir int nDisableShift = 0; 1317*cdf0e10cSrcweir if ( nClipStartX <= nPosX + nClipSizeX && 1318*cdf0e10cSrcweir nPosX <= nClipStartX + nClipSizeX ) 1319*cdf0e10cSrcweir nDisableShift |= SC_CELL_SHIFT_DISABLE_DOWN; 1320*cdf0e10cSrcweir if ( nClipStartY <= nPosY + nClipSizeY && 1321*cdf0e10cSrcweir nPosY <= nClipStartY + nClipSizeY ) 1322*cdf0e10cSrcweir nDisableShift |= SC_CELL_SHIFT_DISABLE_RIGHT; 1323*cdf0e10cSrcweir if ( nDisableShift ) 1324*cdf0e10cSrcweir pDlg->SetCellShiftDisabled( nDisableShift ); 1325*cdf0e10cSrcweir } 1326*cdf0e10cSrcweir } 1327*cdf0e10cSrcweir } 1328*cdf0e10cSrcweir if (pDlg->Execute() == RET_OK) 1329*cdf0e10cSrcweir { 1330*cdf0e10cSrcweir nFlags = pDlg->GetInsContentsCmdBits(); 1331*cdf0e10cSrcweir nFunction = pDlg->GetFormulaCmdBits(); 1332*cdf0e10cSrcweir bSkipEmpty = pDlg->IsSkipEmptyCells(); 1333*cdf0e10cSrcweir bTranspose = pDlg->IsTranspose(); 1334*cdf0e10cSrcweir bAsLink = pDlg->IsLink(); 1335*cdf0e10cSrcweir eMoveMode = pDlg->GetMoveMode(); 1336*cdf0e10cSrcweir } 1337*cdf0e10cSrcweir delete pDlg; 1338*cdf0e10cSrcweir } 1339*cdf0e10cSrcweir else 1340*cdf0e10cSrcweir pTabViewShell->ErrorMessage(aTester.GetMessageId()); 1341*cdf0e10cSrcweir } 1342*cdf0e10cSrcweir 1343*cdf0e10cSrcweir if( nFlags != IDF_NONE ) 1344*cdf0e10cSrcweir { 1345*cdf0e10cSrcweir { 1346*cdf0e10cSrcweir WaitObject aWait( GetViewData()->GetDialogParent() ); 1347*cdf0e10cSrcweir if ( bAsLink && bOtherDoc ) 1348*cdf0e10cSrcweir pTabViewShell->PasteFromSystem(SOT_FORMATSTR_ID_LINK); // DDE einfuegen 1349*cdf0e10cSrcweir else 1350*cdf0e10cSrcweir pTabViewShell->PasteFromClip( nFlags, pOwnClip->GetDocument(), 1351*cdf0e10cSrcweir nFunction, bSkipEmpty, bTranspose, bAsLink, 1352*cdf0e10cSrcweir eMoveMode, IDF_NONE, sal_True ); // allow warning dialog 1353*cdf0e10cSrcweir } 1354*cdf0e10cSrcweir 1355*cdf0e10cSrcweir if( !pReqArgs ) 1356*cdf0e10cSrcweir { 1357*cdf0e10cSrcweir String aFlags; 1358*cdf0e10cSrcweir 1359*cdf0e10cSrcweir if( nFlags == IDF_ALL ) 1360*cdf0e10cSrcweir { 1361*cdf0e10cSrcweir aFlags += 'A'; 1362*cdf0e10cSrcweir } 1363*cdf0e10cSrcweir else 1364*cdf0e10cSrcweir { 1365*cdf0e10cSrcweir if( nFlags & IDF_STRING ) aFlags += 'S'; 1366*cdf0e10cSrcweir if( nFlags & IDF_VALUE ) aFlags += 'V'; 1367*cdf0e10cSrcweir if( nFlags & IDF_DATETIME ) aFlags += 'D'; 1368*cdf0e10cSrcweir if( nFlags & IDF_FORMULA ) aFlags += 'F'; 1369*cdf0e10cSrcweir if( nFlags & IDF_NOTE ) aFlags += 'N'; 1370*cdf0e10cSrcweir if( nFlags & IDF_ATTRIB ) aFlags += 'T'; 1371*cdf0e10cSrcweir } 1372*cdf0e10cSrcweir 1373*cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( FID_INS_CELL_CONTENTS, aFlags ) ); 1374*cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( FN_PARAM_2, bSkipEmpty ) ); 1375*cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( FN_PARAM_3, bTranspose ) ); 1376*cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( FN_PARAM_4, bAsLink ) ); 1377*cdf0e10cSrcweir rReq.AppendItem( SfxUInt16Item( FN_PARAM_1, nFunction ) ); 1378*cdf0e10cSrcweir rReq.AppendItem( SfxInt16Item( FN_PARAM_5, (sal_Int16) eMoveMode ) ); 1379*cdf0e10cSrcweir rReq.Done(); 1380*cdf0e10cSrcweir } 1381*cdf0e10cSrcweir } 1382*cdf0e10cSrcweir } 1383*cdf0e10cSrcweir } 1384*cdf0e10cSrcweir pTabViewShell->CellContentChanged(); // => PasteFromXXX ??? 1385*cdf0e10cSrcweir break; 1386*cdf0e10cSrcweir 1387*cdf0e10cSrcweir case SID_PASTE_SPECIAL: 1388*cdf0e10cSrcweir // Unterscheidung, ob eigene oder fremde Daten, 1389*cdf0e10cSrcweir // dadurch FID_INS_CELL_CONTENTS ueberfluessig 1390*cdf0e10cSrcweir { 1391*cdf0e10cSrcweir Window* pWin = GetViewData()->GetActiveWin(); 1392*cdf0e10cSrcweir 1393*cdf0e10cSrcweir // Clipboard-ID als Parameter angegeben? Basic "PasteSpecial(Format)" 1394*cdf0e10cSrcweir const SfxPoolItem* pItem=NULL; 1395*cdf0e10cSrcweir if ( pReqArgs && 1396*cdf0e10cSrcweir pReqArgs->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET && 1397*cdf0e10cSrcweir pItem->ISA(SfxUInt32Item) ) 1398*cdf0e10cSrcweir { 1399*cdf0e10cSrcweir sal_uLong nFormat = ((const SfxUInt32Item*)pItem)->GetValue(); 1400*cdf0e10cSrcweir sal_Bool bRet=sal_True; 1401*cdf0e10cSrcweir { 1402*cdf0e10cSrcweir WaitObject aWait( GetViewData()->GetDialogParent() ); 1403*cdf0e10cSrcweir sal_Bool bDraw = ( ScDrawTransferObj::GetOwnClipboard( pWin ) != NULL ); 1404*cdf0e10cSrcweir if ( bDraw && nFormat == SOT_FORMATSTR_ID_EMBED_SOURCE ) 1405*cdf0e10cSrcweir pTabViewShell->PasteDraw(); 1406*cdf0e10cSrcweir else 1407*cdf0e10cSrcweir bRet = pTabViewShell->PasteFromSystem(nFormat, sal_True); // TRUE: keine Fehlermeldungen 1408*cdf0e10cSrcweir } 1409*cdf0e10cSrcweir 1410*cdf0e10cSrcweir if ( bRet ) 1411*cdf0e10cSrcweir { 1412*cdf0e10cSrcweir rReq.SetReturnValue(SfxInt16Item(nSlot, bRet)); // 1 = Erfolg, 0 = Fehler 1413*cdf0e10cSrcweir rReq.Done(); 1414*cdf0e10cSrcweir } 1415*cdf0e10cSrcweir else 1416*cdf0e10cSrcweir // if format is not available -> fallback to request without parameters 1417*cdf0e10cSrcweir pItem = NULL; 1418*cdf0e10cSrcweir } 1419*cdf0e10cSrcweir 1420*cdf0e10cSrcweir if ( !pItem ) 1421*cdf0e10cSrcweir { 1422*cdf0e10cSrcweir if ( ScTransferObj::GetOwnClipboard( pWin ) ) // own cell data 1423*cdf0e10cSrcweir { 1424*cdf0e10cSrcweir rReq.SetSlot( FID_INS_CELL_CONTENTS ); 1425*cdf0e10cSrcweir ExecuteSlot( rReq, GetInterface() ); 1426*cdf0e10cSrcweir rReq.SetReturnValue(SfxInt16Item(nSlot, 1)); // 1 = Erfolg 1427*cdf0e10cSrcweir } 1428*cdf0e10cSrcweir else // Zeichenobjekte oder fremde Daten 1429*cdf0e10cSrcweir { 1430*cdf0e10cSrcweir sal_Bool bDraw = ( ScDrawTransferObj::GetOwnClipboard( pWin ) != NULL ); 1431*cdf0e10cSrcweir 1432*cdf0e10cSrcweir SvxClipboardFmtItem aFormats( SID_CLIPBOARD_FORMAT_ITEMS ); 1433*cdf0e10cSrcweir GetPossibleClipboardFormats( aFormats ); 1434*cdf0e10cSrcweir 1435*cdf0e10cSrcweir sal_uInt16 nFormatCount = aFormats.Count(); 1436*cdf0e10cSrcweir if ( nFormatCount ) 1437*cdf0e10cSrcweir { 1438*cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 1439*cdf0e10cSrcweir SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( pTabViewShell->GetDialogParent() ); 1440*cdf0e10cSrcweir if ( pDlg ) 1441*cdf0e10cSrcweir { 1442*cdf0e10cSrcweir for (sal_uInt16 i=0; i<nFormatCount; i++) 1443*cdf0e10cSrcweir { 1444*cdf0e10cSrcweir sal_uLong nFormatId = aFormats.GetClipbrdFormatId( i ); 1445*cdf0e10cSrcweir String aName = aFormats.GetClipbrdFormatName( i ); 1446*cdf0e10cSrcweir // special case for paste dialog: '*' is replaced by object type 1447*cdf0e10cSrcweir if ( nFormatId == SOT_FORMATSTR_ID_EMBED_SOURCE ) 1448*cdf0e10cSrcweir aName.Assign((sal_Unicode)'*'); 1449*cdf0e10cSrcweir pDlg->Insert( nFormatId, aName ); 1450*cdf0e10cSrcweir } 1451*cdf0e10cSrcweir 1452*cdf0e10cSrcweir TransferableDataHelper aDataHelper( 1453*cdf0e10cSrcweir TransferableDataHelper::CreateFromSystemClipboard( pWin ) ); 1454*cdf0e10cSrcweir sal_uLong nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() ); 1455*cdf0e10cSrcweir if (nFormat > 0) 1456*cdf0e10cSrcweir { 1457*cdf0e10cSrcweir { 1458*cdf0e10cSrcweir WaitObject aWait( GetViewData()->GetDialogParent() ); 1459*cdf0e10cSrcweir if ( bDraw && nFormat == SOT_FORMATSTR_ID_EMBED_SOURCE ) 1460*cdf0e10cSrcweir pTabViewShell->PasteDraw(); 1461*cdf0e10cSrcweir else 1462*cdf0e10cSrcweir pTabViewShell->PasteFromSystem(nFormat); 1463*cdf0e10cSrcweir } 1464*cdf0e10cSrcweir rReq.SetReturnValue(SfxInt16Item(nSlot, 1)); // 1 = Erfolg 1465*cdf0e10cSrcweir rReq.AppendItem( SfxUInt32Item( nSlot, nFormat ) ); 1466*cdf0e10cSrcweir rReq.Done(); 1467*cdf0e10cSrcweir } 1468*cdf0e10cSrcweir else 1469*cdf0e10cSrcweir { 1470*cdf0e10cSrcweir rReq.SetReturnValue(SfxInt16Item(nSlot, 0)); // 0 = Fehler 1471*cdf0e10cSrcweir rReq.Ignore(); 1472*cdf0e10cSrcweir } 1473*cdf0e10cSrcweir 1474*cdf0e10cSrcweir delete pDlg; 1475*cdf0e10cSrcweir } 1476*cdf0e10cSrcweir } 1477*cdf0e10cSrcweir else 1478*cdf0e10cSrcweir rReq.SetReturnValue(SfxInt16Item(nSlot, 0)); // 0 = Fehler 1479*cdf0e10cSrcweir } 1480*cdf0e10cSrcweir } 1481*cdf0e10cSrcweir } 1482*cdf0e10cSrcweir pTabViewShell->CellContentChanged(); // => PasteFromSystem() ??? 1483*cdf0e10cSrcweir break; 1484*cdf0e10cSrcweir 1485*cdf0e10cSrcweir // 1486*cdf0e10cSrcweir // sonstiges 1487*cdf0e10cSrcweir // 1488*cdf0e10cSrcweir 1489*cdf0e10cSrcweir case FID_INS_ROWBRK: 1490*cdf0e10cSrcweir pTabViewShell->InsertPageBreak( sal_False ); 1491*cdf0e10cSrcweir rReq.Done(); 1492*cdf0e10cSrcweir break; 1493*cdf0e10cSrcweir 1494*cdf0e10cSrcweir case FID_INS_COLBRK: 1495*cdf0e10cSrcweir pTabViewShell->InsertPageBreak( sal_True ); 1496*cdf0e10cSrcweir rReq.Done(); 1497*cdf0e10cSrcweir break; 1498*cdf0e10cSrcweir 1499*cdf0e10cSrcweir case FID_DEL_ROWBRK: 1500*cdf0e10cSrcweir pTabViewShell->DeletePageBreak( sal_False ); 1501*cdf0e10cSrcweir rReq.Done(); 1502*cdf0e10cSrcweir break; 1503*cdf0e10cSrcweir 1504*cdf0e10cSrcweir case FID_DEL_COLBRK: 1505*cdf0e10cSrcweir pTabViewShell->DeletePageBreak( sal_True ); 1506*cdf0e10cSrcweir rReq.Done(); 1507*cdf0e10cSrcweir break; 1508*cdf0e10cSrcweir 1509*cdf0e10cSrcweir case SID_DETECTIVE_ADD_PRED: 1510*cdf0e10cSrcweir pTabViewShell->DetectiveAddPred(); 1511*cdf0e10cSrcweir rReq.Done(); 1512*cdf0e10cSrcweir break; 1513*cdf0e10cSrcweir 1514*cdf0e10cSrcweir case SID_DETECTIVE_DEL_PRED: 1515*cdf0e10cSrcweir pTabViewShell->DetectiveDelPred(); 1516*cdf0e10cSrcweir rReq.Done(); 1517*cdf0e10cSrcweir break; 1518*cdf0e10cSrcweir 1519*cdf0e10cSrcweir case SID_DETECTIVE_ADD_SUCC: 1520*cdf0e10cSrcweir pTabViewShell->DetectiveAddSucc(); 1521*cdf0e10cSrcweir rReq.Done(); 1522*cdf0e10cSrcweir break; 1523*cdf0e10cSrcweir 1524*cdf0e10cSrcweir case SID_DETECTIVE_DEL_SUCC: 1525*cdf0e10cSrcweir pTabViewShell->DetectiveDelSucc(); 1526*cdf0e10cSrcweir rReq.Done(); 1527*cdf0e10cSrcweir break; 1528*cdf0e10cSrcweir 1529*cdf0e10cSrcweir case SID_DETECTIVE_ADD_ERR: 1530*cdf0e10cSrcweir pTabViewShell->DetectiveAddError(); 1531*cdf0e10cSrcweir rReq.Done(); 1532*cdf0e10cSrcweir break; 1533*cdf0e10cSrcweir 1534*cdf0e10cSrcweir case SID_DETECTIVE_INVALID: 1535*cdf0e10cSrcweir pTabViewShell->DetectiveMarkInvalid(); 1536*cdf0e10cSrcweir rReq.Done(); 1537*cdf0e10cSrcweir break; 1538*cdf0e10cSrcweir 1539*cdf0e10cSrcweir case SID_DETECTIVE_REFRESH: 1540*cdf0e10cSrcweir pTabViewShell->DetectiveRefresh(); 1541*cdf0e10cSrcweir rReq.Done(); 1542*cdf0e10cSrcweir break; 1543*cdf0e10cSrcweir 1544*cdf0e10cSrcweir case SID_SPELL_DIALOG: 1545*cdf0e10cSrcweir // pTabViewShell->DoSpellingChecker(); 1546*cdf0e10cSrcweir { 1547*cdf0e10cSrcweir SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame(); 1548*cdf0e10cSrcweir if( rReq.GetArgs() ) 1549*cdf0e10cSrcweir pViewFrame->SetChildWindow( SID_SPELL_DIALOG, 1550*cdf0e10cSrcweir static_cast< const SfxBoolItem& >( rReq.GetArgs()-> 1551*cdf0e10cSrcweir Get( SID_SPELL_DIALOG ) ).GetValue() ); 1552*cdf0e10cSrcweir else 1553*cdf0e10cSrcweir pViewFrame->ToggleChildWindow( SID_SPELL_DIALOG ); 1554*cdf0e10cSrcweir 1555*cdf0e10cSrcweir pViewFrame->GetBindings().Invalidate( SID_SPELL_DIALOG ); 1556*cdf0e10cSrcweir rReq.Ignore(); 1557*cdf0e10cSrcweir } 1558*cdf0e10cSrcweir break; 1559*cdf0e10cSrcweir 1560*cdf0e10cSrcweir case SID_HANGUL_HANJA_CONVERSION: 1561*cdf0e10cSrcweir pTabViewShell->DoHangulHanjaConversion(); 1562*cdf0e10cSrcweir break; 1563*cdf0e10cSrcweir 1564*cdf0e10cSrcweir case SID_CHINESE_CONVERSION: 1565*cdf0e10cSrcweir { 1566*cdf0e10cSrcweir //open ChineseTranslationDialog 1567*cdf0e10cSrcweir Reference< XComponentContext > xContext( 1568*cdf0e10cSrcweir ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one 1569*cdf0e10cSrcweir if(xContext.is()) 1570*cdf0e10cSrcweir { 1571*cdf0e10cSrcweir Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() ); 1572*cdf0e10cSrcweir if(xMCF.is()) 1573*cdf0e10cSrcweir { 1574*cdf0e10cSrcweir Reference< ui::dialogs::XExecutableDialog > xDialog( 1575*cdf0e10cSrcweir xMCF->createInstanceWithContext( 1576*cdf0e10cSrcweir rtl::OUString::createFromAscii("com.sun.star.linguistic2.ChineseTranslationDialog") 1577*cdf0e10cSrcweir , xContext), UNO_QUERY); 1578*cdf0e10cSrcweir Reference< lang::XInitialization > xInit( xDialog, UNO_QUERY ); 1579*cdf0e10cSrcweir if( xInit.is() ) 1580*cdf0e10cSrcweir { 1581*cdf0e10cSrcweir // initialize dialog 1582*cdf0e10cSrcweir Reference< awt::XWindow > xDialogParentWindow(0); 1583*cdf0e10cSrcweir Sequence<Any> aSeq(1); 1584*cdf0e10cSrcweir Any* pArray = aSeq.getArray(); 1585*cdf0e10cSrcweir PropertyValue aParam; 1586*cdf0e10cSrcweir aParam.Name = rtl::OUString::createFromAscii("ParentWindow"); 1587*cdf0e10cSrcweir aParam.Value <<= makeAny(xDialogParentWindow); 1588*cdf0e10cSrcweir pArray[0] <<= makeAny(aParam); 1589*cdf0e10cSrcweir xInit->initialize( aSeq ); 1590*cdf0e10cSrcweir 1591*cdf0e10cSrcweir //execute dialog 1592*cdf0e10cSrcweir sal_Int16 nDialogRet = xDialog->execute(); 1593*cdf0e10cSrcweir if( RET_OK == nDialogRet ) 1594*cdf0e10cSrcweir { 1595*cdf0e10cSrcweir //get some parameters from the dialog 1596*cdf0e10cSrcweir sal_Bool bToSimplified = sal_True; 1597*cdf0e10cSrcweir sal_Bool bUseVariants = sal_True; 1598*cdf0e10cSrcweir sal_Bool bCommonTerms = sal_True; 1599*cdf0e10cSrcweir Reference< beans::XPropertySet > xProp( xDialog, UNO_QUERY ); 1600*cdf0e10cSrcweir if( xProp.is() ) 1601*cdf0e10cSrcweir { 1602*cdf0e10cSrcweir try 1603*cdf0e10cSrcweir { 1604*cdf0e10cSrcweir xProp->getPropertyValue( C2U("IsDirectionToSimplified") ) >>= bToSimplified; 1605*cdf0e10cSrcweir xProp->getPropertyValue( C2U("IsUseCharacterVariants") ) >>= bUseVariants; 1606*cdf0e10cSrcweir xProp->getPropertyValue( C2U("IsTranslateCommonTerms") ) >>= bCommonTerms; 1607*cdf0e10cSrcweir } 1608*cdf0e10cSrcweir catch( Exception& ) 1609*cdf0e10cSrcweir { 1610*cdf0e10cSrcweir } 1611*cdf0e10cSrcweir } 1612*cdf0e10cSrcweir 1613*cdf0e10cSrcweir //execute translation 1614*cdf0e10cSrcweir LanguageType eSourceLang = bToSimplified ? LANGUAGE_CHINESE_TRADITIONAL : LANGUAGE_CHINESE_SIMPLIFIED; 1615*cdf0e10cSrcweir LanguageType eTargetLang = bToSimplified ? LANGUAGE_CHINESE_SIMPLIFIED : LANGUAGE_CHINESE_TRADITIONAL; 1616*cdf0e10cSrcweir sal_Int32 nOptions = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0; 1617*cdf0e10cSrcweir if( !bCommonTerms ) 1618*cdf0e10cSrcweir nOptions |= i18n::TextConversionOption::CHARACTER_BY_CHARACTER; 1619*cdf0e10cSrcweir 1620*cdf0e10cSrcweir Font aTargetFont = GetViewData()->GetActiveWin()->GetDefaultFont( 1621*cdf0e10cSrcweir DEFAULTFONT_CJK_SPREADSHEET, 1622*cdf0e10cSrcweir eTargetLang, DEFAULTFONT_FLAGS_ONLYONE ); 1623*cdf0e10cSrcweir ScConversionParam aConvParam( SC_CONVERSION_CHINESE_TRANSL, 1624*cdf0e10cSrcweir eSourceLang, eTargetLang, aTargetFont, nOptions, false ); 1625*cdf0e10cSrcweir pTabViewShell->DoSheetConversion( aConvParam ); 1626*cdf0e10cSrcweir } 1627*cdf0e10cSrcweir } 1628*cdf0e10cSrcweir Reference< lang::XComponent > xComponent( xDialog, UNO_QUERY ); 1629*cdf0e10cSrcweir if( xComponent.is() ) 1630*cdf0e10cSrcweir xComponent->dispose(); 1631*cdf0e10cSrcweir } 1632*cdf0e10cSrcweir } 1633*cdf0e10cSrcweir } 1634*cdf0e10cSrcweir break; 1635*cdf0e10cSrcweir 1636*cdf0e10cSrcweir case SID_THESAURUS: 1637*cdf0e10cSrcweir pTabViewShell->DoThesaurus(); 1638*cdf0e10cSrcweir break; 1639*cdf0e10cSrcweir 1640*cdf0e10cSrcweir case SID_TOGGLE_REL: 1641*cdf0e10cSrcweir pTabViewShell->DoRefConversion(); 1642*cdf0e10cSrcweir break; 1643*cdf0e10cSrcweir 1644*cdf0e10cSrcweir case SID_DEC_INDENT: 1645*cdf0e10cSrcweir pTabViewShell->ChangeIndent( sal_False ); 1646*cdf0e10cSrcweir break; 1647*cdf0e10cSrcweir case SID_INC_INDENT: 1648*cdf0e10cSrcweir pTabViewShell->ChangeIndent( sal_True ); 1649*cdf0e10cSrcweir break; 1650*cdf0e10cSrcweir 1651*cdf0e10cSrcweir case FID_USE_NAME: 1652*cdf0e10cSrcweir { 1653*cdf0e10cSrcweir sal_uInt16 nFlags = pTabViewShell->GetCreateNameFlags(); 1654*cdf0e10cSrcweir 1655*cdf0e10cSrcweir //CHINA001 ScNameCreateDlg* pDlg = new ScNameCreateDlg( pTabViewShell->GetDialogParent(), nFlags ); 1656*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 1657*cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 1658*cdf0e10cSrcweir 1659*cdf0e10cSrcweir AbstractScNameCreateDlg* pDlg = pFact->CreateScNameCreateDlg(pTabViewShell->GetDialogParent(), nFlags, RID_SCDLG_NAMES_CREATE ); 1660*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 1661*cdf0e10cSrcweir 1662*cdf0e10cSrcweir if( pDlg->Execute() ) 1663*cdf0e10cSrcweir { 1664*cdf0e10cSrcweir nFlags = pDlg->GetFlags(); 1665*cdf0e10cSrcweir pTabViewShell->CreateNames(nFlags); 1666*cdf0e10cSrcweir rReq.Done(); 1667*cdf0e10cSrcweir } 1668*cdf0e10cSrcweir delete pDlg; 1669*cdf0e10cSrcweir } 1670*cdf0e10cSrcweir break; 1671*cdf0e10cSrcweir 1672*cdf0e10cSrcweir case SID_CONSOLIDATE: 1673*cdf0e10cSrcweir { 1674*cdf0e10cSrcweir const SfxPoolItem* pItem; 1675*cdf0e10cSrcweir if ( pReqArgs && SFX_ITEM_SET == 1676*cdf0e10cSrcweir pReqArgs->GetItemState( SCITEM_CONSOLIDATEDATA, sal_True, &pItem ) ) 1677*cdf0e10cSrcweir { 1678*cdf0e10cSrcweir const ScConsolidateParam& rParam = 1679*cdf0e10cSrcweir ((const ScConsolidateItem*)pItem)->GetData(); 1680*cdf0e10cSrcweir 1681*cdf0e10cSrcweir pTabViewShell->Consolidate( rParam ); 1682*cdf0e10cSrcweir GetViewData()->GetDocument()->SetConsolidateDlgData( &rParam ); 1683*cdf0e10cSrcweir 1684*cdf0e10cSrcweir rReq.Done(); 1685*cdf0e10cSrcweir } 1686*cdf0e10cSrcweir else if (rReq.IsAPI()) 1687*cdf0e10cSrcweir SbxBase::SetError(SbxERR_BAD_PARAMETER); 1688*cdf0e10cSrcweir } 1689*cdf0e10cSrcweir break; 1690*cdf0e10cSrcweir 1691*cdf0e10cSrcweir case SID_INS_FUNCTION: 1692*cdf0e10cSrcweir { 1693*cdf0e10cSrcweir const SfxBoolItem* pOkItem = (const SfxBoolItem*)&pReqArgs->Get( SID_DLG_RETOK ); 1694*cdf0e10cSrcweir 1695*cdf0e10cSrcweir // pScMod->SetFunctionDlg( NULL ); 1696*cdf0e10cSrcweir 1697*cdf0e10cSrcweir if ( pOkItem->GetValue() ) // OK 1698*cdf0e10cSrcweir { 1699*cdf0e10cSrcweir String aFormula; 1700*cdf0e10cSrcweir const SfxStringItem* pSItem = (const SfxStringItem*)&pReqArgs->Get( SCITEM_STRING ); 1701*cdf0e10cSrcweir const SfxBoolItem* pMatrixItem = (const SfxBoolItem*) &pReqArgs->Get( SID_DLG_MATRIX ); 1702*cdf0e10cSrcweir 1703*cdf0e10cSrcweir aFormula += pSItem->GetValue(); 1704*cdf0e10cSrcweir pScMod->ActivateInputWindow( &aFormula, pMatrixItem->GetValue() ); 1705*cdf0e10cSrcweir } 1706*cdf0e10cSrcweir else // CANCEL 1707*cdf0e10cSrcweir { 1708*cdf0e10cSrcweir pScMod->ActivateInputWindow( NULL ); 1709*cdf0e10cSrcweir } 1710*cdf0e10cSrcweir rReq.Ignore(); // only SID_ENTER_STRING is recorded 1711*cdf0e10cSrcweir } 1712*cdf0e10cSrcweir break; 1713*cdf0e10cSrcweir 1714*cdf0e10cSrcweir case FID_DEFINE_NAME: 1715*cdf0e10cSrcweir if ( pReqArgs ) 1716*cdf0e10cSrcweir { 1717*cdf0e10cSrcweir const SfxPoolItem* pItem; 1718*cdf0e10cSrcweir String aName, aSymbol, aAttrib; 1719*cdf0e10cSrcweir 1720*cdf0e10cSrcweir if( IS_AVAILABLE( FID_DEFINE_NAME, &pItem ) ) 1721*cdf0e10cSrcweir aName = ((const SfxStringItem*)pItem)->GetValue(); 1722*cdf0e10cSrcweir 1723*cdf0e10cSrcweir if( IS_AVAILABLE( FN_PARAM_1, &pItem ) ) 1724*cdf0e10cSrcweir aSymbol = ((const SfxStringItem*)pItem)->GetValue(); 1725*cdf0e10cSrcweir 1726*cdf0e10cSrcweir if( IS_AVAILABLE( FN_PARAM_2, &pItem ) ) 1727*cdf0e10cSrcweir aAttrib = ((const SfxStringItem*)pItem)->GetValue(); 1728*cdf0e10cSrcweir 1729*cdf0e10cSrcweir if ( aName.Len() && aSymbol.Len() ) 1730*cdf0e10cSrcweir { 1731*cdf0e10cSrcweir if (pTabViewShell->InsertName( aName, aSymbol, aAttrib )) 1732*cdf0e10cSrcweir rReq.Done(); 1733*cdf0e10cSrcweir else 1734*cdf0e10cSrcweir SbxBase::SetError( SbxERR_BAD_PARAMETER ); // Basic-Fehler 1735*cdf0e10cSrcweir } 1736*cdf0e10cSrcweir } 1737*cdf0e10cSrcweir else 1738*cdf0e10cSrcweir { 1739*cdf0e10cSrcweir sal_uInt16 nId = ScNameDlgWrapper::GetChildWindowId(); 1740*cdf0e10cSrcweir SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame(); 1741*cdf0e10cSrcweir SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId ); 1742*cdf0e10cSrcweir 1743*cdf0e10cSrcweir pScMod->SetRefDialog( nId, pWnd ? sal_False : sal_True ); 1744*cdf0e10cSrcweir } 1745*cdf0e10cSrcweir break; 1746*cdf0e10cSrcweir 1747*cdf0e10cSrcweir case SID_DEFINE_COLROWNAMERANGES: 1748*cdf0e10cSrcweir { 1749*cdf0e10cSrcweir 1750*cdf0e10cSrcweir sal_uInt16 nId = ScColRowNameRangesDlgWrapper::GetChildWindowId(); 1751*cdf0e10cSrcweir SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame(); 1752*cdf0e10cSrcweir SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId ); 1753*cdf0e10cSrcweir 1754*cdf0e10cSrcweir pScMod->SetRefDialog( nId, pWnd ? sal_False : sal_True ); 1755*cdf0e10cSrcweir 1756*cdf0e10cSrcweir } 1757*cdf0e10cSrcweir break; 1758*cdf0e10cSrcweir 1759*cdf0e10cSrcweir case SID_UPDATECHART: 1760*cdf0e10cSrcweir { 1761*cdf0e10cSrcweir sal_Bool bAll = sal_False; 1762*cdf0e10cSrcweir 1763*cdf0e10cSrcweir if( pReqArgs ) 1764*cdf0e10cSrcweir { 1765*cdf0e10cSrcweir const SfxPoolItem* pItem; 1766*cdf0e10cSrcweir 1767*cdf0e10cSrcweir if( IS_AVAILABLE( SID_UPDATECHART, &pItem ) ) 1768*cdf0e10cSrcweir bAll = ((const SfxBoolItem*)pItem)->GetValue(); 1769*cdf0e10cSrcweir } 1770*cdf0e10cSrcweir 1771*cdf0e10cSrcweir pTabViewShell->UpdateCharts( bAll ); 1772*cdf0e10cSrcweir 1773*cdf0e10cSrcweir if( ! rReq.IsAPI() ) 1774*cdf0e10cSrcweir { 1775*cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( SID_UPDATECHART, bAll ) ); 1776*cdf0e10cSrcweir rReq.Done(); 1777*cdf0e10cSrcweir } 1778*cdf0e10cSrcweir } 1779*cdf0e10cSrcweir break; 1780*cdf0e10cSrcweir 1781*cdf0e10cSrcweir 1782*cdf0e10cSrcweir case SID_TABOP: 1783*cdf0e10cSrcweir if (pReqArgs) 1784*cdf0e10cSrcweir { 1785*cdf0e10cSrcweir const ScTabOpItem& rItem = 1786*cdf0e10cSrcweir (const ScTabOpItem&) 1787*cdf0e10cSrcweir pReqArgs->Get( SID_TABOP ); 1788*cdf0e10cSrcweir 1789*cdf0e10cSrcweir pTabViewShell->TabOp( rItem.GetData() ); 1790*cdf0e10cSrcweir 1791*cdf0e10cSrcweir rReq.Done( *pReqArgs ); 1792*cdf0e10cSrcweir } 1793*cdf0e10cSrcweir break; 1794*cdf0e10cSrcweir 1795*cdf0e10cSrcweir case SID_SOLVE: 1796*cdf0e10cSrcweir if (pReqArgs) 1797*cdf0e10cSrcweir { 1798*cdf0e10cSrcweir const ScSolveItem& rItem = 1799*cdf0e10cSrcweir (const ScSolveItem&) 1800*cdf0e10cSrcweir pReqArgs->Get( SCITEM_SOLVEDATA ); 1801*cdf0e10cSrcweir 1802*cdf0e10cSrcweir pTabViewShell->Solve( rItem.GetData() ); 1803*cdf0e10cSrcweir 1804*cdf0e10cSrcweir rReq.Done( *pReqArgs ); 1805*cdf0e10cSrcweir } 1806*cdf0e10cSrcweir break; 1807*cdf0e10cSrcweir 1808*cdf0e10cSrcweir case FID_INSERT_NAME: 1809*cdf0e10cSrcweir { 1810*cdf0e10cSrcweir ScDocument* pDoc = GetViewData()->GetDocument(); 1811*cdf0e10cSrcweir //CHINA001 ScNamePasteDlg* pDlg = new ScNamePasteDlg( pTabViewShell->GetDialogParent(), pDoc->GetRangeName() ); 1812*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 1813*cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 1814*cdf0e10cSrcweir 1815*cdf0e10cSrcweir AbstractScNamePasteDlg* pDlg = pFact->CreateScNamePasteDlg( pTabViewShell->GetDialogParent(), pDoc->GetRangeName(), RID_SCDLG_NAMES_PASTE ); 1816*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 1817*cdf0e10cSrcweir switch( pDlg->Execute() ) 1818*cdf0e10cSrcweir { 1819*cdf0e10cSrcweir case BTN_PASTE_LIST: 1820*cdf0e10cSrcweir pTabViewShell->InsertNameList(); 1821*cdf0e10cSrcweir break; 1822*cdf0e10cSrcweir case BTN_PASTE_NAME: 1823*cdf0e10cSrcweir { 1824*cdf0e10cSrcweir ScInputHandler* pHdl = pScMod->GetInputHdl( pTabViewShell ); 1825*cdf0e10cSrcweir if (pHdl) 1826*cdf0e10cSrcweir { 1827*cdf0e10cSrcweir // das "=" per Key-Event, schaltet in den Eingabe-Modus 1828*cdf0e10cSrcweir pScMod->InputKeyEvent( KeyEvent('=',KeyCode()) ); 1829*cdf0e10cSrcweir 1830*cdf0e10cSrcweir String aName = pDlg->GetSelectedName(); 1831*cdf0e10cSrcweir pHdl->InsertFunction( aName, sal_False ); // ohne "()" 1832*cdf0e10cSrcweir } 1833*cdf0e10cSrcweir } 1834*cdf0e10cSrcweir break; 1835*cdf0e10cSrcweir } 1836*cdf0e10cSrcweir delete pDlg; 1837*cdf0e10cSrcweir } 1838*cdf0e10cSrcweir break; 1839*cdf0e10cSrcweir 1840*cdf0e10cSrcweir case SID_RANGE_NOTETEXT: 1841*cdf0e10cSrcweir if (pReqArgs) 1842*cdf0e10cSrcweir { 1843*cdf0e10cSrcweir const SfxStringItem& rTextItem = (const SfxStringItem&)pReqArgs->Get( SID_RANGE_NOTETEXT ); 1844*cdf0e10cSrcweir 1845*cdf0e10cSrcweir // #43343# immer Cursorposition 1846*cdf0e10cSrcweir ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); 1847*cdf0e10cSrcweir pTabViewShell->SetNoteText( aPos, rTextItem.GetValue() ); 1848*cdf0e10cSrcweir rReq.Done(); 1849*cdf0e10cSrcweir } 1850*cdf0e10cSrcweir break; 1851*cdf0e10cSrcweir 1852*cdf0e10cSrcweir case SID_INSERT_POSTIT: 1853*cdf0e10cSrcweir if ( pReqArgs ) 1854*cdf0e10cSrcweir { 1855*cdf0e10cSrcweir const SvxPostItAuthorItem& rAuthorItem = (const SvxPostItAuthorItem&)pReqArgs->Get( SID_ATTR_POSTIT_AUTHOR ); 1856*cdf0e10cSrcweir const SvxPostItDateItem& rDateItem = (const SvxPostItDateItem&) pReqArgs->Get( SID_ATTR_POSTIT_DATE ); 1857*cdf0e10cSrcweir const SvxPostItTextItem& rTextItem = (const SvxPostItTextItem&) pReqArgs->Get( SID_ATTR_POSTIT_TEXT ); 1858*cdf0e10cSrcweir 1859*cdf0e10cSrcweir ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); 1860*cdf0e10cSrcweir pTabViewShell->ReplaceNote( aPos, rTextItem.GetValue(), &rAuthorItem.GetValue(), &rDateItem.GetValue() ); 1861*cdf0e10cSrcweir rReq.Done(); 1862*cdf0e10cSrcweir } 1863*cdf0e10cSrcweir else 1864*cdf0e10cSrcweir { 1865*cdf0e10cSrcweir pTabViewShell->EditNote(); // Zeichenobjekt zum Editieren 1866*cdf0e10cSrcweir } 1867*cdf0e10cSrcweir break; 1868*cdf0e10cSrcweir 1869*cdf0e10cSrcweir case FID_NOTE_VISIBLE: 1870*cdf0e10cSrcweir { 1871*cdf0e10cSrcweir ScDocument* pDoc = GetViewData()->GetDocument(); 1872*cdf0e10cSrcweir ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); 1873*cdf0e10cSrcweir if( ScPostIt* pNote = pDoc->GetNote( aPos ) ) 1874*cdf0e10cSrcweir { 1875*cdf0e10cSrcweir bool bShow; 1876*cdf0e10cSrcweir const SfxPoolItem* pItem; 1877*cdf0e10cSrcweir if ( pReqArgs && (pReqArgs->GetItemState( FID_NOTE_VISIBLE, sal_True, &pItem ) == SFX_ITEM_SET) ) 1878*cdf0e10cSrcweir bShow = ((const SfxBoolItem*) pItem)->GetValue(); 1879*cdf0e10cSrcweir else 1880*cdf0e10cSrcweir bShow = !pNote->IsCaptionShown(); 1881*cdf0e10cSrcweir 1882*cdf0e10cSrcweir pTabViewShell->ShowNote( bShow ); 1883*cdf0e10cSrcweir 1884*cdf0e10cSrcweir if (!pReqArgs) 1885*cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( FID_NOTE_VISIBLE, bShow ) ); 1886*cdf0e10cSrcweir 1887*cdf0e10cSrcweir rReq.Done(); 1888*cdf0e10cSrcweir rBindings.Invalidate( FID_NOTE_VISIBLE ); 1889*cdf0e10cSrcweir } 1890*cdf0e10cSrcweir else 1891*cdf0e10cSrcweir rReq.Ignore(); 1892*cdf0e10cSrcweir } 1893*cdf0e10cSrcweir break; 1894*cdf0e10cSrcweir 1895*cdf0e10cSrcweir case SID_DELETE_NOTE: 1896*cdf0e10cSrcweir pTabViewShell->DeleteContents( IDF_NOTE ); // delete all notes in selection 1897*cdf0e10cSrcweir rReq.Done(); 1898*cdf0e10cSrcweir break; 1899*cdf0e10cSrcweir 1900*cdf0e10cSrcweir case SID_CHARMAP: 1901*cdf0e10cSrcweir if( pReqArgs != NULL ) 1902*cdf0e10cSrcweir { 1903*cdf0e10cSrcweir String aChars, aFontName; 1904*cdf0e10cSrcweir const SfxItemSet *pArgs = rReq.GetArgs(); 1905*cdf0e10cSrcweir const SfxPoolItem* pItem = 0; 1906*cdf0e10cSrcweir if ( pArgs ) 1907*cdf0e10cSrcweir pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), sal_False, &pItem); 1908*cdf0e10cSrcweir if ( pItem ) 1909*cdf0e10cSrcweir { 1910*cdf0e10cSrcweir const SfxStringItem* pStringItem = PTR_CAST( SfxStringItem, pItem ); 1911*cdf0e10cSrcweir if ( pStringItem ) 1912*cdf0e10cSrcweir aChars = pStringItem->GetValue(); 1913*cdf0e10cSrcweir const SfxPoolItem* pFtItem = NULL; 1914*cdf0e10cSrcweir pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), sal_False, &pFtItem); 1915*cdf0e10cSrcweir const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem ); 1916*cdf0e10cSrcweir if ( pFontItem ) 1917*cdf0e10cSrcweir aFontName = pFontItem->GetValue(); 1918*cdf0e10cSrcweir } 1919*cdf0e10cSrcweir 1920*cdf0e10cSrcweir if ( aChars.Len() ) 1921*cdf0e10cSrcweir { 1922*cdf0e10cSrcweir Font aFont; 1923*cdf0e10cSrcweir pTabViewShell->GetSelectionPattern()->GetFont( aFont, SC_AUTOCOL_BLACK, NULL, NULL, NULL, 1924*cdf0e10cSrcweir pTabViewShell->GetSelectionScriptType() ); 1925*cdf0e10cSrcweir if ( aFontName.Len() ) 1926*cdf0e10cSrcweir aFont = Font( aFontName, Size(1,1) ); 1927*cdf0e10cSrcweir pTabViewShell->InsertSpecialChar( aChars, aFont ); 1928*cdf0e10cSrcweir if( ! rReq.IsAPI() ) 1929*cdf0e10cSrcweir rReq.Done(); 1930*cdf0e10cSrcweir } 1931*cdf0e10cSrcweir } 1932*cdf0e10cSrcweir else 1933*cdf0e10cSrcweir { 1934*cdf0e10cSrcweir //CHINA001 SvxCharacterMap* pDlg = new SvxCharacterMap( pTabViewShell->GetDialogParent(), sal_False ); 1935*cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 1936*cdf0e10cSrcweir 1937*cdf0e10cSrcweir // font color doesn't matter here 1938*cdf0e10cSrcweir Font aCurFont; 1939*cdf0e10cSrcweir pTabViewShell->GetSelectionPattern()->GetFont( aCurFont, SC_AUTOCOL_BLACK, NULL, NULL, NULL, 1940*cdf0e10cSrcweir pTabViewShell->GetSelectionScriptType() ); 1941*cdf0e10cSrcweir 1942*cdf0e10cSrcweir SfxAllItemSet aSet( GetPool() ); 1943*cdf0e10cSrcweir aSet.Put( SfxBoolItem( FN_PARAM_1, sal_False ) ); 1944*cdf0e10cSrcweir aSet.Put( SvxFontItem( aCurFont.GetFamily(), aCurFont.GetName(), aCurFont.GetStyleName(), aCurFont.GetPitch(), aCurFont.GetCharSet(), GetPool().GetWhich(SID_ATTR_CHAR_FONT) ) ); 1945*cdf0e10cSrcweir 1946*cdf0e10cSrcweir SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( pTabViewShell->GetDialogParent(), aSet, 1947*cdf0e10cSrcweir pTabViewShell->GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ); 1948*cdf0e10cSrcweir 1949*cdf0e10cSrcweir if ( pDlg->Execute() == RET_OK ) 1950*cdf0e10cSrcweir { 1951*cdf0e10cSrcweir SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pItem, SfxStringItem, SID_CHARMAP, sal_False ); 1952*cdf0e10cSrcweir SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, sal_False ); 1953*cdf0e10cSrcweir 1954*cdf0e10cSrcweir if ( pItem && pFontItem ) 1955*cdf0e10cSrcweir { 1956*cdf0e10cSrcweir Font aNewFont( pFontItem->GetFamilyName(), pFontItem->GetStyleName(), Size(1,1) ); 1957*cdf0e10cSrcweir aNewFont.SetCharSet( pFontItem->GetCharSet() ); 1958*cdf0e10cSrcweir aNewFont.SetPitch( pFontItem->GetPitch() ); 1959*cdf0e10cSrcweir pTabViewShell->InsertSpecialChar( pItem->GetValue(), aNewFont ); 1960*cdf0e10cSrcweir rReq.AppendItem( *pFontItem ); 1961*cdf0e10cSrcweir rReq.AppendItem( *pItem ); 1962*cdf0e10cSrcweir rReq.Done(); 1963*cdf0e10cSrcweir } 1964*cdf0e10cSrcweir } 1965*cdf0e10cSrcweir delete pDlg; 1966*cdf0e10cSrcweir } 1967*cdf0e10cSrcweir break; 1968*cdf0e10cSrcweir 1969*cdf0e10cSrcweir case SID_SELECT_SCENARIO: 1970*cdf0e10cSrcweir { 1971*cdf0e10cSrcweir // Testing 1972*cdf0e10cSrcweir 1973*cdf0e10cSrcweir if ( pReqArgs ) 1974*cdf0e10cSrcweir { 1975*cdf0e10cSrcweir const SfxStringItem* pItem = 1976*cdf0e10cSrcweir (const SfxStringItem*)&pReqArgs->Get( SID_SELECT_SCENARIO ); 1977*cdf0e10cSrcweir 1978*cdf0e10cSrcweir if( pItem ) 1979*cdf0e10cSrcweir { 1980*cdf0e10cSrcweir pTabViewShell->UseScenario( pItem->GetValue() ); 1981*cdf0e10cSrcweir //! wofuer soll der Return-Wert gut sein?!?! 1982*cdf0e10cSrcweir rReq.SetReturnValue( SfxStringItem( SID_SELECT_SCENARIO, pItem->GetValue() ) ); 1983*cdf0e10cSrcweir rReq.Done(); 1984*cdf0e10cSrcweir } 1985*cdf0e10cSrcweir else 1986*cdf0e10cSrcweir { 1987*cdf0e10cSrcweir DBG_ERROR("NULL"); 1988*cdf0e10cSrcweir } 1989*cdf0e10cSrcweir } 1990*cdf0e10cSrcweir } 1991*cdf0e10cSrcweir break; 1992*cdf0e10cSrcweir 1993*cdf0e10cSrcweir case SID_HYPERLINK_SETLINK: 1994*cdf0e10cSrcweir if( pReqArgs ) 1995*cdf0e10cSrcweir { 1996*cdf0e10cSrcweir const SfxPoolItem* pItem; 1997*cdf0e10cSrcweir if( IS_AVAILABLE( SID_HYPERLINK_SETLINK, &pItem ) ) 1998*cdf0e10cSrcweir { 1999*cdf0e10cSrcweir const SvxHyperlinkItem* pHyper = (const SvxHyperlinkItem*) pItem; 2000*cdf0e10cSrcweir const String& rName = pHyper->GetName(); 2001*cdf0e10cSrcweir const String& rURL = pHyper->GetURL(); 2002*cdf0e10cSrcweir const String& rTarget = pHyper->GetTargetFrame(); 2003*cdf0e10cSrcweir sal_uInt16 nType = (sal_uInt16) pHyper->GetInsertMode(); 2004*cdf0e10cSrcweir 2005*cdf0e10cSrcweir pTabViewShell->InsertURL( rName, rURL, rTarget, nType ); 2006*cdf0e10cSrcweir rReq.Done(); 2007*cdf0e10cSrcweir } 2008*cdf0e10cSrcweir else 2009*cdf0e10cSrcweir rReq.Ignore(); 2010*cdf0e10cSrcweir } 2011*cdf0e10cSrcweir break; 2012*cdf0e10cSrcweir 2013*cdf0e10cSrcweir case FID_CONDITIONAL_FORMAT: 2014*cdf0e10cSrcweir if( pReqArgs ) 2015*cdf0e10cSrcweir { 2016*cdf0e10cSrcweir const SfxPoolItem* pItem; 2017*cdf0e10cSrcweir if( IS_AVAILABLE( FID_CONDITIONAL_FORMAT, &pItem ) ) 2018*cdf0e10cSrcweir { 2019*cdf0e10cSrcweir // Wenn RefInput auf andere Tabelle als Datentabelle umgeschaltet 2020*cdf0e10cSrcweir // hat wieder zurueckschalten: 2021*cdf0e10cSrcweir if ( GetViewData()->GetTabNo() != GetViewData()->GetRefTabNo() ) 2022*cdf0e10cSrcweir { 2023*cdf0e10cSrcweir pTabViewShell->SetTabNo( GetViewData()->GetRefTabNo() ); 2024*cdf0e10cSrcweir pTabViewShell->PaintExtras(); 2025*cdf0e10cSrcweir } 2026*cdf0e10cSrcweir 2027*cdf0e10cSrcweir const ScCondFrmtItem* pCndFmtItem = (const ScCondFrmtItem*) pItem; 2028*cdf0e10cSrcweir pTabViewShell->SetConditionalFormat( pCndFmtItem->GetData() ); 2029*cdf0e10cSrcweir rReq.Done(); 2030*cdf0e10cSrcweir } 2031*cdf0e10cSrcweir } 2032*cdf0e10cSrcweir break; 2033*cdf0e10cSrcweir 2034*cdf0e10cSrcweir case SID_EXTERNAL_SOURCE: 2035*cdf0e10cSrcweir { 2036*cdf0e10cSrcweir String aFile; 2037*cdf0e10cSrcweir String aFilter; 2038*cdf0e10cSrcweir String aOptions; 2039*cdf0e10cSrcweir String aSource; 2040*cdf0e10cSrcweir sal_uLong nRefresh=0; 2041*cdf0e10cSrcweir 2042*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pFile, SfxStringItem, SID_FILE_NAME, sal_False ); 2043*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pSource, SfxStringItem, FN_PARAM_1, sal_False ); 2044*cdf0e10cSrcweir if ( pFile && pSource ) 2045*cdf0e10cSrcweir { 2046*cdf0e10cSrcweir aFile = pFile->GetValue(); 2047*cdf0e10cSrcweir aSource = pSource->GetValue(); 2048*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pFilter, SfxStringItem, SID_FILTER_NAME, sal_False ); 2049*cdf0e10cSrcweir if ( pFilter ) 2050*cdf0e10cSrcweir aFilter = pFilter->GetValue(); 2051*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pOptions, SfxStringItem, SID_FILE_FILTEROPTIONS, sal_False ); 2052*cdf0e10cSrcweir if ( pOptions ) 2053*cdf0e10cSrcweir aOptions = pOptions->GetValue(); 2054*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pRefresh, SfxUInt32Item, FN_PARAM_2, sal_False ); 2055*cdf0e10cSrcweir if ( pRefresh ) 2056*cdf0e10cSrcweir nRefresh = pRefresh->GetValue(); 2057*cdf0e10cSrcweir } 2058*cdf0e10cSrcweir else 2059*cdf0e10cSrcweir { 2060*cdf0e10cSrcweir //CHINA001 ScLinkedAreaDlg* pDlg = new ScLinkedAreaDlg( pTabViewShell->GetDialogParent() ); 2061*cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 2062*cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 2063*cdf0e10cSrcweir 2064*cdf0e10cSrcweir delete pImpl->m_pLinkedDlg; 2065*cdf0e10cSrcweir pImpl->m_pLinkedDlg = 2066*cdf0e10cSrcweir pFact->CreateScLinkedAreaDlg( pTabViewShell->GetDialogParent(), 2067*cdf0e10cSrcweir RID_SCDLG_LINKAREA); 2068*cdf0e10cSrcweir DBG_ASSERT(pImpl->m_pLinkedDlg, "Dialog create fail!");//CHINA001 2069*cdf0e10cSrcweir delete pImpl->m_pRequest; 2070*cdf0e10cSrcweir pImpl->m_pRequest = new SfxRequest( rReq ); 2071*cdf0e10cSrcweir pImpl->m_pLinkedDlg->StartExecuteModal( LINK( this, ScCellShell, DialogClosed ) ); 2072*cdf0e10cSrcweir return; 2073*cdf0e10cSrcweir } 2074*cdf0e10cSrcweir 2075*cdf0e10cSrcweir ExecuteExternalSource( aFile, aFilter, aOptions, aSource, nRefresh, rReq ); 2076*cdf0e10cSrcweir } 2077*cdf0e10cSrcweir break; 2078*cdf0e10cSrcweir 2079*cdf0e10cSrcweir // 2080*cdf0e10cSrcweir // 2081*cdf0e10cSrcweir // 2082*cdf0e10cSrcweir 2083*cdf0e10cSrcweir default: 2084*cdf0e10cSrcweir DBG_ERROR("falscher Slot bei ExecuteEdit"); 2085*cdf0e10cSrcweir break; 2086*cdf0e10cSrcweir } 2087*cdf0e10cSrcweir } 2088*cdf0e10cSrcweir 2089*cdf0e10cSrcweir void ScCellShell::ExecuteTrans( SfxRequest& rReq ) 2090*cdf0e10cSrcweir { 2091*cdf0e10cSrcweir sal_Int32 nType = ScViewUtil::GetTransliterationType( rReq.GetSlot() ); 2092*cdf0e10cSrcweir if ( nType ) 2093*cdf0e10cSrcweir { 2094*cdf0e10cSrcweir GetViewData()->GetView()->TransliterateText( nType ); 2095*cdf0e10cSrcweir rReq.Done(); 2096*cdf0e10cSrcweir } 2097*cdf0e10cSrcweir } 2098*cdf0e10cSrcweir 2099*cdf0e10cSrcweir void ScCellShell::ExecuteExternalSource( 2100*cdf0e10cSrcweir const String& _rFile, const String& _rFilter, const String& _rOptions, 2101*cdf0e10cSrcweir const String& _rSource, sal_uLong _nRefresh, SfxRequest& _rRequest ) 2102*cdf0e10cSrcweir { 2103*cdf0e10cSrcweir if ( _rFile.Len() && _rSource.Len() ) // filter may be empty 2104*cdf0e10cSrcweir { 2105*cdf0e10cSrcweir ScRange aLinkRange; 2106*cdf0e10cSrcweir sal_Bool bMove = sal_False; 2107*cdf0e10cSrcweir 2108*cdf0e10cSrcweir ScViewData* pData = GetViewData(); 2109*cdf0e10cSrcweir ScMarkData& rMark = pData->GetMarkData(); 2110*cdf0e10cSrcweir rMark.MarkToSimple(); 2111*cdf0e10cSrcweir if ( rMark.IsMarked() ) 2112*cdf0e10cSrcweir { 2113*cdf0e10cSrcweir rMark.GetMarkArea( aLinkRange ); 2114*cdf0e10cSrcweir bMove = sal_True; // insert/delete cells to fit range 2115*cdf0e10cSrcweir } 2116*cdf0e10cSrcweir else 2117*cdf0e10cSrcweir aLinkRange = ScRange( pData->GetCurX(), pData->GetCurY(), pData->GetTabNo() ); 2118*cdf0e10cSrcweir 2119*cdf0e10cSrcweir ScDocFunc aFunc(*pData->GetDocShell()); 2120*cdf0e10cSrcweir aFunc.InsertAreaLink( _rFile, _rFilter, _rOptions, _rSource, 2121*cdf0e10cSrcweir aLinkRange, _nRefresh, bMove, sal_False ); 2122*cdf0e10cSrcweir _rRequest.Done(); 2123*cdf0e10cSrcweir } 2124*cdf0e10cSrcweir else 2125*cdf0e10cSrcweir _rRequest.Ignore(); 2126*cdf0e10cSrcweir } 2127*cdf0e10cSrcweir 2128*cdf0e10cSrcweir IMPL_LINK( ScCellShell, DialogClosed, AbstractScLinkedAreaDlg*, EMPTYARG ) 2129*cdf0e10cSrcweir { 2130*cdf0e10cSrcweir DBG_ASSERT( pImpl->m_pLinkedDlg, "ScCellShell::DialogClosed(): invalid request" ); 2131*cdf0e10cSrcweir DBG_ASSERT( pImpl->m_pRequest, "ScCellShell::DialogClosed(): invalid request" ); 2132*cdf0e10cSrcweir String sFile, sFilter, sOptions, sSource; 2133*cdf0e10cSrcweir sal_uLong nRefresh = 0; 2134*cdf0e10cSrcweir 2135*cdf0e10cSrcweir if ( pImpl->m_pLinkedDlg->GetResult() == RET_OK ) 2136*cdf0e10cSrcweir { 2137*cdf0e10cSrcweir sFile = pImpl->m_pLinkedDlg->GetURL(); 2138*cdf0e10cSrcweir sFilter = pImpl->m_pLinkedDlg->GetFilter(); 2139*cdf0e10cSrcweir sOptions = pImpl->m_pLinkedDlg->GetOptions(); 2140*cdf0e10cSrcweir sSource = pImpl->m_pLinkedDlg->GetSource(); 2141*cdf0e10cSrcweir nRefresh = pImpl->m_pLinkedDlg->GetRefresh(); 2142*cdf0e10cSrcweir if ( sFile.Len() ) 2143*cdf0e10cSrcweir pImpl->m_pRequest->AppendItem( SfxStringItem( SID_FILE_NAME, sFile ) ); 2144*cdf0e10cSrcweir if ( sFilter.Len() ) 2145*cdf0e10cSrcweir pImpl->m_pRequest->AppendItem( SfxStringItem( SID_FILTER_NAME, sFilter ) ); 2146*cdf0e10cSrcweir if ( sOptions.Len() ) 2147*cdf0e10cSrcweir pImpl->m_pRequest->AppendItem( SfxStringItem( SID_FILE_FILTEROPTIONS, sOptions ) ); 2148*cdf0e10cSrcweir if ( sSource.Len() ) 2149*cdf0e10cSrcweir pImpl->m_pRequest->AppendItem( SfxStringItem( FN_PARAM_1, sSource ) ); 2150*cdf0e10cSrcweir if ( nRefresh ) 2151*cdf0e10cSrcweir pImpl->m_pRequest->AppendItem( SfxUInt32Item( FN_PARAM_2, nRefresh ) ); 2152*cdf0e10cSrcweir } 2153*cdf0e10cSrcweir 2154*cdf0e10cSrcweir ExecuteExternalSource( sFile, sFilter, sOptions, sSource, nRefresh, *(pImpl->m_pRequest) ); 2155*cdf0e10cSrcweir return 0; 2156*cdf0e10cSrcweir } 2157*cdf0e10cSrcweir 2158*cdf0e10cSrcweir void ScCellShell::PasteFromClipboard( ScViewData* pViewData, ScTabViewShell* pTabViewShell, bool bShowDialog ) 2159*cdf0e10cSrcweir { 2160*cdf0e10cSrcweir Window* pWin = pViewData->GetActiveWin(); 2161*cdf0e10cSrcweir ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin ); 2162*cdf0e10cSrcweir ScDocument* pThisDoc = pViewData->GetDocument(); 2163*cdf0e10cSrcweir ScDPObject* pDPObj = pThisDoc->GetDPAtCursor( pViewData->GetCurX(), 2164*cdf0e10cSrcweir pViewData->GetCurY(), pViewData->GetTabNo() ); 2165*cdf0e10cSrcweir if ( pOwnClip && pDPObj ) 2166*cdf0e10cSrcweir { 2167*cdf0e10cSrcweir // paste from Calc into DataPilot table: sort (similar to drag & drop) 2168*cdf0e10cSrcweir 2169*cdf0e10cSrcweir ScDocument* pClipDoc = pOwnClip->GetDocument(); 2170*cdf0e10cSrcweir SCTAB nSourceTab = pOwnClip->GetVisibleTab(); 2171*cdf0e10cSrcweir 2172*cdf0e10cSrcweir SCCOL nClipStartX; 2173*cdf0e10cSrcweir SCROW nClipStartY; 2174*cdf0e10cSrcweir SCCOL nClipEndX; 2175*cdf0e10cSrcweir SCROW nClipEndY; 2176*cdf0e10cSrcweir pClipDoc->GetClipStart( nClipStartX, nClipStartY ); 2177*cdf0e10cSrcweir pClipDoc->GetClipArea( nClipEndX, nClipEndY, sal_True ); 2178*cdf0e10cSrcweir nClipEndX = nClipEndX + nClipStartX; 2179*cdf0e10cSrcweir nClipEndY = nClipEndY + nClipStartY; // GetClipArea returns the difference 2180*cdf0e10cSrcweir 2181*cdf0e10cSrcweir ScRange aSource( nClipStartX, nClipStartY, nSourceTab, nClipEndX, nClipEndY, nSourceTab ); 2182*cdf0e10cSrcweir sal_Bool bDone = pTabViewShell->DataPilotMove( aSource, pViewData->GetCurPos() ); 2183*cdf0e10cSrcweir if ( !bDone ) 2184*cdf0e10cSrcweir pTabViewShell->ErrorMessage( STR_ERR_DATAPILOT_INPUT ); 2185*cdf0e10cSrcweir } 2186*cdf0e10cSrcweir else 2187*cdf0e10cSrcweir { 2188*cdf0e10cSrcweir // normal paste 2189*cdf0e10cSrcweir WaitObject aWait( pViewData->GetDialogParent() ); 2190*cdf0e10cSrcweir if (!pOwnClip) 2191*cdf0e10cSrcweir pTabViewShell->PasteFromSystem(); 2192*cdf0e10cSrcweir else 2193*cdf0e10cSrcweir { 2194*cdf0e10cSrcweir ScDocument* pClipDoc = pOwnClip->GetDocument(); 2195*cdf0e10cSrcweir sal_uInt16 nFlags = IDF_ALL; 2196*cdf0e10cSrcweir if (pClipDoc->GetClipParam().isMultiRange()) 2197*cdf0e10cSrcweir // For multi-range paste, we paste values by default. 2198*cdf0e10cSrcweir nFlags &= ~IDF_FORMULA; 2199*cdf0e10cSrcweir 2200*cdf0e10cSrcweir pTabViewShell->PasteFromClip( nFlags, pClipDoc, 2201*cdf0e10cSrcweir PASTE_NOFUNC, sal_False, sal_False, sal_False, INS_NONE, IDF_NONE, 2202*cdf0e10cSrcweir bShowDialog ); // allow warning dialog 2203*cdf0e10cSrcweir } 2204*cdf0e10cSrcweir } 2205*cdf0e10cSrcweir pTabViewShell->CellContentChanged(); // => PasteFromSystem() ??? 2206*cdf0e10cSrcweir } 2207