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 /sc/source/filter | |
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 'sc/source/filter')
-rw-r--r-- | sc/source/filter/excel/xechart.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xeescher.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/excel/xiescher.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/excel/xlescher.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/excel/xlroot.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/html/htmlexp.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/html/htmlimp.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/html/htmlpars.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/workbookhelper.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/worksheethelper.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/rtf/eeimpars.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/rtf/rtfparse.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlimprt.cxx | 2 |
13 files changed, 28 insertions, 28 deletions
diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index 1c03ccec29d6..181eb60dc20e 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -3311,7 +3311,7 @@ XclExpChChart::XclExpChChart( const XclExpRoot& rRoot, Reference< XChartDocument > const & xChartDoc, const Rectangle& rChartRect ) : XclExpChGroupBase( XclExpChRoot( rRoot, *this ), EXC_CHFRBLOCK_TYPE_CHART, EXC_ID_CHCHART, 16 ) { - Size aPtSize = OutputDevice::LogicToLogic( rChartRect.GetSize(), MapMode( MAP_100TH_MM ), MapMode( MAP_POINT ) ); + Size aPtSize = OutputDevice::LogicToLogic( rChartRect.GetSize(), MapMode( MapUnit::Map100thMM ), MapMode( MapUnit::MapPoint ) ); // rectangle is stored in 16.16 fixed-point format maRect.mnX = maRect.mnY = 0; maRect.mnWidth = static_cast< sal_Int32 >( aPtSize.Width() << 16 ); diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 6e2ee0622e64..c5a66a5a2e5b 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -258,7 +258,7 @@ void XclExpDffAnchorBase::SetFlags( const SdrObject& rSdrObj ) void XclExpDffAnchorBase::SetSdrObject( const SdrObject& rSdrObj ) { ImplSetFlags( rSdrObj ); - ImplCalcAnchorRect( rSdrObj.GetCurrentBoundRect(), MAP_100TH_MM ); + ImplCalcAnchorRect( rSdrObj.GetCurrentBoundRect(), MapUnit::Map100thMM ); } void XclExpDffAnchorBase::WriteDffData( EscherEx& rEscherEx ) const @@ -271,7 +271,7 @@ void XclExpDffAnchorBase::WriteDffData( EscherEx& rEscherEx ) const void XclExpDffAnchorBase::WriteData( EscherEx& rEscherEx, const Rectangle& rRect ) { // the passed rectangle is in twips - ImplCalcAnchorRect( rRect, MAP_TWIP ); + ImplCalcAnchorRect( rRect, MapUnit::MapTwip ); WriteDffData( rEscherEx ); } @@ -327,7 +327,7 @@ void XclExpDffEmbeddedAnchor::ImplCalcAnchorRect( const Rectangle& rRect, MapUni XclExpDffNoteAnchor::XclExpDffNoteAnchor( const XclExpRoot& rRoot, const Rectangle& rRect ) : XclExpDffAnchorBase( rRoot, EXC_ESC_ANCHOR_SIZELOCKED ) { - maAnchor.SetRect( rRoot, rRoot.GetCurrScTab(), rRect, MAP_100TH_MM ); + maAnchor.SetRect( rRoot, rRoot.GetCurrScTab(), rRect, MapUnit::Map100thMM ); } XclExpDffDropDownAnchor::XclExpDffDropDownAnchor( const XclExpRoot& rRoot, const ScAddress& rScPos ) : diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index 0ae25f02a302..9a1484d0ac55 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -1703,7 +1703,7 @@ SdrObjectPtr XclImpChartObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const inserted into the draw page. */ sal_Int64 nAspect = css::embed::Aspects::MSOLE_CONTENT; MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xEmbObj->getMapUnit( nAspect ) ); - Size aSize( vcl::Window::LogicToLogic( rAnchorRect.GetSize(), MapMode( MAP_100TH_MM ), MapMode( aUnit ) ) ); + Size aSize( vcl::Window::LogicToLogic( rAnchorRect.GetSize(), MapMode( MapUnit::Map100thMM ), MapMode( aUnit ) ) ); css::awt::Size aAwtSize( aSize.Width(), aSize.Height() ); xEmbObj->setVisualAreaSize( nAspect, aAwtSize ); @@ -1766,7 +1766,7 @@ void XclImpChartObj::FinalizeTabChart() // create the object anchor XclObjAnchor aAnchor; - aAnchor.SetRect( GetRoot(), GetCurrScTab(), Rectangle( 1000, 500, nWidth, nHeight ), MAP_100TH_MM ); + aAnchor.SetRect( GetRoot(), GetCurrScTab(), Rectangle( 1000, 500, nWidth, nHeight ), MapUnit::Map100thMM ); SetAnchor( aAnchor ); } @@ -4131,7 +4131,7 @@ void XclImpSheetDrawing::ConvertObjects( XclImpDffConverter& rDffConv ) Rectangle XclImpSheetDrawing::CalcAnchorRect( const XclObjAnchor& rAnchor, bool /*bDffAnchor*/ ) const { - return rAnchor.GetRect( GetRoot(), maScUsedArea.aStart.Tab(), MAP_100TH_MM ); + return rAnchor.GetRect( GetRoot(), maScUsedArea.aStart.Tab(), MapUnit::Map100thMM ); } void XclImpSheetDrawing::OnObjectInserted( const XclImpDrawObjBase& rDrawObj ) diff --git a/sc/source/filter/excel/xlescher.cxx b/sc/source/filter/excel/xlescher.cxx index 70a4d79dcb15..de02aaab6ac0 100644 --- a/sc/source/filter/excel/xlescher.cxx +++ b/sc/source/filter/excel/xlescher.cxx @@ -45,13 +45,13 @@ double lclGetTwipsScale( MapUnit eMapUnit ) Calc's strange definition of a point (1 inch == 72.27 points, instead of 72 points). NOTE: Calc's definition changed from TeX points (72.27) to PS points - (72), so the MAP_TWIP case now actually also delivers a scale of 1.0 + (72), so the MapUnit::MapTwip case now actually also delivers a scale of 1.0 */ double fScale = 1.0; switch( eMapUnit ) { - case MAP_TWIP: fScale = 1; break; // Calc twips <-> real twips - case MAP_100TH_MM: fScale = HMM_PER_TWIPS; break; // Calc twips <-> 1/100mm + case MapUnit::MapTwip: fScale = 1; break; // Calc twips <-> real twips + case MapUnit::Map100thMM: fScale = HMM_PER_TWIPS; break; // Calc twips <-> 1/100mm default: OSL_FAIL( "lclGetTwipsScale - map unit not implemented" ); } return fScale; @@ -183,8 +183,8 @@ void XclObjAnchor::SetRect( const Size& rPageSize, sal_Int32 nScaleX, sal_Int32 double fScale = 1.0; switch( eMapUnit ) { - case MAP_TWIP: fScale = HMM_PER_TWIPS; break; // Calc twips -> 1/100mm - case MAP_100TH_MM: fScale = 1.0; break; // Calc 1/100mm -> 1/100mm + case MapUnit::MapTwip: fScale = HMM_PER_TWIPS; break; // Calc twips -> 1/100mm + case MapUnit::Map100thMM: fScale = 1.0; break; // Calc 1/100mm -> 1/100mm default: OSL_FAIL( "XclObjAnchor::SetRect - map unit not implemented" ); } diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx index a1d9a20cd703..97ece71e8236 100644 --- a/sc/source/filter/excel/xlroot.cxx +++ b/sc/source/filter/excel/xlroot.cxx @@ -344,7 +344,7 @@ ScEditEngineDefaulter& XclRoot::GetEditEngine() const { mrData.mxEditEngine.reset( new ScEditEngineDefaulter( GetDoc().GetEnginePool() ) ); ScEditEngineDefaulter& rEE = *mrData.mxEditEngine; - rEE.SetRefMapMode( MAP_100TH_MM ); + rEE.SetRefMapMode( MapUnit::Map100thMM ); rEE.SetEditTextObjectPool( GetDoc().GetEditPool() ); rEE.SetUpdateMode( false ); rEE.EnableUndo( false ); @@ -359,7 +359,7 @@ ScHeaderEditEngine& XclRoot::GetHFEditEngine() const { mrData.mxHFEditEngine.reset( new ScHeaderEditEngine( EditEngine::CreatePool() ) ); ScHeaderEditEngine& rEE = *mrData.mxHFEditEngine; - rEE.SetRefMapMode( MAP_TWIP ); // headers/footers use twips as default metric + rEE.SetRefMapMode( MapUnit::MapTwip ); // headers/footers use twips as default metric rEE.SetUpdateMode( false ); rEE.EnableUndo( false ); rEE.SetControlWord( rEE.GetControlWord() & ~EEControlBits::ALLOWBIGOBJS ); @@ -386,7 +386,7 @@ EditEngine& XclRoot::GetDrawEditEngine() const { mrData.mxDrawEditEng.reset( new EditEngine( &GetDoc().GetDrawLayer()->GetItemPool() ) ); EditEngine& rEE = *mrData.mxDrawEditEng; - rEE.SetRefMapMode( MAP_100TH_MM ); + rEE.SetRefMapMode( MapUnit::Map100thMM ); rEE.SetUpdateMode( false ); rEE.EnableUndo( false ); rEE.SetControlWord( rEE.GetControlWord() & ~EEControlBits::ALLOWBIGOBJS ); diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index ac29f3d31184..d30ed4f0b7b8 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -284,7 +284,7 @@ sal_uInt16 ScHTMLExport::ToPixel( sal_uInt16 nVal ) if( nVal ) { nVal = (sal_uInt16)pAppWin->LogicToPixel( - Size( nVal, nVal ), MapMode( MAP_TWIP ) ).Width(); + Size( nVal, nVal ), MapMode( MapUnit::MapTwip ) ).Width(); if( !nVal ) // If there's a Twip there should also be a Pixel nVal = 1; } @@ -294,7 +294,7 @@ sal_uInt16 ScHTMLExport::ToPixel( sal_uInt16 nVal ) Size ScHTMLExport::MMToPixel( const Size& rSize ) { Size aSize( rSize ); - aSize = pAppWin->LogicToPixel( rSize, MapMode( MAP_100TH_MM ) ); + aSize = pAppWin->LogicToPixel( rSize, MapMode( MapUnit::Map100thMM ) ); // If there's something there should also be a Pixel if ( !aSize.Width() && rSize.Width() ) aSize.Width() = 1; diff --git a/sc/source/filter/html/htmlimp.cxx b/sc/source/filter/html/htmlimp.cxx index f57b19734922..7af6d8fe928c 100644 --- a/sc/source/filter/html/htmlimp.cxx +++ b/sc/source/filter/html/htmlimp.cxx @@ -84,13 +84,13 @@ ScHTMLImport::ScHTMLImport( ScDocument* pDocP, const OUString& rBaseURL, const S } aPageSize.Width() -= nLeftMargin + nRightMargin; aPageSize.Height() -= nTopMargin + nBottomMargin; - aPageSize = pDefaultDev->LogicToPixel( aPageSize, MapMode( MAP_TWIP ) ); + aPageSize = pDefaultDev->LogicToPixel( aPageSize, MapMode( MapUnit::MapTwip ) ); } else { OSL_FAIL("no StyleSheet?!?"); aPageSize = pDefaultDev->LogicToPixel( - SvxPaperInfo::GetPaperSize( PAPER_A4 ), MapMode( MAP_TWIP ) ); + SvxPaperInfo::GetPaperSize( PAPER_A4 ), MapMode( MapUnit::MapTwip ) ); } if( bCalcWidthHeight ) mpParser = new ScHTMLLayoutParser( mpEngine, rBaseURL, aPageSize, pDocP ); diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 11ce7137cb43..11e6fe9f131c 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -299,7 +299,7 @@ sal_uLong ScHTMLLayoutParser::Read( SvStream& rStream, const OUString& rBaseURL for ( sal_uInt16 j = 1; j < nCount; j++ ) { aSize.Width() = (*pColOffset)[j] - nOff; - aSize = pDefaultDev->PixelToLogic( aSize, MapMode( MAP_TWIP ) ); + aSize = pDefaultDev->PixelToLogic( aSize, MapMode( MapUnit::MapTwip ) ); maColWidths[ j-1 ] = aSize.Width(); nOff = (*pColOffset)[j]; } diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx index cc8bd240afa0..44425e3cdb13 100644 --- a/sc/source/filter/oox/workbookhelper.cxx +++ b/sc/source/filter/oox/workbookhelper.cxx @@ -577,7 +577,7 @@ void WorkbookGlobals::initialize() // initialise edit engine ScDocument& rDoc = getScDocument(); mxEditEngine.reset( new ScEditEngineDefaulter( rDoc.GetEnginePool() ) ); - mxEditEngine->SetRefMapMode( MAP_100TH_MM ); + mxEditEngine->SetRefMapMode( MapUnit::Map100thMM ); mxEditEngine->SetEditTextObjectPool( rDoc.GetEditPool() ); mxEditEngine->SetUpdateMode( false ); mxEditEngine->EnableUndo( false ); diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx index bd03be374b5a..bb04088163fb 100644 --- a/sc/source/filter/oox/worksheethelper.cxx +++ b/sc/source/filter/oox/worksheethelper.cxx @@ -1189,14 +1189,14 @@ sal_Int32 getColumnWidth(UnitConverter& rConverter, double nWidth) double nCoeff = rConverter.getCoefficient(UNIT_DIGIT); ScopedVclPtrInstance<VirtualDevice> aDev; - long nPixel = aDev->LogicToPixel(Point(nCoeff, 0), MapMode(MAP_100TH_MM)).getX(); + long nPixel = aDev->LogicToPixel(Point(nCoeff, 0), MapMode(MapUnit::Map100thMM)).getX(); // the 1.047 has been experimentally chosen based on measurements with a screen ruler // TODO: fix the display of cells so that it no longer requires this hack // algorithm from OOXML spec part1: 18.3.1.13 sal_Int32 nColWidthPixel= std::floor( ( ( 256 * nWidth + std::floor( 128.0 / nPixel ) ) / 256.0 ) * nPixel ) * 1.047; - return aDev->PixelToLogic(Point(nColWidthPixel, 0), MapMode(MAP_100TH_MM)).getX(); + return aDev->PixelToLogic(Point(nColWidthPixel, 0), MapMode(MapUnit::Map100thMM)).getX(); } } diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx index 97b2e3204577..87018f11e8b5 100644 --- a/sc/source/filter/rtf/eeimpars.cxx +++ b/sc/source/filter/rtf/eeimpars.cxx @@ -496,7 +496,7 @@ bool ScEEImport::GraphicSize( SCCOL nCol, SCROW nRow, SCTAB /*nTab*/, ScEEParseE Size aSizePix = pI->aSize; aSizePix.Width() += 2 * pI->aSpace.X(); aSizePix.Height() += 2 * pI->aSpace.Y(); - Size aLogicSize = pDefaultDev->PixelToLogic( aSizePix, MapMode( MAP_TWIP ) ); + Size aLogicSize = pDefaultDev->PixelToLogic( aSizePix, MapMode( MapUnit::MapTwip ) ); if ( nDir & nHorizontal ) nWidth += aLogicSize.Width(); else if ( nWidth < aLogicSize.Width() ) @@ -580,11 +580,11 @@ void ScEEImport::InsertGraphic( SCCOL nCol, SCROW nRow, SCTAB nTab, aInsertPos.Y() += aSpace.Y(); } // Add offset of Spacing - aSpace = pDefaultDev->PixelToLogic( pI->aSpace, MapMode( MAP_100TH_MM ) ); + aSpace = pDefaultDev->PixelToLogic( pI->aSpace, MapMode( MapUnit::Map100thMM ) ); aInsertPos += aSpace; Size aSizePix = pI->aSize; - aLogicSize = pDefaultDev->PixelToLogic( aSizePix, MapMode( MAP_100TH_MM ) ); + aLogicSize = pDefaultDev->PixelToLogic( aSizePix, MapMode( MapUnit::Map100thMM ) ); // Limit size ::ScLimitSizeOnDrawPage( aLogicSize, aInsertPos, pPage->GetSize() ); diff --git a/sc/source/filter/rtf/rtfparse.cxx b/sc/source/filter/rtf/rtfparse.cxx index 923e69d8ba9b..b6b7a70fad9a 100644 --- a/sc/source/filter/rtf/rtfparse.cxx +++ b/sc/source/filter/rtf/rtfparse.cxx @@ -43,7 +43,7 @@ ScRTFParser::ScRTFParser( EditEngine* pEditP ) : bNewDef( false ) { // RTF default FontSize 12Pt - long nMM = OutputDevice::LogicToLogic( 12, MAP_POINT, MAP_100TH_MM ); + long nMM = OutputDevice::LogicToLogic( 12, MapUnit::MapPoint, MapUnit::Map100thMM ); pPool->SetPoolDefaultItem( SvxFontHeightItem( nMM, 100, EE_CHAR_FONTHEIGHT ) ); // Free-flying pInsDefault pInsDefault = new ScRTFCellDefault( pPool ); diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index e972a15a0853..b68e5db3bf2b 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -3430,7 +3430,7 @@ ScEditEngineDefaulter* ScXMLImport::GetEditEngine() if (!mpEditEngine) { mpEditEngine.reset(new ScEditEngineDefaulter(pDoc->GetEnginePool())); - mpEditEngine->SetRefMapMode(MAP_100TH_MM); + mpEditEngine->SetRefMapMode(MapUnit::Map100thMM); mpEditEngine->SetEditTextObjectPool(pDoc->GetEditPool()); mpEditEngine->SetUpdateMode(false); mpEditEngine->EnableUndo(false); |