[Libreoffice-commits] core.git: include/svtools svtools/source

Stephan Bergmann sbergman at redhat.com
Mon Jan 4 09:19:27 PST 2016


 include/svtools/unoevent.hxx    |   13 -
 svtools/source/uno/unoevent.cxx |  266 ++++++++++++++++++++--------------------
 2 files changed, 133 insertions(+), 146 deletions(-)

New commits:
commit d2f6f86330b68500a4e0c7987ff2bb1493a7ea8d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jan 4 18:18:53 2016 +0100

    loplugin:stringconstant
    
    Change-Id: I08430479a2c8d1fd6e3fc357ba3069b3a7bb6ac8

diff --git a/include/svtools/unoevent.hxx b/include/svtools/unoevent.hxx
index ac1f03c..899b2bb 100644
--- a/include/svtools/unoevent.hxx
+++ b/include/svtools/unoevent.hxx
@@ -150,19 +150,6 @@ protected:
 
     /// get the event ID for the name; return 0 if not supported
     sal_uInt16 getMacroID(const OUString& rName) const;
-
-    /// create PropertyValues and Any from macro
-    void getAnyFromMacro(
-        css::uno::Any& aAny,   // Any to be filled by Macro values
-        const SvxMacro& rMacro);
-
-    /// create macro from PropertyValues (in an Any)
-    void getMacroFromAny(
-        SvxMacro& aMacro,       // reference to be filled by Any
-        const css::uno::Any& rAny)
-            throw (
-                css::lang::IllegalArgumentException);
-
 };
 
 
diff --git a/svtools/source/uno/unoevent.cxx b/svtools/source/uno/unoevent.cxx
index 8ddfd0d..bfa752f 100644
--- a/svtools/source/uno/unoevent.cxx
+++ b/svtools/source/uno/unoevent.cxx
@@ -45,138 +45,9 @@ static const char sJavaScript[] = "JavaScript";
 static const char sScript[] = "Script";
 static const char sNone[] = "None";
 
