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: txtattr.cxx,v $
10 * $Revision: 1.28.140.1 $
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_sw.hxx"
35 #include <hintids.hxx>
37 #ifndef _MSGBOX_HXX //autogen
38 #include <vcl/msgbox.hxx>
40 #include <svtools/whiter.hxx>
41 #include <svtools/stritem.hxx>
42 #include <svtools/itemiter.hxx>
43 #include <svtools/ctloptions.hxx>
44 #include <swmodule.hxx>
45 #include <sfx2/bindings.hxx>
46 #include <sfx2/request.hxx>
47 #include <svx/fhgtitem.hxx>
48 #include <svx/adjitem.hxx>
49 #include <svx/lspcitem.hxx>
50 #include <svx/udlnitem.hxx>
51 #include <svx/escpitem.hxx>
52 #include <svx/htmlmode.hxx>
53 #include <svx/scripttypeitem.hxx>
54 #include <svx/frmdiritem.hxx>
57 #include <fmtinfmt.hxx>
65 #include <viewopt.hxx>
81 #include <SwStyleNameMapper.hxx>
82 #include "swabstdlg.hxx"
84 const SwTwips lFontInc
= 2 * 20; // ==> PointToTwips(2)
85 const SwTwips lFontMaxSz
= 72 * 20; // ==> PointToTwips(72)
90 void SwTextShell::ExecCharAttr(SfxRequest
&rReq
)
92 SwWrtShell
&rSh
= GetShell();
93 const SfxItemSet
*pArgs
= rReq
.GetArgs();
94 int eState
= STATE_TOGGLE
;
95 USHORT nWhich
= rReq
.GetSlot();
99 const SfxPoolItem
* pItem
;
100 pArgs
->GetItemState(nWhich
, FALSE
, &pItem
);
101 eState
= ((const SfxBoolItem
&) pArgs
->
102 Get( nWhich
)).GetValue() ? STATE_ON
: STATE_OFF
;
106 SfxItemSet
aSet( GetPool(), RES_CHRATR_BEGIN
, RES_CHRATR_END
-1 );
107 if (STATE_TOGGLE
== eState
)
108 rSh
.GetCurAttr( aSet
);
112 case FN_SET_SUB_SCRIPT
:
113 case FN_SET_SUPER_SCRIPT
:
115 SvxEscapement eEscape
= SVX_ESCAPEMENT_SUBSCRIPT
;
120 short nTmpEsc
= ((const SvxEscapementItem
&)
121 aSet
.Get( RES_CHRATR_ESCAPEMENT
)).GetEsc();
122 eEscape
= nWhich
== FN_SET_SUPER_SCRIPT
?
123 SVX_ESCAPEMENT_SUPERSCRIPT
:
124 SVX_ESCAPEMENT_SUBSCRIPT
;
125 if( nWhich
== FN_SET_SUB_SCRIPT
&& nTmpEsc
< 0 ||
126 nWhich
== FN_SET_SUPER_SCRIPT
&& nTmpEsc
> 0 )
127 eEscape
= SVX_ESCAPEMENT_OFF
;
129 SfxBindings
& rBind
= GetView().GetViewFrame()->GetBindings();
130 if( nWhich
== FN_SET_SUB_SCRIPT
)
131 rBind
.SetState( SfxBoolItem( FN_SET_SUPER_SCRIPT
,
134 rBind
.SetState( SfxBoolItem( FN_SET_SUB_SCRIPT
,
140 eEscape
= nWhich
== FN_SET_SUPER_SCRIPT
?
141 SVX_ESCAPEMENT_SUPERSCRIPT
:
142 SVX_ESCAPEMENT_SUBSCRIPT
;
145 eEscape
= SVX_ESCAPEMENT_OFF
;
148 SvxEscapementItem
aEscape( eEscape
, RES_CHRATR_ESCAPEMENT
);
149 if(eEscape
== SVX_ESCAPEMENT_SUPERSCRIPT
)
150 aEscape
.GetEsc() = DFLT_ESC_AUTO_SUPER
;
151 else if(eEscape
== SVX_ESCAPEMENT_SUBSCRIPT
)
152 aEscape
.GetEsc() = DFLT_ESC_AUTO_SUB
;
153 if(eState
!= STATE_OFF
)
155 if(eEscape
== FN_SET_SUPER_SCRIPT
)
156 aEscape
.GetEsc() *= -1;
158 rSh
.SetAttr( aEscape
);
159 rReq
.AppendItem( aEscape
);
164 case FN_UPDATE_STYLE_BY_EXAMPLE
:
165 rSh
.QuickUpdateStyle();
168 case FN_UNDERLINE_DOUBLE
:
170 FontUnderline eUnderline
= ((const SvxUnderlineItem
&)
171 aSet
.Get(RES_CHRATR_UNDERLINE
)).GetLineStyle();
175 eUnderline
= eUnderline
== UNDERLINE_DOUBLE
?
180 eUnderline
= UNDERLINE_DOUBLE
;
183 eUnderline
= UNDERLINE_NONE
;
186 SvxUnderlineItem
aUnderline(eUnderline
, RES_CHRATR_UNDERLINE
);
187 rSh
.SetAttr( aUnderline
);
188 rReq
.AppendItem( aUnderline
);
192 case FN_REMOVE_DIRECT_CHAR_FORMATS
:
193 if( !rSh
.HasReadonlySel() && rSh
.IsEndPara())
197 ASSERT(FALSE
, falscher Dispatcher
);
203 void SwTextShell::ExecCharAttrArgs(SfxRequest
&rReq
)
205 USHORT nSlot
= rReq
.GetSlot();
206 const SfxItemSet
* pArgs
= rReq
.GetArgs();
207 BOOL bArgs
= pArgs
!= 0 && pArgs
->Count() > 0;
209 SwWrtShell
& rWrtSh
= GetShell();
210 SwTxtFmtColl
* pColl
= 0;
212 // nur gesetzt, wenn gesamter Absatz selektiert ist und AutoUpdateFmt gesetzt ist
213 if( rWrtSh
.HasSelection() && rWrtSh
.IsSelFullPara() )
215 pColl
= rWrtSh
.GetCurTxtFmtColl();
216 if(pColl
&& !pColl
->IsAutoUpdateFmt())
219 SfxItemPool
& rPool
= GetPool();
220 USHORT nWhich
= rPool
.GetWhich(nSlot
);
224 // Sonderbehandlung der PoolId des SwFmtInetFmt
227 const SfxPoolItem
& rItem
= pArgs
->Get(nWhich
);
229 SwFmtINetFmt
aINetFmt((const SwFmtINetFmt
&)rItem
);
230 if( USHRT_MAX
== aINetFmt
.GetVisitedFmtId() )
232 aINetFmt
.SetVisitedFmtId(
233 SwStyleNameMapper::GetPoolIdFromUIName( aINetFmt
.GetVisitedFmt(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT
));
235 if( USHRT_MAX
== aINetFmt
.GetINetFmtId() )
237 aINetFmt
.SetINetFmtId(
238 SwStyleNameMapper::GetPoolIdFromUIName( aINetFmt
.GetINetFmt(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT
));
242 pColl
->SetFmtAttr( aINetFmt
);
243 else rWrtSh
.SetAttr( aINetFmt
);
248 case FN_GROW_FONT_SIZE
:
251 case FN_SHRINK_FONT_SIZE
:
253 SvxScriptSetItem
aSetItem( SID_ATTR_CHAR_FONTHEIGHT
, rPool
);
254 rWrtSh
.GetCurAttr( aSetItem
.GetItemSet() );
255 SfxItemSet
aAttrSet( rPool
, aSetItem
.GetItemSet().GetRanges() );
257 const SfxPoolItem
* pI
;
258 static const USHORT aScrTypes
[] = {
259 SCRIPTTYPE_LATIN
, SCRIPTTYPE_ASIAN
, SCRIPTTYPE_COMPLEX
, 0 };
260 USHORT nScriptType
= rWrtSh
.GetScriptType();
261 for( const USHORT
* pScrpTyp
= aScrTypes
; *pScrpTyp
; ++pScrpTyp
)
262 if( ( nScriptType
& *pScrpTyp
) &&
263 0 != ( pI
= aSetItem
.GetItemOfScript( *pScrpTyp
)))
265 SvxFontHeightItem
aSize( *(const SvxFontHeightItem
*)pI
);
266 SwTwips lSize
= (SwTwips
) aSize
.GetHeight();
270 if( lSize
== lFontMaxSz
)
271 break; // das wars, hoeher gehts nicht
272 if( ( lSize
+= lFontInc
) > lFontMaxSz
)
279 if( ( lSize
-= lFontInc
) < 4 )
282 aSize
.SetHeight( lSize
);
283 aAttrSet
.Put( aSize
);
285 if( aAttrSet
.Count() )
288 pColl
->SetFmtAttr( aAttrSet
);
290 rWrtSh
.SetAttr( aAttrSet
);
297 ASSERT(FALSE
, falscher Dispatcher
);
306 void lcl_SetAdjust(SvxAdjust eAdjst
, SfxItemSet
& rSet
)
308 rSet
.Put(SvxAdjustItem(eAdjst
,RES_PARATR_ADJUST
));
313 void lcl_SetLineSpace(BYTE ePropL
,SfxItemSet
& rSet
)
315 SvxLineSpacingItem
aLineSpacing(ePropL
, RES_PARATR_LINESPACING
);
316 aLineSpacing
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
318 aLineSpacing
.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF
;
320 aLineSpacing
.SetPropLineSpace(ePropL
);
321 rSet
.Put( aLineSpacing
);
326 void SwTextShell::ExecParaAttr(SfxRequest
&rReq
)
328 // gleiche beide Attribute holen, ist nicht teuerer !!
329 SfxItemSet
aSet( GetPool(), RES_PARATR_LINESPACING
, RES_PARATR_ADJUST
);
331 switch (rReq
.GetSlot())
333 case FN_SET_LEFT_PARA
: lcl_SetAdjust(ADJLEFT
,aSet
); break;
334 case FN_SET_RIGHT_PARA
: lcl_SetAdjust(ADJRIGHT
,aSet
); break;
335 case FN_SET_CENTER_PARA
: lcl_SetAdjust(ADJCENTER
,aSet
); break;
336 case SID_ATTR_PARA_ADJUST_BLOCK
:lcl_SetAdjust(ADJBLOCK
,aSet
); break;
338 case FN_SET_LINE_SPACE_1
: lcl_SetLineSpace(100,aSet
); break;
339 case FN_SET_LINE_SPACE_15
: lcl_SetLineSpace(150,aSet
); break;
340 case FN_SET_LINE_SPACE_2
: lcl_SetLineSpace(200,aSet
); break;
343 DBG_ERROR("SwTextShell::ExecParaAttr falscher Dispatcher");
346 SwWrtShell
& rWrtSh
= GetShell();
347 SwTxtFmtColl
* pColl
= rWrtSh
.GetCurTxtFmtColl();
348 if(pColl
&& pColl
->IsAutoUpdateFmt())
350 rWrtSh
.AutoUpdatePara(pColl
, *pSet
);
354 rWrtSh
.SetAttr( aSet
);
363 void SwTextShell::ExecParaAttr(SfxRequest
&rReq
)
367 const SfxItemSet
* pArgs
= rReq
.GetArgs();
369 // gleich beide Attribute holen, ist nicht teuerer !!
370 SfxItemSet
aSet( GetPool(),
371 RES_PARATR_LINESPACING
, RES_PARATR_ADJUST
,
372 RES_FRAMEDIR
, RES_FRAMEDIR
,
375 USHORT nSlot
= rReq
.GetSlot();
378 case SID_ATTR_PARA_ADJUST
:
380 if( pArgs
&& SFX_ITEM_SET
== pArgs
->GetItemState(RES_PARATR_ADJUST
) )
382 const SvxAdjustItem
& rAdj
= (const SvxAdjustItem
&) pArgs
->Get(RES_PARATR_ADJUST
);
383 SvxAdjustItem
aAdj( rAdj
.GetAdjust(), RES_PARATR_ADJUST
);
384 if ( rAdj
.GetAdjust() == SVX_ADJUST_BLOCK
)
386 aAdj
.SetLastBlock( rAdj
.GetLastBlock() );
387 aAdj
.SetOneWord( rAdj
.GetOneWord() );
394 case SID_ATTR_PARA_ADJUST_LEFT
: eAdjst
= SVX_ADJUST_LEFT
; goto SET_ADJUST
;
395 case SID_ATTR_PARA_ADJUST_RIGHT
: eAdjst
= SVX_ADJUST_RIGHT
; goto SET_ADJUST
;
396 case SID_ATTR_PARA_ADJUST_CENTER
: eAdjst
= SVX_ADJUST_CENTER
; goto SET_ADJUST
;
397 case SID_ATTR_PARA_ADJUST_BLOCK
: eAdjst
= SVX_ADJUST_BLOCK
; goto SET_ADJUST
;
400 aSet
.Put(SvxAdjustItem(eAdjst
,RES_PARATR_ADJUST
));
401 rReq
.AppendItem( SfxBoolItem( GetPool().GetWhich(nSlot
), TRUE
) );
405 case SID_ATTR_PARA_LINESPACE
:
406 if(pArgs
&& SFX_ITEM_SET
== pArgs
->GetItemState( GetPool().GetWhich(nSlot
) ))
408 SvxLineSpacingItem aLineSpace
= (const SvxLineSpacingItem
&)pArgs
->Get(
409 GetPool().GetWhich(nSlot
));
410 aSet
.Put( aLineSpace
);
413 case SID_ATTR_PARA_LINESPACE_10
: ePropL
= 100; goto SET_LINESPACE
;
414 case SID_ATTR_PARA_LINESPACE_15
: ePropL
= 150; goto SET_LINESPACE
;
415 case SID_ATTR_PARA_LINESPACE_20
: ePropL
= 200; goto SET_LINESPACE
;
420 SvxLineSpacingItem
aLineSpacing(ePropL
, RES_PARATR_LINESPACING
);
421 aLineSpacing
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
423 aLineSpacing
.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF
;
425 aLineSpacing
.SetPropLineSpace(ePropL
);
426 aSet
.Put( aLineSpacing
);
430 case SID_ATTR_PARA_LEFT_TO_RIGHT
:
431 case SID_ATTR_PARA_RIGHT_TO_LEFT
:
434 int eState
= pArgs
? pArgs
->GetItemState(nSlot
) : SFX_ITEM_DISABLED
;
435 if (pArgs
&& SFX_ITEM_SET
== eState
)
436 bSet
= ((const SfxBoolItem
&)pArgs
->Get(nSlot
)).GetValue();
438 // toggling of the slots not used anymore
441 nSlot = SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot ?
442 SID_ATTR_PARA_RIGHT_TO_LEFT :
443 SID_ATTR_PARA_LEFT_TO_RIGHT;
445 SfxItemSet
aAdjustSet( GetPool(),
446 RES_PARATR_ADJUST
, RES_PARATR_ADJUST
);
447 GetShell().GetCurAttr(aAdjustSet
);
448 BOOL bChgAdjust
= FALSE
;
449 SfxItemState eAdjustState
= aAdjustSet
.GetItemState(RES_PARATR_ADJUST
, FALSE
);
450 if(eAdjustState
>= SFX_ITEM_DEFAULT
)
452 int eAdjust
= (int)(( const SvxAdjustItem
& )
453 aAdjustSet
.Get(RES_PARATR_ADJUST
)).GetAdjust();
454 // bChgAdjust = SVX_ADJUST_CENTER != eAdjust && SVX_ADJUST_BLOCK != eAdjust;
455 bChgAdjust
= (SVX_ADJUST_LEFT
== eAdjust
&& SID_ATTR_PARA_RIGHT_TO_LEFT
== nSlot
) ||
456 (SVX_ADJUST_RIGHT
== eAdjust
&& SID_ATTR_PARA_LEFT_TO_RIGHT
== nSlot
);
461 SvxFrameDirection eFrmDirection
=
462 (SID_ATTR_PARA_LEFT_TO_RIGHT
== nSlot
) ?
463 FRMDIR_HORI_LEFT_TOP
: FRMDIR_HORI_RIGHT_TOP
;
464 aSet
.Put( SvxFrameDirectionItem( eFrmDirection
, RES_FRAMEDIR
) );
468 SvxAdjust eAdjust
= (SID_ATTR_PARA_LEFT_TO_RIGHT
== nSlot
) ?
469 SVX_ADJUST_LEFT
: SVX_ADJUST_RIGHT
;
470 SvxAdjustItem
aAdjust( eAdjust
, RES_PARATR_ADJUST
);
472 aAdjust
.SetWhich(SID_ATTR_PARA_ADJUST
);
473 GetView().GetViewFrame()->GetBindings().SetState( aAdjust
);
474 // Toggle numbering alignment
475 const SwNumRule
* pCurRule
= GetShell().GetCurNumRule();
478 SvxNumRule aRule
= pCurRule
->MakeSvxNumRule();
480 for(USHORT i
= 0; i
< aRule
.GetLevelCount(); i
++)
482 SvxNumberFormat
aFmt(aRule
.GetLevel(i
));
483 if(SVX_ADJUST_LEFT
== aFmt
.GetNumAdjust())
484 aFmt
.SetNumAdjust( SVX_ADJUST_RIGHT
);
486 else if(SVX_ADJUST_RIGHT
== aFmt
.GetNumAdjust())
487 aFmt
.SetNumAdjust( SVX_ADJUST_LEFT
);
489 aRule
.SetLevel(i
, aFmt
, aRule
.Get(i
) != 0);
491 // --> OD 2008-02-11 #newlistlevelattrs#
492 SwNumRule
aSetRule( pCurRule
->GetName(),
493 pCurRule
->Get( 0 ).GetPositionAndSpaceMode() );
495 aSetRule
.SetSvxRule( aRule
, GetShell().GetDoc());
496 aSetRule
.SetAutoRule( TRUE
);
497 // --> OD 2008-03-17 #refactorlists#
498 // no start or continuation of a list - list style is only changed
499 GetShell().SetCurNumRule( aSetRule
, false );
507 ASSERT(FALSE
, falscher Dispatcher
);
510 SwWrtShell
& rWrtSh
= GetShell();
511 SwTxtFmtColl
* pColl
= rWrtSh
.GetCurTxtFmtColl();
512 if(pColl
&& pColl
->IsAutoUpdateFmt())
514 rWrtSh
.AutoUpdatePara(pColl
, aSet
);
517 rWrtSh
.SetAttr( aSet
);
525 void SwTextShell::ExecParaAttrArgs(SfxRequest
&rReq
)
527 SwWrtShell
&rSh
= GetShell();
528 const SfxItemSet
*pArgs
= rReq
.GetArgs();
529 const SfxPoolItem
*pItem
= 0;
531 USHORT nSlot
= rReq
.GetSlot();
533 pArgs
->GetItemState(GetPool().GetWhich(nSlot
), FALSE
, &pItem
);
536 case FN_DROP_CHAR_STYLE_NAME
:
539 String sCharStyleName
= ((const SfxStringItem
*)pItem
)->GetValue();
540 SfxItemSet
aSet(GetPool(), RES_PARATR_DROP
, RES_PARATR_DROP
, 0L);
541 rSh
.GetCurAttr(aSet
);
542 SwFmtDrop
aDropItem((const SwFmtDrop
&)aSet
.Get(RES_PARATR_DROP
));
544 if(sCharStyleName
.Len())
545 pFmt
= rSh
.FindCharFmtByName( sCharStyleName
);
546 aDropItem
.SetCharFmt( pFmt
);
551 case FN_FORMAT_DROPCAPS
:
560 SfxItemSet
aSet(GetPool(), RES_PARATR_DROP
, RES_PARATR_DROP
,
561 HINT_END
, HINT_END
, 0);
562 rSh
.GetCurAttr(aSet
);
563 SwAbstractDialogFactory
* pFact
= SwAbstractDialogFactory::Create();
564 DBG_ASSERT(pFact
, "SwAbstractDialogFactory fail!");
566 SfxAbstractDialog
* pDlg
= pFact
->CreateSfxDialog( GetView().GetWindow(), aSet
,
567 rSh
.GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), DLG_SWDROPCAPS
);
568 DBG_ASSERT(pDlg
, "Dialogdiet fail!");
569 if (pDlg
->Execute() == RET_OK
)
572 rSh
.StartUndo( UNDO_START
);
573 if ( SFX_ITEM_SET
== aSet
.GetItemState(HINT_END
,FALSE
,&pItem
) )
575 if ( ((SfxStringItem
*)pItem
)->GetValue().Len() )
576 rSh
.ReplaceDropTxt(((SfxStringItem
*)pItem
)->GetValue());
578 rSh
.SetAttr(*pDlg
->GetOutputItemSet());
579 rSh
.StartUndo( UNDO_END
);
581 rReq
.Done(*pDlg
->GetOutputItemSet());
587 case SID_ATTR_PARA_PAGEBREAK
:
590 rSh
.SetAttr( *pItem
);
594 case SID_ATTR_PARA_MODEL
:
598 SfxItemSet
aCoreSet( GetPool(),
599 RES_PAGEDESC
, RES_PAGEDESC
,
600 SID_ATTR_PARA_MODEL
, SID_ATTR_PARA_MODEL
, 0);
601 aCoreSet
.Put(*pItem
);
602 SfxToSwPageDescAttr( rSh
, aCoreSet
);
603 rSh
.SetAttr(aCoreSet
);
610 ASSERT(FALSE
, falscher Dispatcher
);
617 void SwTextShell::GetAttrState(SfxItemSet
&rSet
)
619 SwWrtShell
&rSh
= GetShell();
620 SfxItemPool
& rPool
= GetPool();
621 SfxItemSet
aCoreSet(rPool
, aTxtFmtCollSetRange
);
622 rSh
.GetCurAttr(aCoreSet
); // *alle* Textattribute von der Core erfragen
624 SfxWhichIter
aIter(rSet
);
625 USHORT nSlot
= aIter
.FirstWhich();
626 sal_Bool bFlag
= sal_False
;
627 SfxBoolItem aFlagItem
;
628 const SfxPoolItem
* pItem
= 0;
629 int eAdjust
= -1; // Illegaler Wert, um DONTCARE zu erkennen
630 SfxItemState eState
= aCoreSet
.GetItemState(RES_PARATR_ADJUST
, FALSE
, &pItem
);
632 if( SFX_ITEM_DEFAULT
== eState
)
633 pItem
= &rPool
.GetDefaultItem(RES_PARATR_ADJUST
);
634 if( SFX_ITEM_DEFAULT
<= eState
)
635 eAdjust
= (int)(( SvxAdjustItem
* ) pItem
)->GetAdjust();
638 eState
= aCoreSet
.GetItemState(RES_CHRATR_ESCAPEMENT
, FALSE
, &pItem
);
639 if( SFX_ITEM_DEFAULT
== eState
)
640 pItem
= &rPool
.GetDefaultItem(RES_CHRATR_ESCAPEMENT
);
641 if( eState
>= SFX_ITEM_DEFAULT
)
642 nEsc
= ((SvxEscapementItem
* )pItem
)->GetEsc();
644 USHORT nLineSpace
= 0;
645 eState
= aCoreSet
.GetItemState(RES_PARATR_LINESPACING
, FALSE
, &pItem
);
646 if( SFX_ITEM_DEFAULT
== eState
)
647 pItem
= &rPool
.GetDefaultItem(RES_PARATR_LINESPACING
);
648 if( SFX_ITEM_DEFAULT
<= eState
&&
649 ((SvxLineSpacingItem
* )pItem
)->GetLineSpaceRule() == SVX_LINE_SPACE_AUTO
)
651 if(SVX_INTER_LINE_SPACE_OFF
==
652 ((SvxLineSpacingItem
* )pItem
)->GetInterLineSpaceRule())
655 nLineSpace
= ((SvxLineSpacingItem
* )pItem
)->GetPropLineSpace();
662 case FN_SET_SUPER_SCRIPT
:
665 case FN_SET_SUB_SCRIPT
:
668 case SID_ATTR_PARA_ADJUST_LEFT
:
671 rSet
.InvalidateItem( nSlot
);
675 bFlag
= SVX_ADJUST_LEFT
== eAdjust
;
677 case SID_ATTR_PARA_ADJUST_RIGHT
:
680 rSet
.InvalidateItem( nSlot
);
684 bFlag
= SVX_ADJUST_RIGHT
== eAdjust
;
686 case SID_ATTR_PARA_ADJUST_CENTER
:
689 rSet
.InvalidateItem( nSlot
);
693 bFlag
= SVX_ADJUST_CENTER
== eAdjust
;
695 case SID_ATTR_PARA_ADJUST_BLOCK
:
699 rSet
.InvalidateItem( nSlot
);
704 bFlag
= SVX_ADJUST_BLOCK
== eAdjust
;
705 USHORT nHtmlMode
= GetHtmlMode(rSh
.GetView().GetDocShell());
706 if((nHtmlMode
& HTMLMODE_ON
) && !(nHtmlMode
& (HTMLMODE_FULL_STYLES
|HTMLMODE_FIRSTLINE
) ))
708 rSet
.DisableItem( nSlot
);
714 case SID_ATTR_PARA_LINESPACE_10
:
715 bFlag
= nLineSpace
== 100;
717 case SID_ATTR_PARA_LINESPACE_15
:
718 bFlag
= nLineSpace
== 150;
720 case SID_ATTR_PARA_LINESPACE_20
:
721 bFlag
= nLineSpace
== 200;
723 case FN_GROW_FONT_SIZE
:
724 case FN_SHRINK_FONT_SIZE
:
726 SvxScriptSetItem
aSetItem( SID_ATTR_CHAR_FONTHEIGHT
,
728 aSetItem
.GetItemSet().Put( aCoreSet
, FALSE
);
729 if( !aSetItem
.GetItemOfScript( rSh
.GetScriptType() ))
730 rSet
.DisableItem( nSlot
);
734 case FN_UNDERLINE_DOUBLE
:
736 eState
= aCoreSet
.GetItemState(RES_CHRATR_UNDERLINE
);
737 if( eState
>= SFX_ITEM_DEFAULT
)
739 FontUnderline eUnderline
= ((const SvxUnderlineItem
&)
740 aCoreSet
.Get(RES_CHRATR_UNDERLINE
)).GetLineStyle();
741 rSet
.Put(SfxBoolItem(nSlot
, eUnderline
== UNDERLINE_DOUBLE
));
744 rSet
.InvalidateItem(nSlot
);
748 case SID_ATTR_PARA_ADJUST
:
750 rSet
.InvalidateItem( nSlot
);
752 rSet
.Put(SvxAdjustItem((SvxAdjust
)eAdjust
, SID_ATTR_PARA_ADJUST
));
756 case SID_ATTR_PARA_LEFT_TO_RIGHT
:
757 case SID_ATTR_PARA_RIGHT_TO_LEFT
:
759 if ( !SW_MOD()->GetCTLOptions().IsCTLFontEnabled() )
761 rSet
.DisableItem( nSlot
);
767 USHORT nHtmlMode
= GetHtmlMode(rSh
.GetView().GetDocShell());
768 if((!(nHtmlMode
& HTMLMODE_ON
) || (0 != (nHtmlMode
& HTMLMODE_SOME_STYLES
))) &&
769 aCoreSet
.GetItemState( RES_FRAMEDIR
, FALSE
) >= SFX_ITEM_DEFAULT
)
771 SvxFrameDirection eFrmDir
= (SvxFrameDirection
)
772 ((const SvxFrameDirectionItem
& )aCoreSet
.Get(RES_FRAMEDIR
)).GetValue();
773 if (FRMDIR_ENVIRONMENT
== eFrmDir
)
775 eFrmDir
= rSh
.IsInRightToLeftText() ?
776 FRMDIR_HORI_RIGHT_TOP
: FRMDIR_HORI_LEFT_TOP
;
778 bFlag
= (SID_ATTR_PARA_LEFT_TO_RIGHT
== nSlot
&&
779 FRMDIR_HORI_LEFT_TOP
== eFrmDir
) ||
780 (SID_ATTR_PARA_RIGHT_TO_LEFT
== nSlot
&&
781 FRMDIR_HORI_RIGHT_TOP
== eFrmDir
);
785 rSet
.InvalidateItem(nSlot
);
792 case SID_ATTR_CHAR_LANGUAGE
:
793 case SID_ATTR_CHAR_KERNING
:
794 case RES_PARATR_DROP
:
796 #if OSL_DEBUG_LEVEL > 1
797 const SfxPoolItem
& rItem
= aCoreSet
.Get(GetPool().GetWhich(nSlot
), TRUE
);
800 rSet
.Put(aCoreSet
.Get( GetPool().GetWhich(nSlot
), TRUE
));
805 case SID_ATTR_PARA_MODEL
:
807 SfxItemSet
aTemp(GetPool(),
808 RES_PAGEDESC
,RES_PAGEDESC
,
809 SID_ATTR_PARA_MODEL
,SID_ATTR_PARA_MODEL
,
812 ::SwToSfxPageDescAttr(aTemp
);
813 rSet
.Put(aTemp
.Get(SID_ATTR_PARA_MODEL
));
817 case RES_TXTATR_INETFMT
:
819 SfxItemSet
aSet(GetPool(), RES_TXTATR_INETFMT
, RES_TXTATR_INETFMT
);
820 rSh
.GetCurAttr(aSet
);
821 #if OSL_DEBUG_LEVEL > 1
822 const SfxPoolItem
& rItem
= aSet
.Get(RES_TXTATR_INETFMT
, TRUE
);
825 rSet
.Put(aSet
.Get( RES_TXTATR_INETFMT
, TRUE
));
839 aFlagItem
.SetWhich( nSlot
);
840 aFlagItem
.SetValue( bFlag
);
841 rSet
.Put( aFlagItem
);
843 nSlot
= aIter
.NextWhich();
846 rSet
.Put(aCoreSet
,FALSE
);