LCOV - code coverage report
Current view: top level - sd/source/ui/slidesorter/controller - SlsSlotManager.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 39 545 7.2 %
Date: 2012-08-25 Functions: 6 23 26.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 32 1134 2.8 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <com/sun/star/presentation/XPresentation2.hpp>
      31                 :            : 
      32                 :            : #include <editeng/outlobj.hxx>
      33                 :            : 
      34                 :            : #include "controller/SlsSlotManager.hxx"
      35                 :            : #include "SlideSorter.hxx"
      36                 :            : #include "SlideSorterViewShell.hxx"
      37                 :            : #include "controller/SlideSorterController.hxx"
      38                 :            : #include "controller/SlsClipboard.hxx"
      39                 :            : #include "controller/SlsCurrentSlideManager.hxx"
      40                 :            : #include "controller/SlsFocusManager.hxx"
      41                 :            : #include "controller/SlsInsertionIndicatorHandler.hxx"
      42                 :            : #include "controller/SlsPageSelector.hxx"
      43                 :            : #include "controller/SlsSelectionFunction.hxx"
      44                 :            : #include "controller/SlsSelectionManager.hxx"
      45                 :            : #include "controller/SlsSelectionObserver.hxx"
      46                 :            : #include "SlsCommand.hxx"
      47                 :            : #include "model/SlideSorterModel.hxx"
      48                 :            : #include "model/SlsPageEnumerationProvider.hxx"
      49                 :            : #include "model/SlsPageDescriptor.hxx"
      50                 :            : #include "view/SlideSorterView.hxx"
      51                 :            : #include "view/SlsLayouter.hxx"
      52                 :            : #include "framework/FrameworkHelper.hxx"
      53                 :            : #include "Window.hxx"
      54                 :            : #include "fupoor.hxx"
      55                 :            : #include "fuzoom.hxx"
      56                 :            : #include "fucushow.hxx"
      57                 :            : #include "fusldlg.hxx"
      58                 :            : #include "fuexpand.hxx"
      59                 :            : #include "fusumry.hxx"
      60                 :            : #include "fuscale.hxx"
      61                 :            : #include "slideshow.hxx"
      62                 :            : #include "app.hrc"
      63                 :            : #include "strings.hrc"
      64                 :            : #include "sdresid.hxx"
      65                 :            : #include "drawdoc.hxx"
      66                 :            : #include "DrawDocShell.hxx"
      67                 :            : #include "ViewShellBase.hxx"
      68                 :            : #include "ViewShellImplementation.hxx"
      69                 :            : #include "sdattr.hxx"
      70                 :            : #include "FrameView.hxx"
      71                 :            : #include "zoomlist.hxx"
      72                 :            : #include "sdpage.hxx"
      73                 :            : #include "sdxfer.hxx"
      74                 :            : #include "helpids.h"
      75                 :            : #include "glob.hrc"
      76                 :            : #include "unmodpg.hxx"
      77                 :            : #include "DrawViewShell.hxx"
      78                 :            : 
      79                 :            : #include <sfx2/request.hxx>
      80                 :            : #include <sfx2/viewfrm.hxx>
      81                 :            : #include <sfx2/bindings.hxx>
      82                 :            : #include <sfx2/dispatch.hxx>
      83                 :            : #include <svx/svxids.hrc>
      84                 :            : #include <sfx2/zoomitem.hxx>
      85                 :            : #include <svx/svxdlg.hxx>
      86                 :            : #include <svx/dialogs.hrc>
      87                 :            : #include <vcl/msgbox.hxx>
      88                 :            : #include <svl/intitem.hxx>
      89                 :            : #include <svl/whiter.hxx>
      90                 :            : #include <svl/itempool.hxx>
      91                 :            : #include <svl/aeitem.hxx>
      92                 :            : #include <com/sun/star/presentation/FadeEffect.hpp>
      93                 :            : #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
      94                 :            : #include <com/sun/star/drawing/XDrawPages.hpp>
      95                 :            : #include <vcl/svapp.hxx>
      96                 :            : 
      97                 :            : #include <boost/bind.hpp>
      98                 :            : 
      99                 :            : using namespace ::com::sun::star;
     100                 :            : using namespace ::com::sun::star::uno;
     101                 :            : using namespace ::com::sun::star::presentation;
     102                 :            : 
     103                 :            : namespace sd { namespace slidesorter { namespace controller {
     104                 :            : 
     105                 :            : namespace {
     106                 :            : 
     107                 :            : /** The state of a set of slides with respect to being excluded from the
     108                 :            :     slide show.
     109                 :            : */
     110                 :            : enum SlideExclusionState {UNDEFINED, EXCLUDED, INCLUDED, MIXED};
     111                 :            : 
     112                 :            : /** Return for the given set of slides whether they included are
     113                 :            :     excluded from the slide show.
     114                 :            : */
     115                 :            : SlideExclusionState GetSlideExclusionState (model::PageEnumeration& rPageSet);
     116                 :            : 
     117                 :            : } // end of anonymous namespace
     118                 :            : 
     119                 :            : 
     120                 :            : 
     121                 :        130 : SlotManager::SlotManager (SlideSorter& rSlideSorter)
     122                 :            :     : mrSlideSorter(rSlideSorter),
     123         [ +  - ]:        130 :       maCommandQueue()
     124                 :            : {
     125                 :        130 : }
     126                 :            : 
     127                 :            : 
     128                 :            : 
     129                 :            : 
     130                 :        130 : SlotManager::~SlotManager (void)
     131                 :            : {
     132                 :        130 : }
     133                 :            : 
     134                 :            : 
     135                 :            : 
     136                 :            : 
     137                 :          0 : void SlotManager::FuTemporary (SfxRequest& rRequest)
     138                 :            : {
     139                 :          0 :     SdDrawDocument* pDocument = mrSlideSorter.GetModel().GetDocument();
     140                 :            : 
     141                 :            :     SlideSorterViewShell* pShell
     142         [ #  # ]:          0 :         = dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell());
     143         [ #  # ]:          0 :     if (pShell == NULL)
     144                 :          0 :         return;
     145                 :            : 
     146   [ #  #  #  #  :          0 :     switch (rRequest.GetSlot())
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     147                 :            :     {
     148                 :            :         case SID_PRESENTATION:
     149                 :            :         case SID_REHEARSE_TIMINGS:
     150                 :          0 :             ShowSlideShow (rRequest);
     151                 :          0 :             pShell->Cancel();
     152                 :          0 :             rRequest.Done();
     153                 :          0 :             break;
     154                 :            : 
     155                 :            :         case SID_HIDE_SLIDE:
     156         [ #  # ]:          0 :             ChangeSlideExclusionState(model::SharedPageDescriptor(), true);
     157                 :          0 :             break;
     158                 :            : 
     159                 :            :         case SID_SHOW_SLIDE:
     160         [ #  # ]:          0 :             ChangeSlideExclusionState(model::SharedPageDescriptor(), false);
     161                 :          0 :             break;
     162                 :            : 
     163                 :            :         case SID_PAGES_PER_ROW:
     164         [ #  # ]:          0 :             if (rRequest.GetArgs() != NULL)
     165                 :            :             {
     166                 :          0 :                 SFX_REQUEST_ARG(rRequest, pPagesPerRow, SfxUInt16Item,
     167                 :            :                     SID_PAGES_PER_ROW, sal_False);
     168         [ #  # ]:          0 :                 if (pPagesPerRow != NULL)
     169                 :            :                 {
     170                 :          0 :                     sal_Int32 nColumnCount = pPagesPerRow->GetValue();
     171                 :            :                     // Force the given number of columns by setting
     172                 :            :                     // the minimal and maximal number of columns to
     173                 :            :                     // the same value.
     174                 :          0 :                     mrSlideSorter.GetView().GetLayouter().SetColumnCount (
     175                 :          0 :                         nColumnCount, nColumnCount);
     176                 :            :                     // Force a repaint and re-layout.
     177                 :          0 :                     pShell->ArrangeGUIElements ();
     178                 :            :                     // Rearrange the UI-elements controlled by the
     179                 :            :                     // controller and force a rearrangement of the
     180                 :            :                     // view.
     181                 :          0 :                     mrSlideSorter.GetController().Rearrange(true);
     182                 :            :                 }
     183                 :            :             }
     184                 :          0 :             rRequest.Done();
     185                 :          0 :             break;
     186                 :            : 
     187                 :            :         case SID_SELECTALL:
     188                 :          0 :             mrSlideSorter.GetController().GetPageSelector().SelectAllPages();
     189                 :          0 :             rRequest.Done();
     190                 :          0 :             break;
     191                 :            : 
     192                 :            :         case SID_SLIDE_TRANSITIONS_PANEL:
     193                 :            :         {
     194                 :            :             // Make the slide transition panel visible (expand it)
     195                 :            :             // in the tool pane.
     196         [ #  # ]:          0 :             if (mrSlideSorter.GetViewShellBase() != NULL)
     197                 :          0 :                 framework::FrameworkHelper::Instance(*mrSlideSorter.GetViewShellBase())
     198         [ #  # ]:          0 :                     ->RequestTaskPanel(sd::framework::FrameworkHelper::msSlideTransitionTaskPanelURL);
     199                 :          0 :             rRequest.Ignore ();
     200                 :          0 :             break;
     201                 :            :         }
     202                 :            : 
     203                 :            :         case SID_PRESENTATION_DLG:
     204                 :            :             FuSlideShowDlg::Create (
     205                 :            :                 pShell,
     206                 :            :                 mrSlideSorter.GetContentWindow().get(),
     207                 :          0 :                 &mrSlideSorter.GetView(),
     208                 :            :                 pDocument,
     209 [ #  # ][ #  # ]:          0 :                 rRequest);
     210                 :          0 :             break;
     211                 :            : 
     212                 :            :         case SID_CUSTOMSHOW_DLG:
     213                 :            :             FuCustomShowDlg::Create (
     214                 :            :                 pShell,
     215                 :            :                 mrSlideSorter.GetContentWindow().get(),
     216                 :          0 :                 &mrSlideSorter.GetView(),
     217                 :            :                 pDocument,
     218 [ #  # ][ #  # ]:          0 :                 rRequest);
     219                 :          0 :                 break;
     220                 :            : 
     221                 :            :         case SID_EXPAND_PAGE:
     222                 :            :             FuExpandPage::Create (
     223                 :            :                 pShell,
     224                 :            :                 mrSlideSorter.GetContentWindow().get(),
     225                 :          0 :                 &mrSlideSorter.GetView(),
     226                 :            :                 pDocument,
     227 [ #  # ][ #  # ]:          0 :                 rRequest);
     228                 :          0 :             break;
     229                 :            : 
     230                 :            :         case SID_SUMMARY_PAGE:
     231                 :            :             FuSummaryPage::Create (
     232                 :            :                 pShell,
     233                 :            :                 mrSlideSorter.GetContentWindow().get(),
     234                 :          0 :                 &mrSlideSorter.GetView(),
     235                 :            :                 pDocument,
     236 [ #  # ][ #  # ]:          0 :                 rRequest);
     237                 :          0 :             break;
     238                 :            : 
     239                 :            :         case SID_INSERTPAGE:
     240                 :            :         case SID_INSERT_MASTER_PAGE:
     241                 :          0 :             InsertSlide(rRequest);
     242                 :          0 :             rRequest.Done();
     243                 :          0 :             break;
     244                 :            : 
     245                 :            :         case SID_DUPLICATE_PAGE:
     246                 :          0 :             DuplicateSelectedSlides(rRequest);
     247                 :          0 :             rRequest.Done();
     248                 :          0 :             break;
     249                 :            : 
     250                 :            :         case SID_DELETE_PAGE:
     251                 :            :         case SID_DELETE_MASTER_PAGE:
     252                 :            :         case SID_DELETE: // we need SID_CUT to handle the delete key
     253                 :            :             // (DEL -> accelerator -> SID_CUT).
     254         [ #  # ]:          0 :             if (mrSlideSorter.GetModel().GetPageCount() > 1)
     255                 :            :             {
     256         [ #  # ]:          0 :                 mrSlideSorter.GetController().GetSelectionManager()->DeleteSelectedPages();
     257                 :            :             }
     258                 :            : 
     259                 :          0 :             rRequest.Done();
     260                 :          0 :             break;
     261                 :            : 
     262                 :            :         case SID_RENAMEPAGE:
     263                 :            :         case SID_RENAME_MASTER_PAGE:
     264                 :          0 :             RenameSlide ();
     265                 :          0 :             rRequest.Done ();
     266                 :          0 :             break;
     267                 :            : 
     268                 :            :         case SID_ASSIGN_LAYOUT:
     269                 :            :         {
     270                 :          0 :             pShell->mpImpl->AssignLayout( rRequest, mrSlideSorter.GetModel().GetPageType() );
     271                 :          0 :             rRequest.Done ();
     272                 :            :         }
     273                 :          0 :         break;
     274                 :            : 
     275                 :            :         default:
     276                 :          0 :             break;
     277                 :            :     }
     278                 :            : }
     279                 :            : 
     280                 :            : 
     281                 :            : 
     282                 :            : 
     283                 :          0 : void SlotManager::FuPermanent (SfxRequest& rRequest)
     284                 :            : {
     285                 :          0 :     ViewShell* pShell = mrSlideSorter.GetViewShell();
     286         [ #  # ]:          0 :     if (pShell == NULL)
     287                 :          0 :         return;
     288                 :            : 
     289         [ #  # ]:          0 :     if(pShell->GetCurrentFunction().is())
     290                 :            :     {
     291                 :          0 :         FunctionReference xEmpty;
     292 [ #  # ][ #  # ]:          0 :         if (pShell->GetOldFunction() == pShell->GetCurrentFunction())
         [ #  # ][ #  # ]
                 [ #  # ]
     293         [ #  # ]:          0 :             pShell->SetOldFunction(xEmpty);
     294                 :            : 
     295 [ #  # ][ #  # ]:          0 :         pShell->GetCurrentFunction()->Deactivate();
                 [ #  # ]
     296 [ #  # ][ #  # ]:          0 :         pShell->SetCurrentFunction(xEmpty);
     297                 :            :     }
     298                 :            : 
     299         [ #  # ]:          0 :     switch(rRequest.GetSlot())
     300                 :            :     {
     301                 :            :         case SID_OBJECT_SELECT:
     302         [ #  # ]:          0 :             pShell->SetCurrentFunction( SelectionFunction::Create(mrSlideSorter, rRequest) );
     303                 :          0 :             rRequest.Done();
     304                 :          0 :             break;
     305                 :            : 
     306                 :            :         default:
     307                 :          0 :                 break;
     308                 :            :     }
     309                 :            : 
     310         [ #  # ]:          0 :     if(pShell->GetOldFunction().is())
     311                 :            :     {
     312 [ #  # ][ #  # ]:          0 :         pShell->GetOldFunction()->Deactivate();
                 [ #  # ]
     313                 :          0 :         FunctionReference xEmpty;
     314 [ #  # ][ #  # ]:          0 :         pShell->SetOldFunction(xEmpty);
     315                 :            :     }
     316                 :            : 
     317         [ #  # ]:          0 :     if(pShell->GetCurrentFunction().is())
     318                 :            :     {
     319         [ #  # ]:          0 :         pShell->GetCurrentFunction()->Activate();
     320         [ #  # ]:          0 :         pShell->SetOldFunction(pShell->GetCurrentFunction());
     321                 :            :     }
     322                 :            : 
     323                 :            :     //! das ist nur bis das ENUM-Slots sind
     324                 :            :     //  Invalidate( SID_OBJECT_SELECT );
     325                 :            : }
     326                 :            : 
     327                 :          0 : void SlotManager::FuSupport (SfxRequest& rRequest)
     328                 :            : {
     329   [ #  #  #  #  :          0 :     switch (rRequest.GetSlot())
                #  #  # ]
     330                 :            :     {
     331                 :            :         case SID_STYLE_FAMILY:
     332         [ #  # ]:          0 :             if (rRequest.GetArgs() != NULL)
     333                 :            :             {
     334                 :            :                 SdDrawDocument* pDocument
     335                 :          0 :                     = mrSlideSorter.GetModel().GetDocument();
     336         [ #  # ]:          0 :                 if (pDocument != NULL)
     337                 :            :                 {
     338                 :            :                     const SfxPoolItem& rItem (
     339                 :          0 :                         rRequest.GetArgs()->Get(SID_STYLE_FAMILY));
     340                 :            :                     pDocument->GetDocSh()->SetStyleFamily(
     341                 :          0 :                         static_cast<const SfxUInt16Item&>(rItem).GetValue());
     342                 :            :                 }
     343                 :            :             }
     344                 :          0 :             break;
     345                 :            : 
     346                 :            :         case SID_PASTE:
     347                 :            :         {
     348                 :          0 :             SdTransferable* pTransferClip = SD_MOD()->pTransferClip;
     349         [ #  # ]:          0 :             if( pTransferClip )
     350                 :            :             {
     351                 :          0 :                 SfxObjectShell* pTransferDocShell = pTransferClip->GetDocShell();
     352                 :            : 
     353         [ #  # ]:          0 :                 DrawDocShell* pDocShell = dynamic_cast<DrawDocShell*>(pTransferDocShell);
     354 [ #  # ][ #  # ]:          0 :                 if (pDocShell && pDocShell->GetDoc()->GetPageCount() > 1)
                 [ #  # ]
     355                 :            :                 {
     356                 :          0 :                     mrSlideSorter.GetController().GetClipboard().HandleSlotCall(rRequest);
     357                 :          0 :                     break;
     358                 :            :                 }
     359                 :            :             }
     360                 :          0 :             ViewShellBase* pBase = mrSlideSorter.GetViewShellBase();
     361         [ #  # ]:          0 :             if (pBase != NULL)
     362                 :            :             {
     363                 :            :                 ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
     364 [ #  # ][ #  # ]:          0 :                     ::boost::dynamic_pointer_cast<DrawViewShell>(pBase->GetMainViewShell()));
                 [ #  # ]
     365         [ #  # ]:          0 :                 if (pDrawViewShell.get() != NULL)
     366 [ #  # ][ #  # ]:          0 :                     pDrawViewShell->FuSupport(rRequest);
     367                 :            :             }
     368                 :            :         }
     369                 :          0 :         break;
     370                 :            : 
     371                 :            :         case SID_CUT:
     372                 :            :         case SID_COPY:
     373                 :            :         case SID_DELETE:
     374                 :          0 :             mrSlideSorter.GetController().GetClipboard().HandleSlotCall(rRequest);
     375                 :          0 :             break;
     376                 :            : 
     377                 :            :         case SID_DRAWINGMODE:
     378                 :            :         case SID_NOTESMODE:
     379                 :            :         case SID_HANDOUTMODE:
     380                 :            :         case SID_DIAMODE:
     381                 :            :         case SID_OUTLINEMODE:
     382                 :            :         {
     383                 :          0 :             ViewShellBase* pBase = mrSlideSorter.GetViewShellBase();
     384         [ #  # ]:          0 :             if (pBase != NULL)
     385                 :            :             {
     386                 :            :                 framework::FrameworkHelper::Instance(*pBase)->HandleModeChangeSlot(
     387         [ #  # ]:          0 :                     rRequest.GetSlot(), rRequest);
     388                 :          0 :                 rRequest.Done();
     389                 :            :             }
     390                 :          0 :             break;
     391                 :            :         }
     392                 :            : 
     393                 :            :         case SID_UNDO:
     394                 :            :         {
     395                 :            :             SlideSorterViewShell* pViewShell
     396         [ #  # ]:          0 :                 = dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell());
     397         [ #  # ]:          0 :             if (pViewShell != NULL)
     398                 :            :             {
     399         [ #  # ]:          0 :                 view::SlideSorterView::DrawLock aDrawLock (mrSlideSorter);
     400 [ #  # ][ #  # ]:          0 :                 SlideSorterController::ModelChangeLock aModelLock (mrSlideSorter.GetController());
     401         [ #  # ]:          0 :                 PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
     402         [ #  # ]:          0 :                 SelectionObserver::Context aContext (mrSlideSorter);
     403 [ #  # ][ #  # ]:          0 :                 pViewShell->ImpSidUndo (sal_False, rRequest);
         [ #  # ][ #  # ]
                 [ #  # ]
     404                 :            :             }
     405                 :          0 :             break;
     406                 :            :         }
     407                 :            : 
     408                 :            :         case SID_REDO:
     409                 :            :         {
     410                 :            :             SlideSorterViewShell* pViewShell
     411         [ #  # ]:          0 :                 = dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell());
     412         [ #  # ]:          0 :             if (pViewShell != NULL)
     413                 :            :             {
     414         [ #  # ]:          0 :                 view::SlideSorterView::DrawLock aDrawLock (mrSlideSorter);
     415 [ #  # ][ #  # ]:          0 :                 SlideSorterController::ModelChangeLock aModelLock (mrSlideSorter.GetController());
     416         [ #  # ]:          0 :                 PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
     417         [ #  # ]:          0 :                 SelectionObserver::Context aContext (mrSlideSorter);
     418 [ #  # ][ #  # ]:          0 :                 pViewShell->ImpSidRedo (sal_False, rRequest);
         [ #  # ][ #  # ]
                 [ #  # ]
     419                 :            :             }
     420                 :          0 :             break;
     421                 :            :         }
     422                 :            : 
     423                 :            :         default:
     424                 :          0 :             break;
     425                 :            :     }
     426                 :          0 : }
     427                 :            : 
     428                 :            : 
     429                 :            : 
     430                 :            : 
     431                 :          0 : void SlotManager::ExecCtrl (SfxRequest& rRequest)
     432                 :            : {
     433                 :          0 :     ViewShell* pViewShell = mrSlideSorter.GetViewShell();
     434                 :          0 :     sal_uInt16 nSlot = rRequest.GetSlot();
     435   [ #  #  #  #  :          0 :     switch (nSlot)
                   #  # ]
     436                 :            :     {
     437                 :            :         case SID_RELOAD:
     438                 :            :         {
     439                 :            :             // Undo-Manager leeren
     440                 :          0 :             mrSlideSorter.GetModel().GetDocument()->GetDocSh()->ClearUndoBuffer();
     441                 :            : 
     442                 :            :             // Normale Weiterleitung an ViewFrame zur Ausfuehrung
     443         [ #  # ]:          0 :             if (pViewShell != NULL)
     444                 :          0 :                 pViewShell->GetViewFrame()->ExecuteSlot(rRequest);
     445                 :            : 
     446                 :            :             // Muss sofort beendet werden
     447                 :          0 :             return;
     448                 :            :         }
     449                 :            : 
     450                 :            :         case SID_OUTPUT_QUALITY_COLOR:
     451                 :            :         case SID_OUTPUT_QUALITY_GRAYSCALE:
     452                 :            :         case SID_OUTPUT_QUALITY_BLACKWHITE:
     453                 :            :         case SID_OUTPUT_QUALITY_CONTRAST:
     454                 :            :         {
     455                 :            :             // flush page cache
     456         [ #  # ]:          0 :             if (pViewShell != NULL)
     457                 :          0 :                 pViewShell->ExecReq (rRequest);
     458                 :          0 :             break;
     459                 :            :         }
     460                 :            : 
     461                 :            :         case SID_MAIL_SCROLLBODY_PAGEDOWN:
     462                 :            :         {
     463         [ #  # ]:          0 :             if (pViewShell != NULL)
     464                 :          0 :                 pViewShell->ExecReq (rRequest);
     465                 :          0 :             break;
     466                 :            :         }
     467                 :            : 
     468                 :            :         case SID_OPT_LOCALE_CHANGED:
     469                 :            :         {
     470                 :          0 :             mrSlideSorter.GetController().UpdateAllPages();
     471         [ #  # ]:          0 :             if (pViewShell != NULL)
     472                 :          0 :                 pViewShell->UpdatePreview (pViewShell->GetActualPage());
     473                 :          0 :             rRequest.Done();
     474                 :          0 :             break;
     475                 :            :         }
     476                 :            : 
     477                 :            :         case SID_SEARCH_DLG:
     478                 :            :             // We have to handle the SID_SEARCH_DLG slot explicitly because
     479                 :            :             // in some cases (when the slide sorter is displayed in the
     480                 :            :             // center pane) we want to disable the search dialog.  Therefore
     481                 :            :             // we have to handle the execution of that slot as well.
     482                 :            :             // We try to do that by forwarding the request to the view frame
     483                 :            :             // of the view shell.
     484         [ #  # ]:          0 :             if (pViewShell != NULL)
     485                 :          0 :                 pViewShell->GetViewFrame()->ExecuteSlot(rRequest);
     486                 :          0 :             break;
     487                 :            : 
     488                 :            :         default:
     489                 :          0 :             break;
     490                 :            :     }
     491                 :            : }
     492                 :            : 
     493                 :            : 
     494                 :            : 
     495                 :            : 
     496                 :          0 : void SlotManager::GetAttrState (SfxItemSet& rSet)
     497                 :            : {
     498                 :            :     // Iteratate over all items.
     499         [ #  # ]:          0 :     SfxWhichIter aIter (rSet);
     500         [ #  # ]:          0 :     sal_uInt16 nWhich = aIter.FirstWhich();
     501         [ #  # ]:          0 :     while (nWhich)
     502                 :            :     {
     503                 :          0 :         sal_uInt16 nSlotId (nWhich);
     504 [ #  # ][ #  # ]:          0 :         if (SfxItemPool::IsWhich(nWhich) && mrSlideSorter.GetViewShell()!=NULL)
         [ #  # ][ #  # ]
     505 [ #  # ][ #  # ]:          0 :             nSlotId = mrSlideSorter.GetViewShell()->GetPool().GetSlotId(nWhich);
     506         [ #  # ]:          0 :         switch (nSlotId)
     507                 :            :         {
     508                 :            :             case SID_PAGES_PER_ROW:
     509                 :            :                 rSet.Put (
     510                 :            :                     SfxUInt16Item (
     511                 :            :                         nSlotId,
     512 [ #  # ][ #  # ]:          0 :                         (sal_uInt16)mrSlideSorter.GetView().GetLayouter().GetColumnCount()
                 [ #  # ]
     513                 :            :                         )
     514 [ #  # ][ #  # ]:          0 :                     );
                 [ #  # ]
     515                 :          0 :             break;
     516                 :            :         }
     517         [ #  # ]:          0 :         nWhich = aIter.NextWhich();
     518         [ #  # ]:          0 :     }
     519                 :          0 : }
     520                 :            : 
     521                 :          2 : void SlotManager::GetMenuState (SfxItemSet& rSet)
     522                 :            : {
     523                 :          2 :     EditMode eEditMode = mrSlideSorter.GetModel().GetEditMode();
     524                 :          2 :     ViewShell* pShell = mrSlideSorter.GetViewShell();
     525                 :          2 :     DrawDocShell* pDocShell = mrSlideSorter.GetModel().GetDocument()->GetDocSh();
     526                 :            : 
     527 [ +  - ][ +  - ]:          2 :     if (pShell!=NULL && pShell->GetCurrentFunction().is())
                 [ +  - ]
           [ +  -  #  # ]
                 [ +  - ]
     528                 :            :     {
     529                 :          2 :         sal_uInt16 nSId = pShell->GetCurrentFunction()->GetSlotID();
     530                 :            : 
     531         [ +  - ]:          2 :         rSet.Put( SfxBoolItem( nSId, sal_True ) );
     532                 :            :     }
     533         [ +  - ]:          2 :     rSet.Put( SfxBoolItem( SID_DRAWINGMODE, sal_False ) );
     534         [ +  - ]:          2 :     rSet.Put( SfxBoolItem( SID_DIAMODE, sal_True ) );
     535         [ +  - ]:          2 :     rSet.Put( SfxBoolItem( SID_OUTLINEMODE, sal_False ) );
     536         [ +  - ]:          2 :     rSet.Put( SfxBoolItem( SID_NOTESMODE, sal_False ) );
     537         [ +  - ]:          2 :     rSet.Put( SfxBoolItem( SID_HANDOUTMODE, sal_False ) );
     538                 :            : 
     539                 :            :     // Vorlagenkatalog darf nicht aufgerufen werden
     540                 :          2 :     rSet.DisableItem(SID_STYLE_CATALOG);
     541                 :            : 
     542 [ -  + ][ -  + ]:          2 :     if (pShell!=NULL && pShell->IsMainViewShell())
                 [ +  - ]
     543                 :            :     {
     544                 :          0 :         rSet.DisableItem(SID_SPELL_DIALOG);
     545                 :          0 :         rSet.DisableItem(SID_SEARCH_DLG);
     546                 :            :     }
     547                 :            : 
     548         [ -  + ]:          2 :     if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_EXPAND_PAGE))
     549                 :            :     {
     550                 :          0 :         bool bDisable = true;
     551         [ #  # ]:          0 :         if (eEditMode == EM_PAGE)
     552                 :            :         {
     553                 :            :             // At least one of the selected pages has to contain an outline
     554                 :            :             // presentation objects in order to enable the expand page menu
     555                 :            :             // entry.
     556                 :            :             model::PageEnumeration aSelectedPages (
     557                 :            :                 model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
     558 [ #  # ][ #  # ]:          0 :                     mrSlideSorter.GetModel()));
     559 [ #  # ][ #  # ]:          0 :             while (aSelectedPages.HasMoreElements())
     560                 :            :             {
     561 [ #  # ][ #  # ]:          0 :                 SdPage* pPage = aSelectedPages.GetNextElement()->GetPage();
                 [ #  # ]
     562         [ #  # ]:          0 :                 SdrObject* pObj = pPage->GetPresObj(PRESOBJ_OUTLINE);
     563         [ #  # ]:          0 :                 if (pObj!=NULL )
     564                 :            :                 {
     565 [ #  # ][ #  # ]:          0 :                     if( !pObj->IsEmptyPresObj() )
     566                 :            :                     {
     567                 :          0 :                         bDisable = false;
     568                 :            :                     }
     569                 :            :                     else
     570                 :            :                     {
     571                 :            :                         // check if the object is in edit, than its temporarely not empty
     572         [ #  # ]:          0 :                         SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
     573         [ #  # ]:          0 :                         if( pTextObj )
     574                 :            :                         {
     575         [ #  # ]:          0 :                             OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject();
     576         [ #  # ]:          0 :                             if( pParaObj )
     577                 :            :                             {
     578 [ #  # ][ #  # ]:          0 :                                 delete pParaObj;
     579                 :          0 :                                 bDisable = false;
     580                 :            :                             }
     581                 :            :                         }
     582                 :            :                     }
     583                 :            :                 }
     584         [ #  # ]:          0 :             }
     585                 :            :         }
     586                 :            : 
     587         [ #  # ]:          0 :         if (bDisable)
     588                 :          0 :             rSet.DisableItem (SID_EXPAND_PAGE);
     589                 :            :     }
     590                 :            : 
     591         [ -  + ]:          2 :     if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_SUMMARY_PAGE))
     592                 :            :     {
     593                 :          0 :         bool bDisable = true;
     594         [ #  # ]:          0 :         if (eEditMode == EM_PAGE)
     595                 :            :         {
     596                 :            :             // At least one of the selected pages has to contain a title
     597                 :            :             // presentation objects in order to enable the summary page menu
     598                 :            :             // entry.
     599                 :            :             model::PageEnumeration aSelectedPages (
     600                 :            :                 model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
     601 [ #  # ][ #  # ]:          0 :                     mrSlideSorter.GetModel()));
     602 [ #  # ][ #  # ]:          0 :             while (aSelectedPages.HasMoreElements())
     603                 :            :             {
     604 [ #  # ][ #  # ]:          0 :                 SdPage* pPage = aSelectedPages.GetNextElement()->GetPage();
                 [ #  # ]
     605         [ #  # ]:          0 :                 SdrObject* pObj = pPage->GetPresObj(PRESOBJ_TITLE);
     606                 :            : 
     607 [ #  # ][ #  # ]:          0 :                 if (pObj!=NULL && !pObj->IsEmptyPresObj())
         [ #  # ][ #  # ]
     608                 :          0 :                     bDisable = false;
     609         [ #  # ]:          0 :             }
     610                 :            :         }
     611         [ #  # ]:          0 :         if (bDisable)
     612                 :          0 :             rSet.DisableItem (SID_SUMMARY_PAGE);
     613                 :            :     }
     614                 :            : 
     615                 :            :     // Starten der Praesentation moeglich?
     616   [ +  -  -  + ]:          4 :     if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PRESENTATION ) ||
                 [ -  + ]
     617                 :          2 :         SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_REHEARSE_TIMINGS ) )
     618                 :            :     {
     619                 :          0 :         sal_Bool bDisable = sal_True;
     620                 :            :         model::PageEnumeration aAllPages (
     621 [ #  # ][ #  # ]:          0 :             model::PageEnumerationProvider::CreateAllPagesEnumeration(mrSlideSorter.GetModel()));
     622 [ #  # ][ #  # ]:          0 :         while (aAllPages.HasMoreElements())
     623                 :            :         {
     624 [ #  # ][ #  # ]:          0 :             SdPage* pPage = aAllPages.GetNextElement()->GetPage();
                 [ #  # ]
     625                 :            : 
     626         [ #  # ]:          0 :             if( !pPage->IsExcluded() )
     627                 :          0 :                 bDisable = sal_False;
     628                 :            :         }
     629 [ #  # ][ #  # ]:          0 :         if( bDisable || pDocShell->IsPreview())
         [ #  # ][ #  # ]
     630                 :            :         {
     631         [ #  # ]:          0 :             rSet.DisableItem( SID_PRESENTATION );
     632         [ #  # ]:          0 :             rSet.DisableItem( SID_REHEARSE_TIMINGS );
     633         [ #  # ]:          0 :         }
     634                 :            :     }
     635                 :            : 
     636                 :            : 
     637                 :            :     // Disable the rename slots when there are no or more than one slides/master
     638                 :            :     // pages selected.
     639   [ +  -  -  + ]:          4 :     if (rSet.GetItemState(SID_RENAMEPAGE) == SFX_ITEM_AVAILABLE
                 [ -  + ]
     640                 :          2 :         || rSet.GetItemState(SID_RENAME_MASTER_PAGE)  == SFX_ITEM_AVAILABLE)
     641                 :            :     {
     642         [ #  # ]:          0 :         if (mrSlideSorter.GetController().GetPageSelector().GetSelectedPageCount() != 1)
     643                 :            :         {
     644                 :          0 :             rSet.DisableItem(SID_RENAMEPAGE);
     645                 :          0 :             rSet.DisableItem(SID_RENAME_MASTER_PAGE);
     646                 :            :         }
     647                 :            :     }
     648                 :            : 
     649   [ +  -  -  + ]:          4 :     if (rSet.GetItemState(SID_HIDE_SLIDE) == SFX_ITEM_AVAILABLE
                 [ -  + ]
     650                 :          2 :         || rSet.GetItemState(SID_SHOW_SLIDE)  == SFX_ITEM_AVAILABLE)
     651                 :            :     {
     652                 :            :         model::PageEnumeration aSelectedPages (
     653                 :            :             model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
     654 [ #  # ][ #  # ]:          0 :                 mrSlideSorter.GetModel()));
     655         [ #  # ]:          0 :         const SlideExclusionState eState (GetSlideExclusionState(aSelectedPages));
     656   [ #  #  #  #  :          0 :         switch (eState)
                      # ]
     657                 :            :         {
     658                 :            :             case MIXED:
     659                 :            :                 // Show both entries.
     660                 :          0 :                 break;
     661                 :            : 
     662                 :            :             case EXCLUDED:
     663         [ #  # ]:          0 :                 rSet.DisableItem(SID_HIDE_SLIDE);
     664                 :          0 :                 break;
     665                 :            : 
     666                 :            :             case INCLUDED:
     667         [ #  # ]:          0 :                 rSet.DisableItem(SID_SHOW_SLIDE);
     668                 :          0 :                 break;
     669                 :            : 
     670                 :            :             case UNDEFINED:
     671         [ #  # ]:          0 :                 rSet.DisableItem(SID_HIDE_SLIDE);
     672         [ #  # ]:          0 :                 rSet.DisableItem(SID_SHOW_SLIDE);
     673                 :          0 :                 break;
     674         [ #  # ]:          0 :         }
     675                 :            :     }
     676                 :            : 
     677                 :            : 
     678                 :          2 :     PageKind ePageKind = mrSlideSorter.GetModel().GetPageType();
     679 [ #  # ][ -  + ]:          2 :     if ((eEditMode == EM_MASTERPAGE) && (ePageKind != PK_HANDOUT))
     680                 :            :     {
     681                 :          0 :         rSet.DisableItem(SID_ASSIGN_LAYOUT);
     682                 :            :     }
     683                 :            : 
     684 [ +  - ][ -  + ]:          2 :     if ((eEditMode == EM_MASTERPAGE) || (ePageKind==PK_NOTES))
     685                 :            :     {
     686                 :          0 :         rSet.DisableItem(SID_INSERTPAGE);
     687                 :            :     }
     688                 :            : 
     689                 :            :     // Disable some slots when in master page mode.
     690         [ -  + ]:          2 :     if (eEditMode == EM_MASTERPAGE)
     691                 :            :     {
     692         [ #  # ]:          0 :         if (rSet.GetItemState(SID_INSERTPAGE) == SFX_ITEM_AVAILABLE)
     693                 :          0 :             rSet.DisableItem(SID_INSERTPAGE);
     694         [ #  # ]:          0 :         if (rSet.GetItemState(SID_DUPLICATE_PAGE) == SFX_ITEM_AVAILABLE)
     695                 :          0 :             rSet.DisableItem(SID_DUPLICATE_PAGE);
     696                 :            :     }
     697                 :          2 : }
     698                 :            : 
     699                 :            : 
     700                 :            : 
     701                 :            : 
     702                 :          0 : void SlotManager::GetClipboardState ( SfxItemSet& rSet)
     703                 :            : {
     704                 :          0 :     SdTransferable* pTransferClip = SD_MOD()->pTransferClip;
     705                 :            : 
     706         [ #  # ]:          0 :     if (rSet.GetItemState(SID_PASTE)  == SFX_ITEM_AVAILABLE
           [ #  #  #  # ]
     707                 :          0 :         || rSet.GetItemState(SID_PASTE_SPECIAL)  == SFX_ITEM_AVAILABLE)
     708                 :            :     {
     709                 :            :         // Keine eigenen Clipboard-Daten?
     710 [ #  # ][ #  # ]:          0 :         if ( !pTransferClip || !pTransferClip->GetDocShell() )
                 [ #  # ]
     711                 :            :         {
     712                 :          0 :             rSet.DisableItem(SID_PASTE);
     713                 :          0 :             rSet.DisableItem(SID_PASTE_SPECIAL);
     714                 :            :         }
     715                 :            :         else
     716                 :            :         {
     717                 :          0 :             SfxObjectShell* pTransferDocShell = pTransferClip->GetDocShell();
     718                 :            : 
     719 [ #  # ][ #  # ]:          0 :             if( !pTransferDocShell || ( (DrawDocShell*) pTransferDocShell)->GetDoc()->GetPageCount() <= 1 )
                 [ #  # ]
     720                 :            :             {
     721                 :          0 :                 bool bIsPastingSupported (false);
     722                 :            : 
     723                 :            :                 // No or just one page.  Check if there is anything that can be
     724                 :            :                 // pasted via a DrawViewShell.
     725                 :          0 :                 ViewShellBase* pBase = mrSlideSorter.GetViewShellBase();
     726         [ #  # ]:          0 :                 if (pBase != NULL)
     727                 :            :                 {
     728                 :            :                     ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
     729 [ #  # ][ #  # ]:          0 :                         ::boost::dynamic_pointer_cast<DrawViewShell>(pBase->GetMainViewShell()));
                 [ #  # ]
     730         [ #  # ]:          0 :                     if (pDrawViewShell.get() != NULL)
     731                 :            :                     {
     732                 :            :                         TransferableDataHelper aDataHelper (
     733                 :            :                             TransferableDataHelper::CreateFromSystemClipboard(
     734 [ #  # ][ #  # ]:          0 :                                 pDrawViewShell->GetActiveWindow()));
     735 [ #  # ][ #  # ]:          0 :                         if (aDataHelper.GetFormatCount() > 0)
     736         [ #  # ]:          0 :                             bIsPastingSupported = true;
     737         [ #  # ]:          0 :                     }
     738                 :            :                 }
     739                 :            : 
     740         [ #  # ]:          0 :                 if ( ! bIsPastingSupported)
     741                 :            :                 {
     742                 :          0 :                     rSet.DisableItem(SID_PASTE);
     743                 :          0 :                     rSet.DisableItem(SID_PASTE_SPECIAL);
     744                 :            :                 }
     745                 :            :             }
     746                 :            :         }
     747                 :            :     }
     748                 :            : 
     749                 :            :     // Cut, copy and paste of master pages is not yet implemented properly
     750   [ #  #  #  #  :          0 :     if (rSet.GetItemState(SID_COPY) == SFX_ITEM_AVAILABLE
             #  #  #  # ]
                 [ #  # ]
     751                 :          0 :         || rSet.GetItemState(SID_PASTE)  == SFX_ITEM_AVAILABLE
     752                 :          0 :         || rSet.GetItemState(SID_PASTE_SPECIAL)  == SFX_ITEM_AVAILABLE
     753                 :          0 :         || rSet.GetItemState(SID_CUT)  == SFX_ITEM_AVAILABLE)
     754                 :            :     {
     755         [ #  # ]:          0 :         if (mrSlideSorter.GetModel().GetEditMode() == EM_MASTERPAGE)
     756                 :            :         {
     757         [ #  # ]:          0 :             if (rSet.GetItemState(SID_CUT) == SFX_ITEM_AVAILABLE)
     758                 :          0 :                 rSet.DisableItem(SID_CUT);
     759         [ #  # ]:          0 :             if (rSet.GetItemState(SID_COPY) == SFX_ITEM_AVAILABLE)
     760                 :          0 :                 rSet.DisableItem(SID_COPY);
     761         [ #  # ]:          0 :             if (rSet.GetItemState(SID_PASTE) == SFX_ITEM_AVAILABLE)
     762                 :          0 :                 rSet.DisableItem(SID_PASTE);
     763         [ #  # ]:          0 :             if (rSet.GetItemState(SID_PASTE_SPECIAL) == SFX_ITEM_AVAILABLE)
     764                 :          0 :                 rSet.DisableItem(SID_PASTE_SPECIAL);
     765                 :            :         }
     766                 :            :     }
     767                 :            : 
     768                 :            :     // Cut, copy, and delete page are disabled when there is no selection.
     769   [ #  #  #  #  :          0 :     if (rSet.GetItemState(SID_CUT) == SFX_ITEM_AVAILABLE
          #  #  #  #  #  
              # ][ #  # ]
     770                 :          0 :         || rSet.GetItemState(SID_COPY)  == SFX_ITEM_AVAILABLE
     771                 :          0 :         || rSet.GetItemState(SID_DELETE) == SFX_ITEM_AVAILABLE
     772                 :          0 :         || rSet.GetItemState(SID_DELETE_PAGE) == SFX_ITEM_AVAILABLE
     773                 :          0 :         || rSet.GetItemState(SID_DELETE_MASTER_PAGE) == SFX_ITEM_AVAILABLE)
     774                 :            :     {
     775                 :            :         model::PageEnumeration aSelectedPages (
     776                 :            :             model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
     777 [ #  # ][ #  # ]:          0 :                 mrSlideSorter.GetModel()));
     778                 :            : 
     779                 :            :         // For copy to work we have to have at least one selected page.
     780 [ #  # ][ #  # ]:          0 :         if ( ! aSelectedPages.HasMoreElements())
     781         [ #  # ]:          0 :             rSet.DisableItem(SID_COPY);
     782                 :            : 
     783                 :          0 :         bool bDisable = false;
     784                 :            :         // The operations that lead to the deletion of a page are valid if
     785                 :            :         // a) there is at least one selected page
     786                 :            :         // b) deleting the selected pages leaves at least one page in the
     787                 :            :         // document
     788                 :            :         // c) selected master pages must not be used by slides.
     789                 :            : 
     790                 :            :         // Test a).
     791 [ #  # ][ #  # ]:          0 :         if ( ! aSelectedPages.HasMoreElements())
     792                 :          0 :             bDisable = true;
     793                 :            :         // Test b): Count the number of selected pages.  It has to be less
     794                 :            :         // than the number of all pages.
     795 [ #  # ][ #  # ]:          0 :         else if (mrSlideSorter.GetController().GetPageSelector().GetSelectedPageCount()
         [ #  # ][ #  # ]
     796 [ #  # ][ #  # ]:          0 :             >= mrSlideSorter.GetController().GetPageSelector().GetPageCount())
                 [ #  # ]
     797                 :          0 :             bDisable = true;
     798                 :            :         // Test c): Iterate over the selected pages and look for a master
     799                 :            :         // page that is used by at least one page.
     800 [ #  # ][ #  # ]:          0 :         else while (aSelectedPages.HasMoreElements())
     801                 :            :         {
     802 [ #  # ][ #  # ]:          0 :             SdPage* pPage = aSelectedPages.GetNextElement()->GetPage();
                 [ #  # ]
     803         [ #  # ]:          0 :             int nUseCount (mrSlideSorter.GetModel().GetDocument()
     804 [ #  # ][ #  # ]:          0 :                 ->GetMasterPageUserCount(pPage));
     805         [ #  # ]:          0 :             if (nUseCount > 0)
     806                 :            :             {
     807                 :          0 :                 bDisable = true;
     808                 :          0 :                 break;
     809                 :            :             }
     810                 :            :         }
     811                 :            : 
     812         [ #  # ]:          0 :         if (bDisable)
     813                 :            :         {
     814         [ #  # ]:          0 :             rSet.DisableItem(SID_CUT);
     815         [ #  # ]:          0 :             rSet.DisableItem(SID_DELETE_PAGE);
     816         [ #  # ]:          0 :             rSet.DisableItem(SID_DELETE_MASTER_PAGE);
     817         [ #  # ]:          0 :         }
     818                 :            :     }
     819                 :          0 : }
     820                 :            : 
     821                 :            : 
     822                 :            : 
     823                 :            : 
     824                 :          0 : void SlotManager::GetStatusBarState (SfxItemSet& rSet)
     825                 :            : {
     826                 :            :     // Seitenanzeige und Layout
     827                 :          0 :     SdPage* pPage      = NULL;
     828                 :          0 :     SdPage* pFirstPage = NULL;
     829                 :            :     sal_uInt16  nFirstPage;
     830 [ #  # ][ #  # ]:          0 :     sal_uInt16  nSelectedPages = (sal_uInt16)mrSlideSorter.GetController().GetPageSelector().GetSelectedPageCount();
                 [ #  # ]
     831                 :          0 :     rtl::OUString aPageStr;
     832         [ #  # ]:          0 :     String aLayoutStr;
     833                 :            : 
     834         [ #  # ]:          0 :     if (nSelectedPages > 0)
     835 [ #  # ][ #  # ]:          0 :         aPageStr = SD_RESSTR(STR_SD_PAGE);
     836                 :            : 
     837         [ #  # ]:          0 :     if (nSelectedPages == 1)
     838                 :            :     {
     839                 :            :         model::PageEnumeration aSelectedPages (
     840                 :            :             model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
     841 [ #  # ][ #  # ]:          0 :                 mrSlideSorter.GetModel()));
     842         [ #  # ]:          0 :         model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
     843         [ #  # ]:          0 :         if (pDescriptor)
     844                 :            :         {
     845         [ #  # ]:          0 :             pPage = pDescriptor->GetPage();
     846         [ #  # ]:          0 :             nFirstPage = pPage->GetPageNum()/2;
     847                 :          0 :             pFirstPage = pPage;
     848                 :            : 
     849                 :          0 :             aPageStr += " ";
     850                 :          0 :             aPageStr += rtl::OUString::valueOf( static_cast<sal_Int32>(nFirstPage + 1) );
     851                 :          0 :             aPageStr += " / " ;
     852 [ #  # ][ #  # ]:          0 :             aPageStr += rtl::OUString::valueOf(mrSlideSorter.GetModel().GetPageCount());
     853                 :            : 
     854 [ #  # ][ #  # ]:          0 :             aLayoutStr = pFirstPage->GetLayoutName();
                 [ #  # ]
     855 [ #  # ][ #  # ]:          0 :             aLayoutStr.Erase( aLayoutStr.SearchAscii( SD_LT_SEPARATOR ) );
     856 [ #  # ][ #  # ]:          0 :         }
     857                 :            :     }
     858                 :            : 
     859 [ #  # ][ #  # ]:          0 :     rSet.Put( SfxStringItem( SID_STATUS_PAGE, aPageStr ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     860 [ #  # ][ #  # ]:          0 :     rSet.Put( SfxStringItem( SID_STATUS_LAYOUT, aLayoutStr ) );
                 [ #  # ]
     861                 :            : 
     862 [ #  # ][ #  # ]:          0 :     if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_ZOOMSLIDER ) )
     863                 :            :     {
     864 [ #  # ][ #  # ]:          0 :         rSet.Put( SfxVoidItem( SID_ATTR_ZOOMSLIDER ) );
                 [ #  # ]
     865         [ #  # ]:          0 :     }
     866                 :          0 : }
     867                 :            : 
     868                 :          0 : void SlotManager::ShowSlideShow( SfxRequest& rReq)
     869                 :            : {
     870 [ #  # ][ #  # ]:          0 :     Reference< XPresentation2 > xPresentation( mrSlideSorter.GetModel().GetDocument()->getPresentation() );
                 [ #  # ]
     871         [ #  # ]:          0 :     if( xPresentation.is() )
     872                 :            :     {
     873         [ #  # ]:          0 :         if( ( SID_REHEARSE_TIMINGS != rReq.GetSlot() ) )
     874 [ #  # ][ #  # ]:          0 :             xPresentation->start();
     875                 :            :         else
     876 [ #  # ][ #  # ]:          0 :             xPresentation->rehearseTimings();
     877                 :          0 :     }
     878                 :          0 : }
     879                 :            : 
     880                 :          0 : void SlotManager::RenameSlide (void)
     881                 :            : {
     882                 :          0 :     PageKind ePageKind = mrSlideSorter.GetModel().GetPageType();
     883                 :          0 :     View* pDrView = &mrSlideSorter.GetView();
     884                 :            : 
     885 [ #  # ][ #  # ]:          0 :     if (ePageKind==PK_STANDARD || ePageKind==PK_NOTES)
     886                 :            :     {
     887 [ #  # ][ #  # ]:          0 :         if ( pDrView->IsTextEdit() )
     888                 :            :         {
     889         [ #  # ]:          0 :             pDrView->SdrEndTextEdit();
     890                 :            :         }
     891                 :            : 
     892                 :          0 :         SdPage* pSelectedPage = NULL;
     893                 :            :         model::PageEnumeration aSelectedPages (
     894                 :            :             model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
     895 [ #  # ][ #  # ]:          0 :                 mrSlideSorter.GetModel()));
     896 [ #  # ][ #  # ]:          0 :         if (aSelectedPages.HasMoreElements())
     897 [ #  # ][ #  # ]:          0 :             pSelectedPage = aSelectedPages.GetNextElement()->GetPage();
                 [ #  # ]
     898         [ #  # ]:          0 :         if (pSelectedPage != NULL)
     899                 :            :         {
     900 [ #  # ][ #  # ]:          0 :             String aTitle( SdResId( STR_TITLE_RENAMESLIDE ) );
     901 [ #  # ][ #  # ]:          0 :             String aDescr( SdResId( STR_DESC_RENAMESLIDE ) );
     902 [ #  # ][ #  # ]:          0 :             String aPageName = pSelectedPage->GetName();
     903                 :            : 
     904         [ #  # ]:          0 :             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     905                 :            :             DBG_ASSERT(pFact, "Dialogdiet fail!");
     906                 :            :             AbstractSvxNameDialog* aNameDlg = pFact->CreateSvxNameDialog(
     907 [ #  # ][ #  # ]:          0 :                 mrSlideSorter.GetContentWindow().get(),
     908         [ #  # ]:          0 :                 aPageName, aDescr);
     909                 :            :             DBG_ASSERT(aNameDlg, "Dialogdiet fail!");
     910         [ #  # ]:          0 :             aNameDlg->SetText( aTitle );
     911 [ #  # ][ #  # ]:          0 :             aNameDlg->SetCheckNameHdl( LINK( this, SlotManager, RenameSlideHdl ), true );
     912         [ #  # ]:          0 :             aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE );
     913                 :            : 
     914 [ #  # ][ #  # ]:          0 :             if( aNameDlg->Execute() == RET_OK )
     915                 :            :             {
     916         [ #  # ]:          0 :                 String aNewName;
     917         [ #  # ]:          0 :                 aNameDlg->GetName( aNewName );
     918 [ #  # ][ #  # ]:          0 :                 if( ! aNewName.Equals( aPageName ) )
     919                 :            :                 {
     920                 :            : #ifdef DBG_UTIL
     921                 :            :                     bool bResult =
     922                 :            : #endif
     923                 :            :                         RenameSlideFromDrawViewShell(
     924 [ #  # ][ #  # ]:          0 :                           pSelectedPage->GetPageNum()/2, aNewName );
     925                 :            :                     DBG_ASSERT( bResult, "Couldn't rename slide" );
     926         [ #  # ]:          0 :                 }
     927                 :            :             }
     928 [ #  # ][ #  # ]:          0 :             delete aNameDlg;
     929                 :            : 
     930                 :            :             // Tell the slide sorter about the name change (necessary for
     931                 :            :             // accessibility.)
     932         [ #  # ]:          0 :             mrSlideSorter.GetController().PageNameHasChanged(
     933 [ #  # ][ #  # ]:          0 :                 (pSelectedPage->GetPageNum()-1)/2, aPageName);
         [ #  # ][ #  # ]
                 [ #  # ]
     934         [ #  # ]:          0 :         }
     935                 :            :     }
     936                 :          0 : }
     937                 :            : 
     938                 :          0 : IMPL_LINK(SlotManager, RenameSlideHdl, AbstractSvxNameDialog*, pDialog)
     939                 :            : {
     940         [ #  # ]:          0 :     if( ! pDialog )
     941                 :          0 :         return 0;
     942                 :            : 
     943         [ #  # ]:          0 :     String aNewName;
     944         [ #  # ]:          0 :     pDialog->GetName( aNewName );
     945                 :            : 
     946                 :            :     model::SharedPageDescriptor pDescriptor (
     947 [ #  # ][ #  # ]:          0 :         mrSlideSorter.GetController().GetCurrentSlideManager()->GetCurrentSlide());
         [ #  # ][ #  # ]
     948                 :          0 :     SdPage* pCurrentPage = NULL;
     949         [ #  # ]:          0 :     if (pDescriptor.get() != NULL)
     950         [ #  # ]:          0 :         pCurrentPage = pDescriptor->GetPage();
     951                 :            : 
     952 [ #  # ][ #  # ]:          0 :     return ( (pCurrentPage!=NULL && aNewName.Equals( pCurrentPage->GetName() ))
     953         [ #  # ]:          0 :         || (mrSlideSorter.GetViewShell()
     954 [ #  # ][ #  # ]:          0 :             && mrSlideSorter.GetViewShell()->GetDocSh()->IsNewPageNameValid( aNewName ) ));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     955                 :            : }
     956                 :            : 
     957                 :          0 : bool SlotManager::RenameSlideFromDrawViewShell( sal_uInt16 nPageId, const String & rName  )
     958                 :            : {
     959                 :            :     sal_Bool   bOutDummy;
     960 [ #  # ][ #  # ]:          0 :     SdDrawDocument* pDocument = mrSlideSorter.GetModel().GetDocument();
     961 [ #  # ][ #  # ]:          0 :     if( pDocument->GetPageByName( rName, bOutDummy ) != SDRPAGE_NOTFOUND )
     962                 :          0 :         return false;
     963                 :            : 
     964                 :          0 :     SdPage* pPageToRename = NULL;
     965 [ #  # ][ #  # ]:          0 :     PageKind ePageKind = mrSlideSorter.GetModel().GetPageType();
     966                 :            : 
     967         [ #  # ]:          0 :     ::svl::IUndoManager* pManager = pDocument->GetDocSh()->GetUndoManager();
     968                 :            : 
     969 [ #  # ][ #  # ]:          0 :     if( mrSlideSorter.GetModel().GetEditMode() == EM_PAGE )
                 [ #  # ]
     970                 :            :     {
     971                 :            :         model::SharedPageDescriptor pDescriptor (
     972 [ #  # ][ #  # ]:          0 :             mrSlideSorter.GetController().GetCurrentSlideManager()->GetCurrentSlide());
         [ #  # ][ #  # ]
     973         [ #  # ]:          0 :         if (pDescriptor.get() != NULL)
     974         [ #  # ]:          0 :             pPageToRename = pDescriptor->GetPage();
     975                 :            : 
     976         [ #  # ]:          0 :         if (pPageToRename != NULL)
     977                 :            :         {
     978                 :            :             // Undo
     979                 :          0 :             SdPage* pUndoPage = pPageToRename;
     980                 :          0 :             SdrLayerAdmin &  rLayerAdmin = pDocument->GetLayerAdmin();
     981 [ #  # ][ #  # ]:          0 :             sal_uInt8 nBackground = rLayerAdmin.GetLayerID( String( SdResId( STR_LAYER_BCKGRND )), sal_False );
         [ #  # ][ #  # ]
     982 [ #  # ][ #  # ]:          0 :             sal_uInt8 nBgObj = rLayerAdmin.GetLayerID( String( SdResId( STR_LAYER_BCKGRNDOBJ )), sal_False );
         [ #  # ][ #  # ]
     983         [ #  # ]:          0 :             SetOfByte aVisibleLayers = pPageToRename->TRG_GetMasterPageVisibleLayers();
     984                 :            : 
     985                 :            :             // (#67720#)
     986                 :            :             ModifyPageUndoAction* pAction = new ModifyPageUndoAction(
     987                 :            :                 pDocument, pUndoPage, rName, pUndoPage->GetAutoLayout(),
     988                 :          0 :                 aVisibleLayers.IsSet( nBackground ),
     989 [ #  # ][ #  # ]:          0 :                 aVisibleLayers.IsSet( nBgObj ));
         [ #  # ][ #  # ]
     990         [ #  # ]:          0 :             pManager->AddUndoAction( pAction );
     991                 :            : 
     992                 :            :             // rename
     993         [ #  # ]:          0 :             pPageToRename->SetName( rName );
     994                 :            : 
     995         [ #  # ]:          0 :             if( ePageKind == PK_STANDARD )
     996                 :            :             {
     997                 :            :                 // also rename notes-page
     998         [ #  # ]:          0 :                 SdPage* pNotesPage = pDocument->GetSdPage( nPageId, PK_NOTES );
     999         [ #  # ]:          0 :                 if (pNotesPage != NULL)
    1000         [ #  # ]:          0 :                     pNotesPage->SetName (rName);
    1001                 :            :             }
    1002         [ #  # ]:          0 :         }
    1003                 :            :     }
    1004                 :            :     else
    1005                 :            :     {
    1006                 :            :         // rename MasterPage -> rename LayoutTemplate
    1007         [ #  # ]:          0 :         pPageToRename = pDocument->GetMasterSdPage( nPageId, ePageKind );
    1008         [ #  # ]:          0 :         if (pPageToRename != NULL)
    1009                 :            :         {
    1010         [ #  # ]:          0 :             const String aOldLayoutName( pPageToRename->GetLayoutName() );
    1011 [ #  # ][ #  # ]:          0 :             pManager->AddUndoAction( new RenameLayoutTemplateUndoAction( pDocument, aOldLayoutName, rName ) );
                 [ #  # ]
    1012 [ #  # ][ #  # ]:          0 :             pDocument->RenameLayoutTemplate( aOldLayoutName, rName );
    1013                 :            :         }
    1014                 :            :     }
    1015                 :            : 
    1016 [ #  # ][ #  # ]:          0 :     bool bSuccess = pPageToRename!=NULL && ( sal_False != rName.Equals( pPageToRename->GetName()));
         [ #  # ][ #  # ]
    1017                 :            : 
    1018         [ #  # ]:          0 :     if( bSuccess )
    1019                 :            :     {
    1020                 :            :         // user edited page names may be changed by the page so update control
    1021                 :            :         //        aTabControl.SetPageText( nPageId, rName );
    1022                 :            : 
    1023                 :            :         // set document to modified state
    1024         [ #  # ]:          0 :         pDocument->SetChanged( sal_True );
    1025                 :            : 
    1026                 :            :         // inform navigator about change
    1027         [ #  # ]:          0 :         SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True );
    1028 [ #  # ][ #  # ]:          0 :         if (mrSlideSorter.GetViewShell() != NULL)
    1029         [ #  # ]:          0 :             mrSlideSorter.GetViewShell()->GetDispatcher()->Execute(
    1030 [ #  # ][ #  # ]:          0 :                 SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
                 [ #  # ]
    1031                 :            :     }
    1032                 :            : 
    1033                 :          0 :     return bSuccess;
    1034                 :            : }
    1035                 :            : 
    1036                 :            : 
    1037                 :            : 
    1038                 :            : 
    1039                 :            : /** Insert a slide.  The insertion position depends on a) the selection and
    1040                 :            :     b) the mouse position when there is no selection.
    1041                 :            : 
    1042                 :            :     When there is a selection then insertion takes place after the last
    1043                 :            :     slide of the selection.  For this to work all but the last selected
    1044                 :            :     slide are deselected first.
    1045                 :            : 
    1046                 :            :     Otherwise, when there is no selection but the insertion marker is visible
    1047                 :            :     the slide is inserted at that position.  The slide before that marker is
    1048                 :            :     selected first.
    1049                 :            : 
    1050                 :            :     When both the selection and the insertion marker are not visible--can
    1051                 :            :     that happen?--the new slide is inserted after the last slide.
    1052                 :            : */
    1053                 :          0 : void SlotManager::InsertSlide (SfxRequest& rRequest)
    1054                 :            : {
    1055         [ #  # ]:          0 :     const sal_Int32 nInsertionIndex (GetInsertionPosition());
    1056                 :            : 
    1057         [ #  # ]:          0 :     PageSelector::BroadcastLock aBroadcastLock (mrSlideSorter);
    1058                 :            : 
    1059                 :          0 :     SdPage* pNewPage = NULL;
    1060 [ #  # ][ #  # ]:          0 :     if (mrSlideSorter.GetModel().GetEditMode() == EM_PAGE)
                 [ #  # ]
    1061                 :            :     {
    1062                 :            :         SlideSorterViewShell* pShell = dynamic_cast<SlideSorterViewShell*>(
    1063 [ #  # ][ #  # ]:          0 :             mrSlideSorter.GetViewShell());
    1064         [ #  # ]:          0 :         if (pShell != NULL)
    1065                 :            :         {
    1066                 :            :             pNewPage = pShell->CreateOrDuplicatePage (
    1067                 :            :                 rRequest,
    1068         [ #  # ]:          0 :                 mrSlideSorter.GetModel().GetPageType(),
    1069                 :            :                 nInsertionIndex>=0
    1070 [ #  # ][ #  # ]:          0 :                     ? mrSlideSorter.GetModel().GetPageDescriptor(nInsertionIndex)->GetPage()
         [ #  # ][ #  # ]
                 [ #  # ]
    1071   [ #  #  #  # ]:          0 :                         : NULL);
         [ #  # ][ #  # ]
    1072                 :            :         }
    1073                 :            :     }
    1074                 :            :     else
    1075                 :            :     {
    1076                 :            :         // Use the API to create a new page.
    1077 [ #  # ][ #  # ]:          0 :         SdDrawDocument* pDocument = mrSlideSorter.GetModel().GetDocument();
    1078                 :            :         Reference<drawing::XMasterPagesSupplier> xMasterPagesSupplier (
    1079 [ #  # ][ #  # ]:          0 :             pDocument->getUnoModel(), UNO_QUERY);
    1080         [ #  # ]:          0 :         if (xMasterPagesSupplier.is())
    1081                 :            :         {
    1082                 :            :             Reference<drawing::XDrawPages> xMasterPages (
    1083 [ #  # ][ #  # ]:          0 :                 xMasterPagesSupplier->getMasterPages());
    1084         [ #  # ]:          0 :             if (xMasterPages.is())
    1085                 :            :             {
    1086 [ #  # ][ #  # ]:          0 :                 xMasterPages->insertNewByIndex (nInsertionIndex+1);
    1087                 :            : 
    1088                 :            :                 // Create shapes for the default layout.
    1089                 :            :                 pNewPage = pDocument->GetMasterSdPage(
    1090         [ #  # ]:          0 :                     (sal_uInt16)(nInsertionIndex+1), PK_STANDARD);
    1091         [ #  # ]:          0 :                 pNewPage->CreateTitleAndLayout (sal_True,sal_True);
    1092                 :          0 :             }
    1093                 :          0 :         }
    1094                 :            :     }
    1095         [ #  # ]:          0 :     if (pNewPage == NULL)
    1096                 :          0 :         return;
    1097                 :            : 
    1098                 :            :     // When a new page has been inserted then select it, make it the
    1099                 :            :     // current page, and focus it.
    1100         [ #  # ]:          0 :     view::SlideSorterView::DrawLock aDrawLock (mrSlideSorter);
    1101         [ #  # ]:          0 :     PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
    1102 [ #  # ][ #  # ]:          0 :     mrSlideSorter.GetController().GetPageSelector().DeselectAllPages();
                 [ #  # ]
    1103 [ #  # ][ #  # ]:          0 :     mrSlideSorter.GetController().GetPageSelector().SelectPage(pNewPage);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1104                 :            : }
    1105                 :            : 
    1106                 :            : 
    1107                 :            : 
    1108                 :            : 
    1109                 :          0 : void SlotManager::DuplicateSelectedSlides (SfxRequest& rRequest)
    1110                 :            : {
    1111                 :            :     // Create a list of the pages that are to be duplicated.  The process of
    1112                 :            :     // duplication alters the selection.
    1113                 :          0 :     sal_Int32 nInsertPosition (0);
    1114         [ #  # ]:          0 :     ::std::vector<SdPage*> aPagesToDuplicate;
    1115                 :            :     model::PageEnumeration aSelectedPages (
    1116 [ #  # ][ #  # ]:          0 :         model::PageEnumerationProvider::CreateSelectedPagesEnumeration(mrSlideSorter.GetModel()));
    1117 [ #  # ][ #  # ]:          0 :     while (aSelectedPages.HasMoreElements())
    1118                 :            :     {
    1119         [ #  # ]:          0 :         model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
    1120 [ #  # ][ #  # ]:          0 :         if (pDescriptor && pDescriptor->GetPage())
         [ #  # ][ #  # ]
    1121                 :            :         {
    1122 [ #  # ][ #  # ]:          0 :             aPagesToDuplicate.push_back(pDescriptor->GetPage());
    1123 [ #  # ][ #  # ]:          0 :             nInsertPosition = pDescriptor->GetPage()->GetPageNum()+2;
    1124                 :            :         }
    1125         [ #  # ]:          0 :     }
    1126                 :            : 
    1127                 :            :     // Duplicate the pages in aPagesToDuplicate and collect the newly
    1128                 :            :     // created pages in aPagesToSelect.
    1129 [ #  # ][ #  # ]:          0 :     const bool bUndo (aPagesToDuplicate.size()>1 && mrSlideSorter.GetView().IsUndoEnabled());
         [ #  # ][ #  # ]
    1130         [ #  # ]:          0 :     if (bUndo)
    1131 [ #  # ][ #  # ]:          0 :         mrSlideSorter.GetView().BegUndo(String(SdResId(STR_INSERTPAGE)));
         [ #  # ][ #  # ]
                 [ #  # ]
    1132                 :            : 
    1133         [ #  # ]:          0 :     ::std::vector<SdPage*> aPagesToSelect;
    1134 [ #  # ][ #  # ]:          0 :     for(::std::vector<SdPage*>::const_iterator
    1135         [ #  # ]:          0 :             iPage(aPagesToDuplicate.begin()),
    1136         [ #  # ]:          0 :             iEnd(aPagesToDuplicate.end());
    1137                 :            :         iPage!=iEnd;
    1138                 :            :         ++iPage, nInsertPosition+=2)
    1139                 :            :     {
    1140                 :            :         aPagesToSelect.push_back(
    1141         [ #  # ]:          0 :             mrSlideSorter.GetViewShell()->CreateOrDuplicatePage(
    1142 [ #  # ][ #  # ]:          0 :                 rRequest, PK_STANDARD, *iPage, nInsertPosition));
    1143                 :            :     }
    1144                 :          0 :     aPagesToDuplicate.clear();
    1145                 :            : 
    1146         [ #  # ]:          0 :     if (bUndo)
    1147 [ #  # ][ #  # ]:          0 :         mrSlideSorter.GetView().EndUndo();
    1148                 :            : 
    1149                 :            :     // Set the selection to the pages in aPagesToSelect.
    1150 [ #  # ][ #  # ]:          0 :     PageSelector& rSelector (mrSlideSorter.GetController().GetPageSelector());
    1151         [ #  # ]:          0 :     rSelector.DeselectAllPages();
    1152                 :            :     ::std::for_each (
    1153                 :            :         aPagesToSelect.begin(),
    1154                 :            :         aPagesToSelect.end(),
    1155                 :            :         ::boost::bind(
    1156                 :            :             static_cast<void (PageSelector::*)(const SdPage*)>(&PageSelector::SelectPage),
    1157                 :            :             ::boost::ref(rSelector),
    1158 [ #  # ][ #  # ]:          0 :             _1));
         [ #  # ][ #  # ]
    1159                 :          0 : }
    1160                 :            : 
    1161                 :          0 : void SlotManager::ChangeSlideExclusionState (
    1162                 :            :     const model::SharedPageDescriptor& rpDescriptor,
    1163                 :            :     const bool bExcludeSlide)
    1164                 :            : {
    1165         [ #  # ]:          0 :     if (rpDescriptor)
    1166                 :            :     {
    1167                 :          0 :         mrSlideSorter.GetView().SetState(
    1168                 :            :             rpDescriptor,
    1169                 :            :             model::PageDescriptor::ST_Excluded,
    1170                 :          0 :             bExcludeSlide);
    1171                 :            :     }
    1172                 :            :     else
    1173                 :            :     {
    1174                 :            :         model::PageEnumeration aSelectedPages (
    1175                 :            :             model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
    1176 [ #  # ][ #  # ]:          0 :                 mrSlideSorter.GetModel()));
    1177 [ #  # ][ #  # ]:          0 :         while (aSelectedPages.HasMoreElements())
    1178                 :            :         {
    1179         [ #  # ]:          0 :             model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
    1180         [ #  # ]:          0 :             mrSlideSorter.GetView().SetState(
    1181                 :            :                 pDescriptor,
    1182                 :            :                 model::PageDescriptor::ST_Excluded,
    1183         [ #  # ]:          0 :                 bExcludeSlide);
    1184 [ #  # ][ #  # ]:          0 :         }
    1185                 :            :     }
    1186                 :            : 
    1187                 :          0 :     SfxBindings& rBindings (mrSlideSorter.GetViewShell()->GetViewFrame()->GetBindings());
    1188                 :          0 :     rBindings.Invalidate(SID_PRESENTATION);
    1189                 :          0 :     rBindings.Invalidate(SID_REHEARSE_TIMINGS);
    1190                 :          0 :     rBindings.Invalidate(SID_HIDE_SLIDE);
    1191                 :          0 :     rBindings.Invalidate(SID_SHOW_SLIDE);
    1192                 :          0 :     mrSlideSorter.GetModel().GetDocument()->SetChanged();
    1193                 :          0 : }
    1194                 :            : 
    1195                 :            : 
    1196                 :            : 
    1197                 :            : 
    1198                 :          0 : sal_Int32 SlotManager::GetInsertionPosition (void)
    1199                 :            : {
    1200                 :          0 :     PageSelector& rSelector (mrSlideSorter.GetController().GetPageSelector());
    1201                 :            : 
    1202                 :            :     // The insertion indicator is preferred.  After all the user explicitly
    1203                 :            :     // used it to define the insertion position.
    1204 [ #  # ][ #  # ]:          0 :     if (mrSlideSorter.GetController().GetInsertionIndicatorHandler()->IsActive())
    1205                 :            :     {
    1206                 :            :         // Select the page before the insertion indicator.
    1207         [ #  # ]:          0 :         return mrSlideSorter.GetController().GetInsertionIndicatorHandler()->GetInsertionPageIndex()
    1208                 :          0 :             - 1;
    1209                 :            :     }
    1210                 :            : 
    1211                 :            :     // Is there a stored insertion position?
    1212 [ #  # ][ #  # ]:          0 :     else if (mrSlideSorter.GetController().GetSelectionManager()->GetInsertionPosition() >= 0)
    1213                 :            :     {
    1214         [ #  # ]:          0 :         return mrSlideSorter.GetController().GetSelectionManager()->GetInsertionPosition() - 1;
    1215                 :            :     }
    1216                 :            : 
    1217                 :            :     // Use the index of the last selected slide.
    1218         [ #  # ]:          0 :     else if (rSelector.GetSelectedPageCount() > 0)
    1219                 :            :     {
    1220         [ #  # ]:          0 :         for (int nIndex=rSelector.GetPageCount()-1; nIndex>=0; --nIndex)
    1221         [ #  # ]:          0 :             if (rSelector.IsPageSelected(nIndex))
    1222                 :          0 :                 return nIndex;
    1223                 :            : 
    1224                 :            :         // We should never get here.
    1225                 :            :         OSL_ASSERT(false);
    1226                 :          0 :         return rSelector.GetPageCount() - 1;
    1227                 :            :     }
    1228                 :            : 
    1229                 :            :     // Select the last page when there is at least one page.
    1230         [ #  # ]:          0 :     else if (rSelector.GetPageCount() > 0)
    1231                 :            :     {
    1232                 :          0 :         return rSelector.GetPageCount() - 1;
    1233                 :            :     }
    1234                 :            : 
    1235                 :            :     // Hope for the best that CreateOrDuplicatePage() can cope with an empty
    1236                 :            :     // selection.
    1237                 :            :     else
    1238                 :            :     {
    1239                 :            :         // We should never get here because there has to be at least one page.
    1240                 :            :         OSL_ASSERT(false);
    1241                 :          0 :         return -1;
    1242                 :            :     }
    1243                 :            : }
    1244                 :            : 
    1245                 :            : 
    1246                 :            : 
    1247                 :            : 
    1248                 :        130 : void SlotManager::NotifyEditModeChange (void)
    1249                 :            : {
    1250                 :        130 :     SfxBindings& rBindings (mrSlideSorter.GetViewShell()->GetViewFrame()->GetBindings());
    1251                 :        130 :     rBindings.Invalidate(SID_PRESENTATION);
    1252                 :        130 :     rBindings.Invalidate(SID_INSERTPAGE);
    1253                 :        130 :     rBindings.Invalidate(SID_DUPLICATE_PAGE);
    1254                 :        130 : }
    1255                 :            : 
    1256                 :            : 
    1257                 :            : 
    1258                 :            : 
    1259                 :            : //-----------------------------------------------------------------------------
    1260                 :            : 
    1261                 :            : namespace {
    1262                 :            : 
    1263                 :            : 
    1264                 :            : 
    1265                 :          0 : SlideExclusionState GetSlideExclusionState (model::PageEnumeration& rPageSet)
    1266                 :            : {
    1267                 :          0 :     SlideExclusionState eState (UNDEFINED);
    1268                 :            :     sal_Bool bState;
    1269                 :            : 
    1270                 :            :     // Get toggle state of the selected pages.
    1271 [ #  # ][ #  # ]:          0 :     while (rPageSet.HasMoreElements() && eState!=MIXED)
                 [ #  # ]
    1272                 :            :     {
    1273         [ #  # ]:          0 :         bState = rPageSet.GetNextElement()->GetPage()->IsExcluded();
    1274   [ #  #  #  # ]:          0 :         switch (eState)
    1275                 :            :         {
    1276                 :            :             case UNDEFINED:
    1277                 :            :                 // Use the first selected page to set the inital value.
    1278         [ #  # ]:          0 :                 eState = bState ? EXCLUDED : INCLUDED;
    1279                 :          0 :                 break;
    1280                 :            : 
    1281                 :            :             case EXCLUDED:
    1282                 :            :                 // The pages before where all not part of the show,
    1283                 :            :                 // this one is.
    1284         [ #  # ]:          0 :                 if ( ! bState)
    1285                 :          0 :                     eState = MIXED;
    1286                 :          0 :                 break;
    1287                 :            : 
    1288                 :            :             case INCLUDED:
    1289                 :            :                 // The pages before where all part of the show,
    1290                 :            :                 // this one is not.
    1291         [ #  # ]:          0 :                 if (bState)
    1292                 :          0 :                     eState = MIXED;
    1293                 :          0 :                 break;
    1294                 :            : 
    1295                 :            :             case MIXED:
    1296                 :            :             default:
    1297                 :            :                 // No need to change anything.
    1298                 :          0 :                 break;
    1299                 :            :         }
    1300                 :            :     }
    1301                 :            : 
    1302                 :          0 :     return eState;
    1303                 :            : }
    1304                 :            : 
    1305                 :            : } // end of anonymous namespace
    1306                 :            : 
    1307 [ +  - ][ +  - ]:         75 : } } } // end of namespace ::sd::slidesorter::controller
    1308                 :            : 
    1309                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10