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 #ifndef INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_PROGRESSMIXER_HXX
21 #define INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_PROGRESSMIXER_HXX
23 #include <sal/types.h>
30 typedef sal_uInt32 PhaseID
;
31 typedef sal_uInt32 PhaseWeight
;
34 class SAL_NO_VTABLE IProgressConsumer
37 virtual void start( sal_uInt32 _nRange
) = 0;
38 virtual void advance( sal_uInt32 _nValue
) = 0;
39 virtual void end() = 0;
42 ~IProgressConsumer() {}
46 struct ProgressMixer_Data
;
47 /** a class which mixes (i.e. concatenates) progress values from different
48 sources/phases, with different weight
53 ProgressMixer( IProgressConsumer
& _rConsumer
);
56 /** registers a phase of the process, which has the given weight
57 in the overall process
59 the progress is not runnig, yet
61 void registerPhase( const PhaseID _nID
, const PhaseWeight _nWeight
);
63 /** enters the phase with the given ID, with the phase having
64 the given overall range
66 void startPhase( const PhaseID _nID
, const sal_uInt32 _nPhaseRange
);
68 /** announces a new progress in the current phase.
70 The given phase progress must be between 0 and the overall phase range
71 as specified in ->startPhase.
73 void advancePhase( const sal_uInt32 _nPhaseProgress
);
75 /** leaves the current phase, which has been started with ->startPhase previously
80 ::std::unique_ptr
< ProgressMixer_Data
> m_pData
;
85 #endif // INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_PROGRESSMIXER_HXX
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */