Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <com/sun/star/i18n/WordType.hpp>
31 : : #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
32 : :
33 : : #include <comphelper/processfactory.hxx>
34 : : #include <hintids.hxx>
35 : : #include <cmdid.h>
36 : : #include <helpid.h>
37 : :
38 : : #include <i18npool/mslangid.hxx>
39 : : #include <svl/languageoptions.hxx>
40 : : #include <editeng/langitem.hxx>
41 : : #include <svtools/langtab.hxx>
42 : : #include <svl/slstitm.hxx>
43 : : #include <string.h>
44 : : #include <svl/stritem.hxx>
45 : : #include <svx/htmlmode.hxx>
46 : : #include <svl/whiter.hxx>
47 : : #include <sfx2/bindings.hxx>
48 : : #include <sfx2/dispatch.hxx>
49 : : #include <sfx2/objitem.hxx>
50 : : #include <vcl/unohelp2.hxx>
51 : : #include <sfx2/request.hxx>
52 : : #include <svl/eitem.hxx>
53 : : #include <svl/macitem.hxx>
54 : : #include <editeng/lrspitem.hxx>
55 : : #include <editeng/colritem.hxx>
56 : : #include <editeng/tstpitem.hxx>
57 : : #include <editeng/brshitem.hxx>
58 : : #include <editeng/svxacorr.hxx>
59 : : #include <svl/cjkoptions.hxx>
60 : : #include <svl/ctloptions.hxx>
61 : : #include <IDocumentSettingAccess.hxx>
62 : : #include <charfmt.hxx>
63 : : #include <editeng/fontitem.hxx>
64 : : #include <svx/SmartTagItem.hxx>
65 : : #include <fmtinfmt.hxx>
66 : : #include <swwait.hxx>
67 : : #include <wrtsh.hxx>
68 : : #include <wview.hxx>
69 : : #include <swmodule.hxx>
70 : : #include <viewopt.hxx>
71 : : #include <uitool.hxx>
72 : : #include <swevent.hxx>
73 : : #include <pagedesc.hxx>
74 : : #include <textsh.hxx>
75 : : #include <IMark.hxx>
76 : : #include <swdtflvr.hxx>
77 : : #include <docstat.hxx>
78 : : #include <outline.hxx>
79 : : #include <tablemgr.hxx>
80 : : #include <swundo.hxx> // fuer Undo-IDs
81 : : #include <reffld.hxx>
82 : : #include <docsh.hxx>
83 : : #include <mdiexp.hxx>
84 : : #include <inputwin.hxx>
85 : : #include <pardlg.hxx>
86 : : #include <frmatr.hxx>
87 : : #include <fmtcol.hxx>
88 : : #include <cellatr.hxx>
89 : : #include <edtwin.hxx>
90 : : #include <redlndlg.hxx>
91 : : #include "fldmgr.hxx"
92 : :
93 : : #include <globals.hrc>
94 : : #include <shells.hrc>
95 : : #include <app.hrc>
96 : : #include <web.hrc>
97 : : #include "paratr.hxx"
98 : : #include <crsskip.hxx>
99 : : #include <vcl/svapp.hxx>
100 : : #include <sfx2/app.hxx>
101 : : #include <breakit.hxx>
102 : :
103 : : #include <SwSmartTagMgr.hxx>
104 : :
105 : : #include <editeng/acorrcfg.hxx>
106 : : #include "swabstdlg.hxx"
107 : : #include "misc.hrc"
108 : : #include "chrdlg.hrc"
109 : : #include <IDocumentStatistics.hxx>
110 : :
111 : : #include <sfx2/sfxdlg.hxx>
112 : : #include <unotools/lingucfg.hxx>
113 : : #include <com/sun/star/beans/XPropertySet.hpp>
114 : : #include <com/sun/star/util/XChangesBatch.hpp>
115 : : #include <com/sun/star/uno/Any.hxx>
116 : : #include <editeng/unolingu.hxx>
117 : : #include <unotools/syslocaleoptions.hxx>
118 : : #include <doc.hxx>
119 : : #include <view.hxx>
120 : : #include <ndtxt.hxx>
121 : : #include <pam.hxx>
122 : : #include <sfx2/objface.hxx>
123 : : #include <langhelper.hxx>
124 : : #include <uiitems.hxx>
125 : : #include <wordcountdialog.hxx>
126 : :
127 : : using namespace ::com::sun::star;
128 : :
129 : 0 : void lcl_CharDialog( SwWrtShell &rWrtSh, sal_Bool bUseDialog, sal_uInt16 nSlot,const SfxItemSet *pArgs, SfxRequest *pReq )
130 : : {
131 [ # # ][ # # ]: 0 : FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rWrtSh.GetView()));
[ # # ][ # # ]
[ # # ][ # # ]
132 [ # # ][ # # ]: 0 : SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
[ # # ][ # # ]
133 : 0 : SfxItemSet aCoreSet( rWrtSh.GetView().GetPool(),
134 : : RES_CHRATR_BEGIN, RES_CHRATR_END-1,
135 : : RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
136 : : RES_BACKGROUND, RES_BACKGROUND,
137 : : FN_PARAM_SELECTION, FN_PARAM_SELECTION,
138 : : SID_HTML_MODE, SID_HTML_MODE,
139 : : SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, SID_ATTR_CHAR_WIDTH_FIT_TO_LINE,
140 [ # # ]: 0 : 0 );
141 [ # # ]: 0 : rWrtSh.GetCurAttr( aCoreSet );
142 [ # # ]: 0 : sal_Bool bSel = rWrtSh.HasSelection();
143 : 0 : sal_Bool bSelectionPut = sal_False;
144 [ # # ][ # # ]: 0 : if(bSel || rWrtSh.IsInWord())
[ # # ][ # # ]
145 : : {
146 [ # # ]: 0 : if(!bSel)
147 : : {
148 [ # # ]: 0 : rWrtSh.StartAction();
149 [ # # ]: 0 : rWrtSh.Push();
150 [ # # ][ # # ]: 0 : if(!rWrtSh.SelectTxtAttr( RES_TXTATR_INETFMT ))
151 [ # # ]: 0 : rWrtSh.SelWrd();
152 : : }
153 [ # # ][ # # ]: 0 : aCoreSet.Put(SfxStringItem(FN_PARAM_SELECTION, rWrtSh.GetSelTxt()));
[ # # ][ # # ]
[ # # ]
154 : 0 : bSelectionPut = sal_True;
155 [ # # ]: 0 : if(!bSel)
156 : : {
157 [ # # ]: 0 : rWrtSh.Pop(sal_False);
158 [ # # ]: 0 : rWrtSh.EndAction();
159 : : }
160 : : }
161 : : aCoreSet.Put( SfxUInt16Item( SID_ATTR_CHAR_WIDTH_FIT_TO_LINE,
162 [ # # ][ # # ]: 0 : rWrtSh.GetScalingOfSelectedText() ) );
[ # # ][ # # ]
163 : : // Das CHRATR_BACKGROUND-Attribut wird fuer den Dialog in
164 : : // ein RES_BACKGROUND verwandelt und wieder zurueck ...
165 : : const SfxPoolItem *pTmpBrush;
166 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET == aCoreSet.GetItemState( RES_CHRATR_BACKGROUND, sal_True, &pTmpBrush ) )
167 : : {
168 [ # # ]: 0 : SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
169 : 0 : aTmpBrush.SetWhich( RES_BACKGROUND );
170 [ # # ][ # # ]: 0 : aCoreSet.Put( aTmpBrush );
171 : : }
172 : :
173 [ # # ][ # # ]: 0 : aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(rWrtSh.GetView().GetDocShell())));
[ # # ][ # # ]
[ # # ]
174 : 0 : SfxAbstractTabDialog* pDlg = NULL;
175 [ # # ][ # # ]: 0 : if ( bUseDialog && GetActiveView() )
[ # # ][ # # ]
176 : : {
177 [ # # ]: 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
178 : : OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
179 : :
180 [ # # ]: 0 : pDlg = pFact->CreateSwCharDlg( rWrtSh.GetView().GetWindow(), rWrtSh.GetView(), aCoreSet, DLG_CHAR );
181 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
182 [ # # ]: 0 : if( FN_INSERT_HYPERLINK == nSlot )
183 [ # # ]: 0 : pDlg->SetCurPageId(TP_CHAR_URL);
184 : : }
185 : :
186 : 0 : const SfxItemSet* pSet = NULL;
187 [ # # ]: 0 : if ( !bUseDialog )
188 : 0 : pSet = pArgs;
189 [ # # ][ # # ]: 0 : else if ( NULL != pDlg && pDlg->Execute() == RET_OK ) /* #110771# pDlg can be NULL */
[ # # ][ # # ]
190 : : {
191 [ # # ]: 0 : pSet = pDlg->GetOutputItemSet();
192 : : }
193 : :
194 [ # # ]: 0 : if ( pSet)
195 : : {
196 [ # # ]: 0 : SfxItemSet aTmpSet( *pSet );
197 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_BACKGROUND, sal_False, &pTmpBrush ) )
198 : : {
199 [ # # ]: 0 : SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
200 : 0 : aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
201 [ # # ][ # # ]: 0 : aTmpSet.Put( aTmpBrush );
202 : : }
203 : :
204 [ # # ]: 0 : aTmpSet.ClearItem( RES_BACKGROUND );
205 : :
206 : : const SfxPoolItem* pSelectionItem;
207 : 0 : sal_Bool bInsert = sal_False;
208 : 0 : xub_StrLen nInsert = 0;
209 : :
210 : : // aus ungeklaerter Ursache ist das alte Item wieder im Set
211 [ # # ][ # # ]: 0 : if( !bSelectionPut && SFX_ITEM_SET == aTmpSet.GetItemState(FN_PARAM_SELECTION, sal_False, &pSelectionItem) )
[ # # ][ # # ]
212 : : {
213 [ # # ]: 0 : String sInsert = ((const SfxStringItem*)pSelectionItem)->GetValue();
214 : 0 : bInsert = sInsert.Len() != 0;
215 [ # # ]: 0 : if(bInsert)
216 : : {
217 : 0 : nInsert = sInsert.Len();
218 [ # # ]: 0 : rWrtSh.StartAction();
219 [ # # ]: 0 : rWrtSh.Insert( sInsert );
220 [ # # ]: 0 : rWrtSh.SetMark();
221 [ # # ]: 0 : rWrtSh.ExtendSelection(sal_False, sInsert.Len());
222 [ # # ]: 0 : SfxRequest aReq( rWrtSh.GetView().GetViewFrame(), FN_INSERT_STRING );
223 [ # # ][ # # ]: 0 : aReq.AppendItem( SfxStringItem( FN_INSERT_STRING, sInsert ) );
[ # # ]
224 [ # # ]: 0 : aReq.Done();
225 [ # # ]: 0 : SfxRequest aReq1( rWrtSh.GetView().GetViewFrame(), FN_CHAR_LEFT );
226 [ # # ][ # # ]: 0 : aReq1.AppendItem( SfxInt16Item(FN_PARAM_MOVE_COUNT, nInsert) );
[ # # ]
227 [ # # ][ # # ]: 0 : aReq1.AppendItem( SfxBoolItem(FN_PARAM_MOVE_SELECTION, sal_True) );
[ # # ]
228 [ # # ][ # # ]: 0 : aReq1.Done();
[ # # ]
229 [ # # ]: 0 : }
230 : : }
231 [ # # ]: 0 : aTmpSet.ClearItem(FN_PARAM_SELECTION);
232 : :
233 [ # # ]: 0 : SwTxtFmtColl* pColl = rWrtSh.GetCurTxtFmtColl();
234 [ # # ][ # # ]: 0 : if(bSel && rWrtSh.IsSelFullPara() && pColl && pColl->IsAutoUpdateFmt())
[ # # ][ # # ]
[ # # ][ # # ]
235 : : {
236 [ # # ]: 0 : rWrtSh.AutoUpdatePara(pColl, aTmpSet);
237 : : }
238 : : else
239 [ # # ]: 0 : rWrtSh.SetAttr( aTmpSet );
240 [ # # ]: 0 : if (pReq)
241 [ # # ]: 0 : pReq->Done(aTmpSet);
242 [ # # ]: 0 : if(bInsert)
243 : : {
244 [ # # ]: 0 : SfxRequest aReq1( rWrtSh.GetView().GetViewFrame(), FN_CHAR_RIGHT );
245 [ # # ][ # # ]: 0 : aReq1.AppendItem( SfxInt16Item(FN_PARAM_MOVE_COUNT, nInsert) );
[ # # ]
246 [ # # ][ # # ]: 0 : aReq1.AppendItem( SfxBoolItem(FN_PARAM_MOVE_SELECTION, sal_False) );
[ # # ]
247 [ # # ]: 0 : aReq1.Done();
248 [ # # ]: 0 : rWrtSh.SwapPam();
249 [ # # ]: 0 : rWrtSh.ClearMark();
250 [ # # ]: 0 : rWrtSh.DontExpandFmt();
251 [ # # ][ # # ]: 0 : rWrtSh.EndAction();
252 [ # # ]: 0 : }
253 : : }
254 : :
255 [ # # ][ # # ]: 0 : delete pDlg;
[ # # ]
256 : 0 : }
257 : :
258 : 0 : short lcl_AskRedlineMode(Window *pWin)
259 : : {
260 : : MessBox aQBox( pWin, 0,
261 : : String( SW_RES( STR_REDLINE_TITLE ) ),
262 [ # # ][ # # ]: 0 : String( SW_RES( STR_REDLINE_MSG ) ) );
[ # # ][ # # ]
[ # # ]
263 [ # # ][ # # ]: 0 : aQBox.SetImage( QueryBox::GetStandardImage() );
[ # # ]
264 : : sal_uInt16 nBtnFlags = BUTTONDIALOG_DEFBUTTON |
265 : : BUTTONDIALOG_OKBUTTON |
266 : 0 : BUTTONDIALOG_FOCUSBUTTON;
267 : :
268 [ # # ][ # # ]: 0 : aQBox.AddButton(String(SW_RES(STR_REDLINE_ACCEPT_ALL)), RET_OK, nBtnFlags);
[ # # ]
269 [ # # ][ # # ]: 0 : aQBox.GetPushButton( RET_OK )->SetHelpId(HID_AUTOFORMAT_ACCEPT);
270 [ # # ][ # # ]: 0 : aQBox.AddButton(String(SW_RES(STR_REDLINE_REJECT_ALL)), RET_CANCEL, BUTTONDIALOG_CANCELBUTTON);
[ # # ]
271 [ # # ][ # # ]: 0 : aQBox.GetPushButton( RET_CANCEL )->SetHelpId(HID_AUTOFORMAT_REJECT );
272 [ # # ][ # # ]: 0 : aQBox.AddButton(String(SW_RES(STR_REDLINE_EDIT)), 2, 0);
[ # # ]
273 [ # # ][ # # ]: 0 : aQBox.GetPushButton( 2 )->SetHelpId(HID_AUTOFORMAT_EDIT_CHG);
274 [ # # ]: 0 : aQBox.SetButtonHelpText( RET_OK, aEmptyStr );
275 : :
276 [ # # ][ # # ]: 0 : return aQBox.Execute();
277 : : }
278 : :
279 : 0 : void SwTextShell::Execute(SfxRequest &rReq)
280 : : {
281 : 0 : sal_Bool bUseDialog = sal_True;
282 : 0 : const SfxItemSet *pArgs = rReq.GetArgs();
283 [ # # ]: 0 : SwWrtShell& rWrtSh = GetShell();
284 : 0 : const SfxPoolItem* pItem = 0;
285 : 0 : sal_uInt16 nSlot = rReq.GetSlot();
286 [ # # ]: 0 : if(pArgs)
287 [ # # ][ # # ]: 0 : pArgs->GetItemState(GetPool().GetWhich(nSlot), sal_False, &pItem);
288 [ # # # # : 0 : switch( nSlot )
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# ]
289 : : {
290 : : case SID_LANGUAGE_STATUS:
291 : : {
292 : : // get the language
293 [ # # ]: 0 : String aNewLangTxt;
294 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_LANGUAGE_STATUS , sal_False );
295 [ # # ]: 0 : if (pItem2)
296 [ # # ]: 0 : aNewLangTxt = pItem2->GetValue();
297 : :
298 : : //!! Remember the view frame right now...
299 : : //!! (call to GetView().GetViewFrame() will break if the
300 : : //!! SwTextShell got destroyed meanwhile.)
301 : 0 : SfxViewFrame *pViewFrame = GetView().GetViewFrame();
302 : :
303 [ # # ][ # # ]: 0 : if (aNewLangTxt.EqualsAscii( "*" ))
304 : : {
305 : : // open the dialog "Tools/Options/Language Settings - Language"
306 : : // to set the documents default language
307 [ # # ]: 0 : SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
308 [ # # ]: 0 : if (pFact)
309 : : {
310 [ # # ]: 0 : VclAbstractDialog* pDlg = pFact->CreateVclDialog( GetView().GetWindow(), SID_LANGUAGE_OPTIONS );
311 [ # # ]: 0 : pDlg->Execute();
312 [ # # ][ # # ]: 0 : delete pDlg;
313 : : }
314 : : }
315 : : else
316 : : {
317 : : //!! We have to use StartAction / EndAction bracketing in
318 : : //!! order to prevent possible destruction of the SwTextShell
319 : : //!! due to the selection changes coming below.
320 [ # # ]: 0 : rWrtSh.StartAction();
321 : : // prevent view from jumping because of (temporary) selection changes
322 : 0 : rWrtSh.LockView( sal_True );
323 : : // save selection for later restoration
324 [ # # ]: 0 : rWrtSh.Push();
325 : :
326 : : // setting the new language...
327 [ # # ]: 0 : if (aNewLangTxt.Len() > 0)
328 : : {
329 : 0 : const rtl::OUString aSelectionLangPrefix("Current_");
330 : 0 : const rtl::OUString aParagraphLangPrefix("Paragraph_");
331 : 0 : const rtl::OUString aDocumentLangPrefix("Default_");
332 [ # # ]: 0 : const String aStrNone( rtl::OUString("LANGUAGE_NONE") );
333 [ # # ]: 0 : const String aStrResetLangs( rtl::OUString("RESET_LANGUAGES") );
334 : :
335 : 0 : SfxItemSet aCoreSet( GetPool(),
336 : : RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE,
337 : : RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
338 : : RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
339 [ # # ]: 0 : 0 );
340 : :
341 : 0 : xub_StrLen nPos = 0;
342 : 0 : bool bForSelection = true;
343 : 0 : bool bForParagraph = false;
344 [ # # ][ # # ]: 0 : if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aSelectionLangPrefix, 0 )))
[ # # ][ # # ]
345 : : {
346 : : // ... for the current selection
347 [ # # ][ # # ]: 0 : aNewLangTxt = aNewLangTxt.Erase( nPos, aSelectionLangPrefix.getLength() );
348 : 0 : bForSelection = true;
349 : : }
350 [ # # ][ # # ]: 0 : else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aParagraphLangPrefix , 0 )))
[ # # ][ # # ]
351 : : {
352 : : // ... for the current paragraph language
353 [ # # ][ # # ]: 0 : aNewLangTxt = aNewLangTxt.Erase( nPos, aParagraphLangPrefix.getLength() );
354 : 0 : bForSelection = true;
355 : 0 : bForParagraph = true;
356 : : }
357 [ # # ][ # # ]: 0 : else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aDocumentLangPrefix , 0 )))
[ # # ][ # # ]
358 : : {
359 : : // ... as default document language
360 [ # # ][ # # ]: 0 : aNewLangTxt = aNewLangTxt.Erase( nPos, aDocumentLangPrefix.getLength() );
361 : 0 : bForSelection = false;
362 : : }
363 : :
364 [ # # ]: 0 : if (bForParagraph)
365 [ # # ]: 0 : SwLangHelper::SelectCurrentPara( rWrtSh );
366 : :
367 [ # # ]: 0 : if (!bForSelection) // document language to be changed...
368 : : {
369 [ # # ]: 0 : rWrtSh.SelAll();
370 [ # # ]: 0 : rWrtSh.ExtendedSelectAll();
371 : : }
372 [ # # ][ # # ]: 0 : if (aNewLangTxt == aStrNone)
373 [ # # ]: 0 : SwLangHelper::SetLanguage_None( rWrtSh, bForSelection, aCoreSet );
374 [ # # ][ # # ]: 0 : else if (aNewLangTxt == aStrResetLangs)
375 [ # # ]: 0 : SwLangHelper::ResetLanguages( rWrtSh, bForSelection );
376 : : else
377 [ # # ][ # # ]: 0 : SwLangHelper::SetLanguage( rWrtSh, aNewLangTxt, bForSelection, aCoreSet );
[ # # ][ # # ]
378 : : }
379 : :
380 : : // restore selection...
381 [ # # ]: 0 : rWrtSh.Pop( sal_False );
382 : :
383 : 0 : rWrtSh.LockView( sal_False );
384 [ # # ]: 0 : rWrtSh.EndAction();
385 : : }
386 : :
387 : : // invalidate slot to get the new language displayed
388 [ # # ]: 0 : pViewFrame->GetBindings().Invalidate( nSlot );
389 : :
390 [ # # ]: 0 : rReq.Done();
391 [ # # ]: 0 : break;
392 : : }
393 : :
394 : : case SID_THES:
395 : : {
396 : : // replace word/selection with text from selected sub menu entry
397 [ # # ]: 0 : String aReplaceText;
398 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES , sal_False );
399 [ # # ]: 0 : if (pItem2)
400 [ # # ]: 0 : aReplaceText = pItem2->GetValue();
401 [ # # ]: 0 : if (aReplaceText.Len() > 0)
402 : : {
403 : 0 : SwView &rView2 = rWrtSh.GetView();
404 [ # # ]: 0 : const bool bSelection = rWrtSh.HasSelection();
405 [ # # ]: 0 : const String aLookUpText = rView2.GetThesaurusLookUpText( bSelection );
406 [ # # ][ # # ]: 0 : rView2.InsertThesaurusSynonym( aReplaceText, aLookUpText, bSelection );
407 [ # # ]: 0 : }
408 : : }
409 : 0 : break;
410 : :
411 : : case SID_CHARMAP:
412 : : {
413 [ # # ]: 0 : InsertSymbol( rReq );
414 : : }
415 : 0 : break;
416 : : case FN_INSERT_FOOTNOTE:
417 : : case FN_INSERT_ENDNOTE:
418 : : {
419 [ # # ]: 0 : String aStr;
420 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG( rReq, pFont, SfxStringItem, FN_PARAM_1 , sal_False );
421 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, nSlot , sal_False );
422 [ # # ]: 0 : if ( pNameItem )
423 [ # # ]: 0 : aStr = pNameItem->GetValue();
424 [ # # ][ # # ]: 0 : sal_Bool bFont = pFont && pFont->GetValue().Len();
425 [ # # ]: 0 : rWrtSh.StartUndo( UNDO_UI_INSERT_FOOTNOTE );
426 [ # # ]: 0 : rWrtSh.InsertFootnote( aStr, nSlot == FN_INSERT_ENDNOTE, !bFont );
427 [ # # ]: 0 : if ( bFont )
428 : : {
429 [ # # ]: 0 : rWrtSh.Left( CRSR_SKIP_CHARS, sal_True, 1, sal_False );
430 [ # # ][ # # ]: 0 : SfxItemSet aSet( rWrtSh.GetAttrPool(), RES_CHRATR_FONT, RES_CHRATR_FONT );
431 [ # # ]: 0 : rWrtSh.GetCurAttr( aSet );
432 [ # # ]: 0 : SvxFontItem &rFont = (SvxFontItem &) aSet.Get( RES_CHRATR_FONT );
433 : 0 : SvxFontItem aFont( rFont.GetFamily(), pFont->GetValue(),
434 [ # # ]: 0 : rFont.GetStyleName(), rFont.GetPitch(), RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT );
435 [ # # ]: 0 : rWrtSh.SetAttr( aSet, nsSetAttrMode::SETATTR_DONTEXPAND );
436 [ # # ]: 0 : rWrtSh.ResetSelect(0, sal_False);
437 [ # # ]: 0 : rWrtSh.EndSelect();
438 [ # # ][ # # ]: 0 : rWrtSh.GotoFtnTxt();
[ # # ]
439 : : }
440 [ # # ]: 0 : rWrtSh.EndUndo( UNDO_UI_INSERT_FOOTNOTE );
441 [ # # ][ # # ]: 0 : rReq.Done();
442 : : }
443 : 0 : break;
444 : : case FN_INSERT_FOOTNOTE_DLG:
445 : : {
446 [ # # ]: 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
447 : : OSL_ENSURE(pFact, "Dialogdiet fail!");
448 : : AbstractInsFootNoteDlg* pDlg = pFact->CreateInsFootNoteDlg( DLG_INS_FOOTNOTE,
449 [ # # ]: 0 : GetView().GetWindow(), rWrtSh, sal_False );
450 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
451 [ # # ][ # # ]: 0 : pDlg->SetHelpId(GetStaticInterface()->GetSlot(nSlot)->GetCommand());
[ # # ][ # # ]
452 [ # # ][ # # ]: 0 : if ( pDlg->Execute() == RET_OK )
453 : : {
454 [ # # ][ # # ]: 0 : sal_uInt16 nId = pDlg->IsEndNote() ? FN_INSERT_ENDNOTE : FN_INSERT_FOOTNOTE;
455 [ # # ]: 0 : SfxRequest aReq( GetView().GetViewFrame(), nId );
456 [ # # ][ # # ]: 0 : if ( pDlg->GetStr().Len() )
[ # # ]
457 [ # # ][ # # ]: 0 : aReq.AppendItem( SfxStringItem( nId, pDlg->GetStr() ) );
[ # # ][ # # ]
[ # # ]
458 [ # # ][ # # ]: 0 : if ( pDlg->GetFontName().Len() )
[ # # ]
459 [ # # ][ # # ]: 0 : aReq.AppendItem( SfxStringItem( FN_PARAM_1, pDlg->GetFontName() ) );
[ # # ][ # # ]
[ # # ]
460 [ # # ][ # # ]: 0 : ExecuteSlot( aReq );
461 : : }
462 : :
463 [ # # ]: 0 : rReq.Ignore();
464 [ # # ][ # # ]: 0 : delete pDlg;
465 : : }
466 : 0 : break;
467 : : case FN_FORMAT_FOOTNOTE_DLG:
468 : : {
469 [ # # ]: 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
470 : : OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
471 : :
472 [ # # ]: 0 : VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg( GetView().GetWindow(), rWrtSh, DLG_DOC_FOOTNOTE );
473 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
474 [ # # ]: 0 : pDlg->Execute();
475 [ # # ][ # # ]: 0 : delete pDlg;
476 : 0 : break;
477 : : }
478 : : case SID_INSERTDOC:
479 : : {
480 [ # # ]: 0 : GetView().ExecuteInsertDoc( rReq, pItem );
481 : 0 : break;
482 : : }
483 : : case FN_FORMAT_RESET:
484 : : {
485 : : // #i78856, reset all attributes but not the language attributes
486 : : // (for this build an array of all relevant attributes and
487 : : // remove the languages from that)
488 [ # # ]: 0 : std::set<sal_uInt16> aAttribs;
489 : :
490 : : sal_uInt16 aResetableSetRange[] = {
491 : : RES_FRMATR_BEGIN, RES_FRMATR_END-1,
492 : : RES_CHRATR_BEGIN, RES_CHRATR_LANGUAGE - 1,
493 : : RES_CHRATR_LANGUAGE + 1, RES_CHRATR_CJK_LANGUAGE - 1,
494 : : RES_CHRATR_CJK_LANGUAGE + 1, RES_CHRATR_CTL_LANGUAGE - 1,
495 : : RES_CHRATR_CTL_LANGUAGE + 1, RES_CHRATR_END-1,
496 : : RES_PARATR_BEGIN, RES_PARATR_END-1,
497 : : RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY,
498 : : RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
499 : : RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
500 : : 0
501 : 0 : };
502 : 0 : sal_uInt16 *pUShorts = aResetableSetRange;
503 [ # # ]: 0 : while (*pUShorts)
504 : : {
505 : 0 : sal_uInt16 nL = pUShorts[1] - pUShorts[0] + 1;
506 : 0 : sal_uInt16 nE = pUShorts[0];
507 [ # # ]: 0 : for (sal_uInt16 i = 0; i < nL; ++i)
508 [ # # ]: 0 : aAttribs.insert( aAttribs.end(), nE++ );
509 : 0 : pUShorts += 2;
510 : : }
511 : :
512 [ # # ]: 0 : rWrtSh.ResetAttr( aAttribs );
513 [ # # ]: 0 : rReq.Done();
514 : 0 : break;
515 : : }
516 : : case FN_INSERT_BREAK_DLG:
517 : : {
518 : 0 : sal_uInt16 nKind=0, nPageNumber=0;
519 [ # # ]: 0 : String aTemplateName;
520 [ # # ]: 0 : if ( pItem )
521 : : {
522 : 0 : nKind = ((SfxInt16Item*)pItem)->GetValue();
523 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG( rReq, pTemplate, SfxStringItem, FN_PARAM_1 , sal_False );
524 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG( rReq, pNumber, SfxUInt16Item, FN_PARAM_2 , sal_False );
525 [ # # ]: 0 : if ( pTemplate )
526 [ # # ]: 0 : aTemplateName = pTemplate->GetValue();
527 [ # # ]: 0 : if ( pNumber )
528 : 0 : nPageNumber = pNumber->GetValue();
529 : : }
530 : : else
531 : : {
532 [ # # ]: 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
533 : : OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
534 : :
535 [ # # ]: 0 : AbstractSwBreakDlg* pDlg = pFact->CreateSwBreakDlg( GetView().GetWindow(), rWrtSh, DLG_BREAK );
536 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
537 [ # # ][ # # ]: 0 : if ( pDlg->Execute() == RET_OK )
538 : : {
539 [ # # ]: 0 : nKind = pDlg->GetKind();
540 [ # # ][ # # ]: 0 : aTemplateName = pDlg->GetTemplateName();
[ # # ]
541 [ # # ]: 0 : nPageNumber = pDlg->GetPageNumber();
542 [ # # ][ # # ]: 0 : rReq.AppendItem( SfxInt16Item( FN_INSERT_BREAK_DLG, nKind ) );
[ # # ]
543 [ # # ][ # # ]: 0 : rReq.AppendItem( SfxUInt16Item( FN_PARAM_2, nPageNumber ) );
[ # # ]
544 [ # # ][ # # ]: 0 : rReq.AppendItem( SfxStringItem( FN_PARAM_1, aTemplateName ) );
[ # # ]
545 [ # # ]: 0 : rReq.Done();
546 : : }
547 : : else
548 [ # # ]: 0 : rReq.Ignore();
549 [ # # ][ # # ]: 0 : delete pDlg;
550 : : }
551 : :
552 [ # # # # ]: 0 : switch ( nKind )
553 : : {
554 : : case 1 :
555 [ # # ]: 0 : rWrtSh.InsertLineBreak(); break;
556 : : case 2 :
557 [ # # ]: 0 : rWrtSh.InsertColumnBreak(); break;
558 : : case 3 :
559 : : {
560 [ # # ]: 0 : rWrtSh.StartAllAction();
561 [ # # ]: 0 : if( aTemplateName.Len() )
562 [ # # ]: 0 : rWrtSh.InsertPageBreak( &aTemplateName, nPageNumber );
563 : : else
564 [ # # ]: 0 : rWrtSh.InsertPageBreak();
565 [ # # ]: 0 : rWrtSh.EndAllAction();
566 : : }
567 : : }
568 : :
569 [ # # ]: 0 : break;
570 : : }
571 : : case FN_INSERT_BOOKMARK:
572 : : {
573 [ # # ]: 0 : if ( pItem )
574 : : {
575 [ # # ]: 0 : ::rtl::OUString sName = ((SfxStringItem*)pItem)->GetValue();
576 [ # # ][ # # ]: 0 : rWrtSh.SetBookmark( KeyCode(), sName, aEmptyStr );
577 : : }
578 : : else
579 : : {
580 [ # # ]: 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
581 : : OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
582 : :
583 [ # # ]: 0 : VclAbstractDialog* pDlg = pFact->CreateSwInsertBookmarkDlg( GetView().GetWindow(), rWrtSh, rReq, DLG_INSERT_BOOKMARK );
584 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
585 [ # # ]: 0 : pDlg->Execute();
586 [ # # ][ # # ]: 0 : delete pDlg;
587 : : }
588 : :
589 : 0 : break;
590 : : }
591 : : case FN_DELETE_BOOKMARK:
592 : : {
593 [ # # ]: 0 : if ( pItem )
594 : : {
595 [ # # ]: 0 : IDocumentMarkAccess* const pMarkAccess = rWrtSh.getIDocumentMarkAccess();
596 [ # # ][ # # ]: 0 : pMarkAccess->deleteMark( pMarkAccess->findMark(((SfxStringItem*)pItem)->GetValue()) );
[ # # ]
597 : : }
598 : 0 : break;
599 : : }
600 : : case FN_AUTOFORMAT_REDLINE_APPLY:
601 : : {
602 [ # # ][ # # ]: 0 : SvxSwAutoFmtFlags aFlags(SvxAutoCorrCfg::Get().GetAutoCorrect()->GetSwFlags());
603 : : // das muss fuer die Nachbearbeitung immer sal_False sein
604 : 0 : aFlags.bAFmtByInput = sal_False;
605 : 0 : aFlags.bWithRedlining = sal_True;
606 [ # # ]: 0 : rWrtSh.AutoFormat( &aFlags );
607 : 0 : aFlags.bWithRedlining = sal_False;
608 : :
609 : 0 : SfxViewFrame* pVFrame = GetView().GetViewFrame();
610 [ # # ][ # # ]: 0 : if (pVFrame->HasChildWindow(FN_REDLINE_ACCEPT))
611 [ # # ]: 0 : pVFrame->ToggleChildWindow(FN_REDLINE_ACCEPT);
612 : :
613 [ # # ]: 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
614 : : OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
615 : :
616 [ # # ]: 0 : AbstractSwModalRedlineAcceptDlg* pDlg = pFact->CreateSwModalRedlineAcceptDlg( &GetView().GetEditWin(), DLG_MOD_REDLINE_ACCEPT );
617 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
618 : :
619 [ # # ]: 0 : switch (lcl_AskRedlineMode(&GetView().GetEditWin()))
[ # # # # ]
620 : : {
621 : : case RET_OK:
622 : : {
623 [ # # ]: 0 : pDlg->AcceptAll(sal_True);
624 [ # # ]: 0 : SfxRequest aReq( pVFrame, FN_AUTOFORMAT_APPLY );
625 [ # # ]: 0 : aReq.Done();
626 [ # # ]: 0 : rReq.Ignore();
627 [ # # ]: 0 : break;
628 : : }
629 : :
630 : : case RET_CANCEL:
631 [ # # ]: 0 : pDlg->AcceptAll(sal_False);
632 [ # # ]: 0 : rReq.Ignore();
633 : 0 : break;
634 : :
635 : : case 2:
636 [ # # ]: 0 : pDlg->Execute();
637 [ # # ]: 0 : rReq.Done();
638 : 0 : break;
639 : : }
640 [ # # ][ # # ]: 0 : delete pDlg;
[ # # ]
641 : : }
642 : 0 : break;
643 : :
644 : : case FN_AUTOFORMAT_APPLY:
645 : : {
646 [ # # ][ # # ]: 0 : SvxSwAutoFmtFlags aFlags(SvxAutoCorrCfg::Get().GetAutoCorrect()->GetSwFlags());
647 : : // das muss fuer die Nachbearbeitung immer sal_False sein
648 : 0 : aFlags.bAFmtByInput = sal_False;
649 [ # # ]: 0 : rWrtSh.AutoFormat( &aFlags );
650 [ # # ][ # # ]: 0 : rReq.Done();
651 : : }
652 : 0 : break;
653 : : case FN_AUTOFORMAT_AUTO:
654 : : {
655 [ # # ]: 0 : SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get();
656 [ # # ]: 0 : sal_Bool bSet = pItem ? ((const SfxBoolItem*)pItem)->GetValue() : !rACfg.IsAutoFmtByInput();
657 [ # # ]: 0 : if( bSet != rACfg.IsAutoFmtByInput() )
658 : : {
659 [ # # ]: 0 : rACfg.SetAutoFmtByInput( bSet );
660 [ # # ]: 0 : GetView().GetViewFrame()->GetBindings().Invalidate( nSlot );
661 [ # # ]: 0 : if ( !pItem )
662 [ # # ][ # # ]: 0 : rReq.AppendItem( SfxBoolItem( GetPool().GetWhich(nSlot), bSet ) );
[ # # ][ # # ]
663 [ # # ]: 0 : rReq.Done();
664 : : }
665 : : }
666 : 0 : break;
667 : : case FN_AUTO_CORRECT:
668 : : {
669 : : // erstmal auf Blank defaulten
670 : 0 : sal_Unicode cChar = ' ';
671 [ # # ][ # # ]: 0 : rWrtSh.AutoCorrect( *SvxAutoCorrCfg::Get().GetAutoCorrect(), cChar );
672 [ # # ]: 0 : rReq.Done();
673 : : }
674 : 0 : break;
675 : : case FN_TABLE_SORT_DIALOG:
676 : : case FN_SORTING_DLG:
677 : : {
678 [ # # ]: 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
679 : : OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
680 : :
681 [ # # ]: 0 : VclAbstractDialog* pDlg = pFact->CreateVclAbstractDialog( GetView().GetWindow(), rWrtSh, DLG_SORTING );
682 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
683 [ # # ]: 0 : pDlg->Execute();
684 [ # # ][ # # ]: 0 : delete pDlg;
685 [ # # ]: 0 : rReq.Done();
686 : : }
687 : 0 : break;
688 : : case FN_NUMBERING_OUTLINE_DLG:
689 : : {
690 [ # # ]: 0 : SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
691 [ # # ]: 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
692 : : OSL_ENSURE(pFact, "Dialogdiet fail!");
693 : : SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
694 [ # # ]: 0 : GetView().GetWindow(), &aTmp, rWrtSh);
695 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
696 [ # # ]: 0 : pDlg->Execute();
697 [ # # ][ # # ]: 0 : delete pDlg;
698 [ # # ][ # # ]: 0 : rReq.Done();
699 : : }
700 : 0 : break;
701 : : case FN_CALCULATE:
702 : : {
703 [ # # ]: 0 : SwTransferable* pTransfer = new SwTransferable( rWrtSh );
704 : : /*??*/ uno::Reference<
705 : : datatransfer::XTransferable > xRef(
706 [ # # ][ # # ]: 0 : pTransfer );
707 [ # # ]: 0 : pTransfer->CalculateAndCopy();
708 [ # # ]: 0 : rReq.Done();
709 : : }
710 : 0 : break;
711 : : case FN_GOTO_REFERENCE:
712 : : {
713 [ # # ]: 0 : SwField *pFld = rWrtSh.GetCurFld();
714 [ # # ][ # # ]: 0 : if(pFld && pFld->GetTypeId() == TYP_GETREFFLD)
[ # # ][ # # ]
715 : : {
716 [ # # ]: 0 : rWrtSh.StartAllAction();
717 : 0 : rWrtSh.SwCrsrShell::GotoRefMark( ((SwGetRefField*)pFld)->GetSetRefName(),
718 [ # # ]: 0 : ((SwGetRefField*)pFld)->GetSubType(),
719 [ # # ][ # # ]: 0 : ((SwGetRefField*)pFld)->GetSeqNo() );
[ # # ]
720 [ # # ]: 0 : rWrtSh.EndAllAction();
721 [ # # ]: 0 : rReq.Done();
722 : : }
723 : : }
724 : 0 : break;
725 : : case FN_EDIT_FORMULA:
726 : : {
727 [ # # ]: 0 : const sal_uInt16 nId = SwInputChild::GetChildWindowId();
728 : 0 : SfxViewFrame* pVFrame = GetView().GetViewFrame();
729 [ # # ]: 0 : if(pItem)
730 : : {
731 : : //if the ChildWindow is active it has to be removed
732 [ # # ][ # # ]: 0 : if( pVFrame->HasChildWindow( nId ) )
733 : : {
734 [ # # ]: 0 : pVFrame->ToggleChildWindow( nId );
735 [ # # ]: 0 : pVFrame->GetBindings().InvalidateAll( sal_True );
736 : : }
737 : :
738 [ # # ]: 0 : String sFormula(((const SfxStringItem*)pItem)->GetValue());
739 [ # # ]: 0 : SwFldMgr aFldMgr;
740 [ # # ]: 0 : rWrtSh.StartAllAction();
741 : : sal_Bool bDelSel;
742 [ # # ][ # # ]: 0 : if( 0 != (bDelSel = rWrtSh.HasSelection()) )
743 : : {
744 [ # # ]: 0 : rWrtSh.StartUndo( UNDO_START );
745 [ # # ]: 0 : rWrtSh.DelRight();
746 : : }
747 : : else
748 : : {
749 [ # # ]: 0 : rWrtSh.EnterStdMode();
750 : : }
751 : :
752 [ # # ][ # # ]: 0 : if( !bDelSel && aFldMgr.GetCurFld() && TYP_FORMELFLD == aFldMgr.GetCurTypeId() )
[ # # ][ # # ]
[ # # ][ # # ]
753 [ # # ][ # # ]: 0 : aFldMgr.UpdateCurFld( aFldMgr.GetCurFld()->GetFormat(), aEmptyStr, sFormula );
754 [ # # ]: 0 : else if( sFormula.Len() )
755 : : {
756 [ # # ][ # # ]: 0 : if( rWrtSh.IsCrsrInTbl() )
757 : : {
758 [ # # ][ # # ]: 0 : SfxItemSet aSet( rWrtSh.GetAttrPool(), RES_BOXATR_FORMULA, RES_BOXATR_FORMULA );
759 [ # # ][ # # ]: 0 : aSet.Put( SwTblBoxFormula( sFormula ));
[ # # ]
760 [ # # ]: 0 : rWrtSh.SetTblBoxFormulaAttrs( aSet );
761 [ # # ][ # # ]: 0 : rWrtSh.UpdateTable();
762 : : }
763 : : else
764 : : {
765 [ # # ]: 0 : SvNumberFormatter* pFormatter = rWrtSh.GetNumberFormatter();
766 [ # # ]: 0 : sal_uLong nSysNumFmt = pFormatter->GetFormatIndex( NF_NUMBER_STANDARD, LANGUAGE_SYSTEM);
767 [ # # ]: 0 : SwInsertFld_Data aData(TYP_FORMELFLD, nsSwGetSetExpType::GSE_FORMULA, aEmptyStr, sFormula, nSysNumFmt);
768 [ # # ][ # # ]: 0 : aFldMgr.InsertFld(aData);
769 : : }
770 : : }
771 : :
772 [ # # ]: 0 : if( bDelSel )
773 [ # # ]: 0 : rWrtSh.EndUndo( UNDO_END );
774 [ # # ]: 0 : rWrtSh.EndAllAction();
775 [ # # ][ # # ]: 0 : rReq.Done();
[ # # ]
776 : : }
777 : : else
778 : : {
779 [ # # ]: 0 : rWrtSh.EndAllTblBoxEdit();
780 [ # # ]: 0 : pVFrame->ToggleChildWindow( nId );
781 [ # # ][ # # ]: 0 : if( !pVFrame->HasChildWindow( nId ) )
782 [ # # ]: 0 : pVFrame->GetBindings().InvalidateAll( sal_True );
783 [ # # ]: 0 : rReq.Ignore();
784 : : }
785 : : }
786 : :
787 : 0 : break;
788 : : case FN_TABLE_UNSET_READ_ONLY:
789 : : {
790 [ # # ]: 0 : rWrtSh.UnProtectTbls();
791 : : }
792 : 0 : break;
793 : : case FN_EDIT_HYPERLINK:
794 [ # # ]: 0 : GetView().GetViewFrame()->ToggleChildWindow(SID_HYPERLINK_DIALOG);
795 : 0 : break;
796 : : case FN_REMOVE_HYPERLINK:
797 : : {
798 [ # # ]: 0 : sal_Bool bSel = rWrtSh.HasSelection();
799 [ # # ]: 0 : if(!bSel)
800 : : {
801 [ # # ]: 0 : rWrtSh.StartAction();
802 [ # # ]: 0 : rWrtSh.Push();
803 [ # # ][ # # ]: 0 : if(!rWrtSh.SelectTxtAttr( RES_TXTATR_INETFMT ))
804 [ # # ]: 0 : rWrtSh.SelWrd();
805 : : }
806 : : //now remove the attribute
807 [ # # ]: 0 : std::set<sal_uInt16> aAttribs;
808 [ # # ]: 0 : aAttribs.insert( RES_TXTATR_INETFMT );
809 [ # # ]: 0 : rWrtSh.ResetAttr( aAttribs );
810 [ # # ]: 0 : if(!bSel)
811 : : {
812 [ # # ]: 0 : rWrtSh.Pop(sal_False);
813 [ # # ]: 0 : rWrtSh.EndAction();
814 : 0 : }
815 : : }
816 : 0 : break;
817 : : case SID_ATTR_BRUSH_CHAR :
818 : : case SID_ATTR_CHAR_SCALEWIDTH :
819 : : case SID_ATTR_CHAR_ROTATED :
820 : : case FN_TXTATR_INET :
821 : : case FN_INSERT_HYPERLINK:
822 : : {
823 [ # # ]: 0 : sal_uInt16 nWhich = GetPool().GetWhich( nSlot );
824 [ # # ][ # # ]: 0 : if ( pArgs && pArgs->GetItemState( nWhich ) == SFX_ITEM_SET )
[ # # ][ # # ]
825 : 0 : bUseDialog = sal_False;
826 : : // intentionally no break
827 : : }
828 : : case SID_CHAR_DLG:
829 : : {
830 [ # # ]: 0 : lcl_CharDialog( rWrtSh, bUseDialog, nSlot, pArgs, &rReq );
831 : : }
832 : 0 : break;
833 : : case SID_CHAR_DLG_FOR_PARAGRAPH:
834 : : {
835 [ # # ]: 0 : rWrtSh.Push(); //save current cursor
836 [ # # ]: 0 : SwLangHelper::SelectCurrentPara( rWrtSh );
837 [ # # ]: 0 : lcl_CharDialog( rWrtSh, bUseDialog, nSlot, pArgs, &rReq );
838 [ # # ]: 0 : rWrtSh.Pop( sal_False ); //restore old cursor
839 : : }
840 : 0 : break;
841 : : case SID_ATTR_LRSPACE :
842 : : case SID_ATTR_ULSPACE :
843 : : case SID_ATTR_BRUSH :
844 : : case SID_PARA_VERTALIGN :
845 : : case SID_ATTR_PARA_NUMRULE :
846 : : case SID_ATTR_PARA_REGISTER :
847 : : case SID_ATTR_PARA_PAGENUM :
848 : : case FN_FORMAT_LINENUMBER :
849 : : case FN_NUMBER_NEWSTART :
850 : : case FN_NUMBER_NEWSTART_AT :
851 : : case FN_FORMAT_DROPCAPS :
852 : : case FN_DROP_TEXT:
853 : : {
854 [ # # ]: 0 : sal_uInt16 nWhich = GetPool().GetWhich( nSlot );
855 [ # # ][ # # ]: 0 : if ( pArgs && pArgs->GetItemState( nWhich ) == SFX_ITEM_SET )
[ # # ][ # # ]
856 : 0 : bUseDialog = sal_False;
857 : : // intentionally no break
858 : :
859 : : }
860 : : case SID_PARA_DLG:
861 : : {
862 : 0 : SwPaM* pPaM = NULL;
863 : :
864 [ # # ]: 0 : if ( pArgs )
865 : : {
866 : 0 : const SfxPoolItem* pPaMItem = 0;
867 [ # # ][ # # ]: 0 : pArgs->GetItemState( GetPool().GetWhich( FN_PARAM_PAM ), sal_False, &pPaMItem );
868 [ # # ]: 0 : if ( pPaMItem )
869 : 0 : pPaM = static_cast< const SwPaMItem* >( pPaMItem )->GetValue( );
870 : : }
871 : :
872 [ # # ]: 0 : if ( !pPaM )
873 [ # # ]: 0 : pPaM = rWrtSh.GetCrsr();
874 : :
875 : 0 : bool bUseCurCrsr = true;
876 : :
877 [ # # ][ # # ]: 0 : FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView()));
[ # # ][ # # ]
[ # # ][ # # ]
878 [ # # ][ # # ]: 0 : SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
[ # # ][ # # ]
879 : :
880 [ # # ][ # # ]: 0 : sal_Bool bApplyCharUnit = ::HasCharUnit(0 != PTR_CAST(SwWebView, &GetView()));
[ # # ][ # # ]
[ # # ][ # # ]
881 [ # # ][ # # ]: 0 : SW_MOD()->PutItem(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, bApplyCharUnit));
[ # # ][ # # ]
882 : :
883 : 0 : SfxItemSet aCoreSet( GetPool(),
884 : : RES_PARATR_BEGIN, RES_PARATR_END - 1,
885 : : RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1,
886 : : RES_FRMATR_BEGIN, RES_FRMATR_END - 1,
887 : : SID_ATTR_TABSTOP_POS, SID_ATTR_TABSTOP_POS,
888 : : SID_ATTR_TABSTOP_DEFAULTS, SID_ATTR_TABSTOP_DEFAULTS,
889 : : SID_ATTR_TABSTOP_OFFSET, SID_ATTR_TABSTOP_OFFSET,
890 : : SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
891 : : SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP,
892 : : SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM,
893 : : SID_HTML_MODE, SID_HTML_MODE,
894 : : FN_PARAM_1, FN_PARAM_1,
895 : : FN_NUMBER_NEWSTART, FN_NUMBER_NEWSTART_AT,
896 : : FN_DROP_TEXT, FN_DROP_CHAR_STYLE_NAME,
897 [ # # ]: 0 : 0);
898 : : // get also the list level indent values merged as LR-SPACE item, if needed.
899 [ # # ]: 0 : rWrtSh.GetPaMAttr( pPaM, aCoreSet, true );
900 : : aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE,
901 [ # # ][ # # ]: 0 : ::GetHtmlMode(GetView().GetDocShell())));
[ # # ][ # # ]
[ # # ]
902 : :
903 : : // Tabulatoren, DefaultTabs ins ItemSet Stecken
904 : : const SvxTabStopItem& rDefTabs = (const SvxTabStopItem&)
905 [ # # ]: 0 : GetPool().GetDefaultItem(RES_PARATR_TABSTOP);
906 : :
907 [ # # ]: 0 : sal_uInt16 nDefDist = ::GetTabDist( rDefTabs );
908 [ # # ]: 0 : SfxUInt16Item aDefDistItem( SID_ATTR_TABSTOP_DEFAULTS, nDefDist );
909 [ # # ]: 0 : aCoreSet.Put( aDefDistItem );
910 : :
911 : : // Aktueller Tab
912 [ # # ]: 0 : SfxUInt16Item aTabPos( SID_ATTR_TABSTOP_POS, 0 );
913 [ # # ]: 0 : aCoreSet.Put( aTabPos );
914 : :
915 : : // linker Rand als Offset
916 : : //#i24363# tab stops relative to indent
917 [ # # ][ # # ]: 0 : const long nOff = rWrtSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT) ?
918 [ # # ][ # # ]: 0 : ((SvxLRSpaceItem&)aCoreSet.Get( RES_LR_SPACE )).GetTxtLeft() : 0;
919 [ # # ]: 0 : SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff );
920 [ # # ]: 0 : aCoreSet.Put( aOff );
921 : :
922 : : // Setting the BoxInfo if based on the current cursor
923 [ # # ]: 0 : if ( bUseCurCrsr )
924 [ # # ]: 0 : ::PrepareBoxInfo( aCoreSet, rWrtSh );
925 : :
926 : : //aktuelles Seitenformat
927 [ # # ]: 0 : ::SwToSfxPageDescAttr( aCoreSet );
928 : :
929 : 0 : sal_uInt16 nDefPage = 0;
930 [ # # ]: 0 : if( pItem )
931 : 0 : nDefPage = ((SfxUInt16Item *)pItem)->GetValue();
932 : :
933 : : // Numerierungseigenschaften
934 [ # # ][ # # ]: 0 : if( rWrtSh.GetDoc()->GetCurrNumRule( *pPaM->GetPoint() ) )
935 : : {
936 [ # # ][ # # ]: 0 : SfxBoolItem aStart( FN_NUMBER_NEWSTART, rWrtSh.IsNumRuleStart( pPaM ) );
937 [ # # ]: 0 : aCoreSet.Put(aStart);
938 : : SfxUInt16Item aStartAt( FN_NUMBER_NEWSTART_AT,
939 [ # # ][ # # ]: 0 : rWrtSh.GetNodeNumStart( pPaM ) );
940 [ # # ][ # # ]: 0 : aCoreSet.Put(aStartAt);
[ # # ]
941 : : }
942 : 0 : SfxAbstractTabDialog* pDlg = NULL;
943 : :
944 [ # # ][ # # ]: 0 : if ( bUseDialog && GetActiveView() )
[ # # ][ # # ]
945 : : {
946 [ # # ]: 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
947 : : OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
948 : :
949 [ # # ]: 0 : pDlg = pFact->CreateSwParaDlg( GetView().GetWindow(),GetView(), aCoreSet,DLG_STD, DLG_PARA,NULL, sal_False, nDefPage );
950 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
951 : : }
952 : 0 : SfxItemSet* pSet = NULL;
953 [ # # ]: 0 : if ( !bUseDialog )
954 : : {
955 : 0 : pSet = (SfxItemSet*) pArgs;
956 : :
957 : : }
958 [ # # ][ # # ]: 0 : else if ( NULL != pDlg && pDlg->Execute() == RET_OK )
[ # # ][ # # ]
959 : : {
960 : : // Defaults evtl umsetzen
961 [ # # ]: 0 : pSet = (SfxItemSet*)pDlg->GetOutputItemSet();
962 : : sal_uInt16 nNewDist;
963 [ # # ]: 0 : if( SFX_ITEM_SET == pSet->GetItemState( SID_ATTR_TABSTOP_DEFAULTS, sal_False, &pItem ) &&
[ # # # # ]
[ # # ]
964 : 0 : nDefDist != (nNewDist = ((SfxUInt16Item*)pItem)->GetValue()) )
965 : : {
966 [ # # ]: 0 : SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
967 [ # # ]: 0 : MakeDefTabs( nNewDist, aDefTabs );
968 [ # # ]: 0 : rWrtSh.SetDefault( aDefTabs );
969 [ # # ][ # # ]: 0 : pSet->ClearItem( SID_ATTR_TABSTOP_DEFAULTS );
970 : : }
971 : :
972 [ # # ][ # # ]: 0 : if ( SFX_ITEM_SET == pSet->GetItemState(FN_PARAM_1,sal_False,&pItem) )
973 : : {
974 [ # # ][ # # ]: 0 : pSet->Put(SfxStringItem(FN_DROP_TEXT, ((const SfxStringItem*)pItem)->GetValue()));
[ # # ]
975 [ # # ]: 0 : pSet->ClearItem(FN_PARAM_1);
976 : : }
977 : :
978 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET == pSet->GetItemState( RES_PARATR_DROP, sal_False, &pItem ))
979 : : {
980 [ # # ]: 0 : String sCharStyleName;
981 [ # # ]: 0 : if(((const SwFmtDrop*)pItem)->GetCharFmt())
982 [ # # ]: 0 : sCharStyleName = ((const SwFmtDrop*)pItem)->GetCharFmt()->GetName();
983 [ # # ][ # # ]: 0 : pSet->Put(SfxStringItem(FN_DROP_CHAR_STYLE_NAME, sCharStyleName));
[ # # ][ # # ]
984 : : }
985 : : }
986 : :
987 [ # # ]: 0 : if ( pSet )
988 : : {
989 [ # # ]: 0 : rReq.Done( *pSet );
990 [ # # ]: 0 : ::SfxToSwPageDescAttr( rWrtSh, *pSet );
991 : : // #i56253#
992 : : // enclose all undos.
993 : : // Thus, check conditions, if actions will be performed.
994 : 0 : const bool bUndoNeeded( pSet->Count() ||
995 [ # # ]: 0 : SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART) ||
996 [ # # ][ # # ]: 0 : SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) );
[ # # ][ # # ]
997 [ # # ]: 0 : if ( bUndoNeeded )
998 : : {
999 [ # # ]: 0 : rWrtSh.StartUndo( UNDO_INSATTR );
1000 : : }
1001 [ # # ]: 0 : if( pSet->Count() )
1002 : : {
1003 [ # # ]: 0 : rWrtSh.StartAction();
1004 [ # # ][ # # ]: 0 : if ( SFX_ITEM_SET == pSet->GetItemState(FN_DROP_TEXT, sal_False, &pItem) )
1005 : : {
1006 [ # # ]: 0 : if ( ((SfxStringItem*)pItem)->GetValue().Len() )
1007 [ # # ]: 0 : rWrtSh.ReplaceDropTxt(((SfxStringItem*)pItem)->GetValue(), pPaM);
1008 : : }
1009 [ # # ]: 0 : rWrtSh.SetAttr( *pSet, 0, pPaM );
1010 [ # # ]: 0 : rWrtSh.EndAction();
1011 [ # # ]: 0 : SwTxtFmtColl* pColl = rWrtSh.GetPaMTxtFmtColl( pPaM );
1012 [ # # ][ # # ]: 0 : if(pColl && pColl->IsAutoUpdateFmt())
[ # # ]
1013 : : {
1014 [ # # ]: 0 : rWrtSh.AutoUpdatePara(pColl, *pSet, pPaM);
1015 : : }
1016 : : }
1017 : :
1018 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART) )
1019 : : {
1020 : : //SetNumRuleStart(sal_True) restarts the numbering at the value
1021 : : //that is defined at the starting point of the numbering level
1022 : : //otherwise the SetNodeNumStart() value determines the start
1023 : : //if it's set to something different than USHRT_MAX
1024 : :
1025 [ # # ]: 0 : sal_Bool bStart = ((SfxBoolItem&)pSet->Get(FN_NUMBER_NEWSTART)).GetValue();
1026 : : //
1027 : : // Default value for restart value has to be USHRT_MAX
1028 : : // in order to indicate that the restart value of the list
1029 : : // style has to be used on restart.
1030 : 0 : sal_uInt16 nNumStart = USHRT_MAX;
1031 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
1032 : : {
1033 [ # # ]: 0 : nNumStart = ((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue();
1034 : : }
1035 [ # # ]: 0 : rWrtSh.SetNumRuleStart(bStart, pPaM);
1036 [ # # ]: 0 : rWrtSh.SetNodeNumStart(nNumStart);
1037 : : }
1038 [ # # ][ # # ]: 0 : else if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
1039 : : {
1040 [ # # ]: 0 : sal_uInt16 nNumStart = ((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue();
1041 [ # # ]: 0 : rWrtSh.SetNodeNumStart(nNumStart);
1042 [ # # ]: 0 : rWrtSh.SetNumRuleStart(sal_False, pPaM);
1043 : : }
1044 : : // #i56253#
1045 [ # # ]: 0 : if ( bUndoNeeded )
1046 : : {
1047 [ # # ]: 0 : rWrtSh.EndUndo( UNDO_INSATTR );
1048 : : }
1049 : : }
1050 : :
1051 [ # # ][ # # ]: 0 : delete pDlg;
[ # # ][ # # ]
[ # # ][ # # ]
1052 : : }
1053 : 0 : break;
1054 : : case FN_NUM_CONTINUE:
1055 : : {
1056 [ # # ]: 0 : String sContinuedListId;
1057 : : const SwNumRule* pRule =
1058 [ # # ]: 0 : rWrtSh.SearchNumRule( false, true, false, -1, sContinuedListId );
1059 : : // #i86492#
1060 : : // Search also for bullet list
1061 [ # # ]: 0 : if ( !pRule )
1062 : : {
1063 [ # # ]: 0 : pRule = rWrtSh.SearchNumRule( false, false, false, -1, sContinuedListId );
1064 : : }
1065 [ # # ]: 0 : if ( pRule )
1066 : : {
1067 [ # # ][ # # ]: 0 : rWrtSh.SetCurNumRule( *pRule, false, sContinuedListId );
[ # # ]
1068 [ # # ]: 0 : }
1069 : : }
1070 : 0 : break;
1071 : : case FN_SELECT_PARA:
1072 : : {
1073 [ # # ][ # # ]: 0 : if(!rWrtSh.IsSttOfPara())
1074 [ # # ]: 0 : rWrtSh.SttPara(sal_False);
1075 : : else
1076 [ # # ]: 0 : rWrtSh.EnterStdMode();
1077 [ # # ]: 0 : rWrtSh.EndPara(sal_True);
1078 : : }
1079 : 0 : break;
1080 : :
1081 : : case SID_DEC_INDENT:
1082 : : case SID_INC_INDENT:
1083 : : rWrtSh.MoveLeftMargin( SID_INC_INDENT == nSlot,
1084 [ # # ][ # # ]: 0 : rReq.GetModifier() != KEY_MOD1 );
1085 [ # # ]: 0 : rReq.Done();
1086 : 0 : break;
1087 : : case FN_DEC_INDENT_OFFSET:
1088 : : case FN_INC_INDENT_OFFSET:
1089 : : rWrtSh.MoveLeftMargin( FN_INC_INDENT_OFFSET == nSlot,
1090 [ # # ][ # # ]: 0 : rReq.GetModifier() == KEY_MOD1 );
1091 [ # # ]: 0 : rReq.Done();
1092 : 0 : break;
1093 : :
1094 : : case SID_ATTR_CHAR_COLOR2:
1095 : : {
1096 [ # # ]: 0 : if(pItem)
1097 : : {
1098 : 0 : Color aSet = ((const SvxColorItem*)pItem)->GetValue();
1099 : 0 : SwEditWin& rEditWin = GetView().GetEditWin();
1100 : 0 : rEditWin.SetTextColor(aSet);
1101 : 0 : SwApplyTemplate* pApply = rEditWin.GetApplyTemplate();
1102 : :
1103 : : // If there is a selection, then set the color on it
1104 : : // otherwise, it'll be the color for the next text to be typed
1105 [ # # ][ # # ]: 0 : if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_EXT)
1106 : : {
1107 [ # # ][ # # ]: 0 : rWrtSh.SetAttr(SvxColorItem (aSet, RES_CHRATR_COLOR));
[ # # ]
1108 : : }
1109 : :
1110 [ # # ]: 0 : rReq.Done();
1111 : : }
1112 : : }
1113 : 0 : break;
1114 : : case SID_ATTR_CHAR_COLOR_BACKGROUND:
1115 : : {
1116 : 0 : SwEditWin& rEdtWin = GetView().GetEditWin();
1117 : 0 : SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
1118 : 0 : rEdtWin.SetTextBackColorTransparent(0 == pItem);
1119 : 0 : Color aSet;
1120 [ # # ]: 0 : if(pItem)
1121 : : {
1122 : 0 : aSet = ((const SvxColorItem*)pItem)->GetValue();
1123 : 0 : rEdtWin.SetTextBackColor(aSet); //select last color
1124 : : }
1125 : : else
1126 : 0 : rEdtWin.SetTextBackColor(Color(COL_TRANSPARENT)); //if last was "no fill"
1127 [ # # ][ # # ]: 0 : if(!pApply && (rWrtSh.HasSelection() || rReq.IsAPI()))
[ # # ][ # # ]
[ # # ][ # # ]
1128 : : {
1129 [ # # ]: 0 : SvxBrushItem aBrushItem(RES_CHRATR_BACKGROUND);
1130 [ # # ]: 0 : if(pItem)
1131 : 0 : aBrushItem.SetColor(aSet); //set the selected color
1132 : : else
1133 : 0 : aBrushItem.SetColor(Color(COL_TRANSPARENT));//set "no fill" color
1134 [ # # ][ # # ]: 0 : rWrtSh.SetAttr( aBrushItem );
1135 : : }
1136 [ # # ][ # # ]: 0 : else if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_BACKGROUND_EXT)
1137 : : {
1138 [ # # ]: 0 : GetView().GetViewFrame()->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR_BACKGROUND_EXT);
1139 : : }
1140 : :
1141 [ # # ]: 0 : rReq.Done();
1142 : :
1143 : : }
1144 : 0 : break;
1145 : : case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT:
1146 : : case SID_ATTR_CHAR_COLOR_EXT:
1147 : : {
1148 : 0 : SwEditWin& rEdtWin = GetView().GetEditWin();
1149 : 0 : SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
1150 : 0 : SwApplyTemplate aTempl;
1151 [ # # ]: 0 : sal_Bool bSelection = rWrtSh.HasSelection();
1152 [ # # ]: 0 : if(bSelection)
1153 : : {
1154 : :
1155 [ # # ]: 0 : if(nSlot == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT)
1156 : : {
1157 : : rWrtSh.SetAttr( SvxBrushItem(
1158 [ # # ][ # # ]: 0 : rEdtWin.GetTextBackColor(), RES_CHRATR_BACKGROUND) );
[ # # ]
1159 : : }
1160 : : else
1161 : : rWrtSh.SetAttr( SvxColorItem( rEdtWin.GetTextColor(),
1162 [ # # ][ # # ]: 0 : RES_CHRATR_COLOR) );
[ # # ]
1163 : : }
1164 : : else
1165 : : {
1166 [ # # ][ # # ]: 0 : if(!pApply || pApply->nColor != nSlot)
1167 : 0 : aTempl.nColor = nSlot;
1168 [ # # ]: 0 : rEdtWin.SetApplyTemplate(aTempl);
1169 : : }
1170 : :
1171 [ # # ]: 0 : rReq.Done();
1172 : : }
1173 : 0 : break;
1174 : :
1175 : : case FN_NUM_BULLET_MOVEDOWN:
1176 [ # # ]: 0 : if (!rWrtSh.IsAddMode())
1177 [ # # ]: 0 : rWrtSh.MoveParagraph(1);
1178 [ # # ]: 0 : rReq.Done();
1179 : 0 : break;
1180 : :
1181 : : case FN_NUM_BULLET_MOVEUP:
1182 [ # # ]: 0 : if (!rWrtSh.IsAddMode())
1183 [ # # ]: 0 : rWrtSh.MoveParagraph(-1);
1184 [ # # ]: 0 : rReq.Done();
1185 : 0 : break;
1186 : : case SID_RUBY_DIALOG:
1187 : : case SID_HYPERLINK_DIALOG:
1188 : : {
1189 [ # # ][ # # ]: 0 : SfxRequest aReq(nSlot, SFX_CALLMODE_SLOT, SFX_APP()->GetPool());
1190 [ # # ]: 0 : GetView().GetViewFrame()->ExecuteSlot( aReq);
1191 [ # # ][ # # ]: 0 : rReq.Ignore();
1192 : : }
1193 : 0 : break;
1194 : : case FN_INSERT_PAGEHEADER:
1195 : : case FN_INSERT_PAGEFOOTER:
1196 [ # # ][ # # ]: 0 : if(pArgs && pArgs->Count())
[ # # ]
1197 : : {
1198 [ # # ]: 0 : String sStyleName;
1199 [ # # ]: 0 : if(pItem)
1200 [ # # ]: 0 : sStyleName = ((const SfxStringItem*)pItem)->GetValue();
1201 : 0 : sal_Bool bOn = sal_True;
1202 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_1, sal_False, &pItem))
1203 : 0 : bOn = ((const SfxBoolItem*)pItem)->GetValue();
1204 [ # # ][ # # ]: 0 : rWrtSh.ChangeHeaderOrFooter(sStyleName, FN_INSERT_PAGEHEADER == nSlot, bOn, !rReq.IsAPI());
1205 [ # # ][ # # ]: 0 : rReq.Done();
1206 : : }
1207 : 0 : break;
1208 : : case FN_READONLY_SELECTION_MODE :
1209 [ # # ][ # # ]: 0 : if(GetView().GetDocShell()->IsReadOnly())
[ # # ]
1210 : : {
1211 : : rWrtSh.SetReadonlySelectionOption(
1212 [ # # ]: 0 : !rWrtSh.GetViewOptions()->IsSelectionInReadonly());
1213 [ # # ]: 0 : rWrtSh.ShowCrsr();
1214 : : }
1215 : 0 : break;
1216 : : case FN_SELECTION_MODE_DEFAULT:
1217 : : case FN_SELECTION_MODE_BLOCK :
1218 : : {
1219 : 0 : bool bSetBlockMode = !rWrtSh.IsBlockMode();
1220 [ # # ][ # # ]: 0 : if( pArgs && SFX_ITEM_SET == pArgs->GetItemState(nSlot, sal_False, &pItem))
[ # # ][ # # ]
1221 : 0 : bSetBlockMode = ((const SfxBoolItem*)pItem)->GetValue();
1222 [ # # ]: 0 : if( ( nSlot == FN_SELECTION_MODE_DEFAULT ) ^ bSetBlockMode )
1223 [ # # ]: 0 : rWrtSh.EnterBlockMode();
1224 : : else
1225 [ # # ]: 0 : rWrtSh.EnterStdMode();
1226 : 0 : SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings();
1227 [ # # ]: 0 : rBnd.Invalidate(FN_STAT_SELMODE);
1228 [ # # ]: 0 : rBnd.Update(FN_STAT_SELMODE);
1229 : : }
1230 : 0 : break;
1231 : : case SID_OPEN_HYPERLINK:
1232 : : case FN_COPY_HYPERLINK_LOCATION:
1233 : : {
1234 : 0 : SfxItemSet aSet(GetPool(),
1235 : : RES_TXTATR_INETFMT,
1236 [ # # ]: 0 : RES_TXTATR_INETFMT);
1237 [ # # ]: 0 : rWrtSh.GetCurAttr(aSet);
1238 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET <= aSet.GetItemState( RES_TXTATR_INETFMT, sal_True ))
1239 : : {
1240 [ # # ][ # # ]: 0 : const SwFmtINetFmt& rINetFmt = dynamic_cast<const SwFmtINetFmt&>( aSet.Get(RES_TXTATR_INETFMT, sal_True) );
1241 [ # # ]: 0 : if( nSlot == FN_COPY_HYPERLINK_LOCATION )
1242 : : {
1243 [ # # ]: 0 : ::uno::Reference< datatransfer::clipboard::XClipboard > xClipboard = GetView().GetEditWin().GetClipboard();
1244 : : vcl::unohelper::TextDataObject::CopyStringTo(
1245 : 0 : rINetFmt.GetValue(),
1246 [ # # ]: 0 : xClipboard );
1247 : : }
1248 : : else
1249 [ # # ]: 0 : rWrtSh.ClickToINetAttr(rINetFmt, URLLOAD_NOFILTER);
1250 [ # # ]: 0 : }
1251 : : }
1252 : 0 : break;
1253 : : case SID_OPEN_XML_FILTERSETTINGS:
1254 : : {
1255 : : try
1256 : : {
1257 [ # # ][ # # ]: 0 : uno::Reference < ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ui.XSLTFilterDialog"))), uno::UNO_QUERY);
[ # # ][ # # ]
[ # # ]
1258 [ # # ]: 0 : if( xDialog.is() )
1259 : : {
1260 [ # # ][ # # ]: 0 : xDialog->execute();
1261 [ # # ]: 0 : }
1262 : : }
1263 [ # # ]: 0 : catch (const uno::Exception&)
1264 : : {
1265 : : }
1266 [ # # ]: 0 : rReq.Ignore ();
1267 : : }
1268 : 0 : break;
1269 : : case FN_FORMAT_APPLY_HEAD1:
1270 : : {
1271 : : }
1272 : 0 : break;
1273 : : case FN_FORMAT_APPLY_HEAD2:
1274 : : {
1275 : : }
1276 : 0 : break;
1277 : : case FN_FORMAT_APPLY_HEAD3:
1278 : : {
1279 : : }
1280 : 0 : break;
1281 : : case FN_FORMAT_APPLY_DEFAULT:
1282 : : {
1283 : : }
1284 : 0 : break;
1285 : : case FN_FORMAT_APPLY_TEXTBODY:
1286 : : {
1287 : : }
1288 : 0 : break;
1289 : : case FN_WORDCOUNT_DIALOG:
1290 : : {
1291 : 0 : SfxViewFrame* pVFrame = GetView().GetViewFrame();
1292 [ # # ]: 0 : if (pVFrame != NULL)
1293 : : {
1294 [ # # ]: 0 : pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG);
1295 [ # # ]: 0 : Invalidate(rReq.GetSlot());
1296 : :
1297 [ # # ][ # # ]: 0 : SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId());
1298 [ # # ]: 0 : if (pWrdCnt)
1299 [ # # ]: 0 : pWrdCnt->UpdateCounts();
1300 : : }
1301 : : }
1302 : 0 : break;
1303 : : default:
1304 : : OSL_ENSURE(!this, "wrong dispatcher");
1305 : 0 : return;
1306 : : }
1307 : : }
1308 : :
1309 : 8867 : void SwTextShell::GetState( SfxItemSet &rSet )
1310 : : {
1311 [ + - ]: 8867 : SwWrtShell &rSh = GetShell();
1312 [ + - ]: 8867 : SfxWhichIter aIter( rSet );
1313 [ + - ]: 8867 : sal_uInt16 nWhich = aIter.FirstWhich();
1314 [ + + ]: 23704 : while ( nWhich )
1315 : : {
1316 [ + - - + : 14837 : switch ( nWhich )
- + - - -
+ + - + +
+ + - + -
+ + - - +
- - - - -
+ ]
1317 : : {
1318 : : case SID_LANGUAGE_STATUS:
1319 : : {
1320 : : // the value of used script types
1321 [ + - ][ + - ]: 598 : String aScriptTypesInUse( String::CreateFromInt32( rSh.GetScriptType() ) );
1322 : :
1323 [ + - ]: 598 : SvtLanguageTable aLangTable;
1324 : :
1325 : : // get keyboard language
1326 [ + - ]: 598 : String aKeyboardLang;
1327 : 598 : LanguageType nLang = LANGUAGE_DONTKNOW;
1328 : 598 : SwEditWin& rEditWin = GetView().GetEditWin();
1329 [ + - ]: 598 : nLang = rEditWin.GetInputLanguage();
1330 [ - + ][ # # ]: 598 : if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
1331 [ # # ][ # # ]: 0 : aKeyboardLang = aLangTable.GetString( nLang );
1332 : :
1333 : : // get the language that is in use
1334 [ + - ]: 598 : String aCurrentLang = rtl::OUString("*");
1335 [ + - ]: 598 : nLang = SwLangHelper::GetCurrentLanguage( rSh );
1336 [ + - ]: 598 : if (nLang != LANGUAGE_DONTKNOW)
1337 [ + - ][ + - ]: 598 : aCurrentLang = aLangTable.GetString( nLang );
1338 : :
1339 : : // build sequence for status value
1340 [ + - ]: 598 : uno::Sequence< ::rtl::OUString > aSeq( 4 );
1341 [ + - ][ + - ]: 598 : aSeq[0] = aCurrentLang;
1342 [ + - ][ + - ]: 598 : aSeq[1] = aScriptTypesInUse;
1343 [ + - ][ + - ]: 598 : aSeq[2] = aKeyboardLang;
1344 [ + - ][ + - ]: 598 : aSeq[3] = SwLangHelper::GetTextForLanguageGuessing( rSh );
[ + - ][ + - ]
1345 : :
1346 : : // set sequence as status value
1347 [ + - ]: 598 : SfxStringListItem aItem( SID_LANGUAGE_STATUS );
1348 [ + - ]: 598 : aItem.SetStringList( aSeq );
1349 [ + - ][ + - ]: 598 : rSet.Put( aItem, SID_LANGUAGE_STATUS );
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ]
1350 : : }
1351 : 598 : break;
1352 : :
1353 : : case SID_THES:
1354 : : {
1355 : : // is there a valid selection to get text from?
1356 [ # # ]: 0 : String aText;
1357 [ # # ]: 0 : sal_Bool bValid = !rSh.HasSelection() ||
1358 [ # # ][ # # ]: 0 : (rSh.IsSelOnePara() && !rSh.IsMultiSelection());
[ # # ]
1359 : : // prevent context menu from showing when cursor is not in or at the end of a word
1360 : : // (GetCurWord will return the next word if there is none at the current position...)
1361 : 0 : const sal_Int16 nWordType = ::i18n::WordType::DICTIONARY_WORD;
1362 [ # # ][ # # ]: 0 : bool bWord = rSh.IsInWord( nWordType ) || rSh.IsStartWord( nWordType ) || rSh.IsEndWord( nWordType );
[ # # ][ # # ]
[ # # ][ # # ]
1363 [ # # ][ # # ]: 0 : if (bValid && bWord)
1364 [ # # ][ # # ]: 0 : aText = rSh.HasSelection()? rSh.GetSelTxt() : rSh.GetCurWord();
[ # # ][ # # ]
[ # # ][ # # ]
1365 : :
1366 [ # # ]: 0 : LanguageType nLang = rSh.GetCurLang();
1367 [ # # ]: 0 : lang::Locale aLocale = SvxCreateLocale( nLang );
1368 [ # # ][ # # ]: 0 : String aLangText( MsLangId::convertLanguageToIsoString( nLang ) );
1369 : :
1370 : : // set word and locale to look up as status value
1371 [ # # ]: 0 : String aStatusVal( aText );
1372 [ # # ]: 0 : aStatusVal.AppendAscii( "#" );
1373 [ # # ]: 0 : aStatusVal += aLangText;
1374 : :
1375 [ # # ][ # # ]: 0 : rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
[ # # ]
1376 : :
1377 : : // disable "Thesaurus" context menu entry if there is nothing to look up
1378 [ # # ]: 0 : uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
1379 [ # # # # ]: 0 : if (aText.Len() == 0 ||
[ # # ][ # # ]
[ # # ]
1380 [ # # ][ # # ]: 0 : !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale ))
1381 [ # # ][ # # ]: 0 : rSet.DisableItem( SID_THES );
[ # # ][ # # ]
1382 : : }
1383 : 0 : break;
1384 : :
1385 : : case FN_NUMBER_NEWSTART :
1386 [ # # ][ # # ]: 0 : if(!rSh.GetCurNumRule())
1387 [ # # ]: 0 : rSet.DisableItem(nWhich);
1388 : : else
1389 : : rSet.Put(SfxBoolItem(FN_NUMBER_NEWSTART,
1390 [ # # ][ # # ]: 0 : rSh.IsNumRuleStart()));
[ # # ][ # # ]
1391 : 0 : break;
1392 : : case FN_EDIT_FORMULA:
1393 : : case SID_CHARMAP:
1394 : : {
1395 [ + - ]: 2 : const int nType = rSh.GetSelectionType();
1396 [ - + ][ # # ]: 2 : if (!(nType & nsSelectionType::SEL_TXT) &&
[ # # ]
1397 : 0 : !(nType & nsSelectionType::SEL_TBL) &&
1398 : 0 : !(nType & nsSelectionType::SEL_NUM))
1399 [ # # ]: 0 : rSet.DisableItem(nWhich);
1400 : : }
1401 : 2 : break;
1402 : :
1403 : : case FN_INSERT_ENDNOTE:
1404 : : case FN_INSERT_FOOTNOTE:
1405 : : case FN_INSERT_FOOTNOTE_DLG:
1406 : : {
1407 : : const sal_uInt16 nNoType = FRMTYPE_FLY_ANY | FRMTYPE_HEADER |
1408 : 0 : FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE;
1409 [ # # ][ # # ]: 0 : if ( (rSh.GetFrmType(0,sal_True) & nNoType) )
1410 [ # # ]: 0 : rSet.DisableItem(nWhich);
1411 : : }
1412 : 0 : break;
1413 : : case FN_INSERT_TABLE:
1414 [ + - ][ + - ]: 2664 : if ( rSh.GetTableFmt() ||
[ - + ][ - + ]
1415 [ + - ]: 1332 : (rSh.GetFrmType(0,sal_True) & FRMTYPE_FOOTNOTE) )
1416 [ # # ]: 0 : rSet.DisableItem( nWhich );
1417 : 1332 : break;
1418 : :
1419 : : case FN_CALCULATE:
1420 [ # # ]: 0 : if ( !rSh.IsSelection() )
1421 [ # # ]: 0 : rSet.DisableItem(nWhich);
1422 : 0 : break;
1423 : : case FN_GOTO_REFERENCE:
1424 : : {
1425 [ # # ]: 0 : SwField *pFld = rSh.GetCurFld();
1426 [ # # ][ # # ]: 0 : if ( !pFld || (pFld && pFld->GetTypeId() != TYP_GETREFFLD) )
[ # # ][ # # ]
[ # # ]
1427 [ # # ]: 0 : rSet.DisableItem(nWhich);
1428 : : }
1429 : 0 : break;
1430 : : case FN_AUTOFORMAT_AUTO:
1431 : : {
1432 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( nWhich, SvxAutoCorrCfg::Get().IsAutoFmtByInput() ));
[ # # ][ # # ]
1433 : : }
1434 : 0 : break;
1435 : : case FN_GLOSSARY_DLG:
1436 : : {
1437 [ + - ][ + - ]: 14 : rSet.Put(SfxBoolItem(nWhich), sal_True);
[ + - ]
1438 : : }
1439 : 14 : break;
1440 : :
1441 : : case SID_DEC_INDENT:
1442 : : case SID_INC_INDENT:
1443 : : {
1444 [ + - ][ + - ]: 2686 : sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
1445 : 2686 : nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES;
1446 [ + - ][ + + ]: 5372 : if( (nHtmlMode == HTMLMODE_ON) || !rSh.IsMoveLeftMargin(
[ + + ]
1447 [ + - ]: 2686 : SID_INC_INDENT == nWhich, sal_True ))
1448 [ + - ]: 6 : rSet.DisableItem( nWhich );
1449 : : }
1450 : 2686 : break;
1451 : :
1452 : : case FN_DEC_INDENT_OFFSET:
1453 : : case FN_INC_INDENT_OFFSET:
1454 : : {
1455 [ # # ][ # # ]: 0 : sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
1456 : 0 : nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES;
1457 [ # # ][ # # ]: 0 : if( (nHtmlMode == HTMLMODE_ON) ||
[ # # ]
1458 : : !rSh.IsMoveLeftMargin( FN_INC_INDENT_OFFSET == nWhich,
1459 [ # # ]: 0 : sal_False ))
1460 [ # # ]: 0 : rSet.DisableItem( nWhich );
1461 : : }
1462 : 0 : break;
1463 : :
1464 : : case SID_ATTR_CHAR_COLOR2:
1465 : : {
1466 [ + - ][ + - ]: 1343 : rSet.Put(SvxColorItem(GetView().GetEditWin().GetTextColor(), SID_ATTR_CHAR_COLOR2));
[ + - ]
1467 : : }
1468 : 1343 : break;
1469 : : case SID_ATTR_CHAR_COLOR_BACKGROUND:
1470 : : {
1471 [ - + ]: 1343 : if(GetView().GetEditWin().IsTextBackColorTransparent())
1472 [ # # ][ # # ]: 0 : rSet.Put(SvxColorItem(Color(COL_TRANSPARENT), SID_ATTR_CHAR_COLOR_BACKGROUND));
[ # # ]
1473 : : else
1474 [ + - ][ + - ]: 1343 : rSet.Put(SvxColorItem(GetView().GetEditWin().GetTextBackColor(), SID_ATTR_CHAR_COLOR_BACKGROUND));
[ + - ]
1475 : : }
1476 : 1343 : break;
1477 : : case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT:
1478 : : case SID_ATTR_CHAR_COLOR_EXT:
1479 : : {
1480 : 3437 : SwEditWin& rEdtWin = GetView().GetEditWin();
1481 : 3437 : SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
1482 [ # # ][ + - ]: 3437 : rSet.Put(SfxBoolItem(nWhich, pApply && pApply->nColor == nWhich));
[ + - ][ + - ]
[ - + ]
1483 : : }
1484 : 3437 : break;
1485 : : case FN_INSERT_BOOKMARK:
1486 [ - + ]: 4 : if( rSh.IsTableMode() )
1487 [ # # ]: 0 : rSet.DisableItem( nWhich );
1488 : 4 : break;
1489 : :
1490 : : case FN_INSERT_PAGEHEADER:
1491 : : case FN_INSERT_PAGEFOOTER:
1492 : : {
1493 [ # # ][ # # ]: 0 : rSet.Put( SfxObjectShellItem( nWhich, GetView().GetDocShell() ));
[ # # ][ # # ]
1494 : : }
1495 : 0 : break;
1496 : : case FN_TABLE_SORT_DIALOG:
1497 : : case FN_SORTING_DLG:
1498 [ + - ][ + + ]: 23 : if(!rSh.HasSelection() ||
[ + - ][ - + ]
[ + + ]
1499 [ + - ]: 10 : (FN_TABLE_SORT_DIALOG == nWhich && !rSh.GetTableFmt()))
1500 [ + - ]: 3 : rSet.DisableItem( nWhich );
1501 : 13 : break;
1502 : : case SID_RUBY_DIALOG:
1503 : : {
1504 [ # # ]: 0 : SvtCJKOptions aCJKOptions;
1505 [ # # ][ # # ]: 0 : if(!aCJKOptions.IsRubyEnabled())
1506 : : {
1507 [ # # ]: 0 : GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
1508 [ # # ]: 0 : rSet.DisableItem(nWhich);
1509 : : }
1510 : : else
1511 [ # # ]: 0 : GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
1512 [ # # ]: 0 : break;
1513 : : }
1514 : : //no break!
1515 : : case SID_HYPERLINK_DIALOG:
1516 [ + - ][ + - ]: 4037 : if( GetView().GetDocShell()->IsReadOnly() ||
[ + + ][ + - ]
[ - + ][ + + ]
1517 [ + - ]: 1343 : (!GetView().GetViewFrame()->HasChildWindow(nWhich) &&
1518 [ + - ]: 1343 : rSh.HasReadonlySel()) )
1519 [ + - ]: 8 : rSet.DisableItem(nWhich);
1520 : : else
1521 : 1343 : rSet.Put(SfxBoolItem( nWhich, 0 != GetView().
1522 [ + - ][ + - ]: 1343 : GetViewFrame()->GetChildWindow( nWhich ) ));
[ + - ][ + - ]
1523 : 1351 : break;
1524 : : case FN_EDIT_HYPERLINK:
1525 : : case FN_COPY_HYPERLINK_LOCATION:
1526 : : {
1527 : 14 : SfxItemSet aSet(GetPool(),
1528 : : RES_TXTATR_INETFMT,
1529 [ + - ]: 14 : RES_TXTATR_INETFMT);
1530 [ + - ]: 14 : rSh.GetCurAttr(aSet);
1531 [ + - ][ - + ]: 14 : if(SFX_ITEM_SET > aSet.GetItemState( RES_TXTATR_INETFMT, sal_True ) || rSh.HasReadonlySel())
[ # # ][ # # ]
[ + - ]
1532 : : {
1533 [ + - ]: 14 : rSet.DisableItem(nWhich);
1534 [ + - ]: 14 : }
1535 : : }
1536 : 14 : break;
1537 : : case FN_REMOVE_HYPERLINK:
1538 : : {
1539 : 0 : SfxItemSet aSet(GetPool(),
1540 : : RES_TXTATR_INETFMT,
1541 [ # # ]: 0 : RES_TXTATR_INETFMT);
1542 [ # # ]: 0 : rSh.GetCurAttr(aSet);
1543 : :
1544 : : // If a hyperlink is selected, either alone or along with other text...
1545 [ # # ][ # # ]: 0 : if( ((SFX_ITEM_DONTCARE & aSet.GetItemState( RES_TXTATR_INETFMT, sal_True )) == 0) || rSh.HasReadonlySel())
[ # # ][ # # ]
[ # # ]
1546 : : {
1547 [ # # ]: 0 : rSet.DisableItem(nWhich);
1548 [ # # ]: 0 : }
1549 : : }
1550 : 0 : break;
1551 : : case SID_TRANSLITERATE_HALFWIDTH:
1552 : : case SID_TRANSLITERATE_FULLWIDTH:
1553 : : case SID_TRANSLITERATE_HIRAGANA:
1554 : : case SID_TRANSLITERATE_KATAGANA:
1555 : : {
1556 [ # # ]: 0 : SvtCJKOptions aCJKOptions;
1557 [ # # ][ # # ]: 0 : if(!aCJKOptions.IsChangeCaseMapEnabled())
1558 : : {
1559 [ # # ]: 0 : GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
1560 [ # # ]: 0 : rSet.DisableItem(nWhich);
1561 : : }
1562 : : else
1563 [ # # ][ # # ]: 0 : GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
1564 : : }
1565 : 0 : break;
1566 : : case FN_READONLY_SELECTION_MODE :
1567 [ + - ][ + - ]: 14 : if(!GetView().GetDocShell()->IsReadOnly())
[ + - ]
1568 [ + - ]: 14 : rSet.DisableItem( nWhich );
1569 : : else
1570 : : {
1571 [ # # ][ # # ]: 0 : rSet.Put(SfxBoolItem(nWhich, rSh.GetViewOptions()->IsSelectionInReadonly()));
[ # # ]
1572 : : }
1573 : 14 : break;
1574 : : case FN_SELECTION_MODE_DEFAULT:
1575 : : case FN_SELECTION_MODE_BLOCK :
1576 [ # # ][ # # ]: 0 : rSet.Put(SfxBoolItem(nWhich, (nWhich == FN_SELECTION_MODE_DEFAULT) != rSh.IsBlockMode()));
[ # # ]
1577 : 0 : break;
1578 : : case SID_OPEN_HYPERLINK:
1579 : : {
1580 : 0 : SfxItemSet aSet(GetPool(),
1581 : : RES_TXTATR_INETFMT,
1582 [ # # ]: 0 : RES_TXTATR_INETFMT);
1583 [ # # ]: 0 : rSh.GetCurAttr(aSet);
1584 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET > aSet.GetItemState( RES_TXTATR_INETFMT, sal_False ))
1585 [ # # ][ # # ]: 0 : rSet.DisableItem(nWhich);
1586 : : }
1587 : 0 : break;
1588 : : case SID_OPEN_SMARTTAGMENU:
1589 : : {
1590 [ # # ]: 0 : uno::Sequence< rtl::OUString > aSmartTagTypes;
1591 [ # # ]: 0 : uno::Sequence< uno::Reference< container::XStringKeyMap > > aStringKeyMaps;
1592 : 0 : uno::Reference<text::XTextRange> xRange;
1593 : :
1594 [ # # ]: 0 : rSh.GetSmartTagTerm( aSmartTagTypes, aStringKeyMaps, xRange );
1595 : :
1596 [ # # ][ # # ]: 0 : if ( xRange.is() && aSmartTagTypes.getLength() )
[ # # ]
1597 : : {
1598 [ # # ]: 0 : uno::Sequence < uno::Sequence< uno::Reference< smarttags::XSmartTagAction > > > aActionComponentsSequence;
1599 [ # # ]: 0 : uno::Sequence < uno::Sequence< sal_Int32 > > aActionIndicesSequence;
1600 : :
1601 [ # # ]: 0 : const SmartTagMgr& rSmartTagMgr = SwSmartTagMgr::Get();
1602 : : rSmartTagMgr.GetActionSequences( aSmartTagTypes,
1603 : : aActionComponentsSequence,
1604 [ # # ]: 0 : aActionIndicesSequence );
1605 : :
1606 [ # # ]: 0 : uno::Reference <frame::XController> xController = GetView().GetController();
1607 [ # # ][ # # ]: 0 : const lang::Locale aLocale( SW_BREAKITER()->GetLocale( (LanguageType)GetAppLanguage() ) );
[ # # ]
1608 : 0 : const rtl::OUString aApplicationName( rSmartTagMgr.GetApplicationName() );
1609 [ # # ][ # # ]: 0 : const rtl::OUString aRangeText = xRange->getString();
1610 : :
1611 : : const SvxSmartTagItem aItem( nWhich,
1612 : : aActionComponentsSequence,
1613 : : aActionIndicesSequence,
1614 : : aStringKeyMaps,
1615 : : xRange,
1616 : : xController,
1617 : : aLocale,
1618 : : aApplicationName,
1619 [ # # ]: 0 : aRangeText );
1620 : :
1621 [ # # ][ # # ]: 0 : rSet.Put( aItem );
[ # # ][ # # ]
1622 : : }
1623 : : else
1624 [ # # ][ # # ]: 0 : rSet.DisableItem(nWhich);
[ # # ]
1625 : : }
1626 : 0 : break;
1627 : : case FN_NUM_CONTINUE:
1628 : : {
1629 : : {
1630 : : // #i86492#
1631 : : // Search also for bullet list
1632 [ # # ]: 0 : String aDummy;
1633 : : const SwNumRule* pRule =
1634 [ # # ]: 0 : rSh.SearchNumRule( false, true, false, -1, aDummy );
1635 [ # # ]: 0 : if ( !pRule )
1636 : : {
1637 [ # # ]: 0 : pRule = rSh.SearchNumRule( false, false, false, -1, aDummy );
1638 : : }
1639 [ # # ]: 0 : if ( !pRule )
1640 [ # # ][ # # ]: 0 : rSet.DisableItem(nWhich);
1641 : : }
1642 : : }
1643 : 0 : break;
1644 : : case SID_INSERT_RLM :
1645 : : case SID_INSERT_LRM :
1646 : : case SID_INSERT_ZWNBSP :
1647 : : case SID_INSERT_ZWSP:
1648 : : {
1649 [ # # ]: 0 : SvtCTLOptions aCTLOptions;
1650 [ # # ]: 0 : sal_Bool bEnabled = aCTLOptions.IsCTLFontEnabled();
1651 [ # # ]: 0 : GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, bEnabled );
1652 [ # # ]: 0 : if(!bEnabled)
1653 [ # # ][ # # ]: 0 : rSet.DisableItem(nWhich);
1654 : : }
1655 : 0 : break;
1656 : : }
1657 [ + - ]: 14837 : nWhich = aIter.NextWhich();
1658 [ + - ]: 8867 : }
1659 : 8867 : }
1660 : :
1661 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|