From f5e131b2bcd2c88a47e5988d5f319bffd767c4dc Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 3 Mar 2016 14:52:45 +0200 Subject: loplugin:unuseddefaultparams in vcl and xmloff and teach the plugin about code that takes the address of a function Change-Id: Ia9d5afef44520aca236659e8176f1e27135ef4fc Reviewed-on: https://gerrit.libreoffice.org/22861 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/inc/listbox.hxx | 2 +- vcl/inc/salgdi.hxx | 2 +- vcl/inc/unx/i18n_im.hxx | 2 +- vcl/source/control/button.cxx | 8 +++----- vcl/source/control/combobox.cxx | 8 ++++---- vcl/source/control/imp_listbox.cxx | 35 ++++++++++++++++------------------- vcl/source/edit/texteng.cxx | 8 +++----- vcl/source/gdi/pdfwriter_impl.cxx | 16 +++------------- vcl/source/gdi/pdfwriter_impl.hxx | 4 ++-- vcl/source/gdi/salgdilayout.cxx | 4 ++-- vcl/source/outdev/text.cxx | 17 ++++------------- vcl/source/window/menu.cxx | 4 ++-- vcl/source/window/toolbox.cxx | 4 +--- vcl/unx/generic/app/i18n_im.cxx | 4 ++-- 14 files changed, 45 insertions(+), 73 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/listbox.hxx b/vcl/inc/listbox.hxx index 66dac44e5949..262586263be5 100644 --- a/vcl/inc/listbox.hxx +++ b/vcl/inc/listbox.hxx @@ -247,7 +247,7 @@ protected: virtual void LoseFocus() override; bool SelectEntries( sal_Int32 nSelect, LB_EVENT_TYPE eLET, bool bShift = false, bool bCtrl = false, bool bSelectPosChange = false ); - void ImplPaint(vcl::RenderContext& rRenderContext, sal_Int32 nPos, bool bErase = false, bool bLayout = false); + void ImplPaint(vcl::RenderContext& rRenderContext, sal_Int32 nPos, bool bErase = false); void ImplDoPaint(vcl::RenderContext& rRenderContext, const Rectangle& rRect); void ImplCalcMetrics(); void ImplUpdateEntryMetrics( ImplEntryType& rEntry ); diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index 451be62e2924..00a09214b703 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -238,7 +238,7 @@ public: void mirror( ImplControlValue&, const OutputDevice* ) const; basegfx::B2DPoint mirror( const basegfx::B2DPoint& i_rPoint, const OutputDevice *pOutDev, bool bBack = false ) const; basegfx::B2DPolygon mirror( const basegfx::B2DPolygon& i_rPoly, const OutputDevice *pOutDev, bool bBack = false ) const; - basegfx::B2DPolyPolygon mirror( const basegfx::B2DPolyPolygon& i_rPoly, const OutputDevice *pOutDev, bool bBack = false ) const; + basegfx::B2DPolyPolygon mirror( const basegfx::B2DPolyPolygon& i_rPoly, const OutputDevice *pOutDev ) const; // non virtual methods; these do possible coordinate mirroring and // then delegate to protected virtual methods diff --git a/vcl/inc/unx/i18n_im.hxx b/vcl/inc/unx/i18n_im.hxx index b081a55622ce..fa5b3b4a5dcc 100644 --- a/vcl/inc/unx/i18n_im.hxx +++ b/vcl/inc/unx/i18n_im.hxx @@ -40,7 +40,7 @@ public: void HandleDestroyIM(); void CreateMethod( Display *pDisplay ); XIMStyles *GetSupportedStyles() { return mpStyles; } - void SetLocale( const char* pLocale = "" ); + void SetLocale(); bool FilterEvent( XEvent *pEvent, ::Window window ); SalI18N_InputMethod(); diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 97808a3da623..1671d6caf1f0 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -2017,12 +2017,10 @@ void RadioButton::ImplDrawRadioButtonState(vcl::RenderContext& rRenderContext) void RadioButton::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags, const Point& rPos, const Size& rSize, const Size& rImageSize, Rectangle& rStateRect, - Rectangle& rMouseRect, bool bLayout ) + Rectangle& rMouseRect ) { WinBits nWinStyle = GetStyle(); OUString aText( GetText() ); - MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : nullptr; - OUString* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : nullptr; pDev->Push( PushFlags::CLIPREGION ); pDev->IntersectClipRegion( Rectangle( rPos, rSize ) ); @@ -2051,7 +2049,7 @@ void RadioButton::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags, aSize.Height() = rImageSize.Height(); } - ImplDrawAlignedImage( pDev, aPos, aSize, bLayout, 1, + ImplDrawAlignedImage( pDev, aPos, aSize, false/*bLayout*/, 1, nDrawFlags, nTextStyle ); rMouseRect = Rectangle( aPos, aSize ); @@ -2140,7 +2138,7 @@ void RadioButton::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags, aTxtPos.X() += aImageRect.Right()+8; aTxtPos.Y() += (rSize.Height()-nTextHeight)/2; } - pDev->DrawCtrlText( aTxtPos, aText, 0, aText.getLength(), DrawTextFlags::Mnemonic, pVector, pDisplayText ); + pDev->DrawCtrlText( aTxtPos, aText, 0, aText.getLength() ); } rMouseRect = aImageRect; diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index c474cd350a9d..6b54142519bf 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -1335,14 +1335,14 @@ void ComboBox::SetSeparatorPos( sal_Int32 n ) m_pImpl->m_pImplLB->SetSeparatorPos( n ); } -void ComboBox::SetMRUEntries( const OUString& rEntries, sal_Unicode cSep ) +void ComboBox::SetMRUEntries( const OUString& rEntries ) { - m_pImpl->m_pImplLB->SetMRUEntries( rEntries, cSep ); + m_pImpl->m_pImplLB->SetMRUEntries( rEntries, ';' ); } -OUString ComboBox::GetMRUEntries( sal_Unicode cSep ) const +OUString ComboBox::GetMRUEntries() const { - return m_pImpl->m_pImplLB ? m_pImpl->m_pImplLB->GetMRUEntries( cSep ) : OUString(); + return m_pImpl->m_pImplLB ? m_pImpl->m_pImplLB->GetMRUEntries( ';' ) : OUString(); } void ComboBox::SetMaxMRUCount( sal_Int32 n ) diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index e17ba0d3dcea..b9ecd36cba21 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -1696,7 +1696,7 @@ void ImplListBoxWindow::SelectEntry( vcl::StringEntryIdentifier _entry ) } } -void ImplListBoxWindow::ImplPaint(vcl::RenderContext& rRenderContext, sal_Int32 nPos, bool bErase, bool bLayout) +void ImplListBoxWindow::ImplPaint(vcl::RenderContext& rRenderContext, sal_Int32 nPos, bool bErase) { const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); @@ -1708,24 +1708,21 @@ void ImplListBoxWindow::ImplPaint(vcl::RenderContext& rRenderContext, sal_Int32 long nY = mpEntryList->GetAddedHeight(nPos, mnTop); Rectangle aRect(Point(0, nY), Size(nWidth, pEntry->mnHeight)); - if (!bLayout) + if (mpEntryList->IsEntryPosSelected(nPos)) { - if (mpEntryList->IsEntryPosSelected(nPos)) - { - rRenderContext.SetTextColor(!IsEnabled() ? rStyleSettings.GetDisableColor() : rStyleSettings.GetHighlightTextColor()); - rRenderContext.SetFillColor(rStyleSettings.GetHighlightColor()); - rRenderContext.SetTextFillColor(rStyleSettings.GetHighlightColor()); - rRenderContext.DrawRect(aRect); - } - else - { - ApplySettings(rRenderContext); - if (!IsEnabled()) - rRenderContext.SetTextColor(rStyleSettings.GetDisableColor()); - rRenderContext.SetTextFillColor(); - if (bErase) - rRenderContext.Erase(aRect); - } + rRenderContext.SetTextColor(!IsEnabled() ? rStyleSettings.GetDisableColor() : rStyleSettings.GetHighlightTextColor()); + rRenderContext.SetFillColor(rStyleSettings.GetHighlightColor()); + rRenderContext.SetTextFillColor(rStyleSettings.GetHighlightColor()); + rRenderContext.DrawRect(aRect); + } + else + { + ApplySettings(rRenderContext); + if (!IsEnabled()) + rRenderContext.SetTextColor(rStyleSettings.GetDisableColor()); + rRenderContext.SetTextFillColor(); + if (bErase) + rRenderContext.Erase(aRect); } if (IsUserDrawEnabled()) @@ -1747,7 +1744,7 @@ void ImplListBoxWindow::ImplPaint(vcl::RenderContext& rRenderContext, sal_Int32 } else { - DrawEntry(rRenderContext, nPos, true, true, false, bLayout); + DrawEntry(rRenderContext, nPos, true, true); } } diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index a272be4025ab..592a0e51cd18 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -820,7 +820,7 @@ TextPaM TextEngine::ImpInsertParaBreak( const TextSelection& rCurSel ) return ImpInsertParaBreak( aPaM ); } -TextPaM TextEngine::ImpInsertParaBreak( const TextPaM& rPaM, bool bKeepEndingAttribs ) +TextPaM TextEngine::ImpInsertParaBreak( const TextPaM& rPaM ) { if ( IsUndoEnabled() && !IsInUndo() ) InsertUndo( new TextUndoSplitPara( this, rPaM.GetPara(), rPaM.GetIndex() ) ); @@ -828,7 +828,7 @@ TextPaM TextEngine::ImpInsertParaBreak( const TextPaM& rPaM, bool bKeepEndingAtt TextNode* pNode = mpDoc->GetNodes()[ rPaM.GetPara() ]; bool bFirstParaContentChanged = rPaM.GetIndex() < pNode->GetText().getLength(); - TextPaM aPaM( mpDoc->InsertParaBreak( rPaM, bKeepEndingAttribs ) ); + TextPaM aPaM( mpDoc->InsertParaBreak( rPaM, true/*bKeepEndingAttribs*/ ) ); TEParaPortion* pPortion = mpTEParaPortions->GetObject( rPaM.GetPara() ); DBG_ASSERT( pPortion, "ImpInsertParaBreak: Hidden Portion" ); @@ -2905,7 +2905,7 @@ void TextEngine::ImpInitWritingDirections( sal_uInt32 nPara ) } -sal_uInt8 TextEngine::ImpGetRightToLeft( sal_uInt32 nPara, sal_Int32 nPos, sal_Int32* pStart ) +sal_uInt8 TextEngine::ImpGetRightToLeft( sal_uInt32 nPara, sal_Int32 nPos ) { sal_uInt8 nRightToLeft = 0; @@ -2922,8 +2922,6 @@ sal_uInt8 TextEngine::ImpGetRightToLeft( sal_uInt32 nPara, sal_Int32 nPos, sal_I if ( rWritingDirectionInfo.nStartPos <= nPos && rWritingDirectionInfo.nEndPos >= nPos ) { nRightToLeft = rWritingDirectionInfo.nType; - if ( pStart ) - *pStart = rWritingDirectionInfo.nStartPos; break; } } diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 0a4d5953a42f..fef99d636d0b 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -1382,17 +1382,8 @@ GEOMETRY lcl_convert( const MapMode& _rSource, const MapMode& _rDest, OutputDevi } } -void PDFWriterImpl::PDFPage::appendPoint( const Point& rPoint, OStringBuffer& rBuffer, bool bNeg, Point* pOutPoint ) const +void PDFWriterImpl::PDFPage::appendPoint( const Point& rPoint, OStringBuffer& rBuffer, bool bNeg ) const { - if( pOutPoint ) - { - Point aPoint( lcl_convert( m_pWriter->m_aGraphicsStack.front().m_aMapMode, - m_pWriter->m_aMapMode, - m_pWriter->getReferenceDevice(), - rPoint ) ); - *pOutPoint = aPoint; - } - Point aPoint( lcl_convert( m_pWriter->m_aGraphicsStack.front().m_aMapMode, m_pWriter->m_aMapMode, m_pWriter->getReferenceDevice(), @@ -1495,7 +1486,7 @@ void PDFWriterImpl::PDFPage::appendPolygon( const tools::Polygon& rPoly, OString } } -void PDFWriterImpl::PDFPage::appendPolygon( const basegfx::B2DPolygon& rPoly, OStringBuffer& rBuffer, bool bClose ) const +void PDFWriterImpl::PDFPage::appendPolygon( const basegfx::B2DPolygon& rPoly, OStringBuffer& rBuffer ) const { basegfx::B2DPolygon aPoly( lcl_convert( m_pWriter->m_aGraphicsStack.front().m_aMapMode, m_pWriter->m_aMapMode, @@ -1566,8 +1557,7 @@ void PDFWriterImpl::PDFPage::appendPolygon( const basegfx::B2DPolygon& rPoly, OS rBuffer.append( " " ); } } - if( bClose ) - rBuffer.append( "h\n" ); + rBuffer.append( "h\n" ); } } diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index d0817a124111..6b3b0d10dce7 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -139,7 +139,7 @@ public: // to page (useful for transformation matrices // if pOutPoint is set it will be updated to the emitted point // (in PDF map mode, that is 10th of point) - void appendPoint( const Point& rPoint, OStringBuffer& rBuffer, bool bNeg = false, Point* pOutPoint = nullptr ) const; + void appendPoint( const Point& rPoint, OStringBuffer& rBuffer, bool bNeg = false ) const; // appends a B2DPoint without further transformation void appendPixelPoint( const basegfx::B2DPoint& rPoint, OStringBuffer& rBuffer ) const; // appends a rectangle @@ -149,7 +149,7 @@ public: // appends a polygon optionally closing it void appendPolygon( const tools::Polygon& rPoly, OStringBuffer& rBuffer, bool bClose = true ) const; // appends a polygon optionally closing it - void appendPolygon( const basegfx::B2DPolygon& rPoly, OStringBuffer& rBuffer, bool bClose = true ) const; + void appendPolygon( const basegfx::B2DPolygon& rPoly, OStringBuffer& rBuffer ) const; // appends a polypolygon optionally closing the subpaths void appendPolyPolygon( const tools::PolyPolygon& rPolyPoly, OStringBuffer& rBuffer ) const; // appends a polypolygon optionally closing the subpaths diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 13c8a1514b34..b4df20fa4c1a 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -293,7 +293,7 @@ basegfx::B2DPolygon SalGraphics::mirror( const basegfx::B2DPolygon& i_rPoly, con return aRet; } -basegfx::B2DPolyPolygon SalGraphics::mirror( const basegfx::B2DPolyPolygon& i_rPoly, const OutputDevice *i_pOutDev, bool i_bBack ) const +basegfx::B2DPolyPolygon SalGraphics::mirror( const basegfx::B2DPolyPolygon& i_rPoly, const OutputDevice *i_pOutDev ) const { long w; if( i_pOutDev && i_pOutDev->GetOutDevType() == OUTDEV_VIRDEV ) @@ -308,7 +308,7 @@ basegfx::B2DPolyPolygon SalGraphics::mirror( const basegfx::B2DPolyPolygon& i_rP { sal_Int32 nPoly = i_rPoly.count(); for( sal_Int32 i = 0; i < nPoly; i++ ) - aRet.append( mirror( i_rPoly.getB2DPolygon( i ), i_pOutDev, i_bBack ) ); + aRet.append( mirror( i_rPoly.getB2DPolygon( i ), i_pOutDev ) ); aRet.setClosed( i_rPoly.isClosed() ); aRet.flip(); } diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 6ad7eb603715..3a94f8d63cf3 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1093,7 +1093,7 @@ long OutputDevice::GetTextArray( const OUString& rStr, long* pDXAry, bool OutputDevice::GetCaretPositions( const OUString& rStr, long* pCaretXArray, sal_Int32 nIndex, sal_Int32 nLen, - long* pDXAry, long nLayoutWidth ) const + long* pDXAry ) const { if( nIndex >= rStr.getLength() ) @@ -1103,7 +1103,7 @@ bool OutputDevice::GetCaretPositions( const OUString& rStr, long* pCaretXArray, // layout complex text SalLayout* pSalLayout = ImplLayout( rStr, nIndex, nLen, - Point(0,0), nLayoutWidth, pDXAry ); + Point(0,0), 0, pDXAry ); if( !pSalLayout ) return false; @@ -2283,18 +2283,9 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const OUString& rStr, } long OutputDevice::GetCtrlTextWidth( const OUString& rStr, - sal_Int32 nIndex, sal_Int32 nLen ) const + sal_Int32 nIndex ) const { - if(nLen == 0x0FFFF) - { - SAL_INFO("sal.rtl.xub", - "GetCtrlTextWidth Suspicious arguments nLen:" << nLen); - } - /* defensive code */ - if( (nLen < 0) || (nIndex + nLen >= rStr.getLength())) - { - nLen = rStr.getLength() - nIndex; - } + sal_Int32 nLen = rStr.getLength() - nIndex; sal_Int32 nMnemonicPos; OUString aStr = GetNonMnemonicString( rStr, nMnemonicPos ); diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index d218675f23aa..95f3f4a426ad 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -528,7 +528,7 @@ void Menu::InsertItem( const ResId& rResId ) } void Menu::InsertItem(const OUString& rCommand, const css::uno::Reference& rFrame, - MenuItemBits nBits, const OString &rIdent) + MenuItemBits nBits) { OUString aLabel(CommandInfoProvider::Instance().GetPopupLabelForCommand(rCommand, rFrame)); OUString aTooltip(CommandInfoProvider::Instance().GetTooltipForCommand(rCommand, rFrame)); @@ -536,7 +536,7 @@ void Menu::InsertItem(const OUString& rCommand, const css::uno::Reference