diff options
Diffstat (limited to 'sd/source/ui/view')
30 files changed, 225 insertions, 225 deletions
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index 7bf0ba2d15e2..4a4399c83ee1 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -1776,8 +1776,8 @@ private: const Size aPageSize (rHandoutPage.GetSize()); const Size aPrintSize (rInfo.mpPrinter->GetOutputSize()); - const double fHorz = (double) aPrintSize.Width() / aPageSize.Width(); - const double fVert = (double) aPrintSize.Height() / aPageSize.Height(); + const double fHorz = static_cast<double>(aPrintSize.Width()) / aPageSize.Width(); + const double fVert = static_cast<double>(aPrintSize.Height()) / aPageSize.Height(); Fraction aFract; if ( fHorz < fVert ) @@ -1904,8 +1904,8 @@ private: if (mpOptions->IsPageSize()) { - const double fHorz ((double) rInfo.maPrintSize.Width() / aPageSize.Width()); - const double fVert ((double) rInfo.maPrintSize.Height() / aPageSize.Height()); + const double fHorz (static_cast<double>(rInfo.maPrintSize.Width()) / aPageSize.Width()); + const double fVert (static_cast<double>(rInfo.maPrintSize.Height()) / aPageSize.Height()); Fraction aFract; if (fHorz < fVert) @@ -1974,18 +1974,18 @@ private: else aPrintSize_2.Height() >>= 1; - const double fPageWH = (double) aPageSize_2.Width() / aPageSize_2.Height(); - const double fPrintWH = (double) aPrintSize_2.Width() / aPrintSize_2.Height(); + const double fPageWH = static_cast<double>(aPageSize_2.Width()) / aPageSize_2.Height(); + const double fPrintWH = static_cast<double>(aPrintSize_2.Width()) / aPrintSize_2.Height(); if( fPageWH < fPrintWH ) { - aPageSize_2.Width() = (long) ( aPrintSize_2.Height() * fPageWH ); + aPageSize_2.Width() = static_cast<long>( aPrintSize_2.Height() * fPageWH ); aPageSize_2.Height()= aPrintSize_2.Height(); } else { aPageSize_2.Width() = aPrintSize_2.Width(); - aPageSize_2.Height() = (long) ( aPrintSize_2.Width() / fPageWH ); + aPageSize_2.Height() = static_cast<long>( aPrintSize_2.Width() / fPageWH ); } MapMode aMap (rInfo.maMap); @@ -2033,7 +2033,7 @@ private: sal_uInt32 nFirstIndex = 0, nLastIndex = aPageVector.size() - 1; if( aPageVector.size() & 1 ) - aPairVector.emplace_back( (sal_uInt16) 65535, aPageVector[ nFirstIndex++ ] ); + aPairVector.emplace_back( sal_uInt16(65535), aPageVector[ nFirstIndex++ ] ); else aPairVector.emplace_back( aPageVector[ nLastIndex-- ], aPageVector[ nFirstIndex++ ] ); diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 2609e6e65bce..279f0700d974 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -164,7 +164,7 @@ SdOutliner::SdOutliner( SdDrawDocument* pDoc, OutlinerMode nMode ) mpParaObj(nullptr), meStartViewMode(PageKind::Standard), meStartEditMode(EditMode::Page), - mnStartPageIndex((sal_uInt16)-1), + mnStartPageIndex(sal_uInt16(-1)), mpStartEditedObject(nullptr), maStartSelection(), mpSearchItem(nullptr), @@ -354,7 +354,7 @@ void SdOutliner::EndSpelling() mpWeakViewShell.reset(); mpView = nullptr; mpWindow = nullptr; - mnStartPageIndex = (sal_uInt16) -1; + mnStartPageIndex = sal_uInt16(-1); } bool SdOutliner::SpellNextDocument() @@ -500,7 +500,7 @@ bool SdOutliner::StartSearchAndReplace (const SvxSearchItem* pSearchItem) if (nCommand == SvxSearchCmd::FIND) bEndOfSearch = false; } - mnStartPageIndex = (sal_uInt16)-1; + mnStartPageIndex = sal_uInt16(-1); } SfxChildWindow *pChildWin = @@ -630,7 +630,7 @@ bool SdOutliner::SearchAndReplaceAll() if( !mbStringFound ) { RestoreStartPosition (); - mnStartPageIndex = (sal_uInt16)-1; + mnStartPageIndex = sal_uInt16(-1); return true; } @@ -642,7 +642,7 @@ bool SdOutliner::SearchAndReplaceAll() if (mpSearchItem->GetCommand() == SvxSearchCmd::FIND_ALL && comphelper::LibreOfficeKit::isActive() && bFoundMatch && aSelections.size() == 1) { // Without this, RememberStartPosition() will think it already has a remembered position. - mnStartPageIndex = (sal_uInt16)-1; + mnStartPageIndex = sal_uInt16(-1); RememberStartPosition(); @@ -698,7 +698,7 @@ bool SdOutliner::SearchAndReplaceAll() rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangles.getStr()); } - mnStartPageIndex = (sal_uInt16)-1; + mnStartPageIndex = sal_uInt16(-1); return bRet; } @@ -956,7 +956,7 @@ void SdOutliner::RememberStartPosition() return; } - if ( mnStartPageIndex != (sal_uInt16) -1 ) + if ( mnStartPageIndex != sal_uInt16(-1) ) return; if( nullptr != dynamic_cast< const sd::DrawViewShell *>( pViewShell.get() )) @@ -996,7 +996,7 @@ void SdOutliner::RememberStartPosition() } else { - mnStartPageIndex = (sal_uInt16)-1; + mnStartPageIndex = sal_uInt16(-1); } } @@ -1005,7 +1005,7 @@ void SdOutliner::RestoreStartPosition() bool bRestore = true; // Take a negative start page index as inidicator that restoring the // start position is not requested. - if (mnStartPageIndex == (sal_uInt16)-1 ) + if (mnStartPageIndex == sal_uInt16(-1) ) bRestore = false; // Don't restore when the view shell is not valid. std::shared_ptr<sd::ViewShell> pViewShell (mpWeakViewShell.lock()); @@ -1506,7 +1506,7 @@ SdrObject* SdOutliner::SetObject ( const sd::outliner::IteratorPosition& rPosition) { SetViewMode (rPosition.mePageKind); - SetPage (rPosition.meEditMode, (sal_uInt16)rPosition.mnPageIndex); + SetPage (rPosition.meEditMode, static_cast<sal_uInt16>(rPosition.mnPageIndex)); mnText = rPosition.mnText; return rPosition.mxObject.get(); } diff --git a/sd/source/ui/view/OutlinerIterator.cxx b/sd/source/ui/view/OutlinerIterator.cxx index d94aa84d5297..aee6712c4446 100644 --- a/sd/source/ui/view/OutlinerIterator.cxx +++ b/sd/source/ui/view/OutlinerIterator.cxx @@ -637,11 +637,11 @@ void ViewIteratorImpl::SetPage (sal_Int32 nPageIndex) { if (maPosition.meEditMode == EditMode::Page) mpPage = mpDocument->GetSdPage ( - (sal_uInt16)nPageIndex, + static_cast<sal_uInt16>(nPageIndex), maPosition.mePageKind); else mpPage = mpDocument->GetMasterSdPage ( - (sal_uInt16)nPageIndex, + static_cast<sal_uInt16>(nPageIndex), maPosition.mePageKind); } else diff --git a/sd/source/ui/view/ViewClipboard.cxx b/sd/source/ui/view/ViewClipboard.cxx index 38b1a9ebea47..daa168782a28 100644 --- a/sd/source/ui/view/ViewClipboard.cxx +++ b/sd/source/ui/view/ViewClipboard.cxx @@ -198,7 +198,7 @@ sal_uInt16 ViewClipboard::InsertSlides ( // pages are inserted. pBookmarkList = &rTransferable.GetPageBookmarks(); pDataDocSh = rTransferable.GetPageDocShell(); - nInsertPgCnt = (sal_uInt16)pBookmarkList->size(); + nInsertPgCnt = static_cast<sal_uInt16>(pBookmarkList->size()); } else { diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index ab6eca07ca5e..804dce0859b6 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -481,8 +481,8 @@ void ViewShellBase::InnerResizePixel (const Point& rOrigin, const Size &rSize, b aSize.Height() -= (aBorder.Top() + aBorder.Bottom()); Size aObjSizePixel = mpImpl->mpViewWindow->LogicToPixel(aObjSize, MapMode(MapUnit::Map100thMM)); SfxViewShell::SetZoomFactor( - Fraction( aSize.Width(), std::max( aObjSizePixel.Width(), (long int)1 ) ), - Fraction( aSize.Height(), std::max( aObjSizePixel.Height(), (long int)1) ) ); + Fraction( aSize.Width(), std::max( aObjSizePixel.Width(), static_cast<long int>(1) ) ), + Fraction( aSize.Height(), std::max( aObjSizePixel.Height(), static_cast<long int>(1)) ) ); } mpImpl->ResizePixel(rOrigin, rSize, false); diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx index f4324c8398a2..18ae719434c8 100644 --- a/sd/source/ui/view/ViewTabBar.cxx +++ b/sd/source/ui/view/ViewTabBar.cxx @@ -440,7 +440,7 @@ void ViewTabBar::AddTabBarButton ( if (nPosition>=0 && nPosition<=mpTabControl->GetPageCount()) { - sal_uInt16 nIndex ((sal_uInt16)nPosition); + sal_uInt16 nIndex (static_cast<sal_uInt16>(nPosition)); // Insert the button into our local array. maTabBarButtons.insert(maTabBarButtons.begin()+nIndex, rButton); diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index b2e821d7a58e..1eca050e50e3 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -464,7 +464,7 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) { const SfxItemSet& rItems = pOLV->GetOutliner()->GetParaAttribs( nPara ); const SvxULSpaceItem& rItem = rItems.Get( EE_PARA_ULSPACE ); - nUpper = std::max( nUpper, (long)rItem.GetUpper() ); + nUpper = std::max( nUpper, static_cast<long>(rItem.GetUpper()) ); } if( nUpper == 0 ) rSet.DisableItem( SID_PARASPACE_DECREASE ); diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index 16d465cf75f9..0504e883da90 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -164,7 +164,7 @@ void TextObjectBar::Execute( SfxRequest &rReq ) nUpper -= 100; nUpper = std::max<long>( nUpper, 0 ); } - pNewItem->SetUpper( (sal_uInt16) nUpper ); + pNewItem->SetUpper( static_cast<sal_uInt16>(nUpper) ); long nLower = pNewItem->GetLower(); if( nSlot == SID_PARASPACE_INCREASE ) @@ -174,7 +174,7 @@ void TextObjectBar::Execute( SfxRequest &rReq ) nLower -= 100; nLower = std::max<long>( nLower, 0 ); } - pNewItem->SetLower( (sal_uInt16) nLower ); + pNewItem->SetLower( static_cast<sal_uInt16>(nLower) ); SfxItemSet aNewAttrs( aAttr ); aNewAttrs.Put( *pNewItem ); @@ -205,7 +205,7 @@ void TextObjectBar::Execute( SfxRequest &rReq ) nUpper -= 100; nUpper = std::max<long>( nUpper, 0 ); } - pNewItem->SetUpper( (sal_uInt16) nUpper ); + pNewItem->SetUpper( static_cast<sal_uInt16>(nUpper) ); long nLower = pNewItem->GetLower(); if( nSlot == SID_PARASPACE_INCREASE ) @@ -215,7 +215,7 @@ void TextObjectBar::Execute( SfxRequest &rReq ) nLower -= 100; nLower = std::max<long>( nLower, 0 ); } - pNewItem->SetLower( (sal_uInt16) nLower ); + pNewItem->SetLower( static_cast<sal_uInt16>(nLower) ); aNewAttrs.Put( *pNewItem ); pNewItem.reset(); diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index 74433d89fa6e..2fcb816d77e0 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -511,10 +511,10 @@ VclPtr<SvxRuler> DrawViewShell::CreateHRuler (::sd::Window* pWin) GetViewFrame()->GetBindings(), aWBits); // Metric ... - sal_uInt16 nMetric = (sal_uInt16)GetDoc()->GetUIUnit(); + sal_uInt16 nMetric = static_cast<sal_uInt16>(GetDoc()->GetUIUnit()); if( nMetric == 0xffff ) - nMetric = (sal_uInt16)GetViewShellBase().GetViewFrame()->GetDispatcher()->GetModule()->GetFieldUnit(); + nMetric = static_cast<sal_uInt16>(GetViewShellBase().GetViewFrame()->GetDispatcher()->GetModule()->GetFieldUnit()); pRuler->SetUnit( FieldUnit( nMetric ) ); @@ -542,10 +542,10 @@ VclPtr<SvxRuler> DrawViewShell::CreateVRuler(::sd::Window* pWin) GetViewFrame()->GetBindings(), aWBits); // Metric same as HRuler, use document setting - sal_uInt16 nMetric = (sal_uInt16)GetDoc()->GetUIUnit(); + sal_uInt16 nMetric = static_cast<sal_uInt16>(GetDoc()->GetUIUnit()); if( nMetric == 0xffff ) - nMetric = (sal_uInt16)GetViewShellBase().GetViewFrame()->GetDispatcher()->GetModule()->GetFieldUnit(); + nMetric = static_cast<sal_uInt16>(GetViewShellBase().GetViewFrame()->GetDispatcher()->GetModule()->GetFieldUnit()); pRuler->SetUnit( FieldUnit( nMetric ) ); @@ -595,7 +595,7 @@ IMPL_LINK( DrawViewShell, TabSplitHdl, TabBar *, pTab, void ) - maTabControl->GetPosPixel().X() ; Size aTabSize = maTabControl->GetSizePixel(); - aTabSize.Width() = std::min(pTab->GetSplitSize(), (long)(nMax-1)); + aTabSize.Width() = std::min(pTab->GetSplitSize(), static_cast<long>(nMax-1)); maTabControl->SetSizePixel(aTabSize); @@ -625,11 +625,11 @@ SdPage* DrawViewShell::getCurrentPage() const if (meEditMode == EditMode::Page) { - return GetDoc()->GetSdPage((sal_uInt16)nCurrentPage, mePageKind); + return GetDoc()->GetSdPage(static_cast<sal_uInt16>(nCurrentPage), mePageKind); } else // EditMode::MasterPage { - return GetDoc()->GetMasterSdPage((sal_uInt16)nCurrentPage, mePageKind); + return GetDoc()->GetMasterSdPage(static_cast<sal_uInt16>(nCurrentPage), mePageKind); } } diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 42be1b63f8b0..698dac808ae0 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -916,8 +916,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) switch( eZT ) { case SvxZoomType::PERCENT: - SetZoom( (long) static_cast<const SvxZoomItem&>( pArgs-> - Get( SID_ATTR_ZOOM ) ).GetValue() ); + SetZoom( static_cast<long>(static_cast<const SvxZoomItem&>( pArgs-> + Get( SID_ATTR_ZOOM ) ).GetValue()) ); break; case SvxZoomType::OPTIMAL: @@ -1234,8 +1234,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { SdrPageView* pPV; Point aMPos = GetActiveWindow()->PixelToLogic( maMousePos ); - sal_uInt16 nHitLog = (sal_uInt16) GetActiveWindow()->PixelToLogic( Size( - FuPoor::HITPIX, 0 ) ).Width(); + sal_uInt16 nHitLog = static_cast<sal_uInt16>(GetActiveWindow()->PixelToLogic( Size( + FuPoor::HITPIX, 0 ) ).Width()); sal_uInt16 nHelpLine; mbMousePosFreezed = false; @@ -1404,7 +1404,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case FN_NUM_BULLET_ON: { // The value (sal_uInt16)0xFFFF means set bullet on/off. - SfxUInt16Item aItem(FN_SVX_SET_BULLET, (sal_uInt16)0xFFFF); + SfxUInt16Item aItem(FN_SVX_SET_BULLET, sal_uInt16(0xFFFF)); GetViewFrame()->GetDispatcher()->ExecuteList(FN_SVX_SET_BULLET, SfxCallMode::RECORD, { &aItem }); } @@ -1413,7 +1413,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case FN_NUM_NUMBERING_ON: { // The value (sal_uInt16)0xFFFF means set bullet on/off. - SfxUInt16Item aItem(FN_SVX_SET_NUMBER, (sal_uInt16)0xFFFF); + SfxUInt16Item aItem(FN_SVX_SET_NUMBER, sal_uInt16(0xFFFF)); GetViewFrame()->GetDispatcher()->ExecuteList(FN_SVX_SET_NUMBER, SfxCallMode::RECORD, { &aItem }); } @@ -1858,7 +1858,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if ( aPrevLayer == aName ) { - nPrevLayer = std::max(nLayer, (sal_uInt16) 4); + nPrevLayer = std::max(nLayer, sal_uInt16(4)); } } diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index f8f398dd91ca..d267641c9a0f 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -131,7 +131,7 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) if(SlideShow::IsRunning(GetViewShellBase()) && rReq.GetArgs()) { const SfxUInt32Item* pWhatPage = rReq.GetArg<SfxUInt32Item>(ID_VAL_WHATPAGE); - SlideShow::GetSlideShow(GetViewShellBase())->jumpToPageNumber((sal_Int32)((pWhatPage->GetValue()-1)>>1)); + SlideShow::GetSlideShow(GetViewShellBase())->jumpToPageNumber(static_cast<sal_Int32>((pWhatPage->GetValue()-1)>>1)); } else { @@ -147,7 +147,7 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) const SfxUInt32Item* pWhatPage = rReq.GetArg<SfxUInt32Item>(ID_VAL_WHATPAGE); const SfxUInt32Item* pWhatKind = rReq.GetArg<SfxUInt32Item>(ID_VAL_WHATKIND); - sal_Int32 nWhatPage = (sal_Int32)pWhatPage->GetValue (); + sal_Int32 nWhatPage = static_cast<sal_Int32>(pWhatPage->GetValue ()); PageKind nWhatKind = (PageKind)pWhatKind->GetValue (); if (! (nWhatKind >= PageKind::Standard && nWhatKind <= PageKind::Handout)) { @@ -168,7 +168,7 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) break; } - nSelectedPage = (short) nWhatPage; + nSelectedPage = static_cast<short>(nWhatPage); mePageKind = nWhatKind; } } @@ -216,7 +216,7 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) if(pWhatLayer) { - nCurPage = (short)pWhatLayer->GetValue(); + nCurPage = static_cast<short>(pWhatLayer->GetValue()); bCurPageValid = true; } } @@ -1023,8 +1023,8 @@ void DrawViewShell::GetSnapItemState( SfxItemSet &rSet ) { SdrPageView* pPV; Point aMPos = GetActiveWindow()->PixelToLogic(maMousePos); - sal_uInt16 nHitLog = (sal_uInt16) GetActiveWindow()->PixelToLogic( - Size(FuPoor::HITPIX,0)).Width(); + sal_uInt16 nHitLog = static_cast<sal_uInt16>(GetActiveWindow()->PixelToLogic( + Size(FuPoor::HITPIX,0)).Width()); sal_uInt16 nHelpLine; if ( mpDrawView->PickHelpLine(aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) ) diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index 6600582b685c..0f38933a37f3 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -397,9 +397,9 @@ void DrawViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin) } } - pBmpMask->SetColor( Color( (sal_uInt8) ( nRed / fDiv + .5 ), - (sal_uInt8) ( nGreen / fDiv + .5 ), - (sal_uInt8) ( nBlue / fDiv + .5 ) ) ); + pBmpMask->SetColor( Color( static_cast<sal_uInt8>( nRed / fDiv + .5 ), + static_cast<sal_uInt8>( nGreen / fDiv + .5 ), + static_cast<sal_uInt8>( nBlue / fDiv + .5 ) ) ); } } } @@ -504,8 +504,8 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) // is there a snap object under the cursor? SdrPageView* pPV; Point aMPos = pWin->PixelToLogic( maMousePos ); - sal_uInt16 nHitLog = (sal_uInt16) GetActiveWindow()->PixelToLogic( - Size(FuPoor::HITPIX, 0 ) ).Width(); + sal_uInt16 nHitLog = static_cast<sal_uInt16>(GetActiveWindow()->PixelToLogic( + Size(FuPoor::HITPIX, 0 ) ).Width()); sal_uInt16 nHelpLine; // for glue points SdrObject* pObj = nullptr; diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx index 13c5807082f7..d1d604e43ad0 100644 --- a/sd/source/ui/view/drviews5.cxx +++ b/sd/source/ui/view/drviews5.cxx @@ -573,8 +573,8 @@ void DrawViewShell::SetActiveTabLayerIndex (int nIndex) if (nIndex>=0 && nIndex<pBar->GetPageCount()) { // Tell the draw view and the tab control of the new active layer. - mpDrawView->SetActiveLayer (pBar->GetPageText (pBar->GetPageId ((sal_uInt16)nIndex))); - pBar->SetCurPageId (pBar->GetPageId ((sal_uInt16)nIndex)); + mpDrawView->SetActiveLayer (pBar->GetPageText (pBar->GetPageId (static_cast<sal_uInt16>(nIndex)))); + pBar->SetCurPageId (pBar->GetPageId (static_cast<sal_uInt16>(nIndex))); rtl::Reference<SdUnoDrawView> pUnoDrawView(new SdUnoDrawView ( *this, *GetView())); diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 2abf0aae8aa3..1e18528eadda 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -269,8 +269,8 @@ void DrawViewShell::GetMarginProperties( SfxItemSet &rSet ) { // const SvxLRSpaceItem aTmpPageLRSpace ( rDesc.GetMaster().GetLRSpace() ); const SvxLongLRSpaceItem aLongLR( - (long)pPage->GetLeftBorder(), - (long)pPage->GetRightBorder(), + static_cast<long>(pPage->GetLeftBorder()), + static_cast<long>(pPage->GetRightBorder()), SID_ATTR_PAGE_LRSPACE ); rSet.Put( aLongLR ); } @@ -280,8 +280,8 @@ void DrawViewShell::GetMarginProperties( SfxItemSet &rSet ) { // const SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() ); SvxLongULSpaceItem aLongUL( - (long)pPage->GetUpperBorder(), - (long)pPage->GetLowerBorder(), + static_cast<long>(pPage->GetUpperBorder()), + static_cast<long>(pPage->GetLowerBorder()), SID_ATTR_PAGE_ULSPACE ); rSet.Put( aLongUL ); } diff --git a/sd/source/ui/view/drviews8.cxx b/sd/source/ui/view/drviews8.cxx index 3d0bf89a5888..7904c458bf8f 100644 --- a/sd/source/ui/view/drviews8.cxx +++ b/sd/source/ui/view/drviews8.cxx @@ -79,8 +79,8 @@ void DrawViewShell::ScannerEvent() if( ( ( aBmpSize.Height() > aPageSize.Height() ) || ( aBmpSize.Width() > aPageSize.Width() ) ) && aBmpSize.Height() && aPageSize.Height() ) { - double fGrfWH = (double) aBmpSize.Width() / aBmpSize.Height(); - double fWinWH = (double) aPageSize.Width() / aPageSize.Height(); + double fGrfWH = static_cast<double>(aBmpSize.Width()) / aBmpSize.Height(); + double fWinWH = static_cast<double>(aPageSize.Width()) / aPageSize.Height(); if( fGrfWH < fWinWH ) { diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx index c3a55f55f031..2d21a572880a 100644 --- a/sd/source/ui/view/drviews9.cxx +++ b/sd/source/ui/view/drviews9.cxx @@ -104,21 +104,21 @@ void DrawViewShell::ExecGallery(SfxRequest const & rReq) if ( ( ( aSize.Height() > aPageSize.Height() ) || ( aSize.Width() > aPageSize.Width() ) ) && aSize.Height() && aPageSize.Height() ) { - float fGrfWH = (float)aSize.Width() / - (float)aSize.Height(); - float fWinWH = (float)aPageSize.Width() / - (float)aPageSize.Height(); + float fGrfWH = static_cast<float>(aSize.Width()) / + static_cast<float>(aSize.Height()); + float fWinWH = static_cast<float>(aPageSize.Width()) / + static_cast<float>(aPageSize.Height()); // constrain size to page size if necessary if ((fGrfWH != 0.F) && (fGrfWH < fWinWH)) { - aSize.Width() = (long)(aPageSize.Height() * fGrfWH); + aSize.Width() = static_cast<long>(aPageSize.Height() * fGrfWH); aSize.Height()= aPageSize.Height(); } else { aSize.Width() = aPageSize.Width(); - aSize.Height()= (long)(aPageSize.Width() / fGrfWH); + aSize.Height()= static_cast<long>(aPageSize.Width() / fGrfWH); } } @@ -242,7 +242,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) if (pArgs->Count () == 1) { const SfxUInt32Item* pLineStyle = rReq.GetArg<SfxUInt32Item>(ID_VAL_STYLE); - if (CHECK_RANGE ((sal_Int32)drawing::LineStyle_NONE, (sal_Int32)pLineStyle->GetValue(), (sal_Int32)drawing::LineStyle_DASH)) + if (CHECK_RANGE ((sal_Int32)drawing::LineStyle_NONE, static_cast<sal_Int32>(pLineStyle->GetValue()), (sal_Int32)drawing::LineStyle_DASH)) { pAttr->ClearItem (XATTR_LINESTYLE); XLineStyleItem aStyleItem((drawing::LineStyle) pLineStyle->GetValue()); @@ -288,9 +288,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) pAttr->ClearItem (XATTR_FILLCOLOR); pAttr->ClearItem (XATTR_FILLSTYLE); - XFillColorItem aColorItem(-1, Color ((sal_uInt8) pRed->GetValue (), - (sal_uInt8) pGreen->GetValue (), - (sal_uInt8) pBlue->GetValue ())); + XFillColorItem aColorItem(-1, Color (static_cast<sal_uInt8>(pRed->GetValue ()), + static_cast<sal_uInt8>(pGreen->GetValue ()), + static_cast<sal_uInt8>(pBlue->GetValue ()))); aColorItem.SetWhich(XATTR_FILLCOLOR); pAttr->Put(aColorItem); rBindings.Invalidate (SID_ATTR_FILL_COLOR); @@ -313,9 +313,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) const SfxUInt32Item* pBlue = rReq.GetArg<SfxUInt32Item>(ID_VAL_BLUE); pAttr->ClearItem (XATTR_LINECOLOR); - XLineColorItem aColorItem(-1, Color((sal_uInt8) pRed->GetValue(), - (sal_uInt8) pGreen->GetValue(), - (sal_uInt8) pBlue->GetValue())); + XLineColorItem aColorItem(-1, Color(static_cast<sal_uInt8>(pRed->GetValue()), + static_cast<sal_uInt8>(pGreen->GetValue()), + static_cast<sal_uInt8>(pBlue->GetValue()))); aColorItem.SetWhich(XATTR_LINECOLOR); pAttr->Put(aColorItem); rBindings.Invalidate (SID_ATTR_LINE_COLOR); @@ -338,9 +338,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) XGradientListRef pGradientList = GetDoc()->GetGradientList (); long nCounts = pGradientList->Count (); - Color aColor ((sal_uInt8) pRed->GetValue (), - (sal_uInt8) pGreen->GetValue (), - (sal_uInt8) pBlue->GetValue ()); + Color aColor (static_cast<sal_uInt8>(pRed->GetValue ()), + static_cast<sal_uInt8>(pGreen->GetValue ()), + static_cast<sal_uInt8>(pBlue->GetValue ())); long i; pAttr->ClearItem (XATTR_FILLGRADIENT); @@ -409,9 +409,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) XHatchListRef pHatchList = GetDoc()->GetHatchList (); long nCounts = pHatchList->Count (); - Color aColor ((sal_uInt8) pRed->GetValue (), - (sal_uInt8) pGreen->GetValue (), - (sal_uInt8) pBlue->GetValue ()); + Color aColor (static_cast<sal_uInt8>(pRed->GetValue ()), + static_cast<sal_uInt8>(pGreen->GetValue ()), + static_cast<sal_uInt8>(pBlue->GetValue ())); long i; pAttr->ClearItem (XATTR_FILLHATCH); @@ -475,10 +475,10 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) const SfxUInt32Item* pDashLen = rReq.GetArg<SfxUInt32Item>(ID_VAL_DASHLEN); const SfxUInt32Item* pDistance = rReq.GetArg<SfxUInt32Item>(ID_VAL_DISTANCE); - if (CHECK_RANGE ((sal_Int32)css::drawing::DashStyle_RECT, (sal_Int32)pStyle->GetValue(), (sal_Int32)css::drawing::DashStyle_ROUNDRELATIVE)) + if (CHECK_RANGE ((sal_Int32)css::drawing::DashStyle_RECT, static_cast<sal_Int32>(pStyle->GetValue()), (sal_Int32)css::drawing::DashStyle_ROUNDRELATIVE)) { - XDash aNewDash ((css::drawing::DashStyle) pStyle->GetValue (), (short) pDots->GetValue (), pDotLen->GetValue (), - (short) pDashes->GetValue (), pDashLen->GetValue (), pDistance->GetValue ()); + XDash aNewDash ((css::drawing::DashStyle) pStyle->GetValue (), static_cast<short>(pDots->GetValue ()), pDotLen->GetValue (), + static_cast<short>(pDashes->GetValue ()), pDashLen->GetValue (), pDistance->GetValue ()); pAttr->ClearItem (XATTR_LINEDASH); pAttr->ClearItem (XATTR_LINESTYLE); @@ -530,13 +530,13 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) const SfxUInt32Item* pStart = rReq.GetArg<SfxUInt32Item>(ID_VAL_STARTINTENS); const SfxUInt32Item* pEnd = rReq.GetArg<SfxUInt32Item>(ID_VAL_ENDINTENS); - if (CHECK_RANGE ((sal_Int32)css::awt::GradientStyle_LINEAR, (sal_Int32)pStyle->GetValue(), (sal_Int32)css::awt::GradientStyle_RECT) && - CHECK_RANGE (0, (sal_Int32)pAngle->GetValue (), 360) && - CHECK_RANGE (0, (sal_Int32)pBorder->GetValue (), 100) && - CHECK_RANGE (0, (sal_Int32)pCenterX->GetValue (), 100) && - CHECK_RANGE (0, (sal_Int32)pCenterY->GetValue (), 100) && - CHECK_RANGE (0, (sal_Int32)pStart->GetValue (), 100) && - CHECK_RANGE (0, (sal_Int32)pEnd->GetValue (), 100)) + if (CHECK_RANGE ((sal_Int32)css::awt::GradientStyle_LINEAR, static_cast<sal_Int32>(pStyle->GetValue()), (sal_Int32)css::awt::GradientStyle_RECT) && + CHECK_RANGE (0, static_cast<sal_Int32>(pAngle->GetValue ()), 360) && + CHECK_RANGE (0, static_cast<sal_Int32>(pBorder->GetValue ()), 100) && + CHECK_RANGE (0, static_cast<sal_Int32>(pCenterX->GetValue ()), 100) && + CHECK_RANGE (0, static_cast<sal_Int32>(pCenterY->GetValue ()), 100) && + CHECK_RANGE (0, static_cast<sal_Int32>(pStart->GetValue ()), 100) && + CHECK_RANGE (0, static_cast<sal_Int32>(pEnd->GetValue ()), 100)) { pAttr->ClearItem (XATTR_FILLGRADIENT); pAttr->ClearItem (XATTR_FILLSTYLE); @@ -555,11 +555,11 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) aGradient.SetGradientStyle ((css::awt::GradientStyle) pStyle->GetValue ()); aGradient.SetAngle (pAngle->GetValue () * 10); - aGradient.SetBorder ((short) pBorder->GetValue ()); - aGradient.SetXOffset ((short) pCenterX->GetValue ()); - aGradient.SetYOffset ((short) pCenterY->GetValue ()); - aGradient.SetStartIntens ((short) pStart->GetValue ()); - aGradient.SetEndIntens ((short) pEnd->GetValue ()); + aGradient.SetBorder (static_cast<short>(pBorder->GetValue ())); + aGradient.SetXOffset (static_cast<short>(pCenterX->GetValue ())); + aGradient.SetYOffset (static_cast<short>(pCenterY->GetValue ())); + aGradient.SetStartIntens (static_cast<short>(pStart->GetValue ())); + aGradient.SetEndIntens (static_cast<short>(pEnd->GetValue ())); XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT); aStyleItem.SetWhich(XATTR_FILLSTYLE); @@ -575,9 +575,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) { Color aBlack (0, 0, 0); XGradient aGradient (aBlack, aBlack, (css::awt::GradientStyle) pStyle->GetValue (), - pAngle->GetValue () * 10, (short) pCenterX->GetValue (), - (short) pCenterY->GetValue (), (short) pBorder->GetValue (), - (short) pStart->GetValue (), (short) pEnd->GetValue ()); + pAngle->GetValue () * 10, static_cast<short>(pCenterX->GetValue ()), + static_cast<short>(pCenterY->GetValue ()), static_cast<short>(pBorder->GetValue ()), + static_cast<short>(pStart->GetValue ()), static_cast<short>(pEnd->GetValue ())); pGradientList->Insert(o3tl::make_unique<XGradientEntry>(aGradient, pName->GetValue())); XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT); @@ -613,8 +613,8 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) const SfxUInt32Item* pDistance = rReq.GetArg<SfxUInt32Item>(ID_VAL_DISTANCE); const SfxUInt32Item* pAngle = rReq.GetArg<SfxUInt32Item>(ID_VAL_ANGLE); - if (CHECK_RANGE ((sal_Int32)css::drawing::HatchStyle_SINGLE, (sal_Int32)pStyle->GetValue(), (sal_Int32)css::drawing::HatchStyle_TRIPLE) && - CHECK_RANGE (0, (sal_Int32)pAngle->GetValue (), 360)) + if (CHECK_RANGE ((sal_Int32)css::drawing::HatchStyle_SINGLE, static_cast<sal_Int32>(pStyle->GetValue()), (sal_Int32)css::drawing::HatchStyle_TRIPLE) && + CHECK_RANGE (0, static_cast<sal_Int32>(pAngle->GetValue ()), 360)) { pAttr->ClearItem (XATTR_FILLHATCH); pAttr->ClearItem (XATTR_FILLSTYLE); @@ -830,7 +830,7 @@ void DrawViewShell::AttrState (SfxItemSet& rSet) { const XLineWidthItem &rLineWidthItem = aAttr.Get (XATTR_LINEWIDTH); - rSet.Put (SfxUInt32Item (nWhich, (long) rLineWidthItem.GetValue ())); + rSet.Put (SfxUInt32Item (nWhich, static_cast<long>(rLineWidthItem.GetValue ()))); break; } @@ -884,7 +884,7 @@ void DrawViewShell::AttrState (SfxItemSet& rSet) ; } - rSet.Put (SfxUInt32Item (nWhich, (long) ((nWhich == SID_GETRED) + rSet.Put (SfxUInt32Item (nWhich, static_cast<long>((nWhich == SID_GETRED) ? aColor.GetRed () : (nWhich == SID_GETGREEN) ? aColor.GetGreen () diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index 83fb4e824975..4a1cd9c0b38e 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -536,7 +536,7 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet) else { std::unique_ptr<SvxZoomItem> pZoomItem; - sal_uInt16 nZoom = (sal_uInt16) GetActiveWindow()->GetZoom(); + sal_uInt16 nZoom = static_cast<sal_uInt16>(GetActiveWindow()->GetZoom()); if( mbZoomOnPage ) pZoomItem.reset(new SvxZoomItem( SvxZoomType::WHOLEPAGE, nZoom )); @@ -566,7 +566,7 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet) else { sd::Window * pActiveWindow = GetActiveWindow(); - SvxZoomSliderItem aZoomItem( (sal_uInt16) pActiveWindow->GetZoom(), (sal_uInt16)pActiveWindow->GetMinZoom(), (sal_uInt16)pActiveWindow->GetMaxZoom() ) ; + SvxZoomSliderItem aZoomItem( static_cast<sal_uInt16>(pActiveWindow->GetZoom()), static_cast<sal_uInt16>(pActiveWindow->GetMinZoom()), static_cast<sal_uInt16>(pActiveWindow->GetMaxZoom()) ) ; SdrPageView* pPageView = mpDrawView->GetSdrPageView(); if( pPageView ) @@ -575,10 +575,10 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet) Size aPageSize = pPageView->GetPage()->GetSize(); aPagePos.X() += aPageSize.Width() / 2; - aPageSize.Width() = (long) (aPageSize.Width() * 1.03); + aPageSize.Width() = static_cast<long>(aPageSize.Width() * 1.03); aPagePos.Y() += aPageSize.Height() / 2; - aPageSize.Height() = (long) (aPageSize.Height() * 1.03); + aPageSize.Height() = static_cast<long>(aPageSize.Height() * 1.03); aPagePos.Y() -= aPageSize.Height() / 2; aPagePos.X() -= aPageSize.Width() / 2; diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index 517417adda4c..daf0d5177c05 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -127,7 +127,7 @@ void ImpAddPrintableCharactersToTextEdit(SfxRequest const & rReq, ::sd::View* pV { for(sal_Int32 a(0); a < aInputString.getLength(); a++) { - sal_Char aChar = (sal_Char)aInputString[a]; + sal_Char aChar = static_cast<sal_Char>(aInputString[a]); vcl::KeyCode aKeyCode; KeyEvent aKeyEvent(aChar, aKeyCode); @@ -1090,12 +1090,12 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) Size aPageSize = pPageView->GetPage()->GetSize(); aPagePos.X() += aPageSize.Width() / 2; - aPageSize.Width() = (long) (aPageSize.Width() * 1.03); + aPageSize.Width() = static_cast<long>(aPageSize.Width() * 1.03); if( rReq.GetSlot() == SID_SIZE_PAGE ) { aPagePos.Y() += aPageSize.Height() / 2; - aPageSize.Height() = (long) (aPageSize.Height() * 1.03); + aPageSize.Height() = static_cast<long>(aPageSize.Height() * 1.03); aPagePos.Y() -= aPageSize.Height() / 2; } else @@ -1186,8 +1186,8 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) if ( mpDrawView->AreObjectsMarked() ) { maMarkRect = mpDrawView->GetAllMarkedRect(); - long nW = (long) (maMarkRect.GetWidth() * 1.03); - long nH = (long) (maMarkRect.GetHeight() * 1.03); + long nW = static_cast<long>(maMarkRect.GetWidth() * 1.03); + long nH = static_cast<long>(maMarkRect.GetHeight() * 1.03); Point aPos = maMarkRect.Center(); aPos.X() -= nW / 2; aPos.Y() -= nH / 2; @@ -1218,8 +1218,8 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) { ::tools::Rectangle aBoundRect( pPageView->GetObjList()->GetAllObjBoundRect() ); - long nW = (long) (aBoundRect.GetWidth() * 1.03); - long nH = (long) (aBoundRect.GetHeight() * 1.03); + long nW = static_cast<long>(aBoundRect.GetWidth() * 1.03); + long nH = static_cast<long>(aBoundRect.GetHeight() * 1.03); Point aPos = aBoundRect.Center(); aPos.X() -= nW / 2; aPos.Y() -= nH / 2; diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index dc13ed8cbca8..4819c227e844 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -582,7 +582,7 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) { sal_uInt16 nMask = 1; sal_uInt16 nCount = 0; - sal_uInt16 nCurLevel = (sal_uInt16)0xFFFF; + sal_uInt16 nCurLevel = sal_uInt16(0xFFFF); for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++) { if(nActNumLvl & nMask) @@ -609,8 +609,8 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) bBullets = false; } - rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); - rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); + rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,sal_uInt16(0xFFFF))); + rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,sal_uInt16(0xFFFF))); if ( bBullets ) { NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(NBOType::Bullets); diff --git a/sd/source/ui/view/drviewsh.cxx b/sd/source/ui/view/drviewsh.cxx index 3b8e6c5bf5ce..af1f146685f2 100644 --- a/sd/source/ui/view/drviewsh.cxx +++ b/sd/source/ui/view/drviewsh.cxx @@ -63,8 +63,8 @@ void DrawViewShell::MakeVisible(const ::tools::Rectangle& rRect, vcl::Window& rW // tdf#98646 check if Rectangle which contains the bounds of the region to // be shown eventually contains values that cause overflows when processing // e.g. when calling GetWidth() - const bool bOverflowInX(!rtl::math::approxEqual((double)rRect.getWidth(), (double)rRect.Right() - (double)rRect.Left())); - const bool bOverflowInY(!rtl::math::approxEqual((double)rRect.getHeight(), (double)rRect.Bottom() - (double)rRect.Top())); + const bool bOverflowInX(!rtl::math::approxEqual(static_cast<double>(rRect.getWidth()), static_cast<double>(rRect.Right()) - static_cast<double>(rRect.Left()))); + const bool bOverflowInY(!rtl::math::approxEqual(static_cast<double>(rRect.getHeight()), static_cast<double>(rRect.Bottom()) - static_cast<double>(rRect.Top()))); if(bOverflowInX || bOverflowInY) { diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx index f22643275668..4509fe94bc32 100644 --- a/sd/source/ui/view/frmview.cxx +++ b/sd/source/ui/view/frmview.cxx @@ -349,17 +349,17 @@ static OUString createHelpLinesString( const SdrHelpLineList& rHelpLines ) { case SdrHelpLineKind::Point: aLines.append( 'P' ); - aLines.append( (sal_Int32)rPos.X() ); + aLines.append( static_cast<sal_Int32>(rPos.X()) ); aLines.append( ',' ); - aLines.append( (sal_Int32)rPos.Y() ); + aLines.append( static_cast<sal_Int32>(rPos.Y()) ); break; case SdrHelpLineKind::Vertical: aLines.append( 'V' ); - aLines.append( (sal_Int32)rPos.X() ); + aLines.append( static_cast<sal_Int32>(rPos.X()) ); break; case SdrHelpLineKind::Horizontal: aLines.append( 'H' ); - aLines.append( (sal_Int32)rPos.Y() ); + aLines.append( static_cast<sal_Int32>(rPos.Y()) ); break; default: OSL_FAIL( "Unsupported helpline Kind!" ); @@ -385,7 +385,7 @@ void FrameView::WriteUserDataSequence ( css::uno::Sequence < css::beans::Propert aUserData.addValue( sUNO_View_IsPlusHandlesAlwaysVisible, makeAny( IsPlusHandlesAlwaysVisible() ) ); aUserData.addValue( sUNO_View_IsFrameDragSingles, makeAny( IsFrameDragSingles() ) ); - aUserData.addValue( sUNO_View_EliminatePolyPointLimitAngle, makeAny( (sal_Int32)GetEliminatePolyPointLimitAngle() ) ); + aUserData.addValue( sUNO_View_EliminatePolyPointLimitAngle, makeAny( static_cast<sal_Int32>(GetEliminatePolyPointLimitAngle()) ) ); aUserData.addValue( sUNO_View_IsEliminatePolyPoints, makeAny( IsEliminatePolyPoints() ) ); Any aAny; @@ -412,13 +412,13 @@ void FrameView::WriteUserDataSequence ( css::uno::Sequence < css::beans::Propert aUserData.addValue( sUNO_View_RulerIsVisible, makeAny( HasRuler() ) ); aUserData.addValue( sUNO_View_PageKind, makeAny( (sal_Int16)GetPageKind() ) ); - aUserData.addValue( sUNO_View_SelectedPage, makeAny( (sal_Int16)GetSelectedPage() ) ); + aUserData.addValue( sUNO_View_SelectedPage, makeAny( static_cast<sal_Int16>(GetSelectedPage()) ) ); aUserData.addValue( sUNO_View_IsLayerMode, makeAny( IsLayerMode() ) ); aUserData.addValue( sUNO_View_IsDoubleClickTextEdit, makeAny( IsDoubleClickTextEdit() ) ); aUserData.addValue( sUNO_View_IsClickChangeRotation, makeAny( IsClickChangeRotation() ) ); - aUserData.addValue( sUNO_View_SlidesPerRow, makeAny( (sal_Int16)GetSlidesPerRow() ) ); + aUserData.addValue( sUNO_View_SlidesPerRow, makeAny( static_cast<sal_Int16>(GetSlidesPerRow()) ) ); aUserData.addValue( sUNO_View_EditMode, makeAny( (sal_Int32)GetViewShEditMode() ) ); // aUserData.addValue( sUNO_View_EditModeStandard, makeAny( (sal_Int32)GetViewShEditMode( PageKind::Standard ) ) ); // aUserData.addValue( sUNO_View_EditModeNotes, makeAny( (sal_Int32)GetViewShEditMode( PageKind::Notes ) ) ); @@ -427,22 +427,22 @@ void FrameView::WriteUserDataSequence ( css::uno::Sequence < css::beans::Propert { const ::tools::Rectangle aVisArea = GetVisArea(); - aUserData.addValue( sUNO_View_VisibleAreaTop, makeAny( (sal_Int32)aVisArea.Top() ) ); - aUserData.addValue( sUNO_View_VisibleAreaLeft, makeAny( (sal_Int32)aVisArea.Left() ) ); - aUserData.addValue( sUNO_View_VisibleAreaWidth, makeAny( (sal_Int32)aVisArea.GetWidth() ) ); - aUserData.addValue( sUNO_View_VisibleAreaHeight, makeAny( (sal_Int32)aVisArea.GetHeight() ) ); + aUserData.addValue( sUNO_View_VisibleAreaTop, makeAny( static_cast<sal_Int32>(aVisArea.Top()) ) ); + aUserData.addValue( sUNO_View_VisibleAreaLeft, makeAny( static_cast<sal_Int32>(aVisArea.Left()) ) ); + aUserData.addValue( sUNO_View_VisibleAreaWidth, makeAny( static_cast<sal_Int32>(aVisArea.GetWidth()) ) ); + aUserData.addValue( sUNO_View_VisibleAreaHeight, makeAny( static_cast<sal_Int32>(aVisArea.GetHeight()) ) ); } - aUserData.addValue( sUNO_View_GridCoarseWidth, makeAny( (sal_Int32)GetGridCoarse().Width() ) ); - aUserData.addValue( sUNO_View_GridCoarseHeight, makeAny( (sal_Int32)GetGridCoarse().Height() ) ); - aUserData.addValue( sUNO_View_GridFineWidth, makeAny( (sal_Int32)GetGridFine().Width() ) ); - aUserData.addValue( sUNO_View_GridFineHeight, makeAny( (sal_Int32)GetGridFine().Height() ) ); + aUserData.addValue( sUNO_View_GridCoarseWidth, makeAny( static_cast<sal_Int32>(GetGridCoarse().Width()) ) ); + aUserData.addValue( sUNO_View_GridCoarseHeight, makeAny( static_cast<sal_Int32>(GetGridCoarse().Height()) ) ); + aUserData.addValue( sUNO_View_GridFineWidth, makeAny( static_cast<sal_Int32>(GetGridFine().Width()) ) ); + aUserData.addValue( sUNO_View_GridFineHeight, makeAny( static_cast<sal_Int32>(GetGridFine().Height()) ) ); aUserData.addValue( sUNO_View_GridSnapWidthXNumerator, makeAny( GetSnapGridWidthX().GetNumerator() ) ); aUserData.addValue( sUNO_View_GridSnapWidthXDenominator, makeAny( GetSnapGridWidthX().GetDenominator() ) ); aUserData.addValue( sUNO_View_GridSnapWidthYNumerator, makeAny( GetSnapGridWidthY().GetNumerator() ) ); aUserData.addValue( sUNO_View_GridSnapWidthYDenominator, makeAny( GetSnapGridWidthY().GetDenominator() ) ); aUserData.addValue( sUNO_View_IsAngleSnapEnabled, makeAny( IsAngleSnapEnabled() ) ); - aUserData.addValue( sUNO_View_SnapAngle, makeAny( (sal_Int32)GetSnapAngle() ) ); + aUserData.addValue( sUNO_View_SnapAngle, makeAny( static_cast<sal_Int32>(GetSnapAngle()) ) ); const sal_Int32 nOldLength = rValues.getLength(); rValues.realloc( nOldLength + aUserData.size() ); @@ -597,9 +597,9 @@ void FrameView::ReadUserDataSequence ( const css::uno::Sequence < css::beans::Pr { SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( GetModel() ); if( pDoc && pDoc->GetDocSh() && ( SfxObjectCreateMode::EMBEDDED == pDoc->GetDocSh()->GetCreateMode() ) ) - SetSelectedPage( (sal_uInt16)nInt16 ); + SetSelectedPage( static_cast<sal_uInt16>(nInt16) ); - SetSelectedPageOnLoad( (sal_uInt16)nInt16 ); + SetSelectedPageOnLoad( static_cast<sal_uInt16>(nInt16) ); } } else if ( pValue->Name == sUNO_View_IsLayerMode ) @@ -627,7 +627,7 @@ void FrameView::ReadUserDataSequence ( const css::uno::Sequence < css::beans::Pr { if( pValue->Value >>= nInt16 ) { - SetSlidesPerRow( (sal_uInt16)nInt16 ); + SetSlidesPerRow( static_cast<sal_uInt16>(nInt16) ); } } else if ( pValue->Name == sUNO_View_EditMode ) diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx index c48121a62496..ff5c9767d478 100644 --- a/sd/source/ui/view/outlnvs2.cxx +++ b/sd/source/ui/view/outlnvs2.cxx @@ -94,8 +94,8 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq) switch( eZT ) { case SvxZoomType::PERCENT: - SetZoom( (long) static_cast<const SvxZoomItem&>( pArgs-> - Get( SID_ATTR_ZOOM ) ).GetValue() ); + SetZoom( static_cast<long>(static_cast<const SvxZoomItem&>( pArgs-> + Get( SID_ATTR_ZOOM ) ).GetValue()) ); Invalidate( SID_ATTR_ZOOM ); Invalidate( SID_ATTR_ZOOMSLIDER ); break; diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index 76625cb36544..efccc9dce51e 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -1067,7 +1067,7 @@ void OutlineViewShell::VirtHScrollHdl(ScrollBar* pHScroll) { long nThumb = pHScroll->GetThumbPos(); long nRange = pHScroll->GetRange().Len(); - double fX = (double) nThumb / nRange; + double fX = static_cast<double>(nThumb) / nRange; Window* pWin = mpContentWindow.get(); OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWin); @@ -1076,7 +1076,7 @@ void OutlineViewShell::VirtHScrollHdl(ScrollBar* pHScroll) long nTextWidth = pOlView->GetPaperWidth(); nViewWidth = std::max(nViewWidth, nTextWidth); long nCurrentPos = pOutlinerView->GetVisArea().Left(); - long nTargetPos = (long)(fX * nViewWidth); + long nTargetPos = static_cast<long>(fX * nViewWidth); long nDelta = nTargetPos - nCurrentPos; pOutlinerView->HideCursor(); @@ -1088,7 +1088,7 @@ void OutlineViewShell::VirtVScrollHdl(ScrollBar* pVScroll) { long nThumb = pVScroll->GetThumbPos(); long nRange = pVScroll->GetRange().Len(); - double fY = (double) nThumb / nRange; + double fY = static_cast<double>(nThumb) / nRange; Window* pWin = mpContentWindow.get(); OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWin); @@ -1097,7 +1097,7 @@ void OutlineViewShell::VirtVScrollHdl(ScrollBar* pVScroll) long nTextHeight = pOlView->GetOutliner().GetTextHeight(); nViewHeight += nTextHeight; long nCurrentPos = pOutlinerView->GetVisArea().Top(); - long nTargetPos = (long)(fY * nViewHeight); + long nTargetPos = static_cast<long>(fY * nViewHeight); long nDelta = nTargetPos - nCurrentPos; pOutlinerView->HideCursor(); @@ -1260,7 +1260,7 @@ void OutlineViewShell::GetStatusBarState(SfxItemSet& rSet) // Zoom-Item if( SfxItemState::DEFAULT == rSet.GetItemState( SID_ATTR_ZOOM ) ) { - sal_uInt16 nZoom = (sal_uInt16) GetActiveWindow()->GetZoom(); + sal_uInt16 nZoom = static_cast<sal_uInt16>(GetActiveWindow()->GetZoom()); std::unique_ptr<SvxZoomItem> pZoomItem(new SvxZoomItem( SvxZoomType::PERCENT, nZoom )); @@ -1283,7 +1283,7 @@ void OutlineViewShell::GetStatusBarState(SfxItemSet& rSet) else { sd::Window * pActiveWindow = GetActiveWindow(); - SvxZoomSliderItem aZoomItem( (sal_uInt16) pActiveWindow->GetZoom(), (sal_uInt16)pActiveWindow->GetMinZoom(), (sal_uInt16)pActiveWindow->GetMaxZoom() ) ; + SvxZoomSliderItem aZoomItem( static_cast<sal_uInt16>(pActiveWindow->GetZoom()), static_cast<sal_uInt16>(pActiveWindow->GetMinZoom()), static_cast<sal_uInt16>(pActiveWindow->GetMaxZoom()) ) ; aZoomItem.AddSnappingPoint(100); rSet.Put( aZoomItem ); } @@ -1330,11 +1330,11 @@ void OutlineViewShell::GetStatusBarState(SfxItemSet& rSet) if( nPos >= GetDoc()->GetSdPageCount( PageKind::Standard ) ) nPos = 0; - SdrPage* pPage = GetDoc()->GetSdPage( (sal_uInt16) nPos, PageKind::Standard ); + SdrPage* pPage = GetDoc()->GetSdPage( static_cast<sal_uInt16>(nPos), PageKind::Standard ); aPageStr = SdResId(STR_SD_PAGE_COUNT); - aPageStr = aPageStr.replaceFirst("%1", OUString::number((sal_Int32)(nPos + 1))); + aPageStr = aPageStr.replaceFirst("%1", OUString::number(static_cast<sal_Int32>(nPos + 1))); aPageStr = aPageStr.replaceFirst("%2", OUString::number(nPageCount)); aLayoutStr = pPage->GetLayoutName(); diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index 67d509d913c7..94741524df75 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -421,13 +421,13 @@ SdPage* OutlineView::InsertSlideForParagraph( Paragraph* pPara ) **********************************************************************/ // this page is exemplary - SdPage* pExample = mrDoc.GetSdPage((sal_uInt16)nExample, PageKind::Standard); + SdPage* pExample = mrDoc.GetSdPage(static_cast<sal_uInt16>(nExample), PageKind::Standard); SdPage* pPage = mrDoc.AllocSdPage(false); pPage->SetLayoutName(pExample->GetLayoutName()); // insert (page) - mrDoc.InsertPage(pPage, (sal_uInt16)nTarget * 2 + 1); + mrDoc.InsertPage(pPage, static_cast<sal_uInt16>(nTarget) * 2 + 1); if( isRecordingUndo() ) AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoNewPage(*pPage)); @@ -458,7 +458,7 @@ SdPage* OutlineView::InsertSlideForParagraph( Paragraph* pPara ) /********************************************************************** |* now the notes page \*********************************************************************/ - pExample = mrDoc.GetSdPage((sal_uInt16)nExample, PageKind::Notes); + pExample = mrDoc.GetSdPage(static_cast<sal_uInt16>(nExample), PageKind::Notes); SdPage* pNotesPage = mrDoc.AllocSdPage(false); pNotesPage->SetLayoutName(pExample->GetLayoutName()); @@ -466,7 +466,7 @@ SdPage* OutlineView::InsertSlideForParagraph( Paragraph* pPara ) pNotesPage->SetPageKind(PageKind::Notes); // insert (notes page) - mrDoc.InsertPage(pNotesPage, (sal_uInt16)nTarget * 2 + 2); + mrDoc.InsertPage(pNotesPage, static_cast<sal_uInt16>(nTarget) * 2 + 2); if( isRecordingUndo() ) AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoNewPage(*pNotesPage)); @@ -509,13 +509,13 @@ IMPL_LINK( OutlineView, ParagraphRemovingHdl, ::Outliner::ParagraphHdlParam, aPa } // delete page and notes page - sal_uInt16 nAbsPos = (sal_uInt16)nPos * 2 + 1; + sal_uInt16 nAbsPos = static_cast<sal_uInt16>(nPos) * 2 + 1; SdrPage* pPage = mrDoc.GetPage(nAbsPos); if( isRecordingUndo() ) AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage)); mrDoc.RemovePage(nAbsPos); - nAbsPos = (sal_uInt16)nPos * 2 + 1; + nAbsPos = static_cast<sal_uInt16>(nPos) * 2 + 1; pPage = mrDoc.GetPage(nAbsPos); if( isRecordingUndo() ) AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage)); @@ -639,13 +639,13 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner::DepthChangeHdlParam, aParam } // delete page and notes page - sal_uInt16 nAbsPos = (sal_uInt16)nPos * 2 + 1; + sal_uInt16 nAbsPos = static_cast<sal_uInt16>(nPos) * 2 + 1; SdrPage* pPage = mrDoc.GetPage(nAbsPos); if( isRecordingUndo() ) AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage)); mrDoc.RemovePage(nAbsPos); - nAbsPos = (sal_uInt16)nPos * 2 + 1; + nAbsPos = static_cast<sal_uInt16>(nPos) * 2 + 1; pPage = mrDoc.GetPage(nAbsPos); if( isRecordingUndo() ) AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage)); @@ -690,7 +690,7 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner::DepthChangeHdlParam, aParam if(nPos >= 0) { - SdPage*pPage = mrDoc.GetSdPage( (sal_uInt16) nPos, PageKind::Standard); + SdPage*pPage = mrDoc.GetSdPage( static_cast<sal_uInt16>(nPos), PageKind::Standard); if(pPage && pPage->GetPresObj(PRESOBJ_TEXT)) pOutliner->SetDepth( pPara, 0 ); @@ -710,7 +710,7 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner::DepthChangeHdlParam, aParam if( nPos >= 0 ) { - SdPage* pPage = mrDoc.GetSdPage( (sal_uInt16) nPos, PageKind::Standard ); + SdPage* pPage = mrDoc.GetSdPage( static_cast<sal_uInt16>(nPos), PageKind::Standard ); if( pPage ) { @@ -867,7 +867,7 @@ IMPL_LINK( OutlineView, EndMovingHdl, ::Outliner *, pOutliner, void ) sal_uInt16 nPos = nPosNewOrder; // don't change nPosNewOrder if (nPos == 0) { - nPos = (sal_uInt16)-1; // insert before the first page + nPos = sal_uInt16(-1); // insert before the first page } else { @@ -887,7 +887,7 @@ IMPL_LINK( OutlineView, EndMovingHdl, ::Outliner *, pOutliner, void ) mrDoc.MovePages(nPos); // deselect the pages again - sal_uInt16 nPageCount = (sal_uInt16)maSelectedParas.size(); + sal_uInt16 nPageCount = static_cast<sal_uInt16>(maSelectedParas.size()); while (nPageCount) { SdPage* pPage = mrDoc.GetSdPage(nPosNewOrder, PageKind::Standard); @@ -1219,8 +1219,8 @@ SdPage* OutlineView::GetPageForParagraph( Paragraph* pPara ) nPageToSelect++; } - if( nPageToSelect < (sal_uInt32)mrDoc.GetSdPageCount( PageKind::Standard ) ) - return mrDoc.GetSdPage( (sal_uInt16)nPageToSelect, PageKind::Standard ); + if( nPageToSelect < static_cast<sal_uInt32>(mrDoc.GetSdPageCount( PageKind::Standard )) ) + return mrDoc.GetSdPage( static_cast<sal_uInt16>(nPageToSelect), PageKind::Standard ); return nullptr; } @@ -1491,7 +1491,7 @@ void OutlineView::UpdateDocument() sal_uInt32 nPage; for (nPage = 0; nPage < nPageCount; nPage++) { - SdPage* pPage = mrDoc.GetSdPage( (sal_uInt16)nPage, PageKind::Standard); + SdPage* pPage = mrDoc.GetSdPage( static_cast<sal_uInt16>(nPage), PageKind::Standard); mrDoc.SetSelected(pPage, false); mrOutlineViewShell.UpdateTitleObject( pPage, pPara ); @@ -1609,7 +1609,7 @@ IMPL_LINK(OutlineView, PaintingFirstLineHdl, PaintFirstLineInfo*, pInfo, void) nPage++; } - long nBulletHeight = (long)mrOutliner.GetLineHeight( pInfo->mnPara ); + long nBulletHeight = static_cast<long>(mrOutliner.GetLineHeight( pInfo->mnPara )); long nFontHeight = 0; if ( !rEditEngine.IsFlatMode() ) { @@ -1624,13 +1624,13 @@ IMPL_LINK(OutlineView, PaintingFirstLineHdl, PaintFirstLineInfo*, pInfo, void) Size aOutSize( 2000, nBulletHeight ); - const float fImageHeight = ((float)aOutSize.Height() * (float)4) / (float)7; + const float fImageHeight = (static_cast<float>(aOutSize.Height()) * float(4)) / float(7); if (aImageSize.Width() != 0) { - const float fImageRatio = (float)aImageSize.Height() / (float)aImageSize.Width(); - aImageSize.Width() = (long)( fImageRatio * fImageHeight ); + const float fImageRatio = static_cast<float>(aImageSize.Height()) / static_cast<float>(aImageSize.Width()); + aImageSize.Width() = static_cast<long>( fImageRatio * fImageHeight ); } - aImageSize.Height() = (long)fImageHeight; + aImageSize.Height() = static_cast<long>(fImageHeight); Point aImagePos( pInfo->mrStartPos ); aImagePos.X() += aOutSize.Width() - aImageSize.Width() - aOffset.Width() ; diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index 28c80e6204b0..f8412e84496b 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -1348,7 +1348,7 @@ void View::ChangeMarkedObjectsBulletsNumbering( pOutlinerView->ApplyBulletsNumbering( bHandleBullets, pNumRule, bToggle ); } sal_uInt32 nParaCount = pOutliner->GetParagraphCount(); - pText->SetOutlinerParaObject(pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount)); + pText->SetOutlinerParaObject(pOutliner->CreateParaObject(0, static_cast<sal_uInt16>(nParaCount))); pOutliner->Clear(); } } @@ -1379,7 +1379,7 @@ void View::ChangeMarkedObjectsBulletsNumbering( pOutlinerView->ApplyBulletsNumbering( bHandleBullets, pNumRule, bToggle ); } sal_uInt32 nParaCount = pOutliner->GetParagraphCount(); - pTextObj->SetOutlinerParaObject(pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount)); + pTextObj->SetOutlinerParaObject(pOutliner->CreateParaObject(0, static_cast<sal_uInt16>(nParaCount))); pOutliner->Clear(); } } diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index dd41e3a505f4..fdc7237974be 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -657,10 +657,10 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, // delete pages, that are not of any interest for us for( long i = ( pWorkModel->GetPageCount() - 1 ); i >= 0; i-- ) { - SdPage* pP = static_cast< SdPage* >( pWorkModel->GetPage( (sal_uInt16) i ) ); + SdPage* pP = static_cast< SdPage* >( pWorkModel->GetPage( static_cast<sal_uInt16>(i) ) ); if( pP->GetPageKind() != PageKind::Standard ) - pWorkModel->DeletePage( (sal_uInt16) i ); + pWorkModel->DeletePage( static_cast<sal_uInt16>(i) ); } bReturn = Paste(*pWorkModel, maDropPos, pPage, nPasteOptions); @@ -900,10 +900,10 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, // delete pages, that are not of any interest for us for( long i = ( pModel->GetPageCount() - 1 ); i >= 0; i-- ) { - SdPage* pP = static_cast< SdPage* >( pModel->GetPage( (sal_uInt16) i ) ); + SdPage* pP = static_cast< SdPage* >( pModel->GetPage( static_cast<sal_uInt16>(i) ) ); if( pP->GetPageKind() != PageKind::Standard ) - pModel->DeletePage( (sal_uInt16) i ); + pModel->DeletePage( static_cast<sal_uInt16>(i) ); } bReturn = Paste(*pModel, maDropPos, pPage, nPasteOptions); @@ -1344,8 +1344,8 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, SfxItemSet aSet( mrDoc.GetPool() ); bool bClosed = pPickObj->IsClosedObj(); ::sd::Window* pWin = mpViewSh->GetActiveWindow(); - sal_uInt16 nHitLog = (sal_uInt16) pWin->PixelToLogic( - Size(FuPoor::HITPIX, 0 ) ).Width(); + sal_uInt16 nHitLog = static_cast<sal_uInt16>(pWin->PixelToLogic( + Size(FuPoor::HITPIX, 0 ) ).Width()); const long n2HitLog = nHitLog << 1; Point aHitPosR( rPos ); Point aHitPosL( rPos ); diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index c46be7b78302..f916769b4f9c 100644 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -156,34 +156,34 @@ void Window::CalcMinZoom() // area (also called application area) to completely fill the // window. Size aWinSize = PixelToLogic(GetOutputSizePixel()); - sal_uLong nX = (sal_uLong) ((double) aWinSize.Width() - * (double) ZOOM_MULTIPLICATOR / (double) maViewSize.Width()); - sal_uLong nY = (sal_uLong) ((double) aWinSize.Height() - * (double) ZOOM_MULTIPLICATOR / (double) maViewSize.Height()); + sal_uLong nX = static_cast<sal_uLong>(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()) + * 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); // The factor is transformed according to the current zoom factor. nFact = nFact * nZoom / ZOOM_MULTIPLICATOR; - mnMinZoom = std::max((sal_uInt16) MIN_ZOOM, (sal_uInt16) nFact); + mnMinZoom = std::max(sal_uInt16(MIN_ZOOM), static_cast<sal_uInt16>(nFact)); } // If the current zoom factor is smaller than the calculated minimal // zoom factor then set the new minimal factor as the current zoom // factor. - if ( nZoom < (long) mnMinZoom ) + if ( nZoom < static_cast<long>(mnMinZoom) ) SetZoomFactor(mnMinZoom); } } void Window::SetMinZoom (long int nMin) { - mnMinZoom = (sal_uInt16) nMin; + mnMinZoom = static_cast<sal_uInt16>(nMin); } void Window::SetMaxZoom (long int nMax) { - mnMaxZoom = (sal_uInt16) nMax; + mnMaxZoom = static_cast<sal_uInt16>(nMax); } long Window::GetZoom() const @@ -333,7 +333,7 @@ long Window::SetZoomFactor(long nZoom) // calculated by CalcMinZoom() and the constant MAX_ZOOM. if ( nZoom > MAX_ZOOM ) nZoom = MAX_ZOOM; - if ( nZoom < (long) mnMinZoom ) + if ( nZoom < static_cast<long>(mnMinZoom) ) nZoom = mnMinZoom; // Set the zoom factor at the window's map mode. @@ -368,7 +368,7 @@ void Window::SetZoomIntegral(long nZoom) // MAX_ZOOM constant. if ( nZoom > MAX_ZOOM ) nZoom = MAX_ZOOM; - if ( nZoom < (long) mnMinZoom ) + if ( nZoom < static_cast<long>(mnMinZoom) ) nZoom = mnMinZoom; // Calculate the window's new origin. @@ -401,14 +401,14 @@ long Window::GetZoomForRect( const ::tools::Rectangle& rZoomRect ) const Size aWinSize( PixelToLogic(GetOutputSizePixel()) ); if(rZoomRect.GetHeight()) { - nX = (sal_uLong) ((double) aWinSize.Height() - * (double) ZOOM_MULTIPLICATOR / (double) rZoomRect.GetHeight()); + nX = static_cast<sal_uLong>(static_cast<double>(aWinSize.Height()) + * double(ZOOM_MULTIPLICATOR) / static_cast<double>(rZoomRect.GetHeight())); } if(rZoomRect.GetWidth()) { - nY = (sal_uLong) ((double) aWinSize.Width() - * (double) ZOOM_MULTIPLICATOR / (double) rZoomRect.GetWidth()); + nY = static_cast<sal_uLong>(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 @@ -432,7 +432,7 @@ long Window::GetZoomForRect( const ::tools::Rectangle& rZoomRect ) // MAX_ZOOM constant. if ( nRetZoom > MAX_ZOOM ) nRetZoom = MAX_ZOOM; - if ( nRetZoom < (long) mnMinZoom ) + if ( nRetZoom < static_cast<long>(mnMinZoom) ) nRetZoom = mnMinZoom; } } @@ -474,14 +474,14 @@ long Window::SetZoomRect (const ::tools::Rectangle& rZoomRect) if(rZoomRect.GetHeight()) { - nX = (sal_uLong) ((double) aWinSize.Height() - * (double) ZOOM_MULTIPLICATOR / (double) rZoomRect.GetHeight()); + nX = static_cast<sal_uLong>(static_cast<double>(aWinSize.Height()) + * double(ZOOM_MULTIPLICATOR) / static_cast<double>(rZoomRect.GetHeight())); } if(rZoomRect.GetWidth()) { - nY = (sal_uLong) ((double) aWinSize.Width() - * (double) ZOOM_MULTIPLICATOR / (double) rZoomRect.GetWidth()); + nY = static_cast<sal_uLong>(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 @@ -507,9 +507,9 @@ long Window::SetZoomRect (const ::tools::Rectangle& rZoomRect) maWinPos = maViewOrigin + aPos; - aWinSize.Width() = (long) ((double) aWinSize.Width() * (double) ZOOM_MULTIPLICATOR / (double) nFact); + aWinSize.Width() = static_cast<long>(static_cast<double>(aWinSize.Width()) * double(ZOOM_MULTIPLICATOR) / static_cast<double>(nFact)); maWinPos.X() += (rZoomRect.GetWidth() - aWinSize.Width()) / 2; - aWinSize.Height() = (long) ((double) aWinSize.Height() * (double) ZOOM_MULTIPLICATOR / (double) nFact); + aWinSize.Height() = static_cast<long>(static_cast<double>(aWinSize.Height()) * double(ZOOM_MULTIPLICATOR) / static_cast<double>(nFact)); maWinPos.Y() += (rZoomRect.GetHeight() - aWinSize.Height()) / 2; if ( maWinPos.X() < 0 ) maWinPos.X() = 0; @@ -630,7 +630,7 @@ void Window::UpdateMapMode() */ double Window::GetVisibleX() { - return ((double) maWinPos.X() / maViewSize.Width()); + return (static_cast<double>(maWinPos.X()) / maViewSize.Width()); } /** @@ -639,7 +639,7 @@ double Window::GetVisibleX() */ double Window::GetVisibleY() { - return ((double) maWinPos.Y() / maViewSize.Height()); + return (static_cast<double>(maWinPos.Y()) / maViewSize.Height()); } /** @@ -652,9 +652,9 @@ void Window::SetVisibleXY(double fX, double fY) long nOldY = maWinPos.Y(); if ( fX >= 0 ) - maWinPos.X() = (long) (fX * maViewSize.Width()); + maWinPos.X() = static_cast<long>(fX * maViewSize.Width()); if ( fY >= 0 ) - maWinPos.Y() = (long) (fY * maViewSize.Height()); + maWinPos.Y() = static_cast<long>(fY * maViewSize.Height()); UpdateMapOrigin(false); Scroll(nOldX - maWinPos.X(), nOldY - maWinPos.Y(), ScrollFlags::Children); Update(); @@ -669,7 +669,7 @@ double Window::GetVisibleWidth() Size aWinSize = PixelToLogic(GetOutputSizePixel()); if ( aWinSize.Width() > maViewSize.Width() ) aWinSize.Width() = maViewSize.Width(); - return ((double) aWinSize.Width() / maViewSize.Width()); + return (static_cast<double>(aWinSize.Width()) / maViewSize.Width()); } /** @@ -681,7 +681,7 @@ double Window::GetVisibleHeight() Size aWinSize = PixelToLogic(GetOutputSizePixel()); if ( aWinSize.Height() > maViewSize.Height() ) aWinSize.Height() = maViewSize.Height(); - return ((double) aWinSize.Height() / maViewSize.Height()); + return (static_cast<double>(aWinSize.Height()) / maViewSize.Height()); } /** diff --git a/sd/source/ui/view/tabcontr.cxx b/sd/source/ui/view/tabcontr.cxx index 390f30b0fd24..c1d9398d77a8 100644 --- a/sd/source/ui/view/tabcontr.cxx +++ b/sd/source/ui/view/tabcontr.cxx @@ -196,9 +196,9 @@ sal_Int8 TabControl::AcceptDrop( const AcceptDropEvent& rEvt ) sal_Int32 nPageId = GetPageId( aPos ) - 1; - if( ( nPageId >= 0 ) && pDoc->GetPage( (sal_uInt16)nPageId ) ) + if( ( nPageId >= 0 ) && pDoc->GetPage( static_cast<sal_uInt16>(nPageId) ) ) { - nRet = pDrViewSh->AcceptDrop( rEvt, *this, nullptr, (sal_uInt16)nPageId, SDRLAYER_NOTFOUND ); + nRet = pDrViewSh->AcceptDrop( rEvt, *this, nullptr, static_cast<sal_uInt16>(nPageId), SDRLAYER_NOTFOUND ); SwitchPage( aPos ); } } @@ -245,14 +245,14 @@ sal_Int8 TabControl::ExecuteDrop( const ExecuteDropEvent& rEvt ) // Adapt target page id when necessary, i.e. page copy // has been inserted in front of the target page. sal_uInt16 nPageNum = nPageId; - if ((nPageNumOfCopy <= nPageNum) && (nPageNum != (sal_uInt16)-1)) + if ((nPageNumOfCopy <= nPageNum) && (nPageNum != sal_uInt16(-1))) nPageNum += 1; if (pDoc->MovePages(nPageNum)) { // 3. Switch to the copy that has been moved to its // final destination. Use an asynchron slot call to // be executed after the still pending ones. - if (nPageNumOfCopy >= nPageNum || (nPageNum == (sal_uInt16)-1)) + if (nPageNumOfCopy >= nPageNum || (nPageNum == sal_uInt16(-1))) nPageNum += 1; SetCurPageId (GetPageId(nPageNum)); SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher(); @@ -271,9 +271,9 @@ sal_Int8 TabControl::ExecuteDrop( const ExecuteDropEvent& rEvt ) { sal_Int32 nPageId = GetPageId( aPos ) - 1; - if( ( nPageId >= 0 ) && pDoc->GetPage( (sal_uInt16)nPageId ) ) + if( ( nPageId >= 0 ) && pDoc->GetPage( static_cast<sal_uInt16>(nPageId) ) ) { - nRet = pDrViewSh->ExecuteDrop( rEvt, *this, nullptr, (sal_uInt16)nPageId, SDRLAYER_NOTFOUND ); + nRet = pDrViewSh->ExecuteDrop( rEvt, *this, nullptr, static_cast<sal_uInt16>(nPageId), SDRLAYER_NOTFOUND ); } } diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx index 78d6cd13f4db..28addf16c480 100644 --- a/sd/source/ui/view/viewshe2.cxx +++ b/sd/source/ui/view/viewshe2.cxx @@ -84,21 +84,21 @@ void ViewShell::UpdateScrollBars() { if (mpHorizontalScrollBar.get() != nullptr) { - long nW = (long)(mpContentWindow->GetVisibleWidth() * 32000); - long nX = (long)(mpContentWindow->GetVisibleX() * 32000); + long nW = static_cast<long>(mpContentWindow->GetVisibleWidth() * 32000); + long nX = static_cast<long>(mpContentWindow->GetVisibleX() * 32000); mpHorizontalScrollBar->SetVisibleSize(nW); mpHorizontalScrollBar->SetThumbPos(nX); nW = 32000 - nW; - long nLine = (long) (mpContentWindow->GetScrlLineWidth() * nW); - long nPage = (long) (mpContentWindow->GetScrlPageWidth() * nW); + long nLine = static_cast<long>(mpContentWindow->GetScrlLineWidth() * nW); + long nPage = static_cast<long>(mpContentWindow->GetScrlPageWidth() * nW); mpHorizontalScrollBar->SetLineSize(nLine); mpHorizontalScrollBar->SetPageSize(nPage); } if (mpVerticalScrollBar.get() != nullptr) { - long nH = (long)(mpContentWindow->GetVisibleHeight() * 32000); - long nY = (long)(mpContentWindow->GetVisibleY() * 32000); + long nH = static_cast<long>(mpContentWindow->GetVisibleHeight() * 32000); + long nY = static_cast<long>(mpContentWindow->GetVisibleY() * 32000); if(IsPageFlipMode()) // ie in zoom mode where no panning { @@ -117,8 +117,8 @@ void ViewShell::UpdateScrollBars() mpVerticalScrollBar->SetVisibleSize(nH); mpVerticalScrollBar->SetThumbPos(nY); nH = 32000 - nH; - long nLine = (long) (mpContentWindow->GetScrlLineHeight() * nH); - long nPage = (long) (mpContentWindow->GetScrlPageHeight() * nH); + long nLine = static_cast<long>(mpContentWindow->GetScrlLineHeight() * nH); + long nPage = static_cast<long>(mpContentWindow->GetScrlPageHeight() * nH); mpVerticalScrollBar->SetLineSize(nLine); mpVerticalScrollBar->SetPageSize(nPage); } @@ -148,7 +148,7 @@ void ViewShell::VirtHScrollHdl(ScrollBar* pHScroll) if (nDelta != 0) { - double fX = (double) pHScroll->GetThumbPos() / pHScroll->GetRange().Len(); + double fX = static_cast<double>(pHScroll->GetThumbPos()) / pHScroll->GetRange().Len(); // scroll all windows of the column ::sd::View* pView = GetView(); @@ -202,13 +202,13 @@ void ViewShell::VirtVScrollHdl(ScrollBar* pVScroll) { SdPage* pPage = static_cast<DrawViewShell*>(this)->GetActualPage(); sal_uInt16 nCurPage = (pPage->GetPageNum() - 1) >> 1; - sal_uInt16 nNewPage = (sal_uInt16)pVScroll->GetThumbPos()/256; + sal_uInt16 nNewPage = static_cast<sal_uInt16>(pVScroll->GetThumbPos())/256; if( nCurPage != nNewPage ) static_cast<DrawViewShell*>(this)->SwitchPage(nNewPage); } else //panning mode { - double fY = (double) pVScroll->GetThumbPos() / pVScroll->GetRange().Len(); + double fY = static_cast<double>(pVScroll->GetThumbPos()) / pVScroll->GetRange().Len(); ::sd::View* pView = GetView(); OutlinerView* pOLV = nullptr; @@ -292,9 +292,9 @@ void ViewShell::Scroll(long nScrollX, long nScrollY) long nNewThumb = mpVerticalScrollBar->GetThumbPos() + nScrollY; mpVerticalScrollBar->SetThumbPos(nNewThumb); } - double fX = (double) mpHorizontalScrollBar->GetThumbPos() / + double fX = static_cast<double>(mpHorizontalScrollBar->GetThumbPos()) / mpHorizontalScrollBar->GetRange().Len(); - double fY = (double) mpVerticalScrollBar->GetThumbPos() / + double fY = static_cast<double>(mpVerticalScrollBar->GetThumbPos()) / mpVerticalScrollBar->GetRange().Len(); GetActiveWindow()->SetVisibleXY(fX, fY); @@ -632,7 +632,7 @@ void ViewShell::SetPageSizeAndBorder(PageKind ePageKind, const Size& rNewSize, */ void ViewShell::SetZoomFactor(const Fraction& rZoomX, const Fraction&) { - long nZoom = (long)((double) rZoomX * 100); + long nZoom = static_cast<long>(static_cast<double>(rZoomX) * 100); SetZoom(nZoom); } diff --git a/sd/source/ui/view/viewshe3.cxx b/sd/source/ui/view/viewshe3.cxx index f209ecf79827..045c5486f88b 100644 --- a/sd/source/ui/view/viewshe3.cxx +++ b/sd/source/ui/view/viewshe3.cxx @@ -352,7 +352,7 @@ SdPage* ViewShell::CreateOrDuplicatePage ( i == nNewPageIndex); } // Move the selected page to the head of the document - pDocument->MovePages ((sal_uInt16)-1); + pDocument->MovePages (sal_uInt16(-1)); nNewPageIndex = 0; } else |