diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-06 14:37:23 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-08 12:15:51 +0100 |
commit | 9e0770ea7e0cf094add54ad64bc9ff825d24bbe1 (patch) | |
tree | e897291e44ecb11ca44ba5e5ebefe03ac536862f /vcl | |
parent | 841ee6fb052fb35467d74b70f575a86c8c0fe3b7 (diff) |
Convert FieldUnit to scoped enum
Change-Id: Id2df31daa596a18c79af5fc6ea162deb6e24d5af
Reviewed-on: https://gerrit.libreoffice.org/62958
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/units.hrc | 48 | ||||
-rw-r--r-- | vcl/source/control/field.cxx | 117 | ||||
-rw-r--r-- | vcl/source/window/builder.cxx | 50 | ||||
-rw-r--r-- | vcl/source/window/printdlg.cxx | 36 |
4 files changed, 130 insertions, 121 deletions
diff --git a/vcl/inc/units.hrc b/vcl/inc/units.hrc index 3fc58eca0270..031ffab67ec3 100644 --- a/vcl/inc/units.hrc +++ b/vcl/inc/units.hrc @@ -25,32 +25,32 @@ std::pair<const char*, FieldUnit> SV_FUNIT_STRINGS[] = { // To translators: This is the first entry of a sequence of measurement unit names - { NC_("SV_FUNIT_STRINGS", "mm"), FUNIT_MM }, - { NC_("SV_FUNIT_STRINGS", "cm"), FUNIT_CM }, - { NC_("SV_FUNIT_STRINGS", "m"), FUNIT_M }, - { NC_("SV_FUNIT_STRINGS", "km"), FUNIT_KM }, - { NC_("SV_FUNIT_STRINGS", "twips"), FUNIT_TWIP }, - { NC_("SV_FUNIT_STRINGS", "twip"), FUNIT_TWIP }, - { NC_("SV_FUNIT_STRINGS", "pt"), FUNIT_POINT }, - { NC_("SV_FUNIT_STRINGS", "pc"), FUNIT_PICA }, - { NC_("SV_FUNIT_STRINGS", "\""), FUNIT_INCH }, - { NC_("SV_FUNIT_STRINGS", "in"), FUNIT_INCH }, - { NC_("SV_FUNIT_STRINGS", "inch"), FUNIT_INCH }, - { NC_("SV_FUNIT_STRINGS", "'"), FUNIT_FOOT }, - { NC_("SV_FUNIT_STRINGS", "ft"), FUNIT_FOOT }, - { NC_("SV_FUNIT_STRINGS", "foot"), FUNIT_FOOT }, - { NC_("SV_FUNIT_STRINGS", "feet"), FUNIT_FOOT }, - { NC_("SV_FUNIT_STRINGS", "miles"), FUNIT_MILE }, - { NC_("SV_FUNIT_STRINGS", "mile"), FUNIT_MILE }, - { NC_("SV_FUNIT_STRINGS", "ch"), FUNIT_CHAR }, - { NC_("SV_FUNIT_STRINGS", "line"), FUNIT_LINE }, - { NC_("SV_FUNIT_STRINGS", "pixels"), FUNIT_PIXEL }, - { NC_("SV_FUNIT_STRINGS", "pixel"), FUNIT_PIXEL }, + { NC_("SV_FUNIT_STRINGS", "mm"), FieldUnit::MM }, + { NC_("SV_FUNIT_STRINGS", "cm"), FieldUnit::CM }, + { NC_("SV_FUNIT_STRINGS", "m"), FieldUnit::M }, + { NC_("SV_FUNIT_STRINGS", "km"), FieldUnit::KM }, + { NC_("SV_FUNIT_STRINGS", "twips"), FieldUnit::TWIP }, + { NC_("SV_FUNIT_STRINGS", "twip"), FieldUnit::TWIP }, + { NC_("SV_FUNIT_STRINGS", "pt"), FieldUnit::POINT }, + { NC_("SV_FUNIT_STRINGS", "pc"), FieldUnit::PICA }, + { NC_("SV_FUNIT_STRINGS", "\""), FieldUnit::INCH }, + { NC_("SV_FUNIT_STRINGS", "in"), FieldUnit::INCH }, + { NC_("SV_FUNIT_STRINGS", "inch"), FieldUnit::INCH }, + { NC_("SV_FUNIT_STRINGS", "'"), FieldUnit::FOOT }, + { NC_("SV_FUNIT_STRINGS", "ft"), FieldUnit::FOOT }, + { NC_("SV_FUNIT_STRINGS", "foot"), FieldUnit::FOOT }, + { NC_("SV_FUNIT_STRINGS", "feet"), FieldUnit::FOOT }, + { NC_("SV_FUNIT_STRINGS", "miles"), FieldUnit::MILE }, + { NC_("SV_FUNIT_STRINGS", "mile"), FieldUnit::MILE }, + { NC_("SV_FUNIT_STRINGS", "ch"), FieldUnit::CHAR }, + { NC_("SV_FUNIT_STRINGS", "line"), FieldUnit::LINE }, + { NC_("SV_FUNIT_STRINGS", "pixels"), FieldUnit::PIXEL }, + { NC_("SV_FUNIT_STRINGS", "pixel"), FieldUnit::PIXEL }, /* To translators: degree */ - { NC_("SV_FUNIT_STRINGS", "°"), FUNIT_DEGREE }, - { NC_("SV_FUNIT_STRINGS", "sec"), FUNIT_SECOND }, + { NC_("SV_FUNIT_STRINGS", "°"), FieldUnit::DEGREE }, + { NC_("SV_FUNIT_STRINGS", "sec"), FieldUnit::SECOND }, // To translators: This is the last entry of the sequence of measurement unit names - { NC_("SV_FUNIT_STRINGS", "ms"), FUNIT_MILLISECOND } + { NC_("SV_FUNIT_STRINGS", "ms"), FieldUnit::MILLISECOND } }; #endif // INCLUDED_VCL_INC_UNITS_HRC diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 777a2f07d535..23c6905548b6 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -1027,7 +1027,7 @@ FieldUnit MetricFormatter::StringToMetric(const OUString &rMetricString) } } - return FUNIT_NONE; + return FieldUnit::NONE; } static FieldUnit ImplMetricGetUnit(const OUString& rStr) @@ -1043,7 +1043,8 @@ static FieldUnit ImplMetricGetUnit(const OUString& rStr) // twip in km = 254 / 14 400 000 000 // expressions too big for default size 32 bit need LL to avoid overflow -static const sal_Int64 aImplFactor[FUNIT_LINE+1][FUNIT_LINE+1] = +static const sal_Int64 aImplFactor[sal_uInt16(FieldUnit::LINE) + 1] + [sal_uInt16(FieldUnit::LINE) + 1] = { /* mm/100 mm cm m km twip point pica inch foot mile char line */ { 1, 100, 1 K, 100 K, 100 M, 2540, 2540, 2540, 2540,2540*12,2540*12 X , 53340, 396240}, @@ -1064,7 +1065,7 @@ mm/100 mm cm m km twip point pica inch foot mile #undef M #undef K -static FieldUnit eDefaultUnit = FUNIT_NONE; +static FieldUnit eDefaultUnit = FieldUnit::NONE; FieldUnit MetricField::GetDefaultUnit() { return eDefaultUnit; } void MetricField::SetDefaultUnit( FieldUnit meUnit ) { eDefaultUnit = meUnit; } @@ -1075,34 +1076,34 @@ static FieldUnit ImplMap2FieldUnit( MapUnit meUnit, long& nDecDigits ) { case MapUnit::Map100thMM : nDecDigits -= 2; - return FUNIT_MM; + return FieldUnit::MM; case MapUnit::Map10thMM : nDecDigits -= 1; - return FUNIT_MM; + return FieldUnit::MM; case MapUnit::MapMM : - return FUNIT_MM; + return FieldUnit::MM; case MapUnit::MapCM : - return FUNIT_CM; + return FieldUnit::CM; case MapUnit::Map1000thInch : nDecDigits -= 3; - return FUNIT_INCH; + return FieldUnit::INCH; case MapUnit::Map100thInch : nDecDigits -= 2; - return FUNIT_INCH; + return FieldUnit::INCH; case MapUnit::Map10thInch : nDecDigits -= 1; - return FUNIT_INCH; + return FieldUnit::INCH; case MapUnit::MapInch : - return FUNIT_INCH; + return FieldUnit::INCH; case MapUnit::MapPoint : - return FUNIT_POINT; + return FieldUnit::POINT; case MapUnit::MapTwip : - return FUNIT_TWIP; + return FieldUnit::TWIP; default: OSL_FAIL( "default eInUnit" ); break; } - return FUNIT_NONE; + return FieldUnit::NONE; } static double nonValueDoubleToValueDouble( double nValue ) @@ -1143,7 +1144,7 @@ double MetricField::ConvertDoubleValue( double nValue, sal_Int64 mnBaseValue, sa { sal_Int64 nMult = 1, nDiv = 1; - if ( eInUnit == FUNIT_PERCENT ) + if (eInUnit == FieldUnit::PERCENT) { if ( (mnBaseValue <= 0) || (nValue <= 0) ) return nValue; @@ -1151,28 +1152,28 @@ double MetricField::ConvertDoubleValue( double nValue, sal_Int64 mnBaseValue, sa nMult = mnBaseValue; } - else if ( eOutUnit == FUNIT_PERCENT || - eOutUnit == FUNIT_CUSTOM || - eOutUnit == FUNIT_NONE || - eOutUnit == FUNIT_DEGREE || - eOutUnit == FUNIT_SECOND || - eOutUnit == FUNIT_MILLISECOND || - eOutUnit == FUNIT_PIXEL || - eInUnit == FUNIT_CUSTOM || - eInUnit == FUNIT_NONE || - eInUnit == FUNIT_DEGREE || - eInUnit == FUNIT_MILLISECOND || - eInUnit == FUNIT_PIXEL ) + else if ( eOutUnit == FieldUnit::PERCENT || + eOutUnit == FieldUnit::CUSTOM || + eOutUnit == FieldUnit::NONE || + eOutUnit == FieldUnit::DEGREE || + eOutUnit == FieldUnit::SECOND || + eOutUnit == FieldUnit::MILLISECOND || + eOutUnit == FieldUnit::PIXEL || + eInUnit == FieldUnit::CUSTOM || + eInUnit == FieldUnit::NONE || + eInUnit == FieldUnit::DEGREE || + eInUnit == FieldUnit::MILLISECOND || + eInUnit == FieldUnit::PIXEL ) return nValue; else { - if ( eOutUnit == FUNIT_100TH_MM ) - eOutUnit = FUNIT_NONE; - if ( eInUnit == FUNIT_100TH_MM ) - eInUnit = FUNIT_NONE; + if (eOutUnit == FieldUnit::MM_100TH) + eOutUnit = FieldUnit::NONE; + if (eInUnit == FieldUnit::MM_100TH) + eInUnit = FieldUnit::NONE; - nDiv = aImplFactor[eInUnit][eOutUnit]; - nMult = aImplFactor[eOutUnit][eInUnit]; + nDiv = aImplFactor[sal_uInt16(eInUnit)][sal_uInt16(eOutUnit)]; + nMult = aImplFactor[sal_uInt16(eOutUnit)][sal_uInt16(eInUnit)]; SAL_WARN_IF( nMult <= 0, "vcl", "illegal *" ); SAL_WARN_IF( nDiv <= 0, "vcl", "illegal /" ); @@ -1193,9 +1194,9 @@ double MetricField::ConvertDoubleValue( double nValue, sal_Int64 mnBaseValue, sa double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits, MapUnit eInUnit, FieldUnit eOutUnit ) { - if ( eOutUnit == FUNIT_PERCENT || - eOutUnit == FUNIT_CUSTOM || - eOutUnit == FUNIT_NONE || + if ( eOutUnit == FieldUnit::PERCENT || + eOutUnit == FieldUnit::CUSTOM || + eOutUnit == FieldUnit::NONE || eInUnit == MapUnit::MapPixel || eInUnit == MapUnit::MapSysFont || eInUnit == MapUnit::MapAppFont || @@ -1224,8 +1225,8 @@ double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits, if ( eFieldUnit != eOutUnit ) { - sal_Int64 nDiv = aImplFactor[eFieldUnit][eOutUnit]; - sal_Int64 nMult = aImplFactor[eOutUnit][eFieldUnit]; + sal_Int64 nDiv = aImplFactor[sal_uInt16(eFieldUnit)][sal_uInt16(eOutUnit)]; + sal_Int64 nMult = aImplFactor[sal_uInt16(eOutUnit)][sal_uInt16(eFieldUnit)]; SAL_WARN_IF( nMult <= 0, "vcl", "illegal *" ); SAL_WARN_IF( nDiv <= 0, "vcl", "illegal /" ); @@ -1244,13 +1245,13 @@ double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits, double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits, FieldUnit eInUnit, MapUnit eOutUnit ) { - if ( eInUnit == FUNIT_PERCENT || - eInUnit == FUNIT_CUSTOM || - eInUnit == FUNIT_NONE || - eInUnit == FUNIT_DEGREE || - eInUnit == FUNIT_SECOND || - eInUnit == FUNIT_MILLISECOND || - eInUnit == FUNIT_PIXEL || + if ( eInUnit == FieldUnit::PERCENT || + eInUnit == FieldUnit::CUSTOM || + eInUnit == FieldUnit::NONE || + eInUnit == FieldUnit::DEGREE || + eInUnit == FieldUnit::SECOND || + eInUnit == FieldUnit::MILLISECOND || + eInUnit == FieldUnit::PIXEL || eOutUnit == MapUnit::MapPixel || eOutUnit == MapUnit::MapSysFont || eOutUnit == MapUnit::MapAppFont || @@ -1274,8 +1275,8 @@ double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits, if ( eFieldUnit != eInUnit ) { - sal_Int64 nDiv = aImplFactor[eInUnit][eFieldUnit]; - sal_Int64 nMult = aImplFactor[eFieldUnit][eInUnit]; + sal_Int64 nDiv = aImplFactor[sal_uInt16(eInUnit)][sal_uInt16(eFieldUnit)]; + sal_Int64 nMult = aImplFactor[sal_uInt16(eFieldUnit)][sal_uInt16(eInUnit)]; SAL_WARN_IF( nMult <= 0, "vcl", "illegal *" ); SAL_WARN_IF( nDiv <= 0, "vcl", "illegal /" ); @@ -1341,10 +1342,10 @@ MetricFormatter::~MetricFormatter() void MetricFormatter::SetUnit( FieldUnit eNewUnit ) { - if ( eNewUnit == FUNIT_100TH_MM ) + if (eNewUnit == FieldUnit::MM_100TH) { SetDecimalDigits( GetDecimalDigits() + 2 ); - meUnit = FUNIT_MM; + meUnit = FieldUnit::MM; } else meUnit = eNewUnit; @@ -1367,7 +1368,7 @@ OUString MetricFormatter::CreateFieldText( sal_Int64 nValue ) const { //whether percent is separated from its number is locale //specific, pawn it off to icu to decide - if (meUnit == FUNIT_PERCENT) + if (meUnit == FieldUnit::PERCENT) { double dValue = nValue; dValue /= ImplPower10(GetDecimalDigits()); @@ -1376,13 +1377,13 @@ OUString MetricFormatter::CreateFieldText( sal_Int64 nValue ) const OUString aStr = NumericFormatter::CreateFieldText( nValue ); - if( meUnit == FUNIT_CUSTOM ) + if( meUnit == FieldUnit::CUSTOM ) aStr += maCustomUnitText; else { - if (meUnit != FUNIT_NONE && meUnit != FUNIT_DEGREE) + if (meUnit != FieldUnit::NONE && meUnit != FieldUnit::DEGREE) aStr += " "; - assert(meUnit != FUNIT_PERCENT); + assert(meUnit != FieldUnit::PERCENT); aStr += ImplMetricToString( meUnit ); } return aStr; @@ -1414,7 +1415,7 @@ sal_Int64 MetricFormatter::GetValueFromStringUnit(const OUString& rStr, FieldUni sal_Int64 MetricFormatter::GetValueFromString(const OUString& rStr) const { - return GetValueFromStringUnit(rStr, FUNIT_NONE); + return GetValueFromStringUnit(rStr, FieldUnit::NONE); } sal_Int64 MetricFormatter::GetValue( FieldUnit eOutUnit ) const @@ -1425,7 +1426,7 @@ sal_Int64 MetricFormatter::GetValue( FieldUnit eOutUnit ) const void MetricFormatter::SetValue( sal_Int64 nValue ) { // Implementation not inline, because it is a virtual Function - SetValue( nValue, FUNIT_NONE ); + SetValue( nValue, FieldUnit::NONE ); } void MetricFormatter::SetMin( sal_Int64 nNewMin, FieldUnit eInUnit ) @@ -1466,7 +1467,7 @@ sal_Int64 MetricFormatter::GetBaseValue() const { // convert to requested units return MetricField::ConvertValue( mnBaseValue, mnBaseValue, GetDecimalDigits(), - meUnit, FUNIT_NONE ); + meUnit, FieldUnit::NONE ); } void MetricFormatter::Reformat() @@ -1475,7 +1476,7 @@ void MetricFormatter::Reformat() return; OUString aText = GetField()->GetText(); - if ( meUnit == FUNIT_CUSTOM ) + if ( meUnit == FieldUnit::CUSTOM ) maCurUnitText = ImplMetricGetUnitText( aText ); OUString aStr; @@ -1487,7 +1488,7 @@ void MetricFormatter::Reformat() if ( !aStr.isEmpty() ) { ImplSetText( aStr ); - if ( meUnit == FUNIT_CUSTOM ) + if ( meUnit == FieldUnit::CUSTOM ) CustomConvert(); } else diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index ece1380052f5..71bfae795c0f 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -226,7 +226,7 @@ namespace weld unsigned int nDecimalDigits = m_xSpinButton->get_digits(); //pawn percent off to icu to decide whether percent is separated from its number for this locale - if (m_eSrcUnit == FUNIT_PERCENT) + if (m_eSrcUnit == FieldUnit::PERCENT) { double fValue = nValue; fValue /= SpinButton::Power10(nDecimalDigits); @@ -235,9 +235,9 @@ namespace weld else { aStr = rLocaleData.getNum(nValue, nDecimalDigits, true, true); - if (m_eSrcUnit != FUNIT_NONE && m_eSrcUnit != FUNIT_DEGREE) + if (m_eSrcUnit != FieldUnit::NONE && m_eSrcUnit != FieldUnit::DEGREE) aStr += " "; - assert(m_eSrcUnit != FUNIT_PERCENT); + assert(m_eSrcUnit != FieldUnit::PERCENT); aStr += MetricToString(m_eSrcUnit); } @@ -1202,44 +1202,44 @@ namespace FieldUnit detectMetricUnit(const OUString& sUnit) { - FieldUnit eUnit = FUNIT_NONE; + FieldUnit eUnit = FieldUnit::NONE; if (sUnit == "mm") - eUnit = FUNIT_MM; + eUnit = FieldUnit::MM; else if (sUnit == "cm") - eUnit = FUNIT_CM; + eUnit = FieldUnit::CM; else if (sUnit == "m") - eUnit = FUNIT_M; + eUnit = FieldUnit::M; else if (sUnit == "km") - eUnit = FUNIT_KM; + eUnit = FieldUnit::KM; else if ((sUnit == "twips") || (sUnit == "twip")) - eUnit = FUNIT_TWIP; + eUnit = FieldUnit::TWIP; else if (sUnit == "pt") - eUnit = FUNIT_POINT; + eUnit = FieldUnit::POINT; else if (sUnit == "pc") - eUnit = FUNIT_PICA; + eUnit = FieldUnit::PICA; else if (sUnit == "\"" || (sUnit == "in") || (sUnit == "inch")) - eUnit = FUNIT_INCH; + eUnit = FieldUnit::INCH; else if ((sUnit == "'") || (sUnit == "ft") || (sUnit == "foot") || (sUnit == "feet")) - eUnit = FUNIT_FOOT; + eUnit = FieldUnit::FOOT; else if (sUnit == "mile" || (sUnit == "miles")) - eUnit = FUNIT_MILE; + eUnit = FieldUnit::MILE; else if (sUnit == "ch") - eUnit = FUNIT_CHAR; + eUnit = FieldUnit::CHAR; else if (sUnit == "line") - eUnit = FUNIT_LINE; + eUnit = FieldUnit::LINE; else if (sUnit == "%") - eUnit = FUNIT_PERCENT; + eUnit = FieldUnit::PERCENT; else if ((sUnit == "pixels") || (sUnit == "pixel") || (sUnit == "px")) - eUnit = FUNIT_PIXEL; + eUnit = FieldUnit::PIXEL; else if ((sUnit == "degrees") || (sUnit == "degree")) - eUnit = FUNIT_DEGREE; + eUnit = FieldUnit::DEGREE; else if ((sUnit == "sec") || (sUnit == "seconds") || (sUnit == "second")) - eUnit = FUNIT_SECOND; + eUnit = FieldUnit::SECOND; else if ((sUnit == "ms") || (sUnit == "milliseconds") || (sUnit == "millisecond")) - eUnit = FUNIT_MILLISECOND; + eUnit = FieldUnit::MILLISECOND; else if (sUnit != "0") - eUnit = FUNIT_CUSTOM; + eUnit = FieldUnit::CUSTOM; return eUnit; } @@ -1723,7 +1723,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & SAL_INFO("vcl.layout", "making metric field for " << name << " " << sUnit); VclPtrInstance<MetricField> xField(pParent, nBits); xField->SetUnit(eUnit); - if (eUnit == FUNIT_CUSTOM) + if (eUnit == FieldUnit::CUSTOM) xField->SetCustomUnitText(sUnit); xWindow = xField; } @@ -1757,7 +1757,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & xBox->EnableAutoSize(true); xBox->SetUnit(eUnit); xBox->SetDecimalDigits(extractDecimalDigits(sPattern)); - if (eUnit == FUNIT_CUSTOM) + if (eUnit == FieldUnit::CUSTOM) xBox->SetCustomUnitText(sUnit); xWindow = xBox; } @@ -1797,7 +1797,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & xBox->EnableAutoSize(true); xBox->SetUnit(eUnit); xBox->SetDecimalDigits(extractDecimalDigits(sPattern)); - if (eUnit == FUNIT_CUSTOM) + if (eUnit == FieldUnit::CUSTOM) xBox->SetCustomUnitText(sUnit); xWindow = xBox; } diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index e184fbcdf3a2..d3140e084a55 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -523,11 +523,11 @@ void PrintDialog::NUpTabPage::initFromMultiPageSetup( const vcl::PrinterControll // setup field units for metric fields const LocaleDataWrapper& rLocWrap( mpPageMarginEdt->GetLocaleDataWrapper() ); - FieldUnit eUnit = FUNIT_MM; + FieldUnit eUnit = FieldUnit::MM; sal_uInt16 nDigits = 0; if( rLocWrap.getMeasurementSystemEnum() == MeasurementSystem::US ) { - eUnit = FUNIT_INCH; + eUnit = FieldUnit::INCH; nDigits = 2; } // set units @@ -538,8 +538,10 @@ void PrintDialog::NUpTabPage::initFromMultiPageSetup( const vcl::PrinterControll mpPageMarginEdt->SetDecimalDigits( nDigits ); mpSheetMarginEdt->SetDecimalDigits( nDigits ); - mpSheetMarginEdt->SetValue( mpSheetMarginEdt->Normalize( i_rMPS.nLeftMargin ), FUNIT_100TH_MM ); - mpPageMarginEdt->SetValue( mpPageMarginEdt->Normalize( i_rMPS.nHorizontalSpacing ), FUNIT_100TH_MM ); + mpSheetMarginEdt->SetValue(mpSheetMarginEdt->Normalize(i_rMPS.nLeftMargin), + FieldUnit::MM_100TH); + mpPageMarginEdt->SetValue(mpPageMarginEdt->Normalize(i_rMPS.nHorizontalSpacing), + FieldUnit::MM_100TH); mpBorderCB->Check( i_rMPS.bDrawBorder ); mpNupRowsEdt->SetValue( i_rMPS.nRows ); mpNupColEdt->SetValue( i_rMPS.nColumns ); @@ -1431,8 +1433,10 @@ void PrintDialog::updateNupFromPages() sal_IntPtr nPages = sal_IntPtr(maNUpPage.mpNupPagesBox->GetSelectedEntryData()); int nRows = int(maNUpPage.mpNupRowsEdt->GetValue()); int nCols = int(maNUpPage.mpNupColEdt->GetValue()); - long nPageMargin = maNUpPage.mpPageMarginEdt->Denormalize(maNUpPage.mpPageMarginEdt->GetValue( FUNIT_100TH_MM )); - long nSheetMargin = maNUpPage.mpSheetMarginEdt->Denormalize(maNUpPage.mpSheetMarginEdt->GetValue( FUNIT_100TH_MM )); + long nPageMargin = maNUpPage.mpPageMarginEdt->Denormalize( + maNUpPage.mpPageMarginEdt->GetValue(FieldUnit::MM_100TH)); + long nSheetMargin = maNUpPage.mpSheetMarginEdt->Denormalize( + maNUpPage.mpSheetMarginEdt->GetValue(FieldUnit::MM_100TH)); bool bCustom = false; if( nPages == 1 ) @@ -1497,8 +1501,8 @@ void PrintDialog::updateNupFromPages() nSheetMargin = nVertMax; maNUpPage.mpSheetMarginEdt->SetMax( - maNUpPage.mpSheetMarginEdt->Normalize( - std::min(nHorzMax, nVertMax) ), FUNIT_100TH_MM ); + maNUpPage.mpSheetMarginEdt->Normalize(std::min(nHorzMax, nVertMax)), + FieldUnit::MM_100TH); // maximum page distance nHorzMax = (aSize.Width() - 2*nSheetMargin); @@ -1514,14 +1518,16 @@ void PrintDialog::updateNupFromPages() nPageMargin = nVertMax; maNUpPage.mpPageMarginEdt->SetMax( - maNUpPage.mpSheetMarginEdt->Normalize( - std::min(nHorzMax, nVertMax ) ), FUNIT_100TH_MM ); + maNUpPage.mpSheetMarginEdt->Normalize(std::min(nHorzMax, nVertMax)), + FieldUnit::MM_100TH); } maNUpPage.mpNupRowsEdt->SetValue( nRows ); maNUpPage.mpNupColEdt->SetValue( nCols ); - maNUpPage.mpPageMarginEdt->SetValue( maNUpPage.mpPageMarginEdt->Normalize( nPageMargin ), FUNIT_100TH_MM ); - maNUpPage.mpSheetMarginEdt->SetValue( maNUpPage.mpSheetMarginEdt->Normalize( nSheetMargin ), FUNIT_100TH_MM ); + maNUpPage.mpPageMarginEdt->SetValue(maNUpPage.mpPageMarginEdt->Normalize(nPageMargin), + FieldUnit::MM_100TH); + maNUpPage.mpSheetMarginEdt->SetValue(maNUpPage.mpSheetMarginEdt->Normalize(nSheetMargin), + FieldUnit::MM_100TH); maNUpPage.showAdvancedControls( bCustom ); @@ -1535,8 +1541,10 @@ void PrintDialog::updateNup() { int nRows = int(maNUpPage.mpNupRowsEdt->GetValue()); int nCols = int(maNUpPage.mpNupColEdt->GetValue()); - long nPageMargin = maNUpPage.mpPageMarginEdt->Denormalize(maNUpPage.mpPageMarginEdt->GetValue( FUNIT_100TH_MM )); - long nSheetMargin = maNUpPage.mpSheetMarginEdt->Denormalize(maNUpPage.mpSheetMarginEdt->GetValue( FUNIT_100TH_MM )); + long nPageMargin = maNUpPage.mpPageMarginEdt->Denormalize( + maNUpPage.mpPageMarginEdt->GetValue(FieldUnit::MM_100TH)); + long nSheetMargin = maNUpPage.mpSheetMarginEdt->Denormalize( + maNUpPage.mpSheetMarginEdt->GetValue(FieldUnit::MM_100TH)); PrinterController::MultiPageSetup aMPS; aMPS.nRows = nRows; |