1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5efeef26fSAndrew Rist * distributed with this work for additional information
6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at
10efeef26fSAndrew Rist *
11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12efeef26fSAndrew Rist *
13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist * software distributed under the License is distributed on an
15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the
17efeef26fSAndrew Rist * specific language governing permissions and limitations
18efeef26fSAndrew Rist * under the License.
19efeef26fSAndrew Rist *
20efeef26fSAndrew Rist *************************************************************/
21efeef26fSAndrew Rist
22efeef26fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #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>
37766ce4d0SZheng Fan #include <editeng/lrspitem.hxx>
38766ce4d0SZheng 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
Execute(SfxRequest & rReq)141cdf0e10cSrcweir void SwDrawTextShell::Execute( SfxRequest &rReq )
142cdf0e10cSrcweir {
143900fdb6dSOliver-Rainer Wittmann SwWrtShell &rSh = GetShell();
144900fdb6dSOliver-Rainer Wittmann OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
145900fdb6dSOliver-Rainer Wittmann SfxItemSet aEditAttr(pOLV->GetAttribs());
146900fdb6dSOliver-Rainer Wittmann SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges());
147cdf0e10cSrcweir
148900fdb6dSOliver-Rainer Wittmann const sal_uInt16 nSlot = rReq.GetSlot();
149cdf0e10cSrcweir
150900fdb6dSOliver-Rainer Wittmann const sal_uInt16 nWhich = GetPool().GetWhich(nSlot);
151900fdb6dSOliver-Rainer Wittmann const SfxItemSet *pNewAttrs = rReq.GetArgs();
152cdf0e10cSrcweir
153900fdb6dSOliver-Rainer Wittmann bool bRestoreSelection = false;
154900fdb6dSOliver-Rainer Wittmann ESelection aOldSelection;
155cdf0e10cSrcweir
156900fdb6dSOliver-Rainer Wittmann sal_uInt16 nEEWhich = 0;
157900fdb6dSOliver-Rainer Wittmann switch (nSlot)
158900fdb6dSOliver-Rainer Wittmann {
159900fdb6dSOliver-Rainer Wittmann case SID_LANGUAGE_STATUS:
160cdf0e10cSrcweir {
161900fdb6dSOliver-Rainer Wittmann aOldSelection = pOLV->GetSelection();
162900fdb6dSOliver-Rainer Wittmann if (!pOLV->GetEditView().HasSelection())
163900fdb6dSOliver-Rainer Wittmann {
164900fdb6dSOliver-Rainer Wittmann bRestoreSelection = true;
165900fdb6dSOliver-Rainer Wittmann pOLV->GetEditView().SelectCurrentWord();
166900fdb6dSOliver-Rainer Wittmann }
167900fdb6dSOliver-Rainer Wittmann
168900fdb6dSOliver-Rainer Wittmann bRestoreSelection = SwLangHelper::SetLanguageStatus(pOLV,rReq,GetView(),rSh);
169900fdb6dSOliver-Rainer Wittmann break;
170cdf0e10cSrcweir }
171900fdb6dSOliver-Rainer Wittmann
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;
181900fdb6dSOliver-Rainer Wittmann }
182900fdb6dSOliver-Rainer Wittmann
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
205900fdb6dSOliver-Rainer Wittmann case SID_ATTR_CHAR_UNDERLINE:
206900fdb6dSOliver-Rainer Wittmann {
207900fdb6dSOliver-Rainer Wittmann if ( pNewAttrs )
208900fdb6dSOliver-Rainer Wittmann {
209900fdb6dSOliver-Rainer Wittmann const SvxTextLineItem& rTextLineItem = static_cast< const SvxTextLineItem& >( pNewAttrs->Get( pNewAttrs->GetPool()->GetWhich(nSlot) ) );
210900fdb6dSOliver-Rainer Wittmann aNewAttr.Put( SvxUnderlineItem( rTextLineItem.GetLineStyle(), EE_CHAR_UNDERLINE ) );
211900fdb6dSOliver-Rainer Wittmann }
212900fdb6dSOliver-Rainer Wittmann else
213900fdb6dSOliver-Rainer Wittmann {
214900fdb6dSOliver-Rainer Wittmann FontUnderline eFU = ((const SvxUnderlineItem&)aEditAttr.Get(EE_CHAR_UNDERLINE)).GetLineStyle();
215900fdb6dSOliver-Rainer Wittmann aNewAttr.Put( SvxUnderlineItem(eFU == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE) );
216900fdb6dSOliver-Rainer Wittmann }
217900fdb6dSOliver-Rainer Wittmann }
218900fdb6dSOliver-Rainer Wittmann break;
219cdf0e10cSrcweir
220cdf0e10cSrcweir case SID_ATTR_CHAR_OVERLINE:
221cdf0e10cSrcweir {
222cdf0e10cSrcweir FontUnderline eFO = ((const SvxOverlineItem&)aEditAttr.Get(EE_CHAR_OVERLINE)).GetLineStyle();
223cdf0e10cSrcweir aNewAttr.Put(SvxOverlineItem(eFO == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_OVERLINE));
224cdf0e10cSrcweir }
225cdf0e10cSrcweir break;
226cdf0e10cSrcweir
227cdf0e10cSrcweir case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break;
228cdf0e10cSrcweir case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW; break;
229cdf0e10cSrcweir case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT; break;
230cdf0e10cSrcweir case SID_ATTR_CHAR_WORDLINEMODE: nEEWhich = EE_CHAR_WLM; break;
231cdf0e10cSrcweir case SID_ATTR_CHAR_RELIEF : nEEWhich = EE_CHAR_RELIEF; break;
232cdf0e10cSrcweir case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break;
233cdf0e10cSrcweir case SID_ATTR_CHAR_KERNING : nEEWhich = EE_CHAR_KERNING; break;
234cdf0e10cSrcweir case SID_ATTR_CHAR_SCALEWIDTH: nEEWhich = EE_CHAR_FONTWIDTH; break;
235cdf0e10cSrcweir case SID_ATTR_CHAR_AUTOKERN : nEEWhich = EE_CHAR_PAIRKERNING; break;
236cdf0e10cSrcweir case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT; break;
237cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_LEFT:
238cdf0e10cSrcweir aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_LEFT, EE_PARA_JUST));
239cdf0e10cSrcweir break;
240cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_CENTER:
241cdf0e10cSrcweir aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST));
242cdf0e10cSrcweir break;
243cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_RIGHT:
244cdf0e10cSrcweir aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_RIGHT, EE_PARA_JUST));
245cdf0e10cSrcweir break;
246cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_BLOCK:
247cdf0e10cSrcweir aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_BLOCK, EE_PARA_JUST));
248cdf0e10cSrcweir break;
249766ce4d0SZheng Fan case SID_ATTR_PARA_LRSPACE:
250766ce4d0SZheng Fan {
251766ce4d0SZheng Fan SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq.
252766ce4d0SZheng Fan GetArgs()->Get(nSlot));
253766ce4d0SZheng Fan aParaMargin.SetWhich( EE_PARA_LRSPACE );
254766ce4d0SZheng Fan aNewAttr.Put(aParaMargin);
255766ce4d0SZheng Fan rReq.Done();
256766ce4d0SZheng Fan }
257766ce4d0SZheng Fan break;
258766ce4d0SZheng Fan case SID_ATTR_PARA_LINESPACE:
259766ce4d0SZheng Fan {
260766ce4d0SZheng Fan SvxLineSpacingItem aLineSpace = (const SvxLineSpacingItem&)pNewAttrs->Get(
261766ce4d0SZheng Fan GetPool().GetWhich(nSlot));
262766ce4d0SZheng Fan aLineSpace.SetWhich( EE_PARA_SBL );
263766ce4d0SZheng Fan aNewAttr.Put( aLineSpace );
264766ce4d0SZheng Fan rReq.Done();
265766ce4d0SZheng Fan }
266766ce4d0SZheng Fan break;
267766ce4d0SZheng Fan case SID_ATTR_PARA_ULSPACE:
268766ce4d0SZheng Fan {
269766ce4d0SZheng Fan SvxULSpaceItem aULSpace = (const SvxULSpaceItem&)pNewAttrs->Get(
270766ce4d0SZheng Fan GetPool().GetWhich(nSlot));
271766ce4d0SZheng Fan aULSpace.SetWhich( EE_PARA_ULSPACE );
272766ce4d0SZheng Fan aNewAttr.Put( aULSpace );
273766ce4d0SZheng Fan rReq.Done();
274766ce4d0SZheng Fan }
275766ce4d0SZheng Fan break;
276cdf0e10cSrcweir
277cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_10:
278cdf0e10cSrcweir {
279cdf0e10cSrcweir SvxLineSpacingItem aItem(SVX_LINESPACE_ONE_LINE, EE_PARA_SBL);
280cdf0e10cSrcweir aItem.SetPropLineSpace(100);
281cdf0e10cSrcweir aNewAttr.Put(aItem);
282cdf0e10cSrcweir }
283cdf0e10cSrcweir break;
284cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_15:
285cdf0e10cSrcweir {
286cdf0e10cSrcweir SvxLineSpacingItem aItem(SVX_LINESPACE_ONE_POINT_FIVE_LINES, EE_PARA_SBL);
287cdf0e10cSrcweir aItem.SetPropLineSpace(150);
288cdf0e10cSrcweir aNewAttr.Put(aItem);
289cdf0e10cSrcweir }
290cdf0e10cSrcweir break;
291cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_20:
292cdf0e10cSrcweir {
293cdf0e10cSrcweir SvxLineSpacingItem aItem(SVX_LINESPACE_TWO_LINES, EE_PARA_SBL);
294cdf0e10cSrcweir aItem.SetPropLineSpace(200);
295cdf0e10cSrcweir aNewAttr.Put(aItem);
296cdf0e10cSrcweir }
297cdf0e10cSrcweir break;
298cdf0e10cSrcweir
299cdf0e10cSrcweir case FN_SET_SUPER_SCRIPT:
300cdf0e10cSrcweir {
301cdf0e10cSrcweir SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
302cdf0e10cSrcweir SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
303cdf0e10cSrcweir aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
304cdf0e10cSrcweir
305cdf0e10cSrcweir if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
306cdf0e10cSrcweir aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
307cdf0e10cSrcweir else
308cdf0e10cSrcweir aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
309cdf0e10cSrcweir aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT );
310cdf0e10cSrcweir }
311cdf0e10cSrcweir break;
312cdf0e10cSrcweir case FN_SET_SUB_SCRIPT:
313cdf0e10cSrcweir {
314cdf0e10cSrcweir SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
315cdf0e10cSrcweir SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
316cdf0e10cSrcweir aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
317cdf0e10cSrcweir
318cdf0e10cSrcweir if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
319cdf0e10cSrcweir aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
320cdf0e10cSrcweir else
321cdf0e10cSrcweir aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
322cdf0e10cSrcweir aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT );
323cdf0e10cSrcweir }
324cdf0e10cSrcweir break;
325cdf0e10cSrcweir
326eb39ad03SZheng Fan case SID_CHAR_DLG_EFFECT:
327cdf0e10cSrcweir case SID_CHAR_DLG:
328cdf0e10cSrcweir case SID_CHAR_DLG_FOR_PARAGRAPH:
329cdf0e10cSrcweir {
330cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs();
331cdf0e10cSrcweir
332cdf0e10cSrcweir if( !pArgs )
333cdf0e10cSrcweir {
334cdf0e10cSrcweir aOldSelection = pOLV->GetSelection();
335cdf0e10cSrcweir if (nSlot == SID_CHAR_DLG_FOR_PARAGRAPH)
336cdf0e10cSrcweir {
337cdf0e10cSrcweir // select current paragraph (and restore selection later on...)
338cdf0e10cSrcweir EditView & rEditView = pOLV->GetEditView();
339cdf0e10cSrcweir SwLangHelper::SelectPara( rEditView, rEditView.GetSelection() );
340cdf0e10cSrcweir bRestoreSelection = true;
341cdf0e10cSrcweir }
342cdf0e10cSrcweir
343cdf0e10cSrcweir SwView* pView = &GetView();
344cdf0e10cSrcweir FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView));
345cdf0e10cSrcweir SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
346cdf0e10cSrcweir SfxItemSet aDlgAttr(GetPool(), EE_ITEMS_START, EE_ITEMS_END);
347cdf0e10cSrcweir
348cdf0e10cSrcweir // util::Language gibts an der EditEngine nicht! Daher nicht im Set.
349cdf0e10cSrcweir
350cdf0e10cSrcweir aDlgAttr.Put( aEditAttr );
351cdf0e10cSrcweir aDlgAttr.Put( SvxKerningItem(0, RES_CHRATR_KERNING) );
352cdf0e10cSrcweir
353cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
354cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
355cdf0e10cSrcweir
356cdf0e10cSrcweir SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg( pView->GetWindow(), *pView, aDlgAttr, DLG_CHAR,0, sal_True );
357cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");
358eb39ad03SZheng Fan if (nSlot == SID_CHAR_DLG_EFFECT)
359eb39ad03SZheng Fan {
360eb39ad03SZheng Fan pDlg->SetCurPageId(TP_CHAR_EXT);
361eb39ad03SZheng Fan }
362cdf0e10cSrcweir sal_uInt16 nRet = pDlg->Execute();
363cdf0e10cSrcweir if(RET_OK == nRet )
364cdf0e10cSrcweir {
365cdf0e10cSrcweir rReq.Done( *( pDlg->GetOutputItemSet() ) );
366cdf0e10cSrcweir aNewAttr.Put(*pDlg->GetOutputItemSet());
367cdf0e10cSrcweir }
368cdf0e10cSrcweir delete( pDlg );
369cdf0e10cSrcweir if(RET_OK != nRet)
370cdf0e10cSrcweir return ;
371cdf0e10cSrcweir }
372cdf0e10cSrcweir else
373cdf0e10cSrcweir aNewAttr.Put(*pArgs);
374cdf0e10cSrcweir }
375cdf0e10cSrcweir break;
376cdf0e10cSrcweir case FN_FORMAT_FOOTNOTE_DLG:
377cdf0e10cSrcweir {
378cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
379cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
380cdf0e10cSrcweir
381cdf0e10cSrcweir VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg( GetView().GetWindow(), rView.GetWrtShell(), DLG_DOC_FOOTNOTE );
382cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");
383cdf0e10cSrcweir pDlg->Execute();
384cdf0e10cSrcweir delete pDlg;
385cdf0e10cSrcweir break;
386cdf0e10cSrcweir }
387cdf0e10cSrcweir case FN_NUMBERING_OUTLINE_DLG:
388cdf0e10cSrcweir {
389cdf0e10cSrcweir SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
390cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
391cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!");
392cdf0e10cSrcweir SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
393cdf0e10cSrcweir GetView().GetWindow(), &aTmp, GetView().GetWrtShell());
394cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");
395cdf0e10cSrcweir pDlg->Execute();
396cdf0e10cSrcweir delete pDlg;
397cdf0e10cSrcweir rReq.Done();
398cdf0e10cSrcweir }
399cdf0e10cSrcweir break;
400cdf0e10cSrcweir case SID_OPEN_XML_FILTERSETTINGS:
401cdf0e10cSrcweir {
402cdf0e10cSrcweir try
403cdf0e10cSrcweir {
404cdf0e10cSrcweir uno::Reference < ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.comp.ui.XSLTFilterDialog")), uno::UNO_QUERY);
405cdf0e10cSrcweir if( xDialog.is() )
406cdf0e10cSrcweir {
407cdf0e10cSrcweir xDialog->execute();
408cdf0e10cSrcweir }
409cdf0e10cSrcweir }
410cdf0e10cSrcweir catch( uno::Exception& )
411cdf0e10cSrcweir {
412cdf0e10cSrcweir }
413cdf0e10cSrcweir rReq.Ignore ();
414cdf0e10cSrcweir }
415cdf0e10cSrcweir break;
416cdf0e10cSrcweir case FN_WORDCOUNT_DIALOG:
417cdf0e10cSrcweir {
418cdf0e10cSrcweir SwDocStat aCurr;
419cdf0e10cSrcweir SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() );
420cdf0e10cSrcweir {
4218ef2f12bSOliver-Rainer Wittmann SwWait aWait( *GetView().GetDocShell(), true );
422cdf0e10cSrcweir rSh.StartAction();
423cdf0e10cSrcweir rSh.CountWords( aCurr );
424cdf0e10cSrcweir rSh.UpdateDocStat( aDocStat );
425cdf0e10cSrcweir rSh.EndAction();
426cdf0e10cSrcweir }
427cdf0e10cSrcweir
428cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
429cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!");
430cdf0e10cSrcweir AbstractSwWordCountDialog* pDialog = pFact->CreateSwWordCountDialog( GetView().GetWindow() );
431cdf0e10cSrcweir pDialog->SetValues(aCurr, aDocStat );
432cdf0e10cSrcweir pDialog->Execute();
433cdf0e10cSrcweir delete pDialog;
434cdf0e10cSrcweir }
435cdf0e10cSrcweir break;
436cdf0e10cSrcweir case SID_PARA_DLG:
437cdf0e10cSrcweir {
438cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs();
439cdf0e10cSrcweir
440cdf0e10cSrcweir if (!pArgs)
441cdf0e10cSrcweir {
442cdf0e10cSrcweir SwView* pView = &GetView();
443cdf0e10cSrcweir FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView));
444cdf0e10cSrcweir SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
445cdf0e10cSrcweir SfxItemSet aDlgAttr(GetPool(),
446cdf0e10cSrcweir EE_ITEMS_START, EE_ITEMS_END,
447cdf0e10cSrcweir SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_HYPHENZONE,
448cdf0e10cSrcweir SID_ATTR_PARA_SPLIT, SID_ATTR_PARA_SPLIT,
449cdf0e10cSrcweir SID_ATTR_PARA_WIDOWS, SID_ATTR_PARA_WIDOWS,
450cdf0e10cSrcweir SID_ATTR_PARA_ORPHANS, SID_ATTR_PARA_ORPHANS,
451cdf0e10cSrcweir 0);
452cdf0e10cSrcweir
453cdf0e10cSrcweir aDlgAttr.Put(aEditAttr);
454cdf0e10cSrcweir
455cdf0e10cSrcweir // Die Werte sind erst einmal uebernommen worden, um den Dialog anzuzeigen.
456cdf0e10cSrcweir // Muss natuerlich noch geaendert werden
457cdf0e10cSrcweir // aDlgAttr.Put( SvxParaDlgLimitsItem( 567 * 50, 5670) );
458cdf0e10cSrcweir
459cdf0e10cSrcweir aDlgAttr.Put( SvxHyphenZoneItem( sal_False, RES_PARATR_HYPHENZONE) );
460cdf0e10cSrcweir aDlgAttr.Put( SvxFmtBreakItem( SVX_BREAK_NONE, RES_BREAK ) );
461cdf0e10cSrcweir aDlgAttr.Put( SvxFmtSplitItem( sal_True, RES_PARATR_SPLIT ) );
462cdf0e10cSrcweir aDlgAttr.Put( SvxWidowsItem( 0, RES_PARATR_WIDOWS ) );
463cdf0e10cSrcweir aDlgAttr.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS ) );
464cdf0e10cSrcweir
465cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
466cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
467cdf0e10cSrcweir
468cdf0e10cSrcweir SfxAbstractTabDialog* pDlg = pFact->CreateSwParaDlg( GetView().GetWindow(), GetView(), aDlgAttr,DLG_STD, DLG_PARA, 0, sal_True );
469cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");
470cdf0e10cSrcweir sal_uInt16 nRet = pDlg->Execute();
471cdf0e10cSrcweir if(RET_OK == nRet)
472cdf0e10cSrcweir {
473cdf0e10cSrcweir rReq.Done( *( pDlg->GetOutputItemSet() ) );
474cdf0e10cSrcweir aNewAttr.Put(*pDlg->GetOutputItemSet());
475cdf0e10cSrcweir }
476cdf0e10cSrcweir delete( pDlg );
477cdf0e10cSrcweir if(RET_OK != nRet)
478cdf0e10cSrcweir return;
479cdf0e10cSrcweir }
480cdf0e10cSrcweir else
481cdf0e10cSrcweir aNewAttr.Put(*pArgs);
482cdf0e10cSrcweir }
483cdf0e10cSrcweir break;
484cdf0e10cSrcweir case SID_AUTOSPELL_CHECK:
485cdf0e10cSrcweir {
486cdf0e10cSrcweir //!! JP 16.03.2001: why?? pSdrView = rSh.GetDrawView();
487cdf0e10cSrcweir //!! JP 16.03.2001: why?? pOutliner = pSdrView->GetTextEditOutliner();
488cdf0e10cSrcweir SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
489cdf0e10cSrcweir sal_uInt32 nCtrl = pOutliner->GetControlWord();
490cdf0e10cSrcweir
491cdf0e10cSrcweir sal_Bool bSet = ((const SfxBoolItem&)rReq.GetArgs()->Get(
492cdf0e10cSrcweir nSlot)).GetValue();
493cdf0e10cSrcweir if(bSet)
494cdf0e10cSrcweir nCtrl |= EE_CNTRL_ONLINESPELLING|EE_CNTRL_ALLOWBIGOBJS;
495cdf0e10cSrcweir else
496cdf0e10cSrcweir nCtrl &= ~EE_CNTRL_ONLINESPELLING;
497cdf0e10cSrcweir pOutliner->SetControlWord(nCtrl);
498cdf0e10cSrcweir
499cdf0e10cSrcweir rView.ExecuteSlot(rReq);
500cdf0e10cSrcweir }
501cdf0e10cSrcweir break;
502cdf0e10cSrcweir case SID_HYPERLINK_SETLINK:
503cdf0e10cSrcweir {
504cdf0e10cSrcweir const SfxPoolItem* pItem = 0;
505cdf0e10cSrcweir if(pNewAttrs)
506cdf0e10cSrcweir pNewAttrs->GetItemState(nSlot, sal_False, &pItem);
507cdf0e10cSrcweir
508cdf0e10cSrcweir if(pItem)
509cdf0e10cSrcweir {
510cdf0e10cSrcweir const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem;
511cdf0e10cSrcweir SvxURLField aFld(rHLinkItem.GetURL(), rHLinkItem.GetName(), SVXURLFORMAT_APPDEFAULT);
512cdf0e10cSrcweir aFld.SetTargetFrame(rHLinkItem.GetTargetFrame());
513cdf0e10cSrcweir
514cdf0e10cSrcweir const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
515cdf0e10cSrcweir
516cdf0e10cSrcweir if (pFieldItem && pFieldItem->GetField()->ISA(SvxURLField))
517cdf0e10cSrcweir {
518cdf0e10cSrcweir // Feld selektieren, so dass es beim Insert geloescht wird
519cdf0e10cSrcweir ESelection aSel = pOLV->GetSelection();
520cdf0e10cSrcweir aSel.nEndPos++;
521cdf0e10cSrcweir pOLV->SetSelection(aSel);
522cdf0e10cSrcweir }
523cdf0e10cSrcweir pOLV->InsertField(SvxFieldItem(aFld, EE_FEATURE_FIELD));
524cdf0e10cSrcweir }
525cdf0e10cSrcweir }
526cdf0e10cSrcweir break;
527cdf0e10cSrcweir
528cdf0e10cSrcweir case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
529cdf0e10cSrcweir case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
530cdf0e10cSrcweir // Shellwechsel!
531cdf0e10cSrcweir {
532cdf0e10cSrcweir SdrObject* pTmpObj = pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
533cdf0e10cSrcweir SdrPageView* pTmpPV = pSdrView->GetSdrPageView();
534cdf0e10cSrcweir SdrView* pTmpView = pSdrView;
535cdf0e10cSrcweir
536cdf0e10cSrcweir pSdrView->SdrEndTextEdit(sal_True);
537cdf0e10cSrcweir
538cdf0e10cSrcweir SfxItemSet aAttr( *aNewAttr.GetPool(),
539cdf0e10cSrcweir SDRATTR_TEXTDIRECTION,
540cdf0e10cSrcweir SDRATTR_TEXTDIRECTION );
541cdf0e10cSrcweir
542cdf0e10cSrcweir aAttr.Put( SvxWritingModeItem(
543cdf0e10cSrcweir nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ?
544cdf0e10cSrcweir text::WritingMode_LR_TB
545cdf0e10cSrcweir : text::WritingMode_TB_RL, SDRATTR_TEXTDIRECTION ) );
546cdf0e10cSrcweir pTmpView->SetAttributes( aAttr );
547cdf0e10cSrcweir
548cdf0e10cSrcweir rSh.GetView().BeginTextEdit( pTmpObj, pTmpPV, &rSh.GetView().GetEditWin(), sal_False);
549cdf0e10cSrcweir rSh.GetView().AttrChangedNotify( &rSh );
550cdf0e10cSrcweir }
551cdf0e10cSrcweir return;
552cdf0e10cSrcweir
553cdf0e10cSrcweir case SID_ATTR_PARA_LEFT_TO_RIGHT:
554cdf0e10cSrcweir case SID_ATTR_PARA_RIGHT_TO_LEFT:
555cdf0e10cSrcweir {
556cdf0e10cSrcweir SdrObject* pTmpObj = pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
557cdf0e10cSrcweir SdrPageView* pTmpPV = pSdrView->GetSdrPageView();
558cdf0e10cSrcweir SdrView* pTmpView = pSdrView;
559cdf0e10cSrcweir
560cdf0e10cSrcweir pSdrView->SdrEndTextEdit(sal_True);
561cdf0e10cSrcweir sal_Bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT;
562cdf0e10cSrcweir
563cdf0e10cSrcweir const SfxPoolItem* pPoolItem;
564cdf0e10cSrcweir if( pNewAttrs && SFX_ITEM_SET == pNewAttrs->GetItemState( nSlot, sal_True, &pPoolItem ) )
565cdf0e10cSrcweir {
566cdf0e10cSrcweir if( !( (SfxBoolItem*)pPoolItem)->GetValue() )
567cdf0e10cSrcweir bLeftToRight = !bLeftToRight;
568cdf0e10cSrcweir }
569cdf0e10cSrcweir SfxItemSet aAttr( *aNewAttr.GetPool(),
570cdf0e10cSrcweir EE_PARA_JUST, EE_PARA_JUST,
571cdf0e10cSrcweir EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR,
572cdf0e10cSrcweir 0 );
573cdf0e10cSrcweir
574cdf0e10cSrcweir sal_uInt16 nAdjust = SVX_ADJUST_LEFT;
575cdf0e10cSrcweir if( SFX_ITEM_ON == aEditAttr.GetItemState(EE_PARA_JUST, sal_True, &pPoolItem ) )
576cdf0e10cSrcweir nAdjust = ( (SvxAdjustItem*)pPoolItem)->GetEnumValue();
577cdf0e10cSrcweir
578cdf0e10cSrcweir if( bLeftToRight )
579cdf0e10cSrcweir {
580cdf0e10cSrcweir aAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ) );
581cdf0e10cSrcweir if( nAdjust == SVX_ADJUST_RIGHT )
582cdf0e10cSrcweir aAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
583cdf0e10cSrcweir }
584cdf0e10cSrcweir else
585cdf0e10cSrcweir {
586cdf0e10cSrcweir aAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_RIGHT_TOP, EE_PARA_WRITINGDIR ) );
587cdf0e10cSrcweir if( nAdjust == SVX_ADJUST_LEFT )
588cdf0e10cSrcweir aAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
589cdf0e10cSrcweir }
590cdf0e10cSrcweir pTmpView->SetAttributes( aAttr );
591cdf0e10cSrcweir rSh.GetView().BeginTextEdit( pTmpObj, pTmpPV, &rSh.GetView().GetEditWin(), sal_False );
592cdf0e10cSrcweir rSh.GetView().AttrChangedNotify( &rSh );
593cdf0e10cSrcweir }
594cdf0e10cSrcweir return;
595cdf0e10cSrcweir default:
596*870262e3SDon Lewis ASSERT(sal_False, "wrong dispatcher");
597cdf0e10cSrcweir return;
598cdf0e10cSrcweir }
599cdf0e10cSrcweir if(nEEWhich && pNewAttrs)
600cdf0e10cSrcweir aNewAttr.Put(pNewAttrs->Get(nWhich), nEEWhich);
601cdf0e10cSrcweir
602cdf0e10cSrcweir SetAttrToMarked(aNewAttr);
603cdf0e10cSrcweir
604cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False);
605cdf0e10cSrcweir
606cdf0e10cSrcweir if (IsTextEdit() && pOLV->GetOutliner()->IsModified())
607cdf0e10cSrcweir rSh.SetModified();
608cdf0e10cSrcweir
609cdf0e10cSrcweir if (bRestoreSelection)
610cdf0e10cSrcweir {
611cdf0e10cSrcweir // restore selection
612cdf0e10cSrcweir pOLV->GetEditView().SetSelection( aOldSelection );
613cdf0e10cSrcweir }
614cdf0e10cSrcweir }
615cdf0e10cSrcweir
616cdf0e10cSrcweir /*--------------------------------------------------------------------
617cdf0e10cSrcweir Beschreibung:
618cdf0e10cSrcweir --------------------------------------------------------------------*/
619cdf0e10cSrcweir
GetState(SfxItemSet & rSet)620cdf0e10cSrcweir void SwDrawTextShell::GetState(SfxItemSet& rSet)
621cdf0e10cSrcweir {
622cdf0e10cSrcweir if (!IsTextEdit()) // Sonst manchmal Absturz!
623cdf0e10cSrcweir return;
624cdf0e10cSrcweir
625cdf0e10cSrcweir OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
626cdf0e10cSrcweir SfxWhichIter aIter(rSet);
627cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich();
628cdf0e10cSrcweir
629cdf0e10cSrcweir SfxItemSet aEditAttr( pOLV->GetAttribs() );
630cdf0e10cSrcweir const SfxPoolItem *pAdjust = 0, *pLSpace = 0, *pEscItem = 0;
631cdf0e10cSrcweir int eAdjust, nLSpace, nEsc;
632cdf0e10cSrcweir
633cdf0e10cSrcweir while(nWhich)
634cdf0e10cSrcweir {
635cdf0e10cSrcweir sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich );
636cdf0e10cSrcweir sal_Bool bFlag = sal_False;
637cdf0e10cSrcweir switch( nSlotId )
638cdf0e10cSrcweir {
639cdf0e10cSrcweir case SID_LANGUAGE_STATUS://20412:
640cdf0e10cSrcweir {
641cdf0e10cSrcweir nSlotId = SwLangHelper::GetLanguageStatus(pOLV,rSet);;
642cdf0e10cSrcweir break;
643cdf0e10cSrcweir }
644cdf0e10cSrcweir
645cdf0e10cSrcweir case SID_THES:
646cdf0e10cSrcweir {
647cdf0e10cSrcweir String aStatusVal;
648cdf0e10cSrcweir LanguageType nLang = LANGUAGE_NONE;
649cdf0e10cSrcweir bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() );
650cdf0e10cSrcweir rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
651cdf0e10cSrcweir
652cdf0e10cSrcweir // disable "Thesaurus" context menu entry if there is nothing to look up
653cdf0e10cSrcweir uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
654cdf0e10cSrcweir lang::Locale aLocale( SvxCreateLocale( nLang ) );
655cdf0e10cSrcweir if (!bIsLookUpWord ||
656cdf0e10cSrcweir !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale ))
657cdf0e10cSrcweir rSet.DisableItem( SID_THES );
658cdf0e10cSrcweir
65986e1cf34SPedro Giffuni //! avoid putting the same item as SfxBoolItem at the end of this function
660cdf0e10cSrcweir nSlotId = 0;
661cdf0e10cSrcweir break;
662cdf0e10cSrcweir }
663cdf0e10cSrcweir
664cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_LEFT: eAdjust = SVX_ADJUST_LEFT; goto ASK_ADJUST;
665cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_RIGHT: eAdjust = SVX_ADJUST_RIGHT; goto ASK_ADJUST;
666cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_CENTER: eAdjust = SVX_ADJUST_CENTER; goto ASK_ADJUST;
667cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_BLOCK: eAdjust = SVX_ADJUST_BLOCK; goto ASK_ADJUST;
668cdf0e10cSrcweir ASK_ADJUST:
669cdf0e10cSrcweir {
670cdf0e10cSrcweir if( !pAdjust )
671cdf0e10cSrcweir aEditAttr.GetItemState( EE_PARA_JUST, sal_False, &pAdjust);
672cdf0e10cSrcweir
673cdf0e10cSrcweir if( !pAdjust || IsInvalidItem( pAdjust ))
674cdf0e10cSrcweir rSet.InvalidateItem( nSlotId ), nSlotId = 0;
675cdf0e10cSrcweir else
676cdf0e10cSrcweir bFlag = eAdjust == ((SvxAdjustItem*)pAdjust)->GetAdjust();
677cdf0e10cSrcweir }
678cdf0e10cSrcweir break;
679cdf0e10cSrcweir
680766ce4d0SZheng Fan case SID_ATTR_PARA_LRSPACE:
681766ce4d0SZheng Fan {
682766ce4d0SZheng Fan SfxItemState eState = aEditAttr.GetItemState(EE_PARA_LRSPACE);
683766ce4d0SZheng Fan if( eState >= SFX_ITEM_DEFAULT )
684766ce4d0SZheng Fan {
685766ce4d0SZheng Fan SvxLRSpaceItem aLR = (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE );
686766ce4d0SZheng Fan aLR.SetWhich(SID_ATTR_PARA_LRSPACE);
687766ce4d0SZheng Fan rSet.Put(aLR);
688766ce4d0SZheng Fan }
689766ce4d0SZheng Fan else
690766ce4d0SZheng Fan rSet.InvalidateItem(nSlotId);
691766ce4d0SZheng Fan nSlotId = 0;
692766ce4d0SZheng Fan }
693766ce4d0SZheng Fan break;
694766ce4d0SZheng Fan case SID_ATTR_PARA_LINESPACE:
695766ce4d0SZheng Fan {
696766ce4d0SZheng Fan SfxItemState eState = aEditAttr.GetItemState(EE_PARA_SBL);
697766ce4d0SZheng Fan if( eState >= SFX_ITEM_DEFAULT )
698766ce4d0SZheng Fan {
699766ce4d0SZheng Fan SvxLineSpacingItem aLR = (const SvxLineSpacingItem&) aEditAttr.Get( EE_PARA_SBL );
700766ce4d0SZheng Fan rSet.Put(aLR);
701766ce4d0SZheng Fan }
702766ce4d0SZheng Fan else
703766ce4d0SZheng Fan rSet.InvalidateItem(nSlotId);
704766ce4d0SZheng Fan nSlotId = 0;
705766ce4d0SZheng Fan }
706766ce4d0SZheng Fan break;
707766ce4d0SZheng Fan case SID_ATTR_PARA_ULSPACE:
708766ce4d0SZheng Fan {
709766ce4d0SZheng Fan SfxItemState eState = aEditAttr.GetItemState(EE_PARA_ULSPACE);
710766ce4d0SZheng Fan if( eState >= SFX_ITEM_DEFAULT )
711766ce4d0SZheng Fan {
712766ce4d0SZheng Fan SvxULSpaceItem aULSpace = (const SvxULSpaceItem&) aEditAttr.Get( EE_PARA_ULSPACE );
713766ce4d0SZheng Fan aULSpace.SetWhich(SID_ATTR_PARA_ULSPACE);
714766ce4d0SZheng Fan rSet.Put(aULSpace);
715766ce4d0SZheng Fan }
716766ce4d0SZheng Fan else
717766ce4d0SZheng Fan rSet.InvalidateItem(nSlotId);
718766ce4d0SZheng Fan nSlotId = 0;
719766ce4d0SZheng Fan }
720766ce4d0SZheng Fan break;
721766ce4d0SZheng Fan
722cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_10: nLSpace = 100; goto ASK_LINESPACE;
723cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_15: nLSpace = 150; goto ASK_LINESPACE;
724cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_20: nLSpace = 200; goto ASK_LINESPACE;
725cdf0e10cSrcweir ASK_LINESPACE:
726cdf0e10cSrcweir {
727cdf0e10cSrcweir if( !pLSpace )
728cdf0e10cSrcweir aEditAttr.GetItemState( EE_PARA_SBL, sal_False, &pLSpace );
729cdf0e10cSrcweir
730cdf0e10cSrcweir if( !pLSpace || IsInvalidItem( pLSpace ))
731cdf0e10cSrcweir rSet.InvalidateItem( nSlotId ), nSlotId = 0;
732cdf0e10cSrcweir else if( nLSpace == ((const SvxLineSpacingItem*)pLSpace)->
733cdf0e10cSrcweir GetPropLineSpace() )
734cdf0e10cSrcweir bFlag = sal_True;
735cdf0e10cSrcweir else
736cdf0e10cSrcweir nSlotId = 0;
737cdf0e10cSrcweir }
738cdf0e10cSrcweir break;
739cdf0e10cSrcweir
740cdf0e10cSrcweir case FN_SET_SUPER_SCRIPT: nEsc = SVX_ESCAPEMENT_SUPERSCRIPT;
741cdf0e10cSrcweir goto ASK_ESCAPE;
742cdf0e10cSrcweir case FN_SET_SUB_SCRIPT: nEsc = SVX_ESCAPEMENT_SUBSCRIPT;
743cdf0e10cSrcweir goto ASK_ESCAPE;
744cdf0e10cSrcweir ASK_ESCAPE:
745cdf0e10cSrcweir {
746cdf0e10cSrcweir if( !pEscItem )
747cdf0e10cSrcweir pEscItem = &aEditAttr.Get( EE_CHAR_ESCAPEMENT );
748cdf0e10cSrcweir
749cdf0e10cSrcweir if( nEsc == ((const SvxEscapementItem*)
750cdf0e10cSrcweir pEscItem)->GetEnumValue() )
751cdf0e10cSrcweir bFlag = sal_True;
752cdf0e10cSrcweir else
753cdf0e10cSrcweir nSlotId = 0;
754cdf0e10cSrcweir }
755cdf0e10cSrcweir break;
756cdf0e10cSrcweir
757cdf0e10cSrcweir case SID_THESAURUS:
758cdf0e10cSrcweir {
759cdf0e10cSrcweir // disable "Thesaurus" if the language is not supported
760cdf0e10cSrcweir const SfxPoolItem &rItem = GetShell().GetDoc()->GetDefault(
761cdf0e10cSrcweir GetWhichOfScript( RES_CHRATR_LANGUAGE,
762cdf0e10cSrcweir GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage())) );
763cdf0e10cSrcweir LanguageType nLang = ((const SvxLanguageItem &) rItem).GetLanguage();
764cdf0e10cSrcweir
765cdf0e10cSrcweir uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
766cdf0e10cSrcweir if (!xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( SvxCreateLocale( nLang ) ))
767cdf0e10cSrcweir rSet.DisableItem( SID_THESAURUS );
768cdf0e10cSrcweir nSlotId = 0;
769cdf0e10cSrcweir }
770cdf0e10cSrcweir break;
771cdf0e10cSrcweir case SID_HANGUL_HANJA_CONVERSION:
772cdf0e10cSrcweir case SID_CHINESE_CONVERSION:
773cdf0e10cSrcweir {
774cdf0e10cSrcweir if (!SvtCJKOptions().IsAnyEnabled())
775cdf0e10cSrcweir {
776cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
777cdf0e10cSrcweir rSet.DisableItem(nWhich);
778cdf0e10cSrcweir }
779cdf0e10cSrcweir else
780cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
781cdf0e10cSrcweir }
782cdf0e10cSrcweir break;
783cdf0e10cSrcweir
784cdf0e10cSrcweir case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
785cdf0e10cSrcweir case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
786cdf0e10cSrcweir if ( !SvtLanguageOptions().IsVerticalTextEnabled() )
787cdf0e10cSrcweir {
788cdf0e10cSrcweir rSet.DisableItem( nSlotId );
789cdf0e10cSrcweir nSlotId = 0;
790cdf0e10cSrcweir }
791cdf0e10cSrcweir else
792cdf0e10cSrcweir {
793cdf0e10cSrcweir SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
794cdf0e10cSrcweir if( pOutliner )
795cdf0e10cSrcweir bFlag = pOutliner->IsVertical() ==
796cdf0e10cSrcweir (SID_TEXTDIRECTION_TOP_TO_BOTTOM == nSlotId);
797cdf0e10cSrcweir else
798cdf0e10cSrcweir {
799cdf0e10cSrcweir text::WritingMode eMode = (text::WritingMode)
800cdf0e10cSrcweir ( (const SvxWritingModeItem&) aEditAttr.Get( SDRATTR_TEXTDIRECTION ) ).GetValue();
801cdf0e10cSrcweir
802cdf0e10cSrcweir if( nSlotId == SID_TEXTDIRECTION_LEFT_TO_RIGHT )
803cdf0e10cSrcweir {
804cdf0e10cSrcweir bFlag = eMode == text::WritingMode_LR_TB;
805cdf0e10cSrcweir }
806cdf0e10cSrcweir else
807cdf0e10cSrcweir {
808cdf0e10cSrcweir bFlag = eMode != text::WritingMode_TB_RL;
809cdf0e10cSrcweir }
810cdf0e10cSrcweir }
811cdf0e10cSrcweir }
812cdf0e10cSrcweir break;
813cdf0e10cSrcweir case SID_ATTR_PARA_LEFT_TO_RIGHT:
814cdf0e10cSrcweir case SID_ATTR_PARA_RIGHT_TO_LEFT:
815cdf0e10cSrcweir {
816cdf0e10cSrcweir if ( !SvtLanguageOptions().IsCTLFontEnabled() )
817cdf0e10cSrcweir {
818cdf0e10cSrcweir rSet.DisableItem( nWhich );
819cdf0e10cSrcweir nSlotId = 0;
820cdf0e10cSrcweir }
821cdf0e10cSrcweir else
822cdf0e10cSrcweir {
823cdf0e10cSrcweir SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
824cdf0e10cSrcweir if(pOutliner && pOutliner->IsVertical())
825cdf0e10cSrcweir {
826cdf0e10cSrcweir rSet.DisableItem( nWhich );
827cdf0e10cSrcweir nSlotId = 0;
828cdf0e10cSrcweir }
829cdf0e10cSrcweir else
830cdf0e10cSrcweir {
831cdf0e10cSrcweir switch( ( ( (SvxFrameDirectionItem&) aEditAttr.Get( EE_PARA_WRITINGDIR ) ) ).GetValue() )
832cdf0e10cSrcweir {
833cdf0e10cSrcweir case FRMDIR_HORI_LEFT_TOP:
834cdf0e10cSrcweir bFlag = nWhich == SID_ATTR_PARA_LEFT_TO_RIGHT;
835cdf0e10cSrcweir break;
836cdf0e10cSrcweir
837cdf0e10cSrcweir case FRMDIR_HORI_RIGHT_TOP:
838cdf0e10cSrcweir bFlag = nWhich != SID_ATTR_PARA_LEFT_TO_RIGHT;
839cdf0e10cSrcweir break;
840cdf0e10cSrcweir }
841cdf0e10cSrcweir }
842cdf0e10cSrcweir }
843cdf0e10cSrcweir }
844cdf0e10cSrcweir break;
845cdf0e10cSrcweir case SID_TRANSLITERATE_HALFWIDTH:
846cdf0e10cSrcweir case SID_TRANSLITERATE_FULLWIDTH:
847cdf0e10cSrcweir case SID_TRANSLITERATE_HIRAGANA:
848cdf0e10cSrcweir case SID_TRANSLITERATE_KATAGANA:
849cdf0e10cSrcweir {
850cdf0e10cSrcweir SvtCJKOptions aCJKOptions;
851cdf0e10cSrcweir if(!aCJKOptions.IsChangeCaseMapEnabled())
852cdf0e10cSrcweir {
853cdf0e10cSrcweir rSet.DisableItem(nWhich);
854cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
855cdf0e10cSrcweir }
856cdf0e10cSrcweir else
857cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
858cdf0e10cSrcweir }
859cdf0e10cSrcweir break;
860cdf0e10cSrcweir case SID_INSERT_RLM :
861cdf0e10cSrcweir case SID_INSERT_LRM :
862cdf0e10cSrcweir case SID_INSERT_ZWNBSP :
863cdf0e10cSrcweir case SID_INSERT_ZWSP:
864cdf0e10cSrcweir {
865cdf0e10cSrcweir SvtCTLOptions aCTLOptions;
866cdf0e10cSrcweir sal_Bool bEnabled = aCTLOptions.IsCTLFontEnabled();
867cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, bEnabled );
868cdf0e10cSrcweir if(!bEnabled)
869cdf0e10cSrcweir rSet.DisableItem(nWhich);
870cdf0e10cSrcweir }
871cdf0e10cSrcweir break;
872cdf0e10cSrcweir default:
873cdf0e10cSrcweir nSlotId = 0; // don't know this slot
874cdf0e10cSrcweir break;
875cdf0e10cSrcweir }
876cdf0e10cSrcweir
877cdf0e10cSrcweir if( nSlotId )
878cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, bFlag ));
879cdf0e10cSrcweir
880cdf0e10cSrcweir nWhich = aIter.NextWhich();
881cdf0e10cSrcweir }
882cdf0e10cSrcweir }
883cdf0e10cSrcweir
884cdf0e10cSrcweir /*--------------------------------------------------------------------
885cdf0e10cSrcweir Beschreibung:
886cdf0e10cSrcweir --------------------------------------------------------------------*/
GetDrawTxtCtrlState(SfxItemSet & rSet)887cdf0e10cSrcweir void SwDrawTextShell::GetDrawTxtCtrlState(SfxItemSet& rSet)
888cdf0e10cSrcweir {
889cdf0e10cSrcweir if (!IsTextEdit()) // Sonst Absturz!
890cdf0e10cSrcweir return;
891cdf0e10cSrcweir
892cdf0e10cSrcweir OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
893cdf0e10cSrcweir SfxItemSet aEditAttr(pOLV->GetAttribs());
894cdf0e10cSrcweir
895cdf0e10cSrcweir SfxWhichIter aIter(rSet);
896cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich();
897cdf0e10cSrcweir sal_uInt16 nScriptType = pOLV->GetSelectedScriptType();
898cdf0e10cSrcweir while(nWhich)
899cdf0e10cSrcweir {
900cdf0e10cSrcweir sal_uInt16 nEEWhich = 0;
901cdf0e10cSrcweir sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich );
902cdf0e10cSrcweir switch( nSlotId )
903cdf0e10cSrcweir {
904cdf0e10cSrcweir case SID_ATTR_CHAR_FONT:
905cdf0e10cSrcweir case SID_ATTR_CHAR_FONTHEIGHT:
906cdf0e10cSrcweir case SID_ATTR_CHAR_WEIGHT:
907cdf0e10cSrcweir case SID_ATTR_CHAR_POSTURE:
908cdf0e10cSrcweir {
909cdf0e10cSrcweir SfxItemPool* pEditPool = aEditAttr.GetPool()->GetSecondaryPool();
910cdf0e10cSrcweir if( !pEditPool )
911cdf0e10cSrcweir pEditPool = aEditAttr.GetPool();
912cdf0e10cSrcweir SvxScriptSetItem aSetItem( nSlotId, *pEditPool );
913cdf0e10cSrcweir aSetItem.GetItemSet().Put( aEditAttr, sal_False );
914cdf0e10cSrcweir const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
915cdf0e10cSrcweir if( pI )
916cdf0e10cSrcweir rSet.Put( *pI, nWhich );
917cdf0e10cSrcweir else
918cdf0e10cSrcweir rSet.InvalidateItem( nWhich );
919cdf0e10cSrcweir }
920cdf0e10cSrcweir break;
921cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
922cdf0e10cSrcweir case SID_ATTR_CHAR_UNDERLINE: nEEWhich = EE_CHAR_UNDERLINE;break;
923cdf0e10cSrcweir case SID_ATTR_CHAR_OVERLINE: nEEWhich = EE_CHAR_OVERLINE;break;
924cdf0e10cSrcweir case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break;
925cdf0e10cSrcweir case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW;break;
926cdf0e10cSrcweir case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT;break;
927cdf0e10cSrcweir case SID_AUTOSPELL_CHECK:
928cdf0e10cSrcweir {
929cdf0e10cSrcweir const SfxPoolItem* pState = rView.GetSlotState(nWhich);
930cdf0e10cSrcweir if (pState)
931cdf0e10cSrcweir rSet.Put(SfxBoolItem(nWhich, ((const SfxBoolItem*)pState)->GetValue()));
932cdf0e10cSrcweir else
933cdf0e10cSrcweir rSet.DisableItem( nWhich );
934cdf0e10cSrcweir break;
935cdf0e10cSrcweir }
936cdf0e10cSrcweir case SID_ATTR_CHAR_WORDLINEMODE: nEEWhich = EE_CHAR_WLM; break;
937cdf0e10cSrcweir case SID_ATTR_CHAR_RELIEF : nEEWhich = EE_CHAR_RELIEF; break;
938cdf0e10cSrcweir case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break;
939cdf0e10cSrcweir case SID_ATTR_CHAR_KERNING : nEEWhich = EE_CHAR_KERNING; break;
940cdf0e10cSrcweir case SID_ATTR_CHAR_SCALEWIDTH: nEEWhich = EE_CHAR_FONTWIDTH;break;
941cdf0e10cSrcweir case SID_ATTR_CHAR_AUTOKERN : nEEWhich = EE_CHAR_PAIRKERNING; break;
942cdf0e10cSrcweir case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT; break;
943cdf0e10cSrcweir }
944cdf0e10cSrcweir if(nEEWhich)
945cdf0e10cSrcweir rSet.Put(aEditAttr.Get(nEEWhich, sal_True), nWhich);
946cdf0e10cSrcweir
947cdf0e10cSrcweir nWhich = aIter.NextWhich();
948cdf0e10cSrcweir }
949cdf0e10cSrcweir }
950cdf0e10cSrcweir
951cdf0e10cSrcweir /*--------------------------------------------------------------------
952cdf0e10cSrcweir Beschreibung:
953cdf0e10cSrcweir --------------------------------------------------------------------*/
ExecClpbrd(SfxRequest & rReq)954cdf0e10cSrcweir void SwDrawTextShell::ExecClpbrd(SfxRequest &rReq)
955cdf0e10cSrcweir {
956cdf0e10cSrcweir if (!IsTextEdit()) // Sonst Absturz!
957cdf0e10cSrcweir return;
958cdf0e10cSrcweir
959cdf0e10cSrcweir OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
960cdf0e10cSrcweir
961cdf0e10cSrcweir ESelection aSel(pOLV->GetSelection());
962cdf0e10cSrcweir const sal_Bool bCopy = (aSel.nStartPara != aSel.nEndPara) || (aSel.nStartPos != aSel.nEndPos);
963cdf0e10cSrcweir sal_uInt16 nId = rReq.GetSlot();
964cdf0e10cSrcweir switch( nId )
965cdf0e10cSrcweir {
966cdf0e10cSrcweir case SID_CUT:
967cdf0e10cSrcweir if (bCopy)
968cdf0e10cSrcweir pOLV->Cut();
969cdf0e10cSrcweir return;
970cdf0e10cSrcweir
971cdf0e10cSrcweir case SID_COPY:
972cdf0e10cSrcweir if (bCopy)
973cdf0e10cSrcweir pOLV->Copy();
974cdf0e10cSrcweir return;
975cdf0e10cSrcweir
976cdf0e10cSrcweir case SID_PASTE:
977cdf0e10cSrcweir pOLV->PasteSpecial();
978cdf0e10cSrcweir break;
979cdf0e10cSrcweir
980cdf0e10cSrcweir default:
981cdf0e10cSrcweir DBG_ERROR("falscher Dispatcher");
982cdf0e10cSrcweir return;
983cdf0e10cSrcweir }
984cdf0e10cSrcweir }
985cdf0e10cSrcweir
986cdf0e10cSrcweir /*--------------------------------------------------------------------
987cdf0e10cSrcweir Beschreibung: ClipBoard-Status
988cdf0e10cSrcweir --------------------------------------------------------------------*/
StateClpbrd(SfxItemSet & rSet)989cdf0e10cSrcweir void SwDrawTextShell::StateClpbrd(SfxItemSet &rSet)
990cdf0e10cSrcweir {
99169a74367SOliver-Rainer Wittmann if (!IsTextEdit()) // Sonst Absturz!
99269a74367SOliver-Rainer Wittmann return;
993cdf0e10cSrcweir
994cdf0e10cSrcweir OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
995cdf0e10cSrcweir ESelection aSel(pOLV->GetSelection());
99669a74367SOliver-Rainer Wittmann const sal_Bool bCopy = (aSel.nStartPara != aSel.nEndPara) ||
99769a74367SOliver-Rainer Wittmann (aSel.nStartPos != aSel.nEndPos);
998cdf0e10cSrcweir
999cdf0e10cSrcweir
100069a74367SOliver-Rainer Wittmann SfxWhichIter aIter(rSet);
100169a74367SOliver-Rainer Wittmann sal_uInt16 nWhich = aIter.FirstWhich();
1002cdf0e10cSrcweir
100369a74367SOliver-Rainer Wittmann while(nWhich)
100469a74367SOliver-Rainer Wittmann {
100569a74367SOliver-Rainer Wittmann switch(nWhich)
100669a74367SOliver-Rainer Wittmann {
100769a74367SOliver-Rainer Wittmann case SID_CUT:
100869a74367SOliver-Rainer Wittmann case SID_COPY:
100969a74367SOliver-Rainer Wittmann if( !bCopy )
101069a74367SOliver-Rainer Wittmann rSet.DisableItem( nWhich );
101169a74367SOliver-Rainer Wittmann break;
1012cdf0e10cSrcweir
101369a74367SOliver-Rainer Wittmann case SID_PASTE:
101469a74367SOliver-Rainer Wittmann {
101569a74367SOliver-Rainer Wittmann TransferableDataHelper aDataHelper(
101669a74367SOliver-Rainer Wittmann TransferableDataHelper::CreateFromSystemClipboard( &GetView().GetEditWin() ) );
1017cdf0e10cSrcweir
101869a74367SOliver-Rainer Wittmann if( !aDataHelper.GetXTransferable().is()
101969a74367SOliver-Rainer Wittmann || !SwTransferable::IsPaste( GetShell(), aDataHelper ) )
102069a74367SOliver-Rainer Wittmann {
102169a74367SOliver-Rainer Wittmann rSet.DisableItem( nWhich );
102269a74367SOliver-Rainer Wittmann }
102369a74367SOliver-Rainer Wittmann }
102469a74367SOliver-Rainer Wittmann break;
1025cdf0e10cSrcweir
102669a74367SOliver-Rainer Wittmann case SID_PASTE_SPECIAL:
102769a74367SOliver-Rainer Wittmann case SID_CLIPBOARD_FORMAT_ITEMS:
102869a74367SOliver-Rainer Wittmann rSet.DisableItem( nWhich );
102969a74367SOliver-Rainer Wittmann break;
103069a74367SOliver-Rainer Wittmann }
103169a74367SOliver-Rainer Wittmann
103269a74367SOliver-Rainer Wittmann nWhich = aIter.NextWhich();
103369a74367SOliver-Rainer Wittmann }
1034cdf0e10cSrcweir }
1035cdf0e10cSrcweir
1036cdf0e10cSrcweir /*--------------------------------------------------------------------
1037cdf0e10cSrcweir Beschreibung: Hyperlink-Status
1038cdf0e10cSrcweir --------------------------------------------------------------------*/
1039cdf0e10cSrcweir
StateInsert(SfxItemSet & rSet)1040cdf0e10cSrcweir void SwDrawTextShell::StateInsert(SfxItemSet &rSet)
1041cdf0e10cSrcweir {
1042cdf0e10cSrcweir if (!IsTextEdit()) // Sonst Absturz!
1043cdf0e10cSrcweir return;
1044cdf0e10cSrcweir
1045cdf0e10cSrcweir OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
1046cdf0e10cSrcweir SfxWhichIter aIter(rSet);
1047cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich();
1048cdf0e10cSrcweir
1049cdf0e10cSrcweir while(nWhich)
1050cdf0e10cSrcweir {
1051cdf0e10cSrcweir switch(nWhich)
1052cdf0e10cSrcweir {
1053cdf0e10cSrcweir case SID_HYPERLINK_GETLINK:
1054cdf0e10cSrcweir {
1055cdf0e10cSrcweir SvxHyperlinkItem aHLinkItem;
1056cdf0e10cSrcweir aHLinkItem.SetInsertMode(HLINK_FIELD);
1057cdf0e10cSrcweir
1058cdf0e10cSrcweir const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
1059cdf0e10cSrcweir
1060cdf0e10cSrcweir if (pFieldItem)
1061cdf0e10cSrcweir {
1062cdf0e10cSrcweir const SvxFieldData* pField = pFieldItem->GetField();
1063cdf0e10cSrcweir
1064cdf0e10cSrcweir if (pField->ISA(SvxURLField))
1065cdf0e10cSrcweir {
1066cdf0e10cSrcweir aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation());
1067cdf0e10cSrcweir aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL());
1068cdf0e10cSrcweir aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame());
1069cdf0e10cSrcweir }
1070cdf0e10cSrcweir }
1071cdf0e10cSrcweir else
1072cdf0e10cSrcweir {
1073cdf0e10cSrcweir String sSel(pOLV->GetSelected());
1074cdf0e10cSrcweir sSel.Erase(255);
1075cdf0e10cSrcweir sSel.EraseTrailingChars();
1076cdf0e10cSrcweir aHLinkItem.SetName(sSel);
1077cdf0e10cSrcweir }
1078cdf0e10cSrcweir
1079cdf0e10cSrcweir sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
1080cdf0e10cSrcweir aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
1081cdf0e10cSrcweir ((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0)));
1082cdf0e10cSrcweir
1083cdf0e10cSrcweir rSet.Put(aHLinkItem);
1084cdf0e10cSrcweir }
1085cdf0e10cSrcweir break;
1086cdf0e10cSrcweir }
1087cdf0e10cSrcweir nWhich = aIter.NextWhich();
1088cdf0e10cSrcweir }
1089cdf0e10cSrcweir }
1090cdf0e10cSrcweir
1091