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