Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "progresscapture.hxx"
21 : #include "migrationprogress.hxx"
22 :
23 : #include <vcl/svapp.hxx>
24 : #include <osl/mutex.hxx>
25 :
26 : namespace dbmm
27 : {
28 :
29 : using ::com::sun::star::uno::Reference;
30 : using ::com::sun::star::uno::XInterface;
31 : using ::com::sun::star::uno::UNO_QUERY;
32 : using ::com::sun::star::uno::UNO_QUERY_THROW;
33 : using ::com::sun::star::uno::UNO_SET_THROW;
34 : using ::com::sun::star::uno::Exception;
35 : using ::com::sun::star::uno::RuntimeException;
36 : using ::com::sun::star::uno::Any;
37 : using ::com::sun::star::uno::makeAny;
38 :
39 : // ProgressCapture_Data
40 0 : struct ProgressCapture_Data
41 : {
42 0 : ProgressCapture_Data( const OUString& _rObjectName, IMigrationProgress& _rMasterProgress )
43 : :sObjectName( _rObjectName )
44 : ,rMasterProgress( _rMasterProgress )
45 0 : ,bDisposed( false )
46 : {
47 0 : }
48 :
49 : OUString sObjectName;
50 : IMigrationProgress& rMasterProgress;
51 : bool bDisposed;
52 : };
53 :
54 : // ProgressCapture
55 0 : ProgressCapture::ProgressCapture( const OUString& _rObjectName, IMigrationProgress& _rMasterProgress )
56 0 : :m_pData( new ProgressCapture_Data( _rObjectName, _rMasterProgress ) )
57 : {
58 0 : }
59 :
60 0 : ProgressCapture::~ProgressCapture()
61 : {
62 0 : }
63 :
64 0 : void ProgressCapture::dispose()
65 : {
66 0 : SolarMutexGuard aGuard;
67 0 : m_pData->bDisposed = true;
68 0 : }
69 :
70 0 : void SAL_CALL ProgressCapture::start( const OUString& _rText, ::sal_Int32 _nRange ) throw (RuntimeException, std::exception)
71 : {
72 0 : SolarMutexGuard aGuard;
73 0 : if ( !m_pData->bDisposed )
74 0 : m_pData->rMasterProgress.startObject( m_pData->sObjectName, _rText, _nRange );
75 0 : }
76 :
77 0 : void SAL_CALL ProgressCapture::end( ) throw (RuntimeException, std::exception)
78 : {
79 0 : SolarMutexGuard aGuard;
80 0 : if ( !m_pData->bDisposed )
81 0 : m_pData->rMasterProgress.endObject();
82 0 : }
83 :
84 0 : void SAL_CALL ProgressCapture::setText( const OUString& _rText ) throw (RuntimeException, std::exception)
85 : {
86 0 : SolarMutexGuard aGuard;
87 0 : if ( !m_pData->bDisposed )
88 0 : m_pData->rMasterProgress.setObjectProgressText( _rText );
89 0 : }
90 :
91 0 : void SAL_CALL ProgressCapture::setValue( ::sal_Int32 _nValue ) throw (RuntimeException, std::exception)
92 : {
93 0 : SolarMutexGuard aGuard;
94 0 : if ( !m_pData->bDisposed )
95 0 : m_pData->rMasterProgress.setObjectProgressValue( _nValue );
96 0 : }
97 :
98 0 : void SAL_CALL ProgressCapture::reset( ) throw (RuntimeException, std::exception)
99 : {
100 : OSL_FAIL( "ProgressCapture::reset: not implemented!" );
101 0 : }
102 :
103 : } // namespace dbmm
104 :
105 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|