From f6e256c4825a6d7c9d7125a4100c10f8c4de750a Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 12 Jan 2018 20:26:08 +0100 Subject: More loplugin:cstylecast: cui auto-rewrite with "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: I04b0e0c0268cbcc1c7e7ff2174c5125785e09a07 --- cui/source/customize/SvxToolbarConfigPage.cxx | 4 +- cui/source/customize/cfgutil.cxx | 2 +- cui/source/customize/macropg.cxx | 2 +- cui/source/dialogs/SpellDialog.cxx | 20 +++--- cui/source/dialogs/colorpicker.cxx | 38 +++++------ cui/source/dialogs/cuicharmap.cxx | 2 +- cui/source/dialogs/cuifmsearch.cxx | 8 +-- cui/source/dialogs/cuigaldlg.cxx | 8 +-- cui/source/dialogs/cuigrfflt.cxx | 16 ++--- cui/source/dialogs/hangulhanjadlg.cxx | 2 +- cui/source/dialogs/insdlg.cxx | 4 +- cui/source/dialogs/multipat.cxx | 2 +- cui/source/dialogs/showcols.cxx | 2 +- cui/source/dialogs/srchxtra.cxx | 2 +- cui/source/inc/optlingu.hxx | 2 +- cui/source/inc/srchxtra.hxx | 6 +- cui/source/options/optaboutconfig.cxx | 4 +- cui/source/options/optctl.cxx | 2 +- cui/source/options/optdict.cxx | 4 +- cui/source/options/optgdlg.cxx | 6 +- cui/source/options/optgenrl.cxx | 4 +- cui/source/options/opthtml.cxx | 14 ++-- cui/source/options/optinet2.cxx | 4 +- cui/source/options/optlingu.cxx | 94 +++++++++++++-------------- cui/source/options/optpath.cxx | 4 +- cui/source/options/optsave.cxx | 2 +- cui/source/options/optupdt.cxx | 2 +- cui/source/options/treeopt.cxx | 38 +++++------ cui/source/options/webconninfo.cxx | 4 +- cui/source/tabpages/autocdlg.cxx | 16 ++--- cui/source/tabpages/border.cxx | 8 +-- cui/source/tabpages/chardlg.cxx | 64 +++++++++--------- cui/source/tabpages/grfpage.cxx | 16 ++--- cui/source/tabpages/labdlg.cxx | 2 +- cui/source/tabpages/measure.cxx | 6 +- cui/source/tabpages/numfmt.cxx | 36 +++++----- cui/source/tabpages/numpages.cxx | 58 ++++++++--------- cui/source/tabpages/page.cxx | 38 +++++------ cui/source/tabpages/paragrph.cxx | 46 ++++++------- cui/source/tabpages/swpossizetabpage.cxx | 16 ++--- cui/source/tabpages/tabstpge.cxx | 8 +-- cui/source/tabpages/textanim.cxx | 12 ++-- cui/source/tabpages/tpbitmap.cxx | 4 +- cui/source/tabpages/tpcolor.cxx | 30 ++++----- cui/source/tabpages/tpgradnt.cxx | 50 +++++++------- cui/source/tabpages/tpline.cxx | 38 +++++------ cui/source/tabpages/tplnedef.cxx | 4 +- cui/source/tabpages/tpshadow.cxx | 4 +- cui/source/tabpages/tptrans.cxx | 32 ++++----- cui/source/tabpages/transfrm.cxx | 36 +++++----- 50 files changed, 413 insertions(+), 413 deletions(-) (limited to 'cui/source') diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx index eeb2912ba56a..d63d2f9f39c5 100644 --- a/cui/source/customize/SvxToolbarConfigPage.cxx +++ b/cui/source/customize/SvxToolbarConfigPage.cxx @@ -873,8 +873,8 @@ Image SvxToolbarEntriesListBox::GetSizedImage( // Position image at the center of (width-2),(height) rectangle. // We need 2 pixels to have a bigger border to the next button image - sal_uInt16 nPosX = std::max( (sal_uInt16) (((( aNewSize.Width() - 2 ) - aImage.GetSizePixel().Width() ) / 2 ) - 1), (sal_uInt16) 0 ); - sal_uInt16 nPosY = std::max( (sal_uInt16) (((( aNewSize.Height() - 2 ) - aImage.GetSizePixel().Height() ) / 2 ) + 1), (sal_uInt16) 0 ); + sal_uInt16 nPosX = std::max( static_cast(((( aNewSize.Width() - 2 ) - aImage.GetSizePixel().Width() ) / 2 ) - 1), sal_uInt16(0) ); + sal_uInt16 nPosY = std::max( static_cast(((( aNewSize.Height() - 2 ) - aImage.GetSizePixel().Height() ) / 2 ) + 1), sal_uInt16(0) ); Point aPos( std::max(nPosX, 0), std::max(nPosY, 0) ); rVDev.SetFillColor( aFillColor ); rVDev.SetLineColor( aFillColor ); diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx index e033e155b099..9c200c4b3311 100644 --- a/cui/source/customize/cfgutil.cxx +++ b/cui/source/customize/cfgutil.cxx @@ -1012,7 +1012,7 @@ bool SfxConfigGroupListBox::Expand( SvTreeListEntry* pParent ) } if ( nParentPos + nChildCount + 1 > nEntries ) - ScrollOutputArea( (short)( nEntries - ( nParentPos + nChildCount + 1 ) ) ); + ScrollOutputArea( static_cast( nEntries - ( nParentPos + nChildCount + 1 ) ) ); } } diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx index 7d12fcb83e42..14efa4bb1ed4 100644 --- a/cui/source/customize/macropg.cxx +++ b/cui/source/customize/macropg.cxx @@ -822,7 +822,7 @@ SvxMacroTabPage::SvxMacroTabPage(vcl::Window* pParent, InitAndSetHandler( xNameReplace, Reference< container::XNameReplace>(nullptr), Reference< util::XModifiable >(nullptr)); DisplayAppEvents(true); SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox(); - SvTreeListEntry* pE = rListBox.GetEntry( (sal_uLong)nSelectedIndex ); + SvTreeListEntry* pE = rListBox.GetEntry( static_cast(nSelectedIndex) ); if( pE ) rListBox.Select(pE); } diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index b534fca78cba..db126849cb4c 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -658,7 +658,7 @@ IMPL_LINK( SpellDialog, DialogUndoHdl, SpellUndoAction_Impl&, rAction, void ) break; case SPELLUNDO_CHANGE_NEXTERROR: { - m_pSentenceED->MoveErrorMarkTo((sal_uInt16)rAction.GetOldErrorStart(), (sal_uInt16)rAction.GetOldErrorEnd(), false); + m_pSentenceED->MoveErrorMarkTo(static_cast(rAction.GetOldErrorStart()), static_cast(rAction.GetOldErrorEnd()), false); if(rAction.IsErrorLanguageSelected()) { UpdateBoxes_Impl(); @@ -752,7 +752,7 @@ IMPL_LINK(SpellDialog, LanguageSelectHdl, ListBox&, rBox, void) if(!sError.isEmpty()) { LanguageType eLanguage = static_cast(&rBox)->GetSelectLanguage(); - Reference xAlt = xSpell->spell( sError, (sal_uInt16)eLanguage, + Reference xAlt = xSpell->spell( sError, static_cast(eLanguage), Sequence< PropertyValue >() ); if( xAlt.is() ) m_pSentenceED->SetAlternatives( xAlt ); @@ -1583,7 +1583,7 @@ bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError, const css aCursor.GetIndex() += xEntry->getReplacementText().getLength(); // maybe the error found here is already added to the dictionary and has to be ignored - } else if(pSpellErrorDescription && !bGrammarError && xSpell->isValid( GetErrorText(), (sal_uInt16)LanguageTag::convertToLanguageType( pSpellErrorDescription->aLocale ), Sequence< PropertyValue >() )) { + } else if(pSpellErrorDescription && !bGrammarError && xSpell->isValid( GetErrorText(), static_cast(LanguageTag::convertToLanguageType( pSpellErrorDescription->aLocale )), Sequence< PropertyValue >() )) { ++aCursor.GetIndex(); } else @@ -1625,8 +1625,8 @@ bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError, const css void SentenceEditWindow_Impl::MoveErrorMarkTo(sal_Int32 nStart, sal_Int32 nEnd, bool bGrammarError) { TextEngine* pTextEngine = GetTextEngine(); - pTextEngine->RemoveAttribs( 0, (sal_uInt16)TEXTATTR_FONTCOLOR ); - pTextEngine->RemoveAttribs( 0, (sal_uInt16)TEXTATTR_FONTWEIGHT ); + pTextEngine->RemoveAttribs( 0, sal_uInt16(TEXTATTR_FONTCOLOR) ); + pTextEngine->RemoveAttribs( 0, sal_uInt16(TEXTATTR_FONTWEIGHT) ); pTextEngine->SetAttrib( TextAttribFontWeight(WEIGHT_BOLD), 0, nStart, nEnd ); pTextEngine->SetAttrib( TextAttribFontColor(bGrammarError ? COL_LIGHTBLUE : COL_LIGHTRED), 0, nStart, nEnd ); m_nErrorStart = nStart; @@ -1686,7 +1686,7 @@ void SentenceEditWindow_Impl::ChangeMarkedWord(const OUString& rNewWord, Languag //adjust end position long nEndTemp = m_nErrorEnd; nEndTemp += nDiffLen; - m_nErrorEnd = (sal_uInt16)nEndTemp; + m_nErrorEnd = static_cast(nEndTemp); SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl( SPELLUNDO_MOVE_ERROREND, GetSpellDialog()->aDialogUndoLink); @@ -1960,9 +1960,9 @@ void SentenceEditWindow_Impl::UndoActionEnd() void SentenceEditWindow_Impl::MoveErrorEnd(long nOffset) { if(nOffset > 0) - m_nErrorEnd = m_nErrorEnd - (sal_uInt16)nOffset; + m_nErrorEnd = m_nErrorEnd - static_cast(nOffset); else - m_nErrorEnd = m_nErrorEnd -(sal_uInt16)- nOffset; + m_nErrorEnd = m_nErrorEnd -static_cast(- nOffset); } @@ -1997,8 +1997,8 @@ void SentenceEditWindow_Impl::SetUndoEditMode(bool bSet) //remove error marks TextEngine* pTextEngine = GetTextEngine(); - pTextEngine->RemoveAttribs( 0, (sal_uInt16)TEXTATTR_FONTCOLOR ); - pTextEngine->RemoveAttribs( 0, (sal_uInt16)TEXTATTR_FONTWEIGHT ); + pTextEngine->RemoveAttribs( 0, sal_uInt16(TEXTATTR_FONTCOLOR) ); + pTextEngine->RemoveAttribs( 0, sal_uInt16(TEXTATTR_FONTWEIGHT) ); //put the appropriate action on the Undo-stack SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl( diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx index 8431201742fd..687e44677825 100644 --- a/cui/source/dialogs/colorpicker.cxx +++ b/cui/source/dialogs/colorpicker.cxx @@ -707,7 +707,7 @@ void ColorSliderControl::UpdateBitmap() case RED: for (long y = 0; y <= nY; y++) { - aBitmapColor.SetRed(sal_uInt8(((long)255 * y) / nY)); + aBitmapColor.SetRed(sal_uInt8((long(255) * y) / nY)); pWriteAccess->SetPixel(nY - y, 0, aBitmapColor); } break; @@ -715,7 +715,7 @@ void ColorSliderControl::UpdateBitmap() case GREEN: for (long y = 0; y <= nY; y++) { - aBitmapColor.SetGreen(sal_uInt8(((long)255 * y) / nY)); + aBitmapColor.SetGreen(sal_uInt8((long(255) * y) / nY)); pWriteAccess->SetPixel(nY - y, 0, aBitmapColor); } break; @@ -723,7 +723,7 @@ void ColorSliderControl::UpdateBitmap() case BLUE: for (long y = 0; y <= nY; y++) { - aBitmapColor.SetBlue(sal_uInt8(((long)255 * y) / nY)); + aBitmapColor.SetBlue(sal_uInt8((long(255) * y) / nY)); pWriteAccess->SetPixel(nY - y, 0, aBitmapColor); } break; @@ -996,9 +996,9 @@ ColorPickerDialog::ColorPickerDialog( vcl::Window* pParent, sal_Int32 nColor, sa mpColorPrevious->Show(); } - mdRed = ((double)aColor.GetRed()) / 255.0; - mdGreen = ((double)aColor.GetGreen()) / 255.0; - mdBlue = ((double)aColor.GetBlue()) / 255.0; + mdRed = static_cast(aColor.GetRed()) / 255.0; + mdGreen = static_cast(aColor.GetGreen()) / 255.0; + mdBlue = static_cast(aColor.GetBlue()) / 255.0; RGBtoHSV( mdRed, mdGreen, mdBlue, mdHue, mdSat, mdBri ); RGBtoCMYK( mdRed, mdGreen, mdBlue, mdCyan, mdMagenta, mdYellow, mdKey ); @@ -1215,52 +1215,52 @@ IMPL_LINK(ColorPickerDialog, ColorModifyEditHdl, Edit&, rEdit, void) if (&rEdit == mpMFRed) { - setColorComponent( ColorComponent::Red, ((double)mpMFRed->GetValue()) / 255.0 ); + setColorComponent( ColorComponent::Red, static_cast(mpMFRed->GetValue()) / 255.0 ); n = UpdateFlags::All & ~UpdateFlags::RGB; } else if (&rEdit == mpMFGreen) { - setColorComponent( ColorComponent::Green, ((double)mpMFGreen->GetValue()) / 255.0 ); + setColorComponent( ColorComponent::Green, static_cast(mpMFGreen->GetValue()) / 255.0 ); n = UpdateFlags::All & ~UpdateFlags::RGB; } else if (&rEdit == mpMFBlue) { - setColorComponent( ColorComponent::Blue, ((double)mpMFBlue->GetValue()) / 255.0 ); + setColorComponent( ColorComponent::Blue, static_cast(mpMFBlue->GetValue()) / 255.0 ); n = UpdateFlags::All & ~UpdateFlags::RGB; } else if (&rEdit == mpMFHue) { - setColorComponent( ColorComponent::Hue, (double)mpMFHue->GetValue() ); + setColorComponent( ColorComponent::Hue, static_cast(mpMFHue->GetValue()) ); n = UpdateFlags::All & ~UpdateFlags::HSB; } else if (&rEdit == mpMFSaturation) { - setColorComponent( ColorComponent::Saturation, ((double)mpMFSaturation->GetValue()) / 100.0 ); + setColorComponent( ColorComponent::Saturation, static_cast(mpMFSaturation->GetValue()) / 100.0 ); n = UpdateFlags::All & ~UpdateFlags::HSB; } else if (&rEdit == mpMFBrightness) { - setColorComponent( ColorComponent::Brightness, ((double)mpMFBrightness->GetValue()) / 100.0 ); + setColorComponent( ColorComponent::Brightness, static_cast(mpMFBrightness->GetValue()) / 100.0 ); n = UpdateFlags::All & ~UpdateFlags::HSB; } else if (&rEdit == mpMFCyan) { - setColorComponent( ColorComponent::Cyan, ((double)mpMFCyan->GetValue()) / 100.0 ); + setColorComponent( ColorComponent::Cyan, static_cast(mpMFCyan->GetValue()) / 100.0 ); n = UpdateFlags::All & ~UpdateFlags::CMYK; } else if (&rEdit == mpMFMagenta) { - setColorComponent( ColorComponent::Magenta, ((double)mpMFMagenta->GetValue()) / 100.0 ); + setColorComponent( ColorComponent::Magenta, static_cast(mpMFMagenta->GetValue()) / 100.0 ); n = UpdateFlags::All & ~UpdateFlags::CMYK; } else if (&rEdit == mpMFYellow) { - setColorComponent( ColorComponent::Yellow, ((double)mpMFYellow->GetValue()) / 100.0 ); + setColorComponent( ColorComponent::Yellow, static_cast(mpMFYellow->GetValue()) / 100.0 ); n = UpdateFlags::All & ~UpdateFlags::CMYK; } else if (&rEdit == mpMFKey) { - setColorComponent( ColorComponent::Key, ((double)mpMFKey->GetValue()) / 100.0 ); + setColorComponent( ColorComponent::Key, static_cast(mpMFKey->GetValue()) / 100.0 ); n = UpdateFlags::All & ~UpdateFlags::CMYK; } else if (&rEdit == mpEDHex) @@ -1273,9 +1273,9 @@ IMPL_LINK(ColorPickerDialog, ColorModifyEditHdl, Edit&, rEdit, void) if (aColor != GetColor()) { - mdRed = ((double)aColor.GetRed()) / 255.0; - mdGreen = ((double)aColor.GetGreen()) / 255.0; - mdBlue = ((double)aColor.GetBlue()) / 255.0; + mdRed = static_cast(aColor.GetRed()) / 255.0; + mdGreen = static_cast(aColor.GetGreen()) / 255.0; + mdBlue = static_cast(aColor.GetBlue()) / 255.0; RGBtoHSV( mdRed, mdGreen, mdBlue, mdHue, mdSat, mdBri ); RGBtoCMYK( mdRed, mdGreen, mdBlue, mdCyan, mdMagenta, mdYellow, mdKey ); diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx index c01af450b5f8..ef849a56f8d6 100644 --- a/cui/source/dialogs/cuicharmap.cxx +++ b/cui/source/dialogs/cuicharmap.cxx @@ -640,7 +640,7 @@ void SvxCharacterMap::insertCharToDoc(const OUString& sGlyph) IMPL_LINK_NOARG(SvxCharacterMap, FontSelectHdl, ListBox&, void) { const sal_Int32 nPos = m_pFontLB->GetSelectedEntryPos(); - const sal_uInt16 nFont = (sal_uInt16)reinterpret_cast(m_pFontLB->GetEntryData( nPos )); + const sal_uInt16 nFont = static_cast(reinterpret_cast(m_pFontLB->GetEntryData( nPos ))); aFont = GetDevFont( nFont ); aFont.SetWeight( WEIGHT_DONTKNOW ); aFont.SetItalic( ITALIC_NONE ); diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx index 738698756d53..8c2f03d1eada 100644 --- a/cui/source/dialogs/cuifmsearch.cxx +++ b/cui/source/dialogs/cuifmsearch.cxx @@ -114,7 +114,7 @@ FmSearchDialog::FmSearchDialog(vcl::Window* pParent, const OUString& sInitialTex fmscInitial.nContext = nInitialContext; m_lnkContextSupplier.Call(fmscInitial); DBG_ASSERT(fmscInitial.xCursor.is(), "FmSearchDialog::FmSearchDialog : invalid data supplied by ContextSupplier !"); - DBG_ASSERT(comphelper::string::getTokenCount(fmscInitial.strUsedFields, ';') == (sal_Int32)fmscInitial.arrFields.size(), + DBG_ASSERT(comphelper::string::getTokenCount(fmscInitial.strUsedFields, ';') == static_cast(fmscInitial.arrFields.size()), "FmSearchDialog::FmSearchDialog : invalid data supplied by ContextSupplied !"); #if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL for (const Reference & arrField : fmscInitial.arrFields) @@ -416,7 +416,7 @@ IMPL_LINK(FmSearchDialog, OnFieldSelected, ListBox&, rBox, void) { DBG_ASSERT(rBox.GetSelectedEntryCount() == 1, "FmSearchDialog::OnFieldSelected : unexpected : not exactly one entry select!"); - m_pSearchEngine->RebuildUsedFields(m_prbAllFields->IsChecked() ? -1 : (sal_Int16)m_plbField->GetSelectedEntryPos()); + m_pSearchEngine->RebuildUsedFields(m_prbAllFields->IsChecked() ? -1 : static_cast(m_plbField->GetSelectedEntryPos())); // calls m_pSearchEngine->InvalidatePreviousLoc too sal_Int32 nCurrentContext = m_plbForm->GetSelectedEntryPos(); @@ -532,7 +532,7 @@ void FmSearchDialog::InitContext(sal_Int16 nContext) m_plbField->InsertEntry(fmscContext.strUsedFields.getToken(i, ';')); } - if (nContext < (sal_Int32)m_arrContextFields.size() && !m_arrContextFields[nContext].isEmpty()) + if (nContext < static_cast(m_arrContextFields.size()) && !m_arrContextFields[nContext].isEmpty()) { m_plbField->SelectEntry(m_arrContextFields[nContext]); } @@ -718,7 +718,7 @@ IMPL_LINK(FmSearchDialog, OnSearchProgress, const FmSearchProgress*, pProgress, break; case FmSearchProgress::State::Successful: - OnFound(pProgress->aBookmark, (sal_Int16)pProgress->nFieldIndex); + OnFound(pProgress->aBookmark, static_cast(pProgress->nFieldIndex)); EnableSearchUI(true); break; diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx index edd5e8ac8fe6..4784e68c83d6 100644 --- a/cui/source/dialogs/cuigaldlg.cxx +++ b/cui/source/dialogs/cuigaldlg.cxx @@ -171,7 +171,7 @@ void SearchThread::ImplSearch( const INetURLObject& rStartURL, ); mpBrowser->m_pLbxFound->InsertEntry( GetReducedString( aFoundURL, 50 ), - (sal_uInt16) mpBrowser->aFoundList.size() - 1 ); + static_cast(mpBrowser->aFoundList.size()) - 1 ); } } } @@ -292,7 +292,7 @@ void TakeThread::execute() const sal_Int32 nPos = mpBrowser->bTakeAll ? i : mpBrowser->m_pLbxFound->GetSelectedEntryPos( i ); const INetURLObject aURL( mpBrowser->aFoundList[ nPos ]); - mrTakenList.push_back( (sal_uLong)nPos ); + mrTakenList.push_back( static_cast(nPos) ); { SolarMutexGuard aGuard; @@ -383,7 +383,7 @@ IMPL_LINK_NOARG(TakeProgress, CleanUpHdl, void*, void) // refill list box for( i = 0, nCount = aRemoveEntries.size(); i < nCount; ++i ) if( !aRemoveEntries[ i ] ) - aRemainingVector.push_back( pBrowser->m_pLbxFound->GetEntry( (sal_uInt16) i ) ); + aRemainingVector.push_back( pBrowser->m_pLbxFound->GetEntry( static_cast(i) ) ); pBrowser->m_pLbxFound->Clear(); @@ -525,7 +525,7 @@ GalleryIdDialog::GalleryIdDialog( vcl::Window* pParent, GalleryTheme* _pThm ) GalleryTheme::InsertAllThemes(*m_pLbResName); - m_pLbResName->SelectEntryPos( (sal_uInt16) pThm->GetId() ); + m_pLbResName->SelectEntryPos( static_cast(pThm->GetId()) ); m_pLbResName->GrabFocus(); m_pBtnOk->SetClickHdl( LINK( this, GalleryIdDialog, ClickOkHdl ) ); diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx index 4c1d3fcf6cc9..8dee795cda8b 100644 --- a/cui/source/dialogs/cuigrfflt.cxx +++ b/cui/source/dialogs/cuigrfflt.cxx @@ -91,22 +91,22 @@ void GraphicPreviewWindow::ScaleImageToFit() aPreviewSize.Width() && aPreviewSize.Height() && aGrfSize.Width() && aGrfSize.Height() ) { - const double fGrfWH = (double) aGrfSize.Width() / aGrfSize.Height(); - const double fPreWH = (double) aPreviewSize.Width() / aPreviewSize.Height(); + const double fGrfWH = static_cast(aGrfSize.Width()) / aGrfSize.Height(); + const double fPreWH = static_cast(aPreviewSize.Width()) / aPreviewSize.Height(); if( fGrfWH < fPreWH ) { - aGrfSize.Width() = (long) ( aPreviewSize.Height() * fGrfWH ); + aGrfSize.Width() = static_cast( aPreviewSize.Height() * fGrfWH ); aGrfSize.Height() = aPreviewSize.Height(); } else { aGrfSize.Width() = aPreviewSize.Width(); - aGrfSize.Height() = (long) ( aPreviewSize.Width() / fGrfWH ); + aGrfSize.Height() = static_cast( aPreviewSize.Width() / fGrfWH ); } - mfScaleX = (double) aGrfSize.Width() / aSizePixel.Width(); - mfScaleY = (double) aGrfSize.Height() / aSizePixel.Height(); + mfScaleX = static_cast(aGrfSize.Width()) / aSizePixel.Width(); + mfScaleY = static_cast(aGrfSize.Height()) / aSizePixel.Height(); if( !mpOrigGraphic->IsAnimated() ) { @@ -371,7 +371,7 @@ void GraphicFilterSolarize::dispose() Graphic GraphicFilterSolarize::GetFilteredGraphic( const Graphic& rGraphic, double, double ) { Graphic aRet; - sal_uInt8 nGreyThreshold = (sal_uInt8) FRound( mpMtrThreshold->GetValue() * 2.55 ); + sal_uInt8 nGreyThreshold = static_cast(FRound( mpMtrThreshold->GetValue() * 2.55 )); BmpFilterParam aParam( nGreyThreshold ); if( rGraphic.IsAnimated() ) @@ -491,7 +491,7 @@ void GraphicFilterPoster::dispose() Graphic GraphicFilterPoster::GetFilteredGraphic( const Graphic& rGraphic, double, double ) { Graphic aRet; - const sal_uInt16 nPosterCount = (sal_uInt16) mpNumPoster->GetValue(); + const sal_uInt16 nPosterCount = static_cast(mpNumPoster->GetValue()); if( rGraphic.IsAnimated() ) { diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx index 2557538a83c3..90afcd2f700e 100644 --- a/cui/source/dialogs/hangulhanjadlg.cxx +++ b/cui/source/dialogs/hangulhanjadlg.cxx @@ -126,7 +126,7 @@ namespace svx // the font for the secondary text: vcl::Font aSmallerFont(rRenderContext.GetFont()); // heuristic: 80% of the original size - aSmallerFont.SetFontHeight( (long)( 0.8 * aSmallerFont.GetFontHeight() ) ); + aSmallerFont.SetFontHeight( static_cast( 0.8 * aSmallerFont.GetFontHeight() ) ); // let's calculate the size of our two texts ::tools::Rectangle aPrimaryRect = rRenderContext.GetTextRect( _rRect, m_sPrimaryText, _nTextStyle ); diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx index 1717629c4317..e350506707af 100644 --- a/cui/source/dialogs/insdlg.cxx +++ b/cui/source/dialogs/insdlg.cxx @@ -560,13 +560,13 @@ short SfxInsertFloatingFrameDialog::Execute() long lMarginWidth; if ( !m_pCBMarginWidthDefault->IsChecked() ) - lMarginWidth = (long) m_pNMMarginWidth->GetText().toInt32(); + lMarginWidth = static_cast(m_pNMMarginWidth->GetText().toInt32()); else lMarginWidth = SIZE_NOT_SET; long lMarginHeight; if ( !m_pCBMarginHeightDefault->IsChecked() ) - lMarginHeight = (long) m_pNMMarginHeight->GetText().toInt32(); + lMarginHeight = static_cast(m_pNMMarginHeight->GetText().toInt32()); else lMarginHeight = SIZE_NOT_SET; diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx index e52bdd06b11b..27f576713467 100644 --- a/cui/source/dialogs/multipat.cxx +++ b/cui/source/dialogs/multipat.cxx @@ -227,7 +227,7 @@ void SvxMultiPathDialog::dispose() { if (m_pRadioLB) { - sal_uInt16 nPos = (sal_uInt16)m_pRadioLB->GetEntryCount(); + sal_uInt16 nPos = static_cast(m_pRadioLB->GetEntryCount()); while ( nPos-- ) { SvTreeListEntry* pEntry = m_pRadioLB->GetEntry( nPos ); diff --git a/cui/source/dialogs/showcols.cxx b/cui/source/dialogs/showcols.cxx index e01337bc5f58..b27fa36930b3 100644 --- a/cui/source/dialogs/showcols.cxx +++ b/cui/source/dialogs/showcols.cxx @@ -110,7 +110,7 @@ void FmShowColsDialog::SetColumns(const css::uno::Reference< css::container::XIn // if the col is hidden, put it into the list if (bIsHidden) - m_pList->SetEntryData( m_pList->InsertEntry(sCurName), reinterpret_cast((sal_Int64)i) ); + m_pList->SetEntryData( m_pList->InsertEntry(sCurName), reinterpret_cast(static_cast(i)) ); } } diff --git a/cui/source/dialogs/srchxtra.cxx b/cui/source/dialogs/srchxtra.cxx index e5cfd54656f4..366fac3cb7b1 100644 --- a/cui/source/dialogs/srchxtra.cxx +++ b/cui/source/dialogs/srchxtra.cxx @@ -198,7 +198,7 @@ IMPL_LINK_NOARG(SvxSearchAttributeDialog, OKHdl, Button*, void) for ( sal_uLong i = 0; i < m_pAttrLB->GetEntryCount(); ++i ) { - sal_uInt16 nSlot = (sal_uInt16)reinterpret_cast(m_pAttrLB->GetEntryData(i)); + sal_uInt16 nSlot = static_cast(reinterpret_cast(m_pAttrLB->GetEntryData(i))); bool bChecked = m_pAttrLB->IsChecked(i); sal_uInt16 j; diff --git a/cui/source/inc/optlingu.hxx b/cui/source/inc/optlingu.hxx index 477006de3bc8..d53844661ee5 100644 --- a/cui/source/inc/optlingu.hxx +++ b/cui/source/inc/optlingu.hxx @@ -46,7 +46,7 @@ class SvxLinguData_Impl; // define ---------------------------------------------------------------- -#define GROUP_MODULES ((sal_uInt16)0x0008) +#define GROUP_MODULES (sal_uInt16(0x0008)) // forward --------------------------------------------------------------- diff --git a/cui/source/inc/srchxtra.hxx b/cui/source/inc/srchxtra.hxx index 876111059e25..1c0656f6574b 100644 --- a/cui/source/inc/srchxtra.hxx +++ b/cui/source/inc/srchxtra.hxx @@ -82,9 +82,9 @@ public: virtual ~SvxSearchSimilarityDialog() override; virtual void dispose() override; - sal_uInt16 GetOther() { return (sal_uInt16)m_pOtherFld->GetValue(); } - sal_uInt16 GetShorter() { return (sal_uInt16)m_pShorterFld->GetValue(); } - sal_uInt16 GetLonger() { return (sal_uInt16)m_pLongerFld->GetValue(); } + sal_uInt16 GetOther() { return static_cast(m_pOtherFld->GetValue()); } + sal_uInt16 GetShorter() { return static_cast(m_pShorterFld->GetValue()); } + sal_uInt16 GetLonger() { return static_cast(m_pLongerFld->GetValue()); } bool IsRelaxed() { return m_pRelaxBox->IsChecked(); } }; diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx index bb9e2275ed90..87c9b06517d1 100644 --- a/cui/source/options/optaboutconfig.cxx +++ b/cui/source/options/optaboutconfig.cxx @@ -651,7 +651,7 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, Button*, void ) //if the value is 0 and length is not 1, there is something wrong if( ( nNumb==0 && sNewValue.getLength()!=1 ) || nNumb >= SAL_MAX_INT16 || nNumb <= SAL_MIN_INT16) throw uno::Exception("out of range short", nullptr); - nShort = (sal_Int16) nNumb; + nShort = static_cast(nNumb); pProperty->Value <<= nShort; } else if( sPropertyType == "long" ) @@ -698,7 +698,7 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, Button*, void ) //convert all strings to appropriate type for( size_t i = 0; i < seqStr.size(); ++i ) { - seqShort[i] = (sal_Int16) seqStr[i].toInt32(); + seqShort[i] = static_cast(seqStr[i].toInt32()); } pProperty->Value <<= seqShort; } diff --git a/cui/source/options/optctl.cxx b/cui/source/options/optctl.cxx index 904e87796b6d..563888e55cf6 100644 --- a/cui/source/options/optctl.cxx +++ b/cui/source/options/optctl.cxx @@ -145,7 +145,7 @@ void SvxCTLOptionsPage::Reset( const SfxItemSet* ) SAL_WARN( "cui.options", "SvxCTLOptionsPage::Reset(): invalid movement enum" ); } - sal_uInt16 nPos = (sal_uInt16)aCTLOptions.GetCTLTextNumerals(); + sal_uInt16 nPos = static_cast(aCTLOptions.GetCTLTextNumerals()); DBG_ASSERT( nPos < m_pNumeralsLB->GetEntryCount(), "SvxCTLOptionsPage::Reset(): invalid numerals enum" ); m_pNumeralsLB->SelectEntryPos( nPos ); diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx index 1fc1d62ec928..b279fd2e71ee 100644 --- a/cui/source/options/optdict.cxx +++ b/cui/source/options/optdict.cxx @@ -550,8 +550,8 @@ void SvxEditDictionaryDialog::ShowWords_Impl( sal_uInt16 nId ) if (pWordsLB->GetEntryCount()) { - pWordED->SetText( pWordsLB->GetEntryText((sal_uLong)0, 0) ); - pReplaceED->SetText( pWordsLB->GetEntryText((sal_uLong)0, 1) ); + pWordED->SetText( pWordsLB->GetEntryText(sal_uLong(0), 0) ); + pReplaceED->SetText( pWordsLB->GetEntryText(sal_uLong(0), 1) ); } LeaveWait(); diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 7965179fa72d..1cbef34f5251 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -364,7 +364,7 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet ) } const SfxUInt16Item* pUInt16Item = dynamic_cast< const SfxUInt16Item* >( GetOldItem( *rSet, SID_ATTR_YEAR2000 ) ); - sal_uInt16 nNum = (sal_uInt16)m_pYearValueField->GetText().toInt32(); + sal_uInt16 nNum = static_cast(m_pYearValueField->GetText().toInt32()); if ( pUInt16Item && pUInt16Item->GetValue() != nNum ) { bModified = true; @@ -1204,7 +1204,7 @@ OfaLanguagesTabPage::OfaLanguagesTabPage(vcl::Window* pParent, const SfxItemSet& sal_Int32 d = 0; for (sal_Int32 i=0; i < m_pUserInterfaceLB->GetEntryCount(); i++) { - d = (sal_Int32)reinterpret_cast(m_pUserInterfaceLB->GetEntryData(i)); + d = static_cast(reinterpret_cast(m_pUserInterfaceLB->GetEntryData(i))); if ( d > 0 && seqInstalledLanguages.getLength() > d-1 && seqInstalledLanguages[d-1] == m_sUserLocaleValue) m_pUserInterfaceLB->SelectEntryPos(i); } @@ -1362,7 +1362,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet ) // handle settings for UI Language // a change of setting needs to bring up a warning message OUString aLangString; - sal_Int32 d = (sal_Int32)reinterpret_cast(m_pUserInterfaceLB->GetSelectedEntryData()); + sal_Int32 d = static_cast(reinterpret_cast(m_pUserInterfaceLB->GetSelectedEntryData())); if( d > 0 && seqInstalledLanguages.getLength() > d-1) aLangString = seqInstalledLanguages[d-1]; diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx index 0816a8c49821..1b160fb628d9 100644 --- a/cui/source/options/optgenrl.cxx +++ b/cui/source/options/optgenrl.cxx @@ -406,11 +406,11 @@ IMPL_LINK( SvxGeneralTabPage, ModifyHdl_Impl, Edit&, rEdit, void ) { OUString sShortName = rShortName.pEdit->GetText(); // clear short name if it contains more characters than the number of initials - if ((unsigned)sShortName.getLength() > nInits) + if (static_cast(sShortName.getLength()) > nInits) { rShortName.pEdit->SetText(OUString()); } - while ((unsigned)sShortName.getLength() < nInits) + while (static_cast(sShortName.getLength()) < nInits) sShortName += " "; OUString sName = rEdit.GetText(); OUString sLetter = sName.isEmpty() diff --git a/cui/source/options/opthtml.cxx b/cui/source/options/opthtml.cxx index c0023516bd71..957d909daa3e 100644 --- a/cui/source/options/opthtml.cxx +++ b/cui/source/options/opthtml.cxx @@ -100,19 +100,19 @@ bool OfaHtmlTabPage::FillItemSet( SfxItemSet* ) { SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get(); if(aSize1NF->IsValueChangedFromSaved()) - rHtmlOpt.SetFontSize(0, (sal_uInt16)aSize1NF->GetValue()); + rHtmlOpt.SetFontSize(0, static_cast(aSize1NF->GetValue())); if(aSize2NF->IsValueChangedFromSaved()) - rHtmlOpt.SetFontSize(1, (sal_uInt16)aSize2NF->GetValue()); + rHtmlOpt.SetFontSize(1, static_cast(aSize2NF->GetValue())); if(aSize3NF->IsValueChangedFromSaved()) - rHtmlOpt.SetFontSize(2, (sal_uInt16)aSize3NF->GetValue()); + rHtmlOpt.SetFontSize(2, static_cast(aSize3NF->GetValue())); if(aSize4NF->IsValueChangedFromSaved()) - rHtmlOpt.SetFontSize(3, (sal_uInt16)aSize4NF->GetValue()); + rHtmlOpt.SetFontSize(3, static_cast(aSize4NF->GetValue())); if(aSize5NF->IsValueChangedFromSaved()) - rHtmlOpt.SetFontSize(4, (sal_uInt16)aSize5NF->GetValue()); + rHtmlOpt.SetFontSize(4, static_cast(aSize5NF->GetValue())); if(aSize6NF->IsValueChangedFromSaved()) - rHtmlOpt.SetFontSize(5, (sal_uInt16)aSize6NF->GetValue()); + rHtmlOpt.SetFontSize(5, static_cast(aSize6NF->GetValue())); if(aSize7NF->IsValueChangedFromSaved()) - rHtmlOpt.SetFontSize(6, (sal_uInt16)aSize7NF->GetValue()); + rHtmlOpt.SetFontSize(6, static_cast(aSize7NF->GetValue())); if(aNumbersEnglishUSCB->IsValueChangedFromSaved()) rHtmlOpt.SetNumbersEnglishUS(aNumbersEnglishUSCB->IsChecked()); diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx index 66c75166f03e..4a2064101141 100644 --- a/cui/source/options/optinet2.cxx +++ b/cui/source/options/optinet2.cxx @@ -130,7 +130,7 @@ void SvxNoSpaceEdit::Modify() { OUString aValue = GetText(); - if ( !comphelper::string::isdigitAsciiString(aValue) || (long)aValue.toInt32() > USHRT_MAX ) + if ( !comphelper::string::isdigitAsciiString(aValue) || static_cast(aValue.toInt32()) > USHRT_MAX ) // the maximum value of a port number is USHRT_MAX ScopedVclPtrInstance(this, CuiResId( RID_SVXSTR_OPT_PROXYPORTS))->Execute(); } @@ -529,7 +529,7 @@ IMPL_STATIC_LINK( SvxProxyTabPage, LoseFocusHdl_Impl, Control&, rControl, void ) Edit* pEdit = static_cast(&rControl); OUString aValue = pEdit->GetText(); - if ( !comphelper::string::isdigitAsciiString(aValue) || (long)aValue.toInt32() > USHRT_MAX ) + if ( !comphelper::string::isdigitAsciiString(aValue) || static_cast(aValue.toInt32()) > USHRT_MAX ) pEdit->SetText( OUString('0') ); } diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index 2ca52ee9f9e5..a625c014677c 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -146,10 +146,10 @@ bool KillFile_Impl( const OUString& rURL ) // c: 1 -> checked 0 -> unchecked // n: index -#define TYPE_SPELL (sal_uInt8)1 -#define TYPE_GRAMMAR (sal_uInt8)2 -#define TYPE_HYPH (sal_uInt8)3 -#define TYPE_THES (sal_uInt8)4 +#define TYPE_SPELL sal_uInt8(1) +#define TYPE_GRAMMAR sal_uInt8(2) +#define TYPE_HYPH sal_uInt8(3) +#define TYPE_THES sal_uInt8(4) class ModuleUserData_Impl { @@ -189,9 +189,9 @@ public: bool bChecked, bool bEditable, bool bDeletable ); sal_uLong GetUserData() const { return nVal; } - sal_uInt16 GetEntryId() const { return (sal_uInt16)(nVal >> 16); } - bool IsChecked() const { return (bool)((nVal >> 8) & 0x01); } - bool IsDeletable() const { return (bool)((nVal >> 10) & 0x01); } + sal_uInt16 GetEntryId() const { return static_cast(nVal >> 16); } + bool IsChecked() const { return static_cast((nVal >> 8) & 0x01); } + bool IsDeletable() const { return static_cast((nVal >> 10) & 0x01); } }; @@ -200,10 +200,10 @@ DicUserData::DicUserData( bool bChecked, bool bEditable, bool bDeletable ) { DBG_ASSERT( nEID < 65000, "Entry Id out of range" ); - nVal = ((sal_uLong)(0xFFFF & nEID) << 16) | - ((sal_uLong)(bChecked ? 1 : 0) << 8) | - ((sal_uLong)(bEditable ? 1 : 0) << 9) | - ((sal_uLong)(bDeletable ? 1 : 0) << 10); + nVal = (static_cast(0xFFFF & nEID) << 16) | + (static_cast(bChecked ? 1 : 0) << 8) | + (static_cast(bEditable ? 1 : 0) << 9) | + (static_cast(bDeletable ? 1 : 0) << 10); } @@ -289,8 +289,8 @@ static const char * aEidToPropName[] = static inline OUString lcl_GetPropertyName( EID_OPTIONS eEntryId ) { - DBG_ASSERT( (unsigned int) eEntryId < SAL_N_ELEMENTS(aEidToPropName), "index out of range" ); - return OUString::createFromAscii( aEidToPropName[ (int) eEntryId ] ); + DBG_ASSERT( static_cast(eEntryId) < SAL_N_ELEMENTS(aEidToPropName), "index out of range" ); + return OUString::createFromAscii( aEidToPropName[ static_cast(eEntryId) ] ); } class OptionsBreakSet : public ModalDialog @@ -359,11 +359,11 @@ public: bool bCheckable, bool bChecked ); sal_uLong GetUserData() const { return nVal; } - sal_uInt16 GetEntryId() const { return (sal_uInt16)(nVal >> 16); } - bool HasNumericValue() const { return (bool)((nVal >> 10) & 0x01); } - sal_uInt16 GetNumericValue() const { return (sal_uInt16)(nVal & 0xFF); } - bool IsCheckable() const { return (bool)((nVal >> 9) & 0x01); } - bool IsModified() const { return (bool)((nVal >> 11) & 0x01); } + sal_uInt16 GetEntryId() const { return static_cast(nVal >> 16); } + bool HasNumericValue() const { return static_cast((nVal >> 10) & 0x01); } + sal_uInt16 GetNumericValue() const { return static_cast(nVal & 0xFF); } + bool IsCheckable() const { return static_cast((nVal >> 9) & 0x01); } + bool IsModified() const { return static_cast((nVal >> 11) & 0x01); } void SetNumericValue( sal_uInt8 nNumVal ); }; @@ -374,11 +374,11 @@ OptionsUserData::OptionsUserData( sal_uInt16 nEID, { DBG_ASSERT( nEID < 65000, "Entry Id out of range" ); DBG_ASSERT( nNumVal < 256, "value out of range" ); - nVal = ((sal_uLong)(0xFFFF & nEID) << 16) | - ((sal_uLong)(bHasNV ? 1 : 0) << 10) | - ((sal_uLong)(bCheckable ? 1 : 0) << 9) | - ((sal_uLong)(bChecked ? 1 : 0) << 8) | - ((sal_uLong)(0xFF & nNumVal)); + nVal = (static_cast(0xFFFF & nEID) << 16) | + (static_cast(bHasNV ? 1 : 0) << 10) | + (static_cast(bCheckable ? 1 : 0) << 9) | + (static_cast(bChecked ? 1 : 0) << 8) | + static_cast(0xFF & nNumVal); } void OptionsUserData::SetNumericValue( sal_uInt8 nNumVal ) @@ -387,7 +387,7 @@ void OptionsUserData::SetNumericValue( sal_uInt8 nNumVal ) { nVal &= 0xffffff00; nVal |= nNumVal; - nVal |= (sal_uLong)1 << 11; // mark as modified + nVal |= sal_uLong(1) << 11; // mark as modified } } @@ -537,12 +537,12 @@ Sequence< OUString > SvxLinguData_Impl::GetSortedImplNames( LanguageType nLang, if (pTable->count( nLang )) aRes = (*pTable)[ nLang ]; // add configured services sal_Int32 nIdx = aRes.getLength(); - DBG_ASSERT( (sal_Int32) nDisplayServices >= nIdx, "size mismatch" ); + DBG_ASSERT( static_cast(nDisplayServices) >= nIdx, "size mismatch" ); aRes.realloc( nDisplayServices ); OUString *pRes = aRes.getArray(); // add not configured services - for (sal_Int32 i = 0; i < (sal_Int32) nDisplayServices; ++i) + for (sal_Int32 i = 0; i < static_cast(nDisplayServices); ++i) { const ServiceInfo_Impl &rInfo = aDisplayServiceArr[ i ]; OUString aImplName; @@ -1197,8 +1197,8 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet ) aLngCfg.SetProperty( aPropName, aAny ); } - SvTreeListEntry *pPreBreakEntry = m_pLinguOptionsCLB->GetEntry( (sal_uLong) EID_NUM_PRE_BREAK ); - SvTreeListEntry *pPostBreakEntry = m_pLinguOptionsCLB->GetEntry( (sal_uLong) EID_NUM_POST_BREAK ); + SvTreeListEntry *pPreBreakEntry = m_pLinguOptionsCLB->GetEntry( sal_uLong(EID_NUM_PRE_BREAK) ); + SvTreeListEntry *pPostBreakEntry = m_pLinguOptionsCLB->GetEntry( sal_uLong(EID_NUM_POST_BREAK) ); DBG_ASSERT( pPreBreakEntry, "NULL Pointer" ); DBG_ASSERT( pPostBreakEntry, "NULL Pointer" ); if (pPreBreakEntry && pPostBreakEntry) @@ -1208,15 +1208,15 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet ) if ( aPreBreakData.IsModified() || aPostBreakData.IsModified() ) { SfxHyphenRegionItem aHyp( GetWhich( SID_ATTR_HYPHENREGION ) ); - aHyp.GetMinLead() = (sal_uInt8) aPreBreakData.GetNumericValue(); - aHyp.GetMinTrail() = (sal_uInt8) aPostBreakData.GetNumericValue(); + aHyp.GetMinLead() = static_cast(aPreBreakData.GetNumericValue()); + aHyp.GetMinTrail() = static_cast(aPostBreakData.GetNumericValue()); rCoreSet->Put( aHyp ); } } // automatic spell checking - bool bNewAutoCheck = m_pLinguOptionsCLB->IsChecked( (sal_uLong) EID_SPELL_AUTO ); + bool bNewAutoCheck = m_pLinguOptionsCLB->IsChecked( sal_uLong(EID_SPELL_AUTO) ); const SfxPoolItem* pOld = GetOldItem( *rCoreSet, SID_AUTOSPELL_CHECK ); if ( !pOld || static_cast(pOld)->GetValue() != bNewAutoCheck ) { @@ -1281,7 +1281,7 @@ void SvxLinguTabPage::UpdateDicBox_Impl() { const uno::Reference< XDictionary > &rDic = pDic[i]; if (rDic.is()) - AddDicBoxEntry( rDic, (sal_uInt16)i ); + AddDicBoxEntry( rDic, static_cast(i) ); } m_pLinguDicsCLB->SetUpdateMode(true); @@ -1375,7 +1375,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet ) pEntry = CreateEntry( sNumMinWordlen, CBCOL_SECOND ); aLngCfg.GetProperty( UPN_HYPH_MIN_WORD_LENGTH ) >>= nVal; - nUserData = OptionsUserData( EID_NUM_MIN_WORDLEN, true, (sal_uInt16)nVal, false, false).GetUserData(); + nUserData = OptionsUserData( EID_NUM_MIN_WORDLEN, true, static_cast(nVal), false, false).GetUserData(); pEntry->SetUserData( reinterpret_cast(nUserData) ); pModel->Insert( pEntry ); @@ -1387,16 +1387,16 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet ) pEntry = CreateEntry( sNumPreBreak, CBCOL_SECOND ); aLngCfg.GetProperty( UPN_HYPH_MIN_LEADING ) >>= nVal; if (pHyp) - nVal = (sal_Int16) pHyp->GetMinLead(); - nUserData = OptionsUserData( EID_NUM_PRE_BREAK, true, (sal_uInt16)nVal, false, false).GetUserData(); + nVal = static_cast(pHyp->GetMinLead()); + nUserData = OptionsUserData( EID_NUM_PRE_BREAK, true, static_cast(nVal), false, false).GetUserData(); pEntry->SetUserData( reinterpret_cast(nUserData) ); pModel->Insert( pEntry ); pEntry = CreateEntry( sNumPostBreak, CBCOL_SECOND ); aLngCfg.GetProperty( UPN_HYPH_MIN_TRAILING ) >>= nVal; if (pHyp) - nVal = (sal_Int16) pHyp->GetMinTrail(); - nUserData = OptionsUserData( EID_NUM_POST_BREAK, true, (sal_uInt16)nVal, false, false).GetUserData(); + nVal = static_cast(pHyp->GetMinTrail()); + nUserData = OptionsUserData( EID_NUM_POST_BREAK, true, static_cast(nVal), false, false).GetUserData(); pEntry->SetUserData( reinterpret_cast(nUserData) ); pModel->Insert( pEntry ); @@ -1523,7 +1523,7 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, Button *, pBtn, void ) aDics.getArray()[ nLen ] = xNewDic; - AddDicBoxEntry( xNewDic, (sal_uInt16) nLen ); + AddDicBoxEntry( xNewDic, static_cast(nLen) ); } } } @@ -1633,7 +1633,7 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, Button *, pBtn, void ) long nVal = static_cast(aDlg->GetNumericFld().GetValue()); if (-1 != nVal && aData.GetNumericValue() != nVal) { - aData.SetNumericValue( (sal_uInt8)nVal ); //! sets IsModified ! + aData.SetNumericValue( static_cast(nVal) ); //! sets IsModified ! pEntry->SetUserData( reinterpret_cast(aData.GetUserData()) ); m_pLinguOptionsCLB->Invalidate(); } @@ -1977,7 +1977,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(ListBox const * pBox) Sequence< OUString > aNames( rLinguData.GetSortedImplNames( eCurLanguage, TYPE_SPELL ) ); const OUString *pName = aNames.getConstArray(); - sal_uLong nNames = (sal_uLong) aNames.getLength(); + sal_uLong nNames = static_cast(aNames.getLength()); sal_Int32 nLocalIndex = 0; // index relative to parent for (n = 0; n < nNames; ++n) { @@ -2005,7 +2005,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(ListBox const * pBox) const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0; lcl_SetCheckButton( pNewEntry, bCheck ); pUserData = new ModuleUserData_Impl( aImplName, false, - bCheck, TYPE_SPELL, (sal_uInt8)nLocalIndex++ ); + bCheck, TYPE_SPELL, static_cast(nLocalIndex++) ); pNewEntry->SetUserData( static_cast(pUserData) ); pModel->Insert( pNewEntry ); } @@ -2021,7 +2021,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(ListBox const * pBox) aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_GRAMMAR ); pName = aNames.getConstArray(); - nNames = (sal_uLong) aNames.getLength(); + nNames = static_cast(aNames.getLength()); nLocalIndex = 0; for (n = 0; n < nNames; ++n) { @@ -2049,7 +2049,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(ListBox const * pBox) const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0; lcl_SetCheckButton( pNewEntry, bCheck ); pUserData = new ModuleUserData_Impl( aImplName, false, - bCheck, TYPE_GRAMMAR, (sal_uInt8)nLocalIndex++ ); + bCheck, TYPE_GRAMMAR, static_cast(nLocalIndex++) ); pNewEntry->SetUserData( static_cast(pUserData) ); pModel->Insert( pNewEntry ); } @@ -2065,7 +2065,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(ListBox const * pBox) aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_HYPH ); pName = aNames.getConstArray(); - nNames = (sal_uLong) aNames.getLength(); + nNames = static_cast(aNames.getLength()); nLocalIndex = 0; for (n = 0; n < nNames; ++n) { @@ -2093,7 +2093,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(ListBox const * pBox) const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0; lcl_SetCheckButton( pNewEntry, bCheck ); pUserData = new ModuleUserData_Impl( aImplName, false, - bCheck, TYPE_HYPH, (sal_uInt8)nLocalIndex++ ); + bCheck, TYPE_HYPH, static_cast(nLocalIndex++) ); pNewEntry->SetUserData( static_cast(pUserData) ); pModel->Insert( pNewEntry ); } @@ -2109,7 +2109,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(ListBox const * pBox) aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_THES ); pName = aNames.getConstArray(); - nNames = (sal_uLong) aNames.getLength(); + nNames = static_cast(aNames.getLength()); nLocalIndex = 0; for (n = 0; n < nNames; ++n) { @@ -2137,7 +2137,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(ListBox const * pBox) const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0; lcl_SetCheckButton( pNewEntry, bCheck ); pUserData = new ModuleUserData_Impl( aImplName, false, - bCheck, TYPE_THES, (sal_uInt8)nLocalIndex++ ); + bCheck, TYPE_THES, static_cast(nLocalIndex++) ); pNewEntry->SetUserData( static_cast(pUserData) ); pModel->Insert( pNewEntry ); } diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index d6595644bdb1..596f26e36bc0 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -284,7 +284,7 @@ void SvxPathTabPage::Reset( const SfxItemSet* ) long nWidth1 = rBar.GetTextWidth(rBar.GetItemText(1)); long nWidth2 = rBar.GetTextWidth(rBar.GetItemText(2)); - for( sal_uInt16 i = 0; i <= (sal_uInt16)SvtPathOptions::PATH_CLASSIFICATION; ++i ) + for( sal_uInt16 i = 0; i <= sal_uInt16(SvtPathOptions::PATH_CLASSIFICATION); ++i ) { // only writer uses autotext if ( i == SvtPathOptions::PATH_AUTOTEXT @@ -502,7 +502,7 @@ void SvxPathTabPage::ChangeCurrentEntry( const OUString& _rFolder ) if ( bChanged ) { pPathBox->SetEntryText( Convert_Impl( sNewPathStr ), pEntry, 1 ); - sal_uInt16 nPos = (sal_uInt16)pPathBox->GetModel()->GetAbsPos( pEntry ); + sal_uInt16 nPos = static_cast(pPathBox->GetModel()->GetAbsPos( pEntry )); pPathImpl = static_cast(pPathBox->GetEntry(nPos)->GetUserData()); pPathImpl->eState = SfxItemState::SET; pPathImpl->sWritablePath = sNewPathStr; diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx index ff9012d0c1f6..ff3456eee4d8 100644 --- a/cui/source/options/optsave.cxx +++ b/cui/source/options/optsave.cxx @@ -294,7 +294,7 @@ bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet ) if ( aAutoSaveEdit->IsValueChangedFromSaved() ) { rSet->Put( SfxUInt16Item( GetWhich( SID_ATTR_AUTOSAVEMINUTE ), - (sal_uInt16)aAutoSaveEdit->GetValue() ) ); + static_cast(aAutoSaveEdit->GetValue()) ) ); bModified = true; } diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx index 9a517007374d..a5a87712ea11 100644 --- a/cui/source/options/optupdt.cxx +++ b/cui/source/options/optupdt.cxx @@ -132,7 +132,7 @@ void SvxOnlineUpdateTabPage::UpdateLastCheckedText() Date aDate( Date::EMPTY ); tools::Time aTime( tools::Time::EMPTY ); - lastCheckedTV.Seconds = (sal_uInt32) lastChecked; + lastCheckedTV.Seconds = static_cast(lastChecked); osl_getLocalTimeFromSystemTime( &lastCheckedTV, &lastCheckedTV ); if ( osl_getDateTimeFromTimeValue( &lastCheckedTV, &lastCheckedDT ) ) diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index 2d06f7703210..fb01bfeb1945 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -714,7 +714,7 @@ IMPL_STATIC_LINK( pNext = pBox->GetNextEntryInView(pNext); if(!pNext) { - pBox->ScrollOutputArea( -(short)(nChildCount - i + 1) ); + pBox->ScrollOutputArea( -static_cast(nChildCount - i + 1) ); break; } else @@ -724,7 +724,7 @@ IMPL_STATIC_LINK( Point aPos(pBox->GetEntryPosition(pNext)); if(aPos.Y()+nHeight > aSz.Height()) { - pBox->ScrollOutputArea( -(short)(nChildCount - i + 1) ); + pBox->ScrollOutputArea( -static_cast(nChildCount - i + 1) ); break; } } @@ -1123,10 +1123,10 @@ std::unique_ptr OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId if( SfxItemState::DEFAULT <= pDispatch->QueryState( SID_ATTR_YEAR2000, pItem ) ) pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, static_cast(pItem)->GetValue() ) ); else - pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, (sal_uInt16)aMisc.GetYear2000() ) ); + pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, static_cast(aMisc.GetYear2000()) ) ); } else - pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, (sal_uInt16)aMisc.GetYear2000() ) ); + pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, static_cast(aMisc.GetYear2000()) ) ); // miscellaneous - Tabulator @@ -1160,8 +1160,8 @@ std::unique_ptr OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId nMinLead = xProp->getHyphMinLeading(); nMinTrail = xProp->getHyphMinTrailing(); } - aHyphen.GetMinLead() = (sal_uInt8)nMinLead; - aHyphen.GetMinTrail() = (sal_uInt8)nMinTrail; + aHyphen.GetMinLead() = static_cast(nMinLead); + aHyphen.GetMinTrail() = static_cast(nMinTrail); SfxViewFrame* pViewFrame = SfxViewFrame::Current(); if ( pViewFrame ) @@ -1336,8 +1336,8 @@ void OfaTreeOptionsDialog::ApplyLanguageOptions(const SfxItemSet& rSet) { const SfxHyphenRegionItem* pHyphenItem = static_cast(pItem); - xProp->setHyphMinLeading( (sal_Int16) pHyphenItem->GetMinLead() ); - xProp->setHyphMinTrailing( (sal_Int16) pHyphenItem->GetMinTrail() ); + xProp->setHyphMinLeading( static_cast(pHyphenItem->GetMinLead()) ); + xProp->setHyphMinTrailing( static_cast(pHyphenItem->GetMinTrail()) ); bSaveSpellCheck = true; } @@ -1476,7 +1476,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) nGroup = AddGroup( CuiResId(SID_FILTER_DLG_RES[0].first), nullptr, nullptr, SID_FILTER_DLG ); for ( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_FILTER_DLG_RES); ++i ) { - nPageId = (sal_uInt16)SID_FILTER_DLG_RES[i].second; + nPageId = static_cast(SID_FILTER_DLG_RES[i].second); if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) AddTabPage( nPageId, CuiResId(SID_FILTER_DLG_RES[i].first), nGroup ); } @@ -1490,7 +1490,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) nGroup = AddGroup(CuiResId(SID_LANGUAGE_OPTIONS_RES[0].first), nullptr, nullptr, SID_LANGUAGE_OPTIONS ); for (sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_LANGUAGE_OPTIONS_RES); ++i) { - nPageId = (sal_uInt16)SID_LANGUAGE_OPTIONS_RES[i].second; + nPageId = static_cast(SID_LANGUAGE_OPTIONS_RES[i].second); if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) continue; if ( ( RID_SVXPAGE_JSEARCH_OPTIONS != nPageId || aLanguageOptions.IsJapaneseFindEnabled() ) && @@ -1522,7 +1522,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) nGroup = AddGroup(CuiResId(SID_SW_EDITOPTIONS_RES[0].first), pSwMod, pSwMod, SID_SW_EDITOPTIONS ); for ( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_SW_EDITOPTIONS_RES); ++i ) { - nPageId = (sal_uInt16)SID_SW_EDITOPTIONS_RES[i].second; + nPageId = static_cast(SID_SW_EDITOPTIONS_RES[i].second); if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) continue; if ( ( RID_SW_TP_STD_FONT_CJK != nPageId || aLanguageOptions.IsCJKFontEnabled() ) && @@ -1541,7 +1541,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) nGroup = AddGroup(CuiResId(SID_SW_ONLINEOPTIONS_RES[0].first), pSwMod, pSwMod, SID_SW_ONLINEOPTIONS ); for( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_SW_ONLINEOPTIONS_RES); ++i ) { - nPageId = (sal_uInt16)SID_SW_ONLINEOPTIONS_RES[i].second; + nPageId = static_cast(SID_SW_ONLINEOPTIONS_RES[i].second); if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) AddTabPage(nPageId, CuiResId(SID_SW_ONLINEOPTIONS_RES[i].first), nGroup); } @@ -1565,7 +1565,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) const sal_uInt16 nCount = static_cast(SAL_N_ELEMENTS(SID_SC_EDITOPTIONS_RES)); for ( sal_uInt16 i = 1; i < nCount; ++i ) { - nPageId = (sal_uInt16)SID_SC_EDITOPTIONS_RES[i].second; + nPageId = static_cast(SID_SC_EDITOPTIONS_RES[i].second); if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) continue; @@ -1588,7 +1588,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) const sal_uInt16 nCount = static_cast(SAL_N_ELEMENTS(SID_SD_EDITOPTIONS_RES)); for ( sal_uInt16 i = 1; i < nCount; ++i ) { - nPageId = (sal_uInt16)SID_SD_EDITOPTIONS_RES[i].second; + nPageId = static_cast(SID_SD_EDITOPTIONS_RES[i].second); if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) continue; @@ -1610,7 +1610,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) const sal_uInt16 nCount = static_cast(SAL_N_ELEMENTS(SID_SD_GRAPHIC_OPTIONS_RES)); for ( sal_uInt16 i = 1; i < nCount; ++i ) { - nPageId = (sal_uInt16)SID_SD_GRAPHIC_OPTIONS_RES[i].second; + nPageId = static_cast(SID_SD_GRAPHIC_OPTIONS_RES[i].second); if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) continue; @@ -1632,7 +1632,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) nGroup = AddGroup(CuiResId(SID_SM_EDITOPTIONS_RES[0].first), pSmMod, pSmMod, SID_SM_EDITOPTIONS ); for ( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_SM_EDITOPTIONS_RES); ++i ) { - nPageId = (sal_uInt16)SID_SM_EDITOPTIONS_RES[i].second; + nPageId = static_cast(SID_SM_EDITOPTIONS_RES[i].second); if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) AddTabPage( nPageId, CuiResId(SID_SM_EDITOPTIONS_RES[i].first), nGroup ); } @@ -1651,7 +1651,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) nGroup = AddGroup( CuiResId(SID_SB_STARBASEOPTIONS_RES[0].first), nullptr, nullptr, SID_SB_STARBASEOPTIONS ); for ( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_SB_STARBASEOPTIONS_RES); ++i ) { - nPageId = (sal_uInt16)SID_SB_STARBASEOPTIONS_RES[i].second; + nPageId = static_cast(SID_SB_STARBASEOPTIONS_RES[i].second); if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) AddTabPage( nPageId, CuiResId(SID_SB_STARBASEOPTIONS_RES[i].first), nGroup ); } @@ -1664,7 +1664,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) nGroup = AddGroup( CuiResId(SID_SCH_EDITOPTIONS_RES[0].first), nullptr, nullptr, SID_SCH_EDITOPTIONS ); for ( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_SCH_EDITOPTIONS_RES); ++i ) { - nPageId = (sal_uInt16)SID_SCH_EDITOPTIONS_RES[i].second; + nPageId = static_cast(SID_SCH_EDITOPTIONS_RES[i].second); if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) AddTabPage( nPageId, CuiResId(SID_SCH_EDITOPTIONS_RES[i].first), nGroup ); } @@ -1678,7 +1678,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) for ( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_INET_DLG_RES); ++i ) { - nPageId = (sal_uInt16)SID_INET_DLG_RES[i].second; + nPageId = static_cast(SID_INET_DLG_RES[i].second); if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) continue; #if defined(_WIN32) diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx index 82dfb735dc8a..7c351d5f2d80 100644 --- a/cui/source/options/webconninfo.cxx +++ b/cui/source/options/webconninfo.cxx @@ -217,7 +217,7 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, RemovePasswordHdl, Button*, void) uno::Reference< task::XPasswordContainer2 > xPasswdContainer( task::PasswordContainer::create(comphelper::getProcessComponentContext())); - sal_Int32 nPos = (sal_Int32)reinterpret_cast(pEntry->GetUserData()); + sal_Int32 nPos = static_cast(reinterpret_cast(pEntry->GetUserData())); if ( nPos < m_nPos ) { xPasswdContainer->removePersistent( aURL, aUserName ); @@ -306,7 +306,7 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, EntrySelectedHdl, SvTreeListBox*, void) // url container entries (-> use system credentials) have // no password - sal_Int32 nPos = (sal_Int32)reinterpret_cast(pEntry->GetUserData()); + sal_Int32 nPos = static_cast(reinterpret_cast(pEntry->GetUserData())); m_pChangeBtn->Enable( nPos < m_nPos ); } } diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index a84db340d3a7..caac1b3c27b8 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -121,14 +121,14 @@ OfaAutoCorrDlg::OfaAutoCorrDlg(vcl::Window* pParent, const SfxItemSet* _pSet ) m_pLanguageLB->SelectLanguage( LANGUAGE_NONE ); sal_Int32 nPos = m_pLanguageLB->GetSelectedEntryPos(); DBG_ASSERT( LISTBOX_ENTRY_NOTFOUND != nPos, "listbox entry missing" ); - m_pLanguageLB->SetEntryData( nPos, reinterpret_cast((sal_uInt16)LANGUAGE_UNDETERMINED) ); + m_pLanguageLB->SetEntryData( nPos, reinterpret_cast(static_cast(LANGUAGE_UNDETERMINED)) ); // Initializing doesn't work for static on linux - therefore here if( LANGUAGE_SYSTEM == eLastDialogLanguage ) eLastDialogLanguage = Application::GetSettings().GetLanguageTag().getLanguageType(); LanguageType nSelectLang = LANGUAGE_UNDETERMINED; - nPos = m_pLanguageLB->GetEntryPos( reinterpret_cast((sal_uInt16)eLastDialogLanguage) ); + nPos = m_pLanguageLB->GetEntryPos( reinterpret_cast(static_cast(eLastDialogLanguage)) ); if (LISTBOX_ENTRY_NOTFOUND != nPos) nSelectLang = eLastDialogLanguage; m_pLanguageLB->SelectLanguage( nSelectLang ); @@ -580,7 +580,7 @@ bool OfaSwAutoFmtOptionsPage::FillItemSet( SfxItemSet* ) bModified |= pOpt->bRightMargin != bCheck; pOpt->bRightMargin = bCheck; bModified |= nPercent != pOpt->nRightMargin; - pOpt->nRightMargin = (sal_uInt8)nPercent; + pOpt->nRightMargin = static_cast(nPercent); bCheck = m_pCheckLB->IsChecked(APPLY_NUMBERING, CBCOL_SECOND); bModified |= pOpt->bSetNumRule != bCheck; @@ -750,7 +750,7 @@ IMPL_LINK_NOARG(OfaSwAutoFmtOptionsPage, EditHdl, Button*, void) aDlg->GetPrcntFld().SetValue(nPercent); if(RET_OK == aDlg->Execute()) { - nPercent = (sal_uInt16)aDlg->GetPrcntFld().GetValue(); + nPercent = static_cast(aDlg->GetPrcntFld().GetValue()); sMargin = " " + unicode::formatPercent(nPercent, Application::GetSettings().GetUILanguageTag()); } @@ -1009,7 +1009,7 @@ void OfaAutocorrReplacePage::RefillReplaceBox(bool bFromReset, pArray = &aDoubleStringTable[eOldLanguage]; // create new array } - sal_uInt32 nListBoxCount = (sal_uInt32) m_pReplaceTLB->GetEntryCount(); + sal_uInt32 nListBoxCount = static_cast(m_pReplaceTLB->GetEntryCount()); sal_uInt32 i; for(i = 0; i < nListBoxCount; i++) { @@ -2264,11 +2264,11 @@ bool OfaAutoCompleteTabPage::FillItemSet( SfxItemSet* ) bModified |= pOpt->bAutoCmpltShowAsTip != bCheck; pOpt->bAutoCmpltShowAsTip = bCheck; - nVal = (sal_uInt16)m_pNFMinWordlen->GetValue(); + nVal = static_cast(m_pNFMinWordlen->GetValue()); bModified |= nVal != pOpt->nAutoCmpltWordLen; pOpt->nAutoCmpltWordLen = nVal; - nVal = (sal_uInt16)m_pNFMaxEntries->GetValue(); + nVal = static_cast(m_pNFMaxEntries->GetValue()); bModified |= nVal != pOpt->nAutoCmpltListLen; pOpt->nAutoCmpltListLen = nVal; @@ -2277,7 +2277,7 @@ bool OfaAutoCompleteTabPage::FillItemSet( SfxItemSet* ) { sal_uLong nKey = reinterpret_cast(m_pDCBExpandKey->GetEntryData( nPos )); bModified |= nKey != pOpt->nAutoCmpltExpandKey; - pOpt->nAutoCmpltExpandKey = (sal_uInt16)nKey; + pOpt->nAutoCmpltExpandKey = static_cast(nKey); } if (m_pAutoCompleteList && m_nAutoCmpltListCnt != m_pLBEntries->GetEntryCount()) diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index 79416476b750..eaae0619e77f 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -723,10 +723,10 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs ) (pOldBoxInfoItem && !pOldBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::DISTANCE)) ) { - aBoxItem.SetDistance( (sal_uInt16)GetCoreValue(*m_pLeftMF, eCoreUnit ), SvxBoxItemLine::LEFT ); - aBoxItem.SetDistance( (sal_uInt16)GetCoreValue(*m_pRightMF, eCoreUnit ), SvxBoxItemLine::RIGHT ); - aBoxItem.SetDistance( (sal_uInt16)GetCoreValue(*m_pTopMF, eCoreUnit ), SvxBoxItemLine::TOP ); - aBoxItem.SetDistance( (sal_uInt16)GetCoreValue(*m_pBottomMF, eCoreUnit ), SvxBoxItemLine::BOTTOM); + aBoxItem.SetDistance( static_cast(GetCoreValue(*m_pLeftMF, eCoreUnit )), SvxBoxItemLine::LEFT ); + aBoxItem.SetDistance( static_cast(GetCoreValue(*m_pRightMF, eCoreUnit )), SvxBoxItemLine::RIGHT ); + aBoxItem.SetDistance( static_cast(GetCoreValue(*m_pTopMF, eCoreUnit )), SvxBoxItemLine::TOP ); + aBoxItem.SetDistance( static_cast(GetCoreValue(*m_pBottomMF, eCoreUnit )), SvxBoxItemLine::BOTTOM); } else { diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index af80bb565ef7..4fbea4152af0 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -775,7 +775,7 @@ void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp { bool bPtRel = MapUnit::MapPoint == rItem.GetPropUnit(); pSizeBox->SetPtRelative( bPtRel ); - pSizeBox->SetValue( bPtRel ? ((short)rItem.GetProp()) * 10 : rItem.GetProp() ); + pSizeBox->SetValue( bPtRel ? static_cast(rItem.GetProp()) * 10 : rItem.GetProp() ); } else { @@ -1063,9 +1063,9 @@ bool SvxCharNamePage::FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, false, &pItem ) == SfxItemState::SET ) { - float fSize = (float)nSize / 10; + float fSize = static_cast(nSize) / 10; long nVal = CalcToUnit( fSize, rSet.GetPool()->GetMetric( nWhich ) ); - if ( static_cast(pItem)->GetHeight() != (sal_uInt32)nVal ) + if ( static_cast(pItem)->GetHeight() != static_cast(nVal) ) bChanged = true; } @@ -1081,14 +1081,14 @@ bool SvxCharNamePage::FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp SvxFontHeightItem aHeight( 240, 100, nWhich ); if ( pSizeBox->IsPtRelative() ) - aHeight.SetHeight( rOldItem.GetHeight(), (sal_uInt16)( nSize / 10 ), MapUnit::MapPoint, eUnit ); + aHeight.SetHeight( rOldItem.GetHeight(), static_cast( nSize / 10 ), MapUnit::MapPoint, eUnit ); else - aHeight.SetHeight( rOldItem.GetHeight(), (sal_uInt16)nSize ); + aHeight.SetHeight( rOldItem.GetHeight(), static_cast(nSize) ); rSet.Put( aHeight ); } else { - float fSize = (float)nSize / 10; + float fSize = static_cast(nSize) / 10; rSet.Put( SvxFontHeightItem( CalcToUnit( fSize, eUnit ), 100, nWhich ) ); } bModified = true; @@ -2511,12 +2511,12 @@ void SvxCharEffectsPage::PageCreated(const SfxAllItemSet& aSet) SvxCharPositionPage::SvxCharPositionPage( vcl::Window* pParent, const SfxItemSet& rInSet ) : SvxCharBasePage(pParent, "PositionPage", "cui/ui/positionpage.ui", rInSet) - , m_nSuperEsc((short)DFLT_ESC_SUPER) - , m_nSubEsc((short)DFLT_ESC_SUB) + , m_nSuperEsc(short(DFLT_ESC_SUPER)) + , m_nSubEsc(short(DFLT_ESC_SUB)) , m_nScaleWidthItemSetVal(100) , m_nScaleWidthInitialVal(100) - , m_nSuperProp((sal_uInt8)DFLT_ESC_PROP) - , m_nSubProp((sal_uInt8)DFLT_ESC_PROP) + , m_nSuperProp(sal_uInt8(DFLT_ESC_PROP)) + , m_nSubProp(sal_uInt8(DFLT_ESC_PROP)) { get(m_pHighPosBtn, "superscript"); get(m_pNormalPosBtn, "normal"); @@ -2686,8 +2686,8 @@ IMPL_LINK( SvxCharPositionPage, RotationHdl_Impl, Button*, pBtn, void ) IMPL_LINK_NOARG(SvxCharPositionPage, FontModifyHdl_Impl, Edit&, void) { - sal_uInt8 nEscProp = (sal_uInt8)m_pFontSizeMF->GetValue(); - short nEsc = (short)m_pHighLowMF->GetValue(); + sal_uInt8 nEscProp = static_cast(m_pFontSizeMF->GetValue()); + short nEsc = static_cast(m_pHighLowMF->GetValue()); nEsc *= m_pLowPosBtn->IsChecked() ? -1 : 1; UpdatePreview_Impl( 100, nEscProp, nEsc ); } @@ -2725,15 +2725,15 @@ IMPL_LINK_NOARG(SvxCharPositionPage, KerningModifyHdl_Impl, Edit&, void) { long nVal = static_cast(m_pKerningMF->GetValue()); nVal = LogicToLogic( nVal, MapUnit::MapPoint, MapUnit::MapTwip ); - long nKern = (short)m_pKerningMF->Denormalize( nVal ); + long nKern = static_cast(m_pKerningMF->Denormalize( nVal )); SvxFont& rFont = GetPreviewFont(); SvxFont& rCJKFont = GetPreviewCJKFont(); SvxFont& rCTLFont = GetPreviewCTLFont(); - rFont.SetFixKerning( (short)nKern ); - rCJKFont.SetFixKerning( (short)nKern ); - rCTLFont.SetFixKerning( (short)nKern ); + rFont.SetFixKerning( static_cast(nKern) ); + rCJKFont.SetFixKerning( static_cast(nKern) ); + rCTLFont.SetFixKerning( static_cast(nKern) ); m_pPreviewWin->Invalidate(); } @@ -2748,16 +2748,16 @@ IMPL_LINK( SvxCharPositionPage, LoseFocusHdl_Impl, Control&, rControl, void ) if ( m_pHighLowMF == pField ) { if ( bLow ) - m_nSubEsc = (short)m_pHighLowMF->GetValue() * -1; + m_nSubEsc = static_cast(m_pHighLowMF->GetValue()) * -1; else - m_nSuperEsc = (short)m_pHighLowMF->GetValue(); + m_nSuperEsc = static_cast(m_pHighLowMF->GetValue()); } else if ( m_pFontSizeMF == pField ) { if ( bLow ) - m_nSubProp = (sal_uInt8)m_pFontSizeMF->GetValue(); + m_nSubProp = static_cast(m_pFontSizeMF->GetValue()); else - m_nSuperProp = (sal_uInt8)m_pFontSizeMF->GetValue(); + m_nSuperProp = static_cast(m_pFontSizeMF->GetValue()); } } @@ -2787,10 +2787,10 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet ) if ( !sUser.isEmpty() ) { - m_nSuperEsc = (short)sUser.getToken( 0, ';' ).toInt32(); - m_nSubEsc = (short)sUser.getToken( 1, ';' ).toInt32(); - m_nSuperProp = (sal_uInt8)sUser.getToken( 2, ';' ).toInt32(); - m_nSubProp = (sal_uInt8)sUser.getToken( 3, ';' ).toInt32(); + m_nSuperEsc = static_cast(sUser.getToken( 0, ';' ).toInt32()); + m_nSubEsc = static_cast(sUser.getToken( 1, ';' ).toInt32()); + m_nSuperProp = static_cast(sUser.getToken( 2, ';' ).toInt32()); + m_nSubProp = static_cast(sUser.getToken( 3, ';' ).toInt32()); //fdo#75307 validate all the entries and discard all of them if any are //out of range @@ -2906,9 +2906,9 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet ) // set Kerning at the Font, convert into Twips before long nKern = LogicToLogic( rItem.GetValue(), eUnit, MapUnit::MapTwip ); - rFont.SetFixKerning( (short)nKern ); - rCJKFont.SetFixKerning( (short)nKern ); - rCTLFont.SetFixKerning( (short)nKern ); + rFont.SetFixKerning( static_cast(nKern) ); + rCJKFont.SetFixKerning( static_cast(nKern) ); + rCTLFont.SetFixKerning( static_cast(nKern) ); //the attribute value must be displayed also if it's above the maximum allowed value long nVal = static_cast(m_pKerningMF->GetMax()); @@ -3034,10 +3034,10 @@ bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet ) nEsc = bHigh ? DFLT_ESC_AUTO_SUPER : DFLT_ESC_AUTO_SUB; else { - nEsc = (short)m_pHighLowMF->Denormalize( m_pHighLowMF->GetValue() ); + nEsc = static_cast(m_pHighLowMF->Denormalize( m_pHighLowMF->GetValue() )); nEsc *= (bHigh ? 1 : -1); } - nEscProp = (sal_uInt8)m_pFontSizeMF->Denormalize( m_pFontSizeMF->GetValue() ); + nEscProp = static_cast(m_pFontSizeMF->Denormalize( m_pFontSizeMF->GetValue() )); } else { @@ -3075,7 +3075,7 @@ bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet ) long nTmp = static_cast(m_pKerningMF->GetValue()); long nVal = LogicToLogic( nTmp, MapUnit::MapPoint, eUnit ); - nKerning = (short)m_pKerningMF->Denormalize( nVal ); + nKerning = static_cast(m_pKerningMF->Denormalize( nVal )); SfxItemState eOldKernState = rOldSet.GetItemState( nWhich, false ); if ( pOld ) @@ -3108,7 +3108,7 @@ bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet ) nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH ); if ( m_pScaleWidthMF->IsValueChangedFromSaved() ) { - rSet->Put( SvxCharScaleWidthItem( (sal_uInt16)m_pScaleWidthMF->GetValue(), nWhich ) ); + rSet->Put( SvxCharScaleWidthItem( static_cast(m_pScaleWidthMF->GetValue()), nWhich ) ); bModified = true; } else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) ) @@ -3218,7 +3218,7 @@ void SvxCharTwoLinesPage::SelectCharacter( ListBox* pBox ) if ( aDlg->Execute() == RET_OK ) { - sal_Unicode cChar = (sal_Unicode) aDlg->GetChar(); + sal_Unicode cChar = static_cast(aDlg->GetChar()); SetBracket( cChar, bStart ); } else diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx index 6009f92f9749..a6601edbe2cf 100644 --- a/cui/source/tabpages/grfpage.cxx +++ b/cui/source/tabpages/grfpage.cxx @@ -457,7 +457,7 @@ IMPL_LINK( SvxGrfCropPage, SizeHdl, Edit&, rField, void ) lcl_GetValue(*m_pRightMF, eUnit) ); if(!nWidth) nWidth++; - sal_uInt16 nZoom = (sal_uInt16)( aSize.Width() * 100 / nWidth); + sal_uInt16 nZoom = static_cast( aSize.Width() * 100 / nWidth); m_pWidthZoomMF->SetValue(nZoom); } else @@ -467,7 +467,7 @@ IMPL_LINK( SvxGrfCropPage, SizeHdl, Edit&, rField, void ) lcl_GetValue(*m_pBottomMF, eUnit)); if(!nHeight) nHeight++; - sal_uInt16 nZoom = (sal_uInt16)( aSize.Height() * 100 / nHeight); + sal_uInt16 nZoom = static_cast( aSize.Height() * 100 / nHeight); m_pHeightZoomMF->SetValue(nZoom); } } @@ -599,10 +599,10 @@ void SvxGrfCropPage::CalcZoom() sal_uInt16 nZoom = 0; long nDen; if( (nDen = aOrigSize.Width() - nLRBorders) > 0) - nZoom = (sal_uInt16)((( nWidth * 1000 / nDen )+5)/10); + nZoom = static_cast((( nWidth * 1000 / nDen )+5)/10); m_pWidthZoomMF->SetValue(nZoom); if( (nDen = aOrigSize.Height() - nULBorders) > 0) - nZoom = (sal_uInt16)((( nHeight * 1000 / nDen )+5)/10); + nZoom = static_cast((( nHeight * 1000 / nDen )+5)/10); else nZoom = 0; m_pHeightZoomMF->SetValue(nZoom); @@ -699,10 +699,10 @@ void SvxGrfCropPage::GraphicHasChanged( bool bFound ) sTemp += OUStringLiteral1(0x00D7) + aFld->GetText(); if ( aOrigPixelSize.Width() && aOrigPixelSize.Height() ) { - sal_Int32 ax = sal_Int32(floor((float)aOrigPixelSize.Width() / - ((float)aOrigSize.Width()/TWIP_TO_INCH)+0.5)); - sal_Int32 ay = sal_Int32(floor((float)aOrigPixelSize.Height() / - ((float)aOrigSize.Height()/TWIP_TO_INCH)+0.5)); + sal_Int32 ax = sal_Int32(floor(static_cast(aOrigPixelSize.Width()) / + (static_cast(aOrigSize.Width())/TWIP_TO_INCH)+0.5)); + sal_Int32 ay = sal_Int32(floor(static_cast(aOrigPixelSize.Height()) / + (static_cast(aOrigSize.Height())/TWIP_TO_INCH)+0.5)); sTemp += " "; sTemp += CuiResId( RID_SVXSTR_PPI ); OUString sPPI = OUString::number(ax); diff --git a/cui/source/tabpages/labdlg.cxx b/cui/source/tabpages/labdlg.cxx index f16c4c81b4e4..384475316bac 100644 --- a/cui/source/tabpages/labdlg.cxx +++ b/cui/source/tabpages/labdlg.cxx @@ -269,7 +269,7 @@ void SvxCaptionTabPage::Reset( const SfxItemSet* ) nEscAbs = static_cast(m_pMF_ANSATZ->GetValue()); nWhich = GetWhich( SDRATTR_CAPTIONESCREL ); - nEscRel = (long)static_cast( rOutAttrs.Get( nWhich ) ).GetValue(); + nEscRel = static_cast(static_cast( rOutAttrs.Get( nWhich ) ).GetValue()); //------- line length ---------- nWhich = GetWhich( SDRATTR_CAPTIONLINELEN ); diff --git a/cui/source/tabpages/measure.cxx b/cui/source/tabpages/measure.cxx index 63c5ed9104d4..f220327a9c15 100644 --- a/cui/source/tabpages/measure.cxx +++ b/cui/source/tabpages/measure.cxx @@ -318,7 +318,7 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs ) // SdrMeasureUnitItem if( rAttrs->GetItemState( SDRATTR_MEASUREUNIT ) != SfxItemState::DONTCARE ) { - long nFieldUnit = (long) rAttrs->Get( SDRATTR_MEASUREUNIT ).GetValue(); + long nFieldUnit = static_cast(rAttrs->Get( SDRATTR_MEASUREUNIT ).GetValue()); for( sal_Int32 i = 0; i < m_pLbUnit->GetEntryCount(); ++i ) { @@ -511,7 +511,7 @@ bool SvxMeasurePage::FillItemSet( SfxItemSet* rAttrs) { if( nPos != LISTBOX_ENTRY_NOTFOUND ) { - sal_uInt16 nFieldUnit = (sal_uInt16)reinterpret_cast(m_pLbUnit->GetEntryData( nPos )); + sal_uInt16 nFieldUnit = static_cast(reinterpret_cast(m_pLbUnit->GetEntryData( nPos ))); FieldUnit _eUnit = (FieldUnit) nFieldUnit; rAttrs->Put( SdrMeasureUnitItem( _eUnit ) ); bModified = true; @@ -737,7 +737,7 @@ void SvxMeasurePage::ChangeAttrHdl_Impl( void const * p ) sal_Int32 nPos = m_pLbUnit->GetSelectedEntryPos(); if( nPos != LISTBOX_ENTRY_NOTFOUND ) { - sal_uInt16 nFieldUnit = (sal_uInt16)reinterpret_cast(m_pLbUnit->GetEntryData( nPos )); + sal_uInt16 nFieldUnit = static_cast(reinterpret_cast(m_pLbUnit->GetEntryData( nPos ))); FieldUnit _eUnit = (FieldUnit) nFieldUnit; aAttrSet.Put( SdrMeasureUnitItem( _eUnit ) ); } diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index d724ecacc61d..0466d11eec2d 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -918,7 +918,7 @@ void SvxNumberFormatTabPage::UpdateOptions_Impl( bool bCheckCatChange /*= sal_Fa if(nCategory==CAT_CURRENCY) { sal_uInt16 nTstPos=pNumFmtShell->FindCurrencyFormat(theFormat); - if(nCurrencyPos!=static_cast(nTstPos) && nTstPos!=(sal_uInt16)-1) + if(nCurrencyPos!=static_cast(nTstPos) && nTstPos!=sal_uInt16(-1)) { m_pLbCurrency->SelectEntryPos(nTstPos); pNumFmtShell->SetCurrencySymbol(nTstPos); @@ -1095,7 +1095,7 @@ void SvxNumberFormatTabPage::UpdateFormatListBox_Impl m_pFtComment->SetText(m_pLbCategory->GetEntry(1)); } } - ChangePreviewText( (sal_uInt16)nFmtLbSelPos ); + ChangePreviewText( static_cast(nFmtLbSelPos) ); } } @@ -1104,7 +1104,7 @@ void SvxNumberFormatTabPage::UpdateFormatListBox_Impl FillFormatListBox_Impl( aEntryList ); if(nFmtLbSelPos != SELPOS_NONE) { - m_pLbFormat->SelectEntryPos( (sal_uInt16)nFmtLbSelPos ); + m_pLbFormat->SelectEntryPos( static_cast(nFmtLbSelPos) ); m_pFtComment->SetText(pNumFmtShell->GetComment4Entry(nFmtLbSelPos)); if(pNumFmtShell->GetUserDefined4Entry(nFmtLbSelPos)) @@ -1384,7 +1384,7 @@ bool SvxNumberFormatTabPage::Click_Impl(PushButton* pIB) if(nCatLbSelPos==CAT_CURRENCY) { - m_pLbCurrency->SelectEntryPos((sal_uInt16)pNumFmtShell->GetCurrencySymbol()); + m_pLbCurrency->SelectEntryPos(static_cast(pNumFmtShell->GetCurrencySymbol())); } if(bOneAreaFlag && (nFixedCategory!=nCatLbSelPos)) @@ -1420,12 +1420,12 @@ bool SvxNumberFormatTabPage::Click_Impl(PushButton* pIB) pNumFmtShell->SetComment4Entry(nFmtLbSelPos, OUString()); } - m_pLbFormat->SelectEntryPos( (sal_uInt16)nFmtLbSelPos ); + m_pLbFormat->SelectEntryPos( static_cast(nFmtLbSelPos) ); m_pEdFormat->SetText( aFormat ); m_pEdComment->SetText(m_pLbCategory->GetEntry(1)); // String for user defined - ChangePreviewText( (sal_uInt16)nFmtLbSelPos ); + ChangePreviewText( static_cast(nFmtLbSelPos) ); } } } @@ -1469,9 +1469,9 @@ bool SvxNumberFormatTabPage::Click_Impl(PushButton* pIB) else SetCategory(nCatLbSelPos ); - m_pLbFormat->SelectEntryPos( (sal_uInt16)nFmtLbSelPos ); + m_pLbFormat->SelectEntryPos( static_cast(nFmtLbSelPos) ); m_pEdFormat->SetText( aFormat ); - ChangePreviewText( (sal_uInt16)nFmtLbSelPos ); + ChangePreviewText( static_cast(nFmtLbSelPos) ); } else { @@ -1549,12 +1549,12 @@ void SvxNumberFormatTabPage::EditHdl_Impl( Edit const * pEdFormat ) { sal_uInt16 nTmpCurPos=pNumFmtShell->FindCurrencyFormat(aFormat ); - if(nTmpCurPos!=(sal_uInt16)-1) + if(nTmpCurPos!=sal_uInt16(-1)) m_pLbCurrency->SelectEntryPos(nTmpCurPos); } short nPosi=pNumFmtShell->GetListPos4Entry(aFormat); if(nPosi>=0) - m_pLbFormat->SelectEntryPos( (sal_uInt16)nPosi); + m_pLbFormat->SelectEntryPos( static_cast(nPosi)); } else @@ -1610,13 +1610,13 @@ void SvxNumberFormatTabPage::OptHdl_Impl( void const * pOptCtrl ) || ( m_pBtnEngineering->IsVisible() && m_pBtnEngineering->IsEnabled() && m_pBtnEngineering->IsChecked() ); bool bNegRed = m_pBtnNegRed->IsEnabled() && m_pBtnNegRed->IsChecked(); sal_uInt16 nPrecision = (m_pEdDecimals->IsEnabled() && m_pEdDecimals->IsVisible()) - ? (sal_uInt16)m_pEdDecimals->GetValue() + ? static_cast(m_pEdDecimals->GetValue()) : ( (m_pEdDenominator->IsEnabled() && m_pEdDenominator->IsVisible()) - ? (sal_uInt16)m_pEdDenominator->GetValue() - : (sal_uInt16)0 ); + ? static_cast(m_pEdDenominator->GetValue()) + : sal_uInt16(0) ); sal_uInt16 nLeadZeroes = (m_pEdLeadZeroes->IsEnabled()) - ? (sal_uInt16)m_pEdLeadZeroes->GetValue() - : (sal_uInt16)0; + ? static_cast(m_pEdLeadZeroes->GetValue()) + : sal_uInt16(0); if ( pNumFmtShell->GetStandardName() == m_pEdFormat->GetText() ) { m_pEdDecimals->SetValue( nPrecision ); @@ -1625,7 +1625,7 @@ void SvxNumberFormatTabPage::OptHdl_Impl( void const * pOptCtrl ) pNumFmtShell->MakeFormat( aFormat, bThousand, bNegRed, nPrecision, nLeadZeroes, - (sal_uInt16)m_pLbFormat->GetSelectedEntryPos() ); + static_cast(m_pLbFormat->GetSelectedEntryPos()) ); m_pEdFormat->SetText( aFormat ); MakePreviewText( aFormat ); @@ -1675,7 +1675,7 @@ IMPL_LINK( SvxNumberFormatTabPage, LostFocusHdl_Impl, Control&, rControl, void) m_pFtComment->Show(); if(!m_pIbAdd->IsEnabled()) { - sal_uInt16 nSelPos = (sal_uInt16) m_pLbFormat->GetSelectedEntryPos(); + sal_uInt16 nSelPos = static_cast(m_pLbFormat->GetSelectedEntryPos()); pNumFmtShell->SetComment4Entry(nSelPos, m_pEdComment->GetText()); m_pEdComment->SetText(m_pLbCategory->GetEntry(1)); // String for user defined @@ -1813,7 +1813,7 @@ void SvxNumberFormatTabPage::AddAutomaticLanguage_Impl(LanguageType eAutoLang, b { m_pLbLanguage->RemoveLanguage(LANGUAGE_SYSTEM); const sal_Int32 nPos = m_pLbLanguage->InsertEntry(sAutomaticEntry); - m_pLbLanguage->SetEntryData(nPos, reinterpret_cast((sal_uInt16)eAutoLang)); + m_pLbLanguage->SetEntryData(nPos, reinterpret_cast(static_cast(eAutoLang))); if(bSelect) m_pLbLanguage->SelectEntryPos(nPos); } diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index c8cded8ce25d..53495f6168af 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -705,7 +705,7 @@ IMPL_LINK_NOARG(SvxNumPickTabPage, NumSelectHdl_Impl, ValueSet*, void) break; SvxNumberFormat aFmt(pActNum->GetLevel(i)); aFmt.SetNumberingType( pLevelSettings->nNumberType ); - sal_uInt16 nUpperLevelOrChar = (sal_uInt16)pLevelSettings->nParentNumbering; + sal_uInt16 nUpperLevelOrChar = static_cast(pLevelSettings->nParentNumbering); if(aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL) { // #i93908# clear suffix for bullet lists @@ -1022,16 +1022,16 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, Button*, void) BitmapEx aBitmap = aGraphic.GetBitmapEx(); long nPixelX = aBitmap.GetSizePixel().Width(); long nPixelY = aBitmap.GetSizePixel().Height(); - double ratio = nPixelY/(double)nPixelX; + double ratio = nPixelY/static_cast(nPixelX); if(nPixelX > 30) { nPixelX = 30; - nPixelY = (long) (nPixelX*ratio); + nPixelY = static_cast(nPixelX*ratio); } if(nPixelY > 30) { nPixelY = 30; - nPixelX = (long) (nPixelY/ratio); + nPixelX = static_cast(nPixelY/ratio); } aBitmap.Scale( Size( nPixelX, nPixelY ), BmpScaleFlag::Fast ); @@ -1040,9 +1040,9 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, Button*, void) Sequence< PropertyValue > aFilterData( 2 ); aFilterData[ 0 ].Name = "Compression"; - aFilterData[ 0 ].Value <<= (sal_Int32) -1 ; + aFilterData[ 0 ].Value <<= sal_Int32(-1) ; aFilterData[ 1 ].Name = "Quality"; - aFilterData[ 1 ].Value <<= (sal_Int32) 1; + aFilterData[ 1 ].Value <<= sal_Int32(1); sal_uInt16 nFilterFormat = rFilter.GetExportFormatNumberForShortName( gURL.GetFileExtension() ); rFilter.ExportGraphic( aScaledGraphic, gURL , nFilterFormat, &aFilterData ); @@ -1399,7 +1399,7 @@ void SvxNumOptionsTabPage::Reset( const SfxItemSet* rSet ) sal_Int32 nFmtCount = m_pFmtLB->GetEntryCount(); for(sal_Int32 i = nFmtCount; i; i--) { - sal_uInt16 nEntryData = (sal_uInt16)reinterpret_cast(m_pFmtLB->GetEntryData(i - 1)); + sal_uInt16 nEntryData = static_cast(reinterpret_cast(m_pFmtLB->GetEntryData(i - 1))); if(/*SVX_NUM_NUMBER_NONE == nEntryData ||*/ (SVX_NUM_BITMAP|LINK_TOKEN) == nEntryData) m_pFmtLB->RemoveEntry(i - 1); @@ -1426,7 +1426,7 @@ void SvxNumOptionsTabPage::Reset( const SfxItemSet* rSet ) sal_Int32 nFmtCount = m_pFmtLB->GetEntryCount(); for(sal_Int32 i = nFmtCount; i; i--) { - sal_uInt16 nEntryData = (sal_uInt16)reinterpret_cast(m_pFmtLB->GetEntryData(i - 1)); + sal_uInt16 nEntryData = static_cast(reinterpret_cast(m_pFmtLB->GetEntryData(i - 1))); if( /*nEntryData >= SVX_NUM_CHARS_UPPER_LETTER &&*/ nEntryData <= SVX_NUM_NUMBER_NONE) m_pFmtLB->RemoveEntry(i - 1); } @@ -1724,7 +1724,7 @@ IMPL_LINK( SvxNumOptionsTabPage, AllLevelHdl_Impl, Edit&, rBox, void ) if(nActNumLvl & nMask) { SvxNumberFormat aNumFmt(pActNum->GetLevel(e)); - aNumFmt.SetIncludeUpperLevels((sal_uInt8) std::min(static_cast(rBox).GetValue(), sal_Int64(e + 1)) ); + aNumFmt.SetIncludeUpperLevels(static_cast(std::min(static_cast(rBox).GetValue(), sal_Int64(e + 1))) ); pActNum->SetLevel(e, aNumFmt); } nMask <<= 1; @@ -1839,7 +1839,7 @@ IMPL_LINK( SvxNumOptionsTabPage, OrientHdl_Impl, ListBox&, rBox, void ) { const SvxBrushItem* pBrushItem = aNumFmt.GetBrush(); const Size& rSize = aNumFmt.GetGraphicSize(); - sal_Int16 eOrient = (sal_Int16)nPos; + sal_Int16 eOrient = static_cast(nPos); aNumFmt.SetGraphicBrush( pBrushItem, &rSize, &eOrient ); pActNum->SetLevel(i, aNumFmt); } @@ -1887,7 +1887,7 @@ IMPL_LINK(SvxNumOptionsTabPage, BulColorHdl_Impl, SvxColorListBox&, rColorBox, v IMPL_LINK( SvxNumOptionsTabPage, BulRelSizeHdl_Impl, Edit&, rField, void) { - sal_uInt16 nRelSize = (sal_uInt16)static_cast(rField).GetValue(); + sal_uInt16 nRelSize = static_cast(static_cast(rField).GetValue()); sal_uInt16 nMask = 1; for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) @@ -2014,8 +2014,8 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, PopupActivateHdl_Impl, MenuButton *, void) { bool bWidth = aSize.Width() > aSize.Height(); double nScale = bWidth ? - (double)MAX_BMP_WIDTH / (double)aSize.Width(): - (double)MAX_BMP_HEIGHT / (double)aSize.Height(); + double(MAX_BMP_WIDTH) / static_cast(aSize.Width()): + double(MAX_BMP_HEIGHT) / static_cast(aSize.Height()); aBitmap.Scale(nScale, nScale); } Image aImage(aBitmap); @@ -2084,7 +2084,7 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, BulletHdl_Impl, Button*, void) { SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); aNumFmt.SetBulletFont(&aActBulletFont); - aNumFmt.SetBulletChar( (sal_Unicode) pMap->GetChar() ); + aNumFmt.SetBulletChar( static_cast(pMap->GetChar()) ); pActNum->SetLevel(i, aNumFmt); } _nMask <<= 1; @@ -2120,9 +2120,9 @@ IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, Edit&, rField, void) Size aSaveSize(aSize); if (aInitSize[i].Height()) - fSizeRatio = (double)aInitSize[i].Width() / (double)aInitSize[i].Height(); + fSizeRatio = static_cast(aInitSize[i].Width()) / static_cast(aInitSize[i].Height()); else - fSizeRatio = (double)1; + fSizeRatio = double(1); if(bWidth) { @@ -2130,7 +2130,7 @@ IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, Edit&, rField, void) aSize.Width() = nWidthVal; if (bRatio) { - aSize.Height() = aInitSize[i].Height() + (long)((double)nDelta / fSizeRatio); + aSize.Height() = aInitSize[i].Height() + static_cast(static_cast(nDelta) / fSizeRatio); m_pHeightMF->SetUserValue(m_pHeightMF->Normalize( OutputDevice::LogicToLogic( aSize.Height(), eCoreUnit, MapUnit::Map100thMM )), FUNIT_100TH_MM); @@ -2142,7 +2142,7 @@ IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, Edit&, rField, void) aSize.Height() = nHeightVal; if (bRatio) { - aSize.Width() = aInitSize[i].Width() + (long)((double)nDelta * fSizeRatio); + aSize.Width() = aInitSize[i].Width() + static_cast(static_cast(nDelta) * fSizeRatio); m_pWidthMF->SetUserValue(m_pWidthMF->Normalize( OutputDevice::LogicToLogic( aSize.Width(), eCoreUnit, MapUnit::Map100thMM )), FUNIT_100TH_MM); @@ -2221,7 +2221,7 @@ void SvxNumOptionsTabPage::EditModifyHdl_Impl( Edit* pEdit ) else if(bSuffix) aNumFmt.SetSuffix( m_pSuffixED->GetText() ); else if(bStart) - aNumFmt.SetStart( (sal_uInt16)m_pStartED->GetValue() ); + aNumFmt.SetStart( static_cast(m_pStartED->GetValue()) ); pActNum->SetLevel(i, aNumFmt); } nMask <<= 1; @@ -2241,7 +2241,7 @@ static sal_uInt16 lcl_DrawGraphic(VirtualDevice* pVDev, const SvxNumberFormat &r { Size aGSize( rFmt.GetGraphicSize() ); aGSize.Width() /= nDivision; - nRet = (sal_uInt16)aGSize.Width(); + nRet = static_cast(aGSize.Width()); aGSize.Height() /= nDivision; pGrf->Draw( pVDev, Point(nXStart,nYMiddle - ( aGSize.Height() / 2) ), pVDev->PixelToLogic( aGSize ) ); @@ -2280,7 +2280,7 @@ static sal_uInt16 lcl_DrawBullet(VirtualDevice* pVDev, long nY = nYStart; nY -= ((aTmpSize.Height() - rSize.Height())/ 2); pVDev->DrawText( Point(nXStart, nY), aText ); - sal_uInt16 nRet = (sal_uInt16)pVDev->GetTextWidth(aText); + sal_uInt16 nRet = static_cast(pVDev->GetTextWidth(aText)); pVDev->SetFont(aTmpFont); return nRet; @@ -2425,7 +2425,7 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tool pVDev->SetFont(aStdFont); OUString aText(' '); pVDev->DrawText( Point(nNumberXPos, nYStart), aText ); - nBulletWidth = nBulletWidth + (sal_uInt16)pVDev->GetTextWidth(aText); + nBulletWidth = nBulletWidth + static_cast(pVDev->GetTextWidth(aText)); } sal_uInt16 nTextXPos( 0 ); @@ -2540,7 +2540,7 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tool OUString aText(pActNum->MakeNumString(aNum)); pVDev->DrawText(Point(nXStart, nYStart), aText); pVDev->SetFont(aStdFont); - nTextOffset = (sal_uInt16)pVDev->GetTextWidth(aText); + nTextOffset = static_cast(pVDev->GetTextWidth(aText)); nTextOffset = nTextOffset + nXStep; nPreNum++; } @@ -2813,13 +2813,13 @@ void SvxNumPositionTabPage::InitControls() long nDistBorderNum; if(bRelative) { - nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset(); + nDistBorderNum = static_cast(aNumFmtArr[nLvl]->GetAbsLSpace())+ aNumFmtArr[nLvl]->GetFirstLineOffset(); if(nLvl) - nDistBorderNum -= (long)aNumFmtArr[nLvl - 1]->GetAbsLSpace()+ aNumFmtArr[nLvl - 1]->GetFirstLineOffset(); + nDistBorderNum -= static_cast(aNumFmtArr[nLvl - 1]->GetAbsLSpace())+ aNumFmtArr[nLvl - 1]->GetFirstLineOffset(); } else { - nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset(); + nDistBorderNum = static_cast(aNumFmtArr[nLvl]->GetAbsLSpace())+ aNumFmtArr[nLvl]->GetFirstLineOffset(); } SetMetricValue(*m_pDistBorderMF, nDistBorderNum, eCoreUnit); } @@ -3241,12 +3241,12 @@ IMPL_LINK( SvxNumPositionTabPage, DistanceHdl_Impl, SpinField&, rFld, void ) } else { - aNumFmt.SetAbsLSpace( (short)nValue - aNumFmt.GetFirstLineOffset()); + aNumFmt.SetAbsLSpace( static_cast(nValue) - aNumFmt.GetFirstLineOffset()); } } else if (&rFld == m_pDistNumMF) { - aNumFmt.SetCharTextDistance( (short)nValue ); + aNumFmt.SetCharTextDistance( static_cast(nValue) ); } else if (&rFld == m_pIndentMF) { @@ -3254,7 +3254,7 @@ IMPL_LINK( SvxNumPositionTabPage, DistanceHdl_Impl, SpinField&, rFld, void ) long nDiff = nValue + aNumFmt.GetFirstLineOffset(); long nAbsLSpace = aNumFmt.GetAbsLSpace(); aNumFmt.SetAbsLSpace(sal_uInt16(nAbsLSpace + nDiff)); - aNumFmt.SetFirstLineOffset( -(short)nValue ); + aNumFmt.SetFirstLineOffset( -static_cast(nValue) ); } pActNum->SetLevel( i, aNumFmt ); diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index 4f2303c28a40..36548ec99905 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -133,10 +133,10 @@ bool IsEqualSize_Impl( const SvxSizeItem* pSize, const Size& rSize ) } -#define MARGIN_LEFT ( (MarginPosition)0x0001 ) -#define MARGIN_RIGHT ( (MarginPosition)0x0002 ) -#define MARGIN_TOP ( (MarginPosition)0x0004 ) -#define MARGIN_BOTTOM ( (MarginPosition)0x0008 ) +#define MARGIN_LEFT ( MarginPosition(0x0001) ) +#define MARGIN_RIGHT ( MarginPosition(0x0002) ) +#define MARGIN_TOP ( MarginPosition(0x0004) ) +#define MARGIN_BOTTOM ( MarginPosition(0x0008) ) // class SvxPageDescPage -------------------------------------------------- @@ -420,10 +420,10 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet ) const SvxLRSpaceItem& rLRSpace = static_cast(*pItem); SetMetricValue( *m_pLeftMarginEdit, rLRSpace.GetLeft(), eUnit ); m_pBspWin->SetLeft( - (sal_uInt16)ConvertLong_Impl( rLRSpace.GetLeft(), eUnit ) ); + static_cast(ConvertLong_Impl( rLRSpace.GetLeft(), eUnit )) ); SetMetricValue( *m_pRightMarginEdit, rLRSpace.GetRight(), eUnit ); m_pBspWin->SetRight( - (sal_uInt16)ConvertLong_Impl( rLRSpace.GetRight(), eUnit ) ); + static_cast(ConvertLong_Impl( rLRSpace.GetRight(), eUnit )) ); } // adjust margins (top/bottom) @@ -434,10 +434,10 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet ) const SvxULSpaceItem& rULSpace = static_cast(*pItem); SetMetricValue( *m_pTopMarginEdit, rULSpace.GetUpper(), eUnit ); m_pBspWin->SetTop( - (sal_uInt16)ConvertLong_Impl( (long)rULSpace.GetUpper(), eUnit ) ); + static_cast(ConvertLong_Impl( static_cast(rULSpace.GetUpper()), eUnit )) ); SetMetricValue( *m_pBottomMarginEdit, rULSpace.GetLower(), eUnit ); m_pBspWin->SetBottom( - (sal_uInt16)ConvertLong_Impl( (long)rULSpace.GetLower(), eUnit ) ); + static_cast(ConvertLong_Impl( static_cast(rULSpace.GetLower()), eUnit )) ); } // general page data @@ -462,7 +462,7 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet ) //adjust numeration type of the page style //Get the Position of the saved NumType for(int i=0; iGetEntryCount(); i++) - if(eNumType == (sal_uInt16)reinterpret_cast(m_pNumberFormatBox->GetEntryData(i))) + if(eNumType == static_cast(reinterpret_cast(m_pNumberFormatBox->GetEntryData(i)))) { m_pNumberFormatBox->SelectEntryPos( i ); break; @@ -485,10 +485,10 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet ) if ( PAPERBIN_PRINTER_SETTINGS == nPaperBin ) aBinName = EditResId(RID_SVXSTR_PAPERBIN_SETTINGS); else - aBinName = mpDefPrinter->GetPaperBinName( (sal_uInt16)nPaperBin ); + aBinName = mpDefPrinter->GetPaperBinName( static_cast(nPaperBin) ); const sal_Int32 nEntryPos = m_pPaperTrayBox->InsertEntry( aBinName ); - m_pPaperTrayBox->SetEntryData( nEntryPos, reinterpret_cast((sal_uLong)nPaperBin) ); + m_pPaperTrayBox->SetEntryData( nEntryPos, reinterpret_cast(static_cast(nPaperBin)) ); m_pPaperTrayBox->SelectEntry( aBinName ); Size aPaperSize = SvxPaperInfo::GetPaperSize( mpDefPrinter ); @@ -662,13 +662,13 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet ) if ( m_pLeftMarginEdit->IsValueChangedFromSaved() ) { - aMargin.SetLeft( (sal_uInt16)GetCoreValue( *m_pLeftMarginEdit, eUnit ) ); + aMargin.SetLeft( static_cast(GetCoreValue( *m_pLeftMarginEdit, eUnit )) ); bModified = true; } if ( m_pRightMarginEdit->IsValueChangedFromSaved() ) { - aMargin.SetRight( (sal_uInt16)GetCoreValue( *m_pRightMarginEdit, eUnit ) ); + aMargin.SetRight( static_cast(GetCoreValue( *m_pRightMarginEdit, eUnit )) ); bModified = true; } @@ -687,13 +687,13 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet ) if ( m_pTopMarginEdit->IsValueChangedFromSaved() ) { - aTopMargin.SetUpper( (sal_uInt16)GetCoreValue( *m_pTopMarginEdit, eUnit ) ); + aTopMargin.SetUpper( static_cast(GetCoreValue( *m_pTopMarginEdit, eUnit )) ); bMod = true; } if ( m_pBottomMarginEdit->IsValueChangedFromSaved() ) { - aTopMargin.SetLower( (sal_uInt16)GetCoreValue( *m_pBottomMarginEdit, eUnit ) ); + aTopMargin.SetLower( static_cast(GetCoreValue( *m_pBottomMarginEdit, eUnit )) ); bMod = true; } @@ -713,12 +713,12 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet ) // paper tray nWhich = GetWhich( SID_ATTR_PAGE_PAPERBIN ); sal_Int32 nPos = m_pPaperTrayBox->GetSelectedEntryPos(); - sal_uInt16 nBin = (sal_uInt16)reinterpret_cast(m_pPaperTrayBox->GetEntryData( nPos )); + sal_uInt16 nBin = static_cast(reinterpret_cast(m_pPaperTrayBox->GetEntryData( nPos ))); pOld = GetOldItem( *rSet, SID_ATTR_PAGE_PAPERBIN ); if ( !pOld || static_cast(pOld)->GetValue() != nBin ) { - rSet->Put( SvxPaperBinItem( nWhich, (sal_uInt8)nBin ) ); + rSet->Put( SvxPaperBinItem( nWhich, static_cast(nBin) ) ); bModified = true; } @@ -901,7 +901,7 @@ IMPL_LINK_NOARG(SvxPageDescPage, PaperBinHdl_Impl, Control&, void) sal_Int32 nEntryPos = m_pPaperTrayBox->InsertEntry( EditResId( RID_SVXSTR_PAPERBIN_SETTINGS ) ); m_pPaperTrayBox->SetEntryData( nEntryPos, - reinterpret_cast((sal_uLong)PAPERBIN_PRINTER_SETTINGS) ); + reinterpret_cast(sal_uLong(PAPERBIN_PRINTER_SETTINGS)) ); OUString aPaperBin( EditResId( RID_SVXSTR_PAPERBIN ) ); const sal_uInt16 nBinCount = mpDefPrinter->GetPaperBinCount(); @@ -914,7 +914,7 @@ IMPL_LINK_NOARG(SvxPageDescPage, PaperBinHdl_Impl, Control&, void) aName = aPaperBin + " " + OUString::number( i+1 ); } nEntryPos = m_pPaperTrayBox->InsertEntry( aName ); - m_pPaperTrayBox->SetEntryData( nEntryPos, reinterpret_cast((sal_uLong)i) ); + m_pPaperTrayBox->SetEntryData( nEntryPos, reinterpret_cast(static_cast(i)) ); } m_pPaperTrayBox->SelectEntry( aOldName ); m_pPaperTrayBox->SetUpdateMode( true ); diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index a16097152592..fc050eb31451 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -124,21 +124,21 @@ void SetLineSpace_Impl( SvxLineSpacingItem& rLineSpace, case LLINESPACE_PROP: rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Auto ); - rLineSpace.SetPropLineSpace( (sal_uInt8)lValue ); + rLineSpace.SetPropLineSpace( static_cast(lValue) ); break; case LLINESPACE_MIN: - rLineSpace.SetLineHeight( (sal_uInt16)lValue ); + rLineSpace.SetLineHeight( static_cast(lValue) ); rLineSpace.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off ); break; case LLINESPACE_DURCH: rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Auto ); - rLineSpace.SetInterLineSpace( (sal_uInt16)lValue ); + rLineSpace.SetInterLineSpace( static_cast(lValue) ); break; case LLINESPACE_FIX: - rLineSpace.SetLineHeight((sal_uInt16)lValue); + rLineSpace.SetLineHeight(static_cast(lValue)); rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Fix ); rLineSpace.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off ); break; @@ -277,21 +277,21 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet ) if ( m_pTopDist->IsRelative() ) aMargin.SetUpper( rOldItem.GetUpper(), - (sal_uInt16)m_pTopDist->GetValue() ); + static_cast(m_pTopDist->GetValue()) ); else - aMargin.SetUpper( (sal_uInt16)GetCoreValue( *m_pTopDist, eUnit ) ); + aMargin.SetUpper( static_cast(GetCoreValue( *m_pTopDist, eUnit )) ); if ( m_pBottomDist->IsRelative() ) aMargin.SetLower( rOldItem.GetLower(), - (sal_uInt16)m_pBottomDist->GetValue() ); + static_cast(m_pBottomDist->GetValue()) ); else - aMargin.SetLower( (sal_uInt16)GetCoreValue( *m_pBottomDist, eUnit ) ); + aMargin.SetLower( static_cast(GetCoreValue( *m_pBottomDist, eUnit )) ); } else { - aMargin.SetUpper( (sal_uInt16)GetCoreValue( *m_pTopDist, eUnit ) ); - aMargin.SetLower( (sal_uInt16)GetCoreValue( *m_pBottomDist, eUnit ) ); + aMargin.SetUpper( static_cast(GetCoreValue( *m_pTopDist, eUnit )) ); + aMargin.SetLower( static_cast(GetCoreValue( *m_pBottomDist, eUnit )) ); } aMargin.SetContextValue(m_pContextualCB->IsChecked()); eState = GetItemSet().GetItemState( nWhich ); @@ -324,29 +324,29 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet ) if ( m_pLeftIndent->IsRelative() ) aMargin.SetTextLeft( rOldItem.GetTextLeft(), - (sal_uInt16)m_pLeftIndent->GetValue() ); + static_cast(m_pLeftIndent->GetValue()) ); else aMargin.SetTextLeft( GetCoreValue( *m_pLeftIndent, eUnit ) ); if ( m_pRightIndent->IsRelative() ) aMargin.SetRight( rOldItem.GetRight(), - (sal_uInt16)m_pRightIndent->GetValue() ); + static_cast(m_pRightIndent->GetValue()) ); else aMargin.SetRight( GetCoreValue( *m_pRightIndent, eUnit ) ); if ( m_pFLineIndent->IsRelative() ) aMargin.SetTextFirstLineOfst( rOldItem.GetTextFirstLineOfst(), - (sal_uInt16)m_pFLineIndent->GetValue() ); + static_cast(m_pFLineIndent->GetValue()) ); else aMargin.SetTextFirstLineOfst( - (sal_uInt16)GetCoreValue( *m_pFLineIndent, eUnit ) ); + static_cast(GetCoreValue( *m_pFLineIndent, eUnit )) ); } else { aMargin.SetTextLeft( GetCoreValue( *m_pLeftIndent, eUnit ) ); aMargin.SetRight( GetCoreValue( *m_pRightIndent, eUnit ) ); aMargin.SetTextFirstLineOfst( - (sal_uInt16)GetCoreValue( *m_pFLineIndent, eUnit ) ); + static_cast(GetCoreValue( *m_pFLineIndent, eUnit )) ); } aMargin.SetAutoFirst(m_pAutoCB->IsChecked()); if ( aMargin.GetTextFirstLineOfst() < 0 ) @@ -879,11 +879,11 @@ void SvxStdParagraphTabPage::Init_Impl() void SvxStdParagraphTabPage::UpdateExample_Impl() { - m_pExampleWin->SetFirstLineOfst( (short)m_pFLineIndent->Denormalize( m_pFLineIndent->GetValue( FUNIT_TWIP ) ) ); + m_pExampleWin->SetFirstLineOfst( static_cast(m_pFLineIndent->Denormalize( m_pFLineIndent->GetValue( FUNIT_TWIP ) )) ); m_pExampleWin->SetLeftMargin( static_cast(m_pLeftIndent->Denormalize( m_pLeftIndent->GetValue( FUNIT_TWIP ) ) ) ); m_pExampleWin->SetRightMargin( static_cast(m_pRightIndent->Denormalize( m_pRightIndent->GetValue( FUNIT_TWIP ) ) ) ); - m_pExampleWin->SetUpper( (sal_uInt16)m_pTopDist->Denormalize( m_pTopDist->GetValue( FUNIT_TWIP ) ) ); - m_pExampleWin->SetLower( (sal_uInt16)m_pBottomDist->Denormalize( m_pBottomDist->GetValue( FUNIT_TWIP ) ) ); + m_pExampleWin->SetUpper( static_cast(m_pTopDist->Denormalize( m_pTopDist->GetValue( FUNIT_TWIP ) )) ); + m_pExampleWin->SetLower( static_cast(m_pBottomDist->Denormalize( m_pBottomDist->GetValue( FUNIT_TWIP ) )) ); sal_Int32 nPos = m_pLineDist->GetSelectedEntryPos(); @@ -1381,10 +1381,10 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet ) if ( eHyphenState == TRISTATE_TRUE ) { - aHyphen.GetMinLead() = (sal_uInt8)m_pExtHyphenBeforeBox->GetValue(); - aHyphen.GetMinTrail() = (sal_uInt8)m_pExtHyphenAfterBox->GetValue(); + aHyphen.GetMinLead() = static_cast(m_pExtHyphenBeforeBox->GetValue()); + aHyphen.GetMinTrail() = static_cast(m_pExtHyphenAfterBox->GetValue()); } - aHyphen.GetMaxHyphens() = (sal_uInt8)m_pMaxHyphenEdit->GetValue(); + aHyphen.GetMaxHyphens() = static_cast(m_pMaxHyphenEdit->GetValue()); if ( !pOld || !( *static_cast(pOld) == aHyphen ) || @@ -1542,7 +1542,7 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet ) m_pWidowRowNo->IsValueModified() ) { SvxWidowsItem rItem( eState == TRISTATE_TRUE ? - (sal_uInt8)m_pWidowRowNo->GetValue() : 0, _nWhich ); + static_cast(m_pWidowRowNo->GetValue()) : 0, _nWhich ); pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_WIDOWS ); if ( m_pWidowBox->IsValueChangedFromSaved() || !pOld || !( *static_cast(pOld) == rItem ) ) @@ -1559,7 +1559,7 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet ) m_pOrphanRowNo->IsValueModified() ) { SvxOrphansItem rItem( eState == TRISTATE_TRUE ? - (sal_uInt8)m_pOrphanRowNo->GetValue() : 0, _nWhich ); + static_cast(m_pOrphanRowNo->GetValue()) : 0, _nWhich ); pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_ORPHANS ); if ( m_pOrphanBox->IsValueChangedFromSaved() || diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx index 93eca0ac14f7..bc9995dcd5bb 100644 --- a/cui/source/tabpages/swpossizetabpage.cxx +++ b/cui/source/tabpages/swpossizetabpage.cxx @@ -1025,12 +1025,12 @@ void SvxSwPosSizeTabPage::Reset( const SfxItemSet* rSet) } pItem = GetItem( *rSet, SID_ATTR_TRANSFORM_WIDTH ); - sal_Int32 nWidth = std::max( pItem ? ( static_cast(pItem)->GetValue()) : 0, (sal_uInt32)1 ); + sal_Int32 nWidth = std::max( pItem ? ( static_cast(pItem)->GetValue()) : 0, sal_uInt32(1) ); m_pWidthMF->SetValue(m_pWidthMF->Normalize(nWidth), FUNIT_TWIP); pItem = GetItem( *rSet, SID_ATTR_TRANSFORM_HEIGHT ); - sal_Int32 nHeight = std::max( pItem ? ( static_cast(pItem)->GetValue()) : 0, (sal_uInt32)1 ); + sal_Int32 nHeight = std::max( pItem ? ( static_cast(pItem)->GetValue()) : 0, sal_uInt32(1) ); m_pHeightMF->SetValue(m_pHeightMF->Normalize(nHeight), FUNIT_TWIP); m_fWidthHeightRatio = double(nWidth) / double(nHeight); @@ -1165,8 +1165,8 @@ IMPL_LINK_NOARG(SvxSwPosSizeTabPage, RangeModifyHdl, Control&, void) sal_uInt16 nAlign = GetAlignment(m_pHMap, nMapPos, *m_pHoriToLB); sal_uInt16 nRel = GetRelation(*m_pHoriToLB); - aVal.nHoriOrient = (short)nAlign; - aVal.nHRelOrient = (short)nRel; + aVal.nHoriOrient = static_cast(nAlign); + aVal.nHRelOrient = static_cast(nRel); } else aVal.nHoriOrient = HoriOrientation::NONE; @@ -1178,8 +1178,8 @@ IMPL_LINK_NOARG(SvxSwPosSizeTabPage, RangeModifyHdl, Control&, void) sal_uInt16 nAlign = GetAlignment(m_pVMap, nMapPos, *m_pVertToLB); sal_uInt16 nRel = GetRelation(*m_pVertToLB); - aVal.nVertOrient = (short)nAlign; - aVal.nVRelOrient = (short)nRel; + aVal.nVertOrient = static_cast(nAlign); + aVal.nVRelOrient = static_cast(nRel); } else aVal.nVertOrient = VertOrientation::NONE; @@ -1378,12 +1378,12 @@ IMPL_LINK( SvxSwPosSizeTabPage, ModifyHdl, Edit&, rEdit, void ) { if ( &rEdit == m_pWidthMF ) { - nHeight = sal_Int64((double)nWidth / m_fWidthHeightRatio); + nHeight = sal_Int64(static_cast(nWidth) / m_fWidthHeightRatio); m_pHeightMF->SetValue(m_pHeightMF->Normalize(nHeight), FUNIT_TWIP); } else if(&rEdit == m_pHeightMF) { - nWidth = sal_Int64((double)nHeight * m_fWidthHeightRatio); + nWidth = sal_Int64(static_cast(nHeight) * m_fWidthHeightRatio); m_pWidthMF->SetValue(m_pWidthMF->Normalize(nWidth), FUNIT_TWIP); } } diff --git a/cui/source/tabpages/tabstpge.cxx b/cui/source/tabpages/tabstpge.cxx index ee55f1bb1a93..aa72b0f452d7 100644 --- a/cui/source/tabpages/tabstpge.cxx +++ b/cui/source/tabpages/tabstpge.cxx @@ -105,10 +105,10 @@ SvxTabulatorTabPage::SvxTabulatorTabPage(vcl::Window* pParent, const SfxItemSet& m_pRightWin->SetTabulatorTabPage(this); m_pCenterWin->SetTabulatorTabPage(this); m_pDezWin->SetTabulatorTabPage(this); - m_pLeftWin->SetTabStyle((sal_uInt16)(RULER_TAB_LEFT|WB_HORZ)); - m_pRightWin->SetTabStyle((sal_uInt16)(RULER_TAB_RIGHT|WB_HORZ)); - m_pCenterWin->SetTabStyle((sal_uInt16)(RULER_TAB_CENTER|WB_HORZ)); - m_pDezWin->SetTabStyle((sal_uInt16)(RULER_TAB_DECIMAL|WB_HORZ)); + m_pLeftWin->SetTabStyle(sal_uInt16(RULER_TAB_LEFT|WB_HORZ)); + m_pRightWin->SetTabStyle(sal_uInt16(RULER_TAB_RIGHT|WB_HORZ)); + m_pCenterWin->SetTabStyle(sal_uInt16(RULER_TAB_CENTER|WB_HORZ)); + m_pDezWin->SetTabStyle(sal_uInt16(RULER_TAB_DECIMAL|WB_HORZ)); //upper radiobuttons SvtCJKOptions aCJKOptions; get(m_pLeftTab, aCJKOptions.IsAsianTypographyEnabled() ? "radiobuttonST_LEFTTAB_ASIAN" : "radiobuttonBTN_TABTYPE_LEFT"); diff --git a/cui/source/tabpages/textanim.cxx b/cui/source/tabpages/textanim.cxx index 5d994f078271..bab7754a2de0 100644 --- a/cui/source/tabpages/textanim.cxx +++ b/cui/source/tabpages/textanim.cxx @@ -247,7 +247,7 @@ void SvxTextAnimationPage::Reset( const SfxItemSet* rAttrs ) if( pItem ) { m_pTsbEndless->EnableTriState( false ); - long nValue = (long) static_cast(pItem)->GetValue(); + long nValue = static_cast(static_cast(pItem)->GetValue()); m_pNumFldCount->SetValue( nValue ); if( nValue == 0 ) { @@ -280,7 +280,7 @@ void SvxTextAnimationPage::Reset( const SfxItemSet* rAttrs ) if( pItem ) { m_pTsbAuto->EnableTriState( false ); - long nValue = (long) static_cast(pItem)->GetValue(); + long nValue = static_cast(static_cast(pItem)->GetValue()); m_pMtrFldDelay->SetValue( nValue ); if( nValue == 0 ) { @@ -305,7 +305,7 @@ void SvxTextAnimationPage::Reset( const SfxItemSet* rAttrs ) if( pItem ) { m_pTsbPixel->EnableTriState( false ); - long nValue = (long) static_cast(pItem)->GetValue(); + long nValue = static_cast(static_cast(pItem)->GetValue()); if( nValue <= 0 ) { m_pTsbPixel->SetState( TRISTATE_TRUE ); @@ -420,7 +420,7 @@ bool SvxTextAnimationPage::FillItemSet( SfxItemSet* rAttrs) } } if( bModified ) - rAttrs->Put( SdrTextAniCountItem( (sal_uInt16) nValue ) ); + rAttrs->Put( SdrTextAniCountItem( static_cast(nValue) ) ); } // delay @@ -441,7 +441,7 @@ bool SvxTextAnimationPage::FillItemSet( SfxItemSet* rAttrs) } } if( bModified ) - rAttrs->Put( SdrTextAniDelayItem( (sal_uInt16) nValue ) ); + rAttrs->Put( SdrTextAniDelayItem( static_cast(nValue) ) ); } // step size @@ -460,7 +460,7 @@ bool SvxTextAnimationPage::FillItemSet( SfxItemSet* rAttrs) { nValue = GetCoreValue( *m_pMtrFldAmount, eUnit ); } - rAttrs->Put( SdrTextAniAmountItem( (sal_Int16) nValue ) ); + rAttrs->Put( SdrTextAniAmountItem( static_cast(nValue) ) ); bModified = true; } diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index b74041e211c0..f1b1752c8659 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -290,8 +290,8 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs ) pItemTransfHeight= GetItem( rGeoAttr, SID_ATTR_TRANSFORM_HEIGHT ); } } - m_fObjectWidth = std::max( pItemTransfWidth ? (double)static_cast(pItemTransfWidth)->GetValue() : 0.0, 1.0 ); - m_fObjectHeight = std::max( pItemTransfHeight ? (double)static_cast(pItemTransfHeight)->GetValue() : 0.0, 1.0 ); + m_fObjectWidth = std::max( pItemTransfWidth ? static_cast(static_cast(pItemTransfWidth)->GetValue()) : 0.0, 1.0 ); + m_fObjectHeight = std::max( pItemTransfHeight ? static_cast(static_cast(pItemTransfHeight)->GetValue()) : 0.0, 1.0 ); double fTmpWidth((OutputDevice::LogicToLogic(static_cast(m_fObjectWidth), mePoolUnit, MapUnit::Map100thMM )) / fUIScale); m_fObjectWidth = fTmpWidth; diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index 055bf4f19af8..4fe0db177ddc 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -325,9 +325,9 @@ IMPL_LINK(SvxColorTabPage, ModifiedHdl_Impl, Edit&, rEdit, void) aCurrentColor = Color(m_pHexcustom->GetColor()); else { - aCurrentColor.SetColor ( Color( (sal_uInt8)PercentToColor_Impl( (sal_uInt16) m_pRcustom->GetValue() ), - (sal_uInt8)PercentToColor_Impl( (sal_uInt16) m_pGcustom->GetValue() ), - (sal_uInt8)PercentToColor_Impl( (sal_uInt16) m_pBcustom->GetValue() ) ).GetColor() ); + aCurrentColor.SetColor ( Color( static_cast(PercentToColor_Impl( static_cast(m_pRcustom->GetValue()) )), + static_cast(PercentToColor_Impl( static_cast(m_pGcustom->GetValue()) )), + static_cast(PercentToColor_Impl( static_cast(m_pBcustom->GetValue()) )) ).GetColor() ); } UpdateColorValues(); @@ -335,10 +335,10 @@ IMPL_LINK(SvxColorTabPage, ModifiedHdl_Impl, Edit&, rEdit, void) else { // read current MtrFields, if cmyk, then k-value as transparency - aCurrentColor.SetColor ( Color( (sal_uInt8)PercentToColor_Impl( (sal_uInt16) m_pKcustom->GetValue() ), - (sal_uInt8)PercentToColor_Impl( (sal_uInt16) m_pCcustom->GetValue() ), - (sal_uInt8)PercentToColor_Impl( (sal_uInt16) m_pYcustom->GetValue() ), - (sal_uInt8)PercentToColor_Impl( (sal_uInt16) m_pMcustom->GetValue() ) ).GetColor() ); + aCurrentColor.SetColor ( Color( static_cast(PercentToColor_Impl( static_cast(m_pKcustom->GetValue()) )), + static_cast(PercentToColor_Impl( static_cast(m_pCcustom->GetValue()) )), + static_cast(PercentToColor_Impl( static_cast(m_pYcustom->GetValue()) )), + static_cast(PercentToColor_Impl( static_cast(m_pMcustom->GetValue()) )) ).GetColor() ); ConvertColorValues (aCurrentColor, ColorModel::RGB); } @@ -540,8 +540,8 @@ void SvxColorTabPage::ConvertColorValues (Color& rColor, ColorModel eModell) { case ColorModel::RGB: { - CmykToRgb_Impl (rColor, (sal_uInt16)rColor.GetTransparency() ); - rColor.SetTransparency ((sal_uInt8) 0); + CmykToRgb_Impl (rColor, static_cast(rColor.GetTransparency()) ); + rColor.SetTransparency (sal_uInt8(0)); } break; @@ -549,7 +549,7 @@ void SvxColorTabPage::ConvertColorValues (Color& rColor, ColorModel eModell) { sal_uInt16 nK; RgbToCmyk_Impl (rColor, nK ); - rColor.SetTransparency ((sal_uInt8) nK); + rColor.SetTransparency (static_cast(nK)); } break; } @@ -703,19 +703,19 @@ void SvxColorTabPage::CmykToRgb_Impl( Color& rColor, const sal_uInt16 nK ) if( lTemp < 0 ) lTemp = 0; - rColor.SetRed( (sal_uInt8)lTemp ); + rColor.SetRed( static_cast(lTemp) ); lTemp = 255 - ( rColor.GetGreen() + nK ); if( lTemp < 0 ) lTemp = 0; - rColor.SetGreen( (sal_uInt8)lTemp ); + rColor.SetGreen( static_cast(lTemp) ); lTemp = 255 - ( rColor.GetBlue() + nK ); if( lTemp < 0 ) lTemp = 0; - rColor.SetBlue( (sal_uInt8)lTemp ); + rColor.SetBlue( static_cast(lTemp) ); } @@ -730,7 +730,7 @@ sal_uInt16 SvxColorTabPage::ColorToPercent_Impl( sal_uInt16 nColor ) break; case ColorModel::CMYK: - nValue = (sal_uInt16) ( (double) nColor * 100.0 / 255.0 + 0.5 ); + nValue = static_cast( static_cast(nColor) * 100.0 / 255.0 + 0.5 ); break; } @@ -749,7 +749,7 @@ sal_uInt16 SvxColorTabPage::PercentToColor_Impl( sal_uInt16 nPercent ) break; case ColorModel::CMYK: - nValue = (sal_uInt16) ( (double) nPercent * 255.0 / 100.0 + 0.5 ); + nValue = static_cast( static_cast(nPercent) * 255.0 / 100.0 + 0.5 ); break; } diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx index b7274fd379f9..e01db477109b 100644 --- a/cui/source/tabpages/tpgradnt.cxx +++ b/cui/source/tabpages/tpgradnt.cxx @@ -239,12 +239,12 @@ bool SvxGradientTabPage::FillItemSet( SfxItemSet* rSet ) m_pLbColorTo->GetSelectEntryColor(), (css::awt::GradientStyle) m_pLbGradientType->GetSelectedEntryPos(), static_cast(m_pMtrAngle->GetValue() * 10), // should be changed in resource - (sal_uInt16) m_pMtrCenterX->GetValue(), - (sal_uInt16) m_pMtrCenterY->GetValue(), - (sal_uInt16) m_pMtrBorder->GetValue(), - (sal_uInt16) m_pMtrColorFrom->GetValue(), - (sal_uInt16) m_pMtrColorTo->GetValue(), - (sal_uInt16) m_pMtrIncrement->GetValue() )); + static_cast(m_pMtrCenterX->GetValue()), + static_cast(m_pMtrCenterY->GetValue()), + static_cast(m_pMtrBorder->GetValue()), + static_cast(m_pMtrColorFrom->GetValue()), + static_cast(m_pMtrColorTo->GetValue()), + static_cast(m_pMtrIncrement->GetValue()) )); } sal_uInt16 nValue = 0; @@ -336,12 +336,12 @@ void SvxGradientTabPage::ModifiedHdl_Impl( void const * pControl ) m_pLbColorTo->GetSelectEntryColor(), eXGS, static_cast(m_pMtrAngle->GetValue() * 10), // should be changed in resource - (sal_uInt16) m_pMtrCenterX->GetValue(), - (sal_uInt16) m_pMtrCenterY->GetValue(), - (sal_uInt16) m_pMtrBorder->GetValue(), - (sal_uInt16) m_pMtrColorFrom->GetValue(), - (sal_uInt16) m_pMtrColorTo->GetValue(), - (sal_uInt16) m_pMtrIncrement->GetValue() ); + static_cast(m_pMtrCenterX->GetValue()), + static_cast(m_pMtrCenterY->GetValue()), + static_cast(m_pMtrBorder->GetValue()), + static_cast(m_pMtrColorFrom->GetValue()), + static_cast(m_pMtrColorTo->GetValue()), + static_cast(m_pMtrIncrement->GetValue()) ); // enable/disable controls if( pControl == m_pLbGradientType || pControl == this ) @@ -349,7 +349,7 @@ void SvxGradientTabPage::ModifiedHdl_Impl( void const * pControl ) sal_uInt16 nValue = 0; if(!m_pCbIncrement->IsChecked()) - nValue = (sal_uInt16)m_pMtrIncrement->GetValue(); + nValue = static_cast(m_pMtrIncrement->GetValue()); m_rXFSet.Put( XGradientStepCountItem( nValue ) ); // displaying in XOutDev @@ -412,12 +412,12 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl, Button*, void) m_pLbColorTo->GetSelectEntryColor(), (css::awt::GradientStyle) m_pLbGradientType->GetSelectedEntryPos(), static_cast(m_pMtrAngle->GetValue() * 10), // should be changed in resource - (sal_uInt16) m_pMtrCenterX->GetValue(), - (sal_uInt16) m_pMtrCenterY->GetValue(), - (sal_uInt16) m_pMtrBorder->GetValue(), - (sal_uInt16) m_pMtrColorFrom->GetValue(), - (sal_uInt16) m_pMtrColorTo->GetValue(), - (sal_uInt16) m_pMtrIncrement->GetValue() ); + static_cast(m_pMtrCenterX->GetValue()), + static_cast(m_pMtrCenterY->GetValue()), + static_cast(m_pMtrBorder->GetValue()), + static_cast(m_pMtrColorFrom->GetValue()), + static_cast(m_pMtrColorTo->GetValue()), + static_cast(m_pMtrIncrement->GetValue()) ); m_pGradientList->Insert(o3tl::make_unique(aXGradient, aName), nCount); @@ -451,12 +451,12 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickModifyHdl_Impl, Button*, void) m_pLbColorTo->GetSelectEntryColor(), (css::awt::GradientStyle) m_pLbGradientType->GetSelectedEntryPos(), static_cast(m_pMtrAngle->GetValue() * 10), // should be changed in resource - (sal_uInt16) m_pMtrCenterX->GetValue(), - (sal_uInt16) m_pMtrCenterY->GetValue(), - (sal_uInt16) m_pMtrBorder->GetValue(), - (sal_uInt16) m_pMtrColorFrom->GetValue(), - (sal_uInt16) m_pMtrColorTo->GetValue(), - (sal_uInt16) m_pMtrIncrement->GetValue() ); + static_cast(m_pMtrCenterX->GetValue()), + static_cast(m_pMtrCenterY->GetValue()), + static_cast(m_pMtrBorder->GetValue()), + static_cast(m_pMtrColorFrom->GetValue()), + static_cast(m_pMtrColorTo->GetValue()), + static_cast(m_pMtrIncrement->GetValue()) ); m_pGradientList->Replace(o3tl::make_unique(aXGradient, aName), nPos); diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx index 3a0b2fb45df9..c57590af33ee 100644 --- a/cui/source/tabpages/tpline.cxx +++ b/cui/source/tabpages/tpline.cxx @@ -299,7 +299,7 @@ void SvxLineTabPage::InitSymbols(MenuButton const * pButton) SvxBmpItemInfo* pInfo = new SvxBmpItemInfo; pInfo->pBrushItem = pBrushItem; - pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i); + pInfo->nItemId = static_cast(MN_GALLERY_ENTRY + i); if ( i < m_aGrfBrushItems.size() ) { m_aGrfBrushItems.insert( m_aGrfBrushItems.begin() + i, pInfo ); @@ -317,8 +317,8 @@ void SvxLineTabPage::InitSymbols(MenuButton const * pButton) { bool bWidth = aSize.Width() > aSize.Height(); double nScale = bWidth ? - (double)MAX_BMP_WIDTH / (double)aSize.Width(): - (double)MAX_BMP_HEIGHT / (double)aSize.Height(); + double(MAX_BMP_WIDTH) / static_cast(aSize.Width()): + double(MAX_BMP_HEIGHT) / static_cast(aSize.Height()); aBitmap.Scale(nScale, nScale); } @@ -390,8 +390,8 @@ void SvxLineTabPage::InitSymbols(MenuButton const * pButton) SvxBmpItemInfo* pInfo = new SvxBmpItemInfo; pInfo->pBrushItem = pBrushItem; - pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i + m_nNumMenuGalleryItems); - if ( (size_t)(m_nNumMenuGalleryItems + i) < m_aGrfBrushItems.size() ) { + pInfo->nItemId = static_cast(MN_GALLERY_ENTRY + i + m_nNumMenuGalleryItems); + if ( static_cast(m_nNumMenuGalleryItems + i) < m_aGrfBrushItems.size() ) { m_aGrfBrushItems.insert( m_aGrfBrushItems.begin() + m_nNumMenuGalleryItems + i, pInfo ); } else { m_aGrfBrushItems.push_back( pInfo ); @@ -402,8 +402,8 @@ void SvxLineTabPage::InitSymbols(MenuButton const * pButton) { bool bWidth = aSize.Width() > aSize.Height(); double nScale = bWidth ? - (double)MAX_BMP_WIDTH / (double)aSize.Width(): - (double)MAX_BMP_HEIGHT / (double)aSize.Height(); + double(MAX_BMP_WIDTH) / static_cast(aSize.Width()): + double(MAX_BMP_HEIGHT) / static_cast(aSize.Height()); aBitmapEx.Scale(nScale, nScale); } Image aImage(aBitmapEx); @@ -495,8 +495,8 @@ void SvxLineTabPage::SymbolSelected(MenuButton const * pButton) { //#i31097# Data Point Symbol size changes when a different symbol is chosen(maoyg) if( m_aSymbolSize.Width() != m_aSymbolSize.Height() ) { - aSize.setWidth( (long)( m_aSymbolSize.Width() + m_aSymbolSize.Height() )/2 ); - aSize.setHeight( (long)( m_aSymbolSize.Width() + m_aSymbolSize.Height() )/2 ); + aSize.setWidth( static_cast( m_aSymbolSize.Width() + m_aSymbolSize.Height() )/2 ); + aSize.setHeight( static_cast( m_aSymbolSize.Width() + m_aSymbolSize.Height() )/2 ); m_aSymbolSize = aSize; } } @@ -699,7 +699,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) pStyleItem.reset(new XLineStyleItem( drawing::LineStyle_DASH )); // For added security - if( m_pDashList->Count() > (long) ( nPos - 2 ) ) + if( m_pDashList->Count() > static_cast( nPos - 2 ) ) { XLineDashItem aDashItem( m_pLbLineStyle->GetSelectedEntry(), m_pDashList->GetDash( nPos - 2 )->GetDash() ); @@ -775,7 +775,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) std::unique_ptr pItem; if( nPos == 0 ) pItem.reset(new XLineStartItem()); - else if( m_pLineEndList->Count() > (long) ( nPos - 1 ) ) + else if( m_pLineEndList->Count() > static_cast( nPos - 1 ) ) pItem.reset(new XLineStartItem( m_pLbStartStyle->GetSelectedEntry(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() )); pOld = GetOldItem( *rAttrs, XATTR_LINESTART ); if( pItem && ( !pOld || !( *static_cast(pOld) == *pItem ) ) ) @@ -791,7 +791,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) std::unique_ptr pItem; if( nPos == 0 ) pItem.reset(new XLineEndItem()); - else if( m_pLineEndList->Count() > (long) ( nPos - 1 ) ) + else if( m_pLineEndList->Count() > static_cast( nPos - 1 ) ) pItem.reset(new XLineEndItem( m_pLbEndStyle->GetSelectedEntry(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() )); pOld = GetOldItem( *rAttrs, XATTR_LINEEND ); if( pItem && @@ -828,7 +828,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) } // Transparency - sal_uInt16 nVal = (sal_uInt16)m_pMtrTransparent->GetValue(); + sal_uInt16 nVal = static_cast(m_pMtrTransparent->GetValue()); if( m_pMtrTransparent->IsValueChangedFromSaved() ) { XLineTransparenceItem aItem( nVal ); @@ -1073,7 +1073,7 @@ void SvxLineTabPage::FillXLSet_Impl() m_rXLSet.Put( XLineEndCenterItem( false ) ); // Transparency - sal_uInt16 nVal = (sal_uInt16)m_pMtrTransparent->GetValue(); + sal_uInt16 nVal = static_cast(m_pMtrTransparent->GetValue()); m_rXLSet.Put( XLineTransparenceItem( nVal ) ); m_pCtlPreview->SetLineAttributes(m_aXLineAttr.GetItemSet()); @@ -1656,7 +1656,7 @@ void SvxLineTabPage::ChangeEndHdl_Impl( void const * p ) IMPL_LINK_NOARG(SvxLineTabPage, ChangeTransparentHdl_Impl, Edit&, void) { - sal_uInt16 nVal = (sal_uInt16)m_pMtrTransparent->GetValue(); + sal_uInt16 nVal = static_cast(m_pMtrTransparent->GetValue()); m_rXLSet.Put( XLineTransparenceItem( nVal ) ); @@ -1706,12 +1706,12 @@ IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, Edit&, rField, void) nWidthVal = OutputDevice::LogicToLogic(nWidthVal,MapUnit::Map100thMM, m_ePoolUnit ); nHeightVal = OutputDevice::LogicToLogic(nHeightVal,MapUnit::Map100thMM, m_ePoolUnit); m_aSymbolSize = Size(nWidthVal,nHeightVal); - double fSizeRatio = (double)1; + double fSizeRatio = double(1); if(bRatio) { if (m_aSymbolLastSize.Height() && m_aSymbolLastSize.Width()) - fSizeRatio = (double)m_aSymbolLastSize.Width() / m_aSymbolLastSize.Height(); + fSizeRatio = static_cast(m_aSymbolLastSize.Width()) / m_aSymbolLastSize.Height(); } //Size aSymbolSize(aSymbolLastSize); @@ -1722,7 +1722,7 @@ IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, Edit&, rField, void) m_aSymbolSize.Width() = nWidthVal; if (bRatio) { - m_aSymbolSize.Height() = m_aSymbolLastSize.Height() + (long)((double)nDelta / fSizeRatio); + m_aSymbolSize.Height() = m_aSymbolLastSize.Height() + static_cast(static_cast(nDelta) / fSizeRatio); m_aSymbolSize.Height() = OutputDevice::LogicToLogic( m_aSymbolSize.Height(), m_ePoolUnit, MapUnit::Map100thMM ); m_pSymbolHeightMF->SetUserValue(m_pSymbolHeightMF->Normalize(m_aSymbolSize.Height()), FUNIT_100TH_MM); } @@ -1733,7 +1733,7 @@ IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, Edit&, rField, void) m_aSymbolSize.Height() = nHeightVal; if (bRatio) { - m_aSymbolSize.Width() = m_aSymbolLastSize.Width() + (long)((double)nDelta * fSizeRatio); + m_aSymbolSize.Width() = m_aSymbolLastSize.Width() + static_cast(static_cast(nDelta) * fSizeRatio); m_aSymbolSize.Width() = OutputDevice::LogicToLogic( m_aSymbolSize.Width(), m_ePoolUnit, MapUnit::Map100thMM ); m_pSymbolWidthMF->SetUserValue(m_pSymbolWidthMF->Normalize(m_aSymbolSize.Width()), FUNIT_100TH_MM); } diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx index 330ee686e6ed..c89661fe52b9 100644 --- a/cui/source/tabpages/tplnedef.cxx +++ b/cui/source/tabpages/tplnedef.cxx @@ -850,9 +850,9 @@ void SvxLineDefTabPage::FillDash_Impl() eXDS = css::drawing::DashStyle_RECT; aDash.SetDashStyle( eXDS ); - aDash.SetDots( (sal_uInt8) m_pNumFldNumber1->GetValue() ); + aDash.SetDots( static_cast(m_pNumFldNumber1->GetValue()) ); aDash.SetDotLen( m_pLbType1->GetSelectedEntryPos() == 0 ? 0 : GetCoreValue( *m_pMtrLength1, ePoolUnit ) ); - aDash.SetDashes( (sal_uInt8) m_pNumFldNumber2->GetValue() ); + aDash.SetDashes( static_cast(m_pNumFldNumber2->GetValue()) ); aDash.SetDashLen( m_pLbType2->GetSelectedEntryPos() == 0 ? 0 : GetCoreValue( *m_pMtrLength2, ePoolUnit ) ); aDash.SetDistance( GetCoreValue( *m_pMtrDistance, ePoolUnit ) ); diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx index ded82ed5134b..6296400844e7 100644 --- a/cui/source/tabpages/tpshadow.cxx +++ b/cui/source/tabpages/tpshadow.cxx @@ -312,7 +312,7 @@ bool SvxShadowTabPage::FillItemSet( SfxItemSet* rAttrs ) } // transparency - sal_uInt16 nVal = (sal_uInt16)m_pMtrTransparent->GetValue(); + sal_uInt16 nVal = static_cast(m_pMtrTransparent->GetValue()); if( m_pMtrTransparent->IsValueChangedFromSaved() ) { SdrPercentItem aItem( makeSdrShadowTransparenceItem(nVal) ); @@ -464,7 +464,7 @@ IMPL_LINK_NOARG(SvxShadowTabPage, ModifyShadowHdl_Impl, Edit&, void) m_rXFSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) ); m_rXFSet.Put( XFillColorItem( OUString(), m_pLbShadowColor->GetSelectEntryColor() ) ); - sal_uInt16 nVal = (sal_uInt16)m_pMtrTransparent->GetValue(); + sal_uInt16 nVal = static_cast(m_pMtrTransparent->GetValue()); m_rXFSet.Put( XFillTransparenceItem( nVal ) ); // shadow removal diff --git a/cui/source/tabpages/tptrans.cxx b/cui/source/tabpages/tptrans.cxx index 4e54d74cc28a..e4faafec0142 100644 --- a/cui/source/tabpages/tptrans.cxx +++ b/cui/source/tabpages/tptrans.cxx @@ -131,7 +131,7 @@ void SvxTransparenceTabPage::ActivateLinear(bool bActivate) IMPL_LINK_NOARG(SvxTransparenceTabPage, ModifyTransparentHdl_Impl, Edit&, void) { - sal_uInt16 nPos = (sal_uInt16)m_pMtrTransparent->GetValue(); + sal_uInt16 nPos = static_cast(m_pMtrTransparent->GetValue()); rXFSet.Put(XFillTransparenceItem(nPos)); // preview @@ -157,16 +157,16 @@ void SvxTransparenceTabPage::ModifiedTrgrHdl_Impl(void const * pControl) } // preview - sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)m_pMtrTrgrStartValue->GetValue() * 255) / 100); - sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)m_pMtrTrgrEndValue->GetValue() * 255) / 100); + sal_uInt8 nStartCol = static_cast((static_cast(m_pMtrTrgrStartValue->GetValue()) * 255) / 100); + sal_uInt8 nEndCol = static_cast((static_cast(m_pMtrTrgrEndValue->GetValue()) * 255) / 100); XGradient aTmpGradient( Color(nStartCol, nStartCol, nStartCol), Color(nEndCol, nEndCol, nEndCol), (css::awt::GradientStyle)m_pLbTrgrGradientType->GetSelectedEntryPos(), - (sal_uInt16)m_pMtrTrgrAngle->GetValue() * 10, - (sal_uInt16)m_pMtrTrgrCenterX->GetValue(), - (sal_uInt16)m_pMtrTrgrCenterY->GetValue(), - (sal_uInt16)m_pMtrTrgrBorder->GetValue(), + static_cast(m_pMtrTrgrAngle->GetValue()) * 10, + static_cast(m_pMtrTrgrCenterX->GetValue()), + static_cast(m_pMtrTrgrCenterY->GetValue()), + static_cast(m_pMtrTrgrBorder->GetValue()), 100, 100); XFillFloatTransparenceItem aItem( aTmpGradient); @@ -314,7 +314,7 @@ bool SvxTransparenceTabPage::FillItemSet(SfxItemSet* rAttrs) if(m_pMtrTransparent->IsEnabled()) { // linear transparence - sal_uInt16 nPos = (sal_uInt16)m_pMtrTransparent->GetValue(); + sal_uInt16 nPos = static_cast(m_pMtrTransparent->GetValue()); if(m_pMtrTransparent->IsValueChangedFromSaved() || !bLinearActive) { XFillTransparenceItem aItem(nPos); @@ -341,16 +341,16 @@ bool SvxTransparenceTabPage::FillItemSet(SfxItemSet* rAttrs) || m_pMtrTrgrStartValue->IsValueChangedFromSaved() || m_pMtrTrgrEndValue->IsValueChangedFromSaved() ) { - sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)m_pMtrTrgrStartValue->GetValue() * 255) / 100); - sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)m_pMtrTrgrEndValue->GetValue() * 255) / 100); + sal_uInt8 nStartCol = static_cast((static_cast(m_pMtrTrgrStartValue->GetValue()) * 255) / 100); + sal_uInt8 nEndCol = static_cast((static_cast(m_pMtrTrgrEndValue->GetValue()) * 255) / 100); XGradient aTmpGradient( Color(nStartCol, nStartCol, nStartCol), Color(nEndCol, nEndCol, nEndCol), (css::awt::GradientStyle)m_pLbTrgrGradientType->GetSelectedEntryPos(), - (sal_uInt16)m_pMtrTrgrAngle->GetValue() * 10, - (sal_uInt16)m_pMtrTrgrCenterX->GetValue(), - (sal_uInt16)m_pMtrTrgrCenterY->GetValue(), - (sal_uInt16)m_pMtrTrgrBorder->GetValue(), + static_cast(m_pMtrTrgrAngle->GetValue()) * 10, + static_cast(m_pMtrTrgrCenterX->GetValue()), + static_cast(m_pMtrTrgrCenterY->GetValue()), + static_cast(m_pMtrTrgrBorder->GetValue()), 100, 100); XFillFloatTransparenceItem aItem(aTmpGradient); @@ -419,8 +419,8 @@ void SvxTransparenceTabPage::Reset(const SfxItemSet* rAttrs) m_pMtrTrgrBorder->SetValue(rGradient.GetBorder()); m_pMtrTrgrCenterX->SetValue(rGradient.GetXOffset()); m_pMtrTrgrCenterY->SetValue(rGradient.GetYOffset()); - m_pMtrTrgrStartValue->SetValue((sal_uInt16)((((sal_uInt16)rGradient.GetStartColor().GetRed() + 1) * 100) / 255)); - m_pMtrTrgrEndValue->SetValue((sal_uInt16)((((sal_uInt16)rGradient.GetEndColor().GetRed() + 1) * 100) / 255)); + m_pMtrTrgrStartValue->SetValue(static_cast(((static_cast(rGradient.GetStartColor().GetRed()) + 1) * 100) / 255)); + m_pMtrTrgrEndValue->SetValue(static_cast(((static_cast(rGradient.GetEndColor().GetRed()) + 1) * 100) / 255)); // linear transparence sal_uInt16 nTransp = static_cast(pLinearItem)->GetValue(); diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx index d9a3ff38ac85..b7c154ab2842 100644 --- a/cui/source/tabpages/transfrm.cxx +++ b/cui/source/tabpages/transfrm.cxx @@ -289,7 +289,7 @@ void SvxAngleTabPage::Reset(const SfxItemSet* rAttrs) const SfxPoolItem* pItem = GetItem( *rAttrs, SID_ATTR_TRANSFORM_ROT_X ); if(pItem) { - const double fTmp(((double)static_cast(pItem)->GetValue() - maAnchor.getX()) / fUIScale); + const double fTmp((static_cast(static_cast(pItem)->GetValue()) - maAnchor.getX()) / fUIScale); SetMetricValue(*m_pMtrPosX, basegfx::fround(fTmp), ePoolUnit); } else @@ -300,7 +300,7 @@ void SvxAngleTabPage::Reset(const SfxItemSet* rAttrs) pItem = GetItem(*rAttrs, SID_ATTR_TRANSFORM_ROT_Y); if(pItem) { - const double fTmp(((double)static_cast(pItem)->GetValue() - maAnchor.getY()) / fUIScale); + const double fTmp((static_cast(static_cast(pItem)->GetValue()) - maAnchor.getY()) / fUIScale); SetMetricValue(*m_pMtrPosY, basegfx::fround(fTmp), ePoolUnit); } else @@ -583,7 +583,7 @@ void SvxSlantTabPage::Reset(const SfxItemSet* rAttrs) if( pItem ) { const double fUIScale(double(pView->GetModel()->GetUIScale())); - const double fTmp((double)static_cast(pItem)->GetValue() / fUIScale); + const double fTmp(static_cast(static_cast(pItem)->GetValue()) / fUIScale); SetMetricValue(*m_pMtrRadius, basegfx::fround(fTmp), ePoolUnit); } else @@ -966,20 +966,20 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs ) // get Width double nWidth = static_cast(m_pMtrWidth->GetValue( meDlgUnit )); nWidth = MetricField::ConvertDoubleValue( nWidth, m_pMtrWidth->GetBaseValue(), m_pMtrWidth->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); - long lWidth = long(nWidth * (double)aUIScale); + long lWidth = long(nWidth * static_cast(aUIScale)); lWidth = OutputDevice::LogicToLogic( lWidth, MapUnit::Map100thMM, mePoolUnit ); lWidth = static_cast(m_pMtrWidth->Denormalize( lWidth )); // get Height double nHeight = static_cast(m_pMtrHeight->GetValue( meDlgUnit )); nHeight = MetricField::ConvertDoubleValue( nHeight, m_pMtrHeight->GetBaseValue(), m_pMtrHeight->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); - long lHeight = long(nHeight * (double)aUIScale); + long lHeight = long(nHeight * static_cast(aUIScale)); lHeight = OutputDevice::LogicToLogic( lHeight, MapUnit::Map100thMM, mePoolUnit ); lHeight = static_cast(m_pMtrHeight->Denormalize( lHeight )); // put Width & Height to itemset - rOutAttrs->Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_WIDTH ), (sal_uInt32) lWidth ) ); - rOutAttrs->Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_HEIGHT ), (sal_uInt32) lHeight ) ); + rOutAttrs->Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_WIDTH ), static_cast(lWidth) ) ); + rOutAttrs->Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_HEIGHT ), static_cast(lHeight) ) ); rOutAttrs->Put( SfxAllEnumItem( GetWhich( SID_ATTR_TRANSFORM_SIZE_POINT ), sal::static_int_cast< sal_uInt16 >( meRP ) ) ); bModified = true; } @@ -1070,7 +1070,7 @@ void SvxPositionSizeTabPage::Reset( const SfxItemSet* ) { // #i75273# set width pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_WIDTH ); - mfOldWidth = std::max( pItem ? (double)static_cast(pItem)->GetValue() : 0.0, 1.0 ); + mfOldWidth = std::max( pItem ? static_cast(static_cast(pItem)->GetValue()) : 0.0, 1.0 ); double fTmpWidth((OutputDevice::LogicToLogic(static_cast(mfOldWidth), mePoolUnit, MapUnit::Map100thMM)) / fUIScale); if(m_pMtrWidth->GetDecimalDigits()) @@ -1082,7 +1082,7 @@ void SvxPositionSizeTabPage::Reset( const SfxItemSet* ) { // #i75273# set height pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_HEIGHT ); - mfOldHeight = std::max( pItem ? (double)static_cast(pItem)->GetValue() : 0.0, 1.0 ); + mfOldHeight = std::max( pItem ? static_cast(static_cast(pItem)->GetValue()) : 0.0, 1.0 ); double fTmpHeight((OutputDevice::LogicToLogic(static_cast(mfOldHeight), mePoolUnit, MapUnit::Map100thMM)) / fUIScale); if(m_pMtrHeight->GetDecimalDigits()) @@ -1160,8 +1160,8 @@ DeactivateRC SvxPositionSizeTabPage::DeactivatePage( SfxItemSet* _pSet ) { if( _pSet ) { - double fX((double)m_pMtrPosX->GetValue()); - double fY((double)m_pMtrPosY->GetValue()); + double fX(static_cast(m_pMtrPosX->GetValue())); + double fY(static_cast(m_pMtrPosY->GetValue())); GetTopLeftPosition(fX, fY, maRange); const ::tools::Rectangle aOutRectangle( @@ -1308,7 +1308,7 @@ void SvxPositionSizeTabPage::SetMinMaxPosition() } } - const double fMaxLong((double)(MetricField::ConvertValue( LONG_MAX, 0, MapUnit::Map100thMM, meDlgUnit ) - 1)); + const double fMaxLong(static_cast(MetricField::ConvertValue( LONG_MAX, 0, MapUnit::Map100thMM, meDlgUnit ) - 1)); fLeft = basegfx::clamp(fLeft, -fMaxLong, fMaxLong); fRight = basegfx::clamp(fRight, -fMaxLong, fMaxLong); fTop = basegfx::clamp(fTop, - fMaxLong, fMaxLong); @@ -1549,7 +1549,7 @@ IMPL_LINK_NOARG(SvxPositionSizeTabPage, ChangeWidthHdl, Edit&, void) { if( m_pCbxScale->IsChecked() && m_pCbxScale->IsEnabled() ) { - sal_Int64 nHeight(basegfx::fround64((mfOldHeight * (double)m_pMtrWidth->GetValue()) / mfOldWidth)); + sal_Int64 nHeight(basegfx::fround64((mfOldHeight * static_cast(m_pMtrWidth->GetValue())) / mfOldWidth)); if(nHeight <= m_pMtrHeight->GetMax(FUNIT_NONE)) { @@ -1560,7 +1560,7 @@ IMPL_LINK_NOARG(SvxPositionSizeTabPage, ChangeWidthHdl, Edit&, void) nHeight = m_pMtrHeight->GetMax(FUNIT_NONE); m_pMtrHeight->SetUserValue(nHeight); - const sal_Int64 nWidth(basegfx::fround64((mfOldWidth * (double)nHeight) / mfOldHeight)); + const sal_Int64 nWidth(basegfx::fround64((mfOldWidth * static_cast(nHeight)) / mfOldHeight)); m_pMtrWidth->SetUserValue(nWidth, FUNIT_NONE); } } @@ -1571,7 +1571,7 @@ IMPL_LINK_NOARG(SvxPositionSizeTabPage, ChangeHeightHdl, Edit&, void) { if( m_pCbxScale->IsChecked() && m_pCbxScale->IsEnabled() ) { - sal_Int64 nWidth(basegfx::fround64((mfOldWidth * (double)m_pMtrHeight->GetValue()) / mfOldHeight)); + sal_Int64 nWidth(basegfx::fround64((mfOldWidth * static_cast(m_pMtrHeight->GetValue())) / mfOldHeight)); if(nWidth <= m_pMtrWidth->GetMax(FUNIT_NONE)) { @@ -1582,7 +1582,7 @@ IMPL_LINK_NOARG(SvxPositionSizeTabPage, ChangeHeightHdl, Edit&, void) nWidth = m_pMtrWidth->GetMax(FUNIT_NONE); m_pMtrWidth->SetUserValue(nWidth); - const sal_Int64 nHeight(basegfx::fround64((mfOldHeight * (double)nWidth) / mfOldWidth)); + const sal_Int64 nHeight(basegfx::fround64((mfOldHeight * static_cast(nWidth)) / mfOldWidth)); m_pMtrHeight->SetUserValue(nHeight, FUNIT_NONE); } } @@ -1599,8 +1599,8 @@ IMPL_LINK_NOARG(SvxPositionSizeTabPage, ClickAutoHdl, Button*, void) { if( m_pCbxScale->IsChecked() ) { - mfOldWidth = std::max( (double)GetCoreValue( *m_pMtrWidth, mePoolUnit ), 1.0 ); - mfOldHeight = std::max( (double)GetCoreValue( *m_pMtrHeight, mePoolUnit ), 1.0 ); + mfOldWidth = std::max( static_cast(GetCoreValue( *m_pMtrWidth, mePoolUnit )), 1.0 ); + mfOldHeight = std::max( static_cast(GetCoreValue( *m_pMtrHeight, mePoolUnit )), 1.0 ); } } -- cgit v1.2.3