[Libreoffice-commits] core.git: include/sfx2 sfx2/source shell/source sot/source

Noel Grandin noel.grandin at collabora.co.uk
Fri May 18 11:01:04 UTC 2018


 include/sfx2/new.hxx                   |    1 -
 include/sfx2/prnmon.hxx                |    1 -
 include/sfx2/recentdocsview.hxx        |    1 -
 include/sfx2/unoctitm.hxx              |    2 --
 sfx2/source/appl/newhelp.hxx           |    2 +-
 sfx2/source/appl/sfxpicklist.cxx       |   13 +++++--------
 sfx2/source/appl/workwin.cxx           |    3 +--
 sfx2/source/bastyp/fltfnc.cxx          |    2 --
 sfx2/source/control/recentdocsview.cxx |    3 +--
 sfx2/source/control/unoctitm.cxx       |    9 +++------
 sfx2/source/dialog/infobar.cxx         |    4 ++--
 sfx2/source/doc/new.cxx                |    3 +--
 sfx2/source/inc/sfxpicklist.hxx        |    3 ++-
 sfx2/source/inc/workwin.hxx            |    1 -
 sfx2/source/notify/globalevents.cxx    |    5 +----
 sfx2/source/view/printer.cxx           |    3 +--
 shell/source/unix/exec/shellexec.cxx   |   15 ---------------
 shell/source/unix/exec/shellexec.hxx   |    1 -
 sot/source/sdstor/stgavl.cxx           |    6 ++++--
 sot/source/sdstor/stgavl.hxx           |    1 -
 20 files changed, 22 insertions(+), 57 deletions(-)

New commits:
commit 9fa32e5dce345dea17129587c401c03520fb398b
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed May 16 11:54:52 2018 +0200

    loplugin:unusedfields in sfx2
    
    and fix leak of HelpListener_Impl in SfxHelpWindow_Impl
    
    Change-Id: I7450be10c8deaf63b7c7f1f4359b4eaf0083bdd4
    Reviewed-on: https://gerrit.libreoffice.org/54451
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/sfx2/new.hxx b/include/sfx2/new.hxx
index e7c355db1341..4eb1fa8d48c3 100644
--- a/include/sfx2/new.hxx
+++ b/include/sfx2/new.hxx
@@ -69,7 +69,6 @@ private:
     std::unique_ptr<SfxPreviewWin_Impl> m_xPreviewWin;
     std::unique_ptr<weld::Label> m_xAltTitleFt;
     Idle m_aPrevIdle;
-    OUString m_sLoadTemplate;
 
     SfxNewFileDialogMode m_nFlags;
     SfxDocumentTemplates m_aTemplates;
