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: prcntfld.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 ************************************************************************/
33 #ifndef _FIELD_HXX //autogen
34 #include <vcl/field.hxx>
38 class SW_DLLPUBLIC PercentField
: public MetricField
40 sal_Int64 nRefValue
; // 100%-Wert fuer Umrechnung (in Twips)
43 sal_Int64 nOldSpinSize
;
44 sal_Int64 nOldBaseValue
;
45 sal_Int64 nLastPercent
;
49 sal_Bool bLockAutoCalculation
; //prevent recalcution of percent values when the
50 //reference value is changed
52 SW_DLLPRIVATE sal_Int64
ImpPower10(USHORT n
);
54 using MetricField::SetValue
;
55 using MetricField::GetValue
;
56 using MetricFormatter::SetUserValue
;
57 using MetricFormatter::SetBaseValue
;
58 using MetricFormatter::SetMax
;
59 using MetricFormatter::SetMin
;
60 using NumericFormatter::IsValueModified
;
64 virtual void SetValue(sal_Int64 nNewValue
, FieldUnit eInUnit
= FUNIT_NONE
);
66 PercentField( Window
* pWin
, const ResId
& rResId
);
68 void SetPrcntValue(sal_Int64 nNewValue
, FieldUnit eInUnit
= FUNIT_NONE
);
70 void SetUserValue(sal_Int64 nNewValue
, FieldUnit eInUnit
= FUNIT_NONE
);
72 void SetBaseValue(sal_Int64 nNewValue
, FieldUnit eInUnit
= FUNIT_NONE
);
74 sal_Int64
GetValue(FieldUnit eOutUnit
= FUNIT_NONE
);
76 BOOL
IsValueModified();
78 //using NumericFormatter::SetMax;
79 void SetMax(sal_Int64 nNewMax
, FieldUnit eInUnit
= FUNIT_NONE
);
81 //using NumericFormatter::SetMin;
82 void SetMin(sal_Int64 nNewMin
, FieldUnit eInUnit
= FUNIT_NONE
);
84 sal_Int64
NormalizePercent(sal_Int64 nValue
);
85 sal_Int64
DenormalizePercent(sal_Int64 nValue
);
87 void SetRefValue(sal_Int64 nValue
);
88 inline sal_Int64
GetRefValue() const { return nRefValue
; }
89 sal_Int64
GetRealValue(FieldUnit eOutUnit
= FUNIT_NONE
);
91 sal_Int64
Convert(sal_Int64 nValue
, FieldUnit eInUnit
, FieldUnit eOutUnit
);
93 void ShowPercent(BOOL bPercent
);
95 USHORT
GetOldDigits() const {return nOldDigits
;}
97 void LockAutoCalculation(sal_Bool bLock
) {bLockAutoCalculation
= bLock
;}
98 sal_Bool
IsAutoCalculationLocked()const {return bLockAutoCalculation
;}
101 #endif // _PRCNTFLD_HXX