1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5efeef26fSAndrew Rist * distributed with this work for additional information
6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at
10efeef26fSAndrew Rist *
11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12efeef26fSAndrew Rist *
13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist * software distributed under the License is distributed on an
15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the
17efeef26fSAndrew Rist * specific language governing permissions and limitations
18efeef26fSAndrew Rist * under the License.
19efeef26fSAndrew Rist *
20efeef26fSAndrew Rist *************************************************************/
21efeef26fSAndrew Rist
22efeef26fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include <com/sun/star/i18n/WordType.hpp>
28cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
29cdf0e10cSrcweir
30cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
31cdf0e10cSrcweir #include <svx/dialogs.hrc>
32cdf0e10cSrcweir #include <hintids.hxx>
33cdf0e10cSrcweir #include <cmdid.h>
34cdf0e10cSrcweir #include <helpid.h>
35cdf0e10cSrcweir
36cdf0e10cSrcweir #include <i18npool/mslangid.hxx>
37cdf0e10cSrcweir #include <svl/languageoptions.hxx>
38cdf0e10cSrcweir #include <editeng/langitem.hxx>
39cdf0e10cSrcweir #include <svtools/langtab.hxx>
40cdf0e10cSrcweir #include <svl/slstitm.hxx>
41cdf0e10cSrcweir #include <string.h>
42cdf0e10cSrcweir #include <svl/stritem.hxx>
43cdf0e10cSrcweir #include <svx/htmlmode.hxx>
44cdf0e10cSrcweir #include <svl/whiter.hxx>
45cdf0e10cSrcweir #include <sfx2/bindings.hxx>
46cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
47cdf0e10cSrcweir #include <sfx2/objitem.hxx>
48cdf0e10cSrcweir #include <vcl/msgbox.hxx>
49cdf0e10cSrcweir #include <vcl/unohelp2.hxx>
50cdf0e10cSrcweir #include <sfx2/request.hxx>
51cdf0e10cSrcweir #include <svl/eitem.hxx>
52cdf0e10cSrcweir #include <svl/macitem.hxx>
53cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
54cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
55cdf0e10cSrcweir #include <editeng/colritem.hxx>
56cdf0e10cSrcweir #include <editeng/tstpitem.hxx>
57cdf0e10cSrcweir #include <editeng/brshitem.hxx>
58cdf0e10cSrcweir #include <editeng/svxacorr.hxx>
59cdf0e10cSrcweir #include <svl/cjkoptions.hxx>
60cdf0e10cSrcweir #include <svl/ctloptions.hxx>
61cdf0e10cSrcweir #include <IDocumentSettingAccess.hxx>
62cdf0e10cSrcweir #include <charfmt.hxx>
63cdf0e10cSrcweir #include <editeng/fontitem.hxx>
64cdf0e10cSrcweir #include <svx/SmartTagItem.hxx>
65cdf0e10cSrcweir #include <svx/dialmgr.hxx>
66cdf0e10cSrcweir #include <fmtinfmt.hxx>
67cdf0e10cSrcweir #include <swwait.hxx>
68cdf0e10cSrcweir #include <wrtsh.hxx>
69cdf0e10cSrcweir #include <wview.hxx>
70cdf0e10cSrcweir #include <swmodule.hxx>
71cdf0e10cSrcweir #include <viewopt.hxx>
72cdf0e10cSrcweir #include <uitool.hxx>
73cdf0e10cSrcweir #include <swevent.hxx>
74cdf0e10cSrcweir #include <fmthdft.hxx>
75cdf0e10cSrcweir #include <pagedesc.hxx>
76cdf0e10cSrcweir #include <textsh.hxx>
77cdf0e10cSrcweir #include <IMark.hxx>
78cdf0e10cSrcweir #include <swdtflvr.hxx>
79cdf0e10cSrcweir #include <docstat.hxx>
80cdf0e10cSrcweir #include <outline.hxx>
81cdf0e10cSrcweir #include <tablemgr.hxx>
82cdf0e10cSrcweir #include <swundo.hxx> // fuer Undo-IDs
83cdf0e10cSrcweir #include <reffld.hxx>
84cdf0e10cSrcweir #include <docsh.hxx>
85cdf0e10cSrcweir #include <mdiexp.hxx>
86cdf0e10cSrcweir #include <inputwin.hxx>
87cdf0e10cSrcweir #include <pardlg.hxx>
88cdf0e10cSrcweir #include <frmatr.hxx>
89cdf0e10cSrcweir #include <fmtcol.hxx>
90cdf0e10cSrcweir #include <cellatr.hxx>
91cdf0e10cSrcweir #include <edtwin.hxx>
92cdf0e10cSrcweir #include <redlndlg.hxx>
93cdf0e10cSrcweir #include "fldmgr.hxx"
94cdf0e10cSrcweir
95cdf0e10cSrcweir #include <globals.hrc>
96cdf0e10cSrcweir #include <shells.hrc>
97cdf0e10cSrcweir #include <app.hrc>
98cdf0e10cSrcweir #include <web.hrc>
99cdf0e10cSrcweir #include "paratr.hxx"
100cdf0e10cSrcweir #include <crsskip.hxx>
101cdf0e10cSrcweir #include <docstat.hxx>
102cdf0e10cSrcweir #include <vcl/svapp.hxx>
103cdf0e10cSrcweir #include <sfx2/app.hxx>
104cdf0e10cSrcweir #include <breakit.hxx>
105cdf0e10cSrcweir
106cdf0e10cSrcweir #include <SwSmartTagMgr.hxx>
107cdf0e10cSrcweir
108cdf0e10cSrcweir #include <editeng/acorrcfg.hxx>
109cdf0e10cSrcweir #include "swabstdlg.hxx"
110cdf0e10cSrcweir #include "misc.hrc"
111cdf0e10cSrcweir #include "chrdlg.hrc"
112cdf0e10cSrcweir #include <IDocumentStatistics.hxx>
113cdf0e10cSrcweir
114cdf0e10cSrcweir #include <sfx2/sfxdlg.hxx>
115cdf0e10cSrcweir #include <svl/languageoptions.hxx>
116cdf0e10cSrcweir #include <unotools/lingucfg.hxx>
117cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
118cdf0e10cSrcweir #include <com/sun/star/util/XChangesBatch.hpp>
119cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx>
120cdf0e10cSrcweir #include <editeng/unolingu.hxx>
121cdf0e10cSrcweir #include <unotools/syslocaleoptions.hxx>
122cdf0e10cSrcweir #include <doc.hxx>
123cdf0e10cSrcweir #include <view.hxx>
124cdf0e10cSrcweir #include <ndtxt.hxx>
125cdf0e10cSrcweir #include <pam.hxx>
126cdf0e10cSrcweir #include <sfx2/objface.hxx>
127cdf0e10cSrcweir #include <langhelper.hxx>
128cdf0e10cSrcweir
1291ff378efSZheng Fan #ifndef _NBDTMGFACT_HXX
1301ff378efSZheng Fan #include <svx/nbdtmgfact.hxx>
1311ff378efSZheng Fan #endif
1321ff378efSZheng Fan #ifndef _NBDTMG_HXX
1331ff378efSZheng Fan #include <svx/nbdtmg.hxx>
1341ff378efSZheng Fan #endif
1351ff378efSZheng Fan
1361ff378efSZheng Fan
1371ff378efSZheng Fan #include <numrule.hxx>
1381ff378efSZheng Fan
1391ff378efSZheng Fan
140cdf0e10cSrcweir using namespace ::com::sun::star;
1411ff378efSZheng Fan using namespace svx::sidebar;
142cdf0e10cSrcweir
143cdf0e10cSrcweir
lcl_CharDialog(SwWrtShell & rWrtSh,sal_Bool bUseDialog,sal_uInt16 nSlot,const SfxItemSet * pArgs,SfxRequest * pReq)144cdf0e10cSrcweir void lcl_CharDialog( SwWrtShell &rWrtSh, sal_Bool bUseDialog, sal_uInt16 nSlot,const SfxItemSet *pArgs, SfxRequest *pReq )
145cdf0e10cSrcweir {
146cdf0e10cSrcweir FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rWrtSh.GetView()));
147cdf0e10cSrcweir SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
148cdf0e10cSrcweir SfxItemSet aCoreSet( rWrtSh.GetView().GetPool(),
149cdf0e10cSrcweir RES_CHRATR_BEGIN, RES_CHRATR_END-1,
150cdf0e10cSrcweir RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
151cdf0e10cSrcweir RES_BACKGROUND, RES_BACKGROUND,
152cdf0e10cSrcweir FN_PARAM_SELECTION, FN_PARAM_SELECTION,
153cdf0e10cSrcweir SID_HTML_MODE, SID_HTML_MODE,
154cdf0e10cSrcweir SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, SID_ATTR_CHAR_WIDTH_FIT_TO_LINE,
155cdf0e10cSrcweir 0 );
156cdf0e10cSrcweir rWrtSh.GetCurAttr( aCoreSet );
157cdf0e10cSrcweir sal_Bool bSel = rWrtSh.HasSelection();
158cdf0e10cSrcweir sal_Bool bSelectionPut = sal_False;
159cdf0e10cSrcweir if(bSel || rWrtSh.IsInWord())
160cdf0e10cSrcweir {
161cdf0e10cSrcweir if(!bSel)
162cdf0e10cSrcweir {
163cdf0e10cSrcweir rWrtSh.StartAction();
164cdf0e10cSrcweir rWrtSh.Push();
165cdf0e10cSrcweir if(!rWrtSh.SelectTxtAttr( RES_TXTATR_INETFMT ))
166cdf0e10cSrcweir rWrtSh.SelWrd();
167cdf0e10cSrcweir }
168cdf0e10cSrcweir aCoreSet.Put(SfxStringItem(FN_PARAM_SELECTION, rWrtSh.GetSelTxt()));
169cdf0e10cSrcweir bSelectionPut = sal_True;
170cdf0e10cSrcweir if(!bSel)
171cdf0e10cSrcweir {
172cdf0e10cSrcweir rWrtSh.Pop(sal_False);
173cdf0e10cSrcweir rWrtSh.EndAction();
174cdf0e10cSrcweir }
175cdf0e10cSrcweir }
176cdf0e10cSrcweir aCoreSet.Put( SfxUInt16Item( SID_ATTR_CHAR_WIDTH_FIT_TO_LINE,
177cdf0e10cSrcweir rWrtSh.GetScalingOfSelectedText() ) );
178cdf0e10cSrcweir // Das CHRATR_BACKGROUND-Attribut wird fuer den Dialog in
179cdf0e10cSrcweir // ein RES_BACKGROUND verwandelt und wieder zurueck ...
180cdf0e10cSrcweir const SfxPoolItem *pTmpBrush;
181cdf0e10cSrcweir if( SFX_ITEM_SET == aCoreSet.GetItemState( RES_CHRATR_BACKGROUND, sal_True, &pTmpBrush ) )
182cdf0e10cSrcweir {
183cdf0e10cSrcweir SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
184cdf0e10cSrcweir aTmpBrush.SetWhich( RES_BACKGROUND );
185cdf0e10cSrcweir aCoreSet.Put( aTmpBrush );
186cdf0e10cSrcweir }
187cdf0e10cSrcweir
188cdf0e10cSrcweir aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(rWrtSh.GetView().GetDocShell())));
189cdf0e10cSrcweir SfxAbstractTabDialog* pDlg = NULL;
190cdf0e10cSrcweir if ( bUseDialog && GetActiveView() )
191cdf0e10cSrcweir {
192cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
193cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
194cdf0e10cSrcweir
195cdf0e10cSrcweir pDlg = pFact->CreateSwCharDlg( rWrtSh.GetView().GetWindow(), rWrtSh.GetView(), aCoreSet, DLG_CHAR );
196cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");
197cdf0e10cSrcweir if( FN_INSERT_HYPERLINK == nSlot )
198cdf0e10cSrcweir pDlg->SetCurPageId(TP_CHAR_URL);
199cdf0e10cSrcweir }
200eb39ad03SZheng Fan if (nSlot == SID_CHAR_DLG_EFFECT)
201eb39ad03SZheng Fan {
202eb39ad03SZheng Fan pDlg->SetCurPageId(TP_CHAR_EXT);
203eb39ad03SZheng Fan }
204cdf0e10cSrcweir
205cdf0e10cSrcweir const SfxItemSet* pSet = NULL;
206cdf0e10cSrcweir if ( !bUseDialog )
207cdf0e10cSrcweir pSet = pArgs;
208cdf0e10cSrcweir else if ( NULL != pDlg && pDlg->Execute() == RET_OK ) /* #110771# pDlg can be NULL */
209cdf0e10cSrcweir {
210cdf0e10cSrcweir pSet = pDlg->GetOutputItemSet();
211cdf0e10cSrcweir }
212cdf0e10cSrcweir
213cdf0e10cSrcweir if ( pSet)
214cdf0e10cSrcweir {
215cdf0e10cSrcweir SfxItemSet aTmpSet( *pSet );
216cdf0e10cSrcweir if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_BACKGROUND, sal_False, &pTmpBrush ) )
217cdf0e10cSrcweir {
218cdf0e10cSrcweir SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
219cdf0e10cSrcweir aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
220cdf0e10cSrcweir aTmpSet.Put( aTmpBrush );
221cdf0e10cSrcweir }
222cdf0e10cSrcweir
223cdf0e10cSrcweir aTmpSet.ClearItem( RES_BACKGROUND );
224cdf0e10cSrcweir
225cdf0e10cSrcweir const SfxPoolItem* pSelectionItem;
226cdf0e10cSrcweir sal_Bool bInsert = sal_False;
227cdf0e10cSrcweir xub_StrLen nInsert = 0;
228cdf0e10cSrcweir
229cdf0e10cSrcweir // aus ungeklaerter Ursache ist das alte Item wieder im Set
230cdf0e10cSrcweir if( !bSelectionPut && SFX_ITEM_SET == aTmpSet.GetItemState(FN_PARAM_SELECTION, sal_False, &pSelectionItem) )
231cdf0e10cSrcweir {
232cdf0e10cSrcweir String sInsert = ((const SfxStringItem*)pSelectionItem)->GetValue();
233cdf0e10cSrcweir bInsert = sInsert.Len() != 0;
234cdf0e10cSrcweir if(bInsert)
235cdf0e10cSrcweir {
236cdf0e10cSrcweir nInsert = sInsert.Len();
237cdf0e10cSrcweir rWrtSh.StartAction();
238cdf0e10cSrcweir rWrtSh.Insert( sInsert );
239cdf0e10cSrcweir rWrtSh.SetMark();
240cdf0e10cSrcweir rWrtSh.ExtendSelection(sal_False, sInsert.Len());
241cdf0e10cSrcweir SfxRequest aReq( rWrtSh.GetView().GetViewFrame(), FN_INSERT_STRING );
242cdf0e10cSrcweir aReq.AppendItem( SfxStringItem( FN_INSERT_STRING, sInsert ) );
243cdf0e10cSrcweir aReq.Done();
244cdf0e10cSrcweir SfxRequest aReq1( rWrtSh.GetView().GetViewFrame(), FN_CHAR_LEFT );
245cdf0e10cSrcweir aReq1.AppendItem( SfxInt16Item(FN_PARAM_MOVE_COUNT, nInsert) );
246cdf0e10cSrcweir aReq1.AppendItem( SfxBoolItem(FN_PARAM_MOVE_SELECTION, sal_True) );
247cdf0e10cSrcweir aReq1.Done();
248cdf0e10cSrcweir }
249cdf0e10cSrcweir }
250cdf0e10cSrcweir aTmpSet.ClearItem(FN_PARAM_SELECTION);
251cdf0e10cSrcweir
252cdf0e10cSrcweir SwTxtFmtColl* pColl = rWrtSh.GetCurTxtFmtColl();
253cdf0e10cSrcweir if(bSel && rWrtSh.IsSelFullPara() && pColl && pColl->IsAutoUpdateFmt())
254cdf0e10cSrcweir {
255cdf0e10cSrcweir rWrtSh.AutoUpdatePara(pColl, aTmpSet);
256cdf0e10cSrcweir }
257cdf0e10cSrcweir else
25869a74367SOliver-Rainer Wittmann rWrtSh.SetAttrSet( aTmpSet );
259cdf0e10cSrcweir if (pReq)
260cdf0e10cSrcweir pReq->Done(aTmpSet);
261cdf0e10cSrcweir if(bInsert)
262cdf0e10cSrcweir {
263cdf0e10cSrcweir SfxRequest aReq1( rWrtSh.GetView().GetViewFrame(), FN_CHAR_RIGHT );
264cdf0e10cSrcweir aReq1.AppendItem( SfxInt16Item(FN_PARAM_MOVE_COUNT, nInsert) );
265cdf0e10cSrcweir aReq1.AppendItem( SfxBoolItem(FN_PARAM_MOVE_SELECTION, sal_False) );
266cdf0e10cSrcweir aReq1.Done();
267cdf0e10cSrcweir rWrtSh.SwapPam();
268cdf0e10cSrcweir rWrtSh.ClearMark();
269cdf0e10cSrcweir rWrtSh.DontExpandFmt();
270cdf0e10cSrcweir rWrtSh.EndAction();
271cdf0e10cSrcweir }
272cdf0e10cSrcweir }
273cdf0e10cSrcweir
274cdf0e10cSrcweir delete pDlg;
275cdf0e10cSrcweir }
276cdf0e10cSrcweir
277cdf0e10cSrcweir /*--------------------------------------------------------------------
278cdf0e10cSrcweir Beschreibung:
279cdf0e10cSrcweir --------------------------------------------------------------------*/
280cdf0e10cSrcweir
lcl_AskRedlineMode(Window * pWin)281cdf0e10cSrcweir short lcl_AskRedlineMode(Window *pWin)
282cdf0e10cSrcweir {
283cdf0e10cSrcweir MessBox aQBox( pWin, 0,
284cdf0e10cSrcweir String( SW_RES( STR_REDLINE_TITLE ) ),
285cdf0e10cSrcweir String( SW_RES( STR_REDLINE_MSG ) ) );
286cdf0e10cSrcweir aQBox.SetImage( QueryBox::GetStandardImage() );
287cdf0e10cSrcweir sal_uInt16 nBtnFlags = BUTTONDIALOG_DEFBUTTON |
288cdf0e10cSrcweir BUTTONDIALOG_OKBUTTON |
289cdf0e10cSrcweir BUTTONDIALOG_FOCUSBUTTON;
290cdf0e10cSrcweir
291cdf0e10cSrcweir aQBox.AddButton(String(SW_RES(STR_REDLINE_ACCEPT_ALL)), RET_OK, nBtnFlags);
292cdf0e10cSrcweir aQBox.GetPushButton( RET_OK )->SetHelpId(HID_AUTOFORMAT_ACCEPT);
293cdf0e10cSrcweir aQBox.AddButton(String(SW_RES(STR_REDLINE_REJECT_ALL)), RET_CANCEL, BUTTONDIALOG_CANCELBUTTON);
294cdf0e10cSrcweir aQBox.GetPushButton( RET_CANCEL )->SetHelpId(HID_AUTOFORMAT_REJECT );
295cdf0e10cSrcweir aQBox.AddButton(String(SW_RES(STR_REDLINE_EDIT)), 2, 0);
296cdf0e10cSrcweir aQBox.GetPushButton( 2 )->SetHelpId(HID_AUTOFORMAT_EDIT_CHG);
297cdf0e10cSrcweir aQBox.SetButtonHelpText( RET_OK, aEmptyStr );
298cdf0e10cSrcweir
299cdf0e10cSrcweir return aQBox.Execute();
300cdf0e10cSrcweir }
301cdf0e10cSrcweir
Execute(SfxRequest & rReq)302cdf0e10cSrcweir void SwTextShell::Execute(SfxRequest &rReq)
303cdf0e10cSrcweir {
304cdf0e10cSrcweir sal_Bool bUseDialog = sal_True;
30589358e0fSOliver-Rainer Wittmann const SfxItemSet *pArgs = rReq.GetArgs();
30689358e0fSOliver-Rainer Wittmann SwWrtShell& rWrtSh = GetShell();
30789358e0fSOliver-Rainer Wittmann const SfxPoolItem* pItem = 0;
30889358e0fSOliver-Rainer Wittmann sal_uInt16 nSlot = rReq.GetSlot();
30989358e0fSOliver-Rainer Wittmann if(pArgs)
31089358e0fSOliver-Rainer Wittmann pArgs->GetItemState(GetPool().GetWhich(nSlot), sal_False, &pItem);
31189358e0fSOliver-Rainer Wittmann switch( nSlot )
31289358e0fSOliver-Rainer Wittmann {
313cdf0e10cSrcweir case SID_LANGUAGE_STATUS:
314cdf0e10cSrcweir {
315cdf0e10cSrcweir // get the language
316cdf0e10cSrcweir String aNewLangTxt;
317cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_LANGUAGE_STATUS , sal_False );
318cdf0e10cSrcweir if (pItem2)
319cdf0e10cSrcweir aNewLangTxt = pItem2->GetValue();
320cdf0e10cSrcweir
32189358e0fSOliver-Rainer Wittmann //!! Remember the view frame right now...
32289358e0fSOliver-Rainer Wittmann //!! (call to GetView().GetViewFrame() will break if the
32389358e0fSOliver-Rainer Wittmann //!! SwTextShell got destroyed meanwhile.)
32489358e0fSOliver-Rainer Wittmann SfxViewFrame *pViewFrame = GetView().GetViewFrame();
325cdf0e10cSrcweir
326cdf0e10cSrcweir if (aNewLangTxt.EqualsAscii( "*" ))
32789358e0fSOliver-Rainer Wittmann {
328cdf0e10cSrcweir // open the dialog "Tools/Options/Language Settings - Language"
32989358e0fSOliver-Rainer Wittmann // to set the documents default language
33089358e0fSOliver-Rainer Wittmann SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
33189358e0fSOliver-Rainer Wittmann if (pFact)
33289358e0fSOliver-Rainer Wittmann {
333cdf0e10cSrcweir VclAbstractDialog* pDlg = pFact->CreateVclDialog( GetView().GetWindow(), SID_LANGUAGE_OPTIONS );
33489358e0fSOliver-Rainer Wittmann pDlg->Execute();
33589358e0fSOliver-Rainer Wittmann delete pDlg;
33689358e0fSOliver-Rainer Wittmann }
33789358e0fSOliver-Rainer Wittmann }
33889358e0fSOliver-Rainer Wittmann else
33989358e0fSOliver-Rainer Wittmann {
34089358e0fSOliver-Rainer Wittmann //!! We have to use StartAction / EndAction bracketing in
34189358e0fSOliver-Rainer Wittmann //!! order to prevent possible destruction of the SwTextShell
34289358e0fSOliver-Rainer Wittmann //!! due to the selection changes coming below.
34389358e0fSOliver-Rainer Wittmann rWrtSh.StartAction();
34489358e0fSOliver-Rainer Wittmann // prevent view from jumping because of (temporary) selection changes
34589358e0fSOliver-Rainer Wittmann rWrtSh.LockView( sal_True );
34689358e0fSOliver-Rainer Wittmann
34789358e0fSOliver-Rainer Wittmann // save selection for later restoration
34889358e0fSOliver-Rainer Wittmann rWrtSh.Push();
349cdf0e10cSrcweir
350cdf0e10cSrcweir // setting the new language...
351cdf0e10cSrcweir if (aNewLangTxt.Len() > 0)
35289358e0fSOliver-Rainer Wittmann {
353cdf0e10cSrcweir const String aSelectionLangPrefix( String::CreateFromAscii("Current_") );
354cdf0e10cSrcweir const String aParagraphLangPrefix( String::CreateFromAscii("Paragraph_") );
355cdf0e10cSrcweir const String aDocumentLangPrefix( String::CreateFromAscii("Default_") );
35689358e0fSOliver-Rainer Wittmann const String aStrNone( String::CreateFromAscii("LANGUAGE_NONE") );
35789358e0fSOliver-Rainer Wittmann const String aStrResetLangs( String::CreateFromAscii("RESET_LANGUAGES") );
358cdf0e10cSrcweir
35989358e0fSOliver-Rainer Wittmann SfxItemSet aCoreSet( GetPool(),
360cdf0e10cSrcweir RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE,
361cdf0e10cSrcweir RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
362cdf0e10cSrcweir RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
363cdf0e10cSrcweir 0 );
364cdf0e10cSrcweir
365cdf0e10cSrcweir xub_StrLen nPos = 0;
366cdf0e10cSrcweir bool bForSelection = true;
367cdf0e10cSrcweir bool bForParagraph = false;
368cdf0e10cSrcweir if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aSelectionLangPrefix, 0 )))
36989358e0fSOliver-Rainer Wittmann {
370cdf0e10cSrcweir // ... for the current selection
371cdf0e10cSrcweir aNewLangTxt = aNewLangTxt.Erase( nPos, aSelectionLangPrefix.Len() );
372cdf0e10cSrcweir bForSelection = true;
37389358e0fSOliver-Rainer Wittmann }
374cdf0e10cSrcweir else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aParagraphLangPrefix , 0 )))
375cdf0e10cSrcweir {
376cdf0e10cSrcweir // ... for the current paragraph language
377cdf0e10cSrcweir aNewLangTxt = aNewLangTxt.Erase( nPos, aParagraphLangPrefix.Len() );
378cdf0e10cSrcweir bForSelection = true;
379cdf0e10cSrcweir bForParagraph = true;
380cdf0e10cSrcweir }
381cdf0e10cSrcweir else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aDocumentLangPrefix , 0 )))
38289358e0fSOliver-Rainer Wittmann {
383cdf0e10cSrcweir // ... as default document language
384cdf0e10cSrcweir aNewLangTxt = aNewLangTxt.Erase( nPos, aDocumentLangPrefix.Len() );
385cdf0e10cSrcweir bForSelection = false;
38689358e0fSOliver-Rainer Wittmann }
387cdf0e10cSrcweir
388cdf0e10cSrcweir if (bForParagraph)
389cdf0e10cSrcweir SwLangHelper::SelectCurrentPara( rWrtSh );
390cdf0e10cSrcweir
39189358e0fSOliver-Rainer Wittmann if (!bForSelection) // document language to be changed...
392cdf0e10cSrcweir {
39389358e0fSOliver-Rainer Wittmann rWrtSh.SelAll();
394cdf0e10cSrcweir rWrtSh.ExtendedSelectAll();
395cdf0e10cSrcweir }
39689358e0fSOliver-Rainer Wittmann
39789358e0fSOliver-Rainer Wittmann rWrtSh.StartUndo( ( !bForParagraph && !bForSelection ) ? UNDO_SETDEFTATTR : UNDO_EMPTY );
398cdf0e10cSrcweir if (aNewLangTxt == aStrNone)
399cdf0e10cSrcweir SwLangHelper::SetLanguage_None( rWrtSh, bForSelection, aCoreSet );
400cdf0e10cSrcweir else if (aNewLangTxt == aStrResetLangs)
401cdf0e10cSrcweir SwLangHelper::ResetLanguages( rWrtSh, bForSelection );
402cdf0e10cSrcweir else
403cdf0e10cSrcweir SwLangHelper::SetLanguage( rWrtSh, aNewLangTxt, bForSelection, aCoreSet );
40489358e0fSOliver-Rainer Wittmann rWrtSh.EndUndo();
405cdf0e10cSrcweir
40689358e0fSOliver-Rainer Wittmann }
407cdf0e10cSrcweir
40889358e0fSOliver-Rainer Wittmann // restore selection...
40989358e0fSOliver-Rainer Wittmann rWrtSh.Pop( sal_False );
41089358e0fSOliver-Rainer Wittmann
41189358e0fSOliver-Rainer Wittmann rWrtSh.LockView( sal_False );
41289358e0fSOliver-Rainer Wittmann rWrtSh.EndAction();
41389358e0fSOliver-Rainer Wittmann }
414cdf0e10cSrcweir
415cdf0e10cSrcweir // invalidate slot to get the new language displayed
41689358e0fSOliver-Rainer Wittmann pViewFrame->GetBindings().Invalidate( nSlot );
417cdf0e10cSrcweir
418cdf0e10cSrcweir rReq.Done();
41989358e0fSOliver-Rainer Wittmann break;
420cdf0e10cSrcweir }
421cdf0e10cSrcweir
422cdf0e10cSrcweir case SID_THES:
423cdf0e10cSrcweir {
424cdf0e10cSrcweir // replace word/selection with text from selected sub menu entry
425cdf0e10cSrcweir String aReplaceText;
426cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES , sal_False );
427cdf0e10cSrcweir if (pItem2)
428cdf0e10cSrcweir aReplaceText = pItem2->GetValue();
429cdf0e10cSrcweir if (aReplaceText.Len() > 0)
430cdf0e10cSrcweir {
431cdf0e10cSrcweir SwView &rView2 = rWrtSh.GetView();
432cdf0e10cSrcweir const bool bSelection = rWrtSh.HasSelection();
433cdf0e10cSrcweir const String aLookUpText = rView2.GetThesaurusLookUpText( bSelection );
434cdf0e10cSrcweir rView2.InsertThesaurusSynonym( aReplaceText, aLookUpText, bSelection );
435cdf0e10cSrcweir }
436cdf0e10cSrcweir }
437cdf0e10cSrcweir break;
438cdf0e10cSrcweir
439cdf0e10cSrcweir case SID_CHARMAP:
440cdf0e10cSrcweir {
441cdf0e10cSrcweir InsertSymbol( rReq );
442cdf0e10cSrcweir }
443cdf0e10cSrcweir break;
444cdf0e10cSrcweir case FN_INSERT_FOOTNOTE:
445cdf0e10cSrcweir case FN_INSERT_ENDNOTE:
446cdf0e10cSrcweir {
447cdf0e10cSrcweir String aStr;
448cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pFont, SfxStringItem, FN_PARAM_1 , sal_False );
449cdf0e10cSrcweir // SFX_REQUEST_ARG( rReq, pCharset, SfxInt16Item, FN_PARAM_2 , sal_False );
450cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, nSlot , sal_False );
451cdf0e10cSrcweir if ( pNameItem )
452cdf0e10cSrcweir aStr = pNameItem->GetValue();
453cdf0e10cSrcweir sal_Bool bFont = pFont && pFont->GetValue().Len();
454cdf0e10cSrcweir rWrtSh.StartUndo( UNDO_UI_INSERT_FOOTNOTE );
455cdf0e10cSrcweir rWrtSh.InsertFootnote( aStr, nSlot == FN_INSERT_ENDNOTE, !bFont );
456cdf0e10cSrcweir if ( bFont )
457cdf0e10cSrcweir {
458cdf0e10cSrcweir rWrtSh.Left( CRSR_SKIP_CHARS, sal_True, 1, sal_False );
459cdf0e10cSrcweir SfxItemSet aSet( rWrtSh.GetAttrPool(), RES_CHRATR_FONT, RES_CHRATR_FONT );
460cdf0e10cSrcweir rWrtSh.GetCurAttr( aSet );
461cdf0e10cSrcweir SvxFontItem &rFont = (SvxFontItem &) aSet.Get( RES_CHRATR_FONT );
462cdf0e10cSrcweir SvxFontItem aFont( rFont.GetFamily(), pFont->GetValue(),
463cdf0e10cSrcweir rFont.GetStyleName(), rFont.GetPitch(), RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT );
464cdf0e10cSrcweir //pCharset ? (CharSet) pCharset->GetValue() : RTL_TEXTENCODING_DONTKNOW );
46569a74367SOliver-Rainer Wittmann rWrtSh.SetAttrSet( aSet, nsSetAttrMode::SETATTR_DONTEXPAND );
466cdf0e10cSrcweir rWrtSh.ResetSelect(0, sal_False);
467cdf0e10cSrcweir rWrtSh.EndSelect();
468cdf0e10cSrcweir rWrtSh.GotoFtnTxt();
469cdf0e10cSrcweir }
470cdf0e10cSrcweir rWrtSh.EndUndo( UNDO_UI_INSERT_FOOTNOTE );
471cdf0e10cSrcweir rReq.Done();
472cdf0e10cSrcweir }
473cdf0e10cSrcweir break;
474cdf0e10cSrcweir case FN_INSERT_FOOTNOTE_DLG:
475cdf0e10cSrcweir {
476cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
477cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!");
478cdf0e10cSrcweir AbstractInsFootNoteDlg* pDlg = pFact->CreateInsFootNoteDlg( DLG_INS_FOOTNOTE,
479cdf0e10cSrcweir GetView().GetWindow(), rWrtSh, sal_False );
480cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");
481cdf0e10cSrcweir pDlg->SetHelpId(GetStaticInterface()->GetSlot(nSlot)->GetCommand());
482cdf0e10cSrcweir if ( pDlg->Execute() == RET_OK )
483cdf0e10cSrcweir {
484cdf0e10cSrcweir sal_uInt16 nId = pDlg->IsEndNote() ? FN_INSERT_ENDNOTE : FN_INSERT_FOOTNOTE;
485cdf0e10cSrcweir SfxRequest aReq( GetView().GetViewFrame(), nId );
486cdf0e10cSrcweir if ( pDlg->GetStr().Len() )
487cdf0e10cSrcweir aReq.AppendItem( SfxStringItem( nId, pDlg->GetStr() ) );
488cdf0e10cSrcweir if ( pDlg->GetFontName().Len() )
489cdf0e10cSrcweir aReq.AppendItem( SfxStringItem( FN_PARAM_1, pDlg->GetFontName() ) );
490cdf0e10cSrcweir //aReq.AppendItem( SfxStringItem( FN_PARAM_2, pDlg->GetCharSet() ) );
491cdf0e10cSrcweir ExecuteSlot( aReq );
492cdf0e10cSrcweir }
493cdf0e10cSrcweir
494cdf0e10cSrcweir rReq.Ignore();
495cdf0e10cSrcweir delete pDlg;
496cdf0e10cSrcweir }
497cdf0e10cSrcweir break;
498cdf0e10cSrcweir case FN_FORMAT_FOOTNOTE_DLG:
499cdf0e10cSrcweir {
500cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
501cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
502cdf0e10cSrcweir
503cdf0e10cSrcweir VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg( GetView().GetWindow(), rWrtSh, DLG_DOC_FOOTNOTE );
504cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");
505cdf0e10cSrcweir pDlg->Execute();
506cdf0e10cSrcweir delete pDlg;
507cdf0e10cSrcweir break;
508cdf0e10cSrcweir }
509cdf0e10cSrcweir case SID_INSERTDOC:
510cdf0e10cSrcweir {
511cdf0e10cSrcweir GetView().ExecuteInsertDoc( rReq, pItem );
512cdf0e10cSrcweir break;
513cdf0e10cSrcweir }
514cdf0e10cSrcweir case FN_FORMAT_RESET:
515cdf0e10cSrcweir {
516cdf0e10cSrcweir // #i78856, reset all attributes but not the language attributes
517cdf0e10cSrcweir // (for this build an array of all relevant attributes and
518cdf0e10cSrcweir // remove the languages from that)
519cdf0e10cSrcweir SvUShortsSort aAttribs;
520cdf0e10cSrcweir
521cdf0e10cSrcweir sal_uInt16 __FAR_DATA aResetableSetRange[] = {
522cdf0e10cSrcweir RES_FRMATR_BEGIN, RES_FRMATR_END-1,
523cdf0e10cSrcweir RES_CHRATR_BEGIN, RES_CHRATR_LANGUAGE - 1,
524cdf0e10cSrcweir RES_CHRATR_LANGUAGE + 1, RES_CHRATR_CJK_LANGUAGE - 1,
525cdf0e10cSrcweir RES_CHRATR_CJK_LANGUAGE + 1, RES_CHRATR_CTL_LANGUAGE - 1,
526cdf0e10cSrcweir RES_CHRATR_CTL_LANGUAGE + 1, RES_CHRATR_END-1,
527cdf0e10cSrcweir RES_PARATR_BEGIN, RES_PARATR_END-1,
528cdf0e10cSrcweir RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
529cdf0e10cSrcweir RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
530cdf0e10cSrcweir RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY,
531cdf0e10cSrcweir RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
532cdf0e10cSrcweir RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
533cdf0e10cSrcweir 0
534cdf0e10cSrcweir };
535cdf0e10cSrcweir sal_uInt16 __FAR_DATA *pUShorts = aResetableSetRange;
536cdf0e10cSrcweir while (*pUShorts)
537cdf0e10cSrcweir {
538cdf0e10cSrcweir sal_uInt16 nL = pUShorts[1] - pUShorts[0] + 1;
539cdf0e10cSrcweir sal_uInt16 nE = pUShorts[0];
540cdf0e10cSrcweir for (sal_uInt16 i = 0; i < nL; ++i)
541cdf0e10cSrcweir aAttribs.Insert( nE++ );
542cdf0e10cSrcweir pUShorts += 2;
543cdf0e10cSrcweir }
544cdf0e10cSrcweir
545cdf0e10cSrcweir rWrtSh.ResetAttr( &aAttribs );
546cdf0e10cSrcweir rReq.Done();
547cdf0e10cSrcweir break;
548cdf0e10cSrcweir }
549cdf0e10cSrcweir case FN_INSERT_BREAK_DLG:
550cdf0e10cSrcweir {
551cdf0e10cSrcweir sal_uInt16 nKind=0, nPageNumber=0;
552cdf0e10cSrcweir String aTemplateName;
553cdf0e10cSrcweir if ( pItem )
554cdf0e10cSrcweir {
555cdf0e10cSrcweir nKind = ((SfxInt16Item*)pItem)->GetValue();
556cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pTemplate, SfxStringItem, FN_PARAM_1 , sal_False );
557cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pNumber, SfxUInt16Item, FN_PARAM_2 , sal_False );
558cdf0e10cSrcweir if ( pTemplate )
559cdf0e10cSrcweir aTemplateName = pTemplate->GetValue();
560cdf0e10cSrcweir if ( pNumber )
561cdf0e10cSrcweir nPageNumber = pNumber->GetValue();
562cdf0e10cSrcweir }
563cdf0e10cSrcweir else
564cdf0e10cSrcweir {
565cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
566cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
567cdf0e10cSrcweir
568cdf0e10cSrcweir AbstractSwBreakDlg* pDlg = pFact->CreateSwBreakDlg( GetView().GetWindow(), rWrtSh, DLG_BREAK );
569cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");
570cdf0e10cSrcweir if ( pDlg->Execute() == RET_OK )
571cdf0e10cSrcweir {
572cdf0e10cSrcweir nKind = pDlg->GetKind();
573cdf0e10cSrcweir aTemplateName = pDlg->GetTemplateName();
574cdf0e10cSrcweir nPageNumber = pDlg->GetPageNumber();
575cdf0e10cSrcweir rReq.AppendItem( SfxInt16Item( FN_INSERT_BREAK_DLG, nKind ) );
576cdf0e10cSrcweir rReq.AppendItem( SfxUInt16Item( FN_PARAM_2, nPageNumber ) );
577cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( FN_PARAM_1, aTemplateName ) );
578cdf0e10cSrcweir rReq.Done();
579cdf0e10cSrcweir }
580cdf0e10cSrcweir else
581cdf0e10cSrcweir rReq.Ignore();
582cdf0e10cSrcweir delete pDlg;
583cdf0e10cSrcweir }
584cdf0e10cSrcweir
585cdf0e10cSrcweir switch ( nKind )
586cdf0e10cSrcweir {
587cdf0e10cSrcweir case 1 :
588cdf0e10cSrcweir rWrtSh.InsertLineBreak(); break;
589cdf0e10cSrcweir case 2 :
590cdf0e10cSrcweir rWrtSh.InsertColumnBreak(); break;
591cdf0e10cSrcweir case 3 :
592cdf0e10cSrcweir {
593cdf0e10cSrcweir rWrtSh.StartAllAction();
594cdf0e10cSrcweir if( aTemplateName.Len() )
595cdf0e10cSrcweir rWrtSh.InsertPageBreak( &aTemplateName, nPageNumber );
596cdf0e10cSrcweir else
597cdf0e10cSrcweir rWrtSh.InsertPageBreak();
598cdf0e10cSrcweir rWrtSh.EndAllAction();
599cdf0e10cSrcweir }
600cdf0e10cSrcweir }
601cdf0e10cSrcweir
602cdf0e10cSrcweir break;
603cdf0e10cSrcweir }
604cdf0e10cSrcweir case FN_INSERT_BOOKMARK:
605cdf0e10cSrcweir {
606cdf0e10cSrcweir if ( pItem )
607cdf0e10cSrcweir {
608cdf0e10cSrcweir ::rtl::OUString sName = ((SfxStringItem*)pItem)->GetValue();
609cdf0e10cSrcweir rWrtSh.SetBookmark( KeyCode(), sName, aEmptyStr );
610cdf0e10cSrcweir }
611cdf0e10cSrcweir else
612cdf0e10cSrcweir {
613cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
614cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
615cdf0e10cSrcweir
616cdf0e10cSrcweir VclAbstractDialog* pDlg = pFact->CreateSwInsertBookmarkDlg( GetView().GetWindow(), rWrtSh, rReq, DLG_INSERT_BOOKMARK );
617cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");
618cdf0e10cSrcweir pDlg->Execute();
619cdf0e10cSrcweir delete pDlg;
620cdf0e10cSrcweir }
621cdf0e10cSrcweir
622cdf0e10cSrcweir break;
623cdf0e10cSrcweir }
624cdf0e10cSrcweir case FN_DELETE_BOOKMARK:
625cdf0e10cSrcweir {
626cdf0e10cSrcweir if ( pItem )
627cdf0e10cSrcweir {
628cdf0e10cSrcweir IDocumentMarkAccess* const pMarkAccess = rWrtSh.getIDocumentMarkAccess();
629cdf0e10cSrcweir pMarkAccess->deleteMark( pMarkAccess->findMark(((SfxStringItem*)pItem)->GetValue()) );
630cdf0e10cSrcweir }
631cdf0e10cSrcweir break;
632cdf0e10cSrcweir }
633cdf0e10cSrcweir case FN_AUTOFORMAT_REDLINE_APPLY:
634cdf0e10cSrcweir {
635cdf0e10cSrcweir SvxSwAutoFmtFlags aFlags(SvxAutoCorrCfg::Get()->GetAutoCorrect()->GetSwFlags());
636cdf0e10cSrcweir // das muss fuer die Nachbearbeitung immer sal_False sein
637cdf0e10cSrcweir aFlags.bAFmtByInput = sal_False;
638cdf0e10cSrcweir aFlags.bWithRedlining = sal_True;
639cdf0e10cSrcweir rWrtSh.AutoFormat( &aFlags );
640cdf0e10cSrcweir aFlags.bWithRedlining = sal_False;
641cdf0e10cSrcweir
642cdf0e10cSrcweir SfxViewFrame* pVFrame = GetView().GetViewFrame();
643cdf0e10cSrcweir if (pVFrame->HasChildWindow(FN_REDLINE_ACCEPT))
644cdf0e10cSrcweir pVFrame->ToggleChildWindow(FN_REDLINE_ACCEPT);
645cdf0e10cSrcweir
646cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
647cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
648cdf0e10cSrcweir
649cdf0e10cSrcweir AbstractSwModalRedlineAcceptDlg* pDlg = pFact->CreateSwModalRedlineAcceptDlg( &GetView().GetEditWin(), DLG_MOD_REDLINE_ACCEPT );
650cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");
651cdf0e10cSrcweir
652cdf0e10cSrcweir switch (lcl_AskRedlineMode(&GetView().GetEditWin()))
653cdf0e10cSrcweir {
654cdf0e10cSrcweir case RET_OK:
655cdf0e10cSrcweir {
656cdf0e10cSrcweir pDlg->AcceptAll(sal_True);
657cdf0e10cSrcweir SfxRequest aReq( pVFrame, FN_AUTOFORMAT_APPLY );
658cdf0e10cSrcweir aReq.Done();
659cdf0e10cSrcweir rReq.Ignore();
660cdf0e10cSrcweir break;
661cdf0e10cSrcweir }
662cdf0e10cSrcweir
663cdf0e10cSrcweir case RET_CANCEL:
664cdf0e10cSrcweir pDlg->AcceptAll(sal_False);
665cdf0e10cSrcweir rReq.Ignore();
666cdf0e10cSrcweir break;
667cdf0e10cSrcweir
668cdf0e10cSrcweir case 2:
669cdf0e10cSrcweir pDlg->Execute();
670cdf0e10cSrcweir rReq.Done();
671cdf0e10cSrcweir break;
672cdf0e10cSrcweir }
673cdf0e10cSrcweir delete pDlg;
674cdf0e10cSrcweir }
675cdf0e10cSrcweir break;
676cdf0e10cSrcweir
677cdf0e10cSrcweir case FN_AUTOFORMAT_APPLY:
678cdf0e10cSrcweir {
679cdf0e10cSrcweir SvxSwAutoFmtFlags aFlags(SvxAutoCorrCfg::Get()->GetAutoCorrect()->GetSwFlags());
680cdf0e10cSrcweir // das muss fuer die Nachbearbeitung immer sal_False sein
681cdf0e10cSrcweir aFlags.bAFmtByInput = sal_False;
682cdf0e10cSrcweir rWrtSh.AutoFormat( &aFlags );
683cdf0e10cSrcweir rReq.Done();
684cdf0e10cSrcweir }
685cdf0e10cSrcweir break;
686cdf0e10cSrcweir case FN_AUTOFORMAT_AUTO:
687cdf0e10cSrcweir {
688cdf0e10cSrcweir SvxAutoCorrCfg* pACfg = SvxAutoCorrCfg::Get();
689cdf0e10cSrcweir sal_Bool bSet = pItem ? ((const SfxBoolItem*)pItem)->GetValue() : !pACfg->IsAutoFmtByInput();
690cdf0e10cSrcweir if( bSet != pACfg->IsAutoFmtByInput() )
691cdf0e10cSrcweir {
692cdf0e10cSrcweir pACfg->SetAutoFmtByInput( bSet );
693cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().Invalidate( nSlot );
694cdf0e10cSrcweir if ( !pItem )
695cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( GetPool().GetWhich(nSlot), bSet ) );
696cdf0e10cSrcweir rReq.Done();
697cdf0e10cSrcweir }
698cdf0e10cSrcweir }
699cdf0e10cSrcweir break;
700cdf0e10cSrcweir case FN_AUTO_CORRECT:
701cdf0e10cSrcweir {
702cdf0e10cSrcweir // erstmal auf Blank defaulten
703cdf0e10cSrcweir sal_Unicode cChar = ' ';
704cdf0e10cSrcweir rWrtSh.AutoCorrect( *SvxAutoCorrCfg::Get()->GetAutoCorrect(), cChar );
705cdf0e10cSrcweir rReq.Done();
706cdf0e10cSrcweir }
707cdf0e10cSrcweir break;
708cdf0e10cSrcweir case FN_TABLE_SORT_DIALOG:
709cdf0e10cSrcweir case FN_SORTING_DLG:
710cdf0e10cSrcweir {
711cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
712cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
713cdf0e10cSrcweir
714cdf0e10cSrcweir VclAbstractDialog* pDlg = pFact->CreateVclAbstractDialog( GetView().GetWindow(), rWrtSh, DLG_SORTING );
715cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");
716cdf0e10cSrcweir pDlg->Execute();
717cdf0e10cSrcweir delete pDlg;
718cdf0e10cSrcweir rReq.Done();
719cdf0e10cSrcweir }
720cdf0e10cSrcweir break;
721cdf0e10cSrcweir case FN_NUMBERING_OUTLINE_DLG:
722cdf0e10cSrcweir {
723cdf0e10cSrcweir SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
724cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
725cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!");
726cdf0e10cSrcweir SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
727cdf0e10cSrcweir GetView().GetWindow(), &aTmp, rWrtSh);
728cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");
729cdf0e10cSrcweir pDlg->Execute();
730cdf0e10cSrcweir delete pDlg;
731cdf0e10cSrcweir rReq.Done();
732cdf0e10cSrcweir }
733cdf0e10cSrcweir break;
734cdf0e10cSrcweir case FN_CALCULATE:
735cdf0e10cSrcweir {
736cdf0e10cSrcweir SwTransferable* pTransfer = new SwTransferable( rWrtSh );
737cdf0e10cSrcweir /*??*/ uno::Reference<
738cdf0e10cSrcweir datatransfer::XTransferable > xRef(
739cdf0e10cSrcweir pTransfer );
740cdf0e10cSrcweir pTransfer->CalculateAndCopy();
741cdf0e10cSrcweir rReq.Done();
742cdf0e10cSrcweir }
743cdf0e10cSrcweir break;
744cdf0e10cSrcweir case FN_GOTO_REFERENCE:
745cdf0e10cSrcweir {
746cdf0e10cSrcweir SwField *pFld = rWrtSh.GetCurFld();
747cdf0e10cSrcweir if(pFld && pFld->GetTypeId() == TYP_GETREFFLD)
748cdf0e10cSrcweir {
749cdf0e10cSrcweir rWrtSh.StartAllAction();
750cdf0e10cSrcweir rWrtSh.SwCrsrShell::GotoRefMark( ((SwGetRefField*)pFld)->GetSetRefName(),
751cdf0e10cSrcweir ((SwGetRefField*)pFld)->GetSubType(),
752cdf0e10cSrcweir ((SwGetRefField*)pFld)->GetSeqNo() );
753cdf0e10cSrcweir rWrtSh.EndAllAction();
754cdf0e10cSrcweir rReq.Done();
755cdf0e10cSrcweir }
756cdf0e10cSrcweir }
757cdf0e10cSrcweir break;
758cdf0e10cSrcweir case FN_EDIT_FORMULA:
759cdf0e10cSrcweir {
760cdf0e10cSrcweir const sal_uInt16 nId = SwInputChild::GetChildWindowId();
761cdf0e10cSrcweir SfxViewFrame* pVFrame = GetView().GetViewFrame();
762cdf0e10cSrcweir if(pItem)
763cdf0e10cSrcweir {
764cdf0e10cSrcweir //if the ChildWindow is active it has to be removed
765cdf0e10cSrcweir if( pVFrame->HasChildWindow( nId ) )
766cdf0e10cSrcweir {
767cdf0e10cSrcweir pVFrame->ToggleChildWindow( nId );
768cdf0e10cSrcweir pVFrame->GetBindings().InvalidateAll( sal_True );
769cdf0e10cSrcweir }
770cdf0e10cSrcweir
771cdf0e10cSrcweir String sFormula(((const SfxStringItem*)pItem)->GetValue());
772cdf0e10cSrcweir SwFldMgr aFldMgr;
773cdf0e10cSrcweir rWrtSh.StartAllAction();
774cdf0e10cSrcweir sal_Bool bDelSel;
775cdf0e10cSrcweir if( 0 != (bDelSel = rWrtSh.HasSelection()) )
776cdf0e10cSrcweir {
777cdf0e10cSrcweir rWrtSh.StartUndo( UNDO_START );
778cdf0e10cSrcweir rWrtSh.DelRight();
779cdf0e10cSrcweir }
780cdf0e10cSrcweir else
781cdf0e10cSrcweir {
782cdf0e10cSrcweir rWrtSh.EnterStdMode();
783cdf0e10cSrcweir }
784cdf0e10cSrcweir
785cdf0e10cSrcweir if( !bDelSel && aFldMgr.GetCurFld() && TYP_FORMELFLD == aFldMgr.GetCurTypeId() )
786cdf0e10cSrcweir aFldMgr.UpdateCurFld( aFldMgr.GetCurFld()->GetFormat(), aEmptyStr, sFormula );
787cdf0e10cSrcweir else if( sFormula.Len() )
788cdf0e10cSrcweir {
789cdf0e10cSrcweir if( rWrtSh.IsCrsrInTbl() )
790cdf0e10cSrcweir {
791cdf0e10cSrcweir SfxItemSet aSet( rWrtSh.GetAttrPool(), RES_BOXATR_FORMULA, RES_BOXATR_FORMULA );
792cdf0e10cSrcweir aSet.Put( SwTblBoxFormula( sFormula ));
793cdf0e10cSrcweir rWrtSh.SetTblBoxFormulaAttrs( aSet );
794cdf0e10cSrcweir rWrtSh.UpdateTable();
795cdf0e10cSrcweir }
796cdf0e10cSrcweir else
797cdf0e10cSrcweir {
798cdf0e10cSrcweir SvNumberFormatter* pFormatter = rWrtSh.GetNumberFormatter();
799cdf0e10cSrcweir sal_uLong nSysNumFmt = pFormatter->GetFormatIndex( NF_NUMBER_STANDARD, LANGUAGE_SYSTEM);
800cdf0e10cSrcweir SwInsertFld_Data aData(TYP_FORMELFLD, nsSwGetSetExpType::GSE_FORMULA, aEmptyStr, sFormula, nSysNumFmt);
801cdf0e10cSrcweir aFldMgr.InsertFld(aData);
802cdf0e10cSrcweir }
803cdf0e10cSrcweir }
804cdf0e10cSrcweir
805cdf0e10cSrcweir if( bDelSel )
806cdf0e10cSrcweir rWrtSh.EndUndo( UNDO_END );
807cdf0e10cSrcweir rWrtSh.EndAllAction();
808cdf0e10cSrcweir rReq.Done();
809cdf0e10cSrcweir }
810cdf0e10cSrcweir else
811cdf0e10cSrcweir {
812cdf0e10cSrcweir rWrtSh.EndAllTblBoxEdit();
813cdf0e10cSrcweir pVFrame->ToggleChildWindow( nId );
814cdf0e10cSrcweir if( !pVFrame->HasChildWindow( nId ) )
815cdf0e10cSrcweir pVFrame->GetBindings().InvalidateAll( sal_True );
816cdf0e10cSrcweir rReq.Ignore();
817cdf0e10cSrcweir }
818cdf0e10cSrcweir }
819cdf0e10cSrcweir
820cdf0e10cSrcweir break;
821cdf0e10cSrcweir case FN_TABLE_UNSET_READ_ONLY:
822cdf0e10cSrcweir {
823cdf0e10cSrcweir rWrtSh.UnProtectTbls();
824cdf0e10cSrcweir }
825cdf0e10cSrcweir break;
826cdf0e10cSrcweir case FN_EDIT_HYPERLINK:
827cdf0e10cSrcweir GetView().GetViewFrame()->ToggleChildWindow(SID_HYPERLINK_DIALOG);
828cdf0e10cSrcweir break;
829cdf0e10cSrcweir case FN_REMOVE_HYPERLINK:
830cdf0e10cSrcweir {
831cdf0e10cSrcweir sal_Bool bSel = rWrtSh.HasSelection();
832cdf0e10cSrcweir if(!bSel)
833cdf0e10cSrcweir {
834cdf0e10cSrcweir rWrtSh.StartAction();
835cdf0e10cSrcweir rWrtSh.Push();
836cdf0e10cSrcweir if(!rWrtSh.SelectTxtAttr( RES_TXTATR_INETFMT ))
837cdf0e10cSrcweir rWrtSh.SelWrd();
838cdf0e10cSrcweir }
839cdf0e10cSrcweir //now remove the attribute
840cdf0e10cSrcweir SvUShortsSort aAttribs;
841cdf0e10cSrcweir aAttribs.Insert( RES_TXTATR_INETFMT );
842cdf0e10cSrcweir rWrtSh.ResetAttr( &aAttribs );
843cdf0e10cSrcweir if(!bSel)
844cdf0e10cSrcweir {
845cdf0e10cSrcweir rWrtSh.Pop(sal_False);
846cdf0e10cSrcweir rWrtSh.EndAction();
847cdf0e10cSrcweir }
848cdf0e10cSrcweir }
849cdf0e10cSrcweir break;
850cdf0e10cSrcweir case SID_ATTR_BRUSH_CHAR :
851cdf0e10cSrcweir case SID_ATTR_CHAR_SCALEWIDTH :
852cdf0e10cSrcweir case SID_ATTR_CHAR_ROTATED :
853cdf0e10cSrcweir case FN_TXTATR_INET :
854cdf0e10cSrcweir case FN_INSERT_HYPERLINK:
855cdf0e10cSrcweir {
856cdf0e10cSrcweir sal_uInt16 nWhich = GetPool().GetWhich( nSlot );
857cdf0e10cSrcweir if ( pArgs && pArgs->GetItemState( nWhich ) == SFX_ITEM_SET )
858cdf0e10cSrcweir bUseDialog = sal_False;
859cdf0e10cSrcweir // intentionally no break
860cdf0e10cSrcweir }
861cdf0e10cSrcweir case SID_CHAR_DLG:
862eb39ad03SZheng Fan case SID_CHAR_DLG_EFFECT:
863cdf0e10cSrcweir {
864cdf0e10cSrcweir lcl_CharDialog( rWrtSh, bUseDialog, nSlot, pArgs, &rReq );
865cdf0e10cSrcweir }
866cdf0e10cSrcweir break;
867cdf0e10cSrcweir case SID_CHAR_DLG_FOR_PARAGRAPH:
868cdf0e10cSrcweir {
869cdf0e10cSrcweir rWrtSh.Push(); //save current cursor
870cdf0e10cSrcweir SwLangHelper::SelectCurrentPara( rWrtSh );
871cdf0e10cSrcweir lcl_CharDialog( rWrtSh, bUseDialog, nSlot, pArgs, &rReq );
872cdf0e10cSrcweir rWrtSh.Pop( sal_False ); //restore old cursor
873cdf0e10cSrcweir }
874cdf0e10cSrcweir break;
875cdf0e10cSrcweir case SID_ATTR_LRSPACE :
876cdf0e10cSrcweir case SID_ATTR_ULSPACE :
877cdf0e10cSrcweir case SID_ATTR_BRUSH :
878cdf0e10cSrcweir case SID_PARA_VERTALIGN :
879cdf0e10cSrcweir case SID_ATTR_PARA_NUMRULE :
880cdf0e10cSrcweir case SID_ATTR_PARA_REGISTER :
881cdf0e10cSrcweir case SID_ATTR_PARA_PAGENUM :
882cdf0e10cSrcweir case FN_FORMAT_LINENUMBER :
883cdf0e10cSrcweir case FN_NUMBER_NEWSTART :
884cdf0e10cSrcweir case FN_NUMBER_NEWSTART_AT :
885cdf0e10cSrcweir case FN_FORMAT_DROPCAPS :
886cdf0e10cSrcweir case FN_DROP_TEXT:
887512ec161SZheng Fan case SID_ATTR_PARA_LRSPACE:
888cdf0e10cSrcweir {
889cdf0e10cSrcweir sal_uInt16 nWhich = GetPool().GetWhich( nSlot );
890cdf0e10cSrcweir if ( pArgs && pArgs->GetItemState( nWhich ) == SFX_ITEM_SET )
891cdf0e10cSrcweir bUseDialog = sal_False;
892cdf0e10cSrcweir // intentionally no break
893cdf0e10cSrcweir
894cdf0e10cSrcweir }
895cdf0e10cSrcweir case SID_PARA_DLG:
896cdf0e10cSrcweir {
897cdf0e10cSrcweir FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView()));
898cdf0e10cSrcweir SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
899cdf0e10cSrcweir SfxItemSet aCoreSet( GetPool(),
900cdf0e10cSrcweir RES_PARATR_BEGIN, RES_PARATR_END - 1,
901cdf0e10cSrcweir // --> OD 2008-02-25 #refactorlists#
902cdf0e10cSrcweir RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1,
903cdf0e10cSrcweir // <--
904cdf0e10cSrcweir RES_FRMATR_BEGIN, RES_FRMATR_END - 1,
905cdf0e10cSrcweir SID_ATTR_TABSTOP_POS, SID_ATTR_TABSTOP_POS,
906cdf0e10cSrcweir SID_ATTR_TABSTOP_DEFAULTS, SID_ATTR_TABSTOP_DEFAULTS,
907cdf0e10cSrcweir SID_ATTR_TABSTOP_OFFSET, SID_ATTR_TABSTOP_OFFSET,
908cdf0e10cSrcweir SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
909cdf0e10cSrcweir SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP,
910cdf0e10cSrcweir SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM,
911cdf0e10cSrcweir SID_HTML_MODE, SID_HTML_MODE,
912cdf0e10cSrcweir FN_PARAM_1, FN_PARAM_1,
913cdf0e10cSrcweir FN_NUMBER_NEWSTART, FN_NUMBER_NEWSTART_AT,
914cdf0e10cSrcweir FN_DROP_TEXT, FN_DROP_CHAR_STYLE_NAME,
915cdf0e10cSrcweir 0);
916cdf0e10cSrcweir // --> OD 2008-01-16 #newlistlevelattrs#
917cdf0e10cSrcweir // get also the list level indent values merged as LR-SPACE item, if needed.
918cdf0e10cSrcweir rWrtSh.GetCurAttr( aCoreSet, true );
919cdf0e10cSrcweir // <--
920cdf0e10cSrcweir aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE,
921cdf0e10cSrcweir ::GetHtmlMode(GetView().GetDocShell())));
922cdf0e10cSrcweir
923cdf0e10cSrcweir // Tabulatoren, DefaultTabs ins ItemSet Stecken
924cdf0e10cSrcweir const SvxTabStopItem& rDefTabs = (const SvxTabStopItem&)
925cdf0e10cSrcweir GetPool().GetDefaultItem(RES_PARATR_TABSTOP);
926cdf0e10cSrcweir
927cdf0e10cSrcweir sal_uInt16 nDefDist = ::GetTabDist( rDefTabs );
928cdf0e10cSrcweir SfxUInt16Item aDefDistItem( SID_ATTR_TABSTOP_DEFAULTS, nDefDist );
929cdf0e10cSrcweir aCoreSet.Put( aDefDistItem );
930cdf0e10cSrcweir
931cdf0e10cSrcweir // Aktueller Tab
932cdf0e10cSrcweir SfxUInt16Item aTabPos( SID_ATTR_TABSTOP_POS, 0 );
933cdf0e10cSrcweir aCoreSet.Put( aTabPos );
934cdf0e10cSrcweir
935cdf0e10cSrcweir // linker Rand als Offset
936cdf0e10cSrcweir //#i24363# tab stops relative to indent
937cdf0e10cSrcweir const long nOff = rWrtSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT) ?
938cdf0e10cSrcweir ((SvxLRSpaceItem&)aCoreSet.Get( RES_LR_SPACE )).GetTxtLeft() : 0;
939cdf0e10cSrcweir SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff );
940cdf0e10cSrcweir aCoreSet.Put( aOff );
941cdf0e10cSrcweir
942cdf0e10cSrcweir // BoxInfo setzen
943cdf0e10cSrcweir ::PrepareBoxInfo( aCoreSet, rWrtSh );
944cdf0e10cSrcweir
945cdf0e10cSrcweir //aktuelles Seitenformat
946cdf0e10cSrcweir ::SwToSfxPageDescAttr( aCoreSet );
947cdf0e10cSrcweir
948cdf0e10cSrcweir sal_uInt16 nDefPage = 0;
949cdf0e10cSrcweir if( pItem )
950cdf0e10cSrcweir nDefPage = ((SfxUInt16Item *)pItem)->GetValue();
951cdf0e10cSrcweir
952cdf0e10cSrcweir // Numerierungseigenschaften
953cdf0e10cSrcweir if(rWrtSh.GetCurNumRule())
954cdf0e10cSrcweir {
955cdf0e10cSrcweir SfxBoolItem aStart( FN_NUMBER_NEWSTART, rWrtSh.IsNumRuleStart() );
956cdf0e10cSrcweir aCoreSet.Put(aStart);
957cdf0e10cSrcweir // --> OD 2008-02-29 #refactorlists#
958cdf0e10cSrcweir // SfxUInt16Item aStartAt(FN_NUMBER_NEWSTART_AT,
959cdf0e10cSrcweir // rWrtSh.IsNodeNumStart());
960cdf0e10cSrcweir SfxUInt16Item aStartAt( FN_NUMBER_NEWSTART_AT,
961cdf0e10cSrcweir rWrtSh.GetNodeNumStart() );
962cdf0e10cSrcweir // <--
963cdf0e10cSrcweir aCoreSet.Put(aStartAt);
964cdf0e10cSrcweir }
965cdf0e10cSrcweir SfxAbstractTabDialog* pDlg = NULL;
966cdf0e10cSrcweir
967cdf0e10cSrcweir if ( bUseDialog && GetActiveView() )
968cdf0e10cSrcweir {
969cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
970cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
971cdf0e10cSrcweir
972cdf0e10cSrcweir pDlg = pFact->CreateSwParaDlg( GetView().GetWindow(),GetView(), aCoreSet,DLG_STD, DLG_PARA,NULL, sal_False, nDefPage );
973cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");
974cdf0e10cSrcweir }
975cdf0e10cSrcweir SfxItemSet* pSet = NULL;
976cdf0e10cSrcweir if ( !bUseDialog )
977cdf0e10cSrcweir {
978512ec161SZheng Fan if ( nSlot == SID_ATTR_PARA_LRSPACE)
979512ec161SZheng Fan {
980512ec161SZheng Fan SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)pArgs->Get(nSlot));
981512ec161SZheng Fan aParaMargin.SetWhich( RES_LR_SPACE);
982512ec161SZheng Fan aCoreSet.Put(aParaMargin);
983512ec161SZheng Fan pSet = &aCoreSet;
984512ec161SZheng Fan
985512ec161SZheng Fan } else
986512ec161SZheng Fan pSet = (SfxItemSet*) pArgs;
987cdf0e10cSrcweir
988cdf0e10cSrcweir }
989cdf0e10cSrcweir else if ( NULL != pDlg && pDlg->Execute() == RET_OK )
990cdf0e10cSrcweir {
991cdf0e10cSrcweir // Defaults evtl umsetzen
992cdf0e10cSrcweir pSet = (SfxItemSet*)pDlg->GetOutputItemSet();
993cdf0e10cSrcweir sal_uInt16 nNewDist;
994cdf0e10cSrcweir if( SFX_ITEM_SET == pSet->GetItemState( SID_ATTR_TABSTOP_DEFAULTS, sal_False, &pItem ) &&
995cdf0e10cSrcweir nDefDist != (nNewDist = ((SfxUInt16Item*)pItem)->GetValue()) )
996cdf0e10cSrcweir {
997cdf0e10cSrcweir SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
998cdf0e10cSrcweir MakeDefTabs( nNewDist, aDefTabs );
999cdf0e10cSrcweir rWrtSh.SetDefault( aDefTabs );
1000cdf0e10cSrcweir pSet->ClearItem( SID_ATTR_TABSTOP_DEFAULTS );
1001cdf0e10cSrcweir }
1002cdf0e10cSrcweir
1003cdf0e10cSrcweir if ( SFX_ITEM_SET == pSet->GetItemState(FN_PARAM_1,sal_False,&pItem) )
1004cdf0e10cSrcweir {
1005cdf0e10cSrcweir pSet->Put(SfxStringItem(FN_DROP_TEXT, ((const SfxStringItem*)pItem)->GetValue()));
1006cdf0e10cSrcweir pSet->ClearItem(FN_PARAM_1);
1007cdf0e10cSrcweir }
1008cdf0e10cSrcweir
1009cdf0e10cSrcweir if( SFX_ITEM_SET == pSet->GetItemState( RES_PARATR_DROP, sal_False, &pItem ))
1010cdf0e10cSrcweir {
1011cdf0e10cSrcweir String sCharStyleName;
1012cdf0e10cSrcweir if(((const SwFmtDrop*)pItem)->GetCharFmt())
1013cdf0e10cSrcweir sCharStyleName = ((const SwFmtDrop*)pItem)->GetCharFmt()->GetName();
1014cdf0e10cSrcweir pSet->Put(SfxStringItem(FN_DROP_CHAR_STYLE_NAME, sCharStyleName));
1015cdf0e10cSrcweir }
1016cdf0e10cSrcweir }
1017cdf0e10cSrcweir
1018cdf0e10cSrcweir if ( pSet )
1019cdf0e10cSrcweir {
1020cdf0e10cSrcweir rReq.Done( *pSet );
1021cdf0e10cSrcweir ::SfxToSwPageDescAttr( rWrtSh, *pSet );
1022cdf0e10cSrcweir // --> OD 2006-12-06 #i56253#
1023cdf0e10cSrcweir // enclose all undos.
1024cdf0e10cSrcweir // Thus, check conditions, if actions will be performed.
1025cdf0e10cSrcweir const bool bUndoNeeded( pSet->Count() ||
1026cdf0e10cSrcweir SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART) ||
1027cdf0e10cSrcweir SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) );
1028cdf0e10cSrcweir if ( bUndoNeeded )
1029cdf0e10cSrcweir {
1030cdf0e10cSrcweir rWrtSh.StartUndo( UNDO_INSATTR );
1031cdf0e10cSrcweir }
1032cdf0e10cSrcweir // <--
1033cdf0e10cSrcweir if( pSet->Count() )
1034cdf0e10cSrcweir {
1035cdf0e10cSrcweir rWrtSh.StartAction();
1036cdf0e10cSrcweir // rWrtSh.StartUndo( UNDO_START );
1037cdf0e10cSrcweir if ( SFX_ITEM_SET == pSet->GetItemState(FN_DROP_TEXT, sal_False, &pItem) )
1038cdf0e10cSrcweir {
1039cdf0e10cSrcweir if ( ((SfxStringItem*)pItem)->GetValue().Len() )
1040cdf0e10cSrcweir rWrtSh.ReplaceDropTxt(((SfxStringItem*)pItem)->GetValue());
1041cdf0e10cSrcweir }
104269a74367SOliver-Rainer Wittmann rWrtSh.SetAttrSet( *pSet );
1043cdf0e10cSrcweir // rWrtSh.EndUndo( UNDO_END );
1044cdf0e10cSrcweir rWrtSh.EndAction();
1045cdf0e10cSrcweir SwTxtFmtColl* pColl = rWrtSh.GetCurTxtFmtColl();
1046cdf0e10cSrcweir if(pColl && pColl->IsAutoUpdateFmt())
1047cdf0e10cSrcweir {
1048cdf0e10cSrcweir rWrtSh.AutoUpdatePara(pColl, *pSet);
1049cdf0e10cSrcweir }
1050cdf0e10cSrcweir }
1051cdf0e10cSrcweir
1052cdf0e10cSrcweir if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART) )
1053cdf0e10cSrcweir {
1054cdf0e10cSrcweir //SetNumRuleStart(sal_True) restarts the numbering at the value
1055cdf0e10cSrcweir //that is defined at the starting point of the numbering level
1056cdf0e10cSrcweir //otherwise the SetNodeNumStart() value determines the start
10571ff378efSZheng Fan //if it's set to something different than (sal_uInt16)0xFFFF
1058cdf0e10cSrcweir
1059cdf0e10cSrcweir sal_Bool bStart = ((SfxBoolItem&)pSet->Get(FN_NUMBER_NEWSTART)).GetValue();
1060cdf0e10cSrcweir // --> OD 2007-06-11 #b6560525#
10611ff378efSZheng Fan // Default value for restart value has to be (sal_uInt16)0xFFFF
1062cdf0e10cSrcweir // in order to indicate that the restart value of the list
1063cdf0e10cSrcweir // style has to be used on restart.
10641ff378efSZheng Fan sal_uInt16 nNumStart = (sal_uInt16)0xFFFF;
1065cdf0e10cSrcweir // <--
1066cdf0e10cSrcweir if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
1067cdf0e10cSrcweir {
1068cdf0e10cSrcweir nNumStart = ((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue();
1069cdf0e10cSrcweir }
1070cdf0e10cSrcweir rWrtSh.SetNumRuleStart(bStart);
1071cdf0e10cSrcweir rWrtSh.SetNodeNumStart(nNumStart);
1072cdf0e10cSrcweir }
1073cdf0e10cSrcweir else if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
1074cdf0e10cSrcweir {
1075cdf0e10cSrcweir sal_uInt16 nNumStart = ((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue();
1076cdf0e10cSrcweir rWrtSh.SetNodeNumStart(nNumStart);
1077cdf0e10cSrcweir rWrtSh.SetNumRuleStart(sal_False);
1078cdf0e10cSrcweir }
1079cdf0e10cSrcweir // --> OD 2006-12-06 #i56253#
1080cdf0e10cSrcweir if ( bUndoNeeded )
1081cdf0e10cSrcweir {
1082cdf0e10cSrcweir rWrtSh.EndUndo( UNDO_INSATTR );
1083cdf0e10cSrcweir }
1084cdf0e10cSrcweir // <--
1085cdf0e10cSrcweir }
1086cdf0e10cSrcweir
1087cdf0e10cSrcweir delete pDlg;
1088cdf0e10cSrcweir }
1089cdf0e10cSrcweir break;
1090cdf0e10cSrcweir case FN_NUM_CONTINUE:
1091cdf0e10cSrcweir {
1092cdf0e10cSrcweir // --> OD 2008-03-18 #refactorlists#
1093cdf0e10cSrcweir String sContinuedListId;
1094cdf0e10cSrcweir const SwNumRule* pRule =
1095cdf0e10cSrcweir rWrtSh.SearchNumRule( false, true, false, -1, sContinuedListId );
1096cdf0e10cSrcweir // --> OD 2009-08-26 #i86492#
1097cdf0e10cSrcweir // Search also for bullet list
1098cdf0e10cSrcweir if ( !pRule )
1099cdf0e10cSrcweir {
1100cdf0e10cSrcweir pRule = rWrtSh.SearchNumRule( false, false, false, -1, sContinuedListId );
1101cdf0e10cSrcweir }
1102cdf0e10cSrcweir // <--
1103cdf0e10cSrcweir if ( pRule )
1104cdf0e10cSrcweir {
1105cdf0e10cSrcweir rWrtSh.SetCurNumRule( *pRule, false, sContinuedListId );
1106cdf0e10cSrcweir }
1107cdf0e10cSrcweir // <--
1108cdf0e10cSrcweir }
1109cdf0e10cSrcweir break;
1110cdf0e10cSrcweir case FN_SELECT_PARA:
1111cdf0e10cSrcweir {
1112cdf0e10cSrcweir if(!rWrtSh.IsSttOfPara())
1113cdf0e10cSrcweir rWrtSh.SttPara(sal_False);
1114cdf0e10cSrcweir else
1115cdf0e10cSrcweir rWrtSh.EnterStdMode();
1116cdf0e10cSrcweir rWrtSh.EndPara(sal_True);
1117cdf0e10cSrcweir }
1118cdf0e10cSrcweir break;
1119cdf0e10cSrcweir
1120cdf0e10cSrcweir case SID_DEC_INDENT:
1121cdf0e10cSrcweir case SID_INC_INDENT:
1122ca62e2c2SSteve Yin //According to the requirement, modified the behavior when user
1123ca62e2c2SSteve Yin //using the indent button on the toolbar. Now if we increase/decrease indent for a
1124ca62e2c2SSteve Yin //paragraph which has bullet style it will increase/decrease the bullet level.
1125ca62e2c2SSteve Yin {
1126ca62e2c2SSteve Yin //If the current paragraph has bullet call the function to
1127ca62e2c2SSteve Yin //increase or decrease the bullet level.
1128ca62e2c2SSteve Yin //Why could I know wheter a paragraph has bullet or not by checking the below conditions?
1129ca62e2c2SSteve Yin //Please refer to the "case KEY_TAB:" section in SwEditWin::KeyInput(..) :
1130ca62e2c2SSteve Yin // if( rSh.GetCurNumRule() && rSh.IsSttOfPara() &&
1131ca62e2c2SSteve Yin // !rSh.HasReadonlySel() )
1132ca62e2c2SSteve Yin // eKeyState = KS_NumDown;
1133ca62e2c2SSteve Yin //Above code demonstrates that when the cursor is at the start of a paragraph which has bullet,
1134ca62e2c2SSteve Yin //press TAB will increase the bullet level.
1135ca62e2c2SSteve Yin //So I copied from that ^^
1136ca62e2c2SSteve Yin if ( rWrtSh.GetCurNumRule() && !rWrtSh.HasReadonlySel() )
1137ca62e2c2SSteve Yin {
1138ca62e2c2SSteve Yin rWrtSh.NumUpDown( SID_INC_INDENT == nSlot );
1139ca62e2c2SSteve Yin }
1140ca62e2c2SSteve Yin else//execute the original processing functions
1141ca62e2c2SSteve Yin {
1142ca62e2c2SSteve Yin //below is copied of the old codes
1143cdf0e10cSrcweir rWrtSh.MoveLeftMargin( SID_INC_INDENT == nSlot,
1144cdf0e10cSrcweir rReq.GetModifier() != KEY_MOD1 );
1145ca62e2c2SSteve Yin }
1146ca62e2c2SSteve Yin }
1147ca62e2c2SSteve Yin //rWrtSh.MoveLeftMargin( SID_INC_INDENT == nSlot,
1148ca62e2c2SSteve Yin // rReq.GetModifier() != KEY_MOD1 );
1149cdf0e10cSrcweir rReq.Done();
1150cdf0e10cSrcweir break;
1151cdf0e10cSrcweir case FN_DEC_INDENT_OFFSET:
1152cdf0e10cSrcweir case FN_INC_INDENT_OFFSET:
1153cdf0e10cSrcweir rWrtSh.MoveLeftMargin( FN_INC_INDENT_OFFSET == nSlot,
1154cdf0e10cSrcweir rReq.GetModifier() == KEY_MOD1 );
1155cdf0e10cSrcweir rReq.Done();
1156cdf0e10cSrcweir break;
1157cdf0e10cSrcweir
1158cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR2:
1159cdf0e10cSrcweir {
1160cdf0e10cSrcweir if(pItem)
1161cdf0e10cSrcweir {
1162cdf0e10cSrcweir Color aSet = ((const SvxColorItem*)pItem)->GetValue();
1163cdf0e10cSrcweir SwEditWin& rEditWin = GetView().GetEditWin();
1164cdf0e10cSrcweir rEditWin.SetTextColor(aSet);
1165cdf0e10cSrcweir SwApplyTemplate* pApply = rEditWin.GetApplyTemplate();
1166cdf0e10cSrcweir SvxColorItem aItem(aSet, RES_CHRATR_COLOR);
1167cdf0e10cSrcweir
1168cdf0e10cSrcweir // besteht eine Selektion, wird sie gleich gefaerbt
1169cdf0e10cSrcweir if(!pApply && rWrtSh.HasSelection())
1170cdf0e10cSrcweir {
117169a74367SOliver-Rainer Wittmann rWrtSh.SetAttrItem(SvxColorItem (aSet, RES_CHRATR_COLOR));
1172cdf0e10cSrcweir }
1173cdf0e10cSrcweir else if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_EXT)
1174cdf0e10cSrcweir {
1175cdf0e10cSrcweir GetView().GetViewFrame()->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR_EXT);
1176cdf0e10cSrcweir }
1177cdf0e10cSrcweir
1178cdf0e10cSrcweir rReq.Done();
1179cdf0e10cSrcweir }
1180cdf0e10cSrcweir }
1181cdf0e10cSrcweir break;
1182cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR_BACKGROUND:
1183cdf0e10cSrcweir {
1184cdf0e10cSrcweir SwEditWin& rEdtWin = GetView().GetEditWin();
1185cdf0e10cSrcweir SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
1186cdf0e10cSrcweir rEdtWin.SetTextBackColorTransparent(0 == pItem);
1187cdf0e10cSrcweir Color aSet;
1188cdf0e10cSrcweir if(pItem)
1189cdf0e10cSrcweir {
1190cdf0e10cSrcweir aSet = ((const SvxColorItem*)pItem)->GetValue();
1191cdf0e10cSrcweir rEdtWin.SetTextBackColor(aSet);
1192cdf0e10cSrcweir }
1193cdf0e10cSrcweir if(!pApply && (rWrtSh.HasSelection() || rReq.IsAPI()))
1194cdf0e10cSrcweir {
1195cdf0e10cSrcweir SvxBrushItem aBrushItem(RES_CHRATR_BACKGROUND);
1196cdf0e10cSrcweir if(pItem)
1197cdf0e10cSrcweir aBrushItem.SetColor(aSet);
1198cdf0e10cSrcweir else
1199cdf0e10cSrcweir aBrushItem.SetColor(Color(COL_TRANSPARENT));
120069a74367SOliver-Rainer Wittmann rWrtSh.SetAttrItem( aBrushItem );
1201cdf0e10cSrcweir }
1202cdf0e10cSrcweir else if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_BACKGROUND_EXT)
1203cdf0e10cSrcweir {
1204cdf0e10cSrcweir GetView().GetViewFrame()->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR_BACKGROUND_EXT);
1205cdf0e10cSrcweir }
1206cdf0e10cSrcweir
1207cdf0e10cSrcweir rReq.Done();
1208cdf0e10cSrcweir
1209cdf0e10cSrcweir }
1210cdf0e10cSrcweir break;
1211cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT:
1212cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR_EXT:
1213cdf0e10cSrcweir {
1214cdf0e10cSrcweir SwEditWin& rEdtWin = GetView().GetEditWin();
1215cdf0e10cSrcweir SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
1216cdf0e10cSrcweir SwApplyTemplate aTempl;
1217cdf0e10cSrcweir sal_Bool bSelection = rWrtSh.HasSelection();
1218cdf0e10cSrcweir if(bSelection)
1219cdf0e10cSrcweir {
1220cdf0e10cSrcweir
1221cdf0e10cSrcweir if(nSlot == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT)
1222cdf0e10cSrcweir {
122369a74367SOliver-Rainer Wittmann rWrtSh.SetAttrItem(
122469a74367SOliver-Rainer Wittmann SvxBrushItem( rEdtWin.GetTextBackColor(), RES_CHRATR_BACKGROUND) );
1225cdf0e10cSrcweir }
1226cdf0e10cSrcweir else
122769a74367SOliver-Rainer Wittmann rWrtSh.SetAttrItem(
122869a74367SOliver-Rainer Wittmann SvxColorItem( rEdtWin.GetTextColor(), RES_CHRATR_COLOR) );
1229cdf0e10cSrcweir }
1230cdf0e10cSrcweir else
1231cdf0e10cSrcweir {
1232cdf0e10cSrcweir if(!pApply || pApply->nColor != nSlot)
1233cdf0e10cSrcweir aTempl.nColor = nSlot;
1234cdf0e10cSrcweir rEdtWin.SetApplyTemplate(aTempl);
1235cdf0e10cSrcweir }
1236cdf0e10cSrcweir
1237cdf0e10cSrcweir rReq.Done();
1238cdf0e10cSrcweir }
1239cdf0e10cSrcweir break;
1240cdf0e10cSrcweir
1241cdf0e10cSrcweir case FN_NUM_BULLET_MOVEDOWN:
1242cdf0e10cSrcweir if (!rWrtSh.IsAddMode())
1243cdf0e10cSrcweir rWrtSh.MoveParagraph(1);
1244cdf0e10cSrcweir rReq.Done();
1245cdf0e10cSrcweir break;
1246cdf0e10cSrcweir
1247cdf0e10cSrcweir case FN_NUM_BULLET_MOVEUP:
1248cdf0e10cSrcweir if (!rWrtSh.IsAddMode())
1249cdf0e10cSrcweir rWrtSh.MoveParagraph(-1);
1250cdf0e10cSrcweir rReq.Done();
1251cdf0e10cSrcweir break;
1252cdf0e10cSrcweir case SID_RUBY_DIALOG:
1253cdf0e10cSrcweir case SID_HYPERLINK_DIALOG:
1254cdf0e10cSrcweir {
1255cdf0e10cSrcweir SfxRequest aReq(nSlot, SFX_CALLMODE_SLOT, SFX_APP()->GetPool());
1256cdf0e10cSrcweir GetView().GetViewFrame()->ExecuteSlot( aReq);
1257cdf0e10cSrcweir rReq.Ignore();
1258cdf0e10cSrcweir }
1259cdf0e10cSrcweir break;
1260cdf0e10cSrcweir case FN_INSERT_PAGEHEADER:
1261cdf0e10cSrcweir case FN_INSERT_PAGEFOOTER:
1262cdf0e10cSrcweir if(pArgs && pArgs->Count())
1263cdf0e10cSrcweir {
1264cdf0e10cSrcweir String sStyleName;
1265cdf0e10cSrcweir if(pItem)
1266cdf0e10cSrcweir sStyleName = ((const SfxStringItem*)pItem)->GetValue();
1267cdf0e10cSrcweir sal_Bool bOn = sal_True;
1268cdf0e10cSrcweir if( SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_1, sal_False, &pItem))
1269cdf0e10cSrcweir bOn = ((const SfxBoolItem*)pItem)->GetValue();
1270cdf0e10cSrcweir ChangeHeaderOrFooter(sStyleName, FN_INSERT_PAGEHEADER == nSlot, bOn, !rReq.IsAPI());
1271cdf0e10cSrcweir rReq.Done();
1272cdf0e10cSrcweir }
1273cdf0e10cSrcweir break;
1274cdf0e10cSrcweir case FN_READONLY_SELECTION_MODE :
1275cdf0e10cSrcweir if(GetView().GetDocShell()->IsReadOnly())
1276cdf0e10cSrcweir {
1277cdf0e10cSrcweir rWrtSh.SetReadonlySelectionOption(
1278cdf0e10cSrcweir !rWrtSh.GetViewOptions()->IsSelectionInReadonly());
1279cdf0e10cSrcweir rWrtSh.ShowCrsr();
1280cdf0e10cSrcweir }
1281cdf0e10cSrcweir break;
1282cdf0e10cSrcweir case FN_SELECTION_MODE_DEFAULT:
1283cdf0e10cSrcweir case FN_SELECTION_MODE_BLOCK :
1284cdf0e10cSrcweir {
1285cdf0e10cSrcweir bool bSetBlockMode = !rWrtSh.IsBlockMode();
1286cdf0e10cSrcweir if( pArgs && SFX_ITEM_SET == pArgs->GetItemState(nSlot, sal_False, &pItem))
1287cdf0e10cSrcweir bSetBlockMode = ((const SfxBoolItem*)pItem)->GetValue();
1288cdf0e10cSrcweir if( ( nSlot == FN_SELECTION_MODE_DEFAULT ) ^ bSetBlockMode )
1289cdf0e10cSrcweir rWrtSh.EnterBlockMode();
1290cdf0e10cSrcweir else
1291cdf0e10cSrcweir rWrtSh.EnterStdMode();
1292cdf0e10cSrcweir SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings();
1293cdf0e10cSrcweir rBnd.Invalidate(FN_STAT_SELMODE);
1294cdf0e10cSrcweir rBnd.Update(FN_STAT_SELMODE);
1295cdf0e10cSrcweir }
1296cdf0e10cSrcweir break;
1297cdf0e10cSrcweir case SID_OPEN_HYPERLINK:
1298cdf0e10cSrcweir case FN_COPY_HYPERLINK_LOCATION:
1299cdf0e10cSrcweir {
1300cdf0e10cSrcweir SfxItemSet aSet(GetPool(),
1301cdf0e10cSrcweir RES_TXTATR_INETFMT,
1302cdf0e10cSrcweir RES_TXTATR_INETFMT);
1303cdf0e10cSrcweir rWrtSh.GetCurAttr(aSet);
1304cdf0e10cSrcweir if(SFX_ITEM_SET <= aSet.GetItemState( RES_TXTATR_INETFMT, sal_True ))
1305cdf0e10cSrcweir {
1306cdf0e10cSrcweir const SwFmtINetFmt& rINetFmt = dynamic_cast<const SwFmtINetFmt&>( aSet.Get(RES_TXTATR_INETFMT, sal_True) );
1307cdf0e10cSrcweir if( nSlot == FN_COPY_HYPERLINK_LOCATION )
1308cdf0e10cSrcweir {
1309cdf0e10cSrcweir ::uno::Reference< datatransfer::clipboard::XClipboard > xClipboard = GetView().GetEditWin().GetClipboard();
1310cdf0e10cSrcweir vcl::unohelper::TextDataObject::CopyStringTo(
1311cdf0e10cSrcweir rINetFmt.GetValue(),
1312cdf0e10cSrcweir xClipboard );
1313cdf0e10cSrcweir }
1314cdf0e10cSrcweir else
1315cdf0e10cSrcweir rWrtSh.ClickToINetAttr(rINetFmt, URLLOAD_NOFILTER);
1316cdf0e10cSrcweir }
1317cdf0e10cSrcweir }
1318cdf0e10cSrcweir break;
1319cdf0e10cSrcweir case SID_OPEN_XML_FILTERSETTINGS:
1320cdf0e10cSrcweir {
1321cdf0e10cSrcweir try
1322cdf0e10cSrcweir {
1323cdf0e10cSrcweir uno::Reference < ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.comp.ui.XSLTFilterDialog")), uno::UNO_QUERY);
1324cdf0e10cSrcweir if( xDialog.is() )
1325cdf0e10cSrcweir {
1326cdf0e10cSrcweir xDialog->execute();
1327cdf0e10cSrcweir }
1328cdf0e10cSrcweir }
1329cdf0e10cSrcweir catch( uno::Exception& )
1330cdf0e10cSrcweir {
1331cdf0e10cSrcweir }
1332cdf0e10cSrcweir rReq.Ignore ();
1333cdf0e10cSrcweir }
1334cdf0e10cSrcweir break;
1335cdf0e10cSrcweir case FN_FORMAT_APPLY_HEAD1:
1336cdf0e10cSrcweir {
1337cdf0e10cSrcweir }
1338cdf0e10cSrcweir break;
1339cdf0e10cSrcweir case FN_FORMAT_APPLY_HEAD2:
1340cdf0e10cSrcweir {
1341cdf0e10cSrcweir }
1342cdf0e10cSrcweir break;
1343cdf0e10cSrcweir case FN_FORMAT_APPLY_HEAD3:
1344cdf0e10cSrcweir {
1345cdf0e10cSrcweir }
1346cdf0e10cSrcweir break;
1347cdf0e10cSrcweir case FN_FORMAT_APPLY_DEFAULT:
1348cdf0e10cSrcweir {
1349cdf0e10cSrcweir }
1350cdf0e10cSrcweir break;
1351cdf0e10cSrcweir case FN_FORMAT_APPLY_TEXTBODY:
1352cdf0e10cSrcweir {
1353cdf0e10cSrcweir }
1354cdf0e10cSrcweir break;
1355cdf0e10cSrcweir case FN_WORDCOUNT_DIALOG:
1356cdf0e10cSrcweir {
1357cdf0e10cSrcweir SwWrtShell &rSh = GetShell();
1358cdf0e10cSrcweir SwDocStat aCurr;
1359cdf0e10cSrcweir SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() );
1360cdf0e10cSrcweir {
13618ef2f12bSOliver-Rainer Wittmann SwWait aWait( *GetView().GetDocShell(), true );
1362cdf0e10cSrcweir rSh.StartAction();
1363cdf0e10cSrcweir rSh.CountWords( aCurr );
1364cdf0e10cSrcweir rSh.UpdateDocStat( aDocStat );
1365cdf0e10cSrcweir rSh.EndAction();
1366cdf0e10cSrcweir }
1367cdf0e10cSrcweir
1368cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
1369cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!");
1370cdf0e10cSrcweir AbstractSwWordCountDialog* pDialog = pFact->CreateSwWordCountDialog( GetView().GetWindow() );
1371cdf0e10cSrcweir pDialog->SetValues(aCurr, aDocStat );
1372cdf0e10cSrcweir pDialog->Execute();
1373cdf0e10cSrcweir delete pDialog;
1374cdf0e10cSrcweir }
1375cdf0e10cSrcweir break;
1376cdf0e10cSrcweir default:
1377cdf0e10cSrcweir ASSERT(!this, falscher Dispatcher);
1378cdf0e10cSrcweir return;
1379cdf0e10cSrcweir }
1380cdf0e10cSrcweir }
1381cdf0e10cSrcweir
1382cdf0e10cSrcweir
1383cdf0e10cSrcweir /*--------------------------------------------------------------------
1384cdf0e10cSrcweir Beschreibung:
1385cdf0e10cSrcweir --------------------------------------------------------------------*/
1386cdf0e10cSrcweir
1387cdf0e10cSrcweir
GetState(SfxItemSet & rSet)1388cdf0e10cSrcweir void SwTextShell::GetState( SfxItemSet &rSet )
1389cdf0e10cSrcweir {
1390cdf0e10cSrcweir SwWrtShell &rSh = GetShell();
1391cdf0e10cSrcweir SfxWhichIter aIter( rSet );
1392cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich();
1393cdf0e10cSrcweir while ( nWhich )
1394cdf0e10cSrcweir {
1395cdf0e10cSrcweir switch ( nWhich )
1396cdf0e10cSrcweir {
1397cdf0e10cSrcweir case SID_LANGUAGE_STATUS:
1398cdf0e10cSrcweir {
1399cdf0e10cSrcweir // the value of used script types
1400cdf0e10cSrcweir String aScriptTypesInUse( String::CreateFromInt32( rSh.GetScriptType() ) );
1401cdf0e10cSrcweir
1402cdf0e10cSrcweir SvtLanguageTable aLangTable;
1403cdf0e10cSrcweir
1404cdf0e10cSrcweir // get keyboard language
1405cdf0e10cSrcweir String aKeyboardLang;
1406cdf0e10cSrcweir LanguageType nLang = LANGUAGE_DONTKNOW;
1407cdf0e10cSrcweir SwEditWin& rEditWin = GetView().GetEditWin();
1408cdf0e10cSrcweir nLang = rEditWin.GetInputLanguage();
1409cdf0e10cSrcweir if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
1410cdf0e10cSrcweir aKeyboardLang = aLangTable.GetString( nLang );
1411cdf0e10cSrcweir
1412cdf0e10cSrcweir // get the language that is in use
1413cdf0e10cSrcweir const String aMultipleLanguages = String::CreateFromAscii("*");
1414cdf0e10cSrcweir String aCurrentLang = aMultipleLanguages;
1415cdf0e10cSrcweir nLang = SwLangHelper::GetCurrentLanguage( rSh );
1416cdf0e10cSrcweir if (nLang != LANGUAGE_DONTKNOW)
1417cdf0e10cSrcweir aCurrentLang = aLangTable.GetString( nLang );
1418cdf0e10cSrcweir
1419cdf0e10cSrcweir // build sequence for status value
1420cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > aSeq( 4 );
1421cdf0e10cSrcweir aSeq[0] = aCurrentLang;
1422cdf0e10cSrcweir aSeq[1] = aScriptTypesInUse;
1423cdf0e10cSrcweir aSeq[2] = aKeyboardLang;
1424cdf0e10cSrcweir aSeq[3] = SwLangHelper::GetTextForLanguageGuessing( rSh );
1425cdf0e10cSrcweir
1426cdf0e10cSrcweir // set sequence as status value
1427cdf0e10cSrcweir SfxStringListItem aItem( SID_LANGUAGE_STATUS );
1428cdf0e10cSrcweir aItem.SetStringList( aSeq );
1429cdf0e10cSrcweir rSet.Put( aItem, SID_LANGUAGE_STATUS );
1430cdf0e10cSrcweir }
1431cdf0e10cSrcweir break;
1432cdf0e10cSrcweir
1433cdf0e10cSrcweir case SID_THES:
1434cdf0e10cSrcweir {
1435cdf0e10cSrcweir // is there a valid selection to get text from?
1436cdf0e10cSrcweir String aText;
1437cdf0e10cSrcweir sal_Bool bValid = !rSh.HasSelection() ||
1438cdf0e10cSrcweir (rSh.IsSelOnePara() && !rSh.IsMultiSelection());
1439cdf0e10cSrcweir // prevent context menu from showing when cursor is not in or at the end of a word
1440cdf0e10cSrcweir // (GetCurWord will return the next word if there is none at the current position...)
1441cdf0e10cSrcweir const sal_Int16 nWordType = ::i18n::WordType::DICTIONARY_WORD;
1442cdf0e10cSrcweir bool bWord = rSh.IsInWord( nWordType ) || rSh.IsStartWord( nWordType ) || rSh.IsEndWord( nWordType );
1443cdf0e10cSrcweir if (bValid && bWord)
1444cdf0e10cSrcweir aText = rSh.HasSelection()? rSh.GetSelTxt() : rSh.GetCurWord();
1445cdf0e10cSrcweir
1446cdf0e10cSrcweir LanguageType nLang = rSh.GetCurLang();
1447cdf0e10cSrcweir lang::Locale aLocale = SvxCreateLocale( nLang );
1448cdf0e10cSrcweir String aLangText( MsLangId::convertLanguageToIsoString( nLang ) );
1449cdf0e10cSrcweir
1450cdf0e10cSrcweir // set word and locale to look up as status value
1451cdf0e10cSrcweir String aStatusVal( aText );
1452cdf0e10cSrcweir aStatusVal.AppendAscii( "#" );
1453cdf0e10cSrcweir aStatusVal += aLangText;
1454cdf0e10cSrcweir
1455cdf0e10cSrcweir rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
1456cdf0e10cSrcweir
1457cdf0e10cSrcweir // disable "Thesaurus" context menu entry if there is nothing to look up
1458cdf0e10cSrcweir uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
1459cdf0e10cSrcweir if (aText.Len() == 0 ||
1460cdf0e10cSrcweir !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale ))
1461cdf0e10cSrcweir rSet.DisableItem( SID_THES );
1462cdf0e10cSrcweir }
1463cdf0e10cSrcweir break;
1464cdf0e10cSrcweir
1465cdf0e10cSrcweir case FN_NUMBER_NEWSTART :
1466cdf0e10cSrcweir if(!rSh.GetCurNumRule())
1467cdf0e10cSrcweir rSet.DisableItem(nWhich);
1468cdf0e10cSrcweir else
1469cdf0e10cSrcweir rSet.Put(SfxBoolItem(FN_NUMBER_NEWSTART,
1470cdf0e10cSrcweir rSh.IsNumRuleStart()));
1471cdf0e10cSrcweir break;
1472cdf0e10cSrcweir
147369a74367SOliver-Rainer Wittmann case FN_EDIT_FORMULA:
147469a74367SOliver-Rainer Wittmann case SID_CHARMAP:
147569a74367SOliver-Rainer Wittmann {
147669a74367SOliver-Rainer Wittmann const int nType = rSh.GetSelectionType();
147769a74367SOliver-Rainer Wittmann if (!(nType & nsSelectionType::SEL_TXT) &&
147869a74367SOliver-Rainer Wittmann !(nType & nsSelectionType::SEL_TBL) &&
147969a74367SOliver-Rainer Wittmann !(nType & nsSelectionType::SEL_NUM))
148069a74367SOliver-Rainer Wittmann {
148169a74367SOliver-Rainer Wittmann rSet.DisableItem(nWhich);
148269a74367SOliver-Rainer Wittmann }
148369a74367SOliver-Rainer Wittmann else if ( nWhich == FN_EDIT_FORMULA
148469a74367SOliver-Rainer Wittmann && rSh.CrsrInsideInputFld() )
148569a74367SOliver-Rainer Wittmann {
148669a74367SOliver-Rainer Wittmann rSet.DisableItem( nWhich );
148769a74367SOliver-Rainer Wittmann }
148869a74367SOliver-Rainer Wittmann }
148969a74367SOliver-Rainer Wittmann break;
149069a74367SOliver-Rainer Wittmann
149169a74367SOliver-Rainer Wittmann case FN_INSERT_ENDNOTE:
149269a74367SOliver-Rainer Wittmann case FN_INSERT_FOOTNOTE:
149369a74367SOliver-Rainer Wittmann case FN_INSERT_FOOTNOTE_DLG:
149469a74367SOliver-Rainer Wittmann {
149569a74367SOliver-Rainer Wittmann const sal_uInt16 nNoType =
149669a74367SOliver-Rainer Wittmann FRMTYPE_FLY_ANY | FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE;
149769a74367SOliver-Rainer Wittmann if ( (rSh.GetFrmType(0,sal_True) & nNoType) )
149869a74367SOliver-Rainer Wittmann rSet.DisableItem(nWhich);
149969a74367SOliver-Rainer Wittmann
150069a74367SOliver-Rainer Wittmann if ( rSh.CrsrInsideInputFld() )
150169a74367SOliver-Rainer Wittmann {
150269a74367SOliver-Rainer Wittmann rSet.DisableItem( nWhich );
150369a74367SOliver-Rainer Wittmann }
150469a74367SOliver-Rainer Wittmann }
150569a74367SOliver-Rainer Wittmann break;
150669a74367SOliver-Rainer Wittmann
150769a74367SOliver-Rainer Wittmann case FN_INSERT_HYPERLINK:
150869a74367SOliver-Rainer Wittmann case SID_INSERTDOC:
150969a74367SOliver-Rainer Wittmann case FN_INSERT_GLOSSARY:
151069a74367SOliver-Rainer Wittmann case FN_EXPAND_GLOSSARY:
151169a74367SOliver-Rainer Wittmann if ( rSh.CrsrInsideInputFld() )
151269a74367SOliver-Rainer Wittmann {
151369a74367SOliver-Rainer Wittmann rSet.DisableItem( nWhich );
151469a74367SOliver-Rainer Wittmann }
151569a74367SOliver-Rainer Wittmann break;
151669a74367SOliver-Rainer Wittmann
151769a74367SOliver-Rainer Wittmann case FN_INSERT_TABLE:
151869a74367SOliver-Rainer Wittmann if ( rSh.CrsrInsideInputFld()
151969a74367SOliver-Rainer Wittmann || rSh.GetTableFmt()
152069a74367SOliver-Rainer Wittmann || (rSh.GetFrmType(0,sal_True) & FRMTYPE_FOOTNOTE) )
152169a74367SOliver-Rainer Wittmann {
152269a74367SOliver-Rainer Wittmann rSet.DisableItem( nWhich );
152369a74367SOliver-Rainer Wittmann }
152469a74367SOliver-Rainer Wittmann break;
1525cdf0e10cSrcweir
1526cdf0e10cSrcweir case FN_CALCULATE:
1527cdf0e10cSrcweir if ( !rSh.IsSelection() )
1528cdf0e10cSrcweir rSet.DisableItem(nWhich);
1529cdf0e10cSrcweir break;
1530cdf0e10cSrcweir case FN_GOTO_REFERENCE:
1531cdf0e10cSrcweir {
1532cdf0e10cSrcweir SwField *pFld = rSh.GetCurFld();
1533cdf0e10cSrcweir if ( !pFld || (pFld && pFld->GetTypeId() != TYP_GETREFFLD) )
1534cdf0e10cSrcweir rSet.DisableItem(nWhich);
1535cdf0e10cSrcweir }
1536cdf0e10cSrcweir break;
1537cdf0e10cSrcweir case FN_AUTOFORMAT_AUTO:
1538cdf0e10cSrcweir {
1539cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, SvxAutoCorrCfg::Get()->IsAutoFmtByInput() ));
1540cdf0e10cSrcweir }
1541cdf0e10cSrcweir break;
154269a74367SOliver-Rainer Wittmann
154369a74367SOliver-Rainer Wittmann case FN_GLOSSARY_DLG:
154469a74367SOliver-Rainer Wittmann {
154569a74367SOliver-Rainer Wittmann if ( rSh.CrsrInsideInputFld() )
154669a74367SOliver-Rainer Wittmann {
154769a74367SOliver-Rainer Wittmann rSet.DisableItem( nWhich );
154869a74367SOliver-Rainer Wittmann }
154969a74367SOliver-Rainer Wittmann else
155069a74367SOliver-Rainer Wittmann {
155169a74367SOliver-Rainer Wittmann rSet.Put(SfxBoolItem(nWhich), sal_True);
155269a74367SOliver-Rainer Wittmann }
155369a74367SOliver-Rainer Wittmann }
155469a74367SOliver-Rainer Wittmann break;
1555cdf0e10cSrcweir
1556cdf0e10cSrcweir case SID_DEC_INDENT:
1557cdf0e10cSrcweir case SID_INC_INDENT:
1558cdf0e10cSrcweir {
1559ca62e2c2SSteve Yin //if the paragrah has bullet we'll do the following things:
1560ca62e2c2SSteve Yin //1: if the bullet level is the first level, disable the decrease-indent button
1561ca62e2c2SSteve Yin //2: if the bullet level is the last level, disable the increase-indent button
1562ca62e2c2SSteve Yin if ( rSh.GetCurNumRule() && !rSh.HasReadonlySel() )
1563ca62e2c2SSteve Yin {
1564ca62e2c2SSteve Yin sal_uInt8 nLevel = rSh.GetNumLevel();
1565ca62e2c2SSteve Yin if ( nLevel == (MAXLEVEL-1) && nWhich == SID_INC_INDENT ||
1566ca62e2c2SSteve Yin nLevel == 0 && nWhich == SID_DEC_INDENT )
1567ca62e2c2SSteve Yin {
1568ca62e2c2SSteve Yin rSet.DisableItem( nWhich );
1569ca62e2c2SSteve Yin }
1570ca62e2c2SSteve Yin }
1571ca62e2c2SSteve Yin else//if the paragraph has no bullet, execute the original functions
1572ca62e2c2SSteve Yin {
1573ca62e2c2SSteve Yin //below is copied of the old codes
1574cdf0e10cSrcweir sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
1575cdf0e10cSrcweir nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES;
1576cdf0e10cSrcweir if( (nHtmlMode == HTMLMODE_ON) || !rSh.IsMoveLeftMargin(
1577cdf0e10cSrcweir SID_INC_INDENT == nWhich, sal_True ))
1578cdf0e10cSrcweir rSet.DisableItem( nWhich );
1579ca62e2c2SSteve Yin }
1580ca62e2c2SSteve Yin //old code begins
1581ca62e2c2SSteve Yin //sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
1582ca62e2c2SSteve Yin //nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES;
1583ca62e2c2SSteve Yin //if( (nHtmlMode == HTMLMODE_ON) || !rSh.IsMoveLeftMargin(
1584ca62e2c2SSteve Yin // SID_INC_INDENT == nWhich, TRUE ))
1585ca62e2c2SSteve Yin // rSet.DisableItem( nWhich );
1586ca62e2c2SSteve Yin //old code ends
1587cdf0e10cSrcweir }
1588cdf0e10cSrcweir break;
1589cdf0e10cSrcweir
1590cdf0e10cSrcweir case FN_DEC_INDENT_OFFSET:
1591cdf0e10cSrcweir case FN_INC_INDENT_OFFSET:
1592cdf0e10cSrcweir {
1593cdf0e10cSrcweir sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
1594cdf0e10cSrcweir nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES;
1595cdf0e10cSrcweir if( (nHtmlMode == HTMLMODE_ON) ||
1596cdf0e10cSrcweir !rSh.IsMoveLeftMargin( FN_INC_INDENT_OFFSET == nWhich,
1597cdf0e10cSrcweir sal_False ))
1598cdf0e10cSrcweir rSet.DisableItem( nWhich );
1599cdf0e10cSrcweir }
1600cdf0e10cSrcweir break;
1601cdf0e10cSrcweir
1602cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR2:
1603cdf0e10cSrcweir {
1604cdf0e10cSrcweir rSet.Put(SvxColorItem(GetView().GetEditWin().GetTextColor(), SID_ATTR_CHAR_COLOR2));
1605cdf0e10cSrcweir }
1606cdf0e10cSrcweir break;
1607cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR_BACKGROUND:
1608cdf0e10cSrcweir {
1609cdf0e10cSrcweir if(GetView().GetEditWin().IsTextBackColorTransparent())
1610cdf0e10cSrcweir rSet.Put(SvxColorItem(Color(COL_TRANSPARENT), SID_ATTR_CHAR_COLOR_BACKGROUND));
1611cdf0e10cSrcweir else
1612cdf0e10cSrcweir rSet.Put(SvxColorItem(GetView().GetEditWin().GetTextBackColor(), SID_ATTR_CHAR_COLOR_BACKGROUND));
1613cdf0e10cSrcweir }
1614cdf0e10cSrcweir break;
1615cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT:
1616cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR_EXT:
1617cdf0e10cSrcweir {
1618cdf0e10cSrcweir SwEditWin& rEdtWin = GetView().GetEditWin();
1619cdf0e10cSrcweir SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
1620cdf0e10cSrcweir rSet.Put(SfxBoolItem(nWhich, pApply && pApply->nColor == nWhich));
1621cdf0e10cSrcweir }
1622cdf0e10cSrcweir break;
162369a74367SOliver-Rainer Wittmann
162469a74367SOliver-Rainer Wittmann case FN_INSERT_BOOKMARK:
162569a74367SOliver-Rainer Wittmann if( rSh.IsTableMode()
162669a74367SOliver-Rainer Wittmann || rSh.CrsrInsideInputFld() )
162769a74367SOliver-Rainer Wittmann {
162869a74367SOliver-Rainer Wittmann rSet.DisableItem( nWhich );
162969a74367SOliver-Rainer Wittmann }
163069a74367SOliver-Rainer Wittmann break;
163169a74367SOliver-Rainer Wittmann
1632*23d8f725SOliver-Rainer Wittmann
1633*23d8f725SOliver-Rainer Wittmann case FN_INSERT_BREAK:
1634*23d8f725SOliver-Rainer Wittmann if ( rSh.HasReadonlySel()
1635*23d8f725SOliver-Rainer Wittmann && !rSh.CrsrInsideInputFld() )
1636*23d8f725SOliver-Rainer Wittmann {
1637*23d8f725SOliver-Rainer Wittmann rSet.DisableItem( nWhich );
1638*23d8f725SOliver-Rainer Wittmann }
1639*23d8f725SOliver-Rainer Wittmann break;
1640*23d8f725SOliver-Rainer Wittmann
1641*23d8f725SOliver-Rainer Wittmann
164269a74367SOliver-Rainer Wittmann case FN_INSERT_BREAK_DLG:
164369a74367SOliver-Rainer Wittmann case FN_INSERT_COLUMN_BREAK:
164469a74367SOliver-Rainer Wittmann case FN_INSERT_PAGEBREAK:
164569a74367SOliver-Rainer Wittmann if( rSh.CrsrInsideInputFld() )
164669a74367SOliver-Rainer Wittmann {
164769a74367SOliver-Rainer Wittmann rSet.DisableItem( nWhich );
164869a74367SOliver-Rainer Wittmann }
164969a74367SOliver-Rainer Wittmann break;
1650cdf0e10cSrcweir
1651cdf0e10cSrcweir case FN_INSERT_PAGEHEADER:
1652cdf0e10cSrcweir case FN_INSERT_PAGEFOOTER:
1653cdf0e10cSrcweir {
1654cdf0e10cSrcweir #ifndef CHECK_MENU
1655cdf0e10cSrcweir rSet.Put( SfxObjectShellItem( nWhich, GetView().GetDocShell() ));
1656cdf0e10cSrcweir #else
1657cdf0e10cSrcweir // Seitenvorlagen besorgen
1658cdf0e10cSrcweir sal_Bool bFound = sal_False;
1659cdf0e10cSrcweir sal_uInt16 n, nCnt = rSh.GetPageDescCnt();
1660cdf0e10cSrcweir for( n = 0; n < nCnt; ++n )
1661cdf0e10cSrcweir {
1662cdf0e10cSrcweir const SwPageDesc& rDesc = rSh.GetPageDesc( n );
1663cdf0e10cSrcweir if( FN_INSERT_PAGEHEADER == nWhich
1664cdf0e10cSrcweir ? !rDesc.GetMaster().GetHeader().IsActive()
1665cdf0e10cSrcweir : !rDesc.GetMaster().GetFooter().IsActive() )
1666cdf0e10cSrcweir {
1667cdf0e10cSrcweir bFound = sal_True;
1668cdf0e10cSrcweir break;
1669cdf0e10cSrcweir }
1670cdf0e10cSrcweir }
1671cdf0e10cSrcweir
1672cdf0e10cSrcweir if( bFound )
1673cdf0e10cSrcweir rSet.Put( SfxObjectShellItem( nWhich, GetView().GetDocShell() ));
1674cdf0e10cSrcweir else
1675cdf0e10cSrcweir rSet.DisableItem( nWhich );
1676cdf0e10cSrcweir #endif
1677cdf0e10cSrcweir }
1678cdf0e10cSrcweir break;
1679cdf0e10cSrcweir case FN_TABLE_SORT_DIALOG:
1680cdf0e10cSrcweir case FN_SORTING_DLG:
1681cdf0e10cSrcweir if(!rSh.HasSelection() ||
1682cdf0e10cSrcweir (FN_TABLE_SORT_DIALOG == nWhich && !rSh.GetTableFmt()))
1683cdf0e10cSrcweir rSet.DisableItem( nWhich );
1684cdf0e10cSrcweir break;
168569a74367SOliver-Rainer Wittmann
168669a74367SOliver-Rainer Wittmann case SID_RUBY_DIALOG:
168769a74367SOliver-Rainer Wittmann {
168869a74367SOliver-Rainer Wittmann SvtCJKOptions aCJKOptions;
168969a74367SOliver-Rainer Wittmann if( !aCJKOptions.IsRubyEnabled()
169069a74367SOliver-Rainer Wittmann || rSh.CrsrInsideInputFld() )
169169a74367SOliver-Rainer Wittmann {
169269a74367SOliver-Rainer Wittmann GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
169369a74367SOliver-Rainer Wittmann rSet.DisableItem(nWhich);
169469a74367SOliver-Rainer Wittmann }
169569a74367SOliver-Rainer Wittmann else
169669a74367SOliver-Rainer Wittmann GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
169769a74367SOliver-Rainer Wittmann }
169869a74367SOliver-Rainer Wittmann break;
169969a74367SOliver-Rainer Wittmann
170069a74367SOliver-Rainer Wittmann case SID_HYPERLINK_DIALOG:
170169a74367SOliver-Rainer Wittmann if( GetView().GetDocShell()->IsReadOnly()
170269a74367SOliver-Rainer Wittmann || ( !GetView().GetViewFrame()->HasChildWindow(nWhich)
170369a74367SOliver-Rainer Wittmann && rSh.HasReadonlySel() )
170469a74367SOliver-Rainer Wittmann || rSh.CrsrInsideInputFld() )
1705cdf0e10cSrcweir {
1706cdf0e10cSrcweir rSet.DisableItem(nWhich);
1707cdf0e10cSrcweir }
1708cdf0e10cSrcweir else
170969a74367SOliver-Rainer Wittmann {
171069a74367SOliver-Rainer Wittmann rSet.Put(SfxBoolItem( nWhich, 0 != GetView().GetViewFrame()->GetChildWindow( nWhich ) ));
171169a74367SOliver-Rainer Wittmann }
1712cdf0e10cSrcweir break;
171369a74367SOliver-Rainer Wittmann
171469a74367SOliver-Rainer Wittmann case FN_EDIT_HYPERLINK:
1715cdf0e10cSrcweir case FN_REMOVE_HYPERLINK:
1716cdf0e10cSrcweir case FN_COPY_HYPERLINK_LOCATION:
171769a74367SOliver-Rainer Wittmann {
171869a74367SOliver-Rainer Wittmann SfxItemSet aSet(GetPool(),
171969a74367SOliver-Rainer Wittmann RES_TXTATR_INETFMT,
172069a74367SOliver-Rainer Wittmann RES_TXTATR_INETFMT);
172169a74367SOliver-Rainer Wittmann rSh.GetCurAttr(aSet);
172269a74367SOliver-Rainer Wittmann if(SFX_ITEM_SET > aSet.GetItemState( RES_TXTATR_INETFMT, sal_True ) || rSh.HasReadonlySel())
172369a74367SOliver-Rainer Wittmann {
172469a74367SOliver-Rainer Wittmann rSet.DisableItem(nWhich);
172569a74367SOliver-Rainer Wittmann }
172669a74367SOliver-Rainer Wittmann }
172769a74367SOliver-Rainer Wittmann break;
172869a74367SOliver-Rainer Wittmann
1729cdf0e10cSrcweir case SID_TRANSLITERATE_HALFWIDTH:
1730cdf0e10cSrcweir case SID_TRANSLITERATE_FULLWIDTH:
1731cdf0e10cSrcweir case SID_TRANSLITERATE_HIRAGANA:
1732cdf0e10cSrcweir case SID_TRANSLITERATE_KATAGANA:
1733cdf0e10cSrcweir {
1734cdf0e10cSrcweir SvtCJKOptions aCJKOptions;
1735cdf0e10cSrcweir if(!aCJKOptions.IsChangeCaseMapEnabled())
1736cdf0e10cSrcweir {
1737cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
1738cdf0e10cSrcweir rSet.DisableItem(nWhich);
1739cdf0e10cSrcweir }
1740cdf0e10cSrcweir else
1741cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
1742cdf0e10cSrcweir }
1743cdf0e10cSrcweir break;
1744cdf0e10cSrcweir case FN_READONLY_SELECTION_MODE :
1745cdf0e10cSrcweir if(!GetView().GetDocShell()->IsReadOnly())
1746cdf0e10cSrcweir rSet.DisableItem( nWhich );
1747cdf0e10cSrcweir else
1748cdf0e10cSrcweir {
1749cdf0e10cSrcweir rSet.Put(SfxBoolItem(nWhich, rSh.GetViewOptions()->IsSelectionInReadonly()));
1750cdf0e10cSrcweir }
1751cdf0e10cSrcweir break;
1752cdf0e10cSrcweir case FN_SELECTION_MODE_DEFAULT:
1753cdf0e10cSrcweir case FN_SELECTION_MODE_BLOCK :
1754cdf0e10cSrcweir rSet.Put(SfxBoolItem(nWhich, (nWhich == FN_SELECTION_MODE_DEFAULT) != rSh.IsBlockMode()));
1755cdf0e10cSrcweir break;
1756cdf0e10cSrcweir case SID_OPEN_HYPERLINK:
1757cdf0e10cSrcweir {
1758cdf0e10cSrcweir SfxItemSet aSet(GetPool(),
1759cdf0e10cSrcweir RES_TXTATR_INETFMT,
1760cdf0e10cSrcweir RES_TXTATR_INETFMT);
1761cdf0e10cSrcweir rSh.GetCurAttr(aSet);
1762cdf0e10cSrcweir if(SFX_ITEM_SET > aSet.GetItemState( RES_TXTATR_INETFMT, sal_False ))
1763cdf0e10cSrcweir rSet.DisableItem(nWhich);
1764cdf0e10cSrcweir }
1765cdf0e10cSrcweir break;
1766cdf0e10cSrcweir case SID_OPEN_SMARTTAGMENU:
1767cdf0e10cSrcweir {
1768cdf0e10cSrcweir uno::Sequence< rtl::OUString > aSmartTagTypes;
1769cdf0e10cSrcweir uno::Sequence< uno::Reference< container::XStringKeyMap > > aStringKeyMaps;
1770cdf0e10cSrcweir uno::Reference<text::XTextRange> xRange;
1771cdf0e10cSrcweir
1772cdf0e10cSrcweir rSh.GetSmartTagTerm( aSmartTagTypes, aStringKeyMaps, xRange );
1773cdf0e10cSrcweir
1774cdf0e10cSrcweir if ( xRange.is() && aSmartTagTypes.getLength() )
1775cdf0e10cSrcweir {
1776cdf0e10cSrcweir uno::Sequence < uno::Sequence< uno::Reference< smarttags::XSmartTagAction > > > aActionComponentsSequence;
1777cdf0e10cSrcweir uno::Sequence < uno::Sequence< sal_Int32 > > aActionIndicesSequence;
1778cdf0e10cSrcweir
1779cdf0e10cSrcweir const SmartTagMgr& rSmartTagMgr = SwSmartTagMgr::Get();
1780cdf0e10cSrcweir rSmartTagMgr.GetActionSequences( aSmartTagTypes,
1781cdf0e10cSrcweir aActionComponentsSequence,
1782cdf0e10cSrcweir aActionIndicesSequence );
1783cdf0e10cSrcweir
1784cdf0e10cSrcweir uno::Reference <frame::XController> xController = GetView().GetController();
1785cdf0e10cSrcweir const lang::Locale aLocale( SW_BREAKITER()->GetLocale( (LanguageType)GetAppLanguage() ) );
1786cdf0e10cSrcweir const rtl::OUString aApplicationName( rSmartTagMgr.GetApplicationName() );
1787cdf0e10cSrcweir const rtl::OUString aRangeText = xRange->getString();
1788cdf0e10cSrcweir
1789cdf0e10cSrcweir const SvxSmartTagItem aItem( nWhich,
1790cdf0e10cSrcweir aActionComponentsSequence,
1791cdf0e10cSrcweir aActionIndicesSequence,
1792cdf0e10cSrcweir aStringKeyMaps,
1793cdf0e10cSrcweir xRange,
1794cdf0e10cSrcweir xController,
1795cdf0e10cSrcweir aLocale,
1796cdf0e10cSrcweir aApplicationName,
1797cdf0e10cSrcweir aRangeText );
1798cdf0e10cSrcweir
1799cdf0e10cSrcweir rSet.Put( aItem );
1800cdf0e10cSrcweir }
1801cdf0e10cSrcweir else
1802cdf0e10cSrcweir rSet.DisableItem(nWhich);
1803cdf0e10cSrcweir }
1804cdf0e10cSrcweir break;
18051ff378efSZheng Fan case FN_NUM_NUMBERING_ON:
18061ff378efSZheng Fan rSet.Put(SfxBoolItem(FN_NUM_NUMBERING_ON,rSh.SelectionHasNumber()));
18071ff378efSZheng Fan break;
18081ff378efSZheng Fan case FN_NUM_BULLET_ON:
18091ff378efSZheng Fan rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON,rSh.SelectionHasBullet()));
18101ff378efSZheng Fan break;
18111ff378efSZheng Fan case FN_BUL_NUM_RULE_INDEX:
18121ff378efSZheng Fan case FN_NUM_NUM_RULE_INDEX:
18131ff378efSZheng Fan {
18141ff378efSZheng Fan SwNumRule* pCurRule = (SwNumRule*)(GetShell().GetCurNumRule());
18151ff378efSZheng Fan sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF;
18161ff378efSZheng Fan rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,DEFAULT_NONE));
18171ff378efSZheng Fan rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,DEFAULT_NONE));
18181ff378efSZheng Fan if( pCurRule )
18191ff378efSZheng Fan {
18201ff378efSZheng Fan nActNumLvl = GetShell().GetNumLevel();
18211ff378efSZheng Fan if( nActNumLvl < MAXLEVEL )
18221ff378efSZheng Fan {
18231ff378efSZheng Fan nActNumLvl = 1<<nActNumLvl;
18241ff378efSZheng Fan }
18251ff378efSZheng Fan SvxNumRule aSvxRule = pCurRule->MakeSvxNumRule();
18261ff378efSZheng Fan if ( GetShell().HasBullet())
18271ff378efSZheng Fan {
18281ff378efSZheng Fan rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF));
18291ff378efSZheng Fan rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF));
18301ff378efSZheng Fan NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);
18311ff378efSZheng Fan if ( pBullets )
18321ff378efSZheng Fan {
18331ff378efSZheng Fan sal_uInt16 nBulIndex = pBullets->GetNBOIndexForNumRule(aSvxRule,nActNumLvl);
18341ff378efSZheng Fan rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,nBulIndex));
18351ff378efSZheng Fan }
18361ff378efSZheng Fan }else if ( GetShell().HasNumber() )
18371ff378efSZheng Fan {
18381ff378efSZheng Fan rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF));
18391ff378efSZheng Fan rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF));
18401ff378efSZheng Fan NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING);
18411ff378efSZheng Fan if ( pNumbering )
18421ff378efSZheng Fan {
18431ff378efSZheng Fan sal_uInt16 nBulIndex = pNumbering->GetNBOIndexForNumRule(aSvxRule,nActNumLvl);
18441ff378efSZheng Fan rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,nBulIndex));
18451ff378efSZheng Fan }
18461ff378efSZheng Fan }
18471ff378efSZheng Fan }
18481ff378efSZheng Fan }
18491ff378efSZheng Fan break;
1850cdf0e10cSrcweir case FN_NUM_CONTINUE:
1851cdf0e10cSrcweir {
1852cdf0e10cSrcweir {
1853cdf0e10cSrcweir // --> OD 2009-08-26 #i86492#
1854cdf0e10cSrcweir // Search also for bullet list
1855cdf0e10cSrcweir String aDummy;
1856cdf0e10cSrcweir const SwNumRule* pRule =
1857cdf0e10cSrcweir rSh.SearchNumRule( false, true, false, -1, aDummy );
1858cdf0e10cSrcweir if ( !pRule )
1859cdf0e10cSrcweir {
1860cdf0e10cSrcweir pRule = rSh.SearchNumRule( false, false, false, -1, aDummy );
1861cdf0e10cSrcweir }
1862cdf0e10cSrcweir // <--
1863cdf0e10cSrcweir if ( !pRule )
1864cdf0e10cSrcweir rSet.DisableItem(nWhich);
1865cdf0e10cSrcweir }
1866cdf0e10cSrcweir }
1867cdf0e10cSrcweir break;
1868cdf0e10cSrcweir case SID_INSERT_RLM :
1869cdf0e10cSrcweir case SID_INSERT_LRM :
1870cdf0e10cSrcweir case SID_INSERT_ZWNBSP :
1871cdf0e10cSrcweir case SID_INSERT_ZWSP:
1872cdf0e10cSrcweir {
1873cdf0e10cSrcweir SvtCTLOptions aCTLOptions;
1874cdf0e10cSrcweir sal_Bool bEnabled = aCTLOptions.IsCTLFontEnabled();
1875cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, bEnabled );
1876cdf0e10cSrcweir if(!bEnabled)
1877cdf0e10cSrcweir rSet.DisableItem(nWhich);
1878cdf0e10cSrcweir }
1879cdf0e10cSrcweir break;
1880cdf0e10cSrcweir }
1881cdf0e10cSrcweir nWhich = aIter.NextWhich();
1882cdf0e10cSrcweir }
1883cdf0e10cSrcweir }
1884cdf0e10cSrcweir /* -----------------------------2002/07/05 10:31------------------------------
1885cdf0e10cSrcweir Switch on/off header of footer of a page style - if an empty name is
1886cdf0e10cSrcweir given all styles are changed
1887cdf0e10cSrcweir ---------------------------------------------------------------------------*/
ChangeHeaderOrFooter(const String & rStyleName,sal_Bool bHeader,sal_Bool bOn,sal_Bool bShowWarning)1888cdf0e10cSrcweir void SwTextShell::ChangeHeaderOrFooter(
1889cdf0e10cSrcweir const String& rStyleName, sal_Bool bHeader, sal_Bool bOn, sal_Bool bShowWarning)
1890cdf0e10cSrcweir {
1891cdf0e10cSrcweir SwWrtShell& rSh = GetShell();
1892cdf0e10cSrcweir rSh.StartAllAction();
1893cdf0e10cSrcweir rSh.StartUndo( UNDO_HEADER_FOOTER ); // #i7983#
1894cdf0e10cSrcweir sal_Bool bExecute = sal_True;
1895cdf0e10cSrcweir sal_Bool bCrsrSet = sal_False;
1896cdf0e10cSrcweir for( sal_uInt16 nFrom = 0, nTo = rSh.GetPageDescCnt();
1897cdf0e10cSrcweir nFrom < nTo; ++nFrom )
1898cdf0e10cSrcweir {
1899cdf0e10cSrcweir int bChgd = sal_False;
1900cdf0e10cSrcweir SwPageDesc aDesc( rSh.GetPageDesc( nFrom ));
1901cdf0e10cSrcweir String sTmp(aDesc.GetName());
1902cdf0e10cSrcweir if( !rStyleName.Len() || rStyleName == sTmp )
1903cdf0e10cSrcweir {
1904cdf0e10cSrcweir if( bShowWarning && !bOn && GetActiveView() && GetActiveView() == &GetView() &&
1905cdf0e10cSrcweir ((bHeader && aDesc.GetMaster().GetHeader().IsActive()) ||
1906cdf0e10cSrcweir (!bHeader && aDesc.GetMaster().GetFooter().IsActive())))
1907cdf0e10cSrcweir {
1908cdf0e10cSrcweir bShowWarning = sal_False;
1909cdf0e10cSrcweir //Actions have to be closed while the dialog is showing
1910cdf0e10cSrcweir rSh.EndAllAction();
1911cdf0e10cSrcweir
1912cdf0e10cSrcweir Window* pParent = &GetView().GetViewFrame()->GetWindow();
1913cdf0e10cSrcweir sal_Bool bRet = RET_YES == QueryBox( pParent, ResId( RID_SVXQBX_DELETE_HEADFOOT,
1914cdf0e10cSrcweir DIALOG_MGR() ) ).Execute();
1915cdf0e10cSrcweir bExecute = bRet;
1916cdf0e10cSrcweir rSh.StartAllAction();
1917cdf0e10cSrcweir }
1918cdf0e10cSrcweir if( bExecute )
1919cdf0e10cSrcweir {
1920cdf0e10cSrcweir bChgd = sal_True;
1921cdf0e10cSrcweir SwFrmFmt &rMaster = aDesc.GetMaster();
1922cdf0e10cSrcweir if(bHeader)
1923cdf0e10cSrcweir rMaster.SetFmtAttr( SwFmtHeader( bOn ));
1924cdf0e10cSrcweir else
1925cdf0e10cSrcweir rMaster.SetFmtAttr( SwFmtFooter( bOn ));
1926cdf0e10cSrcweir if( bOn )
1927cdf0e10cSrcweir {
1928cdf0e10cSrcweir SvxULSpaceItem aUL(bHeader ? 0 : MM50, bHeader ? MM50 : 0, RES_UL_SPACE );
1929cdf0e10cSrcweir SwFrmFmt* pFmt = bHeader ?
1930cdf0e10cSrcweir (SwFrmFmt*)rMaster.GetHeader().GetHeaderFmt() :
1931cdf0e10cSrcweir (SwFrmFmt*)rMaster.GetFooter().GetFooterFmt();
1932cdf0e10cSrcweir pFmt->SetFmtAttr( aUL );
1933cdf0e10cSrcweir }
1934cdf0e10cSrcweir }
1935cdf0e10cSrcweir if( bChgd )
1936cdf0e10cSrcweir {
1937cdf0e10cSrcweir rSh.ChgPageDesc( nFrom, aDesc );
1938cdf0e10cSrcweir
1939cdf0e10cSrcweir if( !bCrsrSet && bOn )
1940cdf0e10cSrcweir bCrsrSet = rSh.SetCrsrInHdFt(
19411ff378efSZheng Fan !rStyleName.Len() ? (sal_uInt16)0xFFFF : nFrom,
1942cdf0e10cSrcweir bHeader );
1943cdf0e10cSrcweir }
1944cdf0e10cSrcweir }
1945cdf0e10cSrcweir }
1946cdf0e10cSrcweir rSh.EndUndo( UNDO_HEADER_FOOTER ); // #i7983#
1947cdf0e10cSrcweir rSh.EndAllAction();
1948cdf0e10cSrcweir }
1949cdf0e10cSrcweir
1950