From f6b437c57d4b0b032cb7e0838e16572bdf9a05cc Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 1 Dec 2017 15:27:21 +0200 Subject: [PATCH] loplugin:singlevalfields Change-Id: I521d2efa641f3a14c48561e2e0f6d687e5807d93 Reviewed-on: https://gerrit.libreoffice.org/45662 Tested-by: Jenkins Reviewed-by: Noel Grandin --- avmedia/source/viewer/mediawindow_impl.cxx | 19 ++- avmedia/source/viewer/mediawindow_impl.hxx | 1 - compilerplugins/clang/singlevalfields.py | 5 +- compilerplugins/clang/singlevalfields.results | 140 +++++++++--------- cui/source/customize/cfgutil.cxx | 12 +- cui/source/inc/cfgutil.hxx | 1 - sc/source/ui/inc/undodat.hxx | 1 - sc/source/ui/undo/undodat.cxx | 4 +- sw/source/filter/ww8/ww8graf2.cxx | 4 +- sw/source/filter/ww8/ww8par2.hxx | 2 +- sw/source/filter/ww8/ww8par6.cxx | 9 +- 11 files changed, 90 insertions(+), 108 deletions(-) diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx index f5d77615fb1e..e3045a63ece8 100644 --- a/avmedia/source/viewer/mediawindow_impl.cxx +++ b/avmedia/source/viewer/mediawindow_impl.cxx @@ -122,7 +122,6 @@ MediaWindowImpl::MediaWindowImpl(vcl::Window* pParent, MediaWindow* pMediaWindow , DropTargetHelper(this) , DragSourceHelper(this) , mpMediaWindow(pMediaWindow) - , mbEventTransparent(true) , mpMediaWindowControl(bInternalMediaControl ? VclPtr::Create(this) : nullptr) , mpEmptyBmpEx(nullptr) , mpAudioBmpEx(nullptr) @@ -637,53 +636,53 @@ void MediaWindowImpl::GetFocus() void MediaWindowImpl::MouseMove(const MouseEvent& rMEvt) { - if (mpMediaWindow && mbEventTransparent) + if (mpMediaWindow) mpMediaWindow->MouseMove(rMEvt); } void MediaWindowImpl::MouseButtonDown(const MouseEvent& rMEvt) { - if (mpMediaWindow && mbEventTransparent) + if (mpMediaWindow) mpMediaWindow->MouseButtonDown(rMEvt); } void MediaWindowImpl::MouseButtonUp(const MouseEvent& rMEvt) { - if (mpMediaWindow && mbEventTransparent) + if (mpMediaWindow) mpMediaWindow->MouseButtonUp(rMEvt); } void MediaWindowImpl::KeyInput(const KeyEvent& rKEvt) { - if (mpMediaWindow && mbEventTransparent) + if (mpMediaWindow) mpMediaWindow->KeyInput(rKEvt); } void MediaWindowImpl::KeyUp(const KeyEvent& rKEvt) { - if (mpMediaWindow && mbEventTransparent) + if (mpMediaWindow) mpMediaWindow->KeyUp(rKEvt); } void MediaWindowImpl::Command(const CommandEvent& rCEvt) { - if (mpMediaWindow && mbEventTransparent) + if (mpMediaWindow) mpMediaWindow->Command(rCEvt); } sal_Int8 MediaWindowImpl::AcceptDrop(const AcceptDropEvent& rEvt) { - return (mpMediaWindow && mbEventTransparent ? mpMediaWindow->AcceptDrop(rEvt) : 0); + return (mpMediaWindow ? mpMediaWindow->AcceptDrop(rEvt) : 0); } sal_Int8 MediaWindowImpl::ExecuteDrop(const ExecuteDropEvent& rEvt) { - return (mpMediaWindow && mbEventTransparent ? mpMediaWindow->ExecuteDrop(rEvt) : 0); + return (mpMediaWindow ? mpMediaWindow->ExecuteDrop(rEvt) : 0); } void MediaWindowImpl::StartDrag(sal_Int8 nAction, const Point& rPosPixel) { - if (mpMediaWindow && mbEventTransparent) + if (mpMediaWindow) mpMediaWindow->StartDrag(nAction, rPosPixel); } diff --git a/avmedia/source/viewer/mediawindow_impl.hxx b/avmedia/source/viewer/mediawindow_impl.hxx index 3b100c36e324..bed32852e5ce 100644 --- a/avmedia/source/viewer/mediawindow_impl.hxx +++ b/avmedia/source/viewer/mediawindow_impl.hxx @@ -147,7 +147,6 @@ private: MediaWindow* mpMediaWindow; rtl::Reference mxEvents; - bool mbEventTransparent; VclPtr mpChildWindow; VclPtr mpMediaWindowControl; BitmapEx* mpEmptyBmpEx; diff --git a/compilerplugins/clang/singlevalfields.py b/compilerplugins/clang/singlevalfields.py index 5ed8c939bcea..855f3d5ae58f 100755 --- a/compilerplugins/clang/singlevalfields.py +++ b/compilerplugins/clang/singlevalfields.py @@ -26,7 +26,10 @@ with io.open("loplugin.singlevalfields.log", "rb", buffering=1024*1024) as txt: elif tokens[0] == "asgn:": parentClass = normalizeTypeParams(tokens[1]) fieldName = normalizeTypeParams(tokens[2]) - assignValue = tokens[3] + if len(tokens) > 3: + assignValue = tokens[3] + else: + assignValue = "" fieldInfo = (parentClass, fieldName) if not fieldInfo in fieldAssignDict: fieldAssignDict[fieldInfo] = set() diff --git a/compilerplugins/clang/singlevalfields.results b/compilerplugins/clang/singlevalfields.results index 715700b6f0f3..b99868b50374 100644 --- a/compilerplugins/clang/singlevalfields.results +++ b/compilerplugins/clang/singlevalfields.results @@ -1,4 +1,7 @@ -chart2/source/model/main/DataPoint.hxx:109 +avmedia/source/viewer/mediawindow_impl.hxx:150 + avmedia::priv::MediaWindowImpl mbEventTransparent + 1 +chart2/source/model/main/DataPoint.hxx:107 chart::DataPoint m_bNoParentPropAllowed 0 chart2/source/view/inc/GL3DRenderer.hxx:161 @@ -7,74 +10,62 @@ chart2/source/view/inc/GL3DRenderer.hxx:161 connectivity/source/inc/odbc/OBoundParam.hxx:113 connectivity::odbc::OBoundParam paramLength 0 -connectivity/source/inc/OTypeInfo.hxx:37 - connectivity::OTypeInfo nPrecision - 0 -connectivity/source/inc/OTypeInfo.hxx:39 - connectivity::OTypeInfo nMaximumScale - 0 -connectivity/source/inc/OTypeInfo.hxx:40 - connectivity::OTypeInfo nMinimumScale - 0 -connectivity/source/inc/OTypeInfo.hxx:43 - connectivity::OTypeInfo nSearchType - 3 -connectivity/source/inc/OTypeInfo.hxx:44 - connectivity::OTypeInfo nNumPrecRadix - 0 -connectivity/source/inc/OTypeInfo.hxx:46 - connectivity::OTypeInfo bCurrency - 0 -connectivity/source/inc/OTypeInfo.hxx:47 - connectivity::OTypeInfo bAutoIncrement - 0 -connectivity/source/inc/OTypeInfo.hxx:48 - connectivity::OTypeInfo bNullable - 1 -connectivity/source/inc/OTypeInfo.hxx:49 - connectivity::OTypeInfo bCaseSensitive - 0 -connectivity/source/inc/OTypeInfo.hxx:50 - connectivity::OTypeInfo bUnsigned +cui/source/inc/cfgutil.hxx:132 + SfxConfigGroupListBox m_pImageProvider 0 include/basic/sbxvar.hxx:67 SbxValues::(anonymous) pData 0 -include/filter/msfilter/dffpropset.hxx:33 - DffPropFlags bSet - 0 -include/filter/msfilter/dffpropset.hxx:35 - DffPropFlags bBlip - 1 include/o3tl/vector_pool.hxx:93 o3tl::detail::struct_from_value::type nextFree -1 -include/vcl/field.hxx:100 +include/svtools/svparser.hxx:74 + SvParser::TokenStackType nTokenValue + 0 +include/svtools/svparser.hxx:75 + SvParser::TokenStackType bTokenHasValue + 0 +include/vcl/field.hxx:99 PatternFormatter mbInPattKeyInput 0 -include/vcl/filter/pdfdocument.hxx:174 +include/vcl/filter/pdfdocument.hxx:173 vcl::filter::PDFNameElement m_nLength 0 -libreofficekit/source/gtk/lokdocview.cxx:85 +include/vcl/pdfwriter.hxx:549 + vcl::PDFWriter::PDFSignContext m_pDerEncoded + 0 +include/vcl/pdfwriter.hxx:551 + vcl::PDFWriter::PDFSignContext m_nDerEncoded + 0 +include/vcl/pdfwriter.hxx:553 + vcl::PDFWriter::PDFSignContext m_pByteRange1 + 0 +include/vcl/pdfwriter.hxx:555 + vcl::PDFWriter::PDFSignContext m_nByteRange1 + 0 +include/vcl/pdfwriter.hxx:557 + vcl::PDFWriter::PDFSignContext m_pByteRange2 + 0 +include/vcl/pdfwriter.hxx:559 + vcl::PDFWriter::PDFSignContext m_nByteRange2 + 0 +libreofficekit/source/gtk/lokdocview.cxx:84 LOKDocViewPrivateImpl m_bIsLoading 0 -opencl/source/opencl_device.cxx:63 - opencl::(anonymous namespace)::LibreOfficeDeviceEvaluationIO inputSize +opencl/source/opencl_device.cxx:53 + (anonymous namespace)::LibreOfficeDeviceEvaluationIO inputSize 15360 -opencl/source/opencl_device.cxx:64 - opencl::(anonymous namespace)::LibreOfficeDeviceEvaluationIO outputSize +opencl/source/opencl_device.cxx:54 + (anonymous namespace)::LibreOfficeDeviceEvaluationIO outputSize 15360 -pyuno/source/module/pyuno_impl.hxx:314 +pyuno/source/module/pyuno_impl.hxx:312 pyuno::RuntimeCargo valid 1 -rsc/inc/rscdef.hxx:55 - RscExpType cUnused - 0 sax/source/tools/fastserializer.hxx:231 sax_fastparser::FastSaxSerializer mbXescape 1 sc/inc/compiler.hxx:108 - ScRawToken::(anonymous union)::(anonymous) bIsInForceArray + ScRawToken::(anonymous union)::(anonymous) eInForceArray 0 sc/inc/recursionhelper.hxx:56 ScRecursionHelper bConverging @@ -82,6 +73,9 @@ sc/inc/recursionhelper.hxx:56 sc/qa/unit/ucalc.hxx:41 Test::RangeNameDef mnIndex 1 +sc/source/ui/inc/undodat.hxx:448 + ScUndoDataForm nEndChangeAction + 0 sd/inc/sdpptwrp.hxx:42 SdPPTFilter pBas 0 @@ -91,22 +85,22 @@ sd/source/filter/html/htmlex.hxx:114 sd/source/ui/remotecontrol/DiscoveryService.hxx:43 sd::DiscoveryService zService 0 -sfx2/source/appl/lnkbase2.cxx:75 +sfx2/source/appl/lnkbase2.cxx:76 sfx2::ImplBaseLinkData::tDDEType pItem 0 -sfx2/source/appl/lnkbase2.cxx:80 +sfx2/source/appl/lnkbase2.cxx:81 sfx2::ImplBaseLinkData::(anonymous) DDEType 0 -sfx2/source/doc/doctemplates.cxx:134 +sfx2/source/doc/doctemplates.cxx:136 (anonymous namespace)::WaitWindow_Impl mnTextStyle 12576 -sfx2/source/view/ipclient.cxx:76 +sfx2/source/view/ipclient.cxx:78 SfxBooleanFlagGuard m_bLifeValue 1 shell/source/sessioninstall/SyncDbusSessionHelper.cxx:26 (anonymous namespace)::GErrorWrapper m_pError 0 -soltools/cpp/cpp.h:121 +soltools/cpp/cpp.h:120 includelist deleted 1 soltools/mkdepend/def.h:130 @@ -115,31 +109,31 @@ soltools/mkdepend/def.h:130 soltools/mkdepend/def.h:132 inclist i_searched 1 -starmath/inc/node.hxx:101 +starmath/inc/node.hxx:104 SmNode mnFlags 0 -stoc/source/inspect/introspection.cxx:1537 +stoc/source/inspect/introspection.cxx:1533 (anonymous namespace)::Cache::Data hits 1 -sw/inc/hints.hxx:196 +sw/inc/hints.hxx:195 SwAttrSetChg m_bDelSet 0 sw/inc/pagepreviewlayout.hxx:49 SwPagePreviewLayout mnYFree 568 -sw/source/core/inc/frmtool.hxx:256 +sw/source/core/inc/frmtool.hxx:260 SwBorderAttrs m_bBorderDist 1 -sw/source/core/inc/swfont.hxx:157 +sw/source/core/inc/swfont.hxx:158 SwFont m_nToxCount 0 -sw/source/core/inc/swfont.hxx:158 +sw/source/core/inc/swfont.hxx:159 SwFont m_nRefCount 0 -sw/source/core/inc/swfont.hxx:159 +sw/source/core/inc/swfont.hxx:160 SwFont m_nMetaCount 0 -sw/source/core/inc/swfont.hxx:160 +sw/source/core/inc/swfont.hxx:161 SwFont m_nInputFieldCount 0 sw/source/core/inc/UndoSort.hxx:38 @@ -157,12 +151,15 @@ sw/source/filter/html/htmlcss1.cxx:78 sw/source/filter/html/htmlcss1.cxx:79 SwCSS1ItemIds nFormatKeep 109 -sw/source/filter/html/svxcss1.hxx:205 +sw/source/filter/html/svxcss1.hxx:199 SvxCSS1Parser nMinFixLineSpace 141 sw/source/filter/inc/rtf.hxx:30 RTFSurround::(anonymous union)::(anonymous) nJunk 0 +sw/source/filter/ww8/ww8par2.hxx:58 + WW8SwFlyPara eAnchor + 0 sw/source/filter/ww8/ww8par.hxx:650 WW8FormulaControl mfUnknown 0 @@ -178,21 +175,18 @@ vcl/inc/salprn.hxx:42 vcl/inc/salprn.hxx:43 SalPrinterQueueInfo mpSysData 0 -vcl/inc/svdata.hxx:253 +vcl/inc/svdata.hxx:267 ImplSVNWFData mnStatusBarLowerRightOffset 0 -vcl/inc/svdata.hxx:269 +vcl/inc/svdata.hxx:283 ImplSVNWFData mbCenteredTabs 0 -vcl/inc/svdata.hxx:270 +vcl/inc/svdata.hxx:284 ImplSVNWFData mbNoActiveTabTextRaise 0 -vcl/inc/svdata.hxx:272 +vcl/inc/svdata.hxx:286 ImplSVNWFData mbProgressNeedsErase 0 -vcl/inc/unx/i18n_cb.hxx:53 - preedit_text_t nCursorPos - 0 vcl/source/edit/textdat2.hxx:53 TETextPortion nWidth -1 @@ -208,15 +202,15 @@ vcl/source/filter/jpeg/transupp.h:129 vcl/source/filter/jpeg/transupp.h:131 (anonymous) crop 0 -vcl/source/font/font.cxx:540 +vcl/source/font/font.cxx:539 (anonymous namespace)::WeightSearchEntry weight 5 -vcl/source/gdi/pdfwriter_impl.hxx:709 +vcl/source/gdi/pdfwriter_impl.hxx:706 vcl::PDFWriterImpl m_nInheritedPageWidth 595 -vcl/source/gdi/pdfwriter_impl.hxx:710 +vcl/source/gdi/pdfwriter_impl.hxx:707 vcl::PDFWriterImpl m_nInheritedPageHeight 842 -writerfilter/source/dmapper/GraphicImport.cxx:229 +writerfilter/source/dmapper/GraphicImport.cxx:223 writerfilter::dmapper::GraphicImport_Impl nCurrentBorderLine 2 diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx index 131930aa6688..e033e155b099 100644 --- a/cui/source/customize/cfgutil.cxx +++ b/cui/source/customize/cfgutil.cxx @@ -396,7 +396,6 @@ SfxConfigGroupListBox::SfxConfigGroupListBox(vcl::Window* pParent, WinBits nStyl : SvTreeListBox(pParent, nStyle) , xImp(new SvxConfigGroupBoxResource_Impl()) , pFunctionListBox(nullptr) - , m_pImageProvider(nullptr) , pStylesInfo(nullptr) { SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT ); @@ -647,16 +646,7 @@ void SfxConfigGroupListBox::FillFunctionsList(const css::uno::SequenceGetImage( rInfo.Command ); - - SvTreeListEntry* pFuncEntry = nullptr; - if ( !!aImage ) - pFuncEntry = pFunctionListBox->InsertEntry( sUIName, aImage, aImage ); - else - pFuncEntry = pFunctionListBox->InsertEntry(sUIName ); - + SvTreeListEntry* pFuncEntry = pFunctionListBox->InsertEntry(sUIName ); aArr.push_back( o3tl::make_unique( SfxCfgKind::FUNCTION_SLOT, 0 ) ); SfxGroupInfo_Impl* pGrpInfo = aArr.back().get(); pGrpInfo->sCommand = rInfo.Command; diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx index 4e7dd97cdcb7..413de4e25c83 100644 --- a/cui/source/inc/cfgutil.hxx +++ b/cui/source/inc/cfgutil.hxx @@ -129,7 +129,6 @@ class SfxConfigGroupListBox : public SvTreeListBox std::unique_ptr xImp; VclPtr pFunctionListBox; SfxGroupInfoArr_Impl aArr; - SaveInData* m_pImageProvider; OUString m_sModuleLongName; css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::frame::XFrame > m_xFrame; diff --git a/sc/source/ui/inc/undodat.hxx b/sc/source/ui/inc/undodat.hxx index 3b19598eb701..cb9d88135319 100644 --- a/sc/source/ui/inc/undodat.hxx +++ b/sc/source/ui/inc/undodat.hxx @@ -445,7 +445,6 @@ private: std::unique_ptr xRefUndoData; std::unique_ptr xRefRedoData; sal_uLong nStartChangeAction; - sal_uLong nEndChangeAction; bool bRedoFilled; void DoChange( const bool bUndo ); diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx index b1bb0bbc88f3..0fd7ee5f3b68 100644 --- a/sc/source/ui/undo/undodat.cxx +++ b/sc/source/ui/undo/undodat.cxx @@ -1757,7 +1757,7 @@ OUString ScUndoDataForm::GetComment() const void ScUndoDataForm::SetChangeTrack() { - nStartChangeAction = nEndChangeAction = 0; + nStartChangeAction = 0; } void ScUndoDataForm::Undo() @@ -1849,7 +1849,7 @@ void ScUndoDataForm::DoChange( const bool bUndo ) { ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack(); if ( pChangeTrack ) - pChangeTrack->Undo( nStartChangeAction, nEndChangeAction ); + pChangeTrack->Undo( nStartChangeAction, 0 ); } else SetChangeTrack(); diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx index fde01e6ad296..a2eb61857d7f 100644 --- a/sw/source/filter/ww8/ww8graf2.cxx +++ b/sw/source/filter/ww8/ww8graf2.cxx @@ -362,7 +362,7 @@ SwFlyFrameFormat* SwWW8ImplReader::MakeGrafNotInContent(const WW8PicDesc& rPD, WW8FlySet aFlySet(*this, m_xWFlyPara.get(), m_xSFlyPara.get(), true); - SwFormatAnchor aAnchor(m_xSFlyPara->eAnchor); + SwFormatAnchor aAnchor(WW8SwFlyPara::eAnchor); aAnchor.SetAnchor(m_pPaM->GetPoint()); aFlySet.Put(aAnchor); @@ -598,7 +598,7 @@ SwFrameFormat* SwWW8ImplReader::ImportGraf(SdrTextObj const * pTextObj, { WW8FlySet aFlySet(*this, m_xWFlyPara.get(), m_xSFlyPara.get(), true); - SwFormatAnchor aAnchor(m_xSFlyPara->eAnchor); + SwFormatAnchor aAnchor(WW8SwFlyPara::eAnchor); aAnchor.SetAnchor(m_pPaM->GetPoint()); aFlySet.Put(aAnchor); diff --git a/sw/source/filter/ww8/ww8par2.hxx b/sw/source/filter/ww8/ww8par2.hxx index 11d5a37e9982..b66fc73a9aa0 100644 --- a/sw/source/filter/ww8/ww8par2.hxx +++ b/sw/source/filter/ww8/ww8par2.hxx @@ -55,7 +55,7 @@ struct WW8SwFlyPara sal_Int16 nNetWidth; SwFrameSize eHeightFix; // height fixed or min - RndStdIds eAnchor; // binding + static constexpr RndStdIds eAnchor = RndStdIds::FLY_AT_PARA; // binding short eHRel; // page or page border short eVRel; // page or page border sal_Int16 eVAlign; // up, down, centered diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 4eff211a0ada..d4b17f9b6f81 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -1809,7 +1809,6 @@ nWidth(rWW.nSp28), nHeight(rWW.nSp45), nNetWidth(rWW.nSp28), eHeightFix(ATT_FIX_SIZE), -eAnchor(RndStdIds::FLY_AT_PARA), eHRel(text::RelOrientation::PAGE_FRAME), eVRel(text::RelOrientation::FRAME), eVAlign(text::VertOrientation::NONE), @@ -2097,7 +2096,7 @@ WW8FlySet::WW8FlySet(SwWW8ImplReader& rReader, const WW8FlyPara* pFW, if( !bGraf ) { - Put( SwFormatAnchor(pFS->eAnchor) ); + Put( SwFormatAnchor(WW8SwFlyPara::eAnchor) ); // adjust size //Ordinarily with frames, the border width and spacing is @@ -2390,10 +2389,10 @@ bool SwWW8ImplReader::StartApo(const ApoTestResults &rApo, const WW8_TablePos *p } else { - m_xSFlyPara->pFlyFormat = m_rDoc.MakeFlySection(m_xSFlyPara->eAnchor, + m_xSFlyPara->pFlyFormat = m_rDoc.MakeFlySection(WW8SwFlyPara::eAnchor, m_pPaM->GetPoint(), &aFlySet); OSL_ENSURE(m_xSFlyPara->pFlyFormat->GetAnchor().GetAnchorId() == - m_xSFlyPara->eAnchor, "Not the anchor type requested!"); + WW8SwFlyPara::eAnchor, "Not the anchor type requested!"); } if (m_xSFlyPara->pFlyFormat) @@ -2405,7 +2404,7 @@ bool SwWW8ImplReader::StartApo(const ApoTestResults &rApo, const WW8_TablePos *p m_xWWZOrder->InsertTextLayerObject(pOurNewObject); } - if (RndStdIds::FLY_AS_CHAR != m_xSFlyPara->eAnchor && m_xSFlyPara->pFlyFormat) + if (RndStdIds::FLY_AS_CHAR != WW8SwFlyPara::eAnchor && m_xSFlyPara->pFlyFormat) { m_xAnchorStck->AddAnchor(*m_pPaM->GetPoint(), m_xSFlyPara->pFlyFormat); }