summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-08-18 11:56:11 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-08-18 12:34:13 +0100
commit46906b68c443939beb9b0c44d3bef9c1ce9c39d9 (patch)
tree821088e62be796d8ce7a6110e1aff4f7f8015931 /sw
parentb0041fd68ae1a9df91f8c3274e0b4003ef914a44 (diff)
callcatcher: update unused code
One of the SfxTabDialog ResID ctors is now gone, progress. Equally pleasing is that the last use of the old PercentField is gone now as well, so that can be removed and the new PercentFieldWrap can be renamed as PercentField to take its place Change-Id: I7a706e98d4dfdc3541da73c3375ee067a799b4bd
Diffstat (limited to 'sw')
-rw-r--r--sw/source/ui/frmdlg/column.cxx18
-rw-r--r--sw/source/ui/inc/column.hxx16
-rw-r--r--sw/source/ui/inc/frmpage.hxx4
-rw-r--r--sw/source/ui/inc/prcntfld.hxx68
-rw-r--r--sw/source/ui/table/tabledlg.cxx2
-rw-r--r--sw/source/ui/table/tablepg.hxx8
-rw-r--r--sw/source/ui/utlui/prcntfld.cxx285
7 files changed, 34 insertions, 367 deletions
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index aa75d0b4782e..cae138a98f60 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -437,11 +437,11 @@ SwColumnPage::SwColumnPage(Window *pParent, const SfxItemSet &rSet)
get(m_pPgeExampleWN, "pageexample");
get(m_pFrmExampleWN, "frameexample");
- connectPercentFieldWrapper(aEd1, "width1mf");
- connectPercentFieldWrapper(aEd2, "width2mf");
- connectPercentFieldWrapper(aEd3, "width3mf");
- connectPercentFieldWrapper(aDistEd1, "spacing1mf");
- connectPercentFieldWrapper(aDistEd2, "spacing2mf");
+ connectPercentField(aEd1, "width1mf");
+ connectPercentField(aEd2, "width2mf");
+ connectPercentField(aEd3, "width3mf");
+ connectPercentField(aDistEd1, "spacing1mf");
+ connectPercentField(aDistEd2, "spacing2mf");
SetExchangeSupport();
@@ -556,12 +556,12 @@ void SwColumnPage::SetPageWidth(long nPageWidth)
aEd3.SetMax(nNewMaxWidth, FUNIT_TWIP);
}
-void SwColumnPage::connectPercentFieldWrapper(PercentFieldWrap &rWrap, const OString &rName)
+void SwColumnPage::connectPercentField(PercentField &rWrap, const OString &rName)
{
MetricField *pFld = get<MetricField>(rName);
assert(pFld);
rWrap.set(pFld);
- m_aPercentFieldWrappersMap[pFld] = &rWrap;
+ m_aPercentFieldsMap[pFld] = &rWrap;
}
void SwColumnPage::Reset(const SfxItemSet &rSet)
@@ -989,7 +989,7 @@ IMPL_LINK( SwColumnPage, ColModify, NumericField *, pNF )
------------------------------------------------------------------------*/
IMPL_LINK( SwColumnPage, GapModify, MetricField*, pMetricFld )
{
- PercentFieldWrap *pFld = m_aPercentFieldWrappersMap[pMetricFld];
+ PercentField *pFld = m_aPercentFieldsMap[pMetricFld];
assert(pFld);
long nActValue = static_cast< long >(pFld->DenormalizePercent(pFld->GetValue(FUNIT_TWIP)));
if(nCols < 2)
@@ -1062,7 +1062,7 @@ IMPL_LINK( SwColumnPage, GapModify, MetricField*, pMetricFld )
IMPL_LINK( SwColumnPage, EdModify, MetricField *, pMetricFld )
{
- PercentFieldWrap *pField = m_aPercentFieldWrappersMap[pMetricFld];
+ PercentField *pField = m_aPercentFieldsMap[pMetricFld];
assert(pField);
pModifiedField = pField;
Timeout();
diff --git a/sw/source/ui/inc/column.hxx b/sw/source/ui/inc/column.hxx
index bab926bf647f..e50a5d94b7c5 100644
--- a/sw/source/ui/inc/column.hxx
+++ b/sw/source/ui/inc/column.hxx
@@ -98,14 +98,14 @@ class SwColumnPage : public SfxTabPage
PushButton* m_pBtnBack;
FixedText* m_pLbl1;
- PercentFieldWrap aEd1;
+ PercentField aEd1;
FixedText* m_pLbl2;
- PercentFieldWrap aEd2;
+ PercentField aEd2;
FixedText* m_pLbl3;
- PercentFieldWrap aEd3;
+ PercentField aEd3;
PushButton* m_pBtnNext;
- PercentFieldWrap aDistEd1;
- PercentFieldWrap aDistEd2;
+ PercentField aDistEd1;
+ PercentField aDistEd2;
CheckBox* m_pAutoWidthBox;
FixedText* m_pLineTypeLbl;
@@ -133,9 +133,9 @@ class SwColumnPage : public SfxTabPage
long nColWidth[nMaxCols];
long nColDist[nMaxCols];
sal_uInt16 nMinWidth;
- PercentFieldWrap* pModifiedField;
+ PercentField* pModifiedField;
- std::map<MetricField*, PercentFieldWrap*> m_aPercentFieldWrappersMap;
+ std::map<MetricField*, PercentField*> m_aPercentFieldsMap;
sal_Bool bFormat;
sal_Bool bFrm;
@@ -169,7 +169,7 @@ class SwColumnPage : public SfxTabPage
SwColumnPage(Window *pParent, const SfxItemSet &rSet);
- void connectPercentFieldWrapper(PercentFieldWrap &rWrap, const OString &rName);
+ void connectPercentField(PercentField &rWrap, const OString &rName);
bool isLineNotNone() const;
diff --git a/sw/source/ui/inc/frmpage.hxx b/sw/source/ui/inc/frmpage.hxx
index 26de98cd56e9..dbcc213d69c1 100644
--- a/sw/source/ui/inc/frmpage.hxx
+++ b/sw/source/ui/inc/frmpage.hxx
@@ -46,13 +46,13 @@ class SwFrmPage: public SfxTabPage
// size
FixedText* m_pWidthFT;
FixedText* m_pWidthAutoFT;
- PercentFieldWrap m_aWidthED;
+ PercentField m_aWidthED;
CheckBox* m_pRelWidthCB;
CheckBox* m_pAutoWidthCB;
FixedText* m_pHeightFT;
FixedText* m_pHeightAutoFT;
- PercentFieldWrap m_aHeightED;
+ PercentField m_aHeightED;
CheckBox* m_pRelHeightCB;
CheckBox* m_pAutoHeightCB;
diff --git a/sw/source/ui/inc/prcntfld.hxx b/sw/source/ui/inc/prcntfld.hxx
index f8f45e2e1710..f66ad6ee7d88 100644
--- a/sw/source/ui/inc/prcntfld.hxx
+++ b/sw/source/ui/inc/prcntfld.hxx
@@ -24,7 +24,7 @@
#include "uitool.hxx"
//Wraps a MetricField with extra features, preferred to PercentField
-class SW_DLLPUBLIC PercentFieldWrap
+class SW_DLLPUBLIC PercentField
{
MetricField* m_pField;
@@ -44,7 +44,7 @@ class SW_DLLPUBLIC PercentFieldWrap
public:
- PercentFieldWrap();
+ PercentField();
void set(MetricField *pField);
const MetricField* get() const { return m_pField; }
MetricField* get() { return m_pField; }
@@ -106,70 +106,6 @@ public:
bool IsAutoCalculationLocked() const {return bLockAutoCalculation;}
};
-
-class SW_DLLPUBLIC PercentField : public MetricField
-{
- sal_Int64 nRefValue; // 100% value for conversion (in Twips)
- sal_Int64 nOldMax;
- sal_Int64 nOldMin;
- sal_Int64 nOldSpinSize;
- sal_Int64 nOldBaseValue;
- sal_Int64 nLastPercent;
- sal_Int64 nLastValue;
- sal_uInt16 nOldDigits;
- FieldUnit eOldUnit;
- sal_Bool bLockAutoCalculation; //prevent recalcution of percent values when the
- //reference value is changed
-
- SW_DLLPRIVATE sal_Int64 ImpPower10(sal_uInt16 n);
-
- using MetricField::SetValue;
- using MetricField::GetValue;
- using MetricFormatter::SetUserValue;
- using MetricFormatter::SetBaseValue;
- using MetricFormatter::SetMax;
- using MetricFormatter::SetMin;
- using NumericFormatter::IsValueModified;
-
-public:
-
- virtual void SetValue(sal_Int64 nNewValue, FieldUnit eInUnit = FUNIT_NONE);
-
- PercentField( Window* pWin, const ResId& rResId );
-
- void SetPrcntValue(sal_Int64 nNewValue, FieldUnit eInUnit = FUNIT_NONE);
-
- void SetUserValue(sal_Int64 nNewValue, FieldUnit eInUnit = FUNIT_NONE);
-
- void SetBaseValue(sal_Int64 nNewValue, FieldUnit eInUnit = FUNIT_NONE);
-
- sal_Int64 GetValue(FieldUnit eOutUnit = FUNIT_NONE);
-
- sal_Bool IsValueModified();
-
- //using NumericFormatter::SetMax;
- void SetMax(sal_Int64 nNewMax, FieldUnit eInUnit = FUNIT_NONE);
-
- //using NumericFormatter::SetMin;
- void SetMin(sal_Int64 nNewMin, FieldUnit eInUnit = FUNIT_NONE);
-
- sal_Int64 NormalizePercent(sal_Int64 nValue);
- sal_Int64 DenormalizePercent(sal_Int64 nValue);
-
- void SetRefValue(sal_Int64 nValue);
- inline sal_Int64 GetRefValue() const { return nRefValue; }
- sal_Int64 GetRealValue(FieldUnit eOutUnit = FUNIT_NONE);
-
- sal_Int64 Convert(sal_Int64 nValue, FieldUnit eInUnit, FieldUnit eOutUnit);
-
- void ShowPercent(sal_Bool bPercent);
-
- sal_uInt16 GetOldDigits() const {return nOldDigits;}
-
- void LockAutoCalculation(sal_Bool bLock) {bLockAutoCalculation = bLock;}
- sal_Bool IsAutoCalculationLocked()const {return bLockAutoCalculation;}
-};
-
#endif // _PRCNTFLD_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
index e833ba80676a..bc96b1de4806 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -945,7 +945,7 @@ sal_Bool SwTableColumnPage::FillItemSet( SfxItemSet& )
void SwTableColumnPage::ModifyHdl( MetricField* pField )
{
- PercentFieldWrap *pEdit = NULL;
+ PercentField *pEdit = NULL;
sal_uInt16 nAktPos;
sal_uInt16 i;
diff --git a/sw/source/ui/table/tablepg.hxx b/sw/source/ui/table/tablepg.hxx
index 84703bd5e2f4..3e4849273fec 100644
--- a/sw/source/ui/table/tablepg.hxx
+++ b/sw/source/ui/table/tablepg.hxx
@@ -39,7 +39,7 @@ class SwFormatTablePage : public SfxTabPage
{
TableNameEdit* m_pNameED;
FixedText* m_pWidthFT;
- PercentFieldWrap m_aWidthMF;
+ PercentField m_aWidthMF;
CheckBox* m_pRelWidthCB;
RadioButton* m_pFullBtn;
@@ -50,9 +50,9 @@ class SwFormatTablePage : public SfxTabPage
RadioButton* m_pFreeBtn;
FixedText* m_pLeftFT;
- PercentFieldWrap m_aLeftMF;
+ PercentField m_aLeftMF;
FixedText* m_pRightFT;
- PercentFieldWrap m_aRightMF;
+ PercentField m_aRightMF;
FixedText* m_pTopFT;
MetricField* m_pTopMF;
FixedText* m_pBottomFT;
@@ -103,7 +103,7 @@ class SwTableColumnPage : public SfxTabPage
PushButton* m_pDownBtn;
SwTableRep* pTblData;
- PercentFieldWrap m_aFieldArr[MET_FIELDS];
+ PercentField m_aFieldArr[MET_FIELDS];
FixedText* m_pTextArr[MET_FIELDS];
SwTwips nTableWidth;
SwTwips nMinWidth;
diff --git a/sw/source/ui/utlui/prcntfld.cxx b/sw/source/ui/utlui/prcntfld.cxx
index 4aa8659b51a0..e2f217b52e56 100644
--- a/sw/source/ui/utlui/prcntfld.cxx
+++ b/sw/source/ui/utlui/prcntfld.cxx
@@ -20,24 +20,7 @@
#include "prcntfld.hxx"
-PercentField::PercentField( Window* pWin, const ResId& rResId ) :
- MetricField ( pWin, rResId ),
-
- nOldMax (0),
- nOldMin (0),
- nLastPercent(-1),
- nLastValue (-1),
- eOldUnit (FUNIT_NONE),
- bLockAutoCalculation(sal_False)
-{
-
- nOldSpinSize = GetSpinSize();
- nRefValue = DenormalizePercent(MetricField::GetMax(FUNIT_TWIP));
- nOldDigits = GetDecimalDigits();
- SetCustomUnitText(OUString('%'));
-}
-
-PercentFieldWrap::PercentFieldWrap()
+PercentField::PercentField()
: nOldMax(0)
, nOldMin(0)
, nLastPercent(-1)
@@ -47,7 +30,7 @@ PercentFieldWrap::PercentFieldWrap()
{
}
-void PercentFieldWrap::set(MetricField *pField)
+void PercentField::set(MetricField *pField)
{
m_pField = pField;
nOldSpinSize = m_pField->GetSpinSize();
@@ -62,87 +45,11 @@ void PercentField::SetRefValue(sal_Int64 nValue)
nRefValue = nValue;
- if (!bLockAutoCalculation && (GetUnit() == FUNIT_CUSTOM))
- SetPrcntValue(nRealValue, eOldUnit);
-}
-
-void PercentFieldWrap::SetRefValue(sal_Int64 nValue)
-{
- sal_Int64 nRealValue = GetRealValue(eOldUnit);
-
- nRefValue = nValue;
-
if (!bLockAutoCalculation && (m_pField->GetUnit() == FUNIT_CUSTOM))
SetPrcntValue(nRealValue, eOldUnit);
}
-void PercentField::ShowPercent(sal_Bool bPercent)
-{
- if ((bPercent && GetUnit() == FUNIT_CUSTOM) ||
- (!bPercent && GetUnit() != FUNIT_CUSTOM))
- return;
-
- sal_Int64 nOldValue;
-
- if (bPercent)
- {
- sal_Int64 nAktWidth, nPercent;
-
- nOldValue = GetValue();
-
- eOldUnit = GetUnit();
- nOldDigits = GetDecimalDigits();
- nOldMin = GetMin();
- nOldMax = GetMax();
- nOldSpinSize = GetSpinSize();
- nOldBaseValue = GetBaseValue();
- SetUnit(FUNIT_CUSTOM);
- SetDecimalDigits( 0 );
-
- nAktWidth = ConvertValue(nOldMin, 0, nOldDigits, eOldUnit, FUNIT_TWIP);
- // round to 0.5 percent
- nPercent = ((nAktWidth * 10) / nRefValue + 5) / 10;
-
- MetricField::SetMin(std::max(static_cast< sal_Int64 >(1), nPercent));
- MetricField::SetMax(100);
- SetSpinSize(5);
- MetricField::SetBaseValue(0);
- if (nOldValue != nLastValue)
- {
- nAktWidth = ConvertValue(nOldValue, 0, nOldDigits, eOldUnit, FUNIT_TWIP);
- nPercent = ((nAktWidth * 10) / nRefValue + 5) / 10;
- MetricFormatter::SetValue(nPercent);
- nLastPercent = nPercent;
- nLastValue = nOldValue;
- }
- else
- MetricFormatter::SetValue(nLastPercent);
- }
- else
- {
- sal_Int64 nOldPercent = GetValue(FUNIT_CUSTOM);
-
- nOldValue = Convert(GetValue(), GetUnit(), eOldUnit);
-
- SetUnit(eOldUnit);
- SetDecimalDigits(nOldDigits);
- MetricField::SetMin(nOldMin);
- MetricField::SetMax(nOldMax);
- SetSpinSize(nOldSpinSize);
- MetricField::SetBaseValue(nOldBaseValue);
-
- if (nOldPercent != nLastPercent)
- {
- SetPrcntValue(nOldValue, eOldUnit);
- nLastPercent = nOldPercent;
- nLastValue = nOldValue;
- }
- else
- SetPrcntValue(nLastValue, eOldUnit);
- }
-}
-
-void PercentFieldWrap::ShowPercent(bool bPercent)
+void PercentField::ShowPercent(bool bPercent)
{
if ((bPercent && m_pField->GetUnit() == FUNIT_CUSTOM) ||
(!bPercent && m_pField->GetUnit() != FUNIT_CUSTOM))
@@ -208,36 +115,8 @@ void PercentFieldWrap::ShowPercent(bool bPercent)
}
}
-void PercentField::SetValue(sal_Int64 nNewValue, FieldUnit eInUnit)
-{
- MetricFormatter::SetValue(nNewValue, eInUnit);
-}
-
void PercentField::SetPrcntValue(sal_Int64 nNewValue, FieldUnit eInUnit)
{
- if (GetUnit() != FUNIT_CUSTOM || eInUnit == FUNIT_CUSTOM)
- MetricFormatter::SetValue(Convert(nNewValue, eInUnit, GetUnit()));
-
- else
- {
- // Overwrite output value, do not restore later
- sal_Int64 nPercent, nAktWidth;
- if(eInUnit == FUNIT_TWIP)
- {
- nAktWidth = ConvertValue(nNewValue, 0, nOldDigits, FUNIT_TWIP, FUNIT_TWIP);
- }
- else
- {
- sal_Int64 nValue = Convert(nNewValue, eInUnit, eOldUnit);
- nAktWidth = ConvertValue(nValue, 0, nOldDigits, eOldUnit, FUNIT_TWIP);
- }
- nPercent = ((nAktWidth * 10) / nRefValue + 5) / 10;
- MetricFormatter::SetValue(nPercent);
- }
-}
-
-void PercentFieldWrap::SetPrcntValue(sal_Int64 nNewValue, FieldUnit eInUnit)
-{
if (m_pField->GetUnit() != FUNIT_CUSTOM || eInUnit == FUNIT_CUSTOM)
m_pField->SetValue(Convert(nNewValue, eInUnit, m_pField->GetUnit()));
else
@@ -258,7 +137,7 @@ void PercentFieldWrap::SetPrcntValue(sal_Int64 nNewValue, FieldUnit eInUnit)
}
}
-void PercentFieldWrap::SetBaseValue(sal_Int64 nNewValue, FieldUnit eInUnit)
+void PercentField::SetBaseValue(sal_Int64 nNewValue, FieldUnit eInUnit)
{
if (m_pField->GetUnit() == FUNIT_CUSTOM)
nOldBaseValue = m_pField->ConvertValue(nNewValue, 0, nOldDigits, eInUnit, eOldUnit);
@@ -266,65 +145,13 @@ void PercentFieldWrap::SetBaseValue(sal_Int64 nNewValue, FieldUnit eInUnit)
m_pField->SetBaseValue(nNewValue, eInUnit);
}
-void PercentField::SetUserValue( sal_Int64 nNewValue, FieldUnit eInUnit )
-{
- if (GetUnit() != FUNIT_CUSTOM || eInUnit == FUNIT_CUSTOM)
- MetricField::SetUserValue(Convert(nNewValue, eInUnit, GetUnit()),FUNIT_NONE);
-
- else
- {
- // Overwrite output value, do not restore later
- sal_Int64 nPercent, nAktWidth;
- if(eInUnit == FUNIT_TWIP)
- {
- nAktWidth = ConvertValue(nNewValue, 0, nOldDigits, FUNIT_TWIP, FUNIT_TWIP);
- }
- else
- {
- sal_Int64 nValue = Convert(nNewValue, eInUnit, eOldUnit);
- nAktWidth = ConvertValue(nValue, 0, nOldDigits, eOldUnit, FUNIT_TWIP);
- }
- nPercent = ((nAktWidth * 10) / nRefValue + 5) / 10;
- MetricField::SetUserValue(nPercent,FUNIT_NONE);
- }
-
-}
-
-void PercentField::SetBaseValue(sal_Int64 nNewValue, FieldUnit eInUnit)
-{
- if (GetUnit() == FUNIT_CUSTOM)
- nOldBaseValue = ConvertValue(nNewValue, 0, nOldDigits, eInUnit, eOldUnit);
- else
- MetricField::SetBaseValue(nNewValue, eInUnit);
-}
-
-sal_Int64 PercentField::GetValue( FieldUnit eOutUnit )
-{
- return Convert(MetricField::GetValue(), GetUnit(), eOutUnit);
-}
-
-sal_Int64 PercentFieldWrap::GetValue(FieldUnit eOutUnit)
+sal_Int64 PercentField::GetValue(FieldUnit eOutUnit)
{
return Convert(m_pField->GetValue(), m_pField->GetUnit(), eOutUnit);
}
void PercentField::SetMin(sal_Int64 nNewMin, FieldUnit eInUnit)
{
- if (GetUnit() != FUNIT_CUSTOM)
- MetricField::SetMin(nNewMin, eInUnit);
- else
- {
- if (eInUnit == FUNIT_NONE)
- eInUnit = eOldUnit;
- nOldMin = Convert(nNewMin, eInUnit, eOldUnit);
-
- sal_Int64 nPercent = Convert(nNewMin, eInUnit, FUNIT_CUSTOM);
- MetricField::SetMin(std::max( static_cast< sal_Int64 >(1), nPercent));
- }
-}
-
-void PercentFieldWrap::SetMin(sal_Int64 nNewMin, FieldUnit eInUnit)
-{
if (m_pField->GetUnit() != FUNIT_CUSTOM)
m_pField->SetMin(nNewMin, eInUnit);
else
@@ -340,17 +167,6 @@ void PercentFieldWrap::SetMin(sal_Int64 nNewMin, FieldUnit eInUnit)
void PercentField::SetMax(sal_Int64 nNewMax, FieldUnit eInUnit)
{
- if (GetUnit() != FUNIT_CUSTOM)
- MetricField::SetMax(nNewMax, eInUnit);
- else
- {
- if (eInUnit == FUNIT_NONE)
- eInUnit = eOldUnit;
- }
-}
-
-void PercentFieldWrap::SetMax(sal_Int64 nNewMax, FieldUnit eInUnit)
-{
if (m_pField->GetUnit() != FUNIT_CUSTOM)
m_pField->SetMax(nNewMax, eInUnit);
else
@@ -362,16 +178,6 @@ void PercentFieldWrap::SetMax(sal_Int64 nNewMax, FieldUnit eInUnit)
sal_Int64 PercentField::NormalizePercent(sal_Int64 nValue)
{
- if (GetUnit() != FUNIT_CUSTOM)
- nValue = MetricField::Normalize(nValue);
- else
- nValue = nValue * ImpPower10(nOldDigits);
-
- return nValue;
-}
-
-sal_Int64 PercentFieldWrap::NormalizePercent(sal_Int64 nValue)
-{
if (m_pField->GetUnit() != FUNIT_CUSTOM)
nValue = m_pField->Normalize(nValue);
else
@@ -381,19 +187,6 @@ sal_Int64 PercentFieldWrap::NormalizePercent(sal_Int64 nValue)
sal_Int64 PercentField::DenormalizePercent(sal_Int64 nValue)
{
- if (GetUnit() != FUNIT_CUSTOM)
- nValue = MetricField::Denormalize(nValue);
- else
- {
- sal_Int64 nFactor = ImpPower10(nOldDigits);
- nValue = ((nValue+(nFactor/2)) / nFactor);
- }
-
- return nValue;
-}
-
-sal_Int64 PercentFieldWrap::DenormalizePercent(sal_Int64 nValue)
-{
if (m_pField->GetUnit() != FUNIT_CUSTOM)
nValue = m_pField->Denormalize(nValue);
else
@@ -404,7 +197,7 @@ sal_Int64 PercentFieldWrap::DenormalizePercent(sal_Int64 nValue)
return nValue;
}
-bool PercentFieldWrap::IsValueModified()
+bool PercentField::IsValueModified()
{
if (m_pField->GetUnit() == FUNIT_CUSTOM)
return true;
@@ -412,7 +205,7 @@ bool PercentFieldWrap::IsValueModified()
return m_pField->IsValueModified();
}
-void PercentFieldWrap::SetUserValue(sal_Int64 nNewValue, FieldUnit eInUnit)
+void PercentField::SetUserValue(sal_Int64 nNewValue, FieldUnit eInUnit)
{
if (m_pField->GetUnit() != FUNIT_CUSTOM || eInUnit == FUNIT_CUSTOM)
m_pField->SetUserValue(Convert(nNewValue, eInUnit, m_pField->GetUnit()),FUNIT_NONE);
@@ -434,26 +227,7 @@ void PercentFieldWrap::SetUserValue(sal_Int64 nNewValue, FieldUnit eInUnit)
}
}
-sal_Bool PercentField::IsValueModified()
-{
- if (GetUnit() == FUNIT_CUSTOM)
- return sal_True;
- else
- return MetricField::IsValueModified();
-}
-
-sal_Int64 PercentField::ImpPower10( sal_uInt16 n )
-{
- sal_uInt16 i;
- sal_Int64 nValue = 1;
-
- for ( i=0; i < n; i++ )
- nValue *= 10;
-
- return nValue;
-}
-
-sal_Int64 PercentFieldWrap::ImpPower10(sal_uInt16 n)
+sal_Int64 PercentField::ImpPower10(sal_uInt16 n)
{
sal_Int64 nValue = 1;
@@ -465,14 +239,6 @@ sal_Int64 PercentFieldWrap::ImpPower10(sal_uInt16 n)
sal_Int64 PercentField::GetRealValue(FieldUnit eOutUnit)
{
- if (GetUnit() != FUNIT_CUSTOM)
- return GetValue(eOutUnit);
- else
- return Convert(GetValue(), GetUnit(), eOutUnit);
-}
-
-sal_Int64 PercentFieldWrap::GetRealValue(FieldUnit eOutUnit)
-{
if (m_pField->GetUnit() != FUNIT_CUSTOM)
return GetValue(eOutUnit);
else
@@ -482,41 +248,6 @@ sal_Int64 PercentFieldWrap::GetRealValue(FieldUnit eOutUnit)
sal_Int64 PercentField::Convert(sal_Int64 nValue, FieldUnit eInUnit, FieldUnit eOutUnit)
{
if (eInUnit == eOutUnit ||
- (eInUnit == FUNIT_NONE && eOutUnit == GetUnit()) ||
- (eOutUnit == FUNIT_NONE && eInUnit == GetUnit()))
- return nValue;
-
- if (eInUnit == FUNIT_CUSTOM)
- {
- // Convert to metric
- sal_Int64 nTwipValue = (nRefValue * nValue + 50) / 100;
-
- if (eOutUnit == FUNIT_TWIP) // Only convert if necessary
- return NormalizePercent(nTwipValue);
- else
- return ConvertValue(NormalizePercent(nTwipValue), 0, nOldDigits, FUNIT_TWIP, eOutUnit);
- }
-
- if (eOutUnit == FUNIT_CUSTOM)
- {
- // Convert to percent
- sal_Int64 nAktWidth;
- nValue = DenormalizePercent(nValue);
-
- if (eInUnit == FUNIT_TWIP) // Only convert if necessary
- nAktWidth = nValue;
- else
- nAktWidth = ConvertValue(nValue, 0, nOldDigits, eInUnit, FUNIT_TWIP);
- // Round to 0.5 percent
- return ((nAktWidth * 1000) / nRefValue + 5) / 10;
- }
-
- return ConvertValue(nValue, 0, nOldDigits, eInUnit, eOutUnit);
-}
-
-sal_Int64 PercentFieldWrap::Convert(sal_Int64 nValue, FieldUnit eInUnit, FieldUnit eOutUnit)
-{
- if (eInUnit == eOutUnit ||
(eInUnit == FUNIT_NONE && eOutUnit == m_pField->GetUnit()) ||
(eOutUnit == FUNIT_NONE && eInUnit == m_pField->GetUnit()))
return nValue;