update dev300-m58
[ooovba.git] / dbaccess / source / ext / macromigration / progressmixer.hxx
blob8290eca7eb777217085850d761a33289f2205731
1 /*************************************************************************
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * Copyright 2008 by Sun Microsystems, Inc.
6 * OpenOffice.org - a multi-platform office productivity suite
8 * $RCSfile: progressmixer.hxx,v $
10 * $Revision: 1.1.2.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
28 ************************************************************************/
30 #ifndef DBACCESS_PROGRESSMIXER_HXX
31 #define DBACCESS_PROGRESSMIXER_HXX
33 /** === begin UNO includes === **/
34 /** === end UNO includes === **/
36 #include <sal/types.h>
38 #include <memory>
40 //........................................................................
41 namespace dbmm
43 //........................................................................
45 typedef sal_uInt32 PhaseID;
46 typedef sal_uInt32 PhaseWeight;
48 //====================================================================
49 //= IProgressConsumer
50 //====================================================================
51 class SAL_NO_VTABLE IProgressConsumer
53 public:
54 virtual void start( sal_uInt32 _nRange ) = 0;
55 virtual void advance( sal_uInt32 _nValue ) = 0;
56 virtual void end() = 0;
59 //====================================================================
60 //= ProgressMixer
61 //====================================================================
62 struct ProgressMixer_Data;
63 /** a class which mixes (i.e. concatenates) progress values from different
64 sources/phases, with different weight
66 class ProgressMixer
68 public:
69 ProgressMixer( IProgressConsumer& _rConsumer );
70 ~ProgressMixer();
72 /** registers a phase of the process, which has the given weight
73 in the overall process
74 @precond
75 the progress is not runnig, yet
77 void registerPhase( const PhaseID _nID, const PhaseWeight _nWeight );
79 /** enters the phase with the given ID, with the phase having
80 the given overall range
82 void startPhase( const PhaseID _nID, const sal_uInt32 _nPhaseRange );
84 /** announces a new progress in the current phase.
86 The given phase progress must be between 0 and the overall phase range
87 as specified in ->startPhase.
89 void advancePhase( const sal_uInt32 _nPhaseProgress );
91 /** leaves the current phase, which has been started with ->startPhase previously
93 void endPhase();
95 private:
96 ::std::auto_ptr< ProgressMixer_Data > m_pData;
99 //........................................................................
100 } // namespace dbmm
101 //........................................................................
103 #endif // DBACCESS_PROGRESSMIXER_HXX