starmath/qa/cppunit/test_cursor.cxx | 8 - starmath/qa/cppunit/test_starmath.cxx | 2 starmath/qa/extras/mmlimport-test.cxx | 8 - starmath/source/cfgitem.cxx | 3 starmath/source/cursor.cxx | 3 starmath/source/mathmlexport.cxx | 14 -- starmath/source/mathmlimport.cxx | 3 store/source/stordata.cxx | 12 -- svgio/source/svgreader/svgcharacternode.cxx | 18 +-- svgio/source/svgreader/svggradientnode.cxx | 5 svgio/source/svgreader/svggradientstopnode.cxx | 4 svgio/source/svgreader/svgsvgnode.cxx | 86 ++++++++--------- svl/qa/unit/items/test_IndexedStyleSheets.cxx | 25 +--- svl/qa/unit/svl.cxx | 2 svl/source/fsstor/fsstorage.cxx | 9 - svl/source/passwordcontainer/passwordcontainer.cxx | 3 svtools/source/config/colorcfg.cxx | 3 svtools/source/config/extcolorcfg.cxx | 15 -- svtools/source/contnr/contentenumeration.cxx | 3 svtools/source/contnr/fileview.cxx | 8 - svtools/source/contnr/iconviewimpl.cxx | 4 svtools/source/contnr/imivctl1.cxx | 2 svtools/source/contnr/svimpbox.cxx | 4 svtools/source/contnr/svlbitm.cxx | 5 svtools/source/control/toolbarmenu.cxx | 10 - svtools/source/control/valueacc.cxx | 5 svtools/source/control/vclxaccessibleheaderbaritem.cxx | 28 ----- svtools/source/dialogs/addresstemplate.cxx | 3 svtools/source/dialogs/insdlg.cxx | 5 svtools/source/filter/SvFilterOptionsDialog.cxx | 3 svtools/source/misc/unitconv.cxx | 3 svtools/source/svrtf/rtfout.cxx | 2 svtools/source/table/tablecontrol_impl.cxx | 6 - 33 files changed, 117 insertions(+), 197 deletions(-)
New commits: commit c937c6828784260f3536a37f8e297dc721a7d974 Author: Noel Grandin <[email protected]> Date: Mon Jun 26 14:47:31 2017 +0200 loplugin:oncevar in svtools Change-Id: Ic97e75c81a0c00853d2f10aaf182ab476c466c86 Reviewed-on: https://gerrit.libreoffice.org/39281 Tested-by: Jenkins <[email protected]> Reviewed-by: Noel Grandin <[email protected]> diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index 02389ddd4601..69040da4428b 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -276,8 +276,7 @@ void ColorConfig_Impl::ImplCommit() nIndex++; } } - OUString sNode("ColorSchemes"); - SetSetProperties(sNode, aPropValues); + SetSetProperties("ColorSchemes", aPropValues); CommitCurrentSchemeName(); } diff --git a/svtools/source/config/extcolorcfg.cxx b/svtools/source/config/extcolorcfg.cxx index f60858d856cc..800cbf7e304b 100644 --- a/svtools/source/config/extcolorcfg.cxx +++ b/svtools/source/config/extcolorcfg.cxx @@ -134,10 +134,9 @@ uno::Sequence< OUString> ExtendedColorConfig_Impl::GetPropertyNames(const OUStri uno::Sequence< OUString> aNames(GetNodeNames(rScheme)); OUString* pIter = aNames.getArray(); OUString* pEnd = pIter + aNames.getLength(); - OUString sSep("/"); for(;pIter != pEnd;++pIter) { - *pIter = rScheme + sSep + *pIter; + *pIter = rScheme + "/" + *pIter; } return aNames; } @@ -236,8 +235,7 @@ void ExtendedColorConfig_Impl::Load(const OUString& rScheme) // fill display names TDisplayNames aDisplayNameMap; - OUString sEntryNames("EntryNames"); - uno::Sequence < OUString > aComponentNames = GetPropertyNames(sEntryNames); + uno::Sequence < OUString > aComponentNames = GetPropertyNames("EntryNames"); OUString sDisplayName("/DisplayName"); OUString* pIter = aComponentNames.getArray(); OUString* pEnd = pIter + aComponentNames.getLength(); @@ -301,11 +299,9 @@ void ExtendedColorConfig_Impl::Load(const OUString& rScheme) if ( sScheme != "default" ) { - OUString sDefault("default"); - if ( ExistsScheme(sDefault) ) + if ( ExistsScheme("default") ) { - OUString sBaseDefault("ExtendedColorScheme/ColorSchemes/default"); - aComponentNames = GetPropertyNames(sBaseDefault); + aComponentNames = GetPropertyNames("ExtendedColorScheme/ColorSchemes/default"); FillComponentColors(aComponentNames,aDisplayNameMap); } } @@ -431,8 +427,7 @@ void ExtendedColorConfig_Impl::ImplCommit() pPropValues->Value <<= aConIter->second.getColor(); // the default color will never be changed } - OUString s("ExtendedColorScheme/ColorSchemes"); - SetSetProperties(s, aPropValues); + SetSetProperties("ExtendedColorScheme/ColorSchemes", aPropValues); } } diff --git a/svtools/source/contnr/contentenumeration.cxx b/svtools/source/contnr/contentenumeration.cxx index acc6cc4a019a..9f477e4643a8 100644 --- a/svtools/source/contnr/contentenumeration.cxx +++ b/svtools/source/contnr/contentenumeration.cxx @@ -174,8 +174,7 @@ namespace svt } Reference< XDynamicResultSet > xDynResultSet; - ResultSetInclude eInclude = INCLUDE_FOLDERS_AND_DOCUMENTS; - xDynResultSet = aFolder.aContent.createDynamicCursor( aProps, eInclude ); + xDynResultSet = aFolder.aContent.createDynamicCursor( aProps, INCLUDE_FOLDERS_AND_DOCUMENTS ); if ( xDynResultSet.is() ) xResultSet = xDynResultSet->getStaticResultSet(); diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 0e79b7d3cce2..ba399b819d11 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -1860,8 +1860,8 @@ void SvtFileView_Impl::implEnumerationSuccess() void SvtFileView_Impl::ReplaceTabWithString( OUString& aValue ) { - OUString aTab( "\t" ); - OUString aTabString( "%09" ); + OUString const aTab( "\t" ); + OUString const aTabString( "%09" ); sal_Int32 iPos; while ( ( iPos = aValue.indexOf( aTab ) ) >= 0 ) @@ -1875,7 +1875,7 @@ void SvtFileView_Impl::CreateDisplayText_Impl() OUString aValue; OUString aTab( "\t" ); - OUString aDateSep( ", " ); + OUString const aDateSep( ", " ); std::vector< SortingData_Impl* >::iterator aIt; @@ -2116,7 +2116,7 @@ OUString SvtFileView_Impl::FolderInserted( const OUString& rURL, const OUString& OUString aValue; OUString aTab( "\t" ); - OUString aDateSep( ", " ); + OUString const aDateSep( ", " ); // title, type, size, date aValue = pData->GetTitle(); diff --git a/svtools/source/contnr/iconviewimpl.cxx b/svtools/source/contnr/iconviewimpl.cxx index acda2f088bb5..78b5148b264a 100644 --- a/svtools/source/contnr/iconviewimpl.cxx +++ b/svtools/source/contnr/iconviewimpl.cxx @@ -469,8 +469,6 @@ bool IconViewImpl::KeyInput( const KeyEvent& rKEvt ) if( !pCursor ) return false; - bool bKeyUsed = true; - sal_uInt16 aCode = rKeyCode.GetCode(); bool bShift = rKeyCode.IsShift(); @@ -657,7 +655,7 @@ bool IconViewImpl::KeyInput( const KeyEvent& rKEvt ) if(!bHandled) return SvImpLBox::KeyInput( rKEvt ); - return bKeyUsed; + return true; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index 560dc8946825..21b0b1fc8a57 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -2285,7 +2285,7 @@ Size SvxIconChoiceCtrl_Impl::GetMinGrid() const Size aMinSize( aImageSize ); aMinSize.Width() += 2 * LROFFS_BOUND; aMinSize.Height() += TBOFFS_BOUND; // single offset is enough (FileDlg) - OUString aStrDummy( "XXX" ); + OUString const aStrDummy( "XXX" ); Size aTextSize( pView->GetTextWidth( aStrDummy ), pView->GetTextHeight() ); if( nWinBits & WB_ICON ) { diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index 8e68c0c85db0..06a10fbf7956 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -1026,13 +1026,11 @@ void SvImpLBox::DrawNet(vcl::RenderContext& rRenderContext) if (rRenderContext.IsNativeControlSupported(ControlType::ListNet, ControlPart::Entire)) { ImplControlValue aControlValue; - ControlState nState = ControlState::ENABLED; if (rRenderContext.DrawNativeControl(ControlType::ListNet, ControlPart::Entire, - tools::Rectangle(), nState, aControlValue, OUString())) + tools::Rectangle(), ControlState::ENABLED, aControlValue, OUString())) { return; } - } long nEntryHeight = pView->GetEntryHeight(); diff --git a/svtools/source/contnr/svlbitm.cxx b/svtools/source/contnr/svlbitm.cxx index 1bc77fe48b6d..8b1f67741979 100644 --- a/svtools/source/contnr/svlbitm.cxx +++ b/svtools/source/contnr/svlbitm.cxx @@ -338,8 +338,7 @@ void SvLBoxButton::ImplAdjustBoxSize(Size& io_rSize, ControlType i_eType, vcl::R if (rRenderContext.IsNativeControlSupported( i_eType, ControlPart::Entire) ) { ImplControlValue aControlValue; - tools::Rectangle aCtrlRegion( Point( 0, 0 ), io_rSize ); - ControlState nState = ControlState::ENABLED; + tools::Rectangle aCtrlRegion( Point( 0, 0 ), io_rSize ); aControlValue.setTristateVal( ButtonValue::On ); @@ -347,7 +346,7 @@ void SvLBoxButton::ImplAdjustBoxSize(Size& io_rSize, ControlType i_eType, vcl::R bool bNativeOK = rRenderContext.GetNativeControlRegion( i_eType, ControlPart::Entire, aCtrlRegion, - nState, + ControlState::ENABLED, aControlValue, aNativeBounds, aNativeContent ); diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index 17c666288fc6..33df12a8b6d8 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -1142,12 +1142,12 @@ static void ImplPaintCheckBackground(vcl::RenderContext& rRenderContext, vcl::Wi if (rRenderContext.IsNativeControlSupported(ControlType::Toolbar, ControlPart::Button)) { ImplControlValue aControlValue; - ControlState nState = ControlState::PRESSED | ControlState::ENABLED; - aControlValue.setTristateVal(ButtonValue::On); bNativeOk = rRenderContext.DrawNativeControl(ControlType::Toolbar, ControlPart::Button, - i_rRect, nState, aControlValue, OUString()); + i_rRect, + ControlState::PRESSED | ControlState::ENABLED, + aControlValue, OUString()); } if (!bNativeOk) @@ -1160,8 +1160,6 @@ static void ImplPaintCheckBackground(vcl::RenderContext& rRenderContext, vcl::Wi void ToolbarMenu::implPaint(vcl::RenderContext& rRenderContext, ToolbarMenuEntry* pThisOnly, bool bHighlighted) { - sal_uInt16 nBorder = 0; long nStartY = 0; // from Menu implementations, needed when we support native menu background & scrollable menu - long nFontHeight = GetTextHeight(); long nCheckHeight = 0, nRadioHeight = 0, nMaxCheckWidth = 0; @@ -1178,8 +1176,6 @@ void ToolbarMenu::implPaint(vcl::RenderContext& rRenderContext, ToolbarMenuEntry for (const auto& pEntry : mpImpl->maEntryVector) { Point aPos(aTopLeft); - aPos.Y() += nBorder; - aPos.Y() += nStartY; if ((pEntry == nullptr) && !pThisOnly) { diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index 1afc813baff6..467e704a2586 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -237,10 +237,7 @@ sal_Int16 SAL_CALL ValueSetAcc::getAccessibleRole() OUString SAL_CALL ValueSetAcc::getAccessibleDescription() { ThrowIfDisposed(); - const SolarMutexGuard aSolarGuard; - OUString aRet( "ValueSet" ); - - return aRet; + return OUString( "ValueSet" ); } diff --git a/svtools/source/control/vclxaccessibleheaderbaritem.cxx b/svtools/source/control/vclxaccessibleheaderbaritem.cxx index 2e7bad01f9e8..11b0f7446b4b 100644 --- a/svtools/source/control/vclxaccessibleheaderbaritem.cxx +++ b/svtools/source/control/vclxaccessibleheaderbaritem.cxx @@ -164,17 +164,13 @@ sal_Int32 VCLXAccessibleHeaderBarItem::getAccessibleIndexInParent() sal_Int16 VCLXAccessibleHeaderBarItem::getAccessibleRole() { - OExternalLockGuard aGuard( this ); - return AccessibleRole::COLUMN_HEADER; } OUString VCLXAccessibleHeaderBarItem::getAccessibleDescription() { - OExternalLockGuard aGuard( this ); - OUString sDescription; - return sDescription; + return OUString(); } @@ -232,27 +228,19 @@ css::lang::Locale VCLXAccessibleHeaderBarItem::getLocale() Reference< XAccessible > VCLXAccessibleHeaderBarItem::getAccessibleAtPoint( const awt::Point& ) { - OExternalLockGuard aGuard( this ); - return Reference< XAccessible >(); } sal_Int32 VCLXAccessibleHeaderBarItem::getForeground() { - OExternalLockGuard aGuard( this ); - - sal_Int32 nColor = 0; - return nColor; + return 0; } sal_Int32 VCLXAccessibleHeaderBarItem::getBackground() { - OExternalLockGuard aGuard( this ); - - sal_Int32 nColor = 0; - return nColor; + return 0; } @@ -261,19 +249,13 @@ sal_Int32 VCLXAccessibleHeaderBarItem::getBackground() Reference< awt::XFont > VCLXAccessibleHeaderBarItem::getFont() { - OExternalLockGuard aGuard( this ); - - Reference< awt::XFont > xFont; - return xFont; + return Reference< awt::XFont >(); } OUString VCLXAccessibleHeaderBarItem::getTitledBorderText() { - OExternalLockGuard aGuard( this ); - - OUString sText; - return sText; + return OUString(); } diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index 9b6812802520..f35d174df05c 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -387,9 +387,8 @@ void AssignmentPersistentData::ImplCommit() // nothing to do return; - OUString sDescriptionNodePath("Fields"); Sequence< OUString > aNames(&_rLogicalName, 1); - ClearNodeElements(sDescriptionNodePath, aNames); + ClearNodeElements("Fields", aNames); } diff --git a/svtools/source/dialogs/insdlg.cxx b/svtools/source/dialogs/insdlg.cxx index 50e81b579da3..cd61d236de95 100644 --- a/svtools/source/dialogs/insdlg.cxx +++ b/svtools/source/dialogs/insdlg.cxx @@ -267,15 +267,16 @@ OUString SvPasteObjectHelper::GetSotFormatUIName( SotClipboardFormatId nId ) { SotClipboardFormatId::RICHTEXT, STR_FORMAT_ID_RICHTEXT }, }; - OUString aUIName; sal_uInt16 nResId = 0; - for( sal_uInt32 i = 0, nCount = SAL_N_ELEMENTS( aSotResourcePairs ); ( i < nCount ) && !nResId; i++ ) + sal_uInt32 const nCount = SAL_N_ELEMENTS( aSotResourcePairs ); + for( sal_uInt32 i = 0; ( i < nCount ) && !nResId; i++ ) { if( aSotResourcePairs[ i ].mnSotId == nId ) nResId = aSotResourcePairs[ i ].mnResId; } + OUString aUIName; if( nResId ) aUIName = SvtResId( nResId ); else diff --git a/svtools/source/filter/SvFilterOptionsDialog.cxx b/svtools/source/filter/SvFilterOptionsDialog.cxx index 95aea5119320..b3303392bb00 100644 --- a/svtools/source/filter/SvFilterOptionsDialog.cxx +++ b/svtools/source/filter/SvFilterOptionsDialog.cxx @@ -186,12 +186,11 @@ sal_Int16 SvFilterOptionsDialog::execute() { sal_Int16 nRet = ui::dialogs::ExecutableDialogResults::CANCEL; - OUString aFilterNameStr( "FilterName" ); OUString aInternalFilterName; sal_Int32 j, nCount = maMediaDescriptor.getLength(); for ( j = 0; j < nCount; j++ ) { - if ( maMediaDescriptor[ j ].Name.equals( aFilterNameStr ) ) + if ( maMediaDescriptor[ j ].Name == "FilterName" ) { OUString aStr; maMediaDescriptor[ j ].Value >>= aStr; diff --git a/svtools/source/misc/unitconv.cxx b/svtools/source/misc/unitconv.cxx index df9a282d1785..965187ccaac0 100644 --- a/svtools/source/misc/unitconv.cxx +++ b/svtools/source/misc/unitconv.cxx @@ -292,8 +292,7 @@ long CalcToPoint( long nIn, MapUnit eUnit, sal_uInt16 nFactor ) // ggf. aufrunden if ( MapUnit::MapTwip != eUnit ) { - long nMod = 10; - long nTmp = nRet % nMod; + long nTmp = nRet % 10; if ( nTmp >= 4 ) nRet += 10 - nTmp; diff --git a/svtools/source/svrtf/rtfout.cxx b/svtools/source/svrtf/rtfout.cxx index edaab84b5c04..e042a889b79a 100644 --- a/svtools/source/svrtf/rtfout.cxx +++ b/svtools/source/svrtf/rtfout.cxx @@ -133,7 +133,7 @@ SvStream& Out_Char(SvStream& rStream, sal_Unicode c, //export as unicode OUString sBuf(&c, 1); OString sConverted; - sal_uInt32 nFlags = + sal_uInt32 const nFlags = RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR; bool bWriteAsUnicode = !(sBuf.convertToString(&sConverted, diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index fdbe172bbe26..08569138ccc8 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -1215,8 +1215,7 @@ namespace svt { namespace table continue; bool isActiveColumn = (aCell.getColumn() == getCurrentColumn()); - bool isSelectedColumn = false; - pRenderer->PaintColumnHeader(aCell.getColumn(), isActiveColumn, isSelectedColumn, rRenderContext, aCell.getRect(), rStyle); + pRenderer->PaintColumnHeader(aCell.getColumn(), isActiveColumn, false/*isSelectedColumn*/, rRenderContext, aCell.getRect(), rStyle); } } // the area occupied by the row header, if any @@ -1277,8 +1276,7 @@ namespace svt { namespace table // paint all cells in this row for (TableCellGeometry aCell(aRowIterator, m_nLeftColumn); aCell.isValid(); aCell.moveRight()) { - bool isSelectedColumn = false; - pRenderer->PaintCell(aCell.getColumn(), isSelectedRow || isSelectedColumn, isControlFocused, + pRenderer->PaintCell(aCell.getColumn(), isSelectedRow, isControlFocused, rRenderContext, aCell.getRect(), rStyle); } } commit 8dca2d5ac740f262b045f6529bd8e97af0ec9c47 Author: Noel Grandin <[email protected]> Date: Mon Jun 26 14:47:16 2017 +0200 loplugin:oncevar in starmath..svl Change-Id: I20e3796407c7e429a88d2811673929ac1141a41c Reviewed-on: https://gerrit.libreoffice.org/39280 Tested-by: Jenkins <[email protected]> Reviewed-by: Noel Grandin <[email protected]> diff --git a/starmath/qa/cppunit/test_cursor.cxx b/starmath/qa/cppunit/test_cursor.cxx index dd6b86f39439..02c7ff433371 100644 --- a/starmath/qa/cppunit/test_cursor.cxx +++ b/starmath/qa/cppunit/test_cursor.cxx @@ -67,7 +67,7 @@ void Test::tearDown() void Test::testCopyPaste() { - OUString sInput("a * b + c"); + OUString const sInput("a * b + c"); std::unique_ptr<SmNode> xTree(SmParser().Parse(sInput)); xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); @@ -90,7 +90,7 @@ void Test::testCopyPaste() void Test::testCopySelectPaste() { - OUString sInput("a * b + c"); + OUString const sInput("a * b + c"); std::unique_ptr<SmNode> xTree(SmParser().Parse(sInput)); xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); @@ -117,7 +117,7 @@ void Test::testCopySelectPaste() void Test::testCutPaste() { - OUString sInput("a * b + c"); + OUString const sInput("a * b + c"); std::unique_ptr<SmNode> xTree(SmParser().Parse(sInput)); xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); @@ -140,7 +140,7 @@ void Test::testCutPaste() void Test::testCutSelectPaste() { - OUString sInput("a * b + c"); + OUString const sInput("a * b + c"); std::unique_ptr<SmNode> xTree(SmParser().Parse(sInput)); xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx index c7cbb284aa2f..9d0bd53ebdf3 100644 --- a/starmath/qa/cppunit/test_starmath.cxx +++ b/starmath/qa/cppunit/test_starmath.cxx @@ -144,7 +144,7 @@ void Test::editMarker() } { - OUString sTargetText("a under b under c"); + OUString const sTargetText("a under b under c"); ESelection aSelection; m_pEditWindow->SelNextMark(); diff --git a/starmath/qa/extras/mmlimport-test.cxx b/starmath/qa/extras/mmlimport-test.cxx index 26f553bd8d04..927efc7dc05c 100644 --- a/starmath/qa/extras/mmlimport-test.cxx +++ b/starmath/qa/extras/mmlimport-test.cxx @@ -116,21 +116,21 @@ void Test::testColor() void Test::testSimple() { loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/simple.mml")); - OUString sExpected("left ( {a + b} right )^2"); + OUString const sExpected("left ( {a + b} right )^2"); CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText()); } void Test::testNsPrefixMath() { loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/ns-prefix-math.mml")); - OUString sExpected("left ( {a + b} right )^2"); + OUString const sExpected("left ( {a + b} right )^2"); CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText()); } void Test::testMaction() { loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/maction.mml")); - OUString sExpected("matrix {1 ## 2 ## 3}"); + OUString const sExpected("matrix {1 ## 2 ## 3}"); CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText()); } @@ -143,7 +143,7 @@ void Test::testMspace() void Test::testtdf99556() { loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/tdf99556-1.mml")); - OUString sExpected("sqrt { {} }"); + OUString const sExpected("sqrt { {} }"); CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText()); } diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index bf266ceecd2b..332d50858687 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -316,11 +316,10 @@ const OUString SmFontFormatList::GetNewFontFormatId() const { // returns first unused FormatId - OUString aPrefix("Id"); sal_Int32 nCnt = GetCount(); for (sal_Int32 i = 1; i <= nCnt + 1; ++i) { - OUString aTmpId = aPrefix + OUString::number(i); + OUString aTmpId = "Id" + OUString::number(i); if (!GetFontFormat(aTmpId)) return aTmpId; } diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index 564df363a72d..3960498ab4a8 100644 --- a/starmath/source/cursor.cxx +++ b/starmath/source/cursor.cxx @@ -445,8 +445,7 @@ SmNodeList::iterator SmCursor::TakeSelectedNodesFromList(SmNodeList *pLineList, sal_uInt16 eFontDesc = pText->GetFontDesc(); //If we need make segment 1 if(len1 > 0) { - int start1 = 0; - OUString str = aText.copy(start1, len1); + OUString str = aText.copy(0, len1); pText->ChangeText(str); ++it; } else {//Remove it if not needed diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index 7c2109cf6d3a..c7824d81b23b 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -165,9 +165,8 @@ bool SmXMLExportWrapper::Export(SfxMedium &rMedium) new comphelper::PropertySetInfo( aInfoMap ) ) ); SvtSaveOptions aSaveOpt; - OUString sUsePrettyPrinting("UsePrettyPrinting"); bool bUsePrettyPrinting( bFlat || aSaveOpt.IsPrettyPrinting() ); - xInfoSet->setPropertyValue( sUsePrettyPrinting, Any(bUsePrettyPrinting) ); + xInfoSet->setPropertyValue( "UsePrettyPrinting", Any(bUsePrettyPrinting) ); // Set base URI OUString sPropName( "BaseURI" ); @@ -330,21 +329,16 @@ bool SmXMLExportWrapper::WriteThroughComponent( return false; } - OUString aPropName( "MediaType" ); - OUString aMime( "text/xml" ); - uno::Reference < beans::XPropertySet > xSet( xStream, uno::UNO_QUERY ); - xSet->setPropertyValue( aPropName, Any(aMime) ); + xSet->setPropertyValue( "MediaType", Any(OUString( "text/xml" )) ); // all streams must be encrypted in encrypted document - OUString aTmpPropName( "UseCommonStoragePasswordEncryption" ); - xSet->setPropertyValue( aTmpPropName, Any(true) ); + xSet->setPropertyValue( "UseCommonStoragePasswordEncryption", Any(true) ); // set Base URL if ( rPropSet.is() ) { - OUString sPropName( "StreamName" ); - rPropSet->setPropertyValue( sPropName, makeAny( sStreamName ) ); + rPropSet->setPropertyValue( "StreamName", makeAny( sStreamName ) ); } // write the stuff diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index 093e72b3e690..527b97e3aa1a 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -384,8 +384,7 @@ ErrCode SmXMLImportWrapper::ReadThroughComponent( // set Base URL if ( rPropSet.is() ) { - OUString sPropName( "StreamName"); - rPropSet->setPropertyValue( sPropName, makeAny( sStreamName ) ); + rPropSet->setPropertyValue( "StreamName", makeAny( sStreamName ) ); } diff --git a/store/source/stordata.cxx b/store/source/stordata.cxx index 01822cd44e56..a2c992b983d6 100644 --- a/store/source/stordata.cxx +++ b/store/source/stordata.cxx @@ -1015,8 +1015,7 @@ storeError OStoreDirectoryPageObject::truncate ( if (eScope == page::SCOPE_DIRECT) { // Truncate direct data pages. - sal_uInt16 i, n = OStoreDirectoryDataBlock::directCount; - for (i = n; i > nRemain; i--) + for (sal_uInt16 i = OStoreDirectoryDataBlock::directCount; i > nRemain; i--) { // Obtain data page location. sal_uInt32 nAddr = directLink (i - 1); @@ -1038,8 +1037,7 @@ storeError OStoreDirectoryPageObject::truncate ( if (eScope == page::SCOPE_SINGLE) { // Truncate single indirect pages. - sal_uInt16 i, n = OStoreDirectoryDataBlock::singleCount; - for (i = n; i > nRemain; i--) + for (sal_uInt16 i = OStoreDirectoryDataBlock::singleCount; i > nRemain; i--) { // Truncate single indirect page to zero data pages. eErrCode = store_truncate_Impl (singleLink (i - 1), 0, rBIOS); @@ -1057,8 +1055,7 @@ storeError OStoreDirectoryPageObject::truncate ( if (eScope == page::SCOPE_DOUBLE) { // Truncate double indirect pages. - sal_uInt16 i, n = OStoreDirectoryDataBlock::doubleCount; - for (i = n; i > nRemain; i--) + for (sal_uInt16 i = OStoreDirectoryDataBlock::doubleCount; i > nRemain; i--) { // Truncate double indirect page to zero single indirect pages. eErrCode = store_truncate_Impl (doubleLink (i - 1), 0, 0, rBIOS); @@ -1076,8 +1073,7 @@ storeError OStoreDirectoryPageObject::truncate ( if (eScope == page::SCOPE_TRIPLE) { // Truncate triple indirect pages. - sal_uInt16 i, n = OStoreDirectoryDataBlock::tripleCount; - for (i = n; i > nRemain; i--) + for (sal_uInt16 i = OStoreDirectoryDataBlock::tripleCount; i > nRemain; i--) { // Truncate to zero double indirect pages. eErrCode = store_truncate_Impl (tripleLink (i - 1), 0, 0, 0, rBIOS); diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx index 3e20bc5ecac6..b707cc26116a 100644 --- a/svgio/source/svgreader/svgcharacternode.cxx +++ b/svgio/source/svgreader/svgcharacternode.cxx @@ -251,25 +251,19 @@ namespace svgio } const ::FontWeight nFontWeight(getVclFontWeight(rSvgStyleAttributes.getFontWeight())); - bool bSymbol(false); - bool bVertical(false); bool bItalic(FontStyle_italic == rSvgStyleAttributes.getFontStyle() || FontStyle_oblique == rSvgStyleAttributes.getFontStyle()); - bool bMonospaced(false); - bool bOutline(false); - bool bRTL(false); - bool bBiDiStrong(false); const drawinglayer::attribute::FontAttribute aFontAttribute( aFontFamily, OUString(), nFontWeight, - bSymbol, - bVertical, + false/*bSymbol*/, + false/*bVertical*/, bItalic, - bMonospaced, - bOutline, - bRTL, - bBiDiStrong); + false/*bMonospaced*/, + false/*bOutline*/, + false/*bRTL*/, + false/*bBiDiStrong*/); // prepare FontSizeNumber double fFontWidth(rSvgStyleAttributes.getFontSizeNumber().solve(*this)); diff --git a/svgio/source/svgreader/svggradientnode.cxx b/svgio/source/svgreader/svggradientnode.cxx index 1778e48341bf..675a648393d0 100644 --- a/svgio/source/svgreader/svggradientnode.cxx +++ b/svgio/source/svgreader/svggradientnode.cxx @@ -64,11 +64,8 @@ namespace svgio const SvgStyleAttributes* SvgGradientNode::getSvgStyleAttributes() const { - OUString aClassStrA("linearGradient"); - OUString aClassStrB("radialGradient"); - return checkForCssStyle( - SVGTokenLinearGradient == getType() ? aClassStrA : aClassStrB, + SVGTokenLinearGradient == getType() ? OUString("linearGradient") : OUString("radialGradient"), maSvgStyleAttributes); } diff --git a/svgio/source/svgreader/svggradientstopnode.cxx b/svgio/source/svgreader/svggradientstopnode.cxx index 3a6bfd452dc6..7035be0d2020 100644 --- a/svgio/source/svgreader/svggradientstopnode.cxx +++ b/svgio/source/svgreader/svggradientstopnode.cxx @@ -38,9 +38,7 @@ namespace svgio const SvgStyleAttributes* SvgGradientStopNode::getSvgStyleAttributes() const { - OUString aClassStr("stop"); - - return checkForCssStyle(aClassStr, maSvgStyleAttributes); + return checkForCssStyle("stop", maSvgStyleAttributes); } void SvgGradientStopNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) diff --git a/svgio/source/svgreader/svgsvgnode.cxx b/svgio/source/svgreader/svgsvgnode.cxx index 396dc33dcf8a..7e03f75cf812 100644 --- a/svgio/source/svgreader/svgsvgnode.cxx +++ b/svgio/source/svgreader/svgsvgnode.cxx @@ -606,55 +606,51 @@ namespace svgio // initially despite I found various examples of Svg files out there // which have no correct values for this clipping. It's correct // due to the Svg spec. - bool bDoCorrectCanvasClipping(true); - if(bDoCorrectCanvasClipping) - { - // different from Svg we have the possibility with primitives to get - // a correct bounding box for the geometry. Get it for evtl. taking action - const basegfx::B2DRange aContentRange( - aSequence.getB2DRange( - drawinglayer::geometry::ViewInformation2D())); + // different from Svg we have the possibility with primitives to get + // a correct bounding box for the geometry. Get it for evtl. taking action + const basegfx::B2DRange aContentRange( + aSequence.getB2DRange( + drawinglayer::geometry::ViewInformation2D())); - if(aSvgCanvasRange.isInside(aContentRange)) - { - // no clip needed, but an invisible HiddenGeometryPrimitive2D - // to allow getting the full Svg range using the primitive mechanisms. - // This is needed since e.g. an SdrObject using this as graphic will - // create a mapping transformation to exactly map the content to its - // real life size - const drawinglayer::primitive2d::Primitive2DReference xLine( - new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( + if(aSvgCanvasRange.isInside(aContentRange)) + { + // no clip needed, but an invisible HiddenGeometryPrimitive2D + // to allow getting the full Svg range using the primitive mechanisms. + // This is needed since e.g. an SdrObject using this as graphic will + // create a mapping transformation to exactly map the content to its + // real life size + const drawinglayer::primitive2d::Primitive2DReference xLine( + new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( + basegfx::tools::createPolygonFromRect( + aSvgCanvasRange), + basegfx::BColor(0.0, 0.0, 0.0))); + const drawinglayer::primitive2d::Primitive2DReference xHidden( + new drawinglayer::primitive2d::HiddenGeometryPrimitive2D( + drawinglayer::primitive2d::Primitive2DContainer { xLine })); + + aSequence.push_back(xHidden); + } + else if(aSvgCanvasRange.overlaps(aContentRange)) + { + // Clip is necessary. This will make Svg images evtl. smaller + // than wanted from Svg (the free space which may be around it is + // conform to the Svg spec), but avoids an expensive and unnecessary + // clip. Keep the full Svg range here to get the correct mappings + // to objects using this. Optimizations can be done in the processors + const drawinglayer::primitive2d::Primitive2DReference xMask( + new drawinglayer::primitive2d::MaskPrimitive2D( + basegfx::B2DPolyPolygon( basegfx::tools::createPolygonFromRect( - aSvgCanvasRange), - basegfx::BColor(0.0, 0.0, 0.0))); - const drawinglayer::primitive2d::Primitive2DReference xHidden( - new drawinglayer::primitive2d::HiddenGeometryPrimitive2D( - drawinglayer::primitive2d::Primitive2DContainer { xLine })); - - aSequence.push_back(xHidden); - } - else if(aSvgCanvasRange.overlaps(aContentRange)) - { - // Clip is necessary. This will make Svg images evtl. smaller - // than wanted from Svg (the free space which may be around it is - // conform to the Svg spec), but avoids an expensive and unnecessary - // clip. Keep the full Svg range here to get the correct mappings - // to objects using this. Optimizations can be done in the processors - const drawinglayer::primitive2d::Primitive2DReference xMask( - new drawinglayer::primitive2d::MaskPrimitive2D( - basegfx::B2DPolyPolygon( - basegfx::tools::createPolygonFromRect( - aSvgCanvasRange)), - aSequence)); + aSvgCanvasRange)), + aSequence)); - aSequence = drawinglayer::primitive2d::Primitive2DContainer { xMask }; - } - else - { - // not inside, no overlap. Empty Svg - aSequence.clear(); - } + aSequence = drawinglayer::primitive2d::Primitive2DContainer { xMask }; + } + else + { + // not inside, no overlap. Empty Svg + aSequence.clear(); } if(!aSequence.empty()) diff --git a/svl/qa/unit/items/test_IndexedStyleSheets.cxx b/svl/qa/unit/items/test_IndexedStyleSheets.cxx index 6560e7de6832..d7cccebaa833 100644 --- a/svl/qa/unit/items/test_IndexedStyleSheets.cxx +++ b/svl/qa/unit/items/test_IndexedStyleSheets.cxx @@ -73,10 +73,8 @@ void IndexedStyleSheetsTest::InstantiationWorks() void IndexedStyleSheetsTest::AddedStylesheetsCanBeFoundAndRetrievedByPosition() { - rtl::OUString name1("name1"); - rtl::OUString name2("name2"); - rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet(name1)); - rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet(name2)); + rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet("name1")); + rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet("name2")); IndexedStyleSheets iss; iss.AddStyleSheet(sheet1); iss.AddStyleSheet(sheet2); @@ -97,10 +95,8 @@ void IndexedStyleSheetsTest::AddingSameStylesheetTwiceHasNoEffect() void IndexedStyleSheetsTest::RemovedStyleSheetIsNotFound() { - rtl::OUString name1("name1"); - rtl::OUString name2("name2"); - rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet(name1)); - rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet(name2)); + rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet("name1")); + rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet("name2")); IndexedStyleSheets iss; iss.AddStyleSheet(sheet1); iss.AddStyleSheet(sheet2); @@ -147,8 +143,8 @@ void IndexedStyleSheetsTest::StyleSheetsCanBeRetrievedByTheirName() void IndexedStyleSheetsTest::KnowsThatItStoresAStyleSheet() { - rtl::OUString name1("name1"); - rtl::OUString name2("name2"); + rtl::OUString const name1("name1"); + rtl::OUString const name2("name2"); rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet(name1)); rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet(name1)); rtl::Reference<SfxStyleSheetBase> sheet3(new MockedStyleSheet(name2)); @@ -169,12 +165,9 @@ void IndexedStyleSheetsTest::KnowsThatItStoresAStyleSheet() void IndexedStyleSheetsTest::PositionCanBeQueriedByFamily() { - rtl::OUString name1("name1"); - rtl::OUString name2("name2"); - rtl::OUString name3("name3"); - rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet(name1, SfxStyleFamily::Char)); - rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet(name2, SfxStyleFamily::Para)); - rtl::Reference<SfxStyleSheetBase> sheet3(new MockedStyleSheet(name3, SfxStyleFamily::Char)); + rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet("name1", SfxStyleFamily::Char)); + rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet("name2", SfxStyleFamily::Para)); + rtl::Reference<SfxStyleSheetBase> sheet3(new MockedStyleSheet("name3", SfxStyleFamily::Char)); IndexedStyleSheets iss; iss.AddStyleSheet(sheet1); diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx index 10fcbd5672b6..c8b030dc3e00 100644 --- a/svl/qa/unit/svl.cxx +++ b/svl/qa/unit/svl.cxx @@ -317,7 +317,7 @@ void Test::testSharedStringPool() CPPUNIT_ASSERT_EQUAL(p1.getData(), p2.getData()); // Test case insensitive string ID's. - OUString aAndyLower("andy"), aAndyUpper("ANDY"); + OUString const aAndyLower("andy"), aAndyUpper("ANDY"); p1 = aPool.intern(aAndy); p2 = aPool.intern(aAndyLower); CPPUNIT_ASSERT_MESSAGE("Failed to intern strings.", p1.getData() && p2.getData()); diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx index 9ca3cd228ffe..01df7112802a 100644 --- a/svl/source/fsstor/fsstorage.cxx +++ b/svl/source/fsstor/fsstorage.cxx @@ -189,11 +189,10 @@ void FSStorage::CopyContentToStorage_Impl( ::ucbhelper::Content* pContent, const OUString* pProps = aProps.getArray(); pProps[0] = "TargetURL"; pProps[1] = "IsFolder"; - ::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS; try { - uno::Reference< sdbc::XResultSet > xResultSet = pContent->createCursor( aProps, eInclude ); + uno::Reference< sdbc::XResultSet > xResultSet = pContent->createCursor( aProps, ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS ); uno::Reference< sdbc::XRow > xRow( xResultSet, uno::UNO_QUERY ); if ( xResultSet.is() ) { @@ -918,10 +917,9 @@ uno::Sequence< OUString > SAL_CALL FSStorage::getElementNames() throw io::IOException(); // TODO: error handling uno::Sequence<OUString> aProps { "Title" }; - ::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS; sal_Int32 nSize = 0; - uno::Reference< sdbc::XResultSet > xResultSet = GetContent()->createCursor( aProps, eInclude ); + uno::Reference< sdbc::XResultSet > xResultSet = GetContent()->createCursor( aProps, ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS ); uno::Reference< sdbc::XRow > xRow( xResultSet, uno::UNO_QUERY ); if ( xResultSet.is() ) { @@ -1019,9 +1017,8 @@ sal_Bool SAL_CALL FSStorage::hasElements() throw io::IOException(); // TODO: error handling uno::Sequence<OUString> aProps { "TargetURL" }; - ::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS; - uno::Reference< sdbc::XResultSet > xResultSet = GetContent()->createCursor( aProps, eInclude ); + uno::Reference< sdbc::XResultSet > xResultSet = GetContent()->createCursor( aProps, ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS ); return ( xResultSet.is() && xResultSet->next() ); } catch (const uno::RuntimeException&) diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index eaed9780e490..8347d6a50049 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -1104,8 +1104,7 @@ sal_Bool SAL_CALL PasswordContainer::changeMasterPassword( const uno::Reference< if ( bCanChangePassword ) { // ask for the new password, but do not set it - PasswordRequestMode aRMode = PasswordRequestMode_PASSWORD_CREATE; - OUString aPass = RequestPasswordFromUser( aRMode, xTmpHandler ); + OUString aPass = RequestPasswordFromUser( PasswordRequestMode_PASSWORD_CREATE, xTmpHandler ); if ( !aPass.isEmpty() ) { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
