compilerplugins/clang/unusedenumconstants.readonly.results |   12 ---
 sc/source/ui/vba/vbasheetobject.cxx                        |   42 +++----------
 sc/source/ui/vba/vbasheetobject.hxx                        |   15 ----
 scaddins/source/analysis/analysis.cxx                      |    8 +-
 scaddins/source/analysis/analysishelper.cxx                |   18 -----
 scaddins/source/analysis/analysishelper.hxx                |   12 ---
 6 files changed, 20 insertions(+), 87 deletions(-)

New commits:
commit 102091b73d824cdda7f88d9a7b79d04eb33fabf7
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Nov 22 15:30:58 2018 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Nov 24 16:50:11 2018 +0100

    remove ScVbaControlObjectBase::ListenerType enum
    
    we only use one value from it
    
    Change-Id: I3d0391e76f07434915940be25025de36a5475bc5
    Reviewed-on: https://gerrit.libreoffice.org/63937
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/compilerplugins/clang/unusedenumconstants.readonly.results 
b/compilerplugins/clang/unusedenumconstants.readonly.results
index 8e28a282002a..8b78a97df024 100644
--- a/compilerplugins/clang/unusedenumconstants.readonly.results
+++ b/compilerplugins/clang/unusedenumconstants.readonly.results
@@ -1194,14 +1194,6 @@ sc/source/ui/unoobj/condformatuno.cxx:274
     enum (anonymous namespace)::DateProperties Date_StyleName
 sc/source/ui/unoobj/condformatuno.cxx:275
     enum (anonymous namespace)::DateProperties DateType
-sc/source/ui/vba/vbasheetobject.hxx:140
-    enum ScVbaControlObjectBase::ListenerType LISTENER_MOUSE
-sc/source/ui/vba/vbasheetobject.hxx:141
-    enum ScVbaControlObjectBase::ListenerType LISTENER_TEXT
-sc/source/ui/vba/vbasheetobject.hxx:142
-    enum ScVbaControlObjectBase::ListenerType LISTENER_VALUE
-sc/source/ui/vba/vbasheetobject.hxx:143
-    enum ScVbaControlObjectBase::ListenerType LISTENER_CHANGE
 scaddins/source/datefunc/datefunc.hxx:41
     enum ScaCategory Finance
 scaddins/source/datefunc/datefunc.hxx:42
diff --git a/sc/source/ui/vba/vbasheetobject.cxx 
b/sc/source/ui/vba/vbasheetobject.cxx
index 9e5b7856d6c4..80f9d3249e57 100644
--- a/sc/source/ui/vba/vbasheetobject.cxx
+++ b/sc/source/ui/vba/vbasheetobject.cxx
@@ -36,6 +36,10 @@
 using namespace ::com::sun::star;
 using namespace ::ooo::vba;
 
+constexpr OUStringLiteral gaListenerType = "XActionListener";
+constexpr OUStringLiteral gaEventMethod = "actionPerformed";
+
+
 ScVbaButtonCharacters::ScVbaButtonCharacters(
         const uno::Reference< XHelperInterface >& rxParent,
         const uno::Reference< uno::XComponentContext >& rxContext,
@@ -292,37 +296,11 @@ ScVbaControlObjectBase::ScVbaControlObjectBase(
         const uno::Reference< uno::XComponentContext >& rxContext,
         const uno::Reference< frame::XModel >& rxModel,
         const uno::Reference< container::XIndexContainer >& rxFormIC,
-        const uno::Reference< drawing::XControlShape >& rxControlShape,
-        ListenerType eListenerType ) :
+        const uno::Reference< drawing::XControlShape >& rxControlShape ) :
     ScVbaControlObject_BASE( rxParent, rxContext, rxModel, uno::Reference< 
drawing::XShape >( rxControlShape, uno::UNO_QUERY_THROW ) ),
     mxFormIC( rxFormIC, uno::UNO_SET_THROW ),
     mxControlProps( rxControlShape->getControl(), uno::UNO_QUERY_THROW )
 {
-    // set listener and event name to be used for OnAction attribute
-    switch( eListenerType )
-    {
-        case LISTENER_ACTION:
-            maListenerType = "XActionListener";
-            maEventMethod = "actionPerformed";
-        break;
-        case LISTENER_MOUSE:
-            maListenerType = "XMouseListener";
-            maEventMethod = "mouseReleased";
-        break;
-        case LISTENER_TEXT:
-            maListenerType = "XTextListener";
-            maEventMethod = "textChanged";
-        break;
-        case LISTENER_VALUE:
-            maListenerType = "XAdjustmentListener";
-            maEventMethod = "adjustmentValueChanged";
-        break;
-        case LISTENER_CHANGE:
-            maListenerType = "XChangeListener";
-            maEventMethod = "changed";
-        break;
-        // no default, to let the compiler complain about missing case
-    }
 }
 
 // XSheetObject attributes
@@ -348,7 +326,7 @@ OUString SAL_CALL ScVbaControlObjectBase::getOnAction()
         const script::ScriptEventDescriptor* pEventEnd = pEvent + 
aEvents.getLength();
         const OUString aScriptType = "Script";
         for( ; pEvent < pEventEnd; ++pEvent )
-            if( (pEvent->ListenerType == maListenerType) && 
(pEvent->EventMethod == maEventMethod) && (pEvent->ScriptType == aScriptType) )
+            if( (pEvent->ListenerType == gaListenerType) && 
(pEvent->EventMethod == gaEventMethod) && (pEvent->ScriptType == aScriptType) )
                 return extractMacroName( pEvent->ScriptCode );
     }
     return OUString();
@@ -360,7 +338,7 @@ void SAL_CALL ScVbaControlObjectBase::setOnAction( const 
OUString& rMacroName )
     sal_Int32 nIndex = getModelIndexInForm();
 
     // first, remove a registered event (try/catch just in case implementation 
throws)
-    try { xEventMgr->revokeScriptEvent( nIndex, maListenerType, maEventMethod, 
OUString() ); } catch( uno::Exception& ) {}
+    try { xEventMgr->revokeScriptEvent( nIndex, gaListenerType, gaEventMethod, 
OUString() ); } catch( uno::Exception& ) {}
 
     // if a macro name has been passed, try to attach it to the event
     if( !rMacroName.isEmpty() )
@@ -369,8 +347,8 @@ void SAL_CALL ScVbaControlObjectBase::setOnAction( const 
OUString& rMacroName )
         if( !aResolvedMacro.mbFound )
             throw uno::RuntimeException();
         script::ScriptEventDescriptor aDescriptor;
-        aDescriptor.ListenerType = maListenerType;
-        aDescriptor.EventMethod = maEventMethod;
+        aDescriptor.ListenerType = gaListenerType;
+        aDescriptor.EventMethod = gaEventMethod;
         aDescriptor.ScriptType = "Script";
         aDescriptor.ScriptCode = makeMacroURL( aResolvedMacro.msResolvedMacro 
);
         xEventMgr->registerScriptEvent( nIndex, aDescriptor );
@@ -419,7 +397,7 @@ ScVbaButton::ScVbaButton(
         const uno::Reference< frame::XModel >& rxModel,
         const uno::Reference< container::XIndexContainer >& rxFormIC,
         const uno::Reference< drawing::XControlShape >& rxControlShape ) :
-    ScVbaButton_BASE( rxParent, rxContext, rxModel, rxFormIC, rxControlShape, 
LISTENER_ACTION )
+    ScVbaButton_BASE( rxParent, rxContext, rxModel, rxFormIC, rxControlShape )
 {
 }
 
diff --git a/sc/source/ui/vba/vbasheetobject.hxx 
b/sc/source/ui/vba/vbasheetobject.hxx
index 357309e1a0f5..e53418ab0481 100644
--- a/sc/source/ui/vba/vbasheetobject.hxx
+++ b/sc/source/ui/vba/vbasheetobject.hxx
@@ -133,24 +133,13 @@ typedef ::cppu::ImplInheritanceHelper< 
ScVbaSheetObjectBase, ov::excel::XControl
 class ScVbaControlObjectBase : public ScVbaControlObject_BASE
 {
 public:
-    /** Specifies the listener used for OnAction events. */
-    enum ListenerType
-    {
-        LISTENER_ACTION,        /// XActionListener.actionPerformed
-        LISTENER_MOUSE,         /// XMouseListener.mouseReleased
-        LISTENER_TEXT,          /// XTextListener.textChanged
-        LISTENER_VALUE,         /// XAdjustmentListener.adjustmentValueChanged
-        LISTENER_CHANGE         /// XChangeListener.changed
-    };
-
     /// @throws css::uno::RuntimeException
     explicit ScVbaControlObjectBase(
         const css::uno::Reference< ov::XHelperInterface >& rxParent,
         const css::uno::Reference< css::uno::XComponentContext >& rxContext,
         const css::uno::Reference< css::frame::XModel >& rxModel,
         const css::uno::Reference< css::container::XIndexContainer >& rxFormIC,
-        const css::uno::Reference< css::drawing::XControlShape >& 
rxControlShape,
-        ListenerType eListenerType );
+        const css::uno::Reference< css::drawing::XControlShape >& 
rxControlShape );
 
     // XSheetObject attributes
     virtual OUString SAL_CALL getName() override;
@@ -171,8 +160,6 @@ protected:
 protected:
     css::uno::Reference< css::container::XIndexContainer > mxFormIC;
     css::uno::Reference< css::beans::XPropertySet > mxControlProps;
-    OUString maListenerType;
-    OUString maEventMethod;
 };
 
 typedef ::cppu::ImplInheritanceHelper< ScVbaControlObjectBase, 
ov::excel::XButton > ScVbaButton_BASE;
commit ad74c032ce3b9d8b28387a6d74c8dc536c1ff94a
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Nov 22 15:24:50 2018 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Nov 24 16:49:59 2018 +0100

    drop ComplListAppendHandl enum
    
    we only use one value all the time, so it is unnecessary
    
    Change-Id: I37b596f9c9330ad5f35d6b112dcca14851626995
    Reviewed-on: https://gerrit.libreoffice.org/63936
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/compilerplugins/clang/unusedenumconstants.readonly.results 
b/compilerplugins/clang/unusedenumconstants.readonly.results
index 2d3137a2774c..8e28a282002a 100644
--- a/compilerplugins/clang/unusedenumconstants.readonly.results
+++ b/compilerplugins/clang/unusedenumconstants.readonly.results
@@ -1202,10 +1202,6 @@ sc/source/ui/vba/vbasheetobject.hxx:142
     enum ScVbaControlObjectBase::ListenerType LISTENER_VALUE
 sc/source/ui/vba/vbasheetobject.hxx:143
     enum ScVbaControlObjectBase::ListenerType LISTENER_CHANGE
-scaddins/source/analysis/analysishelper.hxx:478
-    enum sca::analysis::ComplListAppendHandl AH_EmptyAsErr
-scaddins/source/analysis/analysishelper.hxx:479
-    enum sca::analysis::ComplListAppendHandl AH_EmpyAs0
 scaddins/source/datefunc/datefunc.hxx:41
     enum ScaCategory Finance
 scaddins/source/datefunc/datefunc.hxx:42
