summaryrefslogtreecommitdiff
path: root/svtools/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-06-26 14:47:31 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-27 08:43:07 +0200
commitc937c6828784260f3536a37f8e297dc721a7d974 (patch)
treee04b2459294d785134cebca133bb324f07db14af /svtools/source
parent8dca2d5ac740f262b045f6529bd8e97af0ec9c47 (diff)
loplugin:oncevar in svtools
Change-Id: Ic97e75c81a0c00853d2f10aaf182ab476c466c86 Reviewed-on: https://gerrit.libreoffice.org/39281 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools/source')
-rw-r--r--svtools/source/config/colorcfg.cxx3
-rw-r--r--svtools/source/config/extcolorcfg.cxx15
-rw-r--r--svtools/source/contnr/contentenumeration.cxx3
-rw-r--r--svtools/source/contnr/fileview.cxx8
-rw-r--r--svtools/source/contnr/iconviewimpl.cxx4
-rw-r--r--svtools/source/contnr/imivctl1.cxx2
-rw-r--r--svtools/source/contnr/svimpbox.cxx4
-rw-r--r--svtools/source/contnr/svlbitm.cxx5
-rw-r--r--svtools/source/control/toolbarmenu.cxx10
-rw-r--r--svtools/source/control/valueacc.cxx5
-rw-r--r--svtools/source/control/vclxaccessibleheaderbaritem.cxx28
-rw-r--r--svtools/source/dialogs/addresstemplate.cxx3
-rw-r--r--svtools/source/dialogs/insdlg.cxx5
-rw-r--r--svtools/source/filter/SvFilterOptionsDialog.cxx3
-rw-r--r--svtools/source/misc/unitconv.cxx3
-rw-r--r--svtools/source/svrtf/rtfout.cxx2
-rw-r--r--svtools/source/table/tablecontrol_impl.cxx6
17 files changed, 34 insertions, 75 deletions
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);
}
}