Kaydet (Commit) 9d1c14ce authored tarafından Stephan Bergmann's avatar Stephan Bergmann

More loplugin:cstylecast: sfx2

Change-Id: Ifdb964558f070e7c9ee87eabeaafa5c3c079c0c9
üst b20ccaf2
......@@ -61,7 +61,7 @@ namespace std
{
std::size_t operator()(const SfxGroupId& k) const
{
return std::hash<sal_uInt16>()((sal_uInt16)k);
return std::hash<sal_uInt16>()(static_cast<sal_uInt16>(k));
}
};
}
......
......@@ -643,7 +643,7 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet )
if ( SfxItemState::SET == rSet.GetItemState(SID_BASIC_ENABLED, true, &pItem))
{
DBG_ASSERT(dynamic_cast< const SfxUInt16Item *>( pItem ) != nullptr, "SfxInt16Item expected");
aSecurityOptions.SetBasicMode( (EBasicSecurityMode)static_cast<const SfxUInt16Item*>( pItem )->GetValue() );
aSecurityOptions.SetBasicMode( static_cast<EBasicSecurityMode>(static_cast<const SfxUInt16Item*>( pItem )->GetValue()) );
}
// Execute PlugIns
......
......@@ -581,7 +581,7 @@ bool SfxChildWinInfo::GetExtraData_Impl
if ( aStr.isEmpty() )
return false;
if ( pAlign )
*pAlign = (SfxChildAlignment) static_cast<sal_uInt16>(aStr.toInt32());
*pAlign = static_cast<SfxChildAlignment>(static_cast<sal_uInt16>(aStr.toInt32()));
// then the LastAlignment
nPos = aStr.indexOf(',');
......
......@@ -243,7 +243,7 @@ FieldUnit SfxModule::GetCurrentFieldUnit()
{
const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC );
if ( pItem )
eUnit = (FieldUnit) static_cast<const SfxUInt16Item*>(pItem)->GetValue();
eUnit = static_cast<FieldUnit>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
}
else
SAL_WARN( "sfx.appl", "GetModuleFieldUnit(): no module found" );
......@@ -255,7 +255,7 @@ FieldUnit SfxModule::GetFieldUnit() const
FieldUnit eUnit = FUNIT_INCH;
const SfxPoolItem* pItem = GetItem( SID_ATTR_METRIC );
if ( pItem )
eUnit = (FieldUnit) static_cast<const SfxUInt16Item*>(pItem)->GetValue();
eUnit = static_cast<FieldUnit>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
return eUnit;
}
......
......@@ -38,7 +38,7 @@ static HTMLOptionEnum<ScrollingMode> const aScrollingTable[] =
{ sHTML_SC_yes, ScrollingMode::Yes },
{ sHTML_SC_no, ScrollingMode::No },
{ sHTML_SC_auto, ScrollingMode::Auto },
{ nullptr, (ScrollingMode)0 }
{ nullptr, ScrollingMode(0) }
};
void SfxFrameHTMLParser::ParseFrameOptions(
......
......@@ -1760,7 +1760,7 @@ bool SfxDispatcher::FindServer_(sal_uInt16 nSlot, SfxSlotServer& rServer, bool b
const SfxSlot *pSlot = pIFace->GetSlot(nSlot);
if ( pSlot && pSlot->nDisableFlags != SfxDisableFlags::NONE &&
( (int)pSlot->nDisableFlags & (int)pObjShell->GetDisableFlags() ) != 0 )
( static_cast<int>(pSlot->nDisableFlags) & static_cast<int>(pObjShell->GetDisableFlags()) ) != 0 )
return false;
if ( pSlot && !( pSlot->nFlags & SfxSlotMode::READONLYDOC ) && bReadOnly )
......
......@@ -284,7 +284,7 @@ SfxObjectUI_Impl* CreateObjectBarUI_Impl(sal_uInt16 nPos, SfxVisibilityFlags nFl
if (nFlags == SfxVisibilityFlags::Invisible)
nFlags |= SfxVisibilityFlags::Standard;
return new SfxObjectUI_Impl(nPos, nFlags, (sal_uInt32)eId, nFeature);
return new SfxObjectUI_Impl(nPos, nFlags, static_cast<sal_uInt32>(eId), nFeature);
}
ToolbarId SfxInterface::GetObjectBarId(sal_uInt16 nNo) const
......@@ -303,7 +303,7 @@ ToolbarId SfxInterface::GetObjectBarId(sal_uInt16 nNo) const
assert( nNo<pImplData->aObjectBars.size() );
return (ToolbarId)pImplData->aObjectBars[nNo]->nObjId;
return static_cast<ToolbarId>(pImplData->aObjectBars[nNo]->nObjId);
}
sal_uInt16 SfxInterface::GetObjectBarPos( sal_uInt16 nNo ) const
......
......@@ -198,7 +198,7 @@ void SAL_CALL SfxStatusListener::statusChanged( const FeatureStateEvent& rEvent)
{
ItemStatus aItemStatus;
rEvent.State >>= aItemStatus;
eState = (SfxItemState) aItemStatus.State;
eState = static_cast<SfxItemState>(aItemStatus.State);
pItem = new SfxVoidItem( m_nSlotID );
}
else if ( aType == cppu::UnoType< css::frame::status::Visibility >::get() )
......
......@@ -896,7 +896,7 @@ void SfxDockingWindow::Initialize(SfxChildWinInfo *pInfo)
pImpl->aWinState = pInfo->aWinState;
// check for valid alignment
SfxChildAlignment eLocalAlignment = (SfxChildAlignment) static_cast<sal_uInt16>(aStr.toInt32());
SfxChildAlignment eLocalAlignment = static_cast<SfxChildAlignment>(static_cast<sal_uInt16>(aStr.toInt32()));
bool bIgnoreFloatConfig = (eLocalAlignment == SfxChildAlignment::NOALIGNMENT &&
!StyleSettings::GetDockingFloatsSupported());
if (pImpl->bDockingPrevented || bIgnoreFloatConfig)
......@@ -918,7 +918,7 @@ void SfxDockingWindow::Initialize(SfxChildWinInfo *pInfo)
if ( nPos != -1 )
{
aStr = aStr.copy(nPos+1);
pImpl->SetLastAlignment( (SfxChildAlignment) static_cast<sal_uInt16>(aStr.toInt32()) );
pImpl->SetLastAlignment( static_cast<SfxChildAlignment>(static_cast<sal_uInt16>(aStr.toInt32())) );
}
nPos = aStr.indexOf(',');
......@@ -1083,9 +1083,9 @@ void SfxDockingWindow::FillInfo(SfxChildWinInfo& rInfo) const
rInfo.aWinState = pImpl->aWinState;
rInfo.aExtraString = "AL:(";
rInfo.aExtraString += OUString::number((sal_uInt16) GetAlignment());
rInfo.aExtraString += OUString::number(static_cast<sal_uInt16>(GetAlignment()));
rInfo.aExtraString += ",";
rInfo.aExtraString += OUString::number ((sal_uInt16) pImpl->GetLastAlignment());
rInfo.aExtraString += OUString::number (static_cast<sal_uInt16>(pImpl->GetLastAlignment()));
if ( pImpl->bSplitable )
{
Point aPos(pImpl->nLine, pImpl->nPos);
......
......@@ -314,7 +314,7 @@ void SfxManageStyleSheetPage::SetDescriptionText_Impl()
{
const SfxPoolItem* pPoolItem = pModule->GetItem( SID_ATTR_METRIC );
if ( pPoolItem )
eFieldUnit = (FieldUnit) static_cast<const SfxUInt16Item*>( pPoolItem )->GetValue();
eFieldUnit = static_cast<FieldUnit>(static_cast<const SfxUInt16Item*>( pPoolItem )->GetValue());
}
switch ( eFieldUnit )
......@@ -348,7 +348,7 @@ IMPL_LINK_NOARG( SfxManageStyleSheetPage, EditStyleSelectHdl_Impl, ListBox&, voi
IMPL_LINK_NOARG( SfxManageStyleSheetPage, EditStyleHdl_Impl, Button*, void )
{
OUString aTemplName(m_pFollowLb->GetSelectedEntry());
if (Execute_Impl( SID_STYLE_EDIT, aTemplName, OUString(),(sal_uInt16)pStyle->GetFamily() ))
if (Execute_Impl( SID_STYLE_EDIT, aTemplName, OUString(),static_cast<sal_uInt16>(pStyle->GetFamily()) ))
{
}
}
......@@ -366,7 +366,7 @@ IMPL_LINK_NOARG( SfxManageStyleSheetPage, EditLinkStyleHdl_Impl, Button*, void )
{
OUString aTemplName(m_pBaseLb->GetSelectedEntry());
if (aTemplName != SfxResId(STR_NONE))
Execute_Impl( SID_STYLE_EDIT, aTemplName, OUString(),(sal_uInt16)pStyle->GetFamily() );
Execute_Impl( SID_STYLE_EDIT, aTemplName, OUString(),static_cast<sal_uInt16>(pStyle->GetFamily()) );
}
// Internal: Perform functions through the Dispatcher
......
......@@ -226,7 +226,7 @@ SfxSplitWindow::SfxSplitWindow( vcl::Window* pParent, SfxChildAlignment eAl,
{
// Read Configuration
OUString aWindowId("SplitWindow");
aWindowId += OUString::number( (sal_Int32) eTbxAlign );
aWindowId += OUString::number( static_cast<sal_Int32>(eTbxAlign) );
SvtViewOptions aWinOpt( EViewType::Window, aWindowId );
OUString aWinData;
Any aUserItem = aWinOpt.GetUserItem( USERITEM_NAME );
......@@ -329,7 +329,7 @@ void SfxSplitWindow::SaveConfig_Impl()
}
OUString aWindowId("SplitWindow");
aWindowId += OUString::number( (sal_Int32) GetAlign() );
aWindowId += OUString::number( static_cast<sal_Int32>(GetAlign()) );
SvtViewOptions aWinOpt( EViewType::Window, aWindowId );
aWinOpt.SetUserItem( USERITEM_NAME, makeAny( aWinData.makeStringAndClear() ) );
}
......
......@@ -1679,7 +1679,7 @@ void SfxCommonTemplateDialog_Impl::ActionSelect(sal_uInt16 nEntry)
GetSelectedEntry());
Execute_Impl(
SID_STYLE_WATERCAN, aTemplName, "",
(sal_uInt16)GetFamilyItem_Impl()->GetFamily() );
static_cast<sal_uInt16>(GetFamilyItem_Impl()->GetFamily()) );
bCheck = true;
}
else
......@@ -1717,7 +1717,7 @@ void SfxCommonTemplateDialog_Impl::ActionSelect(sal_uInt16 nEntry)
const OUString aTemplName(pDlg->GetName());
Execute_Impl(SID_STYLE_NEW_BY_EXAMPLE,
aTemplName, "",
(sal_uInt16)GetFamilyItem_Impl()->GetFamily(),
static_cast<sal_uInt16>(GetFamilyItem_Impl()->GetFamily()),
nFilter);
}
pStyleSheetPool->SetSearchMask( eFam, nFilter );
......@@ -1728,7 +1728,7 @@ void SfxCommonTemplateDialog_Impl::ActionSelect(sal_uInt16 nEntry)
{
Execute_Impl(SID_STYLE_UPDATE_BY_EXAMPLE,
"", "",
(sal_uInt16)GetFamilyItem_Impl()->GetFamily());
static_cast<sal_uInt16>(GetFamilyItem_Impl()->GetFamily()));
break;
}
case SID_TEMPLATE_LOAD:
......@@ -1829,7 +1829,7 @@ void SfxCommonTemplateDialog_Impl::NewHdl()
Execute_Impl(SID_STYLE_NEW,
"", GetSelectedEntry(),
( sal_uInt16 )GetFamilyItem_Impl()->GetFamily(),
static_cast<sal_uInt16>(GetFamilyItem_Impl()->GetFamily()),
nMask);
}
}
......@@ -1843,7 +1843,7 @@ void SfxCommonTemplateDialog_Impl::EditHdl()
OUString aTemplName(GetSelectedEntry());
GetSelectedStyle(); // -Wall required??
if ( Execute_Impl( SID_STYLE_EDIT, aTemplName, OUString(),
(sal_uInt16)GetFamilyItem_Impl()->GetFamily(), 0, &nFilter ) )
static_cast<sal_uInt16>(GetFamilyItem_Impl()->GetFamily()), 0, &nFilter ) )
{
}
}
......@@ -1907,7 +1907,7 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl()
const OUString aTemplName(pTreeBox ? pTreeBox->GetEntryText(*it) : aFmtLb->GetEntryText(*it));
bDontUpdate = true; // To prevent the Treelistbox to shut down while deleting
Execute_Impl( SID_STYLE_DELETE, aTemplName,
OUString(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily() );
OUString(), static_cast<sal_uInt16>(GetFamilyItem_Impl()->GetFamily()) );
if ( pTreeBox )
{
......@@ -1932,7 +1932,7 @@ void SfxCommonTemplateDialog_Impl::HideHdl()
OUString aTemplName = pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb->GetEntryText(pEntry);
Execute_Impl( SID_STYLE_HIDE, aTemplName,
OUString(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily() );
OUString(), static_cast<sal_uInt16>(GetFamilyItem_Impl()->GetFamily()) );
pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb->NextSelected(pEntry);
}
......@@ -1951,7 +1951,7 @@ void SfxCommonTemplateDialog_Impl::ShowHdl()
OUString aTemplName = pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb->GetEntryText(pEntry);
Execute_Impl( SID_STYLE_SHOW, aTemplName,
OUString(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily() );
OUString(), static_cast<sal_uInt16>(GetFamilyItem_Impl()->GetFamily()) );
pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb->NextSelected(pEntry);
}
......@@ -2006,7 +2006,7 @@ IMPL_LINK_NOARG( SfxCommonTemplateDialog_Impl, ApplyHdl, LinkParamNone*, void )
sal_uInt16 nModifier = aFmtLb->GetModifier();
Execute_Impl(SID_STYLE_APPLY,
GetSelectedEntry(), OUString(),
( sal_uInt16 )GetFamilyItem_Impl()->GetFamily(),
static_cast<sal_uInt16>(GetFamilyItem_Impl()->GetFamily()),
0, nullptr, &nModifier );
}
// After selecting a focused item if possible again on the app window
......@@ -2060,7 +2060,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FmtSelectHdl, SvTreeListBox *, pListBox
"", "", 0);
Execute_Impl(SID_STYLE_WATERCAN,
GetSelectedEntry(), "",
( sal_uInt16 )GetFamilyItem_Impl()->GetFamily());
static_cast<sal_uInt16>(GetFamilyItem_Impl()->GetFamily()));
}
EnableItem(SID_STYLE_WATERCAN, !bWaterDisabled);
EnableDelete();
......
......@@ -55,7 +55,7 @@
#include <sfx2/objsh.hxx>
#include <sfx2/event.hxx>
#define SFX_PRINTABLESTATE_CANCELJOB (css::view::PrintableState)-2
#define SFX_PRINTABLESTATE_CANCELJOB css::view::PrintableState(-2)
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
......@@ -297,7 +297,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxPrintHelper::getPrinter()
aPrinter.getArray()[2].Value <<= eFormat;
aPrinter.getArray()[1].Name = "PaperOrientation";
view::PaperOrientation eOrient = (view::PaperOrientation)pPrinter->GetOrientation();
view::PaperOrientation eOrient = static_cast<view::PaperOrientation>(pPrinter->GetOrientation());
aPrinter.getArray()[1].Value <<= eOrient;
aPrinter.getArray()[0].Name = "Name";
......@@ -369,12 +369,12 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >
{
if ( !( rProp.Value >>= lDummy ) )
throw css::lang::IllegalArgumentException();
eOrient = ( view::PaperOrientation) lDummy;
eOrient = static_cast<view::PaperOrientation>(lDummy);
}
if ( (Orientation) eOrient != pPrinter->GetOrientation() )
if ( static_cast<Orientation>(eOrient) != pPrinter->GetOrientation() )
{
pPrinter->SetOrientation( (Orientation) eOrient );
pPrinter->SetOrientation( static_cast<Orientation>(eOrient) );
nChangeFlags |= SfxPrinterChangeFlags::CHG_ORIENTATION;
}
}
......@@ -386,7 +386,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >
{
if ( !( rProp.Value >>= lDummy ) )
throw css::lang::IllegalArgumentException();
nPaperFormat = ( view::PaperFormat ) lDummy;
nPaperFormat = static_cast<view::PaperFormat>(lDummy);
}
if ( convertToPaper(nPaperFormat) != pPrinter->GetPaper() )
......
......@@ -83,8 +83,8 @@ bool SvxZoomItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
}
case MID_VALUE: rVal <<= static_cast<sal_Int32>(GetValue()); break;
case MID_VALUESET: rVal <<= (sal_Int16) nValueSet; break;
case MID_TYPE: rVal <<= (sal_Int16) eType; break;
case MID_VALUESET: rVal <<= static_cast<sal_Int16>(nValueSet); break;
case MID_TYPE: rVal <<= static_cast<sal_Int16>(eType); break;
default:
OSL_FAIL("sfx2::SvxZoomItem::QueryValue(), Wrong MemberId!");
return false;
......
......@@ -263,7 +263,7 @@ void SAL_CALL SfxStatusBarControl::statusChanged( const frame::FeatureStateEvent
{
frame::status::ItemStatus aItemStatus;
rEvent.State >>= aItemStatus;
eState = (SfxItemState) aItemStatus.State;
eState = static_cast<SfxItemState>(aItemStatus.State);
pItem = new SfxVoidItem( nSlotID );
}
else
......
......@@ -490,7 +490,7 @@ void SAL_CALL SfxToolBoxControl::statusChanged( const FeatureStateEvent& rEvent
{
ItemStatus aItemStatus;
rEvent.State >>= aItemStatus;
SfxItemState tmpState = (SfxItemState) aItemStatus.State;
SfxItemState tmpState = static_cast<SfxItemState>(aItemStatus.State);
// make sure no-one tries to send us a combination of states
if (tmpState != SfxItemState::UNKNOWN && tmpState != SfxItemState::DISABLED &&
tmpState != SfxItemState::READONLY && tmpState != SfxItemState::DONTCARE &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment