summaryrefslogtreecommitdiff
path: root/UnoControls
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2017-06-08 21:56:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-10 13:10:39 +0200
commit2347dcf3ba47aa784868ddfc855f34a5344b4de0 (patch)
tree3964dc67401cec2532be898dbaf73f9549c960d4 /UnoControls
parenteb3bcfff0e513c427f1ff69d65d6671f7b4aaab5 (diff)
UnoControls: inline defines or convert to enum
and remove needless local statics Change-Id: Iaa2d7776d439a824e521d0bb7ef51a9f8e44c009 Reviewed-on: https://gerrit.libreoffice.org/38595 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'UnoControls')
-rw-r--r--UnoControls/source/controls/framecontrol.cxx57
-rw-r--r--UnoControls/source/inc/framecontrol.hxx12
2 files changed, 29 insertions, 40 deletions
diff --git a/UnoControls/source/controls/framecontrol.cxx b/UnoControls/source/controls/framecontrol.cxx
index e9fe0371840e..ef8c028d47f8 100644
--- a/UnoControls/source/controls/framecontrol.cxx
+++ b/UnoControls/source/controls/framecontrol.cxx
@@ -44,6 +44,13 @@ using namespace ::com::sun::star::util;
namespace unocontrols{
+enum PropertyHandle // values represent index in PropertyArray
+{ // for FrameControl
+ Componenturl = 0,
+ Frame = 1,
+ Loaderarguments = 2
+};
+
// construct/destruct
FrameControl::FrameControl( const Reference< XComponentContext >& rxContext)
@@ -245,7 +252,7 @@ void SAL_CALL FrameControl::unadvise( const Type& aTyp
const Sequence< OUString > FrameControl::impl_getStaticSupportedServiceNames()
{
- Sequence<OUString> seqServiceNames { SERVICENAME_FRAMECONTROL };
+ Sequence<OUString> seqServiceNames { "com.sun.star.frame.FrameControl" };
return seqServiceNames;
}
@@ -253,7 +260,7 @@ const Sequence< OUString > FrameControl::impl_getStaticSupportedServiceNames()
const OUString FrameControl::impl_getStaticImplementationName()
{
- return OUString(IMPLEMENTATIONNAME_FRAMECONTROL);
+ return OUString("stardiv.UnoControls.FrameControl");
}
// OPropertySetHelper
@@ -266,12 +273,12 @@ sal_Bool FrameControl::convertFastPropertyValue( Any& rConvertedVa
bool bReturn = false;
switch (nHandle)
{
- case PROPERTYHANDLE_COMPONENTURL : rConvertedValue = rValue;
+ case PropertyHandle::Componenturl : rConvertedValue = rValue;
rOldValue <<= m_sComponentURL;
bReturn = true;
break;
- case PROPERTYHANDLE_LOADERARGUMENTS : rConvertedValue = rValue;
+ case PropertyHandle::Loaderarguments : rConvertedValue = rValue;
rOldValue <<= m_seqLoaderArguments;
bReturn = true;
break;
@@ -294,14 +301,14 @@ void FrameControl::setFastPropertyValue_NoBroadcast( sal_Int32 nHan
MutexGuard aGuard (m_aMutex);
switch (nHandle)
{
- case PROPERTYHANDLE_COMPONENTURL : rValue >>= m_sComponentURL;
+ case PropertyHandle::Componenturl : rValue >>= m_sComponentURL;
if (getPeer().is())
{
impl_createFrame ( getPeer(), m_sComponentURL, m_seqLoaderArguments );
}
break;
- case PROPERTYHANDLE_LOADERARGUMENTS : rValue >>= m_seqLoaderArguments;
+ case PropertyHandle::Loaderarguments : rValue >>= m_seqLoaderArguments;
break;
default : OSL_ENSURE ( nHandle == -1, "This is an invalid property handle." );
@@ -317,13 +324,13 @@ void FrameControl::getFastPropertyValue( Any& rRet ,
switch (nHandle)
{
- case PROPERTYHANDLE_COMPONENTURL : rRet <<= m_sComponentURL;
+ case PropertyHandle::Componenturl : rRet <<= m_sComponentURL;
break;
- case PROPERTYHANDLE_LOADERARGUMENTS : rRet <<= m_seqLoaderArguments;
+ case PropertyHandle::Loaderarguments : rRet <<= m_seqLoaderArguments;
break;
- case PROPERTYHANDLE_FRAME : rRet <<= m_xFrame;
+ case PropertyHandle::Frame : rRet <<= m_xFrame;
break;
default : OSL_ENSURE ( nHandle == -1, "This is an invalid property handle." );
@@ -335,7 +342,17 @@ void FrameControl::getFastPropertyValue( Any& rRet ,
IPropertyArrayHelper& FrameControl::getInfoHelper()
{
// Create a table that map names to index values.
- static OPropertyArrayHelper ourPropertyInfo( impl_getStaticPropertyDescriptor(), true );
+ // attention: properties need to be sorted by name!
+ static OPropertyArrayHelper ourPropertyInfo(
+ {
+ Property( "ComponentURL", PropertyHandle::Componenturl, cppu::UnoType<OUString>::get(),
+ PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED ),
+ Property( "Frame", PropertyHandle::Frame, cppu::UnoType<XFrame>::get(),
+ PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT ),
+ Property( "LoaderArguments", PropertyHandle::Loaderarguments, cppu::UnoType<Sequence<PropertyValue>>::get(),
+ PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED )
+ },
+ true );
return ourPropertyInfo;
}
@@ -407,7 +424,7 @@ void FrameControl::impl_createFrame( const Reference< XWindowPeer >& xPee
}
// notify the listeners
- sal_Int32 nFrameId = PROPERTYHANDLE_FRAME;
+ sal_Int32 nFrameId = PropertyHandle::Frame;
Any aNewFrame ( &xNewFrame, cppu::UnoType<XFrame>::get());
Any aOldFrame ( &xOldFrame, cppu::UnoType<XFrame>::get());
@@ -434,7 +451,7 @@ void FrameControl::impl_deleteFrame()
}
// notify the listeners
- sal_Int32 nFrameId = PROPERTYHANDLE_FRAME;
+ sal_Int32 nFrameId = PropertyHandle::Frame;
Any aNewFrame( &xNullFrame, cppu::UnoType<XFrame2>::get());
Any aOldFrame( &xOldFrame, cppu::UnoType<XFrame2>::get());
fire( &nFrameId, &aNewFrame, &aOldFrame, 1, false );
@@ -444,22 +461,6 @@ void FrameControl::impl_deleteFrame()
xOldFrame->dispose();
}
-// private method
-
-const Sequence< Property >& FrameControl::impl_getStaticPropertyDescriptor()
-{
- // All Properties of this implementation. The array must be sorted!
- static const Property pPropertys[PROPERTY_COUNT] =
- {
- Property( PROPERTYNAME_COMPONENTURL, PROPERTYHANDLE_COMPONENTURL, cppu::UnoType<OUString>::get(), PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED ),
- Property( PROPERTYNAME_FRAME, PROPERTYHANDLE_FRAME, cppu::UnoType<XFrame>::get(), PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT ),
- Property( PROPERTYNAME_LOADERARGUMENTS, PROPERTYHANDLE_LOADERARGUMENTS, cppu::UnoType<Sequence<PropertyValue>>::get(), PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED )
- };
-
- static const Sequence< Property > seqPropertys( pPropertys, PROPERTY_COUNT );
-
- return seqPropertys;
-}
} // namespace unocontrols
diff --git a/UnoControls/source/inc/framecontrol.hxx b/UnoControls/source/inc/framecontrol.hxx
index f087a1a43107..6b8e511a6e8e 100644
--- a/UnoControls/source/inc/framecontrol.hxx
+++ b/UnoControls/source/inc/framecontrol.hxx
@@ -38,16 +38,6 @@
namespace unocontrols{
-#define SERVICENAME_FRAMECONTROL "com.sun.star.frame.FrameControl"
-#define IMPLEMENTATIONNAME_FRAMECONTROL "stardiv.UnoControls.FrameControl"
-#define PROPERTYNAME_LOADERARGUMENTS "LoaderArguments"
-#define PROPERTYNAME_COMPONENTURL "ComponentURL"
-#define PROPERTYNAME_FRAME "Frame"
-#define PROPERTY_COUNT 3 // you must count the properties
-#define PROPERTYHANDLE_COMPONENTURL 0 // Id must be the index into the array
-#define PROPERTYHANDLE_FRAME 1
-#define PROPERTYHANDLE_LOADERARGUMENTS 2
-
// class
class FrameControl : public css::awt::XControlModel
@@ -198,8 +188,6 @@ private:
void impl_deleteFrame();
- static const css::uno::Sequence< css::beans::Property >& impl_getStaticPropertyDescriptor();
-
// private variables
private: