bump product version to 4.1.6.2
[LibreOffice.git] / sd / source / ui / func / futempl.cxx
blobab551c2802db61b980d60ec6632ed28517fc0afa
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
21 #include <com/sun/star/beans/XPropertySet.hpp>
22 #include <com/sun/star/container/XNameAccess.hpp>
24 #include "futempl.hxx"
26 #include <editeng/editdata.hxx>
27 #include <editeng/bulletitem.hxx>
28 #include <svx/svxids.hrc> // fuer SID_OBJECT_SELECT
29 #include <sfx2/bindings.hxx>
30 #include <svl/aeitem.hxx>
31 #include <sfx2/dispatch.hxx>
32 #include <vcl/msgbox.hxx>
33 #include <editeng/eeitem.hxx>
34 #include <sfx2/request.hxx>
35 #include <editeng/numitem.hxx>
36 #include <editeng/editeng.hxx>
37 #include <editeng/lrspitem.hxx>
38 #include <svx/svdopage.hxx>
39 #include <svx/svditer.hxx>
40 #include <svx/sdr/properties/properties.hxx>
42 #include <sfx2/viewfrm.hxx>
43 #include <svx/xlndsit.hxx>
44 #include <svx/xlnstit.hxx>
45 #include <svx/xlnedit.hxx>
46 #include "app.hrc"
47 #include "stlsheet.hxx"
48 #include "sdpage.hxx"
49 #include "stlpool.hxx"
50 #include "sdmod.hxx"
51 #include "View.hxx"
52 #include "Window.hxx"
53 #include "drawview.hxx"
54 #include "drawdoc.hxx"
55 #include "DrawDocShell.hxx"
56 #include "DrawViewShell.hxx"
57 #include "ViewShell.hxx"
58 #include "res_bmp.hrc"
59 #include "glob.hrc"
60 #include "prlayout.hxx" // enum PresentationObjects
61 #include "prltempl.hrc" // TAB_PRES_LAYOUT_TEMPLATE_x
62 #include <svx/xfillit.hxx>
63 #include "sdresid.hxx"
64 #include "OutlineViewShell.hxx"
65 #include "strings.hrc"
66 #include "helpids.h"
67 #include "sdabstdlg.hxx"
69 using namespace com::sun::star::uno;
70 using namespace com::sun::star::container;
71 using namespace com::sun::star::beans;
72 using namespace com::sun::star::style;
74 namespace sd
77 TYPEINIT1( FuTemplate, FuPoor );
79 FuTemplate::FuTemplate (
80 ViewShell* pViewSh,
81 ::sd::Window* pWin,
82 ::sd::View* pView,
83 SdDrawDocument* pDoc,
84 SfxRequest& rReq )
85 : FuPoor( pViewSh, pWin, pView, pDoc, rReq )
89 FunctionReference FuTemplate::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
91 FunctionReference xFunc( new FuTemplate( pViewSh, pWin, pView, pDoc, rReq ) );
92 xFunc->DoExecute(rReq);
93 return xFunc;
96 void FuTemplate::DoExecute( SfxRequest& rReq )
98 const SfxItemSet* pArgs = rReq.GetArgs();
99 sal_uInt16 nSId = rReq.GetSlot();
101 // get StyleSheet parameter
102 SfxStyleSheetBasePool* pSSPool = mpDoc->GetDocSh()->GetStyleSheetPool();
103 SfxStyleSheetBase* pStyleSheet = NULL;
105 const SfxPoolItem* pItem;
106 sal_uInt16 nFamily = USHRT_MAX;
107 if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_FAMILY,
108 sal_False, &pItem ))
110 nFamily = ( (const SfxUInt16Item &) pArgs->Get( SID_STYLE_FAMILY ) ).GetValue();
112 else if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_FAMILYNAME,
113 sal_False, &pItem ))
115 String sFamily = ( (const SfxStringItem &) pArgs->Get( SID_STYLE_FAMILYNAME ) ).GetValue();
116 if (sFamily.CompareToAscii("graphics") == COMPARE_EQUAL)
117 nFamily = SD_STYLE_FAMILY_GRAPHICS;
118 else
119 nFamily = SD_STYLE_FAMILY_PSEUDO;
122 OUString aStyleName;
123 sal_uInt16 nRetMask = SFXSTYLEBIT_ALL;
125 switch( nSId )
127 case SID_STYLE_APPLY:
128 case SID_STYLE_EDIT:
129 case SID_STYLE_DELETE:
130 case SID_STYLE_HIDE:
131 case SID_STYLE_SHOW:
132 case SID_STYLE_FAMILY:
133 case SID_STYLE_NEW_BY_EXAMPLE:
135 SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, SID_APPLY_STYLE, sal_False );
136 SFX_REQUEST_ARG( rReq, pFamilyItem, SfxStringItem, SID_STYLE_FAMILYNAME, sal_False );
137 if ( pFamilyItem && pNameItem )
141 Reference< XStyleFamiliesSupplier > xModel(mpDoc->GetDocSh()->GetModel(), UNO_QUERY_THROW );
142 Reference< XNameAccess > xCont( xModel->getStyleFamilies() );
143 Reference< XNameAccess > xStyles( xCont->getByName(pFamilyItem->GetValue()), UNO_QUERY_THROW );
144 Reference< XPropertySet > xInfo( xStyles->getByName( pNameItem->GetValue() ), UNO_QUERY_THROW );
146 OUString aUIName;
147 xInfo->getPropertyValue( "DisplayName" ) >>= aUIName;
148 if ( !aUIName.isEmpty() )
149 rReq.AppendItem( SfxStringItem( nSId, aUIName ) );
151 catch( Exception& )
156 if (pArgs->GetItemState(nSId) == SFX_ITEM_SET)
157 aStyleName = ( ( (const SfxStringItem &) pArgs->Get( nSId ) ).GetValue() );
161 switch( nSId )
163 case SID_STYLE_NEW:
165 SfxStyleSheetBase *p = pSSPool->Find(aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_ALL );
166 if(p)
168 pSSPool->Remove(p);
169 p = 0;
171 pStyleSheet = &pSSPool->Make( aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_USERDEF );
173 if (pArgs->GetItemState(SID_STYLE_REFERENCE) == SFX_ITEM_ON)
175 String aParentName(((const SfxStringItem&) pArgs->Get(SID_STYLE_REFERENCE)).GetValue());
176 pStyleSheet->SetParent(aParentName);
178 else
180 pStyleSheet->SetParent(String(SdResId(STR_STANDARD_STYLESHEET_NAME)));
183 break;
185 case SID_STYLE_NEW_BY_EXAMPLE:
187 // at the moment, the dialog to enter the name of the template is still opened
188 mpView->AreObjectsMarked();
189 SfxStyleSheetBase *p = pSSPool->Find(aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_ALL );
190 if(p)
192 pSSPool->Remove(p);
193 p = 0;
195 pStyleSheet = &pSSPool->Make( aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_USERDEF );
196 pStyleSheet->SetParent(String(SdResId(STR_STANDARD_STYLESHEET_NAME)));
198 break;
200 case SID_STYLE_EDIT:
201 pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
202 break;
204 case SID_STYLE_DELETE:
205 pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
206 if( pStyleSheet )
208 pSSPool->Remove( pStyleSheet );
209 nRetMask = sal_True;
210 mpDoc->SetChanged(sal_True);
212 else
214 nRetMask = sal_False;
216 break;
218 case SID_STYLE_HIDE:
219 case SID_STYLE_SHOW:
220 pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
221 pStyleSheet->SetHidden( nSId == SID_STYLE_HIDE );
222 nRetMask = sal_True;
223 break;
225 case SID_STYLE_APPLY:
226 // apply the template to the document
227 pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
229 // do not set presentation styles, they will be set implicit
230 if ( pStyleSheet && pStyleSheet->GetFamily() != SD_STYLE_FAMILY_PSEUDO )
232 SfxStyleSheet* pOldStyleSheet = mpView->GetStyleSheet();
233 OUString aStr;
235 if( // if the object had no style sheet, allow all
236 !pOldStyleSheet ||
238 // allow if old and new style sheet has same family
239 pStyleSheet->GetFamily() == pOldStyleSheet->GetFamily() ||
241 // allow if old was background objects and new is graphics
242 pStyleSheet->GetFamily() == (SD_STYLE_FAMILY_GRAPHICS && pOldStyleSheet->GetHelpId( aStr ) == HID_PSEUDOSHEET_BACKGROUNDOBJECTS) ||
244 // allow if old was presentation and we are a drawing document
245 (pOldStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE && mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW) )
247 mpView->SetStyleSheet( (SfxStyleSheet*) pStyleSheet);
248 mpDoc->SetChanged(sal_True);
249 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
252 break;
254 case SID_STYLE_WATERCAN:
256 if( !SD_MOD()->GetWaterCan() )
258 if( pArgs->GetItemState( nSId ) == SFX_ITEM_SET )
260 aStyleName = ( ( (const SfxStringItem &) pArgs->Get( nSId ) ).GetValue() );
261 SD_MOD()->SetWaterCan( sal_True );
262 pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
264 // no presentation object templates, they are only allowed implicitly
265 if( pStyleSheet && pStyleSheet->GetFamily() != SD_STYLE_FAMILY_PSEUDO )
267 ( (SdStyleSheetPool*) pSSPool )->SetActualStyleSheet( pStyleSheet );
269 // we switch explicitly into selection mode
270 mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_OBJECT_SELECT,
271 SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
274 else
275 SD_MOD()->SetWaterCan( sal_False );
277 else
279 SD_MOD()->SetWaterCan( sal_False );
280 // we have to re-enable to tools-bar
281 mpViewShell->Invalidate();
284 break;
286 default:
287 break;
290 switch( nSId )
292 case SID_STYLE_NEW:
293 case SID_STYLE_EDIT:
295 PresentationObjects ePO = PO_OUTLINE_1;
297 if( pStyleSheet )
299 SfxAbstractTabDialog* pStdDlg = NULL;
300 SfxAbstractTabDialog* pPresDlg = NULL;
301 SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
302 sal_Bool bOldDocInOtherLanguage = sal_False;
303 SfxItemSet aOriSet( pStyleSheet->GetItemSet() );
305 SfxStyleFamily eFamily = pStyleSheet->GetFamily();
307 if (eFamily == SD_STYLE_FAMILY_GRAPHICS)
309 pStdDlg = pFact ? pFact->CreateSdTabTemplateDlg( 0, mpDoc->GetDocSh(), *pStyleSheet, mpDoc, mpView ) : 0;
311 else if (eFamily == SD_STYLE_FAMILY_PSEUDO)
313 String aName(pStyleSheet->GetName());
314 sal_uInt16 nDlgId = 0;
316 if (aName == String(SdResId(STR_PSEUDOSHEET_TITLE)))
318 nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
319 ePO = PO_TITLE;
321 else if (aName == String(SdResId(STR_PSEUDOSHEET_SUBTITLE)))
323 nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
324 ePO = PO_SUBTITLE;
326 else if (aName ==
327 String(SdResId(STR_PSEUDOSHEET_BACKGROUND)))
329 nDlgId = TAB_PRES_LAYOUT_TEMPLATE_BACKGROUND;
330 ePO = PO_BACKGROUND;
332 else if (aName ==
333 String(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS)))
335 nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
336 ePO = PO_BACKGROUNDOBJECTS;
338 else if (aName ==
339 String(SdResId(STR_PSEUDOSHEET_NOTES)))
341 nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
342 ePO = PO_NOTES;
344 else if(aName.Search(String(SdResId(STR_PSEUDOSHEET_OUTLINE))) !=
345 STRING_NOTFOUND)
347 nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
349 String aOutlineStr((SdResId(STR_PSEUDOSHEET_OUTLINE)));
350 // determine number, mind the blank between name and number
351 String aNumStr(aName.Copy(aOutlineStr.Len() + 1));
352 sal_uInt16 nLevel = (sal_uInt16)aNumStr.ToInt32();
353 switch (nLevel)
355 case 1: ePO = PO_OUTLINE_1; break;
356 case 2: ePO = PO_OUTLINE_2; break;
357 case 3: ePO = PO_OUTLINE_3; break;
358 case 4: ePO = PO_OUTLINE_4; break;
359 case 5: ePO = PO_OUTLINE_5; break;
360 case 6: ePO = PO_OUTLINE_6; break;
361 case 7: ePO = PO_OUTLINE_7; break;
362 case 8: ePO = PO_OUTLINE_8; break;
363 case 9: ePO = PO_OUTLINE_9; break;
366 else
368 OSL_FAIL("StyleSheet from older version with different language");
369 bOldDocInOtherLanguage = sal_True;
372 if( !bOldDocInOtherLanguage )
374 pPresDlg = pFact ? pFact->CreateSdPresLayoutTemplateDlg( mpDocSh, NULL, SdResId(nDlgId), *pStyleSheet, ePO, pSSPool ) : 0;
377 else if (eFamily == SD_STYLE_FAMILY_CELL)
381 sal_uInt16 nResult = RET_CANCEL;
382 const SfxItemSet* pOutSet = NULL;
383 if (pStdDlg)
385 nResult = pStdDlg->Execute();
386 pOutSet = pStdDlg->GetOutputItemSet();
388 else if( pPresDlg )
390 nResult = pPresDlg->Execute();
391 pOutSet = pPresDlg->GetOutputItemSet();
394 switch( nResult )
396 case RET_OK:
398 nRetMask = pStyleSheet->GetMask();
400 if (eFamily == SD_STYLE_FAMILY_PSEUDO)
402 SfxItemSet aTempSet(*pOutSet);
403 ((SdStyleSheet*)pStyleSheet)->AdjustToFontHeight(aTempSet);
405 /* Special treatment: reset the INVALIDS to
406 NULL-Pointer (otherwise INVALIDs or pointer point
407 to DefaultItems in the template; both would
408 prevent the attribute inheritance) */
409 aTempSet.ClearInvalidItems();
411 // EE_PARA_NUMBULLET item is only valid in first outline template
412 if( (ePO >= PO_OUTLINE_2) && (ePO <= PO_OUTLINE_9) )
414 if (aTempSet.GetItemState(EE_PARA_NUMBULLET) == SFX_ITEM_SET)
416 SvxNumRule aRule(*((SvxNumBulletItem*)aTempSet.GetItem(EE_PARA_NUMBULLET))->GetNumRule());
418 String sStyleName((SdResId(STR_PSEUDOSHEET_OUTLINE)));
419 sStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) );
420 SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( sStyleName, SD_STYLE_FAMILY_PSEUDO);
422 if(pFirstStyleSheet)
424 pFirstStyleSheet->GetItemSet().Put( SvxNumBulletItem( aRule, EE_PARA_NUMBULLET ));
425 SdStyleSheet* pRealSheet = ((SdStyleSheet*)pFirstStyleSheet)->GetRealStyleSheet();
426 pRealSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
429 aTempSet.ClearItem( EE_PARA_NUMBULLET );
433 String sStyleName((SdResId(STR_PSEUDOSHEET_OUTLINE)));
434 sStyleName.Append( sal_Unicode( ' ' ));
436 pStyleSheet->GetItemSet().Put(aTempSet);
437 SdStyleSheet* pRealSheet =((SdStyleSheet*)pStyleSheet)->GetRealStyleSheet();
438 pRealSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
440 if( (ePO >= PO_OUTLINE_1) && (ePO <= PO_OUTLINE_8) )
442 for( sal_uInt16 n = (sal_uInt16)(ePO - PO_OUTLINE_1 + 2); n < 10; n++ )
444 String aName( sStyleName );
445 aName.Append( OUString::number( (sal_Int32) n ));
447 SfxStyleSheetBase* pSheet = pSSPool->Find( aName, SD_STYLE_FAMILY_PSEUDO);
449 if(pSheet)
451 SdStyleSheet* pRealStyleSheet = ((SdStyleSheet*)pSheet)->GetRealStyleSheet();
452 pRealStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
458 SfxItemSet& rAttr = pStyleSheet->GetItemSet();
460 sdr::properties::CleanupFillProperties( rAttr );
462 // check for unique names of named items for xml
463 if( rAttr.GetItemState( XATTR_FILLBITMAP ) == SFX_ITEM_SET )
465 const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLBITMAP );
466 SfxPoolItem* pNewItem = ((XFillBitmapItem*)pOldItem)->checkForUniqueItem( mpDoc );
467 if( pOldItem != pNewItem )
469 rAttr.Put( *pNewItem );
470 delete pNewItem;
473 if( rAttr.GetItemState( XATTR_LINEDASH ) == SFX_ITEM_SET )
475 const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINEDASH );
476 SfxPoolItem* pNewItem = ((XLineDashItem*)pOldItem)->checkForUniqueItem( mpDoc );
477 if( pOldItem != pNewItem )
479 rAttr.Put( *pNewItem );
480 delete pNewItem;
483 if( rAttr.GetItemState( XATTR_LINESTART ) == SFX_ITEM_SET )
485 const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINESTART );
486 SfxPoolItem* pNewItem = ((XLineStartItem*)pOldItem)->checkForUniqueItem( mpDoc );
487 if( pOldItem != pNewItem )
489 rAttr.Put( *pNewItem );
490 delete pNewItem;
493 if( rAttr.GetItemState( XATTR_LINEEND ) == SFX_ITEM_SET )
495 const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINEEND );
496 SfxPoolItem* pNewItem = ((XLineEndItem*)pOldItem)->checkForUniqueItem( mpDoc );
497 if( pOldItem != pNewItem )
499 rAttr.Put( *pNewItem );
500 delete pNewItem;
503 if( rAttr.GetItemState( XATTR_FILLGRADIENT ) == SFX_ITEM_SET )
505 const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLGRADIENT );
506 SfxPoolItem* pNewItem = ((XFillGradientItem*)pOldItem)->checkForUniqueItem( mpDoc );
507 if( pOldItem != pNewItem )
509 rAttr.Put( *pNewItem );
510 delete pNewItem;
513 if( rAttr.GetItemState( XATTR_FILLFLOATTRANSPARENCE ) == SFX_ITEM_SET )
515 const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLFLOATTRANSPARENCE );
516 SfxPoolItem* pNewItem = ((XFillFloatTransparenceItem*)pOldItem)->checkForUniqueItem( mpDoc );
517 if( pOldItem != pNewItem )
519 rAttr.Put( *pNewItem );
520 delete pNewItem;
523 if( rAttr.GetItemState( XATTR_FILLHATCH ) == SFX_ITEM_SET )
525 const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLHATCH );
526 SfxPoolItem* pNewItem = ((XFillHatchItem*)pOldItem)->checkForUniqueItem( mpDoc );
527 if( pOldItem != pNewItem )
529 rAttr.Put( *pNewItem );
530 delete pNewItem;
534 ( (SfxStyleSheet*) pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
536 DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >( mpViewShell );
537 if( pDrawViewShell )
539 PageKind ePageKind = pDrawViewShell->GetPageKind();
540 if( ePageKind == PK_NOTES || ePageKind == PK_HANDOUT )
542 SdPage* pPage = mpViewShell->GetActualPage();
544 if(pDrawViewShell->GetEditMode() == EM_MASTERPAGE)
546 pPage = static_cast<SdPage*>((&(pPage->TRG_GetMasterPage())));
549 if( pPage )
551 SdrObjListIter aIter( *pPage );
552 while( aIter.IsMore() )
554 SdrObject* pObj = aIter.Next();
555 if( pObj->ISA(SdrPageObj) )
557 // repaint only
558 pObj->ActionChanged();
559 // pObj->SendRepaintBroadcast();
566 if( mpDoc->GetOnlineSpell() )
568 const SfxPoolItem* pTempItem;
569 if( SFX_ITEM_SET == rAttr.GetItemState(EE_CHAR_LANGUAGE, sal_False, &pTempItem ) ||
570 SFX_ITEM_SET == rAttr.GetItemState(EE_CHAR_LANGUAGE_CJK, sal_False, &pTempItem ) ||
571 SFX_ITEM_SET == rAttr.GetItemState(EE_CHAR_LANGUAGE_CTL, sal_False, &pTempItem ) )
573 mpDoc->StopOnlineSpelling();
574 mpDoc->StartOnlineSpelling();
578 mpDoc->SetChanged(sal_True);
580 break;
582 default:
584 if( nSId == SID_STYLE_NEW )
585 pSSPool->Remove( pStyleSheet );
586 delete pStdDlg;
587 delete pPresDlg;
589 return; // Cancel
591 delete pStdDlg;
592 delete pPresDlg;
595 break;
597 case SID_STYLE_NEW_BY_EXAMPLE:
599 if( pStyleSheet )
601 nRetMask = pStyleSheet->GetMask();
602 SfxItemSet aCoreSet( mpDoc->GetPool() );
603 mpView->GetAttributes( aCoreSet, sal_True );
605 // if the object had a template, this becomes parent of the new template
606 SfxStyleSheet* pOldStyle = mpView->GetStyleSheet();
608 // if pOldStyle == pStyleSheet -> recursion
609 if( pOldStyle != pStyleSheet )
611 if (pOldStyle)
613 pStyleSheet->SetParent(pOldStyle->GetName());
616 SfxItemSet* pStyleSet = &pStyleSheet->GetItemSet();
617 pStyleSet->Put(aCoreSet);
619 /* apply template (but not when somebody is editing a text.
620 To do this, the edit engine had to be capable to use
621 templates on a character level. */
622 if (!mpView->GetTextEditObject())
624 mpView->SetStyleSheet( (SfxStyleSheet*) pStyleSheet);
627 ( (SfxStyleSheet*) pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
628 mpDoc->SetChanged(sal_True);
630 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
634 break;
636 case SID_STYLE_UPDATE_BY_EXAMPLE:
638 if ((mpView->AreObjectsMarked() && mpView->GetMarkedObjectList().GetMarkCount() == 1) ||
639 mpView->ISA(OutlineView))
641 pStyleSheet = mpView->GetStyleSheet();
643 if( pStyleSheet )
645 nRetMask = pStyleSheet->GetMask();
646 SfxItemSet aCoreSet( mpDoc->GetPool() );
647 mpView->GetAttributes( aCoreSet );
649 SfxItemSet* pStyleSet = &pStyleSheet->GetItemSet();
650 pStyleSet->Put( aCoreSet );
652 mpView->SetStyleSheet( (SfxStyleSheet*) pStyleSheet);
654 ( (SfxStyleSheet*) pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
655 mpDoc->SetChanged(sal_True);
656 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
660 break;
663 if( nRetMask != SFXSTYLEBIT_ALL )
664 rReq.SetReturnValue( SfxUInt16Item( nSId, nRetMask ) );
667 void FuTemplate::Activate()
671 void FuTemplate::Deactivate()
675 } // end of namespace sd
677 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */