xref: /aoo42x/main/sfx2/source/dialog/mgetempl.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sfx2.hxx"
30 
31 // include ---------------------------------------------------------------
32 
33 #ifndef _MSGBOX_HXX //autogen
34 #include <vcl/msgbox.hxx>
35 #endif
36 #include <vcl/field.hxx>
37 #include <svl/eitem.hxx>
38 #include <svl/intitem.hxx>
39 #include <svl/style.hxx>
40 #ifndef GCC
41 #endif
42 
43 #include <sfx2/styfitem.hxx>
44 #include <sfx2/styledlg.hxx>
45 #include <sfx2/app.hxx>
46 #include <sfx2/mgetempl.hxx>
47 #include <sfx2/objsh.hxx>
48 #include "sfxtypes.hxx"
49 #include "sfx2/sfxresid.hxx"
50 #include <sfx2/module.hxx>
51 
52 #include <sfx2/sfx.hrc>
53 #include "dialog.hrc"
54 #include "mgetempl.hrc"
55 
56 #ifndef _SFX_STYLE_HRC
57 #include <svl/style.hrc>
58 #endif
59 
60 // SfxManageStyleSheetPage -----------------------------------------------
61 
62 SfxManageStyleSheetPage::SfxManageStyleSheetPage( Window* pParent, const SfxItemSet& rAttrSet ) :
63 
64 	SfxTabPage( pParent, SfxResId( TP_MANAGE_STYLES ), rAttrSet ),
65 
66 	aNameFt		( this, SfxResId( FT_NAME ) ),
67 	aNameEd		( this, SfxResId( ED_NAME ) ),
68 	aNameMLE	( this, SfxResId( MLE_NAME ) ),
69 	aAutoCB     ( this, SfxResId( CB_AUTO ) ),
70 
71 	aFollowFt	( this, SfxResId( FT_NEXT ) ),
72 	aFollowLb	( this, SfxResId( LB_NEXT ) ),
73 
74 	aBaseFt		( this, SfxResId( FT_BASE ) ),
75 	aBaseLb		( this, SfxResId( LB_BASE ) ),
76 
77 	aFilterFt	( this, SfxResId( FT_REGION ) ),
78 	aFilterLb	( this, SfxResId( LB_REGION ) ),
79 
80     aDescGb		( this, SfxResId( GB_DESC ) ),
81 	aDescFt		( this, SfxResId( FT_DESC ) ),
82 	aDescED		( this, SfxResId( ED_DESC ) ),
83 
84 	pStyle( &( (SfxStyleDialog*)pParent->GetParent() )->GetStyleSheet() ),
85 
86 	pItem		( 0 ),
87 	bModified	( sal_False ),
88 	aName		( pStyle->GetName() ),
89 	aFollow		( pStyle->GetFollow() ),
90 	aParent		( pStyle->GetParent() ),
91 	nFlags		( pStyle->GetMask() )
92 
93 /*  [Beschreibung]
94 
95 	Konstruktor; initialisiert die ListBoxen mit den Vorlagen
96 
97 */
98 
99 {
100 	FreeResource();
101 
102 	if ( IsBackground() )
103 		aDescED.SetBackground( GetBackground() );
104 	FixedInfo* pInfo = new FixedInfo( this );
105 	aDescED.SetFont( pInfo->GetFont() );
106 	delete pInfo;
107 
108 	aDescED.Hide();
109 	aDescFt.Show();
110 
111 	// diese Page braucht ExchangeSupport
112 	SetExchangeSupport();
113 
114     ResMgr* pResMgr = SFX_APP()->GetModule_Impl()->GetResMgr();
115 	DBG_ASSERT( pResMgr, "kein ResMgr am Modul" );
116 	pFamilies = new SfxStyleFamilies( ResId( DLG_STYLE_DESIGNER, *pResMgr ) );
117 
118 	SfxStyleSheetBasePool* pPool = 0;
119 	SfxObjectShell* pDocShell = SfxObjectShell::Current();
120 
121 	if ( pDocShell )
122 		pPool = pDocShell->GetStyleSheetPool();
123 	DBG_ASSERT( pPool, "kein Pool oder keine DocShell" );
124 
125 	if ( pPool )
126 	{
127 		pPool->SetSearchMask( pStyle->GetFamily() );
128 		pPool->First();     // fuer SW - interne Liste updaten
129 	}
130 
131 	if ( !pStyle->GetName().Len() && pPool )
132 	{
133 		// NullString als Name -> Name generieren
134 		String aNoName( SfxResId( STR_NONAME ) );
135 		sal_uInt16 nNo = 1;
136 		String aNo( aNoName );
137 		aNoName += String::CreateFromInt32( nNo );
138 		while ( pPool->Find( aNoName ) )
139 		{
140 			++nNo;
141 			aNoName = aNo;
142 			aNoName += String::CreateFromInt32( nNo );
143 		}
144 		pStyle->SetName( aNoName );
145 		aName = aNoName;
146 		aFollow = pStyle->GetFollow();
147 		aParent = pStyle->GetParent();
148 	}
149 	aNameEd.SetText(pStyle->GetName());
150 
151 	// Set the field read-only if it is NOT an user-defined style
152 	// but allow selecting and copying
153 	if ( !pStyle->IsUserDefined() ) {
154 		aNameEd.SetReadOnly();
155 		aNameEd.Hide();
156 
157     	aNameMLE.SetControlBackground( GetSettings().GetStyleSettings().GetDialogColor() );
158 		aNameMLE.SetText( pStyle->GetName() );
159 		aNameMLE.EnableCursor( sal_False );
160 		aNameMLE.Show();
161 	}
162 
163 	if ( pStyle->HasFollowSupport() && pPool )
164 	{
165 		SfxStyleSheetBase* pPoolStyle = pPool->First();
166 
167 		while ( pPoolStyle )
168 		{
169 			aFollowLb.InsertEntry( pPoolStyle->GetName() );
170 			pPoolStyle = pPool->Next();
171 		}
172 
173 		// eine neue Vorlage ist noch nicht im Pool
174 		if ( LISTBOX_ENTRY_NOTFOUND == aFollowLb.GetEntryPos( pStyle->GetName() ) )
175 			aFollowLb.InsertEntry( pStyle->GetName() );
176 	}
177 	else
178 	{
179 		aFollowFt.Hide();
180 		aFollowLb.Hide();
181 
182 		aFilterFt.SetPosPixel( aBaseFt.GetPosPixel() );
183 		aFilterLb.SetPosPixel( aBaseLb.GetPosPixel() );
184 
185 		aBaseFt.SetPosPixel( aFollowFt.GetPosPixel() );
186 		aBaseLb.SetPosPixel( aFollowLb.GetPosPixel() );
187 	}
188 
189 	if ( pStyle->HasParentSupport() && pPool )
190 	{
191 		if ( pStyle->HasClearParentSupport() )
192 			// die Basisvorlage darf auf NULL gesetzt werden
193 			aBaseLb.InsertEntry( String( SfxResId( STR_NONE ) ) );
194 
195 		SfxStyleSheetBase* pPoolStyle = pPool->First();
196 
197 		while ( pPoolStyle )
198 		{
199 			const String aStr( pPoolStyle->GetName() );
200 			// eigener Namen nicht als Basisvorlage
201 			if ( aStr != aName )
202 				aBaseLb.InsertEntry( aStr );
203 			pPoolStyle = pPool->Next();
204 		}
205 	}
206 	else
207 	{
208 		aBaseFt.Disable();
209 		aBaseLb.Disable();
210 	}
211 	sal_uInt16 nCount = pFamilies->Count();
212 
213 	sal_uInt16 i;
214 	for ( i = 0; i < nCount; ++i )
215 	{
216 		pItem = pFamilies->GetObject(i);
217 
218 		if ( pItem->GetFamily() == pStyle->GetFamily() )
219 			break;
220 	}
221 
222 	sal_uInt16 nStyleFilterIdx = 0xffff;
223 
224 	if ( i < nCount )
225 	{
226 		// Filterflags
227 		const SfxStyleFilter& rList = pItem->GetFilterList();
228 		nCount = (sal_uInt16)rList.Count();
229 		sal_uInt16 nIdx = 0;
230 		sal_uInt16 nMask = pStyle->GetMask() & ~SFXSTYLEBIT_USERDEF;
231 
232 		if ( !nMask )	// Benutzervorlage?
233 			nMask = pStyle->GetMask();
234 
235 		for ( i = 0; i < nCount; ++i )
236 		{
237 			SfxFilterTupel* pTupel = rList.GetObject(i);
238 
239 			if ( pTupel->nFlags != SFXSTYLEBIT_AUTO 	&&
240 				 pTupel->nFlags != SFXSTYLEBIT_USED		&&
241 //				 pTupel->nFlags != SFXSTYLEBIT_USERDEF	&&
242 				 pTupel->nFlags != SFXSTYLEBIT_ALL )
243 			{
244 				aFilterLb.InsertEntry( pTupel->aName, nIdx );
245 				aFilterLb.SetEntryData(nIdx, (void*)(long)i);
246 
247 				if ( ( pTupel->nFlags & nMask ) == nMask )
248 					nStyleFilterIdx = nIdx;
249 				++nIdx;
250 			}
251 		}
252 
253 		if ( nStyleFilterIdx != 0xFFFF )
254 			aFilterLb.SelectEntryPos( nStyleFilterIdx );
255 	}
256 
257 	if ( !aFilterLb.GetEntryCount() || !pStyle->IsUserDefined() )
258 	{
259 		pItem = 0;
260 		aFilterFt.Disable();
261 		aFilterLb.Disable();
262 	}
263 	else
264 		aFilterLb.SaveValue();
265 	SetDescriptionText_Impl();
266 
267 	if ( aFollowLb.IsEnabled() || aBaseLb.IsEnabled() )
268 	{
269 		aNameEd.SetGetFocusHdl(
270 			LINK( this, SfxManageStyleSheetPage, GetFocusHdl ) );
271 		aNameEd.SetLoseFocusHdl(
272 			LINK( this, SfxManageStyleSheetPage, LoseFocusHdl ) );
273 	}
274 	// ist es ein Style mit automatischem Update? (nur SW)
275 	if(SFX_ITEM_SET == rAttrSet.GetItemState(SID_ATTR_AUTO_STYLE_UPDATE))
276 	{
277 		Size aSize = aNameEd.GetSizePixel();
278 		aSize.Width() /= 2;
279 		aNameEd.SetSizePixel(aSize);
280 		aAutoCB.Show();
281 	}
282 }
283 
284 //-------------------------------------------------------------------------
285 
286 SfxManageStyleSheetPage::~SfxManageStyleSheetPage()
287 
288 /*  [Beschreibung]
289 
290 	Destruktor; Freigabe der Daten
291 
292 */
293 
294 {
295     aNameEd.SetGetFocusHdl( Link() );
296     aNameEd.SetLoseFocusHdl( Link() );
297 	delete pFamilies;
298 	pItem = 0;
299 	pStyle = 0;
300 
301 }
302 
303 //-------------------------------------------------------------------------
304 
305 void SfxManageStyleSheetPage::UpdateName_Impl( ListBox* pBox,
306 											   const String& rNew )
307 
308 /*  [Beschreibung]
309 
310 	Nach der "Anderung eines Vorlagennamens die ListBox pBox
311 	aktualisieren
312 
313 	[Parameter]
314 
315 	ListBox* pBox			ListBox, deren Eintr"age aktualisiert
316 							werden sollen
317 	const String& rNew		der neue Name
318 
319 */
320 
321 {
322 	if ( pBox->IsEnabled() )
323 	{
324 		// ist der aktuelle Eintrag, dessen Namen modifizieren wurde
325 		const sal_Bool bSelect = pBox->GetSelectEntry() == aBuf;
326 		pBox->RemoveEntry( aBuf );
327 		pBox->InsertEntry( rNew );
328 
329 		if ( bSelect )
330 			pBox->SelectEntry( rNew );
331 	}
332 }
333 
334 //-------------------------------------------------------------------------
335 
336 void SfxManageStyleSheetPage::SetDescriptionText_Impl()
337 
338 /*  [Beschreibung]
339 
340 	Attributbeschreibung setzen. daf"ur die eingestellte Metrik besorgen.
341 */
342 
343 {
344 	SfxMapUnit eUnit = SFX_MAPUNIT_CM;
345 //    FieldUnit eFieldUnit = pSfxApp->GetOptions().GetMetric();
346     FieldUnit eFieldUnit( FUNIT_CM );
347     SfxModule* pModule = SfxModule::GetActiveModule();
348 	if ( pModule )
349 	{
350 		const SfxPoolItem* pPoolItem = pModule->GetItem( SID_ATTR_METRIC );
351 		if ( pPoolItem )
352 			eFieldUnit = (FieldUnit)( (SfxUInt16Item*)pPoolItem )->GetValue();
353 	}
354 
355 	switch ( eFieldUnit )
356 	{
357 		case FUNIT_MM:		eUnit = SFX_MAPUNIT_MM; break;
358 
359 		case FUNIT_CM:
360 		case FUNIT_M:
361 		case FUNIT_KM:		eUnit = SFX_MAPUNIT_CM; break;
362 
363 		case FUNIT_POINT:
364 		case FUNIT_PICA:	eUnit = SFX_MAPUNIT_POINT; break;
365 
366 		case FUNIT_INCH:
367 		case FUNIT_FOOT:
368 		case FUNIT_MILE:	eUnit = SFX_MAPUNIT_INCH; break;
369 
370 		default:
371 			DBG_ERRORFILE( "not supported fieldunit" );
372 	}
373 	aDescFt.SetText( pStyle->GetDescription( eUnit ) );
374 }
375 
376 //-------------------------------------------------------------------------
377 
378 IMPL_LINK_INLINE_START( SfxManageStyleSheetPage, GetFocusHdl, Edit *, pEdit )
379 
380 /*  [Beschreibung]
381 
382 	StarView Handler; GetFocus-Handler des Edits mit dem Vorlagennamen.
383 
384 */
385 
386 {
387 	aBuf = pEdit->GetText().EraseLeadingChars();
388 	return 0;
389 }
390 IMPL_LINK_INLINE_END( SfxManageStyleSheetPage, GetFocusHdl, Edit *, pEdit )
391 
392 //-------------------------------------------------------------------------
393 
394 IMPL_LINK_INLINE_START( SfxManageStyleSheetPage, LoseFocusHdl, Edit *, pEdit )
395 
396 /*  [Beschreibung]
397 
398 	StarView Handler; LoseFocus-Handler des Edits mit dem Vorlagennamen.
399 	Dieser aktualisiert ggf. die Listbox mit den Folgevorlagen.
400 	In der Listbox mit den Basisvorlagen ist die aktuelle Vorlage
401 	selbst nicht enthalten.
402 
403 */
404 
405 {
406 	const String aStr( pEdit->GetText().EraseLeadingChars() );
407 	pEdit->SetText( aStr );
408 	// ggf. Listbox der Basisvorlagen aktualisieren
409 	if ( aStr != aBuf )
410 		UpdateName_Impl( &aFollowLb, aStr );
411 	return 0;
412 }
413 IMPL_LINK_INLINE_END( SfxManageStyleSheetPage, LoseFocusHdl, Edit *, pEdit )
414 
415 //-------------------------------------------------------------------------
416 
417 sal_Bool SfxManageStyleSheetPage::FillItemSet( SfxItemSet& rSet )
418 
419 /*  [Beschreibung]
420 
421 
422 	Handler f"ur das Setzen der (modifizierten) Daten. Wird aus
423 	dem Ok des SfxTabDialog gerufen.
424 
425 	[Parameter]
426 
427 	SfxItemSet &rAttrSet		das Set, das die Daten entgegennimmt.
428 
429 
430 	[R"uckgabewert]
431 
432 	sal_Bool						sal_True:  es hat eine "Anderung der Daten
433 									   stattgefunden
434 								    sal_False: es hat keine "Anderung der Daten
435 									   stattgefunden
436 
437 	[Querverweise]
438 
439 	<class SfxTabDialog>
440 
441 */
442 
443 {
444 	const sal_uInt16 nFilterIdx = aFilterLb.GetSelectEntryPos();
445 
446 	// Filter setzen
447 
448 	if ( LISTBOX_ENTRY_NOTFOUND  != nFilterIdx 		&&
449 		 nFilterIdx != aFilterLb.GetSavedValue() 	&&
450 		 aFilterLb.IsEnabled() )
451 	{
452 		bModified = sal_True;
453 		DBG_ASSERT( pItem, "kein Item" );
454 		// geht nur bei Benutzervorlagen
455 #if OSL_DEBUG_LEVEL > 1
456 		sal_uInt16 nIdx = (sal_uInt16)(long)aFilterLb.GetEntryData( nFilterIdx );
457 		SfxFilterTupel* p;
458         p = pItem->GetFilterList().GetObject( nIdx );
459 #endif
460 		sal_uInt16 nMask = pItem->GetFilterList().GetObject(
461 			(sal_uInt16)(long)aFilterLb.GetEntryData( nFilterIdx ) )->nFlags |
462 			SFXSTYLEBIT_USERDEF;
463 		pStyle->SetMask( nMask );
464 	}
465 	if(aAutoCB.IsVisible() &&
466 		aAutoCB.IsChecked() != aAutoCB.GetSavedValue())
467 	{
468 		rSet.Put(SfxBoolItem(SID_ATTR_AUTO_STYLE_UPDATE, aAutoCB.IsChecked()));
469 	}
470 
471 	return bModified;
472 }
473 
474 //-------------------------------------------------------------------------
475 
476 void SfxManageStyleSheetPage::Reset( const SfxItemSet& /*rAttrSet*/ )
477 
478 /*  [Beschreibung]
479 
480 
481 	Handler f"ur das Initialisieren der Seite mit den initialen Daten.
482 
483 	[Parameter]
484 
485 	const SfxItemSet &rAttrSet		das Set mit den Daten
486 
487 
488 	[Querverweise]
489 
490 	<class SfxTabDialog>
491 
492 */
493 
494 {
495 	bModified = sal_False;
496 	String sCmp( pStyle->GetName() );
497 
498 	if ( sCmp != aName )
499 		pStyle->SetName( aName );
500 	aNameEd.SetText( aName );
501 
502 	if ( aFollowLb.IsEnabled() )
503 	{
504 		sCmp = pStyle->GetFollow();
505 
506 		if ( sCmp != aFollow )
507 			pStyle->SetFollow( aFollow );
508 
509 		if ( !aFollow.Len() )
510 			aFollowLb.SelectEntry( aName );
511 		else
512 			aFollowLb.SelectEntry( aFollow );
513 	}
514 
515 	if ( aBaseLb.IsEnabled() )
516 	{
517 		sCmp = pStyle->GetParent();
518 
519 		if ( sCmp != aParent )
520 			pStyle->SetParent( aParent );
521 
522 		if ( !aParent.Len() )
523 			aBaseLb.SelectEntry( String( SfxResId( STR_NONE ) ) );
524 		else
525 			aBaseLb.SelectEntry( aParent );
526 
527 		if ( String( SfxResId( STR_STANDARD ) ) == aName )
528 		{
529 			// die Standardvorlage kann nicht verkn"upft werden
530 			aBaseFt.Disable();
531 			aBaseLb.Disable();
532 		}
533 	}
534 
535 	if ( aFilterLb.IsEnabled() )
536 	{
537 		sal_uInt16 nCmp = pStyle->GetMask();
538 
539 		if ( nCmp != nFlags )
540 			pStyle->SetMask( nFlags );
541 		aFilterLb.SelectEntryPos( aFilterLb.GetSavedValue() );
542 	}
543 }
544 
545 //-------------------------------------------------------------------------
546 
547 SfxTabPage* SfxManageStyleSheetPage::Create( Window* pParent,
548 											 const SfxItemSet &rAttrSet )
549 
550 /*  [Beschreibung]
551 
552 
553 	Factory f"ur das Erzeugen der Seite
554 
555 	[Querverweise]
556 
557 	<class SfxTabDialog>
558 
559 */
560 
561 {
562 	return new SfxManageStyleSheetPage( pParent, rAttrSet );
563 }
564 
565 //-------------------------------------------------------------------------
566 
567 void SfxManageStyleSheetPage::ActivatePage( const SfxItemSet& rSet)
568 
569 /*  [Beschreibung]
570 
571 	ActivatePage- Handler des SfxTabDialog; wird f"ur die Aktualisierung
572 	des beschreibenden Textes verwendet, da sich dieser durch "Anderungen
573 	der Daten anderer Seiten ge"andert haben kann.
574 
575 	[Parameter]
576 
577 	const SfxItemSet&		das Set f"ur den Datenaustausch; wird
578 							hier nicht verwendet.
579 
580 	[Querverweise]
581 
582 	<SfxTabDialog::ActivatePage(const SfxItemSet &)>
583 
584 */
585 
586 {
587 	SetDescriptionText_Impl();
588 
589 	// ist es ein Style mit automatischem Update? (nur SW)
590 	const SfxPoolItem* pPoolItem;
591 
592 	if ( SFX_ITEM_SET ==
593 		 rSet.GetItemState( SID_ATTR_AUTO_STYLE_UPDATE, sal_False, &pPoolItem ) )
594 		aAutoCB.Check( ( (const SfxBoolItem*)pPoolItem )->GetValue() );
595 	aAutoCB.SaveValue();
596 }
597 
598 //-------------------------------------------------------------------------
599 
600 int SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet )
601 
602 /*  [Beschreibung]
603 
604 	DeactivatePage- Handler des SfxTabDialog; die Daten werden
605 	an der Vorlage eingestellt, damit die richtige Vererbung
606 	f"ur die anderen Seiten des Dialoges vorliegt.
607 	Im Fehlerfall wird das Verlassen der Seite unterbunden.
608 
609 	[Parameter]
610 
611 	SfxItemSet*			das Set f"ur den Datenaustausch; wird hier nicht verwendet.
612 
613 	[Querverweise]
614 
615 	<SfxTabDialog::DeactivatePage(SfxItemSet*)>
616 
617 */
618 
619 {
620 	int nRet = SfxTabPage::LEAVE_PAGE;
621 
622 	if ( aNameEd.IsModified() )
623 	{
624 		// bei <Enter> wird kein LoseFocus() durch StarView ausgel"ost
625 		if ( aNameEd.HasFocus() )
626 			LoseFocusHdl( &aNameEd );
627 
628 		if ( !pStyle->SetName( aNameEd.GetText().EraseLeadingChars() ) )
629 		{
630 			InfoBox aBox( this, SfxResId( MSG_TABPAGE_INVALIDNAME ) );
631 			aBox.Execute();
632 			aNameEd.GrabFocus();
633 			aNameEd.SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
634 			return SfxTabPage::KEEP_PAGE;
635 		}
636 		bModified = sal_True;
637 	}
638 
639 	if ( pStyle->HasFollowSupport() && aFollowLb.IsEnabled() )
640 	{
641 		const String aFollowEntry( aFollowLb.GetSelectEntry() );
642 
643 		if ( pStyle->GetFollow() != aFollowEntry )
644 		{
645 			if ( !pStyle->SetFollow( aFollowEntry ) )
646 			{
647 				InfoBox aBox( this, SfxResId( MSG_TABPAGE_INVALIDSTYLE ) );
648 				aBox.Execute();
649 				aFollowLb.GrabFocus();
650 				return SfxTabPage::KEEP_PAGE;
651 			}
652 			bModified = sal_True;
653 		}
654 	}
655 
656 	if ( aBaseLb.IsEnabled() )
657 	{
658 		String aParentEntry( aBaseLb.GetSelectEntry() );
659 
660 		if ( String( SfxResId( STR_NONE ) ) == aParentEntry || aParentEntry == pStyle->GetName() )
661 			aParentEntry.Erase();
662 
663 		if ( pStyle->GetParent() != aParentEntry )
664 		{
665 			if ( !pStyle->SetParent( aParentEntry ) )
666 			{
667 				InfoBox aBox( this, SfxResId( MSG_TABPAGE_INVALIDPARENT ) );
668 				aBox.Execute();
669 				aBaseLb.GrabFocus();
670 				return SfxTabPage::KEEP_PAGE;
671 			}
672 			bModified = sal_True;
673 			nRet |= (int)SfxTabPage::REFRESH_SET;
674 		}
675 	}
676 
677 	if ( pItemSet )
678 		FillItemSet( *pItemSet );
679 
680 	return nRet;
681 }
682 
683