xref: /AOO41X/main/sw/source/ui/shells/drwtxtex.cxx (revision 766ce4d0f35a6d5b4b7c65174e638ff2dfbd4ec1)
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
10cdf0e10cSrcweir  *
11efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
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.
19cdf0e10cSrcweir  *
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 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
30cdf0e10cSrcweir #include <i18npool/mslangid.hxx>
31cdf0e10cSrcweir #include <sfx2/bindings.hxx>
32cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
33cdf0e10cSrcweir #include <sfx2/request.hxx>
34cdf0e10cSrcweir #include <tools/shl.hxx>
35cdf0e10cSrcweir #include <svx/svdview.hxx>
36cdf0e10cSrcweir #include <editeng/spltitem.hxx>
37*766ce4d0SZheng Fan #include <editeng/lrspitem.hxx>
38*766ce4d0SZheng Fan #include <editeng/ulspitem.hxx>
39cdf0e10cSrcweir #include <editeng/orphitem.hxx>
40cdf0e10cSrcweir #include <editeng/brkitem.hxx>
41cdf0e10cSrcweir #include <editeng/widwitem.hxx>
42cdf0e10cSrcweir #include <editeng/kernitem.hxx>
43cdf0e10cSrcweir #include <editeng/escpitem.hxx>
44cdf0e10cSrcweir #include <editeng/lspcitem.hxx>
45cdf0e10cSrcweir #include <editeng/adjitem.hxx>
46cdf0e10cSrcweir #include <editeng/crsditem.hxx>
47cdf0e10cSrcweir #include <editeng/shdditem.hxx>
48cdf0e10cSrcweir #include <editeng/hyznitem.hxx>
49cdf0e10cSrcweir #include <editeng/udlnitem.hxx>
50cdf0e10cSrcweir #include <editeng/fontitem.hxx>
51cdf0e10cSrcweir #include <editeng/fhgtitem.hxx>
52cdf0e10cSrcweir #include <editeng/colritem.hxx>
53cdf0e10cSrcweir #include <editeng/wghtitem.hxx>
54cdf0e10cSrcweir #include <editeng/cntritem.hxx>
55cdf0e10cSrcweir #include <editeng/postitem.hxx>
56cdf0e10cSrcweir #include <editeng/frmdiritem.hxx>
57cdf0e10cSrcweir #include <svx/svdoutl.hxx>
58cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
59cdf0e10cSrcweir #include <svl/whiter.hxx>
60cdf0e10cSrcweir #include <svl/cjkoptions.hxx>
61cdf0e10cSrcweir #include <svl/ctloptions.hxx>
62cdf0e10cSrcweir #include <svtools/langtab.hxx>
63cdf0e10cSrcweir #include <svl/languageoptions.hxx>
64cdf0e10cSrcweir #include <sfx2/bindings.hxx>
65cdf0e10cSrcweir #include <vcl/msgbox.hxx>
66cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
67cdf0e10cSrcweir #include <sfx2/request.hxx>
68cdf0e10cSrcweir #include <editeng/flditem.hxx>
69cdf0e10cSrcweir #include <editeng/editstat.hxx>
70cdf0e10cSrcweir #include <svx/hlnkitem.hxx>
71cdf0e10cSrcweir #include <svx/htmlmode.hxx>
72cdf0e10cSrcweir #include <svl/languageoptions.hxx>
73cdf0e10cSrcweir #include <svl/slstitm.hxx>
74cdf0e10cSrcweir #include <editeng/langitem.hxx>
75cdf0e10cSrcweir #include <svtools/langtab.hxx>
76cdf0e10cSrcweir #include <editeng/unolingu.hxx>
77cdf0e10cSrcweir #include <editeng/scripttypeitem.hxx>
78cdf0e10cSrcweir #include <editeng/writingmodeitem.hxx>
79cdf0e10cSrcweir #include <editeng/eeitem.hxx>
80cdf0e10cSrcweir #include <editeng/editeng.hxx>
81cdf0e10cSrcweir #include <editeng/editdata.hxx>
82cdf0e10cSrcweir #include <editeng/outliner.hxx>
83cdf0e10cSrcweir #include <vcl/window.hxx>
84cdf0e10cSrcweir #include <editeng/editview.hxx>
85cdf0e10cSrcweir #include <vcl/outdev.hxx>
86cdf0e10cSrcweir #include <editeng/hyznitem.hxx>
87cdf0e10cSrcweir #include <editeng/kernitem.hxx>
88cdf0e10cSrcweir #include <editeng/langitem.hxx>
89cdf0e10cSrcweir #include <editeng/lspcitem.hxx>
90cdf0e10cSrcweir #include <editeng/orphitem.hxx>
91cdf0e10cSrcweir #include <editeng/outliner.hxx>
92cdf0e10cSrcweir #include <editeng/postitem.hxx>
93cdf0e10cSrcweir #include <editeng/scripttypeitem.hxx>
94cdf0e10cSrcweir #include <editeng/shdditem.hxx>
95cdf0e10cSrcweir #include <editeng/spltitem.hxx>
96cdf0e10cSrcweir #include <svx/svdoutl.hxx>
97cdf0e10cSrcweir #include <svx/svdview.hxx>
98cdf0e10cSrcweir #include <editeng/udlnitem.hxx>
99cdf0e10cSrcweir #include <editeng/unolingu.hxx>
100cdf0e10cSrcweir #include <editeng/wghtitem.hxx>
101cdf0e10cSrcweir #include <editeng/widwitem.hxx>
102cdf0e10cSrcweir #include <editeng/writingmodeitem.hxx>
103cdf0e10cSrcweir #include <tools/shl.hxx>
104cdf0e10cSrcweir #include <vcl/msgbox.hxx>
105cdf0e10cSrcweir #include <vcl/outdev.hxx>
106cdf0e10cSrcweir #include <vcl/window.hxx>
107cdf0e10cSrcweir 
108cdf0e10cSrcweir #include <cmdid.h>
109cdf0e10cSrcweir #include <doc.hxx>
110cdf0e10cSrcweir #include <docstat.hxx>
111cdf0e10cSrcweir #include <drwtxtsh.hxx>
112cdf0e10cSrcweir #include <edtwin.hxx>
113cdf0e10cSrcweir #include <globals.hrc>
114cdf0e10cSrcweir #include <hintids.hxx>
115cdf0e10cSrcweir #include <initui.hxx>               // fuer SpellPointer
116cdf0e10cSrcweir #include <langhelper.hxx>
117cdf0e10cSrcweir #include <pardlg.hxx>
118cdf0e10cSrcweir #include <shells.hrc>
119cdf0e10cSrcweir #include <string.h>
120cdf0e10cSrcweir #include <swdtflvr.hxx>
121cdf0e10cSrcweir #include <swmodule.hxx>
122cdf0e10cSrcweir #include <swwait.hxx>
123cdf0e10cSrcweir #include <uitool.hxx>
124cdf0e10cSrcweir #include <viewopt.hxx>
125cdf0e10cSrcweir #include <wrtsh.hxx>
126cdf0e10cSrcweir #include <wview.hxx>
127cdf0e10cSrcweir 
128cdf0e10cSrcweir #include "swabstdlg.hxx"
129cdf0e10cSrcweir #include "chrdlg.hrc"
130cdf0e10cSrcweir #include "misc.hrc"
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 
133cdf0e10cSrcweir #include <langhelper.hxx>
134cdf0e10cSrcweir 
135cdf0e10cSrcweir using namespace ::com::sun::star;
136cdf0e10cSrcweir 
137cdf0e10cSrcweir /*--------------------------------------------------------------------
138cdf0e10cSrcweir 	Beschreibung:
139cdf0e10cSrcweir  --------------------------------------------------------------------*/
140cdf0e10cSrcweir 
141cdf0e10cSrcweir void SwDrawTextShell::Execute( SfxRequest &rReq )
142cdf0e10cSrcweir {
143cdf0e10cSrcweir 	SwWrtShell &rSh = GetShell();
144cdf0e10cSrcweir     	OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
145cdf0e10cSrcweir     	SfxItemSet aEditAttr(pOLV->GetAttribs());
146cdf0e10cSrcweir 	SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges());
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 	sal_uInt16 nSlot = rReq.GetSlot();
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 	sal_uInt16 nWhich = GetPool().GetWhich(nSlot);
151cdf0e10cSrcweir 	const SfxItemSet *pNewAttrs = rReq.GetArgs();
152cdf0e10cSrcweir 
153cdf0e10cSrcweir 	bool bRestoreSelection = false;
154cdf0e10cSrcweir 	ESelection aOldSelection;
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 	sal_uInt16 nEEWhich = 0;
157cdf0e10cSrcweir 	switch (nSlot)
158cdf0e10cSrcweir 	{
159cdf0e10cSrcweir 		case SID_LANGUAGE_STATUS:
160cdf0e10cSrcweir         {
161cdf0e10cSrcweir 			aOldSelection = pOLV->GetSelection();
162cdf0e10cSrcweir 			if (!pOLV->GetEditView().HasSelection())
163cdf0e10cSrcweir 			{
164cdf0e10cSrcweir 				bRestoreSelection	= true;
165cdf0e10cSrcweir 				pOLV->GetEditView().SelectCurrentWord();
166cdf0e10cSrcweir 			}
167cdf0e10cSrcweir 
168cdf0e10cSrcweir 			bRestoreSelection = SwLangHelper::SetLanguageStatus(pOLV,rReq,GetView(),rSh);
169cdf0e10cSrcweir 			break;
170cdf0e10cSrcweir         }
171cdf0e10cSrcweir 
172cdf0e10cSrcweir         case SID_THES:
173cdf0e10cSrcweir         {
174cdf0e10cSrcweir             String aReplaceText;
175cdf0e10cSrcweir             SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, sal_False );
176cdf0e10cSrcweir             if (pItem2)
177cdf0e10cSrcweir                 aReplaceText = pItem2->GetValue();
178cdf0e10cSrcweir             if (aReplaceText.Len() > 0)
179cdf0e10cSrcweir                 ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText );
180cdf0e10cSrcweir             break;
181cdf0e10cSrcweir         }
182cdf0e10cSrcweir 
183cdf0e10cSrcweir         case SID_ATTR_CHAR_FONT:
184cdf0e10cSrcweir         case SID_ATTR_CHAR_FONTHEIGHT:
185cdf0e10cSrcweir         case SID_ATTR_CHAR_WEIGHT:
186cdf0e10cSrcweir         case SID_ATTR_CHAR_POSTURE:
187cdf0e10cSrcweir         {
188cdf0e10cSrcweir             SfxItemPool* pPool2 = aEditAttr.GetPool()->GetSecondaryPool();
189cdf0e10cSrcweir             if( !pPool2 )
190cdf0e10cSrcweir                 pPool2 = aEditAttr.GetPool();
191cdf0e10cSrcweir             SvxScriptSetItem aSetItem( nSlot, *pPool2 );
192cdf0e10cSrcweir 
193cdf0e10cSrcweir             // #i78017 establish the same behaviour as in Writer
194cdf0e10cSrcweir             sal_uInt16 nScriptTypes = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
195cdf0e10cSrcweir             if (nSlot == SID_ATTR_CHAR_FONT)
196cdf0e10cSrcweir                 nScriptTypes = pOLV->GetSelectedScriptType();
197cdf0e10cSrcweir 
198cdf0e10cSrcweir             aSetItem.PutItemForScriptType( nScriptTypes, pNewAttrs->Get( nWhich ) );
199cdf0e10cSrcweir             aNewAttr.Put( aSetItem.GetItemSet() );
200cdf0e10cSrcweir         }
201cdf0e10cSrcweir         break;
202cdf0e10cSrcweir 
203cdf0e10cSrcweir         case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
204cdf0e10cSrcweir 
205cdf0e10cSrcweir 		case SID_ATTR_CHAR_UNDERLINE:
206cdf0e10cSrcweir 		{
207cdf0e10cSrcweir 		 	FontUnderline eFU = ((const SvxUnderlineItem&)aEditAttr.Get(EE_CHAR_UNDERLINE)).GetLineStyle();
208cdf0e10cSrcweir 			aNewAttr.Put(SvxUnderlineItem(eFU == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE));
209cdf0e10cSrcweir 		}
210cdf0e10cSrcweir 		break;
211cdf0e10cSrcweir 
212cdf0e10cSrcweir 		case SID_ATTR_CHAR_OVERLINE:
213cdf0e10cSrcweir 		{
214cdf0e10cSrcweir 		 	FontUnderline eFO = ((const SvxOverlineItem&)aEditAttr.Get(EE_CHAR_OVERLINE)).GetLineStyle();
215cdf0e10cSrcweir 			aNewAttr.Put(SvxOverlineItem(eFO == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_OVERLINE));
216cdf0e10cSrcweir 		}
217cdf0e10cSrcweir 		break;
218cdf0e10cSrcweir 
219cdf0e10cSrcweir         case SID_ATTR_CHAR_CONTOUR:     nEEWhich = EE_CHAR_OUTLINE; break;
220cdf0e10cSrcweir         case SID_ATTR_CHAR_SHADOWED:    nEEWhich = EE_CHAR_SHADOW; break;
221cdf0e10cSrcweir         case SID_ATTR_CHAR_STRIKEOUT:   nEEWhich = EE_CHAR_STRIKEOUT; break;
222cdf0e10cSrcweir         case SID_ATTR_CHAR_WORDLINEMODE: nEEWhich = EE_CHAR_WLM; break;
223cdf0e10cSrcweir         case SID_ATTR_CHAR_RELIEF      : nEEWhich = EE_CHAR_RELIEF;  break;
224cdf0e10cSrcweir         case SID_ATTR_CHAR_LANGUAGE    : nEEWhich = EE_CHAR_LANGUAGE;break;
225cdf0e10cSrcweir         case SID_ATTR_CHAR_KERNING     : nEEWhich = EE_CHAR_KERNING; break;
226cdf0e10cSrcweir         case SID_ATTR_CHAR_SCALEWIDTH:   nEEWhich = EE_CHAR_FONTWIDTH; break;
227cdf0e10cSrcweir         case SID_ATTR_CHAR_AUTOKERN  :   nEEWhich = EE_CHAR_PAIRKERNING; break;
228cdf0e10cSrcweir         case SID_ATTR_CHAR_ESCAPEMENT:   nEEWhich = EE_CHAR_ESCAPEMENT; break;
229cdf0e10cSrcweir         case SID_ATTR_PARA_ADJUST_LEFT:
230cdf0e10cSrcweir 			aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_LEFT, EE_PARA_JUST));
231cdf0e10cSrcweir         break;
232cdf0e10cSrcweir 		case SID_ATTR_PARA_ADJUST_CENTER:
233cdf0e10cSrcweir 			aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST));
234cdf0e10cSrcweir         break;
235cdf0e10cSrcweir 		case SID_ATTR_PARA_ADJUST_RIGHT:
236cdf0e10cSrcweir 			aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_RIGHT, EE_PARA_JUST));
237cdf0e10cSrcweir         break;
238cdf0e10cSrcweir 		case SID_ATTR_PARA_ADJUST_BLOCK:
239cdf0e10cSrcweir 			aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_BLOCK, EE_PARA_JUST));
240cdf0e10cSrcweir         break;
241*766ce4d0SZheng Fan 		case SID_ATTR_PARA_LRSPACE:
242*766ce4d0SZheng Fan 			{
243*766ce4d0SZheng Fan 				SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq.
244*766ce4d0SZheng Fan 										GetArgs()->Get(nSlot));
245*766ce4d0SZheng Fan 				aParaMargin.SetWhich( EE_PARA_LRSPACE );
246*766ce4d0SZheng Fan 				aNewAttr.Put(aParaMargin);
247*766ce4d0SZheng Fan 				rReq.Done();
248*766ce4d0SZheng Fan 			}
249*766ce4d0SZheng Fan 			break;
250*766ce4d0SZheng Fan 		case SID_ATTR_PARA_LINESPACE:
251*766ce4d0SZheng Fan 			{
252*766ce4d0SZheng Fan 				SvxLineSpacingItem aLineSpace = (const SvxLineSpacingItem&)pNewAttrs->Get(
253*766ce4d0SZheng Fan 															GetPool().GetWhich(nSlot));
254*766ce4d0SZheng Fan 				aLineSpace.SetWhich( EE_PARA_SBL );
255*766ce4d0SZheng Fan 				aNewAttr.Put( aLineSpace );
256*766ce4d0SZheng Fan 				rReq.Done();
257*766ce4d0SZheng Fan 			}
258*766ce4d0SZheng Fan 			break;
259*766ce4d0SZheng Fan 		case SID_ATTR_PARA_ULSPACE:
260*766ce4d0SZheng Fan 			{
261*766ce4d0SZheng Fan 				SvxULSpaceItem aULSpace = (const SvxULSpaceItem&)pNewAttrs->Get(
262*766ce4d0SZheng Fan 					GetPool().GetWhich(nSlot));
263*766ce4d0SZheng Fan 				aULSpace.SetWhich( EE_PARA_ULSPACE );
264*766ce4d0SZheng Fan 				aNewAttr.Put( aULSpace );
265*766ce4d0SZheng Fan 				rReq.Done();
266*766ce4d0SZheng Fan 			}
267*766ce4d0SZheng Fan 			break;
268cdf0e10cSrcweir 
269cdf0e10cSrcweir 		case SID_ATTR_PARA_LINESPACE_10:
270cdf0e10cSrcweir 		{
271cdf0e10cSrcweir 			SvxLineSpacingItem aItem(SVX_LINESPACE_ONE_LINE, EE_PARA_SBL);
272cdf0e10cSrcweir 			aItem.SetPropLineSpace(100);
273cdf0e10cSrcweir 			aNewAttr.Put(aItem);
274cdf0e10cSrcweir 		}
275cdf0e10cSrcweir 		break;
276cdf0e10cSrcweir 		case SID_ATTR_PARA_LINESPACE_15:
277cdf0e10cSrcweir 		{
278cdf0e10cSrcweir 			SvxLineSpacingItem aItem(SVX_LINESPACE_ONE_POINT_FIVE_LINES, EE_PARA_SBL);
279cdf0e10cSrcweir 			aItem.SetPropLineSpace(150);
280cdf0e10cSrcweir 			aNewAttr.Put(aItem);
281cdf0e10cSrcweir 		}
282cdf0e10cSrcweir 		break;
283cdf0e10cSrcweir 		case SID_ATTR_PARA_LINESPACE_20:
284cdf0e10cSrcweir 		{
285cdf0e10cSrcweir 			SvxLineSpacingItem aItem(SVX_LINESPACE_TWO_LINES, EE_PARA_SBL);
286cdf0e10cSrcweir 			aItem.SetPropLineSpace(200);
287cdf0e10cSrcweir 			aNewAttr.Put(aItem);
288cdf0e10cSrcweir 		}
289cdf0e10cSrcweir 		break;
290cdf0e10cSrcweir 
291cdf0e10cSrcweir 		case FN_SET_SUPER_SCRIPT:
292cdf0e10cSrcweir 		{
293cdf0e10cSrcweir 			SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
294cdf0e10cSrcweir 			SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
295cdf0e10cSrcweir 							aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
296cdf0e10cSrcweir 
297cdf0e10cSrcweir 			if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
298cdf0e10cSrcweir 				aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
299cdf0e10cSrcweir 			else
300cdf0e10cSrcweir 				aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
301cdf0e10cSrcweir 			aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT );
302cdf0e10cSrcweir 		}
303cdf0e10cSrcweir 		break;
304cdf0e10cSrcweir 		case FN_SET_SUB_SCRIPT:
305cdf0e10cSrcweir 		{
306cdf0e10cSrcweir 			SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
307cdf0e10cSrcweir 			SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
308cdf0e10cSrcweir 							aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
309cdf0e10cSrcweir 
310cdf0e10cSrcweir 			if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
311cdf0e10cSrcweir 				aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
312cdf0e10cSrcweir 			else
313cdf0e10cSrcweir 				aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
314cdf0e10cSrcweir 			aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT );
315cdf0e10cSrcweir 		}
316cdf0e10cSrcweir 		break;
317cdf0e10cSrcweir 
318eb39ad03SZheng Fan 		case SID_CHAR_DLG_EFFECT:
319cdf0e10cSrcweir 		case SID_CHAR_DLG:
320cdf0e10cSrcweir 		case SID_CHAR_DLG_FOR_PARAGRAPH:
321cdf0e10cSrcweir 		{
322cdf0e10cSrcweir 			const SfxItemSet* pArgs = rReq.GetArgs();
323cdf0e10cSrcweir 
324cdf0e10cSrcweir 			if( !pArgs )
325cdf0e10cSrcweir 			{
326cdf0e10cSrcweir 				aOldSelection = pOLV->GetSelection();
327cdf0e10cSrcweir 				if (nSlot == SID_CHAR_DLG_FOR_PARAGRAPH)
328cdf0e10cSrcweir 				{
329cdf0e10cSrcweir 					// select current paragraph (and restore selection later on...)
330cdf0e10cSrcweir 					EditView & rEditView = pOLV->GetEditView();
331cdf0e10cSrcweir 					SwLangHelper::SelectPara( rEditView, rEditView.GetSelection() );
332cdf0e10cSrcweir 					bRestoreSelection = true;
333cdf0e10cSrcweir 				}
334cdf0e10cSrcweir 
335cdf0e10cSrcweir 				SwView* pView = &GetView();
336cdf0e10cSrcweir 				FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView));
337cdf0e10cSrcweir                 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
338cdf0e10cSrcweir 				SfxItemSet aDlgAttr(GetPool(), EE_ITEMS_START, EE_ITEMS_END);
339cdf0e10cSrcweir 
340cdf0e10cSrcweir 				// util::Language gibts an der EditEngine nicht! Daher nicht im Set.
341cdf0e10cSrcweir 
342cdf0e10cSrcweir 				aDlgAttr.Put( aEditAttr );
343cdf0e10cSrcweir                 aDlgAttr.Put( SvxKerningItem(0, RES_CHRATR_KERNING) );
344cdf0e10cSrcweir 
345cdf0e10cSrcweir                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
346cdf0e10cSrcweir                 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
347cdf0e10cSrcweir 
348cdf0e10cSrcweir                 SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg( pView->GetWindow(), *pView, aDlgAttr, DLG_CHAR,0, sal_True );
349cdf0e10cSrcweir                 DBG_ASSERT(pDlg, "Dialogdiet fail!");
350eb39ad03SZheng Fan 				if (nSlot == SID_CHAR_DLG_EFFECT)
351eb39ad03SZheng Fan 				{
352eb39ad03SZheng Fan 					pDlg->SetCurPageId(TP_CHAR_EXT);
353eb39ad03SZheng Fan 				}
354cdf0e10cSrcweir 				sal_uInt16 nRet = pDlg->Execute();
355cdf0e10cSrcweir 				if(RET_OK == nRet )
356cdf0e10cSrcweir                 {
357cdf0e10cSrcweir                     rReq.Done( *( pDlg->GetOutputItemSet() ) );
358cdf0e10cSrcweir                     aNewAttr.Put(*pDlg->GetOutputItemSet());
359cdf0e10cSrcweir                 }
360cdf0e10cSrcweir 				delete( pDlg );
361cdf0e10cSrcweir 				if(RET_OK != nRet)
362cdf0e10cSrcweir 					return ;
363cdf0e10cSrcweir 			}
364cdf0e10cSrcweir 			else
365cdf0e10cSrcweir 				aNewAttr.Put(*pArgs);
366cdf0e10cSrcweir 		}
367cdf0e10cSrcweir 		break;
368cdf0e10cSrcweir 		case FN_FORMAT_FOOTNOTE_DLG:
369cdf0e10cSrcweir 		{
370cdf0e10cSrcweir             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
371cdf0e10cSrcweir             DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
372cdf0e10cSrcweir 
373cdf0e10cSrcweir             VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg( GetView().GetWindow(), rView.GetWrtShell(), DLG_DOC_FOOTNOTE );
374cdf0e10cSrcweir             DBG_ASSERT(pDlg, "Dialogdiet fail!");
375cdf0e10cSrcweir 			pDlg->Execute();
376cdf0e10cSrcweir 			delete pDlg;
377cdf0e10cSrcweir 			break;
378cdf0e10cSrcweir 		}
379cdf0e10cSrcweir 		case FN_NUMBERING_OUTLINE_DLG:
380cdf0e10cSrcweir 		{
381cdf0e10cSrcweir 			SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
382cdf0e10cSrcweir 			SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
383cdf0e10cSrcweir             DBG_ASSERT(pFact, "Dialogdiet fail!");
384cdf0e10cSrcweir             SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
385cdf0e10cSrcweir 														GetView().GetWindow(), &aTmp, GetView().GetWrtShell());
386cdf0e10cSrcweir             DBG_ASSERT(pDlg, "Dialogdiet fail!");
387cdf0e10cSrcweir 			pDlg->Execute();
388cdf0e10cSrcweir 			delete pDlg;
389cdf0e10cSrcweir 			rReq.Done();
390cdf0e10cSrcweir 		}
391cdf0e10cSrcweir 		break;
392cdf0e10cSrcweir 		case SID_OPEN_XML_FILTERSETTINGS:
393cdf0e10cSrcweir 		{
394cdf0e10cSrcweir 			try
395cdf0e10cSrcweir 			{
396cdf0e10cSrcweir 				uno::Reference < ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.comp.ui.XSLTFilterDialog")), uno::UNO_QUERY);
397cdf0e10cSrcweir 				if( xDialog.is() )
398cdf0e10cSrcweir 				{
399cdf0e10cSrcweir 					xDialog->execute();
400cdf0e10cSrcweir 				}
401cdf0e10cSrcweir 			}
402cdf0e10cSrcweir 			catch( uno::Exception& )
403cdf0e10cSrcweir 			{
404cdf0e10cSrcweir 			}
405cdf0e10cSrcweir 			rReq.Ignore ();
406cdf0e10cSrcweir 		}
407cdf0e10cSrcweir 		break;
408cdf0e10cSrcweir 		case FN_WORDCOUNT_DIALOG:
409cdf0e10cSrcweir 		{
410cdf0e10cSrcweir 			SwDocStat aCurr;
411cdf0e10cSrcweir 			SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() );
412cdf0e10cSrcweir 			{
413cdf0e10cSrcweir 				SwWait aWait( *GetView().GetDocShell(), sal_True );
414cdf0e10cSrcweir 				rSh.StartAction();
415cdf0e10cSrcweir 				rSh.CountWords( aCurr );
416cdf0e10cSrcweir 				rSh.UpdateDocStat( aDocStat );
417cdf0e10cSrcweir 				rSh.EndAction();
418cdf0e10cSrcweir 			}
419cdf0e10cSrcweir 
420cdf0e10cSrcweir 			SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
421cdf0e10cSrcweir 			DBG_ASSERT(pFact, "Dialogdiet fail!");
422cdf0e10cSrcweir 			AbstractSwWordCountDialog* pDialog = pFact->CreateSwWordCountDialog( GetView().GetWindow() );
423cdf0e10cSrcweir 			pDialog->SetValues(aCurr, aDocStat );
424cdf0e10cSrcweir 			pDialog->Execute();
425cdf0e10cSrcweir 			delete pDialog;
426cdf0e10cSrcweir 		}
427cdf0e10cSrcweir 		break;
428cdf0e10cSrcweir 		case SID_PARA_DLG:
429cdf0e10cSrcweir 		{
430cdf0e10cSrcweir 			const SfxItemSet* pArgs = rReq.GetArgs();
431cdf0e10cSrcweir 
432cdf0e10cSrcweir 			if (!pArgs)
433cdf0e10cSrcweir 			{
434cdf0e10cSrcweir 				SwView* pView = &GetView();
435cdf0e10cSrcweir 				FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView));
436cdf0e10cSrcweir                 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
437cdf0e10cSrcweir 				SfxItemSet aDlgAttr(GetPool(),
438cdf0e10cSrcweir 									EE_ITEMS_START, EE_ITEMS_END,
439cdf0e10cSrcweir 									SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_HYPHENZONE,
440cdf0e10cSrcweir 									SID_ATTR_PARA_SPLIT, SID_ATTR_PARA_SPLIT,
441cdf0e10cSrcweir 									SID_ATTR_PARA_WIDOWS, SID_ATTR_PARA_WIDOWS,
442cdf0e10cSrcweir 									SID_ATTR_PARA_ORPHANS, SID_ATTR_PARA_ORPHANS,
443cdf0e10cSrcweir 									0);
444cdf0e10cSrcweir 
445cdf0e10cSrcweir 				aDlgAttr.Put(aEditAttr);
446cdf0e10cSrcweir 
447cdf0e10cSrcweir 				// Die Werte sind erst einmal uebernommen worden, um den Dialog anzuzeigen.
448cdf0e10cSrcweir 				// Muss natuerlich noch geaendert werden
449cdf0e10cSrcweir 				// aDlgAttr.Put( SvxParaDlgLimitsItem( 567 * 50, 5670) );
450cdf0e10cSrcweir 
451cdf0e10cSrcweir                 aDlgAttr.Put( SvxHyphenZoneItem( sal_False, RES_PARATR_HYPHENZONE) );
452cdf0e10cSrcweir                 aDlgAttr.Put( SvxFmtBreakItem( SVX_BREAK_NONE, RES_BREAK ) );
453cdf0e10cSrcweir                 aDlgAttr.Put( SvxFmtSplitItem( sal_True, RES_PARATR_SPLIT ) );
454cdf0e10cSrcweir                 aDlgAttr.Put( SvxWidowsItem( 0, RES_PARATR_WIDOWS ) );
455cdf0e10cSrcweir                 aDlgAttr.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS ) );
456cdf0e10cSrcweir 
457cdf0e10cSrcweir                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
458cdf0e10cSrcweir                 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
459cdf0e10cSrcweir 
460cdf0e10cSrcweir                 SfxAbstractTabDialog* pDlg = pFact->CreateSwParaDlg( GetView().GetWindow(), GetView(), aDlgAttr,DLG_STD, DLG_PARA, 0, sal_True );
461cdf0e10cSrcweir                 DBG_ASSERT(pDlg, "Dialogdiet fail!");
462cdf0e10cSrcweir 				sal_uInt16 nRet = pDlg->Execute();
463cdf0e10cSrcweir 				if(RET_OK == nRet)
464cdf0e10cSrcweir                 {
465cdf0e10cSrcweir                     rReq.Done( *( pDlg->GetOutputItemSet() ) );
466cdf0e10cSrcweir                     aNewAttr.Put(*pDlg->GetOutputItemSet());
467cdf0e10cSrcweir                 }
468cdf0e10cSrcweir 				delete( pDlg );
469cdf0e10cSrcweir 				if(RET_OK != nRet)
470cdf0e10cSrcweir 					return;
471cdf0e10cSrcweir 			}
472cdf0e10cSrcweir 			else
473cdf0e10cSrcweir 				aNewAttr.Put(*pArgs);
474cdf0e10cSrcweir 		}
475cdf0e10cSrcweir 		break;
476cdf0e10cSrcweir 		case SID_AUTOSPELL_CHECK:
477cdf0e10cSrcweir 		{
478cdf0e10cSrcweir //!! JP 16.03.2001: why??			pSdrView = rSh.GetDrawView();
479cdf0e10cSrcweir //!! JP 16.03.2001: why??			pOutliner = pSdrView->GetTextEditOutliner();
480cdf0e10cSrcweir             SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
481cdf0e10cSrcweir             sal_uInt32 nCtrl = pOutliner->GetControlWord();
482cdf0e10cSrcweir 
483cdf0e10cSrcweir 			sal_Bool bSet = ((const SfxBoolItem&)rReq.GetArgs()->Get(
484cdf0e10cSrcweir 													nSlot)).GetValue();
485cdf0e10cSrcweir             if(bSet)
486cdf0e10cSrcweir                 nCtrl |= EE_CNTRL_ONLINESPELLING|EE_CNTRL_ALLOWBIGOBJS;
487cdf0e10cSrcweir             else
488cdf0e10cSrcweir                 nCtrl &= ~EE_CNTRL_ONLINESPELLING;
489cdf0e10cSrcweir 			pOutliner->SetControlWord(nCtrl);
490cdf0e10cSrcweir 
491cdf0e10cSrcweir             rView.ExecuteSlot(rReq);
492cdf0e10cSrcweir 		}
493cdf0e10cSrcweir 		break;
494cdf0e10cSrcweir 		case SID_HYPERLINK_SETLINK:
495cdf0e10cSrcweir 		{
496cdf0e10cSrcweir 			const SfxPoolItem* pItem = 0;
497cdf0e10cSrcweir 			if(pNewAttrs)
498cdf0e10cSrcweir 				pNewAttrs->GetItemState(nSlot, sal_False, &pItem);
499cdf0e10cSrcweir 
500cdf0e10cSrcweir 			if(pItem)
501cdf0e10cSrcweir 			{
502cdf0e10cSrcweir 				const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem;
503cdf0e10cSrcweir 				SvxURLField aFld(rHLinkItem.GetURL(), rHLinkItem.GetName(), SVXURLFORMAT_APPDEFAULT);
504cdf0e10cSrcweir 				aFld.SetTargetFrame(rHLinkItem.GetTargetFrame());
505cdf0e10cSrcweir 
506cdf0e10cSrcweir 				const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
507cdf0e10cSrcweir 
508cdf0e10cSrcweir 				if (pFieldItem && pFieldItem->GetField()->ISA(SvxURLField))
509cdf0e10cSrcweir 				{
510cdf0e10cSrcweir 					// Feld selektieren, so dass es beim Insert geloescht wird
511cdf0e10cSrcweir 					ESelection aSel = pOLV->GetSelection();
512cdf0e10cSrcweir 					aSel.nEndPos++;
513cdf0e10cSrcweir 					pOLV->SetSelection(aSel);
514cdf0e10cSrcweir 				}
515cdf0e10cSrcweir                 pOLV->InsertField(SvxFieldItem(aFld, EE_FEATURE_FIELD));
516cdf0e10cSrcweir 			}
517cdf0e10cSrcweir 		}
518cdf0e10cSrcweir 		break;
519cdf0e10cSrcweir 
520cdf0e10cSrcweir 		case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
521cdf0e10cSrcweir     	case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
522cdf0e10cSrcweir 			// Shellwechsel!
523cdf0e10cSrcweir 			{
524cdf0e10cSrcweir 				SdrObject* pTmpObj = pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
525cdf0e10cSrcweir 				SdrPageView* pTmpPV = pSdrView->GetSdrPageView();
526cdf0e10cSrcweir 				SdrView* pTmpView = pSdrView;
527cdf0e10cSrcweir 
528cdf0e10cSrcweir                 pSdrView->SdrEndTextEdit(sal_True);
529cdf0e10cSrcweir 
530cdf0e10cSrcweir 				SfxItemSet aAttr( *aNewAttr.GetPool(),
531cdf0e10cSrcweir 							SDRATTR_TEXTDIRECTION,
532cdf0e10cSrcweir 							SDRATTR_TEXTDIRECTION );
533cdf0e10cSrcweir 
534cdf0e10cSrcweir 				aAttr.Put( SvxWritingModeItem(
535cdf0e10cSrcweir 					nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ?
536cdf0e10cSrcweir                         text::WritingMode_LR_TB
537cdf0e10cSrcweir                         : text::WritingMode_TB_RL, SDRATTR_TEXTDIRECTION ) );
538cdf0e10cSrcweir 				pTmpView->SetAttributes( aAttr );
539cdf0e10cSrcweir 
540cdf0e10cSrcweir 				rSh.GetView().BeginTextEdit( pTmpObj, pTmpPV, &rSh.GetView().GetEditWin(), sal_False);
541cdf0e10cSrcweir 				rSh.GetView().AttrChangedNotify( &rSh );
542cdf0e10cSrcweir 			}
543cdf0e10cSrcweir 			return;
544cdf0e10cSrcweir 
545cdf0e10cSrcweir         case SID_ATTR_PARA_LEFT_TO_RIGHT:
546cdf0e10cSrcweir         case SID_ATTR_PARA_RIGHT_TO_LEFT:
547cdf0e10cSrcweir         {
548cdf0e10cSrcweir             SdrObject* pTmpObj = pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
549cdf0e10cSrcweir             SdrPageView* pTmpPV = pSdrView->GetSdrPageView();
550cdf0e10cSrcweir             SdrView* pTmpView = pSdrView;
551cdf0e10cSrcweir 
552cdf0e10cSrcweir             pSdrView->SdrEndTextEdit(sal_True);
553cdf0e10cSrcweir             sal_Bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT;
554cdf0e10cSrcweir 
555cdf0e10cSrcweir             const SfxPoolItem* pPoolItem;
556cdf0e10cSrcweir             if( pNewAttrs && SFX_ITEM_SET == pNewAttrs->GetItemState( nSlot, sal_True, &pPoolItem ) )
557cdf0e10cSrcweir             {
558cdf0e10cSrcweir                 if( !( (SfxBoolItem*)pPoolItem)->GetValue() )
559cdf0e10cSrcweir                     bLeftToRight = !bLeftToRight;
560cdf0e10cSrcweir             }
561cdf0e10cSrcweir             SfxItemSet aAttr( *aNewAttr.GetPool(),
562cdf0e10cSrcweir                         EE_PARA_JUST, EE_PARA_JUST,
563cdf0e10cSrcweir                         EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR,
564cdf0e10cSrcweir                         0 );
565cdf0e10cSrcweir 
566cdf0e10cSrcweir             sal_uInt16 nAdjust = SVX_ADJUST_LEFT;
567cdf0e10cSrcweir             if( SFX_ITEM_ON == aEditAttr.GetItemState(EE_PARA_JUST, sal_True, &pPoolItem ) )
568cdf0e10cSrcweir                 nAdjust = ( (SvxAdjustItem*)pPoolItem)->GetEnumValue();
569cdf0e10cSrcweir 
570cdf0e10cSrcweir             if( bLeftToRight )
571cdf0e10cSrcweir             {
572cdf0e10cSrcweir                 aAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ) );
573cdf0e10cSrcweir                 if( nAdjust == SVX_ADJUST_RIGHT )
574cdf0e10cSrcweir                     aAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
575cdf0e10cSrcweir             }
576cdf0e10cSrcweir             else
577cdf0e10cSrcweir             {
578cdf0e10cSrcweir                 aAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_RIGHT_TOP, EE_PARA_WRITINGDIR ) );
579cdf0e10cSrcweir                 if( nAdjust == SVX_ADJUST_LEFT )
580cdf0e10cSrcweir                     aAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
581cdf0e10cSrcweir             }
582cdf0e10cSrcweir             pTmpView->SetAttributes( aAttr );
583cdf0e10cSrcweir             rSh.GetView().BeginTextEdit( pTmpObj, pTmpPV, &rSh.GetView().GetEditWin(), sal_False );
584cdf0e10cSrcweir             rSh.GetView().AttrChangedNotify( &rSh );
585cdf0e10cSrcweir         }
586cdf0e10cSrcweir         return;
587cdf0e10cSrcweir 		default:
588cdf0e10cSrcweir 			ASSERT(!this, falscher Dispatcher);
589cdf0e10cSrcweir 			return;
590cdf0e10cSrcweir 	}
591cdf0e10cSrcweir     if(nEEWhich && pNewAttrs)
592cdf0e10cSrcweir         aNewAttr.Put(pNewAttrs->Get(nWhich), nEEWhich);
593cdf0e10cSrcweir 
594cdf0e10cSrcweir 	SetAttrToMarked(aNewAttr);
595cdf0e10cSrcweir 
596cdf0e10cSrcweir 	GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False);
597cdf0e10cSrcweir 
598cdf0e10cSrcweir 	if (IsTextEdit() && pOLV->GetOutliner()->IsModified())
599cdf0e10cSrcweir 		rSh.SetModified();
600cdf0e10cSrcweir 
601cdf0e10cSrcweir 	if (bRestoreSelection)
602cdf0e10cSrcweir 	{
603cdf0e10cSrcweir 		// restore selection
604cdf0e10cSrcweir 		pOLV->GetEditView().SetSelection( aOldSelection );
605cdf0e10cSrcweir 	}
606cdf0e10cSrcweir }
607cdf0e10cSrcweir 
608cdf0e10cSrcweir /*--------------------------------------------------------------------
609cdf0e10cSrcweir 	Beschreibung:
610cdf0e10cSrcweir  --------------------------------------------------------------------*/
611cdf0e10cSrcweir 
612cdf0e10cSrcweir void SwDrawTextShell::GetState(SfxItemSet& rSet)
613cdf0e10cSrcweir {
614cdf0e10cSrcweir 	if (!IsTextEdit())	// Sonst manchmal Absturz!
615cdf0e10cSrcweir 		return;
616cdf0e10cSrcweir 
617cdf0e10cSrcweir 	OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
618cdf0e10cSrcweir     SfxWhichIter aIter(rSet);
619cdf0e10cSrcweir 	sal_uInt16 nWhich = aIter.FirstWhich();
620cdf0e10cSrcweir 
621cdf0e10cSrcweir     SfxItemSet aEditAttr( pOLV->GetAttribs() );
622cdf0e10cSrcweir 	const SfxPoolItem *pAdjust = 0, *pLSpace = 0, *pEscItem = 0;
623cdf0e10cSrcweir 	int eAdjust, nLSpace, nEsc;
624cdf0e10cSrcweir 
625cdf0e10cSrcweir 	while(nWhich)
626cdf0e10cSrcweir 	{
627cdf0e10cSrcweir 		sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich );
628cdf0e10cSrcweir 		sal_Bool bFlag = sal_False;
629cdf0e10cSrcweir 		switch( nSlotId )
630cdf0e10cSrcweir 		{
631cdf0e10cSrcweir 		    case SID_LANGUAGE_STATUS://20412:
632cdf0e10cSrcweir             {
633cdf0e10cSrcweir 				nSlotId = SwLangHelper::GetLanguageStatus(pOLV,rSet);;
634cdf0e10cSrcweir 				break;
635cdf0e10cSrcweir 			}
636cdf0e10cSrcweir 
637cdf0e10cSrcweir             case SID_THES:
638cdf0e10cSrcweir             {
639cdf0e10cSrcweir                 String          aStatusVal;
640cdf0e10cSrcweir                 LanguageType    nLang = LANGUAGE_NONE;
641cdf0e10cSrcweir                 bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() );
642cdf0e10cSrcweir                 rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
643cdf0e10cSrcweir 
644cdf0e10cSrcweir                 // disable "Thesaurus" context menu entry if there is nothing to look up
645cdf0e10cSrcweir                 uno::Reference< linguistic2::XThesaurus >  xThes( ::GetThesaurus() );
646cdf0e10cSrcweir                 lang::Locale aLocale( SvxCreateLocale( nLang ) );
647cdf0e10cSrcweir                 if (!bIsLookUpWord ||
648cdf0e10cSrcweir                     !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale ))
649cdf0e10cSrcweir                     rSet.DisableItem( SID_THES );
650cdf0e10cSrcweir 
651cdf0e10cSrcweir                 //! avoid puting the same item as SfxBoolItem at the end of this function
652cdf0e10cSrcweir                 nSlotId = 0;
653cdf0e10cSrcweir                 break;
654cdf0e10cSrcweir             }
655cdf0e10cSrcweir 
656cdf0e10cSrcweir         case SID_ATTR_PARA_ADJUST_LEFT:     eAdjust = SVX_ADJUST_LEFT; goto ASK_ADJUST;
657cdf0e10cSrcweir 		case SID_ATTR_PARA_ADJUST_RIGHT:	eAdjust = SVX_ADJUST_RIGHT; goto ASK_ADJUST;
658cdf0e10cSrcweir 		case SID_ATTR_PARA_ADJUST_CENTER:	eAdjust = SVX_ADJUST_CENTER; goto ASK_ADJUST;
659cdf0e10cSrcweir 		case SID_ATTR_PARA_ADJUST_BLOCK:	eAdjust = SVX_ADJUST_BLOCK; goto ASK_ADJUST;
660cdf0e10cSrcweir ASK_ADJUST:
661cdf0e10cSrcweir 			{
662cdf0e10cSrcweir 				if( !pAdjust )
663cdf0e10cSrcweir 					aEditAttr.GetItemState( EE_PARA_JUST, sal_False, &pAdjust);
664cdf0e10cSrcweir 
665cdf0e10cSrcweir 				if( !pAdjust || IsInvalidItem( pAdjust ))
666cdf0e10cSrcweir 					rSet.InvalidateItem( nSlotId ), nSlotId = 0;
667cdf0e10cSrcweir 				else
668cdf0e10cSrcweir 					bFlag = eAdjust == ((SvxAdjustItem*)pAdjust)->GetAdjust();
669cdf0e10cSrcweir 			}
670cdf0e10cSrcweir 			break;
671cdf0e10cSrcweir 
672*766ce4d0SZheng Fan 		case SID_ATTR_PARA_LRSPACE:
673*766ce4d0SZheng Fan 			{
674*766ce4d0SZheng Fan 				SfxItemState eState = aEditAttr.GetItemState(EE_PARA_LRSPACE);
675*766ce4d0SZheng Fan 				if( eState >= SFX_ITEM_DEFAULT )
676*766ce4d0SZheng Fan 				{
677*766ce4d0SZheng Fan 					SvxLRSpaceItem aLR = (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE );
678*766ce4d0SZheng Fan 					aLR.SetWhich(SID_ATTR_PARA_LRSPACE);
679*766ce4d0SZheng Fan 					rSet.Put(aLR);
680*766ce4d0SZheng Fan 				}
681*766ce4d0SZheng Fan 				else
682*766ce4d0SZheng Fan 					rSet.InvalidateItem(nSlotId);
683*766ce4d0SZheng Fan 				nSlotId = 0;
684*766ce4d0SZheng Fan 			}
685*766ce4d0SZheng Fan 			break;
686*766ce4d0SZheng Fan 		case SID_ATTR_PARA_LINESPACE:
687*766ce4d0SZheng Fan 			{
688*766ce4d0SZheng Fan 				SfxItemState eState = aEditAttr.GetItemState(EE_PARA_SBL);
689*766ce4d0SZheng Fan 				if( eState >= SFX_ITEM_DEFAULT )
690*766ce4d0SZheng Fan 				{
691*766ce4d0SZheng Fan 					SvxLineSpacingItem aLR = (const SvxLineSpacingItem&) aEditAttr.Get( EE_PARA_SBL );
692*766ce4d0SZheng Fan 					rSet.Put(aLR);
693*766ce4d0SZheng Fan 				}
694*766ce4d0SZheng Fan 				else
695*766ce4d0SZheng Fan 					rSet.InvalidateItem(nSlotId);
696*766ce4d0SZheng Fan 				nSlotId = 0;
697*766ce4d0SZheng Fan 			}
698*766ce4d0SZheng Fan 			break;
699*766ce4d0SZheng Fan 		case SID_ATTR_PARA_ULSPACE:
700*766ce4d0SZheng Fan 			{
701*766ce4d0SZheng Fan 				SfxItemState eState = aEditAttr.GetItemState(EE_PARA_ULSPACE);
702*766ce4d0SZheng Fan 				if( eState >= SFX_ITEM_DEFAULT )
703*766ce4d0SZheng Fan 				{
704*766ce4d0SZheng Fan 					SvxULSpaceItem aULSpace = (const SvxULSpaceItem&) aEditAttr.Get( EE_PARA_ULSPACE );
705*766ce4d0SZheng Fan 					aULSpace.SetWhich(SID_ATTR_PARA_ULSPACE);
706*766ce4d0SZheng Fan 					rSet.Put(aULSpace);
707*766ce4d0SZheng Fan 				}
708*766ce4d0SZheng Fan 				else
709*766ce4d0SZheng Fan 					rSet.InvalidateItem(nSlotId);
710*766ce4d0SZheng Fan 				Invalidate(SID_ATTR_PARA_ULSPACE);
711*766ce4d0SZheng Fan 				nSlotId = 0;
712*766ce4d0SZheng Fan 			}
713*766ce4d0SZheng Fan 			break;
714*766ce4d0SZheng Fan 
715cdf0e10cSrcweir 		case SID_ATTR_PARA_LINESPACE_10:	nLSpace = 100;	goto ASK_LINESPACE;
716cdf0e10cSrcweir 		case SID_ATTR_PARA_LINESPACE_15:	nLSpace = 150;	goto ASK_LINESPACE;
717cdf0e10cSrcweir 		case SID_ATTR_PARA_LINESPACE_20:	nLSpace = 200;	goto ASK_LINESPACE;
718cdf0e10cSrcweir ASK_LINESPACE:
719cdf0e10cSrcweir 			{
720cdf0e10cSrcweir 				if( !pLSpace )
721cdf0e10cSrcweir 					aEditAttr.GetItemState( EE_PARA_SBL, sal_False, &pLSpace );
722cdf0e10cSrcweir 
723cdf0e10cSrcweir 				if( !pLSpace || IsInvalidItem( pLSpace ))
724cdf0e10cSrcweir 					rSet.InvalidateItem( nSlotId ), nSlotId = 0;
725cdf0e10cSrcweir 				else if( nLSpace == ((const SvxLineSpacingItem*)pLSpace)->
726cdf0e10cSrcweir 												GetPropLineSpace() )
727cdf0e10cSrcweir 					bFlag = sal_True;
728cdf0e10cSrcweir 				else
729cdf0e10cSrcweir 					nSlotId = 0;
730cdf0e10cSrcweir 			}
731cdf0e10cSrcweir 			break;
732cdf0e10cSrcweir 
733cdf0e10cSrcweir 		case FN_SET_SUPER_SCRIPT:	nEsc = SVX_ESCAPEMENT_SUPERSCRIPT;
734cdf0e10cSrcweir 									goto ASK_ESCAPE;
735cdf0e10cSrcweir 		case FN_SET_SUB_SCRIPT:		nEsc = SVX_ESCAPEMENT_SUBSCRIPT;
736cdf0e10cSrcweir 									goto ASK_ESCAPE;
737cdf0e10cSrcweir ASK_ESCAPE:
738cdf0e10cSrcweir 			{
739cdf0e10cSrcweir 				if( !pEscItem )
740cdf0e10cSrcweir 					pEscItem = &aEditAttr.Get( EE_CHAR_ESCAPEMENT );
741cdf0e10cSrcweir 
742cdf0e10cSrcweir 				if( nEsc == ((const SvxEscapementItem*)
743cdf0e10cSrcweir 												pEscItem)->GetEnumValue() )
744cdf0e10cSrcweir 					bFlag = sal_True;
745cdf0e10cSrcweir 				else
746cdf0e10cSrcweir 					nSlotId = 0;
747cdf0e10cSrcweir 			}
748cdf0e10cSrcweir 			break;
749cdf0e10cSrcweir 
750cdf0e10cSrcweir         case SID_THESAURUS:
751cdf0e10cSrcweir         {
752cdf0e10cSrcweir             // disable "Thesaurus" if the language is not supported
753cdf0e10cSrcweir             const SfxPoolItem &rItem = GetShell().GetDoc()->GetDefault(
754cdf0e10cSrcweir                             GetWhichOfScript( RES_CHRATR_LANGUAGE,
755cdf0e10cSrcweir                             GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage())) );
756cdf0e10cSrcweir             LanguageType nLang = ((const SvxLanguageItem &) rItem).GetLanguage();
757cdf0e10cSrcweir 
758cdf0e10cSrcweir             uno::Reference< linguistic2::XThesaurus >  xThes( ::GetThesaurus() );
759cdf0e10cSrcweir             if (!xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( SvxCreateLocale( nLang ) ))
760cdf0e10cSrcweir                 rSet.DisableItem( SID_THESAURUS );
761cdf0e10cSrcweir             nSlotId = 0;
762cdf0e10cSrcweir         }
763cdf0e10cSrcweir         break;
764cdf0e10cSrcweir         case SID_HANGUL_HANJA_CONVERSION:
765cdf0e10cSrcweir         case SID_CHINESE_CONVERSION:
766cdf0e10cSrcweir         {
767cdf0e10cSrcweir             if (!SvtCJKOptions().IsAnyEnabled())
768cdf0e10cSrcweir             {
769cdf0e10cSrcweir                 GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
770cdf0e10cSrcweir                 rSet.DisableItem(nWhich);
771cdf0e10cSrcweir             }
772cdf0e10cSrcweir             else
773cdf0e10cSrcweir                 GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
774cdf0e10cSrcweir         }
775cdf0e10cSrcweir         break;
776cdf0e10cSrcweir 
777cdf0e10cSrcweir         case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
778cdf0e10cSrcweir         case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
779cdf0e10cSrcweir 			if ( !SvtLanguageOptions().IsVerticalTextEnabled() )
780cdf0e10cSrcweir 			{
781cdf0e10cSrcweir 				rSet.DisableItem( nSlotId );
782cdf0e10cSrcweir 				nSlotId = 0;
783cdf0e10cSrcweir 			}
784cdf0e10cSrcweir 			else
785cdf0e10cSrcweir 			{
786cdf0e10cSrcweir                 SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
787cdf0e10cSrcweir                 if( pOutliner )
788cdf0e10cSrcweir 					bFlag = pOutliner->IsVertical() ==
789cdf0e10cSrcweir 							(SID_TEXTDIRECTION_TOP_TO_BOTTOM == nSlotId);
790cdf0e10cSrcweir 				else
791cdf0e10cSrcweir 				{
792cdf0e10cSrcweir                     text::WritingMode eMode = (text::WritingMode)
793cdf0e10cSrcweir 									( (const SvxWritingModeItem&) aEditAttr.Get( SDRATTR_TEXTDIRECTION ) ).GetValue();
794cdf0e10cSrcweir 
795cdf0e10cSrcweir 					if( nSlotId == SID_TEXTDIRECTION_LEFT_TO_RIGHT )
796cdf0e10cSrcweir 					{
797cdf0e10cSrcweir                         bFlag = eMode == text::WritingMode_LR_TB;
798cdf0e10cSrcweir 					}
799cdf0e10cSrcweir 					else
800cdf0e10cSrcweir 					{
801cdf0e10cSrcweir                         bFlag = eMode != text::WritingMode_TB_RL;
802cdf0e10cSrcweir 					}
803cdf0e10cSrcweir 				}
804cdf0e10cSrcweir 			}
805cdf0e10cSrcweir 			break;
806cdf0e10cSrcweir         case SID_ATTR_PARA_LEFT_TO_RIGHT:
807cdf0e10cSrcweir         case SID_ATTR_PARA_RIGHT_TO_LEFT:
808cdf0e10cSrcweir         {
809cdf0e10cSrcweir             if ( !SvtLanguageOptions().IsCTLFontEnabled() )
810cdf0e10cSrcweir             {
811cdf0e10cSrcweir 				rSet.DisableItem( nWhich );
812cdf0e10cSrcweir 				nSlotId = 0;
813cdf0e10cSrcweir             }
814cdf0e10cSrcweir             else
815cdf0e10cSrcweir             {
816cdf0e10cSrcweir                 SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
817cdf0e10cSrcweir                 if(pOutliner && pOutliner->IsVertical())
818cdf0e10cSrcweir 				{
819cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
820cdf0e10cSrcweir 					nSlotId = 0;
821cdf0e10cSrcweir 				}
822cdf0e10cSrcweir 				else
823cdf0e10cSrcweir 				{
824cdf0e10cSrcweir 					switch( ( ( (SvxFrameDirectionItem&) aEditAttr.Get( EE_PARA_WRITINGDIR ) ) ).GetValue() )
825cdf0e10cSrcweir 					{
826cdf0e10cSrcweir 						case FRMDIR_HORI_LEFT_TOP:
827cdf0e10cSrcweir 							bFlag = nWhich == SID_ATTR_PARA_LEFT_TO_RIGHT;
828cdf0e10cSrcweir 						break;
829cdf0e10cSrcweir 
830cdf0e10cSrcweir 						case FRMDIR_HORI_RIGHT_TOP:
831cdf0e10cSrcweir 							bFlag = nWhich != SID_ATTR_PARA_LEFT_TO_RIGHT;
832cdf0e10cSrcweir 						break;
833cdf0e10cSrcweir 					}
834cdf0e10cSrcweir 				}
835cdf0e10cSrcweir 			}
836cdf0e10cSrcweir         }
837cdf0e10cSrcweir         break;
838cdf0e10cSrcweir         case SID_TRANSLITERATE_HALFWIDTH:
839cdf0e10cSrcweir         case SID_TRANSLITERATE_FULLWIDTH:
840cdf0e10cSrcweir         case SID_TRANSLITERATE_HIRAGANA:
841cdf0e10cSrcweir         case SID_TRANSLITERATE_KATAGANA:
842cdf0e10cSrcweir         {
843cdf0e10cSrcweir             SvtCJKOptions aCJKOptions;
844cdf0e10cSrcweir             if(!aCJKOptions.IsChangeCaseMapEnabled())
845cdf0e10cSrcweir             {
846cdf0e10cSrcweir                 rSet.DisableItem(nWhich);
847cdf0e10cSrcweir                 GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
848cdf0e10cSrcweir             }
849cdf0e10cSrcweir             else
850cdf0e10cSrcweir                 GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
851cdf0e10cSrcweir         }
852cdf0e10cSrcweir         break;
853cdf0e10cSrcweir 		case SID_INSERT_RLM :
854cdf0e10cSrcweir 		case SID_INSERT_LRM :
855cdf0e10cSrcweir 		case SID_INSERT_ZWNBSP :
856cdf0e10cSrcweir 		case SID_INSERT_ZWSP:
857cdf0e10cSrcweir         {
858cdf0e10cSrcweir 			SvtCTLOptions aCTLOptions;
859cdf0e10cSrcweir 			sal_Bool bEnabled = aCTLOptions.IsCTLFontEnabled();
860cdf0e10cSrcweir 			GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, bEnabled );
861cdf0e10cSrcweir 			if(!bEnabled)
862cdf0e10cSrcweir 				rSet.DisableItem(nWhich);
863cdf0e10cSrcweir 		}
864cdf0e10cSrcweir 		break;
865cdf0e10cSrcweir 		default:
866cdf0e10cSrcweir 			nSlotId = 0;			    // don't know this slot
867cdf0e10cSrcweir 			break;
868cdf0e10cSrcweir 		}
869cdf0e10cSrcweir 
870cdf0e10cSrcweir 		if( nSlotId )
871cdf0e10cSrcweir 			rSet.Put( SfxBoolItem( nWhich, bFlag ));
872cdf0e10cSrcweir 
873cdf0e10cSrcweir 		nWhich = aIter.NextWhich();
874cdf0e10cSrcweir 	}
875cdf0e10cSrcweir }
876cdf0e10cSrcweir 
877cdf0e10cSrcweir /*--------------------------------------------------------------------
878cdf0e10cSrcweir 	Beschreibung:
879cdf0e10cSrcweir  --------------------------------------------------------------------*/
880cdf0e10cSrcweir void SwDrawTextShell::GetDrawTxtCtrlState(SfxItemSet& rSet)
881cdf0e10cSrcweir {
882cdf0e10cSrcweir 	if (!IsTextEdit())	// Sonst Absturz!
883cdf0e10cSrcweir 		return;
884cdf0e10cSrcweir 
885cdf0e10cSrcweir     OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
886cdf0e10cSrcweir     SfxItemSet aEditAttr(pOLV->GetAttribs());
887cdf0e10cSrcweir 
888cdf0e10cSrcweir 	SfxWhichIter aIter(rSet);
889cdf0e10cSrcweir 	sal_uInt16 nWhich = aIter.FirstWhich();
890cdf0e10cSrcweir 	sal_uInt16 nScriptType = pOLV->GetSelectedScriptType();
891cdf0e10cSrcweir     while(nWhich)
892cdf0e10cSrcweir 	{
893cdf0e10cSrcweir         sal_uInt16 nEEWhich = 0;
894cdf0e10cSrcweir         sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich );
895cdf0e10cSrcweir 		switch( nSlotId )
896cdf0e10cSrcweir 		{
897cdf0e10cSrcweir             case SID_ATTR_CHAR_FONT:
898cdf0e10cSrcweir             case SID_ATTR_CHAR_FONTHEIGHT:
899cdf0e10cSrcweir             case SID_ATTR_CHAR_WEIGHT:
900cdf0e10cSrcweir             case SID_ATTR_CHAR_POSTURE:
901cdf0e10cSrcweir 			{
902cdf0e10cSrcweir                 SfxItemPool* pEditPool = aEditAttr.GetPool()->GetSecondaryPool();
903cdf0e10cSrcweir                 if( !pEditPool )
904cdf0e10cSrcweir                     pEditPool = aEditAttr.GetPool();
905cdf0e10cSrcweir                 SvxScriptSetItem aSetItem( nSlotId, *pEditPool );
906cdf0e10cSrcweir 				aSetItem.GetItemSet().Put( aEditAttr, sal_False );
907cdf0e10cSrcweir 				const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
908cdf0e10cSrcweir 				if( pI )
909cdf0e10cSrcweir 					rSet.Put( *pI, nWhich );
910cdf0e10cSrcweir 				else
911cdf0e10cSrcweir 					rSet.InvalidateItem( nWhich );
912cdf0e10cSrcweir 			}
913cdf0e10cSrcweir 			break;
914cdf0e10cSrcweir             case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
915cdf0e10cSrcweir             case SID_ATTR_CHAR_UNDERLINE: nEEWhich = EE_CHAR_UNDERLINE;break;
916cdf0e10cSrcweir             case SID_ATTR_CHAR_OVERLINE: nEEWhich = EE_CHAR_OVERLINE;break;
917cdf0e10cSrcweir             case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break;
918cdf0e10cSrcweir             case SID_ATTR_CHAR_SHADOWED:  nEEWhich = EE_CHAR_SHADOW;break;
919cdf0e10cSrcweir             case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT;break;
920cdf0e10cSrcweir             case SID_AUTOSPELL_CHECK:
921cdf0e10cSrcweir             {
922cdf0e10cSrcweir                 const SfxPoolItem* pState = rView.GetSlotState(nWhich);
923cdf0e10cSrcweir                 if (pState)
924cdf0e10cSrcweir                     rSet.Put(SfxBoolItem(nWhich, ((const SfxBoolItem*)pState)->GetValue()));
925cdf0e10cSrcweir                 else
926cdf0e10cSrcweir                     rSet.DisableItem( nWhich );
927cdf0e10cSrcweir                 break;
928cdf0e10cSrcweir             }
929cdf0e10cSrcweir             case SID_ATTR_CHAR_WORDLINEMODE: nEEWhich = EE_CHAR_WLM; break;
930cdf0e10cSrcweir             case SID_ATTR_CHAR_RELIEF      : nEEWhich = EE_CHAR_RELIEF;  break;
931cdf0e10cSrcweir             case SID_ATTR_CHAR_LANGUAGE    : nEEWhich = EE_CHAR_LANGUAGE;break;
932cdf0e10cSrcweir             case SID_ATTR_CHAR_KERNING     : nEEWhich = EE_CHAR_KERNING; break;
933cdf0e10cSrcweir             case SID_ATTR_CHAR_SCALEWIDTH:   nEEWhich = EE_CHAR_FONTWIDTH;break;
934cdf0e10cSrcweir             case SID_ATTR_CHAR_AUTOKERN  :   nEEWhich = EE_CHAR_PAIRKERNING; break;
935cdf0e10cSrcweir             case SID_ATTR_CHAR_ESCAPEMENT:   nEEWhich = EE_CHAR_ESCAPEMENT; break;
936cdf0e10cSrcweir         }
937cdf0e10cSrcweir         if(nEEWhich)
938cdf0e10cSrcweir             rSet.Put(aEditAttr.Get(nEEWhich, sal_True), nWhich);
939cdf0e10cSrcweir 
940cdf0e10cSrcweir         nWhich = aIter.NextWhich();
941cdf0e10cSrcweir 	}
942cdf0e10cSrcweir }
943cdf0e10cSrcweir 
944cdf0e10cSrcweir /*--------------------------------------------------------------------
945cdf0e10cSrcweir 	Beschreibung:
946cdf0e10cSrcweir  --------------------------------------------------------------------*/
947cdf0e10cSrcweir void SwDrawTextShell::ExecClpbrd(SfxRequest &rReq)
948cdf0e10cSrcweir {
949cdf0e10cSrcweir 	if (!IsTextEdit())	// Sonst Absturz!
950cdf0e10cSrcweir 		return;
951cdf0e10cSrcweir 
952cdf0e10cSrcweir     OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
953cdf0e10cSrcweir 
954cdf0e10cSrcweir     ESelection aSel(pOLV->GetSelection());
955cdf0e10cSrcweir 	const sal_Bool bCopy = (aSel.nStartPara != aSel.nEndPara) || (aSel.nStartPos != aSel.nEndPos);
956cdf0e10cSrcweir     sal_uInt16 nId = rReq.GetSlot();
957cdf0e10cSrcweir 	switch( nId )
958cdf0e10cSrcweir 	{
959cdf0e10cSrcweir 		case SID_CUT:
960cdf0e10cSrcweir 			if (bCopy)
961cdf0e10cSrcweir 				pOLV->Cut();
962cdf0e10cSrcweir 			return;
963cdf0e10cSrcweir 
964cdf0e10cSrcweir 		case SID_COPY:
965cdf0e10cSrcweir 			if (bCopy)
966cdf0e10cSrcweir 				pOLV->Copy();
967cdf0e10cSrcweir 			return;
968cdf0e10cSrcweir 
969cdf0e10cSrcweir 		case SID_PASTE:
970cdf0e10cSrcweir 			pOLV->PasteSpecial();
971cdf0e10cSrcweir 			break;
972cdf0e10cSrcweir 
973cdf0e10cSrcweir 		default:
974cdf0e10cSrcweir 			DBG_ERROR("falscher Dispatcher");
975cdf0e10cSrcweir 			return;
976cdf0e10cSrcweir 	}
977cdf0e10cSrcweir }
978cdf0e10cSrcweir 
979cdf0e10cSrcweir /*--------------------------------------------------------------------
980cdf0e10cSrcweir 	Beschreibung:	ClipBoard-Status
981cdf0e10cSrcweir  --------------------------------------------------------------------*/
982cdf0e10cSrcweir void SwDrawTextShell::StateClpbrd(SfxItemSet &rSet)
983cdf0e10cSrcweir {
984cdf0e10cSrcweir 	if (!IsTextEdit())	// Sonst Absturz!
985cdf0e10cSrcweir 		return;
986cdf0e10cSrcweir 
987cdf0e10cSrcweir     OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
988cdf0e10cSrcweir     ESelection aSel(pOLV->GetSelection());
989cdf0e10cSrcweir 	const sal_Bool bCopy = (aSel.nStartPara != aSel.nEndPara) ||
990cdf0e10cSrcweir 						   (aSel.nStartPos != aSel.nEndPos);
991cdf0e10cSrcweir 
992cdf0e10cSrcweir 
993cdf0e10cSrcweir 	SfxWhichIter aIter(rSet);
994cdf0e10cSrcweir 	sal_uInt16 nWhich = aIter.FirstWhich();
995cdf0e10cSrcweir 
996cdf0e10cSrcweir 	while(nWhich)
997cdf0e10cSrcweir 	{
998cdf0e10cSrcweir 		switch(nWhich)
999cdf0e10cSrcweir 		{
1000cdf0e10cSrcweir 			case SID_CUT:
1001cdf0e10cSrcweir 			case SID_COPY:
1002cdf0e10cSrcweir 				if( !bCopy )
1003cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
1004cdf0e10cSrcweir 				break;
1005cdf0e10cSrcweir 
1006cdf0e10cSrcweir 			case SID_PASTE:
1007cdf0e10cSrcweir 				{
1008cdf0e10cSrcweir 					TransferableDataHelper aDataHelper(
1009cdf0e10cSrcweir 						TransferableDataHelper::CreateFromSystemClipboard(
1010cdf0e10cSrcweir 								&GetView().GetEditWin() ) );
1011cdf0e10cSrcweir 
1012cdf0e10cSrcweir 					if( !aDataHelper.GetXTransferable().is() ||
1013cdf0e10cSrcweir 						!SwTransferable::IsPaste( GetShell(), aDataHelper ))
1014cdf0e10cSrcweir 						rSet.DisableItem( SID_PASTE );
1015cdf0e10cSrcweir 				}
1016cdf0e10cSrcweir 				break;
1017cdf0e10cSrcweir 
1018cdf0e10cSrcweir             case SID_PASTE_SPECIAL:
1019cdf0e10cSrcweir                 rSet.DisableItem( SID_PASTE_SPECIAL );
1020cdf0e10cSrcweir 				break;
1021cdf0e10cSrcweir             // --> OD 2008-06-20 #151110#
1022cdf0e10cSrcweir             case SID_CLIPBOARD_FORMAT_ITEMS:
1023cdf0e10cSrcweir                 rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS );
1024cdf0e10cSrcweir                 break;
1025cdf0e10cSrcweir             // <--
1026cdf0e10cSrcweir 		}
1027cdf0e10cSrcweir 		nWhich = aIter.NextWhich();
1028cdf0e10cSrcweir 	}
1029cdf0e10cSrcweir }
1030cdf0e10cSrcweir 
1031cdf0e10cSrcweir /*--------------------------------------------------------------------
1032cdf0e10cSrcweir 	Beschreibung:	Hyperlink-Status
1033cdf0e10cSrcweir  --------------------------------------------------------------------*/
1034cdf0e10cSrcweir 
1035cdf0e10cSrcweir void SwDrawTextShell::StateInsert(SfxItemSet &rSet)
1036cdf0e10cSrcweir {
1037cdf0e10cSrcweir 	if (!IsTextEdit())	// Sonst Absturz!
1038cdf0e10cSrcweir 		return;
1039cdf0e10cSrcweir 
1040cdf0e10cSrcweir     OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
1041cdf0e10cSrcweir     SfxWhichIter aIter(rSet);
1042cdf0e10cSrcweir 	sal_uInt16 nWhich = aIter.FirstWhich();
1043cdf0e10cSrcweir 
1044cdf0e10cSrcweir 	while(nWhich)
1045cdf0e10cSrcweir 	{
1046cdf0e10cSrcweir 		switch(nWhich)
1047cdf0e10cSrcweir 		{
1048cdf0e10cSrcweir 			case SID_HYPERLINK_GETLINK:
1049cdf0e10cSrcweir 				{
1050cdf0e10cSrcweir 					SvxHyperlinkItem aHLinkItem;
1051cdf0e10cSrcweir 					aHLinkItem.SetInsertMode(HLINK_FIELD);
1052cdf0e10cSrcweir 
1053cdf0e10cSrcweir 					const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
1054cdf0e10cSrcweir 
1055cdf0e10cSrcweir 					if (pFieldItem)
1056cdf0e10cSrcweir 					{
1057cdf0e10cSrcweir 						const SvxFieldData* pField = pFieldItem->GetField();
1058cdf0e10cSrcweir 
1059cdf0e10cSrcweir 						if (pField->ISA(SvxURLField))
1060cdf0e10cSrcweir 						{
1061cdf0e10cSrcweir 							aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation());
1062cdf0e10cSrcweir 							aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL());
1063cdf0e10cSrcweir 							aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame());
1064cdf0e10cSrcweir 						}
1065cdf0e10cSrcweir 					}
1066cdf0e10cSrcweir 					else
1067cdf0e10cSrcweir 					{
1068cdf0e10cSrcweir 						String sSel(pOLV->GetSelected());
1069cdf0e10cSrcweir 						sSel.Erase(255);
1070cdf0e10cSrcweir 						sSel.EraseTrailingChars();
1071cdf0e10cSrcweir 						aHLinkItem.SetName(sSel);
1072cdf0e10cSrcweir 					}
1073cdf0e10cSrcweir 
1074cdf0e10cSrcweir 					sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
1075cdf0e10cSrcweir 					aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
1076cdf0e10cSrcweir 						((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0)));
1077cdf0e10cSrcweir 
1078cdf0e10cSrcweir 					rSet.Put(aHLinkItem);
1079cdf0e10cSrcweir 				}
1080cdf0e10cSrcweir 				break;
1081cdf0e10cSrcweir 		}
1082cdf0e10cSrcweir 		nWhich = aIter.NextWhich();
1083cdf0e10cSrcweir 	}
1084cdf0e10cSrcweir }
1085cdf0e10cSrcweir 
1086