xref: /aoo41x/main/sw/source/ui/shells/txtattr.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sw.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #include <hintids.hxx>
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir #ifndef _MSGBOX_HXX //autogen
35*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
36*cdf0e10cSrcweir #endif
37*cdf0e10cSrcweir #include <svl/whiter.hxx>
38*cdf0e10cSrcweir #include <svl/stritem.hxx>
39*cdf0e10cSrcweir #include <svl/itemiter.hxx>
40*cdf0e10cSrcweir #include <svl/ctloptions.hxx>
41*cdf0e10cSrcweir #include <swmodule.hxx>
42*cdf0e10cSrcweir #include <sfx2/bindings.hxx>
43*cdf0e10cSrcweir #include <sfx2/request.hxx>
44*cdf0e10cSrcweir #include <editeng/fhgtitem.hxx>
45*cdf0e10cSrcweir #include <editeng/adjitem.hxx>
46*cdf0e10cSrcweir #include <editeng/lspcitem.hxx>
47*cdf0e10cSrcweir #include <editeng/udlnitem.hxx>
48*cdf0e10cSrcweir #include <editeng/escpitem.hxx>
49*cdf0e10cSrcweir #include <svx/htmlmode.hxx>
50*cdf0e10cSrcweir #include <editeng/scripttypeitem.hxx>
51*cdf0e10cSrcweir #include <editeng/frmdiritem.hxx>
52*cdf0e10cSrcweir #include "paratr.hxx"
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir #include <fmtinfmt.hxx>
55*cdf0e10cSrcweir #ifndef _DOCSH_HXX
56*cdf0e10cSrcweir #include <docsh.hxx>
57*cdf0e10cSrcweir #endif
58*cdf0e10cSrcweir #include <wrtsh.hxx>
59*cdf0e10cSrcweir #ifndef _VIEW_HXX
60*cdf0e10cSrcweir #include <view.hxx>
61*cdf0e10cSrcweir #endif
62*cdf0e10cSrcweir #include <viewopt.hxx>
63*cdf0e10cSrcweir #include <uitool.hxx>
64*cdf0e10cSrcweir #ifndef _TEXTSH_HXX
65*cdf0e10cSrcweir #include <textsh.hxx>
66*cdf0e10cSrcweir #endif
67*cdf0e10cSrcweir #include <num.hxx>
68*cdf0e10cSrcweir #include <swundo.hxx>
69*cdf0e10cSrcweir #include <fmtcol.hxx>
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir #ifndef _CMDID_H
72*cdf0e10cSrcweir #include <cmdid.h>
73*cdf0e10cSrcweir #endif
74*cdf0e10cSrcweir #include <globals.h>
75*cdf0e10cSrcweir #ifndef _SHELLS_HRC
76*cdf0e10cSrcweir #include <shells.hrc>
77*cdf0e10cSrcweir #endif
78*cdf0e10cSrcweir #include <SwStyleNameMapper.hxx>
79*cdf0e10cSrcweir #include "swabstdlg.hxx"
80*cdf0e10cSrcweir #include "chrdlg.hrc"
81*cdf0e10cSrcweir const SwTwips lFontInc = 2 * 20;		   // ==> PointToTwips(2)
82*cdf0e10cSrcweir const SwTwips lFontMaxSz = 72 * 20; 	   // ==> PointToTwips(72)
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir void SwTextShell::ExecCharAttr(SfxRequest &rReq)
88*cdf0e10cSrcweir {
89*cdf0e10cSrcweir 	SwWrtShell &rSh = GetShell();
90*cdf0e10cSrcweir 	const SfxItemSet  *pArgs   = rReq.GetArgs();
91*cdf0e10cSrcweir 		  int          eState = STATE_TOGGLE;
92*cdf0e10cSrcweir 	sal_uInt16 nWhich = rReq.GetSlot();
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir 	if(pArgs )
95*cdf0e10cSrcweir 	{
96*cdf0e10cSrcweir 		const SfxPoolItem* pItem;
97*cdf0e10cSrcweir 		pArgs->GetItemState(nWhich, sal_False, &pItem);
98*cdf0e10cSrcweir 		eState =  ((const SfxBoolItem &) pArgs->
99*cdf0e10cSrcweir 								Get( nWhich )).GetValue() ? STATE_ON : STATE_OFF;
100*cdf0e10cSrcweir 	}
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir 	SfxItemSet aSet( GetPool(), RES_CHRATR_BEGIN, RES_CHRATR_END-1 );
104*cdf0e10cSrcweir 	if (STATE_TOGGLE == eState)
105*cdf0e10cSrcweir         rSh.GetCurAttr( aSet );
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir 	switch ( nWhich )
108*cdf0e10cSrcweir 	{
109*cdf0e10cSrcweir 		case FN_SET_SUB_SCRIPT:
110*cdf0e10cSrcweir 		case FN_SET_SUPER_SCRIPT:
111*cdf0e10cSrcweir 		{
112*cdf0e10cSrcweir             SvxEscapement eEscape = SVX_ESCAPEMENT_SUBSCRIPT;
113*cdf0e10cSrcweir 			switch (eState)
114*cdf0e10cSrcweir 			{
115*cdf0e10cSrcweir 			case STATE_TOGGLE:
116*cdf0e10cSrcweir 			{
117*cdf0e10cSrcweir 				short nTmpEsc = ((const SvxEscapementItem&)
118*cdf0e10cSrcweir 							aSet.Get( RES_CHRATR_ESCAPEMENT )).GetEsc();
119*cdf0e10cSrcweir 				eEscape = nWhich == FN_SET_SUPER_SCRIPT ?
120*cdf0e10cSrcweir 								SVX_ESCAPEMENT_SUPERSCRIPT:
121*cdf0e10cSrcweir 								SVX_ESCAPEMENT_SUBSCRIPT;
122*cdf0e10cSrcweir 				if( (nWhich == FN_SET_SUB_SCRIPT && nTmpEsc < 0) ||
123*cdf0e10cSrcweir 							(nWhich == FN_SET_SUPER_SCRIPT && nTmpEsc > 0) )
124*cdf0e10cSrcweir 					eEscape = SVX_ESCAPEMENT_OFF;
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir 				SfxBindings& rBind = GetView().GetViewFrame()->GetBindings();
127*cdf0e10cSrcweir 				if( nWhich == FN_SET_SUB_SCRIPT )
128*cdf0e10cSrcweir 					rBind.SetState( SfxBoolItem( FN_SET_SUPER_SCRIPT,
129*cdf0e10cSrcweir 																	sal_False ) );
130*cdf0e10cSrcweir 				else
131*cdf0e10cSrcweir 					rBind.SetState( SfxBoolItem( FN_SET_SUB_SCRIPT,
132*cdf0e10cSrcweir 																	sal_False ) );
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir 			}
135*cdf0e10cSrcweir 			break;
136*cdf0e10cSrcweir 			case STATE_ON:
137*cdf0e10cSrcweir 				eEscape = nWhich == FN_SET_SUPER_SCRIPT ?
138*cdf0e10cSrcweir 								SVX_ESCAPEMENT_SUPERSCRIPT:
139*cdf0e10cSrcweir 								SVX_ESCAPEMENT_SUBSCRIPT;
140*cdf0e10cSrcweir 				break;
141*cdf0e10cSrcweir 			case STATE_OFF:
142*cdf0e10cSrcweir 				eEscape = SVX_ESCAPEMENT_OFF;
143*cdf0e10cSrcweir 				break;
144*cdf0e10cSrcweir 			}
145*cdf0e10cSrcweir             SvxEscapementItem aEscape( eEscape, RES_CHRATR_ESCAPEMENT );
146*cdf0e10cSrcweir 			if(eEscape == SVX_ESCAPEMENT_SUPERSCRIPT)
147*cdf0e10cSrcweir 				aEscape.GetEsc() = DFLT_ESC_AUTO_SUPER;
148*cdf0e10cSrcweir 			else if(eEscape == SVX_ESCAPEMENT_SUBSCRIPT)
149*cdf0e10cSrcweir 				aEscape.GetEsc() = DFLT_ESC_AUTO_SUB;
150*cdf0e10cSrcweir 			if(eState != STATE_OFF )
151*cdf0e10cSrcweir 			{
152*cdf0e10cSrcweir 				if(eEscape == FN_SET_SUPER_SCRIPT)
153*cdf0e10cSrcweir 					aEscape.GetEsc() *= -1;
154*cdf0e10cSrcweir 			}
155*cdf0e10cSrcweir 			rSh.SetAttr( aEscape );
156*cdf0e10cSrcweir             rReq.AppendItem( aEscape );
157*cdf0e10cSrcweir             rReq.Done();
158*cdf0e10cSrcweir 		}
159*cdf0e10cSrcweir 		break;
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir 		case FN_UPDATE_STYLE_BY_EXAMPLE:
162*cdf0e10cSrcweir 			rSh.QuickUpdateStyle();
163*cdf0e10cSrcweir             rReq.Done();
164*cdf0e10cSrcweir 			break;
165*cdf0e10cSrcweir 		case FN_UNDERLINE_DOUBLE:
166*cdf0e10cSrcweir 		{
167*cdf0e10cSrcweir 			FontUnderline eUnderline =  ((const SvxUnderlineItem&)
168*cdf0e10cSrcweir 							aSet.Get(RES_CHRATR_UNDERLINE)).GetLineStyle();
169*cdf0e10cSrcweir 			switch( eState )
170*cdf0e10cSrcweir 			{
171*cdf0e10cSrcweir 				case STATE_TOGGLE:
172*cdf0e10cSrcweir 					eUnderline = eUnderline == UNDERLINE_DOUBLE ?
173*cdf0e10cSrcweir 						UNDERLINE_NONE :
174*cdf0e10cSrcweir 							UNDERLINE_DOUBLE;
175*cdf0e10cSrcweir 				break;
176*cdf0e10cSrcweir 				case STATE_ON:
177*cdf0e10cSrcweir 					eUnderline = UNDERLINE_DOUBLE;
178*cdf0e10cSrcweir 				break;
179*cdf0e10cSrcweir 				case STATE_OFF:
180*cdf0e10cSrcweir 					eUnderline = UNDERLINE_NONE;
181*cdf0e10cSrcweir 				break;
182*cdf0e10cSrcweir 			}
183*cdf0e10cSrcweir             SvxUnderlineItem aUnderline(eUnderline, RES_CHRATR_UNDERLINE );
184*cdf0e10cSrcweir             rSh.SetAttr( aUnderline );
185*cdf0e10cSrcweir             rReq.AppendItem( aUnderline );
186*cdf0e10cSrcweir             rReq.Done();
187*cdf0e10cSrcweir 		}
188*cdf0e10cSrcweir 		break;
189*cdf0e10cSrcweir         case FN_REMOVE_DIRECT_CHAR_FORMATS:
190*cdf0e10cSrcweir             if( !rSh.HasReadonlySel() && rSh.IsEndPara())
191*cdf0e10cSrcweir                 rSh.DontExpandFmt();
192*cdf0e10cSrcweir         break;
193*cdf0e10cSrcweir 		default:
194*cdf0e10cSrcweir 			ASSERT(sal_False, falscher Dispatcher);
195*cdf0e10cSrcweir 			return;
196*cdf0e10cSrcweir 	}
197*cdf0e10cSrcweir }
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq)
201*cdf0e10cSrcweir {
202*cdf0e10cSrcweir     sal_uInt16 nSlot = rReq.GetSlot();
203*cdf0e10cSrcweir 	const SfxItemSet* pArgs = rReq.GetArgs();
204*cdf0e10cSrcweir 	sal_Bool bArgs = pArgs != 0 && pArgs->Count() > 0;
205*cdf0e10cSrcweir 	int bGrow = sal_False;
206*cdf0e10cSrcweir 	SwWrtShell& rWrtSh = GetShell();
207*cdf0e10cSrcweir 	SwTxtFmtColl* pColl = 0;
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir 	// nur gesetzt, wenn gesamter Absatz selektiert ist und AutoUpdateFmt gesetzt ist
210*cdf0e10cSrcweir 	if( rWrtSh.HasSelection() && rWrtSh.IsSelFullPara() )
211*cdf0e10cSrcweir 	{
212*cdf0e10cSrcweir 		pColl = rWrtSh.GetCurTxtFmtColl();
213*cdf0e10cSrcweir 		if(pColl && !pColl->IsAutoUpdateFmt())
214*cdf0e10cSrcweir 			pColl = 0;
215*cdf0e10cSrcweir 	}
216*cdf0e10cSrcweir 	SfxItemPool& rPool = GetPool();
217*cdf0e10cSrcweir 	sal_uInt16 nWhich = rPool.GetWhich(nSlot);
218*cdf0e10cSrcweir 	switch ( nSlot )
219*cdf0e10cSrcweir 	{
220*cdf0e10cSrcweir 		case FN_TXTATR_INET:
221*cdf0e10cSrcweir 		// Sonderbehandlung der PoolId des SwFmtInetFmt
222*cdf0e10cSrcweir 		if(bArgs)
223*cdf0e10cSrcweir 		{
224*cdf0e10cSrcweir 			const SfxPoolItem& rItem = pArgs->Get(nWhich );
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir 			SwFmtINetFmt aINetFmt((const SwFmtINetFmt&)rItem);
227*cdf0e10cSrcweir 			if( USHRT_MAX == aINetFmt.GetVisitedFmtId() )
228*cdf0e10cSrcweir 			{
229*cdf0e10cSrcweir 				aINetFmt.SetVisitedFmtId(
230*cdf0e10cSrcweir 						SwStyleNameMapper::GetPoolIdFromUIName( aINetFmt.GetVisitedFmt(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT));
231*cdf0e10cSrcweir 			}
232*cdf0e10cSrcweir 			if( USHRT_MAX == aINetFmt.GetINetFmtId() )
233*cdf0e10cSrcweir 			{
234*cdf0e10cSrcweir 				aINetFmt.SetINetFmtId(
235*cdf0e10cSrcweir 						SwStyleNameMapper::GetPoolIdFromUIName( aINetFmt.GetINetFmt(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT));
236*cdf0e10cSrcweir 			}
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir 			if ( pColl )
239*cdf0e10cSrcweir                 pColl->SetFmtAttr( aINetFmt );
240*cdf0e10cSrcweir 			else rWrtSh.SetAttr( aINetFmt );
241*cdf0e10cSrcweir             rReq.Done();
242*cdf0e10cSrcweir 		}
243*cdf0e10cSrcweir 		break;
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir 		case FN_GROW_FONT_SIZE:
246*cdf0e10cSrcweir 			bGrow = sal_True;
247*cdf0e10cSrcweir 			// kein break !!
248*cdf0e10cSrcweir 		case FN_SHRINK_FONT_SIZE:
249*cdf0e10cSrcweir 		{
250*cdf0e10cSrcweir 			SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT, rPool );
251*cdf0e10cSrcweir             rWrtSh.GetCurAttr( aSetItem.GetItemSet() );
252*cdf0e10cSrcweir 			SfxItemSet aAttrSet( rPool, aSetItem.GetItemSet().GetRanges() );
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir 			const SfxPoolItem* pI;
255*cdf0e10cSrcweir 			static const sal_uInt16 aScrTypes[] = {
256*cdf0e10cSrcweir 				SCRIPTTYPE_LATIN, SCRIPTTYPE_ASIAN, SCRIPTTYPE_COMPLEX, 0 };
257*cdf0e10cSrcweir 			sal_uInt16 nScriptType = rWrtSh.GetScriptType();
258*cdf0e10cSrcweir 			for( const sal_uInt16* pScrpTyp = aScrTypes; *pScrpTyp; ++pScrpTyp )
259*cdf0e10cSrcweir 				if( ( nScriptType & *pScrpTyp ) &&
260*cdf0e10cSrcweir 					0 != ( pI = aSetItem.GetItemOfScript( *pScrpTyp )))
261*cdf0e10cSrcweir 				{
262*cdf0e10cSrcweir 					SvxFontHeightItem aSize( *(const SvxFontHeightItem*)pI );
263*cdf0e10cSrcweir 					SwTwips lSize = (SwTwips) aSize.GetHeight();
264*cdf0e10cSrcweir 
265*cdf0e10cSrcweir 					if (bGrow)
266*cdf0e10cSrcweir 					{
267*cdf0e10cSrcweir 						if( lSize == lFontMaxSz )
268*cdf0e10cSrcweir 							break;		// das wars, hoeher gehts nicht
269*cdf0e10cSrcweir 						if( ( lSize += lFontInc ) > lFontMaxSz )
270*cdf0e10cSrcweir 							lSize = lFontMaxSz;
271*cdf0e10cSrcweir 					}
272*cdf0e10cSrcweir 					else
273*cdf0e10cSrcweir 					{
274*cdf0e10cSrcweir 						if( 4 == lSize )
275*cdf0e10cSrcweir 							break;
276*cdf0e10cSrcweir 						if( ( lSize -= lFontInc ) < 4 )
277*cdf0e10cSrcweir 							lSize = 4;
278*cdf0e10cSrcweir 					}
279*cdf0e10cSrcweir 					aSize.SetHeight( lSize );
280*cdf0e10cSrcweir 					aAttrSet.Put( aSize );
281*cdf0e10cSrcweir 				}
282*cdf0e10cSrcweir 				if( aAttrSet.Count() )
283*cdf0e10cSrcweir 				{
284*cdf0e10cSrcweir 					if( pColl )
285*cdf0e10cSrcweir                         pColl->SetFmtAttr( aAttrSet );
286*cdf0e10cSrcweir 					else
287*cdf0e10cSrcweir 						rWrtSh.SetAttr( aAttrSet );
288*cdf0e10cSrcweir 				}
289*cdf0e10cSrcweir             rReq.Done();
290*cdf0e10cSrcweir 		}
291*cdf0e10cSrcweir 		break;
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir 		default:
294*cdf0e10cSrcweir 			ASSERT(sal_False, falscher Dispatcher);
295*cdf0e10cSrcweir 			return;
296*cdf0e10cSrcweir 	}
297*cdf0e10cSrcweir }
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir #ifdef CFRONT
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir void lcl_SetAdjust(SvxAdjust eAdjst, SfxItemSet& rSet)
304*cdf0e10cSrcweir {
305*cdf0e10cSrcweir 	rSet.Put(SvxAdjustItem(eAdjst,RES_PARATR_ADJUST ));
306*cdf0e10cSrcweir }
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir void lcl_SetLineSpace(sal_uInt8 ePropL,SfxItemSet& rSet)
311*cdf0e10cSrcweir {
312*cdf0e10cSrcweir 	SvxLineSpacingItem aLineSpacing(ePropL, RES_PARATR_LINESPACING );
313*cdf0e10cSrcweir 	aLineSpacing.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
314*cdf0e10cSrcweir 	if( 100 == ePropL )
315*cdf0e10cSrcweir 		aLineSpacing.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
316*cdf0e10cSrcweir 	else
317*cdf0e10cSrcweir 		aLineSpacing.SetPropLineSpace(ePropL);
318*cdf0e10cSrcweir 	rSet.Put( aLineSpacing );
319*cdf0e10cSrcweir }
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir void SwTextShell::ExecParaAttr(SfxRequest &rReq)
324*cdf0e10cSrcweir {
325*cdf0e10cSrcweir 	// gleiche beide Attribute holen, ist nicht teuerer !!
326*cdf0e10cSrcweir 	SfxItemSet aSet( GetPool(), RES_PARATR_LINESPACING, RES_PARATR_ADJUST );
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir 	switch (rReq.GetSlot())
329*cdf0e10cSrcweir 	{
330*cdf0e10cSrcweir 	case FN_SET_LEFT_PARA:			lcl_SetAdjust(ADJLEFT,aSet); 	break;
331*cdf0e10cSrcweir 	case FN_SET_RIGHT_PARA:			lcl_SetAdjust(ADJRIGHT,aSet); 	break;
332*cdf0e10cSrcweir 	case FN_SET_CENTER_PARA:        lcl_SetAdjust(ADJCENTER,aSet); 	break;
333*cdf0e10cSrcweir 	case SID_ATTR_PARA_ADJUST_BLOCK:lcl_SetAdjust(ADJBLOCK,aSet); 	break;
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir 	case FN_SET_LINE_SPACE_1:	lcl_SetLineSpace(100,aSet); 	break;
336*cdf0e10cSrcweir 	case FN_SET_LINE_SPACE_15:  lcl_SetLineSpace(150,aSet); 	break;
337*cdf0e10cSrcweir 	case FN_SET_LINE_SPACE_2:	lcl_SetLineSpace(200,aSet); 	break;
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir 	default:
340*cdf0e10cSrcweir 		DBG_ERROR("SwTextShell::ExecParaAttr falscher Dispatcher");
341*cdf0e10cSrcweir 		return;
342*cdf0e10cSrcweir 	}
343*cdf0e10cSrcweir 	SwWrtShell& rWrtSh = GetShell();
344*cdf0e10cSrcweir 	SwTxtFmtColl* pColl = rWrtSh.GetCurTxtFmtColl();
345*cdf0e10cSrcweir 	if(pColl && pColl->IsAutoUpdateFmt())
346*cdf0e10cSrcweir 	{
347*cdf0e10cSrcweir 		rWrtSh.AutoUpdatePara(pColl, *pSet);
348*cdf0e10cSrcweir 	}
349*cdf0e10cSrcweir 	else
350*cdf0e10cSrcweir     {
351*cdf0e10cSrcweir 		rWrtSh.SetAttr( aSet );
352*cdf0e10cSrcweir         rReq.Done( aSet );
353*cdf0e10cSrcweir     }
354*cdf0e10cSrcweir }
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir #else
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir void SwTextShell::ExecParaAttr(SfxRequest &rReq)
361*cdf0e10cSrcweir {
362*cdf0e10cSrcweir 	SvxAdjust eAdjst;
363*cdf0e10cSrcweir 	sal_uInt8 ePropL;
364*cdf0e10cSrcweir 	const SfxItemSet* pArgs = rReq.GetArgs();
365*cdf0e10cSrcweir 
366*cdf0e10cSrcweir 	// gleich beide Attribute holen, ist nicht teuerer !!
367*cdf0e10cSrcweir     SfxItemSet aSet( GetPool(),
368*cdf0e10cSrcweir         RES_PARATR_LINESPACING, RES_PARATR_ADJUST,
369*cdf0e10cSrcweir         RES_FRAMEDIR, RES_FRAMEDIR,
370*cdf0e10cSrcweir         0 );
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir 	sal_uInt16 nSlot = rReq.GetSlot();
373*cdf0e10cSrcweir 	switch (nSlot)
374*cdf0e10cSrcweir 	{
375*cdf0e10cSrcweir 		case SID_ATTR_PARA_ADJUST:
376*cdf0e10cSrcweir 		{
377*cdf0e10cSrcweir 			if( pArgs && SFX_ITEM_SET == pArgs->GetItemState(RES_PARATR_ADJUST) )
378*cdf0e10cSrcweir 			{
379*cdf0e10cSrcweir 				const SvxAdjustItem& rAdj = (const SvxAdjustItem&) pArgs->Get(RES_PARATR_ADJUST);
380*cdf0e10cSrcweir 				SvxAdjustItem aAdj( rAdj.GetAdjust(), RES_PARATR_ADJUST );
381*cdf0e10cSrcweir 				if ( rAdj.GetAdjust() == SVX_ADJUST_BLOCK )
382*cdf0e10cSrcweir 				{
383*cdf0e10cSrcweir 					aAdj.SetLastBlock( rAdj.GetLastBlock() );
384*cdf0e10cSrcweir 					aAdj.SetOneWord( rAdj.GetOneWord() );
385*cdf0e10cSrcweir 				}
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir 				aSet.Put(aAdj);
388*cdf0e10cSrcweir 			}
389*cdf0e10cSrcweir 		}
390*cdf0e10cSrcweir 		break;
391*cdf0e10cSrcweir 		case SID_ATTR_PARA_ADJUST_LEFT:		eAdjst =  SVX_ADJUST_LEFT;		goto SET_ADJUST;
392*cdf0e10cSrcweir 		case SID_ATTR_PARA_ADJUST_RIGHT:	eAdjst =  SVX_ADJUST_RIGHT;		goto SET_ADJUST;
393*cdf0e10cSrcweir 		case SID_ATTR_PARA_ADJUST_CENTER:   eAdjst =  SVX_ADJUST_CENTER;	goto SET_ADJUST;
394*cdf0e10cSrcweir 		case SID_ATTR_PARA_ADJUST_BLOCK:	eAdjst =  SVX_ADJUST_BLOCK;		goto SET_ADJUST;
395*cdf0e10cSrcweir SET_ADJUST:
396*cdf0e10cSrcweir 		{
397*cdf0e10cSrcweir 			aSet.Put(SvxAdjustItem(eAdjst,RES_PARATR_ADJUST));
398*cdf0e10cSrcweir             rReq.AppendItem( SfxBoolItem( GetPool().GetWhich(nSlot), sal_True ) );
399*cdf0e10cSrcweir 		}
400*cdf0e10cSrcweir 		break;
401*cdf0e10cSrcweir 
402*cdf0e10cSrcweir 		case SID_ATTR_PARA_LINESPACE:
403*cdf0e10cSrcweir 			if(pArgs && SFX_ITEM_SET == pArgs->GetItemState( GetPool().GetWhich(nSlot) ))
404*cdf0e10cSrcweir 			{
405*cdf0e10cSrcweir 				SvxLineSpacingItem aLineSpace = (const SvxLineSpacingItem&)pArgs->Get(
406*cdf0e10cSrcweir 															GetPool().GetWhich(nSlot));
407*cdf0e10cSrcweir 				aSet.Put( aLineSpace );
408*cdf0e10cSrcweir 			}
409*cdf0e10cSrcweir 		break;
410*cdf0e10cSrcweir 		case SID_ATTR_PARA_LINESPACE_10:	ePropL = 100;	goto SET_LINESPACE;
411*cdf0e10cSrcweir 		case SID_ATTR_PARA_LINESPACE_15:	ePropL = 150;	goto SET_LINESPACE;
412*cdf0e10cSrcweir 		case SID_ATTR_PARA_LINESPACE_20:	ePropL = 200;	goto SET_LINESPACE;
413*cdf0e10cSrcweir 
414*cdf0e10cSrcweir SET_LINESPACE:
415*cdf0e10cSrcweir 		{
416*cdf0e10cSrcweir 
417*cdf0e10cSrcweir 			SvxLineSpacingItem aLineSpacing(ePropL, RES_PARATR_LINESPACING );
418*cdf0e10cSrcweir 			aLineSpacing.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
419*cdf0e10cSrcweir 			if( 100 == ePropL )
420*cdf0e10cSrcweir 				aLineSpacing.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
421*cdf0e10cSrcweir 			else
422*cdf0e10cSrcweir 				aLineSpacing.SetPropLineSpace(ePropL);
423*cdf0e10cSrcweir 			aSet.Put( aLineSpacing );
424*cdf0e10cSrcweir 		}
425*cdf0e10cSrcweir 		break;
426*cdf0e10cSrcweir 
427*cdf0e10cSrcweir         case SID_ATTR_PARA_LEFT_TO_RIGHT :
428*cdf0e10cSrcweir         case SID_ATTR_PARA_RIGHT_TO_LEFT :
429*cdf0e10cSrcweir         {
430*cdf0e10cSrcweir             sal_Bool bSet = sal_True;
431*cdf0e10cSrcweir             int eState = pArgs ? pArgs->GetItemState(nSlot) : SFX_ITEM_DISABLED;
432*cdf0e10cSrcweir             if (pArgs && SFX_ITEM_SET == eState)
433*cdf0e10cSrcweir                 bSet = ((const SfxBoolItem&)pArgs->Get(nSlot)).GetValue();
434*cdf0e10cSrcweir /*
435*cdf0e10cSrcweir // toggling of the slots not used anymore
436*cdf0e10cSrcweir 
437*cdf0e10cSrcweir            if(!bSet)
438*cdf0e10cSrcweir 				nSlot = SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot ?
439*cdf0e10cSrcweir 					SID_ATTR_PARA_RIGHT_TO_LEFT :
440*cdf0e10cSrcweir 					SID_ATTR_PARA_LEFT_TO_RIGHT;
441*cdf0e10cSrcweir */
442*cdf0e10cSrcweir             SfxItemSet aAdjustSet( GetPool(),
443*cdf0e10cSrcweir                     RES_PARATR_ADJUST, RES_PARATR_ADJUST );
444*cdf0e10cSrcweir             GetShell().GetCurAttr(aAdjustSet);
445*cdf0e10cSrcweir             sal_Bool bChgAdjust = sal_False;
446*cdf0e10cSrcweir             SfxItemState eAdjustState = aAdjustSet.GetItemState(RES_PARATR_ADJUST, sal_False);
447*cdf0e10cSrcweir             if(eAdjustState  >= SFX_ITEM_DEFAULT)
448*cdf0e10cSrcweir             {
449*cdf0e10cSrcweir                 int eAdjust = (int)(( const SvxAdjustItem& )
450*cdf0e10cSrcweir 						aAdjustSet.Get(RES_PARATR_ADJUST)).GetAdjust();
451*cdf0e10cSrcweir //                bChgAdjust = SVX_ADJUST_CENTER  != eAdjust  &&  SVX_ADJUST_BLOCK != eAdjust;
452*cdf0e10cSrcweir                 bChgAdjust = (SVX_ADJUST_LEFT  == eAdjust  &&  SID_ATTR_PARA_RIGHT_TO_LEFT == nSlot) ||
453*cdf0e10cSrcweir                              (SVX_ADJUST_RIGHT == eAdjust  &&  SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot);
454*cdf0e10cSrcweir             }
455*cdf0e10cSrcweir             else
456*cdf0e10cSrcweir                 bChgAdjust = sal_True;
457*cdf0e10cSrcweir 
458*cdf0e10cSrcweir             SvxFrameDirection eFrmDirection =
459*cdf0e10cSrcweir                     (SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot) ?
460*cdf0e10cSrcweir                         FRMDIR_HORI_LEFT_TOP : FRMDIR_HORI_RIGHT_TOP;
461*cdf0e10cSrcweir             aSet.Put( SvxFrameDirectionItem( eFrmDirection, RES_FRAMEDIR ) );
462*cdf0e10cSrcweir 
463*cdf0e10cSrcweir             if (bChgAdjust)
464*cdf0e10cSrcweir             {
465*cdf0e10cSrcweir                 SvxAdjust eAdjust = (SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot) ?
466*cdf0e10cSrcweir                         SVX_ADJUST_LEFT : SVX_ADJUST_RIGHT;
467*cdf0e10cSrcweir                 SvxAdjustItem aAdjust( eAdjust, RES_PARATR_ADJUST );
468*cdf0e10cSrcweir                 aSet.Put( aAdjust );
469*cdf0e10cSrcweir                 aAdjust.SetWhich(SID_ATTR_PARA_ADJUST);
470*cdf0e10cSrcweir                 GetView().GetViewFrame()->GetBindings().SetState( aAdjust );
471*cdf0e10cSrcweir                 // Toggle numbering alignment
472*cdf0e10cSrcweir                 const SwNumRule* pCurRule = GetShell().GetCurNumRule();
473*cdf0e10cSrcweir                 if( pCurRule )
474*cdf0e10cSrcweir                 {
475*cdf0e10cSrcweir                     SvxNumRule aRule = pCurRule->MakeSvxNumRule();
476*cdf0e10cSrcweir 
477*cdf0e10cSrcweir                     for(sal_uInt16 i = 0; i < aRule.GetLevelCount(); i++)
478*cdf0e10cSrcweir                     {
479*cdf0e10cSrcweir                         SvxNumberFormat aFmt(aRule.GetLevel(i));
480*cdf0e10cSrcweir                         if(SVX_ADJUST_LEFT == aFmt.GetNumAdjust())
481*cdf0e10cSrcweir                             aFmt.SetNumAdjust( SVX_ADJUST_RIGHT );
482*cdf0e10cSrcweir 
483*cdf0e10cSrcweir                         else if(SVX_ADJUST_RIGHT == aFmt.GetNumAdjust())
484*cdf0e10cSrcweir                             aFmt.SetNumAdjust( SVX_ADJUST_LEFT );
485*cdf0e10cSrcweir 
486*cdf0e10cSrcweir                         aRule.SetLevel(i, aFmt, aRule.Get(i) != 0);
487*cdf0e10cSrcweir                     }
488*cdf0e10cSrcweir                     // --> OD 2008-02-11 #newlistlevelattrs#
489*cdf0e10cSrcweir                     SwNumRule aSetRule( pCurRule->GetName(),
490*cdf0e10cSrcweir                                         pCurRule->Get( 0 ).GetPositionAndSpaceMode() );
491*cdf0e10cSrcweir                     // <--
492*cdf0e10cSrcweir                     aSetRule.SetSvxRule( aRule, GetShell().GetDoc());
493*cdf0e10cSrcweir                     aSetRule.SetAutoRule( sal_True );
494*cdf0e10cSrcweir                     // --> OD 2008-03-17 #refactorlists#
495*cdf0e10cSrcweir                     // no start or continuation of a list - list style is only changed
496*cdf0e10cSrcweir                     GetShell().SetCurNumRule( aSetRule, false );
497*cdf0e10cSrcweir                     // <--
498*cdf0e10cSrcweir                 }
499*cdf0e10cSrcweir             }
500*cdf0e10cSrcweir         }
501*cdf0e10cSrcweir         break;
502*cdf0e10cSrcweir 
503*cdf0e10cSrcweir 		default:
504*cdf0e10cSrcweir 			ASSERT(sal_False, falscher Dispatcher);
505*cdf0e10cSrcweir 			return;
506*cdf0e10cSrcweir 	}
507*cdf0e10cSrcweir 	SwWrtShell& rWrtSh = GetShell();
508*cdf0e10cSrcweir 	SwTxtFmtColl* pColl = rWrtSh.GetCurTxtFmtColl();
509*cdf0e10cSrcweir 	if(pColl && pColl->IsAutoUpdateFmt())
510*cdf0e10cSrcweir 	{
511*cdf0e10cSrcweir 		rWrtSh.AutoUpdatePara(pColl, aSet);
512*cdf0e10cSrcweir 	}
513*cdf0e10cSrcweir 	else
514*cdf0e10cSrcweir 		rWrtSh.SetAttr( aSet );
515*cdf0e10cSrcweir     rReq.Done();
516*cdf0e10cSrcweir }
517*cdf0e10cSrcweir 
518*cdf0e10cSrcweir #endif
519*cdf0e10cSrcweir 
520*cdf0e10cSrcweir 
521*cdf0e10cSrcweir 
522*cdf0e10cSrcweir void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq)
523*cdf0e10cSrcweir {
524*cdf0e10cSrcweir 	SwWrtShell &rSh = GetShell();
525*cdf0e10cSrcweir 	const SfxItemSet *pArgs = rReq.GetArgs();
526*cdf0e10cSrcweir 	const SfxPoolItem *pItem = 0;
527*cdf0e10cSrcweir 
528*cdf0e10cSrcweir 	sal_uInt16 nSlot = rReq.GetSlot();
529*cdf0e10cSrcweir 	if(pArgs)
530*cdf0e10cSrcweir 		pArgs->GetItemState(GetPool().GetWhich(nSlot), sal_False, &pItem);
531*cdf0e10cSrcweir 	switch ( nSlot )
532*cdf0e10cSrcweir 	{
533*cdf0e10cSrcweir         case FN_DROP_CHAR_STYLE_NAME:
534*cdf0e10cSrcweir             if( pItem )
535*cdf0e10cSrcweir             {
536*cdf0e10cSrcweir                 String sCharStyleName = ((const SfxStringItem*)pItem)->GetValue();
537*cdf0e10cSrcweir                 SfxItemSet aSet(GetPool(), RES_PARATR_DROP, RES_PARATR_DROP, 0L);
538*cdf0e10cSrcweir                 rSh.GetCurAttr(aSet);
539*cdf0e10cSrcweir                 SwFmtDrop aDropItem((const SwFmtDrop&)aSet.Get(RES_PARATR_DROP));
540*cdf0e10cSrcweir                 SwCharFmt* pFmt = 0;
541*cdf0e10cSrcweir                 if(sCharStyleName.Len())
542*cdf0e10cSrcweir                     pFmt = rSh.FindCharFmtByName( sCharStyleName );
543*cdf0e10cSrcweir                 aDropItem.SetCharFmt( pFmt );
544*cdf0e10cSrcweir                 aSet.Put(aDropItem);
545*cdf0e10cSrcweir                 rSh.SetAttr(aSet);
546*cdf0e10cSrcweir             }
547*cdf0e10cSrcweir         break;
548*cdf0e10cSrcweir         case FN_FORMAT_DROPCAPS:
549*cdf0e10cSrcweir         {
550*cdf0e10cSrcweir 			if(pItem)
551*cdf0e10cSrcweir             {
552*cdf0e10cSrcweir 				rSh.SetAttr(*pItem);
553*cdf0e10cSrcweir                 rReq.Done();
554*cdf0e10cSrcweir             }
555*cdf0e10cSrcweir 			else
556*cdf0e10cSrcweir 			{
557*cdf0e10cSrcweir 				SfxItemSet aSet(GetPool(), RES_PARATR_DROP, RES_PARATR_DROP,
558*cdf0e10cSrcweir 										   HINT_END, HINT_END, 0);
559*cdf0e10cSrcweir                 rSh.GetCurAttr(aSet);
560*cdf0e10cSrcweir                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
561*cdf0e10cSrcweir                 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
562*cdf0e10cSrcweir 
563*cdf0e10cSrcweir                 SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(), aSet,
564*cdf0e10cSrcweir 					rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), DLG_SWDROPCAPS );
565*cdf0e10cSrcweir                 DBG_ASSERT(pDlg, "Dialogdiet fail!");
566*cdf0e10cSrcweir 				if (pDlg->Execute() == RET_OK)
567*cdf0e10cSrcweir 				{
568*cdf0e10cSrcweir 					rSh.StartAction();
569*cdf0e10cSrcweir 					rSh.StartUndo( UNDO_START );
570*cdf0e10cSrcweir 					if ( SFX_ITEM_SET == aSet.GetItemState(HINT_END,sal_False,&pItem) )
571*cdf0e10cSrcweir 					{
572*cdf0e10cSrcweir 						if ( ((SfxStringItem*)pItem)->GetValue().Len() )
573*cdf0e10cSrcweir 							rSh.ReplaceDropTxt(((SfxStringItem*)pItem)->GetValue());
574*cdf0e10cSrcweir 					}
575*cdf0e10cSrcweir 					rSh.SetAttr(*pDlg->GetOutputItemSet());
576*cdf0e10cSrcweir 					rSh.StartUndo( UNDO_END );
577*cdf0e10cSrcweir 					rSh.EndAction();
578*cdf0e10cSrcweir                     rReq.Done(*pDlg->GetOutputItemSet());
579*cdf0e10cSrcweir 				}
580*cdf0e10cSrcweir 				delete pDlg;
581*cdf0e10cSrcweir 			}
582*cdf0e10cSrcweir 		}
583*cdf0e10cSrcweir  		break;
584*cdf0e10cSrcweir 		case SID_ATTR_PARA_PAGEBREAK:
585*cdf0e10cSrcweir 			if(pItem)
586*cdf0e10cSrcweir 			{
587*cdf0e10cSrcweir 				rSh.SetAttr( *pItem );
588*cdf0e10cSrcweir                 rReq.Done();
589*cdf0e10cSrcweir 			}
590*cdf0e10cSrcweir 		break;
591*cdf0e10cSrcweir 		case SID_ATTR_PARA_MODEL:
592*cdf0e10cSrcweir 		{
593*cdf0e10cSrcweir 			if(pItem)
594*cdf0e10cSrcweir 			{
595*cdf0e10cSrcweir 				SfxItemSet aCoreSet( GetPool(),
596*cdf0e10cSrcweir 					RES_PAGEDESC,	RES_PAGEDESC,
597*cdf0e10cSrcweir 					SID_ATTR_PARA_MODEL, SID_ATTR_PARA_MODEL, 0);
598*cdf0e10cSrcweir 				aCoreSet.Put(*pItem);
599*cdf0e10cSrcweir 				SfxToSwPageDescAttr( rSh, aCoreSet);
600*cdf0e10cSrcweir 				rSh.SetAttr(aCoreSet);
601*cdf0e10cSrcweir                 rReq.Done();
602*cdf0e10cSrcweir 			}
603*cdf0e10cSrcweir 		}
604*cdf0e10cSrcweir 		break;
605*cdf0e10cSrcweir 
606*cdf0e10cSrcweir         default:
607*cdf0e10cSrcweir 			ASSERT(sal_False, falscher Dispatcher);
608*cdf0e10cSrcweir 			return;
609*cdf0e10cSrcweir 	}
610*cdf0e10cSrcweir }
611*cdf0e10cSrcweir 
612*cdf0e10cSrcweir 
613*cdf0e10cSrcweir 
614*cdf0e10cSrcweir void SwTextShell::GetAttrState(SfxItemSet &rSet)
615*cdf0e10cSrcweir {
616*cdf0e10cSrcweir 	SwWrtShell &rSh = GetShell();
617*cdf0e10cSrcweir 	SfxItemPool& rPool = GetPool();
618*cdf0e10cSrcweir 	SfxItemSet aCoreSet(rPool, aTxtFmtCollSetRange);
619*cdf0e10cSrcweir     rSh.GetCurAttr(aCoreSet); // *alle* Textattribute von der Core erfragen
620*cdf0e10cSrcweir 
621*cdf0e10cSrcweir 	SfxWhichIter aIter(rSet);
622*cdf0e10cSrcweir 	sal_uInt16 nSlot = aIter.FirstWhich();
623*cdf0e10cSrcweir     sal_Bool bFlag = sal_False;
624*cdf0e10cSrcweir 	SfxBoolItem aFlagItem;
625*cdf0e10cSrcweir 	const SfxPoolItem* pItem = 0;
626*cdf0e10cSrcweir 	int eAdjust = -1;	// Illegaler Wert, um DONTCARE zu erkennen
627*cdf0e10cSrcweir 	SfxItemState eState = aCoreSet.GetItemState(RES_PARATR_ADJUST, sal_False, &pItem);
628*cdf0e10cSrcweir 
629*cdf0e10cSrcweir 	if( SFX_ITEM_DEFAULT == eState )
630*cdf0e10cSrcweir 		pItem = &rPool.GetDefaultItem(RES_PARATR_ADJUST);
631*cdf0e10cSrcweir 	if( SFX_ITEM_DEFAULT <= eState )
632*cdf0e10cSrcweir 		eAdjust = (int)(( SvxAdjustItem* ) pItem)->GetAdjust();
633*cdf0e10cSrcweir 
634*cdf0e10cSrcweir 	short nEsc = 0;
635*cdf0e10cSrcweir 	eState =  aCoreSet.GetItemState(RES_CHRATR_ESCAPEMENT, sal_False, &pItem);
636*cdf0e10cSrcweir 	if( SFX_ITEM_DEFAULT == eState )
637*cdf0e10cSrcweir 		pItem = &rPool.GetDefaultItem(RES_CHRATR_ESCAPEMENT);
638*cdf0e10cSrcweir 	if( eState >= SFX_ITEM_DEFAULT )
639*cdf0e10cSrcweir 		nEsc = ((SvxEscapementItem* )pItem)->GetEsc();
640*cdf0e10cSrcweir 
641*cdf0e10cSrcweir 	sal_uInt16 nLineSpace = 0;
642*cdf0e10cSrcweir 	eState =  aCoreSet.GetItemState(RES_PARATR_LINESPACING, sal_False, &pItem);
643*cdf0e10cSrcweir 	if( SFX_ITEM_DEFAULT == eState )
644*cdf0e10cSrcweir 		pItem = &rPool.GetDefaultItem(RES_PARATR_LINESPACING);
645*cdf0e10cSrcweir 	if( SFX_ITEM_DEFAULT <= eState &&
646*cdf0e10cSrcweir 			((SvxLineSpacingItem* )pItem)->GetLineSpaceRule() == SVX_LINE_SPACE_AUTO )
647*cdf0e10cSrcweir 	{
648*cdf0e10cSrcweir 		if(SVX_INTER_LINE_SPACE_OFF ==
649*cdf0e10cSrcweir 					((SvxLineSpacingItem* )pItem)->GetInterLineSpaceRule())
650*cdf0e10cSrcweir 			nLineSpace = 100;
651*cdf0e10cSrcweir 		else
652*cdf0e10cSrcweir 			nLineSpace = ((SvxLineSpacingItem* )pItem)->GetPropLineSpace();
653*cdf0e10cSrcweir 	}
654*cdf0e10cSrcweir 
655*cdf0e10cSrcweir 	while (nSlot)
656*cdf0e10cSrcweir 	{
657*cdf0e10cSrcweir 		switch(nSlot)
658*cdf0e10cSrcweir 		{
659*cdf0e10cSrcweir 			case FN_SET_SUPER_SCRIPT:
660*cdf0e10cSrcweir 					bFlag = 0 < nEsc;
661*cdf0e10cSrcweir 				break;
662*cdf0e10cSrcweir 			case FN_SET_SUB_SCRIPT:
663*cdf0e10cSrcweir 					bFlag = 0 > nEsc;
664*cdf0e10cSrcweir 				break;
665*cdf0e10cSrcweir 			case SID_ATTR_PARA_ADJUST_LEFT:
666*cdf0e10cSrcweir 				if (eAdjust == -1)
667*cdf0e10cSrcweir 				{
668*cdf0e10cSrcweir 					rSet.InvalidateItem( nSlot );
669*cdf0e10cSrcweir 					nSlot = 0;
670*cdf0e10cSrcweir 				}
671*cdf0e10cSrcweir 				else
672*cdf0e10cSrcweir 					bFlag = SVX_ADJUST_LEFT == eAdjust;
673*cdf0e10cSrcweir 				break;
674*cdf0e10cSrcweir 			case SID_ATTR_PARA_ADJUST_RIGHT:
675*cdf0e10cSrcweir 				if (eAdjust == -1)
676*cdf0e10cSrcweir 				{
677*cdf0e10cSrcweir 					rSet.InvalidateItem( nSlot );
678*cdf0e10cSrcweir 					nSlot = 0;
679*cdf0e10cSrcweir 				}
680*cdf0e10cSrcweir 				else
681*cdf0e10cSrcweir 					bFlag = SVX_ADJUST_RIGHT == eAdjust;
682*cdf0e10cSrcweir 				break;
683*cdf0e10cSrcweir 			case SID_ATTR_PARA_ADJUST_CENTER:
684*cdf0e10cSrcweir 				if (eAdjust == -1)
685*cdf0e10cSrcweir 				{
686*cdf0e10cSrcweir 					rSet.InvalidateItem( nSlot );
687*cdf0e10cSrcweir 					nSlot = 0;
688*cdf0e10cSrcweir 				}
689*cdf0e10cSrcweir 				else
690*cdf0e10cSrcweir 					bFlag = SVX_ADJUST_CENTER == eAdjust;
691*cdf0e10cSrcweir 				break;
692*cdf0e10cSrcweir 			case SID_ATTR_PARA_ADJUST_BLOCK:
693*cdf0e10cSrcweir 			{
694*cdf0e10cSrcweir 				if (eAdjust == -1)
695*cdf0e10cSrcweir 				{
696*cdf0e10cSrcweir 					rSet.InvalidateItem( nSlot );
697*cdf0e10cSrcweir 					nSlot = 0;
698*cdf0e10cSrcweir 				}
699*cdf0e10cSrcweir 				else
700*cdf0e10cSrcweir 				{
701*cdf0e10cSrcweir 					bFlag = SVX_ADJUST_BLOCK == eAdjust;
702*cdf0e10cSrcweir 					sal_uInt16 nHtmlMode = GetHtmlMode(rSh.GetView().GetDocShell());
703*cdf0e10cSrcweir 					if((nHtmlMode & HTMLMODE_ON) && !(nHtmlMode & (HTMLMODE_FULL_STYLES|HTMLMODE_FIRSTLINE) ))
704*cdf0e10cSrcweir 					{
705*cdf0e10cSrcweir 						rSet.DisableItem( nSlot );
706*cdf0e10cSrcweir 						nSlot = 0;
707*cdf0e10cSrcweir 					}
708*cdf0e10cSrcweir 				}
709*cdf0e10cSrcweir 			}
710*cdf0e10cSrcweir 			break;
711*cdf0e10cSrcweir 			case SID_ATTR_PARA_LINESPACE_10:
712*cdf0e10cSrcweir 				bFlag = nLineSpace == 100;
713*cdf0e10cSrcweir 			break;
714*cdf0e10cSrcweir 			case SID_ATTR_PARA_LINESPACE_15:
715*cdf0e10cSrcweir 				bFlag = nLineSpace == 150;
716*cdf0e10cSrcweir 			break;
717*cdf0e10cSrcweir 			case SID_ATTR_PARA_LINESPACE_20:
718*cdf0e10cSrcweir 				bFlag = nLineSpace == 200;
719*cdf0e10cSrcweir 			break;
720*cdf0e10cSrcweir 			case FN_GROW_FONT_SIZE:
721*cdf0e10cSrcweir 			case FN_SHRINK_FONT_SIZE:
722*cdf0e10cSrcweir 			{
723*cdf0e10cSrcweir 				SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT,
724*cdf0e10cSrcweir 											*rSet.GetPool() );
725*cdf0e10cSrcweir 				aSetItem.GetItemSet().Put( aCoreSet, sal_False );
726*cdf0e10cSrcweir 				if( !aSetItem.GetItemOfScript( rSh.GetScriptType() ))
727*cdf0e10cSrcweir 					rSet.DisableItem( nSlot );
728*cdf0e10cSrcweir 				nSlot = 0;
729*cdf0e10cSrcweir 			}
730*cdf0e10cSrcweir 			break;
731*cdf0e10cSrcweir 			case FN_UNDERLINE_DOUBLE:
732*cdf0e10cSrcweir 			{
733*cdf0e10cSrcweir 				eState = aCoreSet.GetItemState(RES_CHRATR_UNDERLINE);
734*cdf0e10cSrcweir 				if( eState >= SFX_ITEM_DEFAULT )
735*cdf0e10cSrcweir 				{
736*cdf0e10cSrcweir 					FontUnderline eUnderline =  ((const SvxUnderlineItem&)
737*cdf0e10cSrcweir 							aCoreSet.Get(RES_CHRATR_UNDERLINE)).GetLineStyle();
738*cdf0e10cSrcweir 					rSet.Put(SfxBoolItem(nSlot, eUnderline == UNDERLINE_DOUBLE));
739*cdf0e10cSrcweir 				}
740*cdf0e10cSrcweir 				else
741*cdf0e10cSrcweir 					rSet.InvalidateItem(nSlot);
742*cdf0e10cSrcweir 				nSlot = 0;
743*cdf0e10cSrcweir 			}
744*cdf0e10cSrcweir 			break;
745*cdf0e10cSrcweir 			case SID_ATTR_PARA_ADJUST:
746*cdf0e10cSrcweir 				if (eAdjust == -1)
747*cdf0e10cSrcweir 					rSet.InvalidateItem( nSlot );
748*cdf0e10cSrcweir 				else
749*cdf0e10cSrcweir 					rSet.Put(SvxAdjustItem((SvxAdjust)eAdjust, SID_ATTR_PARA_ADJUST ));
750*cdf0e10cSrcweir 				nSlot = 0;
751*cdf0e10cSrcweir 			break;
752*cdf0e10cSrcweir 
753*cdf0e10cSrcweir             case SID_ATTR_PARA_LEFT_TO_RIGHT :
754*cdf0e10cSrcweir             case SID_ATTR_PARA_RIGHT_TO_LEFT :
755*cdf0e10cSrcweir             {
756*cdf0e10cSrcweir                 if ( !SW_MOD()->GetCTLOptions().IsCTLFontEnabled() )
757*cdf0e10cSrcweir 				{
758*cdf0e10cSrcweir 					rSet.DisableItem( nSlot );
759*cdf0e10cSrcweir 					nSlot = 0;
760*cdf0e10cSrcweir 				}
761*cdf0e10cSrcweir 				else
762*cdf0e10cSrcweir 				{
763*cdf0e10cSrcweir                     // is the item set?
764*cdf0e10cSrcweir                     sal_uInt16 nHtmlMode = GetHtmlMode(rSh.GetView().GetDocShell());
765*cdf0e10cSrcweir                     if((!(nHtmlMode & HTMLMODE_ON) || (0 != (nHtmlMode & HTMLMODE_SOME_STYLES))) &&
766*cdf0e10cSrcweir                     aCoreSet.GetItemState( RES_FRAMEDIR, sal_False ) >= SFX_ITEM_DEFAULT)
767*cdf0e10cSrcweir 					{
768*cdf0e10cSrcweir 						SvxFrameDirection eFrmDir = (SvxFrameDirection)
769*cdf0e10cSrcweir 								((const SvxFrameDirectionItem& )aCoreSet.Get(RES_FRAMEDIR)).GetValue();
770*cdf0e10cSrcweir 						if (FRMDIR_ENVIRONMENT == eFrmDir)
771*cdf0e10cSrcweir 						{
772*cdf0e10cSrcweir 							eFrmDir = rSh.IsInRightToLeftText() ?
773*cdf0e10cSrcweir 									FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP;
774*cdf0e10cSrcweir 						}
775*cdf0e10cSrcweir 						bFlag = (SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot &&
776*cdf0e10cSrcweir 											FRMDIR_HORI_LEFT_TOP == eFrmDir) ||
777*cdf0e10cSrcweir 								(SID_ATTR_PARA_RIGHT_TO_LEFT == nSlot &&
778*cdf0e10cSrcweir 											FRMDIR_HORI_RIGHT_TOP == eFrmDir);
779*cdf0e10cSrcweir 					}
780*cdf0e10cSrcweir 					else
781*cdf0e10cSrcweir 					{
782*cdf0e10cSrcweir 						rSet.InvalidateItem(nSlot);
783*cdf0e10cSrcweir 						nSlot = 0;
784*cdf0e10cSrcweir 					}
785*cdf0e10cSrcweir 				}
786*cdf0e10cSrcweir             }
787*cdf0e10cSrcweir             break;
788*cdf0e10cSrcweir 
789*cdf0e10cSrcweir 			case SID_ATTR_CHAR_LANGUAGE:
790*cdf0e10cSrcweir 			case SID_ATTR_CHAR_KERNING:
791*cdf0e10cSrcweir 			case RES_PARATR_DROP:
792*cdf0e10cSrcweir 			{
793*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
794*cdf0e10cSrcweir 				const SfxPoolItem& rItem = aCoreSet.Get(GetPool().GetWhich(nSlot), sal_True);
795*cdf0e10cSrcweir 				rSet.Put(rItem);
796*cdf0e10cSrcweir #else
797*cdf0e10cSrcweir 				rSet.Put(aCoreSet.Get( GetPool().GetWhich(nSlot), sal_True));
798*cdf0e10cSrcweir #endif
799*cdf0e10cSrcweir 				nSlot = 0;
800*cdf0e10cSrcweir 			}
801*cdf0e10cSrcweir 			break;
802*cdf0e10cSrcweir 			case SID_ATTR_PARA_MODEL:
803*cdf0e10cSrcweir 			{
804*cdf0e10cSrcweir 				SfxItemSet aTemp(GetPool(),
805*cdf0e10cSrcweir 						RES_PAGEDESC,RES_PAGEDESC,
806*cdf0e10cSrcweir 						SID_ATTR_PARA_MODEL,SID_ATTR_PARA_MODEL,
807*cdf0e10cSrcweir 						0L);
808*cdf0e10cSrcweir 				aTemp.Put(aCoreSet);
809*cdf0e10cSrcweir 				::SwToSfxPageDescAttr(aTemp);
810*cdf0e10cSrcweir 				rSet.Put(aTemp.Get(SID_ATTR_PARA_MODEL));
811*cdf0e10cSrcweir 				nSlot = 0;
812*cdf0e10cSrcweir 			}
813*cdf0e10cSrcweir 			break;
814*cdf0e10cSrcweir 			case RES_TXTATR_INETFMT:
815*cdf0e10cSrcweir 			{
816*cdf0e10cSrcweir 				SfxItemSet aSet(GetPool(), RES_TXTATR_INETFMT, RES_TXTATR_INETFMT);
817*cdf0e10cSrcweir                 rSh.GetCurAttr(aSet);
818*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
819*cdf0e10cSrcweir 				const SfxPoolItem& rItem = aSet.Get(RES_TXTATR_INETFMT, sal_True);
820*cdf0e10cSrcweir 				rSet.Put(rItem);
821*cdf0e10cSrcweir #else
822*cdf0e10cSrcweir 				rSet.Put(aSet.Get( RES_TXTATR_INETFMT, sal_True));
823*cdf0e10cSrcweir #endif
824*cdf0e10cSrcweir 				nSlot = 0;
825*cdf0e10cSrcweir 			}
826*cdf0e10cSrcweir 			break;
827*cdf0e10cSrcweir 
828*cdf0e10cSrcweir 			default:
829*cdf0e10cSrcweir 			// Nichts tun
830*cdf0e10cSrcweir 			nSlot = 0;
831*cdf0e10cSrcweir 			break;
832*cdf0e10cSrcweir 
833*cdf0e10cSrcweir 		}
834*cdf0e10cSrcweir 		if( nSlot )
835*cdf0e10cSrcweir 		{
836*cdf0e10cSrcweir 			aFlagItem.SetWhich( nSlot );
837*cdf0e10cSrcweir 			aFlagItem.SetValue( bFlag );
838*cdf0e10cSrcweir 			rSet.Put( aFlagItem );
839*cdf0e10cSrcweir 		}
840*cdf0e10cSrcweir 		nSlot = aIter.NextWhich();
841*cdf0e10cSrcweir 	}
842*cdf0e10cSrcweir 
843*cdf0e10cSrcweir 	rSet.Put(aCoreSet,sal_False);
844*cdf0e10cSrcweir }
845*cdf0e10cSrcweir 
846*cdf0e10cSrcweir 
847*cdf0e10cSrcweir 
848