LCOV - code coverage report
Current view: top level - sc/source/ui/view - editsh.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 599 0.5 %
Date: 2012-08-25 Functions: 3 30 10.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 6 1210 0.5 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <com/sun/star/linguistic2/XThesaurus.hpp>
      30                 :            : #include <comphelper/string.hxx>
      31                 :            : #include "scitems.hxx"
      32                 :            : #include <editeng/eeitem.hxx>
      33                 :            : 
      34                 :            : #include <svx/clipfmtitem.hxx>
      35                 :            : #include <svx/svxdlg.hxx>
      36                 :            : #include <editeng/cntritem.hxx>
      37                 :            : #include <editeng/outliner.hxx>
      38                 :            : #include <editeng/unolingu.hxx>
      39                 :            : #include <editeng/crsditem.hxx>
      40                 :            : #include <editeng/editeng.hxx>
      41                 :            : #include <editeng/editview.hxx>
      42                 :            : #include <editeng/escpitem.hxx>
      43                 :            : #include <editeng/flditem.hxx>
      44                 :            : #include <editeng/fontitem.hxx>
      45                 :            : #include <svx/hlnkitem.hxx>
      46                 :            : #include <editeng/postitem.hxx>
      47                 :            : #include <editeng/scripttypeitem.hxx>
      48                 :            : #include <editeng/shdditem.hxx>
      49                 :            : #include <svl/srchitem.hxx>
      50                 :            : #include <editeng/udlnitem.hxx>
      51                 :            : #include <editeng/wghtitem.hxx>
      52                 :            : #include <sfx2/basedlgs.hxx>
      53                 :            : #include <sfx2/bindings.hxx>
      54                 :            : #include <sfx2/msg.hxx>
      55                 :            : #include <sfx2/objface.hxx>
      56                 :            : #include <sfx2/objsh.hxx>
      57                 :            : #include <sfx2/request.hxx>
      58                 :            : #include <sfx2/viewfrm.hxx>
      59                 :            : #include <sot/exchange.hxx>
      60                 :            : #include <svtools/cliplistener.hxx>
      61                 :            : #include <svl/whiter.hxx>
      62                 :            : #include <vcl/msgbox.hxx>
      63                 :            : #include <sot/formats.hxx>
      64                 :            : #include <svtools/transfer.hxx>
      65                 :            : #include <svl/stritem.hxx>
      66                 :            : 
      67                 :            : #include "editsh.hxx"
      68                 :            : #include "scresid.hxx"
      69                 :            : #include "global.hxx"
      70                 :            : #include "sc.hrc"
      71                 :            : #include "scmod.hxx"
      72                 :            : #include "inputhdl.hxx"
      73                 :            : #include "viewutil.hxx"
      74                 :            : #include "viewdata.hxx"
      75                 :            : #include "document.hxx"
      76                 :            : #include "reffind.hxx"
      77                 :            : #include "tabvwsh.hxx"
      78                 :            : #include "editutil.hxx"
      79                 :            : #include "globstr.hrc"
      80                 :            : 
      81                 :            : #define ScEditShell
      82                 :            : #include "scslots.hxx"
      83                 :            : 
      84                 :            : #include "scui_def.hxx"
      85                 :            : #include "scabstdlg.hxx"
      86                 :            : 
      87                 :            : using namespace ::com::sun::star;
      88                 :            : 
      89                 :            : 
      90 [ #  # ][ #  # ]:          0 : TYPEINIT1( ScEditShell, SfxShell );
      91                 :            : 
      92 [ +  + ][ +  - ]:        153 : SFX_IMPL_INTERFACE(ScEditShell, SfxShell, ScResId(SCSTR_EDITSHELL))
                 [ +  - ]
      93                 :            : {
      94 [ +  - ][ +  - ]:         51 :     SFX_POPUPMENU_REGISTRATION( ScResId(RID_POPUP_EDIT) );
      95                 :         51 : }
      96                 :            : 
      97                 :            : 
      98                 :          0 : ScEditShell::ScEditShell(EditView* pView, ScViewData* pData) :
      99                 :            :     pEditView       (pView),
     100                 :            :     pViewData       (pData),
     101                 :            :     pClipEvtLstnr   (NULL),
     102                 :            :     bPastePossible  (false),
     103                 :          0 :     bIsInsertMode   (sal_True)
     104                 :            : {
     105 [ #  # ][ #  # ]:          0 :     SetPool( pEditView->GetEditEngine()->GetEmptyItemSet().GetPool() );
     106 [ #  # ][ #  # ]:          0 :     SetUndoManager( &pEditView->GetEditEngine()->GetUndoManager() );
                 [ #  # ]
     107 [ #  # ][ #  # ]:          0 :     SetName(rtl::OUString("EditCell"));
                 [ #  # ]
     108                 :          0 : }
     109                 :            : 
     110                 :          0 : ScEditShell::~ScEditShell()
     111                 :            : {
     112         [ #  # ]:          0 :     if ( pClipEvtLstnr )
     113                 :            :     {
     114 [ #  # ][ #  # ]:          0 :         pClipEvtLstnr->AddRemoveListener( pViewData->GetActiveWin(), false );
     115                 :            : 
     116                 :            :         //  The listener may just now be waiting for the SolarMutex and call the link
     117                 :            :         //  afterwards, in spite of RemoveListener. So the link has to be reset, too.
     118         [ #  # ]:          0 :         pClipEvtLstnr->ClearCallbackLink();
     119                 :            : 
     120                 :          0 :         pClipEvtLstnr->release();
     121                 :            :     }
     122         [ #  # ]:          0 : }
     123                 :            : 
     124                 :          0 : ScInputHandler* ScEditShell::GetMyInputHdl()
     125                 :            : {
     126                 :          0 :     return SC_MOD()->GetInputHdl( pViewData->GetViewShell() );
     127                 :            : }
     128                 :            : 
     129                 :          0 : void ScEditShell::SetEditView(EditView* pView)
     130                 :            : {
     131                 :          0 :     pEditView = pView;
     132                 :          0 :     pEditView->SetInsertMode( bIsInsertMode );
     133                 :          0 :     SetPool( pEditView->GetEditEngine()->GetEmptyItemSet().GetPool() );
     134                 :          0 :     SetUndoManager( &pEditView->GetEditEngine()->GetUndoManager() );
     135                 :          0 : }
     136                 :            : 
     137                 :          0 : void lcl_RemoveAttribs( EditView& rEditView )
     138                 :            : {
     139 [ #  # ][ #  # ]:          0 :     ScEditEngineDefaulter* pEngine = static_cast<ScEditEngineDefaulter*>(rEditView.GetEditEngine());
     140                 :            : 
     141         [ #  # ]:          0 :     sal_Bool bOld = pEngine->GetUpdateMode();
     142         [ #  # ]:          0 :     pEngine->SetUpdateMode(false);
     143                 :            : 
     144 [ #  # ][ #  # ]:          0 :     String aName = ScGlobal::GetRscString( STR_UNDO_DELETECONTENTS );
     145 [ #  # ][ #  # ]:          0 :     pEngine->GetUndoManager().EnterListAction( aName, aName );
     146                 :            : 
     147         [ #  # ]:          0 :     rEditView.RemoveAttribs(true);
     148         [ #  # ]:          0 :     pEngine->RepeatDefaults();      // paragraph attributes from cell formats must be preserved
     149                 :            : 
     150 [ #  # ][ #  # ]:          0 :     pEngine->GetUndoManager().LeaveListAction();
     151                 :            : 
     152 [ #  # ][ #  # ]:          0 :     pEngine->SetUpdateMode(bOld);
     153                 :          0 : }
     154                 :            : 
     155                 :          0 : void lclInsertCharacter( EditView* pTableView, EditView* pTopView, sal_Unicode cChar )
     156                 :            : {
     157                 :          0 :     rtl::OUString aString( cChar );
     158         [ #  # ]:          0 :     if( pTableView )
     159 [ #  # ][ #  # ]:          0 :         pTableView->InsertText( aString );
                 [ #  # ]
     160         [ #  # ]:          0 :     if( pTopView )
     161 [ #  # ][ #  # ]:          0 :         pTopView->InsertText( aString );
                 [ #  # ]
     162                 :          0 : }
     163                 :            : 
     164                 :          0 : void ScEditShell::Execute( SfxRequest& rReq )
     165                 :            : {
     166                 :          0 :     const SfxItemSet*   pReqArgs    = rReq.GetArgs();
     167                 :          0 :     sal_uInt16              nSlot       = rReq.GetSlot();
     168                 :          0 :     SfxBindings&        rBindings   = pViewData->GetBindings();
     169                 :            : 
     170                 :          0 :     ScInputHandler* pHdl = GetMyInputHdl();
     171                 :            :     OSL_ENSURE(pHdl,"kein ScInputHandler");
     172                 :            : 
     173                 :          0 :     EditView* pTopView   = pHdl->GetTopView();      // hat Eingabezeile den Focus?
     174                 :          0 :     EditView* pTableView = pHdl->GetTableView();
     175                 :            : 
     176                 :            :     OSL_ENSURE(pTableView,"no EditView :-(");
     177                 :            :     /* #i91683# No EditView if spell-check dialog is active and positioned on
     178                 :            :      * an error and user immediately (without double click or F2) selected a
     179                 :            :      * text portion of that cell with the mouse and wanted to modify it. */
     180                 :            :     /* FIXME: Bailing out only cures the symptom and prevents a crash, no edit
     181                 :            :      * action is possible. A real fix somehow would need to create a valid
     182                 :            :      * EditView from the spell-check view. */
     183         [ #  # ]:          0 :     if (!pTableView)
     184                 :          0 :         return;
     185                 :            : 
     186                 :          0 :     EditEngine* pEngine = pTableView->GetEditEngine();
     187                 :            : 
     188                 :          0 :     pHdl->DataChanging();
     189                 :          0 :     sal_Bool bSetSelIsRef = false;
     190                 :            : 
     191   [ #  #  #  #  :          0 :     switch ( nSlot )
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
     192                 :            :     {
     193                 :            :         case FID_INS_CELL_CONTENTS: // Insert-Taste, weil als Acc definiert
     194                 :          0 :             bIsInsertMode = !pTableView->IsInsertMode();
     195                 :          0 :             pTableView->SetInsertMode( bIsInsertMode );
     196         [ #  # ]:          0 :             if (pTopView)
     197                 :          0 :                 pTopView->SetInsertMode( bIsInsertMode );
     198                 :          0 :             rBindings.Invalidate( SID_ATTR_INSERT );
     199                 :          0 :             break;
     200                 :            : 
     201                 :            :         case SID_ATTR_INSERT:
     202         [ #  # ]:          0 :             if ( pReqArgs )
     203                 :            :             {
     204                 :          0 :                 bIsInsertMode = ((const SfxBoolItem&)pReqArgs->Get(nSlot)).GetValue();
     205                 :          0 :                 pTableView->SetInsertMode( bIsInsertMode );
     206         [ #  # ]:          0 :                 if (pTopView)
     207                 :          0 :                     pTopView->SetInsertMode( bIsInsertMode );
     208                 :          0 :                 rBindings.Invalidate( SID_ATTR_INSERT );
     209                 :            :             }
     210                 :          0 :             break;
     211                 :            : 
     212                 :            :         case SID_THES:
     213                 :            :             {
     214         [ #  # ]:          0 :                 String aReplaceText;
     215 [ #  # ][ #  # ]:          0 :                 SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES , false );
     216         [ #  # ]:          0 :                 if (pItem2)
     217         [ #  # ]:          0 :                     aReplaceText = pItem2->GetValue();
     218         [ #  # ]:          0 :                 if (aReplaceText.Len() > 0)
     219 [ #  # ][ #  # ]:          0 :                     ReplaceTextWithSynonym( *pEditView, aReplaceText );
     220                 :            :             }
     221                 :          0 :             break;
     222                 :            : 
     223                 :            :         case SID_COPY:
     224                 :          0 :             pTableView->Copy();
     225                 :          0 :             return;
     226                 :            : 
     227                 :            :         case SID_CUT:
     228                 :          0 :             pTableView->Cut();
     229         [ #  # ]:          0 :             if (pTopView)
     230                 :          0 :                 pTopView->DeleteSelected();
     231                 :          0 :             break;
     232                 :            : 
     233                 :            :         case SID_PASTE:
     234                 :          0 :             pTableView->PasteSpecial();
     235         [ #  # ]:          0 :             if (pTopView)
     236                 :          0 :                 pTopView->Paste();
     237                 :          0 :             break;
     238                 :            : 
     239                 :            :         case SID_DELETE:
     240                 :          0 :             pTableView->DeleteSelected();
     241         [ #  # ]:          0 :             if (pTopView)
     242                 :          0 :                 pTopView->DeleteSelected();
     243                 :          0 :             break;
     244                 :            : 
     245                 :            :         case SID_CELL_FORMAT_RESET:                 // "Standard"
     246                 :          0 :             lcl_RemoveAttribs( *pTableView );
     247         [ #  # ]:          0 :             if ( pTopView )
     248                 :          0 :                 lcl_RemoveAttribs( *pTopView );
     249                 :          0 :             break;
     250                 :            : 
     251                 :            :         case SID_CLIPBOARD_FORMAT_ITEMS:
     252                 :            :             {
     253                 :          0 :                 sal_uLong nFormat = 0;
     254                 :            :                 const SfxPoolItem* pItem;
     255 [ #  # ][ #  # ]:          0 :                 if ( pReqArgs &&
         [ #  # ][ #  # ]
     256         [ #  # ]:          0 :                      pReqArgs->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET &&
     257 [ #  # ][ #  # ]:          0 :                      pItem->ISA(SfxUInt32Item) )
     258                 :            :                 {
     259                 :          0 :                     nFormat = ((const SfxUInt32Item*)pItem)->GetValue();
     260                 :            :                 }
     261                 :            : 
     262         [ #  # ]:          0 :                 if ( nFormat )
     263                 :            :                 {
     264         [ #  # ]:          0 :                     if (SOT_FORMAT_STRING == nFormat)
     265         [ #  # ]:          0 :                         pTableView->Paste();
     266                 :            :                     else
     267         [ #  # ]:          0 :                         pTableView->PasteSpecial();
     268                 :            : 
     269         [ #  # ]:          0 :                     if (pTopView)
     270         [ #  # ]:          0 :                         pTopView->Paste();
     271                 :            :                 }
     272                 :            :             }
     273                 :          0 :             break;
     274                 :            : 
     275                 :            :         case SID_PASTE_SPECIAL:
     276                 :            :             {
     277                 :          0 :                 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     278                 :          0 :                 SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( pViewData->GetDialogParent() );
     279                 :          0 :                 sal_uLong nFormat = 0;
     280         [ #  # ]:          0 :                 if ( pDlg )
     281                 :            :                 {
     282 [ #  # ][ #  # ]:          0 :                     pDlg->Insert( SOT_FORMAT_STRING, EMPTY_STRING );
     283 [ #  # ][ #  # ]:          0 :                     pDlg->Insert( SOT_FORMAT_RTF,    EMPTY_STRING );
     284                 :            : 
     285                 :            :                     TransferableDataHelper aDataHelper(
     286 [ #  # ][ #  # ]:          0 :                         TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) );
     287                 :            : 
     288 [ #  # ][ #  # ]:          0 :                     nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() );
                 [ #  # ]
     289 [ #  # ][ #  # ]:          0 :                     DELETEZ(pDlg);
                 [ #  # ]
     290                 :            :                 }
     291                 :            : 
     292                 :            :                 // while the dialog was open, edit mode may have been stopped
     293         [ #  # ]:          0 :                 if (!SC_MOD()->IsInputMode())
     294                 :          0 :                     return;
     295                 :            : 
     296         [ #  # ]:          0 :                 if (nFormat > 0)
     297                 :            :                 {
     298         [ #  # ]:          0 :                     if (SOT_FORMAT_STRING == nFormat)
     299                 :          0 :                         pTableView->Paste();
     300                 :            :                     else
     301                 :          0 :                         pTableView->PasteSpecial();
     302                 :            : 
     303         [ #  # ]:          0 :                     if (pTopView)
     304                 :          0 :                         pTopView->Paste();
     305                 :            :                 }
     306                 :            : 
     307         [ #  # ]:          0 :                 if (pTopView)
     308                 :          0 :                     pTopView->GetWindow()->GrabFocus();
     309                 :            :             }
     310                 :          0 :             break;
     311                 :            : 
     312                 :            :         case SID_SELECTALL:
     313                 :            :             {
     314                 :          0 :                 sal_uInt16 nPar = pEngine->GetParagraphCount();
     315         [ #  # ]:          0 :                 if (nPar)
     316                 :            :                 {
     317                 :          0 :                     xub_StrLen nLen = pEngine->GetTextLen(nPar-1);
     318         [ #  # ]:          0 :                     pTableView->SetSelection(ESelection(0,0,nPar-1,nLen));
     319         [ #  # ]:          0 :                     if (pTopView)
     320         [ #  # ]:          0 :                         pTopView->SetSelection(ESelection(0,0,nPar-1,nLen));
     321                 :            :                 }
     322                 :            :             }
     323                 :          0 :             return;
     324                 :            : 
     325                 :            :         case SID_CHARMAP:
     326                 :            :             {
     327         [ #  # ]:          0 :                 sal_uInt16 nScript = pTableView->GetSelectedScriptType();
     328                 :            :                 sal_uInt16 nFontWhich = ( nScript == SCRIPTTYPE_ASIAN ) ? EE_CHAR_FONTINFO_CJK :
     329                 :            :                                 ( ( nScript == SCRIPTTYPE_COMPLEX ) ? EE_CHAR_FONTINFO_CTL :
     330 [ #  # ][ #  # ]:          0 :                                                                         EE_CHAR_FONTINFO );
     331                 :            :                 const SvxFontItem& rItem = (const SvxFontItem&)
     332 [ #  # ][ #  # ]:          0 :                             pTableView->GetAttribs().Get(nFontWhich);
                 [ #  # ]
     333                 :            : 
     334         [ #  # ]:          0 :                 String aString;
     335         [ #  # ]:          0 :                 SvxFontItem aNewItem( EE_CHAR_FONTINFO );
     336                 :            : 
     337                 :          0 :                 const SfxItemSet *pArgs = rReq.GetArgs();
     338                 :          0 :                 const SfxPoolItem* pItem = 0;
     339         [ #  # ]:          0 :                 if( pArgs )
     340 [ #  # ][ #  # ]:          0 :                     pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), false, &pItem);
     341                 :            : 
     342         [ #  # ]:          0 :                 if ( pItem )
     343                 :            :                 {
     344         [ #  # ]:          0 :                     aString = ((const SfxStringItem*)pItem)->GetValue();
     345                 :          0 :                     const SfxPoolItem* pFtItem = NULL;
     346 [ #  # ][ #  # ]:          0 :                     pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), false, &pFtItem);
     347 [ #  # ][ #  # ]:          0 :                     const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem );
         [ #  # ][ #  # ]
     348         [ #  # ]:          0 :                     if ( pFontItem )
     349                 :            :                     {
     350         [ #  # ]:          0 :                         String aFontName(pFontItem->GetValue());
     351         [ #  # ]:          0 :                         Font aFont(aFontName, Size(1,1)); // Size nur wg. CTOR
     352         [ #  # ]:          0 :                         aNewItem = SvxFontItem( aFont.GetFamily(), aFont.GetName(),
     353         [ #  # ]:          0 :                                     aFont.GetStyleName(), aFont.GetPitch(),
     354 [ #  # ][ #  # ]:          0 :                                     aFont.GetCharSet(), ATTR_FONT  );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     355                 :            :                     }
     356                 :            :                     else
     357         [ #  # ]:          0 :                         aNewItem = rItem;
     358                 :            :                 }
     359                 :            :                 else
     360                 :            :                 {
     361         [ #  # ]:          0 :                     ScViewUtil::ExecuteCharMap( rItem, *pViewData->GetViewShell()->GetViewFrame(), aNewItem, aString );
     362                 :            : 
     363                 :            :                     // while the dialog was open, edit mode may have been stopped
     364 [ #  # ][ #  # ]:          0 :                     if (!SC_MOD()->IsInputMode())
                 [ #  # ]
     365                 :            :                         return;
     366                 :            :                 }
     367                 :            : 
     368         [ #  # ]:          0 :                 if ( aString.Len() )
     369                 :            :                 {
     370                 :            :                     //  if string contains WEAK characters, set all fonts
     371                 :            :                     sal_uInt8 nSetScript;
     372         [ #  # ]:          0 :                     ScDocument* pDoc = pViewData->GetDocument();
     373 [ #  # ][ #  # ]:          0 :                     if ( pDoc->HasStringWeakCharacters( aString ) )
                 [ #  # ]
     374                 :          0 :                         nSetScript = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
     375                 :            :                     else
     376 [ #  # ][ #  # ]:          0 :                         nSetScript = pDoc->GetStringScriptType( aString );
     377                 :            : 
     378 [ #  # ][ #  # ]:          0 :                     SfxItemSet aSet( pTableView->GetEmptyItemSet() );
     379         [ #  # ]:          0 :                     SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, GetPool() );
     380         [ #  # ]:          0 :                     aSetItem.PutItemForScriptType( nSetScript, aNewItem );
     381         [ #  # ]:          0 :                     aSet.Put( aSetItem.GetItemSet(), false );
     382                 :            : 
     383                 :            :                     //  SetAttribs an der View selektiert ein Wort, wenn nichts selektiert ist
     384 [ #  # ][ #  # ]:          0 :                     pTableView->GetEditEngine()->QuickSetAttribs( aSet, pTableView->GetSelection() );
                 [ #  # ]
     385         [ #  # ]:          0 :                     pTableView->InsertText(aString);
     386         [ #  # ]:          0 :                     if (pTopView)
     387         [ #  # ]:          0 :                         pTopView->InsertText(aString);
     388                 :            : 
     389         [ #  # ]:          0 :                     SfxStringItem aStringItem( SID_CHARMAP, aString );
     390         [ #  # ]:          0 :                     SfxStringItem aFontItem( SID_ATTR_SPECIALCHAR, aNewItem.GetFamilyName() );
     391         [ #  # ]:          0 :                     rReq.AppendItem( aFontItem );
     392         [ #  # ]:          0 :                     rReq.AppendItem( aStringItem );
     393 [ #  # ][ #  # ]:          0 :                     rReq.Done();
         [ #  # ][ #  # ]
                 [ #  # ]
     394                 :            : 
     395                 :            : 
     396                 :            :                 }
     397                 :            : 
     398         [ #  # ]:          0 :                 if (pTopView)
     399 [ #  # ][ #  # ]:          0 :                     pTopView->GetWindow()->GrabFocus();
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     400                 :            :             }
     401                 :          0 :             break;
     402                 :            : 
     403                 :            :         case FID_INSERT_NAME:
     404                 :            :             {
     405                 :          0 :                 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
     406                 :            :                 OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
     407                 :            : 
     408                 :          0 :                 AbstractScNamePasteDlg* pDlg = pFact->CreateScNamePasteDlg( pViewData->GetDialogParent(), pViewData->GetDocShell(), RID_SCDLG_NAMES_PASTE, false );
     409                 :            :                 OSL_ENSURE(pDlg, "Dialog create fail!");
     410                 :          0 :                 short nRet = pDlg->Execute();
     411                 :            :                 // pDlg is needed below
     412                 :            : 
     413                 :            :                 // while the dialog was open, edit mode may have been stopped
     414         [ #  # ]:          0 :                 if (!SC_MOD()->IsInputMode())
     415                 :            :                 {
     416         [ #  # ]:          0 :                     delete pDlg;
     417                 :          0 :                     return;
     418                 :            :                 }
     419                 :            : 
     420         [ #  # ]:          0 :                 if ( nRet == BTN_PASTE_NAME )
     421                 :            :                 {
     422         [ #  # ]:          0 :                     std::vector<rtl::OUString> aNames = pDlg->GetSelectedNames();
     423         [ #  # ]:          0 :                     if (!aNames.empty())
     424                 :            :                     {
     425                 :          0 :                         rtl::OUStringBuffer aBuffer;
     426 [ #  # ][ #  # ]:          0 :                         for (std::vector<rtl::OUString>::const_iterator itr = aNames.begin();
                 [ #  # ]
     427                 :          0 :                                 itr != aNames.end(); ++itr)
     428                 :            :                         {
     429 [ #  # ][ #  # ]:          0 :                             aBuffer.append(*itr).append(' ');
     430                 :            :                         }
     431 [ #  # ][ #  # ]:          0 :                         pTableView->InsertText(aBuffer.toString());
                 [ #  # ]
     432         [ #  # ]:          0 :                         if (pTopView)
     433 [ #  # ][ #  # ]:          0 :                             pTopView->InsertText(aBuffer.makeStringAndClear());
         [ #  # ][ #  # ]
     434                 :          0 :                     }
     435                 :            :                 }
     436         [ #  # ]:          0 :                 delete pDlg;
     437                 :            : 
     438         [ #  # ]:          0 :                 if (pTopView)
     439                 :          0 :                     pTopView->GetWindow()->GrabFocus();
     440                 :            :             }
     441                 :          0 :             break;
     442                 :            : 
     443                 :            :         case SID_CHAR_DLG:
     444                 :            :             {
     445         [ #  # ]:          0 :                 SfxItemSet aAttrs( pTableView->GetAttribs() );
     446                 :            : 
     447         [ #  # ]:          0 :                 SfxObjectShell* pObjSh = pViewData->GetSfxDocShell();
     448                 :            : 
     449         [ #  # ]:          0 :                 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
     450                 :            :                 OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
     451                 :            : 
     452                 :            :                 SfxAbstractTabDialog* pDlg = pFact->CreateScCharDlg( pViewData->GetDialogParent(), &aAttrs,
     453 [ #  # ][ #  # ]:          0 :                                                                      pObjSh, RID_SCDLG_CHAR );
     454                 :            :                 OSL_ENSURE(pDlg, "Dialog create fail!");
     455         [ #  # ]:          0 :                 short nRet = pDlg->Execute();
     456                 :            :                 // pDlg is needed below
     457                 :            : 
     458                 :            :                 // while the dialog was open, edit mode may have been stopped
     459 [ #  # ][ #  # ]:          0 :                 if (!SC_MOD()->IsInputMode())
                 [ #  # ]
     460                 :            :                 {
     461 [ #  # ][ #  # ]:          0 :                     delete pDlg;
     462                 :            :                     return;
     463                 :            :                 }
     464                 :            : 
     465         [ #  # ]:          0 :                 if ( nRet == RET_OK )
     466                 :            :                 {
     467         [ #  # ]:          0 :                     const SfxItemSet* pOut = pDlg->GetOutputItemSet();
     468         [ #  # ]:          0 :                     pTableView->SetAttribs( *pOut );
     469                 :            :                 }
     470 [ #  # ][ #  # ]:          0 :                 delete pDlg;
         [ #  # ][ #  # ]
     471                 :            :             }
     472                 :          0 :             break;
     473                 :            : 
     474                 :            :         case SID_TOGGLE_REL:
     475                 :            :             {
     476         [ #  # ]:          0 :                 if (pEngine->GetParagraphCount() == 1)
     477                 :            :                 {
     478         [ #  # ]:          0 :                     String aText = pEngine->GetText();
     479         [ #  # ]:          0 :                     ESelection aSel = pEditView->GetSelection();    // aktuelle View
     480                 :            : 
     481         [ #  # ]:          0 :                     ScDocument* pDoc = pViewData->GetDocument();
     482 [ #  # ][ #  # ]:          0 :                     ScRefFinder aFinder(aText, pViewData->GetCurPos(), pDoc, pDoc->GetAddressConvention());
                 [ #  # ]
     483         [ #  # ]:          0 :                     aFinder.ToggleRel( aSel.nStartPos, aSel.nEndPos );
     484         [ #  # ]:          0 :                     if (aFinder.GetFound())
     485                 :            :                     {
     486         [ #  # ]:          0 :                         String aNew = aFinder.GetText();
     487                 :          0 :                         ESelection aNewSel( 0,aFinder.GetSelStart(), 0,aFinder.GetSelEnd() );
     488         [ #  # ]:          0 :                         pEngine->SetText( aNew );
     489         [ #  # ]:          0 :                         pTableView->SetSelection( aNewSel );
     490         [ #  # ]:          0 :                         if ( pTopView )
     491                 :            :                         {
     492 [ #  # ][ #  # ]:          0 :                             pTopView->GetEditEngine()->SetText( aNew );
     493         [ #  # ]:          0 :                             pTopView->SetSelection( aNewSel );
     494                 :            :                         }
     495                 :            : 
     496                 :            :                         //  Referenz wird selektiert -> beim Tippen nicht ueberschreiben
     497         [ #  # ]:          0 :                         bSetSelIsRef = sal_True;
     498 [ #  # ][ #  # ]:          0 :                     }
     499                 :            :                 }
     500                 :            :             }
     501                 :          0 :             break;
     502                 :            : 
     503                 :            :         case SID_HYPERLINK_SETLINK:
     504         [ #  # ]:          0 :             if( pReqArgs )
     505                 :            :             {
     506                 :            :                 const SfxPoolItem* pItem;
     507 [ #  # ][ #  # ]:          0 :                 if ( pReqArgs->GetItemState( SID_HYPERLINK_SETLINK, sal_True, &pItem ) == SFX_ITEM_SET )
     508                 :            :                 {
     509                 :          0 :                     const SvxHyperlinkItem* pHyper = (const SvxHyperlinkItem*) pItem;
     510                 :          0 :                     const String& rName     = pHyper->GetName();
     511                 :          0 :                     const String& rURL      = pHyper->GetURL();
     512                 :          0 :                     const String& rTarget   = pHyper->GetTargetFrame();
     513                 :          0 :                     SvxLinkInsertMode eMode = pHyper->GetInsertMode();
     514                 :            : 
     515                 :          0 :                     sal_Bool bDone = false;
     516 [ #  # ][ #  # ]:          0 :                     if ( eMode == HLINK_DEFAULT || eMode == HLINK_FIELD )
     517                 :            :                     {
     518         [ #  # ]:          0 :                         const SvxURLField* pURLField = GetURLField();
     519         [ #  # ]:          0 :                         if ( pURLField )
     520                 :            :                         {
     521                 :            :                             //  altes Feld selektieren
     522                 :            : 
     523         [ #  # ]:          0 :                             ESelection aSel = pTableView->GetSelection();
     524                 :          0 :                             aSel.Adjust();
     525                 :          0 :                             aSel.nEndPara = aSel.nStartPara;
     526                 :          0 :                             aSel.nEndPos = aSel.nStartPos + 1;
     527         [ #  # ]:          0 :                             pTableView->SetSelection( aSel );
     528                 :            : 
     529                 :            :                             //  neues Feld einfuegen
     530                 :            : 
     531 [ #  # ][ #  # ]:          0 :                             SvxURLField aURLField( rURL, rName, SVXURLFORMAT_REPR );
                 [ #  # ]
     532         [ #  # ]:          0 :                             aURLField.SetTargetFrame( rTarget );
     533         [ #  # ]:          0 :                             SvxFieldItem aURLItem( aURLField, EE_FEATURE_FIELD );
     534         [ #  # ]:          0 :                             pTableView->InsertField( aURLItem );
     535         [ #  # ]:          0 :                             pTableView->SetSelection( aSel );       // select inserted field
     536                 :            : 
     537                 :            :                             //  jetzt doch auch Felder in der Top-View
     538                 :            : 
     539         [ #  # ]:          0 :                             if ( pTopView )
     540                 :            :                             {
     541         [ #  # ]:          0 :                                 aSel = pTopView->GetSelection();
     542                 :          0 :                                 aSel.nEndPara = aSel.nStartPara;
     543                 :          0 :                                 aSel.nEndPos = aSel.nStartPos + 1;
     544         [ #  # ]:          0 :                                 pTopView->SetSelection( aSel );
     545         [ #  # ]:          0 :                                 pTopView->InsertField( aURLItem );
     546         [ #  # ]:          0 :                                 pTopView->SetSelection( aSel );     // select inserted field
     547                 :            :                             }
     548                 :            : 
     549 [ #  # ][ #  # ]:          0 :                             bDone = sal_True;
     550                 :            :                         }
     551                 :            :                     }
     552                 :            : 
     553         [ #  # ]:          0 :                     if (!bDone)
     554                 :            :                     {
     555                 :            :                         pViewData->GetViewShell()->
     556         [ #  # ]:          0 :                             InsertURL( rName, rURL, rTarget, (sal_uInt16) eMode );
     557                 :            : 
     558                 :            :                         //  InsertURL an der ViewShell schaltet bei "Button"
     559                 :            :                         //  die EditShell ab, darum sofort return
     560                 :            : 
     561                 :            :                         return;
     562                 :            :                     }
     563                 :            :                 }
     564                 :            :             }
     565                 :          0 :             break;
     566                 :            : 
     567                 :            :             case SID_OPEN_HYPERLINK:
     568                 :            :                 {
     569                 :          0 :                     const SvxURLField* pURLField = GetURLField();
     570         [ #  # ]:          0 :                     if ( pURLField )
     571 [ #  # ][ #  # ]:          0 :                         ScGlobal::OpenURL( pURLField->GetURL(), pURLField->GetTargetFrame() );
                 [ #  # ]
     572                 :          0 :                     return;
     573                 :            :                 }
     574                 :            :                 //break;
     575                 :            : 
     576                 :            :         case FN_INSERT_SOFT_HYPHEN:
     577                 :          0 :             lclInsertCharacter( pTableView, pTopView, CHAR_SHY );
     578                 :          0 :         break;
     579                 :            :         case FN_INSERT_HARDHYPHEN:
     580                 :          0 :             lclInsertCharacter( pTableView, pTopView, CHAR_NBHY );
     581                 :          0 :         break;
     582                 :            :         case FN_INSERT_HARD_SPACE:
     583                 :          0 :             lclInsertCharacter( pTableView, pTopView, CHAR_NBSP );
     584                 :          0 :         break;
     585                 :            :         case SID_INSERT_RLM:
     586                 :          0 :             lclInsertCharacter( pTableView, pTopView, CHAR_RLM );
     587                 :          0 :         break;
     588                 :            :         case SID_INSERT_LRM:
     589                 :          0 :             lclInsertCharacter( pTableView, pTopView, CHAR_LRM );
     590                 :          0 :         break;
     591                 :            :         case SID_INSERT_ZWSP:
     592                 :          0 :             lclInsertCharacter( pTableView, pTopView, CHAR_ZWSP );
     593                 :          0 :         break;
     594                 :            :         case SID_INSERT_ZWNBSP:
     595                 :          0 :             lclInsertCharacter( pTableView, pTopView, CHAR_ZWNBSP );
     596                 :          0 :         break;
     597                 :            :         case SID_INSERT_FIELD_SHEET:
     598                 :            :         {
     599         [ #  # ]:          0 :             SvxTableField aField(pViewData->GetTabNo());
     600         [ #  # ]:          0 :             SvxFieldItem aItem(aField, EE_FEATURE_FIELD);
     601 [ #  # ][ #  # ]:          0 :             pTableView->InsertField(aItem);
                 [ #  # ]
     602                 :            :         }
     603                 :          0 :         break;
     604                 :            :         case SID_INSERT_FIELD_TITLE:
     605                 :            :         {
     606         [ #  # ]:          0 :             SvxFileField aField;
     607         [ #  # ]:          0 :             SvxFieldItem aItem(aField, EE_FEATURE_FIELD);
     608 [ #  # ][ #  # ]:          0 :             pTableView->InsertField(aItem);
                 [ #  # ]
     609                 :            :         }
     610                 :          0 :         break;
     611                 :            :         case SID_INSERT_FIELD_DATE_VAR:
     612                 :            :         {
     613         [ #  # ]:          0 :             SvxDateField aField;
     614         [ #  # ]:          0 :             SvxFieldItem aItem(aField, EE_FEATURE_FIELD);
     615 [ #  # ][ #  # ]:          0 :             pTableView->InsertField(aItem);
                 [ #  # ]
     616                 :            :         }
     617                 :          0 :         break;
     618                 :            :     }
     619                 :            : 
     620                 :          0 :     pHdl->DataChanged();
     621         [ #  # ]:          0 :     if (bSetSelIsRef)
     622                 :          0 :         pHdl->SetSelIsRef(sal_True);
     623                 :            : }
     624                 :            : 
     625                 :          0 : void lcl_DisableAll( SfxItemSet& rSet )    // disable all slots
     626                 :            : {
     627         [ #  # ]:          0 :     SfxWhichIter aIter( rSet );
     628         [ #  # ]:          0 :     sal_uInt16 nWhich = aIter.FirstWhich();
     629         [ #  # ]:          0 :     while (nWhich)
     630                 :            :     {
     631         [ #  # ]:          0 :         rSet.DisableItem( nWhich );
     632         [ #  # ]:          0 :         nWhich = aIter.NextWhich();
     633         [ #  # ]:          0 :     }
     634                 :          0 : }
     635                 :            : 
     636                 :          0 : void ScEditShell::GetState( SfxItemSet& rSet )
     637                 :            : {
     638                 :            :     // When deactivating the view, edit mode is stopped, but the EditShell is left active
     639                 :            :     // (a shell can't be removed from within Deactivate). In that state, the EditView isn't inserted
     640                 :            :     // into the EditEngine, so it can have an invalid selection and must not be used.
     641         [ #  # ]:          0 :     if ( !pViewData->HasEditView( pViewData->GetActivePart() ) )
     642                 :            :     {
     643         [ #  # ]:          0 :         lcl_DisableAll( rSet );
     644                 :          0 :         return;
     645                 :            :     }
     646                 :            : 
     647         [ #  # ]:          0 :     ScInputHandler* pHdl = GetMyInputHdl();
     648 [ #  # ][ #  # ]:          0 :     EditView* pActiveView = pHdl ? pHdl->GetActiveView() : pEditView;
     649                 :            : 
     650         [ #  # ]:          0 :     SfxWhichIter aIter( rSet );
     651         [ #  # ]:          0 :     sal_uInt16 nWhich = aIter.FirstWhich();
     652         [ #  # ]:          0 :     while (nWhich)
     653                 :            :     {
     654   [ #  #  #  #  :          0 :         switch (nWhich)
                #  #  # ]
     655                 :            :         {
     656                 :            :             case SID_ATTR_INSERT:   // Statuszeile
     657                 :            :                 {
     658         [ #  # ]:          0 :                     if ( pActiveView )
     659 [ #  # ][ #  # ]:          0 :                         rSet.Put( SfxBoolItem( nWhich, pActiveView->IsInsertMode() ) );
         [ #  # ][ #  # ]
     660                 :            :                     else
     661 [ #  # ][ #  # ]:          0 :                         rSet.Put( SfxBoolItem( nWhich, 42 ) );
                 [ #  # ]
     662                 :            :                 }
     663                 :          0 :                 break;
     664                 :            : 
     665                 :            :             case SID_HYPERLINK_GETLINK:
     666                 :            :                 {
     667         [ #  # ]:          0 :                     SvxHyperlinkItem aHLinkItem;
     668         [ #  # ]:          0 :                     const SvxURLField* pURLField = GetURLField();
     669         [ #  # ]:          0 :                     if ( pURLField )
     670                 :            :                     {
     671 [ #  # ][ #  # ]:          0 :                         aHLinkItem.SetName( pURLField->GetRepresentation() );
                 [ #  # ]
     672 [ #  # ][ #  # ]:          0 :                         aHLinkItem.SetURL( pURLField->GetURL() );
                 [ #  # ]
     673 [ #  # ][ #  # ]:          0 :                         aHLinkItem.SetTargetFrame( pURLField->GetTargetFrame() );
                 [ #  # ]
     674                 :            :                     }
     675         [ #  # ]:          0 :                     else if ( pActiveView )
     676                 :            :                     {
     677                 :            :                         // use selected text as name for urls
     678         [ #  # ]:          0 :                         String sReturn = pActiveView->GetSelected();
     679         [ #  # ]:          0 :                         sReturn.Erase(255);
     680 [ #  # ][ #  # ]:          0 :                         aHLinkItem.SetName(comphelper::string::stripEnd(sReturn, ' '));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     681                 :            :                     }
     682 [ #  # ][ #  # ]:          0 :                     rSet.Put(aHLinkItem);
     683                 :            :                 }
     684                 :          0 :                 break;
     685                 :            : 
     686                 :            :             case SID_OPEN_HYPERLINK:
     687                 :            :                 {
     688 [ #  # ][ #  # ]:          0 :                     if ( !GetURLField() )
     689         [ #  # ]:          0 :                         rSet.DisableItem( nWhich );
     690                 :            :                 }
     691                 :          0 :                 break;
     692                 :            : 
     693                 :            :             case SID_TRANSLITERATE_HALFWIDTH:
     694                 :            :             case SID_TRANSLITERATE_FULLWIDTH:
     695                 :            :             case SID_TRANSLITERATE_HIRAGANA:
     696                 :            :             case SID_TRANSLITERATE_KATAGANA:
     697                 :            :             case SID_INSERT_RLM:
     698                 :            :             case SID_INSERT_LRM:
     699                 :            :             case SID_INSERT_ZWNBSP:
     700                 :            :             case SID_INSERT_ZWSP:
     701 [ #  # ][ #  # ]:          0 :                 ScViewUtil::HideDisabledSlot( rSet, pViewData->GetBindings(), nWhich );
     702                 :          0 :             break;
     703                 :            : 
     704                 :            :             case SID_THES:
     705                 :            :                 {
     706         [ #  # ]:          0 :                     String          aStatusVal;
     707                 :          0 :                     LanguageType    nLang = LANGUAGE_NONE;
     708         [ #  # ]:          0 :                     bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, *pActiveView );
     709 [ #  # ][ #  # ]:          0 :                     rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
                 [ #  # ]
     710                 :            : 
     711                 :            :                     // disable thesaurus context menu entry if there is nothing to look up
     712         [ #  # ]:          0 :                     sal_Bool bCanDoThesaurus = ScModule::HasThesaurusLanguage( nLang );
     713 [ #  # ][ #  # ]:          0 :                     if (!bIsLookUpWord || !bCanDoThesaurus)
     714 [ #  # ][ #  # ]:          0 :                         rSet.DisableItem( SID_THES );
     715                 :            :                 }
     716                 :          0 :                 break;
     717                 :            :             case SID_INSERT_FIELD_SHEET:
     718                 :            :             case SID_INSERT_FIELD_TITLE:
     719                 :            :             case SID_INSERT_FIELD_DATE_VAR:
     720                 :          0 :             break;
     721                 :            : 
     722                 :            :         }
     723         [ #  # ]:          0 :         nWhich = aIter.NextWhich();
     724         [ #  # ]:          0 :     }
     725                 :            : }
     726                 :            : 
     727                 :          0 : const SvxURLField* ScEditShell::GetURLField()
     728                 :            : {
     729                 :          0 :     ScInputHandler* pHdl = GetMyInputHdl();
     730         [ #  # ]:          0 :     EditView* pActiveView = pHdl ? pHdl->GetActiveView() : pEditView;
     731         [ #  # ]:          0 :     if ( pActiveView )
     732                 :            :     {
     733                 :          0 :         const SvxFieldItem* pFieldItem = pActiveView->GetFieldAtSelection();
     734         [ #  # ]:          0 :         if (pFieldItem)
     735                 :            :         {
     736                 :          0 :             const SvxFieldData* pField = pFieldItem->GetField();
     737 [ #  # ][ #  # ]:          0 :             if ( pField && pField->ISA(SvxURLField) )
                 [ #  # ]
     738                 :          0 :                 return (const SvxURLField*)pField;
     739                 :            :         }
     740                 :            :     }
     741                 :            : 
     742                 :          0 :     return NULL;
     743                 :            : }
     744                 :            : 
     745                 :          0 : IMPL_LINK( ScEditShell, ClipboardChanged, TransferableDataHelper*, pDataHelper )
     746                 :            : {
     747         [ #  # ]:          0 :     if ( pDataHelper )
     748                 :            :     {
     749 [ #  # ][ #  # ]:          0 :         bPastePossible = ( pDataHelper->HasFormat( SOT_FORMAT_STRING ) || pDataHelper->HasFormat( SOT_FORMAT_RTF ) );
     750                 :            : 
     751                 :          0 :         SfxBindings& rBindings = pViewData->GetBindings();
     752                 :          0 :         rBindings.Invalidate( SID_PASTE );
     753                 :          0 :         rBindings.Invalidate( SID_PASTE_SPECIAL );
     754                 :          0 :         rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
     755                 :            :     }
     756                 :          0 :     return 0;
     757                 :            : }
     758                 :            : 
     759                 :          0 : void ScEditShell::GetClipState( SfxItemSet& rSet )
     760                 :            : {
     761         [ #  # ]:          0 :     if ( !pClipEvtLstnr )
     762                 :            :     {
     763                 :            :         // create listener
     764 [ #  # ][ #  # ]:          0 :         pClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScEditShell, ClipboardChanged ) );
     765                 :          0 :         pClipEvtLstnr->acquire();
     766         [ #  # ]:          0 :         Window* pWin = pViewData->GetActiveWin();
     767         [ #  # ]:          0 :         pClipEvtLstnr->AddRemoveListener( pWin, sal_True );
     768                 :            : 
     769                 :            :         // get initial state
     770 [ #  # ][ #  # ]:          0 :         TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) );
     771 [ #  # ][ #  # ]:          0 :         bPastePossible = ( aDataHelper.HasFormat( SOT_FORMAT_STRING ) || aDataHelper.HasFormat( SOT_FORMAT_RTF ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     772                 :            :     }
     773                 :            : 
     774         [ #  # ]:          0 :     SfxWhichIter aIter( rSet );
     775         [ #  # ]:          0 :     sal_uInt16 nWhich = aIter.FirstWhich();
     776         [ #  # ]:          0 :     while (nWhich)
     777                 :            :     {
     778      [ #  #  # ]:          0 :         switch (nWhich)
     779                 :            :         {
     780                 :            :             case SID_PASTE:
     781                 :            :             case SID_PASTE_SPECIAL:
     782         [ #  # ]:          0 :                 if( !bPastePossible )
     783         [ #  # ]:          0 :                     rSet.DisableItem( nWhich );
     784                 :          0 :                 break;
     785                 :            :             case SID_CLIPBOARD_FORMAT_ITEMS:
     786         [ #  # ]:          0 :                 if( bPastePossible )
     787                 :            :                 {
     788         [ #  # ]:          0 :                     SvxClipboardFmtItem aFormats( SID_CLIPBOARD_FORMAT_ITEMS );
     789                 :            :                     TransferableDataHelper aDataHelper(
     790 [ #  # ][ #  # ]:          0 :                             TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) );
     791                 :            : 
     792 [ #  # ][ #  # ]:          0 :                     if ( aDataHelper.HasFormat( SOT_FORMAT_STRING ) )
     793         [ #  # ]:          0 :                         aFormats.AddClipbrdFormat( SOT_FORMAT_STRING );
     794 [ #  # ][ #  # ]:          0 :                     if ( aDataHelper.HasFormat( SOT_FORMAT_RTF ) )
     795         [ #  # ]:          0 :                         aFormats.AddClipbrdFormat( SOT_FORMAT_RTF );
     796                 :            : 
     797 [ #  # ][ #  # ]:          0 :                     rSet.Put( aFormats );
                 [ #  # ]
     798                 :            :                 }
     799                 :            :                 else
     800         [ #  # ]:          0 :                     rSet.DisableItem( nWhich );
     801                 :          0 :                 break;
     802                 :            :         }
     803         [ #  # ]:          0 :         nWhich = aIter.NextWhich();
     804         [ #  # ]:          0 :     }
     805                 :          0 : }
     806                 :            : 
     807                 :          0 : void lcl_InvalidateUnder( SfxBindings& rBindings )
     808                 :            : {
     809                 :          0 :     rBindings.Invalidate( SID_ATTR_CHAR_UNDERLINE );
     810                 :          0 :     rBindings.Invalidate( SID_ULINE_VAL_NONE );
     811                 :          0 :     rBindings.Invalidate( SID_ULINE_VAL_SINGLE );
     812                 :          0 :     rBindings.Invalidate( SID_ULINE_VAL_DOUBLE );
     813                 :          0 :     rBindings.Invalidate( SID_ULINE_VAL_DOTTED );
     814                 :          0 : }
     815                 :            : 
     816                 :          0 : void ScEditShell::ExecuteAttr(SfxRequest& rReq)
     817                 :            : {
     818 [ #  # ][ #  # ]:          0 :     SfxItemSet          aSet( pEditView->GetEmptyItemSet() );
     819         [ #  # ]:          0 :     SfxBindings&        rBindings   = pViewData->GetBindings();
     820                 :          0 :     const SfxItemSet*   pArgs       = rReq.GetArgs();
     821                 :          0 :     sal_uInt16              nSlot       = rReq.GetSlot();
     822                 :            : 
     823   [ #  #  #  #  :          0 :     switch ( nSlot )
          #  #  #  #  #  
             #  #  #  # ]
     824                 :            :     {
     825                 :            :         case SID_ATTR_CHAR_FONTHEIGHT:
     826                 :            :         case SID_ATTR_CHAR_FONT:
     827                 :            :             {
     828         [ #  # ]:          0 :                 if (pArgs)
     829                 :            :                 {
     830                 :            :                     // #i78017 establish the same behaviour as in Writer
     831                 :          0 :                     sal_uInt16 nScript = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
     832         [ #  # ]:          0 :                     if (nSlot == SID_ATTR_CHAR_FONT)
     833                 :            :                     {
     834         [ #  # ]:          0 :                         nScript = pEditView->GetSelectedScriptType();
     835 [ #  # ][ #  # ]:          0 :                         if (nScript == 0) nScript = ScGlobal::GetDefaultScriptType();
     836                 :            :                     }
     837                 :            : 
     838                 :          0 :                     SfxItemPool& rPool = GetPool();
     839         [ #  # ]:          0 :                     SvxScriptSetItem aSetItem( nSlot, rPool );
     840         [ #  # ]:          0 :                     sal_uInt16 nWhich = rPool.GetWhich( nSlot );
     841 [ #  # ][ #  # ]:          0 :                     aSetItem.PutItemForScriptType( nScript, pArgs->Get( nWhich ) );
     842                 :            : 
     843 [ #  # ][ #  # ]:          0 :                     aSet.Put( aSetItem.GetItemSet(), false );
     844                 :            :                 }
     845                 :            :             }
     846                 :          0 :             break;
     847                 :            : 
     848                 :            :         case SID_ATTR_CHAR_COLOR:
     849                 :            :             {
     850         [ #  # ]:          0 :                 if (pArgs)
     851                 :            :                 {
     852 [ #  # ][ #  # ]:          0 :                     aSet.Put( pArgs->Get( pArgs->GetPool()->GetWhich( nSlot ) ) );
                 [ #  # ]
     853         [ #  # ]:          0 :                     rBindings.Invalidate( nSlot );
     854                 :            :                 }
     855                 :            :             }
     856                 :          0 :             break;
     857                 :            : 
     858                 :            :         //  Toggles
     859                 :            : 
     860                 :            :         case SID_ATTR_CHAR_WEIGHT:
     861                 :            :             {
     862                 :            :                 // #i78017 establish the same behaviour as in Writer
     863                 :          0 :                 sal_uInt16 nScript = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
     864                 :            : 
     865                 :          0 :                 SfxItemPool& rPool = GetPool();
     866                 :            : 
     867                 :          0 :                 sal_Bool bOld = false;
     868         [ #  # ]:          0 :                 SvxScriptSetItem aOldSetItem( nSlot, rPool );
     869 [ #  # ][ #  # ]:          0 :                 aOldSetItem.GetItemSet().Put( pEditView->GetAttribs(), false );
                 [ #  # ]
     870         [ #  # ]:          0 :                 const SfxPoolItem* pCore = aOldSetItem.GetItemOfScript( nScript );
     871 [ #  # ][ #  # ]:          0 :                 if ( pCore && ((const SvxWeightItem*)pCore)->GetWeight() > WEIGHT_NORMAL )
                 [ #  # ]
     872                 :          0 :                     bOld = sal_True;
     873                 :            : 
     874         [ #  # ]:          0 :                 SvxScriptSetItem aSetItem( nSlot, rPool );
     875                 :            :                 aSetItem.PutItemForScriptType( nScript,
     876 [ #  # ][ #  # ]:          0 :                             SvxWeightItem( bOld ? WEIGHT_NORMAL : WEIGHT_BOLD, EE_CHAR_WEIGHT ) );
         [ #  # ][ #  # ]
     877         [ #  # ]:          0 :                 aSet.Put( aSetItem.GetItemSet(), false );
     878                 :            : 
     879 [ #  # ][ #  # ]:          0 :                 rBindings.Invalidate( nSlot );
                 [ #  # ]
     880                 :            :             }
     881                 :          0 :             break;
     882                 :            : 
     883                 :            :         case SID_ATTR_CHAR_POSTURE:
     884                 :            :             {
     885                 :            :                 // #i78017 establish the same behaviour as in Writer
     886                 :          0 :                 sal_uInt16 nScript = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
     887                 :            : 
     888                 :          0 :                 SfxItemPool& rPool = GetPool();
     889                 :            : 
     890                 :          0 :                 sal_Bool bOld = false;
     891         [ #  # ]:          0 :                 SvxScriptSetItem aOldSetItem( nSlot, rPool );
     892 [ #  # ][ #  # ]:          0 :                 aOldSetItem.GetItemSet().Put( pEditView->GetAttribs(), false );
                 [ #  # ]
     893         [ #  # ]:          0 :                 const SfxPoolItem* pCore = aOldSetItem.GetItemOfScript( nScript );
     894 [ #  # ][ #  # ]:          0 :                 if ( pCore && ((const SvxPostureItem*)pCore)->GetValue() != ITALIC_NONE )
                 [ #  # ]
     895                 :          0 :                     bOld = sal_True;
     896                 :            : 
     897         [ #  # ]:          0 :                 SvxScriptSetItem aSetItem( nSlot, rPool );
     898                 :            :                 aSetItem.PutItemForScriptType( nScript,
     899 [ #  # ][ #  # ]:          0 :                             SvxPostureItem( bOld ? ITALIC_NONE : ITALIC_NORMAL, EE_CHAR_ITALIC ) );
         [ #  # ][ #  # ]
     900         [ #  # ]:          0 :                 aSet.Put( aSetItem.GetItemSet(), false );
     901                 :            : 
     902 [ #  # ][ #  # ]:          0 :                 rBindings.Invalidate( nSlot );
                 [ #  # ]
     903                 :            :             }
     904                 :          0 :             break;
     905                 :            : 
     906                 :            :         case SID_ULINE_VAL_NONE:
     907 [ #  # ][ #  # ]:          0 :             aSet.Put( SvxUnderlineItem( UNDERLINE_NONE, EE_CHAR_UNDERLINE ) );
                 [ #  # ]
     908         [ #  # ]:          0 :             lcl_InvalidateUnder( rBindings );
     909                 :          0 :             break;
     910                 :            : 
     911                 :            :         case SID_ATTR_CHAR_UNDERLINE:   // Toggles
     912                 :            :         case SID_ULINE_VAL_SINGLE:
     913                 :            :         case SID_ULINE_VAL_DOUBLE:
     914                 :            :         case SID_ULINE_VAL_DOTTED:
     915                 :            :             {
     916                 :            :                 FontUnderline eOld = ((const SvxUnderlineItem&) pEditView->
     917 [ #  # ][ #  # ]:          0 :                                     GetAttribs().Get(EE_CHAR_UNDERLINE)).GetLineStyle();
                 [ #  # ]
     918                 :          0 :                 FontUnderline eNew = eOld;
     919   [ #  #  #  #  :          0 :                 switch (nSlot)
                      # ]
     920                 :            :                 {
     921                 :            :                     case SID_ATTR_CHAR_UNDERLINE:
     922                 :          0 :                         eNew = ( eOld != UNDERLINE_NONE ) ? UNDERLINE_NONE : UNDERLINE_SINGLE;
     923                 :          0 :                         break;
     924                 :            :                     case SID_ULINE_VAL_SINGLE:
     925                 :          0 :                         eNew = ( eOld == UNDERLINE_SINGLE ) ? UNDERLINE_NONE : UNDERLINE_SINGLE;
     926                 :          0 :                         break;
     927                 :            :                     case SID_ULINE_VAL_DOUBLE:
     928         [ #  # ]:          0 :                         eNew = ( eOld == UNDERLINE_DOUBLE ) ? UNDERLINE_NONE : UNDERLINE_DOUBLE;
     929                 :          0 :                         break;
     930                 :            :                     case SID_ULINE_VAL_DOTTED:
     931         [ #  # ]:          0 :                         eNew = ( eOld == UNDERLINE_DOTTED ) ? UNDERLINE_NONE : UNDERLINE_DOTTED;
     932                 :          0 :                         break;
     933                 :            :                 }
     934 [ #  # ][ #  # ]:          0 :                 aSet.Put( SvxUnderlineItem( eNew, EE_CHAR_UNDERLINE ) );
                 [ #  # ]
     935         [ #  # ]:          0 :                 lcl_InvalidateUnder( rBindings );
     936                 :            :             }
     937                 :          0 :             break;
     938                 :            : 
     939                 :            :         case SID_ATTR_CHAR_OVERLINE:
     940                 :            :             {
     941                 :            :                 FontUnderline eOld = ((const SvxOverlineItem&) pEditView->
     942 [ #  # ][ #  # ]:          0 :                                     GetAttribs().Get(EE_CHAR_OVERLINE)).GetLineStyle();
                 [ #  # ]
     943                 :          0 :                 FontUnderline eNew = ( eOld != UNDERLINE_NONE ) ? UNDERLINE_NONE : UNDERLINE_SINGLE;
     944 [ #  # ][ #  # ]:          0 :                 aSet.Put( SvxOverlineItem( eNew, EE_CHAR_OVERLINE ) );
                 [ #  # ]
     945         [ #  # ]:          0 :                 rBindings.Invalidate( nSlot );
     946                 :            :             }
     947                 :          0 :             break;
     948                 :            : 
     949                 :            :         case SID_ATTR_CHAR_STRIKEOUT:
     950                 :            :             {
     951                 :            :                 sal_Bool bOld = ((const SvxCrossedOutItem&)pEditView->GetAttribs().
     952 [ #  # ][ #  # ]:          0 :                                 Get(EE_CHAR_STRIKEOUT)).GetValue() != STRIKEOUT_NONE;
                 [ #  # ]
     953 [ #  # ][ #  # ]:          0 :                 aSet.Put( SvxCrossedOutItem( bOld ? STRIKEOUT_NONE : STRIKEOUT_SINGLE, EE_CHAR_STRIKEOUT ) );
                 [ #  # ]
     954         [ #  # ]:          0 :                 rBindings.Invalidate( nSlot );
     955                 :            :             }
     956                 :          0 :             break;
     957                 :            : 
     958                 :            :         case SID_ATTR_CHAR_SHADOWED:
     959                 :            :             {
     960                 :            :                 sal_Bool bOld = ((const SvxShadowedItem&)pEditView->GetAttribs().
     961 [ #  # ][ #  # ]:          0 :                                 Get(EE_CHAR_SHADOW)).GetValue();
                 [ #  # ]
     962 [ #  # ][ #  # ]:          0 :                 aSet.Put( SvxShadowedItem( !bOld, EE_CHAR_SHADOW ) );
                 [ #  # ]
     963         [ #  # ]:          0 :                 rBindings.Invalidate( nSlot );
     964                 :            :             }
     965                 :          0 :             break;
     966                 :            : 
     967                 :            :         case SID_ATTR_CHAR_CONTOUR:
     968                 :            :             {
     969                 :            :                 sal_Bool bOld = ((const SvxContourItem&)pEditView->GetAttribs().
     970 [ #  # ][ #  # ]:          0 :                                 Get(EE_CHAR_OUTLINE)).GetValue();
                 [ #  # ]
     971 [ #  # ][ #  # ]:          0 :                 aSet.Put( SvxContourItem( !bOld, EE_CHAR_OUTLINE ) );
                 [ #  # ]
     972         [ #  # ]:          0 :                 rBindings.Invalidate( nSlot );
     973                 :            :             }
     974                 :          0 :             break;
     975                 :            : 
     976                 :            :         case SID_SET_SUPER_SCRIPT:
     977                 :            :             {
     978                 :            :                 SvxEscapement eOld = (SvxEscapement) ((const SvxEscapementItem&)
     979 [ #  # ][ #  # ]:          0 :                         pEditView->GetAttribs().Get(EE_CHAR_ESCAPEMENT)).GetEnumValue();
         [ #  # ][ #  # ]
     980                 :            :                 SvxEscapement eNew = (eOld == SVX_ESCAPEMENT_SUPERSCRIPT) ?
     981                 :          0 :                                         SVX_ESCAPEMENT_OFF : SVX_ESCAPEMENT_SUPERSCRIPT;
     982 [ #  # ][ #  # ]:          0 :                 aSet.Put( SvxEscapementItem( eNew, EE_CHAR_ESCAPEMENT ) );
                 [ #  # ]
     983         [ #  # ]:          0 :                 rBindings.Invalidate( nSlot );
     984                 :            :             }
     985                 :          0 :             break;
     986                 :            :         case SID_SET_SUB_SCRIPT:
     987                 :            :             {
     988                 :            :                 SvxEscapement eOld = (SvxEscapement) ((const SvxEscapementItem&)
     989 [ #  # ][ #  # ]:          0 :                         pEditView->GetAttribs().Get(EE_CHAR_ESCAPEMENT)).GetEnumValue();
         [ #  # ][ #  # ]
     990                 :            :                 SvxEscapement eNew = (eOld == SVX_ESCAPEMENT_SUBSCRIPT) ?
     991         [ #  # ]:          0 :                                         SVX_ESCAPEMENT_OFF : SVX_ESCAPEMENT_SUBSCRIPT;
     992 [ #  # ][ #  # ]:          0 :                 aSet.Put( SvxEscapementItem( eNew, EE_CHAR_ESCAPEMENT ) );
                 [ #  # ]
     993         [ #  # ]:          0 :                 rBindings.Invalidate( nSlot );
     994                 :            :             }
     995                 :          0 :             break;
     996                 :            :     }
     997                 :            : 
     998                 :            :     //
     999                 :            :     //  anwenden
    1000                 :            :     //
    1001                 :            : 
    1002         [ #  # ]:          0 :     EditEngine* pEngine = pEditView->GetEditEngine();
    1003         [ #  # ]:          0 :     sal_Bool bOld = pEngine->GetUpdateMode();
    1004         [ #  # ]:          0 :     pEngine->SetUpdateMode(false);
    1005                 :            : 
    1006         [ #  # ]:          0 :     pEditView->SetAttribs( aSet );
    1007                 :            : 
    1008         [ #  # ]:          0 :     pEngine->SetUpdateMode(bOld);
    1009         [ #  # ]:          0 :     pEditView->Invalidate();
    1010                 :            : 
    1011         [ #  # ]:          0 :     ScInputHandler* pHdl = GetMyInputHdl();
    1012                 :          0 :     pHdl->SetModified();
    1013                 :            : 
    1014 [ #  # ][ #  # ]:          0 :     rReq.Done();
    1015                 :          0 : }
    1016                 :            : 
    1017                 :          0 : void ScEditShell::GetAttrState(SfxItemSet &rSet)
    1018                 :            : {
    1019         [ #  # ]:          0 :     if ( !pViewData->HasEditView( pViewData->GetActivePart() ) )    // #125326#
    1020                 :            :     {
    1021         [ #  # ]:          0 :         lcl_DisableAll( rSet );
    1022                 :          0 :         return;
    1023                 :            :     }
    1024                 :            : 
    1025         [ #  # ]:          0 :     SfxItemSet aAttribs = pEditView->GetAttribs();
    1026         [ #  # ]:          0 :     rSet.Put( aAttribs );
    1027                 :            : 
    1028                 :            :     //  choose font info according to selection script type
    1029                 :            : 
    1030         [ #  # ]:          0 :     sal_uInt16 nScript = pEditView->GetSelectedScriptType();
    1031 [ #  # ][ #  # ]:          0 :     if (nScript == 0) nScript = ScGlobal::GetDefaultScriptType();
    1032                 :            : 
    1033                 :            :     // #i55929# input-language-dependent script type (depends on input language if nothing selected)
    1034                 :          0 :     sal_uInt16 nInputScript = nScript;
    1035 [ #  # ][ #  # ]:          0 :     if ( !pEditView->GetSelection().HasRange() )
    1036                 :            :     {
    1037 [ #  # ][ #  # ]:          0 :         LanguageType nInputLang = pViewData->GetActiveWin()->GetInputLanguage();
    1038 [ #  # ][ #  # ]:          0 :         if (nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
    1039         [ #  # ]:          0 :             nInputScript = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
    1040                 :            :     }
    1041                 :            : 
    1042                 :            :     // #i55929# according to spec, nInputScript is used for font and font height only
    1043 [ #  # ][ #  # ]:          0 :     if ( rSet.GetItemState( EE_CHAR_FONTINFO ) != SFX_ITEM_UNKNOWN )
    1044         [ #  # ]:          0 :         ScViewUtil::PutItemScript( rSet, aAttribs, EE_CHAR_FONTINFO, nInputScript );
    1045 [ #  # ][ #  # ]:          0 :     if ( rSet.GetItemState( EE_CHAR_FONTHEIGHT ) != SFX_ITEM_UNKNOWN )
    1046         [ #  # ]:          0 :         ScViewUtil::PutItemScript( rSet, aAttribs, EE_CHAR_FONTHEIGHT, nInputScript );
    1047 [ #  # ][ #  # ]:          0 :     if ( rSet.GetItemState( EE_CHAR_WEIGHT ) != SFX_ITEM_UNKNOWN )
    1048         [ #  # ]:          0 :         ScViewUtil::PutItemScript( rSet, aAttribs, EE_CHAR_WEIGHT, nScript );
    1049 [ #  # ][ #  # ]:          0 :     if ( rSet.GetItemState( EE_CHAR_ITALIC ) != SFX_ITEM_UNKNOWN )
    1050         [ #  # ]:          0 :         ScViewUtil::PutItemScript( rSet, aAttribs, EE_CHAR_ITALIC, nScript );
    1051                 :            : 
    1052                 :            :     //  Unterstreichung
    1053                 :            : 
    1054         [ #  # ]:          0 :     SfxItemState eState = aAttribs.GetItemState( EE_CHAR_UNDERLINE, sal_True );
    1055         [ #  # ]:          0 :     if ( eState == SFX_ITEM_DONTCARE )
    1056                 :            :     {
    1057         [ #  # ]:          0 :         rSet.InvalidateItem( SID_ULINE_VAL_NONE );
    1058         [ #  # ]:          0 :         rSet.InvalidateItem( SID_ULINE_VAL_SINGLE );
    1059         [ #  # ]:          0 :         rSet.InvalidateItem( SID_ULINE_VAL_DOUBLE );
    1060         [ #  # ]:          0 :         rSet.InvalidateItem( SID_ULINE_VAL_DOTTED );
    1061                 :            :     }
    1062                 :            :     else
    1063                 :            :     {
    1064                 :            :         FontUnderline eUnderline = ((const SvxUnderlineItem&)
    1065         [ #  # ]:          0 :                     aAttribs.Get(EE_CHAR_UNDERLINE)).GetLineStyle();
    1066                 :          0 :         sal_uInt16 nId = SID_ULINE_VAL_NONE;
    1067   [ #  #  #  # ]:          0 :         switch (eUnderline)
    1068                 :            :         {
    1069                 :          0 :             case UNDERLINE_SINGLE:  nId = SID_ULINE_VAL_SINGLE; break;
    1070                 :          0 :             case UNDERLINE_DOUBLE:  nId = SID_ULINE_VAL_DOUBLE; break;
    1071                 :          0 :             case UNDERLINE_DOTTED:  nId = SID_ULINE_VAL_DOTTED; break;
    1072                 :            :             default:
    1073                 :          0 :                 break;
    1074                 :            :         }
    1075 [ #  # ][ #  # ]:          0 :         rSet.Put( SfxBoolItem( nId, sal_True ) );
                 [ #  # ]
    1076                 :            :     }
    1077                 :            : 
    1078                 :            :     //! Testen, ob Klammer-Hervorhebung aktiv ist !!!!
    1079         [ #  # ]:          0 :     ScInputHandler* pHdl = GetMyInputHdl();
    1080 [ #  # ][ #  # ]:          0 :     if ( pHdl && pHdl->IsFormulaMode() )
                 [ #  # ]
    1081 [ #  # ][ #  # ]:          0 :         rSet.ClearItem( EE_CHAR_WEIGHT );   // hervorgehobene Klammern hier nicht
    1082                 :            : }
    1083                 :            : 
    1084                 :          0 : String ScEditShell::GetSelectionText( sal_Bool bWholeWord )
    1085                 :            : {
    1086                 :          0 :     String aStrSelection;
    1087                 :            : 
    1088         [ #  # ]:          0 :     if ( pViewData->HasEditView( pViewData->GetActivePart() ) )    // #125326#
    1089                 :            :     {
    1090         [ #  # ]:          0 :         if ( bWholeWord )
    1091                 :            :         {
    1092         [ #  # ]:          0 :             EditEngine* pEngine = pEditView->GetEditEngine();
    1093         [ #  # ]:          0 :             ESelection  aSel = pEditView->GetSelection();
    1094         [ #  # ]:          0 :             String      aStrCurrentDelimiters = pEngine->GetWordDelimiters();
    1095                 :            : 
    1096 [ #  # ][ #  # ]:          0 :             pEngine->SetWordDelimiters(rtl::OUString(" .,;\"'"));
                 [ #  # ]
    1097 [ #  # ][ #  # ]:          0 :             aStrSelection = pEngine->GetWord( aSel.nEndPara, aSel.nEndPos );
                 [ #  # ]
    1098 [ #  # ][ #  # ]:          0 :             pEngine->SetWordDelimiters( aStrCurrentDelimiters );
    1099                 :            :         }
    1100                 :            :         else
    1101                 :            :         {
    1102 [ #  # ][ #  # ]:          0 :             aStrSelection = pEditView->GetSelected();
                 [ #  # ]
    1103                 :            :         }
    1104                 :            :     }
    1105                 :            : 
    1106                 :          0 :     return aStrSelection;
    1107                 :            : }
    1108                 :            : 
    1109                 :          0 : void ScEditShell::ExecuteUndo(SfxRequest& rReq)
    1110                 :            : {
    1111                 :            :     //  Undo must be handled here because it's called for both EditViews
    1112                 :            : 
    1113                 :          0 :     ScInputHandler* pHdl = GetMyInputHdl();
    1114                 :            :     OSL_ENSURE(pHdl,"no ScInputHandler");
    1115                 :          0 :     EditView* pTopView   = pHdl->GetTopView();
    1116                 :          0 :     EditView* pTableView = pHdl->GetTableView();
    1117                 :            :     OSL_ENSURE(pTableView,"no EditView");
    1118                 :            : 
    1119                 :          0 :     pHdl->DataChanging();
    1120                 :            : 
    1121                 :          0 :     const SfxItemSet* pReqArgs = rReq.GetArgs();
    1122                 :          0 :     sal_uInt16 nSlot = rReq.GetSlot();
    1123         [ #  # ]:          0 :     switch ( nSlot )
    1124                 :            :     {
    1125                 :            :         case SID_UNDO:
    1126                 :            :         case SID_REDO:
    1127                 :            :             {
    1128                 :          0 :                 sal_Bool bIsUndo = ( nSlot == SID_UNDO );
    1129                 :            : 
    1130                 :          0 :                 sal_uInt16 nCount = 1;
    1131                 :            :                 const SfxPoolItem* pItem;
    1132 [ #  # ][ #  # ]:          0 :                 if ( pReqArgs && pReqArgs->GetItemState( nSlot, sal_True, &pItem ) == SFX_ITEM_SET )
         [ #  # ][ #  # ]
    1133                 :          0 :                     nCount = ((const SfxUInt16Item*)pItem)->GetValue();
    1134                 :            : 
    1135         [ #  # ]:          0 :                 for (sal_uInt16 i=0; i<nCount; i++)
    1136                 :            :                 {
    1137         [ #  # ]:          0 :                     if ( bIsUndo )
    1138                 :            :                     {
    1139         [ #  # ]:          0 :                         pTableView->Undo();
    1140         [ #  # ]:          0 :                         if (pTopView)
    1141         [ #  # ]:          0 :                             pTopView->Undo();
    1142                 :            :                     }
    1143                 :            :                     else
    1144                 :            :                     {
    1145         [ #  # ]:          0 :                         pTableView->Redo();
    1146         [ #  # ]:          0 :                         if (pTopView)
    1147         [ #  # ]:          0 :                             pTopView->Redo();
    1148                 :            :                     }
    1149                 :            :                 }
    1150                 :            :             }
    1151                 :          0 :             break;
    1152                 :            :     }
    1153                 :          0 :     pViewData->GetBindings().InvalidateAll(false);
    1154                 :            : 
    1155                 :          0 :     pHdl->DataChanged();
    1156                 :          0 : }
    1157                 :            : 
    1158                 :          0 : void ScEditShell::GetUndoState(SfxItemSet &rSet)
    1159                 :            : {
    1160                 :            :     //  Undo state is taken from normal ViewFrame state function
    1161                 :            : 
    1162                 :          0 :     SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame();
    1163 [ #  # ][ #  # ]:          0 :     if ( pViewFrm && GetUndoManager() )
                 [ #  # ]
    1164                 :            :     {
    1165         [ #  # ]:          0 :         SfxWhichIter aIter(rSet);
    1166         [ #  # ]:          0 :         sal_uInt16 nWhich = aIter.FirstWhich();
    1167         [ #  # ]:          0 :         while( nWhich )
    1168                 :            :         {
    1169         [ #  # ]:          0 :             pViewFrm->GetSlotState( nWhich, NULL, &rSet );
    1170         [ #  # ]:          0 :             nWhich = aIter.NextWhich();
    1171         [ #  # ]:          0 :         }
    1172                 :            :     }
    1173                 :            : 
    1174                 :            :     //  disable if no action in input line EditView
    1175                 :            : 
    1176                 :          0 :     ScInputHandler* pHdl = GetMyInputHdl();
    1177                 :            :     OSL_ENSURE(pHdl,"no ScInputHandler");
    1178                 :          0 :     EditView* pTopView = pHdl->GetTopView();
    1179         [ #  # ]:          0 :     if (pTopView)
    1180                 :            :     {
    1181                 :          0 :         ::svl::IUndoManager& rTopMgr = pTopView->GetEditEngine()->GetUndoManager();
    1182         [ #  # ]:          0 :         if ( rTopMgr.GetUndoActionCount() == 0 )
    1183                 :          0 :             rSet.DisableItem( SID_UNDO );
    1184         [ #  # ]:          0 :         if ( rTopMgr.GetRedoActionCount() == 0 )
    1185                 :          0 :             rSet.DisableItem( SID_REDO );
    1186                 :            :     }
    1187                 :          0 : }
    1188                 :            : 
    1189                 :          0 : void ScEditShell::ExecuteTrans( SfxRequest& rReq )
    1190                 :            : {
    1191                 :          0 :     sal_Int32 nType = ScViewUtil::GetTransliterationType( rReq.GetSlot() );
    1192         [ #  # ]:          0 :     if ( nType )
    1193                 :            :     {
    1194                 :          0 :         ScInputHandler* pHdl = GetMyInputHdl();
    1195                 :            :         OSL_ENSURE( pHdl, "no ScInputHandler" );
    1196                 :            : 
    1197                 :          0 :         EditView* pTopView   = pHdl->GetTopView();
    1198                 :          0 :         EditView* pTableView = pHdl->GetTableView();
    1199                 :            :         OSL_ENSURE( pTableView, "no EditView" );
    1200                 :            : 
    1201                 :          0 :         pHdl->DataChanging();
    1202                 :            : 
    1203                 :          0 :         pTableView->TransliterateText( nType );
    1204         [ #  # ]:          0 :         if (pTopView)
    1205                 :          0 :             pTopView->TransliterateText( nType );
    1206                 :            : 
    1207                 :          0 :         pHdl->DataChanged();
    1208                 :            :     }
    1209                 :          0 : }
    1210                 :            : 
    1211                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10