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