Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #ifdef SD_DLLIMPLEMENTATION
31 : : #undef SD_DLLIMPLEMENTATION
32 : : #endif
33 : :
34 : : #include "custsdlg.hxx"
35 : : #include "custsdlg.hrc"
36 : :
37 : : #include "strings.hrc"
38 : : #include "sdresid.hxx"
39 : :
40 : : #include "drawdoc.hxx"
41 : : #include "sdpage.hxx"
42 : : #include "cusshow.hxx"
43 : : #include "app.hxx"
44 : : #include "customshowlist.hxx"
45 : : #include <vcl/msgbox.hxx>
46 : :
47 : :
48 : : /////////////////////
49 : : // SdCustomShowDlg //
50 : : /////////////////////
51 : :
52 : :
53 : : /*************************************************************************
54 : : |* Konstruktor
55 : : \************************************************************************/
56 : 0 : SdCustomShowDlg::SdCustomShowDlg( Window* pWindow,
57 : : SdDrawDocument& rDrawDoc ) :
58 : : ModalDialog ( pWindow, SdResId( DLG_CUSTOMSHOW ) ),
59 : :
60 : : aLbCustomShows ( this, SdResId( LB_CUSTOMSHOWS ) ),
61 : : aCbxUseCustomShow( this, SdResId( CBX_USE_CUSTOMSHOW ) ),
62 : : aBtnNew ( this, SdResId( BTN_NEW ) ),
63 : : aBtnEdit ( this, SdResId( BTN_EDIT ) ),
64 : : aBtnRemove ( this, SdResId( BTN_REMOVE ) ),
65 : : aBtnCopy ( this, SdResId( BTN_COPY ) ),
66 : : aBtnHelp ( this, SdResId( BTN_HELP ) ),
67 : : aBtnStartShow ( this, SdResId( BTN_STARTSHOW ) ),
68 : : aBtnOK ( this, SdResId( BTN_OK ) ),
69 : :
70 : : rDoc ( rDrawDoc ),
71 : : pCustomShowList ( NULL ),
72 : : pCustomShow ( NULL ),
73 : 0 : bModified ( sal_False )
74 : : {
75 : 0 : FreeResource();
76 : :
77 : 0 : Link aLink( LINK( this, SdCustomShowDlg, ClickButtonHdl ) );
78 : 0 : aBtnNew.SetClickHdl( aLink );
79 : 0 : aBtnEdit.SetClickHdl( aLink );
80 : 0 : aBtnRemove.SetClickHdl( aLink );
81 : 0 : aBtnCopy.SetClickHdl( aLink );
82 : 0 : aCbxUseCustomShow.SetClickHdl( aLink );
83 : 0 : aLbCustomShows.SetSelectHdl( aLink );
84 : :
85 : 0 : aBtnStartShow.SetClickHdl( LINK( this, SdCustomShowDlg, StartShowHdl ) ); // Testweise
86 : :
87 : : // CustomShow-Liste des Docs abrufen
88 : 0 : pCustomShowList = rDoc.GetCustomShowList();
89 : 0 : if( pCustomShowList )
90 : : {
91 : 0 : long nPosToSelect = pCustomShowList->GetCurPos();
92 : : // ListBox mit CustomShows fuellen
93 : 0 : for( pCustomShow = pCustomShowList->First();
94 : : pCustomShow != NULL;
95 : 0 : pCustomShow = pCustomShowList->Next() )
96 : : {
97 : 0 : aLbCustomShows.InsertEntry( pCustomShow->GetName() );
98 : : }
99 : 0 : aLbCustomShows.SelectEntryPos( (sal_uInt16)nPosToSelect );
100 : 0 : pCustomShowList->Seek( nPosToSelect );
101 : : }
102 : :
103 : 0 : aCbxUseCustomShow.Check( pCustomShowList && rDoc.getPresentationSettings().mbCustomShow );
104 : :
105 : 0 : CheckState();
106 : 0 : }
107 : :
108 : : /*************************************************************************
109 : : |* Dtor
110 : : \************************************************************************/
111 : 0 : SdCustomShowDlg::~SdCustomShowDlg()
112 : : {
113 : 0 : }
114 : :
115 : : /*************************************************************************
116 : : |* CheckState
117 : : \************************************************************************/
118 : 0 : void SdCustomShowDlg::CheckState()
119 : : {
120 : 0 : sal_uInt16 nPos = aLbCustomShows.GetSelectEntryPos();
121 : :
122 : 0 : sal_Bool bEnable = nPos != LISTBOX_ENTRY_NOTFOUND;
123 : 0 : aBtnEdit.Enable( bEnable );
124 : 0 : aBtnRemove.Enable( bEnable );
125 : 0 : aBtnCopy.Enable( bEnable );
126 : 0 : aCbxUseCustomShow.Enable( bEnable );
127 : 0 : aBtnStartShow.Enable( true );
128 : :
129 : 0 : if( bEnable )
130 : 0 : pCustomShowList->Seek( nPos );
131 : 0 : }
132 : :
133 : : /*************************************************************************
134 : : |* ButtonHdl()
135 : : \************************************************************************/
136 : 0 : IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p )
137 : : {
138 : : // Neue CustomShow
139 : 0 : if( p == &aBtnNew )
140 : : {
141 : 0 : pCustomShow = NULL;
142 : 0 : SdDefineCustomShowDlg aDlg( this, rDoc, pCustomShow );
143 : 0 : if( aDlg.Execute() == RET_OK )
144 : : {
145 : 0 : if( pCustomShow )
146 : : {
147 : 0 : if( !pCustomShowList )
148 : 0 : pCustomShowList = rDoc.GetCustomShowList( sal_True );
149 : :
150 : 0 : pCustomShowList->push_back( pCustomShow );
151 : 0 : pCustomShowList->Last();
152 : 0 : aLbCustomShows.InsertEntry( pCustomShow->GetName() );
153 : 0 : aLbCustomShows.SelectEntry( pCustomShow->GetName() );
154 : : }
155 : :
156 : 0 : if( aDlg.IsModified() )
157 : 0 : bModified = sal_True;
158 : : }
159 : 0 : else if( pCustomShow )
160 : 0 : DELETEZ( pCustomShow );
161 : : }
162 : : // CustomShow bearbeiten
163 : 0 : else if( p == &aBtnEdit )
164 : : {
165 : 0 : sal_uInt16 nPos = aLbCustomShows.GetSelectEntryPos();
166 : 0 : if( nPos != LISTBOX_ENTRY_NOTFOUND )
167 : : {
168 : : DBG_ASSERT( pCustomShowList, "pCustomShowList existiert nicht" );
169 : 0 : pCustomShow = (*pCustomShowList)[ nPos ];
170 : 0 : SdDefineCustomShowDlg aDlg( this, rDoc, pCustomShow );
171 : :
172 : 0 : if( aDlg.Execute() == RET_OK )
173 : : {
174 : 0 : if( pCustomShow )
175 : : {
176 : 0 : (*pCustomShowList)[nPos] = pCustomShow;
177 : 0 : pCustomShowList->Seek( nPos );
178 : 0 : aLbCustomShows.RemoveEntry( nPos );
179 : 0 : aLbCustomShows.InsertEntry( pCustomShow->GetName(), nPos );
180 : 0 : aLbCustomShows.SelectEntryPos( nPos );
181 : : }
182 : 0 : if( aDlg.IsModified() )
183 : 0 : bModified = sal_True;
184 : 0 : }
185 : : }
186 : : }
187 : : // CustomShow loeschen
188 : 0 : else if( p == &aBtnRemove )
189 : : {
190 : 0 : sal_uInt16 nPos = aLbCustomShows.GetSelectEntryPos();
191 : 0 : if( nPos != LISTBOX_ENTRY_NOTFOUND )
192 : : {
193 : 0 : delete *pCustomShowList->erase( pCustomShowList->begin() + nPos );
194 : 0 : aLbCustomShows.RemoveEntry( nPos );
195 : 0 : aLbCustomShows.SelectEntryPos( nPos == 0 ? nPos : nPos - 1 );
196 : 0 : bModified = sal_True;
197 : : }
198 : : }
199 : : // CustomShow kopieren
200 : 0 : else if( p == &aBtnCopy )
201 : : {
202 : 0 : sal_uInt16 nPos = aLbCustomShows.GetSelectEntryPos();
203 : 0 : if( nPos != LISTBOX_ENTRY_NOTFOUND )
204 : : {
205 : 0 : SdCustomShow* pShow = new SdCustomShow( *(*pCustomShowList)[nPos] );
206 : 0 : String aStr( pShow->GetName() );
207 : 0 : String aStrCopy( SdResId( STR_COPY_CUSTOMSHOW ) );
208 : :
209 : 0 : sal_uInt16 nStrPos = aStr.Search( aStrCopy );
210 : 0 : sal_uInt16 nNum = 1;
211 : 0 : if( nStrPos == STRING_NOTFOUND )
212 : : {
213 : 0 : aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) );
214 : 0 : aStr.Append( aStrCopy );
215 : 0 : aStr.Append( UniString::CreateFromInt32( nNum ) );
216 : 0 : aStr.Append( sal_Unicode(')') );
217 : 0 : nStrPos = aStr.Search( aStrCopy );
218 : : }
219 : 0 : nStrPos = nStrPos + (sal_uInt16)aStrCopy.Len();
220 : : // Um nicht ins Nirvana zu greifen (--> Endlosschleife)
221 : 0 : if( nStrPos >= aStr.Len() )
222 : : {
223 : 0 : aStr.Append( sal_Unicode(' ') );
224 : 0 : aStr.Append( UniString::CreateFromInt32( nNum ) );
225 : : }
226 : :
227 : : // Name ueberpruefen...
228 : 0 : sal_Bool bDifferent = sal_False;
229 : : //long nPosToSelect = pCustomShowList->GetCurPos();
230 : 0 : while( !bDifferent )
231 : : {
232 : 0 : bDifferent = sal_True;
233 : 0 : for( pCustomShow = (SdCustomShow*) pCustomShowList->First();
234 : : pCustomShow != NULL && bDifferent;
235 : 0 : pCustomShow = (SdCustomShow*) pCustomShowList->Next() )
236 : : {
237 : 0 : if( aStr == pCustomShow->GetName() )
238 : 0 : bDifferent = sal_False;
239 : : }
240 : 0 : if( !bDifferent )
241 : : {
242 : : // Nummer entfernen und durch um 1 erhoehte ersetzen
243 : :
244 : 0 : const CharClass* pCharClass = rDoc.GetCharClass();
245 : 0 : while( pCharClass->isDigit( aStr, nStrPos ) )
246 : 0 : aStr.Erase( nStrPos, 1 );
247 : 0 : aStr.Insert( UniString::CreateFromInt32( ++nNum ), nStrPos);
248 : : }
249 : :
250 : : }
251 : : //pCustomShowList->Seek( nPosToSelect );
252 : 0 : pShow->SetName( aStr );
253 : :
254 : 0 : pCustomShowList->push_back( pShow );
255 : 0 : pCustomShowList->Last();
256 : 0 : aLbCustomShows.InsertEntry( pShow->GetName() );
257 : 0 : aLbCustomShows.SelectEntry( pShow->GetName() );
258 : :
259 : :
260 : 0 : bModified = sal_True;
261 : : }
262 : : }
263 : 0 : else if( p == &aLbCustomShows )
264 : : {
265 : 0 : sal_uInt16 nPos = aLbCustomShows.GetSelectEntryPos();
266 : 0 : if( nPos != LISTBOX_ENTRY_NOTFOUND )
267 : 0 : pCustomShowList->Seek( nPos );
268 : :
269 : 0 : bModified = sal_True;
270 : : }
271 : 0 : else if( p == &aCbxUseCustomShow )
272 : : {
273 : 0 : bModified = sal_True;
274 : : }
275 : :
276 : 0 : CheckState();
277 : :
278 : 0 : return( 0L );
279 : : }
280 : :
281 : : /*************************************************************************
282 : : |* StartShow-Hdl
283 : : \************************************************************************/
284 : 0 : IMPL_LINK_NOARG(SdCustomShowDlg, StartShowHdl)
285 : : {
286 : 0 : EndDialog( RET_YES );
287 : :
288 : 0 : return 0;
289 : : }
290 : :
291 : : /*************************************************************************
292 : : |* CheckState
293 : : \************************************************************************/
294 : 0 : sal_Bool SdCustomShowDlg::IsCustomShow() const
295 : : {
296 : 0 : return( aCbxUseCustomShow.IsEnabled() && aCbxUseCustomShow.IsChecked() );
297 : : }
298 : :
299 : :
300 : :
301 : : ///////////////////////////
302 : : // SdDefineCustomShowDlg //
303 : : ///////////////////////////
304 : :
305 : :
306 : : /*************************************************************************
307 : : |*
308 : : |* Konstruktor
309 : : |*
310 : : \************************************************************************/
311 : 0 : SdDefineCustomShowDlg::SdDefineCustomShowDlg( Window* pWindow,
312 : : SdDrawDocument& rDrawDoc, SdCustomShow*& rpCS ) :
313 : : ModalDialog ( pWindow, SdResId( DLG_DEFINE_CUSTOMSHOW ) ),
314 : :
315 : : aFtName ( this, SdResId( FT_NAME ) ),
316 : : aEdtName ( this, SdResId( EDT_NAME ) ),
317 : : aFtPages ( this, SdResId( FT_PAGES ) ),
318 : : aLbPages ( this, SdResId( LB_PAGES ) ),
319 : : aBtnAdd ( this, SdResId( BTN_ADD ) ),
320 : : aBtnRemove ( this, SdResId( BTN_REMOVE ) ),
321 : : aFtCustomPages ( this, SdResId( FT_CUSTOM_PAGES ) ),
322 : : aLbCustomPages ( this, SdResId( LB_CUSTOM_PAGES ) ),
323 : : aBtnOK ( this, SdResId( BTN_OK ) ),
324 : : aBtnCancel ( this, SdResId( BTN_CANCEL ) ),
325 : : aBtnHelp ( this, SdResId( BTN_HELP ) ),
326 : :
327 : : rDoc ( rDrawDoc ),
328 : : rpCustomShow ( rpCS ),
329 : 0 : bModified ( sal_False )
330 : : {
331 : 0 : FreeResource();
332 : :
333 : 0 : Link aLink = LINK( this, SdDefineCustomShowDlg, ClickButtonHdl );
334 : 0 : aBtnAdd.SetClickHdl( aLink );
335 : 0 : aBtnRemove.SetClickHdl( aLink );
336 : 0 : aEdtName.SetModifyHdl( aLink );
337 : 0 : aLbPages.SetSelectHdl( aLink ); // wegen Status
338 : 0 : aLbCustomPages.SetSelectHdl( aLink ); // wegen Status
339 : :
340 : 0 : aBtnOK.SetClickHdl( LINK( this, SdDefineCustomShowDlg, OKHdl ) );
341 : :
342 : : SdPage* pPage;
343 : : // Listbox mit Seitennamen des Docs fuellen
344 : 0 : for( long nPage = 0L;
345 : 0 : nPage < rDoc.GetSdPageCount( PK_STANDARD );
346 : : nPage++ )
347 : : {
348 : 0 : pPage = rDoc.GetSdPage( (sal_uInt16) nPage, PK_STANDARD );
349 : 0 : String aStr( pPage->GetName() );
350 : 0 : aLbPages.InsertEntry( aStr );
351 : 0 : }
352 : : //aLbPages.SelectEntryPos( 0 );
353 : :
354 : 0 : if( rpCustomShow )
355 : : {
356 : 0 : aOldName = rpCustomShow->GetName();
357 : 0 : aEdtName.SetText( aOldName );
358 : :
359 : : // ListBox mit CustomShow-Seiten fuellen
360 : 0 : for( SdCustomShow::PageVec::iterator it = rpCustomShow->PagesVector().begin();
361 : 0 : it != rpCustomShow->PagesVector().end(); ++it )
362 : : {
363 : 0 : SvLBoxEntry* pEntry = aLbCustomPages.InsertEntry( (*it)->GetName() );
364 : 0 : pEntry->SetUserData( (SdPage*) (*it) );
365 : : }
366 : : }
367 : : else
368 : : {
369 : 0 : rpCustomShow = new SdCustomShow( &rDoc );
370 : 0 : aEdtName.SetText( String( SdResId( STR_NEW_CUSTOMSHOW ) ) );
371 : 0 : aEdtName.SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
372 : 0 : rpCustomShow->SetName( aEdtName.GetText() );
373 : : }
374 : :
375 : 0 : aLbCustomPages.SetDragDropMode( SV_DRAGDROP_CTRL_MOVE );
376 : 0 : aLbCustomPages.SetHighlightRange();
377 : :
378 : 0 : aBtnOK.Enable( sal_False );
379 : 0 : CheckState();
380 : 0 : }
381 : :
382 : : /*************************************************************************
383 : : |*
384 : : |* Dtor
385 : : |*
386 : : \************************************************************************/
387 : 0 : SdDefineCustomShowDlg::~SdDefineCustomShowDlg()
388 : : {
389 : 0 : }
390 : :
391 : : /*************************************************************************
392 : : |* CheckState
393 : : \************************************************************************/
394 : 0 : void SdDefineCustomShowDlg::CheckState()
395 : : {
396 : 0 : sal_Bool bPages = aLbPages.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND;
397 : : //sal_Bool bCSPages = aLbCustomPages.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND;
398 : 0 : sal_Bool bCSPages = aLbCustomPages.FirstSelected() != NULL;
399 : 0 : sal_Bool bCount = aLbCustomPages.GetEntryCount() > 0;
400 : :
401 : 0 : aBtnOK.Enable( bCount );
402 : 0 : aBtnAdd.Enable( bPages );
403 : 0 : aBtnRemove.Enable( bCSPages );
404 : 0 : }
405 : :
406 : : /*************************************************************************
407 : : |* ButtonHdl()
408 : : \************************************************************************/
409 : 0 : IMPL_LINK( SdDefineCustomShowDlg, ClickButtonHdl, void *, p )
410 : : {
411 : 0 : if( p == &aBtnAdd )
412 : : {
413 : 0 : sal_uInt16 nCount = aLbPages.GetSelectEntryCount();
414 : 0 : if( nCount > 0 )
415 : : {
416 : 0 : sal_uLong nPosCP = LIST_APPEND;
417 : 0 : SvLBoxEntry* pEntry = aLbCustomPages.FirstSelected();
418 : 0 : if( pEntry )
419 : 0 : nPosCP = aLbCustomPages.GetModel()->GetAbsPos( pEntry ) + 1L;
420 : :
421 : 0 : for( sal_uInt16 i = 0; i < nCount; i++ )
422 : : {
423 : 0 : String aStr = aLbPages.GetSelectEntry( i );
424 : : pEntry = aLbCustomPages.InsertEntry( aStr,
425 : 0 : 0, sal_False, nPosCP );
426 : :
427 : 0 : aLbCustomPages.Select( pEntry );
428 : : SdPage* pPage = rDoc.GetSdPage( (sal_uInt16) aLbPages.
429 : 0 : GetSelectEntryPos( i ), PK_STANDARD );
430 : 0 : pEntry->SetUserData( pPage );
431 : :
432 : 0 : if( nPosCP != LIST_APPEND )
433 : 0 : nPosCP++;
434 : 0 : }
435 : 0 : bModified = sal_True;
436 : : }
437 : : }
438 : 0 : else if( p == &aBtnRemove )
439 : : {
440 : : //sal_uInt16 nPos = aLbCustomPages.GetSelectEntryPos();
441 : 0 : SvLBoxEntry* pEntry = aLbCustomPages.FirstSelected();
442 : 0 : if( pEntry )
443 : : {
444 : 0 : sal_uLong nPos = aLbCustomPages.GetModel()->GetAbsPos( pEntry );
445 : : //rpCustomShow->Remove( nPos );
446 : : //aLbCustomPages.RemoveEntry( nPos );
447 : 0 : aLbCustomPages.GetModel()->Remove( aLbCustomPages.GetModel()->GetEntryAtAbsPos( nPos ) );
448 : :
449 : 0 : bModified = sal_True;
450 : : }
451 : : }
452 : 0 : else if( p == &aEdtName )
453 : : {
454 : : //rpCustomShow->SetName( aEdtName.GetText() );
455 : :
456 : 0 : bModified = sal_True;
457 : : }
458 : :
459 : 0 : CheckState();
460 : :
461 : 0 : return( 0L );
462 : : }
463 : :
464 : : /*************************************************************************
465 : : |* CheckCustomShow():
466 : : |* Ueberprueft die Page-Pointer der Show, da die Eintraege ueber die
467 : : |* TreeLB verschoben und kopiert werden k”nnen
468 : : \************************************************************************/
469 : 0 : void SdDefineCustomShowDlg::CheckCustomShow()
470 : : {
471 : 0 : sal_Bool bDifferent = sal_False;
472 : 0 : SdPage* pPage = NULL;
473 : 0 : SvLBoxEntry* pEntry = NULL;
474 : :
475 : : // Anzahl vergleichen
476 : 0 : if( rpCustomShow->PagesVector().size() != aLbCustomPages.GetEntryCount() )
477 : : {
478 : 0 : rpCustomShow->PagesVector().clear();
479 : 0 : bDifferent = sal_True;
480 : : }
481 : :
482 : : // Seiten-Pointer vergleichen
483 : 0 : if( !bDifferent )
484 : : {
485 : 0 : SdCustomShow::PageVec::iterator it1 = rpCustomShow->PagesVector().begin();
486 : 0 : pEntry = aLbCustomPages.First();
487 : 0 : for( ; it1 != rpCustomShow->PagesVector().end() && pEntry != NULL && !bDifferent;
488 : 0 : ++it1, pEntry = aLbCustomPages.Next( pEntry ) )
489 : : {
490 : 0 : if( *it1 != pEntry->GetUserData() )
491 : : {
492 : 0 : rpCustomShow->PagesVector().clear();
493 : 0 : bDifferent = sal_True;
494 : : }
495 : : }
496 : : }
497 : :
498 : : // Seiten-Pointer neu setzen
499 : 0 : if( bDifferent )
500 : : {
501 : 0 : for( pEntry = aLbCustomPages.First();
502 : : pEntry != NULL;
503 : 0 : pEntry = aLbCustomPages.Next( pEntry ) )
504 : : {
505 : 0 : pPage = (SdPage*) pEntry->GetUserData();
506 : 0 : rpCustomShow->PagesVector().push_back( pPage );
507 : : }
508 : 0 : bModified = sal_True;
509 : : }
510 : :
511 : : // Name vergleichen und ggfs. setzen
512 : 0 : String aStr( aEdtName.GetText() );
513 : 0 : if( rpCustomShow->GetName() != aStr )
514 : : {
515 : 0 : rpCustomShow->SetName( aStr );
516 : 0 : bModified = sal_True;
517 : 0 : }
518 : 0 : }
519 : :
520 : : /*************************************************************************
521 : : |* OK-Hdl
522 : : \************************************************************************/
523 : 0 : IMPL_LINK_NOARG(SdDefineCustomShowDlg, OKHdl)
524 : : {
525 : : // Name ueberpruefen...
526 : 0 : sal_Bool bDifferent = sal_True;
527 : 0 : SdCustomShowList* pCustomShowList = rDoc.GetCustomShowList();
528 : 0 : if( pCustomShowList )
529 : : {
530 : 0 : String aName( aEdtName.GetText() );
531 : : SdCustomShow* pCustomShow;
532 : :
533 : 0 : long nPosToSelect = pCustomShowList->GetCurPos();
534 : 0 : for( pCustomShow = pCustomShowList->First();
535 : : pCustomShow != NULL;
536 : : pCustomShow = pCustomShowList->Next() )
537 : : {
538 : 0 : if( aName == pCustomShow->GetName() && aName != aOldName )
539 : 0 : bDifferent = sal_False;
540 : : }
541 : 0 : pCustomShowList->Seek( nPosToSelect );
542 : : }
543 : :
544 : 0 : if( bDifferent )
545 : : {
546 : 0 : CheckCustomShow();
547 : :
548 : 0 : EndDialog( RET_OK );
549 : : }
550 : : else
551 : : {
552 : : WarningBox( this, WinBits( WB_OK ),
553 : 0 : String( SdResId( STR_WARN_NAME_DUPLICATE ) ) ).Execute();
554 : :
555 : 0 : aEdtName.GrabFocus();
556 : : }
557 : :
558 : 0 : return 0;
559 : : }
560 : :
561 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|