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>
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
;
39 // ProgressCapture_Data
40 struct ProgressCapture_Data
42 ProgressCapture_Data( const OUString
& _rObjectName
, IMigrationProgress
& _rMasterProgress
)
43 :sObjectName( _rObjectName
)
44 ,rMasterProgress( _rMasterProgress
)
50 IMigrationProgress
& rMasterProgress
;
55 ProgressCapture::ProgressCapture( const OUString
& _rObjectName
, IMigrationProgress
& _rMasterProgress
)
56 :m_pData( new ProgressCapture_Data( _rObjectName
, _rMasterProgress
) )
60 ProgressCapture::~ProgressCapture()
64 void ProgressCapture::dispose()
66 SolarMutexGuard aGuard
;
67 m_pData
->bDisposed
= true;
70 void SAL_CALL
ProgressCapture::start( const OUString
& _rText
, ::sal_Int32 _nRange
) throw (RuntimeException
, std::exception
)
72 SolarMutexGuard aGuard
;
73 if ( !m_pData
->bDisposed
)
74 m_pData
->rMasterProgress
.startObject( m_pData
->sObjectName
, _rText
, _nRange
);
77 void SAL_CALL
ProgressCapture::end( ) throw (RuntimeException
, std::exception
)
79 SolarMutexGuard aGuard
;
80 if ( !m_pData
->bDisposed
)
81 m_pData
->rMasterProgress
.endObject();
84 void SAL_CALL
ProgressCapture::setText( const OUString
& _rText
) throw (RuntimeException
, std::exception
)
86 SolarMutexGuard aGuard
;
87 if ( !m_pData
->bDisposed
)
88 m_pData
->rMasterProgress
.setObjectProgressText( _rText
);
91 void SAL_CALL
ProgressCapture::setValue( ::sal_Int32 _nValue
) throw (RuntimeException
, std::exception
)
93 SolarMutexGuard aGuard
;
94 if ( !m_pData
->bDisposed
)
95 m_pData
->rMasterProgress
.setObjectProgressValue( _nValue
);
98 void SAL_CALL
ProgressCapture::reset( ) throw (RuntimeException
, std::exception
)
100 OSL_FAIL( "ProgressCapture::reset: not implemented!" );
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */