merge the formfield patch from ooo-build
[ooovba.git] / sc / source / ui / optdlg / tpusrlst.cxx
blobccdddc5c7e37cfda034cebabe9ebc42dc099a6ea
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tpusrlst.cxx,v $
10 * $Revision: 1.12 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
34 #undef SC_DLLIMPLEMENTATION
38 //------------------------------------------------------------------
40 #include <vcl/msgbox.hxx>
42 #include "global.hxx"
43 #include "document.hxx"
44 #include "tabvwsh.hxx"
45 #include "viewdata.hxx"
46 #include "uiitems.hxx"
47 #include "userlist.hxx"
48 #include "rangeutl.hxx"
49 #include "crdlg.hxx"
50 #include "scresid.hxx"
51 #include "sc.hrc" // -> Slot-IDs
52 #include "optdlg.hrc"
53 #include "globstr.hrc"
55 #define _TPUSRLST_CXX
56 #include "tpusrlst.hxx"
57 #undef _TPUSRLST_CXX
59 //CHINA001 #include "scui_def.hxx" //CHINA001
60 //CHINA001 #include "scresid.hxx" //add by CHINA001
61 //CHINA001 #include "miscdlgs.hrc" //add by CHINA001
62 //CHINA001
63 //CHINA001 #include "scabstdlg.hxx" //CHINA001
64 // STATIC DATA -----------------------------------------------------------
66 #define CR (sal_Unicode)13
67 #define LF (sal_Unicode)10
69 static USHORT pUserListsRanges[] =
71 SID_SCUSERLISTS,
72 SID_SCUSERLISTS,
76 static const sal_Unicode cDelimiter = ',';
79 //========================================================================
80 // Benutzerdefinierte Listen:
83 ScTpUserLists::ScTpUserLists( Window* pParent,
84 const SfxItemSet& rCoreAttrs )
86 : SfxTabPage ( pParent,
87 ScResId( RID_SCPAGE_USERLISTS ),
88 rCoreAttrs ),
89 aFtLists ( this, ScResId( FT_LISTS ) ),
90 aLbLists ( this, ScResId( LB_LISTS ) ),
91 aFtEntries ( this, ScResId( FT_ENTRIES ) ),
92 aEdEntries ( this, ScResId( ED_ENTRIES ) ),
93 aFtCopyFrom ( this, ScResId( FT_COPYFROM ) ),
94 aEdCopyFrom ( this, ScResId( ED_COPYFROM ) ),
95 aBtnNew ( this, ScResId( BTN_NEW ) ),
96 aBtnAdd ( this, ScResId( BTN_ADD ) ),
97 aBtnRemove ( this, ScResId( BTN_REMOVE ) ),
98 aBtnCopy ( this, ScResId( BTN_COPY ) ),
99 aStrQueryRemove ( ScResId( STR_QUERYREMOVE ) ),
100 aStrNew ( aBtnNew.GetText() ),
101 aStrCancel ( ScResId( STR_DISMISS ) ),
102 aStrAdd ( ScResId( SCSTR_ADD ) ),
103 aStrModify ( ScResId( SCSTR_MODIFY ) ),
104 aStrCopyList ( ScResId( STR_COPYLIST ) ),
105 aStrCopyFrom ( ScResId( STR_COPYFROM ) ),
106 aStrCopyErr ( ScResId( STR_COPYERR ) ),
108 nWhichUserLists ( GetWhich( SID_SCUSERLISTS ) ),
109 pUserLists ( NULL ),
110 pDoc ( NULL ),
111 pViewData ( NULL ),
112 pRangeUtil ( new ScRangeUtil ),
113 bModifyMode ( FALSE ),
114 bCancelMode ( FALSE ),
115 bCopyDone ( FALSE ),
116 nCancelPos ( 0 )
118 SetExchangeSupport();
119 Init();
120 FreeResource();
123 // -----------------------------------------------------------------------
125 __EXPORT ScTpUserLists::~ScTpUserLists()
127 delete pUserLists;
128 delete pRangeUtil;
131 // -----------------------------------------------------------------------
133 void ScTpUserLists::Init()
135 SfxViewShell* pSh = SfxViewShell::Current();
136 ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell, pSh);
138 aLbLists.SetSelectHdl ( LINK( this, ScTpUserLists, LbSelectHdl ) );
139 aBtnNew.SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) );
140 aBtnNew.SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) );
141 aBtnAdd.SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) );
142 aBtnRemove.SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) );
143 aEdEntries.SetModifyHdl ( LINK( this, ScTpUserLists, EdEntriesModHdl ) );
146 if ( pViewSh )
148 SCTAB nStartTab = 0;
149 SCTAB nEndTab = 0;
150 SCCOL nStartCol = 0;
151 SCROW nStartRow = 0;
152 SCCOL nEndCol = 0;
153 SCROW nEndRow = 0;
155 pViewData = pViewSh->GetViewData();
156 pDoc = pViewData->GetDocument();
158 pViewData->GetSimpleArea( nStartCol, nStartRow, nStartTab,
159 nEndCol, nEndRow, nEndTab );
161 PutInOrder( nStartCol, nEndCol );
162 PutInOrder( nStartRow, nEndRow );
163 PutInOrder( nStartTab, nEndTab );
165 ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab
166 ).Format( aStrSelectedArea, SCR_ABS_3D, pDoc );
168 aBtnCopy.SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) );
169 aBtnCopy.Enable();
171 else
173 aBtnCopy.Disable();
174 aFtCopyFrom.Disable();
175 aEdCopyFrom.Disable();
178 // aLbLists.GrabFocus();
181 // -----------------------------------------------------------------------
183 USHORT* __EXPORT ScTpUserLists::GetRanges()
185 return pUserListsRanges;
188 // -----------------------------------------------------------------------
190 SfxTabPage* __EXPORT ScTpUserLists::Create( Window* pParent, const SfxItemSet& rAttrSet )
192 return ( new ScTpUserLists( pParent, rAttrSet ) );
195 // -----------------------------------------------------------------------
197 void __EXPORT ScTpUserLists::Reset( const SfxItemSet& rCoreAttrs )
199 const ScUserListItem& rUserListItem = (const ScUserListItem&)
200 rCoreAttrs.Get( nWhichUserLists );
201 const ScUserList* pCoreList = rUserListItem.GetUserList();
203 DBG_ASSERT( pCoreList, "UserList not found :-/" );
205 if ( pCoreList )
207 if ( !pUserLists )
208 pUserLists = new ScUserList( *pCoreList );
209 else
210 *pUserLists = *pCoreList;
212 if ( UpdateUserListBox() > 0 )
214 aLbLists.SelectEntryPos( 0 );
215 UpdateEntries( 0 );
218 else if ( !pUserLists )
219 pUserLists = new ScUserList;
221 aEdCopyFrom.SetText( aStrSelectedArea );
223 if ( aLbLists.GetEntryCount() == 0 )
225 aFtLists .Disable();
226 aLbLists .Disable();
227 aFtEntries .Disable();
228 aEdEntries .Disable();
229 aBtnRemove .Disable();
232 aBtnNew.SetText( aStrNew );
233 aBtnAdd.SetText( aStrAdd );
234 aBtnAdd.Disable();
236 if ( !bCopyDone && pViewData )
238 aFtCopyFrom .Enable();
239 aEdCopyFrom .Enable();
240 aBtnCopy .Enable();
243 // aLbLists.GrabFocus();
246 // -----------------------------------------------------------------------
248 BOOL __EXPORT ScTpUserLists::FillItemSet( SfxItemSet& rCoreAttrs )
250 // Modifikationen noch nicht uebernommen?
251 // -> Click auf Add-Button simulieren
253 if ( bModifyMode || bCancelMode )
254 BtnClickHdl( &aBtnAdd );
256 const ScUserListItem& rUserListItem = (const ScUserListItem&)
257 GetItemSet().Get( nWhichUserLists );
259 ScUserList* pCoreList = rUserListItem.GetUserList();
260 BOOL bDataModified = FALSE;
262 if ( (pUserLists == NULL) && (pCoreList == NULL) )
264 bDataModified = FALSE;
266 else if ( pUserLists != NULL )
268 if ( pCoreList != NULL )
269 bDataModified = (*pUserLists != *pCoreList);
270 else
271 bDataModified = TRUE;
274 if ( bDataModified )
276 ScUserListItem aULItem( nWhichUserLists );
278 if ( pUserLists )
279 aULItem.SetUserList( *pUserLists );
281 rCoreAttrs.Put( aULItem );
284 return bDataModified;
287 // -----------------------------------------------------------------------
289 int __EXPORT ScTpUserLists::DeactivatePage( SfxItemSet* pSetP )
291 if ( pSetP )
292 FillItemSet( *pSetP );
294 return LEAVE_PAGE;
297 // -----------------------------------------------------------------------
299 USHORT ScTpUserLists::UpdateUserListBox()
301 aLbLists.Clear();
303 if ( !pUserLists ) return 0;
305 //----------------------------------------------------------
307 USHORT nCount = pUserLists->GetCount();
308 String aEntry;
310 if ( nCount > 0 )
312 for ( USHORT i=0; i<nCount; i++ )
314 aEntry = (*pUserLists)[i]->GetString();
315 DBG_ASSERT( aEntry.Len() > 0, "Empty UserList-entry :-/" );
316 aLbLists.InsertEntry( aEntry );
320 return nCount;
323 // -----------------------------------------------------------------------
325 void ScTpUserLists::UpdateEntries( USHORT nList )
327 if ( !pUserLists ) return;
329 //----------------------------------------------------------
331 if ( nList < pUserLists->GetCount() )
333 ScUserListData* pList = (*pUserLists)[nList];
334 USHORT nSubCount = pList->GetSubCount();
335 String aEntryListStr;
337 for ( USHORT i=0; i<nSubCount; i++ )
339 if ( i!=0 )
340 aEntryListStr += CR;
341 aEntryListStr += pList->GetSubStr( i );
344 aEntryListStr.ConvertLineEnd();
345 aEdEntries.SetText( aEntryListStr );
347 else
349 DBG_ERROR( "Invalid ListIndex :-/" );
353 // -----------------------------------------------------------------------
355 void ScTpUserLists::MakeListStr( String& rListStr )
357 String aInputStr(rListStr);
358 String aStr;
360 xub_StrLen nLen = aStr.Len();
361 xub_StrLen c = 0;
363 aInputStr.ConvertLineEnd( LINEEND_LF );
364 //aStr.EraseAllChars( ' ' );
366 xub_StrLen nToken=rListStr.GetTokenCount(LF);
368 for(xub_StrLen i=0;i<nToken;i++)
370 String aString=rListStr.GetToken(i,LF);
371 aString.EraseLeadingChars(' ');
372 aString.EraseTrailingChars(' ');
373 aStr+=aString;
374 aStr+=cDelimiter;
378 // '\n' durch cDelimiter ersetzen:
379 for ( c=0;
380 (c < nLen) && (nFound != STRING_NOTFOUND);
381 c++ )
383 nFound = aStr.Search( LF, nFound );
384 if ( nFound != STRING_NOTFOUND )
385 aStr[nFound] = cDelimiter;
389 aStr.EraseLeadingChars( cDelimiter );
390 aStr.EraseTrailingChars( cDelimiter );
391 nLen = aStr.Len();
393 rListStr.Erase();
395 // Alle Doppelten cDelimiter entfernen:
396 c=0;
397 while ( c < nLen )
399 rListStr += aStr.GetChar(c);
400 c++;
402 if ( aStr.GetChar(c) == cDelimiter )
404 rListStr += aStr.GetChar(c);
406 while ( (aStr.GetChar(c) == cDelimiter) && (c < nLen) )
407 c++;
413 // -----------------------------------------------------------------------
415 void ScTpUserLists::AddNewList( const String& rEntriesStr )
417 String theEntriesStr( rEntriesStr );
419 if ( !pUserLists )
420 pUserLists = new ScUserList;
422 MakeListStr( theEntriesStr );
424 if ( !pUserLists->Insert( new ScUserListData( theEntriesStr ) ) )
426 DBG_ERROR( "Entry could not be inserted :-/" );
430 // -----------------------------------------------------------------------
432 void ScTpUserLists::CopyListFromArea( const ScRefAddress& rStartPos,
433 const ScRefAddress& rEndPos )
435 if ( bCopyDone ) return;
437 //----------------------------------------------------------
439 SCTAB nTab = rStartPos.Tab();
440 SCCOL nStartCol = rStartPos.Col();
441 SCROW nStartRow = rStartPos.Row();
442 SCCOL nEndCol = rEndPos.Col();
443 SCROW nEndRow = rEndPos.Row();
444 USHORT nCellDir = SCRET_COLS;
445 BOOL bValueIgnored = FALSE;
447 if ( (nStartCol != nEndCol) && (nStartRow != nEndRow) )
449 nCellDir = ScColOrRowDlg( this, aStrCopyList, aStrCopyFrom ).Execute();
450 //CHINA001 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
451 //CHINA001 DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
452 //CHINA001
453 //CHINA001 VclAbstractDialog* pDlg = pFact->CreateScColOrRowDlg( this, aStrCopyList, aStrCopyFrom,ResId(RID_SCDLG_COLORROW) );
454 //CHINA001 DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
455 //CHINA001 nCellDir = pDlg->Execute();
456 //CHINA001 delete pDlg; //CHINA001
458 else if ( nStartCol != nEndCol )
459 nCellDir = SCRET_ROWS;
460 else
461 nCellDir = SCRET_COLS;
463 if ( nCellDir != RET_CANCEL )
465 String aStrList;
466 String aStrField;
468 if ( nCellDir == SCRET_COLS )
470 for ( SCCOL col=nStartCol; col<=nEndCol; col++ )
472 for ( SCROW row=nStartRow; row<=nEndRow; row++ )
474 if ( pDoc->HasStringData( col, row, nTab ) )
476 pDoc->GetString( col, row, nTab, aStrField );
478 if ( aStrField.Len() > 0 )
480 aStrList += aStrField;
481 aStrList += '\n';
484 else
485 bValueIgnored = TRUE;
487 if ( aStrList.Len() > 0 )
488 AddNewList( aStrList );
489 aStrList.Erase();
492 else
494 for ( SCROW row=nStartRow; row<=nEndRow; row++ )
496 for ( SCCOL col=nStartCol; col<=nEndCol; col++ )
498 if ( pDoc->HasStringData( col, row, nTab ) )
500 pDoc->GetString( col, row, nTab, aStrField );
502 if ( aStrField.Len() > 0 )
504 aStrList += aStrField;
505 aStrList += '\n';
508 else
509 bValueIgnored = TRUE;
511 if ( aStrList.Len() > 0 )
512 AddNewList( aStrList );
513 aStrList.Erase();
517 if ( bValueIgnored )
519 InfoBox( this, aStrCopyErr ).Execute();
523 //----------------------------------------------------------
525 bCopyDone = TRUE;
529 // -----------------------------------------------------------------------
531 void ScTpUserLists::ModifyList( USHORT nSelList,
532 const String& rEntriesStr )
534 if ( !pUserLists ) return;
536 //----------------------------------------------------------
538 String theEntriesStr( rEntriesStr );
540 MakeListStr( theEntriesStr );
542 (*pUserLists)[nSelList]->SetString( theEntriesStr );
545 // -----------------------------------------------------------------------
547 void ScTpUserLists::RemoveList( USHORT nList )
549 if ( pUserLists ) pUserLists->AtFree( nList );
552 //-----------------------------------------------------------------------
553 // Handler:
554 //---------
556 IMPL_LINK( ScTpUserLists, LbSelectHdl, ListBox*, pLb )
558 if ( pLb == &aLbLists )
560 USHORT nSelPos = aLbLists.GetSelectEntryPos();
561 if ( nSelPos != LISTBOX_ENTRY_NOTFOUND )
563 if ( !aFtEntries.IsEnabled() ) aFtEntries.Enable();
564 if ( !aEdEntries.IsEnabled() ) aEdEntries.Enable();
565 if ( !aBtnRemove.IsEnabled() ) aBtnRemove.Enable();
566 if ( aBtnAdd.IsEnabled() ) aBtnAdd.Disable();
568 UpdateEntries( nSelPos );
572 return 0;
575 // -----------------------------------------------------------------------
577 IMPL_LINK( ScTpUserLists, BtnClickHdl, PushButton*, pBtn )
579 if ( pBtn == &aBtnNew )
581 if ( !bCancelMode )
583 nCancelPos = ( aLbLists.GetEntryCount() > 0 )
584 ? aLbLists.GetSelectEntryPos()
585 : 0;
586 aLbLists.SetNoSelection();
587 aFtLists.Disable();
588 aLbLists.Disable();
589 aFtEntries.Enable();
590 aEdEntries.Enable();
591 aEdEntries.SetText( EMPTY_STRING );
592 aEdEntries.GrabFocus();
593 aBtnAdd.Disable();
594 aBtnRemove.Disable();
595 //-----------------------------
596 if ( aBtnCopy.IsEnabled() )
598 aBtnCopy.Disable();
599 aFtCopyFrom.Disable();
600 aEdCopyFrom.Disable();
602 aBtnNew.SetText( aStrCancel );
603 bCancelMode = TRUE;
605 else // if ( bCancelMode )
607 if ( aLbLists.GetEntryCount() > 0 )
609 aLbLists.SelectEntryPos( nCancelPos );
610 LbSelectHdl( &aLbLists );
611 aFtLists.Enable();
612 aLbLists.Enable();
614 else
616 aFtEntries.Disable();
617 aEdEntries.Disable();
618 aEdEntries.SetText( EMPTY_STRING );
619 aBtnRemove.Disable();
621 aBtnAdd.Disable();
622 //-----------------------------
623 if ( pViewData && !bCopyDone )
625 aBtnCopy.Enable();
626 aFtCopyFrom.Enable();
627 aEdCopyFrom.Enable();
629 aBtnNew.SetText( aStrNew );
630 bCancelMode = FALSE;
631 bModifyMode = FALSE;
634 else if ( pBtn == &aBtnAdd )
636 String theEntriesStr( aEdEntries.GetText() );
638 if ( !bModifyMode )
640 if ( theEntriesStr.Len() > 0 )
642 AddNewList( theEntriesStr );
643 UpdateUserListBox();
644 aLbLists.SelectEntryPos( aLbLists.GetEntryCount()-1 );
645 LbSelectHdl( &aLbLists );
646 aFtLists.Enable();
647 aLbLists.Enable();
649 else
651 if ( aLbLists.GetEntryCount() > 0 )
653 aLbLists.SelectEntryPos( nCancelPos );
654 LbSelectHdl( &aLbLists );
655 aLbLists.Enable();
656 aLbLists.Enable();
660 aBtnAdd.Disable();
661 aBtnRemove.Enable();
662 aBtnNew.SetText( aStrNew );
663 bCancelMode = FALSE;
665 else // if ( bModifyMode )
667 USHORT nSelList = aLbLists.GetSelectEntryPos();
669 DBG_ASSERT( nSelList != LISTBOX_ENTRY_NOTFOUND, "Modify without List :-/" );
671 if ( theEntriesStr.Len() > 0 )
673 ModifyList( nSelList, theEntriesStr );
674 UpdateUserListBox();
675 aLbLists.SelectEntryPos( nSelList );
677 else
679 aLbLists.SelectEntryPos( 0 );
680 LbSelectHdl( &aLbLists );
683 aBtnNew.SetText( aStrNew ); bCancelMode = FALSE;
684 aBtnAdd.SetText( aStrAdd ); bModifyMode = FALSE;
685 aBtnAdd.Disable();
686 aBtnRemove.Enable();
687 aFtLists.Enable();
688 aLbLists.Enable();
691 if ( pViewData && !bCopyDone )
693 aBtnCopy.Enable();
694 aFtCopyFrom.Enable();
695 aEdCopyFrom.Enable();
698 else if ( pBtn == &aBtnRemove )
700 if ( aLbLists.GetEntryCount() > 0 )
702 USHORT nRemovePos = aLbLists.GetSelectEntryPos();
703 String aMsg ( aStrQueryRemove.GetToken( 0, '#' ) );
705 aMsg += aLbLists.GetEntry( nRemovePos );
706 aMsg += aStrQueryRemove.GetToken( 1, '#' );
709 if ( RET_YES == QueryBox( this,
710 WinBits( WB_YES_NO | WB_DEF_YES ),
711 aMsg
712 ).Execute() )
714 RemoveList( nRemovePos );
715 UpdateUserListBox();
717 if ( aLbLists.GetEntryCount() > 0 )
719 aLbLists.SelectEntryPos(
720 ( nRemovePos >= aLbLists.GetEntryCount() )
721 ? aLbLists.GetEntryCount()-1
722 : nRemovePos );
723 LbSelectHdl( &aLbLists );
725 else
727 aFtLists.Disable();
728 aLbLists.Disable();
729 aFtEntries.Disable();
730 aEdEntries.Disable();
731 aEdEntries.SetText( EMPTY_STRING );
732 aBtnRemove.Disable();
736 if ( pViewData && !bCopyDone && !aBtnCopy.IsEnabled() )
738 aBtnCopy.Enable();
739 aFtCopyFrom.Enable();
740 aEdCopyFrom.Enable();
744 else if ( pViewData && (pBtn == &aBtnCopy) )
746 if ( bCopyDone )
747 return 0;
749 //-----------------------------------------------------------
751 ScRefAddress theStartPos;
752 ScRefAddress theEndPos;
753 String theAreaStr( aEdCopyFrom.GetText() );
754 BOOL bAreaOk = FALSE;
756 if ( theAreaStr.Len() > 0 )
758 bAreaOk = pRangeUtil->IsAbsArea( theAreaStr,
759 pDoc,
760 pViewData->GetTabNo(),
761 &theAreaStr,
762 &theStartPos,
763 &theEndPos,
764 pDoc->GetAddressConvention() );
765 if ( !bAreaOk )
767 bAreaOk = pRangeUtil->IsAbsPos( theAreaStr,
768 pDoc,
769 pViewData->GetTabNo(),
770 &theAreaStr,
771 &theStartPos,
772 pDoc->GetAddressConvention() );
773 theEndPos = theStartPos;
777 if ( bAreaOk )
779 CopyListFromArea( theStartPos, theEndPos );
780 UpdateUserListBox();
781 aLbLists.SelectEntryPos( aLbLists.GetEntryCount()-1 );
782 LbSelectHdl( &aLbLists );
783 aEdCopyFrom .SetText( theAreaStr );
784 aEdCopyFrom .Disable();
785 aBtnCopy .Disable();
786 aFtCopyFrom .Disable();
788 else
790 ErrorBox( this, WinBits( WB_OK | WB_DEF_OK ),
791 ScGlobal::GetRscString( STR_INVALID_TABREF )
792 ).Execute();
793 aEdCopyFrom.GrabFocus();
794 aEdCopyFrom.SetSelection( Selection( 0, SELECTION_MAX ) );
798 return 0;
801 // -----------------------------------------------------------------------
803 IMPL_LINK( ScTpUserLists, EdEntriesModHdl, MultiLineEdit*, pEd )
805 if ( pEd != &aEdEntries )
806 return 0;
808 //-----------------------------------------------------------
810 if ( aBtnCopy.IsEnabled() )
812 aBtnCopy .Disable();
813 aFtCopyFrom .Disable();
814 aEdCopyFrom .Disable();
817 if ( aEdEntries.GetText().Len() > 0 )
819 if ( !bCancelMode && !bModifyMode )
821 aBtnNew.SetText( aStrCancel ); bCancelMode = TRUE;
822 aBtnAdd.SetText( aStrModify ); bModifyMode = TRUE;
823 aBtnAdd.Enable();
824 aBtnRemove.Disable();
825 aFtLists.Disable();
826 aLbLists.Disable();
828 else // if ( bCancelMode || bModifyMode )
830 if ( !aBtnAdd.IsEnabled() ) aBtnAdd.Enable();
833 else
835 if ( aBtnAdd.IsEnabled() ) aBtnAdd.Disable();
838 return 0;