LCOV - code coverage report
Current view: top level - sd/source/ui/dlg - masterlayoutdlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 66 0.0 %
Date: 2012-08-25 Functions: 0 7 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #ifdef SD_DLLIMPLEMENTATION
      31                 :            : #undef SD_DLLIMPLEMENTATION
      32                 :            : #endif
      33                 :            : 
      34                 :            : #include <svx/dialogs.hrc>
      35                 :            : 
      36                 :            : #include "sdresid.hxx"
      37                 :            : 
      38                 :            : #include "strings.hrc"
      39                 :            : #include "dialogs.hrc"
      40                 :            : #include "masterlayoutdlg.hxx"
      41                 :            : #include "masterlayoutdlg.hrc"
      42                 :            : #include "drawdoc.hxx"
      43                 :            : 
      44                 :            : using namespace ::sd;
      45                 :            : 
      46                 :          0 : MasterLayoutDialog::MasterLayoutDialog( Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage )
      47                 :            : :   ModalDialog( pParent, SdResId( RID_SD_DLG_MASTER_LAYOUT ) ),
      48                 :            :     mpDoc( pDoc ),
      49                 :            :     mpCurrentPage( pCurrentPage ),
      50                 :            :     maFLPlaceholders( this, SdResId( FL_PLACEHOLDERS ) ),
      51                 :            :     maCBDate( this, SdResId( CB_DATE ) ),
      52                 :            :     maCBPageNumber( this, SdResId( CB_PAGE_NUMBER ) ),
      53                 :            :     maCBHeader( this, SdResId( CB_HEADER ) ),
      54                 :            :     maCBFooter( this, SdResId( CB_FOOTER ) ),
      55                 :            :     maPBOK( this, SdResId( BT_OK ) ),
      56                 :          0 :     maPBCancel( this, SdResId( BT_CANCEL ) )
      57                 :            : {
      58                 :          0 :     if( mpCurrentPage && !mpCurrentPage->IsMasterPage() )
      59                 :            :     {
      60                 :          0 :         mpCurrentPage = (SdPage*)(&(mpCurrentPage->TRG_GetMasterPage()));
      61                 :            :     }
      62                 :            : 
      63                 :          0 :     if( mpCurrentPage == 0 )
      64                 :            :     {
      65                 :          0 :         mpCurrentPage = pDoc->GetMasterSdPage( 0, PK_STANDARD );
      66                 :            :         OSL_FAIL( "MasterLayoutDialog::MasterLayoutDialog() - no current page?" );
      67                 :            :     }
      68                 :            : 
      69                 :          0 :     switch( mpCurrentPage->GetPageKind() )
      70                 :            :     {
      71                 :            :     case PK_STANDARD:
      72                 :            :     {
      73                 :            :         //      aTitle = String( SdResId( STR_MASTER_LAYOUT_TITLE ) );
      74                 :          0 :         maCBHeader.Enable( sal_False );
      75                 :          0 :     String aSlideNumberStr( SdResId( STR_SLIDE_NUMBER ) );
      76                 :          0 :         maCBPageNumber.SetText( aSlideNumberStr );
      77                 :          0 :         break;
      78                 :            :     }
      79                 :            :     case PK_NOTES:
      80                 :            :         //      aTitle = String( SdResId( STR_NOTES_MASTER_LAYOUT_TITLE ) );
      81                 :          0 :         break;
      82                 :            :     case PK_HANDOUT:
      83                 :            :         //      aTitle = String( SdResId( STR_HANDOUT_TEMPLATE_LAYOUT_TITLE ) );
      84                 :          0 :         break;
      85                 :            :     }
      86                 :          0 :     String aTitle (SdResId( STR_MASTER_LAYOUT_TITLE ) );
      87                 :            : 
      88                 :          0 :     SetText( aTitle );
      89                 :            : 
      90                 :          0 :     FreeResource();
      91                 :            : 
      92                 :          0 :     mbOldHeader = mpCurrentPage->GetPresObj( PRESOBJ_HEADER ) != NULL;
      93                 :          0 :     mbOldDate = mpCurrentPage->GetPresObj( PRESOBJ_DATETIME ) != NULL;
      94                 :          0 :     mbOldFooter = mpCurrentPage->GetPresObj( PRESOBJ_FOOTER ) != NULL;
      95                 :          0 :     mbOldPageNumber = mpCurrentPage->GetPresObj( PRESOBJ_SLIDENUMBER ) != NULL;
      96                 :            : 
      97                 :          0 :     maCBHeader.Check( mbOldHeader );
      98                 :          0 :     maCBDate.Check( mbOldDate );
      99                 :          0 :     maCBFooter.Check( mbOldFooter );
     100                 :          0 :     maCBPageNumber.Check( mbOldPageNumber );
     101                 :          0 : }
     102                 :            : 
     103                 :          0 : MasterLayoutDialog::~MasterLayoutDialog()
     104                 :            : {
     105                 :          0 : }
     106                 :            : 
     107                 :          0 : short MasterLayoutDialog::Execute()
     108                 :            : {
     109                 :          0 :     if ( ModalDialog::Execute() )
     110                 :          0 :         applyChanges();
     111                 :          0 :     return 1;
     112                 :            : }
     113                 :            : 
     114                 :          0 : void MasterLayoutDialog::applyChanges()
     115                 :            : {
     116                 :          0 :     mpDoc->BegUndo(GetText());
     117                 :            : 
     118                 :          0 :     if( (mpCurrentPage->GetPageKind() != PK_STANDARD) && (mbOldHeader != maCBHeader.IsChecked() ) )
     119                 :            :     {
     120                 :          0 :         if( mbOldHeader )
     121                 :          0 :             remove( PRESOBJ_HEADER );
     122                 :            :         else
     123                 :          0 :             create( PRESOBJ_HEADER );
     124                 :            :     }
     125                 :            : 
     126                 :          0 :     if( mbOldFooter != maCBFooter.IsChecked() )
     127                 :            :     {
     128                 :          0 :         if( mbOldFooter )
     129                 :          0 :             remove( PRESOBJ_FOOTER );
     130                 :            :         else
     131                 :          0 :             create( PRESOBJ_FOOTER );
     132                 :            :     }
     133                 :            : 
     134                 :          0 :     if( mbOldDate != maCBDate.IsChecked() )
     135                 :            :     {
     136                 :          0 :         if( mbOldDate )
     137                 :          0 :             remove( PRESOBJ_DATETIME );
     138                 :            :         else
     139                 :          0 :             create( PRESOBJ_DATETIME );
     140                 :            :     }
     141                 :            : 
     142                 :          0 :     if( mbOldPageNumber != maCBPageNumber.IsChecked() )
     143                 :            :     {
     144                 :          0 :         if( mbOldPageNumber )
     145                 :          0 :             remove( PRESOBJ_SLIDENUMBER );
     146                 :            :         else
     147                 :          0 :             create( PRESOBJ_SLIDENUMBER );
     148                 :            :     }
     149                 :            : 
     150                 :          0 :     mpDoc->EndUndo();
     151                 :          0 : }
     152                 :            : 
     153                 :          0 : void MasterLayoutDialog::create( PresObjKind eKind )
     154                 :            : {
     155                 :          0 :     mpCurrentPage->CreateDefaultPresObj( eKind, true );
     156                 :          0 : }
     157                 :            : 
     158                 :          0 : void MasterLayoutDialog::remove( PresObjKind eKind )
     159                 :            : {
     160                 :          0 :     SdrObject* pObject = mpCurrentPage->GetPresObj( eKind );
     161                 :            : 
     162                 :          0 :     if( pObject )
     163                 :            :     {
     164                 :          0 :         const bool bUndo = mpDoc->IsUndoEnabled();
     165                 :          0 :         if( bUndo )
     166                 :          0 :             mpDoc->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoDeleteObject(*pObject));
     167                 :          0 :         SdrObjList* pOL =pObject->GetObjList();
     168                 :          0 :         sal_uInt32 nOrdNum=pObject->GetOrdNumDirect();
     169                 :          0 :         pOL->RemoveObject(nOrdNum);
     170                 :            : 
     171                 :          0 :         if( !bUndo )
     172                 :          0 :             SdrObject::Free(pObject);
     173                 :            :     }
     174                 :          0 : }
     175                 :            : 
     176                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10