LCOV - code coverage report
Current view: top level - sd/source/ui/dlg - brkdlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 56 0.0 %
Date: 2012-08-25 Functions: 0 10 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 "BreakDlg.hxx"
      35                 :            : #include <sfx2/progress.hxx>
      36                 :            : 
      37                 :            : #include <svx/svdedtv.hxx>
      38                 :            : #include <svx/svdetc.hxx>
      39                 :            : #include <sfx2/app.hxx>
      40                 :            : #include <vcl/msgbox.hxx>
      41                 :            : 
      42                 :            : #include "sdattr.hxx"
      43                 :            : #include "brkdlg.hrc"
      44                 :            : #include "sdresid.hxx"
      45                 :            : #include "View.hxx"
      46                 :            : #include "drawview.hxx"
      47                 :            : #include "strings.hrc"
      48                 :            : #include "DrawDocShell.hxx"
      49                 :            : 
      50                 :            : namespace sd {
      51                 :            : 
      52                 :            : /*************************************************************************
      53                 :            : |*
      54                 :            : |* Dialog zum aufbrechen von Metafiles
      55                 :            : |*
      56                 :            : \************************************************************************/
      57                 :            : 
      58                 :          0 : BreakDlg::BreakDlg(
      59                 :            :     ::Window* pWindow,
      60                 :            :     DrawView* _pDrView,
      61                 :            :     DrawDocShell* pShell,
      62                 :            :     sal_uLong nSumActionCount,
      63                 :            :     sal_uLong nObjCount )
      64                 :            :     : SfxModalDialog     ( pWindow, SdResId( DLG_BREAK ) ),
      65                 :            :       aFtObjInfo            ( this, SdResId( FT_OBJ_INFO ) ),
      66                 :            :       aFtActInfo            ( this, SdResId( FT_ACT_INFO ) ),
      67                 :            :       aFtInsInfo            ( this, SdResId( FT_INS_INFO ) ),
      68                 :            :       aFiObjInfo            ( this, SdResId( FI_OBJ_INFO ) ),
      69                 :            :       aFiActInfo            ( this, SdResId( FI_ACT_INFO ) ),
      70                 :            :       aFiInsInfo            ( this, SdResId( FI_INS_INFO ) ),
      71                 :            :       aBtnCancel            ( this, SdResId( BTN_CANCEL ) ),
      72                 :            :       aLink             ( LINK( this, BreakDlg, UpDate)),
      73                 :          0 :       mpProgress            ( NULL )
      74                 :            : {
      75                 :          0 :     aBtnCancel.SetClickHdl( LINK( this, BreakDlg, CancelButtonHdl));
      76                 :            : 
      77                 :          0 :     mpProgress = new SfxProgress( pShell, String(SdResId(STR_BREAK_METAFILE)), nSumActionCount*3 );
      78                 :            : 
      79                 :          0 :     pProgrInfo = new SvdProgressInfo( &aLink );
      80                 :            :     // jede Action wird in DoImport() 3mal bearbeitet
      81                 :          0 :     pProgrInfo->Init( nSumActionCount*3, nObjCount );
      82                 :            : 
      83                 :          0 :     pDrView = _pDrView;
      84                 :          0 :     bCancel = sal_False;
      85                 :            : 
      86                 :          0 :     FreeResource();
      87                 :          0 : }
      88                 :            : 
      89                 :          0 : BreakDlg::~BreakDlg()
      90                 :            : {
      91                 :          0 :     if( mpProgress )
      92                 :          0 :         delete mpProgress;
      93                 :            : 
      94                 :          0 :     if( pProgrInfo )
      95                 :          0 :         delete pProgrInfo;
      96                 :          0 : }
      97                 :            : 
      98                 :            : // Control-Handler fuer den Abbruch Button
      99                 :          0 : IMPL_LINK_NOARG(BreakDlg, CancelButtonHdl)
     100                 :            : {
     101                 :          0 :   bCancel = sal_True;
     102                 :          0 :   aBtnCancel.Disable();
     103                 :          0 :   return( 0L );
     104                 :            : }
     105                 :            : 
     106                 :            : // Die UpDate Methode muss regelmaessig von der Arbeitsfunktion
     107                 :            : // ausgeuehrt werden.
     108                 :            : // Beim ersten aufruf wird die gesamtanzahl der actions uebergeben.
     109                 :            : // Jeder weitere sollte die bearbeiteten actions seit dem letzten aufruf von
     110                 :            : // UpDate erhalten.
     111                 :            : 
     112                 :          0 : IMPL_LINK( BreakDlg, UpDate, void*, nInit )
     113                 :            : {
     114                 :          0 :     String aEmptyStr;
     115                 :            : 
     116                 :          0 :     if(pProgrInfo == NULL)
     117                 :          0 :       return 1L;
     118                 :            : 
     119                 :            :     // Statuszeile updaten oder Fehlermeldung?
     120                 :          0 :     if(nInit == (void*)1L)
     121                 :            :     {
     122                 :          0 :         ErrorBox aErrBox( this, WB_OK, String( SdResId( STR_BREAK_FAIL ) ) );
     123                 :          0 :         aErrBox.Execute();
     124                 :            :     }
     125                 :            :     else
     126                 :            :     {
     127                 :          0 :         if(mpProgress)
     128                 :          0 :             mpProgress->SetState( pProgrInfo->GetSumCurAction() );
     129                 :            :     }
     130                 :            : 
     131                 :            :     // Welches Oject wird gerade angezeigt?
     132                 :          0 :     String info = UniString::CreateFromInt32( pProgrInfo->GetCurObj() );
     133                 :          0 :     info.Append( sal_Unicode('/') );
     134                 :          0 :     info.Append( UniString::CreateFromInt32( pProgrInfo->GetObjCount() ) );
     135                 :          0 :     aFiObjInfo.SetText(info);
     136                 :            : 
     137                 :            :     // Wieviele Actions sind schon aufgebrochen?
     138                 :          0 :     if(pProgrInfo->GetActionCount() == 0)
     139                 :            :     {
     140                 :          0 :         aFiActInfo.SetText( aEmptyStr );
     141                 :            :     }
     142                 :            :     else
     143                 :            :     {
     144                 :          0 :         info = UniString::CreateFromInt32( pProgrInfo->GetCurAction() );
     145                 :          0 :         info.Append( sal_Unicode('/') );
     146                 :          0 :         info.Append( UniString::CreateFromInt32( pProgrInfo->GetActionCount() ) );
     147                 :          0 :         aFiActInfo.SetText(info);
     148                 :            :     }
     149                 :            : 
     150                 :            :     // Und erst eingefuegt????
     151                 :          0 :     if(pProgrInfo->GetInsertCount() == 0)
     152                 :            :     {
     153                 :          0 :         aFiInsInfo.SetText( aEmptyStr );
     154                 :            :     }
     155                 :            :     else
     156                 :            :     {
     157                 :          0 :         info = UniString::CreateFromInt32( pProgrInfo->GetCurInsert() );
     158                 :          0 :         info.Append( sal_Unicode('/') );
     159                 :          0 :         info.Append( UniString::CreateFromInt32( pProgrInfo->GetInsertCount() ) );
     160                 :          0 :         aFiInsInfo.SetText(info);
     161                 :            :     }
     162                 :            : 
     163                 :          0 :     Application::Reschedule();
     164                 :          0 :     return( bCancel?0L:1L );
     165                 :            : }
     166                 :            : 
     167                 :            : // Oeffnet den Modalen Dialog und startet einen Timer der die Arbeitsfunktion
     168                 :            : // nach oeffnen des Dialogs ausfuehrt
     169                 :          0 : short BreakDlg::Execute()
     170                 :            : {
     171                 :          0 :   aTimer.SetTimeout( 10 );
     172                 :          0 :   aTimer.SetTimeoutHdl( LINK( this, BreakDlg, InitialUpdate ) );
     173                 :          0 :   aTimer.Start();
     174                 :            : 
     175                 :          0 :   return SfxModalDialog::Execute();
     176                 :            : }
     177                 :            : 
     178                 :            : // Linkmethode welche die Arbeitsfunktion startet
     179                 :          0 : IMPL_LINK_NOARG(BreakDlg, InitialUpdate)
     180                 :            : {
     181                 :          0 :     pDrView->DoImportMarkedMtf(pProgrInfo);
     182                 :          0 :     EndDialog(sal_True);
     183                 :          0 :     return 0L;
     184                 :            : }
     185                 :            : 
     186                 :            : } // end of namespace sd
     187                 :            : 
     188                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10