From 84272d115da1165ac5f7cf4ae53875855d762b25 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 4 Apr 2014 13:39:38 +0300 Subject: Introduce twip/mm100 conversion functions instead of duplicated macros Change-Id: Ib689e35b417e0e9016cd6a239c986e0603a99d62 Reviewed-on: https://gerrit.libreoffice.org/8837 Tested-by: LibreOffice gerrit bot Reviewed-by: Miklos Vajna --- cui/source/tabpages/numpages.cxx | 15 ++-- editeng/source/items/frmitems.cxx | 98 +++++++++++------------- editeng/source/items/numitem.cxx | 9 +-- editeng/source/items/paraitem.cxx | 30 +++----- editeng/source/items/textitem.cxx | 31 ++++---- include/tools/mapunit.hxx | 16 ++++ starmath/source/unomodel.cxx | 10 +-- svl/source/items/ptitem.cxx | 16 ++-- svx/source/dialog/rulritem.cxx | 28 ++++--- svx/source/items/algitem.cxx | 28 +++---- svx/source/items/grfitem.cxx | 21 +++-- svx/source/xoutdev/xattr.cxx | 8 +- sw/inc/swtypes.hxx | 8 +- sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 2 +- sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 10 +-- sw/qa/extras/rtfexport/rtfexport.cxx | 4 +- sw/qa/extras/rtfimport/rtfimport.cxx | 20 ++--- sw/qa/extras/ww8import/ww8import.cxx | 4 +- sw/source/core/graphic/ndgrf.cxx | 8 +- sw/source/core/layout/atrfrm.cxx | 36 ++++----- sw/source/core/para/paratr.cxx | 8 +- sw/source/core/uibase/config/fontcfg.cxx | 4 +- sw/source/core/uibase/config/modcfg.cxx | 16 ++-- sw/source/core/uibase/config/usrpref.cxx | 12 +-- sw/source/core/uibase/envelp/envimg.cxx | 32 ++++---- sw/source/core/uibase/envelp/labelcfg.cxx | 32 ++++---- sw/source/core/uibase/envelp/labimg.cxx | 32 ++++---- sw/source/core/uibase/shells/grfsh.cxx | 20 ++--- sw/source/core/uibase/uiview/view.cxx | 24 +++--- sw/source/core/uibase/uno/unomod.cxx | 8 +- sw/source/core/uibase/uno/unotxdoc.cxx | 32 ++++---- sw/source/core/uibase/uno/unotxvw.cxx | 4 +- sw/source/core/uibase/utlui/uiitems.cxx | 12 +-- sw/source/core/unocore/unodraw.cxx | 34 ++++---- sw/source/core/unocore/unoframe.cxx | 4 +- sw/source/core/unocore/unoidx.cxx | 4 +- sw/source/core/unocore/unosett.cxx | 44 +++++------ sw/source/core/unocore/unotbl.cxx | 42 +++++----- sw/source/filter/html/htmlform.cxx | 24 +++--- sw/source/filter/ww8/docxattributeoutput.cxx | 6 +- sw/source/filter/xml/xmlexp.cxx | 8 +- sw/source/filter/xml/xmlimp.cxx | 8 +- sw/source/filter/xml/xmltexti.cxx | 4 +- sw/source/ui/index/cntex.cxx | 2 +- sw/source/ui/vba/vbainformationhelper.cxx | 2 +- writerfilter/source/dmapper/ConversionHelper.cxx | 7 +- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 34 ++++---- writerfilter/source/rtftok/rtfsdrimport.cxx | 19 +++-- 48 files changed, 420 insertions(+), 460 deletions(-) diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index a85745a6d35a..2588b189d776 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -2687,25 +2688,23 @@ SvxNumPositionTabPage::~SvxNumPositionTabPage() #if OSL_DEBUG_LEVEL > 1 void lcl_PrintDebugOutput(FixedText& rFixed, const SvxNumberFormat& rNumFmt) { -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) - OUString const sHash( " # " ); if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) { - OUString sDebugText( OUString::number( TWIP_TO_MM100(rNumFmt.GetAbsLSpace() ) ) ); + OUString sDebugText( OUString::number( convertTwipToMm100(rNumFmt.GetAbsLSpace() ) ) ); sDebugText += sHash; - sDebugText += OUString::number( TWIP_TO_MM100(rNumFmt.GetCharTextDistance() ) ); + sDebugText += OUString::number( convertTwipToMm100(rNumFmt.GetCharTextDistance() ) ); sDebugText += sHash; - sDebugText += OUString::number( TWIP_TO_MM100(rNumFmt.GetFirstLineOffset() ) ); + sDebugText += OUString::number( convertTwipToMm100(rNumFmt.GetFirstLineOffset() ) ); rFixed.SetText(sDebugText); } else if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) { - OUString sDebugText( OUString::number( TWIP_TO_MM100(rNumFmt.GetListtabPos() ) ) ); + OUString sDebugText( OUString::number( convertTwipToMm100(rNumFmt.GetListtabPos() ) ) ); sDebugText += sHash; - sDebugText += OUString::number( TWIP_TO_MM100(rNumFmt.GetFirstLineIndent() ) ); + sDebugText += OUString::number( convertTwipToMm100(rNumFmt.GetFirstLineIndent() ) ); sDebugText += sHash; - sDebugText += OUString::number( TWIP_TO_MM100(rNumFmt.GetIndentAt() ) ); + sDebugText += OUString::number( convertTwipToMm100(rNumFmt.GetIndentAt() ) ); rFixed.SetText(sDebugText); } diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 75b6f3a8c73f..398c9ed7de04 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include @@ -87,13 +88,6 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::drawing; using namespace ::com::sun::star::table::BorderLineStyle; - -// Conversion for UNO -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) -#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) -#define TWIP_TO_MM100_UNSIGNED(TWIP) ((((TWIP)*127L+36L)/72L)) -#define MM100_TO_TWIP_UNSIGNED(MM100) ((((MM100)*72L+63L)/127L)) - /* SvxBorderLine is not an SfxPoolItem, and has no Store/Create serialization/deserialization methods. Since border line information needs to be serialized by the table autoformat code, these file-local @@ -241,8 +235,8 @@ bool SvxSizeItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const awt::Size aTmp(aSize.Width(), aSize.Height()); if( bConvert ) { - aTmp.Height = TWIP_TO_MM100(aTmp.Height); - aTmp.Width = TWIP_TO_MM100(aTmp.Width); + aTmp.Height = convertTwipToMm100(aTmp.Height); + aTmp.Width = convertTwipToMm100(aTmp.Width); } switch( nMemberId ) @@ -270,8 +264,8 @@ bool SvxSizeItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { if(bConvert) { - aTmp.Height = MM100_TO_TWIP(aTmp.Height); - aTmp.Width = MM100_TO_TWIP(aTmp.Width); + aTmp.Height = convertMm100ToTwip(aTmp.Height); + aTmp.Width = convertMm100ToTwip(aTmp.Width); } aSize = Size( aTmp.Width, aTmp.Height ); } @@ -287,7 +281,7 @@ bool SvxSizeItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if(!(rVal >>= nVal )) return false; - aSize.Width() = bConvert ? MM100_TO_TWIP(nVal) : nVal; + aSize.Width() = bConvert ? convertMm100ToTwip(nVal) : nVal; } break; case MID_SIZE_HEIGHT: @@ -296,7 +290,7 @@ bool SvxSizeItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if(!(rVal >>= nVal)) return true; - aSize.Height() = bConvert ? MM100_TO_TWIP(nVal) : nVal; + aSize.Height() = bConvert ? convertMm100ToTwip(nVal) : nVal; } break; default: OSL_FAIL("Wrong MemberId!"); @@ -458,14 +452,14 @@ bool SvxLRSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { // now all signed case MID_L_MARGIN: - rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100(nLeftMargin) : nLeftMargin); + rVal <<= (sal_Int32)(bConvert ? convertTwipToMm100(nLeftMargin) : nLeftMargin); break; case MID_TXT_LMARGIN : - rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100(nTxtLeft) : nTxtLeft); + rVal <<= (sal_Int32)(bConvert ? convertTwipToMm100(nTxtLeft) : nTxtLeft); break; case MID_R_MARGIN: - rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100(nRightMargin) : nRightMargin); + rVal <<= (sal_Int32)(bConvert ? convertTwipToMm100(nRightMargin) : nRightMargin); break; case MID_L_REL_MARGIN: rVal <<= (sal_Int16)nPropLeftMargin; @@ -475,7 +469,7 @@ bool SvxLRSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const break; case MID_FIRST_LINE_INDENT: - rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100(nFirstLineOfst) : nFirstLineOfst); + rVal <<= (sal_Int32)(bConvert ? convertTwipToMm100(nFirstLineOfst) : nFirstLineOfst); break; case MID_FIRST_LINE_REL_INDENT: @@ -507,15 +501,15 @@ bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) switch( nMemberId ) { case MID_L_MARGIN: - SetLeft((sal_Int32)bConvert ? MM100_TO_TWIP(nVal) : nVal); + SetLeft((sal_Int32)bConvert ? convertMm100ToTwip(nVal) : nVal); break; case MID_TXT_LMARGIN : - SetTxtLeft((sal_Int32)bConvert ? MM100_TO_TWIP(nVal) : nVal); + SetTxtLeft((sal_Int32)bConvert ? convertMm100ToTwip(nVal) : nVal); break; case MID_R_MARGIN: - SetRight((sal_Int32) bConvert ? MM100_TO_TWIP(nVal) : nVal); + SetRight((sal_Int32) bConvert ? convertMm100ToTwip(nVal) : nVal); break; case MID_L_REL_MARGIN: case MID_R_REL_MARGIN: @@ -533,7 +527,7 @@ bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) } break; case MID_FIRST_LINE_INDENT : - SetTxtFirstLineOfst((short)(bConvert ? MM100_TO_TWIP(nVal) : nVal)); + SetTxtFirstLineOfst((short)(bConvert ? convertMm100ToTwip(nVal) : nVal)); break; case MID_FIRST_LINE_REL_INDENT: @@ -863,15 +857,15 @@ bool SvxULSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const case 0: { ::com::sun::star::frame::status::UpperLowerMarginScale aUpperLowerMarginScale; - aUpperLowerMarginScale.Upper = (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nUpper) : nUpper); - aUpperLowerMarginScale.Lower = (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nLower) : nPropUpper); + aUpperLowerMarginScale.Upper = (sal_Int32)(bConvert ? convertTwipToMm100(nUpper) : nUpper); + aUpperLowerMarginScale.Lower = (sal_Int32)(bConvert ? convertTwipToMm100(nLower) : nPropUpper); aUpperLowerMarginScale.ScaleUpper = (sal_Int16)nPropUpper; aUpperLowerMarginScale.ScaleLower = (sal_Int16)nPropLower; rVal <<= aUpperLowerMarginScale; break; } - case MID_UP_MARGIN: rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nUpper) : nUpper); break; - case MID_LO_MARGIN: rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nLower) : nLower); break; + case MID_UP_MARGIN: rVal <<= (sal_Int32)(bConvert ? convertTwipToMm100(nUpper) : nUpper); break; + case MID_LO_MARGIN: rVal <<= (sal_Int32)(bConvert ? convertTwipToMm100(nLower) : nLower); break; case MID_CTX_MARGIN: rVal <<= bContext; break; case MID_UP_REL_MARGIN: rVal <<= (sal_Int16) nPropUpper; break; case MID_LO_REL_MARGIN: rVal <<= (sal_Int16) nPropLower; break; @@ -894,8 +888,8 @@ bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if ( !(rVal >>= aUpperLowerMarginScale )) return false; { - SetUpper((sal_uInt16)(bConvert ? MM100_TO_TWIP( aUpperLowerMarginScale.Upper ) : aUpperLowerMarginScale.Upper)); - SetLower((sal_uInt16)(bConvert ? MM100_TO_TWIP( aUpperLowerMarginScale.Lower ) : aUpperLowerMarginScale.Lower)); + SetUpper((sal_uInt16)(bConvert ? convertMm100ToTwip( aUpperLowerMarginScale.Upper ) : aUpperLowerMarginScale.Upper)); + SetLower((sal_uInt16)(bConvert ? convertMm100ToTwip( aUpperLowerMarginScale.Lower ) : aUpperLowerMarginScale.Lower)); if( aUpperLowerMarginScale.ScaleUpper > 1 ) nPropUpper = aUpperLowerMarginScale.ScaleUpper; if( aUpperLowerMarginScale.ScaleLower > 1 ) @@ -906,12 +900,12 @@ bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) case MID_UP_MARGIN : if(!(rVal >>= nVal) || nVal < 0) return false; - SetUpper((sal_uInt16)(bConvert ? MM100_TO_TWIP(nVal) : nVal)); + SetUpper((sal_uInt16)(bConvert ? convertMm100ToTwip(nVal) : nVal)); break; case MID_LO_MARGIN : if(!(rVal >>= nVal) || nVal < 0) return false; - SetLower((sal_uInt16)(bConvert ? MM100_TO_TWIP(nVal) : nVal)); + SetLower((sal_uInt16)(bConvert ? convertMm100ToTwip(nVal) : nVal)); break; case MID_CTX_MARGIN : if (!(rVal >>= bVal)) @@ -1345,7 +1339,7 @@ bool SvxShadowItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const default: ;//prevent warning } aShadow.Location = eSet; - aShadow.ShadowWidth = bConvert ? TWIP_TO_MM100_UNSIGNED(nWidth) : nWidth; + aShadow.ShadowWidth = bConvert ? convertTwipToMm100(nWidth) : nWidth; aShadow.IsTransparent = aShadowColor.GetTransparency() > 0; aShadow.Color = aShadowColor.GetColor(); @@ -1418,7 +1412,7 @@ bool SvxShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) default: ;//prevent warning } - nWidth = bConvert ? MM100_TO_TWIP(aShadow.ShadowWidth) : aShadow.ShadowWidth; + nWidth = bConvert ? convertMm100ToTwip(aShadow.ShadowWidth) : aShadow.ShadowWidth; Color aSet(aShadow.Color); aShadowColor = aSet; } @@ -1709,11 +1703,11 @@ table::BorderLine2 SvxBoxItem::SvxLineToLine(const SvxBorderLine* pLine, bool bC if(pLine) { aLine.Color = pLine->GetColor().GetColor() ; - aLine.InnerLineWidth = sal_uInt16( bConvert ? TWIP_TO_MM100_UNSIGNED(pLine->GetInWidth() ): pLine->GetInWidth() ); - aLine.OuterLineWidth = sal_uInt16( bConvert ? TWIP_TO_MM100_UNSIGNED(pLine->GetOutWidth()): pLine->GetOutWidth() ); - aLine.LineDistance = sal_uInt16( bConvert ? TWIP_TO_MM100_UNSIGNED(pLine->GetDistance()): pLine->GetDistance() ); + aLine.InnerLineWidth = sal_uInt16( bConvert ? convertTwipToMm100(pLine->GetInWidth() ): pLine->GetInWidth() ); + aLine.OuterLineWidth = sal_uInt16( bConvert ? convertTwipToMm100(pLine->GetOutWidth()): pLine->GetOutWidth() ); + aLine.LineDistance = sal_uInt16( bConvert ? convertTwipToMm100(pLine->GetDistance()): pLine->GetDistance() ); aLine.LineStyle = pLine->GetBorderLineStyle(); - aLine.LineWidth = sal_uInt32( bConvert ? TWIP_TO_MM100( pLine->GetWidth( ) ) : pLine->GetWidth( ) ); + aLine.LineWidth = sal_uInt32( bConvert ? convertTwipToMm100( pLine->GetWidth( ) ) : pLine->GetWidth( ) ); } else aLine.Color = aLine.InnerLineWidth = aLine.OuterLineWidth = aLine.LineDistance = 0; @@ -1737,11 +1731,11 @@ bool SvxBoxItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const aSeq[1] = uno::makeAny( SvxBoxItem::SvxLineToLine(GetRight(), bConvert) ); aSeq[2] = uno::makeAny( SvxBoxItem::SvxLineToLine(GetBottom(), bConvert) ); aSeq[3] = uno::makeAny( SvxBoxItem::SvxLineToLine(GetTop(), bConvert) ); - aSeq[4] <<= uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED( GetDistance()) : GetDistance())); - aSeq[5] <<= uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED( nTopDist ) : nTopDist )); - aSeq[6] <<= uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED( nBottomDist ) : nBottomDist )); - aSeq[7] <<= uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED( nLeftDist ) : nLeftDist )); - aSeq[8] <<= uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED( nRightDist ) : nRightDist )); + aSeq[4] <<= uno::makeAny( (sal_Int32)(bConvert ? convertTwipToMm100( GetDistance()) : GetDistance())); + aSeq[5] <<= uno::makeAny( (sal_Int32)(bConvert ? convertTwipToMm100( nTopDist ) : nTopDist )); + aSeq[6] <<= uno::makeAny( (sal_Int32)(bConvert ? convertTwipToMm100( nBottomDist ) : nBottomDist )); + aSeq[7] <<= uno::makeAny( (sal_Int32)(bConvert ? convertTwipToMm100( nLeftDist ) : nLeftDist )); + aSeq[8] <<= uno::makeAny( (sal_Int32)(bConvert ? convertTwipToMm100( nRightDist ) : nRightDist )); rVal = uno::makeAny( aSeq ); return true; } @@ -1784,7 +1778,7 @@ bool SvxBoxItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const } if( bDistMember ) - rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nDist) : nDist); + rVal <<= (sal_Int32)(bConvert ? convertTwipToMm100(nDist) : nDist); else rVal <<= aRetLine; @@ -1801,9 +1795,9 @@ lcl_lineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine, sal_B if ( bGuessWidth ) { rSvxLine.GuessLinesWidths( rSvxLine.GetBorderLineStyle(), - sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.OuterLineWidth) : rLine.OuterLineWidth ), - sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.InnerLineWidth) : rLine.InnerLineWidth ), - sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.LineDistance ) : rLine.LineDistance )); + sal_uInt16( bConvert ? convertMm100ToTwip(rLine.OuterLineWidth) : rLine.OuterLineWidth ), + sal_uInt16( bConvert ? convertMm100ToTwip(rLine.InnerLineWidth) : rLine.InnerLineWidth ), + sal_uInt16( bConvert ? convertMm100ToTwip(rLine.LineDistance ) : rLine.LineDistance )); } sal_Bool bRet = !rSvxLine.isEmpty(); @@ -1831,7 +1825,7 @@ SvxBoxItem::LineToSvxLine(const ::com::sun::star::table::BorderLine2& rLine, Svx sal_Bool bGuessWidth = sal_True; if ( rLine.LineWidth ) { - rSvxLine.SetWidth( bConvert? MM100_TO_TWIP_UNSIGNED( rLine.LineWidth ) : rLine.LineWidth ); + rSvxLine.SetWidth( bConvert? convertMm100ToTwip( rLine.LineWidth ) : rLine.LineWidth ); // fdo#46112: double does not necessarily mean symmetric // for backwards compatibility bGuessWidth = ((DOUBLE == nStyle || DOUBLE_THIN == nStyle)) && @@ -1913,7 +1907,7 @@ bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if ( aSeq[n] >>= nDist ) { if( bConvert ) - nDist = MM100_TO_TWIP(nDist); + nDist = convertMm100ToTwip(nDist); if ( n == 4 ) SetDistance( sal_uInt16( nDist )); else @@ -1987,7 +1981,7 @@ bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) long nWidth(0); rVal >>= nWidth; if( bConvert ) - nWidth = MM100_TO_TWIP( nWidth ); + nWidth = convertMm100ToTwip( nWidth ); // Set the line Width on all borders const sal_uInt16 aBorders[] = { BOX_LINE_LEFT, BOX_LINE_RIGHT, BOX_LINE_BOTTOM, BOX_LINE_TOP }; @@ -2010,7 +2004,7 @@ bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if(nDist >= 0) { if( bConvert ) - nDist = MM100_TO_TWIP(nDist); + nDist = convertMm100ToTwip(nDist); if( nMemberId == BORDER_DISTANCE ) SetDistance( sal_uInt16( nDist )); else @@ -2740,7 +2734,7 @@ bool SvxBoxInfoItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const aSeq[2] = ::com::sun::star::uno::makeAny( nVal ); nVal = nValidFlags; aSeq[3] = ::com::sun::star::uno::makeAny( nVal ); - aSeq[4] = ::com::sun::star::uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(GetDefDist()) : GetDefDist()) ); + aSeq[4] = ::com::sun::star::uno::makeAny( (sal_Int32)(bConvert ? convertTwipToMm100(GetDefDist()) : GetDefDist()) ); rVal = ::com::sun::star::uno::makeAny( aSeq ); return true; } @@ -2768,7 +2762,7 @@ bool SvxBoxInfoItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const break; case MID_DISTANCE: bIntMember = sal_True; - rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(GetDefDist()) : GetDefDist()); + rVal <<= (sal_Int32)(bConvert ? convertTwipToMm100(GetDefDist()) : GetDefDist()); break; default: OSL_FAIL("Wrong MemberId!"); return false; } @@ -2816,7 +2810,7 @@ bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if (( aSeq[4] >>= nVal ) && ( nVal >= 0 )) { if( bConvert ) - nVal = MM100_TO_TWIP(nVal); + nVal = convertMm100ToTwip(nVal); SetDefDist( (sal_uInt16)nVal ); } } @@ -2933,7 +2927,7 @@ bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if ( bRet && nVal>=0 ) { if( bConvert ) - nVal = MM100_TO_TWIP(nVal); + nVal = convertMm100ToTwip(nVal); SetDefDist( (sal_uInt16)nVal ); } break; diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index e49e0c32a270..61cc688716c0 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -41,11 +41,10 @@ #include #include #include +#include #include -#define MM100_TO_TWIP(MM100) ((MM100*72L+63L)/127L) - #define DEF_WRITER_LSPACE 500 //Standard Indentation #define DEF_DRAW_LSPACE 800 //Standard Indentation @@ -619,9 +618,9 @@ SvxNumRule::SvxNumRule( sal_uLong nFeatures, if ( eDefaultNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) { - aFmts[i]->SetLSpace( MM100_TO_TWIP(DEF_WRITER_LSPACE) ); - aFmts[i]->SetAbsLSpace( MM100_TO_TWIP(DEF_WRITER_LSPACE * (i+1)) ); - aFmts[i]->SetFirstLineOffset(MM100_TO_TWIP(-DEF_WRITER_LSPACE)); + aFmts[i]->SetLSpace( convertMm100ToTwip(DEF_WRITER_LSPACE) ); + aFmts[i]->SetAbsLSpace( convertMm100ToTwip(DEF_WRITER_LSPACE * (i+1)) ); + aFmts[i]->SetFirstLineOffset(convertMm100ToTwip(-DEF_WRITER_LSPACE)); } else if ( eDefaultNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index 906ba1ae1f5a..4f3d598f107f 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -53,19 +54,6 @@ using namespace ::rtl; using namespace ::com::sun::star; -// Konvertierung fuer UNO -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) -#define TWIP_TO_MM100_UNSIGNED(TWIP) ((((TWIP)*127L+36L)/72L)) -#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) -#define MM100_TO_TWIP_UNSIGNED(MM100) ((((MM100)*72L+63L)/127L)) - - -// STATIC DATA ----------------------------------------------------------- - - - - - TYPEINIT1_FACTORY(SvxLineSpacingItem, SfxPoolItem , new SvxLineSpacingItem(LINE_SPACE_DEFAULT_HEIGHT, 0)); TYPEINIT1_FACTORY(SvxAdjustItem, SfxPoolItem, new SvxAdjustItem(SVX_ADJUST_LEFT, 0)); TYPEINIT1_FACTORY(SvxWidowsItem, SfxByteItem, new SvxWidowsItem(0, 0)); @@ -133,7 +121,7 @@ bool SvxLineSpacingItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const if(eInterLineSpace == SVX_INTER_LINE_SPACE_FIX) { aLSp.Mode = style::LineSpacingMode::LEADING; - aLSp.Height = ( bConvert ? (short)TWIP_TO_MM100(nInterLineSpace) : nInterLineSpace); + aLSp.Height = ( bConvert ? (short)convertTwipToMm100(nInterLineSpace) : nInterLineSpace); } else if(eInterLineSpace == SVX_INTER_LINE_SPACE_OFF) { @@ -149,7 +137,7 @@ bool SvxLineSpacingItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const case SVX_LINE_SPACE_FIX : case SVX_LINE_SPACE_MIN : aLSp.Mode = eLineSpace == SVX_LINE_SPACE_FIX ? style::LineSpacingMode::FIX : style::LineSpacingMode::MINIMUM; - aLSp.Height = ( bConvert ? (short)TWIP_TO_MM100_UNSIGNED(nLineHeight) : nLineHeight ); + aLSp.Height = ( bConvert ? (short)convertTwipToMm100(nLineHeight) : nLineHeight ); break; default: ;//prevent warning about SVX_LINE_SPACE_END @@ -196,7 +184,7 @@ bool SvxLineSpacingItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) eLineSpace = SVX_LINE_SPACE_AUTO; nInterLineSpace = aLSp.Height; if(bConvert) - nInterLineSpace = (short)MM100_TO_TWIP(nInterLineSpace); + nInterLineSpace = (short)convertMm100ToTwip(nInterLineSpace); } break; @@ -217,7 +205,7 @@ bool SvxLineSpacingItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) eLineSpace = aLSp.Mode == style::LineSpacingMode::FIX ? SVX_LINE_SPACE_FIX : SVX_LINE_SPACE_MIN; nLineHeight = aLSp.Height; if(bConvert) - nLineHeight = (sal_uInt16)MM100_TO_TWIP_UNSIGNED(nLineHeight); + nLineHeight = (sal_uInt16)convertMm100ToTwip(nLineHeight); } break; } @@ -956,7 +944,7 @@ bool SvxTabStopItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const for(sal_uInt16 i = 0; i < nCount; i++) { const SvxTabStop& rTab = (*this)[i]; - pArr[i].Position = bConvert ? TWIP_TO_MM100(rTab.GetTabPos()) : rTab.GetTabPos(); + pArr[i].Position = bConvert ? convertTwipToMm100(rTab.GetTabPos()) : rTab.GetTabPos(); switch(rTab.GetAdjustment()) { case SVX_TAB_ADJUST_LEFT : pArr[i].Alignment = style::TabAlign_LEFT; break; @@ -976,7 +964,7 @@ bool SvxTabStopItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const case MID_STD_TAB: { const SvxTabStop &rTab = maTabStops.front(); - rVal <<= (static_cast(bConvert ? TWIP_TO_MM100(rTab.GetTabPos()) : rTab.GetTabPos())); + rVal <<= (static_cast(bConvert ? convertTwipToMm100(rTab.GetTabPos()) : rTab.GetTabPos())); break; } } @@ -1051,7 +1039,7 @@ bool SvxTabStopItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) } sal_Unicode cFill = pArr[i].FillChar; sal_Unicode cDecimal = pArr[i].DecimalChar; - SvxTabStop aTab( bConvert ? MM100_TO_TWIP(pArr[i].Position) : pArr[i].Position, + SvxTabStop aTab( bConvert ? convertMm100ToTwip(pArr[i].Position) : pArr[i].Position, eAdjust, cDecimal, cFill ); @@ -1065,7 +1053,7 @@ bool SvxTabStopItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if (!(rVal >>= nNewPos) ) return false; if (bConvert) - nNewPos = MM100_TO_TWIP ( nNewPos ); + nNewPos = convertMm100ToTwip ( nNewPos ); if (nNewPos <= 0) return false; const SvxTabStop& rTab = maTabStops.front(); diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index b3f8208a4180..5cc4929d6d04 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -99,12 +100,6 @@ using namespace ::rtl; using namespace ::com::sun::star; using namespace ::com::sun::star::text; -// Conversion for UNO -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) -#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) -#define TWIP_TO_MM100_UNSIGNED(TWIP) ((((TWIP)*127L+36L)/72L)) -#define MM100_TO_TWIP_UNSIGNED(MM100) ((((MM100)*72L+63L)/127L)) - bool SvxFontItem::bEnableStoreUnicodeNames = false; // STATIC DATA ----------------------------------------------------------- @@ -837,12 +832,12 @@ bool SvxFontHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const // CONVERT_TWIPS is not set. if( bConvert ) { - long nTwips = bConvert ? nHeight : MM100_TO_TWIP_UNSIGNED(nHeight); + long nTwips = bConvert ? nHeight : convertMm100ToTwip(nHeight); aFontHeight.Height = (float)( nTwips / 20.0 ); } else { - double fPoints = MM100_TO_TWIP_UNSIGNED(nHeight) / 20.0; + double fPoints = convertMm100ToTwip(nHeight) / 20.0; float fRoundPoints = static_cast(::rtl::math::round(fPoints, 1)); aFontHeight.Height = fRoundPoints; @@ -857,7 +852,7 @@ bool SvxFontHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const fRet = 0.; break; case SFX_MAPUNIT_100TH_MM: - fRet = MM100_TO_TWIP(fRet); + fRet = convertMm100ToTwip(fRet); fRet /= 20.; break; case SFX_MAPUNIT_POINT: @@ -878,12 +873,12 @@ bool SvxFontHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const // CONVERT_TWIPS is not set. if( bConvert ) { - long nTwips = bConvert ? nHeight : MM100_TO_TWIP_UNSIGNED(nHeight); + long nTwips = bConvert ? nHeight : convertMm100ToTwip(nHeight); rVal <<= (float)( nTwips / 20.0 ); } else { - double fPoints = MM100_TO_TWIP_UNSIGNED(nHeight) / 20.0; + double fPoints = convertMm100ToTwip(nHeight) / 20.0; float fRoundPoints = static_cast(::rtl::math::round(fPoints, 1)); rVal <<= fRoundPoints; @@ -902,7 +897,7 @@ bool SvxFontHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const fRet = 0.; break; case SFX_MAPUNIT_100TH_MM: - fRet = MM100_TO_TWIP(fRet); + fRet = convertMm100ToTwip(fRet); fRet /= 20.; break; case SFX_MAPUNIT_POINT: @@ -936,7 +931,7 @@ static sal_uInt32 lcl_GetRealHeight_Impl(sal_uInt32 nHeight, sal_uInt16 nProp, S short nTemp = (short)nProp; nDiff = nTemp * 20; if(!bCoreInTwip) - nDiff = (short)TWIP_TO_MM100((long)(nDiff)); + nDiff = (short)convertTwipToMm100((long)(nDiff)); } break; case SFX_MAPUNIT_100TH_MM: @@ -974,7 +969,7 @@ bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) nHeight = (long)( fPoint * 20.0 + 0.5 ); // Twips if (!bConvert) - nHeight = TWIP_TO_MM100_UNSIGNED(nHeight); // Convert, if the item contains 1/100mm + nHeight = convertTwipToMm100(nHeight); // Convert, if the item contains 1/100mm nProp = aFontHeight.Prop; } @@ -999,7 +994,7 @@ bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) nHeight = (long)( fPoint * 20.0 + 0.5 ); // Twips if (!bConvert) - nHeight = TWIP_TO_MM100_UNSIGNED(nHeight); // Convert, if the item contains 1/100mm + nHeight = convertTwipToMm100(nHeight); // Convert, if the item contains 1/100mm } break; case MID_FONTHEIGHT_PROP: @@ -1028,7 +1023,7 @@ bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) fValue = (float)nValue; } sal_Int16 nCoreDiffValue = (sal_Int16)(fValue * 20.); - nHeight += bConvert ? nCoreDiffValue : TWIP_TO_MM100(nCoreDiffValue); + nHeight += bConvert ? nCoreDiffValue : convertTwipToMm100(nCoreDiffValue); nProp = (sal_uInt16)((sal_Int16)fValue); ePropUnit = SFX_MAPUNIT_POINT; } @@ -2203,7 +2198,7 @@ bool SvxKerningItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { sal_Int16 nVal = GetValue(); if(nMemberId & CONVERT_TWIPS) - nVal = (sal_Int16)TWIP_TO_MM100(nVal); + nVal = (sal_Int16)convertTwipToMm100(nVal); rVal <<= nVal; return true; } @@ -2214,7 +2209,7 @@ bool SvxKerningItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId) if(!(rVal >>= nVal)) return false; if(nMemberId & CONVERT_TWIPS) - nVal = (sal_Int16)MM100_TO_TWIP(nVal); + nVal = (sal_Int16)convertMm100ToTwip(nVal); SetValue(nVal); return true; } diff --git a/include/tools/mapunit.hxx b/include/tools/mapunit.hxx index 0076b685ddcb..a68b6b45b251 100644 --- a/include/tools/mapunit.hxx +++ b/include/tools/mapunit.hxx @@ -25,6 +25,22 @@ enum MapUnit { MAP_100TH_MM, MAP_10TH_MM, MAP_MM, MAP_CM, MAP_POINT, MAP_TWIP, MAP_PIXEL, MAP_SYSFONT, MAP_APPFONT, MAP_RELATIVE, MAP_LASTENUMDUMMY }; +inline sal_Int64 convertTwipToMm100(sal_Int64 n) +{ + if (n >= 0) + return (n*127+36)/72; + else + return (n*127-36)/72; +} + +inline sal_Int64 convertMm100ToTwip(sal_Int64 n) +{ + if (n >= 0) + return (n*72+63)/127; + else + return (n*72-63)/127; +} + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 0bafd5b1e900..fb29c1459e78 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -59,11 +60,6 @@ using namespace ::com::sun::star::formula; using namespace ::com::sun::star::view; using namespace ::com::sun::star::script; -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) -#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) - - - SmPrintUIOptions::SmPrintUIOptions() { ResStringArray aLocalizedStrings( SmResId( RID_PRINTUIOPTIONS ) ); @@ -526,7 +522,7 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* throw IllegalArgumentException(); Size aSize = aFormat.GetBaseSize(); nVal *= 20; - nVal = static_cast < sal_Int16 > ( TWIP_TO_MM100(nVal) ); + nVal = static_cast < sal_Int16 > ( convertTwipToMm100(nVal) ); aSize.Height() = nVal; aFormat.SetBaseSize(aSize); @@ -780,7 +776,7 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu { // Point! sal_Int16 nVal = static_cast < sal_Int16 > (aFormat.GetBaseSize().Height()); - nVal = static_cast < sal_Int16 > (MM100_TO_TWIP(nVal)); + nVal = static_cast < sal_Int16 > (convertMm100ToTwip(nVal)); nVal = (nVal + 10) / 20; *pValue <<= nVal; } diff --git a/svl/source/items/ptitem.cxx b/svl/source/items/ptitem.cxx index 1b66c809d74d..c9c36e26a51e 100644 --- a/svl/source/items/ptitem.cxx +++ b/svl/source/items/ptitem.cxx @@ -22,17 +22,13 @@ #include #include #include +#include #include #include using namespace ::com::sun::star; -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) -#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) - - - TYPEINIT1_AUTOFACTORY(SfxPointItem, SfxPoolItem); @@ -113,8 +109,8 @@ bool SfxPointItem::QueryValue( uno::Any& rVal, awt::Point aTmp(aVal.X(), aVal.Y()); if( bConvert ) { - aTmp.X = TWIP_TO_MM100(aTmp.X); - aTmp.Y = TWIP_TO_MM100(aTmp.Y); + aTmp.X = convertTwipToMm100(aTmp.X); + aTmp.Y = convertTwipToMm100(aTmp.Y); } nMemberId &= ~CONVERT_TWIPS; switch ( nMemberId ) @@ -143,15 +139,15 @@ bool SfxPointItem::PutValue( const uno::Any& rVal, bRet = ( rVal >>= aValue ); if( bConvert ) { - aValue.X = MM100_TO_TWIP(aValue.X); - aValue.Y = MM100_TO_TWIP(aValue.Y); + aValue.X = convertMm100ToTwip(aValue.X); + aValue.Y = convertMm100ToTwip(aValue.Y); } } else { bRet = ( rVal >>= nVal ); if( bConvert ) - nVal = MM100_TO_TWIP( nVal ); + nVal = convertMm100ToTwip( nVal ); } if ( bRet ) diff --git a/svx/source/dialog/rulritem.cxx b/svx/source/dialog/rulritem.cxx index c8bbede0a8f4..149c659f2d3b 100644 --- a/svx/source/dialog/rulritem.cxx +++ b/svx/source/dialog/rulritem.cxx @@ -19,6 +19,7 @@ #include #include "svx/rulritem.hxx" +#include #include #include #include @@ -43,9 +44,6 @@ OUString SvxLongLRSpaceItem::GetValueText() const return OUString(); } -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) -#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) - bool SvxLongLRSpaceItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const { bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); @@ -57,8 +55,8 @@ bool SvxLongLRSpaceItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 case 0: { ::com::sun::star::frame::status::LeftRightMargin aLeftRightMargin; - aLeftRightMargin.Left = bConvert ? TWIP_TO_MM100( mlLeft ) : mlLeft; - aLeftRightMargin.Right = bConvert ? TWIP_TO_MM100( mlRight ) : mlRight; + aLeftRightMargin.Left = bConvert ? convertTwipToMm100( mlLeft ) : mlLeft; + aLeftRightMargin.Right = bConvert ? convertTwipToMm100( mlRight ) : mlRight; rVal <<= aLeftRightMargin; return true; } @@ -75,7 +73,7 @@ bool SvxLongLRSpaceItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 } if ( bConvert ) - nVal = TWIP_TO_MM100( nVal ); + nVal = convertTwipToMm100( nVal ); rVal <<= nVal; return true; @@ -92,15 +90,15 @@ bool SvxLongLRSpaceItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_u ::com::sun::star::frame::status::LeftRightMargin aLeftRightMargin; if ( rVal >>= aLeftRightMargin ) { - mlLeft = bConvert ? MM100_TO_TWIP(aLeftRightMargin.Left) : aLeftRightMargin.Left; - mlRight = bConvert ? MM100_TO_TWIP(aLeftRightMargin.Right) : aLeftRightMargin.Right; + mlLeft = bConvert ? convertMm100ToTwip(aLeftRightMargin.Left) : aLeftRightMargin.Left; + mlRight = bConvert ? convertMm100ToTwip(aLeftRightMargin.Right) : aLeftRightMargin.Right; return true; } } else if ( rVal >>= nVal ) { if ( bConvert ) - nVal = MM100_TO_TWIP( nVal ); + nVal = convertMm100ToTwip( nVal ); switch( nMemberId ) { @@ -200,8 +198,8 @@ bool SvxLongULSpaceItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 case 0: { ::com::sun::star::frame::status::UpperLowerMargin aUpperLowerMargin; - aUpperLowerMargin.Upper = bConvert ? TWIP_TO_MM100( mlLeft ) : mlLeft; - aUpperLowerMargin.Lower = bConvert ? TWIP_TO_MM100( mlRight ) : mlRight; + aUpperLowerMargin.Upper = bConvert ? convertTwipToMm100( mlLeft ) : mlLeft; + aUpperLowerMargin.Lower = bConvert ? convertTwipToMm100( mlRight ) : mlRight; rVal <<= aUpperLowerMargin; return true; } @@ -216,7 +214,7 @@ bool SvxLongULSpaceItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 } if ( bConvert ) - nVal = TWIP_TO_MM100( nVal ); + nVal = convertTwipToMm100( nVal ); rVal <<= nVal; return true; @@ -233,15 +231,15 @@ bool SvxLongULSpaceItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_u ::com::sun::star::frame::status::UpperLowerMargin aUpperLowerMargin; if ( rVal >>= aUpperLowerMargin ) { - mlLeft = bConvert ? MM100_TO_TWIP( aUpperLowerMargin.Upper ) : aUpperLowerMargin.Upper; - mlRight = bConvert ? MM100_TO_TWIP( aUpperLowerMargin.Lower ) : aUpperLowerMargin.Lower; + mlLeft = bConvert ? convertMm100ToTwip( aUpperLowerMargin.Upper ) : aUpperLowerMargin.Upper; + mlRight = bConvert ? convertMm100ToTwip( aUpperLowerMargin.Lower ) : aUpperLowerMargin.Lower; return true; } } else if ( rVal >>= nVal ) { if ( bConvert ) - nVal = MM100_TO_TWIP( nVal ); + nVal = convertMm100ToTwip( nVal ); switch( nMemberId ) { diff --git a/svx/source/items/algitem.cxx b/svx/source/items/algitem.cxx index 8f9f5056d940..2cdc3ca31635 100644 --- a/svx/source/items/algitem.cxx +++ b/svx/source/items/algitem.cxx @@ -17,11 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - #include - #include +#include #include #include #include @@ -42,13 +41,6 @@ using namespace ::rtl; using namespace ::com::sun::star; -// Konvertierung fuer UNO -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) -#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) - -// STATIC DATA ----------------------------------------------------------- - -//TYPEINIT1_AUTOFACTORY( SvxHorJustifyItem, SfxEnumItem ); TYPEINIT1_FACTORY( SvxOrientationItem, SfxEnumItem, new SvxOrientationItem(SVX_ORIENTATION_STANDARD, 0) ); TYPEINIT1_FACTORY( SvxMarginItem, SfxPoolItem, new SvxMarginItem(0) ); @@ -342,16 +334,16 @@ bool SvxMarginItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { // jetzt alles signed case MID_MARGIN_L_MARGIN: - rVal <<= (sal_Int32)( bConvert ? TWIP_TO_MM100(nLeftMargin) : nLeftMargin ); + rVal <<= (sal_Int32)( bConvert ? convertTwipToMm100(nLeftMargin) : nLeftMargin ); break; case MID_MARGIN_R_MARGIN: - rVal <<= (sal_Int32)( bConvert ? TWIP_TO_MM100(nRightMargin) : nRightMargin ); + rVal <<= (sal_Int32)( bConvert ? convertTwipToMm100(nRightMargin) : nRightMargin ); break; case MID_MARGIN_UP_MARGIN: - rVal <<= (sal_Int32)( bConvert ? TWIP_TO_MM100(nTopMargin) : nTopMargin ); + rVal <<= (sal_Int32)( bConvert ? convertTwipToMm100(nTopMargin) : nTopMargin ); break; case MID_MARGIN_LO_MARGIN: - rVal <<= (sal_Int32)( bConvert ? TWIP_TO_MM100(nBottomMargin) : nBottomMargin ); + rVal <<= (sal_Int32)( bConvert ? convertTwipToMm100(nBottomMargin) : nBottomMargin ); break; default: OSL_FAIL("unknown MemberId"); @@ -365,7 +357,7 @@ bool SvxMarginItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxMarginItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { bool bConvert = ( ( nMemberId & CONVERT_TWIPS ) != 0 ); - long nMaxVal = bConvert ? TWIP_TO_MM100(SHRT_MAX) : SHRT_MAX; // Members sind sal_Int16 + long nMaxVal = bConvert ? convertTwipToMm100(SHRT_MAX) : SHRT_MAX; // Members sind sal_Int16 sal_Int32 nVal = 0; if(!(rVal >>= nVal) || (nVal > nMaxVal)) return false; @@ -373,16 +365,16 @@ bool SvxMarginItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) switch ( nMemberId & ~CONVERT_TWIPS ) { case MID_MARGIN_L_MARGIN: - nLeftMargin = (sal_Int16)( bConvert ? MM100_TO_TWIP(nVal) : nVal ); + nLeftMargin = (sal_Int16)( bConvert ? convertMm100ToTwip(nVal) : nVal ); break; case MID_MARGIN_R_MARGIN: - nRightMargin = (sal_Int16)( bConvert ? MM100_TO_TWIP(nVal) : nVal ); + nRightMargin = (sal_Int16)( bConvert ? convertMm100ToTwip(nVal) : nVal ); break; case MID_MARGIN_UP_MARGIN: - nTopMargin = (sal_Int16)( bConvert ? MM100_TO_TWIP(nVal) : nVal ); + nTopMargin = (sal_Int16)( bConvert ? convertMm100ToTwip(nVal) : nVal ); break; case MID_MARGIN_LO_MARGIN: - nBottomMargin = (sal_Int16)( bConvert ? MM100_TO_TWIP(nVal) : nVal ); + nBottomMargin = (sal_Int16)( bConvert ? convertMm100ToTwip(nVal) : nVal ); break; default: OSL_FAIL("unknown MemberId"); diff --git a/svx/source/items/grfitem.cxx b/svx/source/items/grfitem.cxx index be3181097ba9..05232eb82b0f 100644 --- a/svx/source/items/grfitem.cxx +++ b/svx/source/items/grfitem.cxx @@ -21,13 +21,10 @@ #include #include #include +#include using namespace ::com::sun::star; -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) -#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) -//TYPEINIT1_FACTORY( SvxGrfCrop, SfxPoolItem , new SvxGrfCrop(0)) - /****************************************************************************** * Implementierung class SwCropGrf ******************************************************************************/ @@ -99,10 +96,10 @@ bool SvxGrfCrop::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const if( bConvert ) { - aRet.Right = TWIP_TO_MM100(aRet.Right ); - aRet.Top = TWIP_TO_MM100(aRet.Top ); - aRet.Left = TWIP_TO_MM100(aRet.Left ); - aRet.Bottom = TWIP_TO_MM100(aRet.Bottom); + aRet.Right = convertTwipToMm100(aRet.Right ); + aRet.Top = convertTwipToMm100(aRet.Top ); + aRet.Left = convertTwipToMm100(aRet.Left ); + aRet.Bottom = convertTwipToMm100(aRet.Bottom); } @@ -120,10 +117,10 @@ bool SvxGrfCrop::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) return false; if( bConvert ) { - aVal.Right = MM100_TO_TWIP(aVal.Right ); - aVal.Top = MM100_TO_TWIP(aVal.Top ); - aVal.Left = MM100_TO_TWIP(aVal.Left ); - aVal.Bottom = MM100_TO_TWIP(aVal.Bottom); + aVal.Right = convertMm100ToTwip(aVal.Right ); + aVal.Top = convertMm100ToTwip(aVal.Top ); + aVal.Left = convertMm100ToTwip(aVal.Left ); + aVal.Bottom = convertMm100ToTwip(aVal.Bottom); } nLeft = aVal.Left ; diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 800542e81ec2..a8f6a1b2287f 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include "svx/unoapi.hxx" #include @@ -57,9 +58,6 @@ using namespace ::rtl; using namespace ::com::sun::star; -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) -#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) - #define VCLTOSVCOL( rCol ) (sal_uInt16)((((sal_uInt16)(rCol))<<8)|(rCol)) TYPEINIT1_AUTOFACTORY(NameOrIndex, SfxStringItem); @@ -1092,7 +1090,7 @@ bool XLineWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMe { sal_Int32 nValue = GetValue(); if( 0 != (nMemberId&CONVERT_TWIPS) ) - nValue = TWIP_TO_MM100(nValue); + nValue = convertTwipToMm100(nValue); rVal <<= nValue; return true; @@ -1103,7 +1101,7 @@ bool XLineWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 sal_Int32 nValue = 0; rVal >>= nValue; if( 0 != (nMemberId&CONVERT_TWIPS) ) - nValue = MM100_TO_TWIP(nValue); + nValue = convertMm100ToTwip(nValue); SetValue( nValue ); return true; diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx index 3cf2c8385423..a77b55313c36 100644 --- a/sw/inc/swtypes.hxx +++ b/sw/inc/swtypes.hxx @@ -20,6 +20,7 @@ #define INCLUDED_SW_INC_SWTYPES_HXX #include #include +#include #include #include @@ -197,13 +198,6 @@ namespace nsSetAttrMode const SetAttrMode SETATTR_IS_COPY = 0x0100; } -// Conversion Twip <-> 1/100 mm for UNO - -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) -#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) -#define TWIP_TO_MM100_UNSIGNED(TWIP) ((((TWIP)*127L+36L)/72L)) -#define MM100_TO_TWIP_UNSIGNED(MM100) ((((MM100)*72L+63L)/127L)) - #define SW_ISPRINTABLE( c ) ( c >= ' ' && 127 != c ) #ifndef SW_CONSTASCII_DECL diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 272207560248..cafd9ea87684 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -1023,7 +1023,7 @@ DECLARE_OOXMLEXPORT_TEST(testParaShadow, "para-shadow.docx") CPPUNIT_ASSERT_EQUAL(COL_BLACK, sal_uInt32(aShadow.Color)); CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location); // w:sz="48" is in eights of a point, 1 pt is 20 twips. - CPPUNIT_ASSERT_EQUAL(sal_Int16(TWIP_TO_MM100(24/8*20)), aShadow.ShadowWidth); + CPPUNIT_ASSERT_EQUAL(sal_Int16(convertTwipToMm100(24/8*20)), aShadow.ShadowWidth); } DECLARE_OOXMLEXPORT_TEST(testTableFloating, "table-floating.docx") diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 3c63f51f39c5..103a3db948f4 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -527,7 +527,7 @@ DECLARE_OOXMLIMPORT_TEST(testN766487, "n766487.docx") xPropertySet.set(xParaEnum->nextElement(), uno::UNO_QUERY); sal_Int32 nValue = 0; xPropertySet->getPropertyValue("ParaFirstLineIndent") >>= nValue; - CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(-360)), nValue); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-360)), nValue); } DECLARE_OOXMLIMPORT_TEST(testN693238, "n693238.docx") @@ -1272,7 +1272,7 @@ DECLARE_OOXMLIMPORT_TEST(testPageBorderShadow, "page-border-shadow.docx") CPPUNIT_ASSERT_EQUAL(COL_BLACK, sal_uInt32(aShadow.Color)); CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location); // w:sz="48" is in eights of a point, 1 pt is 20 twips. - CPPUNIT_ASSERT_EQUAL(sal_Int16(TWIP_TO_MM100(48/8*20)), aShadow.ShadowWidth); + CPPUNIT_ASSERT_EQUAL(sal_Int16(convertTwipToMm100(48/8*20)), aShadow.ShadowWidth); } DECLARE_OOXMLIMPORT_TEST(testN816593, "n816593.docx") @@ -1343,7 +1343,7 @@ DECLARE_OOXMLIMPORT_TEST(testTableAutoColumnFixedSize, "table-auto-column-fixed- uno::Reference xTextTable(xTables->getByIndex(0), uno::UNO_QUERY); // Width was not recognized during import when table size was 'auto' - CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(3996)), getProperty(xTextTable, "Width")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(3996)), getProperty(xTextTable, "Width")); } DECLARE_OOXMLIMPORT_TEST(testFdo46361, "fdo46361.docx") @@ -1934,9 +1934,9 @@ DECLARE_OOXMLIMPORT_TEST(testStrict, "strict.docx") { uno::Reference xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY); // This was only 127, pt suffix was ignored, so this got parsed as twips instead of points. - CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(72 * 20)), getProperty(xPageStyle, "BottomMargin")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(72 * 20)), getProperty(xPageStyle, "BottomMargin")); // This was only 1397, same issue - CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(792 * 20)), getProperty(xPageStyle, "Height")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(792 * 20)), getProperty(xPageStyle, "Height")); // Text was missing, due to not handling the strict namespaces. getParagraph(1, "Hello world!"); diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 3f277cb110b0..a0ffe5d164cf 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -539,7 +539,7 @@ DECLARE_RTFEXPORT_TEST(testParaShadow, "para-shadow.rtf") table::ShadowFormat aShadow = getProperty(getParagraph(2), "ParaShadowFormat"); CPPUNIT_ASSERT_EQUAL(COL_BLACK, sal_uInt32(aShadow.Color)); CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location); - CPPUNIT_ASSERT_EQUAL(sal_Int16(TWIP_TO_MM100(60)), aShadow.ShadowWidth); + CPPUNIT_ASSERT_EQUAL(sal_Int16(convertTwipToMm100(60)), aShadow.ShadowWidth); } DECLARE_RTFEXPORT_TEST(testCharacterBorder, "charborder.odt") @@ -599,7 +599,7 @@ DECLARE_RTFEXPORT_TEST(testFdo74709, "fdo74709.rtf") { uno::Reference xCell = getCell(getParagraphOrTable(1), "B1"); // This was 0, as top/bottom/left/right padding wasn't imported. - CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(360)), getProperty(xCell, "RightBorderDistance")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(360)), getProperty(xCell, "RightBorderDistance")); } DECLARE_RTFEXPORT_TEST(testRelsize, "relsize.rtf") diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 2c25a16f9c16..d06d8fdf3b81 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -125,9 +125,9 @@ DECLARE_RTFIMPORT_TEST(testFdo45553, "fdo45553.rtf") uno::Reference xRange(xRangeEnum->nextElement(), uno::UNO_QUERY); OUString aStr = xRange->getString(); if ( aStr == "space-before" ) - CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(120)), getProperty(xRange, "ParaTopMargin")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(120)), getProperty(xRange, "ParaTopMargin")); else if ( aStr == "space-after" ) - CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(240)), getProperty(xRange, "ParaBottomMargin")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(240)), getProperty(xRange, "ParaBottomMargin")); } } } @@ -161,7 +161,7 @@ DECLARE_RTFIMPORT_TEST(testN695479, "n695479.rtf") // Negative ABSH should mean fixed size. CPPUNIT_ASSERT_EQUAL(text::SizeType::FIX, getProperty(xPropertySet, "SizeType")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(300)), getProperty(xPropertySet, "Height")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(300)), getProperty(xPropertySet, "Height")); uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); @@ -284,7 +284,7 @@ DECLARE_RTFIMPORT_TEST(testN751020, "n751020.rtf") uno::Reference xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); uno::Reference xParaEnum = xParaEnumAccess->createEnumeration(); CPPUNIT_ASSERT(xParaEnum->hasMoreElements()); - CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(200)), getProperty(xParaEnum->nextElement(), "ParaBottomMargin")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(200)), getProperty(xParaEnum->nextElement(), "ParaBottomMargin")); } DECLARE_RTFIMPORT_TEST(testFdo47326, "fdo47326.rtf") @@ -477,7 +477,7 @@ DECLARE_RTFIMPORT_TEST(testFdo49501, "fdo49501.rtf") uno::Reference xStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_True, getProperty(xStyle, "IsLandscape")); - sal_Int32 nExpected(TWIP_TO_MM100(567)); + sal_Int32 nExpected(convertTwipToMm100(567)); CPPUNIT_ASSERT_EQUAL(nExpected, getProperty(xStyle, "LeftMargin")); CPPUNIT_ASSERT_EQUAL(nExpected, getProperty(xStyle, "RightMargin")); CPPUNIT_ASSERT_EQUAL(nExpected, getProperty(xStyle, "TopMargin")); @@ -511,7 +511,7 @@ DECLARE_RTFIMPORT_TEST(testFdo45190, "fdo45190.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(getParagraph(1), "ParaFirstLineIndent")); // but direct one not - CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(-100)), getProperty(getParagraph(2), "ParaFirstLineIndent")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-100)), getProperty(getParagraph(2), "ParaFirstLineIndent")); } DECLARE_RTFIMPORT_TEST(testFdo50539, "fdo50539.rtf") @@ -548,7 +548,7 @@ DECLARE_RTFIMPORT_TEST(testFdo46966, "fdo46966.rtf") * xray ThisComponent.StyleFamilies.PageStyles.Default.TopMargin */ uno::Reference xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(720)), getProperty(xPropertySet, "TopMargin")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(720)), getProperty(xPropertySet, "TopMargin")); } DECLARE_RTFIMPORT_TEST(testFdo52066, "fdo52066.rtf") @@ -559,7 +559,7 @@ DECLARE_RTFIMPORT_TEST(testFdo52066, "fdo52066.rtf") * xray ThisComponent.DrawPage(0).Size.Height */ uno::Reference xShape(getShape(1), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(19)), xShape->getSize().Height); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(19)), xShape->getSize().Height); } DECLARE_RTFIMPORT_TEST(testFdo48033, "fdo48033.rtf") @@ -956,7 +956,7 @@ DECLARE_RTFIMPORT_TEST(testFdo59419, "fdo59419.rtf") DECLARE_RTFIMPORT_TEST(testFdo58076_2, "fdo58076-2.rtf") { // Position of the picture wasn't correct. - CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(8345)), getProperty(getShape(1), "HoriOrientPosition")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(8345)), getProperty(getShape(1), "HoriOrientPosition")); } DECLARE_RTFIMPORT_TEST(testFdo59953, "fdo59953.rtf") @@ -1285,7 +1285,7 @@ DECLARE_RTFIMPORT_TEST(testFdo67365, "fdo67365.rtf") DECLARE_RTFIMPORT_TEST(testFdo67498, "fdo67498.rtf") { // Left margin of the default page style wasn't set (was 2000). - CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(5954)), getProperty(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "LeftMargin")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(5954)), getProperty(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "LeftMargin")); } DECLARE_RTFIMPORT_TEST(testFdo47440, "fdo47440.rtf") diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 9c9b5d81c86e..972b06b63d91 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -21,7 +21,7 @@ #include -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) +#define convertTwipToMm100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) class Test : public SwModelTestBase { @@ -209,7 +209,7 @@ DECLARE_WW8IMPORT_TEST(testPageBorder, "page-border.doc") { // Page border was missing (LineWidth was 0), due to wrong interpretation of pgbApplyTo. table::BorderLine2 aBorder = getProperty(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "TopBorder"); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(TWIP_TO_MM100(6 * 20)), aBorder.LineWidth); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(convertTwipToMm100(6 * 20)), aBorder.LineWidth); } DECLARE_WW8IMPORT_TEST(testN823651, "n823651.doc") diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index a08403ba248c..578b6f8a53ab 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -1136,10 +1136,10 @@ GraphicAttr& SwGrfNode::GetGraphicAttr( GraphicAttr& rGA, rGA.SetMirrorFlags( nMirror ); const SwCropGrf& rCrop = rSet.GetCropGrf(); - rGA.SetCrop( TWIP_TO_MM100( rCrop.GetLeft() ), - TWIP_TO_MM100( rCrop.GetTop() ), - TWIP_TO_MM100( rCrop.GetRight() ), - TWIP_TO_MM100( rCrop.GetBottom() )); + rGA.SetCrop( convertTwipToMm100( rCrop.GetLeft() ), + convertTwipToMm100( rCrop.GetTop() ), + convertTwipToMm100( rCrop.GetRight() ), + convertTwipToMm100( rCrop.GetBottom() )); const SwRotationGrf& rRotation = rSet.GetRotationGrf(); rGA.SetRotation( rRotation.GetValue() ); diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index af7c00757a3b..5f9923b3895c 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -221,8 +221,8 @@ bool SwFmtFrmSize::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const case MID_FRMSIZE_SIZE: { awt::Size aTmp; - aTmp.Height = TWIP_TO_MM100(m_aSize.Height()); - aTmp.Width = TWIP_TO_MM100(m_aSize.Width()); + aTmp.Height = convertTwipToMm100(m_aSize.Height()); + aTmp.Width = convertTwipToMm100(m_aSize.Width()); rVal.setValue(&aTmp, ::getCppuType((const awt::Size*)0)); } break; @@ -251,14 +251,14 @@ bool SwFmtFrmSize::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const } break; case MID_FRMSIZE_WIDTH : - rVal <<= (sal_Int32)TWIP_TO_MM100(m_aSize.Width()); + rVal <<= (sal_Int32)convertTwipToMm100(m_aSize.Width()); break; case MID_FRMSIZE_HEIGHT: // #95848# returned size should never be zero. // (there was a bug that allowed for setting height to 0. // Thus there some documents existing with that not allowed // attribut value which may cause problems on import.) - rVal <<= (sal_Int32)TWIP_TO_MM100(m_aSize.Height() < MINLAY ? MINLAY : m_aSize.Height() ); + rVal <<= (sal_Int32)convertTwipToMm100(m_aSize.Height() < MINLAY ? MINLAY : m_aSize.Height() ); break; case MID_FRMSIZE_SIZE_TYPE: rVal <<= (sal_Int16)GetHeightSizeType(); @@ -293,8 +293,8 @@ bool SwFmtFrmSize::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) Size aTmp(aVal.Width, aVal.Height); if(bConvert) { - aTmp.Height() = MM100_TO_TWIP(aTmp.Height()); - aTmp.Width() = MM100_TO_TWIP(aTmp.Width()); + aTmp.Height() = convertMm100ToTwip(aTmp.Height()); + aTmp.Width() = convertMm100ToTwip(aTmp.Width()); } if(aTmp.Height() && aTmp.Width()) m_aSize = aTmp; @@ -361,7 +361,7 @@ bool SwFmtFrmSize::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if(rVal >>= nWd) { if(bConvert) - nWd = MM100_TO_TWIP(nWd); + nWd = convertMm100ToTwip(nWd); if(nWd < MINLAY) nWd = MINLAY; m_aSize.Width() = nWd; @@ -376,7 +376,7 @@ bool SwFmtFrmSize::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if(rVal >>= nHg) { if(bConvert) - nHg = MM100_TO_TWIP(nHg); + nHg = convertMm100ToTwip(nHg); if(nHg < MINLAY) nHg = MINLAY; m_aSize.Height() = nHg; @@ -1060,8 +1060,8 @@ bool SwFmtCol::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) SwColumn* pCol = new SwColumn; pCol->SetWishWidth( static_cast(pArray[i].Width) ); nWidthSum = static_cast(nWidthSum + pArray[i].Width); - pCol->SetLeft ( static_cast(MM100_TO_TWIP(pArray[i].LeftMargin)) ); - pCol->SetRight( static_cast(MM100_TO_TWIP(pArray[i].RightMargin)) ); + pCol->SetLeft ( static_cast(convertMm100ToTwip(pArray[i].LeftMargin)) ); + pCol->SetRight( static_cast(convertMm100ToTwip(pArray[i].RightMargin)) ); aColumns.insert(aColumns.begin() + i, pCol); } bRet = true; @@ -1281,7 +1281,7 @@ bool SwFmtVertOrient::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const rVal <<= (sal_Int16)eRelation; break; case MID_VERTORIENT_POSITION: - rVal <<= (sal_Int32)TWIP_TO_MM100(GetPos()); + rVal <<= (sal_Int32)convertTwipToMm100(GetPos()); break; default: OSL_ENSURE( !this, "unknown MemberId" ); @@ -1314,7 +1314,7 @@ bool SwFmtVertOrient::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) sal_Int32 nVal = 0; rVal >>= nVal; if(bConvert) - nVal = MM100_TO_TWIP(nVal); + nVal = convertMm100ToTwip(nVal); SetPos( nVal ); } break; @@ -1367,7 +1367,7 @@ bool SwFmtHoriOrient::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const rVal <<= (sal_Int16)eRelation; break; case MID_HORIORIENT_POSITION: - rVal <<= (sal_Int32)TWIP_TO_MM100(GetPos()); + rVal <<= (sal_Int32)convertTwipToMm100(GetPos()); break; case MID_HORIORIENT_PAGETOGGLE: { @@ -1407,7 +1407,7 @@ bool SwFmtHoriOrient::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if(!(rVal >>= nVal)) bRet = false; if(bConvert) - nVal = MM100_TO_TWIP(nVal); + nVal = convertMm100ToTwip(nVal); SetPos( nVal ); } break; @@ -2184,17 +2184,17 @@ bool SwTextGridItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const case MID_GRID_BASEHEIGHT: OSL_ENSURE( (nMemberId & CONVERT_TWIPS) != 0, "This value needs TWIPS-MM100 conversion" ); - rVal <<= (sal_Int32) TWIP_TO_MM100_UNSIGNED(m_nBaseHeight); + rVal <<= (sal_Int32) convertTwipToMm100(m_nBaseHeight); break; case MID_GRID_BASEWIDTH: OSL_ENSURE( (nMemberId & CONVERT_TWIPS) != 0, "This value needs TWIPS-MM100 conversion" ); - rVal <<= (sal_Int32) TWIP_TO_MM100_UNSIGNED(m_nBaseWidth); + rVal <<= (sal_Int32) convertTwipToMm100(m_nBaseWidth); break; case MID_GRID_RUBYHEIGHT: OSL_ENSURE( (nMemberId & CONVERT_TWIPS) != 0, "This value needs TWIPS-MM100 conversion" ); - rVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(m_nRubyHeight); + rVal <<= (sal_Int32)convertTwipToMm100(m_nRubyHeight); break; case MID_GRID_TYPE: switch( GetGridType() ) @@ -2272,7 +2272,7 @@ bool SwTextGridItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) "This value needs TWIPS-MM100 conversion" ); sal_Int32 nTmp = 0; bRet = (rVal >>= nTmp); - nTmp = MM100_TO_TWIP( nTmp ); + nTmp = convertMm100ToTwip( nTmp ); if( bRet && (nTmp >= 0) && ( nTmp <= USHRT_MAX) ) { // rhbz#1043551 round up to 5pt -- 0 causes divide-by-zero diff --git a/sw/source/core/para/paratr.cxx b/sw/source/core/para/paratr.cxx index 4500d8ce1362..415766c7c15e 100644 --- a/sw/source/core/para/paratr.cxx +++ b/sw/source/core/para/paratr.cxx @@ -128,13 +128,13 @@ bool SwFmtDrop::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { case MID_DROPCAP_LINES : rVal <<= (sal_Int16)nLines; break; case MID_DROPCAP_COUNT : rVal <<= (sal_Int16)nChars; break; - case MID_DROPCAP_DISTANCE : rVal <<= (sal_Int16) TWIP_TO_MM100_UNSIGNED(nDistance); break; + case MID_DROPCAP_DISTANCE : rVal <<= (sal_Int16) convertTwipToMm100(nDistance); break; case MID_DROPCAP_FORMAT: { style::DropCapFormat aDrop; aDrop.Lines = nLines ; aDrop.Count = nChars ; - aDrop.Distance = TWIP_TO_MM100_UNSIGNED(nDistance); + aDrop.Distance = convertTwipToMm100(nDistance); rVal.setValue(&aDrop, ::getCppuType((const style::DropCapFormat*)0)); } break; @@ -178,7 +178,7 @@ bool SwFmtDrop::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Int16 nVal = 0; if ( rVal >>= nVal ) - nDistance = (sal_Int16) MM100_TO_TWIP((sal_Int32)nVal); + nDistance = (sal_Int16) convertMm100ToTwip((sal_Int32)nVal); else return false; break; @@ -190,7 +190,7 @@ bool SwFmtDrop::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) const style::DropCapFormat* pDrop = (const style::DropCapFormat*)rVal.getValue(); nLines = pDrop->Lines; nChars = pDrop->Count; - nDistance = MM100_TO_TWIP(pDrop->Distance); + nDistance = convertMm100ToTwip(pDrop->Distance); } else { } diff --git a/sw/source/core/uibase/config/fontcfg.cxx b/sw/source/core/uibase/config/fontcfg.cxx index 35d84ab36034..20ebfdec70c4 100644 --- a/sw/source/core/uibase/config/fontcfg.cxx +++ b/sw/source/core/uibase/config/fontcfg.cxx @@ -124,7 +124,7 @@ SwStdFontConfig::SwStdFontConfig() : else { pValues[nProp] >>= nDefaultFontHeight[nProp - DEF_FONT_COUNT]; - nDefaultFontHeight[nProp - DEF_FONT_COUNT] = MM100_TO_TWIP(nDefaultFontHeight[nProp - DEF_FONT_COUNT]); + nDefaultFontHeight[nProp - DEF_FONT_COUNT] = convertMm100ToTwip(nDefaultFontHeight[nProp - DEF_FONT_COUNT]); } } } @@ -156,7 +156,7 @@ void SwStdFontConfig::Commit() else { if(nDefaultFontHeight[nProp - DEF_FONT_COUNT] > 0) - pValues[nProp] <<= static_cast(TWIP_TO_MM100(nDefaultFontHeight[nProp - DEF_FONT_COUNT])); + pValues[nProp] <<= static_cast(convertTwipToMm100(nDefaultFontHeight[nProp - DEF_FONT_COUNT])); } } PutProperties(aNames, aValues); diff --git a/sw/source/core/uibase/config/modcfg.cxx b/sw/source/core/uibase/config/modcfg.cxx index 211b34ad1080..a242b944dd0b 100644 --- a/sw/source/core/uibase/config/modcfg.cxx +++ b/sw/source/core/uibase/config/modcfg.cxx @@ -1157,10 +1157,10 @@ void SwTableConfig::Commit() { switch(nProp) { - case 0 : pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nTblHMove); break; //"Shift/Row", - case 1 : pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nTblVMove); break; //"Shift/Column", - case 2 : pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nTblHInsert); break; //"Insert/Row", - case 3 : pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nTblVInsert); break; //"Insert/Column", + case 0 : pValues[nProp] <<= (sal_Int32)convertTwipToMm100(nTblHMove); break; //"Shift/Row", + case 1 : pValues[nProp] <<= (sal_Int32)convertTwipToMm100(nTblVMove); break; //"Shift/Column", + case 2 : pValues[nProp] <<= (sal_Int32)convertTwipToMm100(nTblHInsert); break; //"Insert/Row", + case 3 : pValues[nProp] <<= (sal_Int32)convertTwipToMm100(nTblVInsert); break; //"Insert/Column", case 4 : pValues[nProp] <<= (sal_Int32)eTblChgMode; break; //"Change/Effect", case 5 : pValues[nProp].setValue(&bInsTblFormatNum, rType); break; //"Input/NumberRecognition", case 6 : pValues[nProp].setValue(&bInsTblChangeNumFormat, rType); break; //"Input/NumberFormatRecognition", @@ -1185,10 +1185,10 @@ void SwTableConfig::Load() sal_Int32 nTemp = 0; switch(nProp) { - case 0 : pValues[nProp] >>= nTemp; nTblHMove = (sal_uInt16)MM100_TO_TWIP(nTemp); break; //"Shift/Row", - case 1 : pValues[nProp] >>= nTemp; nTblVMove = (sal_uInt16)MM100_TO_TWIP(nTemp); break; //"Shift/Column", - case 2 : pValues[nProp] >>= nTemp; nTblHInsert = (sal_uInt16)MM100_TO_TWIP(nTemp); break; //"Insert/Row", - case 3 : pValues[nProp] >>= nTemp; nTblVInsert = (sal_uInt16)MM100_TO_TWIP(nTemp); break; //"Insert/Column", + case 0 : pValues[nProp] >>= nTemp; nTblHMove = (sal_uInt16)convertMm100ToTwip(nTemp); break; //"Shift/Row", + case 1 : pValues[nProp] >>= nTemp; nTblVMove = (sal_uInt16)convertMm100ToTwip(nTemp); break; //"Shift/Column", + case 2 : pValues[nProp] >>= nTemp; nTblHInsert = (sal_uInt16)convertMm100ToTwip(nTemp); break; //"Insert/Row", + case 3 : pValues[nProp] >>= nTemp; nTblVInsert = (sal_uInt16)convertMm100ToTwip(nTemp); break; //"Insert/Column", case 4 : pValues[nProp] >>= nTemp; eTblChgMode = (TblChgMode)nTemp; break; //"Change/Effect", case 5 : bInsTblFormatNum = *(sal_Bool*)pValues[nProp].getValue(); break; //"Input/NumberRecognition", case 6 : bInsTblChangeNumFormat = *(sal_Bool*)pValues[nProp].getValue(); break; //"Input/NumberFormatRecognition", diff --git a/sw/source/core/uibase/config/usrpref.cxx b/sw/source/core/uibase/config/usrpref.cxx index 7c47d4518486..6e0f70d6086d 100644 --- a/sw/source/core/uibase/config/usrpref.cxx +++ b/sw/source/core/uibase/config/usrpref.cxx @@ -292,7 +292,7 @@ void SwLayoutViewConfig::Commit() case 10: rVal <<= (sal_Int32)rParent.GetZoomType(); break; // "Zoom/Type", case 11: rVal <<= (sal_Bool) rParent.IsAlignMathObjectsToBaseline(); break; // "Other/IsAlignMathObjectsToBaseline" case 12: rVal <<= (sal_Int32)rParent.GetMetric(); break; // "Other/MeasureUnit", - case 13: rVal <<= static_cast(TWIP_TO_MM100(rParent.GetDefTab())); break;// "Other/TabStop", + case 13: rVal <<= static_cast(convertTwipToMm100(rParent.GetDefTab())); break;// "Other/TabStop", case 14: rVal <<= (sal_Bool) rParent.IsVRulerRight(); break; // "Window/IsVerticalRulerRight", case 15: rVal <<= (sal_Int32)rParent.GetViewLayoutColumns(); break; // "ViewLayout/Columns", case 16: rVal <<= (sal_Bool) rParent.IsViewLayoutBookMode(); break; // "ViewLayout/BookMode", @@ -346,7 +346,7 @@ void SwLayoutViewConfig::Load() case 10: rParent.SetZoomType( static_cast< SvxZoomType >(nInt32Val) ); break;// "Zoom/Type", case 11: rParent.SetAlignMathObjectsToBaseline(bSet); break;// "Other/IsAlignMathObjectsToBaseline" case 12: rParent.SetMetric((FieldUnit)nInt32Val, sal_True); break;// "Other/MeasureUnit", - case 13: rParent.SetDefTab(MM100_TO_TWIP(nInt32Val), sal_True); break;// "Other/TabStop", + case 13: rParent.SetDefTab(convertMm100ToTwip(nInt32Val), sal_True); break;// "Other/TabStop", case 14: rParent.SetVRulerRight(bSet); break;// "Window/IsVerticalRulerRight", case 15: rParent.SetViewLayoutColumns( static_cast(nInt32Val) ); break;// "ViewLayout/Columns", case 16: rParent.SetViewLayoutBookMode(bSet); break;// "ViewLayout/BookMode", @@ -409,8 +409,8 @@ void SwGridConfig::Commit() case 0: bSet = rParent.IsSnap(); break;// "Option/SnapToGrid", case 1: bSet = rParent.IsGridVisible(); break;//"Option/VisibleGrid", case 2: bSet = rParent.IsSynchronize(); break;// "Option/Synchronize", - case 3: pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100(rParent.GetSnapSize().Width()); break;// "Resolution/XAxis", - case 4: pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100(rParent.GetSnapSize().Height()); break;// "Resolution/YAxis", + case 3: pValues[nProp] <<= (sal_Int32)convertTwipToMm100(rParent.GetSnapSize().Width()); break;// "Resolution/XAxis", + case 4: pValues[nProp] <<= (sal_Int32)convertTwipToMm100(rParent.GetSnapSize().Height()); break;// "Resolution/YAxis", case 5: pValues[nProp] <<= (sal_Int16)rParent.GetDivisionX(); break;// "Subdivision/XAxis", case 6: pValues[nProp] <<= (sal_Int16)rParent.GetDivisionY(); break;// "Subdivision/YAxis" } @@ -442,8 +442,8 @@ void SwGridConfig::Load() case 0: rParent.SetSnap(bSet); break;// "Option/SnapToGrid", case 1: rParent.SetGridVisible(bSet); break;//"Option/VisibleGrid", case 2: rParent.SetSynchronize(bSet); break;// "Option/Synchronize", - case 3: aSnap.Width() = MM100_TO_TWIP(nSet); break;// "Resolution/XAxis", - case 4: aSnap.Height() = MM100_TO_TWIP(nSet); break;// "Resolution/YAxis", + case 3: aSnap.Width() = convertMm100ToTwip(nSet); break;// "Resolution/XAxis", + case 4: aSnap.Height() = convertMm100ToTwip(nSet); break;// "Resolution/YAxis", case 5: rParent.SetDivisionX((short)nSet); break;// "Subdivision/XAxis", case 6: rParent.SetDivisionY((short)nSet); break;// "Subdivision/YAxis" } diff --git a/sw/source/core/uibase/envelp/envimg.cxx b/sw/source/core/uibase/envelp/envimg.cxx index 6bdbe02f6e31..66e3f0a5d28c 100644 --- a/sw/source/core/uibase/envelp/envimg.cxx +++ b/sw/source/core/uibase/envelp/envimg.cxx @@ -191,27 +191,27 @@ SwEnvCfgItem::SwEnvCfgItem() : case 2: aEnvItem.bSend = *(sal_Bool*)pValues[nProp].getValue(); break;// "Inscription/UseSender", case 3: pValues[nProp] >>= aEnvItem.lAddrFromLeft;// "Format/AddresseeFromLeft", - aEnvItem.lAddrFromLeft = MM100_TO_TWIP(aEnvItem.lAddrFromLeft); + aEnvItem.lAddrFromLeft = convertMm100ToTwip(aEnvItem.lAddrFromLeft); break; case 4: pValues[nProp] >>= aEnvItem.lAddrFromTop; // "Format/AddresseeFromTop", - aEnvItem.lAddrFromTop = MM100_TO_TWIP(aEnvItem.lAddrFromTop); + aEnvItem.lAddrFromTop = convertMm100ToTwip(aEnvItem.lAddrFromTop); break; case 5: pValues[nProp] >>= aEnvItem.lSendFromLeft; // "Format/SenderFromLeft", - aEnvItem.lSendFromLeft = MM100_TO_TWIP(aEnvItem.lSendFromLeft); + aEnvItem.lSendFromLeft = convertMm100ToTwip(aEnvItem.lSendFromLeft); break; case 6: pValues[nProp] >>= aEnvItem.lSendFromTop;// "Format/SenderFromTop", - aEnvItem.lSendFromTop = MM100_TO_TWIP(aEnvItem.lSendFromTop); + aEnvItem.lSendFromTop = convertMm100ToTwip(aEnvItem.lSendFromTop); break; case 7: pValues[nProp] >>= aEnvItem.lWidth; // "Format/Width", - aEnvItem.lWidth = MM100_TO_TWIP(aEnvItem.lWidth); + aEnvItem.lWidth = convertMm100ToTwip(aEnvItem.lWidth); break; case 8: pValues[nProp] >>= aEnvItem.lHeight; // "Format/Height", - aEnvItem.lHeight = MM100_TO_TWIP(aEnvItem.lHeight); + aEnvItem.lHeight = convertMm100ToTwip(aEnvItem.lHeight); break; case 9: { @@ -221,11 +221,11 @@ SwEnvCfgItem::SwEnvCfgItem() : case 10: aEnvItem.bPrintFromAbove = *(sal_Bool*)pValues[nProp].getValue(); break;// "Print/FromAbove", case 11: pValues[nProp] >>= aEnvItem.lShiftRight; - aEnvItem.lShiftRight = MM100_TO_TWIP(aEnvItem.lShiftRight);// "Print/Right", + aEnvItem.lShiftRight = convertMm100ToTwip(aEnvItem.lShiftRight);// "Print/Right", break; case 12: pValues[nProp] >>= aEnvItem.lShiftDown; - aEnvItem.lShiftDown = MM100_TO_TWIP(aEnvItem.lShiftDown); + aEnvItem.lShiftDown = convertMm100ToTwip(aEnvItem.lShiftDown); break;// "Print/Down" } } @@ -251,16 +251,16 @@ void SwEnvCfgItem::Commit() case 0: pValues[nProp] <<= aEnvItem.aAddrText; break;// "Inscription/Addressee", case 1: pValues[nProp] <<= aEnvItem.aSendText; break;// "Inscription/Sender", case 2: pValues[nProp].setValue(&aEnvItem.bSend, rType);break;// "Inscription/UseSender", - case 3: pValues[nProp] <<= static_cast (TWIP_TO_MM100(aEnvItem.lAddrFromLeft)) ; break;// "Format/AddresseeFromLeft", - case 4: pValues[nProp] <<= static_cast (TWIP_TO_MM100(aEnvItem.lAddrFromTop)) ; break;// "Format/AddresseeFromTop", - case 5: pValues[nProp] <<= static_cast (TWIP_TO_MM100(aEnvItem.lSendFromLeft)) ; break;// "Format/SenderFromLeft", - case 6: pValues[nProp] <<= static_cast (TWIP_TO_MM100(aEnvItem.lSendFromTop)) ; break;// "Format/SenderFromTop", - case 7: pValues[nProp] <<= static_cast (TWIP_TO_MM100(aEnvItem.lWidth)) ; break;// "Format/Width", - case 8: pValues[nProp] <<= static_cast (TWIP_TO_MM100(aEnvItem.lHeight)) ; break;// "Format/Height", + case 3: pValues[nProp] <<= static_cast (convertTwipToMm100(aEnvItem.lAddrFromLeft)) ; break;// "Format/AddresseeFromLeft", + case 4: pValues[nProp] <<= static_cast (convertTwipToMm100(aEnvItem.lAddrFromTop)) ; break;// "Format/AddresseeFromTop", + case 5: pValues[nProp] <<= static_cast (convertTwipToMm100(aEnvItem.lSendFromLeft)) ; break;// "Format/SenderFromLeft", + case 6: pValues[nProp] <<= static_cast (convertTwipToMm100(aEnvItem.lSendFromTop)) ; break;// "Format/SenderFromTop", + case 7: pValues[nProp] <<= static_cast (convertTwipToMm100(aEnvItem.lWidth)) ; break;// "Format/Width", + case 8: pValues[nProp] <<= static_cast (convertTwipToMm100(aEnvItem.lHeight)) ; break;// "Format/Height", case 9: pValues[nProp] <<= sal_Int32(aEnvItem.eAlign); break;// "Print/Alignment", case 10: pValues[nProp].setValue(&aEnvItem.bPrintFromAbove, rType); break;// "Print/FromAbove", - case 11: pValues[nProp] <<= static_cast (TWIP_TO_MM100(aEnvItem.lShiftRight));break; // "Print/Right", - case 12: pValues[nProp] <<= static_cast (TWIP_TO_MM100(aEnvItem.lShiftDown)); break;// "Print/Down" + case 11: pValues[nProp] <<= static_cast (convertTwipToMm100(aEnvItem.lShiftRight));break; // "Print/Right", + case 12: pValues[nProp] <<= static_cast (convertTwipToMm100(aEnvItem.lShiftDown)); break;// "Print/Down" } } PutProperties(aNames, aValues); diff --git a/sw/source/core/uibase/envelp/labelcfg.cxx b/sw/source/core/uibase/envelp/labelcfg.cxx index 8630ea098465..b798098492c4 100644 --- a/sw/source/core/uibase/envelp/labelcfg.cxx +++ b/sw/source/core/uibase/envelp/labelcfg.cxx @@ -191,16 +191,16 @@ static SwLabRec* lcl_CreateSwLabRec(const OUString& rType, const OUString& rMeas switch(i) { case 0 : pNewRec->bCont = sToken[0] == 'C'; break; - case 1 : pNewRec->lHDist = MM100_TO_TWIP(nVal); break; - case 2 : pNewRec->lVDist = MM100_TO_TWIP(nVal); break; - case 3 : pNewRec->lWidth = MM100_TO_TWIP(nVal); break; - case 4 : pNewRec->lHeight = MM100_TO_TWIP(nVal); break; - case 5 : pNewRec->lLeft = MM100_TO_TWIP(nVal); break; - case 6 : pNewRec->lUpper = MM100_TO_TWIP(nVal); break; + case 1 : pNewRec->lHDist = convertMm100ToTwip(nVal); break; + case 2 : pNewRec->lVDist = convertMm100ToTwip(nVal); break; + case 3 : pNewRec->lWidth = convertMm100ToTwip(nVal); break; + case 4 : pNewRec->lHeight = convertMm100ToTwip(nVal); break; + case 5 : pNewRec->lLeft = convertMm100ToTwip(nVal); break; + case 6 : pNewRec->lUpper = convertMm100ToTwip(nVal); break; case 7 : pNewRec->nCols = nVal; break; case 8 : pNewRec->nRows = nVal; break; - case 9 : pNewRec->lPWidth = MM100_TO_TWIP(nVal); break; - case 10 : pNewRec->lPHeight = MM100_TO_TWIP(nVal); break; + case 9 : pNewRec->lPWidth = convertMm100ToTwip(nVal); break; + case 10 : pNewRec->lPHeight = convertMm100ToTwip(nVal); break; } } // lines added for compatibility with custom label definitions saved before patch fdo#44516 @@ -231,16 +231,16 @@ static Sequence lcl_CreateProperties( { rMeasure = ""; rMeasure += rRec.bCont ? OUString( "C" ) : OUString( "S" ); rMeasure += sColon; - rMeasure += OUString::number( TWIP_TO_MM100( rRec.lHDist ) ); rMeasure += sColon; - rMeasure += OUString::number( TWIP_TO_MM100( rRec.lVDist ) ); rMeasure += sColon; - rMeasure += OUString::number( TWIP_TO_MM100( rRec.lWidth ) ); rMeasure += sColon; - rMeasure += OUString::number( TWIP_TO_MM100( rRec.lHeight ) ); rMeasure += sColon; - rMeasure += OUString::number( TWIP_TO_MM100( rRec.lLeft ) ); rMeasure += sColon; - rMeasure += OUString::number( TWIP_TO_MM100( rRec.lUpper ) ); rMeasure += sColon; + rMeasure += OUString::number( convertTwipToMm100( rRec.lHDist ) ); rMeasure += sColon; + rMeasure += OUString::number( convertTwipToMm100( rRec.lVDist ) ); rMeasure += sColon; + rMeasure += OUString::number( convertTwipToMm100( rRec.lWidth ) ); rMeasure += sColon; + rMeasure += OUString::number( convertTwipToMm100( rRec.lHeight ) ); rMeasure += sColon; + rMeasure += OUString::number( convertTwipToMm100( rRec.lLeft ) ); rMeasure += sColon; + rMeasure += OUString::number( convertTwipToMm100( rRec.lUpper ) ); rMeasure += sColon; rMeasure += OUString::number( rRec.nCols ); rMeasure += sColon; rMeasure += OUString::number( rRec.nRows ); rMeasure += sColon; - rMeasure += OUString::number( TWIP_TO_MM100( rRec.lPWidth ) ); rMeasure += sColon; - rMeasure += OUString::number( TWIP_TO_MM100( rRec.lPHeight ) ); + rMeasure += OUString::number( convertTwipToMm100( rRec.lPWidth ) ); rMeasure += sColon; + rMeasure += OUString::number( convertTwipToMm100( rRec.lPHeight ) ); pValues[nProp].Value <<= rMeasure; } break; diff --git a/sw/source/core/uibase/envelp/labimg.cxx b/sw/source/core/uibase/envelp/labimg.cxx index a2006b87dda9..3665206d0a24 100644 --- a/sw/source/core/uibase/envelp/labimg.cxx +++ b/sw/source/core/uibase/envelp/labimg.cxx @@ -295,35 +295,35 @@ SwLabCfgItem::SwLabCfgItem(sal_Bool bLabel) : case 4: pValues[nProp] >>= aItem.nRows; break;// "Format/Row", case 5: pValues[nProp] >>= aItem.lHDist; - aItem.lHDist = MM100_TO_TWIP(aItem.lHDist); + aItem.lHDist = convertMm100ToTwip(aItem.lHDist); break;// "Format/HorizontalDistance", case 6: pValues[nProp] >>= aItem.lVDist; - aItem.lVDist = MM100_TO_TWIP(aItem.lVDist); + aItem.lVDist = convertMm100ToTwip(aItem.lVDist); break;// "Format/VerticalDistance", case 7: pValues[nProp] >>= aItem.lWidth; - aItem.lWidth = MM100_TO_TWIP(aItem.lWidth); + aItem.lWidth = convertMm100ToTwip(aItem.lWidth); break;// "Format/Width", case 8: pValues[nProp] >>= aItem.lHeight; - aItem.lHeight = MM100_TO_TWIP(aItem.lHeight); + aItem.lHeight = convertMm100ToTwip(aItem.lHeight); break;// "Format/Height", case 9: pValues[nProp] >>= aItem.lLeft; - aItem.lLeft = MM100_TO_TWIP(aItem.lLeft); + aItem.lLeft = convertMm100ToTwip(aItem.lLeft); break;// "Format/LeftMargin", case 10: pValues[nProp] >>= aItem.lUpper; - aItem.lUpper = MM100_TO_TWIP(aItem.lUpper); + aItem.lUpper = convertMm100ToTwip(aItem.lUpper); break;// "Format/TopMargin", case 11: pValues[nProp] >>= aItem.lPWidth; - aItem.lPWidth = MM100_TO_TWIP(aItem.lPWidth); + aItem.lPWidth = convertMm100ToTwip(aItem.lPWidth); break;// "Format/PageWidth", case 12: pValues[nProp] >>= aItem.lPHeight; - aItem.lPHeight = MM100_TO_TWIP(aItem.lPHeight); + aItem.lPHeight = convertMm100ToTwip(aItem.lPHeight); break;// "Format/PageHeight", case 13: aItem.bSynchron = *(sal_Bool*)pValues[nProp].getValue(); break;// "Option/Synchronize", case 14: aItem.bPage = *(sal_Bool*)pValues[nProp].getValue(); break;// "Option/Page", @@ -416,14 +416,14 @@ void SwLabCfgItem::Commit() case 2: pValues[nProp] <<= aItem.aType; break;// "Medium/Type", case 3: pValues[nProp] <<= aItem.nCols; break;// "Format/Column", case 4: pValues[nProp] <<= aItem.nRows; break;// "Format/Row", - case 5: pValues[nProp] <<= static_cast(TWIP_TO_MM100(aItem.lHDist));break;// "Format/HorizontalDistance", - case 6: pValues[nProp] <<= static_cast(TWIP_TO_MM100(aItem.lVDist));break;// "Format/VerticalDistance", - case 7: pValues[nProp] <<= static_cast(TWIP_TO_MM100(aItem.lWidth)); break;// "Format/Width", - case 8: pValues[nProp] <<= static_cast(TWIP_TO_MM100(aItem.lHeight)); break;// "Format/Height", - case 9: pValues[nProp] <<= static_cast(TWIP_TO_MM100(aItem.lLeft)); break;// "Format/LeftMargin", - case 10: pValues[nProp] <<= static_cast(TWIP_TO_MM100(aItem.lUpper)); break;// "Format/TopMargin", - case 11: pValues[nProp] <<= static_cast(TWIP_TO_MM100(aItem.lPWidth)); break;// "Format/Page Width", - case 12: pValues[nProp] <<= static_cast(TWIP_TO_MM100(aItem.lPHeight)); break;// "Format/PageHeight", + case 5: pValues[nProp] <<= static_cast(convertTwipToMm100(aItem.lHDist));break;// "Format/HorizontalDistance", + case 6: pValues[nProp] <<= static_cast(convertTwipToMm100(aItem.lVDist));break;// "Format/VerticalDistance", + case 7: pValues[nProp] <<= static_cast(convertTwipToMm100(aItem.lWidth)); break;// "Format/Width", + case 8: pValues[nProp] <<= static_cast(convertTwipToMm100(aItem.lHeight)); break;// "Format/Height", + case 9: pValues[nProp] <<= static_cast(convertTwipToMm100(aItem.lLeft)); break;// "Format/LeftMargin", + case 10: pValues[nProp] <<= static_cast(convertTwipToMm100(aItem.lUpper)); break;// "Format/TopMargin", + case 11: pValues[nProp] <<= static_cast(convertTwipToMm100(aItem.lPWidth)); break;// "Format/Page Width", + case 12: pValues[nProp] <<= static_cast(convertTwipToMm100(aItem.lPHeight)); break;// "Format/PageHeight", case 13: pValues[nProp].setValue(&aItem.bSynchron, rType); break;// "Option/Synchronize", case 14: pValues[nProp].setValue(&aItem.bPage, rType); break;// "Option/Page", case 15: pValues[nProp] <<= aItem.nCol; break;// "Option/Column", diff --git a/sw/source/core/uibase/shells/grfsh.cxx b/sw/source/core/uibase/shells/grfsh.cxx index 5538251c3fdd..980dceabe19d 100644 --- a/sw/source/core/uibase/shells/grfsh.cxx +++ b/sw/source/core/uibase/shells/grfsh.cxx @@ -133,18 +133,18 @@ void SwGrfShell::Execute(SfxRequest &rReq) if( pGraphic ) { Size aSize ( - TWIP_TO_MM100(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Width()), - TWIP_TO_MM100(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Height())); + convertTwipToMm100(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Width()), + convertTwipToMm100(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Height())); SfxItemSet aSet( rSh.GetAttrPool(), RES_GRFATR_CROPGRF, RES_GRFATR_CROPGRF ); rSh.GetCurAttr( aSet ); SwCropGrf aCrop( (const SwCropGrf&) aSet.Get(RES_GRFATR_CROPGRF) ); Rectangle aCropRectangle( - TWIP_TO_MM100(aCrop.GetLeft()), - TWIP_TO_MM100(aCrop.GetTop()), - TWIP_TO_MM100(aCrop.GetRight()), - TWIP_TO_MM100(aCrop.GetBottom()) ); + convertTwipToMm100(aCrop.GetLeft()), + convertTwipToMm100(aCrop.GetTop()), + convertTwipToMm100(aCrop.GetRight()), + convertTwipToMm100(aCrop.GetBottom()) ); Graphic aGraphic = Graphic( *pGraphic ); @@ -155,10 +155,10 @@ void SwGrfShell::Execute(SfxRequest &rReq) rSh.StartUndo(UNDO_START); Rectangle aScaledCropedRectangle = aDialog.GetScaledCropRectangle(); - aCrop.SetLeft( MM100_TO_TWIP( aScaledCropedRectangle.Left() )); - aCrop.SetTop( MM100_TO_TWIP( aScaledCropedRectangle.Top() )); - aCrop.SetRight( MM100_TO_TWIP( aScaledCropedRectangle.Right() )); - aCrop.SetBottom( MM100_TO_TWIP( aScaledCropedRectangle.Bottom() )); + aCrop.SetLeft( convertMm100ToTwip( aScaledCropedRectangle.Left() )); + aCrop.SetTop( convertMm100ToTwip( aScaledCropedRectangle.Top() )); + aCrop.SetRight( convertMm100ToTwip( aScaledCropedRectangle.Right() )); + aCrop.SetBottom( convertMm100ToTwip( aScaledCropedRectangle.Bottom() )); Graphic aCompressedGraphic( aDialog.GetCompressedGraphic() ); rSh.ReRead(OUString(), OUString(), (const Graphic*) &aCompressedGraphic); diff --git a/sw/source/core/uibase/uiview/view.cxx b/sw/source/core/uibase/uiview/view.cxx index 1fdf0bfc5d30..e13f9170554b 100644 --- a/sw/source/core/uibase/uiview/view.cxx +++ b/sw/source/core/uibase/uiview/view.cxx @@ -1269,35 +1269,35 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue > if ( pValue->Name == "ViewLeft" ) { pValue->Value >>= nX; - nX = MM100_TO_TWIP( nX ); + nX = convertMm100ToTwip( nX ); } else if ( pValue->Name == "ViewTop" ) { pValue->Value >>= nY; - nY = MM100_TO_TWIP( nY ); + nY = convertMm100ToTwip( nY ); } else if ( pValue->Name == "VisibleLeft" ) { pValue->Value >>= nLeft; - nLeft = MM100_TO_TWIP( nLeft ); + nLeft = convertMm100ToTwip( nLeft ); bGotVisibleLeft = sal_True; } else if ( pValue->Name == "VisibleTop" ) { pValue->Value >>= nTop; - nTop = MM100_TO_TWIP( nTop ); + nTop = convertMm100ToTwip( nTop ); bGotVisibleTop = sal_True; } else if ( pValue->Name == "VisibleRight" ) { pValue->Value >>= nRight; - nRight = MM100_TO_TWIP( nRight ); + nRight = convertMm100ToTwip( nRight ); bGotVisibleRight = sal_True; } else if ( pValue->Name == "VisibleBottom" ) { pValue->Value >>= nBottom; - nBottom = MM100_TO_TWIP( nBottom ); + nBottom = convertMm100ToTwip( nBottom ); bGotVisibleBottom = sal_True; } else if ( pValue->Name == "ZoomType" ) @@ -1471,27 +1471,27 @@ void SwView::WriteUserDataSequence ( uno::Sequence < beans::PropertyValue >& rSe pValue++;nIndex++; pValue->Name = "ViewLeft"; - pValue->Value <<= TWIP_TO_MM100 ( rRect.Left() ); + pValue->Value <<= convertTwipToMm100 ( rRect.Left() ); pValue++;nIndex++; pValue->Name = "ViewTop"; - pValue->Value <<= TWIP_TO_MM100 ( rRect.Top() ); + pValue->Value <<= convertTwipToMm100 ( rRect.Top() ); pValue++;nIndex++; pValue->Name = "VisibleLeft"; - pValue->Value <<= TWIP_TO_MM100 ( rVis.Left() ); + pValue->Value <<= convertTwipToMm100 ( rVis.Left() ); pValue++;nIndex++; pValue->Name = "VisibleTop"; - pValue->Value <<= TWIP_TO_MM100 ( rVis.Top() ); + pValue->Value <<= convertTwipToMm100 ( rVis.Top() ); pValue++;nIndex++; pValue->Name = "VisibleRight"; - pValue->Value <<= TWIP_TO_MM100 ( bBrowse ? LONG_MIN : rVis.Right() ); + pValue->Value <<= convertTwipToMm100 ( bBrowse ? LONG_MIN : rVis.Right() ); pValue++;nIndex++; pValue->Name = "VisibleBottom"; - pValue->Value <<= TWIP_TO_MM100 ( bBrowse ? LONG_MIN : rVis.Bottom() ); + pValue->Value <<= convertTwipToMm100 ( bBrowse ? LONG_MIN : rVis.Bottom() ); pValue++;nIndex++; pValue->Name = "ZoomType"; diff --git a/sw/source/core/uibase/uno/unomod.cxx b/sw/source/core/uibase/uno/unomod.cxx index 88841c1ff637..6f33409b55f8 100644 --- a/sw/source/core/uibase/uno/unomod.cxx +++ b/sw/source/core/uibase/uno/unomod.cxx @@ -639,7 +639,7 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c if(!(rValue >>= nTmp) || nTmp < 10) throw IllegalArgumentException(); Size aSize( mpViewOption->GetSnapSize() ); - aSize.Width() = MM100_TO_TWIP( nTmp ); + aSize.Width() = convertMm100ToTwip( nTmp ); mpViewOption->SetSnapSize( aSize ); } break; @@ -649,7 +649,7 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c if(!(rValue >>= nTmp) || nTmp < 10) throw IllegalArgumentException(); Size aSize( mpViewOption->GetSnapSize() ); - aSize.Height() = MM100_TO_TWIP( nTmp ); + aSize.Height() = convertMm100ToTwip( nTmp ); mpViewOption->SetSnapSize( aSize ); } break; @@ -861,11 +861,11 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u case HANDLE_VIEWSET_SCROLLBAR_TIPS : bBoolVal = mpConstViewOption->IsShowScrollBarTips(); break; case HANDLE_VIEWSET_RASTER_RESOLUTION_X : bBool = false; - rValue <<= (sal_Int32) TWIP_TO_MM100(mpConstViewOption->GetSnapSize().Width()); + rValue <<= (sal_Int32) convertTwipToMm100(mpConstViewOption->GetSnapSize().Width()); break; case HANDLE_VIEWSET_RASTER_RESOLUTION_Y : bBool = false; - rValue <<= (sal_Int32) TWIP_TO_MM100(mpConstViewOption->GetSnapSize().Height()); + rValue <<= (sal_Int32) convertTwipToMm100(mpConstViewOption->GetSnapSize().Height()); break; case HANDLE_VIEWSET_RASTER_SUBDIVISION_X : bBool = false; diff --git a/sw/source/core/uibase/uno/unotxdoc.cxx b/sw/source/core/uibase/uno/unotxdoc.cxx index 6c7fb3b85225..651b1d1724b6 100644 --- a/sw/source/core/uibase/uno/unotxdoc.cxx +++ b/sw/source/core/uibase/uno/unotxdoc.cxx @@ -995,17 +995,17 @@ Sequence< beans::PropertyValue > SwXTextDocument::getPagePrintSettings(void) pArray[0] = beans::PropertyValue("PageRows", -1, aVal, PropertyState_DIRECT_VALUE); aVal <<= (sal_Int16)aData.GetCol(); pArray[1] = beans::PropertyValue("PageColumns", -1, aVal, PropertyState_DIRECT_VALUE); - aVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(aData.GetLeftSpace()); + aVal <<= (sal_Int32)convertTwipToMm100(aData.GetLeftSpace()); pArray[2] = beans::PropertyValue("LeftMargin", -1, aVal, PropertyState_DIRECT_VALUE); - aVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(aData.GetRightSpace()); + aVal <<= (sal_Int32)convertTwipToMm100(aData.GetRightSpace()); pArray[3] = beans::PropertyValue("RightMargin", -1, aVal, PropertyState_DIRECT_VALUE); - aVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(aData.GetTopSpace()); + aVal <<= (sal_Int32)convertTwipToMm100(aData.GetTopSpace()); pArray[4] = beans::PropertyValue("TopMargin", -1, aVal, PropertyState_DIRECT_VALUE); - aVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(aData.GetBottomSpace()); + aVal <<= (sal_Int32)convertTwipToMm100(aData.GetBottomSpace()); pArray[5] = beans::PropertyValue("BottomMargin", -1, aVal, PropertyState_DIRECT_VALUE); - aVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(aData.GetHorzSpace()); + aVal <<= (sal_Int32)convertTwipToMm100(aData.GetHorzSpace()); pArray[6] = beans::PropertyValue("HoriMargin", -1, aVal, PropertyState_DIRECT_VALUE); - aVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(aData.GetVertSpace()); + aVal <<= (sal_Int32)convertTwipToMm100(aData.GetVertSpace()); pArray[7] = beans::PropertyValue("VertMargin", -1, aVal, PropertyState_DIRECT_VALUE); sal_Bool bTemp = aData.GetLandscape(); aVal.setValue(&bTemp, ::getCppuBooleanType()); @@ -1090,27 +1090,27 @@ void SwXTextDocument::setPagePrintSettings(const Sequence< beans::PropertyValue } else if(sName.equalsAscii("LeftMargin")) { - aData.SetLeftSpace(MM100_TO_TWIP_UNSIGNED(nVal)); + aData.SetLeftSpace(convertMm100ToTwip(nVal)); } else if(sName.equalsAscii("RightMargin")) { - aData.SetRightSpace(MM100_TO_TWIP_UNSIGNED(nVal)); + aData.SetRightSpace(convertMm100ToTwip(nVal)); } else if(sName.equalsAscii("TopMargin")) { - aData.SetTopSpace(MM100_TO_TWIP_UNSIGNED(nVal)); + aData.SetTopSpace(convertMm100ToTwip(nVal)); } else if(sName.equalsAscii("BottomMargin")) { - aData.SetBottomSpace(MM100_TO_TWIP_UNSIGNED(nVal)); + aData.SetBottomSpace(convertMm100ToTwip(nVal)); } else if(sName.equalsAscii("HoriMargin")) { - aData.SetHorzSpace(MM100_TO_TWIP_UNSIGNED(nVal)); + aData.SetHorzSpace(convertMm100ToTwip(nVal)); } else if(sName.equalsAscii("VertMargin")) { - aData.SetVertSpace(MM100_TO_TWIP_UNSIGNED(nVal)); + aData.SetVertSpace(convertMm100ToTwip(nVal)); } else if(sName.equalsAscii("IsLandscape")) { @@ -2765,8 +2765,8 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( // which may cause vcl to set that page size on the printer // (if available and not overridden by the user) aTmpSize = pVwSh->GetPageSize( nPage, bIsSkipEmptyPages ); - aPreferredPageSize = awt::Size ( TWIP_TO_MM100( 2 * aTmpSize.Width() ), - TWIP_TO_MM100( aTmpSize.Height() )); + aPreferredPageSize = awt::Size ( convertTwipToMm100( 2 * aTmpSize.Width() ), + convertTwipToMm100( aTmpSize.Height() )); } #else if( bPrintProspect ) @@ -2787,8 +2787,8 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( else { aTmpSize = pVwSh->GetPageSize( nPage, bIsSkipEmptyPages ); - aPageSize = awt::Size ( TWIP_TO_MM100( aTmpSize.Width() ), - TWIP_TO_MM100( aTmpSize.Height() )); + aPageSize = awt::Size ( convertTwipToMm100( aTmpSize.Width() ), + convertTwipToMm100( aTmpSize.Height() )); } sal_Int32 nLen = 2; diff --git a/sw/source/core/uibase/uno/unotxvw.cxx b/sw/source/core/uibase/uno/unotxvw.cxx index 9f310f534a6c..01feda252a11 100644 --- a/sw/source/core/uibase/uno/unotxvw.cxx +++ b/sw/source/core/uibase/uno/unotxvw.cxx @@ -927,11 +927,11 @@ awt::Point SwXTextViewCursor::getPosition(void) throw( uno::RuntimeException, st const SvxULSpaceItem& rUL = rMaster.GetULSpace(); const long nY = aCharRect.Top() - (rUL.GetUpper() + DOCUMENTBORDER); - aRet.Y = TWIP_TO_MM100(nY); + aRet.Y = convertTwipToMm100(nY); const SvxLRSpaceItem& rLR = rMaster.GetLRSpace(); const long nX = aCharRect.Left() - (rLR.GetLeft() + DOCUMENTBORDER); - aRet.X = TWIP_TO_MM100(nX); + aRet.X = convertTwipToMm100(nX); } else throw uno::RuntimeException(); diff --git a/sw/source/core/uibase/utlui/uiitems.cxx b/sw/source/core/uibase/utlui/uiitems.cxx index a3dc8d4b2b3c..de5d2c00691c 100644 --- a/sw/source/core/uibase/utlui/uiitems.cxx +++ b/sw/source/core/uibase/utlui/uiitems.cxx @@ -95,8 +95,8 @@ bool SwPageFtnInfoItem::QueryValue( Any& rVal, sal_uInt8 nMemberId ) const bool bRet = true; switch(nMemberId & ~CONVERT_TWIPS) { - case MID_FTN_HEIGHT : rVal <<= (sal_Int32)TWIP_TO_MM100(aFtnInfo.GetHeight());break; - case MID_LINE_WEIGHT : rVal <<= (sal_Int16)TWIP_TO_MM100_UNSIGNED(aFtnInfo.GetLineWidth());break; + case MID_FTN_HEIGHT : rVal <<= (sal_Int32)convertTwipToMm100(aFtnInfo.GetHeight());break; + case MID_LINE_WEIGHT : rVal <<= (sal_Int16)convertTwipToMm100(aFtnInfo.GetLineWidth());break; case MID_LINE_COLOR : rVal <<= (sal_Int32)aFtnInfo.GetLineColor().GetColor();break; case MID_LINE_RELWIDTH : { @@ -106,8 +106,8 @@ bool SwPageFtnInfoItem::QueryValue( Any& rVal, sal_uInt8 nMemberId ) const } break; case MID_LINE_ADJUST : rVal <<= (sal_Int16)aFtnInfo.GetAdj();break;//text::HorizontalAdjust - case MID_LINE_TEXT_DIST : rVal <<= (sal_Int32)TWIP_TO_MM100(aFtnInfo.GetTopDist());break; - case MID_LINE_FOOTNOTE_DIST: rVal <<= (sal_Int32)TWIP_TO_MM100(aFtnInfo.GetBottomDist());break; + case MID_LINE_TEXT_DIST : rVal <<= (sal_Int32)convertTwipToMm100(aFtnInfo.GetTopDist());break; + case MID_LINE_FOOTNOTE_DIST: rVal <<= (sal_Int32)convertTwipToMm100(aFtnInfo.GetBottomDist());break; case MID_FTN_LINE_STYLE : { switch ( aFtnInfo.GetLineStyle( ) ) @@ -144,7 +144,7 @@ bool SwPageFtnInfoItem::PutValue(const Any& rVal, sal_uInt8 nMemberId) bRet = false; else { - nSet32 = MM100_TO_TWIP(nSet32); + nSet32 = convertMm100ToTwip(nSet32); switch(nMemberId & ~CONVERT_TWIPS) { case MID_FTN_HEIGHT: aFtnInfo.SetHeight(nSet32); break; @@ -158,7 +158,7 @@ bool SwPageFtnInfoItem::PutValue(const Any& rVal, sal_uInt8 nMemberId) sal_Int16 nSet = 0; rVal >>= nSet; if(nSet >= 0) - aFtnInfo.SetLineWidth(MM100_TO_TWIP(nSet)); + aFtnInfo.SetLineWidth(convertMm100ToTwip(nSet)); else bRet = false; } diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 1a980d699c33..f08e7f7ddeb2 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -631,24 +631,24 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape) if ( !pDesc->GetHOrient() ) { SwFmtHoriOrient* pHori = pDesc->GetHOrient( true ); - SwTwips nHoriPos = MM100_TO_TWIP(aMM100Pos.X); + SwTwips nHoriPos = convertMm100ToTwip(aMM100Pos.X); pHori->SetPos( nHoriPos ); } { if(pDesc->GetHOrient()->GetHoriOrient() == text::HoriOrientation::NONE) - aMM100Pos.X = TWIP_TO_MM100(pDesc->GetHOrient()->GetPos()); + aMM100Pos.X = convertTwipToMm100(pDesc->GetHOrient()->GetPos()); aSet.Put( *pDesc->GetHOrient() ); } // #i32349# - if no vertical position exists, create one if ( !pDesc->GetVOrient() ) { SwFmtVertOrient* pVert = pDesc->GetVOrient( true ); - SwTwips nVertPos = MM100_TO_TWIP(aMM100Pos.Y); + SwTwips nVertPos = convertMm100ToTwip(aMM100Pos.Y); pVert->SetPos( nVertPos ); } { if(pDesc->GetVOrient()->GetVertOrient() == text::VertOrientation::NONE) - aMM100Pos.Y = TWIP_TO_MM100(pDesc->GetVOrient()->GetPos()); + aMM100Pos.Y = convertTwipToMm100(pDesc->GetVOrient()->GetPos()); aSet.Put( *pDesc->GetVOrient() ); } @@ -702,7 +702,7 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape) else if ((aAnchor.GetAnchorId() != FLY_AT_PAGE) && pDoc->GetCurrentLayout()) { SwCrsrMoveState aState( MV_SETONLYTEXT ); - Point aTmp(MM100_TO_TWIP(aMM100Pos.X), MM100_TO_TWIP(aMM100Pos.Y)); + Point aTmp(convertMm100ToTwip(aMM100Pos.X), convertMm100ToTwip(aMM100Pos.Y)); pDoc->GetCurrentLayout()->GetCrsrOfst( pPam->GetPoint(), aTmp, &aState ); aAnchor.SetAnchor( pPam->GetPoint() ); @@ -1471,8 +1471,8 @@ uno::Any SwXShape::getPropertyValue(const OUString& rPropertyName) { SdrObject* pObj = pSvxShape->GetSdrObject(); Point aPt = pObj->GetAnchorPos(); - awt::Point aPoint( TWIP_TO_MM100( aPt.X() ), - TWIP_TO_MM100( aPt.Y() ) ); + awt::Point aPoint( convertTwipToMm100( aPt.X() ), + convertTwipToMm100( aPt.Y() ) ); aRet.setValue(&aPoint, ::getCppuType( (awt::Point*)0 )); } } @@ -2205,8 +2205,8 @@ awt::Point SAL_CALL SwXShape::getPosition() throw ( uno::RuntimeException, std:: aOffset.X = ( aMemberObjRect.Left() - aGroupObjRect.Left() ); aOffset.Y = ( aMemberObjRect.Top() - aGroupObjRect.Top() ); } - aOffset.X = TWIP_TO_MM100(aOffset.X); - aOffset.Y = TWIP_TO_MM100(aOffset.Y); + aOffset.X = convertTwipToMm100(aOffset.X); + aOffset.Y = convertTwipToMm100(aOffset.Y); aPos.X += aOffset.X; aPos.Y += aOffset.Y; } @@ -2381,8 +2381,8 @@ awt::Point SwXShape::_GetAttrPosition() aAttrPos.X == 0 && aAttrPos.Y == 0 ) { const Rectangle aObjRect = pObj->GetSnapRect(); - aAttrPos.X = TWIP_TO_MM100(aObjRect.Left()); - aAttrPos.Y = TWIP_TO_MM100(aObjRect.Top()); + aAttrPos.X = convertTwipToMm100(aObjRect.Left()); + aAttrPos.Y = convertTwipToMm100(aObjRect.Top()); } } // #i35007# - If drawing object is anchored as-character, @@ -2469,8 +2469,8 @@ drawing::HomogenMatrix3 SwXShape::_ConvertTransformationToLayoutDir( // get position of object in Drawing layer coordinate system const Point aTmpObjPos( pObj->GetSnapRect().TopLeft() ); const awt::Point aObjPos( - TWIP_TO_MM100( aTmpObjPos.X() - pObj->GetAnchorPos().X() ), - TWIP_TO_MM100( aTmpObjPos.Y() - pObj->GetAnchorPos().Y() ) ); + convertTwipToMm100( aTmpObjPos.X() - pObj->GetAnchorPos().X() ), + convertTwipToMm100( aTmpObjPos.Y() - pObj->GetAnchorPos().Y() ) ); // determine difference between these positions according to the // Writer coordinate system const awt::Point aTranslateDiff( aPos.X - aObjPos.X, @@ -2608,8 +2608,8 @@ void SwXShape::_AdjustPositionProperties( const awt::Point _aPosition ) // get position of object in Drawing layer coordinate system const Point aTmpObjPos( pObj->GetSnapRect().TopLeft() ); const awt::Point aObjPos( - TWIP_TO_MM100( aTmpObjPos.X() - pObj->GetAnchorPos().X() ), - TWIP_TO_MM100( aTmpObjPos.Y() - pObj->GetAnchorPos().Y() ) ); + convertTwipToMm100( aTmpObjPos.X() - pObj->GetAnchorPos().X() ), + convertTwipToMm100( aTmpObjPos.Y() - pObj->GetAnchorPos().Y() ) ); // determine difference between these positions according to the // Writer coordinate system const awt::Point aTranslateDiff( aPos.X - aObjPos.X, @@ -2646,8 +2646,8 @@ void SwXShape::_AdjustPositionProperties( const awt::Point _aPosition ) // get position of object in Drawing layer coordinate system const Point aTmpObjPos( pObj->GetSnapRect().TopLeft() ); const awt::Point aObjPos( - TWIP_TO_MM100( aTmpObjPos.X() - pObj->GetAnchorPos().X() ), - TWIP_TO_MM100( aTmpObjPos.Y() - pObj->GetAnchorPos().Y() ) ); + convertTwipToMm100( aTmpObjPos.X() - pObj->GetAnchorPos().X() ), + convertTwipToMm100( aTmpObjPos.Y() - pObj->GetAnchorPos().Y() ) ); // determine difference between these positions according to the // Writer coordinate system const awt::Point aTranslateDiff( aPos.X - aObjPos.X, diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 5efcf0f47417..f0f251f5c630 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -2078,8 +2078,8 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) } // <-- awt::Size aTmp; - aTmp.Width = TWIP_TO_MM100(aActSize.Width()); - aTmp.Height = TWIP_TO_MM100(aActSize.Height()); + aTmp.Width = convertTwipToMm100(aActSize.Width()); + aTmp.Height = convertTwipToMm100(aActSize.Height()); aAny.setValue(&aTmp, ::getCppuType(static_cast(0))); } } diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index 7d0787e373d3..2cf1eca799fd 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -2888,7 +2888,7 @@ throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, { throw lang::IllegalArgumentException(); } - nPosition = MM100_TO_TWIP(nPosition); + nPosition = convertMm100ToTwip(nPosition); if(nPosition < 0) { throw lang::IllegalArgumentException(); @@ -3133,7 +3133,7 @@ throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, else { pArr[1].Name = "TabStopPosition"; - sal_Int32 nPos = (TWIP_TO_MM100(aToken.nTabStopPosition)); + sal_Int32 nPos = (convertTwipToMm100(aToken.nTabStopPosition)); if(nPos < 0) nPos = 0; pArr[1].Value <<= (sal_Int32)nPos; diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index 40be86a5c735..96538ebcab18 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -919,7 +919,7 @@ void SwXLineNumberingProperties::setPropertyValue( { sal_Int32 nVal = 0; aValue >>= nVal; - sal_Int32 nTmp = MM100_TO_TWIP(nVal); + sal_Int32 nTmp = convertMm100ToTwip(nVal); if (nTmp > USHRT_MAX) nTmp = USHRT_MAX; aInfo.SetPosFromLeft( static_cast< sal_uInt16 >(nTmp) ); @@ -1040,7 +1040,7 @@ Any SwXLineNumberingProperties::getPropertyValue(const OUString& rPropertyName) sal_uInt32 nPos = rInfo.GetPosFromLeft(); if(USHRT_MAX == nPos) nPos = 0; - aRet <<= static_cast < sal_Int32 >(TWIP_TO_MM100_UNSIGNED(nPos)); + aRet <<= static_cast < sal_Int32 >(convertTwipToMm100(nPos)); } break; case WID_INTERVAL : @@ -1395,17 +1395,17 @@ uno::Sequence SwXNumberingRules::GetNumberingRuleByIndex( if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) { //leftmargin - sal_Int32 nINT32 = TWIP_TO_MM100(rFmt.GetAbsLSpace()); + sal_Int32 nINT32 = convertTwipToMm100(rFmt.GetAbsLSpace()); pData = new PropValData((void*)&nINT32, UNO_NAME_LEFT_MARGIN, ::getCppuType((const sal_Int32*)0)); aPropertyValues.push_back(pData); //chartextoffset - nINT32 = TWIP_TO_MM100(rFmt.GetCharTextDistance()); + nINT32 = convertTwipToMm100(rFmt.GetCharTextDistance()); pData = new PropValData((void*)&nINT32, UNO_NAME_SYMBOL_TEXT_DISTANCE, ::getCppuType((const sal_Int32*)0)); aPropertyValues.push_back(pData); //firstlineoffset - nINT32 = TWIP_TO_MM100(rFmt.GetFirstLineOffset()); + nINT32 = convertTwipToMm100(rFmt.GetFirstLineOffset()); pData = new PropValData((void*)&nINT32, UNO_NAME_FIRST_LINE_OFFSET, ::getCppuType((const sal_Int32*)0)); aPropertyValues.push_back(pData); } @@ -1439,21 +1439,21 @@ uno::Sequence SwXNumberingRules::GetNumberingRuleByIndex( aPropertyValues.push_back(pData); // ListtabStopPosition - sal_Int32 nINT32 = TWIP_TO_MM100(rFmt.GetListtabPos()); + sal_Int32 nINT32 = convertTwipToMm100(rFmt.GetListtabPos()); pData = new PropValData( (void*)&nINT32, UNO_NAME_LISTTAB_STOP_POSITION, ::getCppuType((const sal_Int32*)0)); aPropertyValues.push_back(pData); // FirstLineIndent - nINT32 = TWIP_TO_MM100(rFmt.GetFirstLineIndent()); + nINT32 = convertTwipToMm100(rFmt.GetFirstLineIndent()); pData = new PropValData( (void*)&nINT32, UNO_NAME_FIRST_LINE_INDENT, ::getCppuType((const sal_Int32*)0)); aPropertyValues.push_back(pData); // IndentAt - nINT32 = TWIP_TO_MM100(rFmt.GetIndentAt()); + nINT32 = convertTwipToMm100(rFmt.GetIndentAt()); pData = new PropValData( (void*)&nINT32, UNO_NAME_INDENT_AT, ::getCppuType((const sal_Int32*)0)); @@ -1524,7 +1524,7 @@ uno::Sequence SwXNumberingRules::GetNumberingRuleByIndex( Size aSize = rFmt.GetGraphicSize(); // #i101131# // adjust conversion due to type mismatch between and - awt::Size aAwtSize(TWIP_TO_MM100(aSize.Width()), TWIP_TO_MM100(aSize.Height())); + awt::Size aAwtSize(convertTwipToMm100(aSize.Width()), convertTwipToMm100(aSize.Height())); pData = new PropValData((void*)&aAwtSize, UNO_NAME_GRAPHIC_SIZE, ::getCppuType((const awt::Size*)0)); aPropertyValues.push_back(pData); @@ -1785,7 +1785,7 @@ void SwXNumberingRules::SetNumberingRuleByIndex( sal_Int32 nValue = 0; pData->aVal >>= nValue; // #i23727# nValue can be negative - aFmt.SetAbsLSpace((sal_uInt16) MM100_TO_TWIP(nValue)); + aFmt.SetAbsLSpace((sal_uInt16) convertMm100ToTwip(nValue)); } break; case 7: //UNO_NAME_SYMBOL_TEXT_DISTANCE, @@ -1793,7 +1793,7 @@ void SwXNumberingRules::SetNumberingRuleByIndex( sal_Int32 nValue = 0; pData->aVal >>= nValue; if(nValue >= 0) - aFmt.SetCharTextDistance((sal_uInt16) MM100_TO_TWIP(nValue)); + aFmt.SetCharTextDistance((sal_uInt16) convertMm100ToTwip(nValue)); else bWrongArg = true; } @@ -1803,7 +1803,7 @@ void SwXNumberingRules::SetNumberingRuleByIndex( sal_Int32 nValue = 0; pData->aVal >>= nValue; // #i23727# nValue can be positive - nValue = MM100_TO_TWIP(nValue); + nValue = convertMm100ToTwip(nValue); aFmt.SetFirstLineOffset((short)nValue); } break; @@ -1851,7 +1851,7 @@ void SwXNumberingRules::SetNumberingRuleByIndex( { sal_Int32 nValue = 0; pData->aVal >>= nValue; - nValue = MM100_TO_TWIP(nValue); + nValue = convertMm100ToTwip(nValue); if ( nValue >= 0 ) { aFmt.SetListtabPos( nValue ); @@ -1866,7 +1866,7 @@ void SwXNumberingRules::SetNumberingRuleByIndex( { sal_Int32 nValue = 0; pData->aVal >>= nValue; - nValue = MM100_TO_TWIP(nValue); + nValue = convertMm100ToTwip(nValue); aFmt.SetFirstLineIndent( nValue ); } break; @@ -1874,7 +1874,7 @@ void SwXNumberingRules::SetNumberingRuleByIndex( { sal_Int32 nValue = 0; pData->aVal >>= nValue; - nValue = MM100_TO_TWIP(nValue); + nValue = convertMm100ToTwip(nValue); aFmt.SetIndentAt( nValue ); } break; @@ -2028,8 +2028,8 @@ void SwXNumberingRules::SetNumberingRuleByIndex( if(pData->aVal.getValueType() == ::getCppuType((awt::Size*)0)) { awt::Size* pSize = (awt::Size*)pData->aVal.getValue(); - pSize->Width = MM100_TO_TWIP(pSize->Width); - pSize->Height = MM100_TO_TWIP(pSize->Height); + pSize->Width = convertMm100ToTwip(pSize->Width); + pSize->Height = convertMm100ToTwip(pSize->Height); pSetSize->Width() = pSize->Width; pSetSize->Height() = pSize->Height; } @@ -2389,7 +2389,7 @@ SwXTextColumns::SwXTextColumns(const SwFmtCol& rFmtCol) : nAutoDistance = bIsAutomaticWidth ? USHRT_MAX == nItemGutterWidth ? DEF_GUTTER_WIDTH : (sal_Int32)nItemGutterWidth : 0; - nAutoDistance = TWIP_TO_MM100(nAutoDistance); + nAutoDistance = convertTwipToMm100(nAutoDistance); TextColumn* pColumns = aTextColumns.getArray(); const SwColumns& rCols = rFmtCol.GetColumns(); @@ -2399,8 +2399,8 @@ SwXTextColumns::SwXTextColumns(const SwFmtCol& rFmtCol) : pColumns[i].Width = pCol->GetWishWidth(); nReference += pColumns[i].Width; - pColumns[i].LeftMargin = TWIP_TO_MM100_UNSIGNED(pCol->GetLeft ()); - pColumns[i].RightMargin = TWIP_TO_MM100_UNSIGNED(pCol->GetRight()); + pColumns[i].LeftMargin = convertTwipToMm100(pCol->GetLeft ()); + pColumns[i].RightMargin = convertTwipToMm100(pCol->GetRight()); } if(!aTextColumns.getLength()) nReference = USHRT_MAX; @@ -2509,7 +2509,7 @@ void SwXTextColumns::setPropertyValue( const OUString& rPropertyName, const Any& aValue >>= nTmp; if(nTmp < 0) throw IllegalArgumentException(); - nSepLineWidth = MM100_TO_TWIP(nTmp); + nSepLineWidth = convertMm100ToTwip(nTmp); } break; case WID_TXTCOL_LINE_COLOR: @@ -2578,7 +2578,7 @@ Any SwXTextColumns::getPropertyValue( const OUString& rPropertyName ) switch(pEntry->nWID) { case WID_TXTCOL_LINE_WIDTH: - aRet <<= static_cast < sal_Int32 >(TWIP_TO_MM100(nSepLineWidth)); + aRet <<= static_cast < sal_Int32 >(convertTwipToMm100(nSepLineWidth)); break; case WID_TXTCOL_LINE_COLOR: aRet <<= nSepLineColor; diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index f387dc73ff89..d1980ce4c9d2 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -136,9 +136,9 @@ static bool lcl_LineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSv rSvxLine.SetColor(Color(rLine.Color)); rSvxLine.GuessLinesWidths( table::BorderLineStyle::NONE, - MM100_TO_TWIP( rLine.OuterLineWidth ), - MM100_TO_TWIP( rLine.InnerLineWidth ), - MM100_TO_TWIP( rLine.LineDistance ) ); + convertMm100ToTwip( rLine.OuterLineWidth ), + convertMm100ToTwip( rLine.InnerLineWidth ), + convertMm100ToTwip( rLine.LineDistance ) ); bool bRet = rLine.InnerLineWidth > 0 || rLine.OuterLineWidth > 0; return bRet; @@ -185,7 +185,7 @@ static void lcl_SetSpecialProperty(SwFrmFmt* pFmt, sal_Int32 nWidth = 0; aValue >>= nWidth; aSz.SetWidthPercent(0); - aSz.SetWidth ( MM100_TO_TWIP ( nWidth ) ); + aSz.SetWidth ( convertMm100ToTwip ( nWidth ) ); } else if(FN_TABLE_RELATIVE_WIDTH == pEntry->nWID) { @@ -1419,7 +1419,7 @@ void SwXTextTableRow::setPropertyValue(const OUString& rPropertyName, const uno: sal_Int32 nHeight = 0; aValue >>= nHeight; Size aSz(aFrmSize.GetSize()); - aSz.Height() = MM100_TO_TWIP(nHeight); + aSz.Height() = convertMm100ToTwip(nHeight); aFrmSize.SetSize(aSz); } pDoc->SetAttr(aFrmSize, *pLn->ClaimFrmFmt()); @@ -1475,7 +1475,7 @@ uno::Any SwXTextTableRow::getPropertyValue(const OUString& rPropertyName) throw( aRet.setValue(&bTmp, ::getCppuBooleanType()); } else - aRet <<= (sal_Int32)(TWIP_TO_MM100(rSize.GetSize().Height())); + aRet <<= (sal_Int32)(convertTwipToMm100(rSize.GetSize().Height())); } break; @@ -3235,7 +3235,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, const uno::An aBoxInfo.SetLine(aVertLine.isEmpty() ? 0 : &aVertLine, BOXINFO_LINE_VERT); aBoxInfo.SetValid(VALID_VERT, aBorder.IsVerticalLineValid); - aBox.SetDistance((sal_uInt16)MM100_TO_TWIP(aBorder.Distance)); + aBox.SetDistance((sal_uInt16)convertMm100ToTwip(aBorder.Distance)); aBoxInfo.SetValid(VALID_DISTANCE, aBorder.IsDistanceValid); aSet.Put(aBox); @@ -3256,10 +3256,10 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, const uno::An !aTableBorderDistances.IsBottomDistanceValid )) break; - sal_uInt16 nLeftDistance = MM100_TO_TWIP_UNSIGNED( aTableBorderDistances.LeftDistance); - sal_uInt16 nRightDistance = MM100_TO_TWIP_UNSIGNED( aTableBorderDistances.RightDistance); - sal_uInt16 nTopDistance = MM100_TO_TWIP_UNSIGNED( aTableBorderDistances.TopDistance); - sal_uInt16 nBottomDistance = MM100_TO_TWIP_UNSIGNED( aTableBorderDistances.BottomDistance); + sal_uInt16 nLeftDistance = convertMm100ToTwip( aTableBorderDistances.LeftDistance); + sal_uInt16 nRightDistance = convertMm100ToTwip( aTableBorderDistances.RightDistance); + sal_uInt16 nTopDistance = convertMm100ToTwip( aTableBorderDistances.TopDistance); + sal_uInt16 nBottomDistance = convertMm100ToTwip( aTableBorderDistances.BottomDistance); SwDoc* pDoc = pFmt->GetDoc(); SwTable* pTable = SwTable::FindTable( pFmt ); SwTableLines &rLines = pTable->GetTabLines(); @@ -3434,7 +3434,7 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) aTableBorder.IsHorizontalLineValid = rBoxInfoItem.IsValid(VALID_HORI); aTableBorder.VerticalLine = SvxBoxItem::SvxLineToLine(rBoxInfoItem.GetVert(), true); aTableBorder.IsVerticalLineValid = rBoxInfoItem.IsValid(VALID_VERT); - aTableBorder.Distance = TWIP_TO_MM100_UNSIGNED( rBox.GetDistance() ); + aTableBorder.Distance = convertTwipToMm100( rBox.GetDistance() ); aTableBorder.IsDistanceValid = rBoxInfoItem.IsValid(VALID_DISTANCE); aRet <<= aTableBorder; } @@ -3453,7 +3453,7 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) aTableBorder.IsHorizontalLineValid = rBoxInfoItem.IsValid(VALID_HORI); aTableBorder.VerticalLine = SvxBoxItem::SvxLineToLine(rBoxInfoItem.GetVert(), true); aTableBorder.IsVerticalLineValid = rBoxInfoItem.IsValid(VALID_VERT); - aTableBorder.Distance = TWIP_TO_MM100_UNSIGNED( rBox.GetDistance() ); + aTableBorder.Distance = convertTwipToMm100( rBox.GetDistance() ); aTableBorder.IsDistanceValid = rBoxInfoItem.IsValid(VALID_DISTANCE); aRet <<= aTableBorder; } @@ -3483,25 +3483,25 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) const SvxBoxItem& rBox = pBoxFmt->GetBox(); if( bFirst ) { - nLeftDistance = TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_LEFT )); - nRightDistance = TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_RIGHT )); - nTopDistance = TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_TOP )); - nBottomDistance = TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_BOTTOM )); + nLeftDistance = convertTwipToMm100( rBox.GetDistance( BOX_LINE_LEFT )); + nRightDistance = convertTwipToMm100( rBox.GetDistance( BOX_LINE_RIGHT )); + nTopDistance = convertTwipToMm100( rBox.GetDistance( BOX_LINE_TOP )); + nBottomDistance = convertTwipToMm100( rBox.GetDistance( BOX_LINE_BOTTOM )); bFirst = false; } else { if( aTableBorderDistances.IsLeftDistanceValid && - nLeftDistance != TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_LEFT ))) + nLeftDistance != convertTwipToMm100( rBox.GetDistance( BOX_LINE_LEFT ))) aTableBorderDistances.IsLeftDistanceValid = sal_False; if( aTableBorderDistances.IsRightDistanceValid && - nRightDistance != TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_RIGHT ))) + nRightDistance != convertTwipToMm100( rBox.GetDistance( BOX_LINE_RIGHT ))) aTableBorderDistances.IsRightDistanceValid = sal_False; if( aTableBorderDistances.IsTopDistanceValid && - nTopDistance != TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_TOP ))) + nTopDistance != convertTwipToMm100( rBox.GetDistance( BOX_LINE_TOP ))) aTableBorderDistances.IsTopDistanceValid = sal_False; if( aTableBorderDistances.IsBottomDistanceValid && - nBottomDistance != TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_BOTTOM ))) + nBottomDistance != convertTwipToMm100( rBox.GetDistance( BOX_LINE_BOTTOM ))) aTableBorderDistances.IsBottomDistanceValid = sal_False; } diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index ac1d2c728370..1a78810c1f9e 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -958,12 +958,12 @@ uno::Reference< drawing::XShape > SwHTMLParser::InsertControl( aLRItem.SetTxtFirstLineOfst( 0 ); if( rCSS1PropInfo.bLeftMargin ) { - nLeftSpace = static_cast< sal_uInt16 >(TWIP_TO_MM100( aLRItem.GetLeft() )); + nLeftSpace = static_cast< sal_uInt16 >(convertTwipToMm100( aLRItem.GetLeft() )); rCSS1PropInfo.bLeftMargin = sal_False; } if( rCSS1PropInfo.bRightMargin ) { - nRightSpace = static_cast< sal_uInt16 >(TWIP_TO_MM100( aLRItem.GetRight() )); + nRightSpace = static_cast< sal_uInt16 >(convertTwipToMm100( aLRItem.GetRight() )); rCSS1PropInfo.bRightMargin = sal_False; } rCSS1ItemSet.ClearItem( RES_LR_SPACE ); @@ -988,12 +988,12 @@ uno::Reference< drawing::XShape > SwHTMLParser::InsertControl( const SvxULSpaceItem *pULItem = (const SvxULSpaceItem *)pItem; if( rCSS1PropInfo.bTopMargin ) { - nUpperSpace = TWIP_TO_MM100_UNSIGNED( pULItem->GetUpper() ); + nUpperSpace = convertTwipToMm100( pULItem->GetUpper() ); rCSS1PropInfo.bTopMargin = sal_False; } if( rCSS1PropInfo.bBottomMargin ) { - nLowerSpace = TWIP_TO_MM100_UNSIGNED( pULItem->GetLower() ); + nLowerSpace = convertTwipToMm100( pULItem->GetLower() ); rCSS1PropInfo.bBottomMargin = sal_False; } @@ -1148,8 +1148,8 @@ uno::Reference< drawing::XShape > SwHTMLParser::InsertControl( { nAnchorType = text::TextContentAnchorType_AT_PAGE; } - nXPos = TWIP_TO_MM100( rCSS1PropInfo.nLeft ) + nLeftSpace; - nYPos = TWIP_TO_MM100( rCSS1PropInfo.nTop ) + nUpperSpace; + nXPos = convertTwipToMm100( rCSS1PropInfo.nLeft ) + nLeftSpace; + nYPos = convertTwipToMm100( rCSS1PropInfo.nTop ) + nUpperSpace; bSetPos = sal_True; nSurround = text::WrapTextMode_THROUGHT; @@ -1874,13 +1874,13 @@ void SwHTMLParser::InsertInput() if( SVX_CSS1_LTYPE_TWIP== aCSS1PropInfo.eWidthType ) { - aSz.Width() = TWIP_TO_MM100( aCSS1PropInfo.nWidth ); + aSz.Width() = convertTwipToMm100( aCSS1PropInfo.nWidth ); aTextSz.Width() = 0; bMinWidth = sal_False; } if( SVX_CSS1_LTYPE_TWIP== aCSS1PropInfo.eHeightType ) { - aSz.Height() = TWIP_TO_MM100( aCSS1PropInfo.nHeight ); + aSz.Height() = convertTwipToMm100( aCSS1PropInfo.nHeight ); aTextSz.Height() = 0; bMinHeight = sal_False; } @@ -2150,12 +2150,12 @@ void SwHTMLParser::NewTextArea() Size aSz( MINFLY, MINFLY ); if( SVX_CSS1_LTYPE_TWIP== aCSS1PropInfo.eWidthType ) { - aSz.Width() = TWIP_TO_MM100( aCSS1PropInfo.nWidth ); + aSz.Width() = convertTwipToMm100( aCSS1PropInfo.nWidth ); aTextSz.Width() = 0; } if( SVX_CSS1_LTYPE_TWIP== aCSS1PropInfo.eHeightType ) { - aSz.Height() = TWIP_TO_MM100( aCSS1PropInfo.nHeight ); + aSz.Height() = convertTwipToMm100( aCSS1PropInfo.nHeight ); aTextSz.Height() = 0; } if( aSz.Width() < MINFLY ) @@ -2430,13 +2430,13 @@ void SwHTMLParser::NewSelect() bFixSelectWidth = bFixSelectHeight = true; if( SVX_CSS1_LTYPE_TWIP== aCSS1PropInfo.eWidthType ) { - aSz.Width() = TWIP_TO_MM100( aCSS1PropInfo.nWidth ); + aSz.Width() = convertTwipToMm100( aCSS1PropInfo.nWidth ); bFixSelectWidth = false; bMinWidth = sal_False; } if( SVX_CSS1_LTYPE_TWIP== aCSS1PropInfo.eHeightType ) { - aSz.Height() = TWIP_TO_MM100( aCSS1PropInfo.nHeight ); + aSz.Height() = convertTwipToMm100( aCSS1PropInfo.nHeight ); aTextSz.Height() = sal_False; bMinHeight = sal_False; } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index d2e932eedfa3..801c0ac4a3ad 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2153,7 +2153,7 @@ static void impl_borderLine( FSHelperPtr pSerializer, sal_Int32 elementToken, co if( rStyleProps != NULL && pBorderLine && !pBorderLine->isEmpty() && pBorderLine->GetBorderLineStyle() == rStyleProps->LineStyle && pBorderLine->GetColor() == rStyleProps->Color && - (sal_uInt32) pBorderLine->GetWidth() == MM100_TO_TWIP_UNSIGNED( rStyleProps->LineWidth ) ) + pBorderLine->GetWidth() == convertMm100ToTwip( rStyleProps->LineWidth ) ) return; pAttr->add( FSNS( XML_w, XML_val ), OString( pVal ) ); @@ -7019,7 +7019,7 @@ void DocxAttributeOutput::ParaGrabBag(const SfxGrabBagItem& rItem) m_bParaBeforeAutoSpacing = true; // get fixed value which was set during import i->second >>= m_nParaBeforeSpacing; - m_nParaBeforeSpacing = MM100_TO_TWIP(m_nParaBeforeSpacing); + m_nParaBeforeSpacing = convertMm100ToTwip(m_nParaBeforeSpacing); SAL_INFO("sw.ww8", "DocxAttributeOutput::ParaGrabBag: property =" << i->first << " : m_nParaBeforeSpacing= " << m_nParaBeforeSpacing); } else if (i->first == "ParaBottomMarginAfterAutoSpacing") @@ -7027,7 +7027,7 @@ void DocxAttributeOutput::ParaGrabBag(const SfxGrabBagItem& rItem) m_bParaAfterAutoSpacing = true; // get fixed value which was set during import i->second >>= m_nParaAfterSpacing; - m_nParaAfterSpacing = MM100_TO_TWIP(m_nParaAfterSpacing); + m_nParaAfterSpacing = convertMm100ToTwip(m_nParaAfterSpacing); SAL_INFO("sw.ww8", "DocxAttributeOutput::ParaGrabBag: property =" << i->first << " : m_nParaBeforeSpacing= " << m_nParaAfterSpacing); } else if (i->first == "CharThemeFill") diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index d37467bc0a39..8cba8e503bd6 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -367,16 +367,16 @@ void SwXMLExport::GetViewSettings(Sequence& aProps) OSL_ENSURE( bTwip, "Map unit for visible area is not in TWIPS!" ); pValue[nIndex].Name = "ViewAreaTop"; - pValue[nIndex++].Value <<= bTwip ? TWIP_TO_MM100 ( rRect.Top() ) : rRect.Top(); + pValue[nIndex++].Value <<= bTwip ? convertTwipToMm100 ( rRect.Top() ) : rRect.Top(); pValue[nIndex].Name = "ViewAreaLeft"; - pValue[nIndex++].Value <<= bTwip ? TWIP_TO_MM100 ( rRect.Left() ) : rRect.Left(); + pValue[nIndex++].Value <<= bTwip ? convertTwipToMm100 ( rRect.Left() ) : rRect.Left(); pValue[nIndex].Name = "ViewAreaWidth"; - pValue[nIndex++].Value <<= bTwip ? TWIP_TO_MM100 ( rRect.GetWidth() ) : rRect.GetWidth(); + pValue[nIndex++].Value <<= bTwip ? convertTwipToMm100 ( rRect.GetWidth() ) : rRect.GetWidth(); pValue[nIndex].Name = "ViewAreaHeight"; - pValue[nIndex++].Value <<= bTwip ? TWIP_TO_MM100 ( rRect.GetHeight() ) : rRect.GetHeight(); + pValue[nIndex++].Value <<= bTwip ? convertTwipToMm100 ( rRect.GetHeight() ) : rRect.GetHeight(); // "show redline mode" cannot simply be read from the document // since it gets changed during execution. If it's in the info diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 68ed7969a820..8046bce892f7 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1020,25 +1020,25 @@ void SwXMLImport::SetViewSettings(const Sequence < PropertyValue > & aViewProps) if ( pValue->Name == "ViewAreaTop" ) { pValue->Value >>= nTmp; - aRect.setY( static_cast< long >(bTwip ? MM100_TO_TWIP ( nTmp ) : nTmp) ); + aRect.setY( static_cast< long >(bTwip ? convertMm100ToTwip ( nTmp ) : nTmp) ); } else if ( pValue->Name == "ViewAreaLeft" ) { pValue->Value >>= nTmp; - aRect.setX( static_cast< long >(bTwip ? MM100_TO_TWIP ( nTmp ) : nTmp) ); + aRect.setX( static_cast< long >(bTwip ? convertMm100ToTwip ( nTmp ) : nTmp) ); } else if ( pValue->Name == "ViewAreaWidth" ) { pValue->Value >>= nTmp; Size aSize( aRect.GetSize() ); - aSize.Width() = static_cast< long >(bTwip ? MM100_TO_TWIP ( nTmp ) : nTmp); + aSize.Width() = static_cast< long >(bTwip ? convertMm100ToTwip ( nTmp ) : nTmp); aRect.SetSize( aSize ); } else if ( pValue->Name == "ViewAreaHeight" ) { pValue->Value >>= nTmp; Size aSize( aRect.GetSize() ); - aSize.Height() = static_cast< long >(bTwip ? MM100_TO_TWIP ( nTmp ) : nTmp); + aSize.Height() = static_cast< long >(bTwip ? convertMm100ToTwip ( nTmp ) : nTmp); aRect.SetSize( aSize ); } else if ( pValue->Name == "ShowRedlineChanges" ) diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx index 61c91fc16526..43ce1c975ea4 100644 --- a/sw/source/filter/xml/xmltexti.cxx +++ b/sw/source/filter/xml/xmltexti.cxx @@ -100,10 +100,10 @@ static void lcl_putHeightAndWidth ( SfxItemSet &rItemSet, { if( nWidth > 0 && nHeight > 0 ) { - nWidth = MM100_TO_TWIP( nWidth ); + nWidth = convertMm100ToTwip( nWidth ); if( nWidth < MINFLY ) nWidth = MINFLY; - nHeight = MM100_TO_TWIP( nHeight ); + nHeight = convertMm100ToTwip( nHeight ); if( nHeight < MINFLY ) nHeight = MINFLY; rItemSet.Put( SwFmtFrmSize( ATT_FIX_SIZE, nWidth, nHeight ) ); diff --git a/sw/source/ui/index/cntex.cxx b/sw/source/ui/index/cntex.cxx index 1b8d2f219cb9..094ea5f793eb 100644 --- a/sw/source/ui/index/cntex.cxx +++ b/sw/source/ui/index/cntex.cxx @@ -358,7 +358,7 @@ void SwMultiTOXTabDialog::CreateOrUpdateExample( pPropValArr[4].Name = "TabStopPosition"; SwTwips nTempPos = aToken.nTabStopPosition >= 0 ? aToken.nTabStopPosition : 0; - nTempPos = TWIP_TO_MM100(nTempPos); + nTempPos = convertTwipToMm100(nTempPos); pPropValArr[4].Value <<= (sal_Int32)nTempPos; } else if(TOKEN_TEXT == aToken.eTokenType) diff --git a/sw/source/ui/vba/vbainformationhelper.cxx b/sw/source/ui/vba/vbainformationhelper.cxx index 838e29eee56b..9af29dada418 100644 --- a/sw/source/ui/vba/vbainformationhelper.cxx +++ b/sw/source/ui/vba/vbainformationhelper.cxx @@ -58,7 +58,7 @@ double SwVbaInformationHelper::handleWdVerticalPositionRelativeToPage( const css // it is very strange that the curros position is incorrect when open Word file. // e.g. if current cursor in the top left of the text body of the first page without header, // the top value of current position should be 0, but is 201 when open a Word file. - nCurrentPos = nCurrentPos + nTopMargin - ( DEFAULT_PAGE_DISTANCE + TWIP_TO_MM100( nPageHeight ) ) * ( nCurrentPage - 1 ); + nCurrentPos = nCurrentPos + nTopMargin - ( DEFAULT_PAGE_DISTANCE + convertTwipToMm100( nPageHeight ) ) * ( nCurrentPage - 1 ); return Millimeter::getInPoints( nCurrentPos ); } diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx index 9de86eeb8f0a..bff0e823b2a7 100644 --- a/writerfilter/source/dmapper/ConversionHelper.cxx +++ b/writerfilter/source/dmapper/ConversionHelper.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -226,11 +227,9 @@ OUString ConvertMSFormatStringToSO( } -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) - sal_Int32 convertTwipToMM100(sal_Int32 _t) { - return TWIP_TO_MM100( _t ); + return ::convertTwipToMm100( _t ); } sal_uInt32 convertTwipToMM100Unsigned(sal_Int32 _t) @@ -241,7 +240,7 @@ sal_uInt32 convertTwipToMM100Unsigned(sal_Int32 _t) // anything that's bigger than 32767 appears to be simply ignored. if( _t >= 0x8000 ) return 0; - return TWIP_TO_MM100( _t ); + return ::convertTwipToMm100( _t ); } sal_Int32 convertEMUToMM100(sal_Int32 _t) diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 39da5cc9bead..b9b99fe93764 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -56,7 +57,6 @@ #include #include -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) #define MM100_TO_EMU(MM100) (MM100 * 360) using std::make_pair; @@ -3479,15 +3479,15 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) m_aStates.top().aPicture.nHeight = nParam; break; case RTF_PICWGOAL: - m_aStates.top().aPicture.nGoalWidth = TWIP_TO_MM100(nParam); + m_aStates.top().aPicture.nGoalWidth = convertTwipToMm100(nParam); break; case RTF_PICHGOAL: - m_aStates.top().aPicture.nGoalHeight = TWIP_TO_MM100(nParam); + m_aStates.top().aPicture.nGoalHeight = convertTwipToMm100(nParam); break; - case RTF_PICCROPL: m_aStates.top().aPicture.nCropL = TWIP_TO_MM100(nParam); break; - case RTF_PICCROPR: m_aStates.top().aPicture.nCropR = TWIP_TO_MM100(nParam); break; - case RTF_PICCROPT: m_aStates.top().aPicture.nCropT = TWIP_TO_MM100(nParam); break; - case RTF_PICCROPB: m_aStates.top().aPicture.nCropB = TWIP_TO_MM100(nParam); break; + case RTF_PICCROPL: m_aStates.top().aPicture.nCropL = convertTwipToMm100(nParam); break; + case RTF_PICCROPR: m_aStates.top().aPicture.nCropR = convertTwipToMm100(nParam); break; + case RTF_PICCROPT: m_aStates.top().aPicture.nCropT = convertTwipToMm100(nParam); break; + case RTF_PICCROPB: m_aStates.top().aPicture.nCropB = convertTwipToMm100(nParam); break; case RTF_SHPWRK: { int nValue = 0; @@ -3704,16 +3704,16 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) } break; case RTF_SHPLEFT: - m_aStates.top().aShape.nLeft = TWIP_TO_MM100(nParam); + m_aStates.top().aShape.nLeft = convertTwipToMm100(nParam); break; case RTF_SHPTOP: - m_aStates.top().aShape.nTop = TWIP_TO_MM100(nParam); + m_aStates.top().aShape.nTop = convertTwipToMm100(nParam); break; case RTF_SHPRIGHT: - m_aStates.top().aShape.nRight = TWIP_TO_MM100(nParam); + m_aStates.top().aShape.nRight = convertTwipToMm100(nParam); break; case RTF_SHPBOTTOM: - m_aStates.top().aShape.nBottom = TWIP_TO_MM100(nParam); + m_aStates.top().aShape.nBottom = convertTwipToMm100(nParam); break; case RTF_SHPZ: m_aStates.top().aShape.oZ.reset(nParam); @@ -3832,16 +3832,16 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_after, pIntValue, OVERWRITE_YES); break; case RTF_DPX: - m_aStates.top().aDrawingObject.nLeft = TWIP_TO_MM100(nParam); + m_aStates.top().aDrawingObject.nLeft = convertTwipToMm100(nParam); break; case RTF_DPY: - m_aStates.top().aDrawingObject.nTop = TWIP_TO_MM100(nParam); + m_aStates.top().aDrawingObject.nTop = convertTwipToMm100(nParam); break; case RTF_DPXSIZE: - m_aStates.top().aDrawingObject.nRight = TWIP_TO_MM100(nParam); + m_aStates.top().aDrawingObject.nRight = convertTwipToMm100(nParam); break; case RTF_DPYSIZE: - m_aStates.top().aDrawingObject.nBottom = TWIP_TO_MM100(nParam); + m_aStates.top().aDrawingObject.nBottom = convertTwipToMm100(nParam); break; case RTF_PNSTART: m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_start, pIntValue); @@ -3933,7 +3933,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) if (!rDrawingObject.aPolyLinePoints.hasElements()) dispatchValue(RTF_DPPOLYCOUNT, 2); - rDrawingObject.aPolyLinePoints[rDrawingObject.aPolyLinePoints.getLength() - rDrawingObject.nPolyLineCount].X = TWIP_TO_MM100(nParam); + rDrawingObject.aPolyLinePoints[rDrawingObject.aPolyLinePoints.getLength() - rDrawingObject.nPolyLineCount].X = convertTwipToMm100(nParam); } break; case RTF_DPPTY: @@ -3941,7 +3941,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) RTFDrawingObject& rDrawingObject = m_aStates.top().aDrawingObject; if (rDrawingObject.aPolyLinePoints.hasElements()) { - rDrawingObject.aPolyLinePoints[rDrawingObject.aPolyLinePoints.getLength() - rDrawingObject.nPolyLineCount].Y = TWIP_TO_MM100(nParam); + rDrawingObject.aPolyLinePoints[rDrawingObject.aPolyLinePoints.getLength() - rDrawingObject.nPolyLineCount].Y = convertTwipToMm100(nParam); rDrawingObject.nPolyLineCount--; if (rDrawingObject.nPolyLineCount == 0) { diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 5f5869427041..cc5d6cd4eff0 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "../dmapper/GraphicHelpers.hxx" @@ -39,8 +40,6 @@ #include #include -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) - namespace writerfilter { namespace rtftok { @@ -527,21 +526,21 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose) } } else if (i->first == "groupLeft") - oGroupLeft.reset(TWIP_TO_MM100(i->second.toInt32())); + oGroupLeft.reset(convertTwipToMm100(i->second.toInt32())); else if (i->first == "groupTop") - oGroupTop.reset(TWIP_TO_MM100(i->second.toInt32())); + oGroupTop.reset(convertTwipToMm100(i->second.toInt32())); else if (i->first == "groupRight") - oGroupRight.reset(TWIP_TO_MM100(i->second.toInt32())); + oGroupRight.reset(convertTwipToMm100(i->second.toInt32())); else if (i->first == "groupBottom") - oGroupBottom.reset(TWIP_TO_MM100(i->second.toInt32())); + oGroupBottom.reset(convertTwipToMm100(i->second.toInt32())); else if (i->first == "relLeft") - oRelLeft.reset(TWIP_TO_MM100(i->second.toInt32())); + oRelLeft.reset(convertTwipToMm100(i->second.toInt32())); else if (i->first == "relTop") - oRelTop.reset(TWIP_TO_MM100(i->second.toInt32())); + oRelTop.reset(convertTwipToMm100(i->second.toInt32())); else if (i->first == "relRight") - oRelRight.reset(TWIP_TO_MM100(i->second.toInt32())); + oRelRight.reset(convertTwipToMm100(i->second.toInt32())); else if (i->first == "relBottom") - oRelBottom.reset(TWIP_TO_MM100(i->second.toInt32())); + oRelBottom.reset(convertTwipToMm100(i->second.toInt32())); else if (i->first == "fBehindDocument") bOpaque = !i->second.toInt32(); else if (i->first == "pctHoriz" || i->first == "pctVert") -- cgit v1.2.3