24#include <com/sun/star/lang/XServiceInfo.hpp>
25#include <com/sun/star/beans/XPropertySet.hpp>
26#include <com/sun/star/container/XNameAccess.hpp>
27#include <com/sun/star/container/XEnumeration.hpp>
28#include <com/sun/star/container/XIndexAccess.hpp>
31#include <osl/diagnose.h>
34#define SC_SIMPLE_SERVICE_INFO_IMPL( ClassName, ClassNameAscii ) \
35OUString SAL_CALL ClassName::getImplementationName() \
37 return ClassNameAscii; \
39sal_Bool SAL_CALL ClassName::supportsService( const OUString& ServiceName ) \
41 return cppu::supportsService(this, ServiceName); \
44#define SC_SIMPLE_SERVICE_INFO_NAME( ClassName, ServiceAscii ) \
45css::uno::Sequence< OUString > \
46 SAL_CALL ClassName::getSupportedServiceNames() \
48 css::uno::Sequence< OUString > aRet { ServiceAscii }; \
55#define SC_SIMPLE_SERVICE_INFO_TYPO( ClassName, ServiceAscii, ServiceAsciiMistyped ) \
56css::uno::Sequence< OUString > \
57 SAL_CALL ClassName::getSupportedServiceNames() \
59 css::uno::Sequence< OUString > aRet { ServiceAsciiMistyped, ServiceAscii }; \
63#define SC_SIMPLE_SERVICE_INFO( ClassName, ClassNameAscii, ServiceAscii ) \
64 SC_SIMPLE_SERVICE_INFO_IMPL( ClassName, ClassNameAscii ) \
65 SC_SIMPLE_SERVICE_INFO_NAME( ClassName, ServiceAscii )
67#define SC_SIMPLE_SERVICE_INFO_COMPAT( ClassName, ClassNameAscii, ServiceAscii, ServiceAsciiMistyped ) \
68 SC_SIMPLE_SERVICE_INFO_IMPL( ClassName, ClassNameAscii ) \
69 SC_SIMPLE_SERVICE_INFO_TYPO( ClassName, ServiceAscii, ServiceAsciiMistyped )
72#define SC_IMPL_DUMMY_PROPERTY_LISTENER( ClassName ) \
73 void SAL_CALL ClassName::addPropertyChangeListener( const OUString&, \
74 const uno::Reference<beans::XPropertyChangeListener>&) \
75 { OSL_FAIL("not implemented"); } \
76 void SAL_CALL ClassName::removePropertyChangeListener( const OUString&, \
77 const uno::Reference<beans::XPropertyChangeListener>&) \
78 { OSL_FAIL("not implemented"); } \
79 void SAL_CALL ClassName::addVetoableChangeListener( const OUString&, \
80 const uno::Reference<beans::XVetoableChangeListener>&) \
81 { OSL_FAIL("not implemented"); } \
82 void SAL_CALL ClassName::removeVetoableChangeListener( const OUString&, \
83 const uno::Reference<beans::XVetoableChangeListener>&) \
84 { OSL_FAIL("not implemented"); }
86#define SC_QUERYINTERFACE(x) \
87 if (rType == cppu::UnoType<x>::get()) \
88 { return uno::Any(uno::Reference<x>(this)); }
93#define SC_QUERY_MULTIPLE(x,y) \
94 if (rType == cppu::UnoType<x>::get()) \
95 { uno::Any aR; aR <<= uno::Reference<x>(static_cast<y*>(this)); return aR; }
98 css::container::XEnumeration,
99 css::lang::XServiceInfo >
102 css::uno::Reference<css::container::XIndexAccess>
xIndex;
108 css::container::XIndexAccess> xInd, OUString aServiceName);
113 virtual css::uno::Any SAL_CALL
nextElement()
override;
123 css::container::XIndexAccess,
124 css::lang::XServiceInfo >
132 css::uno::Reference< css::container::XNameAccess> xNameObj );
136 virtual sal_Int32 SAL_CALL
getCount( )
override;
152 static bool GetBoolProperty(
const css::uno::Reference< css::beans::XPropertySet>& xProp,
153 const OUString& rName,
bool bDefault =
false );
154 static sal_Int16 GetShortProperty(
const css::uno::Reference< css::beans::XPropertySet>& xProp,
155 const OUString& rName, sal_Int16 nDefault );
156 static sal_Int32 GetLongProperty(
const css::uno::Reference< css::beans::XPropertySet>& xProp,
157 const OUString& rName );
158 template<
typename EnumT>
159 static EnumT
GetEnumProperty(
const css::uno::Reference< css::beans::XPropertySet>& xProp,
160 const OUString& rName, EnumT nDefault )
161 {
return static_cast<EnumT
>(GetEnumPropertyImpl(xProp, rName,
static_cast<sal_Int32
>(nDefault))); }
163 static OUString GetStringProperty(
164 const css::uno::Reference<css::beans::XPropertySet>& xProp,
165 const OUString& rName,
const OUString& rDefault );
167 static bool GetBoolFromAny(
const css::uno::Any& aAny );
168 static sal_Int16 GetInt16FromAny(
const css::uno::Any& aAny );
169 static sal_Int32 GetInt32FromAny(
const css::uno::Any& aAny );
170 static sal_Int32 GetEnumFromAny(
const css::uno::Any& aAny );
173 const css::uno::Reference< css::beans::XPropertySet >& rPropSet,
174 const char* pPropName,
const css::uno::Any& rVal );
176 const css::uno::Reference< css::beans::XPropertySet >& rPropSet,
177 const OUString& rPropName,
const css::uno::Any& rVal );
179 template<
typename ValueType>
181 const css::uno::Reference< css::beans::XPropertySet >& rPropSet,
182 const char* pPropName,
const ValueType& rVal )
186 SetOptionalPropertyValue(rPropSet, pPropName,
any);
188 template<
typename ValueType>
190 const css::uno::Reference< css::beans::XPropertySet >& rPropSet,
191 const OUString& rPropName,
const ValueType& rVal )
195 SetOptionalPropertyValue(rPropSet, rPropName,
any);
198 template<
typename ValueType>
199 static css::uno::Sequence<ValueType>
VectorToSequence(
const std::vector<ValueType>& rVector )
202 return css::uno::Sequence<ValueType>();
204 return css::uno::Sequence<ValueType>(&rVector[0],
static_cast<sal_Int32
>(rVector.size()));
207 static sal_Int32 GetEnumPropertyImpl(
const css::uno::Reference< css::beans::XPropertySet>& xProp,
208 const OUString& rName, sal_Int32 nDefault );
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL hasMoreElements() override
ScIndexEnumeration(css::uno::Reference< css::container::XIndexAccess > xInd, OUString aServiceName)
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Any SAL_CALL nextElement() override
virtual ~ScIndexEnumeration() override
css::uno::Reference< css::container::XIndexAccess > xIndex
virtual OUString SAL_CALL getImplementationName() override
virtual sal_Int32 SAL_CALL getCount() override
ScNameToIndexAccess(css::uno::Reference< css::container::XNameAccess > xNameObj)
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Type SAL_CALL getElementType() override
css::uno::Sequence< OUString > aNames
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
virtual ~ScNameToIndexAccess() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL hasElements() override
virtual OUString SAL_CALL getImplementationName() override
css::uno::Reference< css::container::XNameAccess > xNameAccess
static void SetOptionalPropertyValue(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const char *pPropName, const ValueType &rVal)
static void SetOptionalPropertyValue(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const OUString &rPropName, const ValueType &rVal)
static EnumT GetEnumProperty(const css::uno::Reference< css::beans::XPropertySet > &xProp, const OUString &rName, EnumT nDefault)
static void SetOptionalPropertyValue(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const OUString &rPropName, const css::uno::Any &rVal)
static void SetOptionalPropertyValue(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const char *pPropName, const css::uno::Any &rVal)
static css::uno::Sequence< ValueType > VectorToSequence(const std::vector< ValueType > &rVector)