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 : //........................................................................
27 : namespace dbmm
28 : {
29 : //........................................................................
30 :
31 : /** === begin UNO using === **/
32 : using ::com::sun::star::uno::Reference;
33 : using ::com::sun::star::uno::XInterface;
34 : using ::com::sun::star::uno::UNO_QUERY;
35 : using ::com::sun::star::uno::UNO_QUERY_THROW;
36 : using ::com::sun::star::uno::UNO_SET_THROW;
37 : using ::com::sun::star::uno::Exception;
38 : using ::com::sun::star::uno::RuntimeException;
39 : using ::com::sun::star::uno::Any;
40 : using ::com::sun::star::uno::makeAny;
41 : /** === end UNO using === **/
42 :
43 : //====================================================================
44 : //= ProgressCapture_Data
45 : //====================================================================
46 0 : struct ProgressCapture_Data
47 : {
48 0 : ProgressCapture_Data( const ::rtl::OUString& _rObjectName, IMigrationProgress& _rMasterProgress )
49 : :sObjectName( _rObjectName )
50 : ,rMasterProgress( _rMasterProgress )
51 0 : ,bDisposed( false )
52 : {
53 0 : }
54 :
55 : ::rtl::OUString sObjectName;
56 : IMigrationProgress& rMasterProgress;
57 : bool bDisposed;
58 : };
59 :
60 : //====================================================================
61 : //= ProgressCapture
62 : //====================================================================
63 : //--------------------------------------------------------------------
64 0 : ProgressCapture::ProgressCapture( const ::rtl::OUString& _rObjectName, IMigrationProgress& _rMasterProgress )
65 0 : :m_pData( new ProgressCapture_Data( _rObjectName, _rMasterProgress ) )
66 : {
67 0 : }
68 :
69 : //--------------------------------------------------------------------
70 0 : ProgressCapture::~ProgressCapture()
71 : {
72 0 : }
73 :
74 : //--------------------------------------------------------------------
75 0 : void ProgressCapture::dispose()
76 : {
77 0 : SolarMutexGuard aGuard;
78 0 : m_pData->bDisposed = true;
79 0 : }
80 :
81 : //--------------------------------------------------------------------
82 0 : void SAL_CALL ProgressCapture::start( const ::rtl::OUString& _rText, ::sal_Int32 _nRange ) throw (RuntimeException)
83 : {
84 0 : SolarMutexGuard aGuard;
85 0 : if ( !m_pData->bDisposed )
86 0 : m_pData->rMasterProgress.startObject( m_pData->sObjectName, _rText, _nRange );
87 0 : }
88 :
89 : //--------------------------------------------------------------------
90 0 : void SAL_CALL ProgressCapture::end( ) throw (RuntimeException)
91 : {
92 0 : SolarMutexGuard aGuard;
93 0 : if ( !m_pData->bDisposed )
94 0 : m_pData->rMasterProgress.endObject();
95 0 : }
96 :
97 : //--------------------------------------------------------------------
98 0 : void SAL_CALL ProgressCapture::setText( const ::rtl::OUString& _rText ) throw (RuntimeException)
99 : {
100 0 : SolarMutexGuard aGuard;
101 0 : if ( !m_pData->bDisposed )
102 0 : m_pData->rMasterProgress.setObjectProgressText( _rText );
103 0 : }
104 :
105 : //--------------------------------------------------------------------
106 0 : void SAL_CALL ProgressCapture::setValue( ::sal_Int32 _nValue ) throw (RuntimeException)
107 : {
108 0 : SolarMutexGuard aGuard;
109 0 : if ( !m_pData->bDisposed )
110 0 : m_pData->rMasterProgress.setObjectProgressValue( _nValue );
111 0 : }
112 :
113 : //--------------------------------------------------------------------
114 0 : void SAL_CALL ProgressCapture::reset( ) throw (RuntimeException)
115 : {
116 : OSL_FAIL( "ProgressCapture::reset: not implemented!" );
117 0 : }
118 :
119 : //........................................................................
120 : } // namespace dbmm
121 : //........................................................................
122 :
123 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|