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 /editeng | |
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 'editeng')
-rw-r--r-- | editeng/source/editeng/editdbg.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/editview.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/eehtml.cxx | 10 | ||||
-rw-r--r-- | editeng/source/editeng/eertfpar.cxx | 6 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 26 | ||||
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/impedit4.cxx | 6 | ||||
-rw-r--r-- | editeng/source/items/itemtype.cxx | 62 | ||||
-rw-r--r-- | editeng/source/items/numitem.cxx | 4 | ||||
-rw-r--r-- | editeng/source/items/paperinf.cxx | 12 | ||||
-rw-r--r-- | editeng/source/items/textitem.cxx | 73 | ||||
-rw-r--r-- | editeng/source/outliner/outliner.cxx | 2 | ||||
-rw-r--r-- | editeng/source/uno/unoipset.cxx | 20 |
13 files changed, 119 insertions, 114 deletions
diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index 134abc8d7457..a39b465c155b 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -208,7 +208,7 @@ OString DbgOutItem(const SfxItemPool& rPool, const SfxPoolItem& rItem) Size aSz( 0, static_cast<const SvxFontHeightItem&>(rItem).GetHeight() ); MapUnit eUnit = rPool.GetMetric( rItem.Which() ); MapMode aItemMapMode(eUnit); - MapMode aPntMap( MAP_POINT ); + MapMode aPntMap( MapUnit::MapPoint ); aSz = OutputDevice::LogicToLogic( aSz, aItemMapMode, aPntMap ); aDebStr.append(" Points="); aDebStr.append(static_cast<sal_Int32>(aSz.Height())); @@ -278,7 +278,7 @@ OString DbgOutItem(const SfxItemPool& rPool, const SfxPoolItem& rItem) Size aSz( 0, (short)static_cast<const SvxKerningItem&>(rItem).GetValue() ); MapUnit eUnit = rPool.GetMetric( rItem.Which() ); MapMode aItemMapMode(eUnit); - MapMode aPntMap( MAP_POINT ); + MapMode aPntMap( MapUnit::MapPoint ); aSz = OutputDevice::LogicToLogic( aSz, aItemMapMode, aPntMap ); aDebStr.append(" Points="); aDebStr.append(static_cast<sal_Int32>(aSz.Height())); diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 491507820060..3c256baa5c4f 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -1211,7 +1211,7 @@ bool EditView::ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFo SvxFontHeightItem aFontHeightItem( static_cast<const SvxFontHeightItem&>(rSet.Get( *pWhich )) ); long nHeight = aFontHeightItem.GetHeight(); const MapUnit eUnit = rSet.GetPool()->GetMetric( *pWhich ); - nHeight = OutputDevice::LogicToLogic(nHeight * 10, eUnit, MAP_POINT); + nHeight = OutputDevice::LogicToLogic(nHeight * 10, eUnit, MapUnit::MapPoint); FontMetric aFontMetric = pFontList->Get( pFontItem->GetFamilyName(), pFontItem->GetStyleName() ); const sal_IntPtr* pAry = pFontList->GetSizeAry( aFontMetric ); @@ -1264,7 +1264,7 @@ bool EditView::ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFo if( (nHeight >= 2) && (nHeight <= 9999 ) ) { - nHeight = OutputDevice::LogicToLogic( nHeight, MAP_POINT, (MapUnit)eUnit ) / 10; + nHeight = OutputDevice::LogicToLogic( nHeight, MapUnit::MapPoint, (MapUnit)eUnit ) / 10; if( nHeight != (long)aFontHeightItem.GetHeight() ) { diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx index 58620b6efb72..4f7f99bba563 100644 --- a/editeng/source/editeng/eehtml.cxx +++ b/editeng/source/editeng/eehtml.cxx @@ -607,8 +607,8 @@ void EditHTMLParser::ImpSetStyleSheet( sal_uInt16 nHLevel ) // Font hight and margins, when LogicToLogic is possible: MapUnit eUnit = mpEditEngine->GetRefMapMode().GetMapUnit(); - if ( ( eUnit != MAP_PIXEL ) && ( eUnit != MAP_SYSFONT ) && - ( eUnit != MAP_APPFONT ) && ( eUnit != MAP_RELATIVE ) ) + if ( ( eUnit != MapUnit::MapPixel ) && ( eUnit != MapUnit::MapSysFont ) && + ( eUnit != MapUnit::MapAppFont ) && ( eUnit != MapUnit::MapRelative ) ) { long nPoints = 10; if ( nHLevel == 1 ) @@ -620,7 +620,7 @@ void EditHTMLParser::ImpSetStyleSheet( sal_uInt16 nHLevel ) else if ( nHLevel == 4 ) nPoints = 11; - nPoints = OutputDevice::LogicToLogic( nPoints, MAP_POINT, eUnit ); + nPoints = OutputDevice::LogicToLogic( nPoints, MapUnit::MapPoint, eUnit ); SvxFontHeightItem aHeightItem( nPoints, 100, EE_CHAR_FONTHEIGHT ); aItems.Put( aHeightItem ); @@ -635,8 +635,8 @@ void EditHTMLParser::ImpSetStyleSheet( sal_uInt16 nHLevel ) if ( !nHLevel || ((nHLevel >= 1) && (nHLevel <= 6)) ) { SvxULSpaceItem aULSpaceItem( EE_PARA_ULSPACE ); - aULSpaceItem.SetUpper( (sal_uInt16)OutputDevice::LogicToLogic( 42, MAP_10TH_MM, eUnit ) ); - aULSpaceItem.SetLower( (sal_uInt16)OutputDevice::LogicToLogic( 35, MAP_10TH_MM, eUnit ) ); + aULSpaceItem.SetUpper( (sal_uInt16)OutputDevice::LogicToLogic( 42, MapUnit::Map10thMM, eUnit ) ); + aULSpaceItem.SetLower( (sal_uInt16)OutputDevice::LogicToLogic( 35, MapUnit::Map10thMM, eUnit ) ); aItems.Put( aULSpaceItem ); } } diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx index bf03c9042241..19a4225073db 100644 --- a/editeng/source/editeng/eertfpar.cxx +++ b/editeng/source/editeng/eertfpar.cxx @@ -55,7 +55,7 @@ EditRTFParser::EditRTFParser( SvxRTFParser(rAttrPool, rIn, nullptr), aCurSel(aSel), mpEditEngine(pEditEngine), - aRTFMapMode(MAP_TWIP), + aRTFMapMode(MapUnit::MapTwip), nDefFont(0), nDefTab(0), bLastActionInsertParaBreak(false) @@ -143,7 +143,7 @@ void EditRTFParser::AddRTFDefaultValues( const EditPaM& rStart, const EditPaM& r { // Problem: DefFont and DefFontHeight Size aSz( 12, 0 ); - MapMode aPntMode( MAP_POINT ); + MapMode aPntMode( MapUnit::MapPoint ); MapMode _aEditMapMode(mpEditEngine->GetRefDevice()->GetMapMode().GetMapUnit()); aSz = mpEditEngine->GetRefDevice()->LogicToLogic(aSz, &aPntMode, &_aEditMapMode); SvxFontHeightItem aFontHeightItem( aSz.Width(), 100, EE_CHAR_FONTHEIGHT ); @@ -495,7 +495,7 @@ void EditRTFParser::CreateStyleSheets() void EditRTFParser::CalcValue() { - const MapUnit eDestUnit = static_cast< MapUnit >( aEditMapMode.GetMapUnit() ); + const MapUnit eDestUnit = aEditMapMode.GetMapUnit(); const MapUnit eSrcUnit = aRTFMapMode.GetMapUnit(); if (eDestUnit != eSrcUnit) nTokenValue = OutputDevice::LogicToLogic( (long)nTokenValue, eSrcUnit, eDestUnit ); diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index b04a4918e5ba..3d4498084444 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -179,7 +179,7 @@ void lcl_translateTwips(vcl::Window& rParent, vcl::Window& rChild) if (!rChild.IsMapModeEnabled()) { MapMode aMapMode(rChild.GetMapMode()); - aMapMode.SetMapUnit(MAP_TWIP); + aMapMode.SetMapUnit(MapUnit::MapTwip); aMapMode.SetScaleX(rParent.GetMapMode().GetScaleX()); aMapMode.SetScaleY(rParent.GetMapMode().GetScaleY()); rChild.SetMapMode(aMapMode); @@ -351,7 +351,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou if (comphelper::LibreOfficeKit::isActive() && mpViewShell && !pOldRegion) { pOutWin->Push(PushFlags::MAPMODE); - if (pOutWin->GetMapMode().GetMapUnit() == MAP_TWIP) + if (pOutWin->GetMapMode().GetMapUnit() == MapUnit::MapTwip) { // Find the parent that is not right // on top of us to use its offset. @@ -369,10 +369,10 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou } } - bool bMm100ToTwip = pOutWin->GetMapMode().GetMapUnit() == MAP_100TH_MM; + bool bMm100ToTwip = pOutWin->GetMapMode().GetMapUnit() == MapUnit::Map100thMM; Point aOrigin; - if (pOutWin->GetMapMode().GetMapUnit() == MAP_TWIP) + if (pOutWin->GetMapMode().GetMapUnit() == MapUnit::MapTwip) // Writer comments: they use editeng, but are separate widgets. aOrigin = pOutWin->GetMapMode().GetOrigin(); @@ -388,7 +388,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou Rectangle& rStart = aRectangles.front(); Rectangle aStart = Rectangle(rStart.Left(), rStart.Top(), rStart.Left() + 1, rStart.Bottom()); if (bMm100ToTwip) - aStart = OutputDevice::LogicToLogic(aStart, MAP_100TH_MM, MAP_TWIP); + aStart = OutputDevice::LogicToLogic(aStart, MapUnit::Map100thMM, MapUnit::MapTwip); aStart.Move(aOrigin.getX(), aOrigin.getY()); mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, aStart.toString().getStr()); @@ -396,7 +396,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou Rectangle& rEnd = aRectangles.back(); Rectangle aEnd = Rectangle(rEnd.Right() - 1, rEnd.Top(), rEnd.Right(), rEnd.Bottom()); if (bMm100ToTwip) - aEnd = OutputDevice::LogicToLogic(aEnd, MAP_100TH_MM, MAP_TWIP); + aEnd = OutputDevice::LogicToLogic(aEnd, MapUnit::Map100thMM, MapUnit::MapTwip); aEnd.Move(aOrigin.getX(), aOrigin.getY()); mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr()); @@ -406,7 +406,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou for (Rectangle & rRectangle : aRectangles) { if (bMm100ToTwip) - rRectangle = OutputDevice::LogicToLogic(rRectangle, MAP_100TH_MM, MAP_TWIP); + rRectangle = OutputDevice::LogicToLogic(rRectangle, MapUnit::Map100thMM, MapUnit::MapTwip); rRectangle.Move(aOrigin.getX(), aOrigin.getY()); v.push_back(rRectangle.toString().getStr()); } @@ -444,7 +444,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou void ImpEditView::GetSelectionRectangles(std::vector<Rectangle>& rLogicRects) { - bool bMm100ToTwip = pOutWin->GetMapMode().GetMapUnit() == MAP_100TH_MM; + bool bMm100ToTwip = pOutWin->GetMapMode().GetMapUnit() == MapUnit::Map100thMM; vcl::Region aRegion; DrawSelection(aEditSelection, &aRegion); aRegion.GetRegionRectangles(rLogicRects); @@ -452,7 +452,7 @@ void ImpEditView::GetSelectionRectangles(std::vector<Rectangle>& rLogicRects) for (Rectangle& rRectangle : rLogicRects) { if (bMm100ToTwip) - rRectangle = OutputDevice::LogicToLogic(rRectangle, MAP_100TH_MM, MAP_TWIP); + rRectangle = OutputDevice::LogicToLogic(rRectangle, MapUnit::Map100thMM, MapUnit::MapTwip); } } @@ -460,7 +460,7 @@ void ImpEditView::ImplDrawHighlightRect( OutputDevice* _pTarget, const Point& rD { if ( rDocPosTopLeft.X() != rDocPosBottomRight.X() ) { - bool bPixelMode = _pTarget->GetMapMode() == MAP_PIXEL; + bool bPixelMode = _pTarget->GetMapMode() == MapUnit::MapPixel; Point aPnt1( GetWindowPos( rDocPosTopLeft ) ); Point aPnt2( GetWindowPos( rDocPosBottomRight ) ); @@ -1007,9 +1007,9 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor ) Rectangle aRect(rPos.getX(), rPos.getY(), rPos.getX() + GetCursor()->GetWidth(), rPos.getY() + GetCursor()->GetHeight()); // LOK output is always in twips, convert from mm100 if necessary. - if (pOutWin->GetMapMode().GetMapUnit() == MAP_100TH_MM) - aRect = OutputDevice::LogicToLogic(aRect, MAP_100TH_MM, MAP_TWIP); - else if (pOutWin->GetMapMode().GetMapUnit() == MAP_TWIP) + if (pOutWin->GetMapMode().GetMapUnit() == MapUnit::Map100thMM) + aRect = OutputDevice::LogicToLogic(aRect, MapUnit::Map100thMM, MapUnit::MapTwip); + else if (pOutWin->GetMapMode().GetMapUnit() == MapUnit::MapTwip) { // Writer comments: they use editeng, but are separate widgets. Point aOrigin = pOutWin->GetMapMode().GetOrigin(); diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 0badeb5a712a..4fd52827283e 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -194,7 +194,7 @@ void ImpEditEngine::SetRefDevice( OutputDevice* pRef ) if ( !pRef ) { pRefDev = VclPtr<VirtualDevice>::Create(); - pRefDev->SetMapMode( MAP_TWIP ); + pRefDev->SetMapMode( MapUnit::MapTwip ); bOwnerOfRefDev = true; } else { @@ -219,7 +219,7 @@ void ImpEditEngine::SetRefMapMode( const MapMode& rMapMode ) if ( !bOwnerOfRefDev ) { pRefDev = VclPtr<VirtualDevice>::Create(); - pRefDev->SetMapMode( MAP_TWIP ); + pRefDev->SetMapMode( MapUnit::MapTwip ); SetRefDevice( pRefDev ); bOwnerOfRefDev = true; } diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index c994c40e65c0..e98c5adda0fc 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -535,7 +535,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) rOutput.WriteChar( '}' ) << endl; // DefTab: - MapMode aTwpMode( MAP_TWIP ); + MapMode aTwpMode( MapUnit::MapTwip ); sal_uInt16 nDefTabTwps = (sal_uInt16) GetRefDevice()->LogicToLogic( Point( aEditDoc.GetDefTab(), 0 ), &GetRefMapMode(), &aTwpMode ).X(); @@ -965,7 +965,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, SvxFont aFont; ContentNode* pNode = aEditDoc.GetObject( nPara ); SeekCursor( pNode, nPos, aFont ); - MapMode aPntMode( MAP_POINT ); + MapMode aPntMode( MapUnit::MapPoint ); long nFontHeight = GetRefDevice()->LogicToLogic( aFont.GetFontSize(), &GetRefMapMode(), &aPntMode ).Height(); nFontHeight *=2; // Half Points @@ -3112,7 +3112,7 @@ bool ImpEditEngine::ImplHasText() const sal_Int32 ImpEditEngine::LogicToTwips(sal_Int32 n) { Size aSz(n, 0); - MapMode aTwipsMode( MAP_TWIP ); + MapMode aTwipsMode( MapUnit::MapTwip ); aSz = pRefDev->LogicToLogic( aSz, nullptr, &aTwipsMode ); return aSz.Width(); } diff --git a/editeng/source/items/itemtype.cxx b/editeng/source/items/itemtype.cxx index ee1749186b8b..c8ff68c37e26 100644 --- a/editeng/source/items/itemtype.cxx +++ b/editeng/source/items/itemtype.cxx @@ -39,45 +39,45 @@ OUString GetMetricText( long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const In switch ( eDestUnit ) { - case MAP_100TH_MM: - case MAP_10TH_MM: - case MAP_MM: - case MAP_CM: + case MapUnit::Map100thMM: + case MapUnit::Map10thMM: + case MapUnit::MapMM: + case MapUnit::MapCM: { nRet = (long)OutputDevice::LogicToLogic( - nVal, (MapUnit)eSrcUnit, (MapUnit)MAP_100TH_MM ); + nVal, (MapUnit)eSrcUnit, (MapUnit)MapUnit::Map100thMM ); switch ( eDestUnit ) { - case MAP_100TH_MM: nRet *= 1000; break; - case MAP_10TH_MM: nRet *= 100; break; - case MAP_MM: nRet *= 10; break; + case MapUnit::Map100thMM: nRet *= 1000; break; + case MapUnit::Map10thMM: nRet *= 100; break; + case MapUnit::MapMM: nRet *= 10; break; default: ;//prevent warning } break; } - case MAP_1000TH_INCH: - case MAP_100TH_INCH: - case MAP_10TH_INCH: - case MAP_INCH: + case MapUnit::Map1000thInch: + case MapUnit::Map100thInch: + case MapUnit::Map10thInch: + case MapUnit::MapInch: { nRet = OutputDevice::LogicToLogic( - nVal, (MapUnit)eSrcUnit, (MapUnit)MAP_1000TH_INCH ); + nVal, (MapUnit)eSrcUnit, (MapUnit)MapUnit::Map1000thInch ); switch ( eDestUnit ) { - case MAP_1000TH_INCH: nRet *= 1000; break; - case MAP_100TH_INCH: nRet *= 100; break; - case MAP_10TH_INCH: nRet *= 10; break; + case MapUnit::Map1000thInch: nRet *= 1000; break; + case MapUnit::Map100thInch: nRet *= 100; break; + case MapUnit::Map10thInch: nRet *= 10; break; default: ;//prevent warning } break; } - case MAP_POINT: - case MAP_TWIP: - case MAP_PIXEL: + case MapUnit::MapPoint: + case MapUnit::MapTwip: + case MapUnit::MapPixel: return OUString::number( (long)OutputDevice::LogicToLogic( nVal, (MapUnit)eSrcUnit, (MapUnit)eDestUnit )); @@ -86,7 +86,7 @@ OUString GetMetricText( long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const In return OUString(); } - if ( MAP_CM == eDestUnit || MAP_INCH == eDestUnit ) + if ( MapUnit::MapCM == eDestUnit || MapUnit::MapInch == eDestUnit ) { sal_Int32 nMod = nRet % 10; @@ -174,32 +174,32 @@ sal_uInt16 GetMetricId( MapUnit eUnit ) switch ( eUnit ) { - case MAP_100TH_MM: - case MAP_10TH_MM: - case MAP_MM: + case MapUnit::Map100thMM: + case MapUnit::Map10thMM: + case MapUnit::MapMM: nId = RID_SVXITEMS_METRIC_MM; break; - case MAP_CM: + case MapUnit::MapCM: nId = RID_SVXITEMS_METRIC_CM; break; - case MAP_1000TH_INCH: - case MAP_100TH_INCH: - case MAP_10TH_INCH: - case MAP_INCH: + case MapUnit::Map1000thInch: + case MapUnit::Map100thInch: + case MapUnit::Map10thInch: + case MapUnit::MapInch: nId = RID_SVXITEMS_METRIC_INCH; break; - case MAP_POINT: + case MapUnit::MapPoint: nId = RID_SVXITEMS_METRIC_POINT; break; - case MAP_TWIP: + case MapUnit::MapTwip: nId = RID_SVXITEMS_METRIC_TWIP; break; - case MAP_PIXEL: + case MapUnit::MapPixel: nId = RID_SVXITEMS_METRIC_PIXEL; break; diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index cde00e370a0d..3b6eba562c33 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -484,10 +484,10 @@ void SvxNumberFormat::SetIndentAt( const long nIndentAt ) Size SvxNumberFormat::GetGraphicSizeMM100(const Graphic* pGraphic) { - const MapMode aMapMM100( MAP_100TH_MM ); + const MapMode aMapMM100( MapUnit::Map100thMM ); const Size& rSize = pGraphic->GetPrefSize(); Size aRetSize; - if ( pGraphic->GetPrefMapMode().GetMapUnit() == MAP_PIXEL ) + if ( pGraphic->GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel ) { OutputDevice* pOutDev = Application::GetDefaultDevice(); MapMode aOldMap( pOutDev->GetMapMode() ); diff --git a/editeng/source/items/paperinf.cxx b/editeng/source/items/paperinf.cxx index 42d49e768369..bde8319d93e7 100644 --- a/editeng/source/items/paperinf.cxx +++ b/editeng/source/items/paperinf.cxx @@ -37,7 +37,7 @@ Size SvxPaperInfo::GetPaperSize( Paper ePaper, MapUnit eUnit ) { PaperInfo aInfo(ePaper); Size aRet(aInfo.getWidth(), aInfo.getHeight()); // in 100thMM - return eUnit == MAP_100TH_MM ? aRet : OutputDevice::LogicToLogic(aRet, MAP_100TH_MM, eUnit); + return eUnit == MapUnit::Map100thMM ? aRet : OutputDevice::LogicToLogic(aRet, MapUnit::Map100thMM, eUnit); } /*------------------------------------------------------------------------ @@ -70,7 +70,7 @@ Size SvxPaperInfo::GetPaperSize( const Printer* pPrinter ) if ( aMap1 == aMap2 ) aPaperSize = - pPrinter->PixelToLogic( aPaperSize, MapMode( MAP_TWIP ) ); + pPrinter->PixelToLogic( aPaperSize, MapMode( MapUnit::MapTwip ) ); return aPaperSize; } @@ -85,7 +85,7 @@ Size SvxPaperInfo::GetPaperSize( const Printer* pPrinter ) Paper SvxPaperInfo::GetSvxPaper( const Size &rSize, MapUnit eUnit, bool bSloppy ) { - Size aSize(eUnit == MAP_100TH_MM ? rSize : OutputDevice::LogicToLogic(rSize, eUnit, MAP_100TH_MM)); + Size aSize(eUnit == MapUnit::Map100thMM ? rSize : OutputDevice::LogicToLogic(rSize, eUnit, MapUnit::Map100thMM)); PaperInfo aInfo(aSize.Width(), aSize.Height()); if (bSloppy) aInfo.doSloppyFit(); @@ -95,9 +95,9 @@ Paper SvxPaperInfo::GetSvxPaper( const Size &rSize, MapUnit eUnit, bool bSloppy long SvxPaperInfo::GetSloppyPaperDimension( long nSize ) { - nSize = OutputDevice::LogicToLogic(nSize, MAP_TWIP, MAP_100TH_MM); + nSize = OutputDevice::LogicToLogic(nSize, MapUnit::MapTwip, MapUnit::Map100thMM); nSize = PaperInfo::sloppyFitPageDimension(nSize); - return OutputDevice::LogicToLogic(nSize, MAP_100TH_MM, MAP_TWIP); + return OutputDevice::LogicToLogic(nSize, MapUnit::Map100thMM, MapUnit::MapTwip); } @@ -105,7 +105,7 @@ Size SvxPaperInfo::GetDefaultPaperSize( MapUnit eUnit ) { PaperInfo aInfo(PaperInfo::getSystemDefaultPaper()); Size aRet(aInfo.getWidth(), aInfo.getHeight()); - return eUnit == MAP_100TH_MM ? aRet : OutputDevice::LogicToLogic(aRet, MAP_100TH_MM, eUnit); + return eUnit == MapUnit::Map100thMM ? aRet : OutputDevice::LogicToLogic(aRet, MapUnit::Map100thMM, eUnit); } /*------------------------------------------------------------------------ diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 410b83a872c4..b7e4446b450b 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -727,13 +727,13 @@ SvStream& SvxFontHeightItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) rStrm.WriteUInt16( GetHeight() ); if( FONTHEIGHT_UNIT_VERSION <= nItemVersion ) - rStrm.WriteUInt16( GetProp() ).WriteUInt16( GetPropUnit() ); + rStrm.WriteUInt16( GetProp() ).WriteUInt16( (sal_uInt16)GetPropUnit() ); else { // When exporting to the old versions the relative information is lost // when there is no percentage sal_uInt16 _nProp = GetProp(); - if( MAP_RELATIVE != GetPropUnit() ) + if( MapUnit::MapRelative != GetPropUnit() ) _nProp = 100; rStrm.WriteUInt16( _nProp ); } @@ -744,7 +744,8 @@ SvStream& SvxFontHeightItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) SfxPoolItem* SvxFontHeightItem::Create( SvStream& rStrm, sal_uInt16 nVersion ) const { - sal_uInt16 nsize, nprop = 0, nPropUnit = MAP_RELATIVE; + sal_uInt16 nsize, nprop = 0; + MapUnit nPropUnit = MapUnit::MapRelative; rStrm.ReadUInt16( nsize ); @@ -758,7 +759,11 @@ SfxPoolItem* SvxFontHeightItem::Create( SvStream& rStrm, } if( FONTHEIGHT_UNIT_VERSION <= nVersion ) - rStrm.ReadUInt16( nPropUnit ); + { + sal_uInt16 nTmp; + rStrm.ReadUInt16( nTmp ); + nPropUnit = (MapUnit)nTmp; + } SvxFontHeightItem* pItem = new SvxFontHeightItem( nsize, 100, Which() ); pItem->SetProp( nprop, (MapUnit)nPropUnit ); @@ -801,22 +806,22 @@ bool SvxFontHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const aFontHeight.Height = fRoundPoints; } - aFontHeight.Prop = (sal_Int16)(MAP_RELATIVE == ePropUnit ? nProp : 100); + aFontHeight.Prop = (sal_Int16)(MapUnit::MapRelative == ePropUnit ? nProp : 100); float fRet = (float)(short)nProp; switch( ePropUnit ) { - case MAP_RELATIVE: + case MapUnit::MapRelative: fRet = 0.; break; - case MAP_100TH_MM: + case MapUnit::Map100thMM: fRet = convertMm100ToTwip(fRet); fRet /= 20.; break; - case MAP_POINT: + case MapUnit::MapPoint: break; - case MAP_TWIP: + case MapUnit::MapTwip: fRet /= 20.; break; default: ;//prevent warning @@ -843,24 +848,24 @@ bool SvxFontHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const } break; case MID_FONTHEIGHT_PROP: - rVal <<= (sal_Int16)(MAP_RELATIVE == ePropUnit ? nProp : 100); + rVal <<= (sal_Int16)(MapUnit::MapRelative == ePropUnit ? nProp : 100); break; case MID_FONTHEIGHT_DIFF: { float fRet = (float)(short)nProp; switch( ePropUnit ) { - case MAP_RELATIVE: + case MapUnit::MapRelative: fRet = 0.; break; - case MAP_100TH_MM: + case MapUnit::Map100thMM: fRet = convertMm100ToTwip(fRet); fRet /= 20.; break; - case MAP_POINT: + case MapUnit::MapPoint: break; - case MAP_TWIP: + case MapUnit::MapTwip: fRet /= 20.; break; default: ;//prevent warning @@ -885,11 +890,11 @@ static sal_uInt32 lcl_GetRealHeight_Impl(sal_uInt32 nHeight, sal_uInt16 nProp, M short nDiff = 0; switch( eProp ) { - case MAP_RELATIVE: + case MapUnit::MapRelative: nRet *= 100; nRet /= nProp; break; - case MAP_POINT: + case MapUnit::MapPoint: { short nTemp = (short)nProp; nDiff = nTemp * 20; @@ -897,11 +902,11 @@ static sal_uInt32 lcl_GetRealHeight_Impl(sal_uInt32 nHeight, sal_uInt16 nProp, M nDiff = (short)convertTwipToMm100((long)(nDiff)); } break; - case MAP_100TH_MM: + case MapUnit::Map100thMM: //then the core is surely also in 1/100 mm nDiff = (short)nProp; break; - case MAP_TWIP: + case MapUnit::MapTwip: // Here surely TWIP nDiff = ((short)nProp); break; @@ -926,7 +931,7 @@ bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if ( rVal >>= aFontHeight ) { // Height - ePropUnit = MAP_RELATIVE; + ePropUnit = MapUnit::MapRelative; nProp = 100; double fPoint = aFontHeight.Height; if( fPoint < 0. || fPoint > 10000. ) @@ -944,7 +949,7 @@ bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) break; case MID_FONTHEIGHT: { - ePropUnit = MAP_RELATIVE; + ePropUnit = MapUnit::MapRelative; nProp = 100; double fPoint = 0; if(!(rVal >>= fPoint)) @@ -973,7 +978,7 @@ bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) nHeight *= nNew; nHeight /= 100; nProp = nNew; - ePropUnit = MAP_RELATIVE; + ePropUnit = MapUnit::MapRelative; } break; case MID_FONTHEIGHT_DIFF: @@ -990,7 +995,7 @@ bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) sal_Int16 nCoreDiffValue = (sal_Int16)(fValue * 20.); nHeight += bConvert ? nCoreDiffValue : convertTwipToMm100(nCoreDiffValue); nProp = (sal_uInt16)((sal_Int16)fValue); - ePropUnit = MAP_POINT; + ePropUnit = MapUnit::MapPoint; } break; } @@ -1006,7 +1011,7 @@ bool SvxFontHeightItem::GetPresentation OUString& rText, const IntlWrapper *pIntl ) const { - if( MAP_RELATIVE != ePropUnit ) + if( MapUnit::MapRelative != ePropUnit ) { rText = OUString::number( (short)nProp ) + " " + EE_RESSTR( GetMetricId( ePropUnit ) ); @@ -1016,8 +1021,8 @@ bool SvxFontHeightItem::GetPresentation else if( 100 == nProp ) { rText = GetMetricText( (long)nHeight, - eCoreUnit, MAP_POINT, pIntl ) + - " " + EE_RESSTR(GetMetricId(MAP_POINT)); + eCoreUnit, MapUnit::MapPoint, pIntl ) + + " " + EE_RESSTR(GetMetricId(MapUnit::MapPoint)); } else rText = OUString::number( nProp ) + "%"; @@ -1049,7 +1054,7 @@ void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewP { DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); - if( MAP_RELATIVE != eUnit ) + if( MapUnit::MapRelative != eUnit ) nHeight = nNewHeight + ::ItemToControl( (short)nNewProp, eUnit, FUNIT_TWIP ); else if( 100 != nNewProp ) @@ -1066,7 +1071,7 @@ void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp, { DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); - if( MAP_RELATIVE != eMetric ) + if( MapUnit::MapRelative != eMetric ) nHeight = nNewHeight + ::ControlToItem( ::ItemToControl((short)nNewProp, eMetric, FUNIT_TWIP ), FUNIT_TWIP, @@ -1086,7 +1091,7 @@ void SvxFontHeightItem::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr())); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("height"), BAD_CAST(OString::number(nHeight).getStr())); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("prop"), BAD_CAST(OString::number(nProp).getStr())); - xmlTextWriterWriteAttribute(pWriter, BAD_CAST("propUnit"), BAD_CAST(OString::number(ePropUnit).getStr())); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("propUnit"), BAD_CAST(OString::number((int)ePropUnit).getStr())); xmlTextWriterEndElement(pWriter); } @@ -1194,8 +1199,8 @@ bool SvxFontWidthItem::GetPresentation if ( 100 == nProp ) { rText = GetMetricText( (long)nWidth, - eCoreUnit, MAP_POINT, pIntl ) + - " " + EE_RESSTR(GetMetricId(MAP_POINT)); + eCoreUnit, MapUnit::MapPoint, pIntl ) + + " " + EE_RESSTR(GetMetricId(MapUnit::MapPoint)); } else rText = OUString::number( nProp ) + "%"; @@ -2033,8 +2038,8 @@ bool SvxKerningItem::GetPresentation switch ( ePres ) { case SfxItemPresentation::Nameless: - rText = GetMetricText( (long)GetValue(), eCoreUnit, MAP_POINT, pIntl ) + - " " + EE_RESSTR(GetMetricId(MAP_POINT)); + rText = GetMetricText( (long)GetValue(), eCoreUnit, MapUnit::MapPoint, pIntl ) + + " " + EE_RESSTR(GetMetricId(MapUnit::MapPoint)); return true; case SfxItemPresentation::Complete: { @@ -2049,8 +2054,8 @@ bool SvxKerningItem::GetPresentation if ( nId ) rText += EE_RESSTR(nId); rText = rText + - GetMetricText( (long)GetValue(), eCoreUnit, MAP_POINT, pIntl ) + - " " + EE_RESSTR(GetMetricId(MAP_POINT)); + GetMetricText( (long)GetValue(), eCoreUnit, MapUnit::MapPoint, pIntl ) + + " " + EE_RESSTR(GetMetricId(MapUnit::MapPoint)); return true; } default: ; //prevent warning diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index a7f86b652142..f385cee753d0 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -1455,7 +1455,7 @@ Size Outliner::ImplGetBulletSize( sal_Int32 nPara ) } else { - pPara->aBulSize = OutputDevice::LogicToLogic( pFmt->GetGraphicSize(), MAP_100TH_MM, pEditEngine->GetRefDevice()->GetMapMode() ); + pPara->aBulSize = OutputDevice::LogicToLogic( pFmt->GetGraphicSize(), MapUnit::Map100thMM, pEditEngine->GetRefDevice()->GetMapMode() ); } } diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx index 31f7e48ea8e1..60bac11af009 100644 --- a/editeng/source/uno/unoipset.cxx +++ b/editeng/source/uno/unoipset.cxx @@ -103,9 +103,9 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry* if( nullptr == pItem && pPool ) pItem = &(pPool->GetDefaultItem( pMap->nWID )); - const MapUnit eMapUnit = pPool ? pPool->GetMetric((sal_uInt16)pMap->nWID) : MAP_100TH_MM; + const MapUnit eMapUnit = pPool ? pPool->GetMetric((sal_uInt16)pMap->nWID) : MapUnit::Map100thMM; sal_uInt8 nMemberId = pMap->nMemberId & (~SFX_METRIC_ITEM); - if( eMapUnit == MAP_100TH_MM ) + if( eMapUnit == MapUnit::Map100thMM ) nMemberId &= (~CONVERT_TWIPS); if(pItem) @@ -113,7 +113,7 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry* pItem->QueryValue( aVal, nMemberId ); if( pMap->nMemberId & SFX_METRIC_ITEM ) { - if( eMapUnit != MAP_100TH_MM ) + if( eMapUnit != MapUnit::Map100thMM ) { if ( !bDontConvertNegativeValues || SvxUnoCheckForPositiveValue( aVal ) ) SvxUnoConvertToMM( eMapUnit, aVal ); @@ -164,10 +164,10 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry* pMa { uno::Any aValue( rVal ); - const MapUnit eMapUnit = pPool ? pPool->GetMetric((sal_uInt16)pMap->nWID) : MAP_100TH_MM; + const MapUnit eMapUnit = pPool ? pPool->GetMetric((sal_uInt16)pMap->nWID) : MapUnit::Map100thMM; // check for needed metric translation - if( (pMap->nMemberId & SFX_METRIC_ITEM) && eMapUnit != MAP_100TH_MM ) + if( (pMap->nMemberId & SFX_METRIC_ITEM) && eMapUnit != MapUnit::Map100thMM ) { if ( !bDontConvertNegativeValues || SvxUnoCheckForPositiveValue( aValue ) ) SvxUnoConvertFromMM( eMapUnit, aValue ); @@ -176,7 +176,7 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry* pMa SfxPoolItem *pNewItem = pItem->Clone(); sal_uInt8 nMemberId = pMap->nMemberId & (~SFX_METRIC_ITEM); - if( eMapUnit == MAP_100TH_MM ) + if( eMapUnit == MapUnit::Map100thMM ) nMemberId &= (~CONVERT_TWIPS); if( pNewItem->PutValue( aValue, nMemberId ) ) @@ -200,7 +200,7 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry* // No UsrAny detected yet, generate Default entry and return this const MapUnit eMapUnit = mrItemPool.GetMetric((sal_uInt16)pMap->nWID); sal_uInt8 nMemberId = pMap->nMemberId & (~SFX_METRIC_ITEM); - if( eMapUnit == MAP_100TH_MM ) + if( eMapUnit == MapUnit::Map100thMM ) nMemberId &= (~CONVERT_TWIPS); uno::Any aVal; SfxItemSet aSet( mrItemPool, pMap->nWID, pMap->nWID); @@ -226,7 +226,7 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry* if( pMap->nMemberId & SFX_METRIC_ITEM ) { // check for needed metric translation - if(pMap->nMemberId & SFX_METRIC_ITEM && eMapUnit != MAP_100TH_MM) + if(pMap->nMemberId & SFX_METRIC_ITEM && eMapUnit != MapUnit::Map100thMM) { SvxUnoConvertToMM( eMapUnit, aVal ); } @@ -282,7 +282,7 @@ void SvxUnoConvertToMM( const MapUnit eSourceMapUnit, uno::Any & rMetric ) throw // map the metric of the itempool to 100th mm switch(eSourceMapUnit) { - case MAP_TWIP : + case MapUnit::MapTwip : { switch( rMetric.getValueTypeClass() ) { @@ -319,7 +319,7 @@ void SvxUnoConvertFromMM( const MapUnit eDestinationMapUnit, uno::Any & rMetric { switch(eDestinationMapUnit) { - case MAP_TWIP : + case MapUnit::MapTwip : { switch( rMetric.getValueTypeClass() ) { |