LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sd/source/ui/func - fusldlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 116 0.9 %
Date: 2013-07-09 Functions: 2 10 20.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "fusldlg.hxx"
      21             : #include <svl/itemset.hxx>
      22             : #include <vcl/msgbox.hxx>
      23             : 
      24             : #include "drawdoc.hxx"
      25             : #include "sdpage.hxx"
      26             : #include "sdresid.hxx"
      27             : #include "strings.hrc"
      28             : #include "sdattr.hxx"
      29             : #include "glob.hrc"
      30             : #include "sdmod.hxx"
      31             : #include "ViewShell.hxx"
      32             : #include "Window.hxx"
      33             : #include "optsitem.hxx"
      34             : #include "sdabstdlg.hxx"
      35             : 
      36             : namespace sd {
      37             : 
      38             : #define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
      39             : 
      40           0 : TYPEINIT1( FuSlideShowDlg, FuPoor );
      41             : 
      42             : 
      43           0 : FuSlideShowDlg::FuSlideShowDlg (
      44             :     ViewShell* pViewSh,
      45             :     ::sd::Window* pWin,
      46             :     ::sd::View* pView,
      47             :     SdDrawDocument* pDoc,
      48             :     SfxRequest& rReq)
      49           0 :     : FuPoor( pViewSh, pWin, pView, pDoc, rReq )
      50             : {
      51           0 : }
      52             : 
      53           0 : FunctionReference FuSlideShowDlg::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
      54             : {
      55           0 :     FunctionReference xFunc( new FuSlideShowDlg( pViewSh, pWin, pView, pDoc, rReq ) );
      56           0 :     xFunc->DoExecute(rReq);
      57           0 :     return xFunc;
      58             : }
      59             : 
      60           0 : void FuSlideShowDlg::DoExecute( SfxRequest& )
      61             : {
      62           0 :     PresentationSettings& rPresentationSettings = mpDoc->getPresentationSettings();
      63             : 
      64           0 :     SfxItemSet      aDlgSet( mpDoc->GetPool(), ATTR_PRESENT_START, ATTR_PRESENT_END );
      65           0 :     std::vector<String> aPageNameList(mpDoc->GetSdPageCount( PK_STANDARD ));
      66           0 :     const String&   rPresPage = rPresentationSettings.maPresPage;
      67           0 :     String          aFirstPage;
      68           0 :     SdPage*         pPage = NULL;
      69             :     long            nPage;
      70             : 
      71           0 :     for( nPage = mpDoc->GetSdPageCount( PK_STANDARD ) - 1L; nPage >= 0L; nPage-- )
      72             :     {
      73           0 :         pPage = mpDoc->GetSdPage( (sal_uInt16) nPage, PK_STANDARD );
      74           0 :         String aStr( pPage->GetName() );
      75             : 
      76           0 :         if ( !aStr.Len() )
      77             :         {
      78           0 :             aStr = String( SdResId( STR_PAGE ) );
      79           0 :             aStr.Append( OUString::valueOf( nPage + 1 ) );
      80             :         }
      81             : 
      82           0 :         aPageNameList[ nPage ] = aStr;
      83             : 
      84             :         // is this our (existing) first page?
      85           0 :         if ( rPresPage == aStr )
      86           0 :             aFirstPage = rPresPage;
      87           0 :         else if ( pPage->IsSelected() && !aFirstPage.Len() )
      88           0 :             aFirstPage = aStr;
      89           0 :     }
      90           0 :     SdCustomShowList* pCustomShowList = mpDoc->GetCustomShowList(); // No Create
      91             : 
      92           0 :     sal_Bool bStartWithActualPage = SD_MOD()->GetSdOptions( mpDoc->GetDocumentType() )->IsStartWithActualPage();
      93           0 :     if( !aFirstPage.Len() && pPage )
      94           0 :         aFirstPage = pPage->GetName();
      95             : 
      96           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ALL, rPresentationSettings.mbAll ) );
      97           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_CUSTOMSHOW, rPresentationSettings.mbCustomShow ) );
      98           0 :     aDlgSet.Put( SfxStringItem( ATTR_PRESENT_DIANAME, aFirstPage ) );
      99           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ENDLESS, rPresentationSettings.mbEndless ) );
     100           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_MANUEL, rPresentationSettings.mbManual ) );
     101           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_MOUSE, rPresentationSettings.mbMouseVisible ) );
     102           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_PEN, rPresentationSettings.mbMouseAsPen ) );
     103           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_NAVIGATOR, rPresentationSettings.mbStartWithNavigator ) );
     104           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ANIMATION_ALLOWED, rPresentationSettings.mbAnimationAllowed ) );
     105           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_CHANGE_PAGE, !rPresentationSettings.mbLockedPages ) );
     106           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ALWAYS_ON_TOP, rPresentationSettings.mbAlwaysOnTop ) );
     107           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_FULLSCREEN, rPresentationSettings.mbFullScreen ) );
     108           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_START_ACTUAL_PAGE, bStartWithActualPage ) );
     109           0 :     aDlgSet.Put( SfxUInt32Item( ATTR_PRESENT_PAUSE_TIMEOUT, rPresentationSettings.mnPauseTimeout ) );
     110           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_SHOW_PAUSELOGO, rPresentationSettings.mbShowPauseLogo ) );
     111             : 
     112           0 :     SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
     113           0 :     aDlgSet.Put( SfxInt32Item( ATTR_PRESENT_DISPLAY, pOptions->GetDisplay() ) );
     114             : 
     115           0 :     SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
     116           0 :     AbstractSdStartPresDlg* pDlg = pFact ? pFact->CreateSdStartPresentationDlg(mpWindow, aDlgSet, aPageNameList, pCustomShowList) : 0;
     117           0 :     if( pDlg && (pDlg->Execute() == RET_OK) )
     118             :     {
     119           0 :         OUString aPage;
     120             :         long    nValue32;
     121             :         sal_Bool bValue;
     122           0 :         bool    bValuesChanged = sal_False;
     123             : 
     124           0 :         pDlg->GetAttr( aDlgSet );
     125             : 
     126           0 :         aPage = ITEMVALUE( aDlgSet, ATTR_PRESENT_DIANAME, SfxStringItem );
     127           0 :         if( aPage != rPresentationSettings.maPresPage )
     128             :         {
     129           0 :             bValuesChanged = true;
     130           0 :             rPresentationSettings.maPresPage = aPage;
     131             :         }
     132             : 
     133           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ALL, SfxBoolItem );
     134           0 :         if ( bValue != rPresentationSettings.mbAll )
     135             :         {
     136           0 :             bValuesChanged = true;
     137           0 :             rPresentationSettings.mbAll = bValue;
     138             :         }
     139             : 
     140           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_CUSTOMSHOW, SfxBoolItem );
     141           0 :         if ( bValue != rPresentationSettings.mbCustomShow )
     142             :         {
     143           0 :             bValuesChanged = true;
     144           0 :             rPresentationSettings.mbCustomShow = bValue;
     145             :         }
     146             : 
     147           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ENDLESS, SfxBoolItem );
     148           0 :         if ( bValue != rPresentationSettings.mbEndless )
     149             :         {
     150           0 :             bValuesChanged = true;
     151           0 :             rPresentationSettings.mbEndless = bValue;
     152             :         }
     153             : 
     154           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_MANUEL, SfxBoolItem );
     155           0 :         if ( bValue != rPresentationSettings.mbManual )
     156             :         {
     157           0 :             bValuesChanged = true;
     158           0 :             rPresentationSettings.mbManual = bValue;
     159             :         }
     160             : 
     161           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_MOUSE, SfxBoolItem );
     162           0 :         if ( bValue != rPresentationSettings.mbMouseVisible )
     163             :         {
     164           0 :             bValuesChanged = true;
     165           0 :             rPresentationSettings.mbMouseVisible = bValue;
     166             :         }
     167             : 
     168           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_PEN, SfxBoolItem );
     169           0 :         if ( bValue != rPresentationSettings.mbMouseAsPen )
     170             :         {
     171           0 :             bValuesChanged = true;
     172           0 :             rPresentationSettings.mbMouseAsPen = bValue;
     173             :         }
     174             : 
     175           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_NAVIGATOR, SfxBoolItem );
     176           0 :         if( bValue != rPresentationSettings.mbStartWithNavigator )
     177             :         {
     178           0 :             bValuesChanged = true;
     179           0 :             rPresentationSettings.mbStartWithNavigator = bValue;
     180             :         }
     181             : 
     182           0 :         bValue = !ITEMVALUE( aDlgSet, ATTR_PRESENT_CHANGE_PAGE, SfxBoolItem );
     183           0 :         if ( bValue != rPresentationSettings.mbLockedPages )
     184             :         {
     185           0 :             bValuesChanged = true;
     186           0 :             rPresentationSettings.mbLockedPages = bValue;
     187             :         }
     188             : 
     189           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ANIMATION_ALLOWED, SfxBoolItem );
     190           0 :         if ( bValue != rPresentationSettings.mbAnimationAllowed )
     191             :         {
     192           0 :             bValuesChanged = true;
     193           0 :             rPresentationSettings.mbAnimationAllowed = bValue;
     194             :         }
     195             : 
     196           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ALWAYS_ON_TOP, SfxBoolItem );
     197           0 :         if ( bValue != rPresentationSettings.mbAlwaysOnTop )
     198             :         {
     199           0 :             bValuesChanged = true;
     200           0 :             rPresentationSettings.mbAlwaysOnTop = bValue;
     201             :         }
     202             : 
     203           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_FULLSCREEN, SfxBoolItem );
     204           0 :         if ( bValue != rPresentationSettings.mbFullScreen )
     205             :         {
     206           0 :             bValuesChanged = true;
     207           0 :             rPresentationSettings.mbFullScreen = bValue;
     208             :         }
     209             : 
     210           0 :         nValue32 = ITEMVALUE( aDlgSet, ATTR_PRESENT_PAUSE_TIMEOUT, SfxUInt32Item );
     211           0 :         if( nValue32 != rPresentationSettings.mnPauseTimeout )
     212             :         {
     213           0 :             bValuesChanged = true;
     214           0 :             rPresentationSettings.mnPauseTimeout = nValue32;
     215             :         }
     216             : 
     217           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_SHOW_PAUSELOGO, SfxBoolItem );
     218           0 :         if ( bValue != rPresentationSettings.mbShowPauseLogo )
     219             :         {
     220           0 :             bValuesChanged = true;
     221           0 :             rPresentationSettings.mbShowPauseLogo = bValue;
     222             :         }
     223             : 
     224           0 :         pOptions->SetDisplay( ITEMVALUE( aDlgSet, ATTR_PRESENT_DISPLAY, SfxInt32Item ) );
     225             : 
     226             :         // is something has changed, we set the modified flag
     227           0 :         if ( bValuesChanged )
     228           0 :             mpDoc->SetChanged( sal_True );
     229             :     }
     230           0 :     delete pDlg;
     231           0 : }
     232             : 
     233          33 : } // end of namespace sd
     234             : 
     235             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10