[Libreoffice-commits] core.git: cui/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Jun 20 08:41:18 UTC 2017


 cui/source/customize/acccfg.cxx          |    7 ++-----
 cui/source/customize/cfg.cxx             |    3 +--
 cui/source/customize/cfgutil.cxx         |    4 +---
 cui/source/customize/macropg.cxx         |    8 ++------
 cui/source/dialogs/cuigaldlg.cxx         |    8 ++------
 cui/source/dialogs/hangulhanjadlg.cxx    |    2 +-
 cui/source/dialogs/hldoctp.cxx           |    3 +--
 cui/source/dialogs/iconcdlg.cxx          |    2 +-
 cui/source/dialogs/multipat.cxx          |    7 ++-----
 cui/source/dialogs/scriptdlg.cxx         |    2 +-
 cui/source/options/certpath.cxx          |    3 +--
 cui/source/options/optchart.cxx          |    2 +-
 cui/source/options/optgdlg.cxx           |    9 +++------
 cui/source/options/optinet2.cxx          |    4 +---
 cui/source/tabpages/backgrnd.cxx         |    3 +--
 cui/source/tabpages/border.cxx           |    2 +-
 cui/source/tabpages/chardlg.cxx          |    7 ++-----
 cui/source/tabpages/macroass.cxx         |    8 ++------
 cui/source/tabpages/numpages.cxx         |   12 ++++--------
 cui/source/tabpages/swpossizetabpage.cxx |    7 ++-----
 20 files changed, 32 insertions(+), 71 deletions(-)

New commits:
commit 27fa7eff1d06914750fbda2582c655ddbb21dfa3
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Jun 20 09:26:50 2017 +0200

    loplugin:oncevar in cui
    
    Change-Id: I1bbd37a82f238327b5e52110c62cdd2a9b0a9c14
    Reviewed-on: https://gerrit.libreoffice.org/39001
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index ebfc9e0b2014..b80b6e054455 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -931,16 +931,13 @@ void SfxAcceleratorConfigPage::Init(const uno::Reference<ui::XAcceleratorConfigu
     // Insert all editable accelerators into list box. It is possible
     // that some accelerators are not mapped on the current system/keyboard
     // but we don't want to lose these mappings.
-    sal_Int32 c1 = KEYCODE_ARRAY_SIZE;
-    sal_Int32 i1  = 0;
-    sal_Int32 nListPos = 0;
-    for (i1 = 0; i1 < c1; ++i1)
+    for (sal_Int32 i1 = 0; i1 < KEYCODE_ARRAY_SIZE; ++i1)
     {
         vcl::KeyCode aKey = KEYCODE_ARRAY[i1];
         OUString sKey = aKey.GetName();
         if (sKey.isEmpty())
             continue;
-        TAccInfo*    pEntry   = new TAccInfo(i1, nListPos, aKey);
+        TAccInfo*    pEntry   = new TAccInfo(i1, 0/*nListPos*/, aKey);
         SvTreeListEntry* pLBEntry = m_pEntriesBox->InsertEntryToColumn(sKey, nullptr, TREELIST_APPEND, 0xFFFF);
         pLBEntry->SetUserData(pEntry);
     }
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 5a535bd1acd8..90545756487c 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -5387,13 +5387,12 @@ void SvxIconSelectorDialog::ImportGraphics(
     if ( rejectedCount != 0 )
     {
         OUString message;
-        OUString newLine("\n");
         OUString fPath;
         if (rejectedCount > 1)
               fPath = rPaths[0].copy(8) + "/";
         for ( sal_Int32 i = 0; i < rejectedCount; ++i )
         {
-            message += fPath + rejected[i] + newLine;
+            message += fPath + rejected[i] + "\n";
         }
 
         ScopedVclPtrInstance< SvxIconChangeDialog > aDialog(this, message);
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index d81813ee8193..6e2019ba1ce8 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -751,9 +751,7 @@ Image SfxConfigGroupListBox::GetImage(
     Image aImage;
     if ( bIsRootNode )
     {
-        OUString user("user");
-        OUString share("share");
-        if (node->getName().equals( user ) || node->getName().equals(share ) )
+        if (node->getName() == "user" || node->getName() == "share" )
         {
             aImage = xImp->m_hdImage;
         }
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
index 1175bd9ec45e..60140c901c79 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -561,10 +561,8 @@ IMPL_LINK_NOARG( SvxMacroTabPage_, SelectEvent_Impl, SvTreeListBox*, void)
 {
     SvHeaderTabListBox&        rListBox = mpImpl->pEventLB->GetListBox();
     SvTreeListEntry*           pE = rListBox.FirstSelected();
-    sal_uLong                  nPos;
 
-    if( !pE || LISTBOX_ENTRY_NOTFOUND ==
-        ( nPos = rListBox.GetModel()->GetAbsPos( pE ) ) )
+    if( !pE || LISTBOX_ENTRY_NOTFOUND == rListBox.GetModel()->GetAbsPos( pE ) )
     {
         DBG_ASSERT( pE, "Where does the empty entry come from?" );
         return;
@@ -589,9 +587,7 @@ long SvxMacroTabPage_::GenericHandler_Impl( SvxMacroTabPage_* pThis, PushButton*
     SvxMacroTabPage_Impl*    pImpl = pThis->mpImpl;
     SvHeaderTabListBox& rListBox = pImpl->pEventLB->GetListBox();
     SvTreeListEntry* pE = rListBox.FirstSelected();
-    sal_uLong nPos;
-    if( !pE || LISTBOX_ENTRY_NOTFOUND ==
-        ( nPos = rListBox.GetModel()->GetAbsPos( pE ) ) )
+    if( !pE || LISTBOX_ENTRY_NOTFOUND == rListBox.GetModel()->GetAbsPos( pE ) )
     {
         DBG_ASSERT( pE, "Where does the empty entry come from?" );
         return 0;
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index cb01345bbf7e..0e59258bf288 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -806,14 +806,10 @@ VclPtr<SfxTabPage> TPGalleryThemeProperties::Create( vcl::Window* pParent, const
 
 OUString TPGalleryThemeProperties::addExtension( const OUString& _rDisplayText, const OUString& _rExtension )
 {
-    OUString sAllFilter( "(*.*)" );
-    OUString sOpenBracket( " (" );
-    OUString sCloseBracket( ")" );
     OUString sRet = _rDisplayText;
-
-    if ( sRet.indexOf( sAllFilter ) == -1 )
+    if ( sRet.indexOf( "(*.*)" ) == -1 )
     {
-        sRet += sOpenBracket + _rExtension + sCloseBracket;
+        sRet += " (" + _rExtension + ")";
     }
     return sRet;
 }
diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
index 9ef0d6f6261b..4b23004e5888 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -371,7 +371,7 @@ namespace svx
         m_aValueSet->SetLineCount( LINE_CNT );
         m_aValueSet->SetStyle( m_aValueSet->GetStyle() | WB_ITEMBORDER | WB_FLATVALUESET | WB_VSCROLL );
         m_aValueSet->SetBorderStyle( WindowBorderStyle::MONO );
-        OUString aOneCharacter("AU");
+        OUString const aOneCharacter("AU");
         long nItemWidth = 2*GetTextWidth( aOneCharacter );
         m_aValueSet->SetItemWidth( nItemWidth );
 
diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx
index 92c4e64a3602..a5811165c65a 100644
--- a/cui/source/dialogs/hldoctp.cxx
+++ b/cui/source/dialogs/hldoctp.cxx
@@ -59,8 +59,7 @@ SvxHyperlinkDocTp::SvxHyperlinkDocTp ( vcl::Window *pParent, IconChoiceDialog* p
     InitStdControls();
 
     m_pCbbPath->Show();
-    OUString aFileScheme( INET_FILE_SCHEME );
-    m_pCbbPath->SetBaseURL(aFileScheme);
+    m_pCbbPath->SetBaseURL(INET_FILE_SCHEME);
     m_pCbbPath->SetHelpId( HID_HYPERDLG_DOC_PATH );
 
     SetExchangeSupport ();
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx
index 7d03d02f8d77..70a1b87afc10 100644
--- a/cui/source/dialogs/iconcdlg.cxx
+++ b/cui/source/dialogs/iconcdlg.cxx
@@ -275,7 +275,7 @@ SvxIconChoiceCtrlEntry* IconChoiceDialog::AddTabPage(
 
 void IconChoiceDialog::SetCtrlStyle()
 {
-    WinBits aWinBits = WB_3DLOOK | WB_ICON | WB_BORDER | WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME | WB_NODRAGSELECTION | WB_TABSTOP | WB_CLIPCHILDREN | WB_ALIGN_LEFT | WB_NOHSCROLL;
+    WinBits const aWinBits = WB_3DLOOK | WB_ICON | WB_BORDER | WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME | WB_NODRAGSELECTION | WB_TABSTOP | WB_CLIPCHILDREN | WB_ALIGN_LEFT | WB_NOHSCROLL;
     m_pIconCtrl->SetStyle(aWinBits);
     m_pIconCtrl->ArrangeIcons();
 }
diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx
index 0bdc805d7381..c4da4b668a85 100644
--- a/cui/source/dialogs/multipat.cxx
+++ b/cui/source/dialogs/multipat.cxx
@@ -288,12 +288,11 @@ OUString SvxMultiPathDialog::GetPath() const
 OUString SvxPathSelectDialog::GetPath() const
 {
     OUString sNewPath;
-    sal_Unicode cDelim = SVT_SEARCHPATH_DELIMITER;
 
     for ( sal_Int32 i = 0; i < m_pPathLB->GetEntryCount(); ++i )
     {
         if ( !sNewPath.isEmpty() )
-            sNewPath += OUStringLiteral1(cDelim);
+            sNewPath += OUStringLiteral1(SVT_SEARCHPATH_DELIMITER);
         sNewPath += *static_cast<OUString*>(m_pPathLB->GetEntryData(i));
     }
 
@@ -335,14 +334,12 @@ void SvxMultiPathDialog::SetPath( const OUString& rPath )
 
 void SvxPathSelectDialog::SetPath(const OUString& rPath)
 {
-    sal_Unicode cDelim = SVT_SEARCHPATH_DELIMITER;
-
     if ( !rPath.isEmpty() )
     {
         sal_Int32 nIndex = 0;
         do
         {
-            const OUString sPath = rPath.getToken( 0, cDelim, nIndex );
+            const OUString sPath = rPath.getToken( 0, SVT_SEARCHPATH_DELIMITER, nIndex );
             OUString sSystemPath;
             bool bIsSystemPath =
                 osl::FileBase::getSystemPathFromFileURL(sPath, sSystemPath) == osl::FileBase::E_None;
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index 82ccd5666915..be35fb37e545 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -166,7 +166,7 @@ void SFTreeListBox::Init( const OUString& language  )
     Sequence< Reference< browse::XBrowseNode > > children;
 
     OUString userStr("user");
-    OUString shareStr("share");
+    OUString const shareStr("share");
 
     try
     {
diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx
index 08c6470e4f44..a19e075ad6f9 100644
--- a/cui/source/options/certpath.cxx
+++ b/cui/source/options/certpath.cxx
@@ -66,11 +66,10 @@ CertPathDialog::CertPathDialog(vcl::Window* pParent)
             "thunderbird",
             "firefox",
             "mozilla" };
-        sal_Int32 nProduct = SAL_N_ELEMENTS(productTypes);
 
         uno::Reference<mozilla::XMozillaBootstrap> xMozillaBootstrap = mozilla::MozillaBootstrap::create( comphelper::getProcessComponentContext() );
 
-        for (sal_Int32 i = 0; i < nProduct; ++i)
+        for (sal_Int32 i = 0; i < sal_Int32(SAL_N_ELEMENTS(productTypes)); ++i)
         {
             OUString profile = xMozillaBootstrap->getDefaultProfile(productTypes[i]);
 
diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx
index c8b8865d5c90..00ba47e4e0b9 100644
--- a/cui/source/options/optchart.cxx
+++ b/cui/source/options/optchart.cxx
@@ -272,7 +272,7 @@ IMPL_LINK_NOARG(SvxDefaultColorOptPage, AddChartColor, Button*, void)
 {
     if( pColorConfig )
     {
-        ColorData black = RGB_COLORDATA( 0x00, 0x00, 0x00 );
+        ColorData const black = RGB_COLORDATA( 0x00, 0x00, 0x00 );
 
         pColorConfig->GetColorList().append (XColorEntry ( black, pColorConfig->GetColorList().getDefaultName(pColorConfig->GetColorList().size())));
 
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 4e1bf3c5635a..b21e1c839f4b 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -1457,8 +1457,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
             Any aValue;
             Locale aLocale = LanguageTag::convertToLocale( eSelectLang, false);
             aValue <<= aLocale;
-            OUString aPropName( "DefaultLocale" );
-            pLangConfig->aLinguConfig.SetProperty( aPropName, aValue );
+            pLangConfig->aLinguConfig.SetProperty( "DefaultLocale", aValue );
             if (xLinguProp.is())
                 xLinguProp->setDefaultLocale( aLocale );
         }
@@ -1477,8 +1476,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
             Any aValue;
             Locale aLocale = LanguageTag::convertToLocale( eSelectLang, false);
             aValue <<= aLocale;
-            OUString aPropName( "DefaultLocale_CJK" );
-            pLangConfig->aLinguConfig.SetProperty( aPropName, aValue );
+            pLangConfig->aLinguConfig.SetProperty( "DefaultLocale_CJK", aValue );
             if (xLinguProp.is())
                 xLinguProp->setDefaultLocale_CJK( aLocale );
         }
@@ -1497,8 +1495,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
             Any aValue;
             Locale aLocale = LanguageTag::convertToLocale( eSelectLang, false);
             aValue <<= aLocale;
-            OUString aPropName( "DefaultLocale_CTL" );
-            pLangConfig->aLinguConfig.SetProperty( aPropName, aValue );
+            pLangConfig->aLinguConfig.SetProperty( "DefaultLocale_CTL", aValue );
             if (xLinguProp.is())
                 xLinguProp->setDefaultLocale_CTL( aLocale );
         }
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index ff8368e1b2fc..c28e7aecc901 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -197,11 +197,9 @@ SvxProxyTabPage::SvxProxyTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
             configuration::theDefaultProvider::get(
                 comphelper::getProcessComponentContext() ) );
 
-    OUString aConfigRoot( "org.openoffice.Inet/Settings" );
-
     beans::NamedValue aProperty;
     aProperty.Name  = "nodepath";
-    aProperty.Value <<= aConfigRoot;
+    aProperty.Value <<= OUString( "org.openoffice.Inet/Settings" );
 
     Sequence< Any > aArgumentList( 1 );
     aArgumentList[0] <<= aProperty;
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index b727860bc6f4..7d52eb2d5c20 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -578,8 +578,7 @@ void SvxBackgroundTabPage::ResetFromWallpaperItem( const SfxItemSet& rSet )
 
     // get and evaluate Input-BrushItem
     const SvxBrushItem* pBgdAttr = nullptr;
-    sal_uInt16 nSlot = SID_VIEW_FLD_PIC;
-    sal_uInt16 nWhich = GetWhich( nSlot );
+    sal_uInt16 nWhich = GetWhich( SID_VIEW_FLD_PIC );
     std::unique_ptr<SvxBrushItem> pTemp;
 
     if ( rSet.GetItemState( nWhich, false ) >= SfxItemState::DEFAULT )
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index eebd2eb35a8c..e6848ad3bd1a 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -1098,7 +1098,7 @@ void SvxBorderTabPage::FillLineListBox_Impl()
 
     m_pLbLineStyle->SetNone( SvxResId( RID_SVXSTR_NONE ) );
 
-    for (size_t i = 0, n = SAL_N_ELEMENTS(aLines); i < n; ++i)
+    for (size_t i = 0; i < SAL_N_ELEMENTS(aLines); ++i)
     {
         if (!IsBorderLineStyleAllowed(aLines[i].mnStyle))
             continue;
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 667e09955298..063a9baac2c5 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -2815,7 +2815,6 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
 
     short nEsc = 0;
     sal_uInt8 nEscProp = 100;
-    sal_uInt8 nProp = 100;
 
     m_pHighLowFT->Disable();
     m_pHighLowMF->Disable();
@@ -2893,7 +2892,7 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
     }
 
     // set BspFont
-    SetPrevFontEscapement( nProp, nEscProp, nEsc );
+    SetPrevFontEscapement( 100, nEscProp, nEsc );
 
     // Kerning
     nWhich = GetWhich( SID_ATTR_CHAR_KERNING );
@@ -2902,10 +2901,8 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
     {
         const SvxKerningItem& rItem = static_cast<const SvxKerningItem&>(rSet->Get( nWhich ));
         MapUnit eUnit = rSet->GetPool()->GetMetric( nWhich );
-        MapUnit eOrgUnit = eUnit;
-        MapUnit ePntUnit( MapUnit::MapPoint );
         long nBig = static_cast<long>(m_pKerningMF->Normalize( static_cast<long>(rItem.GetValue()) ));
-        long nKerning = LogicToLogic( nBig, eOrgUnit, ePntUnit );
+        long nKerning = LogicToLogic( nBig, eUnit, MapUnit::MapPoint );
 
         // set Kerning at the Font, convert into Twips before
         long nKern = LogicToLogic( rItem.GetValue(), eUnit, MapUnit::MapTwip );
diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx
index 7f92f19ecece..6742eceb4c87 100644
--- a/cui/source/tabpages/macroass.cxx
+++ b/cui/source/tabpages/macroass.cxx
@@ -278,9 +278,7 @@ IMPL_LINK_NOARG( SfxMacroTabPage, SelectEvent_Impl, SvTreeListBox*, void)
 {
     SvHeaderTabListBox&     rListBox = mpImpl->pEventLB->GetListBox();
     SvTreeListEntry*            pE = rListBox.FirstSelected();
-    sal_uLong                   nPos;
-    if( !pE || LISTBOX_ENTRY_NOTFOUND ==
-        ( nPos = rListBox.GetModel()->GetAbsPos( pE ) ) )
+    if( !pE || LISTBOX_ENTRY_NOTFOUND == rListBox.GetModel()->GetAbsPos( pE ) )
     {
         DBG_ASSERT( pE, "Where does the empty entry come from?" );
         return;
@@ -321,9 +319,7 @@ bool SfxMacroTabPage::AssignDeleteHdl(Control* pBtn)
 {
     SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox();
     SvTreeListEntry* pE = rListBox.FirstSelected();
-    sal_uLong nPos;
-    if( !pE || LISTBOX_ENTRY_NOTFOUND ==
-        ( nPos = rListBox.GetModel()->GetAbsPos( pE ) ) )
+    if( !pE || LISTBOX_ENTRY_NOTFOUND == rListBox.GetModel()->GetAbsPos( pE ) )
     {
         DBG_ASSERT( pE, "Where does the empty entry come from?" );
         return false;
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 0c3d313c8686..8d4da92cedf5 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -950,13 +950,12 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, NumSelectHdl_Impl, ValueSet*, void)
         sal_uInt16 nIdx = m_pExamplesVS->GetSelectItemId() - 1;
 
         sal_uInt16 nMask = 1;
-        SvxNumType nSetNumberingType = SVX_NUM_BITMAP;
         for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
         {
             if(nActNumLvl & nMask)
             {
                 SvxNumberFormat aFmt(pActNum->GetLevel(i));
-                aFmt.SetNumberingType(nSetNumberingType);
+                aFmt.SetNumberingType(SVX_NUM_BITMAP);
                 aFmt.SetPrefix( "" );
                 aFmt.SetSuffix( "" );
                 aFmt.SetCharFormatName( sNumCharFmtName );
@@ -1417,15 +1416,13 @@ void    SvxNumOptionsTabPage::Reset( const SfxItemSet* rSet )
     //one must be enabled
     if(!pActNum->IsFeatureSupported(SvxNumRuleFlags::ENABLE_LINKED_BMP))
     {
-        sal_IntPtr nData = SVX_NUM_BITMAP|LINK_TOKEN;
-        sal_Int32 nPos = m_pFmtLB->GetEntryPos(reinterpret_cast<void*>(nData));
+        sal_Int32 nPos = m_pFmtLB->GetEntryPos(reinterpret_cast<void*>(SVX_NUM_BITMAP|LINK_TOKEN));
         if(LISTBOX_ENTRY_NOTFOUND != nPos)
             m_pFmtLB->RemoveEntry(nPos);
     }
     else if(!pActNum->IsFeatureSupported(SvxNumRuleFlags::ENABLE_EMBEDDED_BMP))
     {
-        sal_IntPtr nData = SVX_NUM_BITMAP;
-        sal_Int32 nPos = m_pFmtLB->GetEntryPos(reinterpret_cast<void*>(nData));
+        sal_Int32 nPos = m_pFmtLB->GetEntryPos(reinterpret_cast<void*>(SVX_NUM_BITMAP));
         if(LISTBOX_ENTRY_NOTFOUND != nPos)
             m_pFmtLB->RemoveEntry(nPos);
     }
@@ -2534,8 +2531,7 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tool
         else
         {
             //#i5153# painting gray or black rectangles as 'normal' numbering text
-            OUString sMsg("Preview");
-            long nWidth = pVDev->GetTextWidth(sMsg);
+            long nWidth = pVDev->GetTextWidth("Preview");
             long nTextHeight = pVDev->GetTextHeight();
             long nRectHeight = nTextHeight * 2 / 3;
             long nTopOffset = nTextHeight - nRectHeight;
diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx
index 2bad725b2524..63af938d9a91 100644
--- a/cui/source/tabpages/swpossizetabpage.cxx
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -1687,7 +1687,6 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap *pMap, sal_uInt16 nMapPos, sal_uInt16
         if (pMap == aVAsCharHtmlMap || pMap == aVAsCharMap)
         {
             OUString sOldEntry(rLB.GetSelectEntry());
-            sal_uInt16 nRelCount = SAL_N_ELEMENTS(aAsCharRelationMap);
             SvxSwFramePosString::StringId eStrId = pMap[nMapPos].eStrId;
 
             for (std::size_t _nMapPos = 0; _nMapPos < nMapCount; _nMapPos++)
@@ -1695,7 +1694,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap *pMap, sal_uInt16 nMapPos, sal_uInt16
                 if (pMap[_nMapPos].eStrId == eStrId)
                 {
                     nLBRelations = pMap[_nMapPos].nLBRelations;
-                    for (sal_uInt16 nRelPos = 0; nRelPos < nRelCount; nRelPos++)
+                    for (sal_uInt16 nRelPos = 0; nRelPos < SAL_N_ELEMENTS(aAsCharRelationMap); nRelPos++)
                     {
                         if (nLBRelations & aAsCharRelationMap[nRelPos].nLBRelation)
                         {
@@ -1734,8 +1733,6 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap *pMap, sal_uInt16 nMapPos, sal_uInt16
         }
         else
         {
-            sal_uInt16 nRelCount = SAL_N_ELEMENTS(aRelationMap);
-
             // #i22341# - special handling for map <aVCharMap>,
             // because its ambiguous in its <eStrId>/<eMirrorStrId>.
             if ( pMap == aVCharMap )
@@ -1755,7 +1752,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap *pMap, sal_uInt16 nMapPos, sal_uInt16
             {
                 if (nLBRelations & (LB)nBit)
                 {
-                    for (sal_uInt16 nRelPos = 0; nRelPos < nRelCount; nRelPos++)
+                    for (sal_uInt16 nRelPos = 0; nRelPos < SAL_N_ELEMENTS(aRelationMap); nRelPos++)
                     {
                         if (aRelationMap[nRelPos].nLBRelation == (LB)nBit)
                         {


More information about the Libreoffice-commits mailing list