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