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 #undef SC_DLLIMPLEMENTATION 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir //------------------------------------------------------------------ 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #include "global.hxx" 40*cdf0e10cSrcweir #include "document.hxx" 41*cdf0e10cSrcweir #include "tabvwsh.hxx" 42*cdf0e10cSrcweir #include "viewdata.hxx" 43*cdf0e10cSrcweir #include "uiitems.hxx" 44*cdf0e10cSrcweir #include "userlist.hxx" 45*cdf0e10cSrcweir #include "rangeutl.hxx" 46*cdf0e10cSrcweir #include "crdlg.hxx" 47*cdf0e10cSrcweir #include "scresid.hxx" 48*cdf0e10cSrcweir #include "sc.hrc" // -> Slot-IDs 49*cdf0e10cSrcweir #include "optdlg.hrc" 50*cdf0e10cSrcweir #include "globstr.hrc" 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir #define _TPUSRLST_CXX 53*cdf0e10cSrcweir #include "tpusrlst.hxx" 54*cdf0e10cSrcweir #undef _TPUSRLST_CXX 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir //CHINA001 #include "scui_def.hxx" //CHINA001 57*cdf0e10cSrcweir //CHINA001 #include "scresid.hxx" //add by CHINA001 58*cdf0e10cSrcweir //CHINA001 #include "miscdlgs.hrc" //add by CHINA001 59*cdf0e10cSrcweir //CHINA001 60*cdf0e10cSrcweir //CHINA001 #include "scabstdlg.hxx" //CHINA001 61*cdf0e10cSrcweir // STATIC DATA ----------------------------------------------------------- 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir #define CR (sal_Unicode)13 64*cdf0e10cSrcweir #define LF (sal_Unicode)10 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir static sal_uInt16 pUserListsRanges[] = 67*cdf0e10cSrcweir { 68*cdf0e10cSrcweir SID_SCUSERLISTS, 69*cdf0e10cSrcweir SID_SCUSERLISTS, 70*cdf0e10cSrcweir 0 71*cdf0e10cSrcweir }; 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir static const sal_Unicode cDelimiter = ','; 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir //======================================================================== 77*cdf0e10cSrcweir // Benutzerdefinierte Listen: 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir ScTpUserLists::ScTpUserLists( Window* pParent, 81*cdf0e10cSrcweir const SfxItemSet& rCoreAttrs ) 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir : SfxTabPage ( pParent, 84*cdf0e10cSrcweir ScResId( RID_SCPAGE_USERLISTS ), 85*cdf0e10cSrcweir rCoreAttrs ), 86*cdf0e10cSrcweir aFtLists ( this, ScResId( FT_LISTS ) ), 87*cdf0e10cSrcweir aLbLists ( this, ScResId( LB_LISTS ) ), 88*cdf0e10cSrcweir aFtEntries ( this, ScResId( FT_ENTRIES ) ), 89*cdf0e10cSrcweir aEdEntries ( this, ScResId( ED_ENTRIES ) ), 90*cdf0e10cSrcweir aFtCopyFrom ( this, ScResId( FT_COPYFROM ) ), 91*cdf0e10cSrcweir aEdCopyFrom ( this, ScResId( ED_COPYFROM ) ), 92*cdf0e10cSrcweir aBtnNew ( this, ScResId( BTN_NEW ) ), 93*cdf0e10cSrcweir aBtnAdd ( this, ScResId( BTN_ADD ) ), 94*cdf0e10cSrcweir aBtnRemove ( this, ScResId( BTN_REMOVE ) ), 95*cdf0e10cSrcweir aBtnCopy ( this, ScResId( BTN_COPY ) ), 96*cdf0e10cSrcweir aStrQueryRemove ( ScResId( STR_QUERYREMOVE ) ), 97*cdf0e10cSrcweir aStrNew ( aBtnNew.GetText() ), 98*cdf0e10cSrcweir aStrCancel ( ScResId( STR_DISMISS ) ), 99*cdf0e10cSrcweir aStrAdd ( ScResId( SCSTR_ADD ) ), 100*cdf0e10cSrcweir aStrModify ( ScResId( SCSTR_MODIFY ) ), 101*cdf0e10cSrcweir aStrCopyList ( ScResId( STR_COPYLIST ) ), 102*cdf0e10cSrcweir aStrCopyFrom ( ScResId( STR_COPYFROM ) ), 103*cdf0e10cSrcweir aStrCopyErr ( ScResId( STR_COPYERR ) ), 104*cdf0e10cSrcweir // 105*cdf0e10cSrcweir nWhichUserLists ( GetWhich( SID_SCUSERLISTS ) ), 106*cdf0e10cSrcweir pUserLists ( NULL ), 107*cdf0e10cSrcweir pDoc ( NULL ), 108*cdf0e10cSrcweir pViewData ( NULL ), 109*cdf0e10cSrcweir pRangeUtil ( new ScRangeUtil ), 110*cdf0e10cSrcweir bModifyMode ( sal_False ), 111*cdf0e10cSrcweir bCancelMode ( sal_False ), 112*cdf0e10cSrcweir bCopyDone ( sal_False ), 113*cdf0e10cSrcweir nCancelPos ( 0 ) 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir SetExchangeSupport(); 116*cdf0e10cSrcweir Init(); 117*cdf0e10cSrcweir FreeResource(); 118*cdf0e10cSrcweir } 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir // ----------------------------------------------------------------------- 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir __EXPORT ScTpUserLists::~ScTpUserLists() 123*cdf0e10cSrcweir { 124*cdf0e10cSrcweir delete pUserLists; 125*cdf0e10cSrcweir delete pRangeUtil; 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir // ----------------------------------------------------------------------- 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir void ScTpUserLists::Init() 131*cdf0e10cSrcweir { 132*cdf0e10cSrcweir SfxViewShell* pSh = SfxViewShell::Current(); 133*cdf0e10cSrcweir ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell, pSh); 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir aLbLists.SetSelectHdl ( LINK( this, ScTpUserLists, LbSelectHdl ) ); 136*cdf0e10cSrcweir aBtnNew.SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) ); 137*cdf0e10cSrcweir aBtnNew.SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) ); 138*cdf0e10cSrcweir aBtnAdd.SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) ); 139*cdf0e10cSrcweir aBtnRemove.SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) ); 140*cdf0e10cSrcweir aEdEntries.SetModifyHdl ( LINK( this, ScTpUserLists, EdEntriesModHdl ) ); 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir if ( pViewSh ) 144*cdf0e10cSrcweir { 145*cdf0e10cSrcweir SCTAB nStartTab = 0; 146*cdf0e10cSrcweir SCTAB nEndTab = 0; 147*cdf0e10cSrcweir SCCOL nStartCol = 0; 148*cdf0e10cSrcweir SCROW nStartRow = 0; 149*cdf0e10cSrcweir SCCOL nEndCol = 0; 150*cdf0e10cSrcweir SCROW nEndRow = 0; 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir pViewData = pViewSh->GetViewData(); 153*cdf0e10cSrcweir pDoc = pViewData->GetDocument(); 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir pViewData->GetSimpleArea( nStartCol, nStartRow, nStartTab, 156*cdf0e10cSrcweir nEndCol, nEndRow, nEndTab ); 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir PutInOrder( nStartCol, nEndCol ); 159*cdf0e10cSrcweir PutInOrder( nStartRow, nEndRow ); 160*cdf0e10cSrcweir PutInOrder( nStartTab, nEndTab ); 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab 163*cdf0e10cSrcweir ).Format( aStrSelectedArea, SCR_ABS_3D, pDoc ); 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir aBtnCopy.SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) ); 166*cdf0e10cSrcweir aBtnCopy.Enable(); 167*cdf0e10cSrcweir } 168*cdf0e10cSrcweir else 169*cdf0e10cSrcweir { 170*cdf0e10cSrcweir aBtnCopy.Disable(); 171*cdf0e10cSrcweir aFtCopyFrom.Disable(); 172*cdf0e10cSrcweir aEdCopyFrom.Disable(); 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir // aLbLists.GrabFocus(); 176*cdf0e10cSrcweir } 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir // ----------------------------------------------------------------------- 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir sal_uInt16* __EXPORT ScTpUserLists::GetRanges() 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir return pUserListsRanges; 183*cdf0e10cSrcweir } 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir // ----------------------------------------------------------------------- 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir SfxTabPage* __EXPORT ScTpUserLists::Create( Window* pParent, const SfxItemSet& rAttrSet ) 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir return ( new ScTpUserLists( pParent, rAttrSet ) ); 190*cdf0e10cSrcweir } 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir // ----------------------------------------------------------------------- 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir void __EXPORT ScTpUserLists::Reset( const SfxItemSet& rCoreAttrs ) 195*cdf0e10cSrcweir { 196*cdf0e10cSrcweir const ScUserListItem& rUserListItem = (const ScUserListItem&) 197*cdf0e10cSrcweir rCoreAttrs.Get( nWhichUserLists ); 198*cdf0e10cSrcweir const ScUserList* pCoreList = rUserListItem.GetUserList(); 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir DBG_ASSERT( pCoreList, "UserList not found :-/" ); 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir if ( pCoreList ) 203*cdf0e10cSrcweir { 204*cdf0e10cSrcweir if ( !pUserLists ) 205*cdf0e10cSrcweir pUserLists = new ScUserList( *pCoreList ); 206*cdf0e10cSrcweir else 207*cdf0e10cSrcweir *pUserLists = *pCoreList; 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir if ( UpdateUserListBox() > 0 ) 210*cdf0e10cSrcweir { 211*cdf0e10cSrcweir aLbLists.SelectEntryPos( 0 ); 212*cdf0e10cSrcweir UpdateEntries( 0 ); 213*cdf0e10cSrcweir } 214*cdf0e10cSrcweir } 215*cdf0e10cSrcweir else if ( !pUserLists ) 216*cdf0e10cSrcweir pUserLists = new ScUserList; 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir aEdCopyFrom.SetText( aStrSelectedArea ); 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir if ( aLbLists.GetEntryCount() == 0 ) 221*cdf0e10cSrcweir { 222*cdf0e10cSrcweir aFtLists .Disable(); 223*cdf0e10cSrcweir aLbLists .Disable(); 224*cdf0e10cSrcweir aFtEntries .Disable(); 225*cdf0e10cSrcweir aEdEntries .Disable(); 226*cdf0e10cSrcweir aBtnRemove .Disable(); 227*cdf0e10cSrcweir } 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir aBtnNew.SetText( aStrNew ); 230*cdf0e10cSrcweir aBtnAdd.SetText( aStrAdd ); 231*cdf0e10cSrcweir aBtnAdd.Disable(); 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir if ( !bCopyDone && pViewData ) 234*cdf0e10cSrcweir { 235*cdf0e10cSrcweir aFtCopyFrom .Enable(); 236*cdf0e10cSrcweir aEdCopyFrom .Enable(); 237*cdf0e10cSrcweir aBtnCopy .Enable(); 238*cdf0e10cSrcweir } 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir // aLbLists.GrabFocus(); 241*cdf0e10cSrcweir } 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir // ----------------------------------------------------------------------- 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir sal_Bool __EXPORT ScTpUserLists::FillItemSet( SfxItemSet& rCoreAttrs ) 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir // Modifikationen noch nicht uebernommen? 248*cdf0e10cSrcweir // -> Click auf Add-Button simulieren 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir if ( bModifyMode || bCancelMode ) 251*cdf0e10cSrcweir BtnClickHdl( &aBtnAdd ); 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir const ScUserListItem& rUserListItem = (const ScUserListItem&) 254*cdf0e10cSrcweir GetItemSet().Get( nWhichUserLists ); 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir ScUserList* pCoreList = rUserListItem.GetUserList(); 257*cdf0e10cSrcweir sal_Bool bDataModified = sal_False; 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir if ( (pUserLists == NULL) && (pCoreList == NULL) ) 260*cdf0e10cSrcweir { 261*cdf0e10cSrcweir bDataModified = sal_False; 262*cdf0e10cSrcweir } 263*cdf0e10cSrcweir else if ( pUserLists != NULL ) 264*cdf0e10cSrcweir { 265*cdf0e10cSrcweir if ( pCoreList != NULL ) 266*cdf0e10cSrcweir bDataModified = (*pUserLists != *pCoreList); 267*cdf0e10cSrcweir else 268*cdf0e10cSrcweir bDataModified = sal_True; 269*cdf0e10cSrcweir } 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir if ( bDataModified ) 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir ScUserListItem aULItem( nWhichUserLists ); 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir if ( pUserLists ) 276*cdf0e10cSrcweir aULItem.SetUserList( *pUserLists ); 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir rCoreAttrs.Put( aULItem ); 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir return bDataModified; 282*cdf0e10cSrcweir } 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir // ----------------------------------------------------------------------- 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir int __EXPORT ScTpUserLists::DeactivatePage( SfxItemSet* pSetP ) 287*cdf0e10cSrcweir { 288*cdf0e10cSrcweir if ( pSetP ) 289*cdf0e10cSrcweir FillItemSet( *pSetP ); 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir return LEAVE_PAGE; 292*cdf0e10cSrcweir } 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir // ----------------------------------------------------------------------- 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir sal_uInt16 ScTpUserLists::UpdateUserListBox() 297*cdf0e10cSrcweir { 298*cdf0e10cSrcweir aLbLists.Clear(); 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir if ( !pUserLists ) return 0; 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir //---------------------------------------------------------- 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir sal_uInt16 nCount = pUserLists->GetCount(); 305*cdf0e10cSrcweir String aEntry; 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir if ( nCount > 0 ) 308*cdf0e10cSrcweir { 309*cdf0e10cSrcweir for ( sal_uInt16 i=0; i<nCount; i++ ) 310*cdf0e10cSrcweir { 311*cdf0e10cSrcweir aEntry = (*pUserLists)[i]->GetString(); 312*cdf0e10cSrcweir DBG_ASSERT( aEntry.Len() > 0, "Empty UserList-entry :-/" ); 313*cdf0e10cSrcweir aLbLists.InsertEntry( aEntry ); 314*cdf0e10cSrcweir } 315*cdf0e10cSrcweir } 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir return nCount; 318*cdf0e10cSrcweir } 319*cdf0e10cSrcweir 320*cdf0e10cSrcweir // ----------------------------------------------------------------------- 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir void ScTpUserLists::UpdateEntries( sal_uInt16 nList ) 323*cdf0e10cSrcweir { 324*cdf0e10cSrcweir if ( !pUserLists ) return; 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir //---------------------------------------------------------- 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir if ( nList < pUserLists->GetCount() ) 329*cdf0e10cSrcweir { 330*cdf0e10cSrcweir ScUserListData* pList = (*pUserLists)[nList]; 331*cdf0e10cSrcweir sal_uInt16 nSubCount = pList->GetSubCount(); 332*cdf0e10cSrcweir String aEntryListStr; 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir for ( sal_uInt16 i=0; i<nSubCount; i++ ) 335*cdf0e10cSrcweir { 336*cdf0e10cSrcweir if ( i!=0 ) 337*cdf0e10cSrcweir aEntryListStr += CR; 338*cdf0e10cSrcweir aEntryListStr += pList->GetSubStr( i ); 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir aEntryListStr.ConvertLineEnd(); 342*cdf0e10cSrcweir aEdEntries.SetText( aEntryListStr ); 343*cdf0e10cSrcweir } 344*cdf0e10cSrcweir else 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir DBG_ERROR( "Invalid ListIndex :-/" ); 347*cdf0e10cSrcweir } 348*cdf0e10cSrcweir } 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir // ----------------------------------------------------------------------- 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir void ScTpUserLists::MakeListStr( String& rListStr ) 353*cdf0e10cSrcweir { 354*cdf0e10cSrcweir String aInputStr(rListStr); 355*cdf0e10cSrcweir String aStr; 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir xub_StrLen nLen = aStr.Len(); 358*cdf0e10cSrcweir xub_StrLen c = 0; 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir aInputStr.ConvertLineEnd( LINEEND_LF ); 361*cdf0e10cSrcweir //aStr.EraseAllChars( ' ' ); 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir xub_StrLen nToken=rListStr.GetTokenCount(LF); 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir for(xub_StrLen i=0;i<nToken;i++) 366*cdf0e10cSrcweir { 367*cdf0e10cSrcweir String aString=rListStr.GetToken(i,LF); 368*cdf0e10cSrcweir aString.EraseLeadingChars(' '); 369*cdf0e10cSrcweir aString.EraseTrailingChars(' '); 370*cdf0e10cSrcweir aStr+=aString; 371*cdf0e10cSrcweir aStr+=cDelimiter; 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir /* 375*cdf0e10cSrcweir // '\n' durch cDelimiter ersetzen: 376*cdf0e10cSrcweir for ( c=0; 377*cdf0e10cSrcweir (c < nLen) && (nFound != STRING_NOTFOUND); 378*cdf0e10cSrcweir c++ ) 379*cdf0e10cSrcweir { 380*cdf0e10cSrcweir nFound = aStr.Search( LF, nFound ); 381*cdf0e10cSrcweir if ( nFound != STRING_NOTFOUND ) 382*cdf0e10cSrcweir aStr[nFound] = cDelimiter; 383*cdf0e10cSrcweir } 384*cdf0e10cSrcweir */ 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir aStr.EraseLeadingChars( cDelimiter ); 387*cdf0e10cSrcweir aStr.EraseTrailingChars( cDelimiter ); 388*cdf0e10cSrcweir nLen = aStr.Len(); 389*cdf0e10cSrcweir 390*cdf0e10cSrcweir rListStr.Erase(); 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir // Alle Doppelten cDelimiter entfernen: 393*cdf0e10cSrcweir c=0; 394*cdf0e10cSrcweir while ( c < nLen ) 395*cdf0e10cSrcweir { 396*cdf0e10cSrcweir rListStr += aStr.GetChar(c); 397*cdf0e10cSrcweir c++; 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir if ( aStr.GetChar(c) == cDelimiter ) 400*cdf0e10cSrcweir { 401*cdf0e10cSrcweir rListStr += aStr.GetChar(c); 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir while ( (aStr.GetChar(c) == cDelimiter) && (c < nLen) ) 404*cdf0e10cSrcweir c++; 405*cdf0e10cSrcweir } 406*cdf0e10cSrcweir } 407*cdf0e10cSrcweir 408*cdf0e10cSrcweir } 409*cdf0e10cSrcweir 410*cdf0e10cSrcweir // ----------------------------------------------------------------------- 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir void ScTpUserLists::AddNewList( const String& rEntriesStr ) 413*cdf0e10cSrcweir { 414*cdf0e10cSrcweir String theEntriesStr( rEntriesStr ); 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir if ( !pUserLists ) 417*cdf0e10cSrcweir pUserLists = new ScUserList; 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir MakeListStr( theEntriesStr ); 420*cdf0e10cSrcweir 421*cdf0e10cSrcweir if ( !pUserLists->Insert( new ScUserListData( theEntriesStr ) ) ) 422*cdf0e10cSrcweir { 423*cdf0e10cSrcweir DBG_ERROR( "Entry could not be inserted :-/" ); 424*cdf0e10cSrcweir } 425*cdf0e10cSrcweir } 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir // ----------------------------------------------------------------------- 428*cdf0e10cSrcweir 429*cdf0e10cSrcweir void ScTpUserLists::CopyListFromArea( const ScRefAddress& rStartPos, 430*cdf0e10cSrcweir const ScRefAddress& rEndPos ) 431*cdf0e10cSrcweir { 432*cdf0e10cSrcweir if ( bCopyDone ) return; 433*cdf0e10cSrcweir 434*cdf0e10cSrcweir //---------------------------------------------------------- 435*cdf0e10cSrcweir 436*cdf0e10cSrcweir SCTAB nTab = rStartPos.Tab(); 437*cdf0e10cSrcweir SCCOL nStartCol = rStartPos.Col(); 438*cdf0e10cSrcweir SCROW nStartRow = rStartPos.Row(); 439*cdf0e10cSrcweir SCCOL nEndCol = rEndPos.Col(); 440*cdf0e10cSrcweir SCROW nEndRow = rEndPos.Row(); 441*cdf0e10cSrcweir sal_uInt16 nCellDir = SCRET_COLS; 442*cdf0e10cSrcweir sal_Bool bValueIgnored = sal_False; 443*cdf0e10cSrcweir 444*cdf0e10cSrcweir if ( (nStartCol != nEndCol) && (nStartRow != nEndRow) ) 445*cdf0e10cSrcweir { 446*cdf0e10cSrcweir nCellDir = ScColOrRowDlg( this, aStrCopyList, aStrCopyFrom ).Execute(); 447*cdf0e10cSrcweir //CHINA001 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 448*cdf0e10cSrcweir //CHINA001 DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 449*cdf0e10cSrcweir //CHINA001 450*cdf0e10cSrcweir //CHINA001 VclAbstractDialog* pDlg = pFact->CreateScColOrRowDlg( this, aStrCopyList, aStrCopyFrom,ResId(RID_SCDLG_COLORROW) ); 451*cdf0e10cSrcweir //CHINA001 DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 452*cdf0e10cSrcweir //CHINA001 nCellDir = pDlg->Execute(); 453*cdf0e10cSrcweir //CHINA001 delete pDlg; //CHINA001 454*cdf0e10cSrcweir } 455*cdf0e10cSrcweir else if ( nStartCol != nEndCol ) 456*cdf0e10cSrcweir nCellDir = SCRET_ROWS; 457*cdf0e10cSrcweir else 458*cdf0e10cSrcweir nCellDir = SCRET_COLS; 459*cdf0e10cSrcweir 460*cdf0e10cSrcweir if ( nCellDir != RET_CANCEL ) 461*cdf0e10cSrcweir { 462*cdf0e10cSrcweir String aStrList; 463*cdf0e10cSrcweir String aStrField; 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir if ( nCellDir == SCRET_COLS ) 466*cdf0e10cSrcweir { 467*cdf0e10cSrcweir for ( SCCOL col=nStartCol; col<=nEndCol; col++ ) 468*cdf0e10cSrcweir { 469*cdf0e10cSrcweir for ( SCROW row=nStartRow; row<=nEndRow; row++ ) 470*cdf0e10cSrcweir { 471*cdf0e10cSrcweir if ( pDoc->HasStringData( col, row, nTab ) ) 472*cdf0e10cSrcweir { 473*cdf0e10cSrcweir pDoc->GetString( col, row, nTab, aStrField ); 474*cdf0e10cSrcweir 475*cdf0e10cSrcweir if ( aStrField.Len() > 0 ) 476*cdf0e10cSrcweir { 477*cdf0e10cSrcweir aStrList += aStrField; 478*cdf0e10cSrcweir aStrList += '\n'; 479*cdf0e10cSrcweir } 480*cdf0e10cSrcweir } 481*cdf0e10cSrcweir else 482*cdf0e10cSrcweir bValueIgnored = sal_True; 483*cdf0e10cSrcweir } 484*cdf0e10cSrcweir if ( aStrList.Len() > 0 ) 485*cdf0e10cSrcweir AddNewList( aStrList ); 486*cdf0e10cSrcweir aStrList.Erase(); 487*cdf0e10cSrcweir } 488*cdf0e10cSrcweir } 489*cdf0e10cSrcweir else 490*cdf0e10cSrcweir { 491*cdf0e10cSrcweir for ( SCROW row=nStartRow; row<=nEndRow; row++ ) 492*cdf0e10cSrcweir { 493*cdf0e10cSrcweir for ( SCCOL col=nStartCol; col<=nEndCol; col++ ) 494*cdf0e10cSrcweir { 495*cdf0e10cSrcweir if ( pDoc->HasStringData( col, row, nTab ) ) 496*cdf0e10cSrcweir { 497*cdf0e10cSrcweir pDoc->GetString( col, row, nTab, aStrField ); 498*cdf0e10cSrcweir 499*cdf0e10cSrcweir if ( aStrField.Len() > 0 ) 500*cdf0e10cSrcweir { 501*cdf0e10cSrcweir aStrList += aStrField; 502*cdf0e10cSrcweir aStrList += '\n'; 503*cdf0e10cSrcweir } 504*cdf0e10cSrcweir } 505*cdf0e10cSrcweir else 506*cdf0e10cSrcweir bValueIgnored = sal_True; 507*cdf0e10cSrcweir } 508*cdf0e10cSrcweir if ( aStrList.Len() > 0 ) 509*cdf0e10cSrcweir AddNewList( aStrList ); 510*cdf0e10cSrcweir aStrList.Erase(); 511*cdf0e10cSrcweir } 512*cdf0e10cSrcweir } 513*cdf0e10cSrcweir 514*cdf0e10cSrcweir if ( bValueIgnored ) 515*cdf0e10cSrcweir { 516*cdf0e10cSrcweir InfoBox( this, aStrCopyErr ).Execute(); 517*cdf0e10cSrcweir } 518*cdf0e10cSrcweir } 519*cdf0e10cSrcweir 520*cdf0e10cSrcweir //---------------------------------------------------------- 521*cdf0e10cSrcweir 522*cdf0e10cSrcweir bCopyDone = sal_True; 523*cdf0e10cSrcweir 524*cdf0e10cSrcweir } 525*cdf0e10cSrcweir 526*cdf0e10cSrcweir // ----------------------------------------------------------------------- 527*cdf0e10cSrcweir 528*cdf0e10cSrcweir void ScTpUserLists::ModifyList( sal_uInt16 nSelList, 529*cdf0e10cSrcweir const String& rEntriesStr ) 530*cdf0e10cSrcweir { 531*cdf0e10cSrcweir if ( !pUserLists ) return; 532*cdf0e10cSrcweir 533*cdf0e10cSrcweir //---------------------------------------------------------- 534*cdf0e10cSrcweir 535*cdf0e10cSrcweir String theEntriesStr( rEntriesStr ); 536*cdf0e10cSrcweir 537*cdf0e10cSrcweir MakeListStr( theEntriesStr ); 538*cdf0e10cSrcweir 539*cdf0e10cSrcweir (*pUserLists)[nSelList]->SetString( theEntriesStr ); 540*cdf0e10cSrcweir } 541*cdf0e10cSrcweir 542*cdf0e10cSrcweir // ----------------------------------------------------------------------- 543*cdf0e10cSrcweir 544*cdf0e10cSrcweir void ScTpUserLists::RemoveList( sal_uInt16 nList ) 545*cdf0e10cSrcweir { 546*cdf0e10cSrcweir if ( pUserLists ) pUserLists->AtFree( nList ); 547*cdf0e10cSrcweir } 548*cdf0e10cSrcweir 549*cdf0e10cSrcweir //----------------------------------------------------------------------- 550*cdf0e10cSrcweir // Handler: 551*cdf0e10cSrcweir //--------- 552*cdf0e10cSrcweir 553*cdf0e10cSrcweir IMPL_LINK( ScTpUserLists, LbSelectHdl, ListBox*, pLb ) 554*cdf0e10cSrcweir { 555*cdf0e10cSrcweir if ( pLb == &aLbLists ) 556*cdf0e10cSrcweir { 557*cdf0e10cSrcweir sal_uInt16 nSelPos = aLbLists.GetSelectEntryPos(); 558*cdf0e10cSrcweir if ( nSelPos != LISTBOX_ENTRY_NOTFOUND ) 559*cdf0e10cSrcweir { 560*cdf0e10cSrcweir if ( !aFtEntries.IsEnabled() ) aFtEntries.Enable(); 561*cdf0e10cSrcweir if ( !aEdEntries.IsEnabled() ) aEdEntries.Enable(); 562*cdf0e10cSrcweir if ( !aBtnRemove.IsEnabled() ) aBtnRemove.Enable(); 563*cdf0e10cSrcweir if ( aBtnAdd.IsEnabled() ) aBtnAdd.Disable(); 564*cdf0e10cSrcweir 565*cdf0e10cSrcweir UpdateEntries( nSelPos ); 566*cdf0e10cSrcweir } 567*cdf0e10cSrcweir } 568*cdf0e10cSrcweir 569*cdf0e10cSrcweir return 0; 570*cdf0e10cSrcweir } 571*cdf0e10cSrcweir 572*cdf0e10cSrcweir // ----------------------------------------------------------------------- 573*cdf0e10cSrcweir 574*cdf0e10cSrcweir IMPL_LINK( ScTpUserLists, BtnClickHdl, PushButton*, pBtn ) 575*cdf0e10cSrcweir { 576*cdf0e10cSrcweir if ( pBtn == &aBtnNew ) 577*cdf0e10cSrcweir { 578*cdf0e10cSrcweir if ( !bCancelMode ) 579*cdf0e10cSrcweir { 580*cdf0e10cSrcweir nCancelPos = ( aLbLists.GetEntryCount() > 0 ) 581*cdf0e10cSrcweir ? aLbLists.GetSelectEntryPos() 582*cdf0e10cSrcweir : 0; 583*cdf0e10cSrcweir aLbLists.SetNoSelection(); 584*cdf0e10cSrcweir aFtLists.Disable(); 585*cdf0e10cSrcweir aLbLists.Disable(); 586*cdf0e10cSrcweir aFtEntries.Enable(); 587*cdf0e10cSrcweir aEdEntries.Enable(); 588*cdf0e10cSrcweir aEdEntries.SetText( EMPTY_STRING ); 589*cdf0e10cSrcweir aEdEntries.GrabFocus(); 590*cdf0e10cSrcweir aBtnAdd.Disable(); 591*cdf0e10cSrcweir aBtnRemove.Disable(); 592*cdf0e10cSrcweir //----------------------------- 593*cdf0e10cSrcweir if ( aBtnCopy.IsEnabled() ) 594*cdf0e10cSrcweir { 595*cdf0e10cSrcweir aBtnCopy.Disable(); 596*cdf0e10cSrcweir aFtCopyFrom.Disable(); 597*cdf0e10cSrcweir aEdCopyFrom.Disable(); 598*cdf0e10cSrcweir } 599*cdf0e10cSrcweir aBtnNew.SetText( aStrCancel ); 600*cdf0e10cSrcweir bCancelMode = sal_True; 601*cdf0e10cSrcweir } 602*cdf0e10cSrcweir else // if ( bCancelMode ) 603*cdf0e10cSrcweir { 604*cdf0e10cSrcweir if ( aLbLists.GetEntryCount() > 0 ) 605*cdf0e10cSrcweir { 606*cdf0e10cSrcweir aLbLists.SelectEntryPos( nCancelPos ); 607*cdf0e10cSrcweir LbSelectHdl( &aLbLists ); 608*cdf0e10cSrcweir aFtLists.Enable(); 609*cdf0e10cSrcweir aLbLists.Enable(); 610*cdf0e10cSrcweir } 611*cdf0e10cSrcweir else 612*cdf0e10cSrcweir { 613*cdf0e10cSrcweir aFtEntries.Disable(); 614*cdf0e10cSrcweir aEdEntries.Disable(); 615*cdf0e10cSrcweir aEdEntries.SetText( EMPTY_STRING ); 616*cdf0e10cSrcweir aBtnRemove.Disable(); 617*cdf0e10cSrcweir } 618*cdf0e10cSrcweir aBtnAdd.Disable(); 619*cdf0e10cSrcweir //----------------------------- 620*cdf0e10cSrcweir if ( pViewData && !bCopyDone ) 621*cdf0e10cSrcweir { 622*cdf0e10cSrcweir aBtnCopy.Enable(); 623*cdf0e10cSrcweir aFtCopyFrom.Enable(); 624*cdf0e10cSrcweir aEdCopyFrom.Enable(); 625*cdf0e10cSrcweir } 626*cdf0e10cSrcweir aBtnNew.SetText( aStrNew ); 627*cdf0e10cSrcweir bCancelMode = sal_False; 628*cdf0e10cSrcweir bModifyMode = sal_False; 629*cdf0e10cSrcweir } 630*cdf0e10cSrcweir } 631*cdf0e10cSrcweir else if ( pBtn == &aBtnAdd ) 632*cdf0e10cSrcweir { 633*cdf0e10cSrcweir String theEntriesStr( aEdEntries.GetText() ); 634*cdf0e10cSrcweir 635*cdf0e10cSrcweir if ( !bModifyMode ) 636*cdf0e10cSrcweir { 637*cdf0e10cSrcweir if ( theEntriesStr.Len() > 0 ) 638*cdf0e10cSrcweir { 639*cdf0e10cSrcweir AddNewList( theEntriesStr ); 640*cdf0e10cSrcweir UpdateUserListBox(); 641*cdf0e10cSrcweir aLbLists.SelectEntryPos( aLbLists.GetEntryCount()-1 ); 642*cdf0e10cSrcweir LbSelectHdl( &aLbLists ); 643*cdf0e10cSrcweir aFtLists.Enable(); 644*cdf0e10cSrcweir aLbLists.Enable(); 645*cdf0e10cSrcweir } 646*cdf0e10cSrcweir else 647*cdf0e10cSrcweir { 648*cdf0e10cSrcweir if ( aLbLists.GetEntryCount() > 0 ) 649*cdf0e10cSrcweir { 650*cdf0e10cSrcweir aLbLists.SelectEntryPos( nCancelPos ); 651*cdf0e10cSrcweir LbSelectHdl( &aLbLists ); 652*cdf0e10cSrcweir aLbLists.Enable(); 653*cdf0e10cSrcweir aLbLists.Enable(); 654*cdf0e10cSrcweir } 655*cdf0e10cSrcweir } 656*cdf0e10cSrcweir 657*cdf0e10cSrcweir aBtnAdd.Disable(); 658*cdf0e10cSrcweir aBtnRemove.Enable(); 659*cdf0e10cSrcweir aBtnNew.SetText( aStrNew ); 660*cdf0e10cSrcweir bCancelMode = sal_False; 661*cdf0e10cSrcweir } 662*cdf0e10cSrcweir else // if ( bModifyMode ) 663*cdf0e10cSrcweir { 664*cdf0e10cSrcweir sal_uInt16 nSelList = aLbLists.GetSelectEntryPos(); 665*cdf0e10cSrcweir 666*cdf0e10cSrcweir DBG_ASSERT( nSelList != LISTBOX_ENTRY_NOTFOUND, "Modify without List :-/" ); 667*cdf0e10cSrcweir 668*cdf0e10cSrcweir if ( theEntriesStr.Len() > 0 ) 669*cdf0e10cSrcweir { 670*cdf0e10cSrcweir ModifyList( nSelList, theEntriesStr ); 671*cdf0e10cSrcweir UpdateUserListBox(); 672*cdf0e10cSrcweir aLbLists.SelectEntryPos( nSelList ); 673*cdf0e10cSrcweir } 674*cdf0e10cSrcweir else 675*cdf0e10cSrcweir { 676*cdf0e10cSrcweir aLbLists.SelectEntryPos( 0 ); 677*cdf0e10cSrcweir LbSelectHdl( &aLbLists ); 678*cdf0e10cSrcweir } 679*cdf0e10cSrcweir 680*cdf0e10cSrcweir aBtnNew.SetText( aStrNew ); bCancelMode = sal_False; 681*cdf0e10cSrcweir aBtnAdd.SetText( aStrAdd ); bModifyMode = sal_False; 682*cdf0e10cSrcweir aBtnAdd.Disable(); 683*cdf0e10cSrcweir aBtnRemove.Enable(); 684*cdf0e10cSrcweir aFtLists.Enable(); 685*cdf0e10cSrcweir aLbLists.Enable(); 686*cdf0e10cSrcweir } 687*cdf0e10cSrcweir 688*cdf0e10cSrcweir if ( pViewData && !bCopyDone ) 689*cdf0e10cSrcweir { 690*cdf0e10cSrcweir aBtnCopy.Enable(); 691*cdf0e10cSrcweir aFtCopyFrom.Enable(); 692*cdf0e10cSrcweir aEdCopyFrom.Enable(); 693*cdf0e10cSrcweir } 694*cdf0e10cSrcweir } 695*cdf0e10cSrcweir else if ( pBtn == &aBtnRemove ) 696*cdf0e10cSrcweir { 697*cdf0e10cSrcweir if ( aLbLists.GetEntryCount() > 0 ) 698*cdf0e10cSrcweir { 699*cdf0e10cSrcweir sal_uInt16 nRemovePos = aLbLists.GetSelectEntryPos(); 700*cdf0e10cSrcweir String aMsg ( aStrQueryRemove.GetToken( 0, '#' ) ); 701*cdf0e10cSrcweir 702*cdf0e10cSrcweir aMsg += aLbLists.GetEntry( nRemovePos ); 703*cdf0e10cSrcweir aMsg += aStrQueryRemove.GetToken( 1, '#' ); 704*cdf0e10cSrcweir 705*cdf0e10cSrcweir 706*cdf0e10cSrcweir if ( RET_YES == QueryBox( this, 707*cdf0e10cSrcweir WinBits( WB_YES_NO | WB_DEF_YES ), 708*cdf0e10cSrcweir aMsg 709*cdf0e10cSrcweir ).Execute() ) 710*cdf0e10cSrcweir { 711*cdf0e10cSrcweir RemoveList( nRemovePos ); 712*cdf0e10cSrcweir UpdateUserListBox(); 713*cdf0e10cSrcweir 714*cdf0e10cSrcweir if ( aLbLists.GetEntryCount() > 0 ) 715*cdf0e10cSrcweir { 716*cdf0e10cSrcweir aLbLists.SelectEntryPos( 717*cdf0e10cSrcweir ( nRemovePos >= aLbLists.GetEntryCount() ) 718*cdf0e10cSrcweir ? aLbLists.GetEntryCount()-1 719*cdf0e10cSrcweir : nRemovePos ); 720*cdf0e10cSrcweir LbSelectHdl( &aLbLists ); 721*cdf0e10cSrcweir } 722*cdf0e10cSrcweir else 723*cdf0e10cSrcweir { 724*cdf0e10cSrcweir aFtLists.Disable(); 725*cdf0e10cSrcweir aLbLists.Disable(); 726*cdf0e10cSrcweir aFtEntries.Disable(); 727*cdf0e10cSrcweir aEdEntries.Disable(); 728*cdf0e10cSrcweir aEdEntries.SetText( EMPTY_STRING ); 729*cdf0e10cSrcweir aBtnRemove.Disable(); 730*cdf0e10cSrcweir } 731*cdf0e10cSrcweir } 732*cdf0e10cSrcweir 733*cdf0e10cSrcweir if ( pViewData && !bCopyDone && !aBtnCopy.IsEnabled() ) 734*cdf0e10cSrcweir { 735*cdf0e10cSrcweir aBtnCopy.Enable(); 736*cdf0e10cSrcweir aFtCopyFrom.Enable(); 737*cdf0e10cSrcweir aEdCopyFrom.Enable(); 738*cdf0e10cSrcweir } 739*cdf0e10cSrcweir } 740*cdf0e10cSrcweir } 741*cdf0e10cSrcweir else if ( pViewData && (pBtn == &aBtnCopy) ) 742*cdf0e10cSrcweir { 743*cdf0e10cSrcweir if ( bCopyDone ) 744*cdf0e10cSrcweir return 0; 745*cdf0e10cSrcweir 746*cdf0e10cSrcweir //----------------------------------------------------------- 747*cdf0e10cSrcweir 748*cdf0e10cSrcweir ScRefAddress theStartPos; 749*cdf0e10cSrcweir ScRefAddress theEndPos; 750*cdf0e10cSrcweir String theAreaStr( aEdCopyFrom.GetText() ); 751*cdf0e10cSrcweir sal_Bool bAreaOk = sal_False; 752*cdf0e10cSrcweir 753*cdf0e10cSrcweir if ( theAreaStr.Len() > 0 ) 754*cdf0e10cSrcweir { 755*cdf0e10cSrcweir bAreaOk = pRangeUtil->IsAbsArea( theAreaStr, 756*cdf0e10cSrcweir pDoc, 757*cdf0e10cSrcweir pViewData->GetTabNo(), 758*cdf0e10cSrcweir &theAreaStr, 759*cdf0e10cSrcweir &theStartPos, 760*cdf0e10cSrcweir &theEndPos, 761*cdf0e10cSrcweir pDoc->GetAddressConvention() ); 762*cdf0e10cSrcweir if ( !bAreaOk ) 763*cdf0e10cSrcweir { 764*cdf0e10cSrcweir bAreaOk = pRangeUtil->IsAbsPos( theAreaStr, 765*cdf0e10cSrcweir pDoc, 766*cdf0e10cSrcweir pViewData->GetTabNo(), 767*cdf0e10cSrcweir &theAreaStr, 768*cdf0e10cSrcweir &theStartPos, 769*cdf0e10cSrcweir pDoc->GetAddressConvention() ); 770*cdf0e10cSrcweir theEndPos = theStartPos; 771*cdf0e10cSrcweir } 772*cdf0e10cSrcweir } 773*cdf0e10cSrcweir 774*cdf0e10cSrcweir if ( bAreaOk ) 775*cdf0e10cSrcweir { 776*cdf0e10cSrcweir CopyListFromArea( theStartPos, theEndPos ); 777*cdf0e10cSrcweir UpdateUserListBox(); 778*cdf0e10cSrcweir aLbLists.SelectEntryPos( aLbLists.GetEntryCount()-1 ); 779*cdf0e10cSrcweir LbSelectHdl( &aLbLists ); 780*cdf0e10cSrcweir aEdCopyFrom .SetText( theAreaStr ); 781*cdf0e10cSrcweir aEdCopyFrom .Disable(); 782*cdf0e10cSrcweir aBtnCopy .Disable(); 783*cdf0e10cSrcweir aFtCopyFrom .Disable(); 784*cdf0e10cSrcweir } 785*cdf0e10cSrcweir else 786*cdf0e10cSrcweir { 787*cdf0e10cSrcweir ErrorBox( this, WinBits( WB_OK | WB_DEF_OK ), 788*cdf0e10cSrcweir ScGlobal::GetRscString( STR_INVALID_TABREF ) 789*cdf0e10cSrcweir ).Execute(); 790*cdf0e10cSrcweir aEdCopyFrom.GrabFocus(); 791*cdf0e10cSrcweir aEdCopyFrom.SetSelection( Selection( 0, SELECTION_MAX ) ); 792*cdf0e10cSrcweir } 793*cdf0e10cSrcweir } 794*cdf0e10cSrcweir 795*cdf0e10cSrcweir return 0; 796*cdf0e10cSrcweir } 797*cdf0e10cSrcweir 798*cdf0e10cSrcweir // ----------------------------------------------------------------------- 799*cdf0e10cSrcweir 800*cdf0e10cSrcweir IMPL_LINK( ScTpUserLists, EdEntriesModHdl, MultiLineEdit*, pEd ) 801*cdf0e10cSrcweir { 802*cdf0e10cSrcweir if ( pEd != &aEdEntries ) 803*cdf0e10cSrcweir return 0; 804*cdf0e10cSrcweir 805*cdf0e10cSrcweir //----------------------------------------------------------- 806*cdf0e10cSrcweir 807*cdf0e10cSrcweir if ( aBtnCopy.IsEnabled() ) 808*cdf0e10cSrcweir { 809*cdf0e10cSrcweir aBtnCopy .Disable(); 810*cdf0e10cSrcweir aFtCopyFrom .Disable(); 811*cdf0e10cSrcweir aEdCopyFrom .Disable(); 812*cdf0e10cSrcweir } 813*cdf0e10cSrcweir 814*cdf0e10cSrcweir if ( aEdEntries.GetText().Len() > 0 ) 815*cdf0e10cSrcweir { 816*cdf0e10cSrcweir if ( !bCancelMode && !bModifyMode ) 817*cdf0e10cSrcweir { 818*cdf0e10cSrcweir aBtnNew.SetText( aStrCancel ); bCancelMode = sal_True; 819*cdf0e10cSrcweir aBtnAdd.SetText( aStrModify ); bModifyMode = sal_True; 820*cdf0e10cSrcweir aBtnAdd.Enable(); 821*cdf0e10cSrcweir aBtnRemove.Disable(); 822*cdf0e10cSrcweir aFtLists.Disable(); 823*cdf0e10cSrcweir aLbLists.Disable(); 824*cdf0e10cSrcweir } 825*cdf0e10cSrcweir else // if ( bCancelMode || bModifyMode ) 826*cdf0e10cSrcweir { 827*cdf0e10cSrcweir if ( !aBtnAdd.IsEnabled() ) aBtnAdd.Enable(); 828*cdf0e10cSrcweir } 829*cdf0e10cSrcweir } 830*cdf0e10cSrcweir else 831*cdf0e10cSrcweir { 832*cdf0e10cSrcweir if ( aBtnAdd.IsEnabled() ) aBtnAdd.Disable(); 833*cdf0e10cSrcweir } 834*cdf0e10cSrcweir 835*cdf0e10cSrcweir return 0; 836*cdf0e10cSrcweir } 837*cdf0e10cSrcweir 838*cdf0e10cSrcweir 839*cdf0e10cSrcweir 840