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