teach unusedvariablecheck plugin about SfxPoolItem subclasses
which can all be treated as SAL_WARN_UNUSED The eehtml.cxx change probably fixes some CJK/CTL bug somewhere Change-Id: I6852129540f316075aee907971ac19418d71dd9a
This commit is contained in:
parent
1d7c589d50
commit
fe2164949b
@ -49,7 +49,7 @@ void UnusedVariableCheck::run()
|
||||
TraverseDecl( compiler.getASTContext().getTranslationUnitDecl());
|
||||
}
|
||||
|
||||
bool BaseCheckNotDialogSubclass(
|
||||
bool BaseCheckNotSomethingInterestingSubclass(
|
||||
const CXXRecordDecl *BaseDefinition
|
||||
#if CLANG_VERSION < 30800
|
||||
, void *
|
||||
@ -59,21 +59,26 @@ bool BaseCheckNotDialogSubclass(
|
||||
if (BaseDefinition && BaseDefinition->getQualifiedNameAsString().compare("Dialog") == 0) {
|
||||
return false;
|
||||
}
|
||||
if (BaseDefinition && BaseDefinition->getQualifiedNameAsString().compare("SfxPoolItem") == 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isDerivedFromDialog(const CXXRecordDecl *decl) {
|
||||
bool isDerivedFromSomethingInteresting(const CXXRecordDecl *decl) {
|
||||
if (!decl)
|
||||
return false;
|
||||
if (decl->getQualifiedNameAsString() == "Dialog")
|
||||
return true;
|
||||
if (decl->getQualifiedNameAsString() == "SfxPoolItem")
|
||||
return true;
|
||||
if (!decl->hasDefinition()) {
|
||||
return false;
|
||||
}
|
||||
if (// not sure what hasAnyDependentBases() does,
|
||||
// but it avoids classes we don't want, e.g. WeakAggComponentImplHelper1
|
||||
!decl->hasAnyDependentBases() &&
|
||||
!compat::forallBases(*decl, BaseCheckNotDialogSubclass, nullptr, true)) {
|
||||
!compat::forallBases(*decl, BaseCheckNotSomethingInterestingSubclass, nullptr, true)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -114,8 +119,7 @@ bool UnusedVariableCheck::VisitVarDecl( const VarDecl* var )
|
||||
|| n == "std::list" || n == "std::__debug::list"
|
||||
|| n == "std::vector" || n == "std::__debug::vector" )
|
||||
warn_unused = true;
|
||||
// check if this field is derived from Dialog
|
||||
if (!warn_unused && isDerivedFromDialog(type))
|
||||
if (!warn_unused && isDerivedFromSomethingInteresting(type))
|
||||
warn_unused = true;
|
||||
}
|
||||
if( warn_unused )
|
||||
|
@ -598,10 +598,10 @@ void EditHTMLParser::ImpSetStyleSheet( sal_uInt16 nHLevel )
|
||||
aItems.Put( aWeightItem );
|
||||
|
||||
SvxWeightItem aWeightItemCJK( WEIGHT_BOLD, EE_CHAR_WEIGHT_CJK );
|
||||
aItems.Put( aWeightItem );
|
||||
aItems.Put( aWeightItemCJK );
|
||||
|
||||
SvxWeightItem aWeightItemCTL( WEIGHT_BOLD, EE_CHAR_WEIGHT_CTL );
|
||||
aItems.Put( aWeightItem );
|
||||
aItems.Put( aWeightItemCTL );
|
||||
}
|
||||
|
||||
// Font hight and margins, when LogicToLogic is possible:
|
||||
|
@ -254,7 +254,6 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo
|
||||
Point aPos = cellRect.TopLeft();
|
||||
sal_uInt16 nRightX = 0;
|
||||
bool bJustify = pCurData->GetIncludeJustify();
|
||||
SvxHorJustifyItem aHorJustifyItem( SVX_HOR_JUSTIFY_STANDARD, ATTR_HOR_JUSTIFY );
|
||||
SvxCellHorJustify eJustification;
|
||||
|
||||
SvtScriptedTextHelper aScriptedText(rRenderContext);
|
||||
|
@ -1260,7 +1260,6 @@ ScVbaApplication::setDisplayFormulaBar( sal_Bool _displayformulabar )
|
||||
ScTabViewShell* pViewShell = excel::getCurrentBestViewShell( mxContext );
|
||||
if ( pViewShell && ( _displayformulabar != getDisplayFormulaBar() ) )
|
||||
{
|
||||
SfxBoolItem sfxFormBar( FID_TOGGLEINPUTLINE, _displayformulabar);
|
||||
SfxAllItemSet reqList( SfxGetpApp()->GetPool() );
|
||||
SfxRequest aReq( FID_TOGGLEINPUTLINE, SfxCallMode::SLOT, reqList );
|
||||
pViewShell->Execute( aReq );
|
||||
|
@ -158,9 +158,6 @@ bool SdTpOptionsContents::FillItemSet( SfxItemSet* rAttrs )
|
||||
|
||||
void SdTpOptionsContents::Reset( const SfxItemSet* rAttrs )
|
||||
{
|
||||
SdOptionsContentsItem aOptsItem( static_cast<const SdOptionsContentsItem&>( rAttrs->
|
||||
Get( ATTR_OPTIONS_CONTENTS ) ) );
|
||||
|
||||
SdOptionsLayoutItem aLayoutItem( static_cast<const SdOptionsLayoutItem&>( rAttrs->
|
||||
Get( ATTR_OPTIONS_LAYOUT ) ) );
|
||||
|
||||
|
@ -381,7 +381,6 @@ bool SfxManageStyleSheetPage::Execute_Impl(
|
||||
SfxStringItem aItem(nId, rStr);
|
||||
SfxUInt16Item aFamily(SID_STYLE_FAMILY, nFamily);
|
||||
SfxUInt16Item aMask( SID_STYLE_MASK, nMask );
|
||||
SfxStringItem aUpdName(SID_STYLE_UPD_BY_EX_NAME, rStr);
|
||||
SfxStringItem aRefName( SID_STYLE_REFERENCE, rRefStr );
|
||||
const SfxPoolItem* pItems[ 6 ];
|
||||
sal_uInt16 nCount = 0;
|
||||
|
@ -369,16 +369,12 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosXHdl, Edit&, void )
|
||||
if ( mpMtrPosX->IsValueModified())
|
||||
{
|
||||
long lX = GetCoreValue( *mpMtrPosX, mePoolUnit );
|
||||
long lY = GetCoreValue( *mpMtrPosY, mePoolUnit );
|
||||
|
||||
Fraction aUIScale = mpView->GetModel()->GetUIScale();
|
||||
lX += maAnchorPos.X();
|
||||
lX = Fraction( lX ) * aUIScale;
|
||||
lY += maAnchorPos.Y();
|
||||
lY = Fraction( lY ) * aUIScale;
|
||||
|
||||
SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,(sal_uInt32) lX);
|
||||
SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,(sal_uInt32) lY);
|
||||
|
||||
GetBindings()->GetDispatcher()->ExecuteList(
|
||||
SID_ATTR_TRANSFORM, SfxCallMode::RECORD, { &aPosXItem });
|
||||
@ -390,16 +386,12 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosYHdl, Edit&, void )
|
||||
{
|
||||
if ( mpMtrPosY->IsValueModified() )
|
||||
{
|
||||
long lX = GetCoreValue( *mpMtrPosX, mePoolUnit );
|
||||
long lY = GetCoreValue( *mpMtrPosY, mePoolUnit );
|
||||
|
||||
Fraction aUIScale = mpView->GetModel()->GetUIScale();
|
||||
lX += maAnchorPos.X();
|
||||
lX = Fraction( lX ) * aUIScale;
|
||||
lY += maAnchorPos.Y();
|
||||
lY = Fraction( lY ) * aUIScale;
|
||||
|
||||
SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,(sal_uInt32) lX);
|
||||
SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,(sal_uInt32) lY);
|
||||
|
||||
GetBindings()->GetDispatcher()->ExecuteList(
|
||||
|
@ -629,8 +629,6 @@ bool SwDoc::SetFrameFormatToFly( SwFrameFormat& rFormat, SwFrameFormat& rNewForm
|
||||
bool bChgAnchor = false, bFrameSz = false;
|
||||
|
||||
const SwFormatFrameSize aFrameSz( rFormat.GetFrameSize() );
|
||||
const SwFormatVertOrient aVert( rFormat.GetVertOrient() );
|
||||
const SwFormatHoriOrient aHori( rFormat.GetHoriOrient() );
|
||||
|
||||
SwUndoSetFlyFormat* pUndo = nullptr;
|
||||
bool const bUndo = GetIDocumentUndoRedo().DoesUndo();
|
||||
|
@ -148,17 +148,20 @@ SwUndoPageDesc::SwUndoPageDesc(const SwPageDesc & _aOld,
|
||||
SwFrameFormat* pFormat = new SwFrameFormat( *rNewHead.GetHeaderFormat() );
|
||||
// The Ctor of this object will remove the duplicate!
|
||||
SwFormatHeader aFormatHeader(pFormat);
|
||||
(void)aFormatHeader;
|
||||
if (!rNewDesc.IsHeaderShared())
|
||||
{
|
||||
pFormat = new SwFrameFormat( *rNewDesc.GetLeft().GetHeader().GetHeaderFormat() );
|
||||
// The Ctor of this object will remove the duplicate!
|
||||
SwFormatHeader aLeftHeader(pFormat);
|
||||
(void)aLeftHeader;
|
||||
}
|
||||
if (!rNewDesc.IsFirstShared())
|
||||
{
|
||||
pFormat = new SwFrameFormat( *rNewDesc.GetFirstMaster().GetHeader().GetHeaderFormat() );
|
||||
// The Ctor of this object will remove the duplicate!
|
||||
SwFormatHeader aFirstHeader(pFormat);
|
||||
(void)aFirstHeader;
|
||||
}
|
||||
}
|
||||
// Same procedure for footers...
|
||||
@ -167,17 +170,20 @@ SwUndoPageDesc::SwUndoPageDesc(const SwPageDesc & _aOld,
|
||||
SwFrameFormat* pFormat = new SwFrameFormat( *rNewFoot.GetFooterFormat() );
|
||||
// The Ctor of this object will remove the duplicate!
|
||||
SwFormatFooter aFormatFooter(pFormat);
|
||||
(void)aFormatFooter;
|
||||
if (!rNewDesc.IsFooterShared())
|
||||
{
|
||||
pFormat = new SwFrameFormat( *rNewDesc.GetLeft().GetFooter().GetFooterFormat() );
|
||||
// The Ctor of this object will remove the duplicate!
|
||||
SwFormatFooter aLeftFooter(pFormat);
|
||||
(void)aLeftFooter;
|
||||
}
|
||||
if (!rNewDesc.IsFirstShared())
|
||||
{
|
||||
pFormat = new SwFrameFormat( *rNewDesc.GetFirstMaster().GetFooter().GetFooterFormat() );
|
||||
// The Ctor of this object will remove the duplicate!
|
||||
SwFormatFooter aFirstFooter(pFormat);
|
||||
(void)aFirstFooter;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -937,7 +937,6 @@ void SvxCSS1Parser::MergeStyles( const SfxItemSet& rSrcSet,
|
||||
{
|
||||
SvxLRSpaceItem aLRSpace( static_cast<const SvxLRSpaceItem&>(rTargetSet.Get(aItemIds.nLRSpace)) );
|
||||
SvxULSpaceItem aULSpace( static_cast<const SvxULSpaceItem&>(rTargetSet.Get(aItemIds.nULSpace)) );
|
||||
SvxBoxItem aBox( static_cast<const SvxBoxItem&>(rTargetSet.Get(aItemIds.nBox)) );
|
||||
|
||||
rTargetSet.Put( rSrcSet );
|
||||
|
||||
|
@ -352,7 +352,6 @@ bool SwParagraphNumTabPage::ExecuteEditNumStyle_Impl(
|
||||
SfxStringItem aItem(nId, rStr);
|
||||
SfxUInt16Item aFamily(SID_STYLE_FAMILY, (sal_uInt16)nFamily);
|
||||
SfxUInt16Item aMask( SID_STYLE_MASK, nMask );
|
||||
SfxStringItem aUpdName(SID_STYLE_UPD_BY_EX_NAME, rStr);
|
||||
SfxStringItem aRefName( SID_STYLE_REFERENCE, rRefStr );
|
||||
const SfxPoolItem* pItems[ 6 ];
|
||||
sal_uInt16 nCount = 0;
|
||||
|
@ -841,7 +841,6 @@ IMPL_LINK(SwMMResultPrintDialog, PrintHdl_Impl, Button*, pButton, void)
|
||||
|
||||
SfxObjectShell* pObjSh = pTargetView->GetViewFrame()->GetObjectShell();
|
||||
SfxGetpApp()->NotifyEvent(SfxEventHint(SfxEventHintId::SwMailMerge, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), pObjSh));
|
||||
SfxBoolItem aMergeSilent(SID_SILENT, false);
|
||||
|
||||
uno::Sequence < beans::PropertyValue > aProps( 2 );
|
||||
aProps[0]. Name = "MonitorVisible";
|
||||
@ -1045,7 +1044,6 @@ IMPL_LINK(SwMMResultEmailDialog, SendDocumentsHdl_Impl, Button*, pButton, void)
|
||||
else
|
||||
return; // back to the dialog
|
||||
}
|
||||
SfxStringItem aFilterName( SID_FILTER_NAME, pSfxFlt->GetFilterName() );
|
||||
OUString sEMailColumn = m_pMailToLB->GetSelectEntry();
|
||||
OSL_ENSURE( !sEMailColumn.isEmpty(), "No email column selected");
|
||||
Reference< sdbcx::XColumnsSupplier > xColsSupp( xConfigItem->GetResultSet(), UNO_QUERY);
|
||||
|
@ -224,7 +224,6 @@ static SwTableRep* lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh )
|
||||
|
||||
SwTabCols aTabCols;
|
||||
rSh.GetTabCols( aTabCols );
|
||||
SvxColumnItem aColItem;
|
||||
|
||||
// Pointer will be deleted after the dialogue execution.
|
||||
SwTableRep* pRep = new SwTableRep( aTabCols );
|
||||
|
@ -466,9 +466,6 @@ void SwTextShell::Execute(SfxRequest &rReq)
|
||||
rWrtSh.Left( CRSR_SKIP_CHARS, true, 1, false );
|
||||
SfxItemSet aSet( rWrtSh.GetAttrPool(), RES_CHRATR_FONT, RES_CHRATR_FONT );
|
||||
rWrtSh.GetCurAttr( aSet );
|
||||
const SvxFontItem &rFont = static_cast<const SvxFontItem &>( aSet.Get( RES_CHRATR_FONT ));
|
||||
SvxFontItem aFont( rFont.GetFamily(), pFont->GetValue(),
|
||||
rFont.GetStyleName(), rFont.GetPitch(), RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT );
|
||||
rWrtSh.SetAttrSet( aSet, SetAttrMode::DONTEXPAND );
|
||||
rWrtSh.ResetSelect(nullptr, false);
|
||||
rWrtSh.EndSelect();
|
||||
|
Loading…
x
Reference in New Issue
Block a user