LCOV - code coverage report
Current view: top level - sd/source/ui/view - outlnvs2.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 277 0.0 %
Date: 2012-08-25 Functions: 0 2 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 607 0.0 %

           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 "OutlineViewShell.hxx"
      31                 :            : 
      32                 :            : #include <com/sun/star/presentation/XPresentation2.hpp>
      33                 :            : 
      34                 :            : #include "app.hrc"
      35                 :            : #include <svx/hlnkitem.hxx>
      36                 :            : #include <sfx2/docfile.hxx>
      37                 :            : #include <sfx2/dispatch.hxx>
      38                 :            : #include <sfx2/request.hxx>
      39                 :            : #include <svl/eitem.hxx>
      40                 :            : #include <sfx2/zoomitem.hxx>
      41                 :            : #include <svx/svxids.hrc>
      42                 :            : #include <vcl/msgbox.hxx>
      43                 :            : #include <editeng/eeitem.hxx>
      44                 :            : #include <editeng/flditem.hxx>
      45                 :            : #include <editeng/editstat.hxx>
      46                 :            : #include "optsitem.hxx"
      47                 :            : #include <unotools/useroptions.hxx>
      48                 :            : 
      49                 :            : #include <sfx2/viewfrm.hxx>
      50                 :            : #include "Outliner.hxx"
      51                 :            : #include "Window.hxx"
      52                 :            : #include "fubullet.hxx"
      53                 :            : #include "fuolbull.hxx"
      54                 :            : #include "FrameView.hxx"
      55                 :            : #include "fuzoom.hxx"
      56                 :            : #include "fuscale.hxx"
      57                 :            : #include "fuchar.hxx"
      58                 :            : #include "fuinsfil.hxx"
      59                 :            : #include "fuprobjs.hxx"
      60                 :            : #include "futhes.hxx"
      61                 :            : #include "futempl.hxx"
      62                 :            : #include "fusldlg.hxx"
      63                 :            : #include "zoomlist.hxx"
      64                 :            : #include "fuexpand.hxx"
      65                 :            : #include "fusumry.hxx"
      66                 :            : #include "fucushow.hxx"
      67                 :            : #include "drawdoc.hxx"
      68                 :            : #include "sdattr.hxx"
      69                 :            : #include "ViewShellBase.hxx"
      70                 :            : #include "sdabstdlg.hxx"
      71                 :            : #include "framework/FrameworkHelper.hxx"
      72                 :            : #include "DrawViewShell.hxx"
      73                 :            : 
      74                 :            : using namespace ::com::sun::star::uno;
      75                 :            : using namespace ::com::sun::star::presentation;
      76                 :            : 
      77                 :            : namespace sd {
      78                 :            : 
      79                 :            : 
      80                 :            : /************************************************************************/
      81                 :            : 
      82                 :            : /*************************************************************************
      83                 :            : |*
      84                 :            : |* SfxRequests for temporary functions
      85                 :            : |*
      86                 :            : \************************************************************************/
      87                 :            : 
      88                 :          0 : void OutlineViewShell::FuTemporary(SfxRequest &rReq)
      89                 :            : {
      90                 :          0 :     DeactivateCurrentFunction();
      91                 :            : 
      92                 :          0 :     OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() );
      93                 :          0 :     sal_uInt16 nSId = rReq.GetSlot();
      94                 :            : 
      95   [ #  #  #  #  :          0 :     switch( nSId )
          #  #  #  #  #  
          #  #  #  #  #  
                #  #  # ]
      96                 :            :     {
      97                 :            :         case SID_ATTR_ZOOM:
      98                 :            :         {
      99                 :          0 :             const SfxItemSet* pArgs = rReq.GetArgs();
     100                 :            : 
     101         [ #  # ]:          0 :             if ( pArgs )
     102                 :            :             {
     103                 :            :                 SvxZoomType eZT = ( ( const SvxZoomItem& ) pArgs->
     104                 :          0 :                                             Get( SID_ATTR_ZOOM ) ).GetType();
     105         [ #  # ]:          0 :                 switch( eZT )
     106                 :            :                 {
     107                 :            :                     case SVX_ZOOM_PERCENT:
     108                 :            :                         SetZoom( (long) ( ( const SvxZoomItem& ) pArgs->
     109                 :          0 :                                             Get( SID_ATTR_ZOOM ) ).GetValue() );
     110                 :          0 :                         Invalidate( SID_ATTR_ZOOM );
     111                 :          0 :                         Invalidate( SID_ATTR_ZOOMSLIDER );
     112                 :          0 :                         break;
     113                 :            :                     default:
     114                 :          0 :                         break;
     115                 :            :                 }
     116                 :          0 :                 rReq.Done();
     117                 :            :             }
     118                 :            :             else
     119                 :            :             {
     120                 :            :                 // open the zoom dialog here
     121         [ #  # ]:          0 :                 SetCurrentFunction( FuScale::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
     122                 :            :             }
     123                 :          0 :             Cancel();
     124                 :            :         }
     125                 :          0 :         break;
     126                 :            : 
     127                 :            :         case SID_ATTR_ZOOMSLIDER:
     128                 :            :         {
     129                 :          0 :             const SfxItemSet* pArgs = rReq.GetArgs();
     130                 :            : 
     131 [ #  # ][ #  # ]:          0 :             if (pArgs && pArgs->Count () == 1 )
                 [ #  # ]
     132                 :            :             {
     133                 :          0 :                 SFX_REQUEST_ARG (rReq, pScale, SfxUInt16Item, SID_ATTR_ZOOMSLIDER, sal_False);
     134 [ #  # ][ #  # ]:          0 :                 if (CHECK_RANGE (5, pScale->GetValue (), 3000))
                 [ #  # ]
     135                 :            :                 {
     136                 :          0 :                     SetZoom (pScale->GetValue ());
     137                 :            : 
     138                 :          0 :                     SfxBindings& rBindings = GetViewFrame()->GetBindings();
     139                 :          0 :                     rBindings.Invalidate( SID_ATTR_ZOOM );
     140                 :          0 :                     rBindings.Invalidate( SID_ZOOM_IN );
     141                 :          0 :                     rBindings.Invalidate( SID_ZOOM_OUT );
     142                 :          0 :                     rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
     143                 :            : 
     144                 :            :                 }
     145                 :            :             }
     146                 :            : 
     147                 :          0 :             Cancel();
     148                 :          0 :             rReq.Done ();
     149                 :          0 :             break;
     150                 :            :         }
     151                 :            : 
     152                 :            :         case SID_ZOOM_OUT:
     153                 :            :         {
     154         [ #  # ]:          0 :             SetCurrentFunction( FuZoom::Create(this, GetActiveWindow(), pOlView, GetDoc(), rReq) );
     155                 :            :             // ends itself, no need for Cancel()!
     156                 :          0 :             rReq.Done();
     157                 :            :         }
     158                 :          0 :         break;
     159                 :            : 
     160                 :            :         case SID_SIZE_REAL:
     161                 :            :         {
     162         [ #  # ]:          0 :             SetZoom( 100 );
     163         [ #  # ]:          0 :             Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
     164 [ #  # ][ #  # ]:          0 :                                              GetActiveWindow()->GetOutputSizePixel()) );
                 [ #  # ]
     165         [ #  # ]:          0 :             mpZoomList->InsertZoomRect(aVisAreaWin);
     166         [ #  # ]:          0 :             Invalidate( SID_ATTR_ZOOM );
     167         [ #  # ]:          0 :             Invalidate( SID_ATTR_ZOOMSLIDER );
     168         [ #  # ]:          0 :             Cancel();
     169         [ #  # ]:          0 :             rReq.Done();
     170                 :            :         }
     171                 :          0 :         break;
     172                 :            : 
     173                 :            :         case SID_ZOOM_IN:
     174                 :            :         {
     175 [ #  # ][ #  # ]:          0 :             SetZoom( Max( (long) ( GetActiveWindow()->GetZoom() / 2 ), (long) GetActiveWindow()->GetMinZoom() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     176         [ #  # ]:          0 :             Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
     177 [ #  # ][ #  # ]:          0 :                                              GetActiveWindow()->GetOutputSizePixel()) );
                 [ #  # ]
     178         [ #  # ]:          0 :             mpZoomList->InsertZoomRect(aVisAreaWin);
     179         [ #  # ]:          0 :             Invalidate( SID_ATTR_ZOOM );
     180         [ #  # ]:          0 :             Invalidate( SID_ZOOM_OUT);
     181         [ #  # ]:          0 :             Invalidate( SID_ZOOM_IN );
     182         [ #  # ]:          0 :             Invalidate( SID_ATTR_ZOOMSLIDER );
     183         [ #  # ]:          0 :             Cancel();
     184         [ #  # ]:          0 :             rReq.Done();
     185                 :            :         }
     186                 :          0 :         break;
     187                 :            : 
     188                 :            :         case SID_OUTLINE_COLLAPSE_ALL:
     189                 :            :         {
     190                 :          0 :             pOutlinerView->CollapseAll();
     191                 :          0 :             Cancel();
     192                 :          0 :             rReq.Done();
     193                 :            :         }
     194                 :          0 :         break;
     195                 :            : 
     196                 :            :         case SID_OUTLINE_COLLAPSE:
     197                 :            :         {
     198                 :          0 :             pOutlinerView->Collapse();
     199                 :          0 :             Cancel();
     200                 :          0 :             rReq.Done();
     201                 :            :         }
     202                 :          0 :         break;
     203                 :            : 
     204                 :            :         case SID_OUTLINE_EXPAND_ALL:
     205                 :            :         {
     206                 :          0 :             pOutlinerView->ExpandAll();
     207                 :          0 :             Cancel();
     208                 :          0 :             rReq.Done();
     209                 :            :         }
     210                 :          0 :         break;
     211                 :            : 
     212                 :            :         case SID_OUTLINE_EXPAND:
     213                 :            :         {
     214                 :          0 :             pOutlinerView->Expand();
     215                 :          0 :             Cancel();
     216                 :          0 :             rReq.Done();
     217                 :            :         }
     218                 :          0 :         break;
     219                 :            : 
     220                 :            :         case SID_OUTLINE_FORMAT:
     221                 :            :         {
     222                 :          0 :             ::Outliner* pOutl = pOutlinerView->GetOutliner();
     223                 :          0 :             pOutl->SetFlatMode( !pOutl->IsFlatMode() );
     224                 :          0 :             Invalidate( SID_COLORVIEW );
     225                 :          0 :             Cancel();
     226                 :          0 :             rReq.Done();
     227                 :            :         }
     228                 :          0 :         break;
     229                 :            : 
     230                 :            :         case SID_SELECTALL:
     231                 :            :         {
     232                 :          0 :             ::Outliner* pOutl = pOlView->GetOutliner();
     233                 :          0 :             sal_uLong nParaCount = pOutl->GetParagraphCount();
     234         [ #  # ]:          0 :             if (nParaCount > 0)
     235                 :            :             {
     236                 :          0 :                 pOutlinerView->SelectRange( 0, (sal_uInt16) nParaCount );
     237                 :            :             }
     238                 :          0 :             Cancel();
     239                 :            :         }
     240                 :          0 :         break;
     241                 :            : 
     242                 :            :         case SID_PRESENTATION:
     243                 :            :         case SID_REHEARSE_TIMINGS:
     244                 :            :         {
     245         [ #  # ]:          0 :             pOlView->PrepareClose();
     246                 :            : 
     247 [ #  # ][ #  # ]:          0 :             Reference< XPresentation2 > xPresentation( GetDoc()->getPresentation() );
     248         [ #  # ]:          0 :             if( xPresentation.is() )
     249                 :            :             {
     250         [ #  # ]:          0 :                 if( ( SID_REHEARSE_TIMINGS != rReq.GetSlot() ) )
     251 [ #  # ][ #  # ]:          0 :                     xPresentation->start();
     252                 :            :                 else
     253 [ #  # ][ #  # ]:          0 :                     xPresentation->rehearseTimings();
     254                 :            :             }
     255         [ #  # ]:          0 :             rReq.Done();
     256                 :            :         }
     257                 :          0 :         break;
     258                 :            : 
     259                 :            :         case SID_COLORVIEW:
     260                 :            :         {
     261                 :          0 :             ::Outliner* pOutl = pOutlinerView->GetOutliner();
     262                 :          0 :             sal_uLong nCntrl = pOutl->GetControlWord();
     263                 :            : 
     264         [ #  # ]:          0 :             if ( !(nCntrl & EE_CNTRL_NOCOLORS) )
     265                 :            :             {
     266                 :            :                 // color view is enabled: disable
     267                 :          0 :                 pOutl->SetControlWord(nCntrl | EE_CNTRL_NOCOLORS);
     268                 :            :             }
     269                 :            :             else
     270                 :            :             {
     271                 :            :                 // color view is disabled: enable
     272                 :          0 :                 pOutl->SetControlWord(nCntrl & ~EE_CNTRL_NOCOLORS);
     273                 :            :             }
     274                 :            : 
     275                 :          0 :             InvalidateWindows();
     276                 :          0 :             Invalidate( SID_COLORVIEW );
     277                 :          0 :             Cancel();
     278                 :          0 :             rReq.Done();
     279                 :            :         }
     280                 :          0 :         break;
     281                 :            : 
     282                 :            :         case SID_STYLE_EDIT:
     283                 :            :         case SID_STYLE_UPDATE_BY_EXAMPLE:
     284                 :            :         {
     285         [ #  # ]:          0 :             if( rReq.GetArgs() )
     286                 :            :             {
     287         [ #  # ]:          0 :                 SetCurrentFunction( FuTemplate::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
     288                 :          0 :                 Cancel();
     289                 :            :             }
     290                 :            : 
     291                 :          0 :             rReq.Ignore ();
     292                 :            :         }
     293                 :          0 :         break;
     294                 :            : 
     295                 :            :         case SID_PRESENTATION_DLG:
     296                 :            :         {
     297         [ #  # ]:          0 :             SetCurrentFunction( FuSlideShowDlg::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
     298                 :          0 :             Cancel();
     299                 :            :         }
     300                 :          0 :         break;
     301                 :            : 
     302                 :            :         case SID_CUSTOMSHOW_DLG:
     303                 :            :         {
     304         [ #  # ]:          0 :             SetCurrentFunction( FuCustomShowDlg::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
     305                 :          0 :             Cancel();
     306                 :            :         }
     307                 :          0 :         break;
     308                 :            :     }
     309                 :            : 
     310         [ #  # ]:          0 :     if(HasCurrentFunction())
     311         [ #  # ]:          0 :         GetCurrentFunction()->Activate();
     312                 :            : 
     313                 :          0 :     Invalidate( SID_OUTLINE_COLLAPSE_ALL );
     314                 :          0 :     Invalidate( SID_OUTLINE_COLLAPSE );
     315                 :          0 :     Invalidate( SID_OUTLINE_EXPAND_ALL );
     316                 :          0 :     Invalidate( SID_OUTLINE_EXPAND );
     317                 :            : 
     318                 :          0 :     SfxBindings& rBindings = GetViewFrame()->GetBindings();
     319                 :          0 :     rBindings.Invalidate( SID_OUTLINE_LEFT );
     320                 :          0 :     rBindings.Invalidate( SID_OUTLINE_RIGHT );
     321                 :          0 :     rBindings.Invalidate( SID_OUTLINE_UP );
     322                 :          0 :     rBindings.Invalidate( SID_OUTLINE_DOWN );
     323                 :            : 
     324                 :          0 :     Invalidate( SID_OUTLINE_FORMAT );
     325                 :          0 :     Invalidate( SID_COLORVIEW );
     326                 :          0 :     Invalidate(SID_CUT);
     327                 :          0 :     Invalidate(SID_COPY);
     328                 :          0 :     Invalidate(SID_PASTE);
     329                 :          0 : }
     330                 :            : 
     331                 :          0 : void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq)
     332                 :            : {
     333         [ #  # ]:          0 :     OutlineViewModelChangeGuard aGuard( *pOlView );
     334                 :            : 
     335         [ #  # ]:          0 :     DeactivateCurrentFunction();
     336                 :            : 
     337 [ #  # ][ #  # ]:          0 :     OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() );
     338                 :          0 :     sal_uInt16 nSId = rReq.GetSlot();
     339                 :            : 
     340   [ #  #  #  #  :          0 :     switch( nSId )
          #  #  #  #  #  
             #  #  #  # ]
     341                 :            :     {
     342                 :            :         case SID_HYPERLINK_SETLINK:
     343                 :            :         {
     344                 :          0 :             const SfxItemSet* pReqArgs = rReq.GetArgs();
     345                 :            : 
     346         [ #  # ]:          0 :             if (pReqArgs)
     347                 :            :             {
     348                 :            :                 SvxHyperlinkItem* pHLItem =
     349         [ #  # ]:          0 :                 (SvxHyperlinkItem*) &pReqArgs->Get(SID_HYPERLINK_SETLINK);
     350                 :            : 
     351                 :          0 :                 SvxFieldItem aURLItem(SvxURLField(pHLItem->GetURL(),
     352                 :          0 :                                                   pHLItem->GetName(),
     353 [ #  # ][ #  # ]:          0 :                                                   SVXURLFORMAT_REPR), EE_FEATURE_FIELD);
                 [ #  # ]
           [ #  #  #  # ]
     354         [ #  # ]:          0 :                 ESelection aSel( pOutlinerView->GetSelection() );
     355         [ #  # ]:          0 :                 pOutlinerView->InsertField(aURLItem);
     356         [ #  # ]:          0 :                 if ( aSel.nStartPos <= aSel.nEndPos )
     357                 :          0 :                     aSel.nEndPos = aSel.nStartPos + 1;
     358                 :            :                 else
     359                 :          0 :                     aSel.nStartPos = aSel.nEndPos + 1;
     360 [ #  # ][ #  # ]:          0 :                 pOutlinerView->SetSelection( aSel );
     361                 :            :             }
     362                 :            : 
     363         [ #  # ]:          0 :             Cancel();
     364         [ #  # ]:          0 :             rReq.Ignore ();
     365                 :            :         }
     366                 :          0 :         break;
     367                 :            : 
     368                 :            :         case FN_INSERT_SOFT_HYPHEN:
     369                 :            :         case FN_INSERT_HARDHYPHEN:
     370                 :            :         case FN_INSERT_HARD_SPACE:
     371                 :            :         case SID_INSERT_RLM :
     372                 :            :         case SID_INSERT_LRM :
     373                 :            :         case SID_INSERT_ZWNBSP :
     374                 :            :         case SID_INSERT_ZWSP:
     375                 :            :         case SID_CHARMAP:
     376                 :            :         {
     377 [ #  # ][ #  # ]:          0 :             SetCurrentFunction( FuBullet::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     378         [ #  # ]:          0 :             Cancel();
     379                 :            :         }
     380                 :          0 :         break;
     381                 :            : 
     382                 :            :         case SID_OUTLINE_BULLET:
     383                 :            :         {
     384 [ #  # ][ #  # ]:          0 :             SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     385         [ #  # ]:          0 :             Cancel();
     386                 :            :         }
     387                 :          0 :         break;
     388                 :            : 
     389                 :            :         case SID_THESAURUS:
     390                 :            :         {
     391 [ #  # ][ #  # ]:          0 :             SetCurrentFunction( FuThesaurus::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     392         [ #  # ]:          0 :             Cancel();
     393         [ #  # ]:          0 :             rReq.Ignore ();
     394                 :            :         }
     395                 :          0 :         break;
     396                 :            : 
     397                 :            :         case SID_CHAR_DLG:
     398                 :            :         {
     399 [ #  # ][ #  # ]:          0 :             SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     400         [ #  # ]:          0 :             Cancel();
     401                 :            :         }
     402                 :          0 :         break;
     403                 :            : 
     404                 :            :         case SID_INSERTFILE:
     405                 :            :         {
     406 [ #  # ][ #  # ]:          0 :             SetCurrentFunction( FuInsertFile::Create(this, GetActiveWindow(), pOlView, GetDoc(), rReq) );
         [ #  # ][ #  # ]
                 [ #  # ]
     407         [ #  # ]:          0 :             Cancel();
     408                 :            :         }
     409                 :          0 :         break;
     410                 :            : 
     411                 :            :         case SID_PRESENTATIONOBJECT:
     412                 :            :         {
     413 [ #  # ][ #  # ]:          0 :             SetCurrentFunction( FuPresentationObjects::Create(this, GetActiveWindow(), pOlView, GetDoc(), rReq) );
         [ #  # ][ #  # ]
                 [ #  # ]
     414         [ #  # ]:          0 :             Cancel();
     415                 :            :         }
     416                 :          0 :         break;
     417                 :            : 
     418                 :            :         case SID_SET_DEFAULT:
     419                 :            :         {
     420         [ #  # ]:          0 :             pOutlinerView->RemoveAttribs(sal_True); // sal_True = also paragraph attributes
     421         [ #  # ]:          0 :             Cancel();
     422         [ #  # ]:          0 :             rReq.Done();
     423                 :            :         }
     424                 :          0 :         break;
     425                 :            : 
     426                 :            :         case SID_SUMMARY_PAGE:
     427                 :            :         {
     428         [ #  # ]:          0 :             pOlView->SetSelectedPages();
     429 [ #  # ][ #  # ]:          0 :             SetCurrentFunction( FuSummaryPage::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     430         [ #  # ]:          0 :             pOlView->GetOutliner()->Clear();
     431         [ #  # ]:          0 :             pOlView->FillOutliner();
     432         [ #  # ]:          0 :             pOlView->GetActualPage();
     433         [ #  # ]:          0 :             Cancel();
     434                 :            :         }
     435                 :          0 :         break;
     436                 :            : 
     437                 :            :         case SID_EXPAND_PAGE:
     438                 :            :         {
     439         [ #  # ]:          0 :             pOlView->SetSelectedPages();
     440 [ #  # ][ #  # ]:          0 :             SetCurrentFunction( FuExpandPage::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     441         [ #  # ]:          0 :             pOlView->GetOutliner()->Clear();
     442         [ #  # ]:          0 :             pOlView->FillOutliner();
     443         [ #  # ]:          0 :             pOlView->GetActualPage();
     444         [ #  # ]:          0 :             Cancel();
     445                 :            :         }
     446                 :          0 :         break;
     447                 :            : 
     448                 :            :         case SID_INSERT_FLD_DATE_FIX:
     449                 :            :         case SID_INSERT_FLD_DATE_VAR:
     450                 :            :         case SID_INSERT_FLD_TIME_FIX:
     451                 :            :         case SID_INSERT_FLD_TIME_VAR:
     452                 :            :         case SID_INSERT_FLD_AUTHOR:
     453                 :            :         case SID_INSERT_FLD_PAGE:
     454                 :            :         case SID_INSERT_FLD_PAGES:
     455                 :            :         case SID_INSERT_FLD_FILE:
     456                 :            :         {
     457                 :          0 :             SvxFieldItem* pFieldItem = 0;
     458                 :            : 
     459   [ #  #  #  #  :          0 :             switch( nSId )
             #  #  #  #  
                      # ]
     460                 :            :             {
     461                 :            :                 case SID_INSERT_FLD_DATE_FIX:
     462                 :            :                     pFieldItem = new SvxFieldItem(
     463 [ #  # ][ #  # ]:          0 :                         SvxDateField( Date( Date::SYSTEM ), SVXDATETYPE_FIX ), EE_FEATURE_FIELD );
         [ #  # ][ #  # ]
                 [ #  # ]
     464                 :          0 :                 break;
     465                 :            : 
     466                 :            :                 case SID_INSERT_FLD_DATE_VAR:
     467 [ #  # ][ #  # ]:          0 :                     pFieldItem = new SvxFieldItem( SvxDateField(), EE_FEATURE_FIELD );
         [ #  # ][ #  # ]
     468                 :          0 :                 break;
     469                 :            : 
     470                 :            :                 case SID_INSERT_FLD_TIME_FIX:
     471                 :            :                     pFieldItem = new SvxFieldItem(
     472 [ #  # ][ #  # ]:          0 :                         SvxExtTimeField( Time( Time::SYSTEM ), SVXTIMETYPE_FIX ), EE_FEATURE_FIELD );
         [ #  # ][ #  # ]
                 [ #  # ]
     473                 :          0 :                 break;
     474                 :            : 
     475                 :            :                 case SID_INSERT_FLD_TIME_VAR:
     476 [ #  # ][ #  # ]:          0 :                     pFieldItem = new SvxFieldItem( SvxExtTimeField(), EE_FEATURE_FIELD );
         [ #  # ][ #  # ]
     477                 :          0 :                 break;
     478                 :            : 
     479                 :            :                 case SID_INSERT_FLD_AUTHOR:
     480                 :            :                 {
     481         [ #  # ]:          0 :                     SvtUserOptions aUserOptions;
     482                 :            :                     pFieldItem = new SvxFieldItem(
     483                 :            :                             SvxAuthorField(
     484                 :            :                                 aUserOptions.GetFirstName(), aUserOptions.GetLastName(), aUserOptions.GetID() )
     485 [ #  # ][ #  # ]:          0 :                                 , EE_FEATURE_FIELD );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     486                 :            :                 }
     487                 :          0 :                 break;
     488                 :            : 
     489                 :            :                 case SID_INSERT_FLD_PAGE:
     490 [ #  # ][ #  # ]:          0 :                     pFieldItem = new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD );
         [ #  # ][ #  # ]
     491                 :          0 :                 break;
     492                 :            : 
     493                 :            :                 case SID_INSERT_FLD_PAGES:
     494 [ #  # ][ #  # ]:          0 :                     pFieldItem = new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD );
         [ #  # ][ #  # ]
     495                 :          0 :                 break;
     496                 :            : 
     497                 :            :                 case SID_INSERT_FLD_FILE:
     498                 :            :                 {
     499         [ #  # ]:          0 :                     String aName;
     500 [ #  # ][ #  # ]:          0 :                     if( GetDocSh()->HasName() )
     501 [ #  # ][ #  # ]:          0 :                         aName = GetDocSh()->GetMedium()->GetName();
                 [ #  # ]
     502                 :            :                     //else
     503                 :            :                     //  aName = GetDocSh()->GetName();
     504 [ #  # ][ #  # ]:          0 :                     pFieldItem = new SvxFieldItem( SvxExtFileField( aName ), EE_FEATURE_FIELD );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     505                 :            :                 }
     506                 :          0 :                 break;
     507                 :            :             }
     508                 :            : 
     509         [ #  # ]:          0 :             const SvxFieldItem* pOldFldItem = pOutlinerView->GetFieldAtSelection();
     510                 :            : 
     511 [ #  # ][ #  # ]:          0 :             if( pOldFldItem && ( pOldFldItem->GetField()->ISA( SvxURLField ) ||
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     512 [ #  # ][ #  # ]:          0 :                                 pOldFldItem->GetField()->ISA( SvxDateField ) ||
     513 [ #  # ][ #  # ]:          0 :                                 pOldFldItem->GetField()->ISA( SvxTimeField ) ||
     514 [ #  # ][ #  # ]:          0 :                                 pOldFldItem->GetField()->ISA( SvxExtTimeField ) ||
     515 [ #  # ][ #  # ]:          0 :                                 pOldFldItem->GetField()->ISA( SvxExtFileField ) ||
     516 [ #  # ][ #  # ]:          0 :                                 pOldFldItem->GetField()->ISA( SvxAuthorField ) ||
     517 [ #  # ][ #  # ]:          0 :                                 pOldFldItem->GetField()->ISA( SvxPageField ) ||
     518 [ #  # ][ #  # ]:          0 :                                 pOldFldItem->GetField()->ISA( SvxPagesField )) )
     519                 :            :             {
     520                 :            :                 // select field, so it gets deleted on Insert
     521         [ #  # ]:          0 :                 ESelection aSel = pOutlinerView->GetSelection();
     522         [ #  # ]:          0 :                 if( aSel.nStartPos == aSel.nEndPos )
     523                 :          0 :                     aSel.nEndPos++;
     524         [ #  # ]:          0 :                 pOutlinerView->SetSelection( aSel );
     525                 :            :             }
     526                 :            : 
     527         [ #  # ]:          0 :             if( pFieldItem )
     528         [ #  # ]:          0 :                 pOutlinerView->InsertField( *pFieldItem );
     529                 :            : 
     530 [ #  # ][ #  # ]:          0 :             delete pFieldItem;
     531                 :            : 
     532         [ #  # ]:          0 :             Cancel();
     533         [ #  # ]:          0 :             rReq.Ignore ();
     534                 :            :         }
     535                 :          0 :         break;
     536                 :            : 
     537                 :            :         case SID_MODIFY_FIELD:
     538                 :            :         {
     539         [ #  # ]:          0 :             const SvxFieldItem* pFldItem = pOutlinerView->GetFieldAtSelection();
     540                 :            : 
     541 [ #  # ][ #  # ]:          0 :             if( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) ||
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     542 [ #  # ][ #  # ]:          0 :                                 pFldItem->GetField()->ISA( SvxAuthorField ) ||
     543 [ #  # ][ #  # ]:          0 :                                 pFldItem->GetField()->ISA( SvxExtFileField ) ||
     544 [ #  # ][ #  # ]:          0 :                                 pFldItem->GetField()->ISA( SvxExtTimeField ) ) )
     545                 :            :             {
     546                 :            :                 // Dialog...
     547         [ #  # ]:          0 :                 SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
     548 [ #  # ][ #  # ]:          0 :                 AbstractSdModifyFieldDlg* pDlg = pFact ? pFact->CreateSdModifyFieldDlg(GetActiveWindow(), pFldItem->GetField(), pOutlinerView->GetAttribs() ) : 0;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     549 [ #  # ][ #  # ]:          0 :                 if( pDlg && (pDlg->Execute() == RET_OK) )
         [ #  # ][ #  # ]
     550                 :            :                 {
     551         [ #  # ]:          0 :                     SvxFieldData* pField = pDlg->GetField();
     552         [ #  # ]:          0 :                     if( pField )
     553                 :            :                     {
     554         [ #  # ]:          0 :                         SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD );
     555                 :            :                         //pOLV->DeleteSelected(); <-- unfortunately missing!
     556                 :            :                         // select field, so it gets deleted on Insert
     557         [ #  # ]:          0 :                         ESelection aSel = pOutlinerView->GetSelection();
     558                 :          0 :                         sal_Bool bSel = sal_True;
     559         [ #  # ]:          0 :                         if( aSel.nStartPos == aSel.nEndPos )
     560                 :            :                         {
     561                 :          0 :                             bSel = sal_False;
     562                 :          0 :                             aSel.nEndPos++;
     563                 :            :                         }
     564         [ #  # ]:          0 :                         pOutlinerView->SetSelection( aSel );
     565                 :            : 
     566         [ #  # ]:          0 :                         pOutlinerView->InsertField( aFieldItem );
     567                 :            : 
     568                 :            :                         // reset selection to original state
     569         [ #  # ]:          0 :                         if( !bSel )
     570                 :          0 :                             aSel.nEndPos--;
     571         [ #  # ]:          0 :                         pOutlinerView->SetSelection( aSel );
     572                 :            : 
     573 [ #  # ][ #  # ]:          0 :                         delete pField;
                 [ #  # ]
     574                 :            :                     }
     575                 :            : 
     576         [ #  # ]:          0 :                     SfxItemSet aSet( pDlg->GetItemSet() );
     577         [ #  # ]:          0 :                     if( aSet.Count() )
     578                 :            :                     {
     579         [ #  # ]:          0 :                         pOutlinerView->SetAttribs( aSet );
     580                 :            : 
     581                 :          0 :                         ::Outliner* pOutliner = pOutlinerView->GetOutliner();
     582         [ #  # ]:          0 :                         if( pOutliner )
     583         [ #  # ]:          0 :                             pOutliner->UpdateFields();
     584         [ #  # ]:          0 :                     }
     585                 :            :                 }
     586 [ #  # ][ #  # ]:          0 :                 delete pDlg;
     587                 :            :             }
     588                 :            : 
     589         [ #  # ]:          0 :             Cancel();
     590         [ #  # ]:          0 :             rReq.Ignore ();
     591                 :            :         }
     592                 :          0 :         break;
     593                 :            :     }
     594                 :            : 
     595 [ #  # ][ #  # ]:          0 :     if(HasCurrentFunction())
     596 [ #  # ][ #  # ]:          0 :         GetCurrentFunction()->Activate();
                 [ #  # ]
     597                 :            : 
     598         [ #  # ]:          0 :     Invalidate( SID_OUTLINE_COLLAPSE_ALL );
     599         [ #  # ]:          0 :     Invalidate( SID_OUTLINE_COLLAPSE );
     600         [ #  # ]:          0 :     Invalidate( SID_OUTLINE_EXPAND_ALL );
     601         [ #  # ]:          0 :     Invalidate( SID_OUTLINE_EXPAND );
     602                 :            : 
     603         [ #  # ]:          0 :     SfxBindings& rBindings = GetViewFrame()->GetBindings();
     604         [ #  # ]:          0 :     rBindings.Invalidate( SID_OUTLINE_LEFT );
     605         [ #  # ]:          0 :     rBindings.Invalidate( SID_OUTLINE_RIGHT );
     606         [ #  # ]:          0 :     rBindings.Invalidate( SID_OUTLINE_UP );
     607         [ #  # ]:          0 :     rBindings.Invalidate( SID_OUTLINE_DOWN );
     608                 :            : 
     609         [ #  # ]:          0 :     Invalidate( SID_OUTLINE_FORMAT );
     610         [ #  # ]:          0 :     Invalidate( SID_COLORVIEW );
     611         [ #  # ]:          0 :     Invalidate(SID_CUT);
     612         [ #  # ]:          0 :     Invalidate(SID_COPY);
     613 [ #  # ][ #  # ]:          0 :     Invalidate(SID_PASTE);
     614                 :          0 : }
     615                 :            : 
     616                 :            : 
     617                 :            : } // end of namespace sd
     618                 :            : 
     619                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10