LCOV - code coverage report
Current view: top level - sw/source/core/uibase/shells - textsh1.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 81 869 9.3 %
Date: 2014-04-11 Functions: 3 6 50.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10