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 /svtools | |
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 'svtools')
27 files changed, 162 insertions, 162 deletions
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index dc22ff3a391d..cfc4ab9b6320 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -682,8 +682,8 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, // (as it is based on the settings of our data window, not the foreign device) if (!nDataRowHeight) ImpGetDataRowHeight(); - long nHeightLogic = PixelToLogic(Size(0, nDataRowHeight), MAP_10TH_MM).Height(); - long nForeignHeightPixel = pDev->LogicToPixel(Size(0, nHeightLogic), MAP_10TH_MM).Height(); + long nHeightLogic = PixelToLogic(Size(0, nDataRowHeight), MapUnit::Map10thMM).Height(); + long nForeignHeightPixel = pDev->LogicToPixel(Size(0, nHeightLogic), MapUnit::Map10thMM).Height(); long nOriginalHeight = nDataRowHeight; nDataRowHeight = nForeignHeightPixel; @@ -694,8 +694,8 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, { BrowserColumn* pCurrent = (*pCols)[ nPos ]; - long nWidthLogic = PixelToLogic(Size(pCurrent->Width(), 0), MAP_10TH_MM).Width(); - long nForeignWidthPixel = pDev->LogicToPixel(Size(nWidthLogic, 0), MAP_10TH_MM).Width(); + long nWidthLogic = PixelToLogic(Size(pCurrent->Width(), 0), MapUnit::Map10thMM).Width(); + long nForeignWidthPixel = pDev->LogicToPixel(Size(nWidthLogic, 0), MapUnit::Map10thMM).Width(); pCurrent->SetWidth(nForeignWidthPixel, GetZoom()); if ( pBar ) @@ -712,8 +712,8 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, if ( pBar ) { // the title height with respect to the font set for the given device - long nTitleHeight = PixelToLogic(Size(0, GetTitleHeight()), MAP_10TH_MM).Height(); - nTitleHeight = pDev->LogicToPixel(Size(0, nTitleHeight), MAP_10TH_MM).Height(); + long nTitleHeight = PixelToLogic(Size(0, GetTitleHeight()), MapUnit::Map10thMM).Height(); + nTitleHeight = pDev->LogicToPixel(Size(0, nTitleHeight), MapUnit::Map10thMM).Height(); BrowserColumn* pFirstCol = !pCols->empty() ? (*pCols)[ 0 ] : nullptr; @@ -773,8 +773,8 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, { BrowserColumn* pCurrent = (*pCols)[ nPos ]; - long nForeignWidthLogic = pDev->PixelToLogic(Size(pCurrent->Width(), 0), MAP_10TH_MM).Width(); - long nWidthPixel = LogicToPixel(Size(nForeignWidthLogic, 0), MAP_10TH_MM).Width(); + long nForeignWidthLogic = pDev->PixelToLogic(Size(pCurrent->Width(), 0), MapUnit::Map10thMM).Width(); + long nWidthPixel = LogicToPixel(Size(nForeignWidthLogic, 0), MapUnit::Map10thMM).Width(); pCurrent->SetWidth(nWidthPixel, GetZoom()); if ( pBar ) diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 82df75ef8f51..b97d2c126ef6 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -495,14 +495,14 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( vcl::Window* pParentWin, if (nFlags & FileViewFlags::SHOW_ONLYTITLE) { long pTabs[] = { 2, 20, 600 }; - SetTabs(&pTabs[0], MAP_PIXEL); + SetTabs(&pTabs[0], MapUnit::MapPixel); mpHeaderBar->InsertItem(COLUMN_TITLE, SVT_RESSTR(STR_SVT_FILEVIEW_COLUMN_TITLE), 600, nBits | HeaderBarItemBits::UPARROW); } else { long pTabs[] = { 5, 20, 180, 320, 400, 600 }; - SetTabs(&pTabs[0], MAP_PIXEL); + SetTabs(&pTabs[0], MapUnit::MapPixel); SetTabJustify(2, AdjustRight); // column "Size" mpHeaderBar->InsertItem(COLUMN_TITLE, SVT_RESSTR(STR_SVT_FILEVIEW_COLUMN_TITLE), 180, nBits | HeaderBarItemBits::UPARROW); @@ -1012,7 +1012,7 @@ VCL_BUILDER_DECL_FACTORY(SvtFileView) Size SvtFileView::GetOptimalSize() const { - return LogicToPixel(Size(208, 50), MAP_APPFONT); + return LogicToPixel(Size(208, 50), MapUnit::MapAppFont); } void SvtFileView::SetViewMode( FileViewMode eMode ) @@ -1313,7 +1313,7 @@ IMPL_LINK( SvtFileView, HeaderEndDrag_Impl, HeaderBar*, pBar, void ) long nWidth = pBar->GetItemSize(i); aSize.Width() = nWidth + nTmpSize; nTmpSize += nWidth; - mpImpl->mpView->SetTab( i, aSize.Width(), MAP_PIXEL ); + mpImpl->mpView->SetTab( i, aSize.Width(), MapUnit::MapPixel ); } } } diff --git a/svtools/source/contnr/simptabl.cxx b/svtools/source/contnr/simptabl.cxx index ef479e626c5f..0652388e3679 100644 --- a/svtools/source/contnr/simptabl.cxx +++ b/svtools/source/contnr/simptabl.cxx @@ -382,7 +382,7 @@ void SvSimpleTable::HBarEndDrag() for(sal_uInt16 i=1;i<nPrivTabCount;i++) { nNewSize = static_cast< sal_uInt16 >( aHeaderBar->GetItemSize(i) ) + nPos; - SetTab( i, nNewSize, MAP_PIXEL ); + SetTab( i, nNewSize, MapUnit::MapPixel ); nPos = nNewSize; } } diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx index e33e31a5e421..4b07b1270426 100644 --- a/svtools/source/contnr/svtabbx.cxx +++ b/svtools/source/contnr/svtabbx.cxx @@ -132,7 +132,7 @@ void SvTabListBox::SetTabs(const long* pTabs, MapUnit eMapUnit) nTabCount = nCount; MapMode aMMSource( eMapUnit ); - MapMode aMMDest( MAP_PIXEL ); + MapMode aMMDest( MapUnit::MapPixel ); pTabs++; for( sal_uInt16 nIdx = 0; nIdx < nCount; nIdx++, pTabs++ ) @@ -155,7 +155,7 @@ void SvTabListBox::SetTab( sal_uInt16 nTab,long nValue,MapUnit eMapUnit ) { DBG_ASSERT(pTabList,"TabList?"); MapMode aMMSource( eMapUnit ); - MapMode aMMDest( MAP_PIXEL ); + MapMode aMMDest( MapUnit::MapPixel ); Size aSize( nValue, 0 ); aSize = LogicToLogic( aSize, &aMMSource, &aMMDest ); nValue = aSize.Width(); diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 20fdb89c9eaf..cb190b4af2a7 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -517,7 +517,7 @@ void lclDrawPolygon( OutputDevice& rDev, const basegfx::B2DPolygon& rPolygon, lo basegfx::B2DPolyPolygon aPolygons = svtools::ApplyLineDashing(rPolygon, nDashing, nPix); // Handle problems of width 1px in Pixel mode: 0.5px gives a 1px line - if (rDev.GetMapMode().GetMapUnit() == MAP_PIXEL && nWidth == nPix) + if (rDev.GetMapMode().GetMapUnit() == MapUnit::MapPixel && nWidth == nPix) nWidth = 0; for ( sal_uInt32 i = 0; i < aPolygons.count( ); i++ ) @@ -717,7 +717,7 @@ void LineListBox::ImplInit() eSourceUnit = FUNIT_POINT; aVirDev->SetLineColor(); - aVirDev->SetMapMode( MapMode( MAP_TWIP ) ); + aVirDev->SetMapMode( MapMode( MapUnit::MapTwip ) ); UpdatePaintLineColor(); } diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx index a196e0a3ad8d..974af100fa7c 100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -747,7 +747,7 @@ const sal_IntPtr* FontList::GetSizeAry( const FontMetric& rInfo ) const return aStdSizeAry; MapMode aOldMapMode = pDevice->GetMapMode(); - MapMode aMap( MAP_10TH_INCH, Point(), Fraction( 1, 72 ), Fraction( 1, 72 ) ); + MapMode aMap( MapUnit::Map10thInch, Point(), Fraction( 1, 72 ), Fraction( 1, 72 ) ); pDevice->SetMapMode( aMap ); int nRealCount = 0; diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx index 640e98da9de0..638159100126 100644 --- a/svtools/source/control/roadmap.cxx +++ b/svtools/source/control/roadmap.cxx @@ -189,8 +189,8 @@ public: void RoadmapImpl::initItemSize() { Size aLabelSize( m_rAntiImpl.GetOutputSizePixel() ); - aLabelSize.Height() = m_rAntiImpl.LogicToPixel( Size( 0, LABELBASEMAPHEIGHT ), MAP_APPFONT ).Height(); - aLabelSize.Width() -= m_rAntiImpl.LogicToPixel( Size( 2 * ROADMAP_INDENT_X, 0 ), MAP_APPFONT ).Width(); + aLabelSize.Height() = m_rAntiImpl.LogicToPixel( Size( 0, LABELBASEMAPHEIGHT ), MapUnit::MapAppFont ).Height(); + aLabelSize.Width() -= m_rAntiImpl.LogicToPixel( Size( 2 * ROADMAP_INDENT_X, 0 ), MapUnit::MapAppFont ).Width(); m_aItemSizePixel = aLabelSize; } @@ -572,7 +572,7 @@ void ORoadmap::Paint(vcl::RenderContext& rRenderContext, const Rectangle& _rRect void ORoadmap::DrawHeadline(vcl::RenderContext& rRenderContext) { - Point aTextPos = LogicToPixel(Point(ROADMAP_INDENT_X, 8), MAP_APPFONT); + Point aTextPos = LogicToPixel(Point(ROADMAP_INDENT_X, 8), MapUnit::MapAppFont); Size aOutputSize(GetOutputSizePixel()); @@ -744,7 +744,7 @@ void RoadmapItem::SetPosition(RoadmapItem* _pOldItem) Point aIDPos; if ( _pOldItem == nullptr ) { - aIDPos = mpID->LogicToPixel( Point( ROADMAP_INDENT_X, ROADMAP_INDENT_Y ), MAP_APPFONT ); + aIDPos = mpID->LogicToPixel( Point( ROADMAP_INDENT_X, ROADMAP_INDENT_Y ), MapUnit::MapAppFont ); } else { diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx index 7e4dbb9f2bbc..22b752d6f709 100644 --- a/svtools/source/control/ruler.cxx +++ b/svtools/source/control/ruler.cxx @@ -179,17 +179,17 @@ ImplRulerData& ImplRulerData::operator=( const ImplRulerData& rData ) static const RulerUnitData aImplRulerUnitTab[RULER_UNIT_COUNT] = { -{ MAP_100TH_MM, 100, 25.0, 25.0, 50.0, 100.0, " mm" }, // MM -{ MAP_100TH_MM, 1000, 100.0, 500.0, 1000.0, 1000.0, " cm" }, // CM -{ MAP_MM, 1000, 10.0, 250.0, 500.0, 1000.0, " m" }, // M -{ MAP_CM, 100000, 12500.0, 25000.0, 50000.0, 100000.0, " km" }, // KM -{ MAP_1000TH_INCH, 1000, 62.5, 125.0, 500.0, 1000.0, "\"" }, // INCH -{ MAP_100TH_INCH, 1200, 120.0, 120.0, 600.0, 1200.0, "'" }, // FOOT -{ MAP_10TH_INCH, 633600, 63360.0, 63360.0, 316800.0, 633600.0, " miles" }, // MILE -{ MAP_POINT, 1, 12.0, 12.0, 12.0, 36.0, " pt" }, // POINT -{ MAP_100TH_MM, 423, 423.0, 423.0, 423.0, 846.0, " pi" }, // PICA -{ MAP_100TH_MM, 371, 371.0, 371.0, 371.0, 743.0, " ch" }, // CHAR -{ MAP_100TH_MM, 551, 551.0, 551.0, 551.0, 1102.0, " li" } // LINE +{ MapUnit::Map100thMM, 100, 25.0, 25.0, 50.0, 100.0, " mm" }, // MM +{ MapUnit::Map100thMM, 1000, 100.0, 500.0, 1000.0, 1000.0, " cm" }, // CM +{ MapUnit::MapMM, 1000, 10.0, 250.0, 500.0, 1000.0, " m" }, // M +{ MapUnit::MapCM, 100000, 12500.0, 25000.0, 50000.0, 100000.0, " km" }, // KM +{ MapUnit::Map1000thInch, 1000, 62.5, 125.0, 500.0, 1000.0, "\"" }, // INCH +{ MapUnit::Map100thInch, 1200, 120.0, 120.0, 600.0, 1200.0, "'" }, // FOOT +{ MapUnit::Map10thInch, 633600, 63360.0, 63360.0, 316800.0, 633600.0, " miles" }, // MILE +{ MapUnit::MapPoint, 1, 12.0, 12.0, 12.0, 36.0, " pt" }, // POINT +{ MapUnit::Map100thMM, 423, 423.0, 423.0, 423.0, 846.0, " pi" }, // PICA +{ MapUnit::Map100thMM, 371, 371.0, 371.0, 371.0, 743.0, " ch" }, // CHAR +{ MapUnit::Map100thMM, 551, 551.0, 551.0, 551.0, 1102.0, " li" } // LINE }; static RulerTabData ruler_tab = @@ -260,7 +260,7 @@ void Ruler::ImplInit( WinBits nWinBits ) mnUnitIndex = RULER_UNIT_CM; meUnit = FUNIT_CM; maZoom = Fraction( 1, 1 ); - meSourceUnit = MAP_100TH_MM; + meSourceUnit = MapUnit::Map100thMM; // Recalculate border widths if ( nWinBits & WB_BORDER ) @@ -289,7 +289,7 @@ void Ruler::ImplInit( WinBits nWinBits ) Ruler::Ruler( vcl::Window* pParent, WinBits nWinStyle ) : Window( pParent, nWinStyle & WB_3DLOOK ), maVirDev( VclPtr<VirtualDevice>::Create(*this) ), - maMapMode( MAP_100TH_MM ), + maMapMode( MapUnit::Map100thMM ), mpSaveData(new ImplRulerData), mpData(nullptr), mpDragData(new ImplRulerData) diff --git a/svtools/source/control/scrwin.cxx b/svtools/source/control/scrwin.cxx index ae3484defafd..84ad86e9ff77 100644 --- a/svtools/source/control/scrwin.cxx +++ b/svtools/source/control/scrwin.cxx @@ -230,7 +230,7 @@ void ScrollableWindow::Resize() // select the shifted map-mode if ( aPixOffset != aOldPixOffset ) { - Window::SetMapMode( MapMode( MAP_PIXEL ) ); + Window::SetMapMode( MapMode( MapUnit::MapPixel ) ); Window::Scroll( aPixOffset.X() - aOldPixOffset.X(), aPixOffset.Y() - aOldPixOffset.Y() ); diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx index 5b38e6403aa4..cac41b7419cb 100644 --- a/svtools/source/dialogs/roadmapwizard.cxx +++ b/svtools/source/dialogs/roadmapwizard.cxx @@ -133,7 +133,7 @@ namespace svt m_pImpl->pRoadmap->SetPosPixel( Point( 0, 0 ) ); m_pImpl->pRoadmap->SetItemSelectHdl( LINK( this, RoadmapWizard, OnRoadmapItemSelected ) ); - Size aRoadmapSize =( LogicToPixel( Size( 85, 0 ), MAP_APPFONT ) ); + Size aRoadmapSize =( LogicToPixel( Size( 85, 0 ), MapUnit::MapAppFont ) ); aRoadmapSize.Height() = GetSizePixel().Height(); m_pImpl->pRoadmap->SetSizePixel( aRoadmapSize ); diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx index dde11dced207..0f9ad02d0d25 100644 --- a/svtools/source/dialogs/wizardmachine.cxx +++ b/svtools/source/dialogs/wizardmachine.cxx @@ -125,7 +125,7 @@ namespace svt if (_nButtonFlags & WizardButtonFlags::HELP) { m_pHelp= VclPtr<HelpButton>::Create(this, WB_TABSTOP); - m_pHelp->SetSizePixel( LogicToPixel( Size( 50, 14 ), MAP_APPFONT ) ); + m_pHelp->SetSizePixel( LogicToPixel( Size( 50, 14 ), MapUnit::MapAppFont ) ); m_pHelp->Show(); AddButton( m_pHelp, WIZARDDIALOG_BUTTON_STDOFFSET_X); } @@ -135,7 +135,7 @@ namespace svt { m_pPrevPage = VclPtr<PushButton>::Create(this, WB_TABSTOP); m_pPrevPage->SetHelpId( HID_WIZARD_PREVIOUS ); - m_pPrevPage->SetSizePixel( LogicToPixel( Size( 50, 14 ), MAP_APPFONT ) ); + m_pPrevPage->SetSizePixel( LogicToPixel( Size( 50, 14 ), MapUnit::MapAppFont ) ); m_pPrevPage->SetText(SVT_RESSTR(STR_WIZDLG_PREVIOUS)); m_pPrevPage->Show(); m_pPrevPage->set_id("previous"); @@ -153,7 +153,7 @@ namespace svt { m_pNextPage = VclPtr<PushButton>::Create(this, WB_TABSTOP); m_pNextPage->SetHelpId( HID_WIZARD_NEXT ); - m_pNextPage->SetSizePixel( LogicToPixel( Size( 50, 14 ), MAP_APPFONT ) ); + m_pNextPage->SetSizePixel( LogicToPixel( Size( 50, 14 ), MapUnit::MapAppFont ) ); m_pNextPage->SetText(OUString(SVT_RESSTR(STR_WIZDLG_NEXT))); m_pNextPage->Show(); m_pNextPage->set_id("next"); @@ -167,7 +167,7 @@ namespace svt if (_nButtonFlags & WizardButtonFlags::FINISH) { m_pFinish = VclPtr<OKButton>::Create(this, WB_TABSTOP); - m_pFinish->SetSizePixel( LogicToPixel( Size( 50, 14 ), MAP_APPFONT ) ); + m_pFinish->SetSizePixel( LogicToPixel( Size( 50, 14 ), MapUnit::MapAppFont ) ); m_pFinish->SetText(SVT_RESSTR(STR_WIZDLG_FINISH)); m_pFinish->Show(); m_pFinish->set_id("finish"); @@ -180,7 +180,7 @@ namespace svt if (_nButtonFlags & WizardButtonFlags::CANCEL) { m_pCancel = VclPtr<CancelButton>::Create(this, WB_TABSTOP); - m_pCancel->SetSizePixel( LogicToPixel( Size( 50, 14 ), MAP_APPFONT ) ); + m_pCancel->SetSizePixel( LogicToPixel( Size( 50, 14 ), MapUnit::MapAppFont ) ); m_pCancel->Show(); AddButton( m_pCancel, WIZARDDIALOG_BUTTON_STDOFFSET_X ); diff --git a/svtools/source/dialogs/wizdlg.cxx b/svtools/source/dialogs/wizdlg.cxx index f8b04d233568..e7e7508fbb08 100644 --- a/svtools/source/dialogs/wizdlg.cxx +++ b/svtools/source/dialogs/wizdlg.cxx @@ -235,7 +235,7 @@ void WizardDialog::ImplPosCtrls() long WizardDialog::LogicalCoordinateToPixel(int iCoordinate){ - Size aLocSize = LogicToPixel(Size( iCoordinate, 0 ), MAP_APPFONT ); + Size aLocSize = LogicToPixel(Size( iCoordinate, 0 ), MapUnit::MapAppFont ); int iPixelCoordinate = aLocSize.Width(); return iPixelCoordinate; } diff --git a/svtools/source/filter/DocumentToGraphicRenderer.cxx b/svtools/source/filter/DocumentToGraphicRenderer.cxx index 7bcb47303867..4d1e72f9ff94 100644 --- a/svtools/source/filter/DocumentToGraphicRenderer.cxx +++ b/svtools/source/filter/DocumentToGraphicRenderer.cxx @@ -53,7 +53,7 @@ DocumentToGraphicRenderer::~DocumentToGraphicRenderer() Size DocumentToGraphicRenderer::getDocumentSizeInPixels(sal_Int32 aCurrentPage) { Size aSize100mm = getDocumentSizeIn100mm(aCurrentPage); - return Size( Application::GetDefaultDevice()->LogicToPixel( aSize100mm, MAP_100TH_MM ) ); + return Size( Application::GetDefaultDevice()->LogicToPixel( aSize100mm, MapUnit::Map100thMM ) ); } Size DocumentToGraphicRenderer::getDocumentSizeIn100mm(sal_Int32 aCurrentPage) diff --git a/svtools/source/filter/GraphicExportOptionsDialog.cxx b/svtools/source/filter/GraphicExportOptionsDialog.cxx index 33fbeafde44a..e7591cc2b98d 100644 --- a/svtools/source/filter/GraphicExportOptionsDialog.cxx +++ b/svtools/source/filter/GraphicExportOptionsDialog.cxx @@ -89,12 +89,12 @@ IMPL_LINK_NOARG( GraphicExportOptionsDialog, resolutionModifiedHandle, Edit&, vo double GraphicExportOptionsDialog::getViewWidthInch() { - return (double) MetricField::ConvertValue(mSize100mm.Width(), 2, MAP_100TH_MM, FUNIT_INCH) / 100.0; + return (double) MetricField::ConvertValue(mSize100mm.Width(), 2, MapUnit::Map100thMM, FUNIT_INCH) / 100.0; } double GraphicExportOptionsDialog::getViewHeightInch() { - return (double) MetricField::ConvertValue(mSize100mm.Height(), 2, MAP_100TH_MM, FUNIT_INCH) / 100.0; + return (double) MetricField::ConvertValue(mSize100mm.Height(), 2, MapUnit::Map100thMM, FUNIT_INCH) / 100.0; } void GraphicExportOptionsDialog::updateWidth() diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx index 9f965471dc24..645c8df7dd5f 100644 --- a/svtools/source/filter/exportdialog.cxx +++ b/svtools/source/filter/exportdialog.cxx @@ -90,14 +90,14 @@ static sal_Int16 GetFilterFormat(const OUString& rExt) static MapUnit GetMapUnit( sal_Int32 nUnit ) { - MapUnit aMapUnit( MAP_PIXEL ); + MapUnit aMapUnit( MapUnit::MapPixel ); switch( nUnit ) { - case UNIT_INCH : aMapUnit = MAP_INCH; break; - case UNIT_CM : aMapUnit = MAP_CM; break; - case UNIT_MM : aMapUnit = MAP_MM; break; - case UNIT_POINT : aMapUnit = MAP_POINT; break; - case UNIT_PIXEL : aMapUnit = MAP_PIXEL; break; + case UNIT_INCH : aMapUnit = MapUnit::MapInch; break; + case UNIT_CM : aMapUnit = MapUnit::MapCM; break; + case UNIT_MM : aMapUnit = MapUnit::MapMM; break; + case UNIT_POINT : aMapUnit = MapUnit::MapPoint; break; + case UNIT_PIXEL : aMapUnit = MapUnit::MapPixel; break; } return aMapUnit; } @@ -600,7 +600,7 @@ ExportDialog::ExportDialog(FltCallDialogParameter& rPara, mnFormat = GetFilterFormat( maExt ); - Size aResolution( Application::GetDefaultDevice()->LogicToPixel( Size( 100, 100 ), MAP_CM ) ); + Size aResolution( Application::GetDefaultDevice()->LogicToPixel( Size( 100, 100 ), MapUnit::MapCM ) ); maResolution.Width = aResolution.Width(); maResolution.Height= aResolution.Height(); maOriginalSize = GetOriginalSize(); @@ -838,7 +838,7 @@ void ExportDialog::updateControls() if ( !mbIsPixelFormat ) { awt::Size aSize100thmm( maSize ); - Size aSize( LogicToLogic( Size( aSize100thmm.Width * 100, aSize100thmm.Height * 100 ), MAP_100TH_MM, + Size aSize( LogicToLogic( Size( aSize100thmm.Width * 100, aSize100thmm.Height * 100 ), MapUnit::Map100thMM, MapMode( GetMapUnit( mpLbSizeX->GetSelectEntryPos() ) ) ) ); mpMfSizeX->SetValue( aSize.Width() ); mpMfSizeY->SetValue( aSize.Height() ); @@ -846,7 +846,7 @@ void ExportDialog::updateControls() else { MapUnit aMapUnit( GetMapUnit( mpLbSizeX->GetSelectEntryPos() ) ); - if ( aMapUnit == MAP_PIXEL ) + if ( aMapUnit == MapUnit::MapPixel ) { // calculating pixel count via resolution and original graphic size mpMfSizeX->SetDecimalDigits( 0 ); mpMfSizeY->SetDecimalDigits( 0 ); @@ -860,11 +860,11 @@ void ExportDialog::updateControls() double fRatio; switch( GetMapUnit( mpLbSizeX->GetSelectEntryPos() ) ) { - case MAP_INCH : fRatio = static_cast< double >( maResolution.Width ) * 0.0254; break; - case MAP_MM : fRatio = static_cast< double >( maResolution.Width ) * 0.001; break; - case MAP_POINT :fRatio = ( static_cast< double >( maResolution.Width ) * 0.0254 ) / 72.0; break; + case MapUnit::MapInch : fRatio = static_cast< double >( maResolution.Width ) * 0.0254; break; + case MapUnit::MapMM : fRatio = static_cast< double >( maResolution.Width ) * 0.001; break; + case MapUnit::MapPoint :fRatio = ( static_cast< double >( maResolution.Width ) * 0.0254 ) / 72.0; break; default: - case MAP_CM : fRatio = static_cast< double >( maResolution.Width ) * 0.01; break; + case MapUnit::MapCM : fRatio = static_cast< double >( maResolution.Width ) * 0.01; break; } mpMfSizeX->SetValue( static_cast< sal_Int32 >( ( static_cast< double >( maSize.Width * 100 ) / fRatio ) + 0.5 ) ); mpMfSizeY->SetValue( static_cast< sal_Int32 >( ( static_cast< double >( maSize.Height * 100 ) / fRatio ) + 0.5 ) ); @@ -998,12 +998,12 @@ IMPL_LINK_NOARG(ExportDialog, UpdateHdlMtfSizeX, Edit&, void) { switch( GetMapUnit( mpLbSizeX->GetSelectEntryPos() ) ) { - case MAP_INCH : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.0254 * mpMfSizeX->GetValue() / 100.0 + 0.5 ); break; - case MAP_CM : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.01 * mpMfSizeX->GetValue() / 100.0 + 0.5 ); break; - case MAP_MM : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.001 * mpMfSizeX->GetValue() / 100.0 + 0.5 ); break; - case MAP_POINT : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.0254 * mpMfSizeX->GetValue() / 100.0 * 72 + 0.5 ); break; + case MapUnit::MapInch : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.0254 * mpMfSizeX->GetValue() / 100.0 + 0.5 ); break; + case MapUnit::MapCM : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.01 * mpMfSizeX->GetValue() / 100.0 + 0.5 ); break; + case MapUnit::MapMM : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.001 * mpMfSizeX->GetValue() / 100.0 + 0.5 ); break; + case MapUnit::MapPoint : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.0254 * mpMfSizeX->GetValue() / 100.0 * 72 + 0.5 ); break; default: - case MAP_PIXEL : maSize.Width = mpMfSizeX->GetValue(); break; + case MapUnit::MapPixel : maSize.Width = mpMfSizeX->GetValue(); break; } maSize.Height = static_cast< sal_Int32 >( fRatio * maSize.Width + 0.5 ); } @@ -1014,7 +1014,7 @@ IMPL_LINK_NOARG(ExportDialog, UpdateHdlMtfSizeX, Edit&, void) sal_Int32 nHeight= static_cast< sal_Int32 >( nWidth * fRatio ); const Size aSource( static_cast< sal_Int32 >( nWidth ), static_cast< sal_Int32 >( nHeight ) ); MapMode aSourceMapMode( GetMapUnit( mpLbSizeX->GetSelectEntryPos() ),Point(), aFract, aFract ); - Size aDest( LogicToLogic( aSource, aSourceMapMode, MAP_100TH_MM ) ); + Size aDest( LogicToLogic( aSource, aSourceMapMode, MapUnit::Map100thMM ) ); maSize.Width = aDest.Width(); maSize.Height = aDest.Height(); @@ -1030,12 +1030,12 @@ IMPL_LINK_NOARG(ExportDialog, UpdateHdlMtfSizeY, Edit&, void) { switch( GetMapUnit( mpLbSizeX->GetSelectEntryPos() ) ) { - case MAP_INCH : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.0254 * mpMfSizeY->GetValue() / 100.0 + 0.5 ); break; - case MAP_CM : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.01 * mpMfSizeY->GetValue() / 100.0 + 0.5 ); break; - case MAP_MM : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.001 * mpMfSizeY->GetValue() / 100.0 + 0.5 ); break; - case MAP_POINT : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.0254 * mpMfSizeY->GetValue() / 100.0 * 72 + 0.5 ); break; + case MapUnit::MapInch : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.0254 * mpMfSizeY->GetValue() / 100.0 + 0.5 ); break; + case MapUnit::MapCM : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.01 * mpMfSizeY->GetValue() / 100.0 + 0.5 ); break; + case MapUnit::MapMM : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.001 * mpMfSizeY->GetValue() / 100.0 + 0.5 ); break; + case MapUnit::MapPoint : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.0254 * mpMfSizeY->GetValue() / 100.0 * 72 + 0.5 ); break; default: - case MAP_PIXEL : maSize.Height = mpMfSizeY->GetValue(); break; + case MapUnit::MapPixel : maSize.Height = mpMfSizeY->GetValue(); break; } maSize.Width = static_cast< sal_Int32 >( fRatio * maSize.Height + 0.5 ); } @@ -1046,7 +1046,7 @@ IMPL_LINK_NOARG(ExportDialog, UpdateHdlMtfSizeY, Edit&, void) sal_Int32 nWidth = static_cast< sal_Int32 >( nHeight * fRatio ); const Size aSource( static_cast< sal_Int32 >( nWidth ), static_cast< sal_Int32 >( nHeight ) ); MapMode aSourceMapMode( GetMapUnit( mpLbSizeX->GetSelectEntryPos() ),Point(), aFract, aFract ); - Size aDest( LogicToLogic( aSource, aSourceMapMode, MAP_100TH_MM ) ); + Size aDest( LogicToLogic( aSource, aSourceMapMode, MapUnit::Map100thMM ) ); maSize.Height = aDest.Height(); maSize.Width = aDest.Width(); diff --git a/svtools/source/graphic/descriptor.cxx b/svtools/source/graphic/descriptor.cxx index 1cec88463da3..4f73e4fab05c 100644 --- a/svtools/source/graphic/descriptor.cxx +++ b/svtools/source/graphic/descriptor.cxx @@ -379,9 +379,9 @@ void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry** if( mpGraphic ) { - if( mpGraphic->GetPrefMapMode().GetMapUnit() != MAP_PIXEL ) + if( mpGraphic->GetPrefMapMode().GetMapUnit() != MapUnit::MapPixel ) { - const Size aSizeLog( OutputDevice::LogicToLogic( mpGraphic->GetPrefSize(), mpGraphic->GetPrefMapMode(), MAP_100TH_MM ) ); + const Size aSizeLog( OutputDevice::LogicToLogic( mpGraphic->GetPrefSize(), mpGraphic->GetPrefMapMode(), MapUnit::Map100thMM ) ); aAWTSize = awt::Size( aSizeLog.Width(), aSizeLog.Height() ); } } diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index 3392814cc4d9..214f37814fb0 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -290,7 +290,7 @@ bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& rSz tools::Polygon aClipPoly( Rectangle( rPt, rSz ) ); const sal_uInt16 nRot10 = pAttr->GetRotation() % 3600; const Point aOldOrigin( rPt ); - const MapMode aMap100( MAP_100TH_MM ); + const MapMode aMap100( MapUnit::Map100thMM ); Size aSize100; long nTotalWidth, nTotalHeight; @@ -304,7 +304,7 @@ bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& rSz rClipPolyPoly = aClipPoly; - if( maGraphic.GetPrefMapMode() == MAP_PIXEL ) + if( maGraphic.GetPrefMapMode() == MapUnit::MapPixel ) aSize100 = Application::GetDefaultDevice()->PixelToLogic( maGraphic.GetPrefSize(), aMap100 ); else { @@ -723,7 +723,7 @@ Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMo // #104115# Convert the crop margins to graphic object mapmode const MapMode aMapGraph( aTransGraphic.GetPrefMapMode() ); - const MapMode aMap100( MAP_100TH_MM ); + const MapMode aMap100( MapUnit::Map100thMM ); Size aCropLeftTop; Size aCropRightBottom; @@ -732,9 +732,9 @@ Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMo { GDIMetaFile aMtf( aTransGraphic.GetGDIMetaFile() ); - if( aMapGraph == MAP_PIXEL ) + if( aMapGraph == MapUnit::MapPixel ) { - // crops are in 1/100th mm -> to aMapGraph -> to MAP_PIXEL + // crops are in 1/100th mm -> to aMapGraph -> to MapUnit::MapPixel aCropLeftTop = Application::GetDefaultDevice()->LogicToPixel( Size(rAttr.GetLeftCrop(), rAttr.GetTopCrop()), aMap100); @@ -805,9 +805,9 @@ Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMo // convert crops to pixel if(rAttr.IsCropped()) { - if( aMapGraph == MAP_PIXEL ) + if( aMapGraph == MapUnit::MapPixel ) { - // crops are in 1/100th mm -> to MAP_PIXEL + // crops are in 1/100th mm -> to MapUnit::MapPixel aCropLeftTop = Application::GetDefaultDevice()->LogicToPixel( Size(rAttr.GetLeftCrop(), rAttr.GetTopCrop()), aMap100); @@ -817,7 +817,7 @@ Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMo } else { - // crops are in GraphicObject units -> to MAP_PIXEL + // crops are in GraphicObject units -> to MapUnit::MapPixel aCropLeftTop = Application::GetDefaultDevice()->LogicToPixel( Size(rAttr.GetLeftCrop(), rAttr.GetTopCrop()), aMapGraph); @@ -1153,12 +1153,12 @@ basegfx::B2DVector GraphicObject::calculateCropScaling( double fRightCrop, double fBottomCrop) const { - const MapMode aMapMode100thmm(MAP_100TH_MM); + const MapMode aMapMode100thmm(MapUnit::Map100thMM); Size aBitmapSize(GetPrefSize()); double fFactorX(1.0); double fFactorY(1.0); - if(MAP_PIXEL == GetPrefMapMode().GetMapUnit()) + if(MapUnit::MapPixel == GetPrefMapMode().GetMapUnit()) { aBitmapSize = Application::GetDefaultDevice()->PixelToLogic(aBitmapSize, aMapMode100thmm); } diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx index fdfcbc50ae9a..1f559d6c5e28 100644 --- a/svtools/source/graphic/provider.cxx +++ b/svtools/source/graphic/provider.cxx @@ -501,13 +501,13 @@ void ImplCalculateCropRect( ::Graphic& rGraphic, const text::GraphicCrop& rGraph if ( rGraphicCropLogic.Left || rGraphicCropLogic.Top || rGraphicCropLogic.Right || rGraphicCropLogic.Bottom ) { Size aSize100thMM( 0, 0 ); - if( rGraphic.GetPrefMapMode().GetMapUnit() != MAP_PIXEL ) + if( rGraphic.GetPrefMapMode().GetMapUnit() != MapUnit::MapPixel ) { - aSize100thMM = OutputDevice::LogicToLogic( rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode(), MAP_100TH_MM ); + aSize100thMM = OutputDevice::LogicToLogic( rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode(), MapUnit::Map100thMM ); } else { - aSize100thMM = Application::GetDefaultDevice()->PixelToLogic( rGraphic.GetPrefSize(), MAP_100TH_MM ); + aSize100thMM = Application::GetDefaultDevice()->PixelToLogic( rGraphic.GetPrefSize(), MapUnit::Map100thMM ); } if ( aSize100thMM.Width() && aSize100thMM.Height() ) { @@ -627,10 +627,10 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal { ScopedVclPtrInstance< VirtualDevice > aDummyVDev; GDIMetaFile aMtf( rGraphic.GetGDIMetaFile() ); - Size aMtfSize( OutputDevice::LogicToLogic( aMtf.GetPrefSize(), aMtf.GetPrefMapMode(), MAP_100TH_MM ) ); + Size aMtfSize( OutputDevice::LogicToLogic( aMtf.GetPrefSize(), aMtf.GetPrefMapMode(), MapUnit::Map100thMM ) ); if ( aMtfSize.Width() && aMtfSize.Height() ) { - MapMode aNewMapMode( MAP_100TH_MM ); + MapMode aNewMapMode( MapUnit::Map100thMM ); aNewMapMode.SetScaleX( static_cast< double >( aLogicalSize.Width ) / static_cast< double >( aMtfSize.Width() ) ); aNewMapMode.SetScaleY( static_cast< double >( aLogicalSize.Height ) / static_cast< double >( aMtfSize.Height() ) ); aDummyVDev->EnableOutput( false ); @@ -680,7 +680,7 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal } ::Graphic aGraphic( aBmpEx ); const Size aSize100thmm( aDummyVDev->LogicToPixel( aSize ) ); - Size aSize100thmm2( aDummyVDev->PixelToLogic( aSize100thmm, MAP_100TH_MM ) ); + Size aSize100thmm2( aDummyVDev->PixelToLogic( aSize100thmm, MapUnit::Map100thMM ) ); ImplApplyBitmapResolution( aGraphic, nImageResolution, aGraphic.GetSizePixel(), awt::Size( aSize100thmm2.Width(), aSize100thmm2.Height() ) ); diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index 9a61bfc7cce0..564b5a096479 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -463,7 +463,7 @@ const Graphic* EmbeddedObjectRef::GetGraphic() const Size EmbeddedObjectRef::GetSize( MapMode* pTargetMapMode ) const { - MapMode aSourceMapMode( MAP_100TH_MM ); + MapMode aSourceMapMode( MapUnit::Map100thMM ); Size aResult; if ( mpImpl->nViewAspect == embed::Aspects::MSOLE_ICON ) @@ -640,7 +640,7 @@ SvStream* EmbeddedObjectRef::GetGraphicStream( bool bUpdate ) const void EmbeddedObjectRef::DrawPaintReplacement( const Rectangle &rRect, const OUString &rText, OutputDevice *pOut ) { - MapMode aMM( MAP_APPFONT ); + MapMode aMM( MapUnit::MapAppFont ); Size aAppFontSz = pOut->LogicToLogic( Size( 0, 8 ), &aMM, nullptr ); vcl::Font aFnt( OUString("Helvetica"), aAppFontSz ); aFnt.SetTransparent( true ); diff --git a/svtools/source/misc/embedtransfer.cxx b/svtools/source/misc/embedtransfer.cxx index 8dab2ac5abdb..1a867e22e240 100644 --- a/svtools/source/misc/embedtransfer.cxx +++ b/svtools/source/misc/embedtransfer.cxx @@ -218,7 +218,7 @@ void SvEmbedTransferHelper::FillTransferableObjectDescriptor( TransferableObject rDesc.mnOle2Misc = sal::static_int_cast<sal_Int32>(xObj->getStatus( rDesc.mnViewAspect )); Size aSize; - MapMode aMapMode( MAP_100TH_MM ); + MapMode aMapMode( MapUnit::Map100thMM ); if ( nAspect == embed::Aspects::MSOLE_ICON ) { if ( pGraphic ) @@ -247,7 +247,7 @@ void SvEmbedTransferHelper::FillTransferableObjectDescriptor( TransferableObject aMapMode = MapMode( VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( rDesc.mnViewAspect ) ) ); } - rDesc.maSize = OutputDevice::LogicToLogic( aSize, aMapMode, MapMode( MAP_100TH_MM ) ); + rDesc.maSize = OutputDevice::LogicToLogic( aSize, aMapMode, MapMode( MapUnit::Map100thMM ) ); rDesc.maDragStartPos = Point(); rDesc.maDisplayName.clear(); } diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx index e37763b52a9a..1b96d67840f7 100644 --- a/svtools/source/misc/imap.cxx +++ b/svtools/source/misc/imap.cxx @@ -151,7 +151,7 @@ IMapRectangleObject::IMapRectangleObject( const Rectangle& rRect, void IMapRectangleObject::ImpConstruct( const Rectangle& rRect, bool bPixel ) { if ( bPixel ) - aRect = Application::GetDefaultDevice()->PixelToLogic( rRect, MapMode( MAP_100TH_MM ) ); + aRect = Application::GetDefaultDevice()->PixelToLogic( rRect, MapMode( MapUnit::Map100thMM ) ); else aRect = rRect; } @@ -209,7 +209,7 @@ Rectangle IMapRectangleObject::GetRectangle( bool bPixelCoords ) const Rectangle aNewRect; if ( bPixelCoords ) - aNewRect = Application::GetDefaultDevice()->LogicToPixel( aRect, MapMode( MAP_100TH_MM ) ); + aNewRect = Application::GetDefaultDevice()->LogicToPixel( aRect, MapMode( MapUnit::Map100thMM ) ); else aNewRect = aRect; @@ -252,7 +252,7 @@ void IMapCircleObject::ImpConstruct( const Point& rCenter, sal_uLong nRad, bool { if ( bPixel ) { - MapMode aMap100( MAP_100TH_MM ); + MapMode aMap100( MapUnit::Map100thMM ); aCenter = Application::GetDefaultDevice()->PixelToLogic( rCenter, aMap100 ); nRadius = Application::GetDefaultDevice()->PixelToLogic( Size( nRad, 0 ), aMap100 ).Width(); @@ -334,7 +334,7 @@ Point IMapCircleObject::GetCenter( bool bPixelCoords ) const Point aNewPoint; if ( bPixelCoords ) - aNewPoint = Application::GetDefaultDevice()->LogicToPixel( aCenter, MapMode( MAP_100TH_MM ) ); + aNewPoint = Application::GetDefaultDevice()->LogicToPixel( aCenter, MapMode( MapUnit::Map100thMM ) ); else aNewPoint = aCenter; @@ -346,7 +346,7 @@ sal_uLong IMapCircleObject::GetRadius( bool bPixelCoords ) const sal_uLong nNewRadius; if ( bPixelCoords ) - nNewRadius = Application::GetDefaultDevice()->LogicToPixel( Size( nRadius, 0 ), MapMode( MAP_100TH_MM ) ).Width(); + nNewRadius = Application::GetDefaultDevice()->LogicToPixel( Size( nRadius, 0 ), MapMode( MapUnit::Map100thMM ) ).Width(); else nNewRadius = nRadius; @@ -395,7 +395,7 @@ IMapPolygonObject::IMapPolygonObject( const tools::Polygon& rPoly, void IMapPolygonObject::ImpConstruct( const tools::Polygon& rPoly, bool bPixel ) { if ( bPixel ) - aPoly = Application::GetDefaultDevice()->PixelToLogic( rPoly, MapMode( MAP_100TH_MM ) ); + aPoly = Application::GetDefaultDevice()->PixelToLogic( rPoly, MapMode( MapUnit::Map100thMM ) ); else aPoly = rPoly; } @@ -462,7 +462,7 @@ tools::Polygon IMapPolygonObject::GetPolygon( bool bPixelCoords ) const tools::Polygon aNewPoly; if ( bPixelCoords ) - aNewPoly = Application::GetDefaultDevice()->LogicToPixel( aPoly, MapMode( MAP_100TH_MM ) ); + aNewPoly = Application::GetDefaultDevice()->LogicToPixel( aPoly, MapMode( MapUnit::Map100thMM ) ); else aNewPoly = aPoly; diff --git a/svtools/source/misc/imap2.cxx b/svtools/source/misc/imap2.cxx index b031d4c85cc7..8ca4349421fd 100644 --- a/svtools/source/misc/imap2.cxx +++ b/svtools/source/misc/imap2.cxx @@ -39,7 +39,7 @@ void IMapObject::AppendCERNCoords(OStringBuffer& rBuf, const Point& rPoint100) { - const Point aPixPt( Application::GetDefaultDevice()->LogicToPixel( rPoint100, MapMode( MAP_100TH_MM ) ) ); + const Point aPixPt( Application::GetDefaultDevice()->LogicToPixel( rPoint100, MapMode( MapUnit::Map100thMM ) ) ); rBuf.append('('); rBuf.append(static_cast<sal_Int32>(aPixPt.X())); @@ -50,7 +50,7 @@ void IMapObject::AppendCERNCoords(OStringBuffer& rBuf, const Point& rPoint100) void IMapObject::AppendNCSACoords(OStringBuffer& rBuf, const Point& rPoint100) { - const Point aPixPt( Application::GetDefaultDevice()->LogicToPixel( rPoint100, MapMode( MAP_100TH_MM ) ) ); + const Point aPixPt( Application::GetDefaultDevice()->LogicToPixel( rPoint100, MapMode( MapUnit::Map100thMM ) ) ); rBuf.append(static_cast<sal_Int32>(aPixPt.X())); rBuf.append(','); diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index b156b61220bd..8efdce0b1512 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -1609,18 +1609,18 @@ bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapEx& r { const MapMode aMapMode(rBmpEx.GetPrefMapMode()); - if(MAP_PIXEL != aMapMode.GetMapUnit()) + if(MapUnit::MapPixel != aMapMode.GetMapUnit()) { - const Size aSize(OutputDevice::LogicToLogic(rBmpEx.GetPrefSize(), aMapMode, MAP_100TH_MM)); + const Size aSize(OutputDevice::LogicToLogic(rBmpEx.GetPrefSize(), aMapMode, MapUnit::Map100thMM)); // #i122388# This wrongly corrects in the given case; changing from 5000 100th mm to // the described 50 cm (which is 50000 100th mm) if((aSize.Width() > 50000) || (aSize.Height() > 50000)) { - rBmpEx.SetPrefMapMode(MAP_PIXEL); + rBmpEx.SetPrefMapMode(MapUnit::MapPixel); // #i122388# also adapt size by applying the mew MapMode - const Size aNewSize(OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, MAP_PIXEL)); + const Size aNewSize(OutputDevice::LogicToLogic(aSize, MapUnit::Map100thMM, MapUnit::MapPixel)); rBmpEx.SetPrefSize(aNewSize); } } diff --git a/svtools/source/misc/unitconv.cxx b/svtools/source/misc/unitconv.cxx index 250ac3b96438..acf65083136c 100644 --- a/svtools/source/misc/unitconv.cxx +++ b/svtools/source/misc/unitconv.cxx @@ -111,7 +111,7 @@ void SetFieldUnit( MetricBox& rBox, FieldUnit eUnit ) void SetMetricValue( MetricField& rField, long nCoreValue, MapUnit eUnit ) { - sal_Int64 nVal = OutputDevice::LogicToLogic( nCoreValue, (MapUnit)eUnit, MAP_100TH_MM ); + sal_Int64 nVal = OutputDevice::LogicToLogic( nCoreValue, (MapUnit)eUnit, MapUnit::Map100thMM ); nVal = rField.Normalize( nVal ); rField.SetValue( nVal, FUNIT_100TH_MM ); @@ -136,7 +136,7 @@ long GetCoreValue( const MetricField& rField, MapUnit eUnit ) } if( bRoundBefore ) nVal = rField.Denormalize( nVal ); - sal_Int64 nUnitVal = OutputDevice::LogicToLogic( static_cast<long>(nVal), MAP_100TH_MM, (MapUnit)eUnit ); + sal_Int64 nUnitVal = OutputDevice::LogicToLogic( static_cast<long>(nVal), MapUnit::Map100thMM, (MapUnit)eUnit ); if( ! bRoundBefore ) nUnitVal = rField.Denormalize( nUnitVal ); return static_cast<long>(nUnitVal); @@ -147,23 +147,23 @@ long CalcToUnit( float nIn, MapUnit eUnit ) { // nIn ist in Points - DBG_ASSERT( eUnit == MAP_TWIP || - eUnit == MAP_100TH_MM || - eUnit == MAP_10TH_MM || - eUnit == MAP_MM || - eUnit == MAP_CM, "this unit is not implemented" ); + DBG_ASSERT( eUnit == MapUnit::MapTwip || + eUnit == MapUnit::Map100thMM || + eUnit == MapUnit::Map10thMM || + eUnit == MapUnit::MapMM || + eUnit == MapUnit::MapCM, "this unit is not implemented" ); float nTmp = nIn; - if ( MAP_TWIP != eUnit ) + if ( MapUnit::MapTwip != eUnit ) nTmp = nIn * 10 / 567; switch ( eUnit ) { - case MAP_100TH_MM: nTmp *= 100; break; - case MAP_10TH_MM: nTmp *= 10; break; - case MAP_MM: break; - case MAP_CM: nTmp /= 10; break; + case MapUnit::Map100thMM: nTmp *= 100; break; + case MapUnit::Map10thMM: nTmp *= 10; break; + case MapUnit::MapMM: break; + case MapUnit::MapCM: nTmp /= 10; break; default: ;//prevent warning } @@ -180,46 +180,46 @@ long ItemToControl( long nIn, MapUnit eItem, FieldUnit eCtrl ) switch ( eItem ) { - case MAP_100TH_MM: - case MAP_10TH_MM: - case MAP_MM: + case MapUnit::Map100thMM: + case MapUnit::Map10thMM: + case MapUnit::MapMM: { - if ( eItem == MAP_10TH_MM ) + if ( eItem == MapUnit::Map10thMM ) nIn /= 10; - else if ( eItem == MAP_100TH_MM ) + else if ( eItem == MapUnit::Map100thMM ) nIn /= 100; nOut = TransformMetric( nIn, FUNIT_MM, eCtrl ); } break; - case MAP_CM: + case MapUnit::MapCM: { nOut = TransformMetric( nIn, FUNIT_CM, eCtrl ); } 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: { - if ( eItem == MAP_10TH_INCH ) + if ( eItem == MapUnit::Map10thInch ) nIn /= 10; - else if ( eItem == MAP_100TH_INCH ) + else if ( eItem == MapUnit::Map100thInch ) nIn /= 100; - else if ( eItem == MAP_1000TH_INCH ) + else if ( eItem == MapUnit::Map1000thInch ) nIn /= 1000; nOut = TransformMetric( nIn, FUNIT_INCH, eCtrl ); } break; - case MAP_POINT: + case MapUnit::MapPoint: { nOut = TransformMetric( nIn, FUNIT_POINT, eCtrl ); } break; - case MAP_TWIP: + case MapUnit::MapTwip: { nOut = TransformMetric( nIn, FUNIT_TWIP, eCtrl ); } @@ -240,24 +240,24 @@ FieldUnit MapToFieldUnit( const MapUnit eUnit ) { switch ( eUnit ) { - case MAP_100TH_MM: - case MAP_10TH_MM: - case MAP_MM: + case MapUnit::Map100thMM: + case MapUnit::Map10thMM: + case MapUnit::MapMM: return FUNIT_MM; - case MAP_CM: + case MapUnit::MapCM: return FUNIT_CM; - 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: return FUNIT_INCH; - case MAP_POINT: + case MapUnit::MapPoint: return FUNIT_POINT; - case MAP_TWIP: + case MapUnit::MapTwip: return FUNIT_TWIP; default: ;//prevent warning } @@ -267,30 +267,30 @@ FieldUnit MapToFieldUnit( const MapUnit eUnit ) long CalcToPoint( long nIn, MapUnit eUnit, sal_uInt16 nFactor ) { - DBG_ASSERT( eUnit == MAP_TWIP || - eUnit == MAP_100TH_MM || - eUnit == MAP_10TH_MM || - eUnit == MAP_MM || - eUnit == MAP_CM, "this unit is not implemented" ); + DBG_ASSERT( eUnit == MapUnit::MapTwip || + eUnit == MapUnit::Map100thMM || + eUnit == MapUnit::Map10thMM || + eUnit == MapUnit::MapMM || + eUnit == MapUnit::MapCM, "this unit is not implemented" ); long nRet = 0; - if ( MAP_TWIP == eUnit ) + if ( MapUnit::MapTwip == eUnit ) nRet = nIn; else nRet = nIn * 567; switch ( eUnit ) { - case MAP_100TH_MM: nRet /= 100; break; - case MAP_10TH_MM: nRet /= 10; break; - case MAP_MM: break; - case MAP_CM: nRet *= 10; break; + case MapUnit::Map100thMM: nRet /= 100; break; + case MapUnit::Map10thMM: nRet /= 10; break; + case MapUnit::MapMM: break; + case MapUnit::MapCM: nRet *= 10; break; default: ;//prevent warning } // ggf. aufrunden - if ( MAP_TWIP != eUnit ) + if ( MapUnit::MapTwip != eUnit ) { long nMod = 10; long nTmp = nRet % nMod; diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index dacd04450f51..e9636955793f 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -558,15 +558,15 @@ namespace svt { namespace table void TableControl_Impl::impl_ni_updateCachedTableMetrics() { - m_nRowHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getRowHeight() ), MAP_APPFONT ).Height(); + m_nRowHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getRowHeight() ), MapUnit::MapAppFont ).Height(); m_nColHeaderHeightPixel = 0; if ( m_pModel->hasColumnHeaders() ) - m_nColHeaderHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getColumnHeaderHeight() ), MAP_APPFONT ).Height(); + m_nColHeaderHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getColumnHeaderHeight() ), MapUnit::MapAppFont ).Height(); m_nRowHeaderWidthPixel = 0; if ( m_pModel->hasRowHeaders() ) - m_nRowHeaderWidthPixel = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT).Width(); + m_nRowHeaderWidthPixel = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MapUnit::MapAppFont).Width(); } @@ -1810,13 +1810,13 @@ namespace svt { namespace table long TableControl_Impl::pixelWidthToAppFont( long const i_pixels ) const { - return m_pDataWindow->PixelToLogic( Size( i_pixels, 0 ), MAP_APPFONT ).Width(); + return m_pDataWindow->PixelToLogic( Size( i_pixels, 0 ), MapUnit::MapAppFont ).Width(); } long TableControl_Impl::appFontWidthToPixel( long const i_appFontUnits ) const { - return m_pDataWindow->LogicToPixel( Size( i_appFontUnits, 0 ), MAP_APPFONT ).Width(); + return m_pDataWindow->LogicToPixel( Size( i_appFontUnits, 0 ), MapUnit::MapAppFont ).Width(); } diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index 9bdbafa1aa20..59bb09071a13 100644 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -212,7 +212,7 @@ void SVTXGridControl::setProperty( const OUString& PropertyName, const Any& aVal sal_Int32 columnHeaderHeight = 0; if ( !aValue.hasValue() ) { - columnHeaderHeight = pTable->PixelToLogic( Size( 0, pTable->GetTextHeight() + 3 ), MAP_APPFONT ).Height(); + columnHeaderHeight = pTable->PixelToLogic( Size( 0, pTable->GetTextHeight() + 3 ), MapUnit::MapAppFont ).Height(); } else { @@ -252,7 +252,7 @@ void SVTXGridControl::setProperty( const OUString& PropertyName, const Any& aVal sal_Int32 rowHeight = 0; if ( !aValue.hasValue() ) { - rowHeight = pTable->PixelToLogic( Size( 0, pTable->GetTextHeight() + 3 ), MAP_APPFONT ).Height(); + rowHeight = pTable->PixelToLogic( Size( 0, pTable->GetTextHeight() + 3 ), MapUnit::MapAppFont ).Height(); } else { diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx index ca27a2ee2193..ad63261bd229 100644 --- a/svtools/source/uno/wizard/wizardshell.cxx +++ b/svtools/source/uno/wizard/wizardshell.cxx @@ -184,7 +184,7 @@ namespace svt { namespace uno { // fallback for ill-behaved clients: empty page pPage = VclPtr<TabPage>::Create( this, 0 ); - pPage->SetSizePixel( LogicToPixel( Size( 280, 185 ), MAP_APPFONT ) ); + pPage->SetSizePixel( LogicToPixel( Size( 280, 185 ), MapUnit::MapAppFont ) ); } m_aPageControllers[ pPage ] = pController; |