1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_dbaccess.hxx" 30 31 #include "progresscapture.hxx" 32 #include "migrationprogress.hxx" 33 34 /** === begin UNO includes === **/ 35 /** === end UNO includes === **/ 36 37 #include <vcl/svapp.hxx> 38 #include <vos/mutex.hxx> 39 40 //........................................................................ 41 namespace dbmm 42 { 43 //........................................................................ 44 45 /** === begin UNO using === **/ 46 using ::com::sun::star::uno::Reference; 47 using ::com::sun::star::uno::XInterface; 48 using ::com::sun::star::uno::UNO_QUERY; 49 using ::com::sun::star::uno::UNO_QUERY_THROW; 50 using ::com::sun::star::uno::UNO_SET_THROW; 51 using ::com::sun::star::uno::Exception; 52 using ::com::sun::star::uno::RuntimeException; 53 using ::com::sun::star::uno::Any; 54 using ::com::sun::star::uno::makeAny; 55 /** === end UNO using === **/ 56 57 //==================================================================== 58 //= ProgressCapture_Data 59 //==================================================================== 60 struct ProgressCapture_Data 61 { 62 ProgressCapture_Data( const ::rtl::OUString& _rObjectName, IMigrationProgress& _rMasterProgress ) 63 :sObjectName( _rObjectName ) 64 ,rMasterProgress( _rMasterProgress ) 65 ,bDisposed( false ) 66 { 67 } 68 69 ::rtl::OUString sObjectName; 70 IMigrationProgress& rMasterProgress; 71 bool bDisposed; 72 }; 73 74 //==================================================================== 75 //= ProgressCapture 76 //==================================================================== 77 //-------------------------------------------------------------------- 78 ProgressCapture::ProgressCapture( const ::rtl::OUString& _rObjectName, IMigrationProgress& _rMasterProgress ) 79 :m_pData( new ProgressCapture_Data( _rObjectName, _rMasterProgress ) ) 80 { 81 } 82 83 //-------------------------------------------------------------------- 84 ProgressCapture::~ProgressCapture() 85 { 86 } 87 88 //-------------------------------------------------------------------- 89 void ProgressCapture::dispose() 90 { 91 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 92 m_pData->bDisposed = true; 93 } 94 95 //-------------------------------------------------------------------- 96 void SAL_CALL ProgressCapture::start( const ::rtl::OUString& _rText, ::sal_Int32 _nRange ) throw (RuntimeException) 97 { 98 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 99 if ( !m_pData->bDisposed ) 100 m_pData->rMasterProgress.startObject( m_pData->sObjectName, _rText, _nRange ); 101 } 102 103 //-------------------------------------------------------------------- 104 void SAL_CALL ProgressCapture::end( ) throw (RuntimeException) 105 { 106 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 107 if ( !m_pData->bDisposed ) 108 m_pData->rMasterProgress.endObject(); 109 } 110 111 //-------------------------------------------------------------------- 112 void SAL_CALL ProgressCapture::setText( const ::rtl::OUString& _rText ) throw (RuntimeException) 113 { 114 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 115 if ( !m_pData->bDisposed ) 116 m_pData->rMasterProgress.setObjectProgressText( _rText ); 117 } 118 119 //-------------------------------------------------------------------- 120 void SAL_CALL ProgressCapture::setValue( ::sal_Int32 _nValue ) throw (RuntimeException) 121 { 122 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 123 if ( !m_pData->bDisposed ) 124 m_pData->rMasterProgress.setObjectProgressValue( _nValue ); 125 } 126 127 //-------------------------------------------------------------------- 128 void SAL_CALL ProgressCapture::reset( ) throw (RuntimeException) 129 { 130 OSL_ENSURE( false, "ProgressCapture::reset: not implemented!" ); 131 } 132 133 //........................................................................ 134 } // namespace dbmm 135 //........................................................................ 136