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