summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-01-04 18:18:53 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-01-04 18:18:53 +0100
commitd2f6f86330b68500a4e0c7987ff2bb1493a7ea8d (patch)
tree1e79c00a6093e312d47ff8719b9781588d883b26 /svtools
parenteb760663d06dd9eb445b5390c854c4daf18a1a52 (diff)
loplugin:stringconstant
Change-Id: I08430479a2c8d1fd6e3fc357ba3069b3a7bb6ac8
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/uno/unoevent.cxx266
1 files changed, 133 insertions, 133 deletions
diff --git a/svtools/source/uno/unoevent.cxx b/svtools/source/uno/unoevent.cxx
index 8ddfd0d2e661..bfa752f49964 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,