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