1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: futempl.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
35 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 #include <com/sun/star/container/XNameAccess.hpp>
39 #include "futempl.hxx"
41 #include <svx/editdata.hxx>
42 #include <svx/bulitem.hxx>
43 #include <svx/svxids.hrc> // fuer SID_OBJECT_SELECT
44 #include <sfx2/bindings.hxx>
45 #include <svtools/aeitem.hxx>
46 #include <sfx2/dispatch.hxx>
47 #include <vcl/msgbox.hxx>
48 #include <svx/eeitem.hxx>
49 #include <sfx2/request.hxx>
50 #include <svx/numitem.hxx>
51 #include <svx/editeng.hxx>
52 #include <svx/lrspitem.hxx>
53 #include <svx/svdopage.hxx>
54 #include <svx/svditer.hxx>
56 #include <sfx2/viewfrm.hxx>
57 #include <svx/xlndsit.hxx>
58 #include <svx/xlnstit.hxx>
59 #include <svx/xlnedit.hxx>
61 #include "stlsheet.hxx"
63 #include "stlpool.hxx"
66 #ifndef SD_WINDOW_SHELL_HXX
69 #include "drawview.hxx"
70 #include "drawdoc.hxx"
71 #include "DrawDocShell.hxx"
72 #include "DrawViewShell.hxx"
73 #include "ViewShell.hxx"
74 #include "res_bmp.hrc"
76 #include "prlayout.hxx" // enum PresentationObjects
77 #include "prltempl.hrc" // TAB_PRES_LAYOUT_TEMPLATE_x
78 #include <svx/tabarea.hxx>
79 #include "sdresid.hxx"
80 #include "OutlineViewShell.hxx"
81 #include "strings.hrc"
83 #include "sdabstdlg.hxx"
86 using namespace com::sun::star::uno
;
87 using namespace com::sun::star::container
;
88 using namespace com::sun::star::beans
;
89 using namespace com::sun::star::style
;
94 TYPEINIT1( FuTemplate
, FuPoor
);
96 /*************************************************************************
100 \************************************************************************/
102 FuTemplate::FuTemplate (
106 SdDrawDocument
* pDoc
,
108 : FuPoor( pViewSh
, pWin
, pView
, pDoc
, rReq
)
112 FunctionReference
FuTemplate::Create( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
, SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
114 FunctionReference
xFunc( new FuTemplate( pViewSh
, pWin
, pView
, pDoc
, rReq
) );
115 xFunc
->DoExecute(rReq
);
119 void FuTemplate::DoExecute( SfxRequest
& rReq
)
121 const SfxItemSet
* pArgs
= rReq
.GetArgs();
122 USHORT nSId
= rReq
.GetSlot();
124 // StyleSheet-Parameter holen
125 SfxStyleSheetBasePool
* pSSPool
= mpDoc
->GetDocSh()->GetStyleSheetPool();
126 SfxStyleSheetBase
* pStyleSheet
= NULL
;
128 const SfxPoolItem
* pItem
;
129 USHORT nFamily
= USHRT_MAX
;
130 if( pArgs
&& SFX_ITEM_SET
== pArgs
->GetItemState( SID_STYLE_FAMILY
,
133 nFamily
= ( (const SfxUInt16Item
&) pArgs
->Get( SID_STYLE_FAMILY
) ).GetValue();
136 if( pArgs
&& SFX_ITEM_SET
== pArgs
->GetItemState( SID_STYLE_FAMILYNAME
,
139 String sFamily
= ( (const SfxStringItem
&) pArgs
->Get( SID_STYLE_FAMILYNAME
) ).GetValue();
140 if (sFamily
.CompareToAscii("graphics") == COMPARE_EQUAL
)
141 nFamily
= SD_STYLE_FAMILY_GRAPHICS
;
143 nFamily
= SD_STYLE_FAMILY_PSEUDO
;
147 USHORT nRetMask
= 0xffff;
151 case SID_STYLE_APPLY
:
153 case SID_STYLE_DELETE
:
154 case SID_STYLE_FAMILY
:
155 case SID_STYLE_NEW_BY_EXAMPLE
:
157 SFX_REQUEST_ARG( rReq
, pNameItem
, SfxStringItem
, SID_APPLY_STYLE
, sal_False
);
158 SFX_REQUEST_ARG( rReq
, pFamilyItem
, SfxStringItem
, SID_STYLE_FAMILYNAME
, sal_False
);
159 if ( pFamilyItem
&& pNameItem
)
163 Reference
< XStyleFamiliesSupplier
> xModel(mpDoc
->GetDocSh()->GetModel(), UNO_QUERY_THROW
);
164 Reference
< XNameAccess
> xCont( xModel
->getStyleFamilies() );
165 Reference
< XNameAccess
> xStyles( xCont
->getByName(pFamilyItem
->GetValue()), UNO_QUERY_THROW
);
166 Reference
< XPropertySet
> xInfo( xStyles
->getByName( pNameItem
->GetValue() ), UNO_QUERY_THROW
);
169 xInfo
->getPropertyValue( ::rtl::OUString::createFromAscii("DisplayName") ) >>= aUIName
;
170 if ( aUIName
.getLength() )
171 rReq
.AppendItem( SfxStringItem( nSId
, aUIName
) );
178 if (pArgs
->GetItemState(nSId
) == SFX_ITEM_SET
)
179 aStyleName
= ( ( (const SfxStringItem
&) pArgs
->Get( nSId
) ).GetValue() );
187 SfxStyleSheetBase
*p
= pSSPool
->Find(aStyleName
, (SfxStyleFamily
) nFamily
, SFXSTYLEBIT_ALL
);
193 pStyleSheet
= &pSSPool
->Make( aStyleName
, (SfxStyleFamily
) nFamily
, SFXSTYLEBIT_USERDEF
);
195 if (pArgs
->GetItemState(SID_STYLE_REFERENCE
) == SFX_ITEM_ON
)
197 String
aParentName(((const SfxStringItem
&) pArgs
->Get(SID_STYLE_REFERENCE
)).GetValue());
198 pStyleSheet
->SetParent(aParentName
);
202 pStyleSheet
->SetParent(String(SdResId(STR_STANDARD_STYLESHEET_NAME
)));
207 case SID_STYLE_NEW_BY_EXAMPLE
:
209 // Z.Z. geht immer noch der Dialog auf, um den Namen
210 // der Vorlage einzugeben.
211 if( mpView
->AreObjectsMarked() || TRUE
)
213 SfxStyleSheetBase
*p
= pSSPool
->Find(aStyleName
, (SfxStyleFamily
) nFamily
, SFXSTYLEBIT_ALL
);
219 pStyleSheet
= &pSSPool
->Make( aStyleName
, (SfxStyleFamily
) nFamily
, SFXSTYLEBIT_USERDEF
);
220 pStyleSheet
->SetParent(String(SdResId(STR_STANDARD_STYLESHEET_NAME
)));
226 pStyleSheet
= pSSPool
->Find( aStyleName
, (SfxStyleFamily
) nFamily
);
229 case SID_STYLE_DELETE
:
230 pStyleSheet
= pSSPool
->Find( aStyleName
, (SfxStyleFamily
) nFamily
);
233 pSSPool
->Remove( pStyleSheet
);
235 mpDoc
->SetChanged(TRUE
);
243 case SID_STYLE_APPLY
:
244 // Anwenden der Vorlage auf das Dokument
245 pStyleSheet
= pSSPool
->Find( aStyleName
, (SfxStyleFamily
) nFamily
);
247 // do not set presentation styles, they will be set implicit
248 if ( pStyleSheet
&& pStyleSheet
->GetFamily() != SD_STYLE_FAMILY_PSEUDO
)
250 SfxStyleSheet
* pOldStyleSheet
= mpView
->GetStyleSheet();
253 if( // if the object had no style sheet, allow all
256 // allow if old and new style sheet has same family
257 pStyleSheet
->GetFamily() == pOldStyleSheet
->GetFamily() ||
259 // allow if old was background objects and new is graphics
260 pStyleSheet
->GetFamily() == (SD_STYLE_FAMILY_GRAPHICS
&& pOldStyleSheet
->GetHelpId( aStr
) == HID_PSEUDOSHEET_BACKGROUNDOBJECTS
) ||
262 // allow if old was presentation and we are a drawing document
263 (pOldStyleSheet
->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE
&& mpDoc
->GetDocumentType() == DOCUMENT_TYPE_DRAW
) )
265 mpView
->SetStyleSheet( (SfxStyleSheet
*) pStyleSheet
);
266 mpDoc
->SetChanged(TRUE
);
267 mpViewShell
->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2
);
270 /* #96983# GrabFocus moved to stylist
275 case SID_STYLE_WATERCAN
:
277 if( !SD_MOD()->GetWaterCan() )
279 if( pArgs
->GetItemState( nSId
) == SFX_ITEM_SET
)
281 aStyleName
= ( ( (const SfxStringItem
&) pArgs
->Get( nSId
) ).GetValue() );
282 SD_MOD()->SetWaterCan( TRUE
);
283 pStyleSheet
= pSSPool
->Find( aStyleName
, (SfxStyleFamily
) nFamily
);
285 // keine Praesentationsobjektvorlagen, die werden nur
286 // implizit zugewiesen
287 if( pStyleSheet
&& pStyleSheet
->GetFamily() != SD_STYLE_FAMILY_PSEUDO
)
289 ( (SdStyleSheetPool
*) pSSPool
)->SetActualStyleSheet( pStyleSheet
);
291 // Es wird explizit in den Selektionsmodus geschaltet
292 mpViewShell
->GetViewFrame()->GetDispatcher()->Execute( SID_OBJECT_SELECT
,
293 SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
);
297 SD_MOD()->SetWaterCan( FALSE
);
301 SD_MOD()->SetWaterCan( FALSE
);
302 // Werkzeugleiste muss wieder enabled werden
303 mpViewShell
->Invalidate();
317 PresentationObjects ePO
= PO_OUTLINE_1
;
321 SfxAbstractTabDialog
* pStdDlg
= NULL
;
322 SfxAbstractTabDialog
* pPresDlg
= NULL
;
323 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
324 BOOL bOldDocInOtherLanguage
= FALSE
;
325 SfxItemSet
aOriSet( pStyleSheet
->GetItemSet() );
327 SfxStyleFamily eFamily
= pStyleSheet
->GetFamily();
329 if (eFamily
== SD_STYLE_FAMILY_GRAPHICS
)
331 pStdDlg
= pFact
? pFact
->CreateSdTabTemplateDlg( 0, mpDoc
->GetDocSh(), *pStyleSheet
, mpDoc
, mpView
) : 0;
333 else if (eFamily
== SD_STYLE_FAMILY_PSEUDO
)
335 String
aName(pStyleSheet
->GetName());
338 if (aName
== String(SdResId(STR_PSEUDOSHEET_TITLE
)))
340 nDlgId
= TAB_PRES_LAYOUT_TEMPLATE
;
343 else if (aName
== String(SdResId(STR_PSEUDOSHEET_SUBTITLE
)))
345 nDlgId
= TAB_PRES_LAYOUT_TEMPLATE
;
349 String(SdResId(STR_PSEUDOSHEET_BACKGROUND
)))
351 nDlgId
= TAB_PRES_LAYOUT_TEMPLATE_BACKGROUND
;
355 String(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS
)))
357 nDlgId
= TAB_PRES_LAYOUT_TEMPLATE
;
358 ePO
= PO_BACKGROUNDOBJECTS
;
361 String(SdResId(STR_PSEUDOSHEET_NOTES
)))
363 nDlgId
= TAB_PRES_LAYOUT_TEMPLATE
;
366 else if(aName
.Search(String(SdResId(STR_PSEUDOSHEET_OUTLINE
))) !=
369 nDlgId
= TAB_PRES_LAYOUT_TEMPLATE
;
371 String
aOutlineStr((SdResId(STR_PSEUDOSHEET_OUTLINE
)));
372 // die Nummer ermitteln; ein Leerzeichen zwischen
373 // Name und Nummer beachten
374 String
aNumStr(aName
.Copy(aOutlineStr
.Len() + 1));
375 USHORT nLevel
= (USHORT
)aNumStr
.ToInt32();
378 case 1: ePO
= PO_OUTLINE_1
; break;
379 case 2: ePO
= PO_OUTLINE_2
; break;
380 case 3: ePO
= PO_OUTLINE_3
; break;
381 case 4: ePO
= PO_OUTLINE_4
; break;
382 case 5: ePO
= PO_OUTLINE_5
; break;
383 case 6: ePO
= PO_OUTLINE_6
; break;
384 case 7: ePO
= PO_OUTLINE_7
; break;
385 case 8: ePO
= PO_OUTLINE_8
; break;
386 case 9: ePO
= PO_OUTLINE_9
; break;
391 DBG_ERROR("Vorlage aus aelterer anderssprachiger Version");
392 bOldDocInOtherLanguage
= TRUE
;
395 if( !bOldDocInOtherLanguage
)
397 pPresDlg
= pFact
? pFact
->CreateSdPresLayoutTemplateDlg( mpDocSh
, NULL
, SdResId(nDlgId
), *pStyleSheet
, ePO
, pSSPool
) : 0;
400 else if (eFamily
== SD_STYLE_FAMILY_CELL
)
404 USHORT nResult
= RET_CANCEL
;
405 const SfxItemSet
* pOutSet
= NULL
;
408 nResult
= pStdDlg
->Execute();
409 pOutSet
= pStdDlg
->GetOutputItemSet();
413 nResult
= pPresDlg
->Execute();
414 pOutSet
= pPresDlg
->GetOutputItemSet();
421 nRetMask
= pStyleSheet
->GetMask();
423 if (eFamily
== SD_STYLE_FAMILY_PSEUDO
)
425 SfxItemSet
aTempSet(*pOutSet
);
426 ((SdStyleSheet
*)pStyleSheet
)->AdjustToFontHeight(aTempSet
);
428 // Sonderbehandlung: die INVALIDS auf NULL-Pointer
429 // zurueckgesetzen (sonst landen INVALIDs oder
430 // Pointer auf die DefaultItems in der Vorlage;
431 // beides wuerde die Attribut-Vererbung unterbinden)
432 aTempSet
.ClearInvalidItems();
434 // EE_PARA_NUMBULLET item is only valid in first outline template
435 if( (ePO
>= PO_OUTLINE_2
) && (ePO
<= PO_OUTLINE_9
) )
437 if (aTempSet
.GetItemState(EE_PARA_NUMBULLET
) == SFX_ITEM_SET
)
439 SvxNumRule
aRule(*((SvxNumBulletItem
*)aTempSet
.GetItem(EE_PARA_NUMBULLET
))->GetNumRule());
441 String
sStyleName((SdResId(STR_PSEUDOSHEET_OUTLINE
)));
442 sStyleName
.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) );
443 SfxStyleSheetBase
* pFirstStyleSheet
= pSSPool
->Find( sStyleName
, SD_STYLE_FAMILY_PSEUDO
);
447 pFirstStyleSheet
->GetItemSet().Put( SvxNumBulletItem( aRule
, EE_PARA_NUMBULLET
));
448 SdStyleSheet
* pRealSheet
= ((SdStyleSheet
*)pFirstStyleSheet
)->GetRealStyleSheet();
449 pRealSheet
->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED
));
452 aTempSet
.ClearItem( EE_PARA_NUMBULLET
);
456 String
sStyleName((SdResId(STR_PSEUDOSHEET_OUTLINE
)));
457 sStyleName
.Append( sal_Unicode( ' ' ));
459 pStyleSheet
->GetItemSet().Put(aTempSet
);
460 SdStyleSheet
* pRealSheet
=((SdStyleSheet
*)pStyleSheet
)->GetRealStyleSheet();
461 pRealSheet
->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED
));
463 if( (ePO
>= PO_OUTLINE_1
) && (ePO
<= PO_OUTLINE_8
) )
465 for( USHORT n
= (USHORT
)(ePO
- PO_OUTLINE_1
+ 2); n
< 10; n
++ )
467 String
aName( sStyleName
);
468 aName
.Append( String::CreateFromInt32( (sal_Int32
) n
));
470 SfxStyleSheetBase
* pSheet
= pSSPool
->Find( aName
, SD_STYLE_FAMILY_PSEUDO
);
474 SdStyleSheet
* pRealStyleSheet
= ((SdStyleSheet
*)pSheet
)->GetRealStyleSheet();
475 pRealStyleSheet
->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED
));
481 SfxItemSet
& rAttr
= pStyleSheet
->GetItemSet();
484 if ( rAttr.GetItemState( EE_PARA_LRSPACE ) == SFX_ITEM_ON )
486 // SvxLRSpaceItem hart gesetzt: NumBulletItem anpassen
487 if ( aOriSet.GetItemState( EE_PARA_LRSPACE ) != SFX_ITEM_ON ||
488 (const SvxLRSpaceItem&) aOriSet.Get( EE_PARA_LRSPACE ) !=
489 (const SvxLRSpaceItem&) rAttr.Get( EE_PARA_LRSPACE ) )
491 SvxNumBulletItem aNumBullet( (const SvxNumBulletItem&) rAttr.Get(EE_PARA_NUMBULLET) );
493 sal_uInt16 nLevel = 0;
494 if( (ePO >= PO_OUTLINE_2) && (ePO <= PO_OUTLINE_9) )
495 nLevel = (sal_uInt16)(ePO - PO_OUTLINE_1 + 1);
497 EditEngine::ImportBulletItem( aNumBullet, nLevel, NULL,
498 &(const SvxLRSpaceItem&) rAttr.Get( EE_PARA_LRSPACE ) );
500 // the numbering bullet item is not valid in styles Outline 2 to Outline 9
503 // so put it into Outline 1 then..
504 String sStyleName((SdResId(STR_PSEUDOSHEET_OUTLINE)));
505 sStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) );
506 SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( sStyleName, SD_STYLE_FAMILY_PSEUDO);
510 pFirstStyleSheet->GetItemSet().Put( aNumBullet);
511 SdStyleSheet* pRealSheet = ((SdStyleSheet*)pFirstStyleSheet)->GetRealStyleSheet();
512 pRealSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
517 ( (SfxItemSet&) rAttr).Put( aNumBullet );
522 // check for unique names of named items for xml
523 if( rAttr
.GetItemState( XATTR_FILLBITMAP
) == SFX_ITEM_SET
)
525 const SfxPoolItem
* pOldItem
= rAttr
.GetItem( XATTR_FILLBITMAP
);
526 SfxPoolItem
* pNewItem
= ((XFillBitmapItem
*)pOldItem
)->checkForUniqueItem( mpDoc
);
527 if( pOldItem
!= pNewItem
)
529 rAttr
.Put( *pNewItem
);
533 if( rAttr
.GetItemState( XATTR_LINEDASH
) == SFX_ITEM_SET
)
535 const SfxPoolItem
* pOldItem
= rAttr
.GetItem( XATTR_LINEDASH
);
536 SfxPoolItem
* pNewItem
= ((XLineDashItem
*)pOldItem
)->checkForUniqueItem( mpDoc
);
537 if( pOldItem
!= pNewItem
)
539 rAttr
.Put( *pNewItem
);
543 if( rAttr
.GetItemState( XATTR_LINESTART
) == SFX_ITEM_SET
)
545 const SfxPoolItem
* pOldItem
= rAttr
.GetItem( XATTR_LINESTART
);
546 SfxPoolItem
* pNewItem
= ((XLineStartItem
*)pOldItem
)->checkForUniqueItem( mpDoc
);
547 if( pOldItem
!= pNewItem
)
549 rAttr
.Put( *pNewItem
);
553 if( rAttr
.GetItemState( XATTR_LINEEND
) == SFX_ITEM_SET
)
555 const SfxPoolItem
* pOldItem
= rAttr
.GetItem( XATTR_LINEEND
);
556 SfxPoolItem
* pNewItem
= ((XLineEndItem
*)pOldItem
)->checkForUniqueItem( mpDoc
);
557 if( pOldItem
!= pNewItem
)
559 rAttr
.Put( *pNewItem
);
563 if( rAttr
.GetItemState( XATTR_FILLGRADIENT
) == SFX_ITEM_SET
)
565 const SfxPoolItem
* pOldItem
= rAttr
.GetItem( XATTR_FILLGRADIENT
);
566 SfxPoolItem
* pNewItem
= ((XFillGradientItem
*)pOldItem
)->checkForUniqueItem( mpDoc
);
567 if( pOldItem
!= pNewItem
)
569 rAttr
.Put( *pNewItem
);
573 if( rAttr
.GetItemState( XATTR_FILLFLOATTRANSPARENCE
) == SFX_ITEM_SET
)
575 const SfxPoolItem
* pOldItem
= rAttr
.GetItem( XATTR_FILLFLOATTRANSPARENCE
);
576 SfxPoolItem
* pNewItem
= ((XFillFloatTransparenceItem
*)pOldItem
)->checkForUniqueItem( mpDoc
);
577 if( pOldItem
!= pNewItem
)
579 rAttr
.Put( *pNewItem
);
583 if( rAttr
.GetItemState( XATTR_FILLHATCH
) == SFX_ITEM_SET
)
585 const SfxPoolItem
* pOldItem
= rAttr
.GetItem( XATTR_FILLHATCH
);
586 SfxPoolItem
* pNewItem
= ((XFillHatchItem
*)pOldItem
)->checkForUniqueItem( mpDoc
);
587 if( pOldItem
!= pNewItem
)
589 rAttr
.Put( *pNewItem
);
594 ( (SfxStyleSheet
*) pStyleSheet
)->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED
) );
596 DrawViewShell
* pDrawViewShell
= dynamic_cast< DrawViewShell
* >( mpViewShell
);
599 PageKind ePageKind
= pDrawViewShell
->GetPageKind();
600 if( ePageKind
== PK_NOTES
|| ePageKind
== PK_HANDOUT
)
602 SdPage
* pPage
= mpViewShell
->GetActualPage();
604 if(pDrawViewShell
->GetEditMode() == EM_MASTERPAGE
)
606 pPage
= static_cast<SdPage
*>((&(pPage
->TRG_GetMasterPage())));
611 SdrObjListIter
aIter( *pPage
);
612 while( aIter
.IsMore() )
614 SdrObject
* pObj
= aIter
.Next();
615 if( pObj
->ISA(SdrPageObj
) )
618 pObj
->ActionChanged();
619 // pObj->SendRepaintBroadcast();
626 if( mpDoc
->GetOnlineSpell() )
628 const SfxPoolItem
* pTempItem
;
629 if( SFX_ITEM_SET
== rAttr
.GetItemState(EE_CHAR_LANGUAGE
, FALSE
, &pTempItem
) ||
630 SFX_ITEM_SET
== rAttr
.GetItemState(EE_CHAR_LANGUAGE_CJK
, FALSE
, &pTempItem
) ||
631 SFX_ITEM_SET
== rAttr
.GetItemState(EE_CHAR_LANGUAGE_CTL
, FALSE
, &pTempItem
) )
633 mpDoc
->StopOnlineSpelling();
634 mpDoc
->StartOnlineSpelling();
638 mpDoc
->SetChanged(TRUE
);
644 if( nSId
== SID_STYLE_NEW
)
645 pSSPool
->Remove( pStyleSheet
);
657 case SID_STYLE_NEW_BY_EXAMPLE
:
661 nRetMask
= pStyleSheet
->GetMask();
662 SfxItemSet
aCoreSet( mpDoc
->GetPool() );
663 mpView
->GetAttributes( aCoreSet
, TRUE
);
665 // wenn das Objekt eine Vorlage hatte, wird diese Parent
667 SfxStyleSheet
* pOldStyle
= mpView
->GetStyleSheet();
669 // Wenn pOldStyle == pStyleSheet -> Rekursion
670 if( pOldStyle
!= pStyleSheet
)
674 pStyleSheet
->SetParent(pOldStyle
->GetName());
677 SfxItemSet
* pStyleSet
= &pStyleSheet
->GetItemSet();
678 pStyleSet
->Put(aCoreSet
);
680 // Vorlage anwenden (Aber nicht, wenn gerade ein Text
681 // editiert wird, denn dazu muesste die Edit Engine
682 // Vorlagen auf Zeichenebene beherrschen.)
683 if (!mpView
->GetTextEditObject())
685 mpView
->SetStyleSheet( (SfxStyleSheet
*) pStyleSheet
);
688 ( (SfxStyleSheet
*) pStyleSheet
)->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED
) );
689 mpDoc
->SetChanged(TRUE
);
691 mpViewShell
->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2
);
697 case SID_STYLE_UPDATE_BY_EXAMPLE
:
699 if ((mpView
->AreObjectsMarked() && mpView
->GetMarkedObjectList().GetMarkCount() == 1) ||
700 mpView
->ISA(OutlineView
))
702 pStyleSheet
= mpView
->GetStyleSheet();
706 nRetMask
= pStyleSheet
->GetMask();
707 SfxItemSet
aCoreSet( mpDoc
->GetPool() );
708 mpView
->GetAttributes( aCoreSet
);
710 SfxItemSet
* pStyleSet
= &pStyleSheet
->GetItemSet();
711 pStyleSet
->Put( aCoreSet
);
713 mpView
->SetStyleSheet( (SfxStyleSheet
*) pStyleSheet
);
715 ( (SfxStyleSheet
*) pStyleSheet
)->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED
) );
716 mpDoc
->SetChanged(TRUE
);
717 mpViewShell
->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2
);
724 if( nRetMask
!= 0xffff )
725 rReq
.SetReturnValue( SfxUInt16Item( nSId
, nRetMask
) );
728 void FuTemplate::Activate()
732 void FuTemplate::Deactivate()
736 } // end of namespace sd