1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ProgressBarHelper.hxx,v $
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.
29 ************************************************************************/
31 #ifndef _XMLOFF_PROGRESSBARHELPER_HXX
32 #define _XMLOFF_PROGRESSBARHELPER_HXX
34 #ifndef _COM_SUN_STAR_TASK_XSTATUSINDICATOR_HPP_
35 #include <com/sun/star/task/XStatusIndicator.hpp>
39 #define XML_PROGRESSRANGE "ProgressRange"
40 #define XML_PROGRESSMAX "ProgressMax"
41 #define XML_PROGRESSCURRENT "ProgressCurrent"
42 #define XML_PROGRESSREPEAT "ProgressRepeat"
44 class ProgressBarHelper
46 ::com::sun::star::uno::Reference
< ::com::sun::star::task::XStatusIndicator
> xStatusIndicator
;
52 // #96469#; if the value goes over the Range the progressbar starts again
59 ProgressBarHelper(const ::com::sun::star::uno::Reference
< ::com::sun::star::task::XStatusIndicator
>& xStatusIndicator
,
60 const sal_Bool bStrict
);
63 void SetText(::rtl::OUString
& rText
) { if (xStatusIndicator
.is()) xStatusIndicator
->setText(rText
); }
64 void SetRange(sal_Int32 nValue
) { nRange
= nValue
; }
65 void SetReference(sal_Int32 nValue
) { nReference
= nValue
; }
66 void SetValue(sal_Int32 nValue
);
67 void SetRepeat(sal_Bool bValue
) { bRepeat
= bValue
; }
68 inline void Increment(sal_Int32 nInc
= 1) { SetValue( nValue
+nInc
); }
69 void End() { if (xStatusIndicator
.is()) xStatusIndicator
->end(); }
71 // set the new reference and returns the new value which gives the
72 // Progress Bar the sam position as before
73 sal_Int32
ChangeReference(sal_Int32 nNewReference
);
75 sal_Int32
GetReference() { return nReference
; }
76 sal_Int32
GetValue() { return nValue
; }
77 sal_Bool
GetRepeat() { return bRepeat
; }
80 }//end of namespace binfilter