LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sd/source/ui/view - outlnvs2.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 302 0.3 %
Date: 2013-07-09 Functions: 2 5 40.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10