sc/source/core/opencl/formulagroupcl.cxx | 54 ++++++++++++++----------------- sc/source/filter/excel/xeescher.cxx | 38 ++++++++++++--------- sc/source/ui/docshell/docsh4.cxx | 24 ++++++------- sc/source/ui/view/printfun.cxx | 42 ++++++++++++++++-------- 4 files changed, 88 insertions(+), 70 deletions(-)
New commits: commit 58d863eec084029716eccab7f941727fc650415e Author: Jochen Nitschke <j.nitschke+loger...@ok.de> Date: Fri Mar 25 19:29:35 2016 +0100 sc: replace local macros inline one time use macros convert other macros to local helpers HMM2XL(x) probably means hundredth millimetres to excel or xls. Excels seems to use pixel and the ratio of 1/100th mm per pixel happens to be 26.483 hmm/px @ 96dpi Change-Id: I84de6106b24daa7bd1fb355fc9bc4c355bc285c7 Reviewed-on: https://gerrit.libreoffice.org/23478 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noelgran...@gmail.com> diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 4cb6333..3b1bd76 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -113,34 +113,32 @@ std::string StackVarEnumToString(StackVar const e) { switch (e) { -#define CASE(x) case sv##x: return #x - CASE(Byte); - CASE(Double); - CASE(String); - CASE(SingleRef); - CASE(DoubleRef); - CASE(Matrix); - CASE(Index); - CASE(Jump); - CASE(External); - CASE(FAP); - CASE(JumpMatrix); - CASE(RefList); - CASE(EmptyCell); - CASE(MatrixCell); - CASE(HybridCell); - CASE(HybridValueCell); - CASE(ExternalSingleRef); - CASE(ExternalDoubleRef); - CASE(ExternalName); - CASE(SingleVectorRef); - CASE(DoubleVectorRef); - CASE(Subroutine); - CASE(Error); - CASE(Missing); - CASE(Sep); - CASE(Unknown); -#undef CASE + case svByte: return "Byte"; + case svDouble: return "Double"; + case svString: return "String"; + case svSingleRef: return "SingleRef"; + case svDoubleRef: return "DoubleRef"; + case svMatrix: return "Matrix"; + case svIndex: return "Index"; + case svJump: return "Jump"; + case svExternal: return "External"; + case svFAP: return "FAP"; + case svJumpMatrix: return "JumpMatrix"; + case svRefList: return "RefList"; + case svEmptyCell: return "EmptyCell"; + case svMatrixCell: return "MatrixCell"; + case svHybridCell: return "HybridCell"; + case svHybridValueCell: return "HybridValueCell"; + case svExternalSingleRef: return "ExternalSingleRef"; + case svExternalDoubleRef: return "ExternalDoubleRef"; + case svExternalName: return "ExternalName"; + case svSingleVectorRef: return "SingleVectorRef"; + case svDoubleVectorRef: return "DoubleVectorRef"; + case svSubroutine: return "Subroutine"; + case svError: return "Error"; + case svMissing: return "Missing"; + case svSep: return "Sep"; + case svUnknown: return "Unknown"; } return std::to_string(static_cast<int>(e)); } diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 44ec01e..1c0b2ed 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -103,12 +103,15 @@ using ::oox::drawingml::DrawingML; using ::oox::drawingml::ChartExport; using namespace oox; -#define HMM2XL(x) ((x)/26.5)+0.5 +namespace +{ -#if 1//def XLSX_OOXML_FUTURE -// these function are only used within that context -// Static Function Helpers -static const char *ToHorizAlign( SdrTextHorzAdjust eAdjust ) +inline long lcl_hmm2px(long nPixel) +{ + return static_cast<long>(nPixel*PIXEL_PER_INCH/1000.0/CM_PER_INCH)+0.5; +} + +const char *ToHorizAlign( SdrTextHorzAdjust eAdjust ) { switch( eAdjust ) { @@ -124,7 +127,7 @@ static const char *ToHorizAlign( SdrTextHorzAdjust eAdjust ) } } -static const char *ToVertAlign( SdrTextVertAdjust eAdjust ) +const char *ToVertAlign( SdrTextVertAdjust eAdjust ) { switch( eAdjust ) { @@ -140,7 +143,7 @@ static const char *ToVertAlign( SdrTextVertAdjust eAdjust ) } } -static void lcl_WriteAnchorVertex( sax_fastparser::FSHelperPtr rComments, Rectangle &aRect ) +void lcl_WriteAnchorVertex( sax_fastparser::FSHelperPtr rComments, Rectangle &aRect ) { rComments->startElement( FSNS( XML_xdr, XML_col ), FSEND ); rComments->writeEscaped( OUString::number( aRect.Left() ) ); @@ -155,9 +158,8 @@ static void lcl_WriteAnchorVertex( sax_fastparser::FSHelperPtr rComments, Rectan rComments->writeEscaped( OUString::number( aRect.Bottom() ) ); rComments->endElement( FSNS( XML_xdr, XML_rowOff ) ); } -#endif -static void lcl_GetFromTo( const XclExpRoot& rRoot, const Rectangle &aRect, sal_Int32 nTab, Rectangle &aFrom, Rectangle &aTo ) +void lcl_GetFromTo( const XclExpRoot& rRoot, const Rectangle &aRect, sal_Int32 nTab, Rectangle &aFrom, Rectangle &aTo ) { sal_Int32 nCol = 0, nRow = 0; sal_Int32 nColOff = 0, nRowOff= 0; @@ -180,8 +182,8 @@ static void lcl_GetFromTo( const XclExpRoot& rRoot, const Rectangle &aRect, sal_ } if( r.Left() > aRect.Left() && r.Top() > aRect.Top() ) { - aFrom = Rectangle( nCol-1, static_cast<long>(HMM2XL( nColOff )), - nRow-1, static_cast<long>(HMM2XL( nRowOff )) ); + aFrom = Rectangle( nCol-1, lcl_hmm2px( nColOff ), + nRow-1, lcl_hmm2px( nRowOff ) ); break; } } @@ -203,8 +205,8 @@ static void lcl_GetFromTo( const XclExpRoot& rRoot, const Rectangle &aRect, sal_ } if( r.Left() < aRect.Left() && r.Top() > aRect.Top() ) { - aFrom = Rectangle( nCol-1, static_cast<long>(HMM2XL( nColOff )), - nRow-1, static_cast<long>(HMM2XL( nRowOff )) ); + aFrom = Rectangle( nCol-1, lcl_hmm2px( nColOff ), + nRow-1, lcl_hmm2px( nRowOff ) ); break; } } @@ -220,8 +222,8 @@ static void lcl_GetFromTo( const XclExpRoot& rRoot, const Rectangle &aRect, sal_ nRow++; if( r.Right() >= aRect.Right() && r.Bottom() >= aRect.Bottom() ) { - aTo = Rectangle( nCol, static_cast<long>(HMM2XL( aRect.Right() - r.Left() )), - nRow, static_cast<long>(HMM2XL( aRect.Bottom() - r.Top() ))); + aTo = Rectangle( nCol, lcl_hmm2px( aRect.Right() - r.Left() ), + nRow, lcl_hmm2px( aRect.Bottom() - r.Top() )); break; } } @@ -237,14 +239,16 @@ static void lcl_GetFromTo( const XclExpRoot& rRoot, const Rectangle &aRect, sal_ nRow++; if( r.Right() < aRect.Right() && r.Bottom() >= aRect.Bottom() ) { - aTo = Rectangle( nCol, static_cast<long>(HMM2XL( r.Left() - aRect.Right() )), - nRow, static_cast<long>(HMM2XL( aRect.Bottom() - r.Top() ))); + aTo = Rectangle( nCol, lcl_hmm2px( r.Left() - aRect.Right() ), + nRow, lcl_hmm2px( aRect.Bottom() - r.Top() )); break; } } } } +} // namespace + // Escher client anchor ======================================================= XclExpDffAnchorBase::XclExpDffAnchorBase( const XclExpRoot& rRoot, sal_uInt16 nFlags ) : diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 669ee62..09b7f5c 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -102,16 +102,6 @@ using namespace ::com::sun::star; #include <documentlinkmgr.hxx> #include <memory> -#define IS_SHARE_HEADER(set) \ - static_cast<const SfxBoolItem&>( \ - static_cast<const SvxSetItem&>((set).Get(ATTR_PAGE_HEADERSET)).GetItemSet(). \ - Get(ATTR_PAGE_SHARED)).GetValue() - -#define IS_SHARE_FOOTER(set) \ - static_cast<const SfxBoolItem&>( \ - static_cast<const SvxSetItem&>((set).Get(ATTR_PAGE_FOOTERSET)).GetItemSet(). \ - Get(ATTR_PAGE_SHARED)).GetValue() - void ScDocShell::Execute( SfxRequest& rReq ) { // SID_SC_RANGE (Range), @@ -1640,8 +1630,18 @@ void ScDocShell::ExecutePageStyle( SfxViewShell& rCaller, SvxPageUsage( static_cast<const SvxPageItem&>( rStyleSet.Get( ATTR_PAGE )). GetPageUsage() ); - bool bShareHeader = IS_SHARE_HEADER(rStyleSet); - bool bShareFooter = IS_SHARE_FOOTER(rStyleSet); + bool bShareHeader = static_cast<const SfxBoolItem&>( + static_cast<const SvxSetItem&>(rStyleSet + .Get(ATTR_PAGE_HEADERSET)) + .GetItemSet() + .Get(ATTR_PAGE_SHARED)) + .GetValue(); + bool bShareFooter = static_cast<const SfxBoolItem&>( + static_cast<const SvxSetItem&>(rStyleSet + .Get(ATTR_PAGE_FOOTERSET)) + .GetItemSet() + .Get(ATTR_PAGE_SHARED)) + .GetValue(); sal_uInt16 nResId = 0; switch ( eUsage ) diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index f9bfa01..ca7a15a 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -75,9 +75,25 @@ #define ZOOM_MIN 10 -#define GET_BOOL(set,which) static_cast<const SfxBoolItem&>((set)->Get((which))).GetValue() -#define GET_USHORT(set,which) static_cast<const SfxUInt16Item&>((set)->Get((which))).GetValue() -#define GET_SHOW(set,which) ( VOBJ_MODE_SHOW == ScVObjMode( static_cast<const ScViewObjectModeItem&>((set)->Get((which))).GetValue()) ) +namespace{ + +inline bool lcl_GetBool(const SfxItemSet* pSet, sal_uInt16 nWhich) +{ + return static_cast<const SfxBoolItem&>(pSet->Get(nWhich)).GetValue(); +} + +inline sal_uInt16 lcl_GetUShort(const SfxItemSet* pSet, sal_uInt16 nWhich) +{ + return static_cast<const SfxUInt16Item&>(pSet->Get(nWhich)).GetValue(); +} + +inline bool lcl_GetShow(const SfxItemSet* pSet, sal_uInt16 nWhich) +{ + return ScVObjMode::VOBJ_MODE_SHOW == ScVObjMode( static_cast<const ScViewObjectModeItem&>(pSet->Get(nWhich)).GetValue() ); +} + + +} // namespace ScPageRowEntry::ScPageRowEntry(const ScPageRowEntry& r) { @@ -879,17 +895,17 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions ) OSL_ENSURE( pScaleItem && pScaleToItem && pScaleToPagesItem, "Missing ScaleItem! :-/" ); aTableParam.bCellContent = true; - aTableParam.bNotes = GET_BOOL(pParamSet,ATTR_PAGE_NOTES); - aTableParam.bGrid = GET_BOOL(pParamSet,ATTR_PAGE_GRID); - aTableParam.bHeaders = GET_BOOL(pParamSet,ATTR_PAGE_HEADERS); - aTableParam.bFormulas = GET_BOOL(pParamSet,ATTR_PAGE_FORMULAS); - aTableParam.bNullVals = GET_BOOL(pParamSet,ATTR_PAGE_NULLVALS); - aTableParam.bCharts = GET_SHOW(pParamSet,ATTR_PAGE_CHARTS); - aTableParam.bObjects = GET_SHOW(pParamSet,ATTR_PAGE_OBJECTS); - aTableParam.bDrawings = GET_SHOW(pParamSet,ATTR_PAGE_DRAWINGS); - aTableParam.bTopDown = GET_BOOL(pParamSet,ATTR_PAGE_TOPDOWN); + aTableParam.bNotes = lcl_GetBool(pParamSet,ATTR_PAGE_NOTES); + aTableParam.bGrid = lcl_GetBool(pParamSet,ATTR_PAGE_GRID); + aTableParam.bHeaders = lcl_GetBool(pParamSet,ATTR_PAGE_HEADERS); + aTableParam.bFormulas = lcl_GetBool(pParamSet,ATTR_PAGE_FORMULAS); + aTableParam.bNullVals = lcl_GetBool(pParamSet,ATTR_PAGE_NULLVALS); + aTableParam.bCharts = lcl_GetShow(pParamSet,ATTR_PAGE_CHARTS); + aTableParam.bObjects = lcl_GetShow(pParamSet,ATTR_PAGE_OBJECTS); + aTableParam.bDrawings = lcl_GetShow(pParamSet,ATTR_PAGE_DRAWINGS); + aTableParam.bTopDown = lcl_GetBool(pParamSet,ATTR_PAGE_TOPDOWN); aTableParam.bLeftRight = !aTableParam.bLeftRight; - aTableParam.nFirstPageNo = GET_USHORT(pParamSet,ATTR_PAGE_FIRSTPAGENO); + aTableParam.nFirstPageNo = lcl_GetUShort(pParamSet,ATTR_PAGE_FIRSTPAGENO); if (!aTableParam.nFirstPageNo) aTableParam.nFirstPageNo = (sal_uInt16) nPageStart; // from previous table _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits