summaryrefslogtreecommitdiff
path: root/editeng/source/items
diff options
context:
space:
mode:
Diffstat (limited to 'editeng/source/items')
-rw-r--r--editeng/source/items/itemtype.cxx62
-rw-r--r--editeng/source/items/numitem.cxx4
-rw-r--r--editeng/source/items/paperinf.cxx12
-rw-r--r--editeng/source/items/textitem.cxx73
4 files changed, 78 insertions, 73 deletions
diff --git a/editeng/source/items/itemtype.cxx b/editeng/source/items/itemtype.cxx
index ee1749186b8b..c8ff68c37e26 100644
--- a/editeng/source/items/itemtype.cxx
+++ b/editeng/source/items/itemtype.cxx
@@ -39,45 +39,45 @@ OUString GetMetricText( long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const In
switch ( eDestUnit )
{
- case MAP_100TH_MM:
- case MAP_10TH_MM:
- case MAP_MM:
- case MAP_CM:
+ case MapUnit::Map100thMM:
+ case MapUnit::Map10thMM:
+ case MapUnit::MapMM:
+ case MapUnit::MapCM:
{
nRet = (long)OutputDevice::LogicToLogic(
- nVal, (MapUnit)eSrcUnit, (MapUnit)MAP_100TH_MM );
+ nVal, (MapUnit)eSrcUnit, (MapUnit)MapUnit::Map100thMM );
switch ( eDestUnit )
{
- case MAP_100TH_MM: nRet *= 1000; break;
- case MAP_10TH_MM: nRet *= 100; break;
- case MAP_MM: nRet *= 10; break;
+ case MapUnit::Map100thMM: nRet *= 1000; break;
+ case MapUnit::Map10thMM: nRet *= 100; break;
+ case MapUnit::MapMM: nRet *= 10; break;
default: ;//prevent warning
}
break;
}
- case MAP_1000TH_INCH:
- case MAP_100TH_INCH:
- case MAP_10TH_INCH:
- case MAP_INCH:
+ case MapUnit::Map1000thInch:
+ case MapUnit::Map100thInch:
+ case MapUnit::Map10thInch:
+ case MapUnit::MapInch:
{
nRet = OutputDevice::LogicToLogic(
- nVal, (MapUnit)eSrcUnit, (MapUnit)MAP_1000TH_INCH );
+ nVal, (MapUnit)eSrcUnit, (MapUnit)MapUnit::Map1000thInch );
switch ( eDestUnit )
{
- case MAP_1000TH_INCH: nRet *= 1000; break;
- case MAP_100TH_INCH: nRet *= 100; break;
- case MAP_10TH_INCH: nRet *= 10; break;
+ case MapUnit::Map1000thInch: nRet *= 1000; break;
+ case MapUnit::Map100thInch: nRet *= 100; break;
+ case MapUnit::Map10thInch: nRet *= 10; break;
default: ;//prevent warning
}
break;
}
- case MAP_POINT:
- case MAP_TWIP:
- case MAP_PIXEL:
+ case MapUnit::MapPoint:
+ case MapUnit::MapTwip:
+ case MapUnit::MapPixel:
return OUString::number( (long)OutputDevice::LogicToLogic(
nVal, (MapUnit)eSrcUnit, (MapUnit)eDestUnit ));
@@ -86,7 +86,7 @@ OUString GetMetricText( long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const In
return OUString();
}
- if ( MAP_CM == eDestUnit || MAP_INCH == eDestUnit )
+ if ( MapUnit::MapCM == eDestUnit || MapUnit::MapInch == eDestUnit )
{
sal_Int32 nMod = nRet % 10;
@@ -174,32 +174,32 @@ sal_uInt16 GetMetricId( MapUnit eUnit )
switch ( eUnit )
{
- case MAP_100TH_MM:
- case MAP_10TH_MM:
- case MAP_MM:
+ case MapUnit::Map100thMM:
+ case MapUnit::Map10thMM:
+ case MapUnit::MapMM:
nId = RID_SVXITEMS_METRIC_MM;
break;
- case MAP_CM:
+ case MapUnit::MapCM:
nId = RID_SVXITEMS_METRIC_CM;
break;
- case MAP_1000TH_INCH:
- case MAP_100TH_INCH:
- case MAP_10TH_INCH:
- case MAP_INCH:
+ case MapUnit::Map1000thInch:
+ case MapUnit::Map100thInch:
+ case MapUnit::Map10thInch:
+ case MapUnit::MapInch:
nId = RID_SVXITEMS_METRIC_INCH;
break;
- case MAP_POINT:
+ case MapUnit::MapPoint:
nId = RID_SVXITEMS_METRIC_POINT;
break;
- case MAP_TWIP:
+ case MapUnit::MapTwip:
nId = RID_SVXITEMS_METRIC_TWIP;
break;
- case MAP_PIXEL:
+ case MapUnit::MapPixel:
nId = RID_SVXITEMS_METRIC_PIXEL;
break;
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index cde00e370a0d..3b6eba562c33 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -484,10 +484,10 @@ void SvxNumberFormat::SetIndentAt( const long nIndentAt )
Size SvxNumberFormat::GetGraphicSizeMM100(const Graphic* pGraphic)
{
- const MapMode aMapMM100( MAP_100TH_MM );
+ const MapMode aMapMM100( MapUnit::Map100thMM );
const Size& rSize = pGraphic->GetPrefSize();
Size aRetSize;
- if ( pGraphic->GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
+ if ( pGraphic->GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel )
{
OutputDevice* pOutDev = Application::GetDefaultDevice();
MapMode aOldMap( pOutDev->GetMapMode() );
diff --git a/editeng/source/items/paperinf.cxx b/editeng/source/items/paperinf.cxx
index 42d49e768369..bde8319d93e7 100644
--- a/editeng/source/items/paperinf.cxx
+++ b/editeng/source/items/paperinf.cxx
@@ -37,7 +37,7 @@ Size SvxPaperInfo::GetPaperSize( Paper ePaper, MapUnit eUnit )
{
PaperInfo aInfo(ePaper);
Size aRet(aInfo.getWidth(), aInfo.getHeight()); // in 100thMM
- return eUnit == MAP_100TH_MM ? aRet : OutputDevice::LogicToLogic(aRet, MAP_100TH_MM, eUnit);
+ return eUnit == MapUnit::Map100thMM ? aRet : OutputDevice::LogicToLogic(aRet, MapUnit::Map100thMM, eUnit);
}
/*------------------------------------------------------------------------
@@ -70,7 +70,7 @@ Size SvxPaperInfo::GetPaperSize( const Printer* pPrinter )
if ( aMap1 == aMap2 )
aPaperSize =
- pPrinter->PixelToLogic( aPaperSize, MapMode( MAP_TWIP ) );
+ pPrinter->PixelToLogic( aPaperSize, MapMode( MapUnit::MapTwip ) );
return aPaperSize;
}
@@ -85,7 +85,7 @@ Size SvxPaperInfo::GetPaperSize( const Printer* pPrinter )
Paper SvxPaperInfo::GetSvxPaper( const Size &rSize, MapUnit eUnit, bool bSloppy )
{
- Size aSize(eUnit == MAP_100TH_MM ? rSize : OutputDevice::LogicToLogic(rSize, eUnit, MAP_100TH_MM));
+ Size aSize(eUnit == MapUnit::Map100thMM ? rSize : OutputDevice::LogicToLogic(rSize, eUnit, MapUnit::Map100thMM));
PaperInfo aInfo(aSize.Width(), aSize.Height());
if (bSloppy)
aInfo.doSloppyFit();
@@ -95,9 +95,9 @@ Paper SvxPaperInfo::GetSvxPaper( const Size &rSize, MapUnit eUnit, bool bSloppy
long SvxPaperInfo::GetSloppyPaperDimension( long nSize )
{
- nSize = OutputDevice::LogicToLogic(nSize, MAP_TWIP, MAP_100TH_MM);
+ nSize = OutputDevice::LogicToLogic(nSize, MapUnit::MapTwip, MapUnit::Map100thMM);
nSize = PaperInfo::sloppyFitPageDimension(nSize);
- return OutputDevice::LogicToLogic(nSize, MAP_100TH_MM, MAP_TWIP);
+ return OutputDevice::LogicToLogic(nSize, MapUnit::Map100thMM, MapUnit::MapTwip);
}
@@ -105,7 +105,7 @@ Size SvxPaperInfo::GetDefaultPaperSize( MapUnit eUnit )
{
PaperInfo aInfo(PaperInfo::getSystemDefaultPaper());
Size aRet(aInfo.getWidth(), aInfo.getHeight());
- return eUnit == MAP_100TH_MM ? aRet : OutputDevice::LogicToLogic(aRet, MAP_100TH_MM, eUnit);
+ return eUnit == MapUnit::Map100thMM ? aRet : OutputDevice::LogicToLogic(aRet, MapUnit::Map100thMM, eUnit);
}
/*------------------------------------------------------------------------
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 410b83a872c4..b7e4446b450b 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -727,13 +727,13 @@ SvStream& SvxFontHeightItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion )
rStrm.WriteUInt16( GetHeight() );
if( FONTHEIGHT_UNIT_VERSION <= nItemVersion )
- rStrm.WriteUInt16( GetProp() ).WriteUInt16( GetPropUnit() );
+ rStrm.WriteUInt16( GetProp() ).WriteUInt16( (sal_uInt16)GetPropUnit() );
else
{
// When exporting to the old versions the relative information is lost
// when there is no percentage
sal_uInt16 _nProp = GetProp();
- if( MAP_RELATIVE != GetPropUnit() )
+ if( MapUnit::MapRelative != GetPropUnit() )
_nProp = 100;
rStrm.WriteUInt16( _nProp );
}
@@ -744,7 +744,8 @@ SvStream& SvxFontHeightItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion )
SfxPoolItem* SvxFontHeightItem::Create( SvStream& rStrm,
sal_uInt16 nVersion ) const
{
- sal_uInt16 nsize, nprop = 0, nPropUnit = MAP_RELATIVE;
+ sal_uInt16 nsize, nprop = 0;
+ MapUnit nPropUnit = MapUnit::MapRelative;
rStrm.ReadUInt16( nsize );
@@ -758,7 +759,11 @@ SfxPoolItem* SvxFontHeightItem::Create( SvStream& rStrm,
}
if( FONTHEIGHT_UNIT_VERSION <= nVersion )
- rStrm.ReadUInt16( nPropUnit );
+ {
+ sal_uInt16 nTmp;
+ rStrm.ReadUInt16( nTmp );
+ nPropUnit = (MapUnit)nTmp;
+ }
SvxFontHeightItem* pItem = new SvxFontHeightItem( nsize, 100, Which() );
pItem->SetProp( nprop, (MapUnit)nPropUnit );
@@ -801,22 +806,22 @@ bool SvxFontHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
aFontHeight.Height = fRoundPoints;
}
- aFontHeight.Prop = (sal_Int16)(MAP_RELATIVE == ePropUnit ? nProp : 100);
+ aFontHeight.Prop = (sal_Int16)(MapUnit::MapRelative == ePropUnit ? nProp : 100);
float fRet = (float)(short)nProp;
switch( ePropUnit )
{
- case MAP_RELATIVE:
+ case MapUnit::MapRelative:
fRet = 0.;
break;
- case MAP_100TH_MM:
+ case MapUnit::Map100thMM:
fRet = convertMm100ToTwip(fRet);
fRet /= 20.;
break;
- case MAP_POINT:
+ case MapUnit::MapPoint:
break;
- case MAP_TWIP:
+ case MapUnit::MapTwip:
fRet /= 20.;
break;
default: ;//prevent warning
@@ -843,24 +848,24 @@ bool SvxFontHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
}
break;
case MID_FONTHEIGHT_PROP:
- rVal <<= (sal_Int16)(MAP_RELATIVE == ePropUnit ? nProp : 100);
+ rVal <<= (sal_Int16)(MapUnit::MapRelative == ePropUnit ? nProp : 100);
break;
case MID_FONTHEIGHT_DIFF:
{
float fRet = (float)(short)nProp;
switch( ePropUnit )
{
- case MAP_RELATIVE:
+ case MapUnit::MapRelative:
fRet = 0.;
break;
- case MAP_100TH_MM:
+ case MapUnit::Map100thMM:
fRet = convertMm100ToTwip(fRet);
fRet /= 20.;
break;
- case MAP_POINT:
+ case MapUnit::MapPoint:
break;
- case MAP_TWIP:
+ case MapUnit::MapTwip:
fRet /= 20.;
break;
default: ;//prevent warning
@@ -885,11 +890,11 @@ static sal_uInt32 lcl_GetRealHeight_Impl(sal_uInt32 nHeight, sal_uInt16 nProp, M
short nDiff = 0;
switch( eProp )
{
- case MAP_RELATIVE:
+ case MapUnit::MapRelative:
nRet *= 100;
nRet /= nProp;
break;
- case MAP_POINT:
+ case MapUnit::MapPoint:
{
short nTemp = (short)nProp;
nDiff = nTemp * 20;
@@ -897,11 +902,11 @@ static sal_uInt32 lcl_GetRealHeight_Impl(sal_uInt32 nHeight, sal_uInt16 nProp, M
nDiff = (short)convertTwipToMm100((long)(nDiff));
}
break;
- case MAP_100TH_MM:
+ case MapUnit::Map100thMM:
//then the core is surely also in 1/100 mm
nDiff = (short)nProp;
break;
- case MAP_TWIP:
+ case MapUnit::MapTwip:
// Here surely TWIP
nDiff = ((short)nProp);
break;
@@ -926,7 +931,7 @@ bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
if ( rVal >>= aFontHeight )
{
// Height
- ePropUnit = MAP_RELATIVE;
+ ePropUnit = MapUnit::MapRelative;
nProp = 100;
double fPoint = aFontHeight.Height;
if( fPoint < 0. || fPoint > 10000. )
@@ -944,7 +949,7 @@ bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
break;
case MID_FONTHEIGHT:
{
- ePropUnit = MAP_RELATIVE;
+ ePropUnit = MapUnit::MapRelative;
nProp = 100;
double fPoint = 0;
if(!(rVal >>= fPoint))
@@ -973,7 +978,7 @@ bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
nHeight *= nNew;
nHeight /= 100;
nProp = nNew;
- ePropUnit = MAP_RELATIVE;
+ ePropUnit = MapUnit::MapRelative;
}
break;
case MID_FONTHEIGHT_DIFF:
@@ -990,7 +995,7 @@ bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
sal_Int16 nCoreDiffValue = (sal_Int16)(fValue * 20.);
nHeight += bConvert ? nCoreDiffValue : convertTwipToMm100(nCoreDiffValue);
nProp = (sal_uInt16)((sal_Int16)fValue);
- ePropUnit = MAP_POINT;
+ ePropUnit = MapUnit::MapPoint;
}
break;
}
@@ -1006,7 +1011,7 @@ bool SvxFontHeightItem::GetPresentation
OUString& rText, const IntlWrapper *pIntl
) const
{
- if( MAP_RELATIVE != ePropUnit )
+ if( MapUnit::MapRelative != ePropUnit )
{
rText = OUString::number( (short)nProp ) +
" " + EE_RESSTR( GetMetricId( ePropUnit ) );
@@ -1016,8 +1021,8 @@ bool SvxFontHeightItem::GetPresentation
else if( 100 == nProp )
{
rText = GetMetricText( (long)nHeight,
- eCoreUnit, MAP_POINT, pIntl ) +
- " " + EE_RESSTR(GetMetricId(MAP_POINT));
+ eCoreUnit, MapUnit::MapPoint, pIntl ) +
+ " " + EE_RESSTR(GetMetricId(MapUnit::MapPoint));
}
else
rText = OUString::number( nProp ) + "%";
@@ -1049,7 +1054,7 @@ void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewP
{
DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
- if( MAP_RELATIVE != eUnit )
+ if( MapUnit::MapRelative != eUnit )
nHeight = nNewHeight + ::ItemToControl( (short)nNewProp, eUnit,
FUNIT_TWIP );
else if( 100 != nNewProp )
@@ -1066,7 +1071,7 @@ void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp,
{
DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
- if( MAP_RELATIVE != eMetric )
+ if( MapUnit::MapRelative != eMetric )
nHeight = nNewHeight +
::ControlToItem( ::ItemToControl((short)nNewProp, eMetric,
FUNIT_TWIP ), FUNIT_TWIP,
@@ -1086,7 +1091,7 @@ void SvxFontHeightItem::dumpAsXml(xmlTextWriterPtr pWriter) const
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("height"), BAD_CAST(OString::number(nHeight).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("prop"), BAD_CAST(OString::number(nProp).getStr()));
- xmlTextWriterWriteAttribute(pWriter, BAD_CAST("propUnit"), BAD_CAST(OString::number(ePropUnit).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("propUnit"), BAD_CAST(OString::number((int)ePropUnit).getStr()));
xmlTextWriterEndElement(pWriter);
}
@@ -1194,8 +1199,8 @@ bool SvxFontWidthItem::GetPresentation
if ( 100 == nProp )
{
rText = GetMetricText( (long)nWidth,
- eCoreUnit, MAP_POINT, pIntl ) +
- " " + EE_RESSTR(GetMetricId(MAP_POINT));
+ eCoreUnit, MapUnit::MapPoint, pIntl ) +
+ " " + EE_RESSTR(GetMetricId(MapUnit::MapPoint));
}
else
rText = OUString::number( nProp ) + "%";
@@ -2033,8 +2038,8 @@ bool SvxKerningItem::GetPresentation
switch ( ePres )
{
case SfxItemPresentation::Nameless:
- rText = GetMetricText( (long)GetValue(), eCoreUnit, MAP_POINT, pIntl ) +
- " " + EE_RESSTR(GetMetricId(MAP_POINT));
+ rText = GetMetricText( (long)GetValue(), eCoreUnit, MapUnit::MapPoint, pIntl ) +
+ " " + EE_RESSTR(GetMetricId(MapUnit::MapPoint));
return true;
case SfxItemPresentation::Complete:
{
@@ -2049,8 +2054,8 @@ bool SvxKerningItem::GetPresentation
if ( nId )
rText += EE_RESSTR(nId);
rText = rText +
- GetMetricText( (long)GetValue(), eCoreUnit, MAP_POINT, pIntl ) +
- " " + EE_RESSTR(GetMetricId(MAP_POINT));
+ GetMetricText( (long)GetValue(), eCoreUnit, MapUnit::MapPoint, pIntl ) +
+ " " + EE_RESSTR(GetMetricId(MapUnit::MapPoint));
return true;
}
default: ; //prevent warning