update dev300-m58
[ooovba.git] / dbaccess / source / ext / macromigration / progresscapture.cxx
blob6aa3a3ef9ae4d25673c48cb6001fc684ffd31eb5
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: progresscapture.cxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
34 #include "progresscapture.hxx"
35 #include "migrationprogress.hxx"
37 /** === begin UNO includes === **/
38 /** === end UNO includes === **/
40 #include <vcl/svapp.hxx>
41 #include <vos/mutex.hxx>
43 //........................................................................
44 namespace dbmm
46 //........................................................................
48 /** === begin UNO using === **/
49 using ::com::sun::star::uno::Reference;
50 using ::com::sun::star::uno::XInterface;
51 using ::com::sun::star::uno::UNO_QUERY;
52 using ::com::sun::star::uno::UNO_QUERY_THROW;
53 using ::com::sun::star::uno::UNO_SET_THROW;
54 using ::com::sun::star::uno::Exception;
55 using ::com::sun::star::uno::RuntimeException;
56 using ::com::sun::star::uno::Any;
57 using ::com::sun::star::uno::makeAny;
58 /** === end UNO using === **/
60 //====================================================================
61 //= ProgressCapture_Data
62 //====================================================================
63 struct ProgressCapture_Data
65 ProgressCapture_Data( const ::rtl::OUString& _rObjectName, IMigrationProgress& _rMasterProgress )
66 :sObjectName( _rObjectName )
67 ,rMasterProgress( _rMasterProgress )
68 ,bDisposed( false )
72 ::rtl::OUString sObjectName;
73 IMigrationProgress& rMasterProgress;
74 bool bDisposed;
77 //====================================================================
78 //= ProgressCapture
79 //====================================================================
80 //--------------------------------------------------------------------
81 ProgressCapture::ProgressCapture( const ::rtl::OUString& _rObjectName, IMigrationProgress& _rMasterProgress )
82 :m_pData( new ProgressCapture_Data( _rObjectName, _rMasterProgress ) )
86 //--------------------------------------------------------------------
87 ProgressCapture::~ProgressCapture()
91 //--------------------------------------------------------------------
92 void ProgressCapture::dispose()
94 ::vos::OGuard aGuard( Application::GetSolarMutex() );
95 m_pData->bDisposed = true;
98 //--------------------------------------------------------------------
99 void SAL_CALL ProgressCapture::start( const ::rtl::OUString& _rText, ::sal_Int32 _nRange ) throw (RuntimeException)
101 ::vos::OGuard aGuard( Application::GetSolarMutex() );
102 if ( !m_pData->bDisposed )
103 m_pData->rMasterProgress.startObject( m_pData->sObjectName, _rText, _nRange );
106 //--------------------------------------------------------------------
107 void SAL_CALL ProgressCapture::end( ) throw (RuntimeException)
109 ::vos::OGuard aGuard( Application::GetSolarMutex() );
110 if ( !m_pData->bDisposed )
111 m_pData->rMasterProgress.endObject();
114 //--------------------------------------------------------------------
115 void SAL_CALL ProgressCapture::setText( const ::rtl::OUString& _rText ) throw (RuntimeException)
117 ::vos::OGuard aGuard( Application::GetSolarMutex() );
118 if ( !m_pData->bDisposed )
119 m_pData->rMasterProgress.setObjectProgressText( _rText );
122 //--------------------------------------------------------------------
123 void SAL_CALL ProgressCapture::setValue( ::sal_Int32 _nValue ) throw (RuntimeException)
125 ::vos::OGuard aGuard( Application::GetSolarMutex() );
126 if ( !m_pData->bDisposed )
127 m_pData->rMasterProgress.setObjectProgressValue( _nValue );
130 //--------------------------------------------------------------------
131 void SAL_CALL ProgressCapture::reset( ) throw (RuntimeException)
133 OSL_ENSURE( false, "ProgressCapture::reset: not implemented!" );
136 //........................................................................
137 } // namespace dbmm
138 //........................................................................