LCOV - code coverage report
Current view: top level - sd/source/ui/view - drviewsb.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 402 0.0 %
Date: 2012-08-25 Functions: 0 5 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 1058 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                 :            : #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
      30                 :            : #include <comphelper/processfactory.hxx>
      31                 :            : #include <svx/svdlayer.hxx>
      32                 :            : #include <svx/svxids.hrc>
      33                 :            : #include <sfx2/msgpool.hxx>
      34                 :            : #include <sfx2/viewfrm.hxx>
      35                 :            : #include <svx/hlnkitem.hxx>
      36                 :            : #include <editeng/eeitem.hxx>
      37                 :            : #include <editeng/flditem.hxx>
      38                 :            : #include <vcl/msgbox.hxx>
      39                 :            : #include <sfx2/request.hxx>
      40                 :            : #include <sfx2/dispatch.hxx>
      41                 :            : #include <svx/svdorect.hxx>
      42                 :            : #include <sfx2/docfile.hxx>
      43                 :            : #include <basic/sbstar.hxx>
      44                 :            : #include <basic/sberrors.hxx>
      45                 :            : #include <svx/fmshell.hxx>
      46                 :            : #include <svx/svxdlg.hxx>
      47                 :            : #include <svx/dialogs.hrc>
      48                 :            : #include <unotools/useroptions.hxx>
      49                 :            : 
      50                 :            : #include "app.hrc"
      51                 :            : #include "strings.hrc"
      52                 :            : #include "res_bmp.hrc"
      53                 :            : #include "glob.hrc"
      54                 :            : #include "Outliner.hxx"
      55                 :            : #include "Window.hxx"
      56                 :            : #include "app.hxx"
      57                 :            : #include "sdattr.hxx"
      58                 :            : #include "drawdoc.hxx"
      59                 :            : #include "DrawDocShell.hxx"
      60                 :            : #include "sdresid.hxx"
      61                 :            : #include "sdpage.hxx"
      62                 :            : #include "DrawViewShell.hxx"
      63                 :            : #include "drawview.hxx"
      64                 :            : #include "unmodpg.hxx"
      65                 :            : #include "undolayer.hxx"
      66                 :            : #include "ViewShellBase.hxx"
      67                 :            : #include "FormShellManager.hxx"
      68                 :            : #include "LayerTabBar.hxx"
      69                 :            : #include "sdabstdlg.hxx"
      70                 :            : #include "SlideSorterViewShell.hxx"
      71                 :            : #include "SlideSorter.hxx"
      72                 :            : #include "controller/SlideSorterController.hxx"
      73                 :            : 
      74                 :            : namespace sd {
      75                 :            : 
      76                 :            : /*************************************************************************
      77                 :            : |*
      78                 :            : |* SfxRequests fuer temporaere Funktionen
      79                 :            : |*
      80                 :            : \************************************************************************/
      81                 :            : 
      82                 :          0 : void DrawViewShell::FuTemp02(SfxRequest& rReq)
      83                 :            : {
      84                 :          0 :     sal_uInt16 nSId = rReq.GetSlot();
      85   [ #  #  #  #  :          0 :     switch( nSId )
          #  #  #  #  #  
                      # ]
      86                 :            :     {
      87                 :            :         case SID_INSERTLAYER:
      88                 :            :         {
      89 [ #  # ][ #  # ]:          0 :             if ( mpDrawView->IsTextEdit() )
      90                 :            :             {
      91         [ #  # ]:          0 :                 mpDrawView->SdrEndTextEdit();
      92                 :            :             }
      93                 :            : 
      94         [ #  # ]:          0 :             SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
      95                 :          0 :             sal_uInt16 nLayerCnt = rLayerAdmin.GetLayerCount();
      96                 :          0 :             sal_uInt16 nLayer = nLayerCnt - 2 + 1;
      97 [ #  # ][ #  # ]:          0 :             String aLayerName ( SdResId(STR_LAYER) ), aLayerTitle, aLayerDesc;
         [ #  # ][ #  # ]
      98 [ #  # ][ #  # ]:          0 :             aLayerName += String::CreateFromInt32( (sal_Int32)nLayer );
                 [ #  # ]
      99                 :          0 :             sal_Bool bIsVisible = sal_False;
     100                 :          0 :             sal_Bool bIsLocked = sal_False;
     101                 :          0 :             sal_Bool bIsPrintable = sal_False;
     102                 :            : 
     103                 :          0 :             const SfxItemSet* pArgs = rReq.GetArgs();
     104                 :            : 
     105         [ #  # ]:          0 :             if (! pArgs)
     106                 :            :             {
     107 [ #  # ][ #  # ]:          0 :                 SfxItemSet aNewAttr( GetDoc()->GetPool(), ATTR_LAYER_START, ATTR_LAYER_END );
     108                 :            : 
     109 [ #  # ][ #  # ]:          0 :                 aNewAttr.Put( SdAttrLayerName( aLayerName ) );
                 [ #  # ]
     110 [ #  # ][ #  # ]:          0 :                 aNewAttr.Put( SdAttrLayerTitle() );
                 [ #  # ]
     111 [ #  # ][ #  # ]:          0 :                 aNewAttr.Put( SdAttrLayerDesc() );
                 [ #  # ]
     112 [ #  # ][ #  # ]:          0 :                 aNewAttr.Put( SdAttrLayerVisible() );
                 [ #  # ]
     113 [ #  # ][ #  # ]:          0 :                 aNewAttr.Put( SdAttrLayerPrintable() );
                 [ #  # ]
     114 [ #  # ][ #  # ]:          0 :                 aNewAttr.Put( SdAttrLayerLocked() );
                 [ #  # ]
     115 [ #  # ][ #  # ]:          0 :                 aNewAttr.Put( SdAttrLayerThisPage() );
                 [ #  # ]
     116                 :            : 
     117         [ #  # ]:          0 :                 SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
     118 [ #  # ][ #  # ]:          0 :                 AbstractSdInsertLayerDlg* pDlg = pFact ? pFact->CreateSdInsertLayerDlg(NULL, aNewAttr, true, String( SdResId( STR_INSERTLAYER ) ) ) : 0;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     119         [ #  # ]:          0 :                 if( pDlg )
     120                 :            :                 {
     121 [ #  # ][ #  # ]:          0 :                     pDlg->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_INSERTLAYER )->GetCommand() );
         [ #  # ][ #  # ]
                 [ #  # ]
     122                 :            : 
     123                 :            :                     // Ueberpruefung auf schon vorhandene Namen
     124                 :          0 :                     sal_Bool bLoop = sal_True;
     125 [ #  # ][ #  # ]:          0 :                     while( bLoop && pDlg->Execute() == RET_OK )
         [ #  # ][ #  # ]
     126                 :            :                     {
     127         [ #  # ]:          0 :                         pDlg->GetAttr( aNewAttr );
     128 [ #  # ][ #  # ]:          0 :                         aLayerName   = ((SdAttrLayerName &) aNewAttr.Get (ATTR_LAYER_NAME)).GetValue ();
     129                 :            : 
     130         [ #  # ]:          0 :                         if( rLayerAdmin.GetLayer( aLayerName, sal_False )
           [ #  #  #  # ]
                 [ #  # ]
     131                 :          0 :                             || aLayerName.Len()==0 )
     132                 :            :                         {
     133                 :            :                             // Name ist schon vorhanden
     134                 :            :                             WarningBox aWarningBox (
     135                 :            :                                 GetParentWindow(),
     136                 :            :                                 WinBits( WB_OK ),
     137 [ #  # ][ #  # ]:          0 :                                 String(SdResId( STR_WARN_NAME_DUPLICATE)));
         [ #  # ][ #  # ]
     138 [ #  # ][ #  # ]:          0 :                             aWarningBox.Execute();
     139                 :            :                         }
     140                 :            :                         else
     141                 :          0 :                             bLoop = sal_False;
     142                 :            :                     }
     143         [ #  # ]:          0 :                     if( bLoop ) // wurde abgebrochen
     144                 :            :                     {
     145 [ #  # ][ #  # ]:          0 :                         delete pDlg;
     146                 :            : 
     147         [ #  # ]:          0 :                         Cancel();
     148         [ #  # ]:          0 :                         rReq.Ignore ();
     149                 :            :                         break;
     150                 :            :                     }
     151                 :            :                     else
     152                 :            :                     {
     153 [ #  # ][ #  # ]:          0 :                         aLayerTitle  = ((SdAttrLayerTitle &) aNewAttr.Get (ATTR_LAYER_TITLE)).GetValue ();
     154 [ #  # ][ #  # ]:          0 :                         aLayerDesc   = ((SdAttrLayerDesc &) aNewAttr.Get (ATTR_LAYER_DESC)).GetValue ();
     155         [ #  # ]:          0 :                         bIsVisible   = ((SdAttrLayerVisible &) aNewAttr.Get (ATTR_LAYER_VISIBLE)).GetValue ();
     156         [ #  # ]:          0 :                         bIsLocked    = ((SdAttrLayerLocked &) aNewAttr.Get (ATTR_LAYER_LOCKED)).GetValue () ;
     157         [ #  # ]:          0 :                         bIsPrintable = ((SdAttrLayerPrintable &) aNewAttr.Get (ATTR_LAYER_PRINTABLE)).GetValue () ;
     158                 :            : 
     159 [ #  # ][ #  # ]:          0 :                         delete pDlg;
     160                 :            :                     }
     161 [ #  # ][ #  # ]:          0 :                 }
     162                 :            :             }
     163         [ #  # ]:          0 :             else if (pArgs->Count () != 4)
     164                 :            :                  {
     165                 :            : #ifndef DISABLE_SCRIPTING
     166         [ #  # ]:          0 :                      StarBASIC::FatalError (SbERR_WRONG_ARGS);
     167                 :            : #endif
     168         [ #  # ]:          0 :                      Cancel();
     169         [ #  # ]:          0 :                      rReq.Ignore ();
     170                 :            :                      break;
     171                 :            :                  }
     172                 :            :                  else
     173                 :            :                  {
     174 [ #  # ][ #  # ]:          0 :                      SFX_REQUEST_ARG (rReq, pLayerName, SfxStringItem, ID_VAL_LAYERNAME, sal_False);
     175 [ #  # ][ #  # ]:          0 :                      SFX_REQUEST_ARG (rReq, pIsVisible, SfxBoolItem, ID_VAL_ISVISIBLE, sal_False);
     176 [ #  # ][ #  # ]:          0 :                      SFX_REQUEST_ARG (rReq, pIsLocked, SfxBoolItem, ID_VAL_ISLOCKED, sal_False);
     177 [ #  # ][ #  # ]:          0 :                      SFX_REQUEST_ARG (rReq, pIsPrintable, SfxBoolItem, ID_VAL_ISPRINTABLE, sal_False);
     178                 :            : 
     179         [ #  # ]:          0 :                      aLayerName   = pLayerName->GetValue ();
     180                 :          0 :                      bIsVisible   = pIsVisible->GetValue ();
     181                 :          0 :                      bIsLocked    = pIsLocked->GetValue ();
     182                 :          0 :                      bIsPrintable = pIsPrintable->GetValue ();
     183                 :            :                  }
     184                 :            : 
     185         [ #  # ]:          0 :             String aPrevLayer = mpDrawView->GetActiveLayer();
     186         [ #  # ]:          0 :             String aName;
     187                 :            :             SdrLayer* pLayer;
     188                 :          0 :             sal_uInt16 nPrevLayer = 0;
     189                 :          0 :             nLayerCnt = rLayerAdmin.GetLayerCount();
     190                 :            : 
     191         [ #  # ]:          0 :             for ( nLayer = 0; nLayer < nLayerCnt; nLayer++ )
     192                 :            :             {
     193         [ #  # ]:          0 :                 pLayer = rLayerAdmin.GetLayer(nLayer);
     194         [ #  # ]:          0 :                 aName = pLayer->GetName();
     195                 :            : 
     196 [ #  # ][ #  # ]:          0 :                 if ( aPrevLayer == aName )
     197                 :            :                 {
     198                 :          0 :                     nPrevLayer = Max(nLayer, (sal_uInt16) 4);
     199                 :            :                 }
     200                 :            :             }
     201                 :            : 
     202         [ #  # ]:          0 :             mpDrawView->InsertNewLayer(aLayerName, nPrevLayer + 1);
     203         [ #  # ]:          0 :             pLayer = rLayerAdmin.GetLayer(aLayerName, sal_False);
     204         [ #  # ]:          0 :             if( pLayer )
     205                 :            :             {
     206         [ #  # ]:          0 :                 pLayer->SetTitle( aLayerTitle );
     207         [ #  # ]:          0 :                 pLayer->SetDescription( aLayerDesc );
     208                 :            :             }
     209                 :            : 
     210         [ #  # ]:          0 :             mpDrawView->SetLayerVisible( aLayerName, bIsVisible );
     211         [ #  # ]:          0 :             mpDrawView->SetLayerLocked( aLayerName, bIsLocked);
     212         [ #  # ]:          0 :             mpDrawView->SetLayerPrintable(aLayerName, bIsPrintable);
     213                 :            : 
     214         [ #  # ]:          0 :             mpDrawView->SetActiveLayer(aLayerName);
     215                 :            : 
     216         [ #  # ]:          0 :             ResetActualLayer();
     217                 :            : 
     218 [ #  # ][ #  # ]:          0 :             GetDoc()->SetChanged(sal_True);
     219                 :            : 
     220                 :            :             GetViewFrame()->GetDispatcher()->Execute(SID_SWITCHLAYER,
     221 [ #  # ][ #  # ]:          0 :                     SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
     222                 :            : 
     223         [ #  # ]:          0 :             Cancel();
     224 [ #  # ][ #  # ]:          0 :             rReq.Done ();
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     225                 :            :         }
     226                 :          0 :         break;
     227                 :            : 
     228                 :            :         case SID_MODIFYLAYER:
     229                 :            :         {
     230 [ #  # ][ #  # ]:          0 :             if ( mpDrawView->IsTextEdit() )
     231                 :            :             {
     232         [ #  # ]:          0 :                 mpDrawView->SdrEndTextEdit();
     233                 :            :             }
     234                 :            : 
     235         [ #  # ]:          0 :             SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
     236         [ #  # ]:          0 :             sal_uInt16 nCurPage = GetLayerTabControl()->GetCurPageId();
     237 [ #  # ][ #  # ]:          0 :             String aLayerName( GetLayerTabControl()->GetPageText(nCurPage) );
     238         [ #  # ]:          0 :             SdrLayer* pLayer = rLayerAdmin.GetLayer(aLayerName, sal_False);
     239                 :            : 
     240         [ #  # ]:          0 :             String aLayerTitle( pLayer->GetTitle() );
     241         [ #  # ]:          0 :             String aLayerDesc( pLayer->GetDescription() );
     242                 :            : 
     243         [ #  # ]:          0 :             String aOldLayerName( aLayerName );
     244         [ #  # ]:          0 :             String aOldLayerTitle( aLayerTitle );
     245         [ #  # ]:          0 :             String aOldLayerDesc( aLayerDesc );
     246                 :            : 
     247                 :            :             sal_Bool bIsVisible, bIsLocked, bIsPrintable;
     248         [ #  # ]:          0 :             sal_Bool bOldIsVisible = bIsVisible = mpDrawView->IsLayerVisible(aLayerName);
     249         [ #  # ]:          0 :             sal_Bool bOldIsLocked = bIsLocked = mpDrawView->IsLayerLocked(aLayerName);
     250         [ #  # ]:          0 :             sal_Bool bOldIsPrintable = bIsPrintable = mpDrawView->IsLayerPrintable(aLayerName);
     251                 :            : 
     252                 :            : 
     253                 :          0 :             const SfxItemSet* pArgs = rReq.GetArgs();
     254                 :            :             // darf der Layer geloescht werden ?
     255                 :          0 :             bool bDelete = true;
     256                 :            : 
     257 [ #  # ][ #  # ]:          0 :             String aLayoutLayer ( SdResId(STR_LAYER_LAYOUT) );
     258 [ #  # ][ #  # ]:          0 :             String aControlsLayer ( SdResId(STR_LAYER_CONTROLS) );
     259 [ #  # ][ #  # ]:          0 :             String aMeasureLinesLayer ( SdResId(STR_LAYER_MEASURELINES) );
     260 [ #  # ][ #  # ]:          0 :             String aBackgroundLayer( SdResId(STR_LAYER_BCKGRND) );
     261 [ #  # ][ #  # ]:          0 :             String aBackgroundObjLayer( SdResId(STR_LAYER_BCKGRNDOBJ) );
     262                 :            : 
     263 [ #  # ][ #  # ]:          0 :             if( aLayerName == aLayoutLayer       || aLayerName == aControlsLayer ||
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     264         [ #  # ]:          0 :                 aLayerName == aMeasureLinesLayer ||
     265 [ #  # ][ #  # ]:          0 :                 aLayerName == aBackgroundLayer   || aLayerName == aBackgroundObjLayer )
     266                 :            :             {
     267                 :          0 :                 bDelete = false;
     268                 :            :             }
     269                 :            : 
     270         [ #  # ]:          0 :             if (! pArgs)
     271                 :            :             {
     272 [ #  # ][ #  # ]:          0 :                 SfxItemSet aNewAttr( GetDoc()->GetPool(), ATTR_LAYER_START, ATTR_LAYER_END );
     273                 :            : 
     274 [ #  # ][ #  # ]:          0 :                 aNewAttr.Put( SdAttrLayerName( aLayerName ) );
                 [ #  # ]
     275 [ #  # ][ #  # ]:          0 :                 aNewAttr.Put( SdAttrLayerTitle( aLayerTitle ) );
                 [ #  # ]
     276 [ #  # ][ #  # ]:          0 :                 aNewAttr.Put( SdAttrLayerDesc( aLayerDesc ) );
                 [ #  # ]
     277 [ #  # ][ #  # ]:          0 :                 aNewAttr.Put( SdAttrLayerVisible( bIsVisible ) );
                 [ #  # ]
     278 [ #  # ][ #  # ]:          0 :                 aNewAttr.Put( SdAttrLayerLocked( bIsLocked ) );
                 [ #  # ]
     279 [ #  # ][ #  # ]:          0 :                 aNewAttr.Put( SdAttrLayerPrintable( bIsPrintable ) );
                 [ #  # ]
     280 [ #  # ][ #  # ]:          0 :                 aNewAttr.Put( SdAttrLayerThisPage() );
                 [ #  # ]
     281                 :            : 
     282         [ #  # ]:          0 :                 SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
     283 [ #  # ][ #  # ]:          0 :                 AbstractSdInsertLayerDlg* pDlg = pFact ? pFact->CreateSdInsertLayerDlg(NULL, aNewAttr, bDelete, String( SdResId( STR_MODIFYLAYER ) ) ) : 0;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     284         [ #  # ]:          0 :                 if( pDlg )
     285                 :            :                 {
     286 [ #  # ][ #  # ]:          0 :                     pDlg->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_MODIFYLAYER )->GetCommand() );
         [ #  # ][ #  # ]
                 [ #  # ]
     287                 :            : 
     288                 :            :                     // Ueberpruefung auf schon vorhandene Namen
     289                 :          0 :                     sal_Bool    bLoop = sal_True;
     290                 :          0 :                     sal_uInt16  nRet = 0;
     291 [ #  # ][ #  # ]:          0 :                     while( bLoop && ( (nRet = pDlg->Execute()) == RET_OK ) )
         [ #  # ][ #  # ]
     292                 :            :                     {
     293         [ #  # ]:          0 :                         pDlg->GetAttr( aNewAttr );
     294 [ #  # ][ #  # ]:          0 :                         aLayerName   = ((SdAttrLayerName &) aNewAttr.Get (ATTR_LAYER_NAME)).GetValue ();
     295                 :            : 
     296 [ #  # ][ #  # ]:          0 :                         if( (rLayerAdmin.GetLayer( aLayerName, sal_False ) &&
           [ #  #  #  # ]
                 [ #  # ]
     297         [ #  # ]:          0 :                              aLayerName != aOldLayerName) || aLayerName.Len()==0 )
     298                 :            :                         {
     299                 :            :                             // Name ist schon vorhanden
     300                 :            :                             WarningBox aWarningBox (
     301                 :            :                                 GetParentWindow(),
     302                 :            :                                 WinBits( WB_OK ),
     303 [ #  # ][ #  # ]:          0 :                                 String( SdResId( STR_WARN_NAME_DUPLICATE)));
         [ #  # ][ #  # ]
     304 [ #  # ][ #  # ]:          0 :                             aWarningBox.Execute();
     305                 :            :                         }
     306                 :            :                         else
     307                 :          0 :                             bLoop = sal_False;
     308                 :            :                     }
     309         [ #  # ]:          0 :                     switch (nRet)
     310                 :            :                     {
     311                 :            :                         case RET_OK :
     312 [ #  # ][ #  # ]:          0 :                             aLayerTitle  = ((SdAttrLayerTitle &) aNewAttr.Get (ATTR_LAYER_TITLE)).GetValue ();
     313 [ #  # ][ #  # ]:          0 :                             aLayerDesc   = ((SdAttrLayerDesc &) aNewAttr.Get (ATTR_LAYER_DESC)).GetValue ();
     314         [ #  # ]:          0 :                             bIsVisible   = ((const SdAttrLayerVisible &) aNewAttr.Get (ATTR_LAYER_VISIBLE)).GetValue ();
     315         [ #  # ]:          0 :                             bIsLocked    = ((const SdAttrLayerLocked &) aNewAttr.Get (ATTR_LAYER_LOCKED)).GetValue ();
     316         [ #  # ]:          0 :                             bIsPrintable = ((const SdAttrLayerLocked &) aNewAttr.Get (ATTR_LAYER_PRINTABLE)).GetValue ();
     317                 :            : 
     318 [ #  # ][ #  # ]:          0 :                             delete pDlg;
     319                 :          0 :                             break;
     320                 :            : 
     321                 :            :                         default :
     322 [ #  # ][ #  # ]:          0 :                             delete pDlg;
     323         [ #  # ]:          0 :                             rReq.Ignore ();
     324         [ #  # ]:          0 :                             Cancel ();
     325                 :          0 :                             return;
     326                 :            :                     }
     327 [ #  # ][ #  # ]:          0 :                 }
     328                 :            :             }
     329         [ #  # ]:          0 :             else if (pArgs->Count () == 4)
     330                 :            :             {
     331 [ #  # ][ #  # ]:          0 :                 SFX_REQUEST_ARG (rReq, pLayerName, SfxStringItem, ID_VAL_LAYERNAME, sal_False);
     332 [ #  # ][ #  # ]:          0 :                 SFX_REQUEST_ARG (rReq, pIsVisible, SfxBoolItem, ID_VAL_ISVISIBLE, sal_False);
     333 [ #  # ][ #  # ]:          0 :                 SFX_REQUEST_ARG (rReq, pIsLocked, SfxBoolItem, ID_VAL_ISLOCKED, sal_False);
     334 [ #  # ][ #  # ]:          0 :                 SFX_REQUEST_ARG (rReq, pIsPrintable, SfxBoolItem, ID_VAL_ISPRINTABLE, sal_False);
     335                 :            : 
     336         [ #  # ]:          0 :                 aLayerName   = pLayerName->GetValue ();
     337                 :          0 :                 bIsVisible   = pIsVisible->GetValue ();
     338                 :          0 :                 bIsLocked    = pIsLocked->GetValue ();
     339                 :          0 :                 bIsPrintable = pIsPrintable->GetValue ();
     340                 :            :             }
     341                 :            :             else
     342                 :            :             {
     343                 :            : #ifndef DISABLE_SCRIPTING
     344         [ #  # ]:          0 :                 StarBASIC::FatalError (SbERR_WRONG_ARGS);
     345                 :            : #endif
     346         [ #  # ]:          0 :                 Cancel ();
     347         [ #  # ]:          0 :                 rReq.Ignore ();
     348                 :            :                 break;
     349                 :            :             }
     350                 :            : 
     351 [ #  # ][ #  # ]:          0 :             ::svl::IUndoManager* pManager = GetDoc()->GetDocSh()->GetUndoManager();
     352                 :            :             SdLayerModifyUndoAction* pAction = new SdLayerModifyUndoAction(
     353                 :          0 :                 GetDoc(),
     354                 :            :                 pLayer,
     355                 :            :                 // old values
     356                 :            :                 aOldLayerName,
     357                 :            :                 aOldLayerTitle,
     358                 :            :                 aOldLayerDesc,
     359                 :            :                 bOldIsVisible,
     360                 :            :                 bOldIsLocked,
     361                 :            :                 bOldIsPrintable,
     362                 :            :                 // new values
     363                 :            :                 aLayerName,
     364                 :            :                 aLayerTitle,
     365                 :            :                 aLayerDesc,
     366                 :            :                 bIsVisible,
     367                 :            :                 bIsLocked,
     368                 :            :                 bIsPrintable
     369 [ #  # ][ #  # ]:          0 :                 );
                 [ #  # ]
     370         [ #  # ]:          0 :             pManager->AddUndoAction( pAction );
     371                 :            : 
     372         [ #  # ]:          0 :             ModifyLayer( pLayer, aLayerName, aLayerTitle, aLayerDesc, bIsVisible, bIsLocked, bIsPrintable );
     373                 :            : 
     374         [ #  # ]:          0 :             Cancel();
     375 [ #  # ][ #  # ]:          0 :             rReq.Done ();
              [ #  #  # ]
                 [ #  # ]
              [ #  #  # ]
                 [ #  # ]
              [ #  #  # ]
                 [ #  # ]
              [ #  #  # ]
                 [ #  # ]
              [ #  #  # ]
                 [ #  # ]
              [ #  #  # ]
                 [ #  # ]
              [ #  #  # ]
                 [ #  # ]
              [ #  #  # ]
                 [ #  # ]
              [ #  #  # ]
                 [ #  # ]
              [ #  #  # ]
                 [ #  # ]
              [ #  #  # ]
     376                 :            :         }
     377                 :          0 :         break;
     378                 :            : 
     379                 :            :         case SID_RENAMELAYER:
     380                 :            :         {
     381         [ #  # ]:          0 :             if ( mpDrawView->IsTextEdit() )
     382                 :            :             {
     383                 :          0 :                 mpDrawView->SdrEndTextEdit();
     384                 :            :             }
     385                 :            : 
     386                 :          0 :             GetLayerTabControl()->StartEditMode(
     387                 :          0 :                 GetLayerTabControl()->GetCurPageId() );
     388                 :            : 
     389                 :          0 :             Cancel();
     390                 :          0 :             rReq.Ignore ();
     391                 :            :         }
     392                 :          0 :         break;
     393                 :            : 
     394                 :            :         case SID_EDIT_HYPERLINK :
     395                 :            :         {
     396                 :          0 :             GetViewFrame()->GetDispatcher()->Execute( SID_HYPERLINK_DIALOG );
     397                 :            : 
     398                 :          0 :             Cancel();
     399                 :          0 :             rReq.Done ();
     400                 :            :         }
     401                 :          0 :         break;
     402                 :            : 
     403                 :            :         case SID_OPEN_HYPERLINK:
     404                 :            :         {
     405                 :          0 :             OutlinerView* pOutView = mpDrawView->GetTextEditOutlinerView();
     406         [ #  # ]:          0 :             if ( pOutView )
     407                 :            :             {
     408                 :          0 :                 const SvxFieldItem* pFieldItem = pOutView->GetFieldAtSelection();
     409         [ #  # ]:          0 :                 if ( pFieldItem )
     410                 :            :                 {
     411                 :          0 :                     const SvxFieldData* pField = pFieldItem->GetField();
     412 [ #  # ][ #  # ]:          0 :                     if( pField && pField->ISA( SvxURLField ) )
                 [ #  # ]
     413                 :            :                     {
     414                 :          0 :                         const SvxURLField* pURLField = static_cast< const SvxURLField* >( pField );
     415                 :            : 
     416 [ #  # ][ #  # ]:          0 :                         SfxStringItem aUrl( SID_FILE_NAME, pURLField->GetURL() );
                 [ #  # ]
     417 [ #  # ][ #  # ]:          0 :                         SfxStringItem aTarget( SID_TARGETNAME, pURLField->GetTargetFrame() );
                 [ #  # ]
     418                 :            : 
     419         [ #  # ]:          0 :                         String aReferName;
     420         [ #  # ]:          0 :                         SfxViewFrame* pFrame = GetViewFrame();
     421         [ #  # ]:          0 :                         SfxMedium* pMed = pFrame->GetObjectShell()->GetMedium();
     422         [ #  # ]:          0 :                         if (pMed)
     423 [ #  # ][ #  # ]:          0 :                             aReferName = pMed->GetName();
     424                 :            : 
     425         [ #  # ]:          0 :                         SfxFrameItem aFrm( SID_DOCFRAME, pFrame );
     426         [ #  # ]:          0 :                         SfxStringItem aReferer( SID_REFERER, aReferName );
     427                 :            : 
     428         [ #  # ]:          0 :                         SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, sal_False );
     429         [ #  # ]:          0 :                         SfxBoolItem aBrowsing( SID_BROWSE, sal_True );
     430                 :            : 
     431         [ #  # ]:          0 :                         SfxViewFrame* pViewFrm = SfxViewFrame::Current();
     432         [ #  # ]:          0 :                         if (pViewFrm)
     433                 :            :                             pViewFrm->GetDispatcher()->Execute( SID_OPENDOC,
     434                 :            :                                                         SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
     435                 :            :                                                         &aUrl, &aTarget,
     436                 :            :                                                         &aFrm, &aReferer,
     437                 :            :                                                         &aNewView, &aBrowsing,
     438 [ #  # ][ #  # ]:          0 :                                                         0L );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     439                 :            :                     }
     440                 :            :                 }
     441                 :            :             }
     442                 :          0 :             Cancel();
     443                 :          0 :             rReq.Done ();
     444                 :            :         }
     445                 :          0 :         break;
     446                 :            : 
     447                 :            :         case SID_HYPERLINK_SETLINK:
     448                 :            :         {
     449                 :          0 :             const SfxItemSet* pReqArgs = rReq.GetArgs();
     450                 :            : 
     451         [ #  # ]:          0 :             if (pReqArgs)
     452                 :            :             {
     453                 :            :                 SvxHyperlinkItem* pHLItem =
     454                 :          0 :                 (SvxHyperlinkItem*) &pReqArgs->Get(SID_HYPERLINK_SETLINK);
     455                 :            : 
     456         [ #  # ]:          0 :                 if (pHLItem->GetInsertMode() == HLINK_FIELD)
     457                 :            :                 {
     458                 :          0 :                     InsertURLField(pHLItem->GetURL(), pHLItem->GetName(),
     459                 :          0 :                                    pHLItem->GetTargetFrame(), NULL);
     460                 :            :                 }
     461         [ #  # ]:          0 :                 else if (pHLItem->GetInsertMode() == HLINK_BUTTON)
     462                 :            :                 {
     463                 :          0 :                     InsertURLButton(pHLItem->GetURL(), pHLItem->GetName(),
     464                 :          0 :                                     pHLItem->GetTargetFrame(), NULL);
     465                 :            :                 }
     466         [ #  # ]:          0 :                 else if (pHLItem->GetInsertMode() == HLINK_DEFAULT)
     467                 :            :                 {
     468                 :          0 :                     OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
     469                 :            : 
     470         [ #  # ]:          0 :                     if (pOlView)
     471                 :            :                     {
     472                 :          0 :                         InsertURLField(pHLItem->GetURL(), pHLItem->GetName(),
     473                 :          0 :                                        pHLItem->GetTargetFrame(), NULL);
     474                 :            :                     }
     475                 :            :                     else
     476                 :            :                     {
     477                 :          0 :                         InsertURLButton(pHLItem->GetURL(), pHLItem->GetName(),
     478                 :          0 :                                         pHLItem->GetTargetFrame(), NULL);
     479                 :            :                     }
     480                 :            :                 }
     481                 :            :             }
     482                 :            : 
     483                 :          0 :             Cancel();
     484                 :          0 :             rReq.Ignore ();
     485                 :            :         }
     486                 :          0 :         break;
     487                 :            : 
     488                 :            :         case SID_INSERT_FLD_DATE_FIX:
     489                 :            :         case SID_INSERT_FLD_DATE_VAR:
     490                 :            :         case SID_INSERT_FLD_TIME_FIX:
     491                 :            :         case SID_INSERT_FLD_TIME_VAR:
     492                 :            :         case SID_INSERT_FLD_AUTHOR:
     493                 :            :         case SID_INSERT_FLD_PAGE:
     494                 :            :         case SID_INSERT_FLD_PAGES:
     495                 :            :         case SID_INSERT_FLD_FILE:
     496                 :            :         {
     497                 :          0 :             sal_uInt16 nMul = 1;
     498                 :          0 :             SvxFieldItem* pFieldItem = 0;
     499                 :            : 
     500   [ #  #  #  #  :          0 :             switch( nSId )
             #  #  #  #  
                      # ]
     501                 :            :             {
     502                 :            :                 case SID_INSERT_FLD_DATE_FIX:
     503                 :            :                     pFieldItem = new SvxFieldItem(
     504 [ #  # ][ #  # ]:          0 :                         SvxDateField( Date( Date::SYSTEM ), SVXDATETYPE_FIX ), EE_FEATURE_FIELD );
         [ #  # ][ #  # ]
     505                 :          0 :                 break;
     506                 :            : 
     507                 :            :                 case SID_INSERT_FLD_DATE_VAR:
     508 [ #  # ][ #  # ]:          0 :                     pFieldItem = new SvxFieldItem( SvxDateField(), EE_FEATURE_FIELD );
     509                 :          0 :                 break;
     510                 :            : 
     511                 :            :                 case SID_INSERT_FLD_TIME_FIX:
     512                 :            :                     pFieldItem = new SvxFieldItem(
     513 [ #  # ][ #  # ]:          0 :                         SvxExtTimeField( Time( Time::SYSTEM ), SVXTIMETYPE_FIX ), EE_FEATURE_FIELD );
         [ #  # ][ #  # ]
     514                 :          0 :                 break;
     515                 :            : 
     516                 :            :                 case SID_INSERT_FLD_TIME_VAR:
     517 [ #  # ][ #  # ]:          0 :                     pFieldItem = new SvxFieldItem( SvxExtTimeField(), EE_FEATURE_FIELD );
     518                 :          0 :                 break;
     519                 :            : 
     520                 :            :                 case SID_INSERT_FLD_AUTHOR:
     521                 :            :                 {
     522         [ #  # ]:          0 :                     SvtUserOptions aUserOptions;
     523                 :            :                     pFieldItem = new SvxFieldItem(
     524                 :            :                             SvxAuthorField(
     525 [ #  # ][ #  # ]:          0 :                                 aUserOptions.GetFirstName(), aUserOptions.GetLastName(), aUserOptions.GetID() ), EE_FEATURE_FIELD );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     526                 :            :                 }
     527                 :          0 :                 break;
     528                 :            : 
     529                 :            :                 case SID_INSERT_FLD_PAGE:
     530                 :            :                 {
     531 [ #  # ][ #  # ]:          0 :                     pFieldItem = new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD );
     532                 :          0 :                     nMul = 3;
     533                 :            :                 }
     534                 :          0 :                 break;
     535                 :            : 
     536                 :            :                 case SID_INSERT_FLD_PAGES:
     537                 :            :                 {
     538 [ #  # ][ #  # ]:          0 :                     pFieldItem = new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD );
     539                 :          0 :                     nMul = 3;
     540                 :            :                 }
     541                 :          0 :                 break;
     542                 :            : 
     543                 :            :                 case SID_INSERT_FLD_FILE:
     544                 :            :                 {
     545         [ #  # ]:          0 :                     String aName;
     546 [ #  # ][ #  # ]:          0 :                     if( GetDocSh()->HasName() )
     547 [ #  # ][ #  # ]:          0 :                         aName = GetDocSh()->GetMedium()->GetName();
                 [ #  # ]
     548 [ #  # ][ #  # ]:          0 :                     pFieldItem = new SvxFieldItem( SvxExtFileField( aName ), EE_FEATURE_FIELD );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     549                 :            :                 }
     550                 :          0 :                 break;
     551                 :            :             }
     552                 :            : 
     553                 :          0 :             OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
     554                 :            : 
     555         [ #  # ]:          0 :             if( pOLV )
     556                 :            :             {
     557                 :          0 :                 const SvxFieldItem* pOldFldItem = pOLV->GetFieldAtSelection();
     558                 :            : 
     559   [ #  #  #  #  :          0 :                 if( pOldFldItem && ( pOldFldItem->GetField()->ISA( SvxURLField ) ||
          #  #  #  #  #  
             #  #  #  #  
              # ][ #  # ]
                 [ #  # ]
     560                 :          0 :                                     pOldFldItem->GetField()->ISA( SvxDateField ) ||
     561                 :          0 :                                     pOldFldItem->GetField()->ISA( SvxTimeField ) ||
     562                 :          0 :                                     pOldFldItem->GetField()->ISA( SvxExtTimeField ) ||
     563                 :          0 :                                     pOldFldItem->GetField()->ISA( SvxExtFileField ) ||
     564                 :          0 :                                     pOldFldItem->GetField()->ISA( SvxAuthorField ) ||
     565                 :          0 :                                     pOldFldItem->GetField()->ISA( SvxPageField ) ) )
     566                 :            :                 {
     567                 :            :                     // Feld selektieren, so dass es beim Insert geloescht wird
     568         [ #  # ]:          0 :                     ESelection aSel = pOLV->GetSelection();
     569         [ #  # ]:          0 :                     if( aSel.nStartPos == aSel.nEndPos )
     570                 :          0 :                         aSel.nEndPos++;
     571         [ #  # ]:          0 :                     pOLV->SetSelection( aSel );
     572                 :            :                 }
     573                 :            : 
     574         [ #  # ]:          0 :                 if( pFieldItem )
     575                 :          0 :                     pOLV->InsertField( *pFieldItem );
     576                 :            :             }
     577                 :            :             else
     578                 :            :             {
     579 [ #  # ][ #  # ]:          0 :                 Outliner* pOutl = GetDoc()->GetInternalOutliner();
     580         [ #  # ]:          0 :                 pOutl->Init( OUTLINERMODE_TEXTOBJECT );
     581                 :          0 :                 sal_uInt16 nOutlMode = pOutl->GetMode();
     582         [ #  # ]:          0 :                 pOutl->SetStyleSheet( 0, NULL );
     583         [ #  # ]:          0 :                 pOutl->QuickInsertField( *pFieldItem, ESelection() );
     584         [ #  # ]:          0 :                 OutlinerParaObject* pOutlParaObject = pOutl->CreateParaObject();
     585                 :            : 
     586 [ #  # ][ #  # ]:          0 :                 SdrRectObj* pRectObj = new SdrRectObj( OBJ_TEXT );
     587 [ #  # ][ #  # ]:          0 :                 pRectObj->SetMergedItem(SdrTextAutoGrowWidthItem(sal_True));
                 [ #  # ]
     588                 :            : 
     589         [ #  # ]:          0 :                 pOutl->UpdateFields();
     590         [ #  # ]:          0 :                 pOutl->SetUpdateMode( sal_True );
     591         [ #  # ]:          0 :                 Size aSize( pOutl->CalcTextSize() );
     592                 :          0 :                 aSize.Width() *= nMul;
     593         [ #  # ]:          0 :                 pOutl->SetUpdateMode( sal_False );
     594                 :            : 
     595                 :          0 :                 Point aPos;
     596 [ #  # ][ #  # ]:          0 :                 Rectangle aRect( aPos, GetActiveWindow()->GetOutputSizePixel() );
     597         [ #  # ]:          0 :                 aPos = aRect.Center();
     598 [ #  # ][ #  # ]:          0 :                 aPos = GetActiveWindow()->PixelToLogic(aPos);
     599                 :          0 :                 aPos.X() -= aSize.Width() / 2;
     600                 :          0 :                 aPos.Y() -= aSize.Height() / 2;
     601                 :            : 
     602         [ #  # ]:          0 :                 Rectangle aLogicRect(aPos, aSize);
     603         [ #  # ]:          0 :                 pRectObj->SetLogicRect(aLogicRect);
     604         [ #  # ]:          0 :                 pRectObj->SetOutlinerParaObject( pOutlParaObject );
     605         [ #  # ]:          0 :                 mpDrawView->InsertObjectAtView(pRectObj, *mpDrawView->GetSdrPageView());
     606         [ #  # ]:          0 :                 pOutl->Init( nOutlMode );
     607                 :            :             }
     608                 :            : 
     609         [ #  # ]:          0 :             delete pFieldItem;
     610                 :            : 
     611                 :          0 :             Cancel();
     612                 :          0 :             rReq.Ignore ();
     613                 :            :         }
     614                 :          0 :         break;
     615                 :            : 
     616                 :            :         case SID_MODIFY_FIELD:
     617                 :            :         {
     618                 :          0 :             OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
     619                 :            : 
     620         [ #  # ]:          0 :             if( pOLV )
     621                 :            :             {
     622                 :          0 :                 const SvxFieldItem* pFldItem = pOLV->GetFieldAtSelection();
     623                 :            : 
     624   [ #  #  #  #  :          0 :                 if( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) ||
             #  #  #  # ]
         [ #  # ][ #  # ]
     625                 :          0 :                                  pFldItem->GetField()->ISA( SvxAuthorField ) ||
     626                 :          0 :                                  pFldItem->GetField()->ISA( SvxExtFileField ) ||
     627                 :          0 :                                  pFldItem->GetField()->ISA( SvxExtTimeField ) ) )
     628                 :            :                 {
     629                 :            :                     // Dialog...
     630                 :          0 :                     SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
     631 [ #  # ][ #  # ]:          0 :                     AbstractSdModifyFieldDlg* pDlg = pFact ? pFact->CreateSdModifyFieldDlg(GetActiveWindow(), pFldItem->GetField(), pOLV->GetAttribs() ) : 0;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     632 [ #  # ][ #  # ]:          0 :                     if( pDlg && pDlg->Execute() == RET_OK )
                 [ #  # ]
     633                 :            :                     {
     634                 :            :                         // To make a correct SetAttribs() call at the utlinerView
     635                 :            :                         // it is necessary to split the actions here
     636         [ #  # ]:          0 :                         SvxFieldData* pField = pDlg->GetField();
     637         [ #  # ]:          0 :                         ESelection aSel = pOLV->GetSelection();
     638                 :          0 :                         sal_Bool bSelectionWasModified(sal_False);
     639                 :            : 
     640         [ #  # ]:          0 :                         if( pField )
     641                 :            :                         {
     642         [ #  # ]:          0 :                             SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD );
     643                 :            : 
     644         [ #  # ]:          0 :                             if( aSel.nStartPos == aSel.nEndPos )
     645                 :            :                             {
     646                 :          0 :                                 bSelectionWasModified = sal_True;
     647                 :          0 :                                 aSel.nEndPos++;
     648         [ #  # ]:          0 :                                 pOLV->SetSelection( aSel );
     649                 :            :                             }
     650                 :            : 
     651         [ #  # ]:          0 :                             pOLV->InsertField( aFieldItem );
     652                 :            : 
     653                 :            :                             // select again for eventual SetAttribs call
     654 [ #  # ][ #  # ]:          0 :                             pOLV->SetSelection( aSel );
     655                 :            :                         }
     656                 :            : 
     657         [ #  # ]:          0 :                         SfxItemSet aSet( pDlg->GetItemSet() );
     658                 :            : 
     659         [ #  # ]:          0 :                         if( aSet.Count() )
     660                 :            :                         {
     661         [ #  # ]:          0 :                             pOLV->SetAttribs( aSet );
     662                 :            : 
     663                 :          0 :                             ::Outliner* pOutliner = pOLV->GetOutliner();
     664         [ #  # ]:          0 :                             if( pOutliner )
     665         [ #  # ]:          0 :                                 pOutliner->UpdateFields();
     666                 :            :                         }
     667                 :            : 
     668         [ #  # ]:          0 :                         if(pField)
     669                 :            :                         {
     670                 :            :                             // restore selection to original
     671         [ #  # ]:          0 :                             if(bSelectionWasModified)
     672                 :            :                             {
     673                 :          0 :                                 aSel.nEndPos--;
     674         [ #  # ]:          0 :                                 pOLV->SetSelection( aSel );
     675                 :            :                             }
     676                 :            : 
     677 [ #  # ][ #  # ]:          0 :                             delete pField;
     678         [ #  # ]:          0 :                         }
     679                 :            :                     }
     680         [ #  # ]:          0 :                     delete pDlg;
     681                 :            :                 }
     682                 :            :             }
     683                 :            : 
     684                 :          0 :             Cancel();
     685                 :          0 :             rReq.Ignore ();
     686                 :            :         }
     687                 :          0 :         break;
     688                 :            : 
     689                 :            :         case SID_OPEN_XML_FILTERSETTINGS:
     690                 :            :         {
     691                 :            :             try
     692                 :            :             {
     693 [ #  # ][ #  # ]:          0 :                 com::sun::star::uno::Reference < ::com::sun::star::ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance("com.sun.star.comp.ui.XSLTFilterDialog"), com::sun::star::uno::UNO_QUERY);
         [ #  # ][ #  # ]
     694         [ #  # ]:          0 :                 if( xDialog.is() )
     695                 :            :                 {
     696 [ #  # ][ #  # ]:          0 :                     xDialog->execute();
     697         [ #  # ]:          0 :                 }
     698                 :            :             }
     699                 :          0 :             catch( ::com::sun::star::uno::RuntimeException& )
     700                 :            :             {
     701                 :            :             }
     702                 :            : 
     703                 :          0 :             Cancel();
     704                 :          0 :             rReq.Ignore ();
     705                 :            :         }
     706                 :          0 :         break;
     707                 :            : 
     708                 :            :         default:
     709                 :            :         {
     710                 :            :             // switch Anweisung wegen CLOOKS aufgeteilt. Alle case-Anweisungen die
     711                 :            :             // eine Fu???? -Funktion aufrufen, sind in die Methode FuTemp03 (drviewsb)
     712                 :            :             // gewandert.
     713                 :          0 :             FuTemp03(rReq);
     714                 :            :         }
     715                 :          0 :         break;
     716                 :            :     };
     717                 :            : };
     718                 :            : 
     719                 :          0 : bool DrawViewShell::RenameSlide( sal_uInt16 nPageId, const String & rName  )
     720                 :            : {
     721                 :            :     sal_Bool   bOutDummy;
     722 [ #  # ][ #  # ]:          0 :     if( GetDoc()->GetPageByName( rName, bOutDummy ) != SDRPAGE_NOTFOUND )
                 [ #  # ]
     723                 :          0 :         return false;
     724                 :            : 
     725                 :          0 :     SdPage* pPageToRename = NULL;
     726                 :          0 :     PageKind ePageKind = GetPageKind();
     727                 :            : 
     728         [ #  # ]:          0 :     if( GetEditMode() == EM_PAGE )
     729                 :            :     {
     730 [ #  # ][ #  # ]:          0 :         pPageToRename = GetDoc()->GetSdPage( nPageId - 1, ePageKind );
     731                 :            : 
     732                 :            :         // Undo
     733                 :          0 :         SdPage* pUndoPage = pPageToRename;
     734         [ #  # ]:          0 :         SdrLayerAdmin &  rLayerAdmin = GetDoc()->GetLayerAdmin();
     735 [ #  # ][ #  # ]:          0 :         sal_uInt8 nBackground = rLayerAdmin.GetLayerID( String( SdResId( STR_LAYER_BCKGRND )), sal_False );
         [ #  # ][ #  # ]
     736 [ #  # ][ #  # ]:          0 :         sal_uInt8 nBgObj = rLayerAdmin.GetLayerID( String( SdResId( STR_LAYER_BCKGRNDOBJ )), sal_False );
         [ #  # ][ #  # ]
     737         [ #  # ]:          0 :         SetOfByte aVisibleLayers = mpActualPage->TRG_GetMasterPageVisibleLayers();
     738                 :            : 
     739 [ #  # ][ #  # ]:          0 :         ::svl::IUndoManager* pManager = GetDoc()->GetDocSh()->GetUndoManager();
     740                 :            :         ModifyPageUndoAction* pAction = new ModifyPageUndoAction(
     741                 :          0 :             GetDoc(), pUndoPage, rName, pUndoPage->GetAutoLayout(),
     742                 :          0 :             aVisibleLayers.IsSet( nBackground ),
     743 [ #  # ][ #  # ]:          0 :             aVisibleLayers.IsSet( nBgObj ));
         [ #  # ][ #  # ]
                 [ #  # ]
     744         [ #  # ]:          0 :         pManager->AddUndoAction( pAction );
     745                 :            : 
     746                 :            :         // rename
     747         [ #  # ]:          0 :         pPageToRename->SetName( rName );
     748                 :            : 
     749         [ #  # ]:          0 :         if( ePageKind == PK_STANDARD )
     750                 :            :         {
     751                 :            :             // also rename notes-page
     752 [ #  # ][ #  # ]:          0 :             SdPage* pNotesPage = GetDoc()->GetSdPage( nPageId - 1, PK_NOTES );
     753         [ #  # ]:          0 :             pNotesPage->SetName( rName );
     754                 :            :         }
     755                 :            :     }
     756                 :            :     else
     757                 :            :     {
     758                 :            :         // rename MasterPage -> rename LayoutTemplate
     759 [ #  # ][ #  # ]:          0 :         pPageToRename = GetDoc()->GetMasterSdPage( nPageId - 1, ePageKind );
     760 [ #  # ][ #  # ]:          0 :         GetDoc()->RenameLayoutTemplate( pPageToRename->GetLayoutName(), rName );
         [ #  # ][ #  # ]
     761                 :            :     }
     762                 :            : 
     763 [ #  # ][ #  # ]:          0 :     bool bSuccess = ( sal_False != rName.Equals( pPageToRename->GetName()));
     764                 :            : 
     765         [ #  # ]:          0 :     if( bSuccess )
     766                 :            :     {
     767                 :            :         // user edited page names may be changed by the page so update control
     768         [ #  # ]:          0 :         maTabControl.SetPageText( nPageId, rName );
     769                 :            : 
     770                 :            :         // set document to modified state
     771 [ #  # ][ #  # ]:          0 :         GetDoc()->SetChanged( sal_True );
     772                 :            : 
     773                 :            :         // inform navigator about change
     774         [ #  # ]:          0 :         SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True );
     775                 :            :         GetViewFrame()->GetDispatcher()->Execute(
     776 [ #  # ][ #  # ]:          0 :             SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
     777                 :            : 
     778                 :            :         // Tell the slide sorter about the name change (necessary for
     779                 :            :         // accessibility.)
     780                 :            :         slidesorter::SlideSorterViewShell* pSlideSorterViewShell
     781 [ #  # ][ #  # ]:          0 :             = slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase());
     782         [ #  # ]:          0 :         if (pSlideSorterViewShell != NULL)
     783                 :            :         {
     784 [ #  # ][ #  # ]:          0 :             pSlideSorterViewShell->GetSlideSorter().GetController().PageNameHasChanged(
     785         [ #  # ]:          0 :                 nPageId-1, rName);
     786         [ #  # ]:          0 :         }
     787                 :            :     }
     788                 :            : 
     789                 :          0 :     return bSuccess;
     790                 :            : }
     791                 :            : 
     792                 :            : 
     793                 :            : 
     794                 :            : 
     795                 :          0 : IMPL_LINK( DrawViewShell, RenameSlideHdl, AbstractSvxNameDialog*, pDialog )
     796                 :            : {
     797         [ #  # ]:          0 :     if( ! pDialog )
     798                 :          0 :         return 0;
     799                 :            : 
     800         [ #  # ]:          0 :     String aNewName;
     801         [ #  # ]:          0 :     pDialog->GetName( aNewName );
     802                 :            : 
     803 [ #  # ][ #  # ]:          0 :     SdPage* pCurrentPage = GetDoc()->GetSdPage( maTabControl.GetCurPageId() - 1, GetPageKind() );
     804                 :            : 
     805 [ #  # ][ #  # ]:          0 :     return pCurrentPage && ( aNewName.Equals( pCurrentPage->GetName() ) || GetDocSh()->IsNewPageNameValid( aNewName ) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     806                 :            : }
     807                 :            : 
     808                 :            : 
     809                 :            : 
     810                 :            : 
     811                 :          0 : void DrawViewShell::ModifyLayer (
     812                 :            :     SdrLayer* pLayer,
     813                 :            :     const String& rLayerName,
     814                 :            :     const String& rLayerTitle,
     815                 :            :     const String& rLayerDesc,
     816                 :            :     bool bIsVisible,
     817                 :            :     bool bIsLocked,
     818                 :            :     bool bIsPrintable)
     819                 :            : {
     820         [ #  # ]:          0 :     if( pLayer )
     821                 :            :     {
     822                 :          0 :         const sal_uInt16 nPageCount = GetLayerTabControl()->GetPageCount();
     823                 :          0 :         sal_uInt16 nCurPage = 0;
     824                 :            :         sal_uInt16 nPos;
     825         [ #  # ]:          0 :         for( nPos = 0; nPos < nPageCount; nPos++ )
     826                 :            :         {
     827                 :          0 :             sal_uInt16 nId = GetLayerTabControl()->GetPageId( nPos );
     828 [ #  # ][ #  # ]:          0 :             if( pLayer->GetName() == GetLayerTabControl()->GetPageText( nId ) )
     829                 :            :             {
     830                 :          0 :                 nCurPage = nId;
     831                 :          0 :                 break;
     832                 :            :             }
     833                 :            :         }
     834                 :            : 
     835                 :          0 :         pLayer->SetName( rLayerName );
     836                 :          0 :         pLayer->SetTitle( rLayerTitle );
     837                 :          0 :         pLayer->SetDescription( rLayerDesc );
     838                 :          0 :         mpDrawView->SetLayerVisible( rLayerName, bIsVisible );
     839                 :          0 :         mpDrawView->SetLayerLocked( rLayerName, bIsLocked);
     840                 :          0 :         mpDrawView->SetLayerPrintable(rLayerName, bIsPrintable);
     841                 :            : 
     842                 :          0 :         GetDoc()->SetChanged(sal_True);
     843                 :            : 
     844                 :          0 :         GetLayerTabControl()->SetPageText(nCurPage, rLayerName);
     845                 :            : 
     846                 :          0 :         TabBarPageBits nBits = 0;
     847                 :            : 
     848         [ #  # ]:          0 :         if (!bIsVisible)
     849                 :            :         {
     850                 :            :             // Unsichtbare Layer werden anders dargestellt
     851                 :          0 :             nBits = TPB_SPECIAL;
     852                 :            :         }
     853                 :            : 
     854                 :          0 :         GetLayerTabControl()->SetPageBits(nCurPage, nBits);
     855                 :            : 
     856                 :            :         GetViewFrame()->GetDispatcher()->Execute(
     857                 :            :             SID_SWITCHLAYER,
     858                 :          0 :             SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
     859                 :            : 
     860                 :            :         // Call Invalidate at the form shell.
     861         [ #  # ]:          0 :         FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
     862         [ #  # ]:          0 :         if (pFormShell != NULL)
     863                 :          0 :             pFormShell->Invalidate();
     864                 :            :     }
     865                 :          0 : }
     866                 :            : 
     867                 :            : } // end of namespace sd
     868                 :            : 
     869                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10