LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/func - fusldlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 117 0.9 %
Date: 2012-12-27 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             : /*************************************************************************
      44             : |*
      45             : |* Konstruktor
      46             : |*
      47             : \************************************************************************/
      48             : 
      49           0 : FuSlideShowDlg::FuSlideShowDlg (
      50             :     ViewShell* pViewSh,
      51             :     ::sd::Window* pWin,
      52             :     ::sd::View* pView,
      53             :     SdDrawDocument* pDoc,
      54             :     SfxRequest& rReq)
      55           0 :     : FuPoor( pViewSh, pWin, pView, pDoc, rReq )
      56             : {
      57           0 : }
      58             : 
      59           0 : FunctionReference FuSlideShowDlg::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
      60             : {
      61           0 :     FunctionReference xFunc( new FuSlideShowDlg( pViewSh, pWin, pView, pDoc, rReq ) );
      62           0 :     xFunc->DoExecute(rReq);
      63           0 :     return xFunc;
      64             : }
      65             : 
      66           0 : void FuSlideShowDlg::DoExecute( SfxRequest& )
      67             : {
      68           0 :     PresentationSettings& rPresentationSettings = mpDoc->getPresentationSettings();
      69             : 
      70           0 :     SfxItemSet      aDlgSet( mpDoc->GetPool(), ATTR_PRESENT_START, ATTR_PRESENT_END );
      71           0 :     std::vector<String> aPageNameList(mpDoc->GetSdPageCount( PK_STANDARD ));
      72           0 :     const String&   rPresPage = rPresentationSettings.maPresPage;
      73           0 :     String          aFirstPage;
      74           0 :     String          aStandardName( SdResId( STR_PAGE ) );
      75           0 :     SdPage*         pPage = NULL;
      76             :     long            nPage;
      77             : 
      78           0 :     for( nPage = mpDoc->GetSdPageCount( PK_STANDARD ) - 1L; nPage >= 0L; nPage-- )
      79             :     {
      80           0 :         pPage = mpDoc->GetSdPage( (sal_uInt16) nPage, PK_STANDARD );
      81           0 :         String aStr( pPage->GetName() );
      82             : 
      83           0 :         if ( !aStr.Len() )
      84             :         {
      85           0 :             aStr = String( SdResId( STR_PAGE ) );
      86           0 :             aStr.Append( UniString::CreateFromInt32( nPage + 1 ) );
      87             :         }
      88             : 
      89           0 :         aPageNameList[ nPage ] = aStr;
      90             : 
      91             :         // ist dies unsere (vorhandene) erste Seite?
      92           0 :         if ( rPresPage == aStr )
      93           0 :             aFirstPage = rPresPage;
      94           0 :         else if ( pPage->IsSelected() && !aFirstPage.Len() )
      95           0 :             aFirstPage = aStr;
      96           0 :     }
      97           0 :     SdCustomShowList* pCustomShowList = mpDoc->GetCustomShowList(); // No Create
      98             : 
      99           0 :     sal_Bool bStartWithActualPage = SD_MOD()->GetSdOptions( mpDoc->GetDocumentType() )->IsStartWithActualPage();
     100           0 :     if( !aFirstPage.Len() && pPage )
     101           0 :         aFirstPage = pPage->GetName();
     102             : 
     103           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ALL, rPresentationSettings.mbAll ) );
     104           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_CUSTOMSHOW, rPresentationSettings.mbCustomShow ) );
     105           0 :     aDlgSet.Put( SfxStringItem( ATTR_PRESENT_DIANAME, aFirstPage ) );
     106           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ENDLESS, rPresentationSettings.mbEndless ) );
     107           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_MANUEL, rPresentationSettings.mbManual ) );
     108           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_MOUSE, rPresentationSettings.mbMouseVisible ) );
     109           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_PEN, rPresentationSettings.mbMouseAsPen ) );
     110           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_NAVIGATOR, rPresentationSettings.mbStartWithNavigator ) );
     111           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ANIMATION_ALLOWED, rPresentationSettings.mbAnimationAllowed ) );
     112           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_CHANGE_PAGE, !rPresentationSettings.mbLockedPages ) );
     113           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ALWAYS_ON_TOP, rPresentationSettings.mbAlwaysOnTop ) );
     114           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_FULLSCREEN, rPresentationSettings.mbFullScreen ) );
     115           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_START_ACTUAL_PAGE, bStartWithActualPage ) );
     116           0 :     aDlgSet.Put( SfxUInt32Item( ATTR_PRESENT_PAUSE_TIMEOUT, rPresentationSettings.mnPauseTimeout ) );
     117           0 :     aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_SHOW_PAUSELOGO, rPresentationSettings.mbShowPauseLogo ) );
     118             : 
     119           0 :     SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
     120           0 :     aDlgSet.Put( SfxInt32Item( ATTR_PRESENT_DISPLAY, pOptions->GetDisplay() ) );
     121             : 
     122           0 :     SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
     123           0 :     AbstractSdStartPresDlg* pDlg = pFact ? pFact->CreateSdStartPresentationDlg(mpWindow, aDlgSet, aPageNameList, pCustomShowList) : 0;
     124           0 :     if( pDlg && (pDlg->Execute() == RET_OK) )
     125             :     {
     126           0 :         rtl::OUString aPage;
     127             :         long    nValue32;
     128             :         sal_Bool bValue;
     129           0 :         bool    bValuesChanged = sal_False;
     130             : 
     131           0 :         pDlg->GetAttr( aDlgSet );
     132             : 
     133           0 :         aPage = ITEMVALUE( aDlgSet, ATTR_PRESENT_DIANAME, SfxStringItem );
     134           0 :         if( aPage != rPresentationSettings.maPresPage )
     135             :         {
     136           0 :             bValuesChanged = true;
     137           0 :             rPresentationSettings.maPresPage = aPage;
     138             :         }
     139             : 
     140           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ALL, SfxBoolItem );
     141           0 :         if ( bValue != rPresentationSettings.mbAll )
     142             :         {
     143           0 :             bValuesChanged = true;
     144           0 :             rPresentationSettings.mbAll = bValue;
     145             :         }
     146             : 
     147           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_CUSTOMSHOW, SfxBoolItem );
     148           0 :         if ( bValue != rPresentationSettings.mbCustomShow )
     149             :         {
     150           0 :             bValuesChanged = true;
     151           0 :             rPresentationSettings.mbCustomShow = bValue;
     152             :         }
     153             : 
     154           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ENDLESS, SfxBoolItem );
     155           0 :         if ( bValue != rPresentationSettings.mbEndless )
     156             :         {
     157           0 :             bValuesChanged = true;
     158           0 :             rPresentationSettings.mbEndless = bValue;
     159             :         }
     160             : 
     161           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_MANUEL, SfxBoolItem );
     162           0 :         if ( bValue != rPresentationSettings.mbManual )
     163             :         {
     164           0 :             bValuesChanged = true;
     165           0 :             rPresentationSettings.mbManual = bValue;
     166             :         }
     167             : 
     168           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_MOUSE, SfxBoolItem );
     169           0 :         if ( bValue != rPresentationSettings.mbMouseVisible )
     170             :         {
     171           0 :             bValuesChanged = true;
     172           0 :             rPresentationSettings.mbMouseVisible = bValue;
     173             :         }
     174             : 
     175           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_PEN, SfxBoolItem );
     176           0 :         if ( bValue != rPresentationSettings.mbMouseAsPen )
     177             :         {
     178           0 :             bValuesChanged = true;
     179           0 :             rPresentationSettings.mbMouseAsPen = bValue;
     180             :         }
     181             : 
     182           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_NAVIGATOR, SfxBoolItem );
     183           0 :         if( bValue != rPresentationSettings.mbStartWithNavigator )
     184             :         {
     185           0 :             bValuesChanged = true;
     186           0 :             rPresentationSettings.mbStartWithNavigator = bValue;
     187             :         }
     188             : 
     189           0 :         bValue = !ITEMVALUE( aDlgSet, ATTR_PRESENT_CHANGE_PAGE, SfxBoolItem );
     190           0 :         if ( bValue != rPresentationSettings.mbLockedPages )
     191             :         {
     192           0 :             bValuesChanged = true;
     193           0 :             rPresentationSettings.mbLockedPages = bValue;
     194             :         }
     195             : 
     196           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ANIMATION_ALLOWED, SfxBoolItem );
     197           0 :         if ( bValue != rPresentationSettings.mbAnimationAllowed )
     198             :         {
     199           0 :             bValuesChanged = true;
     200           0 :             rPresentationSettings.mbAnimationAllowed = bValue;
     201             :         }
     202             : 
     203           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ALWAYS_ON_TOP, SfxBoolItem );
     204           0 :         if ( bValue != rPresentationSettings.mbAlwaysOnTop )
     205             :         {
     206           0 :             bValuesChanged = true;
     207           0 :             rPresentationSettings.mbAlwaysOnTop = bValue;
     208             :         }
     209             : 
     210           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_FULLSCREEN, SfxBoolItem );
     211           0 :         if ( bValue != rPresentationSettings.mbFullScreen )
     212             :         {
     213           0 :             bValuesChanged = true;
     214           0 :             rPresentationSettings.mbFullScreen = bValue;
     215             :         }
     216             : 
     217           0 :         nValue32 = ITEMVALUE( aDlgSet, ATTR_PRESENT_PAUSE_TIMEOUT, SfxUInt32Item );
     218           0 :         if( nValue32 != rPresentationSettings.mnPauseTimeout )
     219             :         {
     220           0 :             bValuesChanged = true;
     221           0 :             rPresentationSettings.mnPauseTimeout = nValue32;
     222             :         }
     223             : 
     224           0 :         bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_SHOW_PAUSELOGO, SfxBoolItem );
     225           0 :         if ( bValue != rPresentationSettings.mbShowPauseLogo )
     226             :         {
     227           0 :             bValuesChanged = true;
     228           0 :             rPresentationSettings.mbShowPauseLogo = bValue;
     229             :         }
     230             : 
     231           0 :         pOptions->SetDisplay( ITEMVALUE( aDlgSet, ATTR_PRESENT_DISPLAY, SfxInt32Item ) );
     232             : 
     233             :         // wenn sich etwas geaendert hat, setzen wir das Modified-Flag,
     234           0 :         if ( bValuesChanged )
     235           0 :             mpDoc->SetChanged( sal_True );
     236             :     }
     237           0 :     delete pDlg;
     238           0 : }
     239             : 
     240           9 : } // end of namespace sd
     241             : 
     242             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10