1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "progresscapture.hxx"
21 #include "migrationprogress.hxx"
23 #include <vcl/svapp.hxx>
24 #include <osl/mutex.hxx>
26 //........................................................................
29 //........................................................................
31 using ::com::sun::star::uno::Reference
;
32 using ::com::sun::star::uno::XInterface
;
33 using ::com::sun::star::uno::UNO_QUERY
;
34 using ::com::sun::star::uno::UNO_QUERY_THROW
;
35 using ::com::sun::star::uno::UNO_SET_THROW
;
36 using ::com::sun::star::uno::Exception
;
37 using ::com::sun::star::uno::RuntimeException
;
38 using ::com::sun::star::uno::Any
;
39 using ::com::sun::star::uno::makeAny
;
41 //====================================================================
42 //= ProgressCapture_Data
43 //====================================================================
44 struct ProgressCapture_Data
46 ProgressCapture_Data( const OUString
& _rObjectName
, IMigrationProgress
& _rMasterProgress
)
47 :sObjectName( _rObjectName
)
48 ,rMasterProgress( _rMasterProgress
)
54 IMigrationProgress
& rMasterProgress
;
58 //====================================================================
60 //====================================================================
61 //--------------------------------------------------------------------
62 ProgressCapture::ProgressCapture( const OUString
& _rObjectName
, IMigrationProgress
& _rMasterProgress
)
63 :m_pData( new ProgressCapture_Data( _rObjectName
, _rMasterProgress
) )
67 //--------------------------------------------------------------------
68 ProgressCapture::~ProgressCapture()
72 //--------------------------------------------------------------------
73 void ProgressCapture::dispose()
75 SolarMutexGuard aGuard
;
76 m_pData
->bDisposed
= true;
79 //--------------------------------------------------------------------
80 void SAL_CALL
ProgressCapture::start( const OUString
& _rText
, ::sal_Int32 _nRange
) throw (RuntimeException
)
82 SolarMutexGuard aGuard
;
83 if ( !m_pData
->bDisposed
)
84 m_pData
->rMasterProgress
.startObject( m_pData
->sObjectName
, _rText
, _nRange
);
87 //--------------------------------------------------------------------
88 void SAL_CALL
ProgressCapture::end( ) throw (RuntimeException
)
90 SolarMutexGuard aGuard
;
91 if ( !m_pData
->bDisposed
)
92 m_pData
->rMasterProgress
.endObject();
95 //--------------------------------------------------------------------
96 void SAL_CALL
ProgressCapture::setText( const OUString
& _rText
) throw (RuntimeException
)
98 SolarMutexGuard aGuard
;
99 if ( !m_pData
->bDisposed
)
100 m_pData
->rMasterProgress
.setObjectProgressText( _rText
);
103 //--------------------------------------------------------------------
104 void SAL_CALL
ProgressCapture::setValue( ::sal_Int32 _nValue
) throw (RuntimeException
)
106 SolarMutexGuard aGuard
;
107 if ( !m_pData
->bDisposed
)
108 m_pData
->rMasterProgress
.setObjectProgressValue( _nValue
);
111 //--------------------------------------------------------------------
112 void SAL_CALL
ProgressCapture::reset( ) throw (RuntimeException
)
114 OSL_FAIL( "ProgressCapture::reset: not implemented!" );
117 //........................................................................
119 //........................................................................
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */