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 10cdf0e10cSrcweir * 11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 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. 19cdf0e10cSrcweir * 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 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 258cdf0e10cSrcweir rWrtSh.SetAttr( 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 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 302cdf0e10cSrcweir void SwTextShell::Execute(SfxRequest &rReq) 303cdf0e10cSrcweir { 304cdf0e10cSrcweir sal_Bool bUseDialog = sal_True; 305cdf0e10cSrcweir const SfxItemSet *pArgs = rReq.GetArgs(); 306cdf0e10cSrcweir SwWrtShell& rWrtSh = GetShell(); 307cdf0e10cSrcweir const SfxPoolItem* pItem = 0; 308cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 309cdf0e10cSrcweir if(pArgs) 310cdf0e10cSrcweir pArgs->GetItemState(GetPool().GetWhich(nSlot), sal_False, &pItem); 311cdf0e10cSrcweir switch( nSlot ) 312cdf0e10cSrcweir { 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 321cdf0e10cSrcweir //!! Remember the view frame right now... 322cdf0e10cSrcweir //!! (call to GetView().GetViewFrame() will break if the 323cdf0e10cSrcweir //!! SwTextShell got destroyed meanwhile.) 324cdf0e10cSrcweir SfxViewFrame *pViewFrame = GetView().GetViewFrame(); 325cdf0e10cSrcweir 326cdf0e10cSrcweir if (aNewLangTxt.EqualsAscii( "*" )) 327cdf0e10cSrcweir { 328cdf0e10cSrcweir // open the dialog "Tools/Options/Language Settings - Language" 329cdf0e10cSrcweir // to set the documents default language 330cdf0e10cSrcweir SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); 331cdf0e10cSrcweir if (pFact) 332cdf0e10cSrcweir { 333cdf0e10cSrcweir VclAbstractDialog* pDlg = pFact->CreateVclDialog( GetView().GetWindow(), SID_LANGUAGE_OPTIONS ); 334cdf0e10cSrcweir pDlg->Execute(); 335cdf0e10cSrcweir delete pDlg; 336cdf0e10cSrcweir } 337cdf0e10cSrcweir } 338cdf0e10cSrcweir else 339cdf0e10cSrcweir { 340cdf0e10cSrcweir //!! We have to use StartAction / EndAction bracketing in 341cdf0e10cSrcweir //!! order to prevent possible destruction of the SwTextShell 342cdf0e10cSrcweir //!! due to the selection changes coming below. 343cdf0e10cSrcweir rWrtSh.StartAction(); 344cdf0e10cSrcweir // prevent view from jumping because of (temporary) selection changes 345cdf0e10cSrcweir rWrtSh.LockView( sal_True ); 346cdf0e10cSrcweir // save selection for later restoration 347cdf0e10cSrcweir rWrtSh.Push(); 348cdf0e10cSrcweir 349cdf0e10cSrcweir // setting the new language... 350cdf0e10cSrcweir if (aNewLangTxt.Len() > 0) 351cdf0e10cSrcweir { 352cdf0e10cSrcweir const String aSelectionLangPrefix( String::CreateFromAscii("Current_") ); 353cdf0e10cSrcweir const String aParagraphLangPrefix( String::CreateFromAscii("Paragraph_") ); 354cdf0e10cSrcweir const String aDocumentLangPrefix( String::CreateFromAscii("Default_") ); 355cdf0e10cSrcweir const String aStrNone( String::CreateFromAscii("LANGUAGE_NONE") ); 356cdf0e10cSrcweir const String aStrResetLangs( String::CreateFromAscii("RESET_LANGUAGES") ); 357cdf0e10cSrcweir 358cdf0e10cSrcweir SfxItemSet aCoreSet( GetPool(), 359cdf0e10cSrcweir RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE, 360cdf0e10cSrcweir RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, 361cdf0e10cSrcweir RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE, 362cdf0e10cSrcweir 0 ); 363cdf0e10cSrcweir 364cdf0e10cSrcweir xub_StrLen nPos = 0; 365cdf0e10cSrcweir bool bForSelection = true; 366cdf0e10cSrcweir bool bForParagraph = false; 367cdf0e10cSrcweir if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aSelectionLangPrefix, 0 ))) 368cdf0e10cSrcweir { 369cdf0e10cSrcweir // ... for the current selection 370cdf0e10cSrcweir aNewLangTxt = aNewLangTxt.Erase( nPos, aSelectionLangPrefix.Len() ); 371cdf0e10cSrcweir bForSelection = true; 372cdf0e10cSrcweir } 373cdf0e10cSrcweir else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aParagraphLangPrefix , 0 ))) 374cdf0e10cSrcweir { 375cdf0e10cSrcweir // ... for the current paragraph language 376cdf0e10cSrcweir aNewLangTxt = aNewLangTxt.Erase( nPos, aParagraphLangPrefix.Len() ); 377cdf0e10cSrcweir bForSelection = true; 378cdf0e10cSrcweir bForParagraph = true; 379cdf0e10cSrcweir } 380cdf0e10cSrcweir else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aDocumentLangPrefix , 0 ))) 381cdf0e10cSrcweir { 382cdf0e10cSrcweir // ... as default document language 383cdf0e10cSrcweir aNewLangTxt = aNewLangTxt.Erase( nPos, aDocumentLangPrefix.Len() ); 384cdf0e10cSrcweir bForSelection = false; 385cdf0e10cSrcweir } 386cdf0e10cSrcweir 387cdf0e10cSrcweir if (bForParagraph) 388cdf0e10cSrcweir SwLangHelper::SelectCurrentPara( rWrtSh ); 389cdf0e10cSrcweir 390cdf0e10cSrcweir if (!bForSelection) // document language to be changed... 391cdf0e10cSrcweir { 392cdf0e10cSrcweir rWrtSh.SelAll(); 393cdf0e10cSrcweir rWrtSh.ExtendedSelectAll(); 394cdf0e10cSrcweir } 395cdf0e10cSrcweir if (aNewLangTxt == aStrNone) 396cdf0e10cSrcweir SwLangHelper::SetLanguage_None( rWrtSh, bForSelection, aCoreSet ); 397cdf0e10cSrcweir else if (aNewLangTxt == aStrResetLangs) 398cdf0e10cSrcweir SwLangHelper::ResetLanguages( rWrtSh, bForSelection ); 399cdf0e10cSrcweir else 400cdf0e10cSrcweir SwLangHelper::SetLanguage( rWrtSh, aNewLangTxt, bForSelection, aCoreSet ); 401cdf0e10cSrcweir } 402cdf0e10cSrcweir 403cdf0e10cSrcweir // restore selection... 404cdf0e10cSrcweir rWrtSh.Pop( sal_False ); 405cdf0e10cSrcweir 406cdf0e10cSrcweir rWrtSh.LockView( sal_False ); 407cdf0e10cSrcweir rWrtSh.EndAction(); 408cdf0e10cSrcweir } 409cdf0e10cSrcweir 410cdf0e10cSrcweir // invalidate slot to get the new language displayed 411cdf0e10cSrcweir pViewFrame->GetBindings().Invalidate( nSlot ); 412cdf0e10cSrcweir 413cdf0e10cSrcweir rReq.Done(); 414cdf0e10cSrcweir break; 415cdf0e10cSrcweir } 416cdf0e10cSrcweir 417cdf0e10cSrcweir case SID_THES: 418cdf0e10cSrcweir { 419cdf0e10cSrcweir // replace word/selection with text from selected sub menu entry 420cdf0e10cSrcweir String aReplaceText; 421cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES , sal_False ); 422cdf0e10cSrcweir if (pItem2) 423cdf0e10cSrcweir aReplaceText = pItem2->GetValue(); 424cdf0e10cSrcweir if (aReplaceText.Len() > 0) 425cdf0e10cSrcweir { 426cdf0e10cSrcweir SwView &rView2 = rWrtSh.GetView(); 427cdf0e10cSrcweir const bool bSelection = rWrtSh.HasSelection(); 428cdf0e10cSrcweir const String aLookUpText = rView2.GetThesaurusLookUpText( bSelection ); 429cdf0e10cSrcweir rView2.InsertThesaurusSynonym( aReplaceText, aLookUpText, bSelection ); 430cdf0e10cSrcweir } 431cdf0e10cSrcweir } 432cdf0e10cSrcweir break; 433cdf0e10cSrcweir 434cdf0e10cSrcweir case SID_CHARMAP: 435cdf0e10cSrcweir { 436cdf0e10cSrcweir InsertSymbol( rReq ); 437cdf0e10cSrcweir } 438cdf0e10cSrcweir break; 439cdf0e10cSrcweir case FN_INSERT_FOOTNOTE: 440cdf0e10cSrcweir case FN_INSERT_ENDNOTE: 441cdf0e10cSrcweir { 442cdf0e10cSrcweir String aStr; 443cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pFont, SfxStringItem, FN_PARAM_1 , sal_False ); 444cdf0e10cSrcweir // SFX_REQUEST_ARG( rReq, pCharset, SfxInt16Item, FN_PARAM_2 , sal_False ); 445cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, nSlot , sal_False ); 446cdf0e10cSrcweir if ( pNameItem ) 447cdf0e10cSrcweir aStr = pNameItem->GetValue(); 448cdf0e10cSrcweir sal_Bool bFont = pFont && pFont->GetValue().Len(); 449cdf0e10cSrcweir rWrtSh.StartUndo( UNDO_UI_INSERT_FOOTNOTE ); 450cdf0e10cSrcweir rWrtSh.InsertFootnote( aStr, nSlot == FN_INSERT_ENDNOTE, !bFont ); 451cdf0e10cSrcweir if ( bFont ) 452cdf0e10cSrcweir { 453cdf0e10cSrcweir rWrtSh.Left( CRSR_SKIP_CHARS, sal_True, 1, sal_False ); 454cdf0e10cSrcweir SfxItemSet aSet( rWrtSh.GetAttrPool(), RES_CHRATR_FONT, RES_CHRATR_FONT ); 455cdf0e10cSrcweir rWrtSh.GetCurAttr( aSet ); 456cdf0e10cSrcweir SvxFontItem &rFont = (SvxFontItem &) aSet.Get( RES_CHRATR_FONT ); 457cdf0e10cSrcweir SvxFontItem aFont( rFont.GetFamily(), pFont->GetValue(), 458cdf0e10cSrcweir rFont.GetStyleName(), rFont.GetPitch(), RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT ); 459cdf0e10cSrcweir //pCharset ? (CharSet) pCharset->GetValue() : RTL_TEXTENCODING_DONTKNOW ); 460cdf0e10cSrcweir rWrtSh.SetAttr( aSet, nsSetAttrMode::SETATTR_DONTEXPAND ); 461cdf0e10cSrcweir rWrtSh.ResetSelect(0, sal_False); 462cdf0e10cSrcweir rWrtSh.EndSelect(); 463cdf0e10cSrcweir rWrtSh.GotoFtnTxt(); 464cdf0e10cSrcweir } 465cdf0e10cSrcweir rWrtSh.EndUndo( UNDO_UI_INSERT_FOOTNOTE ); 466cdf0e10cSrcweir rReq.Done(); 467cdf0e10cSrcweir } 468cdf0e10cSrcweir break; 469cdf0e10cSrcweir case FN_INSERT_FOOTNOTE_DLG: 470cdf0e10cSrcweir { 471cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 472cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!"); 473cdf0e10cSrcweir AbstractInsFootNoteDlg* pDlg = pFact->CreateInsFootNoteDlg( DLG_INS_FOOTNOTE, 474cdf0e10cSrcweir GetView().GetWindow(), rWrtSh, sal_False ); 475cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 476cdf0e10cSrcweir pDlg->SetHelpId(GetStaticInterface()->GetSlot(nSlot)->GetCommand()); 477cdf0e10cSrcweir if ( pDlg->Execute() == RET_OK ) 478cdf0e10cSrcweir { 479cdf0e10cSrcweir sal_uInt16 nId = pDlg->IsEndNote() ? FN_INSERT_ENDNOTE : FN_INSERT_FOOTNOTE; 480cdf0e10cSrcweir SfxRequest aReq( GetView().GetViewFrame(), nId ); 481cdf0e10cSrcweir if ( pDlg->GetStr().Len() ) 482cdf0e10cSrcweir aReq.AppendItem( SfxStringItem( nId, pDlg->GetStr() ) ); 483cdf0e10cSrcweir if ( pDlg->GetFontName().Len() ) 484cdf0e10cSrcweir aReq.AppendItem( SfxStringItem( FN_PARAM_1, pDlg->GetFontName() ) ); 485cdf0e10cSrcweir //aReq.AppendItem( SfxStringItem( FN_PARAM_2, pDlg->GetCharSet() ) ); 486cdf0e10cSrcweir ExecuteSlot( aReq ); 487cdf0e10cSrcweir } 488cdf0e10cSrcweir 489cdf0e10cSrcweir rReq.Ignore(); 490cdf0e10cSrcweir delete pDlg; 491cdf0e10cSrcweir } 492cdf0e10cSrcweir break; 493cdf0e10cSrcweir case FN_FORMAT_FOOTNOTE_DLG: 494cdf0e10cSrcweir { 495cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 496cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 497cdf0e10cSrcweir 498cdf0e10cSrcweir VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg( GetView().GetWindow(), rWrtSh, DLG_DOC_FOOTNOTE ); 499cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 500cdf0e10cSrcweir pDlg->Execute(); 501cdf0e10cSrcweir delete pDlg; 502cdf0e10cSrcweir break; 503cdf0e10cSrcweir } 504cdf0e10cSrcweir case SID_INSERTDOC: 505cdf0e10cSrcweir { 506cdf0e10cSrcweir GetView().ExecuteInsertDoc( rReq, pItem ); 507cdf0e10cSrcweir break; 508cdf0e10cSrcweir } 509cdf0e10cSrcweir case FN_FORMAT_RESET: 510cdf0e10cSrcweir { 511cdf0e10cSrcweir // #i78856, reset all attributes but not the language attributes 512cdf0e10cSrcweir // (for this build an array of all relevant attributes and 513cdf0e10cSrcweir // remove the languages from that) 514cdf0e10cSrcweir SvUShortsSort aAttribs; 515cdf0e10cSrcweir 516cdf0e10cSrcweir sal_uInt16 __FAR_DATA aResetableSetRange[] = { 517cdf0e10cSrcweir RES_FRMATR_BEGIN, RES_FRMATR_END-1, 518cdf0e10cSrcweir RES_CHRATR_BEGIN, RES_CHRATR_LANGUAGE - 1, 519cdf0e10cSrcweir RES_CHRATR_LANGUAGE + 1, RES_CHRATR_CJK_LANGUAGE - 1, 520cdf0e10cSrcweir RES_CHRATR_CJK_LANGUAGE + 1, RES_CHRATR_CTL_LANGUAGE - 1, 521cdf0e10cSrcweir RES_CHRATR_CTL_LANGUAGE + 1, RES_CHRATR_END-1, 522cdf0e10cSrcweir RES_PARATR_BEGIN, RES_PARATR_END-1, 523cdf0e10cSrcweir RES_TXTATR_INETFMT, RES_TXTATR_INETFMT, 524cdf0e10cSrcweir RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT, 525cdf0e10cSrcweir RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY, 526cdf0e10cSrcweir RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER, 527cdf0e10cSrcweir RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, 528cdf0e10cSrcweir 0 529cdf0e10cSrcweir }; 530cdf0e10cSrcweir sal_uInt16 __FAR_DATA *pUShorts = aResetableSetRange; 531cdf0e10cSrcweir while (*pUShorts) 532cdf0e10cSrcweir { 533cdf0e10cSrcweir sal_uInt16 nL = pUShorts[1] - pUShorts[0] + 1; 534cdf0e10cSrcweir sal_uInt16 nE = pUShorts[0]; 535cdf0e10cSrcweir for (sal_uInt16 i = 0; i < nL; ++i) 536cdf0e10cSrcweir aAttribs.Insert( nE++ ); 537cdf0e10cSrcweir pUShorts += 2; 538cdf0e10cSrcweir } 539cdf0e10cSrcweir 540cdf0e10cSrcweir rWrtSh.ResetAttr( &aAttribs ); 541cdf0e10cSrcweir rReq.Done(); 542cdf0e10cSrcweir break; 543cdf0e10cSrcweir } 544cdf0e10cSrcweir case FN_INSERT_BREAK_DLG: 545cdf0e10cSrcweir { 546cdf0e10cSrcweir sal_uInt16 nKind=0, nPageNumber=0; 547cdf0e10cSrcweir String aTemplateName; 548cdf0e10cSrcweir if ( pItem ) 549cdf0e10cSrcweir { 550cdf0e10cSrcweir nKind = ((SfxInt16Item*)pItem)->GetValue(); 551cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pTemplate, SfxStringItem, FN_PARAM_1 , sal_False ); 552cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pNumber, SfxUInt16Item, FN_PARAM_2 , sal_False ); 553cdf0e10cSrcweir if ( pTemplate ) 554cdf0e10cSrcweir aTemplateName = pTemplate->GetValue(); 555cdf0e10cSrcweir if ( pNumber ) 556cdf0e10cSrcweir nPageNumber = pNumber->GetValue(); 557cdf0e10cSrcweir } 558cdf0e10cSrcweir else 559cdf0e10cSrcweir { 560cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 561cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 562cdf0e10cSrcweir 563cdf0e10cSrcweir AbstractSwBreakDlg* pDlg = pFact->CreateSwBreakDlg( GetView().GetWindow(), rWrtSh, DLG_BREAK ); 564cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 565cdf0e10cSrcweir if ( pDlg->Execute() == RET_OK ) 566cdf0e10cSrcweir { 567cdf0e10cSrcweir nKind = pDlg->GetKind(); 568cdf0e10cSrcweir aTemplateName = pDlg->GetTemplateName(); 569cdf0e10cSrcweir nPageNumber = pDlg->GetPageNumber(); 570cdf0e10cSrcweir rReq.AppendItem( SfxInt16Item( FN_INSERT_BREAK_DLG, nKind ) ); 571cdf0e10cSrcweir rReq.AppendItem( SfxUInt16Item( FN_PARAM_2, nPageNumber ) ); 572cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( FN_PARAM_1, aTemplateName ) ); 573cdf0e10cSrcweir rReq.Done(); 574cdf0e10cSrcweir } 575cdf0e10cSrcweir else 576cdf0e10cSrcweir rReq.Ignore(); 577cdf0e10cSrcweir delete pDlg; 578cdf0e10cSrcweir } 579cdf0e10cSrcweir 580cdf0e10cSrcweir switch ( nKind ) 581cdf0e10cSrcweir { 582cdf0e10cSrcweir case 1 : 583cdf0e10cSrcweir rWrtSh.InsertLineBreak(); break; 584cdf0e10cSrcweir case 2 : 585cdf0e10cSrcweir rWrtSh.InsertColumnBreak(); break; 586cdf0e10cSrcweir case 3 : 587cdf0e10cSrcweir { 588cdf0e10cSrcweir rWrtSh.StartAllAction(); 589cdf0e10cSrcweir if( aTemplateName.Len() ) 590cdf0e10cSrcweir rWrtSh.InsertPageBreak( &aTemplateName, nPageNumber ); 591cdf0e10cSrcweir else 592cdf0e10cSrcweir rWrtSh.InsertPageBreak(); 593cdf0e10cSrcweir rWrtSh.EndAllAction(); 594cdf0e10cSrcweir } 595cdf0e10cSrcweir } 596cdf0e10cSrcweir 597cdf0e10cSrcweir break; 598cdf0e10cSrcweir } 599cdf0e10cSrcweir case FN_INSERT_BOOKMARK: 600cdf0e10cSrcweir { 601cdf0e10cSrcweir if ( pItem ) 602cdf0e10cSrcweir { 603cdf0e10cSrcweir ::rtl::OUString sName = ((SfxStringItem*)pItem)->GetValue(); 604cdf0e10cSrcweir rWrtSh.SetBookmark( KeyCode(), sName, aEmptyStr ); 605cdf0e10cSrcweir } 606cdf0e10cSrcweir else 607cdf0e10cSrcweir { 608cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 609cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 610cdf0e10cSrcweir 611cdf0e10cSrcweir VclAbstractDialog* pDlg = pFact->CreateSwInsertBookmarkDlg( GetView().GetWindow(), rWrtSh, rReq, DLG_INSERT_BOOKMARK ); 612cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 613cdf0e10cSrcweir pDlg->Execute(); 614cdf0e10cSrcweir delete pDlg; 615cdf0e10cSrcweir } 616cdf0e10cSrcweir 617cdf0e10cSrcweir break; 618cdf0e10cSrcweir } 619cdf0e10cSrcweir case FN_DELETE_BOOKMARK: 620cdf0e10cSrcweir { 621cdf0e10cSrcweir if ( pItem ) 622cdf0e10cSrcweir { 623cdf0e10cSrcweir IDocumentMarkAccess* const pMarkAccess = rWrtSh.getIDocumentMarkAccess(); 624cdf0e10cSrcweir pMarkAccess->deleteMark( pMarkAccess->findMark(((SfxStringItem*)pItem)->GetValue()) ); 625cdf0e10cSrcweir } 626cdf0e10cSrcweir break; 627cdf0e10cSrcweir } 628cdf0e10cSrcweir case FN_AUTOFORMAT_REDLINE_APPLY: 629cdf0e10cSrcweir { 630cdf0e10cSrcweir SvxSwAutoFmtFlags aFlags(SvxAutoCorrCfg::Get()->GetAutoCorrect()->GetSwFlags()); 631cdf0e10cSrcweir // das muss fuer die Nachbearbeitung immer sal_False sein 632cdf0e10cSrcweir aFlags.bAFmtByInput = sal_False; 633cdf0e10cSrcweir aFlags.bWithRedlining = sal_True; 634cdf0e10cSrcweir rWrtSh.AutoFormat( &aFlags ); 635cdf0e10cSrcweir aFlags.bWithRedlining = sal_False; 636cdf0e10cSrcweir 637cdf0e10cSrcweir SfxViewFrame* pVFrame = GetView().GetViewFrame(); 638cdf0e10cSrcweir if (pVFrame->HasChildWindow(FN_REDLINE_ACCEPT)) 639cdf0e10cSrcweir pVFrame->ToggleChildWindow(FN_REDLINE_ACCEPT); 640cdf0e10cSrcweir 641cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 642cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 643cdf0e10cSrcweir 644cdf0e10cSrcweir AbstractSwModalRedlineAcceptDlg* pDlg = pFact->CreateSwModalRedlineAcceptDlg( &GetView().GetEditWin(), DLG_MOD_REDLINE_ACCEPT ); 645cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 646cdf0e10cSrcweir 647cdf0e10cSrcweir switch (lcl_AskRedlineMode(&GetView().GetEditWin())) 648cdf0e10cSrcweir { 649cdf0e10cSrcweir case RET_OK: 650cdf0e10cSrcweir { 651cdf0e10cSrcweir pDlg->AcceptAll(sal_True); 652cdf0e10cSrcweir SfxRequest aReq( pVFrame, FN_AUTOFORMAT_APPLY ); 653cdf0e10cSrcweir aReq.Done(); 654cdf0e10cSrcweir rReq.Ignore(); 655cdf0e10cSrcweir break; 656cdf0e10cSrcweir } 657cdf0e10cSrcweir 658cdf0e10cSrcweir case RET_CANCEL: 659cdf0e10cSrcweir pDlg->AcceptAll(sal_False); 660cdf0e10cSrcweir rReq.Ignore(); 661cdf0e10cSrcweir break; 662cdf0e10cSrcweir 663cdf0e10cSrcweir case 2: 664cdf0e10cSrcweir pDlg->Execute(); 665cdf0e10cSrcweir rReq.Done(); 666cdf0e10cSrcweir break; 667cdf0e10cSrcweir } 668cdf0e10cSrcweir delete pDlg; 669cdf0e10cSrcweir } 670cdf0e10cSrcweir break; 671cdf0e10cSrcweir 672cdf0e10cSrcweir case FN_AUTOFORMAT_APPLY: 673cdf0e10cSrcweir { 674cdf0e10cSrcweir SvxSwAutoFmtFlags aFlags(SvxAutoCorrCfg::Get()->GetAutoCorrect()->GetSwFlags()); 675cdf0e10cSrcweir // das muss fuer die Nachbearbeitung immer sal_False sein 676cdf0e10cSrcweir aFlags.bAFmtByInput = sal_False; 677cdf0e10cSrcweir rWrtSh.AutoFormat( &aFlags ); 678cdf0e10cSrcweir rReq.Done(); 679cdf0e10cSrcweir } 680cdf0e10cSrcweir break; 681cdf0e10cSrcweir case FN_AUTOFORMAT_AUTO: 682cdf0e10cSrcweir { 683cdf0e10cSrcweir SvxAutoCorrCfg* pACfg = SvxAutoCorrCfg::Get(); 684cdf0e10cSrcweir sal_Bool bSet = pItem ? ((const SfxBoolItem*)pItem)->GetValue() : !pACfg->IsAutoFmtByInput(); 685cdf0e10cSrcweir if( bSet != pACfg->IsAutoFmtByInput() ) 686cdf0e10cSrcweir { 687cdf0e10cSrcweir pACfg->SetAutoFmtByInput( bSet ); 688cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().Invalidate( nSlot ); 689cdf0e10cSrcweir if ( !pItem ) 690cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( GetPool().GetWhich(nSlot), bSet ) ); 691cdf0e10cSrcweir rReq.Done(); 692cdf0e10cSrcweir } 693cdf0e10cSrcweir } 694cdf0e10cSrcweir break; 695cdf0e10cSrcweir case FN_AUTO_CORRECT: 696cdf0e10cSrcweir { 697cdf0e10cSrcweir // erstmal auf Blank defaulten 698cdf0e10cSrcweir sal_Unicode cChar = ' '; 699cdf0e10cSrcweir rWrtSh.AutoCorrect( *SvxAutoCorrCfg::Get()->GetAutoCorrect(), cChar ); 700cdf0e10cSrcweir rReq.Done(); 701cdf0e10cSrcweir } 702cdf0e10cSrcweir break; 703cdf0e10cSrcweir case FN_TABLE_SORT_DIALOG: 704cdf0e10cSrcweir case FN_SORTING_DLG: 705cdf0e10cSrcweir { 706cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 707cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 708cdf0e10cSrcweir 709cdf0e10cSrcweir VclAbstractDialog* pDlg = pFact->CreateVclAbstractDialog( GetView().GetWindow(), rWrtSh, DLG_SORTING ); 710cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 711cdf0e10cSrcweir pDlg->Execute(); 712cdf0e10cSrcweir delete pDlg; 713cdf0e10cSrcweir rReq.Done(); 714cdf0e10cSrcweir } 715cdf0e10cSrcweir break; 716cdf0e10cSrcweir case FN_NUMBERING_OUTLINE_DLG: 717cdf0e10cSrcweir { 718cdf0e10cSrcweir SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1); 719cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 720cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!"); 721cdf0e10cSrcweir SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE, 722cdf0e10cSrcweir GetView().GetWindow(), &aTmp, rWrtSh); 723cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 724cdf0e10cSrcweir pDlg->Execute(); 725cdf0e10cSrcweir delete pDlg; 726cdf0e10cSrcweir rReq.Done(); 727cdf0e10cSrcweir } 728cdf0e10cSrcweir break; 729cdf0e10cSrcweir case FN_CALCULATE: 730cdf0e10cSrcweir { 731cdf0e10cSrcweir SwTransferable* pTransfer = new SwTransferable( rWrtSh ); 732cdf0e10cSrcweir /*??*/ uno::Reference< 733cdf0e10cSrcweir datatransfer::XTransferable > xRef( 734cdf0e10cSrcweir pTransfer ); 735cdf0e10cSrcweir pTransfer->CalculateAndCopy(); 736cdf0e10cSrcweir rReq.Done(); 737cdf0e10cSrcweir } 738cdf0e10cSrcweir break; 739cdf0e10cSrcweir case FN_GOTO_REFERENCE: 740cdf0e10cSrcweir { 741cdf0e10cSrcweir SwField *pFld = rWrtSh.GetCurFld(); 742cdf0e10cSrcweir if(pFld && pFld->GetTypeId() == TYP_GETREFFLD) 743cdf0e10cSrcweir { 744cdf0e10cSrcweir rWrtSh.StartAllAction(); 745cdf0e10cSrcweir rWrtSh.SwCrsrShell::GotoRefMark( ((SwGetRefField*)pFld)->GetSetRefName(), 746cdf0e10cSrcweir ((SwGetRefField*)pFld)->GetSubType(), 747cdf0e10cSrcweir ((SwGetRefField*)pFld)->GetSeqNo() ); 748cdf0e10cSrcweir rWrtSh.EndAllAction(); 749cdf0e10cSrcweir rReq.Done(); 750cdf0e10cSrcweir } 751cdf0e10cSrcweir } 752cdf0e10cSrcweir break; 753cdf0e10cSrcweir case FN_EDIT_FORMULA: 754cdf0e10cSrcweir { 755cdf0e10cSrcweir const sal_uInt16 nId = SwInputChild::GetChildWindowId(); 756cdf0e10cSrcweir SfxViewFrame* pVFrame = GetView().GetViewFrame(); 757cdf0e10cSrcweir if(pItem) 758cdf0e10cSrcweir { 759cdf0e10cSrcweir //if the ChildWindow is active it has to be removed 760cdf0e10cSrcweir if( pVFrame->HasChildWindow( nId ) ) 761cdf0e10cSrcweir { 762cdf0e10cSrcweir pVFrame->ToggleChildWindow( nId ); 763cdf0e10cSrcweir pVFrame->GetBindings().InvalidateAll( sal_True ); 764cdf0e10cSrcweir } 765cdf0e10cSrcweir 766cdf0e10cSrcweir String sFormula(((const SfxStringItem*)pItem)->GetValue()); 767cdf0e10cSrcweir SwFldMgr aFldMgr; 768cdf0e10cSrcweir rWrtSh.StartAllAction(); 769cdf0e10cSrcweir sal_Bool bDelSel; 770cdf0e10cSrcweir if( 0 != (bDelSel = rWrtSh.HasSelection()) ) 771cdf0e10cSrcweir { 772cdf0e10cSrcweir rWrtSh.StartUndo( UNDO_START ); 773cdf0e10cSrcweir rWrtSh.DelRight(); 774cdf0e10cSrcweir } 775cdf0e10cSrcweir else 776cdf0e10cSrcweir { 777cdf0e10cSrcweir rWrtSh.EnterStdMode(); 778cdf0e10cSrcweir } 779cdf0e10cSrcweir 780cdf0e10cSrcweir if( !bDelSel && aFldMgr.GetCurFld() && TYP_FORMELFLD == aFldMgr.GetCurTypeId() ) 781cdf0e10cSrcweir aFldMgr.UpdateCurFld( aFldMgr.GetCurFld()->GetFormat(), aEmptyStr, sFormula ); 782cdf0e10cSrcweir else if( sFormula.Len() ) 783cdf0e10cSrcweir { 784cdf0e10cSrcweir if( rWrtSh.IsCrsrInTbl() ) 785cdf0e10cSrcweir { 786cdf0e10cSrcweir SfxItemSet aSet( rWrtSh.GetAttrPool(), RES_BOXATR_FORMULA, RES_BOXATR_FORMULA ); 787cdf0e10cSrcweir aSet.Put( SwTblBoxFormula( sFormula )); 788cdf0e10cSrcweir rWrtSh.SetTblBoxFormulaAttrs( aSet ); 789cdf0e10cSrcweir rWrtSh.UpdateTable(); 790cdf0e10cSrcweir } 791cdf0e10cSrcweir else 792cdf0e10cSrcweir { 793cdf0e10cSrcweir SvNumberFormatter* pFormatter = rWrtSh.GetNumberFormatter(); 794cdf0e10cSrcweir sal_uLong nSysNumFmt = pFormatter->GetFormatIndex( NF_NUMBER_STANDARD, LANGUAGE_SYSTEM); 795cdf0e10cSrcweir SwInsertFld_Data aData(TYP_FORMELFLD, nsSwGetSetExpType::GSE_FORMULA, aEmptyStr, sFormula, nSysNumFmt); 796cdf0e10cSrcweir aFldMgr.InsertFld(aData); 797cdf0e10cSrcweir } 798cdf0e10cSrcweir } 799cdf0e10cSrcweir 800cdf0e10cSrcweir if( bDelSel ) 801cdf0e10cSrcweir rWrtSh.EndUndo( UNDO_END ); 802cdf0e10cSrcweir rWrtSh.EndAllAction(); 803cdf0e10cSrcweir rReq.Done(); 804cdf0e10cSrcweir } 805cdf0e10cSrcweir else 806cdf0e10cSrcweir { 807cdf0e10cSrcweir rWrtSh.EndAllTblBoxEdit(); 808cdf0e10cSrcweir pVFrame->ToggleChildWindow( nId ); 809cdf0e10cSrcweir if( !pVFrame->HasChildWindow( nId ) ) 810cdf0e10cSrcweir pVFrame->GetBindings().InvalidateAll( sal_True ); 811cdf0e10cSrcweir rReq.Ignore(); 812cdf0e10cSrcweir } 813cdf0e10cSrcweir } 814cdf0e10cSrcweir 815cdf0e10cSrcweir break; 816cdf0e10cSrcweir case FN_TABLE_UNSET_READ_ONLY: 817cdf0e10cSrcweir { 818cdf0e10cSrcweir rWrtSh.UnProtectTbls(); 819cdf0e10cSrcweir } 820cdf0e10cSrcweir break; 821cdf0e10cSrcweir case FN_EDIT_HYPERLINK: 822cdf0e10cSrcweir GetView().GetViewFrame()->ToggleChildWindow(SID_HYPERLINK_DIALOG); 823cdf0e10cSrcweir break; 824cdf0e10cSrcweir case FN_REMOVE_HYPERLINK: 825cdf0e10cSrcweir { 826cdf0e10cSrcweir sal_Bool bSel = rWrtSh.HasSelection(); 827cdf0e10cSrcweir if(!bSel) 828cdf0e10cSrcweir { 829cdf0e10cSrcweir rWrtSh.StartAction(); 830cdf0e10cSrcweir rWrtSh.Push(); 831cdf0e10cSrcweir if(!rWrtSh.SelectTxtAttr( RES_TXTATR_INETFMT )) 832cdf0e10cSrcweir rWrtSh.SelWrd(); 833cdf0e10cSrcweir } 834cdf0e10cSrcweir //now remove the attribute 835cdf0e10cSrcweir SvUShortsSort aAttribs; 836cdf0e10cSrcweir aAttribs.Insert( RES_TXTATR_INETFMT ); 837cdf0e10cSrcweir rWrtSh.ResetAttr( &aAttribs ); 838cdf0e10cSrcweir if(!bSel) 839cdf0e10cSrcweir { 840cdf0e10cSrcweir rWrtSh.Pop(sal_False); 841cdf0e10cSrcweir rWrtSh.EndAction(); 842cdf0e10cSrcweir } 843cdf0e10cSrcweir } 844cdf0e10cSrcweir break; 845cdf0e10cSrcweir case SID_ATTR_BRUSH_CHAR : 846cdf0e10cSrcweir case SID_ATTR_CHAR_SCALEWIDTH : 847cdf0e10cSrcweir case SID_ATTR_CHAR_ROTATED : 848cdf0e10cSrcweir case FN_TXTATR_INET : 849cdf0e10cSrcweir case FN_INSERT_HYPERLINK: 850cdf0e10cSrcweir { 851cdf0e10cSrcweir sal_uInt16 nWhich = GetPool().GetWhich( nSlot ); 852cdf0e10cSrcweir if ( pArgs && pArgs->GetItemState( nWhich ) == SFX_ITEM_SET ) 853cdf0e10cSrcweir bUseDialog = sal_False; 854cdf0e10cSrcweir // intentionally no break 855cdf0e10cSrcweir } 856cdf0e10cSrcweir case SID_CHAR_DLG: 857eb39ad03SZheng Fan case SID_CHAR_DLG_EFFECT: 858cdf0e10cSrcweir { 859cdf0e10cSrcweir lcl_CharDialog( rWrtSh, bUseDialog, nSlot, pArgs, &rReq ); 860cdf0e10cSrcweir } 861cdf0e10cSrcweir break; 862cdf0e10cSrcweir case SID_CHAR_DLG_FOR_PARAGRAPH: 863cdf0e10cSrcweir { 864cdf0e10cSrcweir rWrtSh.Push(); //save current cursor 865cdf0e10cSrcweir SwLangHelper::SelectCurrentPara( rWrtSh ); 866cdf0e10cSrcweir lcl_CharDialog( rWrtSh, bUseDialog, nSlot, pArgs, &rReq ); 867cdf0e10cSrcweir rWrtSh.Pop( sal_False ); //restore old cursor 868cdf0e10cSrcweir } 869cdf0e10cSrcweir break; 870cdf0e10cSrcweir case SID_ATTR_LRSPACE : 871cdf0e10cSrcweir case SID_ATTR_ULSPACE : 872cdf0e10cSrcweir case SID_ATTR_BRUSH : 873cdf0e10cSrcweir case SID_PARA_VERTALIGN : 874cdf0e10cSrcweir case SID_ATTR_PARA_NUMRULE : 875cdf0e10cSrcweir case SID_ATTR_PARA_REGISTER : 876cdf0e10cSrcweir case SID_ATTR_PARA_PAGENUM : 877cdf0e10cSrcweir case FN_FORMAT_LINENUMBER : 878cdf0e10cSrcweir case FN_NUMBER_NEWSTART : 879cdf0e10cSrcweir case FN_NUMBER_NEWSTART_AT : 880cdf0e10cSrcweir case FN_FORMAT_DROPCAPS : 881cdf0e10cSrcweir case FN_DROP_TEXT: 882512ec161SZheng Fan case SID_ATTR_PARA_LRSPACE: 883cdf0e10cSrcweir { 884cdf0e10cSrcweir sal_uInt16 nWhich = GetPool().GetWhich( nSlot ); 885cdf0e10cSrcweir if ( pArgs && pArgs->GetItemState( nWhich ) == SFX_ITEM_SET ) 886cdf0e10cSrcweir bUseDialog = sal_False; 887cdf0e10cSrcweir // intentionally no break 888cdf0e10cSrcweir 889cdf0e10cSrcweir } 890cdf0e10cSrcweir case SID_PARA_DLG: 891cdf0e10cSrcweir { 892cdf0e10cSrcweir FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView())); 893cdf0e10cSrcweir SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); 894cdf0e10cSrcweir SfxItemSet aCoreSet( GetPool(), 895cdf0e10cSrcweir RES_PARATR_BEGIN, RES_PARATR_END - 1, 896cdf0e10cSrcweir // --> OD 2008-02-25 #refactorlists# 897cdf0e10cSrcweir RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1, 898cdf0e10cSrcweir // <-- 899cdf0e10cSrcweir RES_FRMATR_BEGIN, RES_FRMATR_END - 1, 900cdf0e10cSrcweir SID_ATTR_TABSTOP_POS, SID_ATTR_TABSTOP_POS, 901cdf0e10cSrcweir SID_ATTR_TABSTOP_DEFAULTS, SID_ATTR_TABSTOP_DEFAULTS, 902cdf0e10cSrcweir SID_ATTR_TABSTOP_OFFSET, SID_ATTR_TABSTOP_OFFSET, 903cdf0e10cSrcweir SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 904cdf0e10cSrcweir SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP, 905cdf0e10cSrcweir SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM, 906cdf0e10cSrcweir SID_HTML_MODE, SID_HTML_MODE, 907cdf0e10cSrcweir FN_PARAM_1, FN_PARAM_1, 908cdf0e10cSrcweir FN_NUMBER_NEWSTART, FN_NUMBER_NEWSTART_AT, 909cdf0e10cSrcweir FN_DROP_TEXT, FN_DROP_CHAR_STYLE_NAME, 910cdf0e10cSrcweir 0); 911cdf0e10cSrcweir // --> OD 2008-01-16 #newlistlevelattrs# 912cdf0e10cSrcweir // get also the list level indent values merged as LR-SPACE item, if needed. 913cdf0e10cSrcweir rWrtSh.GetCurAttr( aCoreSet, true ); 914cdf0e10cSrcweir // <-- 915cdf0e10cSrcweir aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE, 916cdf0e10cSrcweir ::GetHtmlMode(GetView().GetDocShell()))); 917cdf0e10cSrcweir 918cdf0e10cSrcweir // Tabulatoren, DefaultTabs ins ItemSet Stecken 919cdf0e10cSrcweir const SvxTabStopItem& rDefTabs = (const SvxTabStopItem&) 920cdf0e10cSrcweir GetPool().GetDefaultItem(RES_PARATR_TABSTOP); 921cdf0e10cSrcweir 922cdf0e10cSrcweir sal_uInt16 nDefDist = ::GetTabDist( rDefTabs ); 923cdf0e10cSrcweir SfxUInt16Item aDefDistItem( SID_ATTR_TABSTOP_DEFAULTS, nDefDist ); 924cdf0e10cSrcweir aCoreSet.Put( aDefDistItem ); 925cdf0e10cSrcweir 926cdf0e10cSrcweir // Aktueller Tab 927cdf0e10cSrcweir SfxUInt16Item aTabPos( SID_ATTR_TABSTOP_POS, 0 ); 928cdf0e10cSrcweir aCoreSet.Put( aTabPos ); 929cdf0e10cSrcweir 930cdf0e10cSrcweir // linker Rand als Offset 931cdf0e10cSrcweir //#i24363# tab stops relative to indent 932cdf0e10cSrcweir const long nOff = rWrtSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT) ? 933cdf0e10cSrcweir ((SvxLRSpaceItem&)aCoreSet.Get( RES_LR_SPACE )).GetTxtLeft() : 0; 934cdf0e10cSrcweir SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff ); 935cdf0e10cSrcweir aCoreSet.Put( aOff ); 936cdf0e10cSrcweir 937cdf0e10cSrcweir // BoxInfo setzen 938cdf0e10cSrcweir ::PrepareBoxInfo( aCoreSet, rWrtSh ); 939cdf0e10cSrcweir 940cdf0e10cSrcweir //aktuelles Seitenformat 941cdf0e10cSrcweir ::SwToSfxPageDescAttr( aCoreSet ); 942cdf0e10cSrcweir 943cdf0e10cSrcweir sal_uInt16 nDefPage = 0; 944cdf0e10cSrcweir if( pItem ) 945cdf0e10cSrcweir nDefPage = ((SfxUInt16Item *)pItem)->GetValue(); 946cdf0e10cSrcweir 947cdf0e10cSrcweir // Numerierungseigenschaften 948cdf0e10cSrcweir if(rWrtSh.GetCurNumRule()) 949cdf0e10cSrcweir { 950cdf0e10cSrcweir SfxBoolItem aStart( FN_NUMBER_NEWSTART, rWrtSh.IsNumRuleStart() ); 951cdf0e10cSrcweir aCoreSet.Put(aStart); 952cdf0e10cSrcweir // --> OD 2008-02-29 #refactorlists# 953cdf0e10cSrcweir // SfxUInt16Item aStartAt(FN_NUMBER_NEWSTART_AT, 954cdf0e10cSrcweir // rWrtSh.IsNodeNumStart()); 955cdf0e10cSrcweir SfxUInt16Item aStartAt( FN_NUMBER_NEWSTART_AT, 956cdf0e10cSrcweir rWrtSh.GetNodeNumStart() ); 957cdf0e10cSrcweir // <-- 958cdf0e10cSrcweir aCoreSet.Put(aStartAt); 959cdf0e10cSrcweir } 960cdf0e10cSrcweir SfxAbstractTabDialog* pDlg = NULL; 961cdf0e10cSrcweir 962cdf0e10cSrcweir if ( bUseDialog && GetActiveView() ) 963cdf0e10cSrcweir { 964cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 965cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 966cdf0e10cSrcweir 967cdf0e10cSrcweir pDlg = pFact->CreateSwParaDlg( GetView().GetWindow(),GetView(), aCoreSet,DLG_STD, DLG_PARA,NULL, sal_False, nDefPage ); 968cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 969cdf0e10cSrcweir } 970cdf0e10cSrcweir SfxItemSet* pSet = NULL; 971cdf0e10cSrcweir if ( !bUseDialog ) 972cdf0e10cSrcweir { 973512ec161SZheng Fan if ( nSlot == SID_ATTR_PARA_LRSPACE) 974512ec161SZheng Fan { 975512ec161SZheng Fan SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)pArgs->Get(nSlot)); 976512ec161SZheng Fan aParaMargin.SetWhich( RES_LR_SPACE); 977512ec161SZheng Fan aCoreSet.Put(aParaMargin); 978512ec161SZheng Fan pSet = &aCoreSet; 979512ec161SZheng Fan 980512ec161SZheng Fan } else 981cdf0e10cSrcweir pSet = (SfxItemSet*) pArgs; 982cdf0e10cSrcweir 983cdf0e10cSrcweir } 984cdf0e10cSrcweir else if ( NULL != pDlg && pDlg->Execute() == RET_OK ) 985cdf0e10cSrcweir { 986cdf0e10cSrcweir // Defaults evtl umsetzen 987cdf0e10cSrcweir pSet = (SfxItemSet*)pDlg->GetOutputItemSet(); 988cdf0e10cSrcweir sal_uInt16 nNewDist; 989cdf0e10cSrcweir if( SFX_ITEM_SET == pSet->GetItemState( SID_ATTR_TABSTOP_DEFAULTS, sal_False, &pItem ) && 990cdf0e10cSrcweir nDefDist != (nNewDist = ((SfxUInt16Item*)pItem)->GetValue()) ) 991cdf0e10cSrcweir { 992cdf0e10cSrcweir SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP ); 993cdf0e10cSrcweir MakeDefTabs( nNewDist, aDefTabs ); 994cdf0e10cSrcweir rWrtSh.SetDefault( aDefTabs ); 995cdf0e10cSrcweir pSet->ClearItem( SID_ATTR_TABSTOP_DEFAULTS ); 996cdf0e10cSrcweir } 997cdf0e10cSrcweir 998cdf0e10cSrcweir if ( SFX_ITEM_SET == pSet->GetItemState(FN_PARAM_1,sal_False,&pItem) ) 999cdf0e10cSrcweir { 1000cdf0e10cSrcweir pSet->Put(SfxStringItem(FN_DROP_TEXT, ((const SfxStringItem*)pItem)->GetValue())); 1001cdf0e10cSrcweir pSet->ClearItem(FN_PARAM_1); 1002cdf0e10cSrcweir } 1003cdf0e10cSrcweir 1004cdf0e10cSrcweir if( SFX_ITEM_SET == pSet->GetItemState( RES_PARATR_DROP, sal_False, &pItem )) 1005cdf0e10cSrcweir { 1006cdf0e10cSrcweir String sCharStyleName; 1007cdf0e10cSrcweir if(((const SwFmtDrop*)pItem)->GetCharFmt()) 1008cdf0e10cSrcweir sCharStyleName = ((const SwFmtDrop*)pItem)->GetCharFmt()->GetName(); 1009cdf0e10cSrcweir pSet->Put(SfxStringItem(FN_DROP_CHAR_STYLE_NAME, sCharStyleName)); 1010cdf0e10cSrcweir } 1011cdf0e10cSrcweir } 1012cdf0e10cSrcweir 1013cdf0e10cSrcweir if ( pSet ) 1014cdf0e10cSrcweir { 1015cdf0e10cSrcweir rReq.Done( *pSet ); 1016cdf0e10cSrcweir ::SfxToSwPageDescAttr( rWrtSh, *pSet ); 1017cdf0e10cSrcweir // --> OD 2006-12-06 #i56253# 1018cdf0e10cSrcweir // enclose all undos. 1019cdf0e10cSrcweir // Thus, check conditions, if actions will be performed. 1020cdf0e10cSrcweir const bool bUndoNeeded( pSet->Count() || 1021cdf0e10cSrcweir SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART) || 1022cdf0e10cSrcweir SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) ); 1023cdf0e10cSrcweir if ( bUndoNeeded ) 1024cdf0e10cSrcweir { 1025cdf0e10cSrcweir rWrtSh.StartUndo( UNDO_INSATTR ); 1026cdf0e10cSrcweir } 1027cdf0e10cSrcweir // <-- 1028cdf0e10cSrcweir if( pSet->Count() ) 1029cdf0e10cSrcweir { 1030cdf0e10cSrcweir rWrtSh.StartAction(); 1031cdf0e10cSrcweir // rWrtSh.StartUndo( UNDO_START ); 1032cdf0e10cSrcweir if ( SFX_ITEM_SET == pSet->GetItemState(FN_DROP_TEXT, sal_False, &pItem) ) 1033cdf0e10cSrcweir { 1034cdf0e10cSrcweir if ( ((SfxStringItem*)pItem)->GetValue().Len() ) 1035cdf0e10cSrcweir rWrtSh.ReplaceDropTxt(((SfxStringItem*)pItem)->GetValue()); 1036cdf0e10cSrcweir } 1037cdf0e10cSrcweir rWrtSh.SetAttr( *pSet ); 1038cdf0e10cSrcweir // rWrtSh.EndUndo( UNDO_END ); 1039cdf0e10cSrcweir rWrtSh.EndAction(); 1040cdf0e10cSrcweir SwTxtFmtColl* pColl = rWrtSh.GetCurTxtFmtColl(); 1041cdf0e10cSrcweir if(pColl && pColl->IsAutoUpdateFmt()) 1042cdf0e10cSrcweir { 1043cdf0e10cSrcweir rWrtSh.AutoUpdatePara(pColl, *pSet); 1044cdf0e10cSrcweir } 1045cdf0e10cSrcweir } 1046cdf0e10cSrcweir 1047cdf0e10cSrcweir if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART) ) 1048cdf0e10cSrcweir { 1049cdf0e10cSrcweir //SetNumRuleStart(sal_True) restarts the numbering at the value 1050cdf0e10cSrcweir //that is defined at the starting point of the numbering level 1051cdf0e10cSrcweir //otherwise the SetNodeNumStart() value determines the start 10521ff378efSZheng Fan //if it's set to something different than (sal_uInt16)0xFFFF 1053cdf0e10cSrcweir 1054cdf0e10cSrcweir sal_Bool bStart = ((SfxBoolItem&)pSet->Get(FN_NUMBER_NEWSTART)).GetValue(); 1055cdf0e10cSrcweir // --> OD 2007-06-11 #b6560525# 10561ff378efSZheng Fan // Default value for restart value has to be (sal_uInt16)0xFFFF 1057cdf0e10cSrcweir // in order to indicate that the restart value of the list 1058cdf0e10cSrcweir // style has to be used on restart. 10591ff378efSZheng Fan sal_uInt16 nNumStart = (sal_uInt16)0xFFFF; 1060cdf0e10cSrcweir // <-- 1061cdf0e10cSrcweir if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) ) 1062cdf0e10cSrcweir { 1063cdf0e10cSrcweir nNumStart = ((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue(); 1064cdf0e10cSrcweir } 1065cdf0e10cSrcweir rWrtSh.SetNumRuleStart(bStart); 1066cdf0e10cSrcweir rWrtSh.SetNodeNumStart(nNumStart); 1067cdf0e10cSrcweir } 1068cdf0e10cSrcweir else if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) ) 1069cdf0e10cSrcweir { 1070cdf0e10cSrcweir sal_uInt16 nNumStart = ((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue(); 1071cdf0e10cSrcweir rWrtSh.SetNodeNumStart(nNumStart); 1072cdf0e10cSrcweir rWrtSh.SetNumRuleStart(sal_False); 1073cdf0e10cSrcweir } 1074cdf0e10cSrcweir // --> OD 2006-12-06 #i56253# 1075cdf0e10cSrcweir if ( bUndoNeeded ) 1076cdf0e10cSrcweir { 1077cdf0e10cSrcweir rWrtSh.EndUndo( UNDO_INSATTR ); 1078cdf0e10cSrcweir } 1079cdf0e10cSrcweir // <-- 1080cdf0e10cSrcweir } 1081cdf0e10cSrcweir 1082cdf0e10cSrcweir delete pDlg; 1083cdf0e10cSrcweir } 1084cdf0e10cSrcweir break; 1085cdf0e10cSrcweir case FN_NUM_CONTINUE: 1086cdf0e10cSrcweir { 1087cdf0e10cSrcweir // --> OD 2008-03-18 #refactorlists# 1088cdf0e10cSrcweir String sContinuedListId; 1089cdf0e10cSrcweir const SwNumRule* pRule = 1090cdf0e10cSrcweir rWrtSh.SearchNumRule( false, true, false, -1, sContinuedListId ); 1091cdf0e10cSrcweir // --> OD 2009-08-26 #i86492# 1092cdf0e10cSrcweir // Search also for bullet list 1093cdf0e10cSrcweir if ( !pRule ) 1094cdf0e10cSrcweir { 1095cdf0e10cSrcweir pRule = rWrtSh.SearchNumRule( false, false, false, -1, sContinuedListId ); 1096cdf0e10cSrcweir } 1097cdf0e10cSrcweir // <-- 1098cdf0e10cSrcweir if ( pRule ) 1099cdf0e10cSrcweir { 1100cdf0e10cSrcweir rWrtSh.SetCurNumRule( *pRule, false, sContinuedListId ); 1101cdf0e10cSrcweir } 1102cdf0e10cSrcweir // <-- 1103cdf0e10cSrcweir } 1104cdf0e10cSrcweir break; 1105cdf0e10cSrcweir case FN_SELECT_PARA: 1106cdf0e10cSrcweir { 1107cdf0e10cSrcweir if(!rWrtSh.IsSttOfPara()) 1108cdf0e10cSrcweir rWrtSh.SttPara(sal_False); 1109cdf0e10cSrcweir else 1110cdf0e10cSrcweir rWrtSh.EnterStdMode(); 1111cdf0e10cSrcweir rWrtSh.EndPara(sal_True); 1112cdf0e10cSrcweir } 1113cdf0e10cSrcweir break; 1114cdf0e10cSrcweir 1115cdf0e10cSrcweir case SID_DEC_INDENT: 1116cdf0e10cSrcweir case SID_INC_INDENT: 1117*ca62e2c2SSteve Yin //IAccessibility2 Implementation 2009----- 1118*ca62e2c2SSteve Yin //According to the requirement, modified the behavior when user 1119*ca62e2c2SSteve Yin //using the indent button on the toolbar. Now if we increase/decrease indent for a 1120*ca62e2c2SSteve Yin //paragraph which has bullet style it will increase/decrease the bullet level. 1121*ca62e2c2SSteve Yin { 1122*ca62e2c2SSteve Yin //If the current paragraph has bullet call the function to 1123*ca62e2c2SSteve Yin //increase or decrease the bullet level. 1124*ca62e2c2SSteve Yin //Why could I know wheter a paragraph has bullet or not by checking the below conditions? 1125*ca62e2c2SSteve Yin //Please refer to the "case KEY_TAB:" section in SwEditWin::KeyInput(..) : 1126*ca62e2c2SSteve Yin // if( rSh.GetCurNumRule() && rSh.IsSttOfPara() && 1127*ca62e2c2SSteve Yin // !rSh.HasReadonlySel() ) 1128*ca62e2c2SSteve Yin // eKeyState = KS_NumDown; 1129*ca62e2c2SSteve Yin //Above code demonstrates that when the cursor is at the start of a paragraph which has bullet, 1130*ca62e2c2SSteve Yin //press TAB will increase the bullet level. 1131*ca62e2c2SSteve Yin //So I copied from that ^^ 1132*ca62e2c2SSteve Yin if ( rWrtSh.GetCurNumRule() && !rWrtSh.HasReadonlySel() ) 1133*ca62e2c2SSteve Yin { 1134*ca62e2c2SSteve Yin rWrtSh.NumUpDown( SID_INC_INDENT == nSlot ); 1135*ca62e2c2SSteve Yin } 1136*ca62e2c2SSteve Yin else//execute the original processing functions 1137*ca62e2c2SSteve Yin { 1138*ca62e2c2SSteve Yin //below is copied of the old codes 1139cdf0e10cSrcweir rWrtSh.MoveLeftMargin( SID_INC_INDENT == nSlot, 1140cdf0e10cSrcweir rReq.GetModifier() != KEY_MOD1 ); 1141*ca62e2c2SSteve Yin } 1142*ca62e2c2SSteve Yin } 1143*ca62e2c2SSteve Yin //rWrtSh.MoveLeftMargin( SID_INC_INDENT == nSlot, 1144*ca62e2c2SSteve Yin // rReq.GetModifier() != KEY_MOD1 ); 1145*ca62e2c2SSteve Yin //-----IAccessibility2 Implementation 2009 1146cdf0e10cSrcweir rReq.Done(); 1147cdf0e10cSrcweir break; 1148cdf0e10cSrcweir case FN_DEC_INDENT_OFFSET: 1149cdf0e10cSrcweir case FN_INC_INDENT_OFFSET: 1150cdf0e10cSrcweir rWrtSh.MoveLeftMargin( FN_INC_INDENT_OFFSET == nSlot, 1151cdf0e10cSrcweir rReq.GetModifier() == KEY_MOD1 ); 1152cdf0e10cSrcweir rReq.Done(); 1153cdf0e10cSrcweir break; 1154cdf0e10cSrcweir 1155cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR2: 1156cdf0e10cSrcweir { 1157cdf0e10cSrcweir if(pItem) 1158cdf0e10cSrcweir { 1159cdf0e10cSrcweir Color aSet = ((const SvxColorItem*)pItem)->GetValue(); 1160cdf0e10cSrcweir SwEditWin& rEditWin = GetView().GetEditWin(); 1161cdf0e10cSrcweir rEditWin.SetTextColor(aSet); 1162cdf0e10cSrcweir SwApplyTemplate* pApply = rEditWin.GetApplyTemplate(); 1163cdf0e10cSrcweir SvxColorItem aItem(aSet, RES_CHRATR_COLOR); 1164cdf0e10cSrcweir 1165cdf0e10cSrcweir // besteht eine Selektion, wird sie gleich gefaerbt 1166cdf0e10cSrcweir if(!pApply && rWrtSh.HasSelection()) 1167cdf0e10cSrcweir { 1168cdf0e10cSrcweir rWrtSh.SetAttr(SvxColorItem (aSet, RES_CHRATR_COLOR)); 1169cdf0e10cSrcweir } 1170cdf0e10cSrcweir else if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_EXT) 1171cdf0e10cSrcweir { 1172cdf0e10cSrcweir GetView().GetViewFrame()->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR_EXT); 1173cdf0e10cSrcweir } 1174cdf0e10cSrcweir 1175cdf0e10cSrcweir rReq.Done(); 1176cdf0e10cSrcweir /* OS 22.02.97 18:40 Das alte Verhalten ist unerwuenscht 1177cdf0e10cSrcweir SwEditWin& rEdtWin = GetView().GetEditWin(); 1178cdf0e10cSrcweir 1179cdf0e10cSrcweir SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate(); 1180cdf0e10cSrcweir SvxColorItem aItem(aSet, RES_CHRATR_COLOR); 1181cdf0e10cSrcweir 1182cdf0e10cSrcweir if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_EXT) 1183cdf0e10cSrcweir { 1184cdf0e10cSrcweir GetShell().SetAttr(aItem); 1185cdf0e10cSrcweir } 1186cdf0e10cSrcweir */ 1187cdf0e10cSrcweir } 1188cdf0e10cSrcweir } 1189cdf0e10cSrcweir break; 1190cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR_BACKGROUND: 1191cdf0e10cSrcweir { 1192cdf0e10cSrcweir SwEditWin& rEdtWin = GetView().GetEditWin(); 1193cdf0e10cSrcweir SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate(); 1194cdf0e10cSrcweir rEdtWin.SetTextBackColorTransparent(0 == pItem); 1195cdf0e10cSrcweir Color aSet; 1196cdf0e10cSrcweir if(pItem) 1197cdf0e10cSrcweir { 1198cdf0e10cSrcweir aSet = ((const SvxColorItem*)pItem)->GetValue(); 1199cdf0e10cSrcweir rEdtWin.SetTextBackColor(aSet); 1200cdf0e10cSrcweir } 1201cdf0e10cSrcweir if(!pApply && (rWrtSh.HasSelection() || rReq.IsAPI())) 1202cdf0e10cSrcweir { 1203cdf0e10cSrcweir SvxBrushItem aBrushItem(RES_CHRATR_BACKGROUND); 1204cdf0e10cSrcweir if(pItem) 1205cdf0e10cSrcweir aBrushItem.SetColor(aSet); 1206cdf0e10cSrcweir else 1207cdf0e10cSrcweir aBrushItem.SetColor(Color(COL_TRANSPARENT)); 1208cdf0e10cSrcweir rWrtSh.SetAttr( aBrushItem ); 1209cdf0e10cSrcweir } 1210cdf0e10cSrcweir else if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_BACKGROUND_EXT) 1211cdf0e10cSrcweir { 1212cdf0e10cSrcweir GetView().GetViewFrame()->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR_BACKGROUND_EXT); 1213cdf0e10cSrcweir } 1214cdf0e10cSrcweir 1215cdf0e10cSrcweir rReq.Done(); 1216cdf0e10cSrcweir 1217cdf0e10cSrcweir /* OS 22.02.97 18:40 Das alte Verhalten ist unerwuenscht 1218cdf0e10cSrcweir if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_BACKGROUND_EXT) 1219cdf0e10cSrcweir { 1220cdf0e10cSrcweir Brush aBrush(pItem ? BRUSH_SOLID : BRUSH_NULL); 1221cdf0e10cSrcweir if(pItem) 1222cdf0e10cSrcweir aBrush.SetColor( aSet ); 1223cdf0e10cSrcweir GetShell().SetAttr( SvxBrushItem(aBrush, RES_CHRATR_BACKGROUND) ); 1224cdf0e10cSrcweir } 1225cdf0e10cSrcweir */ 1226cdf0e10cSrcweir } 1227cdf0e10cSrcweir break; 1228cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT: 1229cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR_EXT: 1230cdf0e10cSrcweir { 1231cdf0e10cSrcweir SwEditWin& rEdtWin = GetView().GetEditWin(); 1232cdf0e10cSrcweir SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate(); 1233cdf0e10cSrcweir SwApplyTemplate aTempl; 1234cdf0e10cSrcweir sal_Bool bSelection = rWrtSh.HasSelection(); 1235cdf0e10cSrcweir if(bSelection) 1236cdf0e10cSrcweir { 1237cdf0e10cSrcweir 1238cdf0e10cSrcweir if(nSlot == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT) 1239cdf0e10cSrcweir { 1240cdf0e10cSrcweir rWrtSh.SetAttr( SvxBrushItem( 1241cdf0e10cSrcweir rEdtWin.GetTextBackColor(), RES_CHRATR_BACKGROUND) ); 1242cdf0e10cSrcweir } 1243cdf0e10cSrcweir else 1244cdf0e10cSrcweir rWrtSh.SetAttr( SvxColorItem( rEdtWin.GetTextColor(), 1245cdf0e10cSrcweir RES_CHRATR_COLOR) ); 1246cdf0e10cSrcweir } 1247cdf0e10cSrcweir else 1248cdf0e10cSrcweir { 1249cdf0e10cSrcweir if(!pApply || pApply->nColor != nSlot) 1250cdf0e10cSrcweir aTempl.nColor = nSlot; 1251cdf0e10cSrcweir rEdtWin.SetApplyTemplate(aTempl); 1252cdf0e10cSrcweir } 1253cdf0e10cSrcweir 1254cdf0e10cSrcweir rReq.Done(); 1255cdf0e10cSrcweir } 1256cdf0e10cSrcweir break; 1257cdf0e10cSrcweir 1258cdf0e10cSrcweir case FN_NUM_BULLET_MOVEDOWN: 1259cdf0e10cSrcweir if (!rWrtSh.IsAddMode()) 1260cdf0e10cSrcweir rWrtSh.MoveParagraph(1); 1261cdf0e10cSrcweir rReq.Done(); 1262cdf0e10cSrcweir break; 1263cdf0e10cSrcweir 1264cdf0e10cSrcweir case FN_NUM_BULLET_MOVEUP: 1265cdf0e10cSrcweir if (!rWrtSh.IsAddMode()) 1266cdf0e10cSrcweir rWrtSh.MoveParagraph(-1); 1267cdf0e10cSrcweir rReq.Done(); 1268cdf0e10cSrcweir break; 1269cdf0e10cSrcweir case SID_RUBY_DIALOG: 1270cdf0e10cSrcweir case SID_HYPERLINK_DIALOG: 1271cdf0e10cSrcweir { 1272cdf0e10cSrcweir SfxRequest aReq(nSlot, SFX_CALLMODE_SLOT, SFX_APP()->GetPool()); 1273cdf0e10cSrcweir GetView().GetViewFrame()->ExecuteSlot( aReq); 1274cdf0e10cSrcweir rReq.Ignore(); 1275cdf0e10cSrcweir } 1276cdf0e10cSrcweir break; 1277cdf0e10cSrcweir case FN_INSERT_PAGEHEADER: 1278cdf0e10cSrcweir case FN_INSERT_PAGEFOOTER: 1279cdf0e10cSrcweir if(pArgs && pArgs->Count()) 1280cdf0e10cSrcweir { 1281cdf0e10cSrcweir String sStyleName; 1282cdf0e10cSrcweir if(pItem) 1283cdf0e10cSrcweir sStyleName = ((const SfxStringItem*)pItem)->GetValue(); 1284cdf0e10cSrcweir sal_Bool bOn = sal_True; 1285cdf0e10cSrcweir if( SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_1, sal_False, &pItem)) 1286cdf0e10cSrcweir bOn = ((const SfxBoolItem*)pItem)->GetValue(); 1287cdf0e10cSrcweir ChangeHeaderOrFooter(sStyleName, FN_INSERT_PAGEHEADER == nSlot, bOn, !rReq.IsAPI()); 1288cdf0e10cSrcweir rReq.Done(); 1289cdf0e10cSrcweir } 1290cdf0e10cSrcweir break; 1291cdf0e10cSrcweir case FN_READONLY_SELECTION_MODE : 1292cdf0e10cSrcweir if(GetView().GetDocShell()->IsReadOnly()) 1293cdf0e10cSrcweir { 1294cdf0e10cSrcweir rWrtSh.SetReadonlySelectionOption( 1295cdf0e10cSrcweir !rWrtSh.GetViewOptions()->IsSelectionInReadonly()); 1296cdf0e10cSrcweir rWrtSh.ShowCrsr(); 1297cdf0e10cSrcweir } 1298cdf0e10cSrcweir break; 1299cdf0e10cSrcweir case FN_SELECTION_MODE_DEFAULT: 1300cdf0e10cSrcweir case FN_SELECTION_MODE_BLOCK : 1301cdf0e10cSrcweir { 1302cdf0e10cSrcweir bool bSetBlockMode = !rWrtSh.IsBlockMode(); 1303cdf0e10cSrcweir if( pArgs && SFX_ITEM_SET == pArgs->GetItemState(nSlot, sal_False, &pItem)) 1304cdf0e10cSrcweir bSetBlockMode = ((const SfxBoolItem*)pItem)->GetValue(); 1305cdf0e10cSrcweir if( ( nSlot == FN_SELECTION_MODE_DEFAULT ) ^ bSetBlockMode ) 1306cdf0e10cSrcweir rWrtSh.EnterBlockMode(); 1307cdf0e10cSrcweir else 1308cdf0e10cSrcweir rWrtSh.EnterStdMode(); 1309cdf0e10cSrcweir SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings(); 1310cdf0e10cSrcweir rBnd.Invalidate(FN_STAT_SELMODE); 1311cdf0e10cSrcweir rBnd.Update(FN_STAT_SELMODE); 1312cdf0e10cSrcweir } 1313cdf0e10cSrcweir break; 1314cdf0e10cSrcweir case SID_OPEN_HYPERLINK: 1315cdf0e10cSrcweir case FN_COPY_HYPERLINK_LOCATION: 1316cdf0e10cSrcweir { 1317cdf0e10cSrcweir SfxItemSet aSet(GetPool(), 1318cdf0e10cSrcweir RES_TXTATR_INETFMT, 1319cdf0e10cSrcweir RES_TXTATR_INETFMT); 1320cdf0e10cSrcweir rWrtSh.GetCurAttr(aSet); 1321cdf0e10cSrcweir if(SFX_ITEM_SET <= aSet.GetItemState( RES_TXTATR_INETFMT, sal_True )) 1322cdf0e10cSrcweir { 1323cdf0e10cSrcweir const SwFmtINetFmt& rINetFmt = dynamic_cast<const SwFmtINetFmt&>( aSet.Get(RES_TXTATR_INETFMT, sal_True) ); 1324cdf0e10cSrcweir if( nSlot == FN_COPY_HYPERLINK_LOCATION ) 1325cdf0e10cSrcweir { 1326cdf0e10cSrcweir ::uno::Reference< datatransfer::clipboard::XClipboard > xClipboard = GetView().GetEditWin().GetClipboard(); 1327cdf0e10cSrcweir vcl::unohelper::TextDataObject::CopyStringTo( 1328cdf0e10cSrcweir rINetFmt.GetValue(), 1329cdf0e10cSrcweir xClipboard ); 1330cdf0e10cSrcweir } 1331cdf0e10cSrcweir else 1332cdf0e10cSrcweir rWrtSh.ClickToINetAttr(rINetFmt, URLLOAD_NOFILTER); 1333cdf0e10cSrcweir } 1334cdf0e10cSrcweir } 1335cdf0e10cSrcweir break; 1336cdf0e10cSrcweir case SID_OPEN_XML_FILTERSETTINGS: 1337cdf0e10cSrcweir { 1338cdf0e10cSrcweir try 1339cdf0e10cSrcweir { 1340cdf0e10cSrcweir uno::Reference < ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.comp.ui.XSLTFilterDialog")), uno::UNO_QUERY); 1341cdf0e10cSrcweir if( xDialog.is() ) 1342cdf0e10cSrcweir { 1343cdf0e10cSrcweir xDialog->execute(); 1344cdf0e10cSrcweir } 1345cdf0e10cSrcweir } 1346cdf0e10cSrcweir catch( uno::Exception& ) 1347cdf0e10cSrcweir { 1348cdf0e10cSrcweir } 1349cdf0e10cSrcweir rReq.Ignore (); 1350cdf0e10cSrcweir } 1351cdf0e10cSrcweir break; 1352cdf0e10cSrcweir case FN_FORMAT_APPLY_HEAD1: 1353cdf0e10cSrcweir { 1354cdf0e10cSrcweir } 1355cdf0e10cSrcweir break; 1356cdf0e10cSrcweir case FN_FORMAT_APPLY_HEAD2: 1357cdf0e10cSrcweir { 1358cdf0e10cSrcweir } 1359cdf0e10cSrcweir break; 1360cdf0e10cSrcweir case FN_FORMAT_APPLY_HEAD3: 1361cdf0e10cSrcweir { 1362cdf0e10cSrcweir } 1363cdf0e10cSrcweir break; 1364cdf0e10cSrcweir case FN_FORMAT_APPLY_DEFAULT: 1365cdf0e10cSrcweir { 1366cdf0e10cSrcweir } 1367cdf0e10cSrcweir break; 1368cdf0e10cSrcweir case FN_FORMAT_APPLY_TEXTBODY: 1369cdf0e10cSrcweir { 1370cdf0e10cSrcweir } 1371cdf0e10cSrcweir break; 1372cdf0e10cSrcweir case FN_WORDCOUNT_DIALOG: 1373cdf0e10cSrcweir { 1374cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 1375cdf0e10cSrcweir SwDocStat aCurr; 1376cdf0e10cSrcweir SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() ); 1377cdf0e10cSrcweir { 1378cdf0e10cSrcweir SwWait aWait( *GetView().GetDocShell(), sal_True ); 1379cdf0e10cSrcweir rSh.StartAction(); 1380cdf0e10cSrcweir rSh.CountWords( aCurr ); 1381cdf0e10cSrcweir rSh.UpdateDocStat( aDocStat ); 1382cdf0e10cSrcweir rSh.EndAction(); 1383cdf0e10cSrcweir } 1384cdf0e10cSrcweir 1385cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 1386cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!"); 1387cdf0e10cSrcweir AbstractSwWordCountDialog* pDialog = pFact->CreateSwWordCountDialog( GetView().GetWindow() ); 1388cdf0e10cSrcweir pDialog->SetValues(aCurr, aDocStat ); 1389cdf0e10cSrcweir pDialog->Execute(); 1390cdf0e10cSrcweir delete pDialog; 1391cdf0e10cSrcweir } 1392cdf0e10cSrcweir break; 1393cdf0e10cSrcweir default: 1394cdf0e10cSrcweir ASSERT(!this, falscher Dispatcher); 1395cdf0e10cSrcweir return; 1396cdf0e10cSrcweir } 1397cdf0e10cSrcweir } 1398cdf0e10cSrcweir 1399cdf0e10cSrcweir 1400cdf0e10cSrcweir /*-------------------------------------------------------------------- 1401cdf0e10cSrcweir Beschreibung: 1402cdf0e10cSrcweir --------------------------------------------------------------------*/ 1403cdf0e10cSrcweir 1404cdf0e10cSrcweir 1405cdf0e10cSrcweir void SwTextShell::GetState( SfxItemSet &rSet ) 1406cdf0e10cSrcweir { 1407cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 1408cdf0e10cSrcweir SfxWhichIter aIter( rSet ); 1409cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 1410cdf0e10cSrcweir while ( nWhich ) 1411cdf0e10cSrcweir { 1412cdf0e10cSrcweir switch ( nWhich ) 1413cdf0e10cSrcweir { 1414cdf0e10cSrcweir case SID_LANGUAGE_STATUS: 1415cdf0e10cSrcweir { 1416cdf0e10cSrcweir // the value of used script types 1417cdf0e10cSrcweir String aScriptTypesInUse( String::CreateFromInt32( rSh.GetScriptType() ) ); 1418cdf0e10cSrcweir 1419cdf0e10cSrcweir SvtLanguageTable aLangTable; 1420cdf0e10cSrcweir 1421cdf0e10cSrcweir // get keyboard language 1422cdf0e10cSrcweir String aKeyboardLang; 1423cdf0e10cSrcweir LanguageType nLang = LANGUAGE_DONTKNOW; 1424cdf0e10cSrcweir SwEditWin& rEditWin = GetView().GetEditWin(); 1425cdf0e10cSrcweir nLang = rEditWin.GetInputLanguage(); 1426cdf0e10cSrcweir if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) 1427cdf0e10cSrcweir aKeyboardLang = aLangTable.GetString( nLang ); 1428cdf0e10cSrcweir 1429cdf0e10cSrcweir // get the language that is in use 1430cdf0e10cSrcweir const String aMultipleLanguages = String::CreateFromAscii("*"); 1431cdf0e10cSrcweir String aCurrentLang = aMultipleLanguages; 1432cdf0e10cSrcweir nLang = SwLangHelper::GetCurrentLanguage( rSh ); 1433cdf0e10cSrcweir if (nLang != LANGUAGE_DONTKNOW) 1434cdf0e10cSrcweir aCurrentLang = aLangTable.GetString( nLang ); 1435cdf0e10cSrcweir 1436cdf0e10cSrcweir // build sequence for status value 1437cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > aSeq( 4 ); 1438cdf0e10cSrcweir aSeq[0] = aCurrentLang; 1439cdf0e10cSrcweir aSeq[1] = aScriptTypesInUse; 1440cdf0e10cSrcweir aSeq[2] = aKeyboardLang; 1441cdf0e10cSrcweir aSeq[3] = SwLangHelper::GetTextForLanguageGuessing( rSh ); 1442cdf0e10cSrcweir 1443cdf0e10cSrcweir // set sequence as status value 1444cdf0e10cSrcweir SfxStringListItem aItem( SID_LANGUAGE_STATUS ); 1445cdf0e10cSrcweir aItem.SetStringList( aSeq ); 1446cdf0e10cSrcweir rSet.Put( aItem, SID_LANGUAGE_STATUS ); 1447cdf0e10cSrcweir } 1448cdf0e10cSrcweir break; 1449cdf0e10cSrcweir 1450cdf0e10cSrcweir case SID_THES: 1451cdf0e10cSrcweir { 1452cdf0e10cSrcweir // is there a valid selection to get text from? 1453cdf0e10cSrcweir String aText; 1454cdf0e10cSrcweir sal_Bool bValid = !rSh.HasSelection() || 1455cdf0e10cSrcweir (rSh.IsSelOnePara() && !rSh.IsMultiSelection()); 1456cdf0e10cSrcweir // prevent context menu from showing when cursor is not in or at the end of a word 1457cdf0e10cSrcweir // (GetCurWord will return the next word if there is none at the current position...) 1458cdf0e10cSrcweir const sal_Int16 nWordType = ::i18n::WordType::DICTIONARY_WORD; 1459cdf0e10cSrcweir bool bWord = rSh.IsInWord( nWordType ) || rSh.IsStartWord( nWordType ) || rSh.IsEndWord( nWordType ); 1460cdf0e10cSrcweir if (bValid && bWord) 1461cdf0e10cSrcweir aText = rSh.HasSelection()? rSh.GetSelTxt() : rSh.GetCurWord(); 1462cdf0e10cSrcweir 1463cdf0e10cSrcweir LanguageType nLang = rSh.GetCurLang(); 1464cdf0e10cSrcweir lang::Locale aLocale = SvxCreateLocale( nLang ); 1465cdf0e10cSrcweir String aLangText( MsLangId::convertLanguageToIsoString( nLang ) ); 1466cdf0e10cSrcweir 1467cdf0e10cSrcweir // set word and locale to look up as status value 1468cdf0e10cSrcweir String aStatusVal( aText ); 1469cdf0e10cSrcweir aStatusVal.AppendAscii( "#" ); 1470cdf0e10cSrcweir aStatusVal += aLangText; 1471cdf0e10cSrcweir 1472cdf0e10cSrcweir rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); 1473cdf0e10cSrcweir 1474cdf0e10cSrcweir // disable "Thesaurus" context menu entry if there is nothing to look up 1475cdf0e10cSrcweir uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); 1476cdf0e10cSrcweir if (aText.Len() == 0 || 1477cdf0e10cSrcweir !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale )) 1478cdf0e10cSrcweir rSet.DisableItem( SID_THES ); 1479cdf0e10cSrcweir } 1480cdf0e10cSrcweir break; 1481cdf0e10cSrcweir 1482cdf0e10cSrcweir case FN_NUMBER_NEWSTART : 1483cdf0e10cSrcweir if(!rSh.GetCurNumRule()) 1484cdf0e10cSrcweir rSet.DisableItem(nWhich); 1485cdf0e10cSrcweir else 1486cdf0e10cSrcweir rSet.Put(SfxBoolItem(FN_NUMBER_NEWSTART, 1487cdf0e10cSrcweir rSh.IsNumRuleStart())); 1488cdf0e10cSrcweir break; 1489cdf0e10cSrcweir case FN_EDIT_FORMULA: 1490cdf0e10cSrcweir case SID_CHARMAP: 1491cdf0e10cSrcweir { 1492cdf0e10cSrcweir const int nType = rSh.GetSelectionType(); 1493cdf0e10cSrcweir if (!(nType & nsSelectionType::SEL_TXT) && 1494cdf0e10cSrcweir !(nType & nsSelectionType::SEL_TBL) && 1495cdf0e10cSrcweir !(nType & nsSelectionType::SEL_NUM)) 1496cdf0e10cSrcweir rSet.DisableItem(nWhich); 1497cdf0e10cSrcweir } 1498cdf0e10cSrcweir break; 1499cdf0e10cSrcweir 1500cdf0e10cSrcweir case FN_INSERT_ENDNOTE: 1501cdf0e10cSrcweir case FN_INSERT_FOOTNOTE: 1502cdf0e10cSrcweir case FN_INSERT_FOOTNOTE_DLG: 1503cdf0e10cSrcweir { 1504cdf0e10cSrcweir const sal_uInt16 nNoType = FRMTYPE_FLY_ANY | FRMTYPE_HEADER | 1505cdf0e10cSrcweir FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE; 1506cdf0e10cSrcweir if ( (rSh.GetFrmType(0,sal_True) & nNoType) ) 1507cdf0e10cSrcweir rSet.DisableItem(nWhich); 1508cdf0e10cSrcweir } 1509cdf0e10cSrcweir break; 1510cdf0e10cSrcweir case FN_INSERT_TABLE: 1511cdf0e10cSrcweir if ( rSh.GetTableFmt() || 1512cdf0e10cSrcweir (rSh.GetFrmType(0,sal_True) & FRMTYPE_FOOTNOTE) ) 1513cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1514cdf0e10cSrcweir break; 1515cdf0e10cSrcweir 1516cdf0e10cSrcweir case FN_CALCULATE: 1517cdf0e10cSrcweir if ( !rSh.IsSelection() ) 1518cdf0e10cSrcweir rSet.DisableItem(nWhich); 1519cdf0e10cSrcweir break; 1520cdf0e10cSrcweir case FN_GOTO_REFERENCE: 1521cdf0e10cSrcweir { 1522cdf0e10cSrcweir SwField *pFld = rSh.GetCurFld(); 1523cdf0e10cSrcweir if ( !pFld || (pFld && pFld->GetTypeId() != TYP_GETREFFLD) ) 1524cdf0e10cSrcweir rSet.DisableItem(nWhich); 1525cdf0e10cSrcweir } 1526cdf0e10cSrcweir break; 1527cdf0e10cSrcweir case FN_AUTOFORMAT_AUTO: 1528cdf0e10cSrcweir { 1529cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, SvxAutoCorrCfg::Get()->IsAutoFmtByInput() )); 1530cdf0e10cSrcweir } 1531cdf0e10cSrcweir break; 1532cdf0e10cSrcweir case FN_GLOSSARY_DLG: 1533cdf0e10cSrcweir { 1534cdf0e10cSrcweir rSet.Put(SfxBoolItem(nWhich), sal_True); 1535cdf0e10cSrcweir } 1536cdf0e10cSrcweir break; 1537cdf0e10cSrcweir 1538cdf0e10cSrcweir case SID_DEC_INDENT: 1539cdf0e10cSrcweir case SID_INC_INDENT: 1540cdf0e10cSrcweir { 1541*ca62e2c2SSteve Yin //IAccessibility2 Implementation 2009----- 1542*ca62e2c2SSteve Yin //if the paragrah has bullet we'll do the following things: 1543*ca62e2c2SSteve Yin //1: if the bullet level is the first level, disable the decrease-indent button 1544*ca62e2c2SSteve Yin //2: if the bullet level is the last level, disable the increase-indent button 1545*ca62e2c2SSteve Yin if ( rSh.GetCurNumRule() && !rSh.HasReadonlySel() ) 1546*ca62e2c2SSteve Yin { 1547*ca62e2c2SSteve Yin sal_uInt8 nLevel = rSh.GetNumLevel(); 1548*ca62e2c2SSteve Yin if ( nLevel == (MAXLEVEL-1) && nWhich == SID_INC_INDENT || 1549*ca62e2c2SSteve Yin nLevel == 0 && nWhich == SID_DEC_INDENT ) 1550*ca62e2c2SSteve Yin { 1551*ca62e2c2SSteve Yin rSet.DisableItem( nWhich ); 1552*ca62e2c2SSteve Yin } 1553*ca62e2c2SSteve Yin } 1554*ca62e2c2SSteve Yin else//if the paragraph has no bullet, execute the original functions 1555*ca62e2c2SSteve Yin { 1556*ca62e2c2SSteve Yin //below is copied of the old codes 1557cdf0e10cSrcweir sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell()); 1558cdf0e10cSrcweir nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES; 1559cdf0e10cSrcweir if( (nHtmlMode == HTMLMODE_ON) || !rSh.IsMoveLeftMargin( 1560cdf0e10cSrcweir SID_INC_INDENT == nWhich, sal_True )) 1561cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1562cdf0e10cSrcweir } 1563*ca62e2c2SSteve Yin //old code begins 1564*ca62e2c2SSteve Yin //sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell()); 1565*ca62e2c2SSteve Yin //nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES; 1566*ca62e2c2SSteve Yin //if( (nHtmlMode == HTMLMODE_ON) || !rSh.IsMoveLeftMargin( 1567*ca62e2c2SSteve Yin // SID_INC_INDENT == nWhich, TRUE )) 1568*ca62e2c2SSteve Yin // rSet.DisableItem( nWhich ); 1569*ca62e2c2SSteve Yin //old code ends 1570*ca62e2c2SSteve Yin //-----IAccessibility2 Implementation 2009 1571*ca62e2c2SSteve Yin } 1572cdf0e10cSrcweir break; 1573cdf0e10cSrcweir 1574cdf0e10cSrcweir case FN_DEC_INDENT_OFFSET: 1575cdf0e10cSrcweir case FN_INC_INDENT_OFFSET: 1576cdf0e10cSrcweir { 1577cdf0e10cSrcweir sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell()); 1578cdf0e10cSrcweir nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES; 1579cdf0e10cSrcweir if( (nHtmlMode == HTMLMODE_ON) || 1580cdf0e10cSrcweir !rSh.IsMoveLeftMargin( FN_INC_INDENT_OFFSET == nWhich, 1581cdf0e10cSrcweir sal_False )) 1582cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1583cdf0e10cSrcweir } 1584cdf0e10cSrcweir break; 1585cdf0e10cSrcweir 1586cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR2: 1587cdf0e10cSrcweir { 1588cdf0e10cSrcweir rSet.Put(SvxColorItem(GetView().GetEditWin().GetTextColor(), SID_ATTR_CHAR_COLOR2)); 1589cdf0e10cSrcweir } 1590cdf0e10cSrcweir break; 1591cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR_BACKGROUND: 1592cdf0e10cSrcweir { 1593cdf0e10cSrcweir if(GetView().GetEditWin().IsTextBackColorTransparent()) 1594cdf0e10cSrcweir rSet.Put(SvxColorItem(Color(COL_TRANSPARENT), SID_ATTR_CHAR_COLOR_BACKGROUND)); 1595cdf0e10cSrcweir else 1596cdf0e10cSrcweir rSet.Put(SvxColorItem(GetView().GetEditWin().GetTextBackColor(), SID_ATTR_CHAR_COLOR_BACKGROUND)); 1597cdf0e10cSrcweir } 1598cdf0e10cSrcweir break; 1599cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT: 1600cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR_EXT: 1601cdf0e10cSrcweir { 1602cdf0e10cSrcweir SwEditWin& rEdtWin = GetView().GetEditWin(); 1603cdf0e10cSrcweir SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate(); 1604cdf0e10cSrcweir rSet.Put(SfxBoolItem(nWhich, pApply && pApply->nColor == nWhich)); 1605cdf0e10cSrcweir } 1606cdf0e10cSrcweir break; 1607cdf0e10cSrcweir case FN_INSERT_BOOKMARK: 1608cdf0e10cSrcweir if( rSh.IsTableMode() ) 1609cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1610cdf0e10cSrcweir break; 1611cdf0e10cSrcweir 1612cdf0e10cSrcweir case FN_INSERT_PAGEHEADER: 1613cdf0e10cSrcweir case FN_INSERT_PAGEFOOTER: 1614cdf0e10cSrcweir { 1615cdf0e10cSrcweir #ifndef CHECK_MENU 1616cdf0e10cSrcweir rSet.Put( SfxObjectShellItem( nWhich, GetView().GetDocShell() )); 1617cdf0e10cSrcweir #else 1618cdf0e10cSrcweir // Seitenvorlagen besorgen 1619cdf0e10cSrcweir sal_Bool bFound = sal_False; 1620cdf0e10cSrcweir sal_uInt16 n, nCnt = rSh.GetPageDescCnt(); 1621cdf0e10cSrcweir for( n = 0; n < nCnt; ++n ) 1622cdf0e10cSrcweir { 1623cdf0e10cSrcweir const SwPageDesc& rDesc = rSh.GetPageDesc( n ); 1624cdf0e10cSrcweir if( FN_INSERT_PAGEHEADER == nWhich 1625cdf0e10cSrcweir ? !rDesc.GetMaster().GetHeader().IsActive() 1626cdf0e10cSrcweir : !rDesc.GetMaster().GetFooter().IsActive() ) 1627cdf0e10cSrcweir { 1628cdf0e10cSrcweir bFound = sal_True; 1629cdf0e10cSrcweir break; 1630cdf0e10cSrcweir } 1631cdf0e10cSrcweir } 1632cdf0e10cSrcweir 1633cdf0e10cSrcweir if( bFound ) 1634cdf0e10cSrcweir rSet.Put( SfxObjectShellItem( nWhich, GetView().GetDocShell() )); 1635cdf0e10cSrcweir else 1636cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1637cdf0e10cSrcweir #endif 1638cdf0e10cSrcweir } 1639cdf0e10cSrcweir break; 1640cdf0e10cSrcweir case FN_TABLE_SORT_DIALOG: 1641cdf0e10cSrcweir case FN_SORTING_DLG: 1642cdf0e10cSrcweir if(!rSh.HasSelection() || 1643cdf0e10cSrcweir (FN_TABLE_SORT_DIALOG == nWhich && !rSh.GetTableFmt())) 1644cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1645cdf0e10cSrcweir break; 1646cdf0e10cSrcweir case SID_RUBY_DIALOG: 1647cdf0e10cSrcweir { 1648cdf0e10cSrcweir SvtCJKOptions aCJKOptions; 1649cdf0e10cSrcweir if(!aCJKOptions.IsRubyEnabled()) 1650cdf0e10cSrcweir { 1651cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False ); 1652cdf0e10cSrcweir rSet.DisableItem(nWhich); 1653cdf0e10cSrcweir } 1654cdf0e10cSrcweir else 1655cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True ); 1656cdf0e10cSrcweir break; 1657cdf0e10cSrcweir } 1658cdf0e10cSrcweir //no break! 1659cdf0e10cSrcweir case SID_HYPERLINK_DIALOG: 1660cdf0e10cSrcweir if( GetView().GetDocShell()->IsReadOnly() || 1661cdf0e10cSrcweir (!GetView().GetViewFrame()->HasChildWindow(nWhich) && 1662cdf0e10cSrcweir rSh.HasReadonlySel()) ) 1663cdf0e10cSrcweir rSet.DisableItem(nWhich); 1664cdf0e10cSrcweir else 1665cdf0e10cSrcweir rSet.Put(SfxBoolItem( nWhich, 0 != GetView(). 1666cdf0e10cSrcweir GetViewFrame()->GetChildWindow( nWhich ) )); 1667cdf0e10cSrcweir break; 1668cdf0e10cSrcweir case FN_EDIT_HYPERLINK: 1669cdf0e10cSrcweir case FN_REMOVE_HYPERLINK: 1670cdf0e10cSrcweir case FN_COPY_HYPERLINK_LOCATION: 1671cdf0e10cSrcweir { 1672cdf0e10cSrcweir SfxItemSet aSet(GetPool(), 1673cdf0e10cSrcweir RES_TXTATR_INETFMT, 1674cdf0e10cSrcweir RES_TXTATR_INETFMT); 1675cdf0e10cSrcweir rSh.GetCurAttr(aSet); 1676cdf0e10cSrcweir if(SFX_ITEM_SET > aSet.GetItemState( RES_TXTATR_INETFMT, sal_True ) || rSh.HasReadonlySel()) 1677cdf0e10cSrcweir { 1678cdf0e10cSrcweir rSet.DisableItem(nWhich); 1679cdf0e10cSrcweir } 1680cdf0e10cSrcweir } 1681cdf0e10cSrcweir break; 1682cdf0e10cSrcweir case SID_TRANSLITERATE_HALFWIDTH: 1683cdf0e10cSrcweir case SID_TRANSLITERATE_FULLWIDTH: 1684cdf0e10cSrcweir case SID_TRANSLITERATE_HIRAGANA: 1685cdf0e10cSrcweir case SID_TRANSLITERATE_KATAGANA: 1686cdf0e10cSrcweir { 1687cdf0e10cSrcweir SvtCJKOptions aCJKOptions; 1688cdf0e10cSrcweir if(!aCJKOptions.IsChangeCaseMapEnabled()) 1689cdf0e10cSrcweir { 1690cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False ); 1691cdf0e10cSrcweir rSet.DisableItem(nWhich); 1692cdf0e10cSrcweir } 1693cdf0e10cSrcweir else 1694cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True ); 1695cdf0e10cSrcweir } 1696cdf0e10cSrcweir break; 1697cdf0e10cSrcweir case FN_READONLY_SELECTION_MODE : 1698cdf0e10cSrcweir if(!GetView().GetDocShell()->IsReadOnly()) 1699cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1700cdf0e10cSrcweir else 1701cdf0e10cSrcweir { 1702cdf0e10cSrcweir rSet.Put(SfxBoolItem(nWhich, rSh.GetViewOptions()->IsSelectionInReadonly())); 1703cdf0e10cSrcweir } 1704cdf0e10cSrcweir break; 1705cdf0e10cSrcweir case FN_SELECTION_MODE_DEFAULT: 1706cdf0e10cSrcweir case FN_SELECTION_MODE_BLOCK : 1707cdf0e10cSrcweir rSet.Put(SfxBoolItem(nWhich, (nWhich == FN_SELECTION_MODE_DEFAULT) != rSh.IsBlockMode())); 1708cdf0e10cSrcweir break; 1709cdf0e10cSrcweir case SID_OPEN_HYPERLINK: 1710cdf0e10cSrcweir { 1711cdf0e10cSrcweir SfxItemSet aSet(GetPool(), 1712cdf0e10cSrcweir RES_TXTATR_INETFMT, 1713cdf0e10cSrcweir RES_TXTATR_INETFMT); 1714cdf0e10cSrcweir rSh.GetCurAttr(aSet); 1715cdf0e10cSrcweir if(SFX_ITEM_SET > aSet.GetItemState( RES_TXTATR_INETFMT, sal_False )) 1716cdf0e10cSrcweir rSet.DisableItem(nWhich); 1717cdf0e10cSrcweir } 1718cdf0e10cSrcweir break; 1719cdf0e10cSrcweir case SID_OPEN_SMARTTAGMENU: 1720cdf0e10cSrcweir { 1721cdf0e10cSrcweir uno::Sequence< rtl::OUString > aSmartTagTypes; 1722cdf0e10cSrcweir uno::Sequence< uno::Reference< container::XStringKeyMap > > aStringKeyMaps; 1723cdf0e10cSrcweir uno::Reference<text::XTextRange> xRange; 1724cdf0e10cSrcweir 1725cdf0e10cSrcweir rSh.GetSmartTagTerm( aSmartTagTypes, aStringKeyMaps, xRange ); 1726cdf0e10cSrcweir 1727cdf0e10cSrcweir if ( xRange.is() && aSmartTagTypes.getLength() ) 1728cdf0e10cSrcweir { 1729cdf0e10cSrcweir uno::Sequence < uno::Sequence< uno::Reference< smarttags::XSmartTagAction > > > aActionComponentsSequence; 1730cdf0e10cSrcweir uno::Sequence < uno::Sequence< sal_Int32 > > aActionIndicesSequence; 1731cdf0e10cSrcweir 1732cdf0e10cSrcweir const SmartTagMgr& rSmartTagMgr = SwSmartTagMgr::Get(); 1733cdf0e10cSrcweir rSmartTagMgr.GetActionSequences( aSmartTagTypes, 1734cdf0e10cSrcweir aActionComponentsSequence, 1735cdf0e10cSrcweir aActionIndicesSequence ); 1736cdf0e10cSrcweir 1737cdf0e10cSrcweir uno::Reference <frame::XController> xController = GetView().GetController(); 1738cdf0e10cSrcweir const lang::Locale aLocale( SW_BREAKITER()->GetLocale( (LanguageType)GetAppLanguage() ) ); 1739cdf0e10cSrcweir const rtl::OUString aApplicationName( rSmartTagMgr.GetApplicationName() ); 1740cdf0e10cSrcweir const rtl::OUString aRangeText = xRange->getString(); 1741cdf0e10cSrcweir 1742cdf0e10cSrcweir const SvxSmartTagItem aItem( nWhich, 1743cdf0e10cSrcweir aActionComponentsSequence, 1744cdf0e10cSrcweir aActionIndicesSequence, 1745cdf0e10cSrcweir aStringKeyMaps, 1746cdf0e10cSrcweir xRange, 1747cdf0e10cSrcweir xController, 1748cdf0e10cSrcweir aLocale, 1749cdf0e10cSrcweir aApplicationName, 1750cdf0e10cSrcweir aRangeText ); 1751cdf0e10cSrcweir 1752cdf0e10cSrcweir rSet.Put( aItem ); 1753cdf0e10cSrcweir } 1754cdf0e10cSrcweir else 1755cdf0e10cSrcweir rSet.DisableItem(nWhich); 1756cdf0e10cSrcweir } 1757cdf0e10cSrcweir break; 17581ff378efSZheng Fan case FN_NUM_NUMBERING_ON: 17591ff378efSZheng Fan rSet.Put(SfxBoolItem(FN_NUM_NUMBERING_ON,rSh.SelectionHasNumber())); 17601ff378efSZheng Fan break; 17611ff378efSZheng Fan case FN_NUM_BULLET_ON: 17621ff378efSZheng Fan rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON,rSh.SelectionHasBullet())); 17631ff378efSZheng Fan break; 17641ff378efSZheng Fan case FN_BUL_NUM_RULE_INDEX: 17651ff378efSZheng Fan case FN_NUM_NUM_RULE_INDEX: 17661ff378efSZheng Fan { 17671ff378efSZheng Fan SwNumRule* pCurRule = (SwNumRule*)(GetShell().GetCurNumRule()); 17681ff378efSZheng Fan sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF; 17691ff378efSZheng Fan rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,DEFAULT_NONE)); 17701ff378efSZheng Fan rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,DEFAULT_NONE)); 17711ff378efSZheng Fan if( pCurRule ) 17721ff378efSZheng Fan { 17731ff378efSZheng Fan nActNumLvl = GetShell().GetNumLevel(); 17741ff378efSZheng Fan if( nActNumLvl < MAXLEVEL ) 17751ff378efSZheng Fan { 17761ff378efSZheng Fan nActNumLvl = 1<<nActNumLvl; 17771ff378efSZheng Fan } 17781ff378efSZheng Fan SvxNumRule aSvxRule = pCurRule->MakeSvxNumRule(); 17791ff378efSZheng Fan if ( GetShell().HasBullet()) 17801ff378efSZheng Fan { 17811ff378efSZheng Fan rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); 17821ff378efSZheng Fan rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); 17831ff378efSZheng Fan NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS); 17841ff378efSZheng Fan if ( pBullets ) 17851ff378efSZheng Fan { 17861ff378efSZheng Fan sal_uInt16 nBulIndex = pBullets->GetNBOIndexForNumRule(aSvxRule,nActNumLvl); 17871ff378efSZheng Fan rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,nBulIndex)); 17881ff378efSZheng Fan } 17891ff378efSZheng Fan }else if ( GetShell().HasNumber() ) 17901ff378efSZheng Fan { 17911ff378efSZheng Fan rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); 17921ff378efSZheng Fan rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); 17931ff378efSZheng Fan NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING); 17941ff378efSZheng Fan if ( pNumbering ) 17951ff378efSZheng Fan { 17961ff378efSZheng Fan sal_uInt16 nBulIndex = pNumbering->GetNBOIndexForNumRule(aSvxRule,nActNumLvl); 17971ff378efSZheng Fan rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,nBulIndex)); 17981ff378efSZheng Fan } 17991ff378efSZheng Fan } 18001ff378efSZheng Fan } 18011ff378efSZheng Fan } 18021ff378efSZheng Fan break; 1803cdf0e10cSrcweir case FN_NUM_CONTINUE: 1804cdf0e10cSrcweir { 1805cdf0e10cSrcweir // --> OD 2009-08-26 #i86492# 1806cdf0e10cSrcweir // Allow continuation of previous list, even if at current cursor 1807cdf0e10cSrcweir // a list is active. 1808cdf0e10cSrcweir // if ( rSh.GetCurNumRule() ) 1809cdf0e10cSrcweir // rSet.DisableItem(nWhich); 1810cdf0e10cSrcweir // else 1811cdf0e10cSrcweir // <-- 1812cdf0e10cSrcweir { 1813cdf0e10cSrcweir // --> OD 2009-08-26 #i86492# 1814cdf0e10cSrcweir // Search also for bullet list 1815cdf0e10cSrcweir String aDummy; 1816cdf0e10cSrcweir const SwNumRule* pRule = 1817cdf0e10cSrcweir rSh.SearchNumRule( false, true, false, -1, aDummy ); 1818cdf0e10cSrcweir if ( !pRule ) 1819cdf0e10cSrcweir { 1820cdf0e10cSrcweir pRule = rSh.SearchNumRule( false, false, false, -1, aDummy ); 1821cdf0e10cSrcweir } 1822cdf0e10cSrcweir // <-- 1823cdf0e10cSrcweir if ( !pRule ) 1824cdf0e10cSrcweir rSet.DisableItem(nWhich); 1825cdf0e10cSrcweir } 1826cdf0e10cSrcweir } 1827cdf0e10cSrcweir break; 1828cdf0e10cSrcweir case SID_INSERT_RLM : 1829cdf0e10cSrcweir case SID_INSERT_LRM : 1830cdf0e10cSrcweir case SID_INSERT_ZWNBSP : 1831cdf0e10cSrcweir case SID_INSERT_ZWSP: 1832cdf0e10cSrcweir { 1833cdf0e10cSrcweir SvtCTLOptions aCTLOptions; 1834cdf0e10cSrcweir sal_Bool bEnabled = aCTLOptions.IsCTLFontEnabled(); 1835cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, bEnabled ); 1836cdf0e10cSrcweir if(!bEnabled) 1837cdf0e10cSrcweir rSet.DisableItem(nWhich); 1838cdf0e10cSrcweir } 1839cdf0e10cSrcweir break; 1840cdf0e10cSrcweir } 1841cdf0e10cSrcweir nWhich = aIter.NextWhich(); 1842cdf0e10cSrcweir } 1843cdf0e10cSrcweir } 1844cdf0e10cSrcweir /* -----------------------------2002/07/05 10:31------------------------------ 1845cdf0e10cSrcweir Switch on/off header of footer of a page style - if an empty name is 1846cdf0e10cSrcweir given all styles are changed 1847cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 1848cdf0e10cSrcweir void SwTextShell::ChangeHeaderOrFooter( 1849cdf0e10cSrcweir const String& rStyleName, sal_Bool bHeader, sal_Bool bOn, sal_Bool bShowWarning) 1850cdf0e10cSrcweir { 1851cdf0e10cSrcweir SwWrtShell& rSh = GetShell(); 1852cdf0e10cSrcweir rSh.StartAllAction(); 1853cdf0e10cSrcweir rSh.StartUndo( UNDO_HEADER_FOOTER ); // #i7983# 1854cdf0e10cSrcweir sal_Bool bExecute = sal_True; 1855cdf0e10cSrcweir sal_Bool bCrsrSet = sal_False; 1856cdf0e10cSrcweir for( sal_uInt16 nFrom = 0, nTo = rSh.GetPageDescCnt(); 1857cdf0e10cSrcweir nFrom < nTo; ++nFrom ) 1858cdf0e10cSrcweir { 1859cdf0e10cSrcweir int bChgd = sal_False; 1860cdf0e10cSrcweir SwPageDesc aDesc( rSh.GetPageDesc( nFrom )); 1861cdf0e10cSrcweir String sTmp(aDesc.GetName()); 1862cdf0e10cSrcweir if( !rStyleName.Len() || rStyleName == sTmp ) 1863cdf0e10cSrcweir { 1864cdf0e10cSrcweir if( bShowWarning && !bOn && GetActiveView() && GetActiveView() == &GetView() && 1865cdf0e10cSrcweir ((bHeader && aDesc.GetMaster().GetHeader().IsActive()) || 1866cdf0e10cSrcweir (!bHeader && aDesc.GetMaster().GetFooter().IsActive()))) 1867cdf0e10cSrcweir { 1868cdf0e10cSrcweir bShowWarning = sal_False; 1869cdf0e10cSrcweir //Actions have to be closed while the dialog is showing 1870cdf0e10cSrcweir rSh.EndAllAction(); 1871cdf0e10cSrcweir 1872cdf0e10cSrcweir Window* pParent = &GetView().GetViewFrame()->GetWindow(); 1873cdf0e10cSrcweir sal_Bool bRet = RET_YES == QueryBox( pParent, ResId( RID_SVXQBX_DELETE_HEADFOOT, 1874cdf0e10cSrcweir DIALOG_MGR() ) ).Execute(); 1875cdf0e10cSrcweir bExecute = bRet; 1876cdf0e10cSrcweir rSh.StartAllAction(); 1877cdf0e10cSrcweir } 1878cdf0e10cSrcweir if( bExecute ) 1879cdf0e10cSrcweir { 1880cdf0e10cSrcweir bChgd = sal_True; 1881cdf0e10cSrcweir SwFrmFmt &rMaster = aDesc.GetMaster(); 1882cdf0e10cSrcweir if(bHeader) 1883cdf0e10cSrcweir rMaster.SetFmtAttr( SwFmtHeader( bOn )); 1884cdf0e10cSrcweir else 1885cdf0e10cSrcweir rMaster.SetFmtAttr( SwFmtFooter( bOn )); 1886cdf0e10cSrcweir if( bOn ) 1887cdf0e10cSrcweir { 1888cdf0e10cSrcweir SvxULSpaceItem aUL(bHeader ? 0 : MM50, bHeader ? MM50 : 0, RES_UL_SPACE ); 1889cdf0e10cSrcweir SwFrmFmt* pFmt = bHeader ? 1890cdf0e10cSrcweir (SwFrmFmt*)rMaster.GetHeader().GetHeaderFmt() : 1891cdf0e10cSrcweir (SwFrmFmt*)rMaster.GetFooter().GetFooterFmt(); 1892cdf0e10cSrcweir pFmt->SetFmtAttr( aUL ); 1893cdf0e10cSrcweir } 1894cdf0e10cSrcweir } 1895cdf0e10cSrcweir if( bChgd ) 1896cdf0e10cSrcweir { 1897cdf0e10cSrcweir rSh.ChgPageDesc( nFrom, aDesc ); 1898cdf0e10cSrcweir 1899cdf0e10cSrcweir if( !bCrsrSet && bOn ) 1900cdf0e10cSrcweir bCrsrSet = rSh.SetCrsrInHdFt( 19011ff378efSZheng Fan !rStyleName.Len() ? (sal_uInt16)0xFFFF : nFrom, 1902cdf0e10cSrcweir bHeader ); 1903cdf0e10cSrcweir } 1904cdf0e10cSrcweir } 1905cdf0e10cSrcweir } 1906cdf0e10cSrcweir rSh.EndUndo( UNDO_HEADER_FOOTER ); // #i7983# 1907cdf0e10cSrcweir rSh.EndAllAction(); 1908cdf0e10cSrcweir } 1909cdf0e10cSrcweir 1910