sd/source/core/sdpage.cxx | 8 ++++---- sd/source/ui/view/outlview.cxx | 32 ++++++++++++++++---------------- sd/source/ui/view/sdview3.cxx | 2 +- sd/source/ui/view/sdwindow.cxx | 26 +++++++++++++------------- 4 files changed, 34 insertions(+), 34 deletions(-)
New commits: commit 351df84114abe96b30719c2a7676df8ce35377ed Author: Swarnadeep Paul <[email protected]> AuthorDate: Sat Feb 28 12:01:18 2026 +0530 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Mar 3 10:41:19 2026 +0100 tdf#114441 sd: Use tools::Long for UI geometry - Replaced platform-dependent sal_uLong with tools::Long for UI coordinates, scaling, and zoom factors. - Used sal_uInt32 for height and weigth - Used 16bit Integer for example in outlview.cxx - Use size_t for counting and iterating Change-Id: I1eab0a88b61a93715fec116e699a826e9e38dc74 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200665 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 11f2298cc454..4f993d992c8f 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -2039,7 +2039,7 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const ::tools::Rectangle& rN SfxItemSet& rSet = pTitleSheet->GetItemSet(); const SvxFontHeightItem& rOldHgt = rSet.Get(EE_CHAR_FONTHEIGHT); - sal_uLong nFontHeight = rOldHgt.GetHeight(); + sal_uInt32 nFontHeight = rOldHgt.GetHeight(); nFontHeight = ::tools::Long(nFontHeight * static_cast<double>(aFractY)); rSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT)); @@ -2077,7 +2077,7 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const ::tools::Rectangle& rN SfxItemSet aTempSet(pOutlineSheet->GetItemSet()); const SvxFontHeightItem& rOldHgt = aTempSet.Get(EE_CHAR_FONTHEIGHT); - sal_uLong nFontHeight = rOldHgt.GetHeight(); + sal_uInt32 nFontHeight = rOldHgt.GetHeight(); nFontHeight = ::tools::Long(nFontHeight * static_cast<double>(aFractY)); aTempSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT)); @@ -2128,8 +2128,8 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const ::tools::Rectangle& rN if (pNotesSheet) { - sal_uLong nHeight = pObj->GetLogicRect().GetSize().Height(); - sal_uLong nFontHeight = static_cast<sal_uLong>(nHeight * 0.0741); + sal_uInt32 nHeight = pObj->GetLogicRect().GetSize().Height(); + sal_uInt32 nFontHeight = nHeight * 0.0741; SfxItemSet& rSet = pNotesSheet->GetItemSet(); rSet.Put( SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT )); rSet.Put( SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CJK )); diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index cb411fb7d535..1aa4214731ee 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -573,8 +573,8 @@ SdPage* OutlineView::InsertSlideForParagraph( Paragraph* pPara ) mrOutliner.SetParaFlag( pPara, ParaFlag::ISPAGE ); // how many titles are there before the new title paragraph? - sal_uLong nExample = 0; // position of the "example" page - sal_uLong nTarget = 0; // position of insertion + sal_uInt16 nExample = 0; // position of the "example" page + sal_uInt16 nTarget = 0; // position of insertion while(pPara) { pPara = GetPrevTitle(pPara); @@ -611,13 +611,13 @@ SdPage* OutlineView::InsertSlideForParagraph( Paragraph* pPara ) **********************************************************************/ // this page is exemplary - SdPage* pExample = mrDoc.GetSdPage(static_cast<sal_uInt16>(nExample), PageKind::Standard); + SdPage* pExample = mrDoc.GetSdPage(nExample, PageKind::Standard); rtl::Reference<SdPage> pPage = mrDoc.AllocSdPage(false); pPage->SetLayoutName(pExample->GetLayoutName()); // insert (page) - mrDoc.InsertPage(pPage.get(), static_cast<sal_uInt16>(nTarget) * 2 + 1); + mrDoc.InsertPage(pPage.get(), nTarget * 2 + 1); if( isRecordingUndo() ) AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoNewPage(*pPage)); @@ -648,7 +648,7 @@ SdPage* OutlineView::InsertSlideForParagraph( Paragraph* pPara ) /********************************************************************** |* now the notes page \*********************************************************************/ - pExample = mrDoc.GetSdPage(static_cast<sal_uInt16>(nExample), PageKind::Notes); + pExample = mrDoc.GetSdPage(nExample, PageKind::Notes); rtl::Reference<SdPage> pNotesPage = mrDoc.AllocSdPage(false); pNotesPage->SetLayoutName(pExample->GetLayoutName()); @@ -656,7 +656,7 @@ SdPage* OutlineView::InsertSlideForParagraph( Paragraph* pPara ) pNotesPage->SetPageKind(PageKind::Notes); // insert (notes page) - mrDoc.InsertPage(pNotesPage.get(), static_cast<sal_uInt16>(nTarget) * 2 + 2); + mrDoc.InsertPage(pNotesPage.get(), nTarget * 2 + 2); if( isRecordingUndo() ) AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoNewPage(*pNotesPage)); @@ -692,7 +692,7 @@ IMPL_LINK( OutlineView, ParagraphRemovingHdl, ::Outliner::ParagraphHdlParam, aPa return; // how many titles are in front of the title paragraph in question? - sal_uLong nPos = 0; + sal_uInt16 nPos = 0; while(pPara) { pPara = GetPrevTitle(pPara); @@ -700,13 +700,13 @@ IMPL_LINK( OutlineView, ParagraphRemovingHdl, ::Outliner::ParagraphHdlParam, aPa } // delete page and notes page - sal_uInt16 nAbsPos = static_cast<sal_uInt16>(nPos) * 2 + 1; + sal_uInt16 nAbsPos = nPos * 2 + 1; SdrPage* pPage = mrDoc.GetPage(nAbsPos); if( isRecordingUndo() ) AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage)); mrDoc.RemovePage(nAbsPos); - nAbsPos = static_cast<sal_uInt16>(nPos) * 2 + 1; + nAbsPos = nPos * 2 + 1; pPage = mrDoc.GetPage(nAbsPos); if( isRecordingUndo() ) AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage)); @@ -809,7 +809,7 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner::DepthChangeHdlParam, aParam // the paragraph was a page but now becomes a normal paragraph // how many titles are before the title paragraph in question? - sal_uLong nPos = 0; + sal_uInt16 nPos = 0; Paragraph* pParagraph = pPara; while(pParagraph) { @@ -819,13 +819,13 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner::DepthChangeHdlParam, aParam } // delete page and notes page - sal_uInt16 nAbsPos = static_cast<sal_uInt16>(nPos) * 2 + 1; + sal_uInt16 nAbsPos = nPos * 2 + 1; SdrPage* pPage = mrDoc.GetPage(nAbsPos); if( isRecordingUndo() ) AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage)); mrDoc.RemovePage(nAbsPos); - nAbsPos = static_cast<sal_uInt16>(nPos) * 2 + 1; + nAbsPos = nPos * 2 + 1; pPage = mrDoc.GetPage(nAbsPos); if( isRecordingUndo() ) AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage)); @@ -854,7 +854,7 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner::DepthChangeHdlParam, aParam else if ( (pOutliner->GetPrevDepth() == 1) && ( pOutliner->GetDepth( pOutliner->GetAbsPos( pPara ) ) == 2 ) ) { // how many titles are in front of the title paragraph in question? - sal_Int32 nPos = -1; + sal_Int16 nPos = -1; Paragraph* pParagraph = pPara; while(pParagraph) @@ -866,7 +866,7 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner::DepthChangeHdlParam, aParam if(nPos >= 0) { - SdPage*pPage = mrDoc.GetSdPage( static_cast<sal_uInt16>(nPos), PageKind::Standard); + SdPage*pPage = mrDoc.GetSdPage( nPos, PageKind::Standard); if(pPage && pPage->GetPresObj(PresObjKind::Text)) pOutliner->SetDepth( pPara, 0 ); @@ -874,7 +874,7 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner::DepthChangeHdlParam, aParam } // how many titles are in front of the title paragraph in question? - sal_Int32 nPos = -1; + sal_Int16 nPos = -1; Paragraph* pTempPara = pPara; while(pTempPara) @@ -887,7 +887,7 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner::DepthChangeHdlParam, aParam if( nPos < 0 ) return; - SdPage* pPage = mrDoc.GetSdPage( static_cast<sal_uInt16>(nPos), PageKind::Standard ); + SdPage* pPage = mrDoc.GetSdPage( nPos, PageKind::Standard ); if( !pPage ) return; diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index a0f189ba64aa..06daf64c6c9b 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -1596,7 +1596,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, { maDropFileVector.clear(); - for( sal_uLong i = 0, nCount = aDropFileList.Count(); i < nCount; i++ ) + for( size_t i = 0, nCount = aDropFileList.Count(); i < nCount; i++ ) maDropFileVector.push_back( aDropFileList.GetFile( i ) ); maDropInsertFileIdle.Start(); diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index 773778677083..8e4a8c9a5dc0 100644 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -151,13 +151,13 @@ void Window::CalcMinZoom() // area (also called application area) to completely fill the // window. Size aWinSize = PixelToLogic(GetOutputSizePixel()); - sal_uLong nX = static_cast<sal_uLong>(static_cast<double>(aWinSize.Width()) + tools::Long nX = static_cast<tools::Long>(static_cast<double>(aWinSize.Width()) * double(ZOOM_MULTIPLICATOR) / static_cast<double>(maViewSize.Width())); - sal_uLong nY = static_cast<sal_uLong>(static_cast<double>(aWinSize.Height()) + tools::Long nY = static_cast<tools::Long>(static_cast<double>(aWinSize.Height()) * double(ZOOM_MULTIPLICATOR) / static_cast<double>(maViewSize.Height())); // Decide whether to take the larger or the smaller factor. - sal_uLong nFact = std::min(nX, nY); + tools::Long nFact = std::min(nX, nY); // The factor is transformed according to the current zoom factor. nFact = nFact * nZoom / ZOOM_MULTIPLICATOR; @@ -395,25 +395,25 @@ void Window::SetZoomIntegral(::tools::Long nZoom) // rectangle being fully visible (when translated accordingly) as // large as possible in the output area independently in both // coordinate directions . - sal_uLong nX(0); - sal_uLong nY(0); + tools::Long nX(0); + tools::Long nY(0); const Size aWinSize( PixelToLogic(GetOutputSizePixel()) ); if(rZoomRect.GetHeight()) { - nX = static_cast<sal_uLong>(static_cast<double>(aWinSize.Height()) + nX = static_cast<tools::Long>(static_cast<double>(aWinSize.Height()) * double(ZOOM_MULTIPLICATOR) / static_cast<double>(rZoomRect.GetHeight())); } if(rZoomRect.GetWidth()) { - nY = static_cast<sal_uLong>(static_cast<double>(aWinSize.Width()) + nY = static_cast<tools::Long>(static_cast<double>(aWinSize.Width()) * double(ZOOM_MULTIPLICATOR) / static_cast<double>(rZoomRect.GetWidth())); } // Use the smaller one of both so that the zoom rectangle will be // fully visible with respect to both coordinate directions. - sal_uLong nFact = std::min(nX, nY); + tools::Long nFact = std::min(nX, nY); // Transform the current zoom factor so that it leads to the desired // scaling. @@ -469,24 +469,24 @@ void Window::SetZoomIntegral(::tools::Long nZoom) // rectangle being fully visible (when translated accordingly) as // large as possible in the output area independently in both // coordinate directions . - sal_uLong nX(0); - sal_uLong nY(0); + tools::Long nX(0); + tools::Long nY(0); if(rZoomRect.GetHeight()) { - nX = static_cast<sal_uLong>(static_cast<double>(aWinSize.Height()) + nX = static_cast<tools::Long>(static_cast<double>(aWinSize.Height()) * double(ZOOM_MULTIPLICATOR) / static_cast<double>(rZoomRect.GetHeight())); } if(rZoomRect.GetWidth()) { - nY = static_cast<sal_uLong>(static_cast<double>(aWinSize.Width()) + nY = static_cast<tools::Long>(static_cast<double>(aWinSize.Width()) * double(ZOOM_MULTIPLICATOR) / static_cast<double>(rZoomRect.GetWidth())); } // Use the smaller one of both so that the zoom rectangle will be // fully visible with respect to both coordinate directions. - sal_uLong nFact = std::min(nX, nY); + tools::Long nFact = std::min(nX, nY); // Transform the current zoom factor so that it leads to the desired // scaling.