diff --git a/include/sfx2/prnmon.hxx b/include/sfx2/prnmon.hxx
index 66dec0442723..e66d17b73f1d 100644
--- a/include/sfx2/prnmon.hxx
+++ b/include/sfx2/prnmon.hxx
@@ -34,7 +34,6 @@ class SfxPrintOptionsDialog : public weld::GenericDialogController
 {
 private:
     std::unique_ptr<SfxPrintOptDlg_Impl>   pDlgImpl;
-    SfxViewShell*           pViewSh;
     std::unique_ptr<SfxItemSet>            pOptions;
     VclPtr<SfxTabPage>      pPage;
     std::unique_ptr<weld::Widget>    m_xHelpBtn;
diff --git a/include/sfx2/recentdocsview.hxx b/include/sfx2/recentdocsview.hxx
index a2d2f8ad86d8..a22dae2d6e87 100644
--- a/include/sfx2/recentdocsview.hxx
+++ b/include/sfx2/recentdocsview.hxx
@@ -87,7 +87,6 @@ private:
     long mnItemMaxSize;
     long mnTextHeight;
     long mnItemPadding;
-    long mnItemMaxTextLength;
     size_t mnLastMouseDownItem;
 
     /// Image that appears when there is no recent document.
diff --git a/include/sfx2/unoctitm.hxx b/include/sfx2/unoctitm.hxx
index 7f64e5a393d2..81a9ea1a698a 100644
--- a/include/sfx2/unoctitm.hxx
+++ b/include/sfx2/unoctitm.hxx
@@ -107,11 +107,9 @@ class SfxDispatchController_Impl : public SfxControllerItem
     SfxDispatcher*              pDispatcher;
     SfxBindings*                pBindings;
     const SfxPoolItem*          pLastState;
-    sal_uInt16                  nSlot;
     SfxOfficeDispatch*          pDispatch;
     bool                        bMasterSlave;
     bool                        bVisible;
-    const char*                 pUnoName;
     css::uno::WeakReference< css::frame::XFrame > xFrame;
 
     static void         addParametersToArgs( const css::util::URL& aURL,
diff --git a/sfx2/source/appl/newhelp.hxx b/sfx2/source/appl/newhelp.hxx
index 48213720b426..ab95c195ec77 100644
--- a/sfx2/source/appl/newhelp.hxx
+++ b/sfx2/source/appl/newhelp.hxx
@@ -503,7 +503,7 @@ friend class SfxHelpIndexWindow_Impl;
     VclPtr<SfxHelpIndexWindow_Impl>    pIndexWin;
     VclPtr<SfxHelpTextWindow_Impl>     pTextWin;
     HelpInterceptor_Impl*       pHelpInterceptor;
-    HelpListener_Impl*          pHelpListener;
+    std::unique_ptr<HelpListener_Impl> pHelpListener;
 
     sal_Int32           nExpandWidth;
     sal_Int32           nCollapseWidth;
diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx
index cb9b54426d2b..c243dac224e3 100644
--- a/sfx2/source/appl/sfxpicklist.cxx
+++ b/sfx2/source/appl/sfxpicklist.cxx
@@ -84,7 +84,6 @@ namespace
 class SfxPickListImpl : public SfxListener
 {
 private:
-    sal_uInt32 m_nAllowedMenuSize;
     css::uno::Reference< css::util::XStringWidth > m_xStringLength;
 
     /**
@@ -95,7 +94,7 @@ private:
     static void         AddDocumentToPickList( SfxObjectShell* pDocShell );
 
 public:
-    SfxPickListImpl(sal_uInt32 nMenuSize);
+    SfxPickListImpl();
     virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
 };
 
@@ -178,8 +177,8 @@ void SfxPickListImpl::AddDocumentToPickList( SfxObjectShell* pDocSh )
                                                                  pFilter ? pFilter->GetServiceName() : OUString() );
 }
 
-SfxPickList::SfxPickList(sal_uInt32 nAllowedMenuSize)
-    : mxImpl(new SfxPickListImpl(nAllowedMenuSize))
+SfxPickList::SfxPickList()
+    : mxImpl(new SfxPickListImpl())
 {
 }
 
@@ -191,14 +190,12 @@ SfxPickList::~SfxPickList()
 
 void SfxPickList::ensure()
 {
-    static SfxPickList aUniqueInstance(SvtHistoryOptions().GetSize(ePICKLIST));
+    static SfxPickList aUniqueInstance;
 }
 
-SfxPickListImpl::SfxPickListImpl( sal_uInt32 nAllowedMenuSize ) :
-    m_nAllowedMenuSize( nAllowedMenuSize )
+SfxPickListImpl::SfxPickListImpl()
 {
     m_xStringLength = new StringLength;
-    m_nAllowedMenuSize = ::std::min( m_nAllowedMenuSize, sal_uInt32(PICKLIST_MAXSIZE) );
     StartListening( *SfxGetpApp() );
 }
 
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index fc0b94c37e1b..20ad05d51573 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -460,7 +460,6 @@ SfxWorkWindow::SfxWorkWindow( vcl::Window *pWin, SfxFrame *pFrm, SfxFrame* pMast
     pParent( nullptr ),
     pBindings(&pFrm->GetCurrentViewFrame()->GetBindings()),
     pWorkWin (pWin),
-    pConfigShell( nullptr ),
     pActiveChild( nullptr ),
     nUpdateMode(SfxVisibilityFlags::Standard),
     nChildren( 0 ),
@@ -499,7 +498,7 @@ SfxWorkWindow::SfxWorkWindow( vcl::Window *pWin, SfxFrame *pFrm, SfxFrame* pMast
                                   css::uno::UNO_QUERY );
     pLayoutManagerListener->setFrame( xFrame );
 
-    pConfigShell = pFrm->GetCurrentViewFrame();
+    SfxShell* pConfigShell = pFrm->GetCurrentViewFrame();
     if ( pConfigShell && pConfigShell->GetObjectShell() )
     {
         bShowStatusBar = ( !pConfigShell->GetObjectShell()->IsInPlaceActive() );
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx
index c4eca2d5b0d8..58ec1f7ac2a5 100644
--- a/sfx2/source/bastyp/fltfnc.cxx
+++ b/sfx2/source/bastyp/fltfnc.cxx
@@ -127,12 +127,10 @@ class SfxFilterContainer_Impl
 {
 public:
     OUString            aName;
-    OUString            aServiceName;
 
     explicit SfxFilterContainer_Impl( const OUString& rName )
         : aName( rName )
     {
-        aServiceName = SfxObjectShell::GetServiceNameFromFactory( rName );
     }
 };
 
diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx
index 31591e3db568..cecebe60a496 100644
--- a/sfx2/source/control/recentdocsview.cxx
+++ b/sfx2/source/control/recentdocsview.cxx
@@ -119,7 +119,6 @@ RecentDocsView::RecentDocsView( vcl::Window* pParent )
     , mnFileTypes(ApplicationType::TYPE_NONE)
     , mnTextHeight(30)
     , mnItemPadding(5)
-    , mnItemMaxTextLength(30)
     , mnLastMouseDownItem(THUMBNAILVIEW_ITEM_NOTFOUND)
     , maWelcomeImage(BitmapEx(BMP_WELCOME))
     , maWelcomeLine1(SfxResId(STR_WELCOME_LINE1))
@@ -129,7 +128,7 @@ RecentDocsView::RecentDocsView( vcl::Window* pParent )
     mnItemMaxSize = std::min(aScreen.GetWidth(),aScreen.GetHeight()) > 800 ? 256 : 192;
 
     SetStyle(GetStyle() | WB_VSCROLL);
-    setItemMaxTextLength( mnItemMaxTextLength );
+    setItemMaxTextLength( 30 );
     setItemDimensions( mnItemMaxSize, mnItemMaxSize, mnTextHeight, mnItemPadding );
 
     maFillColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsBackgroundColor::get());
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 0b02bd0f2ae4..372a7751ca2c 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -297,21 +297,18 @@ SfxDispatchController_Impl::SfxDispatchController_Impl(
     , pDispatcher( pDispat )
     , pBindings( pBind )
     , pLastState( nullptr )
-    , nSlot( pSlot->GetSlotId() )
     , pDispatch( pDisp )
     , bMasterSlave( false )
     , bVisible( true )
-    , pUnoName( pSlot->pUnoName )
 {
-    if ( aDispatchURL.Protocol == "slot:" && pUnoName )
+    if ( aDispatchURL.Protocol == "slot:" && pSlot->pUnoName )
     {
-        OStringBuffer aTmp(".uno:");
-        aTmp.append(pUnoName);
-        aDispatchURL.Complete = OStringToOUString(aTmp.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US);
+        aDispatchURL.Complete = ".uno:" + OUString::createFromAscii(pSlot->pUnoName);
         Reference< XURLTransformer > xTrans( URLTransformer::create( ::comphelper::getProcessComponentContext() ) );
         xTrans->parseStrict( aDispatchURL );
     }
 
+    sal_uInt16 nSlot = pSlot->GetSlotId();
     SetId( nSlot );
     if ( pBindings )
     {
diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx
index a79df9603f38..349d09cf405f 100644
--- a/sfx2/source/dialog/infobar.cxx
+++ b/sfx2/source/dialog/infobar.cxx
@@ -95,12 +95,12 @@ class SfxCloseButton : public PushButton
 {
     basegfx::BColor m_aBackgroundColor;
     basegfx::BColor m_aForegroundColor;
-    basegfx::BColor m_aMessageColor;
 
 public:
     explicit SfxCloseButton(vcl::Window* pParent) : PushButton(pParent, 0)
     {
-        GetInfoBarColors(InfoBarType::Warning,m_aBackgroundColor,m_aForegroundColor,m_aMessageColor);
+        basegfx::BColor aMessageColor;
+        GetInfoBarColors(InfoBarType::Warning,m_aBackgroundColor,m_aForegroundColor,aMessageColor);
     }
 
     virtual void Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& rRect) override;
diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx
index cc88976587f1..1d860d18275e 100644
--- a/sfx2/source/doc/new.cxx
+++ b/sfx2/source/doc/new.cxx
@@ -249,7 +249,6 @@ SfxNewFileDialog::SfxNewFileDialog(weld::Window *pParent, SfxNewFileDialogMode n
     , m_xMoreBt(m_xBuilder->weld_expander("expander"))
     , m_xPreviewWin(new SfxPreviewWin_Impl(m_xBuilder->weld_drawing_area("image")))
     , m_xAltTitleFt(m_xBuilder->weld_label("alttitle"))
-    , m_sLoadTemplate(m_xAltTitleFt->get_label())
     , m_nFlags(nFlags)
 {
     const int nWidth = m_xRegionLb->get_approximate_digit_width() * 32;
@@ -270,7 +269,7 @@ SfxNewFileDialog::SfxNewFileDialog(weld::Window *pParent, SfxNewFileDialogMode n
         m_xMergeStyleCB->show();
         m_xMoreBt->hide();
         m_xTextStyleCB->set_active(true);
-        m_xDialog->set_title(m_sLoadTemplate);
+        m_xDialog->set_title(m_xAltTitleFt->get_label());
     }
     else
     {
diff --git a/sfx2/source/inc/sfxpicklist.hxx b/sfx2/source/inc/sfxpicklist.hxx
index 2ff52d1c44b3..bce382461c7d 100644
--- a/sfx2/source/inc/sfxpicklist.hxx
+++ b/sfx2/source/inc/sfxpicklist.hxx
@@ -35,7 +35,8 @@ class SfxPickList
 private:
     std::unique_ptr<SfxPickListImpl> mxImpl;
 public:
-    SfxPickList(sal_uInt32 nAllowedMenuSize);
+    SfxPickList();
+    /// Ensure instantiation of listener that manages the internal recently-used list
     static void ensure();
     ~SfxPickList();
 };
diff --git a/sfx2/source/inc/workwin.hxx b/sfx2/source/inc/workwin.hxx
index c3286960a568..cf332f74c3bd 100644
--- a/sfx2/source/inc/workwin.hxx
+++ b/sfx2/source/inc/workwin.hxx
@@ -194,7 +194,6 @@ class SfxWorkWindow final
                             aChildWins;
     SfxBindings*            pBindings;
     VclPtr<vcl::Window>     pWorkWin;
-    SfxShell*               pConfigShell;
     VclPtr<vcl::Window>     pActiveChild;
     SfxVisibilityFlags      nUpdateMode;
     sal_uInt16              nChildren;
diff --git a/sfx2/source/notify/globalevents.cxx b/sfx2/source/notify/globalevents.cxx
index a94540659109..ed495f8d23ef 100644
--- a/sfx2/source/notify/globalevents.cxx
+++ b/sfx2/source/notify/globalevents.cxx
@@ -70,7 +70,6 @@ class SfxGlobalEvents_Impl : public ModelCollectionMutexBase
     ::comphelper::OInterfaceContainerHelper2 m_aLegacyListeners;
     ::comphelper::OInterfaceContainerHelper2 m_aDocumentListeners;
     TModelList m_lModels;
-    GlobalEventConfig* pImp;
 
 public:
     explicit SfxGlobalEvents_Impl(const css::uno::Reference < css::uno::XComponentContext >& rxContext);
@@ -143,12 +142,10 @@ SfxGlobalEvents_Impl::SfxGlobalEvents_Impl( const uno::Reference < uno::XCompone
     , m_xJobExecutorListener( task::theJobExecutor::get( rxContext ), uno::UNO_QUERY_THROW )
     , m_aLegacyListeners      (m_aLock)
     , m_aDocumentListeners    (m_aLock)
-    , pImp                    (nullptr      )
 {
     m_refCount++;
     SfxApplication::GetOrCreate();
-    pImp                   = new GlobalEventConfig();
-    m_xEvents              = pImp;
+    m_xEvents = new GlobalEventConfig();
     m_refCount--;
 }
 
diff --git a/sfx2/source/view/printer.cxx b/sfx2/source/view/printer.cxx
index 4b8ef5bd1cc9..7d04b54226aa 100644
--- a/sfx2/source/view/printer.cxx
+++ b/sfx2/source/view/printer.cxx
@@ -195,13 +195,12 @@ SfxPrintOptionsDialog::SfxPrintOptionsDialog(weld::Window *pParent,
                                              const SfxItemSet *pSet)
     : GenericDialogController(pParent, "sfx/ui/printeroptionsdialog.ui", "PrinterOptionsDialog")
     , pDlgImpl(new SfxPrintOptDlg_Impl)
-    , pViewSh(pViewShell)
     , pOptions(pSet->Clone())
     , m_xHelpBtn(m_xBuilder->weld_widget("help"))
     , m_xContainer(m_xDialog->weld_content_area())
 {
     // Insert TabPage
-    pPage.reset(pViewSh->CreatePrintOptionsPage(m_xContainer.get(), *pOptions));
+    pPage.reset(pViewShell->CreatePrintOptionsPage(m_xContainer.get(), *pOptions));
     DBG_ASSERT( pPage, "CreatePrintOptions != SFX_VIEW_HAS_PRINTOPTIONS" );
     if( pPage )
     {
diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx
index d12b5778ba3d..34861674de96 100644
--- a/shell/source/unix/exec/shellexec.cxx
+++ b/shell/source/unix/exec/shellexec.cxx
@@ -77,21 +77,6 @@ ShellExec::ShellExec( const Reference< XComponentContext >& xContext ) :
     WeakImplHelper< XSystemShellExecute, XServiceInfo >(),
     m_xContext(xContext)
 {
-    try {
-        Reference< XCurrentContext > xCurrentContext(getCurrentContext());
-
-        if (xCurrentContext.is())
-        {
-            Any aValue = xCurrentContext->getValueByName( "system.desktop-environment" );
-
-            OUString aDesktopEnvironment;
-            if (aValue >>= aDesktopEnvironment)
-            {
-                m_aDesktopEnvironment = OUStringToOString(aDesktopEnvironment, RTL_TEXTENCODING_ASCII_US);
-            }
-        }
-    } catch (const RuntimeException &) {
-    }
 }
 
 void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aParameter, sal_Int32 nFlags )
diff --git a/shell/source/unix/exec/shellexec.hxx b/shell/source/unix/exec/shellexec.hxx
index 38ebf8ea94c0..22b03ad76d3d 100644
--- a/shell/source/unix/exec/shellexec.hxx
+++ b/shell/source/unix/exec/shellexec.hxx
@@ -32,7 +32,6 @@
 
 class ShellExec : public ::cppu::WeakImplHelper< css::system::XSystemShellExecute, css::lang::XServiceInfo >
 {
-    OString                                            m_aDesktopEnvironment;
     css::uno::Reference< css::uno::XComponentContext > m_xContext;
 
 public:
diff --git a/sot/source/sdstor/stgavl.cxx b/sot/source/sdstor/stgavl.cxx
index 3adb7b0dc5ed..d488eec69130 100644
--- a/sot/source/sdstor/stgavl.cxx
+++ b/sot/source/sdstor/stgavl.cxx
@@ -376,10 +376,12 @@ bool StgAvlNode::Remove( StgAvlNode** pRoot, StgAvlNode* pDel, bool bDel )
 StgAvlIterator::StgAvlIterator( StgAvlNode* p )
 {
     m_pRoot = p;
-    m_nCount = 0;
     m_nCur = 0;
     if( p )
-        p->StgEnum( m_nCount );
+    {
+        short nCount = 0; // tree size
+        p->StgEnum( nCount );
+    }
 }
 
 StgAvlNode* StgAvlIterator::Find( short n )
diff --git a/sot/source/sdstor/stgavl.hxx b/sot/source/sdstor/stgavl.hxx
index 831d75942910..d521eb00b290 100644
--- a/sot/source/sdstor/stgavl.hxx
+++ b/sot/source/sdstor/stgavl.hxx
@@ -52,7 +52,6 @@ public:
 
 class StgAvlIterator {
     StgAvlNode* m_pRoot;                  // root entry (parent)
-    short       m_nCount;                 // tree size
     short       m_nCur;                   // current element
     StgAvlNode* Find( short );
 public:


More information about the Libreoffice-commits mailing list