diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-09-20 16:41:39 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-10-05 06:51:20 +0000 |
commit | 954f752cf10fc6a8777af2a6a93e496688464687 (patch) | |
tree | 0fc776cdcb6ad9b1d2b9673ac044bb5b4f496972 /vcl | |
parent | c1e18e05a53c1d55afe36a887ca25f74f3f1d32d (diff) |
convert MapUnit to scoped enum
I left a prefix on the names "Map" so that I would not have to re-arrange
each name too much, since I can't start identifiers with digits like "100thMM"
And remove RSC_EXTRAMAPUNIT, which doesn't seem to be doing anything anymore.
Change-Id: I5187824aa87e30caf5357b51b5384b5ab919d224
Reviewed-on: https://gerrit.libreoffice.org/29096
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
55 files changed, 240 insertions, 238 deletions
diff --git a/vcl/README.GDIMetaFile b/vcl/README.GDIMetaFile index 5d0358db29cc..80749c88b372 100644 --- a/vcl/README.GDIMetaFile +++ b/vcl/README.GDIMetaFile @@ -87,7 +87,7 @@ DISPLACEMENT FUNCTIONS - Move( long nX, long nX) - Move( long nX, long nX, long nDPIX, long nDPIY ) - Move method getting specifics how to - handle MapMode( MAP_PIXEL ) + handle MapMode( MapUnit::MapPixel ) TRANSFORMATION FUNCTIONS diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx index fa2f88b13c61..4eba68e093bd 100644 --- a/vcl/osx/salprn.cxx +++ b/vcl/osx/salprn.cxx @@ -449,7 +449,7 @@ bool AquaSalInfoPrinter::StartJob( const OUString* i_pFileName, // also SetPaperSizeUser has the advantage that we can share a // platform independent paper matching algorithm VclPtr<Printer> pPrinter( i_rController.getPrinter() ); - pPrinter->SetMapMode( MapMode( MAP_100TH_MM ) ); + pPrinter->SetMapMode( MapMode( MapUnit::Map100thMM ) ); pPrinter->SetPaperSizeUser( aCurSize, true ); // create view diff --git a/vcl/qa/cppunit/mapmode.cxx b/vcl/qa/cppunit/mapmode.cxx index 87c20a3bd666..d4c7e820d4a6 100644 --- a/vcl/qa/cppunit/mapmode.cxx +++ b/vcl/qa/cppunit/mapmode.cxx @@ -31,31 +31,31 @@ public: void VclMapModeTest::testMultiplier() { MapMode aMapMode; - CPPUNIT_ASSERT_MESSAGE( "Default map mode is MAP_PIXEL, multiplier should be 1", aMapMode.GetUnitMultiplier() == 1 ); - aMapMode.SetMapUnit( MAP_SYSFONT ); - CPPUNIT_ASSERT_MESSAGE( "Map mode is MAP_SYSFONT, multiplier should be 1", aMapMode.GetUnitMultiplier() == 1 ); - aMapMode.SetMapUnit( MAP_APPFONT ); - CPPUNIT_ASSERT_MESSAGE( "Map mode is MAP_APPFONT, multiplier should be 1", aMapMode.GetUnitMultiplier() == 1 ); - aMapMode.SetMapUnit( MAP_100TH_MM ); - CPPUNIT_ASSERT_MESSAGE( "Map mode is MAP_100TH_MM, multiplier should be 1", aMapMode.GetUnitMultiplier() == 1 ); - aMapMode.SetMapUnit( MAP_10TH_MM ); - CPPUNIT_ASSERT_MESSAGE( "Map mode is MAP_10TH_MM, multiplier should be 10", aMapMode.GetUnitMultiplier() == 10 ); - aMapMode.SetMapUnit( MAP_MM ); - CPPUNIT_ASSERT_MESSAGE( "Map mode is MAP_MM, multiplier should be 100", aMapMode.GetUnitMultiplier() == 100 ); - aMapMode.SetMapUnit( MAP_CM ); - CPPUNIT_ASSERT_MESSAGE( "Map mode is MAP_CM, multiplier should be 1000", aMapMode.GetUnitMultiplier() == 1000 ); - aMapMode.SetMapUnit( MAP_1000TH_INCH ); - CPPUNIT_ASSERT_MESSAGE( "Map mode is MAP_1000TH_INCH, multiplier should be 2.54", aMapMode.GetUnitMultiplier() == 2.54 ); - aMapMode.SetMapUnit( MAP_100TH_INCH ); - CPPUNIT_ASSERT_MESSAGE( "Map mode is MAP_100TH_INCH, multiplier should be 2.54", aMapMode.GetUnitMultiplier() == 25.4 ); - aMapMode.SetMapUnit( MAP_10TH_INCH ); - CPPUNIT_ASSERT_MESSAGE( "Map mode is MAP_10TH_INCH, multiplier should be 254", aMapMode.GetUnitMultiplier() == 254 ); - aMapMode.SetMapUnit( MAP_INCH ); - CPPUNIT_ASSERT_MESSAGE( "Map mode is MAP_INCH, multiplier should be 2540", aMapMode.GetUnitMultiplier() == 2540 ); - aMapMode.SetMapUnit( MAP_TWIP ); - CPPUNIT_ASSERT_MESSAGE( "Map mode is MAP_TWIP, multiplier should be 1.76388889", aMapMode.GetUnitMultiplier() == 1.76388889 ); - aMapMode.SetMapUnit( MAP_POINT ); - CPPUNIT_ASSERT_MESSAGE( "Map mode is MAP_POINT, multiplier should be 35.27777778", aMapMode.GetUnitMultiplier() == 35.27777778 ); + CPPUNIT_ASSERT_MESSAGE( "Default map mode is MapUnit::MapPixel, multiplier should be 1", aMapMode.GetUnitMultiplier() == 1 ); + aMapMode.SetMapUnit( MapUnit::MapSysFont ); + CPPUNIT_ASSERT_MESSAGE( "Map mode is MapUnit::MapSysFont, multiplier should be 1", aMapMode.GetUnitMultiplier() == 1 ); + aMapMode.SetMapUnit( MapUnit::MapAppFont ); + CPPUNIT_ASSERT_MESSAGE( "Map mode is MapUnit::MapAppFont, multiplier should be 1", aMapMode.GetUnitMultiplier() == 1 ); + aMapMode.SetMapUnit( MapUnit::Map100thMM ); + CPPUNIT_ASSERT_MESSAGE( "Map mode is MapUnit::Map100thMM, multiplier should be 1", aMapMode.GetUnitMultiplier() == 1 ); + aMapMode.SetMapUnit( MapUnit::Map10thMM ); + CPPUNIT_ASSERT_MESSAGE( "Map mode is MapUnit::Map10thMM, multiplier should be 10", aMapMode.GetUnitMultiplier() == 10 ); + aMapMode.SetMapUnit( MapUnit::MapMM ); + CPPUNIT_ASSERT_MESSAGE( "Map mode is MapUnit::MapMM, multiplier should be 100", aMapMode.GetUnitMultiplier() == 100 ); + aMapMode.SetMapUnit( MapUnit::MapCM ); + CPPUNIT_ASSERT_MESSAGE( "Map mode is MapUnit::MapCM, multiplier should be 1000", aMapMode.GetUnitMultiplier() == 1000 ); + aMapMode.SetMapUnit( MapUnit::Map1000thInch ); + CPPUNIT_ASSERT_MESSAGE( "Map mode is MapUnit::Map1000thInch, multiplier should be 2.54", aMapMode.GetUnitMultiplier() == 2.54 ); + aMapMode.SetMapUnit( MapUnit::Map100thInch ); + CPPUNIT_ASSERT_MESSAGE( "Map mode is MapUnit::Map100thInch, multiplier should be 2.54", aMapMode.GetUnitMultiplier() == 25.4 ); + aMapMode.SetMapUnit( MapUnit::Map10thInch ); + CPPUNIT_ASSERT_MESSAGE( "Map mode is MapUnit::Map10thInch, multiplier should be 254", aMapMode.GetUnitMultiplier() == 254 ); + aMapMode.SetMapUnit( MapUnit::MapInch ); + CPPUNIT_ASSERT_MESSAGE( "Map mode is MapUnit::MapInch, multiplier should be 2540", aMapMode.GetUnitMultiplier() == 2540 ); + aMapMode.SetMapUnit( MapUnit::MapTwip ); + CPPUNIT_ASSERT_MESSAGE( "Map mode is MapUnit::MapTwip, multiplier should be 1.76388889", aMapMode.GetUnitMultiplier() == 1.76388889 ); + aMapMode.SetMapUnit( MapUnit::MapPoint ); + CPPUNIT_ASSERT_MESSAGE( "Map mode is MapUnit::MapPoint, multiplier should be 35.27777778", aMapMode.GetUnitMultiplier() == 35.27777778 ); } CPPUNIT_TEST_SUITE_REGISTRATION(VclMapModeTest); diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 6a97396677cc..1cab69d178dc 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -2056,7 +2056,7 @@ const Size& StyleSettings::GetListBoxPreviewDefaultPixelSize() const if(0 == mxData->maListBoxPreviewDefaultPixelSize.Width() || 0 == mxData->maListBoxPreviewDefaultPixelSize.Height()) { const_cast< StyleSettings* >(this)->mxData->maListBoxPreviewDefaultPixelSize = - Application::GetDefaultDevice()->LogicToPixel(mxData->maListBoxPreviewDefaultLogicSize, MAP_APPFONT); + Application::GetDefaultDevice()->LogicToPixel(mxData->maListBoxPreviewDefaultLogicSize, MapUnit::MapAppFont); } return mxData->maListBoxPreviewDefaultPixelSize; diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 98dfacdb2d48..becfa0f9b0e9 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -723,7 +723,7 @@ void Application::SetSettings( const AllSettings& rSettings ) while ( pFrame ) { // restore AppFont cache data - pFrame->mpWindowImpl->mpFrameData->meMapUnit = MAP_PIXEL; + pFrame->mpWindowImpl->mpFrameData->meMapUnit = MapUnit::MapPixel; // call UpdateSettings from ClientWindow in order to prevent updating data twice vcl::Window* pClientWin = pFrame; diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 658a8b0d19c1..4e5904eb56c0 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -1081,7 +1081,7 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext) // prepare single line hint (needed on mac to decide between normal push button and // rectangular bevel button look) Size aFontSize(Application::GetSettings().GetStyleSettings().GetPushButtonFont().GetFontSize()); - aFontSize = rRenderContext.LogicToPixel(aFontSize, MapMode(MAP_POINT)); + aFontSize = rRenderContext.LogicToPixel(aFontSize, MapMode(MapUnit::MapPoint)); Size aInRectSize(rRenderContext.LogicToPixel(Size(aInRect.GetWidth(), aInRect.GetHeight()))); aControlValue.mbSingleLine = (aInRectSize.Height() < 2 * aFontSize.Height()); @@ -2471,7 +2471,7 @@ void RadioButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize { if ( !maImage ) { - MapMode aResMapMode( MAP_100TH_MM ); + MapMode aResMapMode( MapUnit::Map100thMM ); Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); Size aImageSize = pDev->LogicToPixel( Size( 300, 300 ), aResMapMode ); @@ -2866,7 +2866,7 @@ Image RadioButton::GetRadioImage( const AllSettings& rSettings, DrawButtonFlags void RadioButton::ImplSetMinimumNWFSize() { Push( PushFlags::MAPMODE ); - SetMapMode( MAP_PIXEL ); + SetMapMode( MapUnit::MapPixel ); ImplControlValue aControlValue; Size aCurSize( GetSizePixel() ); @@ -3358,7 +3358,7 @@ void CheckBox::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) void CheckBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags ) { - MapMode aResMapMode( MAP_100TH_MM ); + MapMode aResMapMode( MapUnit::Map100thMM ); Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); Size aImageSize = pDev->LogicToPixel( Size( 300, 300 ), aResMapMode ); @@ -3729,7 +3729,7 @@ Image CheckBox::GetCheckImage( const AllSettings& rSettings, DrawButtonFlags nFl void CheckBox::ImplSetMinimumNWFSize() { Push( PushFlags::MAPMODE ); - SetMapMode( MAP_PIXEL ); + SetMapMode( MapUnit::MapPixel ); ImplControlValue aControlValue; Size aCurSize( GetSizePixel() ); diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 9ed2710ff3f6..c71ae85c40f0 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -1141,30 +1141,30 @@ static FieldUnit ImplMap2FieldUnit( MapUnit meUnit, long& nDecDigits ) { switch( meUnit ) { - case MAP_100TH_MM : + case MapUnit::Map100thMM : nDecDigits -= 2; return FUNIT_MM; - case MAP_10TH_MM : + case MapUnit::Map10thMM : nDecDigits -= 1; return FUNIT_MM; - case MAP_MM : + case MapUnit::MapMM : return FUNIT_MM; - case MAP_CM : + case MapUnit::MapCM : return FUNIT_CM; - case MAP_1000TH_INCH : + case MapUnit::Map1000thInch : nDecDigits -= 3; return FUNIT_INCH; - case MAP_100TH_INCH : + case MapUnit::Map100thInch : nDecDigits -= 2; return FUNIT_INCH; - case MAP_10TH_INCH : + case MapUnit::Map10thInch : nDecDigits -= 1; return FUNIT_INCH; - case MAP_INCH : + case MapUnit::MapInch : return FUNIT_INCH; - case MAP_POINT : + case MapUnit::MapPoint : return FUNIT_POINT; - case MAP_TWIP : + case MapUnit::MapTwip : return FUNIT_TWIP; default: OSL_FAIL( "default eInUnit" ); @@ -1264,10 +1264,10 @@ double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits, if ( eOutUnit == FUNIT_PERCENT || eOutUnit == FUNIT_CUSTOM || eOutUnit == FUNIT_NONE || - eInUnit == MAP_PIXEL || - eInUnit == MAP_SYSFONT || - eInUnit == MAP_APPFONT || - eInUnit == MAP_RELATIVE ) + eInUnit == MapUnit::MapPixel || + eInUnit == MapUnit::MapSysFont || + eInUnit == MapUnit::MapAppFont || + eInUnit == MapUnit::MapRelative ) { OSL_FAIL( "invalid parameters" ); return nValue; @@ -1319,10 +1319,10 @@ double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits, eInUnit == FUNIT_SECOND || eInUnit == FUNIT_MILLISECOND || eInUnit == FUNIT_PIXEL || - eOutUnit == MAP_PIXEL || - eOutUnit == MAP_SYSFONT || - eOutUnit == MAP_APPFONT || - eOutUnit == MAP_RELATIVE ) + eOutUnit == MapUnit::MapPixel || + eOutUnit == MapUnit::MapSysFont || + eOutUnit == MapUnit::MapAppFont || + eOutUnit == MapUnit::MapRelative ) { OSL_FAIL( "invalid parameters" ); return nValue; diff --git a/vcl/source/control/morebtn.cxx b/vcl/source/control/morebtn.cxx index 03b9e481bbc5..86cb9c09619e 100644 --- a/vcl/source/control/morebtn.cxx +++ b/vcl/source/control/morebtn.cxx @@ -32,7 +32,7 @@ struct ImplMoreButtonData void MoreButton::ImplInit( vcl::Window* pParent, WinBits nStyle ) { mpMBData = new ImplMoreButtonData; - meUnit = MAP_PIXEL; + meUnit = MapUnit::MapPixel; mbState = false; mpMBData->mpItemList = nullptr; diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index 7d2a23923599..c16f4f52de57 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -861,7 +861,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) if (rMEvt.IsLeft() || rMEvt.IsMiddle() || rMEvt.IsRight()) { Point aPosPixel; - if (!IsMapModeEnabled() && GetMapMode().GetMapUnit() == MAP_TWIP) + if (!IsMapModeEnabled() && GetMapMode().GetMapUnit() == MapUnit::MapTwip) { // rMEvt coordinates are in twips. Push(PushFlags::MAPMODE); @@ -872,7 +872,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) aPosPixel = LogicToPixel(rMEvt.GetPosPixel()); Pop(); } - const Point& rMousePos = (GetMapMode().GetMapUnit() != MAP_TWIP ? rMEvt.GetPosPixel() : aPosPixel); + const Point& rMousePos = (GetMapMode().GetMapUnit() != MapUnit::MapTwip ? rMEvt.GetPosPixel() : aPosPixel); StartTrackingFlags nTrackFlags = StartTrackingFlags::NONE; bool bHorizontal = ( GetStyle() & WB_HORZ ) != 0; bool bIsInside = false; @@ -1040,7 +1040,7 @@ void ScrollBar::Tracking( const TrackingEvent& rTEvt ) else { Point aPosPixel; - if (!IsMapModeEnabled() && GetMapMode().GetMapUnit() == MAP_TWIP) + if (!IsMapModeEnabled() && GetMapMode().GetMapUnit() == MapUnit::MapTwip) { // rTEvt coordinates are in twips. Push(PushFlags::MAPMODE); @@ -1051,7 +1051,7 @@ void ScrollBar::Tracking( const TrackingEvent& rTEvt ) aPosPixel = LogicToPixel(rTEvt.GetMouseEvent().GetPosPixel()); Pop(); } - const Point rMousePos = (GetMapMode().GetMapUnit() != MAP_TWIP ? rTEvt.GetMouseEvent().GetPosPixel() : aPosPixel); + const Point rMousePos = (GetMapMode().GetMapUnit() != MapUnit::MapTwip ? rTEvt.GetMouseEvent().GetPosPixel() : aPosPixel); // Dragging is treated in a special way if ( meScrollType == ScrollType::Drag ) diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index dc4998262784..84562282cfc5 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -1253,7 +1253,7 @@ void TabControl::setAllocation(const Size &rAllocation) long nPrefWidth = mpTabCtrlData->mpListBox->get_preferred_size().Width(); if( nPrefWidth > aTabCtrlSize.Width() ) nPrefWidth = aTabCtrlSize.Width(); - Size aNewSize( nPrefWidth, LogicToPixel( Size( 12, 12 ), MapMode( MAP_APPFONT ) ).Height() ); + Size aNewSize( nPrefWidth, LogicToPixel( Size( 12, 12 ), MapMode( MapUnit::MapAppFont ) ).Height() ); Point aNewPos( (aTabCtrlSize.Width() - nPrefWidth) / 2, 0 ); mpTabCtrlData->mpListBox->SetPosSizePixel( aNewPos, aNewSize ); } diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index dba350de110a..379b8c5a8ff2 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -846,10 +846,10 @@ static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, FilterConfigItem& r Size aOriginalSize; Size aPrefSize( rGraphic.GetPrefSize() ); MapMode aPrefMapMode( rGraphic.GetPrefMapMode() ); - if ( aPrefMapMode == MAP_PIXEL ) - aOriginalSize = Application::GetDefaultDevice()->PixelToLogic( aPrefSize, MAP_100TH_MM ); + if ( aPrefMapMode == MapUnit::MapPixel ) + aOriginalSize = Application::GetDefaultDevice()->PixelToLogic( aPrefSize, MapUnit::Map100thMM ); else - aOriginalSize = OutputDevice::LogicToLogic( aPrefSize, aPrefMapMode, MAP_100TH_MM ); + aOriginalSize = OutputDevice::LogicToLogic( aPrefSize, aPrefMapMode, MapUnit::Map100thMM ); if ( !nLogicalWidth ) nLogicalWidth = aOriginalSize.Width(); if ( !nLogicalHeight ) @@ -861,7 +861,7 @@ static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, FilterConfigItem& r if( nMode == 1 ) { Bitmap aBitmap( rGraphic.GetBitmap() ); - MapMode aMap( MAP_100TH_INCH ); + MapMode aMap( MapUnit::Map100thInch ); sal_Int32 nDPI = rConfigItem.ReadInt32( "Resolution", 75 ); Fraction aFrac( 1, std::min( std::max( nDPI, sal_Int32( 75 ) ), sal_Int32( 600 ) ) ); @@ -879,7 +879,7 @@ static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, FilterConfigItem& r else if( nMode == 2 ) { aGraphic = rGraphic; - aGraphic.SetPrefMapMode( MapMode( MAP_100TH_MM ) ); + aGraphic.SetPrefMapMode( MapMode( MapUnit::Map100thMM ) ); aGraphic.SetPrefSize( Size( nLogicalWidth, nLogicalHeight ) ); } else @@ -898,7 +898,7 @@ static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, FilterConfigItem& r if( ( nMode == 1 ) || ( nMode == 2 ) ) { GDIMetaFile aMtf( rGraphic.GetGDIMetaFile() ); - Size aNewSize( OutputDevice::LogicToLogic( Size( nLogicalWidth, nLogicalHeight ), MAP_100TH_MM, aMtf.GetPrefMapMode() ) ); + Size aNewSize( OutputDevice::LogicToLogic( Size( nLogicalWidth, nLogicalHeight ), MapUnit::Map100thMM, aMtf.GetPrefMapMode() ) ); if( aNewSize.Width() && aNewSize.Height() ) { @@ -1916,11 +1916,11 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString aSizePixel.Height()=(sal_uLong)(((double)aSizePixel.Height())*fFak); } - aVirDev->SetMapMode(MapMode(MAP_PIXEL)); + aVirDev->SetMapMode(MapMode(MapUnit::MapPixel)); aVirDev->SetOutputSizePixel(aSizePixel); Graphic aGraphic2=aGraphic; aGraphic2.Draw(aVirDev.get(),Point(0,0),aSizePixel); // this changes the MapMode - aVirDev->SetMapMode(MapMode(MAP_PIXEL)); + aVirDev->SetMapMode(MapMode(MapUnit::MapPixel)); aGraphic=Graphic(aVirDev->GetBitmap(Point(0,0),aSizePixel)); } } diff --git a/vcl/source/filter/graphicfilter2.cxx b/vcl/source/filter/graphicfilter2.cxx index 4e57a0172980..66c83e9cfc92 100644 --- a/vcl/source/filter/graphicfilter2.cxx +++ b/vcl/source/filter/graphicfilter2.cxx @@ -335,10 +335,10 @@ bool GraphicDescriptor::ImpDetectJPG( SvStream& rStm, bool bExtendedInfo ) if ( nUnits && nHorizontalResolution && nVerticalResolution ) { MapMode aMap; - aMap.SetMapUnit( nUnits == 1 ? MAP_INCH : MAP_CM ); + aMap.SetMapUnit( nUnits == 1 ? MapUnit::MapInch : MapUnit::MapCM ); aMap.SetScaleX( Fraction( 1, nHorizontalResolution ) ); aMap.SetScaleY( Fraction( 1, nVerticalResolution ) ); - aLogSize = OutputDevice::LogicToLogic( aPixSize, aMap, MapMode( MAP_100TH_MM ) ); + aLogSize = OutputDevice::LogicToLogic( aPixSize, aMap, MapMode( MapUnit::Map100thMM ) ); } } } @@ -490,10 +490,10 @@ bool GraphicDescriptor::ImpDetectPCX( SvStream& rStm, bool bExtendedInfo ) nDPIy = nTemp16; // set logical size - MapMode aMap( MAP_INCH, Point(), + MapMode aMap( MapUnit::MapInch, Point(), Fraction( 1, nDPIx ), Fraction( 1, nDPIy ) ); aLogSize = OutputDevice::LogicToLogic( aPixSize, aMap, - MapMode( MAP_100TH_MM ) ); + MapMode( MapUnit::Map100thMM ) ); // number of color planes cByte = 5; // Illegal value in case of EOF. @@ -1035,7 +1035,7 @@ bool GraphicDescriptor::ImpDetectSVM( SvStream& rStm, bool bExtendedInfo ) rStm.ReadUInt16( nTemp16 ); aLogSize = OutputDevice::LogicToLogic( aLogSize, MapMode( (MapUnit) nTemp16 ), - MapMode( MAP_100TH_MM ) ); + MapMode( MapUnit::Map100thMM ) ); } } } @@ -1063,7 +1063,7 @@ bool GraphicDescriptor::ImpDetectSVM( SvStream& rStm, bool bExtendedInfo ) rStm.SeekRel( 0x06 ); ReadMapMode( rStm, aMapMode ); ReadPair( rStm, aLogSize ); - aLogSize = OutputDevice::LogicToLogic( aLogSize, aMapMode, MapMode( MAP_100TH_MM ) ); + aLogSize = OutputDevice::LogicToLogic( aLogSize, aMapMode, MapMode( MapUnit::Map100thMM ) ); } } } diff --git a/vcl/source/filter/igif/gifread.cxx b/vcl/source/filter/igif/gifread.cxx index 7b9ac2ab799c..bc739efa9ba1 100644 --- a/vcl/source/filter/igif/gifread.cxx +++ b/vcl/source/filter/igif/gifread.cxx @@ -874,7 +874,7 @@ ReadState GIFReader::ReadGIF( Graphic& rGraphic ) if( nLogWidth100 && nLogHeight100 ) { rGraphic.SetPrefSize( Size( nLogWidth100, nLogHeight100 ) ); - rGraphic.SetPrefMapMode( MAP_100TH_MM ); + rGraphic.SetPrefMapMode( MapUnit::Map100thMM ); } } else diff --git a/vcl/source/filter/jpeg/JpegReader.cxx b/vcl/source/filter/jpeg/JpegReader.cxx index b1582d8da2b6..cde54c49dbde 100644 --- a/vcl/source/filter/jpeg/JpegReader.cxx +++ b/vcl/source/filter/jpeg/JpegReader.cxx @@ -227,11 +227,11 @@ bool JPEGReader::CreateBitmap(JPEGCreateBitmapParam& rParam) Point aEmptyPoint; Fraction aFractX( 1, rParam.X_density ); Fraction aFractY( 1, rParam.Y_density ); - MapMode aMapMode( nUnit == 1 ? MAP_INCH : MAP_CM, aEmptyPoint, aFractX, aFractY ); - Size aPrefSize = OutputDevice::LogicToLogic( aSize, aMapMode, MAP_100TH_MM ); + MapMode aMapMode( nUnit == 1 ? MapUnit::MapInch : MapUnit::MapCM, aEmptyPoint, aFractX, aFractY ); + Size aPrefSize = OutputDevice::LogicToLogic( aSize, aMapMode, MapUnit::Map100thMM ); maBitmap.SetPrefSize(aPrefSize); - maBitmap.SetPrefMapMode(MapMode(MAP_100TH_MM)); + maBitmap.SetPrefMapMode(MapMode(MapUnit::Map100thMM)); } } diff --git a/vcl/source/filter/sgfbram.cxx b/vcl/source/filter/sgfbram.cxx index a2a51200a543..468c18cf52dc 100644 --- a/vcl/source/filter/sgfbram.cxx +++ b/vcl/source/filter/sgfbram.cxx @@ -433,7 +433,7 @@ bool SgfFilterVect(SvStream& rInp, SgfHeader& rHead, SgfEntry&, GDIMetaFile& rMt } rMtf.Stop(); rMtf.WindStart(); - MapMode aMap( MAP_10TH_MM, Point(), + MapMode aMap( MapUnit::Map10thMM, Point(), Fraction( 1, 4 ), Fraction( 1, 4 ) ); rMtf.SetPrefMapMode( aMap ); rMtf.SetPrefSize( Size( (short)rHead.Xsize, (short)rHead.Ysize ) ); diff --git a/vcl/source/filter/sgvmain.cxx b/vcl/source/filter/sgvmain.cxx index c4f474f043b5..cc0207513233 100644 --- a/vcl/source/filter/sgvmain.cxx +++ b/vcl/source/filter/sgvmain.cxx @@ -899,7 +899,7 @@ bool SgfFilterSDrw( SvStream& rInp, SgfHeader&, SgfEntry&, GDIMetaFile& rMtf ) rMtf.Stop(); rMtf.WindStart(); - MapMode aMap(MAP_10TH_MM,Point(),Fraction(1,4),Fraction(1,4)); + MapMode aMap(MapUnit::Map10thMM,Point(),Fraction(1,4),Fraction(1,4)); rMtf.SetPrefMapMode(aMap); rMtf.SetPrefSize(Size((sal_Int16)aPage.Paper.Size.x,(sal_Int16)aPage.Paper.Size.y)); bRet=true; diff --git a/vcl/source/filter/sgvtext.cxx b/vcl/source/filter/sgvtext.cxx index c062c50474ff..404dd4206c9b 100644 --- a/vcl/source/filter/sgvtext.cxx +++ b/vcl/source/filter/sgvtext.cxx @@ -681,7 +681,7 @@ void FormatLine(UCHAR* TBuf, sal_uInt16& Index, ObjTextType& Atr0, ObjTextType& sal_uInt16 i,j,k,h; sal_uInt16 re,li; - vOut->SetMapMode(MapMode(MAP_10TH_MM,Point(),Fraction(1,4),Fraction(1,4))); + vOut->SetMapMode(MapMode(MapUnit::Map10thMM,Point(),Fraction(1,4),Fraction(1,4))); nChars=0; SetTextContext(*vOut.get(),AktAtr,false,0,1,1,1,1); diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx index b13f4459af5d..dda3d56f7db8 100644 --- a/vcl/source/filter/wmf/emfwr.cxx +++ b/vcl/source/filter/wmf/emfwr.cxx @@ -243,7 +243,7 @@ bool EMFWriter::WriteEMF(const GDIMetaFile& rMtf) maVDev->EnableOutput( false ); maVDev->SetMapMode( rMtf.GetPrefMapMode() ); // don't work with pixel as destination map mode -> higher resolution preferable - maDestMapMode.SetMapUnit( MAP_100TH_MM ); + maDestMapMode.SetMapUnit( MapUnit::Map100thMM ); mHandlesUsed = std::vector<bool>(MAXHANDLES, false); mnHandleCount = mnRecordCount = mnRecordPos = mnRecordPlusPos = 0; mbRecordOpen = mbRecordPlusOpen = false; @@ -252,7 +252,7 @@ bool EMFWriter::WriteEMF(const GDIMetaFile& rMtf) mnHorTextAlign = 0; const Size aMtfSizePix( maVDev->LogicToPixel( rMtf.GetPrefSize(), rMtf.GetPrefMapMode() ) ); - const Size aMtfSizeLog( OutputDevice::LogicToLogic( rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MAP_100TH_MM ) ); + const Size aMtfSizeLog( OutputDevice::LogicToLogic( rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MapUnit::Map100thMM ) ); // seek over header // use [MS-EMF 2.2.11] HeaderExtension2 Object, otherwise resulting EMF cannot be converted with GetWinMetaFileBits() diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx index b6d7d76ba682..fba68a2b467e 100644 --- a/vcl/source/filter/wmf/winmtf.cxx +++ b/vcl/source/filter/wmf/winmtf.cxx @@ -871,7 +871,7 @@ WinMtfOutput::WinMtfOutput( GDIMetaFile& rGDIMetaFile ) : WinMtfOutput::~WinMtfOutput() { mpGDIMetaFile->AddAction( new MetaPopAction() ); - mpGDIMetaFile->SetPrefMapMode( MAP_100TH_MM ); + mpGDIMetaFile->SetPrefMapMode( MapUnit::Map100thMM ); if ( mrclFrame.IsEmpty() ) mpGDIMetaFile->SetPrefSize( Size( mnDevWidth, mnDevHeight ) ); else @@ -1458,7 +1458,7 @@ void WinMtfOutput::DrawText( Point& rPosition, OUString& rText, long* pDXArry, b SolarMutexGuard aGuard; ScopedVclPtrInstance< VirtualDevice > pVDev; sal_Int32 nTextWidth; - pVDev->SetMapMode( MapMode( MAP_100TH_MM ) ); + pVDev->SetMapMode( MapMode( MapUnit::Map100thMM ) ); pVDev->SetFont( maFont ); if( pDXArry ) { @@ -1506,7 +1506,7 @@ void WinMtfOutput::DrawText( Point& rPosition, OUString& rText, long* pDXArry, b SolarMutexGuard aGuard; ScopedVclPtrInstance< VirtualDevice > pVDev; pDX = new long[ rText.getLength() ]; - pVDev->SetMapMode( MAP_100TH_MM ); + pVDev->SetMapMode( MapUnit::Map100thMM ); pVDev->SetFont( maLatestFont ); pVDev->GetTextArray( rText, pDX, 0, rText.getLength()); } @@ -1523,7 +1523,7 @@ void WinMtfOutput::ImplDrawBitmap( const Point& rPos, const Size& rSize, const B if ( mbComplexClip ) { VclPtrInstance< VirtualDevice > pVDev; - MapMode aMapMode( MAP_100TH_MM ); + MapMode aMapMode( MapUnit::Map100thMM ); aMapMode.SetOrigin( Point( -rPos.X(), -rPos.Y() ) ); const Size aOutputSizePixel( pVDev->LogicToPixel( rSize, aMapMode ) ); const Size aSizePixel( rBitmap.GetSizePixel() ); diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx index bb56e7c91ed5..f1b907f8f1c4 100644 --- a/vcl/source/filter/wmf/winwmf.cxx +++ b/vcl/source/filter/wmf/winwmf.cxx @@ -1256,8 +1256,8 @@ bool WMFReader::ReadHeader() if( ( labs( aWMFSize.Width() ) > 1 ) && ( labs( aWMFSize.Height() ) > 1 ) ) { const Fraction aFrac( 1, nUnitsPerInch ); - MapMode aWMFMap( MAP_INCH, Point(), aFrac, aFrac ); - Size aSize100( OutputDevice::LogicToLogic( aWMFSize, aWMFMap, MAP_100TH_MM ) ); + MapMode aWMFMap( MapUnit::MapInch, Point(), aFrac, aFrac ); + Size aSize100( OutputDevice::LogicToLogic( aWMFSize, aWMFMap, MapUnit::Map100thMM ) ); aDevExt = Size( labs( aSize100.Width() ), labs( aSize100.Height() ) ); } pOut->SetDevExt( aDevExt ); diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx index 7973b4368be1..3d8bb911df40 100644 --- a/vcl/source/filter/wmf/wmfwr.cxx +++ b/vcl/source/filter/wmf/wmfwr.cxx @@ -1400,7 +1400,7 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) if (aSrcMapMode!=pA->GetMapMode()) { - if( pA->GetMapMode().GetMapUnit() == MAP_RELATIVE ) + if( pA->GetMapMode().GetMapUnit() == MapUnit::MapRelative ) { MapMode aMM = pA->GetMapMode(); Fraction aScaleX = aMM.GetScaleX(); @@ -1637,7 +1637,7 @@ void WMFWriter::WriteHeader( const GDIMetaFile &, bool bPlaceable ) if( bPlaceable ) { sal_uInt16 nCheckSum, nValue; - Size aSize( OutputDevice::LogicToLogic(Size(1,1),MapMode(MAP_INCH), aTargetMapMode) ); + Size aSize( OutputDevice::LogicToLogic(Size(1,1),MapMode(MapUnit::MapInch), aTargetMapMode) ); sal_uInt16 nUnitsPerInch = (sal_uInt16) ( ( aSize.Width() + aSize.Height() ) >> 1 ); nCheckSum=0; @@ -1721,7 +1721,7 @@ bool WMFWriter::WriteWMF( const GDIMetaFile& rMTF, SvStream& rTargetStream, } else { - aTargetMapMode = MapMode( MAP_INCH ); + aTargetMapMode = MapMode( MapUnit::MapInch ); const long nUnit = pVirDev->LogicToPixel( Size( 1, 1 ), aTargetMapMode ).Width(); const Fraction aFrac( 1, nUnit ); diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx index a2187f3eceaf..e9461d1e5f6a 100644 --- a/vcl/source/gdi/bitmap.cxx +++ b/vcl/source/gdi/bitmap.cxx @@ -55,7 +55,7 @@ Bitmap::Bitmap(const Bitmap& rBitmap) Bitmap::Bitmap(SalBitmap* pSalBitmap) : mxImpBmp(new ImpBitmap(pSalBitmap)) - , maPrefMapMode(MapMode(MAP_PIXEL)) + , maPrefMapMode(MapMode(MapUnit::MapPixel)) , maPrefSize(mxImpBmp->ImplGetSize()) { } @@ -1531,7 +1531,7 @@ bool Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, sal if (xImpBmp->ImplCreate(*mxImpBmp) && xImpBmp->ImplReplace(rSearchColor, rReplaceColor, nTol)) { ImplSetImpBitmap(xImpBmp); - maPrefMapMode = MapMode( MAP_PIXEL ); + maPrefMapMode = MapMode( MapUnit::MapPixel ); maPrefSize = xImpBmp->ImplGetSize(); return true; } diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx index f4223fe385a8..acc6c4baeac0 100644 --- a/vcl/source/gdi/bitmap3.cxx +++ b/vcl/source/gdi/bitmap3.cxx @@ -904,7 +904,7 @@ bool Bitmap::Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag n { ImplSetImpBitmap(xImpBmp); SAL_INFO( "vcl.opengl", "Ref count: " << mxImpBmp.use_count() ); - maPrefMapMode = MapMode( MAP_PIXEL ); + maPrefMapMode = MapMode( MapUnit::MapPixel ); maPrefSize = xImpBmp->ImplGetSize(); return true; } diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index a3e6a07015db..ebe9d895e20f 100644 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -943,7 +943,7 @@ bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, AlphaMask* pBmpAlpha, sal_u if(bRet && aHeader.nXPelsPerMeter && aHeader.nYPelsPerMeter) { MapMode aMapMode( - MAP_MM, + MapUnit::MapMM, Point(), Fraction(1000, aHeader.nXPelsPerMeter), Fraction(1000, aHeader.nYPelsPerMeter)); @@ -1358,7 +1358,7 @@ bool ImplWriteDIBBits(SvStream& rOStm, BitmapReadAccess& rAcc, BitmapReadAccess* bool ImplWriteDIBBody(const Bitmap& rBitmap, SvStream& rOStm, BitmapReadAccess& rAcc, BitmapReadAccess* pAccAlpha, bool bCompressed) { - const MapMode aMapPixel(MAP_PIXEL); + const MapMode aMapPixel(MapUnit::MapPixel); DIBV5Header aHeader; sal_uLong nImageSizePos(0); sal_uLong nEndPos(0); @@ -1421,7 +1421,7 @@ bool ImplWriteDIBBody(const Bitmap& rBitmap, SvStream& rOStm, BitmapReadAccess& // MapMode is integer-based, and suffers from roundoffs, // especially if maPrefSize is small. Trying to circumvent // that by performing part of the math in floating point. - const Size aScale100000(OutputDevice::LogicToLogic(Size(100000, 100000), MAP_100TH_MM, rBitmap.GetPrefMapMode())); + const Size aScale100000(OutputDevice::LogicToLogic(Size(100000, 100000), MapUnit::Map100thMM, rBitmap.GetPrefMapMode())); const double fBmpWidthM((double)rBitmap.GetPrefSize().Width() / aScale100000.Width()); const double fBmpHeightM((double)rBitmap.GetPrefSize().Height() / aScale100000.Height()); diff --git a/vcl/source/gdi/gdimetafiletools.cxx b/vcl/source/gdi/gdimetafiletools.cxx index b8adfdf18109..877ca9a302f1 100644 --- a/vcl/source/gdi/gdimetafiletools.cxx +++ b/vcl/source/gdi/gdimetafiletools.cxx @@ -276,7 +276,7 @@ void clipMetafileContentAgainstOwnRegions(GDIMetaFile& rSource) // start with empty region aClips.push_back(basegfx::B2DPolyPolygon()); - // start with default MapMode (MAP_PIXEL) + // start with default MapMode (MapUnit::MapPixel) aMapModes.push_back(MapMode()); for(sal_uLong i(0); i < nObjCount; ++i) @@ -715,7 +715,7 @@ void clipMetafileContentAgainstOwnRegions(GDIMetaFile& rSource) // combination with the current MapMode Size aLogicalSize(rBitmapEx.GetPrefSize()); - if(MAP_PIXEL == rBitmapEx.GetPrefMapMode().GetMapUnit()) + if(MapUnit::MapPixel == rBitmapEx.GetPrefMapMode().GetMapUnit()) { aLogicalSize = Application::GetDefaultDevice()->PixelToLogic(aLogicalSize, aMapModes.back().GetMapUnit()); } @@ -742,7 +742,7 @@ void clipMetafileContentAgainstOwnRegions(GDIMetaFile& rSource) // combination with the current MapMode Size aLogicalSize(rBitmap.GetPrefSize()); - if(MAP_PIXEL == rBitmap.GetPrefMapMode().GetMapUnit()) + if(MapUnit::MapPixel == rBitmap.GetPrefMapMode().GetMapUnit()) { aLogicalSize = Application::GetDefaultDevice()->PixelToLogic(aLogicalSize, aMapModes.back().GetMapUnit()); } diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 7954574c6a7a..74bdd0747026 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -419,7 +419,7 @@ bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, S BitmapEx aBitmapEx; if( aBitmapEx.Create( xBitmapCanvas, aSize ) ) { - if ( pOut->GetMapMode() == MAP_PIXEL ) + if ( pOut->GetMapMode() == MapUnit::MapPixel ) pOut->DrawBitmapEx( rPos, aBitmapEx ); else pOut->DrawBitmapEx( rPos, rLogicDestSize, aBitmapEx ); @@ -706,7 +706,7 @@ void GDIMetaFile::Move( long nX, long nY, long nDPIX, long nDPIY ) ( MetaActionType::POP == nType ) ) { pModAct->Execute( aMapVDev.get() ); - if( aMapVDev->GetMapMode().GetMapUnit() == MAP_PIXEL ) + if( aMapVDev->GetMapMode().GetMapUnit() == MapUnit::MapPixel ) { aOffset = aMapVDev->LogicToPixel( aBaseOffset, GetPrefMapMode() ); MapMode aMap( aMapVDev->GetMapMode() ); diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index 791a65971294..77c8fad22fa1 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -92,7 +92,7 @@ static void ImplDrawDefault( OutputDevice* pOutDev, const OUString* pText, if ( aSize.Width() > 0 && aSize.Height() > 0 && pFont && pText && pText->getLength() && !(!pOutDev->IsOutputEnabled() /*&& pOutDev->GetConnectMetaFile() */) ) { - MapMode aMapMode( MAP_POINT ); + MapMode aMapMode( MapUnit::MapPoint ); Size aSz = pOutDev->LogicToLogic( Size( 0, 12 ), &aMapMode, nullptr ); long nThreshold = aSz.Height() / 2; long nStep = nThreshold / 3; diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 2a7dce6480fc..ce3b42c4f681 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -696,7 +696,7 @@ MapMode ImpGraphic::ImplGetPrefMapMode() const if(maSvgData.get() && maEx.IsEmpty()) { // svg not yet buffered in maEx, return default PrefMapMode - aMapMode = MapMode(MAP_100TH_MM); + aMapMode = MapMode(MapUnit::Map100thMM); } else { @@ -1075,7 +1075,7 @@ bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm ) rOStm.WriteInt32( 0 ); rOStm.WriteInt32( aSize.Width() ); rOStm.WriteInt32( aSize.Height() ); - rOStm.WriteInt32( aMapMode.GetMapUnit() ); + rOStm.WriteInt32( (sal_uInt16)aMapMode.GetMapUnit() ); rOStm.WriteInt32( aMapMode.GetScaleX().GetNumerator() ); rOStm.WriteInt32( aMapMode.GetScaleX().GetDenominator() ); rOStm.WriteInt32( aMapMode.GetScaleY().GetNumerator() ); diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx index 26a4c6d520d2..d3b97e9ec35a 100644 --- a/vcl/source/gdi/impvect.cxx +++ b/vcl/source/gdi/impvect.cxx @@ -713,7 +713,7 @@ bool ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf, if( rMtf.GetActionSize() ) { - MapMode aMap( MAP_100TH_MM ); + MapMode aMap( MapUnit::Map100thMM ); ScopedVclPtrInstance< VirtualDevice > aVDev; const Size aLogSize1( aVDev->PixelToLogic( Size( 1, 1 ), aMap ) ); diff --git a/vcl/source/gdi/mapmod.cxx b/vcl/source/gdi/mapmod.cxx index 06523e0ead4c..e981a5d26253 100644 --- a/vcl/source/gdi/mapmod.cxx +++ b/vcl/source/gdi/mapmod.cxx @@ -49,7 +49,7 @@ MapMode::ImplMapMode::ImplMapMode() : maScaleX( 1, 1 ), maScaleY( 1, 1 ) { - meUnit = MAP_PIXEL; + meUnit = MapUnit::MapPixel; mbSimple = true; } @@ -134,38 +134,38 @@ double MapMode::GetUnitMultiplier() const double nMul; switch ( GetMapUnit() ) { - case MAP_PIXEL : - case MAP_SYSFONT : - case MAP_APPFONT : + case MapUnit::MapPixel : + case MapUnit::MapSysFont : + case MapUnit::MapAppFont : - case MAP_100TH_MM : + case MapUnit::Map100thMM : nMul = 1; break; - case MAP_10TH_MM : + case MapUnit::Map10thMM : nMul = 10; break; - case MAP_MM : + case MapUnit::MapMM : nMul = 100; break; - case MAP_CM : + case MapUnit::MapCM : nMul = 1000; break; - case MAP_1000TH_INCH : + case MapUnit::Map1000thInch : nMul = 2.54; break; - case MAP_100TH_INCH : + case MapUnit::Map100thInch : nMul = 25.4; break; - case MAP_10TH_INCH : + case MapUnit::Map10thInch : nMul = 254; break; - case MAP_INCH : + case MapUnit::MapInch : nMul = 2540; break; - case MAP_TWIP : + case MapUnit::MapTwip : nMul = 1.76388889; break; - case MAP_POINT : + case MapUnit::MapPoint : nMul = 35.27777778; break; default: @@ -215,7 +215,7 @@ SvStream& WriteMapMode( SvStream& rOStm, const MapMode& rMapMode ) { VersionCompat aCompat( rOStm, StreamMode::WRITE, 1 ); - rOStm.WriteUInt16( rMapMode.mpImplMapMode->meUnit ); + rOStm.WriteUInt16( (sal_uInt16)rMapMode.mpImplMapMode->meUnit ); WritePair( rOStm, rMapMode.mpImplMapMode->maOrigin ); WriteFraction( rOStm, rMapMode.mpImplMapMode->maScaleX ); WriteFraction( rOStm, rMapMode.mpImplMapMode->maScaleY ); diff --git a/vcl/source/gdi/oldprintadaptor.cxx b/vcl/source/gdi/oldprintadaptor.cxx index 2c0fedd478a8..1f354febbd25 100644 --- a/vcl/source/gdi/oldprintadaptor.cxx +++ b/vcl/source/gdi/oldprintadaptor.cxx @@ -57,7 +57,7 @@ OldStylePrintAdaptor::~OldStylePrintAdaptor() void OldStylePrintAdaptor::StartPage() { - Size aPaperSize( getPrinter()->PixelToLogic( getPrinter()->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) ); + Size aPaperSize( getPrinter()->PixelToLogic( getPrinter()->GetPaperSizePixel(), MapMode( MapUnit::Map100thMM ) ) ); mpData->maPages.push_back( AdaptorPage() ); mpData->maPages.back().maPageSize.Width = aPaperSize.getWidth(); mpData->maPages.back().maPageSize.Height = aPaperSize.getHeight(); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 66b79c0785c4..8a662bc01546 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -177,7 +177,7 @@ void doTestCode() aWriter.BeginStructureElement( PDFWriter::Document ); // set duration of 3 sec for first page aWriter.SetAutoAdvanceTime( 3 ); - aWriter.SetMapMode( MapMode( MAP_100TH_MM ) ); + aWriter.SetMapMode( MapMode( MapUnit::Map100thMM ) ); aWriter.SetFillColor( Color( COL_LIGHTRED ) ); aWriter.SetLineColor( Color( COL_LIGHTGREEN ) ); @@ -229,7 +229,7 @@ void doTestCode() aWriter.AddStream( "text/plain", new PDFTestOutputStream(), true ); // set transitional mode aWriter.SetPageTransition( PDFWriter::WipeRightToLeft, 1500 ); - aWriter.SetMapMode( MapMode( MAP_100TH_MM ) ); + aWriter.SetMapMode( MapMode( MapUnit::Map100thMM ) ); aWriter.SetTextColor( Color( COL_BLACK ) ); aWriter.SetFont( Font( OUString( "Times" ), Size( 0, 500 ) ) ); aWriter.DrawText( Rectangle( Point( 4500, 1500 ), Size( 12000, 3000 ) ), @@ -301,7 +301,7 @@ void doTestCode() for( int nY = 0; nY < 256; nY++ ) pAcc->SetPixel( nX, nY, BitmapColor( (sal_uInt8)((nX+nY)/2) ) ); aTransMask.ReleaseAccess( pAcc ); - aTransMask.SetPrefMapMode( MAP_MM ); + aTransMask.SetPrefMapMode( MapUnit::MapMM ); aTransMask.SetPrefSize( Size( 10, 10 ) ); aWriter.DrawBitmap( Point( 600, 13500 ), Size( 3000, 3000 ), aTransMask ); @@ -349,13 +349,13 @@ void doTestCode() aWriter.DrawPolyLine( aLIPoly, aLI ); aWriter.NewPage( 595, 842 ); - aWriter.SetMapMode( MapMode( MAP_100TH_MM ) ); + aWriter.SetMapMode( MapMode( MapUnit::Map100thMM ) ); Wallpaper aWall( aTransMask ); aWall.SetStyle( WallpaperStyle::Tile ); aWriter.DrawWallpaper( Rectangle( Point( 4400, 4200 ), Size( 10200, 6300 ) ), aWall ); aWriter.NewPage( 595, 842 ); - aWriter.SetMapMode( MapMode( MAP_100TH_MM ) ); + aWriter.SetMapMode( MapMode( MapUnit::Map100thMM ) ); aWriter.SetFont( Font( OUString( "Times" ), Size( 0, 500 ) ) ); aWriter.SetTextColor( Color( COL_BLACK ) ); aRect = Rectangle( Point( 4500, 6000 ), Size( 6000, 1500 ) ); @@ -1370,7 +1370,7 @@ template < class GEOMETRY > GEOMETRY lcl_convert( const MapMode& _rSource, const MapMode& _rDest, OutputDevice* _pPixelConversion, const GEOMETRY& _rObject ) { GEOMETRY aPoint; - if ( MAP_PIXEL == _rSource.GetMapUnit() ) + if ( MapUnit::MapPixel == _rSource.GetMapUnit() ) { aPoint = _pPixelConversion->PixelToLogic( _rObject, _rDest ); } @@ -1713,7 +1713,7 @@ void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal PDFWriter& i_rOuterFace) : m_pReferenceDevice( nullptr ), - m_aMapMode( MAP_POINT, Point(), Fraction( 1, pointToPixel(1) ), Fraction( 1, pointToPixel(1) ) ), + m_aMapMode( MapUnit::MapPoint, Point(), Fraction( 1, pointToPixel(1) ), Fraction( 1, pointToPixel(1) ) ), m_nCurrentStructElement( 0 ), m_bEmitStructure( true ), m_nNextFID( 1 ), @@ -2206,7 +2206,7 @@ OutputDevice* PDFWriterImpl::getReferenceDevice() pVDev->SetReferenceDevice( m_aContext.DPIx, m_aContext.DPIy ); pVDev->SetOutputSizePixel( Size( 640, 480 ) ); - pVDev->SetMapMode( MAP_MM ); + pVDev->SetMapMode( MapUnit::MapMM ); m_pReferenceDevice->mpPDFWriter = this; m_pReferenceDevice->ImplUpdateFontData(); @@ -3571,7 +3571,7 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const Physical OutputDevice* pRef = getReferenceDevice(); pRef->Push( PushFlags::FONT | PushFlags::MAPMODE ); - pRef->SetMapMode( MapMode( MAP_PIXEL ) ); + pRef->SetMapMode( MapMode( MapUnit::MapPixel ) ); Font aFont( pFont->GetFamilyName(), pFont->GetStyleName(), Size( 0, 1000 ) ); aFont.SetWeight( pFont->GetWeight() ); aFont.SetItalic( pFont->GetItalic() ); @@ -10792,7 +10792,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject ) ScopedVclPtrInstance< VirtualDevice > aDev; aDev->SetOutputSizePixel( rObject.m_aSize ); - aDev->SetMapMode( MapMode( MAP_PIXEL ) ); + aDev->SetMapMode( MapMode( MapUnit::MapPixel ) ); if( m_aContext.ColorMode == PDFWriter::DrawGreyscale ) aDev->SetDrawMode( aDev->GetDrawMode() | ( DrawModeFlags::GrayLine | DrawModeFlags::GrayFill | DrawModeFlags::GrayText | @@ -11546,7 +11546,7 @@ void PDFWriterImpl::drawBitmap( const Point& rDestPoint, const Size& rDestSize, sal_Int32 PDFWriterImpl::createGradient( const Gradient& rGradient, const Size& rSize ) { Size aPtSize( lcl_convert( m_aGraphicsStack.front().m_aMapMode, - MapMode( MAP_POINT ), + MapMode( MapUnit::MapPoint ), getReferenceDevice(), rSize ) ); // check if we already have this gradient diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index f72a4a1a3cb1..e7feb6ba99a3 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -107,7 +107,7 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz if( i_rContext.m_nMaxImageResolution > 50 ) { // do downsampling if necessary - const Size aDstSizeTwip( i_pDummyVDev->PixelToLogic( i_pDummyVDev->LogicToPixel( aSize ), MAP_TWIP ) ); + const Size aDstSizeTwip( i_pDummyVDev->PixelToLogic( i_pDummyVDev->LogicToPixel( aSize ), MapUnit::MapTwip ) ); const Size aBmpSize( aBitmapEx.GetSizePixel() ); const double fBmpPixelX = aBmpSize.Width(); const double fBmpPixelY = aBmpSize.Height(); @@ -427,7 +427,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa } else { - const Size aDstSizeTwip( pDummyVDev->PixelToLogic( pDummyVDev->LogicToPixel( rSize ), MAP_TWIP ) ); + const Size aDstSizeTwip( pDummyVDev->PixelToLogic( pDummyVDev->LogicToPixel( rSize ), MapUnit::MapTwip ) ); // i#115962# Always use at least 300 DPI for bitmap conversion of transparence gradients, // else the quality is not acceptable (see bugdoc as example) diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx index 00497a337b0a..c26a84129de4 100644 --- a/vcl/source/gdi/pngread.cxx +++ b/vcl/source/gdi/pngread.cxx @@ -90,7 +90,7 @@ private: sal_Int32 mnChunkLen; // Length of current PNG chunk Size maOrigSize; // pixel size of the full image Size maTargetSize; // pixel size of the result image - Size maPhysSize; // preferred size in MAP_100TH_MM units + Size maPhysSize; // preferred size in MapUnit::Map100thMM units sal_uInt32 mnBPP; // number of bytes per pixel sal_uInt32 mnScansize; // max size of scanline sal_uInt32 mnYpos; // latest y position in full image @@ -408,7 +408,7 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& rPreviewSizeHint ) { mbpHYs = true; - // convert into MAP_100TH_MM + // convert into MapUnit::Map100thMM maPhysSize.Width() = (sal_Int32)( (100000.0 * maOrigSize.Width()) / nXPixelPerMeter ); maPhysSize.Height() = (sal_Int32)( (100000.0 * maOrigSize.Height()) / nYPixelPerMeter ); } @@ -455,7 +455,7 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& rPreviewSizeHint ) if ( mbpHYs && maPhysSize.Width() && maPhysSize.Height() ) { - aRet.SetPrefMapMode( MAP_100TH_MM ); + aRet.SetPrefMapMode( MapUnit::Map100thMM ); aRet.SetPrefSize( maPhysSize ); } } diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx index a55cf09bd784..eddcaf7c81bb 100644 --- a/vcl/source/gdi/pngwrite.cxx +++ b/vcl/source/gdi/pngwrite.cxx @@ -358,7 +358,7 @@ void PNGWriterImpl::ImplWriteTransparent() void PNGWriterImpl::ImplWritepHYs(const BitmapEx& rBmpEx) { - if (rBmpEx.GetPrefMapMode() == MAP_100TH_MM) + if (rBmpEx.GetPrefMapMode() == MapUnit::Map100thMM) { Size aPrefSize(rBmpEx.GetPrefSize()); diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 3574c5100f40..45c771a037fe 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -253,7 +253,7 @@ void Printer::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly, mpAlphaVDev = pOldAlphaVDev; Rectangle aPolyRect( LogicToPixel( rPolyPoly ).GetBoundRect() ); - const Size aDPISize( LogicToPixel( Size( 1, 1 ), MAP_INCH ) ); + const Size aDPISize( LogicToPixel( Size( 1, 1 ), MapUnit::MapInch ) ); const long nBaseExtent = std::max( FRound( aDPISize.Width() / 300. ), 1L ); long nMove; const sal_uInt16 nTrans = ( nTransparencePercent < 13 ) ? 0 : @@ -1449,7 +1449,7 @@ bool Printer::SetPaperSizeUser( const Size& rSize, bool bMatchNearest ) return false; const Size aPixSize = LogicToPixel( rSize ); - const Size aPageSize = PixelToLogic( aPixSize, MAP_100TH_MM ); + const Size aPageSize = PixelToLogic( aPixSize, MapUnit::Map100thMM ); bool bNeedToChange(maJobSetup.ImplGetConstData().GetPaperWidth() != aPageSize.Width() || maJobSetup.ImplGetConstData().GetPaperHeight() != aPageSize.Height()); @@ -1542,7 +1542,7 @@ OUString Printer::GetPaperName( Paper ePaper ) OUString Printer::GetPaperName() const { - Size aPageSize = PixelToLogic( GetPaperSizePixel(), MAP_100TH_MM ); + Size aPageSize = PixelToLogic( GetPaperSizePixel(), MapUnit::Map100thMM ); Paper ePaper = ImplGetPaperFormat( aPageSize.Width(), aPageSize.Height() ); if( ePaper == PAPER_USER ) ePaper = ImplGetPaperFormat( aPageSize.Height(), aPageSize.Width() ); diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index 22cf699f7b2e..dbd07513906f 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -1111,7 +1111,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, if( mpPDFWriter ) { aTmpSize = mpPDFWriter->getCurPageSize(); - aTmpSize = LogicToPixel( aTmpSize, MapMode( MAP_POINT ) ); + aTmpSize = LogicToPixel( aTmpSize, MapMode( MapUnit::MapPoint ) ); // also add error code to PDFWriter mpPDFWriter->insertError( vcl::PDFWriter::Warning_Transparency_Converted ); diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 741038d77b6c..b9de9928cc76 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -434,7 +434,7 @@ bool Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, aMPS.nVerticalSpacing = nValue; aMPS.bDrawBorder = xController->getBoolProperty( "NUpDrawBorder", aMPS.bDrawBorder ); aMPS.nOrder = static_cast<NupOrderType>(xController->getIntProperty( "NUpSubPageOrder", (sal_Int32)aMPS.nOrder )); - aMPS.aPaperSize = xController->getPrinter()->PixelToLogic( xController->getPrinter()->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ); + aMPS.aPaperSize = xController->getPrinter()->PixelToLogic( xController->getPrinter()->GetPaperSizePixel(), MapMode( MapUnit::Map100thMM ) ); css::beans::PropertyValue* pPgSizeVal = xController->getValue( OUString( "NUpPaperSize" ) ); css::awt::Size aSizeVal; if( pPgSizeVal && (pPgSizeVal->Value >>= aSizeVal) ) @@ -782,7 +782,7 @@ void PrinterController::setPrinter( const VclPtr<Printer>& i_rPrinter ) css::uno::makeAny( OUString( i_rPrinter->GetName() ) ) ); mpImplData->mnDefaultPaperBin = mpImplData->mxPrinter->GetPaperBin(); mpImplData->mxPrinter->Push(); - mpImplData->mxPrinter->SetMapMode(MapMode(MAP_100TH_MM)); + mpImplData->mxPrinter->SetMapMode(MapMode(MapUnit::Map100thMM)); mpImplData->maDefaultPageSize = mpImplData->mxPrinter->GetPaperSize(); mpImplData->mxPrinter->Pop(); mpImplData->mnFixedPaperBin = -1; @@ -801,7 +801,7 @@ bool PrinterController::setupPrinter( vcl::Window* i_pParent ) if( mpImplData->mxPrinter.get() ) { mpImplData->mxPrinter->Push(); - mpImplData->mxPrinter->SetMapMode(MapMode(MAP_100TH_MM)); + mpImplData->mxPrinter->SetMapMode(MapMode(MapUnit::Map100thMM)); // get current data Size aPaperSize(mpImplData->mxPrinter->GetPaperSize()); @@ -928,7 +928,7 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons void vcl::ImplPrinterControllerData::resetPaperToLastConfigured() { mxPrinter->Push(); - mxPrinter->SetMapMode(MapMode(MAP_100TH_MM)); + mxPrinter->SetMapMode(MapMode(MapUnit::Map100thMM)); Size aCurSize(mxPrinter->GetPaperSize()); if (aCurSize != maDefaultPageSize) mxPrinter->SetPaperSizeUser(maDefaultPageSize, !isFixedPageSize()); @@ -937,7 +937,7 @@ void vcl::ImplPrinterControllerData::resetPaperToLastConfigured() int PrinterController::getPageCountProtected() const { - const MapMode aMapMode( MAP_100TH_MM ); + const MapMode aMapMode( MapUnit::Map100thMM ); mpImplData->mxPrinter->Push(); mpImplData->mxPrinter->SetMapMode( aMapMode ); @@ -948,7 +948,7 @@ int PrinterController::getPageCountProtected() const css::uno::Sequence< css::beans::PropertyValue > PrinterController::getPageParametersProtected( int i_nPage ) const { - const MapMode aMapMode( MAP_100TH_MM ); + const MapMode aMapMode( MapUnit::Map100thMM ); mpImplData->mxPrinter->Push(); mpImplData->mxPrinter->SetMapMode( aMapMode ); @@ -984,7 +984,7 @@ PrinterController::PageSize PrinterController::getPageFile( int i_nUnfilteredPag // get page parameters css::uno::Sequence< css::beans::PropertyValue > aPageParm( getPageParametersProtected( i_nUnfilteredPage ) ); - const MapMode aMapMode( MAP_100TH_MM ); + const MapMode aMapMode( MapUnit::Map100thMM ); mpImplData->mxPrinter->Push(); mpImplData->mxPrinter->SetMapMode( aMapMode ); @@ -1038,7 +1038,7 @@ static void appendSubPage( GDIMetaFile& o_rMtf, const Rectangle& i_rClipRect, GD { // save gstate o_rMtf.AddAction( new MetaPushAction( PushFlags::LINECOLOR | PushFlags::FILLCOLOR | PushFlags::CLIPREGION | PushFlags::MAPMODE ) ); - o_rMtf.AddAction( new MetaMapModeAction( MapMode( MAP_100TH_MM ) ) ); + o_rMtf.AddAction( new MetaMapModeAction( MapMode( MapUnit::Map100thMM ) ) ); Rectangle aBorderRect( i_rClipRect ); o_rMtf.AddAction( new MetaLineColorAction( Color( COL_BLACK ), true ) ); @@ -1077,7 +1077,7 @@ PrinterController::PageSize PrinterController::getFilteredPageFile( int i_nFilte return PrinterController::PageSize(); } Size aPaperSize = mpImplData->getRealPaperSize( aPageSize.aSize, true ); - mpImplData->mxPrinter->SetMapMode( MapMode( MAP_100TH_MM ) ); + mpImplData->mxPrinter->SetMapMode( MapMode( MapUnit::Map100thMM ) ); mpImplData->mxPrinter->SetPaperSizeUser( aPaperSize, ! mpImplData->isFixedPageSize() ); if( aPaperSize != aPageSize.aSize ) { @@ -1117,8 +1117,8 @@ PrinterController::PageSize PrinterController::getFilteredPageFile( int i_nFilte o_rMtf.Clear(); o_rMtf.SetPrefSize( aPaperSize ); - o_rMtf.SetPrefMapMode( MapMode( MAP_100TH_MM ) ); - o_rMtf.AddAction( new MetaMapModeAction( MapMode( MAP_100TH_MM ) ) ); + o_rMtf.SetPrefMapMode( MapMode( MapUnit::Map100thMM ) ); + o_rMtf.AddAction( new MetaMapModeAction( MapMode( MapUnit::Map100thMM ) ) ); int nDocPages = getPageCountProtected(); if (mpImplData->meJobState != css::view::PrintableState_JOB_STARTED) @@ -1187,7 +1187,7 @@ PrinterController::PageSize PrinterController::getFilteredPageFile( int i_nFilte o_rMtf.WindStart(); // subsequent getPageFile calls have changed the paper, reset it to current value - mpImplData->mxPrinter->SetMapMode( MapMode( MAP_100TH_MM ) ); + mpImplData->mxPrinter->SetMapMode( MapMode( MapUnit::Map100thMM ) ); mpImplData->mxPrinter->SetPaperSizeUser( aPaperSize, ! mpImplData->isFixedPageSize() ); return PrinterController::PageSize( aPaperSize, true ); @@ -1287,7 +1287,7 @@ void PrinterController::printFilteredPage( int i_nPage ) } // in N-Up printing set the correct page size - mpImplData->mxPrinter->SetMapMode( MAP_100TH_MM ); + mpImplData->mxPrinter->SetMapMode( MapUnit::Map100thMM ); // aPageSize was filtered through mpImplData->getRealPaperSize already by getFilteredPageFile() mpImplData->mxPrinter->SetPaperSizeUser( aPageSize.aSize, ! mpImplData->isFixedPageSize() ); if( mpImplData->mnFixedPaperBin != -1 && diff --git a/vcl/source/gdi/svgdata.cxx b/vcl/source/gdi/svgdata.cxx index 1e08433bf83d..cf85eeb6be8e 100644 --- a/vcl/source/gdi/svgdata.cxx +++ b/vcl/source/gdi/svgdata.cxx @@ -58,7 +58,7 @@ BitmapEx convertPrimitive2DSequenceToBitmapEx( aRealRect.Y2 = rTargetRange.getMaxY(); // get system DPI - const Size aDPI(Application::GetDefaultDevice()->LogicToPixel(Size(1, 1), MAP_INCH)); + const Size aDPI(Application::GetDefaultDevice()->LogicToPixel(Size(1, 1), MapUnit::MapInch)); const uno::Reference< rendering::XBitmap > xBitmap( xPrimitive2DRenderer->rasterize( diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx index 37bcd08af1c2..0ed8e5f94cef 100644 --- a/vcl/source/gdi/svmconverter.cxx +++ b/vcl/source/gdi/svmconverter.cxx @@ -146,7 +146,7 @@ void ImplReadMapMode( SvStream& rIStm, MapMode& rMapMode ) void ImplWriteMapMode( SvStream& rOStm, const MapMode& rMapMode ) { - rOStm.WriteInt16( rMapMode.GetMapUnit() ); + rOStm.WriteInt16( (sal_uInt16)rMapMode.GetMapUnit() ); WritePair( rOStm, rMapMode.GetOrigin() ); rOStm.WriteInt32( rMapMode.GetScaleX().GetNumerator() ); rOStm.WriteInt32( rMapMode.GetScaleX().GetDenominator() ); diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx index 6129fa0fa1d5..4d9783e188b9 100644 --- a/vcl/source/gdi/textlayout.cxx +++ b/vcl/source/gdi/textlayout.cxx @@ -129,26 +129,26 @@ namespace vcl // also, use a higher-resolution map unit than "pixels", which should save us some rounding errors when // translating coordinates between the reference device and the target device. - OSL_ENSURE( aTargetMapMode.GetMapUnit() == MAP_PIXEL, + OSL_ENSURE( aTargetMapMode.GetMapUnit() == MapUnit::MapPixel, "ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: this class is not expected to work with such target devices!" ); // we *could* adjust all the code in this class to handle this case, but at the moment, it's not necessary const MapUnit eTargetMapUnit = m_rReferenceDevice.GetMapMode().GetMapUnit(); aTargetMapMode.SetMapUnit( eTargetMapUnit ); - OSL_ENSURE( aTargetMapMode.GetMapUnit() != MAP_PIXEL, + OSL_ENSURE( aTargetMapMode.GetMapUnit() != MapUnit::MapPixel, "ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: a reference device which has map mode PIXEL?!" ); m_rTargetDevice.SetMapMode( aTargetMapMode ); // now that the Zoom is part of the map mode, reset the target device's font to the "unzoomed" version Font aDrawFont( m_aUnzoomedPointFont ); - aDrawFont.SetFontSize( OutputDevice::LogicToLogic( aDrawFont.GetFontSize(), MAP_POINT, eTargetMapUnit ) ); + aDrawFont.SetFontSize( OutputDevice::LogicToLogic( aDrawFont.GetFontSize(), MapUnit::MapPoint, eTargetMapUnit ) ); _rTargetDevice.SetFont( aDrawFont ); // transfer font to the reference device m_rReferenceDevice.Push( PushFlags::FONT | PushFlags::TEXTLAYOUTMODE ); Font aRefFont( m_aUnzoomedPointFont ); aRefFont.SetFontSize( OutputDevice::LogicToLogic( - aRefFont.GetFontSize(), MAP_POINT, m_rReferenceDevice.GetMapMode().GetMapUnit() ) ); + aRefFont.GetFontSize(), MapUnit::MapPoint, m_rReferenceDevice.GetMapMode().GetMapUnit() ) ); m_rReferenceDevice.SetFont( aRefFont ); } diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index 387bf0d97f98..8a5e1d53e0f9 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -196,7 +196,7 @@ Bitmap OutputDevice::GetDownsampledBitmap( const Size& rDstSz, if( !aBmp.IsEmpty() ) { // do downsampling if necessary - Size aDstSizeTwip( PixelToLogic( LogicToPixel( rDstSz ), MAP_TWIP ) ); + Size aDstSizeTwip( PixelToLogic( LogicToPixel( rDstSz ), MapUnit::MapTwip ) ); // #103209# Normalize size (mirroring has to happen outside of this method) aDstSizeTwip = Size( labs(aDstSizeTwip.Width()), labs(aDstSizeTwip.Height()) ); @@ -1199,14 +1199,14 @@ void OutputDevice::DrawTransformedBitmapEx( basegfx::fround(aScale.getX() + aTranslate.getX()) - aDestPt.X(), basegfx::fround(aScale.getY() + aTranslate.getY()) - aDestPt.Y()); const Point aOrigin = GetMapMode().GetOrigin(); - if (comphelper::LibreOfficeKit::isActive() && GetMapMode().GetMapUnit() != MAP_PIXEL) + if (comphelper::LibreOfficeKit::isActive() && GetMapMode().GetMapUnit() != MapUnit::MapPixel) { aDestPt.Move(aOrigin.getX(), aOrigin.getY()); EnableMapMode(false); } DrawBitmapEx(aDestPt, aDestSize, rBitmapEx); - if (comphelper::LibreOfficeKit::isActive() && GetMapMode().GetMapUnit() != MAP_PIXEL) + if (comphelper::LibreOfficeKit::isActive() && GetMapMode().GetMapUnit() != MapUnit::MapPixel) { EnableMapMode(); aDestPt.Move(-aOrigin.getX(), -aOrigin.getY()); diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 8f7fea70cd1a..36f1602de603 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -118,7 +118,7 @@ Size OutputDevice::GetDevFontSize( const vcl::Font& rFont, int nSizeIndex ) cons if ( mbMap ) { aSize.Height() *= 10; - MapMode aMap( MAP_10TH_INCH, Point(), Fraction( 1, 72 ), Fraction( 1, 72 ) ); + MapMode aMap( MapUnit::Map10thInch, Point(), Fraction( 1, 72 ), Fraction( 1, 72 ) ); aSize = PixelToLogic( aSize, aMap ); aSize.Height() += 5; aSize.Height() /= 10; diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx index 24ca3306604e..c66565093596 100644 --- a/vcl/source/outdev/map.cxx +++ b/vcl/source/outdev/map.cxx @@ -28,12 +28,14 @@ #include <outdev.h> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <o3tl/enumarray.hxx> -static int const s_ImplArySize = MAP_PIXEL+1; -static const long aImplNumeratorAry[s_ImplArySize] = - { 1, 1, 5, 50, 1, 1, 1, 1, 1, 1, 1 }; -static const long aImplDenominatorAry[s_ImplArySize] = - { 2540, 254, 127, 127, 1000, 100, 10, 1, 72, 1440, 1 }; +// we don't actually handle units beyond, hence the zeros in the arrays +static const MapUnit s_MaxValidUnit = MapUnit::MapPixel; +static const o3tl::enumarray<MapUnit,long> aImplNumeratorAry = + { 1, 1, 5, 50, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 }; +static const o3tl::enumarray<MapUnit,long> aImplDenominatorAry = + { 2540, 254, 127, 127, 1000, 100, 10, 1, 72, 1440, 1, 0, 0, 0 }; /* Reduces accuracy until it is a fraction (should become @@ -148,76 +150,76 @@ static void ImplCalcMapResolution( const MapMode& rMapMode, rMapRes.mfScaleY = 1.0; switch ( rMapMode.GetMapUnit() ) { - case MAP_RELATIVE: + case MapUnit::MapRelative: break; - case MAP_100TH_MM: + case MapUnit::Map100thMM: rMapRes.mnMapScNumX = 1; rMapRes.mnMapScDenomX = 2540; rMapRes.mnMapScNumY = 1; rMapRes.mnMapScDenomY = 2540; break; - case MAP_10TH_MM: + case MapUnit::Map10thMM: rMapRes.mnMapScNumX = 1; rMapRes.mnMapScDenomX = 254; rMapRes.mnMapScNumY = 1; rMapRes.mnMapScDenomY = 254; break; - case MAP_MM: + case MapUnit::MapMM: rMapRes.mnMapScNumX = 5; // 10 rMapRes.mnMapScDenomX = 127; // 254 rMapRes.mnMapScNumY = 5; // 10 rMapRes.mnMapScDenomY = 127; // 254 break; - case MAP_CM: + case MapUnit::MapCM: rMapRes.mnMapScNumX = 50; // 100 rMapRes.mnMapScDenomX = 127; // 254 rMapRes.mnMapScNumY = 50; // 100 rMapRes.mnMapScDenomY = 127; // 254 break; - case MAP_1000TH_INCH: + case MapUnit::Map1000thInch: rMapRes.mnMapScNumX = 1; rMapRes.mnMapScDenomX = 1000; rMapRes.mnMapScNumY = 1; rMapRes.mnMapScDenomY = 1000; break; - case MAP_100TH_INCH: + case MapUnit::Map100thInch: rMapRes.mnMapScNumX = 1; rMapRes.mnMapScDenomX = 100; rMapRes.mnMapScNumY = 1; rMapRes.mnMapScDenomY = 100; break; - case MAP_10TH_INCH: + case MapUnit::Map10thInch: rMapRes.mnMapScNumX = 1; rMapRes.mnMapScDenomX = 10; rMapRes.mnMapScNumY = 1; rMapRes.mnMapScDenomY = 10; break; - case MAP_INCH: + case MapUnit::MapInch: rMapRes.mnMapScNumX = 1; rMapRes.mnMapScDenomX = 1; rMapRes.mnMapScNumY = 1; rMapRes.mnMapScDenomY = 1; break; - case MAP_POINT: + case MapUnit::MapPoint: rMapRes.mnMapScNumX = 1; rMapRes.mnMapScDenomX = 72; rMapRes.mnMapScNumY = 1; rMapRes.mnMapScDenomY = 72; break; - case MAP_TWIP: + case MapUnit::MapTwip: rMapRes.mnMapScNumX = 1; rMapRes.mnMapScDenomX = 1440; rMapRes.mnMapScNumY = 1; rMapRes.mnMapScDenomY = 1440; break; - case MAP_PIXEL: + case MapUnit::MapPixel: rMapRes.mnMapScNumX = 1; rMapRes.mnMapScDenomX = nDPIX; rMapRes.mnMapScNumY = 1; rMapRes.mnMapScDenomY = nDPIY; break; - case MAP_SYSFONT: - case MAP_APPFONT: + case MapUnit::MapSysFont: + case MapUnit::MapAppFont: { ImplSVData* pSVData = ImplGetSVData(); if ( !pSVData->maGDIData.mnAppFontX ) @@ -246,7 +248,7 @@ static void ImplCalcMapResolution( const MapMode& rMapMode, // set offset according to MapMode Point aOrigin = rMapMode.GetOrigin(); - if ( rMapMode.GetMapUnit() != MAP_RELATIVE ) + if ( rMapMode.GetMapUnit() != MapUnit::MapRelative ) { rMapRes.mnMapOfsX = aOrigin.X(); rMapRes.mnMapOfsY = aOrigin.Y(); @@ -694,7 +696,7 @@ void OutputDevice::SetMapMode() void OutputDevice::SetMapMode( const MapMode& rNewMapMode ) { - bool bRelMap = (rNewMapMode.GetMapUnit() == MAP_RELATIVE); + bool bRelMap = (rNewMapMode.GetMapUnit() == MapUnit::MapRelative); if ( mpMetaFile ) { @@ -817,11 +819,11 @@ void OutputDevice::SetRelativeMapMode( const MapMode& rNewMapMode ) Point aPt( LogicToLogic( Point(), nullptr, &rNewMapMode ) ); if ( eNew != eOld ) { - if ( eOld > MAP_PIXEL ) + if ( eOld > MapUnit::MapPixel ) { SAL_WARN( "vcl.gdi", "Not implemented MapUnit" ); } - else if ( eNew > MAP_PIXEL ) + else if ( eNew > MapUnit::MapPixel ) { SAL_WARN( "vcl.gdi", "Not implemented MapUnit" ); } @@ -835,12 +837,12 @@ void OutputDevice::SetRelativeMapMode( const MapMode& rNewMapMode ) aXF.GetDenominator(), aF.GetDenominator() ); aYF = ImplMakeFraction( aYF.GetNumerator(), aF.GetNumerator(), aYF.GetDenominator(), aF.GetDenominator() ); - if ( eOld == MAP_PIXEL ) + if ( eOld == MapUnit::MapPixel ) { aXF *= Fraction( mnDPIX, 1 ); aYF *= Fraction( mnDPIY, 1 ); } - else if ( eNew == MAP_PIXEL ) + else if ( eNew == MapUnit::MapPixel ) { aXF *= Fraction( 1, mnDPIX ); aYF *= Fraction( 1, mnDPIY ); @@ -848,7 +850,7 @@ void OutputDevice::SetRelativeMapMode( const MapMode& rNewMapMode ) } } - MapMode aNewMapMode( MAP_RELATIVE, Point( -aPt.X(), -aPt.Y() ), aXF, aYF ); + MapMode aNewMapMode( MapUnit::MapRelative, Point( -aPt.X(), -aPt.Y() ), aXF, aYF ); SetMapMode( aNewMapMode ); if ( eNew != eOld ) @@ -1480,7 +1482,7 @@ basegfx::B2DPolyPolygon OutputDevice::PixelToLogic( const basegfx::B2DPolyPolygo \ if ( !mbMap || pMapModeSource != &maMapMode ) \ { \ - if ( pMapModeSource->GetMapUnit() == MAP_RELATIVE ) \ + if ( pMapModeSource->GetMapUnit() == MapUnit::MapRelative ) \ aMapResSource = maMapRes; \ ImplCalcMapResolution( *pMapModeSource, \ mnDPIX, mnDPIY, aMapResSource ); \ @@ -1489,7 +1491,7 @@ basegfx::B2DPolyPolygon OutputDevice::PixelToLogic( const basegfx::B2DPolyPolygo aMapResSource = maMapRes; \ if ( !mbMap || pMapModeDest != &maMapMode ) \ { \ - if ( pMapModeDest->GetMapUnit() == MAP_RELATIVE ) \ + if ( pMapModeDest->GetMapUnit() == MapUnit::MapRelative ) \ aMapResDest = maMapRes; \ ImplCalcMapResolution( *pMapModeDest, \ mnDPIX, mnDPIY, aMapResDest ); \ @@ -1501,35 +1503,35 @@ static void verifyUnitSourceDest( MapUnit eUnitSource, MapUnit eUnitDest ) { (void) eUnitSource; (void) eUnitDest; - DBG_ASSERT( eUnitSource != MAP_SYSFONT - && eUnitSource != MAP_APPFONT - && eUnitSource != MAP_RELATIVE, + DBG_ASSERT( eUnitSource != MapUnit::MapSysFont + && eUnitSource != MapUnit::MapAppFont + && eUnitSource != MapUnit::MapRelative, "Source MapUnit is not permitted" ); - DBG_ASSERT( eUnitDest != MAP_SYSFONT - && eUnitDest != MAP_APPFONT - && eUnitDest != MAP_RELATIVE, + DBG_ASSERT( eUnitDest != MapUnit::MapSysFont + && eUnitDest != MapUnit::MapAppFont + && eUnitDest != MapUnit::MapRelative, "Destination MapUnit is not permitted" ); - SAL_WARN_IF( eUnitSource == MAP_PIXEL, "vcl", - "MAP_PIXEL approximated with 72dpi" ); - SAL_WARN_IF( eUnitDest == MAP_PIXEL, "vcl", - "MAP_PIXEL approximated with 72dpi" ); + SAL_WARN_IF( eUnitSource == MapUnit::MapPixel, "vcl", + "MapUnit::MapPixel approximated with 72dpi" ); + SAL_WARN_IF( eUnitDest == MapUnit::MapPixel, "vcl", + "MapUnit::MapPixel approximated with 72dpi" ); } #define ENTER3( eUnitSource, eUnitDest ) \ long nNumerator = 1; \ long nDenominator = 1; \ - SAL_WARN_IF( eUnitSource >= s_ImplArySize, "vcl", "Invalid source map unit"); \ - SAL_WARN_IF( eUnitDest >= s_ImplArySize, "vcl", "Invalid destination map unit"); \ - if( (eUnitSource < s_ImplArySize) && (eUnitDest < s_ImplArySize) ) \ + SAL_WARN_IF( eUnitSource > s_MaxValidUnit, "vcl", "Invalid source map unit"); \ + SAL_WARN_IF( eUnitDest > s_MaxValidUnit, "vcl", "Invalid destination map unit"); \ + if( (eUnitSource <= s_MaxValidUnit) && (eUnitDest <= s_MaxValidUnit) ) \ { \ nNumerator = aImplNumeratorAry[eUnitSource] * \ aImplDenominatorAry[eUnitDest]; \ nDenominator = aImplNumeratorAry[eUnitDest] * \ aImplDenominatorAry[eUnitSource]; \ } \ - if ( eUnitSource == MAP_PIXEL ) \ + if ( eUnitSource == MapUnit::MapPixel ) \ nDenominator *= 72; \ - else if( eUnitDest == MAP_PIXEL ) \ + else if( eUnitDest == MapUnit::MapPixel ) \ nNumerator *= 72 #define ENTER4( rMapModeSource, rMapModeDest ) \ @@ -1951,7 +1953,7 @@ namespace vcl { long Window::ImplLogicUnitToPixelX( long nX, MapUnit eUnit ) { - if ( eUnit != MAP_PIXEL ) + if ( eUnit != MapUnit::MapPixel ) { ImplFrameData* pFrameData = mpWindowImpl->mpFrameData; @@ -1976,7 +1978,7 @@ long Window::ImplLogicUnitToPixelX( long nX, MapUnit eUnit ) long Window::ImplLogicUnitToPixelY( long nY, MapUnit eUnit ) { - if ( eUnit != MAP_PIXEL ) + if ( eUnit != MapUnit::MapPixel ) { ImplFrameData* pFrameData = mpWindowImpl->mpFrameData; diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 6c8137328bda..8b03032efbd6 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -2713,7 +2713,7 @@ bool OutputDevice::GetTextOutlines( basegfx::B2DPolyPolygonVector& rVector, if( bOptimize ) { aFont.SetFontSize( Size( 0, GLYPH_FONT_HEIGHT ) ); - aVDev->SetMapMode( MAP_PIXEL ); + aVDev->SetMapMode( MapUnit::MapPixel ); } aVDev->SetFont( aFont ); aVDev->SetTextAlign( ALIGN_TOP ); diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx index 9c9c7e439a16..e40d3b56cbae 100644 --- a/vcl/source/window/decoview.cxx +++ b/vcl/source/window/decoview.cxx @@ -510,7 +510,7 @@ void ImplDrawButton( OutputDevice *const pDev, Rectangle aFillRect, Size aBrdSize( 1, 1 ); if ( pDev->GetOutDevType() == OUTDEV_PRINTER ) { - aBrdSize = pDev->LogicToPixel( Size( 20, 20 ), MapMode(MAP_100TH_MM) ); + aBrdSize = pDev->LogicToPixel( Size( 20, 20 ), MapMode(MapUnit::Map100thMM) ); if ( !aBrdSize.Width() ) aBrdSize.Width() = 1; if ( !aBrdSize.Height() ) diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index f069b5583241..af27e481071d 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -377,7 +377,7 @@ void DockingWindow::ImplLoadRes( const ResId& rResId ) { // use Sizes of the Resource Point aPos; - MapUnit ePosMap = MAP_PIXEL; + MapUnit ePosMap = MapUnit::MapPixel; if ( RSC_DOCKINGWINDOW_XYMAPMODE & nMask ) ePosMap = (MapUnit)ReadLongRes(); diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index a0167833edc4..f412db46a7cd 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -894,7 +894,7 @@ void MenuBarWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) { rRenderContext.Push(PushFlags::LINECOLOR | PushFlags::MAPMODE); rRenderContext.SetLineColor(Color(COL_WHITE)); - rRenderContext.SetMapMode(MapMode(MAP_PIXEL)); + rRenderContext.SetMapMode(MapMode(MapUnit::MapPixel)); Size aSize = GetSizePixel(); rRenderContext.DrawLine(Point(0, aSize.Height() - 1), Point(aSize.Width() - 1, aSize.Height() - 1)); diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index 96054a2b37ae..af0896c69ece 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -123,7 +123,7 @@ PaintBufferGuard::~PaintBufferGuard() { // Make sure that the +1 value GetSize() adds to the size is in pixels. Size aPaintRectSize; - if (m_pWindow->GetMapMode().GetMapUnit() == MAP_PIXEL) + if (m_pWindow->GetMapMode().GetMapUnit() == MapUnit::MapPixel) { aPaintRectSize = m_aPaintRect.GetSize(); } @@ -1338,8 +1338,8 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP bool bOutput = IsOutputEnabled(); EnableOutput(); - SAL_WARN_IF( GetMapMode().GetMapUnit() != MAP_PIXEL, "vcl", "MapMode must be PIXEL based" ); - if ( GetMapMode().GetMapUnit() != MAP_PIXEL ) + SAL_WARN_IF( GetMapMode().GetMapUnit() != MapUnit::MapPixel, "vcl", "MapMode must be PIXEL based" ); + if ( GetMapMode().GetMapUnit() != MapUnit::MapPixel ) return; // preserve graphicsstate diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 19d292c68c1e..d0abe927796a 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -233,18 +233,18 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi // use correct measurements const LocaleDataWrapper& rLocWrap( GetSettings().GetLocaleDataWrapper() ); - MapUnit eUnit = MAP_MM; + MapUnit eUnit = MapUnit::MapMM; int nDigits = 0; if( rLocWrap.getMeasurementSystemEnum() == MEASURE_US ) { - eUnit = MAP_100TH_INCH; + eUnit = MapUnit::Map100thInch; nDigits = 2; } - Size aLogicPaperSize( LogicToLogic( i_rOrigSize, MapMode( MAP_100TH_MM ), MapMode( eUnit ) ) ); + Size aLogicPaperSize( LogicToLogic( i_rOrigSize, MapMode( MapUnit::Map100thMM ), MapMode( eUnit ) ) ); OUString aNumText( rLocWrap.getNum( aLogicPaperSize.Width(), nDigits ) ); aBuf.append( aNumText ) .append( sal_Unicode( ' ' ) ); - aBuf.appendAscii( eUnit == MAP_MM ? "mm" : "in" ); + aBuf.appendAscii( eUnit == MapUnit::MapMM ? "mm" : "in" ); if( !i_rPaperName.isEmpty() ) { aBuf.append( " (" ); @@ -256,7 +256,7 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi aNumText = rLocWrap.getNum( aLogicPaperSize.Height(), nDigits ); aBuf.append( aNumText ) .append( sal_Unicode( ' ' ) ); - aBuf.appendAscii( eUnit == MAP_MM ? "mm" : "in" ); + aBuf.appendAscii( eUnit == MapUnit::MapMM ? "mm" : "in" ); maVertDim->SetText( aBuf.makeStringAndClear() ); Resize(); @@ -269,7 +269,7 @@ void PrintDialog::PrintPreviewWindow::preparePreviewBitmap() GDIMetaFile aMtf( maMtf ); Size aVDevSize( maPageVDev->GetOutputSizePixel() ); - const Size aLogicSize( maPageVDev->PixelToLogic( aVDevSize, MapMode( MAP_100TH_MM ) ) ); + const Size aLogicSize( maPageVDev->PixelToLogic( aVDevSize, MapMode( MapUnit::Map100thMM ) ) ); Size aOrigSize( maOrigSize ); if( aOrigSize.Width() < 1 ) aOrigSize.Width() = aLogicSize.Width(); @@ -279,7 +279,7 @@ void PrintDialog::PrintPreviewWindow::preparePreviewBitmap() maPageVDev->Erase(); maPageVDev->Push(); - maPageVDev->SetMapMode( MAP_100TH_MM ); + maPageVDev->SetMapMode( MapUnit::Map100thMM ); DrawModeFlags nOldDrawMode = maPageVDev->GetDrawMode(); if( mbGreyscale ) maPageVDev->SetDrawMode( maPageVDev->GetDrawMode() | @@ -296,8 +296,8 @@ void PrintDialog::PrintPreviewWindow::preparePreviewBitmap() maPageVDev->Pop(); - SetMapMode( MAP_PIXEL ); - maPageVDev->SetMapMode( MAP_PIXEL ); + SetMapMode( MapUnit::MapPixel ); + maPageVDev->SetMapMode( MapUnit::MapPixel ); maPreviewBitmap = Bitmap(maPageVDev->GetBitmap(Point(0, 0), aVDevSize)); @@ -327,7 +327,7 @@ void PrintDialog::ShowNupOrderWindow::Paint(vcl::RenderContext& rRenderContext, { Window::Paint(rRenderContext, i_rRect); - rRenderContext.SetMapMode(MAP_PIXEL); + rRenderContext.SetMapMode(MapUnit::MapPixel); rRenderContext.SetTextColor(rRenderContext.GetSettings().GetStyleSettings().GetFieldTextColor()); int nPages = mnRows * mnColumns; @@ -653,7 +653,7 @@ PrintDialog::PrintDialog( vcl::Window* i_pParent, const std::shared_ptr<PrinterC // setup sizes for N-Up Size aNupSize( maPController->getPrinter()->PixelToLogic( - maPController->getPrinter()->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) ); + maPController->getPrinter()->GetPaperSizePixel(), MapMode( MapUnit::Map100thMM ) ) ); if( maPController->getPrinter()->GetOrientation() == Orientation::Landscape ) { maNupLandscapeSize = aNupSize; @@ -1328,7 +1328,7 @@ void PrintDialog::preparePreview( bool i_bNewPage, bool i_bMayUseCache ) if( i_bNewPage ) { - const MapMode aMapMode( MAP_100TH_MM ); + const MapMode aMapMode( MapUnit::Map100thMM ); GDIMetaFile aMtf; VclPtr<Printer> aPrt( maPController->getPrinter() ); if( nPages > 0 ) @@ -1342,7 +1342,7 @@ void PrintDialog::preparePreview( bool i_bNewPage, bool i_bMayUseCache ) } } - Size aCurPageSize = aPrt->PixelToLogic( aPrt->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ); + Size aCurPageSize = aPrt->PixelToLogic( aPrt->GetPaperSizePixel(), MapMode( MapUnit::Map100thMM ) ); mpPreviewWindow->setPreview( aMtf, aCurPageSize, aPrt->GetPaperName(), nPages > 0 ? OUString() : maNoPageStr, @@ -1916,7 +1916,7 @@ PrintProgressDialog::PrintProgressDialog(vcl::Window* i_pParent, int i_nMax) mpText->set_width_request(mpText->get_preferred_size().Width()); //Pick a useful max width - mpProgress->set_width_request(mpProgress->LogicToPixel(Size(100, 0), MapMode(MAP_APPFONT)).Width()); + mpProgress->set_width_request(mpProgress->LogicToPixel(Size(100, 0), MapMode(MapUnit::MapAppFont)).Width()); mpButton->SetClickHdl( LINK( this, PrintProgressDialog, ClickHdl ) ); diff --git a/vcl/source/window/resource.cxx b/vcl/source/window/resource.cxx index 12536be7b543..abc5eed43d08 100644 --- a/vcl/source/window/resource.cxx +++ b/vcl/source/window/resource.cxx @@ -85,7 +85,7 @@ void Window::ImplLoadRes( const ResId& rResId ) if ( nObjMask & (RscWindowFlags::XYMapMode | RscWindowFlags::X | RscWindowFlags::Y) ) { // use size as per resource - MapUnit ePosMap = MAP_PIXEL; + MapUnit ePosMap = MapUnit::MapPixel; bPos = true; @@ -100,7 +100,7 @@ void Window::ImplLoadRes( const ResId& rResId ) if ( nObjMask & (RscWindowFlags::WHMapMode | RscWindowFlags::Width | RscWindowFlags::Height) ) { // use size as per resource - MapUnit eSizeMap = MAP_PIXEL; + MapUnit eSizeMap = MapUnit::MapPixel; bSize = true; diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 2e1b9d527101..7086612e1f7e 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -1044,7 +1044,7 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p mpWindowImpl->mpFrameData->mnFirstMouseCode = 0; mpWindowImpl->mpFrameData->mnMouseCode = 0; mpWindowImpl->mpFrameData->mnMouseMode = MouseEventModifiers::NONE; - mpWindowImpl->mpFrameData->meMapUnit = MAP_PIXEL; + mpWindowImpl->mpFrameData->meMapUnit = MapUnit::MapPixel; mpWindowImpl->mpFrameData->mbHasFocus = false; mpWindowImpl->mpFrameData->mbInMouseMove = false; mpWindowImpl->mpFrameData->mbMouseIn = false; diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 1c71a6497a1d..b668704f6e4e 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -646,7 +646,7 @@ vcl::Font Window::GetDrawPixelFont(OutputDevice* pDev) const { vcl::Font aFont = GetPointFont(*const_cast<Window*>(this)); Size aFontSize = aFont.GetFontSize(); - MapMode aPtMapMode(MAP_POINT); + MapMode aPtMapMode(MapUnit::MapPoint); aFontSize = pDev->LogicToPixel( aFontSize, aPtMapMode ); aFont.SetFontSize( aFontSize ); return aFont; @@ -657,7 +657,7 @@ long Window::GetDrawPixel( OutputDevice* pDev, long nPixels ) const long nP = nPixels; if ( pDev->GetOutDevType() != OUTDEV_WINDOW ) { - MapMode aMap( MAP_100TH_MM ); + MapMode aMap( MapUnit::Map100thMM ); Size aSz( nP, 0 ); aSz = PixelToLogic( aSz, aMap ); aSz = pDev->LogicToPixel( aSz, aMap ); diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx index 17ca9cddae49..d0cedec3ed20 100644 --- a/vcl/unx/generic/print/genprnpsp.cxx +++ b/vcl/unx/generic/print/genprnpsp.cxx @@ -1103,7 +1103,7 @@ bool PspSalPrinter::StartJob( const OUString* i_pFileName, const OUString& i_rJo } else { - xPrinter->SetMapMode( MapMode( MAP_100TH_MM ) ); + xPrinter->SetMapMode( MapMode( MapUnit::Map100thMM ) ); xPrinter->SetPaperSizeUser( aPageSize.aSize, true ); PDFNewJobParameters aNewParm(xPrinter->GetPaperSize(), xPrinter->GetPaperBin()); diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx index 0d67499f8149..71a7fc84dd8e 100644 --- a/vcl/workben/svptest.cxx +++ b/vcl/workben/svptest.cxx @@ -230,7 +230,7 @@ void MyWin::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) WorkWindow::Paint(rRenderContext, rRect); rRenderContext.Push(); - MapMode aMapMode(MAP_100TH_MM); + MapMode aMapMode(MapUnit::Map100thMM); rRenderContext.SetMapMode(aMapMode); |