diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-24 13:19:04 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-24 13:19:39 +0200 |
commit | fe2164949b38a7f73883dbdcb3271b94e5c81744 (patch) | |
tree | d3b8d4ccfd21debfd4c554149eca01fc0f1a7d72 | |
parent | 1d7c589d502fb7f0d874c13e30011ca33a3fb6e4 (diff) |
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
-rw-r--r-- | compilerplugins/clang/unusedvariablecheck.cxx | 14 | ||||
-rw-r--r-- | editeng/source/editeng/eehtml.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/autofmt.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/vba/vbaapplication.cxx | 1 | ||||
-rw-r--r-- | sd/source/ui/dlg/tpoption.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/dialog/mgetempl.cxx | 1 | ||||
-rw-r--r-- | svx/source/sidebar/possize/PosSizePropertyPanel.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/doc/docfly.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/undo/SwUndoPageDesc.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/html/svxcss1.cxx | 1 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/numpara.cxx | 1 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmresultdialogs.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/shells/tabsh.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh1.cxx | 3 |
14 files changed, 17 insertions, 31 deletions
diff --git a/compilerplugins/clang/unusedvariablecheck.cxx b/compilerplugins/clang/unusedvariablecheck.cxx index 8642032df12a..db6a45e1ae3f 100644 --- a/compilerplugins/clang/unusedvariablecheck.cxx +++ b/compilerplugins/clang/unusedvariablecheck.cxx @@ -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 ) diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx index be16f0366480..f0f6cd3ffec7 100644 --- a/editeng/source/editeng/eehtml.cxx +++ b/editeng/source/editeng/eehtml.cxx @@ -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: diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx index 4e7b9e44ec68..d9f7219b3c3a 100644 --- a/sc/source/ui/miscdlgs/autofmt.cxx +++ b/sc/source/ui/miscdlgs/autofmt.cxx @@ -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); diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index 49920849daa9..a55a99c80987 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -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 ); diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx index 8ba8d68cf107..a2cff387542e 100644 --- a/sd/source/ui/dlg/tpoption.cxx +++ b/sd/source/ui/dlg/tpoption.cxx @@ -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 ) ) ); diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index 523a47648aa1..0989f25ac140 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -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; diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx index 5861e13e6487..a9346e88b0a0 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -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( diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index 98ffdae260f3..c89c6360a6d0 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -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(); diff --git a/sw/source/core/undo/SwUndoPageDesc.cxx b/sw/source/core/undo/SwUndoPageDesc.cxx index e8bdf8bcacbc..d1bb5bb1f8b3 100644 --- a/sw/source/core/undo/SwUndoPageDesc.cxx +++ b/sw/source/core/undo/SwUndoPageDesc.cxx @@ -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; } } diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx index f94dabf360ac..5373a5f3a81e 100644 --- a/sw/source/filter/html/svxcss1.cxx +++ b/sw/source/filter/html/svxcss1.cxx @@ -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 ); diff --git a/sw/source/ui/chrdlg/numpara.cxx b/sw/source/ui/chrdlg/numpara.cxx index 487441cf9fb4..8ccffebdccff 100644 --- a/sw/source/ui/chrdlg/numpara.cxx +++ b/sw/source/ui/chrdlg/numpara.cxx @@ -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; diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx index 2fa7ba337612..53fb96fc7339 100644 --- a/sw/source/ui/dbui/mmresultdialogs.cxx +++ b/sw/source/ui/dbui/mmresultdialogs.cxx @@ -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); diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 8c63736cf151..ce4ae644291e 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -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 ); diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 350a7f14cbb0..43383e1c55c0 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -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(); |