1*96de5490SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*96de5490SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*96de5490SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*96de5490SAndrew Rist * distributed with this work for additional information 6*96de5490SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*96de5490SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*96de5490SAndrew Rist * "License"); you may not use this file except in compliance 9*96de5490SAndrew Rist * with the License. You may obtain a copy of the License at 10*96de5490SAndrew Rist * 11*96de5490SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*96de5490SAndrew Rist * 13*96de5490SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*96de5490SAndrew Rist * software distributed under the License is distributed on an 15*96de5490SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*96de5490SAndrew Rist * KIND, either express or implied. See the License for the 17*96de5490SAndrew Rist * specific language governing permissions and limitations 18*96de5490SAndrew Rist * under the License. 19*96de5490SAndrew Rist * 20*96de5490SAndrew Rist *************************************************************/ 21*96de5490SAndrew Rist 22*96de5490SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_dbaccess.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "progresscapture.hxx" 28cdf0e10cSrcweir #include "migrationprogress.hxx" 29cdf0e10cSrcweir 30cdf0e10cSrcweir /** === begin UNO includes === **/ 31cdf0e10cSrcweir /** === end UNO includes === **/ 32cdf0e10cSrcweir 33cdf0e10cSrcweir #include <vcl/svapp.hxx> 34cdf0e10cSrcweir #include <vos/mutex.hxx> 35cdf0e10cSrcweir 36cdf0e10cSrcweir //........................................................................ 37cdf0e10cSrcweir namespace dbmm 38cdf0e10cSrcweir { 39cdf0e10cSrcweir //........................................................................ 40cdf0e10cSrcweir 41cdf0e10cSrcweir /** === begin UNO using === **/ 42cdf0e10cSrcweir using ::com::sun::star::uno::Reference; 43cdf0e10cSrcweir using ::com::sun::star::uno::XInterface; 44cdf0e10cSrcweir using ::com::sun::star::uno::UNO_QUERY; 45cdf0e10cSrcweir using ::com::sun::star::uno::UNO_QUERY_THROW; 46cdf0e10cSrcweir using ::com::sun::star::uno::UNO_SET_THROW; 47cdf0e10cSrcweir using ::com::sun::star::uno::Exception; 48cdf0e10cSrcweir using ::com::sun::star::uno::RuntimeException; 49cdf0e10cSrcweir using ::com::sun::star::uno::Any; 50cdf0e10cSrcweir using ::com::sun::star::uno::makeAny; 51cdf0e10cSrcweir /** === end UNO using === **/ 52cdf0e10cSrcweir 53cdf0e10cSrcweir //==================================================================== 54cdf0e10cSrcweir //= ProgressCapture_Data 55cdf0e10cSrcweir //==================================================================== 56cdf0e10cSrcweir struct ProgressCapture_Data 57cdf0e10cSrcweir { 58cdf0e10cSrcweir ProgressCapture_Data( const ::rtl::OUString& _rObjectName, IMigrationProgress& _rMasterProgress ) 59cdf0e10cSrcweir :sObjectName( _rObjectName ) 60cdf0e10cSrcweir ,rMasterProgress( _rMasterProgress ) 61cdf0e10cSrcweir ,bDisposed( false ) 62cdf0e10cSrcweir { 63cdf0e10cSrcweir } 64cdf0e10cSrcweir 65cdf0e10cSrcweir ::rtl::OUString sObjectName; 66cdf0e10cSrcweir IMigrationProgress& rMasterProgress; 67cdf0e10cSrcweir bool bDisposed; 68cdf0e10cSrcweir }; 69cdf0e10cSrcweir 70cdf0e10cSrcweir //==================================================================== 71cdf0e10cSrcweir //= ProgressCapture 72cdf0e10cSrcweir //==================================================================== 73cdf0e10cSrcweir //-------------------------------------------------------------------- 74cdf0e10cSrcweir ProgressCapture::ProgressCapture( const ::rtl::OUString& _rObjectName, IMigrationProgress& _rMasterProgress ) 75cdf0e10cSrcweir :m_pData( new ProgressCapture_Data( _rObjectName, _rMasterProgress ) ) 76cdf0e10cSrcweir { 77cdf0e10cSrcweir } 78cdf0e10cSrcweir 79cdf0e10cSrcweir //-------------------------------------------------------------------- 80cdf0e10cSrcweir ProgressCapture::~ProgressCapture() 81cdf0e10cSrcweir { 82cdf0e10cSrcweir } 83cdf0e10cSrcweir 84cdf0e10cSrcweir //-------------------------------------------------------------------- 85cdf0e10cSrcweir void ProgressCapture::dispose() 86cdf0e10cSrcweir { 87cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 88cdf0e10cSrcweir m_pData->bDisposed = true; 89cdf0e10cSrcweir } 90cdf0e10cSrcweir 91cdf0e10cSrcweir //-------------------------------------------------------------------- 92cdf0e10cSrcweir void SAL_CALL ProgressCapture::start( const ::rtl::OUString& _rText, ::sal_Int32 _nRange ) throw (RuntimeException) 93cdf0e10cSrcweir { 94cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 95cdf0e10cSrcweir if ( !m_pData->bDisposed ) 96cdf0e10cSrcweir m_pData->rMasterProgress.startObject( m_pData->sObjectName, _rText, _nRange ); 97cdf0e10cSrcweir } 98cdf0e10cSrcweir 99cdf0e10cSrcweir //-------------------------------------------------------------------- 100cdf0e10cSrcweir void SAL_CALL ProgressCapture::end( ) throw (RuntimeException) 101cdf0e10cSrcweir { 102cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 103cdf0e10cSrcweir if ( !m_pData->bDisposed ) 104cdf0e10cSrcweir m_pData->rMasterProgress.endObject(); 105cdf0e10cSrcweir } 106cdf0e10cSrcweir 107cdf0e10cSrcweir //-------------------------------------------------------------------- 108cdf0e10cSrcweir void SAL_CALL ProgressCapture::setText( const ::rtl::OUString& _rText ) throw (RuntimeException) 109cdf0e10cSrcweir { 110cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 111cdf0e10cSrcweir if ( !m_pData->bDisposed ) 112cdf0e10cSrcweir m_pData->rMasterProgress.setObjectProgressText( _rText ); 113cdf0e10cSrcweir } 114cdf0e10cSrcweir 115cdf0e10cSrcweir //-------------------------------------------------------------------- 116cdf0e10cSrcweir void SAL_CALL ProgressCapture::setValue( ::sal_Int32 _nValue ) throw (RuntimeException) 117cdf0e10cSrcweir { 118cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 119cdf0e10cSrcweir if ( !m_pData->bDisposed ) 120cdf0e10cSrcweir m_pData->rMasterProgress.setObjectProgressValue( _nValue ); 121cdf0e10cSrcweir } 122cdf0e10cSrcweir 123cdf0e10cSrcweir //-------------------------------------------------------------------- 124cdf0e10cSrcweir void SAL_CALL ProgressCapture::reset( ) throw (RuntimeException) 125cdf0e10cSrcweir { 126cdf0e10cSrcweir OSL_ENSURE( false, "ProgressCapture::reset: not implemented!" ); 127cdf0e10cSrcweir } 128cdf0e10cSrcweir 129cdf0e10cSrcweir //........................................................................ 130cdf0e10cSrcweir } // namespace dbmm 131cdf0e10cSrcweir //........................................................................ 132