From 039b887c54fd7e8cd8a4964d1633fdfc300e938e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 2 Oct 2014 07:36:46 +0200 Subject: loplugin: cstylecast Change-Id: I4a230f45e91773fca7d537e91c9e9fb54773cf10 --- sfx2/source/dialog/backingcomp.cxx | 4 +-- sfx2/source/dialog/dinfdlg.cxx | 54 +++++++++++++++++++------------------- 2 files changed, 29 insertions(+), 29 deletions(-) (limited to 'sfx2/source/dialog') diff --git a/sfx2/source/dialog/backingcomp.cxx b/sfx2/source/dialog/backingcomp.cxx index 8f5f7d712c7c..39845cad2fc1 100644 --- a/sfx2/source/dialog/backingcomp.cxx +++ b/sfx2/source/dialog/backingcomp.cxx @@ -402,7 +402,7 @@ void SAL_CALL BackingComp::attachFrame( /*IN*/ const css::uno::Reference< css::f // initialize the component and its parent window css::uno::Reference< css::awt::XWindow > xParentWindow = xFrame->getContainerWindow(); - WorkWindow* pParent = (WorkWindow*)VCLUnoHelper::GetWindow(xParentWindow); + WorkWindow* pParent = static_cast(VCLUnoHelper::GetWindow(xParentWindow)); vcl::Window* pWindow = VCLUnoHelper::GetWindow(m_xWindow); // disable full screen mode of the frame! @@ -799,7 +799,7 @@ void SAL_CALL BackingComp::dispatch( const css::util::URL& aURL, const css::uno: // Recalculate minimum width css::uno::Reference< css::awt::XWindow > xParentWindow = m_xFrame->getContainerWindow(); - WorkWindow* pParent = (WorkWindow*)VCLUnoHelper::GetWindow(xParentWindow); + WorkWindow* pParent = static_cast(VCLUnoHelper::GetWindow(xParentWindow)); if( pParent ) { pParent->SetMinOutputSizePixel( Size( diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index ccbf9139908a..46723e3ddcc9 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -658,7 +658,7 @@ bool SfxDocumentDescPage::FillItemSet(SfxItemSet *rSet) if ( pExSet && SfxItemState::SET != pExSet->GetItemState( SID_DOCINFO, true, &pItem ) ) pInfo = m_pInfoItem; else if ( pItem ) - pInfo = new SfxDocumentInfoItem( *(const SfxDocumentInfoItem *)pItem ); + pInfo = new SfxDocumentInfoItem( *static_cast(pItem) ); if ( !pInfo ) { @@ -694,7 +694,7 @@ bool SfxDocumentDescPage::FillItemSet(SfxItemSet *rSet) void SfxDocumentDescPage::Reset(const SfxItemSet *rSet) { - m_pInfoItem = &(SfxDocumentInfoItem &)rSet->Get(SID_DOCINFO); + m_pInfoItem = const_cast(&static_cast(rSet->Get(SID_DOCINFO))); m_pTitleEd->SetText( m_pInfoItem->getTitle() ); m_pThemaEd->SetText( m_pInfoItem->getSubject() ); @@ -933,12 +933,12 @@ bool SfxDocumentPage::FillItemSet( SfxItemSet* rSet ) m_pUseUserDataCB->IsValueChangedFromSaved() && GetTabDialog() && GetTabDialog()->GetExampleSet() ) { - const SfxItemSet* pExpSet = GetTabDialog()->GetExampleSet(); - const SfxPoolItem* pItem; + SfxItemSet* pExpSet = GetTabDialog()->GetExampleSet(); + SfxPoolItem* pItem; if ( pExpSet && SfxItemState::SET == pExpSet->GetItemState( SID_DOCINFO, true, &pItem ) ) { - SfxDocumentInfoItem* m_pInfoItem = (SfxDocumentInfoItem*)pItem; + SfxDocumentInfoItem* m_pInfoItem = static_cast(pItem); bool bUseData = ( TRISTATE_TRUE == m_pUseUserDataCB->GetState() ); m_pInfoItem->SetUseUserData( bUseData ); rSet->Put( SfxDocumentInfoItem( *m_pInfoItem ) ); @@ -948,17 +948,17 @@ bool SfxDocumentPage::FillItemSet( SfxItemSet* rSet ) if ( bHandleDelete ) { - const SfxItemSet* pExpSet = GetTabDialog()->GetExampleSet(); - const SfxPoolItem* pItem; + SfxItemSet* pExpSet = GetTabDialog()->GetExampleSet(); + SfxPoolItem* pItem; if ( pExpSet && SfxItemState::SET == pExpSet->GetItemState( SID_DOCINFO, true, &pItem ) ) { - SfxDocumentInfoItem* m_pInfoItem = (SfxDocumentInfoItem*)pItem; + SfxDocumentInfoItem* pInfoItem = static_cast(pItem); bool bUseAuthor = bEnableUseUserData && m_pUseUserDataCB->IsChecked(); - SfxDocumentInfoItem newItem( *m_pInfoItem ); + SfxDocumentInfoItem newItem( *pInfoItem ); newItem.resetUserData( bUseAuthor ? SvtUserOptions().GetFullName() : OUString() ); - m_pInfoItem->SetUseUserData( TRISTATE_TRUE == m_pUseUserDataCB->GetState() ); + pInfoItem->SetUseUserData( TRISTATE_TRUE == m_pUseUserDataCB->GetState() ); newItem.SetUseUserData( TRISTATE_TRUE == m_pUseUserDataCB->GetState() ); newItem.SetDeleteUserData( true ); @@ -1033,7 +1033,7 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet ) || !pItem ) m_pReadOnlyCB->Hide(); else - m_pReadOnlyCB->Check( ( (SfxBoolItem*)pItem )->GetValue() ); + m_pReadOnlyCB->Check( static_cast(pItem)->GetValue() ); // determine context symbol INetURLObject aURL; @@ -1197,7 +1197,7 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog( vcl::Window* pParent, { DBG_ASSERT( pItem->IsA( TYPE( SfxStringItem ) ), "SfxDocumentInfoDialog: expected" ); - aTitle += ( ( SfxStringItem* ) pItem )->GetValue(); + aTitle += static_cast(pItem)->GetValue(); } SetText( aTitle ); @@ -1461,7 +1461,7 @@ CustomPropertiesWindow::~CustomPropertiesWindow() IMPL_LINK( CustomPropertiesWindow, TypeHdl, CustomPropertiesTypeBox*, pBox ) { - sal_Int64 nType = sal_Int64( (sal_IntPtr)pBox->GetEntryData( pBox->GetSelectEntryPos() ) ); + long nType = reinterpret_cast( pBox->GetEntryData( pBox->GetSelectEntryPos() ) ); CustomPropertyLine* pLine = pBox->GetLine(); pLine->m_aValueEdit.Show( (CUSTOM_TYPE_TEXT == nType) || (CUSTOM_TYPE_NUMBER == nType) ); pLine->m_aDateField.Show( (CUSTOM_TYPE_DATE == nType) || (CUSTOM_TYPE_DATETIME == nType) ); @@ -1566,8 +1566,8 @@ bool CustomPropertiesWindow::IsLineValid( CustomPropertyLine* pLine ) const { bool bIsValid = true; pLine->m_bTypeLostFocus = false; - sal_Int64 nType = sal_Int64( - (sal_IntPtr)pLine->m_aTypeBox.GetEntryData( pLine->m_aTypeBox.GetSelectEntryPos() ) ); + long nType = reinterpret_cast( + pLine->m_aTypeBox.GetEntryData( pLine->m_aTypeBox.GetSelectEntryPos() ) ); OUString sValue = pLine->m_aValueEdit.GetText(); if ( sValue.isEmpty() ) return true; @@ -1602,7 +1602,7 @@ void CustomPropertiesWindow::ValidateLine( CustomPropertyLine* pLine, bool bIsFr pLine->m_bTypeLostFocus = true; vcl::Window* pParent = GetParent()->GetParent(); if (MessageDialog(pParent, SfxResId(STR_SFX_QUERY_WRONG_TYPE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_OK_CANCEL).Execute() == RET_OK) - pLine->m_aTypeBox.SelectEntryPos( m_aTypeBox.GetEntryPos( (void*)CUSTOM_TYPE_TEXT ) ); + pLine->m_aTypeBox.SelectEntryPos( m_aTypeBox.GetEntryPos( reinterpret_cast(CUSTOM_TYPE_TEXT) ) ); else pLine->m_aValueEdit.GrabFocus(); } @@ -1840,7 +1840,7 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny ) else pNewLine->m_aYesNoButton.CheckNo(); } - pNewLine->m_aTypeBox.SelectEntryPos( m_aTypeBox.GetEntryPos( (void*)nType ) ); + pNewLine->m_aTypeBox.SelectEntryPos( m_aTypeBox.GetEntryPos( reinterpret_cast(nType) ) ); } TypeHdl( &pNewLine->m_aTypeBox ); @@ -1919,8 +1919,8 @@ Sequence< beans::PropertyValue > CustomPropertiesWindow::GetCustomProperties() c if ( !sPropertyName.isEmpty() ) { aPropertiesSeq[i].Name = sPropertyName; - sal_Int64 nType = sal_Int64( - (sal_IntPtr)pLine->m_aTypeBox.GetEntryData( pLine->m_aTypeBox.GetSelectEntryPos() ) ); + long nType = reinterpret_cast( + pLine->m_aTypeBox.GetEntryData( pLine->m_aTypeBox.GetSelectEntryPos() ) ); if ( CUSTOM_TYPE_NUMBER == nType ) { double nValue = 0; @@ -2131,11 +2131,11 @@ bool SfxCustomPropertiesPage::FillItemSet( SfxItemSet* rSet ) { if ( SfxItemState::SET != GetTabDialog()->GetExampleSet()->GetItemState( SID_DOCINFO, true, &pItem ) ) - pInfo = &( SfxDocumentInfoItem& )rSet->Get( SID_DOCINFO ); + pInfo = const_cast(&static_cast(rSet->Get( SID_DOCINFO ))); else { bMustDelete = true; - pInfo = new SfxDocumentInfoItem( *( const SfxDocumentInfoItem* ) pItem ); + pInfo = new SfxDocumentInfoItem( *static_cast(pItem) ); } } @@ -2174,8 +2174,8 @@ bool SfxCustomPropertiesPage::FillItemSet( SfxItemSet* rSet ) void SfxCustomPropertiesPage::Reset( const SfxItemSet* rItemSet ) { m_pPropertiesCtrl->ClearAllLines(); - const SfxDocumentInfoItem* m_pInfoItem = &(const SfxDocumentInfoItem &)rItemSet->Get(SID_DOCINFO); - std::vector< CustomProperty* > aCustomProps = m_pInfoItem->GetCustomProperties(); + const SfxDocumentInfoItem& rInfoItem = static_cast(rItemSet->Get(SID_DOCINFO)); + std::vector< CustomProperty* > aCustomProps = rInfoItem.GetCustomProperties(); for ( sal_uInt32 i = 0; i < aCustomProps.size(); i++ ) { m_pPropertiesCtrl->AddLine( aCustomProps[i]->m_sName, aCustomProps[i]->m_aValue, false ); @@ -2603,11 +2603,11 @@ bool SfxCmisPropertiesPage::FillItemSet( SfxItemSet* rSet ) { if ( SfxItemState::SET != GetTabDialog()->GetExampleSet()->GetItemState( SID_DOCINFO, true, &pItem ) ) - pInfo = &( SfxDocumentInfoItem& )rSet->Get( SID_DOCINFO ); + pInfo = const_cast(&static_cast(rSet->Get( SID_DOCINFO ))); else { bMustDelete = true; - pInfo = new SfxDocumentInfoItem( *( const SfxDocumentInfoItem* ) pItem ); + pInfo = new SfxDocumentInfoItem( *static_cast(pItem) ); } } @@ -2665,8 +2665,8 @@ bool SfxCmisPropertiesPage::FillItemSet( SfxItemSet* rSet ) void SfxCmisPropertiesPage::Reset( const SfxItemSet* rItemSet ) { m_pPropertiesCtrl.ClearAllLines(); - const SfxDocumentInfoItem* m_pInfoItem = &(const SfxDocumentInfoItem &)rItemSet->Get(SID_DOCINFO); - uno::Sequence< document::CmisProperty > aCmisProps = m_pInfoItem->GetCmisProperties(); + const SfxDocumentInfoItem& rInfoItem = static_cast(rItemSet->Get(SID_DOCINFO)); + uno::Sequence< document::CmisProperty > aCmisProps = rInfoItem.GetCmisProperties(); for ( sal_Int32 i = 0; i < aCmisProps.getLength(); i++ ) { m_pPropertiesCtrl.AddLine( aCmisProps[i].Id, -- cgit v1.2.3