improve redundantcast loplugin
to find c-style casts where the expression is a templated method Change-Id: Ifbd1e2cdc72d906fc95a7ec0f9408c3f6d2a836b Reviewed-on: https://gerrit.libreoffice.org/42275 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
44bfe8fad4
commit
5685ee25aa
@ -294,6 +294,9 @@ bool RedundantCast::VisitCStyleCastExpr(CStyleCastExpr const * expr) {
|
||||
}
|
||||
auto t1 = compat::getSubExprAsWritten(expr)->getType();
|
||||
auto t2 = expr->getTypeAsWritten();
|
||||
if (auto templateType = dyn_cast<SubstTemplateTypeParmType>(t1)) {
|
||||
t1 = templateType->desugar();
|
||||
}
|
||||
if (t1 != t2) {
|
||||
return true;
|
||||
}
|
||||
|
@ -290,11 +290,23 @@ void testCStyleCast() {
|
||||
(void)e;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct EnumItemInterface {
|
||||
T GetValue() { return static_cast<T>(0); }
|
||||
};
|
||||
class Enum1Item : public EnumItemInterface<Enum1> {
|
||||
};
|
||||
bool testCStyleCastOfTemplateMethodResult(Enum1Item* item) {
|
||||
return (Enum1)item->GetValue() == Enum1::X; // expected-error {{redundant cstyle cast from 'Enum1' to 'Enum1' [loplugin:redundantcast]}}
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
testConstCast();
|
||||
testStaticCast();
|
||||
testFunctionalCast();
|
||||
testCStyleCast();
|
||||
testCStyleCastOfTemplateMethodResult(nullptr);
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
|
@ -1968,7 +1968,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
|
||||
case SfxItemState::SET:
|
||||
{
|
||||
const SvxCaseMapItem& rItem = static_cast<const SvxCaseMapItem&>(rSet->Get( nWhich ));
|
||||
eCaseMap = (SvxCaseMap)rItem.GetValue();
|
||||
eCaseMap = rItem.GetValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2333,7 +2333,7 @@ bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet )
|
||||
SfxItemState::DEFAULT > rOldSet.GetItemState( nWhich );
|
||||
|
||||
const SvxCaseMapItem& rItem = *static_cast<const SvxCaseMapItem*>(pOld);
|
||||
if ( (SvxCaseMap)rItem.GetValue() == eCaseMap && !bAllowChg )
|
||||
if ( rItem.GetValue() == eCaseMap && !bAllowChg )
|
||||
bChanged = false;
|
||||
}
|
||||
|
||||
|
@ -285,7 +285,7 @@ void SvxCaptionTabPage::Reset( const SfxItemSet* )
|
||||
SetMetricValue( *m_pMF_ABSTAND, nGap, eUnit );
|
||||
nGap = static_cast<long>(m_pMF_ABSTAND->GetValue());
|
||||
|
||||
nCaptionType = (SdrCaptionType)static_cast<const SdrCaptionTypeItem&>( rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONTYPE ) ) ).GetValue();
|
||||
nCaptionType = static_cast<const SdrCaptionTypeItem&>( rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONTYPE ) ) ).GetValue();
|
||||
bFitLineLen = static_cast<const SfxBoolItem&>( rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONFITLINELEN ) ) ).GetValue();
|
||||
nEscDir = static_cast<const SdrCaptionEscDirItem&>( rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCDIR ) ) ).GetValue();
|
||||
bEscRel = static_cast<const SfxBoolItem&>( rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCISREL ) ) ).GetValue();
|
||||
|
@ -235,8 +235,8 @@ void SvxTextAttrPage::Reset( const SfxItemSet* rAttrs )
|
||||
if(SfxItemState::DONTCARE != eVState && SfxItemState::DONTCARE != eHState)
|
||||
{
|
||||
// VertAdjust and HorAdjust are unequivocal, thus
|
||||
SdrTextVertAdjust eTVA = (SdrTextVertAdjust)static_cast<const SdrTextVertAdjustItem&>(rAttrs->Get(SDRATTR_TEXT_VERTADJUST)).GetValue();
|
||||
SdrTextHorzAdjust eTHA = (SdrTextHorzAdjust)static_cast<const SdrTextHorzAdjustItem&>(rAttrs->Get(SDRATTR_TEXT_HORZADJUST)).GetValue();
|
||||
SdrTextVertAdjust eTVA = static_cast<const SdrTextVertAdjustItem&>(rAttrs->Get(SDRATTR_TEXT_VERTADJUST)).GetValue();
|
||||
SdrTextHorzAdjust eTHA = static_cast<const SdrTextHorzAdjustItem&>(rAttrs->Get(SDRATTR_TEXT_HORZADJUST)).GetValue();
|
||||
RectPoint eRP = RectPoint::LB;
|
||||
|
||||
m_pTsbFullWidth->EnableTriState( false );
|
||||
@ -309,7 +309,7 @@ void SvxTextAttrPage::Reset( const SfxItemSet* rAttrs )
|
||||
// adjust to border
|
||||
if ( rAttrs->GetItemState( SDRATTR_TEXT_FITTOSIZE ) != SfxItemState::DONTCARE )
|
||||
{
|
||||
SdrFitToSizeType eFTS = (SdrFitToSizeType)
|
||||
SdrFitToSizeType eFTS =
|
||||
static_cast<const SdrTextFitToSizeTypeItem&>( rAttrs->Get( SDRATTR_TEXT_FITTOSIZE ) ).GetValue();
|
||||
if( eFTS == SdrFitToSizeType::Autofit || eFTS == SdrFitToSizeType::NONE )
|
||||
m_pTsbFitToSize->SetState( TRISTATE_FALSE );
|
||||
@ -462,8 +462,7 @@ bool SvxTextAttrPage::FillItemSet( SfxItemSet* rAttrs)
|
||||
|
||||
if ( rOutAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST ) != SfxItemState::DONTCARE )
|
||||
{
|
||||
eOldTVA = (SdrTextVertAdjust)
|
||||
static_cast<const SdrTextVertAdjustItem&>( rOutAttrs.Get( SDRATTR_TEXT_VERTADJUST ) ).GetValue();
|
||||
eOldTVA = static_cast<const SdrTextVertAdjustItem&>( rOutAttrs.Get( SDRATTR_TEXT_VERTADJUST ) ).GetValue();
|
||||
if( eOldTVA != eTVA )
|
||||
rAttrs->Put( SdrTextVertAdjustItem( eTVA ) );
|
||||
}
|
||||
@ -472,8 +471,7 @@ bool SvxTextAttrPage::FillItemSet( SfxItemSet* rAttrs)
|
||||
|
||||
if ( rOutAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ) != SfxItemState::DONTCARE )
|
||||
{
|
||||
eOldTHA = (SdrTextHorzAdjust)
|
||||
static_cast<const SdrTextHorzAdjustItem&>( rOutAttrs.Get( SDRATTR_TEXT_HORZADJUST ) ).GetValue();
|
||||
eOldTHA = static_cast<const SdrTextHorzAdjustItem&>( rOutAttrs.Get( SDRATTR_TEXT_HORZADJUST ) ).GetValue();
|
||||
if( eOldTHA != eTHA )
|
||||
rAttrs->Put( SdrTextHorzAdjustItem( eTHA ) );
|
||||
}
|
||||
|
@ -859,7 +859,7 @@ bool callColumnFormatDialog(vcl::Window* _pParent,
|
||||
// horizontal justify
|
||||
const SvxHorJustifyItem* pHorJustify = pSet->GetItem<SvxHorJustifyItem>(SBA_ATTR_ALIGN_HOR_JUSTIFY);
|
||||
|
||||
_eJustify = (SvxCellHorJustify)pHorJustify->GetValue();
|
||||
_eJustify = pHorJustify->GetValue();
|
||||
|
||||
// format key
|
||||
if (_bHasFormat)
|
||||
|
@ -473,7 +473,7 @@ EditCharAttribRelief::EditCharAttribRelief( const SvxCharReliefItem& rAttr, sal_
|
||||
|
||||
void EditCharAttribRelief::SetFont( SvxFont& rFont, OutputDevice* )
|
||||
{
|
||||
rFont.SetRelief( (FontRelief)static_cast<const SvxCharReliefItem*>(GetItem())->GetValue() );
|
||||
rFont.SetRelief( static_cast<const SvxCharReliefItem*>(GetItem())->GetValue() );
|
||||
}
|
||||
|
||||
// class EditCharAttribGrabBag
|
||||
|
@ -2050,7 +2050,7 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, S
|
||||
if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_EMPHASISMARK ) == SfxItemState::SET ) )
|
||||
rFont.SetEmphasisMark( static_cast<const SvxEmphasisMarkItem&>(rSet.Get( EE_CHAR_EMPHASISMARK )).GetEmphasisMark() );
|
||||
if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_RELIEF ) == SfxItemState::SET ) )
|
||||
rFont.SetRelief( (FontRelief)static_cast<const SvxCharReliefItem&>(rSet.Get( EE_CHAR_RELIEF )).GetValue() );
|
||||
rFont.SetRelief( static_cast<const SvxCharReliefItem&>(rSet.Get( EE_CHAR_RELIEF )).GetValue() );
|
||||
|
||||
// If comparing the entire font, or if checking before each alteration
|
||||
// whether the value changes, remains relatively the same thing.
|
||||
|
@ -69,7 +69,7 @@ bool SvxHorJustifyItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
|
||||
case MID_HORJUST_HORJUST:
|
||||
{
|
||||
table::CellHoriJustify eUno = table::CellHoriJustify_STANDARD;
|
||||
switch ( (SvxCellHorJustify)GetValue() )
|
||||
switch ( GetValue() )
|
||||
{
|
||||
case SvxCellHorJustify::Standard: eUno = table::CellHoriJustify_STANDARD; break;
|
||||
case SvxCellHorJustify::Left: eUno = table::CellHoriJustify_LEFT; break;
|
||||
@ -87,7 +87,7 @@ bool SvxHorJustifyItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
|
||||
// (same value for ParaAdjust and ParaLastLineAdjust)
|
||||
|
||||
style::ParagraphAdjust nAdjust = style::ParagraphAdjust_LEFT;
|
||||
switch ( (SvxCellHorJustify)GetValue() )
|
||||
switch ( GetValue() )
|
||||
{
|
||||
// ParagraphAdjust_LEFT is used for STANDARD and REPEAT
|
||||
case SvxCellHorJustify::Standard:
|
||||
@ -218,7 +218,7 @@ bool SvxVerJustifyItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
|
||||
case MID_HORJUST_ADJUST:
|
||||
{
|
||||
style::VerticalAlignment eUno = style::VerticalAlignment_TOP;
|
||||
switch ( (SvxCellVerJustify)GetValue() )
|
||||
switch ( GetValue() )
|
||||
{
|
||||
case SVX_VER_JUSTIFY_TOP: eUno = style::VerticalAlignment_TOP; break;
|
||||
case SVX_VER_JUSTIFY_CENTER: eUno = style::VerticalAlignment_MIDDLE; break;
|
||||
@ -231,7 +231,7 @@ bool SvxVerJustifyItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
|
||||
default:
|
||||
{
|
||||
sal_Int32 nUno = table::CellVertJustify2::STANDARD;
|
||||
switch ( (SvxCellVerJustify)GetValue() )
|
||||
switch ( GetValue() )
|
||||
{
|
||||
case SVX_VER_JUSTIFY_STANDARD: nUno = table::CellVertJustify2::STANDARD; break;
|
||||
case SVX_VER_JUSTIFY_TOP: nUno = table::CellVertJustify2::TOP; break;
|
||||
|
@ -359,7 +359,7 @@ OUString SubstitutePathVariables::impl_substituteVariable( const OUString& rText
|
||||
if ( pNTOIIter != m_aPreDefVarMap.end() )
|
||||
{
|
||||
// Fixed/Predefined variable found
|
||||
PreDefVariable nIndex = (PreDefVariable)pNTOIIter->second;
|
||||
PreDefVariable nIndex = pNTOIIter->second;
|
||||
|
||||
// Determine variable value and length from array/table
|
||||
if ( nIndex == PREDEFVAR_WORK && !bWorkRetrieved )
|
||||
@ -592,7 +592,7 @@ OUString const & SubstitutePathVariables::impl_getSubstituteVariableValue( const
|
||||
// Fixed/Predefined variable
|
||||
if ( pNTOIIter != m_aPreDefVarMap.end() )
|
||||
{
|
||||
PreDefVariable nIndex = (PreDefVariable)pNTOIIter->second;
|
||||
PreDefVariable nIndex = pNTOIIter->second;
|
||||
return m_aPreDefVars.m_FixedVar[(sal_Int32)nIndex];
|
||||
}
|
||||
else
|
||||
|
@ -1358,7 +1358,7 @@ bool ScAttrArray::HasAttrib_Impl(const ScPatternAttr* pPattern, HasAttrFlags nMa
|
||||
bFound = true;
|
||||
else if (static_cast<const SfxBoolItem&>(pPattern->GetItem( ATTR_LINEBREAK )).GetValue())
|
||||
bFound = true;
|
||||
else if ((SvxCellHorJustify)static_cast<const SvxHorJustifyItem&>(pPattern->
|
||||
else if (static_cast<const SvxHorJustifyItem&>(pPattern->
|
||||
GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SvxCellHorJustify::Block)
|
||||
bFound = true;
|
||||
|
||||
@ -1382,7 +1382,7 @@ bool ScAttrArray::HasAttrib_Impl(const ScPatternAttr* pPattern, HasAttrFlags nMa
|
||||
if ( nMask & HasAttrFlags::RightOrCenter )
|
||||
{
|
||||
// called only if the sheet is LTR, so physical=logical alignment can be assumed
|
||||
SvxCellHorJustify eHorJust = (SvxCellHorJustify)
|
||||
SvxCellHorJustify eHorJust =
|
||||
static_cast<const SvxHorJustifyItem&>( pPattern->GetItem( ATTR_HOR_JUSTIFY )).GetValue();
|
||||
if ( eHorJust == SvxCellHorJustify::Right || eHorJust == SvxCellHorJustify::Center )
|
||||
bFound = true;
|
||||
|
@ -144,9 +144,9 @@ long ScColumn::GetNeededSize(
|
||||
SvxCellHorJustify eHorJust;
|
||||
if (pCondSet &&
|
||||
pCondSet->GetItemState(ATTR_HOR_JUSTIFY, true, &pCondItem) == SfxItemState::SET)
|
||||
eHorJust = (SvxCellHorJustify)static_cast<const SvxHorJustifyItem*>(pCondItem)->GetValue();
|
||||
eHorJust = static_cast<const SvxHorJustifyItem*>(pCondItem)->GetValue();
|
||||
else
|
||||
eHorJust = (SvxCellHorJustify)static_cast<const SvxHorJustifyItem&>(
|
||||
eHorJust = static_cast<const SvxHorJustifyItem&>(
|
||||
pPattern->GetItem( ATTR_HOR_JUSTIFY )).GetValue();
|
||||
bool bBreak;
|
||||
if ( eHorJust == SvxCellHorJustify::Block )
|
||||
@ -212,9 +212,9 @@ long ScColumn::GetNeededSize(
|
||||
{
|
||||
if (pCondSet &&
|
||||
pCondSet->GetItemState(ATTR_ROTATE_MODE, true, &pCondItem) == SfxItemState::SET)
|
||||
eRotMode = (SvxRotateMode)static_cast<const SvxRotateModeItem*>(pCondItem)->GetValue();
|
||||
eRotMode = static_cast<const SvxRotateModeItem*>(pCondItem)->GetValue();
|
||||
else
|
||||
eRotMode = (SvxRotateMode)static_cast<const SvxRotateModeItem&>(
|
||||
eRotMode = static_cast<const SvxRotateModeItem&>(
|
||||
pPattern->GetItem(ATTR_ROTATE_MODE)).GetValue();
|
||||
|
||||
if ( nRotate == 18000 )
|
||||
@ -814,7 +814,7 @@ void ScColumn::GetOptimalHeight(
|
||||
if (bStdAllowed)
|
||||
{
|
||||
bool bBreak = static_cast<const SfxBoolItem&>(pPattern->GetItem(ATTR_LINEBREAK)).GetValue() ||
|
||||
((SvxCellHorJustify)static_cast<const SvxHorJustifyItem&>(pPattern->
|
||||
(static_cast<const SvxHorJustifyItem&>(pPattern->
|
||||
GetItem( ATTR_HOR_JUSTIFY )).GetValue() ==
|
||||
SvxCellHorJustify::Block);
|
||||
bStdOnly = !bBreak;
|
||||
|
@ -909,7 +909,7 @@ void ScPatternAttr::FillEditParaItems( SfxItemSet* pEditSet ) const
|
||||
|
||||
const SfxItemSet& rMySet = GetItemSet();
|
||||
|
||||
SvxCellHorJustify eHorJust = (SvxCellHorJustify)
|
||||
SvxCellHorJustify eHorJust =
|
||||
static_cast<const SvxHorJustifyItem&>(rMySet.Get(ATTR_HOR_JUSTIFY)).GetValue();
|
||||
|
||||
SvxAdjust eSvxAdjust;
|
||||
|
@ -1922,7 +1922,7 @@ void ScTable::MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, d
|
||||
const ScPatternAttr* pPattern = GetPattern( rCol, nRow );
|
||||
const SfxItemSet* pCondSet = pDocument->GetCondResult( rCol, nRow, nTab );
|
||||
|
||||
SvxCellHorJustify eHorJust = (SvxCellHorJustify)static_cast<const SvxHorJustifyItem&>(
|
||||
SvxCellHorJustify eHorJust = static_cast<const SvxHorJustifyItem&>(
|
||||
pPattern->GetItem( ATTR_HOR_JUSTIFY, pCondSet )).GetValue();
|
||||
if ( eHorJust == SvxCellHorJustify::Center )
|
||||
nMissing /= 2; // distributed into both directions
|
||||
|
@ -317,7 +317,7 @@ tools::Rectangle ScEditUtil::GetEditArea( const ScPatternAttr* pPattern, bool bF
|
||||
|
||||
long nPixDifY;
|
||||
long nTopMargin = (long) ( pMargin->GetTopMargin() * nPPTY );
|
||||
SvxCellVerJustify eJust = (SvxCellVerJustify) static_cast<const SvxVerJustifyItem&>(pPattern->
|
||||
SvxCellVerJustify eJust = static_cast<const SvxVerJustifyItem&>(pPattern->
|
||||
GetItem(ATTR_VER_JUSTIFY)).GetValue();
|
||||
|
||||
// asian vertical is always edited top-aligned
|
||||
|
@ -2122,7 +2122,7 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bIn
|
||||
mpEditEngine->SetBackgroundColor( aBackCol );
|
||||
|
||||
// Adjustment
|
||||
eAttrAdjust = (SvxCellHorJustify)static_cast<const SvxHorJustifyItem&>(pPattern->
|
||||
eAttrAdjust = static_cast<const SvxHorJustifyItem&>(pPattern->
|
||||
GetItem(ATTR_HOR_JUSTIFY)).GetValue();
|
||||
if ( eAttrAdjust == SvxCellHorJustify::Repeat &&
|
||||
static_cast<const SfxBoolItem&>(pPattern->GetItem(ATTR_LINEBREAK)).GetValue() )
|
||||
|
@ -2069,7 +2069,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
|
||||
|
||||
if ( bFixedWidth )
|
||||
{
|
||||
SvxCellHorJustify eHorJust = (SvxCellHorJustify)
|
||||
SvxCellHorJustify eHorJust =
|
||||
static_cast<const SvxHorJustifyItem*>( aDocument.GetAttr( nCol, nRow,
|
||||
nTab, ATTR_HOR_JUSTIFY ))->GetValue();
|
||||
lcl_ScDocShell_GetFixedWidthString( aString, aDocument, nTab, nCol,
|
||||
|
@ -1237,7 +1237,7 @@ void ScDrawTextObjectBar::GetStatePropPanelAttr(SfxItemSet &rSet)
|
||||
//if(SfxItemState::DONTCARE != eVState && SfxItemState::DONTCARE != eHState)
|
||||
if(SfxItemState::DONTCARE != eVState)
|
||||
{
|
||||
SdrTextVertAdjust eTVA = (SdrTextVertAdjust)static_cast<const SdrTextVertAdjustItem&>(aEditAttr.Get(SDRATTR_TEXT_VERTADJUST)).GetValue();
|
||||
SdrTextVertAdjust eTVA = static_cast<const SdrTextVertAdjustItem&>(aEditAttr.Get(SDRATTR_TEXT_VERTADJUST)).GetValue();
|
||||
bool bSet = (nSlotId == SID_TABLE_VERT_NONE && eTVA == SDRTEXTVERTADJUST_TOP) ||
|
||||
(nSlotId == SID_TABLE_VERT_CENTER && eTVA == SDRTEXTVERTADJUST_CENTER) ||
|
||||
(nSlotId == SID_TABLE_VERT_BOTTOM && eTVA == SDRTEXTVERTADJUST_BOTTOM);
|
||||
|
@ -261,7 +261,7 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo
|
||||
// Justification:
|
||||
|
||||
eJustification = mbRTL ? SvxCellHorJustify::Right : bJustify ?
|
||||
(SvxCellHorJustify) (static_cast<const SvxHorJustifyItem*>(pCurData->GetItem(nFmtIndex, ATTR_HOR_JUSTIFY))->GetValue()) :
|
||||
static_cast<const SvxHorJustifyItem*>(pCurData->GetItem(nFmtIndex, ATTR_HOR_JUSTIFY))->GetValue() :
|
||||
SvxCellHorJustify::Standard;
|
||||
|
||||
if (pCurData->GetIncludeFont())
|
||||
|
@ -270,7 +270,7 @@ void AlignmentPropertyPanel::NotifyItemUpdate(
|
||||
if(eState >= SfxItemState::DEFAULT && pState && dynamic_cast<const SvxHorJustifyItem*>( pState) != nullptr )
|
||||
{
|
||||
const SvxHorJustifyItem* pItem = static_cast<const SvxHorJustifyItem*>(pState);
|
||||
meHorAlignState = (SvxCellHorJustify)pItem->GetValue();
|
||||
meHorAlignState = pItem->GetValue();
|
||||
}
|
||||
|
||||
if( meHorAlignState == SvxCellHorJustify::Repeat )
|
||||
@ -359,7 +359,7 @@ void AlignmentPropertyPanel::NotifyItemUpdate(
|
||||
if( eState >= SfxItemState::DEFAULT)
|
||||
{
|
||||
const SvxRotateModeItem* pItem = static_cast<const SvxRotateModeItem*>(pState);
|
||||
SvxRotateMode eMode = (SvxRotateMode)pItem->GetValue();
|
||||
SvxRotateMode eMode = pItem->GetValue();
|
||||
if(eMode == SVX_ROTATE_MODE_BOTTOM)
|
||||
{
|
||||
mpRefEdgeBottom->SetState(true);
|
||||
|
@ -1347,14 +1347,14 @@ void ScFormatShell::ExecuteAlignment( SfxRequest& rReq )
|
||||
|
||||
case SID_H_ALIGNCELL:
|
||||
{
|
||||
SvxCellHorJustify eJust = (SvxCellHorJustify)static_cast<const SvxHorJustifyItem*>(pItem)->GetValue();
|
||||
SvxCellHorJustify eJust = static_cast<const SvxHorJustifyItem*>(pItem)->GetValue();
|
||||
// #i78476# update alignment of text in cell edit mode
|
||||
pTabViewShell->UpdateInputHandlerCellAdjust( eJust );
|
||||
pTabViewShell->ApplyAttr( SvxHorJustifyItem( eJust, ATTR_HOR_JUSTIFY ) );
|
||||
}
|
||||
break;
|
||||
case SID_V_ALIGNCELL:
|
||||
pTabViewShell->ApplyAttr( SvxVerJustifyItem( (SvxCellVerJustify)static_cast<const SvxVerJustifyItem*>(pItem)->GetValue(), ATTR_VER_JUSTIFY ) );
|
||||
pTabViewShell->ApplyAttr( SvxVerJustifyItem( static_cast<const SvxVerJustifyItem*>(pItem)->GetValue(), ATTR_VER_JUSTIFY ) );
|
||||
break;
|
||||
default:
|
||||
OSL_FAIL( "ExecuteAlignment: invalid slot" );
|
||||
@ -2443,12 +2443,12 @@ void ScFormatShell::GetAlignState( SfxItemSet& rSet )
|
||||
SvxCellHorJustify eHAlign = SvxCellHorJustify::Standard;
|
||||
bool bHasHAlign = rAttrSet.GetItemState( ATTR_HOR_JUSTIFY ) != SfxItemState::DONTCARE;
|
||||
if( bHasHAlign )
|
||||
eHAlign = (SvxCellHorJustify)static_cast<const SvxHorJustifyItem&>(rAttrSet.Get( ATTR_HOR_JUSTIFY )).GetValue();
|
||||
eHAlign = static_cast<const SvxHorJustifyItem&>(rAttrSet.Get( ATTR_HOR_JUSTIFY )).GetValue();
|
||||
|
||||
SvxCellVerJustify eVAlign = SVX_VER_JUSTIFY_STANDARD;
|
||||
bool bHasVAlign = rAttrSet.GetItemState( ATTR_VER_JUSTIFY ) != SfxItemState::DONTCARE;
|
||||
if( bHasVAlign )
|
||||
eVAlign = (SvxCellVerJustify)static_cast<const SvxVerJustifyItem&>(rAttrSet.Get( ATTR_VER_JUSTIFY )).GetValue();
|
||||
eVAlign = static_cast<const SvxVerJustifyItem&>(rAttrSet.Get( ATTR_VER_JUSTIFY )).GetValue();
|
||||
|
||||
while ( nWhich )
|
||||
{
|
||||
|
@ -5078,9 +5078,9 @@ bool ScGridWindow::GetEditUrl( const Point& rPos,
|
||||
return false;
|
||||
|
||||
bool bBreak = static_cast<const SfxBoolItem&>(pPattern->GetItem(ATTR_LINEBREAK)).GetValue() ||
|
||||
((SvxCellHorJustify)static_cast<const SvxHorJustifyItem&>(pPattern->
|
||||
(static_cast<const SvxHorJustifyItem&>(pPattern->
|
||||
GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SvxCellHorJustify::Block);
|
||||
SvxCellHorJustify eHorJust = (SvxCellHorJustify)static_cast<const SvxHorJustifyItem&>(pPattern->
|
||||
SvxCellHorJustify eHorJust = static_cast<const SvxHorJustifyItem&>(pPattern->
|
||||
GetItem(ATTR_HOR_JUSTIFY)).GetValue();
|
||||
|
||||
// EditEngine
|
||||
|
@ -656,7 +656,7 @@ void ScOutputData::SetCellRotations()
|
||||
|
||||
// add rotation info to Array information
|
||||
const long nAttrRotate(pPattern->GetRotateVal(pCondSet));
|
||||
const SvxRotateMode eRotMode((SvxRotateMode)static_cast<const SvxRotateModeItem&>(pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet)).GetValue());
|
||||
const SvxRotateMode eRotMode(static_cast<const SvxRotateModeItem&>(pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet)).GetValue());
|
||||
const double fOrient((bLayoutRTL ? -1.0 : 1.0) * nAttrRotate * F_PI18000); // 1/100th degrees -> [0..2PI]
|
||||
svx::frame::Array& rArray = mrTabInfo.maArray;
|
||||
|
||||
@ -678,7 +678,7 @@ static ScRotateDir lcl_GetRotateDir( const ScDocument* pDoc, SCCOL nCol, SCROW n
|
||||
long nAttrRotate = pPattern->GetRotateVal( pCondSet );
|
||||
if ( nAttrRotate )
|
||||
{
|
||||
SvxRotateMode eRotMode = (SvxRotateMode)static_cast<const SvxRotateModeItem&>(
|
||||
SvxRotateMode eRotMode = static_cast<const SvxRotateModeItem&>(
|
||||
pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet)).GetValue();
|
||||
|
||||
if ( eRotMode == SVX_ROTATE_MODE_STANDARD )
|
||||
@ -1548,7 +1548,7 @@ void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext)
|
||||
//! LastPattern etc.
|
||||
|
||||
long nAttrRotate = pPattern->GetRotateVal( pCondSet );
|
||||
SvxRotateMode eRotMode = (SvxRotateMode)static_cast<const SvxRotateModeItem&>(
|
||||
SvxRotateMode eRotMode = static_cast<const SvxRotateModeItem&>(
|
||||
pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet)).GetValue();
|
||||
|
||||
if (nAttrRotate)
|
||||
|
@ -323,9 +323,9 @@ void ScDrawStringsVars::SetPattern(
|
||||
|
||||
// alignment
|
||||
|
||||
eAttrHorJust = (SvxCellHorJustify)static_cast<const SvxHorJustifyItem&>(pPattern->GetItem( ATTR_HOR_JUSTIFY, pCondSet )).GetValue();
|
||||
eAttrHorJust = static_cast<const SvxHorJustifyItem&>(pPattern->GetItem( ATTR_HOR_JUSTIFY, pCondSet )).GetValue();
|
||||
|
||||
eAttrVerJust = (SvxCellVerJustify)static_cast<const SvxVerJustifyItem&>(pPattern->GetItem( ATTR_VER_JUSTIFY, pCondSet )).GetValue();
|
||||
eAttrVerJust = static_cast<const SvxVerJustifyItem&>(pPattern->GetItem( ATTR_VER_JUSTIFY, pCondSet )).GetValue();
|
||||
if ( eAttrVerJust == SVX_VER_JUSTIFY_STANDARD )
|
||||
eAttrVerJust = SVX_VER_JUSTIFY_BOTTOM;
|
||||
|
||||
@ -4721,7 +4721,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
|
||||
|
||||
long nCellWidth = (long) pRowInfo[0].pCellInfo[nX+1].nWidth;
|
||||
|
||||
SvxCellHorJustify eHorJust = (SvxCellHorJustify)static_cast<const SvxHorJustifyItem&>(
|
||||
SvxCellHorJustify eHorJust = static_cast<const SvxHorJustifyItem&>(
|
||||
pPattern->GetItem(ATTR_HOR_JUSTIFY, pCondSet)).GetValue();
|
||||
bool bBreak = ( eHorJust == SvxCellHorJustify::Block ) ||
|
||||
static_cast<const SfxBoolItem&>(pPattern->GetItem(ATTR_LINEBREAK, pCondSet)).GetValue();
|
||||
@ -4769,7 +4769,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
|
||||
nOutHeight += (long) mpDoc->GetScaledRowHeight( nY+1, nY+nCountY-1, nTab, mnPPTY);
|
||||
}
|
||||
|
||||
SvxCellVerJustify eVerJust = (SvxCellVerJustify)static_cast<const SvxVerJustifyItem&>(
|
||||
SvxCellVerJustify eVerJust = static_cast<const SvxVerJustifyItem&>(
|
||||
pPattern->GetItem(ATTR_VER_JUSTIFY, pCondSet)).GetValue();
|
||||
|
||||
// syntax mode is ignored here...
|
||||
@ -4848,7 +4848,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
|
||||
GetItem(ATTR_ROTATE_VALUE, pCondSet)).GetValue();
|
||||
if ( nAttrRotate )
|
||||
{
|
||||
eRotMode = (SvxRotateMode)static_cast<const SvxRotateModeItem&>(
|
||||
eRotMode = static_cast<const SvxRotateModeItem&>(
|
||||
pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet)).GetValue();
|
||||
|
||||
if ( nAttrRotate == 18000 )
|
||||
|
@ -1050,7 +1050,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
|
||||
bEditActive[eWhich] = true;
|
||||
|
||||
const ScPatternAttr* pPattern = pDoc->GetPattern( nNewX, nNewY, nTabNo );
|
||||
SvxCellHorJustify eJust = (SvxCellHorJustify)static_cast<const SvxHorJustifyItem&>(
|
||||
SvxCellHorJustify eJust = static_cast<const SvxHorJustifyItem&>(
|
||||
pPattern->GetItem( ATTR_HOR_JUSTIFY )).GetValue();
|
||||
|
||||
bool bBreak = ( eJust == SvxCellHorJustify::Block ) ||
|
||||
@ -1256,7 +1256,7 @@ void ScViewData::EditGrowX()
|
||||
|
||||
// get bGrow... variables the same way as in SetEditEngine
|
||||
const ScPatternAttr* pPattern = pLocalDoc->GetPattern( nEditCol, nEditRow, nTabNo );
|
||||
SvxCellHorJustify eJust = (SvxCellHorJustify)static_cast<const SvxHorJustifyItem&>(
|
||||
SvxCellHorJustify eJust = static_cast<const SvxHorJustifyItem&>(
|
||||
pPattern->GetItem( ATTR_HOR_JUSTIFY )).GetValue();
|
||||
bool bGrowCentered = ( eJust == SvxCellHorJustify::Center );
|
||||
bool bGrowToLeft = ( eJust == SvxCellHorJustify::Right ); // visual left
|
||||
|
@ -3202,7 +3202,7 @@ void DrawViewShell::GetStatePropPanelAttr(SfxItemSet& rSet)
|
||||
//if(SfxItemState::DONTCARE != eVState && SfxItemState::DONTCARE != eHState)
|
||||
if(SfxItemState::DONTCARE != eVState)
|
||||
{
|
||||
SdrTextVertAdjust eTVA = (SdrTextVertAdjust)static_cast<const SdrTextVertAdjustItem&>(aAttrs.Get(SDRATTR_TEXT_VERTADJUST)).GetValue();
|
||||
SdrTextVertAdjust eTVA = static_cast<const SdrTextVertAdjustItem&>(aAttrs.Get(SDRATTR_TEXT_VERTADJUST)).GetValue();
|
||||
bool bSet = (nSlotId == SID_TABLE_VERT_NONE && eTVA == SDRTEXTVERTADJUST_TOP) ||
|
||||
(nSlotId == SID_TABLE_VERT_CENTER && eTVA == SDRTEXTVERTADJUST_CENTER) ||
|
||||
(nSlotId == SID_TABLE_VERT_BOTTOM && eTVA == SDRTEXTVERTADJUST_BOTTOM);
|
||||
|
@ -197,19 +197,19 @@ void HTMLOption::GetColor( Color& rColor ) const
|
||||
HTMLInputType HTMLOption::GetInputType() const
|
||||
{
|
||||
DBG_ASSERT( nToken==HtmlOptionId::TYPE, "GetInputType: Option not TYPE" );
|
||||
return (HTMLInputType)GetEnum( aInputTypeOptEnums, HTMLInputType::Text );
|
||||
return GetEnum( aInputTypeOptEnums, HTMLInputType::Text );
|
||||
}
|
||||
|
||||
HTMLTableFrame HTMLOption::GetTableFrame() const
|
||||
{
|
||||
DBG_ASSERT( nToken==HtmlOptionId::FRAME, "GetTableFrame: Option not FRAME" );
|
||||
return (HTMLTableFrame)GetEnum( aTableFrameOptEnums );
|
||||
return GetEnum( aTableFrameOptEnums );
|
||||
}
|
||||
|
||||
HTMLTableRules HTMLOption::GetTableRules() const
|
||||
{
|
||||
DBG_ASSERT( nToken==HtmlOptionId::RULES, "GetTableRules: Option not RULES" );
|
||||
return (HTMLTableRules)GetEnum( aTableRulesOptEnums );
|
||||
return GetEnum( aTableRulesOptEnums );
|
||||
}
|
||||
|
||||
HTMLParser::HTMLParser( SvStream& rIn, bool bReadNewDoc ) :
|
||||
|
@ -1013,7 +1013,7 @@ void SvxFontPrevWindow::SetFromItemSet(const SfxItemSet &rSet, bool bPreviewBack
|
||||
if( GetWhich( rSet, SID_ATTR_CHAR_CASEMAP, nWhich ) )
|
||||
{
|
||||
const SvxCaseMapItem& rItem = static_cast<const SvxCaseMapItem&>( rSet.Get( nWhich ) );
|
||||
SvxCaseMap eCaseMap = ( SvxCaseMap ) rItem.GetValue();
|
||||
SvxCaseMap eCaseMap = rItem.GetValue();
|
||||
rFont.SetCaseMap( eCaseMap );
|
||||
rCJKFont.SetCaseMap( eCaseMap );
|
||||
// #i78474# small caps do not exist in CTL fonts
|
||||
@ -1255,7 +1255,7 @@ void SvxFontPrevWindow::Init(const SfxItemSet& rSet)
|
||||
if( ISITEMSET )
|
||||
{
|
||||
const SvxCaseMapItem& rItem = static_cast<const SvxCaseMapItem&>( rSet.Get( nWhich ) );
|
||||
SvxCaseMap eCaseMap = ( SvxCaseMap ) rItem.GetValue();
|
||||
SvxCaseMap eCaseMap = rItem.GetValue();
|
||||
rFont.SetCaseMap( eCaseMap );
|
||||
rCJKFont.SetCaseMap( eCaseMap );
|
||||
// #i78474# small caps do not exist in CTL fonts
|
||||
|
@ -82,7 +82,7 @@ bool SvxOrientationItem::GetPresentation
|
||||
bool SvxOrientationItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
|
||||
{
|
||||
table::CellOrientation eUno = table::CellOrientation_STANDARD;
|
||||
switch ( (SvxCellOrientation)GetValue() )
|
||||
switch ( GetValue() )
|
||||
{
|
||||
case SvxCellOrientation::Standard: eUno = table::CellOrientation_STANDARD; break;
|
||||
case SvxCellOrientation::TopBottom: eUno = table::CellOrientation_TOPBOTTOM; break;
|
||||
|
@ -104,7 +104,7 @@ sal_uInt16 SvxRotateModeItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const
|
||||
bool SvxRotateModeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
|
||||
{
|
||||
sal_Int32 nUno = table::CellVertJustify2::STANDARD;
|
||||
switch ( (SvxRotateMode)GetValue() )
|
||||
switch ( GetValue() )
|
||||
{
|
||||
case SVX_ROTATE_MODE_STANDARD: nUno = table::CellVertJustify2::STANDARD; break;
|
||||
case SVX_ROTATE_MODE_TOP: nUno = table::CellVertJustify2::TOP; break;
|
||||
|
@ -1020,7 +1020,7 @@ GraphicAttr& SwGrfNode::GetGraphicAttr( GraphicAttr& rGA,
|
||||
{
|
||||
const SwAttrSet& rSet = GetSwAttrSet();
|
||||
|
||||
rGA.SetDrawMode( (GraphicDrawMode)rSet.GetDrawModeGrf().GetValue() );
|
||||
rGA.SetDrawMode( rSet.GetDrawModeGrf().GetValue() );
|
||||
|
||||
const SwMirrorGrf & rMirror = rSet.GetMirrorGrf();
|
||||
BmpMirrorFlags nMirror = BmpMirrorFlags::NONE;
|
||||
|
@ -855,7 +855,7 @@ void SwDrawTextShell::GetStatePropPanelAttr(SfxItemSet &rSet)
|
||||
//if(SfxItemState::DONTCARE != eVState && SfxItemState::DONTCARE != eHState)
|
||||
if(SfxItemState::DONTCARE != eVState)
|
||||
{
|
||||
SdrTextVertAdjust eTVA = (SdrTextVertAdjust)static_cast<const SdrTextVertAdjustItem&>(aAttrs.Get(SDRATTR_TEXT_VERTADJUST)).GetValue();
|
||||
SdrTextVertAdjust eTVA = static_cast<const SdrTextVertAdjustItem&>(aAttrs.Get(SDRATTR_TEXT_VERTADJUST)).GetValue();
|
||||
bool bSet = (nSlotId == SID_TABLE_VERT_NONE && eTVA == SDRTEXTVERTADJUST_TOP) ||
|
||||
(nSlotId == SID_TABLE_VERT_CENTER && eTVA == SDRTEXTVERTADJUST_CENTER) ||
|
||||
(nSlotId == SID_TABLE_VERT_BOTTOM && eTVA == SDRTEXTVERTADJUST_BOTTOM);
|
||||
|
@ -796,15 +796,15 @@ void NeonSession::Init()
|
||||
// set the timeout (in seconds) used when making a connection
|
||||
sal_Int32 nConnectTimeout = officecfg::Inet::Settings::ConnectTimeout::get( rContext );
|
||||
ne_set_connect_timeout( m_pHttpSession,
|
||||
(int) ( std::max( nConnectTimeoutMin,
|
||||
std::min( nConnectTimeout, nConnectTimeoutMax ) ) ) );
|
||||
std::max( nConnectTimeoutMin,
|
||||
std::min( nConnectTimeout, nConnectTimeoutMax ) ) );
|
||||
|
||||
// provides a read time out facility as well
|
||||
// set the timeout (in seconds) used when reading from a socket.
|
||||
sal_Int32 nReadTimeout = officecfg::Inet::Settings::ReadTimeout::get( rContext );
|
||||
ne_set_read_timeout( m_pHttpSession,
|
||||
(int) ( std::max( nReadTimeoutMin,
|
||||
std::min( nReadTimeout, nReadTimeoutMax ) ) ) );
|
||||
std::max( nReadTimeoutMin,
|
||||
std::min( nReadTimeout, nReadTimeoutMax ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user