basic/source/sbx/sbxvalue.cxx | 63 +++++++++++------------- framework/source/accelerators/presethandler.cxx | 42 ---------------- sd/source/ui/dlg/BulletAndPositionDlg.cxx | 13 ---- sd/source/ui/dlg/sdtreelb.cxx | 17 ++---- sdext/source/presenter/PresenterToolBar.cxx | 5 - svl/source/misc/inethist.cxx | 14 +---- unotools/source/misc/fontdefs.cxx | 19 +++---- vcl/source/outdev/bitmap.cxx | 11 +--- vcl/unx/generic/printer/jobdata.cxx | 31 +++++------ 9 files changed, 69 insertions(+), 146 deletions(-)
New commits: commit 096168cacc574a71482520e5c3fbd79f975dc6ad Author: Noel Grandin <[email protected]> AuthorDate: Sun Jul 28 09:19:57 2019 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sun Jul 28 16:52:20 2019 +0200 loplugin:writeonlyvars Change-Id: I00b495685cc9f74440051eafa2f8681a050a536e Reviewed-on: https://gerrit.libreoffice.org/76497 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/framework/source/accelerators/presethandler.cxx b/framework/source/accelerators/presethandler.cxx index c40c22cbc5bd..b8b637c5455e 100644 --- a/framework/source/accelerators/presethandler.cxx +++ b/framework/source/accelerators/presethandler.cxx @@ -436,48 +436,6 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType sRelPathUser = sLocalizedUserPath; } - // read content of level 3 (presets, targets) - css::uno::Sequence< OUString > lNames; - const OUString* pNames; - sal_Int32 c; - sal_Int32 i; - std::vector<OUString> lPresets; - std::vector<OUString> lTargets; - - // read preset names of share layer - if (xShare.is()) - { - lNames = xShare->getElementNames(); - pNames = lNames.getConstArray(); - c = lNames.getLength(); - - for (i=0; i<c; ++i) - { - OUString sTemp = pNames[i]; - sal_Int32 nPos = sTemp.indexOf(".xml"); - if (nPos > -1) - sTemp = sTemp.copy(0,nPos); - lPresets.push_back(sTemp); - } - } - - // read preset names of user layer - if (xUser.is()) - { - lNames = xUser->getElementNames(); - pNames = lNames.getConstArray(); - c = lNames.getLength(); - - for (i=0; i<c; ++i) - { - OUString sTemp = pNames[i]; - sal_Int32 nPos = sTemp.indexOf(".xml"); - if (nPos > -1) - sTemp = sTemp.copy(0,nPos); - lTargets.push_back(sTemp); - } - } - { SolarMutexGuard g; m_xWorkingStorageShare = xShare; diff --git a/sd/source/ui/dlg/BulletAndPositionDlg.cxx b/sd/source/ui/dlg/BulletAndPositionDlg.cxx index 265274c1ff4d..dd811411d493 100644 --- a/sd/source/ui/dlg/BulletAndPositionDlg.cxx +++ b/sd/source/ui/dlg/BulletAndPositionDlg.cxx @@ -448,9 +448,6 @@ void SvxBulletAndPositionDlg::InitControls() bool bSameStart = true; bool bSamePrefix = true; bool bSameSuffix = true; - bool bAllLevel = true; - bool bSameCharFmt = true; - bool bSameVOrient = true; bool bSameSize = true; bool bSameBulColor = true; bool bSameBulRelSize = true; @@ -460,13 +457,10 @@ void SvxBulletAndPositionDlg::InitControls() const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM]; OUString sFirstCharFmt; - sal_Int16 eFirstOrient = text::VertOrientation::NONE; SvxAdjust eFirstAdjust = SvxAdjust::Left; Size aFirstSize(0, 0); sal_uInt16 nMask = 1; sal_uInt16 nLvl = SAL_MAX_UINT16; - sal_uInt16 nHighestLevel = 0; - (void)nHighestLevel; bool bBullColor = pActNum->IsFeatureSupported(SvxNumRuleFlags::BULLET_COLOR); bool bBullRelSize = pActNum->IsFeatureSupported(SvxNumRuleFlags::BULLET_REL_SIZE); @@ -483,7 +477,6 @@ void SvxBulletAndPositionDlg::InitControls() { nLvl = i; sFirstCharFmt = aNumFmtArr[i]->GetCharFormatName(); - eFirstOrient = aNumFmtArr[i]->GetVertOrient(); if (bShowBitmap) aFirstSize = aNumFmtArr[i]->GetGraphicSize(); } @@ -495,10 +488,6 @@ void SvxBulletAndPositionDlg::InitControls() bSamePrefix = aNumFmtArr[i]->GetPrefix() == aNumFmtArr[nLvl]->GetPrefix(); bSameSuffix = aNumFmtArr[i]->GetSuffix() == aNumFmtArr[nLvl]->GetSuffix(); - bAllLevel &= aNumFmtArr[i]->GetIncludeUpperLevels() - == aNumFmtArr[nLvl]->GetIncludeUpperLevels(); - bSameCharFmt &= sFirstCharFmt == aNumFmtArr[i]->GetCharFormatName(); - bSameVOrient &= eFirstOrient == aNumFmtArr[i]->GetVertOrient(); //bSameAdjust &= eFirstAdjust == aNumFmtArr[i]->GetNumAdjust(); if (bShowBitmap && bSameSize) bSameSize &= aNumFmtArr[i]->GetGraphicSize() == aFirstSize; @@ -510,7 +499,6 @@ void SvxBulletAndPositionDlg::InitControls() &= aNumFmtArr[i]->GetFirstLineOffset() == aNumFmtArr[nLvl]->GetFirstLineOffset(); } - nHighestLevel = i; } nMask <<= 1; @@ -523,7 +511,6 @@ void SvxBulletAndPositionDlg::InitControls() else { nNumberingType = SVX_NUM_NUMBER_NONE; - bAllLevel = false; bSameDistBorderNum = false; bSameIndent = false; bSameBulRelSize = false; commit e8493f9349d18cbcb323930a9bf200c542a72d62 Author: Noel Grandin <[email protected]> AuthorDate: Sun Jul 28 09:01:19 2019 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sun Jul 28 16:52:06 2019 +0200 loplugin:collapseif Change-Id: I69bfafa97c66ef944cc6ae35c7e2f66d0430d6a4 Reviewed-on: https://gerrit.libreoffice.org/76496 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index 1a011b6706d1..37f8cffbf413 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -976,43 +976,40 @@ bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp ) { aL.eType = aR.eType = SbxDECIMAL; bDecimal = true; - if( rOp.Get( aR ) ) + if( rOp.Get( aR ) && Get( aL ) ) { - if( Get( aL ) ) + if( aL.pDecimal && aR.pDecimal ) { - if( aL.pDecimal && aR.pDecimal ) - { - bool bOk = true; - switch( eOp ) - { - case SbxMUL: - bOk = ( *(aL.pDecimal) *= *(aR.pDecimal) ); - break; - case SbxDIV: - if( aR.pDecimal->isZero() ) - SetError( ERRCODE_BASIC_ZERODIV ); - else - bOk = ( *(aL.pDecimal) /= *(aR.pDecimal) ); - break; - case SbxPLUS: - bOk = ( *(aL.pDecimal) += *(aR.pDecimal) ); - break; - case SbxMINUS: - bOk = ( *(aL.pDecimal) -= *(aR.pDecimal) ); - break; - case SbxNEG: - bOk = ( aL.pDecimal->neg() ); - break; - default: - SetError( ERRCODE_BASIC_BAD_ARGUMENT ); - } - if( !bOk ) - SetError( ERRCODE_BASIC_MATH_OVERFLOW ); - } - else + bool bOk = true; + switch( eOp ) { - SetError( ERRCODE_BASIC_CONVERSION ); + case SbxMUL: + bOk = ( *(aL.pDecimal) *= *(aR.pDecimal) ); + break; + case SbxDIV: + if( aR.pDecimal->isZero() ) + SetError( ERRCODE_BASIC_ZERODIV ); + else + bOk = ( *(aL.pDecimal) /= *(aR.pDecimal) ); + break; + case SbxPLUS: + bOk = ( *(aL.pDecimal) += *(aR.pDecimal) ); + break; + case SbxMINUS: + bOk = ( *(aL.pDecimal) -= *(aR.pDecimal) ); + break; + case SbxNEG: + bOk = ( aL.pDecimal->neg() ); + break; + default: + SetError( ERRCODE_BASIC_BAD_ARGUMENT ); } + if( !bOk ) + SetError( ERRCODE_BASIC_MATH_OVERFLOW ); + } + else + { + SetError( ERRCODE_BASIC_CONVERSION ); } } } diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 2d6b2ae0fe45..b17fb4546524 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -1128,18 +1128,15 @@ sal_Int8 SdPageObjsTLB::ExecuteDrop( const ExecuteDropEvent& rEvt ) try { - if( !bIsInDrag ) + if( !bIsInDrag && mpNavigator) { - if (mpNavigator) - { - TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable ); - OUString aFile; + TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable ); + OUString aFile; - if( aDataHelper.GetString( SotClipboardFormatId::SIMPLE_FILE, aFile ) && - mpNavigator->InsertFile( aFile ) ) - { - nRet = rEvt.mnAction; - } + if( aDataHelper.GetString( SotClipboardFormatId::SIMPLE_FILE, aFile ) && + mpNavigator->InsertFile( aFile ) ) + { + nRet = rEvt.mnAction; } } } diff --git a/sdext/source/presenter/PresenterToolBar.cxx b/sdext/source/presenter/PresenterToolBar.cxx index 5d065da4454e..e6e19f03e908 100644 --- a/sdext/source/presenter/PresenterToolBar.cxx +++ b/sdext/source/presenter/PresenterToolBar.cxx @@ -752,9 +752,8 @@ void PresenterToolBar::Layout ( nX+aPartSizes[nIndex].Width, nY+aTotalSize.Height); // Add space for gaps between elements. - if (rxPart->size() > 1) - if (bIsHorizontal) - aBoundingBox.X2 += (rxPart->size() - 1) * nGapWidth; + if (rxPart->size() > 1 && bIsHorizontal) + aBoundingBox.X2 += (rxPart->size() - 1) * nGapWidth; LayoutPart(rxCanvas, rxPart, aBoundingBox, aPartSizes[nIndex], bIsHorizontal); bIsHorizontal = !bIsHorizontal; diff --git a/svl/source/misc/inethist.cxx b/svl/source/misc/inethist.cxx index 5dafe30d2ce2..19cae51df5ad 100644 --- a/svl/source/misc/inethist.cxx +++ b/svl/source/misc/inethist.cxx @@ -254,16 +254,10 @@ void INetURLHistory_Impl::putUrl (const OUString &rUrl) // Check source and destination. sal_uInt16 nDI = std::min (k, sal_uInt16(capacity() - 1)); - if (nSI < nDI) - { - if (!(m_pHash[nDI] < h)) - nDI -= 1; - } - if (nDI < nSI) - { - if (m_pHash[nDI] < h) - nDI += 1; - } + if (nSI < nDI && !(m_pHash[nDI] < h)) + nDI -= 1; + if (nDI < nSI && m_pHash[nDI] < h) + nDI += 1; // Assign data. m_pList[m_aHead.m_nNext].m_nHash = m_pHash[nSI].m_nHash = h; diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx index f988b5f17759..c8c05c94fe59 100644 --- a/unotools/source/misc/fontdefs.cxx +++ b/unotools/source/misc/fontdefs.cxx @@ -527,19 +527,16 @@ OUString GetSubsFontName( const OUString& rName, SubsFontFlags nFlags ) return aName; const utl::FontNameAttr* pAttr = utl::FontSubstConfiguration::get().getSubstInfo( aOrgName ); - if ( pAttr ) + if ( pAttr && (nFlags & SubsFontFlags::MS) ) { - if( nFlags & SubsFontFlags::MS ) + for( const auto& rSubstitution : pAttr->MSSubstitutions ) + if( ! ImplIsFontToken( rName, rSubstitution ) ) { - for( const auto& rSubstitution : pAttr->MSSubstitutions ) - if( ! ImplIsFontToken( rName, rSubstitution ) ) - { - ImplAppendFontToken( aName, rSubstitution ); - if( nFlags & SubsFontFlags::ONLYONE ) - { - break; - } - } + ImplAppendFontToken( aName, rSubstitution ); + if( nFlags & SubsFontFlags::ONLYONE ) + { + break; + } } } diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index acbd13e0a5ab..10b58b208db5 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -1569,15 +1569,12 @@ Bitmap OutputDevice::BlendBitmap( BitmapScopedWriteAccess pB(aBmp); bool bFastBlend = false; - if( pP && pA && pB ) + if( pP && pA && pB && !bHMirr && !bVMirr ) { - if( !bHMirr && !bVMirr ) - { - SalTwoRect aTR(aBmpRect.Left(), aBmpRect.Top(), aBmpRect.GetWidth(), aBmpRect.GetHeight(), - nOffX, nOffY, aOutSz.Width(), aOutSz.Height()); + SalTwoRect aTR(aBmpRect.Left(), aBmpRect.Top(), aBmpRect.GetWidth(), aBmpRect.GetHeight(), + nOffX, nOffY, aOutSz.Width(), aOutSz.Height()); - bFastBlend = ImplFastBitmapBlending( *pB,*pP,*pA, aTR ); - } + bFastBlend = ImplFastBitmapBlending( *pB,*pP,*pA, aTR ); } if( pP && pA && pB && !bFastBlend ) diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx index 11f1b931ecaf..e95263e29c49 100644 --- a/vcl/unx/generic/printer/jobdata.cxx +++ b/vcl/unx/generic/printer/jobdata.cxx @@ -266,26 +266,23 @@ bool JobData::constructFromStreamBuffer( const void* pData, sal_uInt32 bytes, Jo bPDFDevice = true; rJobData.m_nPDFDevice = aLine.copy(RTL_CONSTASCII_LENGTH(pdfdeviceEquals)).toInt32(); } - else if (aLine == "PPDContexData") + else if (aLine == "PPDContexData" && bPrinter) { - if( bPrinter ) + PrinterInfoManager& rManager = PrinterInfoManager::get(); + const PrinterInfo& rInfo = rManager.getPrinterInfo( rJobData.m_aPrinterName ); + rJobData.m_pParser = PPDParser::getParser( rInfo.m_aDriverName ); + if( rJobData.m_pParser ) { - PrinterInfoManager& rManager = PrinterInfoManager::get(); - const PrinterInfo& rInfo = rManager.getPrinterInfo( rJobData.m_aPrinterName ); - rJobData.m_pParser = PPDParser::getParser( rInfo.m_aDriverName ); - if( rJobData.m_pParser ) + rJobData.m_aContext.setParser( rJobData.m_pParser ); + sal_uInt64 nBytes = bytes - aStream.Tell(); + std::vector<char> aRemain(nBytes+1); + nBytes = aStream.ReadBytes(aRemain.data(), nBytes); + if (nBytes) { - rJobData.m_aContext.setParser( rJobData.m_pParser ); - sal_uInt64 nBytes = bytes - aStream.Tell(); - std::vector<char> aRemain(nBytes+1); - nBytes = aStream.ReadBytes(aRemain.data(), nBytes); - if (nBytes) - { - aRemain.resize(nBytes+1); - aRemain[nBytes] = 0; - rJobData.m_aContext.rebuildFromStreamBuffer(aRemain); - bContext = true; - } + aRemain.resize(nBytes+1); + aRemain[nBytes] = 0; + rJobData.m_aContext.rebuildFromStreamBuffer(aRemain); + bContext = true; } } } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
