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