diff --git a/scaddins/source/analysis/analysis.cxx 
b/scaddins/source/analysis/analysis.cxx
index 2fe57cea1356..db051847789d 100644
--- a/scaddins/source/analysis/analysis.cxx
+++ b/scaddins/source/analysis/analysis.cxx
@@ -931,8 +931,8 @@ OUString SAL_CALL AnalysisAddIn::getImproduct( const 
uno::Reference< beans::XPro
 {
     ComplexList     z_list;
 
-    z_list.Append( aNum1, AH_IgnoreEmpty );
-    z_list.Append( aNL, AH_IgnoreEmpty );
+    z_list.Append( aNum1 );
+    z_list.Append( aNL );
 
     if( z_list.empty() )
         return Complex( 0 ).GetString();
@@ -972,8 +972,8 @@ OUString SAL_CALL AnalysisAddIn::getImsum( const 
uno::Reference< beans::XPropert
 {
     ComplexList     z_list;
 
-    z_list.Append( aNum1, AH_IgnoreEmpty );
-    z_list.Append( aFollowingPars, AH_IgnoreEmpty );
+    z_list.Append( aNum1 );
+    z_list.Append( aFollowingPars );
 
     if( z_list.empty() )
         return Complex( 0 ).GetString();
diff --git a/scaddins/source/analysis/analysishelper.cxx 
b/scaddins/source/analysis/analysishelper.cxx
index 3d05ac068921..3baf6d70cb46 100644
--- a/scaddins/source/analysis/analysishelper.cxx
+++ b/scaddins/source/analysis/analysishelper.cxx
@@ -2034,13 +2034,11 @@ ComplexList::~ComplexList()
 }
 
 
-void ComplexList::Append( const uno::Sequence< uno::Sequence< OUString > >& r, 
ComplListAppendHandl eAH )
+void ComplexList::Append( const uno::Sequence< uno::Sequence< OUString > >& r )
 {
     sal_Int32   n1, n2;
     sal_Int32   nE1 = r.getLength();
     sal_Int32   nE2;
-    bool        bEmpty0 = eAH == AH_EmpyAs0;
-    bool        bErrOnEmpty = eAH == AH_EmptyAsErr;
 
     for( n1 = 0 ; n1 < nE1 ; n1++ )
     {
@@ -2053,20 +2051,14 @@ void ComplexList::Append( const uno::Sequence< 
uno::Sequence< OUString > >& r, C
 
             if( !rStr.isEmpty() )
                 Append( Complex( rStr ) );
-            else if( bEmpty0 )
-                Append( Complex( 0.0 ) );
-            else if( bErrOnEmpty )
-                throw lang::IllegalArgumentException();
         }
     }
 }
 
 
-void ComplexList::Append( const uno::Sequence< uno::Any >& aMultPars, 
ComplListAppendHandl eAH )
+void ComplexList::Append( const uno::Sequence< uno::Any >& aMultPars )
 {
     sal_Int32       nEle = aMultPars.getLength();
-    bool            bEmpty0 = eAH == AH_EmpyAs0;
-    bool            bErrOnEmpty = eAH == AH_EmptyAsErr;
 
     for( sal_Int32 i = 0 ; i < nEle ; i++ )
     {
@@ -2080,10 +2072,6 @@ void ComplexList::Append( const uno::Sequence< uno::Any 
>& aMultPars, ComplListA
 
                 if( !pStr->isEmpty() )
                     Append( Complex( *pStr ) );
-                else if( bEmpty0 )
-                    Append( Complex( 0.0 ) );
-                else if( bErrOnEmpty )
-                    throw lang::IllegalArgumentException();
                 }
                 break;
             case uno::TypeClass_DOUBLE:
@@ -2098,7 +2086,7 @@ void ComplexList::Append( const uno::Sequence< uno::Any 
>& aMultPars, ComplListA
                 sal_Int32           nE = aValArr.getLength();
                 const uno::Sequence< uno::Any >*   pArr = 
aValArr.getConstArray();
                 for( sal_Int32 n = 0 ; n < nE ; n++ )
-                    Append( pArr[ n ], eAH );
+                    Append( pArr[ n ] );
                 }
                 break;
             default:
diff --git a/scaddins/source/analysis/analysishelper.hxx 
b/scaddins/source/analysis/analysishelper.hxx
index 05f3e7afdd8a..fa189f67da09 100644
--- a/scaddins/source/analysis/analysishelper.hxx
+++ b/scaddins/source/analysis/analysishelper.hxx
@@ -473,14 +473,6 @@ public:
 };
 
 
-enum ComplListAppendHandl
-{
-    AH_EmptyAsErr,
-    AH_EmpyAs0,
-    AH_IgnoreEmpty
-};
-
-
 class ComplexList final
 {
 private:
@@ -498,10 +490,10 @@ public:
     inline void             Append( Complex&& pNew );
     /// @throws css::uno::RuntimeException
     /// @throws css::lang::IllegalArgumentException
-    void                    Append( const css::uno::Sequence< 
css::uno::Sequence< OUString > >& rComplexNumList, ComplListAppendHandl eAH );
+    void                    Append( const css::uno::Sequence< 
css::uno::Sequence< OUString > >& rComplexNumList );
     /// @throws css::uno::RuntimeException
     /// @throws css::lang::IllegalArgumentException
-    void                    Append( const css::uno::Sequence< css::uno::Any >& 
aMultPars,ComplListAppendHandl eAH );
+    void                    Append( const css::uno::Sequence< css::uno::Any >& 
aMultPars );
 };
 
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to