LCOV - code coverage report
Current view: top level - sw/source/ui/shells - textfld.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 18 471 3.8 %
Date: 2012-08-25 Functions: 1 8 12.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 13 1070 1.2 %

           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                 :            : 
      30                 :            : #include <crsskip.hxx>
      31                 :            : #include <hintids.hxx>  //_immer_ vor den solar-Items
      32                 :            : 
      33                 :            : #include <sfx2/lnkbase.hxx>
      34                 :            : #include <fmtfld.hxx>
      35                 :            : #include <vcl/msgbox.hxx>
      36                 :            : #include <svl/itempool.hxx>
      37                 :            : #include <unotools/useroptions.hxx>
      38                 :            : #include <svl/whiter.hxx>
      39                 :            : #include <svl/eitem.hxx>
      40                 :            : #include <svl/macitem.hxx>
      41                 :            : #include <sfx2/viewfrm.hxx>
      42                 :            : #include <sfx2/request.hxx>
      43                 :            : #include <svx/postattr.hxx>
      44                 :            : #include <svx/hlnkitem.hxx>
      45                 :            : 
      46                 :            : #include <svx/svxdlg.hxx>
      47                 :            : #include <sfx2/linkmgr.hxx>
      48                 :            : #include <unotools/localedatawrapper.hxx>
      49                 :            : #include <sfx2/dispatch.hxx>
      50                 :            : #include <fmtinfmt.hxx>
      51                 :            : #include <fldwrap.hxx>
      52                 :            : #include <redline.hxx>
      53                 :            : #include <view.hxx>
      54                 :            : #include <wrtsh.hxx>
      55                 :            : #include <basesh.hxx>
      56                 :            : #include <flddat.hxx>
      57                 :            : #include <numrule.hxx>
      58                 :            : #include <textsh.hxx>
      59                 :            : #include <docsh.hxx>
      60                 :            : #include <docufld.hxx>
      61                 :            : #include <usrfld.hxx>
      62                 :            : #include <ddefld.hxx>
      63                 :            : #include <expfld.hxx>
      64                 :            : #include <fldmgr.hxx>
      65                 :            : #include <uitool.hxx>
      66                 :            : 
      67                 :            : #include <cmdid.h>
      68                 :            : #include <shells.hrc>
      69                 :            : 
      70                 :            : #include <sfx2/app.hxx>
      71                 :            : #include <svx/dialogs.hrc>
      72                 :            : #include "swabstdlg.hxx"
      73                 :            : #include "dialog.hrc"
      74                 :            : #include <fldui.hrc>
      75                 :            : #include <doc.hxx>
      76                 :            : 
      77                 :            : #include <app.hrc>
      78                 :            : 
      79                 :            : #include <PostItMgr.hxx>
      80                 :            : #include <switerator.hxx>
      81                 :            : 
      82                 :            : using namespace nsSwDocInfoSubType;
      83                 :            : 
      84                 :            : extern sal_Bool bNoInterrupt;       // in mainwn.cxx
      85                 :            : 
      86                 :          0 : String& lcl_AppendRedlineStr( String& rStr, sal_uInt16 nRedlId )
      87                 :            : {
      88                 :          0 :     sal_uInt16 nResId = 0;
      89   [ #  #  #  #  :          0 :     switch( nRedlId )
                   #  # ]
      90                 :            :     {
      91                 :          0 :     case nsRedlineType_t::REDLINE_INSERT:   nResId = STR_REDLINE_INSERTED;      break;
      92                 :          0 :     case nsRedlineType_t::REDLINE_DELETE:   nResId = STR_REDLINE_DELETED;       break;
      93                 :          0 :     case nsRedlineType_t::REDLINE_FORMAT:   nResId = STR_REDLINE_FORMATED;      break;
      94                 :          0 :     case nsRedlineType_t::REDLINE_TABLE:        nResId = STR_REDLINE_TABLECHG;      break;
      95                 :          0 :     case nsRedlineType_t::REDLINE_FMTCOLL:  nResId = STR_REDLINE_FMTCOLLSET;    break;
      96                 :            :     }
      97         [ #  # ]:          0 :     if( nResId )
      98 [ #  # ][ #  # ]:          0 :         rStr += SW_RESSTR( nResId );
      99                 :          0 :     return rStr;
     100                 :            : }
     101                 :            : 
     102                 :            : // STATIC DATA -----------------------------------------------------------
     103                 :          0 : void SwTextShell::ExecField(SfxRequest &rReq)
     104                 :            : {
     105         [ #  # ]:          0 :     SwWrtShell& rSh = GetShell();
     106                 :          0 :     const SfxPoolItem* pItem = 0;
     107                 :            : 
     108                 :          0 :     sal_uInt16 nSlot = rReq.GetSlot();
     109                 :          0 :     const SfxItemSet* pArgs = rReq.GetArgs();
     110         [ #  # ]:          0 :     if(pArgs)
     111 [ #  # ][ #  # ]:          0 :         pArgs->GetItemState(GetPool().GetWhich(nSlot), sal_False, &pItem);
     112                 :            : 
     113         [ #  # ]:          0 :     Window *pMDI = &GetView().GetViewFrame()->GetWindow();
     114                 :          0 :     sal_Bool bMore = sal_False;
     115                 :          0 :     sal_Bool bIsText = sal_True;
     116                 :          0 :     sal_uInt16 nInsertType = 0;
     117                 :          0 :     sal_uInt16 nInsertSubType = 0;
     118                 :          0 :     sal_uLong nInsertFormat = 0;
     119                 :            : 
     120   [ #  #  #  # ]:          0 :     switch(nSlot)
     121                 :            :     {
     122                 :            :         case FN_EDIT_FIELD:
     123                 :            :         {
     124         [ #  # ]:          0 :             SwField* pFld = rSh.GetCurFld();
     125         [ #  # ]:          0 :             if( pFld )
     126                 :            :             {
     127 [ #  # ][ #  # ]:          0 :                 switch ( pFld->GetTypeId() )
     128                 :            :                 {
     129                 :            :                     case TYP_DDEFLD:
     130                 :            :                     {
     131                 :          0 :                         ::sfx2::SvBaseLink& rLink = ((SwDDEFieldType*)pFld->GetTyp())->
     132                 :          0 :                                                 GetBaseLink();
     133         [ #  # ]:          0 :                         if(rLink.IsVisible())
     134                 :            :                         {
     135         [ #  # ]:          0 :                             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     136 [ #  # ][ #  # ]:          0 :                             SfxAbstractLinksDialog* pDlg = pFact->CreateLinksDialog( pMDI, &rSh.GetLinkManager(), sal_False, &rLink );
     137         [ #  # ]:          0 :                             if ( pDlg )
     138                 :            :                             {
     139         [ #  # ]:          0 :                                 pDlg->Execute();
     140 [ #  # ][ #  # ]:          0 :                                 delete pDlg;
     141                 :            :                             }
     142                 :            :                         }
     143                 :          0 :                         break;
     144                 :            :                     }
     145                 :            :                     default:
     146                 :            :                     {
     147         [ #  # ]:          0 :                         SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     148                 :            :                         OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
     149                 :            : 
     150         [ #  # ]:          0 :                         SfxAbstractDialog* pDlg = pFact->CreateSwFldEditDlg( GetView(),RC_DLG_SWFLDEDITDLG );
     151                 :            :                         OSL_ENSURE(pDlg, "Dialogdiet fail!");
     152         [ #  # ]:          0 :                         pDlg->Execute();
     153 [ #  # ][ #  # ]:          0 :                         delete pDlg;
     154                 :            :                     }
     155                 :            :                 }
     156                 :            :             }
     157                 :          0 :             break;
     158                 :            :         }
     159                 :            :         case FN_EXECUTE_MACROFIELD:
     160                 :            :         {
     161         [ #  # ]:          0 :             SwField* pFld = rSh.GetCurFld();
     162 [ #  # ][ #  # ]:          0 :             if(pFld && pFld->GetTyp()->Which() == RES_MACROFLD)
                 [ #  # ]
     163                 :            :             {
     164                 :            : 
     165         [ #  # ]:          0 :                 const String& rMacro = ((SwMacroField*)pFld)->GetMacro();
     166         [ #  # ]:          0 :                 sal_uInt16 nPos = rMacro.Search('.', 0);
     167         [ #  # ]:          0 :                 if(nPos != STRING_NOTFOUND)
     168                 :            :                 {
     169 [ #  # ][ #  # ]:          0 :                     SvxMacro aMacro( rMacro.Copy(nPos + 1), rMacro.Copy(0,nPos), STARBASIC );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     170 [ #  # ][ #  # ]:          0 :                     rSh.ExecMacro(aMacro);
     171         [ #  # ]:          0 :                 }
     172                 :            :             }
     173                 :            :         }
     174                 :          0 :         break;
     175                 :            : 
     176                 :            :         case FN_GOTO_NEXT_INPUTFLD:
     177                 :            :         case FN_GOTO_PREV_INPUTFLD:
     178                 :            :             {
     179                 :          0 :                 sal_Bool bRet = sal_False;
     180         [ #  # ]:          0 :                 SwFieldType* pFld = rSh.GetFldType( 0, RES_INPUTFLD );
     181 [ #  # ][ #  # ]:          0 :                 if( pFld && rSh.MoveFldType( pFld,
                 [ #  # ]
     182         [ #  # ]:          0 :                             FN_GOTO_NEXT_INPUTFLD == nSlot ))
     183                 :            :                 {
     184         [ #  # ]:          0 :                     rSh.ClearMark();
     185 [ #  # ][ #  # ]:          0 :                     rSh.StartInputFldDlg( rSh.GetCurFld(), sal_False );
     186                 :          0 :                     bRet = sal_True;
     187                 :            :                 }
     188                 :            : 
     189 [ #  # ][ #  # ]:          0 :                 rReq.SetReturnValue( SfxBoolItem( nSlot, bRet ));
                 [ #  # ]
     190                 :            :             }
     191                 :          0 :             break;
     192                 :            : 
     193                 :            :         default:
     194                 :          0 :             bMore = sal_True;
     195                 :            :     }
     196         [ #  # ]:          0 :     if(bMore)
     197                 :            :     {
     198                 :            :         // hier kommen die Slots mit FldMgr
     199 [ #  # ][ #  # ]:          0 :         SwFldMgr aFldMgr(GetShellPtr());
     200   [ #  #  #  #  :          0 :         switch(nSlot)
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                      # ]
     201                 :            :         {
     202                 :            :             case FN_INSERT_DBFIELD:
     203                 :            :             {
     204                 :          0 :                 sal_Bool bRes = sal_False;
     205         [ #  # ]:          0 :                 if( pItem )
     206                 :            :                 {
     207                 :          0 :                     sal_uLong  nFormat = 0;
     208                 :          0 :                     sal_uInt16 nType = 0;
     209         [ #  # ]:          0 :                     String aPar1 = ((SfxStringItem *)pItem)->GetValue();
     210         [ #  # ]:          0 :                     String aPar2;
     211         [ #  # ]:          0 :                     String aPar3;
     212                 :          0 :                     sal_Int32 nCommand = 0;
     213                 :            : 
     214         [ #  # ]:          0 :                     if( SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_FIELD_TYPE,
     215         [ #  # ]:          0 :                                                                 sal_False, &pItem ))
     216                 :          0 :                         nType = ((SfxUInt16Item *)pItem)->GetValue();
     217         [ #  # ]:          0 :                     aPar1 += DB_DELIM;
     218         [ #  # ]:          0 :                     if( SFX_ITEM_SET == pArgs->GetItemState(
     219         [ #  # ]:          0 :                                         FN_PARAM_1, sal_False, &pItem ))
     220                 :            :                     {
     221         [ #  # ]:          0 :                         aPar1 += ((SfxStringItem *)pItem)->GetValue();
     222                 :            :                     }
     223         [ #  # ]:          0 :                     if( SFX_ITEM_SET == pArgs->GetItemState(
     224         [ #  # ]:          0 :                                         FN_PARAM_3, sal_False, &pItem ))
     225                 :          0 :                         nCommand = ((SfxInt32Item*)pItem)->GetValue();
     226         [ #  # ]:          0 :                     aPar1 += DB_DELIM;
     227 [ #  # ][ #  # ]:          0 :                     aPar1 += String::CreateFromInt32(nCommand);
                 [ #  # ]
     228         [ #  # ]:          0 :                     aPar1 += DB_DELIM;
     229         [ #  # ]:          0 :                     if( SFX_ITEM_SET == pArgs->GetItemState(
     230         [ #  # ]:          0 :                                         FN_PARAM_2, sal_False, &pItem ))
     231                 :            :                     {
     232         [ #  # ]:          0 :                         aPar1 += ((SfxStringItem *)pItem)->GetValue();
     233                 :            :                     }
     234         [ #  # ]:          0 :                     if( SFX_ITEM_SET == pArgs->GetItemState(
     235         [ #  # ]:          0 :                                         FN_PARAM_FIELD_CONTENT, sal_False, &pItem ))
     236         [ #  # ]:          0 :                         aPar2 = ((SfxStringItem *)pItem)->GetValue();
     237         [ #  # ]:          0 :                     if( SFX_ITEM_SET == pArgs->GetItemState(
     238         [ #  # ]:          0 :                                         FN_PARAM_FIELD_FORMAT, sal_False, &pItem ))
     239                 :          0 :                         nFormat = ((SfxUInt32Item *)pItem)->GetValue();
     240                 :            :                     OSL_FAIL("Command is not yet used");
     241                 :          0 :                     sal_Unicode cSeparator = ' ';
     242 [ #  # ][ #  # ]:          0 :                     SwInsertFld_Data aData(nType, 0, aPar1, aPar2, nFormat, GetShellPtr(), cSeparator );
     243 [ #  # ][ #  # ]:          0 :                     bRes = aFldMgr.InsertFld(aData);
         [ #  # ][ #  # ]
                 [ #  # ]
     244                 :            :                 }
     245 [ #  # ][ #  # ]:          0 :                 rReq.SetReturnValue(SfxBoolItem( nSlot, bRes ));
                 [ #  # ]
     246                 :            :             }
     247                 :          0 :             break;
     248                 :            :             case FN_INSERT_FIELD_CTRL:
     249                 :            :             case FN_INSERT_FIELD:
     250                 :            :             {
     251                 :          0 :                 sal_Bool bRes = sal_False;
     252 [ #  # ][ #  # ]:          0 :                 if( pItem && nSlot != FN_INSERT_FIELD_CTRL)
     253                 :            :                 {
     254                 :          0 :                     sal_uLong  nFormat = 0;
     255                 :          0 :                     sal_uInt16 nType = 0;
     256                 :          0 :                     sal_uInt16 nSubType = 0;
     257         [ #  # ]:          0 :                     String aPar1 = ((SfxStringItem *)pItem)->GetValue();
     258         [ #  # ]:          0 :                     String aPar2;
     259                 :          0 :                     sal_Unicode cSeparator = ' ';
     260                 :            : 
     261         [ #  # ]:          0 :                     if( SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_FIELD_TYPE,
     262         [ #  # ]:          0 :                                                                 sal_False, &pItem ))
     263                 :          0 :                         nType = ((SfxUInt16Item *)pItem)->GetValue();
     264         [ #  # ]:          0 :                     if( SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_FIELD_SUBTYPE,
     265         [ #  # ]:          0 :                                                                 sal_False, &pItem ))
     266                 :          0 :                         nSubType = ((SfxUInt16Item *)pItem)->GetValue();
     267         [ #  # ]:          0 :                     if( SFX_ITEM_SET == pArgs->GetItemState(
     268         [ #  # ]:          0 :                                         FN_PARAM_FIELD_CONTENT, sal_False, &pItem ))
     269         [ #  # ]:          0 :                         aPar2 = ((SfxStringItem *)pItem)->GetValue();
     270         [ #  # ]:          0 :                     if( SFX_ITEM_SET == pArgs->GetItemState(
     271         [ #  # ]:          0 :                                         FN_PARAM_FIELD_FORMAT, sal_False, &pItem ))
     272                 :          0 :                         nFormat = ((SfxUInt32Item *)pItem)->GetValue();
     273         [ #  # ]:          0 :                     if( SFX_ITEM_SET == pArgs->GetItemState(
     274         [ #  # ]:          0 :                                         FN_PARAM_3, sal_False, &pItem ))
     275                 :            :                     {
     276         [ #  # ]:          0 :                         String sTmp = ((SfxStringItem *)pItem)->GetValue();
     277         [ #  # ]:          0 :                         if(sTmp.Len())
     278         [ #  # ]:          0 :                             cSeparator = sTmp.GetChar(0);
     279                 :            :                     }
     280 [ #  # ][ #  # ]:          0 :                     SwInsertFld_Data aData(nType, nSubType, aPar1, aPar2, nFormat, GetShellPtr(), cSeparator );
     281 [ #  # ][ #  # ]:          0 :                     bRes = aFldMgr.InsertFld( aData );
         [ #  # ][ #  # ]
     282                 :            :                 }
     283                 :            :                 else
     284                 :            :                         //#i5788# prevent closing of the field dialog while a modal dialog ( Input field dialog ) is active
     285 [ #  # ][ #  # ]:          0 :                         if(!GetView().GetViewFrame()->IsInModalMode())
     286                 :            :                 {
     287                 :          0 :                     SfxViewFrame* pVFrame = GetView().GetViewFrame();
     288         [ #  # ]:          0 :                     pVFrame->ToggleChildWindow(FN_INSERT_FIELD);
     289         [ #  # ]:          0 :                     bRes = pVFrame->GetChildWindow( nSlot ) != 0;
     290         [ #  # ]:          0 :                     Invalidate(rReq.GetSlot());
     291         [ #  # ]:          0 :                     Invalidate(FN_INSERT_FIELD_CTRL);
     292         [ #  # ]:          0 :                     rReq.Ignore();
     293                 :            :                 }
     294 [ #  # ][ #  # ]:          0 :                 rReq.SetReturnValue(SfxBoolItem( nSlot, bRes ));
                 [ #  # ]
     295                 :            :             }
     296                 :          0 :             break;
     297                 :            : 
     298                 :            :             case FN_INSERT_REF_FIELD:
     299                 :            :             {
     300                 :          0 :                 SfxViewFrame* pVFrame = GetView().GetViewFrame();
     301 [ #  # ][ #  # ]:          0 :                 if (!pVFrame->HasChildWindow(FN_INSERT_FIELD))
     302         [ #  # ]:          0 :                     pVFrame->ToggleChildWindow(FN_INSERT_FIELD);    // Dialog anzeigen
     303                 :            : 
     304                 :            :                 // Flddlg auf neue TabPage umschalten
     305         [ #  # ]:          0 :                 sal_uInt16 nId = SwFldDlgWrapper::GetChildWindowId();
     306         [ #  # ]:          0 :                 SwFldDlgWrapper *pWrp = (SwFldDlgWrapper*)pVFrame->GetChildWindow(nId);
     307         [ #  # ]:          0 :                 if (pWrp)
     308         [ #  # ]:          0 :                     pWrp->ShowPage();
     309         [ #  # ]:          0 :                 rReq.Ignore();
     310                 :            :             }
     311                 :          0 :             break;
     312                 :            :             case FN_DELETE_COMMENT:
     313 [ #  # ][ #  # ]:          0 :                 if ( GetView().GetPostItMgr() &&
                 [ #  # ]
     314         [ #  # ]:          0 :                      GetView().GetPostItMgr()->HasActiveSidebarWin() )
     315                 :            :                 {
     316         [ #  # ]:          0 :                     GetView().GetPostItMgr()->DeleteActiveSidebarWin();
     317                 :            :                 }
     318                 :          0 :             break;
     319                 :            :             case FN_DELETE_ALL_NOTES:
     320         [ #  # ]:          0 :                 if ( GetView().GetPostItMgr() )
     321         [ #  # ]:          0 :                     GetView().GetPostItMgr()->Delete();
     322                 :          0 :             break;
     323                 :            :             case FN_DELETE_NOTE_AUTHOR:
     324                 :            :             {
     325 [ #  # ][ #  # ]:          0 :                 SFX_REQUEST_ARG( rReq, pNoteItem, SfxStringItem, nSlot, sal_False);
     326 [ #  # ][ #  # ]:          0 :                 if ( pNoteItem && GetView().GetPostItMgr() )
                 [ #  # ]
     327 [ #  # ][ #  # ]:          0 :                     GetView().GetPostItMgr()->Delete( pNoteItem->GetValue() );
                 [ #  # ]
     328                 :            :             }
     329                 :          0 :             break;
     330                 :            :             case FN_HIDE_NOTE:
     331 [ #  # ][ #  # ]:          0 :                 if ( GetView().GetPostItMgr() &&
                 [ #  # ]
     332         [ #  # ]:          0 :                      GetView().GetPostItMgr()->HasActiveSidebarWin() )
     333                 :            :                 {
     334         [ #  # ]:          0 :                     GetView().GetPostItMgr()->HideActiveSidebarWin();
     335                 :            :                 }
     336                 :          0 :             break;
     337                 :            :             case FN_HIDE_ALL_NOTES:
     338         [ #  # ]:          0 :                 if ( GetView().GetPostItMgr() )
     339         [ #  # ]:          0 :                     GetView().GetPostItMgr()->Hide();
     340                 :          0 :             break;
     341                 :            :             case FN_HIDE_NOTE_AUTHOR:
     342                 :            :             {
     343 [ #  # ][ #  # ]:          0 :                 SFX_REQUEST_ARG( rReq, pNoteItem, SfxStringItem, nSlot, sal_False);
     344 [ #  # ][ #  # ]:          0 :                 if ( pNoteItem && GetView().GetPostItMgr() )
                 [ #  # ]
     345         [ #  # ]:          0 :                     GetView().GetPostItMgr()->Hide( pNoteItem->GetValue() );
     346                 :            :             }
     347                 :          0 :             break;
     348                 :            :             case FN_POSTIT:
     349                 :            :             {
     350         [ #  # ]:          0 :                 SwPostItField* pPostIt = (SwPostItField*)aFldMgr.GetCurFld();
     351 [ #  # ][ #  # ]:          0 :                   sal_Bool bNew = !(pPostIt && pPostIt->GetTyp()->Which() == RES_POSTITFLD);
     352 [ #  # ][ #  # ]:          0 :                 if (bNew || GetView().GetPostItMgr()->IsAnswer())
                 [ #  # ]
     353                 :            :                 {
     354         [ #  # ]:          0 :                     SvtUserOptions aUserOpt;
     355         [ #  # ]:          0 :                     String sAuthor;
     356 [ #  # ][ #  # ]:          0 :                     if( !(sAuthor = aUserOpt.GetFullName()).Len())
                 [ #  # ]
     357 [ #  # ][ #  # ]:          0 :                         if( !(sAuthor = aUserOpt.GetID()).Len() )
                 [ #  # ]
     358 [ #  # ][ #  # ]:          0 :                             sAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
                 [ #  # ]
     359                 :            : 
     360                 :            :                     // Save the current selection, it will be required later for fieldmark insertion.
     361         [ #  # ]:          0 :                     SwPaM& rCurrPam = rSh.GetCurrentShellCursor();
     362         [ #  # ]:          0 :                     SwPaM aSaved(*rCurrPam.GetPoint(), *rCurrPam.GetMark());
     363 [ #  # ][ #  # ]:          0 :                     if( rSh.HasSelection() )
     364                 :            :                     {
     365         [ #  # ]:          0 :                         rSh.NormalizePam(false);
     366         [ #  # ]:          0 :                         rSh.KillPams();
     367         [ #  # ]:          0 :                         rSh.ClearMark();
     368                 :            :                     }
     369         [ #  # ]:          0 :                     SwInsertFld_Data aData(TYP_POSTITFLD, 0, sAuthor, aEmptyStr, 0);
     370         [ #  # ]:          0 :                     aFldMgr.InsertFld(aData, &aSaved);
     371                 :            : 
     372         [ #  # ]:          0 :                     rSh.Push();
     373         [ #  # ]:          0 :                     rSh.SwCrsrShell::Left(1, CRSR_SKIP_CHARS, sal_False);
     374         [ #  # ]:          0 :                     pPostIt = (SwPostItField*)aFldMgr.GetCurFld();
     375 [ #  # ][ #  # ]:          0 :                     rSh.Pop(sal_False); // Cursorpos restaurieren
         [ #  # ][ #  # ]
                 [ #  # ]
     376                 :            :                  }
     377                 :            : 
     378         [ #  # ]:          0 :                 if (pPostIt)
     379                 :            :                 {
     380         [ #  # ]:          0 :                     SwFieldType* pType = rSh.GetDoc()->GetFldType(RES_POSTITFLD, aEmptyStr,false);
     381         [ #  # ]:          0 :                     SwIterator<SwFmtFld,SwFieldType> aIter( *pType );
     382         [ #  # ]:          0 :                     SwFmtFld* pSwFmtFld = aIter.First();
     383         [ #  # ]:          0 :                     while( pSwFmtFld )
     384                 :            :                     {
     385         [ #  # ]:          0 :                         if ( pSwFmtFld->GetFld() == pPostIt )
     386                 :            :                         {
     387 [ #  # ][ #  # ]:          0 :                             pSwFmtFld->Broadcast( SwFmtFldHint( 0, SWFMTFLD_FOCUS, &GetView() ) );
                 [ #  # ]
     388                 :          0 :                             break;
     389                 :            :                         }
     390         [ #  # ]:          0 :                         pSwFmtFld = aIter.Next();
     391         [ #  # ]:          0 :                     }
     392                 :            :                 }
     393                 :            :             }
     394                 :          0 :             break;
     395                 :            :             case FN_REDLINE_COMMENT:
     396                 :            :             {
     397                 :            :                 /*  this code can be used once we want redline comments in the margin, all other stuff can
     398                 :            :                     then be deleted
     399                 :            :                 String sComment;
     400                 :            :                 const SwRedline *pRedline = rSh.GetCurrRedline();
     401                 :            : 
     402                 :            :                 if (pRedline)
     403                 :            :                 {
     404                 :            :                     sComment = pRedline->GetComment();
     405                 :            :                     if ( !sComment.Len() )
     406                 :            :                         GetView().GetDocShell()->Broadcast(SwRedlineHint(pRedline,SWREDLINE_INSERTED));
     407                 :            :                     const_cast<SwRedline*>(pRedline)->Broadcast(SwRedlineHint(pRedline,SWREDLINE_FOCUS,&GetView()));
     408                 :            :                 }
     409                 :            :                 */
     410                 :            : 
     411         [ #  # ]:          0 :                 const SwRedline *pRedline = rSh.GetCurrRedline();
     412                 :            : 
     413         [ #  # ]:          0 :                 if (pRedline)
     414                 :            :                 {
     415 [ #  # ][ #  # ]:          0 :                     rtl::OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
                 [ #  # ]
     416                 :            : 
     417                 :          0 :                     sal_Bool bTravel = sal_False;
     418                 :            : 
     419         [ #  # ]:          0 :                     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     420                 :            :                     OSL_ENSURE(pFact, "Dialogdiet fail!");
     421         [ #  # ]:          0 :                     ::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc( RID_SVXDLG_POSTIT );
     422                 :            :                     OSL_ENSURE(fnGetRange, "Dialogdiet fail! GetRanges()");
     423 [ #  # ][ #  # ]:          0 :                     SfxItemSet aSet(GetPool(), fnGetRange());
     424 [ #  # ][ #  # ]:          0 :                     aSet.Put(SvxPostItTextItem(sComment, SID_ATTR_POSTIT_TEXT));
         [ #  # ][ #  # ]
                 [ #  # ]
     425 [ #  # ][ #  # ]:          0 :                     aSet.Put(SvxPostItAuthorItem(pRedline->GetAuthorString(), SID_ATTR_POSTIT_AUTHOR));
         [ #  # ][ #  # ]
     426                 :            : 
     427                 :            :                     aSet.Put( SvxPostItDateItem( GetAppLangDateTimeString(
     428         [ #  # ]:          0 :                                 pRedline->GetRedlineData().GetTimeStamp() ),
     429 [ #  # ][ #  # ]:          0 :                                 SID_ATTR_POSTIT_DATE ));
         [ #  # ][ #  # ]
                 [ #  # ]
     430                 :            : 
     431                 :            :                     // Traveling nur bei mehr als einem Feld
     432         [ #  # ]:          0 :                     rSh.StartAction();
     433                 :            : 
     434         [ #  # ]:          0 :                     rSh.Push();
     435         [ #  # ]:          0 :                     const SwRedline *pActRed = rSh.SelPrevRedline();
     436                 :            : 
     437         [ #  # ]:          0 :                     if (pActRed == pRedline)
     438                 :            :                     {   // Neuer Cursor steht am Anfang des Current Redlines
     439         [ #  # ]:          0 :                         rSh.Pop();  // Alten Cursor wegwerfen
     440         [ #  # ]:          0 :                         rSh.Push();
     441         [ #  # ]:          0 :                         pActRed = rSh.SelPrevRedline();
     442                 :            :                     }
     443                 :            : 
     444                 :          0 :                     sal_Bool bPrev = pActRed != 0;
     445         [ #  # ]:          0 :                     rSh.Pop(sal_False);
     446         [ #  # ]:          0 :                     rSh.EndAction();
     447                 :            : 
     448         [ #  # ]:          0 :                     rSh.ClearMark();
     449         [ #  # ]:          0 :                     rSh.SelNextRedline();   // Aktueller Redline wird selektiert
     450                 :            : 
     451         [ #  # ]:          0 :                     rSh.StartAction();
     452         [ #  # ]:          0 :                     rSh.Push();
     453         [ #  # ]:          0 :                     pActRed = rSh.SelNextRedline();
     454                 :          0 :                     sal_Bool bNext = pActRed != 0;
     455         [ #  # ]:          0 :                     rSh.Pop(sal_False); // Cursorpos restaurieren
     456                 :            : 
     457 [ #  # ][ #  # ]:          0 :                     if( rSh.IsCrsrPtAtEnd() )
     458         [ #  # ]:          0 :                         rSh.SwapPam();
     459                 :            : 
     460         [ #  # ]:          0 :                     rSh.EndAction();
     461                 :            : 
     462                 :          0 :                     bTravel |= bNext|bPrev;
     463                 :            : 
     464         [ #  # ]:          0 :                     SvxAbstractDialogFactory* pFact2 = SvxAbstractDialogFactory::Create();
     465                 :            :                     OSL_ENSURE(pFact2, "Dialogdiet fail!");
     466         [ #  # ]:          0 :                     AbstractSvxPostItDialog* pDlg = pFact2->CreateSvxPostItDialog( pMDI, aSet, bTravel, sal_True );
     467                 :            :                     OSL_ENSURE(pDlg, "Dialogdiet fail!");
     468         [ #  # ]:          0 :                     pDlg->HideAuthor();
     469                 :            : 
     470         [ #  # ]:          0 :                     String sTitle(SW_RES(STR_REDLINE_COMMENT));
     471 [ #  # ][ #  # ]:          0 :                     ::lcl_AppendRedlineStr( sTitle, pRedline->GetType() );
     472                 :            : 
     473         [ #  # ]:          0 :                     pDlg->SetText(sTitle);
     474                 :            : 
     475         [ #  # ]:          0 :                     if (bTravel)
     476                 :            :                     {
     477         [ #  # ]:          0 :                         pDlg->EnableTravel(bNext, bPrev);
     478 [ #  # ][ #  # ]:          0 :                         pDlg->SetPrevHdl(LINK(this, SwTextShell, RedlinePrevHdl));
     479 [ #  # ][ #  # ]:          0 :                         pDlg->SetNextHdl(LINK(this, SwTextShell, RedlineNextHdl));
     480                 :            :                     }
     481                 :            : 
     482 [ #  # ][ #  # ]:          0 :                     rSh.SetCareWin(pDlg->GetWindow());
     483                 :          0 :                     bNoInterrupt = sal_True;
     484                 :            : 
     485 [ #  # ][ #  # ]:          0 :                     if ( pDlg->Execute() == RET_OK )
     486                 :            :                     {
     487         [ #  # ]:          0 :                         const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
     488 [ #  # ][ #  # ]:          0 :                         String sMsg(((const SvxPostItTextItem&)pOutSet->Get(SID_ATTR_POSTIT_TEXT)).GetValue());
     489                 :            : 
     490                 :            :                         // Kommentar einfuegen bzw aendern
     491 [ #  # ][ #  # ]:          0 :                         rSh.SetRedlineComment(sMsg);
     492                 :            :                     }
     493                 :            : 
     494 [ #  # ][ #  # ]:          0 :                     delete pDlg;
     495         [ #  # ]:          0 :                     rSh.SetCareWin(NULL);
     496                 :          0 :                     bNoInterrupt = sal_False;
     497         [ #  # ]:          0 :                     rSh.ClearMark();
     498 [ #  # ][ #  # ]:          0 :                     GetView().AttrChangedNotify(GetShellPtr());
         [ #  # ][ #  # ]
     499                 :            :                 }
     500                 :            :             }
     501                 :          0 :             break;
     502                 :            : 
     503                 :            :             case FN_JAVAEDIT:
     504                 :            :             {
     505                 :          0 :                 rtl::OUString aType, aText;
     506                 :          0 :                 sal_Bool bIsUrl=sal_False;
     507                 :          0 :                 sal_Bool bNew=sal_False, bUpdate=sal_False;
     508 [ #  # ][ #  # ]:          0 :                 SwFldMgr* pMgr = new SwFldMgr;
     509         [ #  # ]:          0 :                 if ( pItem )
     510                 :            :                 {
     511         [ #  # ]:          0 :                     aText = ((SfxStringItem*)pItem)->GetValue();
     512 [ #  # ][ #  # ]:          0 :                     SFX_REQUEST_ARG( rReq, pType, SfxStringItem, FN_PARAM_2 , sal_False );
     513 [ #  # ][ #  # ]:          0 :                     SFX_REQUEST_ARG( rReq, pIsUrl, SfxBoolItem, FN_PARAM_1 , sal_False );
     514         [ #  # ]:          0 :                     if ( pType )
     515         [ #  # ]:          0 :                         aType = pType->GetValue();
     516         [ #  # ]:          0 :                     if ( pIsUrl )
     517                 :          0 :                         bIsUrl = pIsUrl->GetValue();
     518                 :            : 
     519         [ #  # ]:          0 :                     SwScriptField* pFld = (SwScriptField*)pMgr->GetCurFld();
     520 [ #  # ][ #  # ]:          0 :                     bNew = !pFld || !(pFld->GetTyp()->Which() == RES_SCRIPTFLD);
     521 [ #  # ][ #  # ]:          0 :                     bUpdate = pFld && ( bIsUrl != pFld->GetFormat() || pFld->GetPar2() != aType || pFld->GetPar1() != aText );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     522                 :            :                 }
     523                 :            :                 else
     524                 :            :                 {
     525         [ #  # ]:          0 :                     SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     526                 :            :                     OSL_ENSURE(pFact, "Dialogdiet fail!");
     527                 :            :                     AbstractJavaEditDialog* pDlg = pFact->CreateJavaEditDialog( DLG_JAVAEDIT,
     528         [ #  # ]:          0 :                                                             pMDI, &rSh);
     529                 :            :                     OSL_ENSURE(pDlg, "Dialogdiet fail!");
     530 [ #  # ][ #  # ]:          0 :                     if ( pDlg->Execute() )
     531                 :            :                     {
     532 [ #  # ][ #  # ]:          0 :                         aType = pDlg->GetType();
                 [ #  # ]
     533 [ #  # ][ #  # ]:          0 :                         aText = pDlg->GetText();
                 [ #  # ]
     534         [ #  # ]:          0 :                         bIsUrl = pDlg->IsUrl();
     535         [ #  # ]:          0 :                         bNew = pDlg->IsNew();
     536         [ #  # ]:          0 :                         bUpdate = pDlg->IsUpdate();
     537 [ #  # ][ #  # ]:          0 :                         rReq.AppendItem( SfxStringItem( FN_JAVAEDIT, aText ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     538 [ #  # ][ #  # ]:          0 :                         rReq.AppendItem( SfxStringItem( FN_PARAM_2, aType ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     539 [ #  # ][ #  # ]:          0 :                         rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bIsUrl ) );
                 [ #  # ]
     540                 :            :                     }
     541                 :            : 
     542 [ #  # ][ #  # ]:          0 :                     delete pDlg;
     543                 :            :                 }
     544                 :            : 
     545         [ #  # ]:          0 :                 if( bNew )
     546                 :            :                 {
     547 [ #  # ][ #  # ]:          0 :                     SwInsertFld_Data aData(TYP_SCRIPTFLD, 0, aType, aText, bIsUrl);
         [ #  # ][ #  # ]
                 [ #  # ]
     548         [ #  # ]:          0 :                     pMgr->InsertFld(aData);
     549 [ #  # ][ #  # ]:          0 :                     rReq.Done();
     550                 :            :                 }
     551         [ #  # ]:          0 :                 else if( bUpdate )
     552                 :            :                 {
     553 [ #  # ][ #  # ]:          0 :                     pMgr->UpdateCurFld( bIsUrl, aType, aText );
         [ #  # ][ #  # ]
                 [ #  # ]
     554         [ #  # ]:          0 :                     rSh.SetUndoNoResetModified();
     555         [ #  # ]:          0 :                     rReq.Done();
     556                 :            :                 }
     557                 :            :                 else
     558         [ #  # ]:          0 :                     rReq.Ignore();
     559                 :            :             }
     560                 :          0 :             break;
     561                 :            : 
     562                 :            :             case FN_INSERT_FLD_DATE    :
     563                 :          0 :                 nInsertType = TYP_DATEFLD;
     564                 :          0 :                 bIsText = sal_False;
     565                 :          0 :                 goto FIELD_INSERT;
     566                 :            :             case FN_INSERT_FLD_TIME    :
     567                 :          0 :                 nInsertType = TYP_TIMEFLD;
     568                 :          0 :                 bIsText = sal_False;
     569                 :          0 :                 goto FIELD_INSERT;
     570                 :            :             case FN_INSERT_FLD_PGNUMBER:
     571                 :          0 :                 nInsertType = TYP_PAGENUMBERFLD;
     572                 :          0 :                 nInsertFormat = SVX_NUM_PAGEDESC; // wie Seitenvorlage
     573                 :          0 :                 bIsText = sal_False;
     574                 :          0 :                 goto FIELD_INSERT;
     575                 :            :             case FN_INSERT_FLD_PGCOUNT :
     576                 :          0 :                 nInsertType = TYP_DOCSTATFLD;
     577                 :          0 :                 nInsertSubType = 0;
     578                 :          0 :                 bIsText = sal_False;
     579                 :          0 :                 nInsertFormat = SVX_NUM_PAGEDESC;
     580                 :          0 :                 goto FIELD_INSERT;
     581                 :            :             case FN_INSERT_FLD_TOPIC   :
     582                 :          0 :                 nInsertType = TYP_DOCINFOFLD;
     583                 :          0 :                 nInsertSubType = DI_THEMA;
     584                 :          0 :                 goto FIELD_INSERT;
     585                 :            :             case FN_INSERT_FLD_TITLE   :
     586                 :          0 :                 nInsertType = TYP_DOCINFOFLD;
     587                 :          0 :                 nInsertSubType = DI_TITEL;
     588                 :          0 :                 goto FIELD_INSERT;
     589                 :            :             case FN_INSERT_FLD_AUTHOR  :
     590                 :          0 :                 nInsertType = TYP_DOCINFOFLD;
     591                 :          0 :                 nInsertSubType = DI_CREATE|DI_SUB_AUTHOR;
     592                 :            : 
     593                 :            : FIELD_INSERT:
     594                 :            :             {
     595                 :            :                 //format conversion should only be done for number formatter formats
     596         [ #  # ]:          0 :                 if(!nInsertFormat)
     597 [ #  # ][ #  # ]:          0 :                     nInsertFormat = aFldMgr.GetDefaultFormat(nInsertType, bIsText, rSh.GetNumberFormatter());
     598                 :            :                 SwInsertFld_Data aData(nInsertType, nInsertSubType,
     599         [ #  # ]:          0 :                                     aEmptyStr, aEmptyStr, nInsertFormat);
     600         [ #  # ]:          0 :                 aFldMgr.InsertFld(aData);
     601 [ #  # ][ #  # ]:          0 :                 rReq.Done();
     602                 :            :             }
     603                 :          0 :             break;
     604                 :            :             default:
     605                 :            :                 OSL_FAIL("wrong dispatcher");
     606                 :          0 :                 return;
     607 [ #  # ][ #  # ]:          0 :         }
     608                 :            :     }
     609                 :            : }
     610                 :            : 
     611                 :         14 : void SwTextShell::StateField( SfxItemSet &rSet )
     612                 :            : {
     613         [ +  - ]:         14 :     SwWrtShell& rSh = GetShell();
     614         [ +  - ]:         14 :     SfxWhichIter aIter( rSet );
     615                 :         14 :     const SwField* pField = 0;
     616                 :         14 :     int bGetField = sal_False;
     617         [ +  - ]:         14 :     sal_uInt16 nWhich = aIter.FirstWhich();
     618                 :            : 
     619         [ +  + ]:         28 :     while (nWhich)
     620                 :            :     {
     621   [ -  +  -  -  :         14 :         switch (nWhich)
             -  -  -  -  
                      - ]
     622                 :            :         {
     623                 :            :             case FN_DELETE_COMMENT:
     624                 :            :             case FN_DELETE_NOTE_AUTHOR:
     625                 :            :             case FN_DELETE_ALL_NOTES:
     626                 :            :             case FN_HIDE_NOTE:
     627                 :            :             case FN_HIDE_NOTE_AUTHOR:
     628                 :            :             case FN_HIDE_ALL_NOTES:
     629                 :            :                 {
     630                 :          0 :                     SwPostItMgr* pPostItMgr = GetView().GetPostItMgr();
     631         [ #  # ]:          0 :                     if ( !pPostItMgr )
     632         [ #  # ]:          0 :                         rSet.InvalidateItem( nWhich );
     633 [ #  # ][ #  # ]:          0 :                     else if ( !pPostItMgr->HasActiveSidebarWin() )
     634                 :            :                     {
     635         [ #  # ]:          0 :                         rSet.InvalidateItem( FN_DELETE_COMMENT );
     636         [ #  # ]:          0 :                         rSet.InvalidateItem( FN_HIDE_NOTE );
     637                 :            :                     }
     638                 :            :                 }
     639                 :          0 :             break;
     640                 :            :             case FN_EDIT_FIELD:
     641                 :            :             {
     642                 :            : 
     643         [ +  - ]:         14 :                 if( !bGetField )
     644                 :            :                 {
     645         [ +  - ]:         14 :                     pField = rSh.GetCurFld();
     646                 :         14 :                     bGetField = sal_True;
     647                 :            :                 }
     648                 :            : 
     649         [ -  + ]:         14 :                 sal_uInt16 nTempWhich = pField ? pField->GetTyp()->Which() : USHRT_MAX;
     650 [ -  + ][ #  # ]:         14 :                 if( USHRT_MAX == nTempWhich ||
         [ #  # ][ #  # ]
     651                 :            :                     RES_POSTITFLD == nTempWhich ||
     652                 :            :                     RES_SCRIPTFLD == nTempWhich ||
     653                 :            :                     RES_AUTHORITY == nTempWhich )
     654         [ +  - ]:         14 :                     rSet.DisableItem( nWhich );
     655   [ #  #  #  # ]:          0 :                 else if( RES_DDEFLD == nTempWhich &&
                 [ #  # ]
     656                 :          0 :                         !((SwDDEFieldType*)pField->GetTyp())->GetBaseLink().IsVisible())
     657                 :            :                 {
     658                 :            :                     // nested links cannot be edited
     659         [ #  # ]:          0 :                     rSet.DisableItem( nWhich );
     660                 :            :                 }
     661                 :            :             }
     662                 :         14 :             break;
     663                 :            :             case FN_EXECUTE_MACROFIELD:
     664                 :            :             {
     665         [ #  # ]:          0 :                 if(!bGetField)
     666                 :            :                 {
     667         [ #  # ]:          0 :                     pField = rSh.GetCurFld();
     668                 :          0 :                     bGetField = sal_True;
     669                 :            :                 }
     670 [ #  # ][ #  # ]:          0 :                 if(!pField || pField->GetTyp()->Which() != RES_MACROFLD)
                 [ #  # ]
     671         [ #  # ]:          0 :                     rSet.DisableItem(nWhich);
     672                 :            :             }
     673                 :          0 :             break;
     674                 :            : 
     675                 :            :             case FN_INSERT_FIELD:
     676                 :            :             {
     677                 :          0 :                 SfxViewFrame* pVFrame = GetView().GetViewFrame();
     678                 :            :                 //#i5788# prevent closing of the field dialog while a modal dialog ( Input field dialog ) is active
     679 [ #  # ][ #  # ]:          0 :                 if(!pVFrame->IsInModalMode() &&
         [ #  # ][ #  # ]
                 [ #  # ]
     680 [ #  # ][ #  # ]:          0 :                         pVFrame->KnowsChildWindow(FN_INSERT_FIELD) && !pVFrame->HasChildWindow(FN_INSERT_FIELD_DATA_ONLY) )
     681 [ #  # ][ #  # ]:          0 :                     rSet.Put(SfxBoolItem( FN_INSERT_FIELD, pVFrame->HasChildWindow(nWhich)));
         [ #  # ][ #  # ]
     682                 :            :                 else
     683         [ #  # ]:          0 :                     rSet.DisableItem(FN_INSERT_FIELD);
     684                 :            :             }
     685                 :          0 :             break;
     686                 :            :             case FN_INSERT_REF_FIELD:
     687                 :            :             {
     688                 :          0 :                 SfxViewFrame* pVFrame = GetView().GetViewFrame();
     689 [ #  # ][ #  # ]:          0 :                 if (!pVFrame->KnowsChildWindow(FN_INSERT_FIELD))
     690         [ #  # ]:          0 :                     rSet.DisableItem(FN_INSERT_REF_FIELD);
     691                 :            :             }
     692                 :          0 :             break;
     693                 :            :             case FN_INSERT_FIELD_CTRL:
     694 [ #  # ][ #  # ]:          0 :                 rSet.Put(SfxBoolItem( nWhich, GetView().GetViewFrame()->HasChildWindow(FN_INSERT_FIELD)));
         [ #  # ][ #  # ]
     695                 :          0 :             break;
     696                 :            :             case FN_REDLINE_COMMENT:
     697 [ #  # ][ #  # ]:          0 :                 if (!rSh.GetCurrRedline())
     698         [ #  # ]:          0 :                     rSet.DisableItem(nWhich);
     699                 :          0 :                 break;
     700                 :            :             case FN_POSTIT :
     701                 :            :             case FN_JAVAEDIT :
     702                 :          0 :                 sal_Bool bCurField = sal_False;
     703         [ #  # ]:          0 :                 pField = rSh.GetCurFld();
     704         [ #  # ]:          0 :                 if(nWhich == FN_POSTIT)
     705 [ #  # ][ #  # ]:          0 :                     bCurField = pField && pField->GetTyp()->Which() == RES_POSTITFLD;
     706                 :            :                 else
     707 [ #  # ][ #  # ]:          0 :                     bCurField = pField && pField->GetTyp()->Which() == RES_SCRIPTFLD;
     708                 :            : 
     709 [ #  # ][ #  # ]:          0 :                 if(!bCurField && rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel() )
         [ #  # ][ #  # ]
                 [ #  # ]
     710         [ #  # ]:          0 :                     rSet.DisableItem(nWhich);
     711                 :          0 :             break;
     712                 :            :         }
     713         [ +  - ]:         14 :         nWhich = aIter.NextWhich();
     714         [ +  - ]:         14 :     }
     715                 :         14 : }
     716                 :            : 
     717                 :          0 : void SwTextShell::InsertHyperlink(const SvxHyperlinkItem& rHlnkItem)
     718                 :            : {
     719                 :          0 :     const String& rName   = rHlnkItem.GetName();
     720                 :          0 :     const String& rURL    = rHlnkItem.GetURL();
     721                 :          0 :     const String& rTarget = rHlnkItem.GetTargetFrame();
     722                 :          0 :     sal_uInt16 nType =  (sal_uInt16)rHlnkItem.GetInsertMode();
     723                 :          0 :     nType &= ~HLINK_HTMLMODE;
     724                 :          0 :     const SvxMacroTableDtor* pMacroTbl = rHlnkItem.GetMacroTbl();
     725                 :            : 
     726                 :          0 :     SwWrtShell& rSh = GetShell();
     727                 :            : 
     728         [ #  # ]:          0 :     if( rSh.GetSelectionType() & nsSelectionType::SEL_TXT )
     729                 :            :     {
     730         [ #  # ]:          0 :         rSh.StartAction();
     731         [ #  # ]:          0 :         SfxItemSet aSet(GetPool(), RES_TXTATR_INETFMT, RES_TXTATR_INETFMT);
     732         [ #  # ]:          0 :         rSh.GetCurAttr( aSet );
     733                 :            : 
     734                 :            :         const SfxPoolItem* pItem;
     735 [ #  # ][ #  # ]:          0 :         if(SFX_ITEM_SET == aSet.GetItemState(RES_TXTATR_INETFMT, sal_False, &pItem))
     736                 :            :         {
     737                 :            :             // Links selektieren
     738         [ #  # ]:          0 :             rSh.SwCrsrShell::SelectTxtAttr(RES_TXTATR_INETFMT, sal_False);
     739                 :            :         }
     740      [ #  #  # ]:          0 :         switch (nType)
     741                 :            :         {
     742                 :            :         case HLINK_DEFAULT:
     743                 :            :         case HLINK_FIELD:
     744                 :            :             {
     745         [ #  # ]:          0 :                 SwFmtINetFmt aINetFmt( rURL, rTarget );
     746         [ #  # ]:          0 :                 aINetFmt.SetName(rHlnkItem.GetIntName());
     747         [ #  # ]:          0 :                 if(pMacroTbl)
     748                 :            :                 {
     749         [ #  # ]:          0 :                     const SvxMacro *pMacro = pMacroTbl->Get( SFX_EVENT_MOUSEOVER_OBJECT );
     750         [ #  # ]:          0 :                     if( pMacro )
     751         [ #  # ]:          0 :                         aINetFmt.SetMacro(SFX_EVENT_MOUSEOVER_OBJECT, *pMacro);
     752         [ #  # ]:          0 :                     pMacro = pMacroTbl->Get( SFX_EVENT_MOUSECLICK_OBJECT );
     753         [ #  # ]:          0 :                     if( pMacro )
     754         [ #  # ]:          0 :                         aINetFmt.SetMacro(SFX_EVENT_MOUSECLICK_OBJECT, *pMacro);
     755         [ #  # ]:          0 :                     pMacro = pMacroTbl->Get( SFX_EVENT_MOUSEOUT_OBJECT );
     756         [ #  # ]:          0 :                     if( pMacro )
     757         [ #  # ]:          0 :                         aINetFmt.SetMacro(SFX_EVENT_MOUSEOUT_OBJECT, *pMacro);
     758                 :            :                 }
     759         [ #  # ]:          0 :                 rSh.SttSelect();
     760         [ #  # ]:          0 :                 rSh.InsertURL( aINetFmt, rName, sal_True );
     761 [ #  # ][ #  # ]:          0 :                 rSh.EndSelect();
     762                 :            :             }
     763                 :          0 :             break;
     764                 :            : 
     765                 :            :         case HLINK_BUTTON:
     766         [ #  # ]:          0 :             sal_Bool bSel = rSh.HasSelection();
     767         [ #  # ]:          0 :             if(bSel)
     768         [ #  # ]:          0 :                 rSh.DelRight();
     769         [ #  # ]:          0 :             InsertURLButton( rURL, rTarget, rName );
     770         [ #  # ]:          0 :             rSh.EnterStdMode();
     771                 :          0 :             break;
     772                 :            :         }
     773 [ #  # ][ #  # ]:          0 :         rSh.EndAction();
     774                 :            :     }
     775                 :          0 : }
     776                 :            : 
     777                 :          0 : IMPL_LINK( SwTextShell, RedlineNextHdl, AbstractSvxPostItDialog *, pBtn )
     778                 :            : {
     779                 :          0 :     SwWrtShell* pSh = GetShellPtr();
     780                 :          0 :     AbstractSvxPostItDialog *pDlg = (AbstractSvxPostItDialog*)pBtn;
     781                 :            : 
     782                 :            :     // Kommentar einfuegen bzw aendern
     783         [ #  # ]:          0 :     pSh->SetRedlineComment(pDlg->GetNote());
     784                 :            : 
     785                 :          0 :     const SwRedline *pRedline = pSh->GetCurrRedline();
     786                 :            : 
     787         [ #  # ]:          0 :     if (pRedline)
     788                 :            :     {
     789                 :            :         // Traveling nur bei mehr als einem Feld
     790 [ #  # ][ #  # ]:          0 :         if( !pSh->IsCrsrPtAtEnd() )
     791         [ #  # ]:          0 :             pSh->SwapPam(); // Cursor hinter den Redline stellen
     792                 :            : 
     793         [ #  # ]:          0 :         pSh->Push();
     794         [ #  # ]:          0 :         const SwRedline *pActRed = pSh->SelNextRedline();
     795         [ #  # ]:          0 :         pSh->Pop(pActRed != 0);
     796                 :            : 
     797                 :          0 :         sal_Bool bEnable = sal_False;
     798                 :            : 
     799         [ #  # ]:          0 :         if (pActRed)
     800                 :            :         {
     801         [ #  # ]:          0 :             pSh->StartAction();
     802         [ #  # ]:          0 :             pSh->Push();
     803         [ #  # ]:          0 :             bEnable = pSh->SelNextRedline() != 0;
     804         [ #  # ]:          0 :             pSh->Pop(sal_False);
     805         [ #  # ]:          0 :             pSh->EndAction();
     806                 :            :         }
     807                 :            : 
     808         [ #  # ]:          0 :         pDlg->EnableTravel(bEnable, sal_True);
     809                 :            : 
     810 [ #  # ][ #  # ]:          0 :         if( pSh->IsCrsrPtAtEnd() )
     811         [ #  # ]:          0 :             pSh->SwapPam();
     812                 :            : 
     813         [ #  # ]:          0 :         pRedline = pSh->GetCurrRedline();
     814 [ #  # ][ #  # ]:          0 :         rtl::OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
                 [ #  # ]
     815                 :            : 
     816 [ #  # ][ #  # ]:          0 :         pDlg->SetNote(sComment);
                 [ #  # ]
     817         [ #  # ]:          0 :         pDlg->ShowLastAuthor( pRedline->GetAuthorString(),
     818                 :            :                     GetAppLangDateTimeString(
     819 [ #  # ][ #  # ]:          0 :                                 pRedline->GetRedlineData().GetTimeStamp() ));
         [ #  # ][ #  # ]
     820                 :            : 
     821         [ #  # ]:          0 :         String sTitle(SW_RES(STR_REDLINE_COMMENT));
     822 [ #  # ][ #  # ]:          0 :         ::lcl_AppendRedlineStr( sTitle, pRedline->GetType() );
     823                 :            : 
     824 [ #  # ][ #  # ]:          0 :         pDlg->SetText(sTitle);
     825                 :            :     }
     826                 :            : 
     827                 :          0 :     return 0;
     828                 :            : }
     829                 :            : 
     830                 :          0 : IMPL_LINK( SwTextShell, RedlinePrevHdl, AbstractSvxPostItDialog *, pBtn )
     831                 :            : {
     832                 :          0 :     SwWrtShell* pSh = GetShellPtr();
     833                 :          0 :     AbstractSvxPostItDialog *pDlg = (AbstractSvxPostItDialog*)pBtn;
     834                 :            : 
     835                 :            :     // Kommentar einfuegen bzw aendern
     836         [ #  # ]:          0 :     pSh->SetRedlineComment(pDlg->GetNote());
     837                 :            : 
     838                 :          0 :     const SwRedline *pRedline = pSh->GetCurrRedline();
     839                 :            : 
     840         [ #  # ]:          0 :     if (pRedline)
     841                 :            :     {
     842                 :            :         // Traveling nur bei mehr als einem Feld
     843         [ #  # ]:          0 :         pSh->Push();
     844         [ #  # ]:          0 :         const SwRedline *pActRed = pSh->SelPrevRedline();
     845         [ #  # ]:          0 :         pSh->Pop(pActRed != 0);
     846                 :            : 
     847                 :          0 :         sal_Bool bEnable = sal_False;
     848                 :            : 
     849         [ #  # ]:          0 :         if (pActRed)
     850                 :            :         {
     851         [ #  # ]:          0 :             pSh->StartAction();
     852         [ #  # ]:          0 :             pSh->Push();
     853         [ #  # ]:          0 :             bEnable = pSh->SelPrevRedline() != 0;
     854         [ #  # ]:          0 :             pSh->Pop(sal_False);
     855         [ #  # ]:          0 :             pSh->EndAction();
     856                 :            :         }
     857                 :            : 
     858         [ #  # ]:          0 :         pDlg->EnableTravel(sal_True, bEnable);
     859                 :            : 
     860         [ #  # ]:          0 :         pRedline = pSh->GetCurrRedline();
     861 [ #  # ][ #  # ]:          0 :         rtl::OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
                 [ #  # ]
     862                 :            : 
     863 [ #  # ][ #  # ]:          0 :         pDlg->SetNote(sComment);
                 [ #  # ]
     864         [ #  # ]:          0 :         pDlg->ShowLastAuthor(pRedline->GetAuthorString(),
     865                 :            :                 GetAppLangDateTimeString(
     866 [ #  # ][ #  # ]:          0 :                                 pRedline->GetRedlineData().GetTimeStamp() ));
         [ #  # ][ #  # ]
     867                 :            : 
     868         [ #  # ]:          0 :         String sTitle(SW_RES(STR_REDLINE_COMMENT));
     869 [ #  # ][ #  # ]:          0 :         ::lcl_AppendRedlineStr( sTitle, pRedline->GetType() );
     870                 :            : 
     871 [ #  # ][ #  # ]:          0 :         pDlg->SetText(sTitle);
     872                 :            :     }
     873                 :            : 
     874                 :          0 :     return 0;
     875                 :            : }
     876                 :            : 
     877                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10