+namespace {
 
-SvBaseEventDescriptor::SvBaseEventDescriptor( const SvEventDescription* pSupportedMacroItems ) :
-        mpSupportedMacroItems(pSupportedMacroItems),
-        mnMacroItems(0)
-{
-    assert(pSupportedMacroItems != nullptr && "Need a list of supported events!");
-
-    for( ; mpSupportedMacroItems[mnMacroItems].mnEvent != 0; mnMacroItems++) ;
-}
-
-
-SvBaseEventDescriptor::~SvBaseEventDescriptor()
-{
-}
-
-void SvBaseEventDescriptor::replaceByName(
-    const OUString& rName,
-    const Any& rElement )
-    throw(
-        IllegalArgumentException,
-        NoSuchElementException,
-        WrappedTargetException,
-        RuntimeException, std::exception)
-{
-    sal_uInt16 nMacroID = getMacroID(rName);
-
-    // error checking
-    if (0 == nMacroID)
-        throw NoSuchElementException();
-    if (rElement.getValueType() != getElementType())
-        throw IllegalArgumentException();
-
-    // get sequence
-    Sequence<PropertyValue> aSequence;
-    rElement >>= aSequence;
-
-    // perform replace (in subclass)
-    SvxMacro aMacro("","");
-    getMacroFromAny(aMacro, rElement);
-    replaceByName(nMacroID, aMacro);
-}
-
-Any SvBaseEventDescriptor::getByName(
-    const OUString& rName )
-    throw(
-        NoSuchElementException,
-        WrappedTargetException,
-        RuntimeException, std::exception)
-{
-    sal_uInt16 nMacroID = getMacroID(rName);
-
-    // error checking
-    if (0 == nMacroID)
-        throw NoSuchElementException();
-
-    // perform get (in subclass)
-    Any aAny;
-    SvxMacro aMacro( "", "" );
-    getByName(aMacro, nMacroID);
-    getAnyFromMacro(aAny, aMacro);
-    return aAny;
-}
-
-Sequence<OUString> SvBaseEventDescriptor::getElementNames()
-    throw(RuntimeException, std::exception)
-{
-    // create and fill sequence
-    Sequence<OUString> aSequence(mnMacroItems);
-    for( sal_Int16 i = 0; i < mnMacroItems; i++)
-    {
-        aSequence[i] = OUString::createFromAscii( mpSupportedMacroItems[i].mpEventName );
-    }
-
-    return aSequence;
-}
-
-sal_Bool SvBaseEventDescriptor::hasByName(
-    const OUString& rName )
-    throw(RuntimeException, std::exception)
-{
-    sal_uInt16 nMacroID = getMacroID(rName);
-    return (nMacroID != 0);
-}
-
-Type SvBaseEventDescriptor::getElementType()
-    throw(RuntimeException, std::exception)
-{
-    return cppu::UnoType<Sequence<PropertyValue>>::get();
-}
-
-sal_Bool SvBaseEventDescriptor::hasElements()
-    throw(RuntimeException, std::exception)
-{
-    return mnMacroItems != 0;
-}
-
-sal_Bool SvBaseEventDescriptor::supportsService(const OUString& rServiceName)
-    throw(RuntimeException, std::exception)
-{
-    return cppu::supportsService(this, rServiceName);
-}
-
-Sequence<OUString> SvBaseEventDescriptor::getSupportedServiceNames()
-    throw(RuntimeException, std::exception)
-{
-    Sequence<OUString> aSequence { sAPI_ServiceName };
-
-    return aSequence;
-}
-
-sal_uInt16 SvBaseEventDescriptor::mapNameToEventID(const OUString& rName) const
-{
-    // iterate over known event names
-    for(sal_Int16 i = 0; i < mnMacroItems; i++)
-    {
-        if( rName.equalsAscii(mpSupportedMacroItems[i].mpEventName))
-        {
-            return mpSupportedMacroItems[i].mnEvent;
-        }
-    }
-
-    // not found -> return zero
-    return 0;
-}
-
-sal_uInt16 SvBaseEventDescriptor::getMacroID(const OUString& rName) const
-{
-    return mapNameToEventID(rName);
-}
-
-void SvBaseEventDescriptor::getAnyFromMacro(Any& rAny,
-                                       const SvxMacro& rMacro)
+void getAnyFromMacro(Any& rAny, const SvxMacro& rMacro)
 {
     bool bRetValueOK = false;   // do we have a ret value?
 
@@ -266,8 +137,7 @@ void SvBaseEventDescriptor::getAnyFromMacro(Any& rAny,
     }
 }
 
-
-void SvBaseEventDescriptor::getMacroFromAny(
+void getMacroFromAny(
     SvxMacro& rMacro,
     const Any& rAny)
         throw ( IllegalArgumentException )
@@ -363,6 +233,136 @@ void SvBaseEventDescriptor::getMacroFromAny(
     }
 }
 
+}
+
+SvBaseEventDescriptor::SvBaseEventDescriptor( const SvEventDescription* pSupportedMacroItems ) :
+        mpSupportedMacroItems(pSupportedMacroItems),
+        mnMacroItems(0)
+{
+    assert(pSupportedMacroItems != nullptr && "Need a list of supported events!");
+
+    for( ; mpSupportedMacroItems[mnMacroItems].mnEvent != 0; mnMacroItems++) ;
+}
+
+
+SvBaseEventDescriptor::~SvBaseEventDescriptor()
+{
+}
+
+void SvBaseEventDescriptor::replaceByName(
+    const OUString& rName,
+    const Any& rElement )
+    throw(
+        IllegalArgumentException,
+        NoSuchElementException,
+        WrappedTargetException,
+        RuntimeException, std::exception)
+{
+    sal_uInt16 nMacroID = getMacroID(rName);
+
+    // error checking
+    if (0 == nMacroID)
+        throw NoSuchElementException();
+    if (rElement.getValueType() != getElementType())
+        throw IllegalArgumentException();
+
+    // get sequence
+    Sequence<PropertyValue> aSequence;
+    rElement >>= aSequence;
+
+    // perform replace (in subclass)
+    SvxMacro aMacro("","");
+    getMacroFromAny(aMacro, rElement);
+    replaceByName(nMacroID, aMacro);
+}
+
+Any SvBaseEventDescriptor::getByName(
+    const OUString& rName )
+    throw(
+        NoSuchElementException,
+        WrappedTargetException,
+        RuntimeException, std::exception)
+{
+    sal_uInt16 nMacroID = getMacroID(rName);
+
+    // error checking
+    if (0 == nMacroID)
+        throw NoSuchElementException();
+
+    // perform get (in subclass)
+    Any aAny;
+    SvxMacro aMacro( "", "" );
+    getByName(aMacro, nMacroID);
+    getAnyFromMacro(aAny, aMacro);
+    return aAny;
+}
+
+Sequence<OUString> SvBaseEventDescriptor::getElementNames()
+    throw(RuntimeException, std::exception)
+{
+    // create and fill sequence
+    Sequence<OUString> aSequence(mnMacroItems);
+    for( sal_Int16 i = 0; i < mnMacroItems; i++)
+    {
+        aSequence[i] = OUString::createFromAscii( mpSupportedMacroItems[i].mpEventName );
+    }
+
+    return aSequence;
+}
+
+sal_Bool SvBaseEventDescriptor::hasByName(
+    const OUString& rName )
+    throw(RuntimeException, std::exception)
+{
+    sal_uInt16 nMacroID = getMacroID(rName);
+    return (nMacroID != 0);
+}
+
+Type SvBaseEventDescriptor::getElementType()
+    throw(RuntimeException, std::exception)
+{
+    return cppu::UnoType<Sequence<PropertyValue>>::get();
+}
+
+sal_Bool SvBaseEventDescriptor::hasElements()
+    throw(RuntimeException, std::exception)
+{
+    return mnMacroItems != 0;
+}
+
+sal_Bool SvBaseEventDescriptor::supportsService(const OUString& rServiceName)
+    throw(RuntimeException, std::exception)
+{
+    return cppu::supportsService(this, rServiceName);
+}
+
+Sequence<OUString> SvBaseEventDescriptor::getSupportedServiceNames()
+    throw(RuntimeException, std::exception)
+{
+    Sequence<OUString> aSequence { sAPI_ServiceName };
+
+    return aSequence;
+}
+
+sal_uInt16 SvBaseEventDescriptor::mapNameToEventID(const OUString& rName) const
+{
+    // iterate over known event names
+    for(sal_Int16 i = 0; i < mnMacroItems; i++)
+    {
+        if( rName.equalsAscii(mpSupportedMacroItems[i].mpEventName))
+        {
+            return mpSupportedMacroItems[i].mnEvent;
+        }
+    }
+
+    // not found -> return zero
+    return 0;
+}
+
+sal_uInt16 SvBaseEventDescriptor::getMacroID(const OUString& rName) const
+{
+    return mapNameToEventID(rName);
+}
 
 SvEventDescriptor::SvEventDescriptor(
     XInterface& rParent,


More information about the Libreoffice-commits mailing list