diff options
Diffstat (limited to 'sw/source')
24 files changed, 101 insertions, 103 deletions
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index fcb598966280..1d51efc07ce6 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -898,10 +898,10 @@ void SwVirtFlyDrawObj::NbcCrop(const basegfx::B2DPoint& rRef, double fxFact, dou // pSh->StartUndo(SwUndoId::START); // Set new crop values in twips - aCrop.SetLeft (convertMm100ToTwip(nLeftCrop)); - aCrop.SetTop (convertMm100ToTwip(nTopCrop)); - aCrop.SetRight (convertMm100ToTwip(nRightCrop)); - aCrop.SetBottom(convertMm100ToTwip(nBottomCrop)); + aCrop.SetLeft (o3tl::toTwips(nLeftCrop, o3tl::Length::mm100)); + aCrop.SetTop (o3tl::toTwips(nTopCrop, o3tl::Length::mm100)); + aCrop.SetRight (o3tl::toTwips(nRightCrop, o3tl::Length::mm100)); + aCrop.SetBottom(o3tl::toTwips(nBottomCrop, o3tl::Length::mm100)); pSh->SetAttrItem(aCrop); // Set new frame size diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx index 6e79b4aa941d..244d935bceb1 100644 --- a/sw/source/core/inc/rootfrm.hxx +++ b/sw/source/core/inc/rootfrm.hxx @@ -107,7 +107,7 @@ class SW_DLLPUBLIC SwRootFrame final : public SwLayoutFrame static bool s_isNoVirDev;// No virt. Device for SystemPaints /// Width of the HTML / Web document if not defined otherwise: 20cm. - static constexpr sal_Int64 MIN_BROWSE_WIDTH = convertMm100ToTwip(20000); + static constexpr sal_Int64 MIN_BROWSE_WIDTH = o3tl::toTwips(20000, o3tl::Length::mm100); bool mbCheckSuperfluous :1; // Search for empty Pages? bool mbIdleFormat :1; // Trigger Idle Formatter? diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 9181f970ea18..711957cea1f2 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -326,8 +326,8 @@ bool SwFormatFrameSize::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) Size aTmp(aVal.Width, aVal.Height); if(bConvert) { - aTmp.setHeight( convertMm100ToTwip(aTmp.Height()) ); - aTmp.setWidth( convertMm100ToTwip(aTmp.Width()) ); + aTmp.setHeight(o3tl::toTwips(aTmp.Height(), o3tl::Length::mm100)); + aTmp.setWidth(o3tl::toTwips(aTmp.Width(), o3tl::Length::mm100)); } SetSize(aTmp); } @@ -391,7 +391,7 @@ bool SwFormatFrameSize::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if(rVal >>= nWd) { if(bConvert) - nWd = convertMm100ToTwip(nWd); + nWd = o3tl::toTwips(nWd, o3tl::Length::mm100); if(nWd < MINLAY) nWd = MINLAY; SetWidth(nWd); @@ -406,7 +406,7 @@ bool SwFormatFrameSize::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if(rVal >>= nHg) { if(bConvert) - nHg = convertMm100ToTwip(nHg); + nHg = o3tl::toTwips(nHg, o3tl::Length::mm100); if(nHg < MINLAY) nHg = MINLAY; SetHeight(nHg); @@ -1189,8 +1189,8 @@ bool SwFormatCol::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) SwColumn aCol; aCol.SetWishWidth(pArray[i].Width ); nWidthSum = nWidthSum + pArray[i].Width; - aCol.SetLeft (convertMm100ToTwip(pArray[i].LeftMargin)); - aCol.SetRight(convertMm100ToTwip(pArray[i].RightMargin)); + aCol.SetLeft (o3tl::toTwips(pArray[i].LeftMargin, o3tl::Length::mm100)); + aCol.SetRight(o3tl::toTwips(pArray[i].RightMargin, o3tl::Length::mm100)); m_aColumns.insert(m_aColumns.begin() + i, aCol); } bRet = true; @@ -1433,7 +1433,7 @@ bool SwFormatVertOrient::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) sal_Int32 nVal = 0; rVal >>= nVal; if(bConvert) - nVal = convertMm100ToTwip(nVal); + nVal = o3tl::toTwips(nVal, o3tl::Length::mm100); SetPos( nVal ); } break; @@ -1531,7 +1531,7 @@ bool SwFormatHoriOrient::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if(!(rVal >>= nVal)) bRet = false; if(bConvert) - nVal = convertMm100ToTwip(nVal); + nVal = o3tl::toTwips(nVal, o3tl::Length::mm100); SetPos( nVal ); } break; @@ -2380,7 +2380,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 = convertMm100ToTwip( nTmp ); + nTmp = o3tl::toTwips(nTmp, o3tl::Length::mm100); if( bRet && (nTmp >= 0) && ( nTmp <= SAL_MAX_UINT16) ) { // 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 b8c6e668b01a..f724ac21c0fe 100644 --- a/sw/source/core/para/paratr.cxx +++ b/sw/source/core/para/paratr.cxx @@ -147,7 +147,7 @@ bool SwFormatDrop::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Int16 nVal = 0; if ( rVal >>= nVal ) - m_nDistance = static_cast<sal_Int16>(convertMm100ToTwip(static_cast<sal_Int32>(nVal))); + m_nDistance = o3tl::toTwips(nVal, o3tl::Length::mm100); else return false; break; @@ -159,7 +159,7 @@ bool SwFormatDrop::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) auto pDrop = o3tl::doAccess<style::DropCapFormat>(rVal); m_nLines = pDrop->Lines; m_nChars = pDrop->Count; - m_nDistance = convertMm100ToTwip(pDrop->Distance); + m_nDistance = o3tl::toTwips(pDrop->Distance, o3tl::Length::mm100); } } break; diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index c47887f8350d..221f47fca29a 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -619,7 +619,7 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape) if ( !pDesc->GetHOrient() ) { SwFormatHoriOrient* pHori = pDesc->GetHOrient( true ); - SwTwips nHoriPos = convertMm100ToTwip(aMM100Pos.X); + SwTwips nHoriPos = o3tl::toTwips(aMM100Pos.X, o3tl::Length::mm100); pHori->SetPos( nHoriPos ); } { @@ -631,7 +631,7 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape) if ( !pDesc->GetVOrient() ) { SwFormatVertOrient* pVert = pDesc->GetVOrient( true ); - SwTwips nVertPos = convertMm100ToTwip(aMM100Pos.Y); + SwTwips nVertPos = o3tl::toTwips(aMM100Pos.Y, o3tl::Length::mm100); pVert->SetPos( nVertPos ); } { @@ -689,7 +689,7 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape) else if ((aAnchor.GetAnchorId() != RndStdIds::FLY_AT_PAGE) && m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout()) { SwCursorMoveState aState( CursorMoveState::SetOnlyText ); - Point aTmp(convertMm100ToTwip(aMM100Pos.X), convertMm100ToTwip(aMM100Pos.Y)); + Point aTmp(o3tl::toTwips(aMM100Pos.X, o3tl::Length::mm100), o3tl::toTwips(aMM100Pos.Y, o3tl::Length::mm100)); m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout()->GetModelPositionForViewPoint( pPam->GetPoint(), aTmp, &aState ); aAnchor.SetAnchor( pPam->GetPoint() ); diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index b71d108b9cf6..58aba6aef78c 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -2728,7 +2728,7 @@ SwXDocumentIndex::TokenAccess_Impl::replaceByIndex( { throw lang::IllegalArgumentException(); } - nPosition = convertMm100ToTwip(nPosition); + nPosition = o3tl::toTwips(nPosition, o3tl::Length::mm100); if(nPosition < 0) { throw lang::IllegalArgumentException(); diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index 50aa72b76894..76b7839415b0 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -841,10 +841,10 @@ void SwXLineNumberingProperties::setPropertyValue( { sal_Int32 nVal = 0; aValue >>= nVal; - sal_Int32 nTmp = convertMm100ToTwip(nVal); + sal_Int32 nTmp = o3tl::toTwips(nVal, o3tl::Length::mm100); if (nTmp > SAL_MAX_UINT16) nTmp = SAL_MAX_UINT16; - aFontMetric.SetPosFromLeft( static_cast< sal_uInt16 >(nTmp) ); + aFontMetric.SetPosFromLeft(nTmp); } break; case WID_INTERVAL : @@ -1624,14 +1624,14 @@ void SwXNumberingRules::SetPropertiesToNumFormat( sal_Int32 nValue = 0; rProp.Value >>= nValue; // #i23727# nValue can be negative - aFormat.SetAbsLSpace(convertMm100ToTwip(nValue)); + aFormat.SetAbsLSpace(o3tl::toTwips(nValue, o3tl::Length::mm100)); } else if (rProp.Name == UNO_NAME_SYMBOL_TEXT_DISTANCE) { sal_Int32 nValue = 0; rProp.Value >>= nValue; if (nValue >= 0) - aFormat.SetCharTextDistance(static_cast<short>(convertMm100ToTwip(nValue))); + aFormat.SetCharTextDistance(o3tl::toTwips(nValue, o3tl::Length::mm100)); else bWrongArg = true; } @@ -1640,7 +1640,7 @@ void SwXNumberingRules::SetPropertiesToNumFormat( sal_Int32 nValue = 0; rProp.Value >>= nValue; // #i23727# nValue can be positive - nValue = convertMm100ToTwip(nValue); + nValue = o3tl::toTwips(nValue, o3tl::Length::mm100); aFormat.SetFirstLineOffset(nValue); } else if (rProp.Name == UNO_NAME_POSITION_AND_SPACE_MODE) @@ -1689,7 +1689,7 @@ void SwXNumberingRules::SetPropertiesToNumFormat( { sal_Int32 nValue = 0; rProp.Value >>= nValue; - nValue = convertMm100ToTwip(nValue); + nValue = o3tl::toTwips(nValue, o3tl::Length::mm100); if ( nValue >= 0 ) { aFormat.SetListtabPos( nValue ); @@ -1703,14 +1703,14 @@ void SwXNumberingRules::SetPropertiesToNumFormat( { sal_Int32 nValue = 0; rProp.Value >>= nValue; - nValue = convertMm100ToTwip(nValue); + nValue = o3tl::toTwips(nValue, o3tl::Length::mm100); aFormat.SetFirstLineIndent( nValue ); } else if (rProp.Name == UNO_NAME_INDENT_AT) { sal_Int32 nValue = 0; rProp.Value >>= nValue; - nValue = convertMm100ToTwip(nValue); + nValue = o3tl::toTwips(nValue, o3tl::Length::mm100); aFormat.SetIndentAt( nValue ); } else if (rProp.Name == UNO_NAME_NUMBERING_TYPE) @@ -1843,10 +1843,8 @@ void SwXNumberingRules::SetPropertiesToNumFormat( awt::Size size; if (rProp.Value >>= size) { - size.Width = convertMm100ToTwip(size.Width); - size.Height = convertMm100ToTwip(size.Height); - pSetSize->setWidth( size.Width ); - pSetSize->setHeight( size.Height ); + pSetSize->setWidth(o3tl::toTwips(size.Width, o3tl::Length::mm100)); + pSetSize->setHeight(o3tl::toTwips(size.Height, o3tl::Length::mm100)); } else bWrongArg = true; diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 9c9b6d52c675..6bb794009ff5 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -174,9 +174,9 @@ static bool lcl_LineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSv rSvxLine.SetColor(Color(ColorTransparency, rLine.Color)); rSvxLine.GuessLinesWidths( SvxBorderLineStyle::NONE, - convertMm100ToTwip( rLine.OuterLineWidth ), - convertMm100ToTwip( rLine.InnerLineWidth ), - convertMm100ToTwip( rLine.LineDistance ) ); + o3tl::toTwips(rLine.OuterLineWidth, o3tl::Length::mm100), + o3tl::toTwips(rLine.InnerLineWidth, o3tl::Length::mm100), + o3tl::toTwips(rLine.LineDistance, o3tl::Length::mm100) ); return rLine.InnerLineWidth > 0 || rLine.OuterLineWidth > 0; } @@ -219,7 +219,7 @@ static void lcl_SetSpecialProperty(SwFrameFormat* pFormat, sal_Int32 nWidth = 0; aValue >>= nWidth; aSz.SetWidthPercent(0); - aSz.SetWidth ( convertMm100ToTwip ( nWidth ) ); + aSz.SetWidth ( o3tl::toTwips(nWidth, o3tl::Length::mm100) ); } else if(FN_TABLE_RELATIVE_WIDTH == pEntry->nWID) { @@ -1313,7 +1313,7 @@ void SwXTextTableRow::setPropertyValue(const OUString& rPropertyName, const uno: sal_Int32 nHeight = 0; aValue >>= nHeight; Size aSz(aFrameSize.GetSize()); - aSz.setHeight( convertMm100ToTwip(nHeight) ); + aSz.setHeight( o3tl::toTwips(nHeight, o3tl::Length::mm100) ); aFrameSize.SetSize(aSz); } pDoc->SetAttr(aFrameSize, *pLn->ClaimFrameFormat()); @@ -2633,7 +2633,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, const uno::An aBoxInfo.SetLine(aVertLine.isEmpty() ? nullptr : &aVertLine, SvxBoxInfoItemLine::VERT); aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::VERT, aBorder.IsVerticalLineValid); - aBox.SetAllDistances(o3tl::narrowing<sal_uInt16>(convertMm100ToTwip(aBorder.Distance))); + aBox.SetAllDistances(o3tl::toTwips(aBorder.Distance, o3tl::Length::mm100)); aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::DISTANCE, aBorder.IsDistanceValid); aSet.Put(aBox); @@ -2653,10 +2653,10 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, const uno::An !aTableBorderDistances.IsBottomDistanceValid )) break; - const sal_uInt16 nLeftDistance = convertMm100ToTwip(aTableBorderDistances.LeftDistance); - const sal_uInt16 nRightDistance = convertMm100ToTwip(aTableBorderDistances.RightDistance); - const sal_uInt16 nTopDistance = convertMm100ToTwip(aTableBorderDistances.TopDistance); - const sal_uInt16 nBottomDistance = convertMm100ToTwip(aTableBorderDistances.BottomDistance); + const sal_uInt16 nLeftDistance = o3tl::toTwips(aTableBorderDistances.LeftDistance, o3tl::Length::mm100); + const sal_uInt16 nRightDistance = o3tl::toTwips(aTableBorderDistances.RightDistance, o3tl::Length::mm100); + const sal_uInt16 nTopDistance = o3tl::toTwips(aTableBorderDistances.TopDistance, o3tl::Length::mm100); + const sal_uInt16 nBottomDistance = o3tl::toTwips(aTableBorderDistances.BottomDistance, o3tl::Length::mm100); SwDoc* pDoc = pFormat->GetDoc(); SwTable* pTable = SwTable::FindTable( pFormat ); SwTableLines &rLines = pTable->GetTabLines(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 9bed3f18b726..5dd987b252a9 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3411,7 +3411,7 @@ static void impl_borderLine( FSHelperPtr const & pSerializer, sal_Int32 elementT if( rStyleProps != nullptr && pBorderLine && !pBorderLine->isEmpty() && pBorderLine->GetBorderLineStyle() == static_cast<SvxBorderLineStyle>(rStyleProps->LineStyle) && pBorderLine->GetColor() == Color(ColorTransparency, rStyleProps->Color) && - pBorderLine->GetWidth() == convertMm100ToTwip( rStyleProps->LineWidth ) ) + pBorderLine->GetWidth() == o3tl::toTwips(rStyleProps->LineWidth, o3tl::Length::mm100) ) return; rtl::Reference<FastAttributeList> pAttr = FastSerializerHelper::createAttrList(); @@ -5148,7 +5148,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size if (xShapePropSet) { if (css::awt::Size val; xShapePropSet->getPropertyValue("Size") >>= val) - aSize = Size(convertMm100ToTwip(val.Width), convertMm100ToTwip(val.Height)); + aSize = Size(o3tl::toTwips(val.Width, o3tl::Length::mm100), o3tl::toTwips(val.Height, o3tl::Length::mm100)); } m_rExport.SdrExporter().startDMLAnchorInline(pFrameFormat, aSize); @@ -9692,7 +9692,7 @@ void DocxAttributeOutput::ParaGrabBag(const SfxGrabBagItem& rItem) m_bParaBeforeAutoSpacing = true; // get fixed value which was set during import rGrabBagElement.second >>= m_nParaBeforeSpacing; - m_nParaBeforeSpacing = convertMm100ToTwip(m_nParaBeforeSpacing); + m_nParaBeforeSpacing = o3tl::toTwips(m_nParaBeforeSpacing, o3tl::Length::mm100); SAL_INFO("sw.ww8", "DocxAttributeOutput::ParaGrabBag: property =" << rGrabBagElement.first << " : m_nParaBeforeSpacing= " << m_nParaBeforeSpacing); } else if (rGrabBagElement.first == "ParaBottomMarginAfterAutoSpacing") @@ -9700,7 +9700,7 @@ void DocxAttributeOutput::ParaGrabBag(const SfxGrabBagItem& rItem) m_bParaAfterAutoSpacing = true; // get fixed value which was set during import rGrabBagElement.second >>= m_nParaAfterSpacing; - m_nParaAfterSpacing = convertMm100ToTwip(m_nParaAfterSpacing); + m_nParaAfterSpacing = o3tl::toTwips(m_nParaAfterSpacing, o3tl::Length::mm100); SAL_INFO("sw.ww8", "DocxAttributeOutput::ParaGrabBag: property =" << rGrabBagElement.first << " : m_nParaBeforeSpacing= " << m_nParaAfterSpacing); } else if (rGrabBagElement.first == "CharThemeFill") diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 5b93db40de6d..f79422a9a2b7 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -3711,13 +3711,13 @@ void RtfAttributeOutput::ParaGrabBag(const SfxGrabBagItem& rItem) { m_bParaBeforeAutoSpacing = true; rValue.second >>= m_nParaBeforeSpacing; - m_nParaBeforeSpacing = convertMm100ToTwip(m_nParaBeforeSpacing); + m_nParaBeforeSpacing = o3tl::toTwips(m_nParaBeforeSpacing, o3tl::Length::mm100); } else if (rValue.first == "ParaBottomMarginAfterAutoSpacing") { m_bParaAfterAutoSpacing = true; rValue.second >>= m_nParaAfterSpacing; - m_nParaAfterSpacing = convertMm100ToTwip(m_nParaAfterSpacing); + m_nParaAfterSpacing = o3tl::toTwips(m_nParaAfterSpacing, o3tl::Length::mm100); } } } diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx index 189e26bb57e1..c3d390f93d5e 100644 --- a/sw/source/filter/xml/xmltexti.cxx +++ b/sw/source/filter/xml/xmltexti.cxx @@ -105,10 +105,10 @@ static void lcl_putHeightAndWidth ( SfxItemSet &rItemSet, { if( nWidth > 0 && nHeight > 0 ) { - nWidth = convertMm100ToTwip( nWidth ); + nWidth = o3tl::toTwips(nWidth, o3tl::Length::mm100); if( nWidth < MINFLY ) nWidth = MINFLY; - nHeight = convertMm100ToTwip( nHeight ); + nHeight = o3tl::toTwips(nHeight, o3tl::Length::mm100); if( nHeight < MINFLY ) nHeight = MINFLY; rItemSet.Put( SwFormatFrameSize( SwFrameSize::Fixed, nWidth, nHeight ) ); diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx index 55494b43ef9a..a738084516a6 100644 --- a/sw/source/uibase/app/appopt.cxx +++ b/sw/source/uibase/app/appopt.cxx @@ -178,7 +178,7 @@ std::optional<SfxItemSet> SwModule::CreateItemSet( sal_uInt16 nId ) aRet.Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP, o3tl::narrowing<sal_uInt16>(::GetTabDist(rDefTabs)))); } else - aRet.Put(SfxUInt16Item( SID_ATTR_DEFTABSTOP, o3tl::narrowing<sal_uInt16>(convertMm100ToTwip(pPref->GetDefTabInMm100())))); + aRet.Put(SfxUInt16Item( SID_ATTR_DEFTABSTOP, o3tl::toTwips(pPref->GetDefTabInMm100(), o3tl::Length::mm100))); } // Options for GridTabPage diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx index 5869749a04b5..0b47fc6d26cc 100644 --- a/sw/source/uibase/app/docshini.cxx +++ b/sw/source/uibase/app/docshini.cxx @@ -658,7 +658,7 @@ void SwDocShell::SubInitNew() aDfltSet.Put( aHyp ); - sal_uInt16 nNewPos = static_cast< sal_uInt16 >(convertMm100ToTwip(SW_MOD()->GetUsrPref(false)->GetDefTabInMm100())); + sal_uInt16 nNewPos = o3tl::toTwips(SW_MOD()->GetUsrPref(false)->GetDefTabInMm100(), o3tl::Length::mm100); if( nNewPos ) aDfltSet.Put( SvxTabStopItem( 1, nNewPos, SvxTabAdjust::Default, RES_PARATR_TABSTOP ) ); diff --git a/sw/source/uibase/config/fontcfg.cxx b/sw/source/uibase/config/fontcfg.cxx index 3792fdb16012..d1f5059a3566 100644 --- a/sw/source/uibase/config/fontcfg.cxx +++ b/sw/source/uibase/config/fontcfg.cxx @@ -113,7 +113,7 @@ SwStdFontConfig::SwStdFontConfig() : else { pValues[nProp] >>= nDefaultFontHeight[nProp - DEF_FONT_COUNT]; - nDefaultFontHeight[nProp - DEF_FONT_COUNT] = convertMm100ToTwip(nDefaultFontHeight[nProp - DEF_FONT_COUNT]); + nDefaultFontHeight[nProp - DEF_FONT_COUNT] = o3tl::toTwips(nDefaultFontHeight[nProp - DEF_FONT_COUNT], o3tl::Length::mm100); } } } diff --git a/sw/source/uibase/config/modcfg.cxx b/sw/source/uibase/config/modcfg.cxx index 4733727e7043..425534945e67 100644 --- a/sw/source/uibase/config/modcfg.cxx +++ b/sw/source/uibase/config/modcfg.cxx @@ -1139,10 +1139,10 @@ void SwTableConfig::Load() sal_Int32 nTemp = 0; switch (nProp) { - case 0 : pValues[nProp] >>= nTemp; m_nTableHMove = o3tl::narrowing<sal_uInt16>(convertMm100ToTwip(nTemp)); break; //"Shift/Row", - case 1 : pValues[nProp] >>= nTemp; m_nTableVMove = o3tl::narrowing<sal_uInt16>(convertMm100ToTwip(nTemp)); break; //"Shift/Column", - case 2 : pValues[nProp] >>= nTemp; m_nTableHInsert = o3tl::narrowing<sal_uInt16>(convertMm100ToTwip(nTemp)); break; //"Insert/Row", - case 3 : pValues[nProp] >>= nTemp; m_nTableVInsert = o3tl::narrowing<sal_uInt16>(convertMm100ToTwip(nTemp)); break; //"Insert/Column", + case 0 : pValues[nProp] >>= nTemp; m_nTableHMove = o3tl::toTwips(nTemp, o3tl::Length::mm100); break; //"Shift/Row", + case 1 : pValues[nProp] >>= nTemp; m_nTableVMove = o3tl::toTwips(nTemp, o3tl::Length::mm100); break; //"Shift/Column", + case 2 : pValues[nProp] >>= nTemp; m_nTableHInsert = o3tl::toTwips(nTemp, o3tl::Length::mm100); break; //"Insert/Row", + case 3 : pValues[nProp] >>= nTemp; m_nTableVInsert = o3tl::toTwips(nTemp, o3tl::Length::mm100); break; //"Insert/Column", case 4 : pValues[nProp] >>= nTemp; m_eTableChgMode = static_cast<TableChgMode>(nTemp); break; //"Change/Effect", case 5 : m_bInsTableFormatNum = *o3tl::doAccess<bool>(pValues[nProp]); break; //"Input/NumberRecognition", case 6 : m_bInsTableChangeNumFormat = *o3tl::doAccess<bool>(pValues[nProp]); break; //"Input/NumberFormatRecognition", diff --git a/sw/source/uibase/config/usrpref.cxx b/sw/source/uibase/config/usrpref.cxx index 7f85d5a78940..0c759a78cf94 100644 --- a/sw/source/uibase/config/usrpref.cxx +++ b/sw/source/uibase/config/usrpref.cxx @@ -475,8 +475,8 @@ void SwGridConfig::Load() case 0: m_rParent.SetSnap(bSet); break;// "Option/SnapToGrid", case 1: m_rParent.SetGridVisible(bSet); break;//"Option/VisibleGrid", case 2: m_rParent.SetSynchronize(bSet); break;// "Option/Synchronize", - case 3: aSnap.setWidth( convertMm100ToTwip(nSet) ); break;// "Resolution/XAxis", - case 4: aSnap.setHeight( convertMm100ToTwip(nSet) ); break;// "Resolution/YAxis", + case 3: aSnap.setWidth( o3tl::toTwips(nSet, o3tl::Length::mm100) ); break;// "Resolution/XAxis", + case 4: aSnap.setHeight( o3tl::toTwips(nSet, o3tl::Length::mm100) ); break;// "Resolution/YAxis", case 5: m_rParent.SetDivisionX(static_cast<short>(nSet)); break;// "Subdivision/XAxis", case 6: m_rParent.SetDivisionY(static_cast<short>(nSet)); break;// "Subdivision/YAxis" } diff --git a/sw/source/uibase/envelp/envimg.cxx b/sw/source/uibase/envelp/envimg.cxx index e1db006171dc..b676b028f018 100644 --- a/sw/source/uibase/envelp/envimg.cxx +++ b/sw/source/uibase/envelp/envimg.cxx @@ -174,27 +174,27 @@ SwEnvCfgItem::SwEnvCfgItem() : case 2: m_aEnvItem.m_bSend = *o3tl::doAccess<bool>(pValues[nProp]); break;// "Inscription/UseSender", case 3: pValues[nProp] >>= m_aEnvItem.m_nAddrFromLeft;// "Format/AddresseeFromLeft", - m_aEnvItem.m_nAddrFromLeft = convertMm100ToTwip(m_aEnvItem.m_nAddrFromLeft); + m_aEnvItem.m_nAddrFromLeft = o3tl::toTwips(m_aEnvItem.m_nAddrFromLeft, o3tl::Length::mm100); break; case 4: pValues[nProp] >>= m_aEnvItem.m_nAddrFromTop; // "Format/AddresseeFromTop", - m_aEnvItem.m_nAddrFromTop = convertMm100ToTwip(m_aEnvItem.m_nAddrFromTop); + m_aEnvItem.m_nAddrFromTop = o3tl::toTwips(m_aEnvItem.m_nAddrFromTop, o3tl::Length::mm100); break; case 5: pValues[nProp] >>= m_aEnvItem.m_nSendFromLeft; // "Format/SenderFromLeft", - m_aEnvItem.m_nSendFromLeft = convertMm100ToTwip(m_aEnvItem.m_nSendFromLeft); + m_aEnvItem.m_nSendFromLeft = o3tl::toTwips(m_aEnvItem.m_nSendFromLeft, o3tl::Length::mm100); break; case 6: pValues[nProp] >>= m_aEnvItem.m_nSendFromTop;// "Format/SenderFromTop", - m_aEnvItem.m_nSendFromTop = convertMm100ToTwip(m_aEnvItem.m_nSendFromTop); + m_aEnvItem.m_nSendFromTop = o3tl::toTwips(m_aEnvItem.m_nSendFromTop, o3tl::Length::mm100); break; case 7: pValues[nProp] >>= m_aEnvItem.m_nWidth; // "Format/Width", - m_aEnvItem.m_nWidth = convertMm100ToTwip(m_aEnvItem.m_nWidth); + m_aEnvItem.m_nWidth = o3tl::toTwips(m_aEnvItem.m_nWidth, o3tl::Length::mm100); break; case 8: pValues[nProp] >>= m_aEnvItem.m_nHeight; // "Format/Height", - m_aEnvItem.m_nHeight = convertMm100ToTwip(m_aEnvItem.m_nHeight); + m_aEnvItem.m_nHeight = o3tl::toTwips(m_aEnvItem.m_nHeight, o3tl::Length::mm100); break; case 9: { @@ -204,11 +204,11 @@ SwEnvCfgItem::SwEnvCfgItem() : case 10: m_aEnvItem.m_bPrintFromAbove = *o3tl::doAccess<bool>(pValues[nProp]); break;// "Print/FromAbove", case 11: pValues[nProp] >>= m_aEnvItem.m_nShiftRight; - m_aEnvItem.m_nShiftRight = convertMm100ToTwip(m_aEnvItem.m_nShiftRight);// "Print/Right", + m_aEnvItem.m_nShiftRight = o3tl::toTwips(m_aEnvItem.m_nShiftRight, o3tl::Length::mm100);// "Print/Right", break; case 12: pValues[nProp] >>= m_aEnvItem.m_nShiftDown; - m_aEnvItem.m_nShiftDown = convertMm100ToTwip(m_aEnvItem.m_nShiftDown); + m_aEnvItem.m_nShiftDown = o3tl::toTwips(m_aEnvItem.m_nShiftDown, o3tl::Length::mm100); break;// "Print/Down" } } diff --git a/sw/source/uibase/envelp/labelcfg.cxx b/sw/source/uibase/envelp/labelcfg.cxx index e0fbe142f688..413768e030f3 100644 --- a/sw/source/uibase/envelp/labelcfg.cxx +++ b/sw/source/uibase/envelp/labelcfg.cxx @@ -180,16 +180,16 @@ static std::unique_ptr<SwLabRec> lcl_CreateSwLabRec(const OUString& rType, const switch(nTok++) { case 0 : pNewRec->m_bCont = sToken[0] == 'C'; break; - case 1 : pNewRec->m_nHDist = convertMm100ToTwip(nVal); break; - case 2 : pNewRec->m_nVDist = convertMm100ToTwip(nVal); break; - case 3 : pNewRec->m_nWidth = convertMm100ToTwip(nVal); break; - case 4 : pNewRec->m_nHeight = convertMm100ToTwip(nVal); break; - case 5 : pNewRec->m_nLeft = convertMm100ToTwip(nVal); break; - case 6 : pNewRec->m_nUpper = convertMm100ToTwip(nVal); break; + case 1 : pNewRec->m_nHDist = o3tl::toTwips(nVal, o3tl::Length::mm100); break; + case 2 : pNewRec->m_nVDist = o3tl::toTwips(nVal, o3tl::Length::mm100); break; + case 3 : pNewRec->m_nWidth = o3tl::toTwips(nVal, o3tl::Length::mm100); break; + case 4 : pNewRec->m_nHeight = o3tl::toTwips(nVal, o3tl::Length::mm100); break; + case 5 : pNewRec->m_nLeft = o3tl::toTwips(nVal, o3tl::Length::mm100); break; + case 6 : pNewRec->m_nUpper = o3tl::toTwips(nVal, o3tl::Length::mm100); break; case 7 : pNewRec->m_nCols = nVal; break; case 8 : pNewRec->m_nRows = nVal; break; - case 9 : pNewRec->m_nPWidth = convertMm100ToTwip(nVal); break; - case 10 : pNewRec->m_nPHeight = convertMm100ToTwip(nVal); break; + case 9 : pNewRec->m_nPWidth = o3tl::toTwips(nVal, o3tl::Length::mm100); break; + case 10 : pNewRec->m_nPHeight = o3tl::toTwips(nVal, o3tl::Length::mm100); break; } } // lines added for compatibility with custom label definitions saved before patch fdo#44516 diff --git a/sw/source/uibase/envelp/labimg.cxx b/sw/source/uibase/envelp/labimg.cxx index 5e7051cbc8b7..a3cfc5cc52b6 100644 --- a/sw/source/uibase/envelp/labimg.cxx +++ b/sw/source/uibase/envelp/labimg.cxx @@ -287,35 +287,35 @@ SwLabCfgItem::SwLabCfgItem(bool bLabel) : case 4: pValues[nProp] >>= aItem.m_nRows; break;// "Format/Row", case 5: pValues[nProp] >>= aItem.m_lHDist; - aItem.m_lHDist = convertMm100ToTwip(aItem.m_lHDist); + aItem.m_lHDist = o3tl::toTwips(aItem.m_lHDist, o3tl::Length::mm100); break;// "Format/HorizontalDistance", case 6: pValues[nProp] >>= aItem.m_lVDist; - aItem.m_lVDist = convertMm100ToTwip(aItem.m_lVDist); + aItem.m_lVDist = o3tl::toTwips(aItem.m_lVDist, o3tl::Length::mm100); break;// "Format/VerticalDistance", case 7: pValues[nProp] >>= aItem.m_lWidth; - aItem.m_lWidth = convertMm100ToTwip(aItem.m_lWidth); + aItem.m_lWidth = o3tl::toTwips(aItem.m_lWidth, o3tl::Length::mm100); break;// "Format/Width", case 8: pValues[nProp] >>= aItem.m_lHeight; - aItem.m_lHeight = convertMm100ToTwip(aItem.m_lHeight); + aItem.m_lHeight = o3tl::toTwips(aItem.m_lHeight, o3tl::Length::mm100); break;// "Format/Height", case 9: pValues[nProp] >>= aItem.m_lLeft; - aItem.m_lLeft = convertMm100ToTwip(aItem.m_lLeft); + aItem.m_lLeft = o3tl::toTwips(aItem.m_lLeft, o3tl::Length::mm100); break;// "Format/LeftMargin", case 10: pValues[nProp] >>= aItem.m_lUpper; - aItem.m_lUpper = convertMm100ToTwip(aItem.m_lUpper); + aItem.m_lUpper = o3tl::toTwips(aItem.m_lUpper, o3tl::Length::mm100); break;// "Format/TopMargin", case 11: pValues[nProp] >>= aItem.m_lPWidth; - aItem.m_lPWidth = convertMm100ToTwip(aItem.m_lPWidth); + aItem.m_lPWidth = o3tl::toTwips(aItem.m_lPWidth, o3tl::Length::mm100); break;// "Format/PageWidth", case 12: pValues[nProp] >>= aItem.m_lPHeight; - aItem.m_lPHeight = convertMm100ToTwip(aItem.m_lPHeight); + aItem.m_lPHeight = o3tl::toTwips(aItem.m_lPHeight, o3tl::Length::mm100); break;// "Format/PageHeight", case 13: aItem.m_bSynchron = *o3tl::doAccess<bool>(pValues[nProp]); break;// "Option/Synchronize", case 14: aItem.m_bPage = *o3tl::doAccess<bool>(pValues[nProp]); break;// "Option/Page", diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx index a93432251a47..a217b5d56ecb 100644 --- a/sw/source/uibase/shells/grfsh.cxx +++ b/sw/source/uibase/shells/grfsh.cxx @@ -211,10 +211,10 @@ void SwGrfShell::Execute(SfxRequest &rReq) rSh.StartUndo(SwUndoId::START); tools::Rectangle aScaledCropedRectangle = aDialog.GetScaledCropRectangle(); - aCrop.SetLeft( convertMm100ToTwip( aScaledCropedRectangle.Left() )); - aCrop.SetTop( convertMm100ToTwip( aScaledCropedRectangle.Top() )); - aCrop.SetRight( convertMm100ToTwip( aScaledCropedRectangle.Right() )); - aCrop.SetBottom( convertMm100ToTwip( aScaledCropedRectangle.Bottom() )); + aCrop.SetLeft( o3tl::toTwips( aScaledCropedRectangle.Left(), o3tl::Length::mm100 )); + aCrop.SetTop( o3tl::toTwips( aScaledCropedRectangle.Top(), o3tl::Length::mm100 )); + aCrop.SetRight( o3tl::toTwips( aScaledCropedRectangle.Right(), o3tl::Length::mm100 )); + aCrop.SetBottom( o3tl::toTwips( aScaledCropedRectangle.Bottom(), o3tl::Length::mm100 )); Graphic aCompressedGraphic( aDialog.GetCompressedGraphic() ); rSh.ReRead(OUString(), OUString(), const_cast<const Graphic*>(&aCompressedGraphic)); diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 7880e4fcacd8..7ac084f44aa4 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -1324,35 +1324,35 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue > if ( rValue.Name == "ViewLeft" ) { rValue.Value >>= nX; - nX = convertMm100ToTwip( nX ); + nX = o3tl::toTwips(nX, o3tl::Length::mm100); } else if ( rValue.Name == "ViewTop" ) { rValue.Value >>= nY; - nY = convertMm100ToTwip( nY ); + nY = o3tl::toTwips(nY, o3tl::Length::mm100); } else if ( rValue.Name == "VisibleLeft" ) { rValue.Value >>= nLeft; - nLeft = convertMm100ToTwip( nLeft ); + nLeft = o3tl::toTwips(nLeft, o3tl::Length::mm100); bGotVisibleLeft = true; } else if ( rValue.Name == "VisibleTop" ) { rValue.Value >>= nTop; - nTop = convertMm100ToTwip( nTop ); + nTop = o3tl::toTwips(nTop, o3tl::Length::mm100); bGotVisibleTop = true; } else if ( rValue.Name == "VisibleRight" ) { rValue.Value >>= nRight; - nRight = convertMm100ToTwip( nRight ); + nRight = o3tl::toTwips(nRight, o3tl::Length::mm100); bGotVisibleRight = true; } else if ( rValue.Name == "VisibleBottom" ) { rValue.Value >>= nBottom; - nBottom = convertMm100ToTwip( nBottom ); + nBottom = o3tl::toTwips(nBottom, o3tl::Length::mm100); bGotVisibleBottom = true; } else if ( rValue.Name == "ZoomType" ) diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx index fa1c432d7591..44fe733886bd 100644 --- a/sw/source/uibase/uno/unomod.cxx +++ b/sw/source/uibase/uno/unomod.cxx @@ -610,7 +610,7 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c if(!(rValue >>= nTmp) || nTmp < 10) throw IllegalArgumentException(); Size aSize( mpViewOption->GetSnapSize() ); - aSize.setWidth( convertMm100ToTwip( nTmp ) ); + aSize.setWidth( o3tl::toTwips(nTmp, o3tl::Length::mm100) ); mpViewOption->SetSnapSize( aSize ); } break; @@ -620,7 +620,7 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c if(!(rValue >>= nTmp) || nTmp < 10) throw IllegalArgumentException(); Size aSize( mpViewOption->GetSnapSize() ); - aSize.setHeight( convertMm100ToTwip( nTmp ) ); + aSize.setHeight( o3tl::toTwips(nTmp, o3tl::Length::mm100) ); mpViewOption->SetSnapSize( aSize ); } break; diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 51dfac84254c..2037d316a0f2 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -1071,27 +1071,27 @@ void SwXTextDocument::setPagePrintSettings(const Sequence< beans::PropertyValue } else if(sName == "LeftMargin") { - aData.SetLeftSpace(convertMm100ToTwip(nVal)); + aData.SetLeftSpace(o3tl::toTwips(nVal, o3tl::Length::mm100)); } else if(sName == "RightMargin") { - aData.SetRightSpace(convertMm100ToTwip(nVal)); + aData.SetRightSpace(o3tl::toTwips(nVal, o3tl::Length::mm100)); } else if(sName == "TopMargin") { - aData.SetTopSpace(convertMm100ToTwip(nVal)); + aData.SetTopSpace(o3tl::toTwips(nVal, o3tl::Length::mm100)); } else if(sName == "BottomMargin") { - aData.SetBottomSpace(convertMm100ToTwip(nVal)); + aData.SetBottomSpace(o3tl::toTwips(nVal, o3tl::Length::mm100)); } else if(sName == "HoriMargin") { - aData.SetHorzSpace(convertMm100ToTwip(nVal)); + aData.SetHorzSpace(o3tl::toTwips(nVal, o3tl::Length::mm100)); } else if(sName == "VertMargin") { - aData.SetVertSpace(convertMm100ToTwip(nVal)); + aData.SetVertSpace(o3tl::toTwips(nVal, o3tl::Length::mm100)); } else if(sName == "IsLandscape") { diff --git a/sw/source/uibase/utlui/uiitems.cxx b/sw/source/uibase/utlui/uiitems.cxx index de816541cb07..7088018ccb63 100644 --- a/sw/source/uibase/utlui/uiitems.cxx +++ b/sw/source/uibase/utlui/uiitems.cxx @@ -129,7 +129,7 @@ bool SwPageFootnoteInfoItem::PutValue(const Any& rVal, sal_uInt8 nMemberId) bRet = false; else { - nSet32 = convertMm100ToTwip(nSet32); + nSet32 = o3tl::toTwips(nSet32, o3tl::Length::mm100); switch(nMemberId & ~CONVERT_TWIPS) { case MID_FTN_HEIGHT: aFootnoteInfo.SetHeight(nSet32); break; @@ -143,7 +143,7 @@ bool SwPageFootnoteInfoItem::PutValue(const Any& rVal, sal_uInt8 nMemberId) sal_Int16 nSet = 0; rVal >>= nSet; if(nSet >= 0) - aFootnoteInfo.SetLineWidth(convertMm100ToTwip(nSet)); + aFootnoteInfo.SetLineWidth(o3tl::toTwips(nSet, o3tl::Length::mm100)); else bRet = false; } |