basic: one more WeakImplHelper<XPropertySetInfo> duplicate
This one may be quite busted even since it compares sal_Int32(-1) with USHRT_MAX. Change-Id: I894b382ad499ee49f4616c7704afbb90f0556744
This commit is contained in:
@@ -23,6 +23,9 @@
|
|||||||
#include <basic/sbstar.hxx>
|
#include <basic/sbstar.hxx>
|
||||||
#include <basic/sbuno.hxx>
|
#include <basic/sbuno.hxx>
|
||||||
#include <sbunoobj.hxx>
|
#include <sbunoobj.hxx>
|
||||||
|
|
||||||
|
#include <comphelper/propertysetinfo.hxx>
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
using com::sun::star::uno::Reference;
|
using com::sun::star::uno::Reference;
|
||||||
@@ -40,14 +43,6 @@ struct SbCompare_UString_PropertyValue_Impl
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
extern "C" int SAL_CALL SbCompare_UString_Property_Impl( const void *arg1, const void *arg2 )
|
|
||||||
{
|
|
||||||
const OUString *pArg1 = static_cast<OUString const *>(arg1);
|
|
||||||
const Property *pArg2 = static_cast<Property const *>(arg2);
|
|
||||||
return pArg1->compareTo( pArg2->Name );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SbPropertyValues::SbPropertyValues()
|
SbPropertyValues::SbPropertyValues()
|
||||||
{
|
{
|
||||||
@@ -60,15 +55,22 @@ SbPropertyValues::~SbPropertyValues()
|
|||||||
m_xInfo.clear();
|
m_xInfo.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference< XPropertySetInfo > SbPropertyValues::getPropertySetInfo() throw( RuntimeException, std::exception )
|
Reference< XPropertySetInfo > SbPropertyValues::getPropertySetInfo() throw( RuntimeException, std::exception )
|
||||||
{
|
{
|
||||||
// create on demand?
|
// create on demand?
|
||||||
if (!m_xInfo.is())
|
if (!m_xInfo.is())
|
||||||
{
|
{
|
||||||
SbPropertySetInfo *pInfo = new SbPropertySetInfo( m_aPropVals );
|
uno::Sequence<beans::Property> props(m_aPropVals.size());
|
||||||
m_xInfo.set(pInfo);
|
for (size_t n = 0; n < m_aPropVals.size(); ++n)
|
||||||
|
{
|
||||||
|
Property &rProp = props.getArray()[n];
|
||||||
|
const PropertyValue &rPropVal = m_aPropVals[n];
|
||||||
|
rProp.Name = rPropVal.Name;
|
||||||
|
rProp.Handle = rPropVal.Handle;
|
||||||
|
rProp.Type = cppu::UnoType<void>::get();
|
||||||
|
rProp.Attributes = 0;
|
||||||
|
}
|
||||||
|
m_xInfo.set(new ::comphelper::PropertySetInfo(props));
|
||||||
}
|
}
|
||||||
return m_xInfo;
|
return m_xInfo;
|
||||||
}
|
}
|
||||||
@@ -188,81 +190,6 @@ void SbPropertyValues::setPropertyValues(const Sequence< PropertyValue >& rPrope
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//PropertySetInfoImpl
|
|
||||||
|
|
||||||
PropertySetInfoImpl::PropertySetInfoImpl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
sal_Int32 PropertySetInfoImpl::GetIndex_Impl( const OUString &rPropName ) const
|
|
||||||
{
|
|
||||||
Property *pP;
|
|
||||||
pP = static_cast<Property*>(
|
|
||||||
bsearch( &rPropName, _aProps.getConstArray(), _aProps.getLength(),
|
|
||||||
sizeof( Property ),
|
|
||||||
SbCompare_UString_Property_Impl ));
|
|
||||||
return pP ? sal::static_int_cast<sal_Int32>( pP - _aProps.getConstArray() ) : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Property PropertySetInfoImpl::getPropertyByName(const OUString& Name) throw( RuntimeException )
|
|
||||||
{
|
|
||||||
sal_Int32 nIndex = GetIndex_Impl( Name );
|
|
||||||
if( USHRT_MAX != nIndex )
|
|
||||||
return _aProps.getConstArray()[ nIndex ];
|
|
||||||
return Property();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PropertySetInfoImpl::hasPropertyByName(const OUString& Name) throw( RuntimeException )
|
|
||||||
{
|
|
||||||
sal_Int32 nIndex = GetIndex_Impl( Name );
|
|
||||||
return USHRT_MAX != nIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SbPropertySetInfo::SbPropertySetInfo( const SbPropertyValueArr_Impl &rPropVals )
|
|
||||||
{
|
|
||||||
aImpl._aProps.realloc( rPropVals.size() );
|
|
||||||
for ( size_t n = 0; n < rPropVals.size(); ++n )
|
|
||||||
{
|
|
||||||
Property &rProp = aImpl._aProps.getArray()[n];
|
|
||||||
const PropertyValue &rPropVal = rPropVals[n];
|
|
||||||
rProp.Name = rPropVal.Name;
|
|
||||||
rProp.Handle = rPropVal.Handle;
|
|
||||||
rProp.Type = cppu::UnoType<void>::get();
|
|
||||||
rProp.Attributes = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SbPropertySetInfo::~SbPropertySetInfo()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Sequence< Property > SbPropertySetInfo::getProperties() throw( RuntimeException, std::exception )
|
|
||||||
{
|
|
||||||
return aImpl.getProperties();
|
|
||||||
}
|
|
||||||
|
|
||||||
Property SbPropertySetInfo::getPropertyByName(const OUString& Name)
|
|
||||||
throw( RuntimeException, std::exception )
|
|
||||||
{
|
|
||||||
return aImpl.getPropertyByName( Name );
|
|
||||||
}
|
|
||||||
|
|
||||||
sal_Bool SbPropertySetInfo::hasPropertyByName(const OUString& Name)
|
|
||||||
throw( RuntimeException, std::exception )
|
|
||||||
{
|
|
||||||
return aImpl.hasPropertyByName( Name );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )
|
void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )
|
||||||
{
|
{
|
||||||
(void)pBasic;
|
(void)pBasic;
|
||||||
|
@@ -84,48 +84,6 @@ public:
|
|||||||
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< css::beans::PropertyValue >& PropertyValues_) throw (css::beans::UnknownPropertyException, css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< css::beans::PropertyValue >& PropertyValues_) throw (css::beans::UnknownPropertyException, css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// AB 20.3.2000 Help Class for XPropertySetInfo implementation
|
|
||||||
class PropertySetInfoImpl
|
|
||||||
{
|
|
||||||
friend class SbPropertySetInfo;
|
|
||||||
|
|
||||||
css::uno::Sequence< css::beans::Property > _aProps;
|
|
||||||
|
|
||||||
sal_Int32 GetIndex_Impl( const OUString &rPropName ) const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
PropertySetInfoImpl();
|
|
||||||
PropertySetInfoImpl( css::uno::Sequence< css::beans::Property >& rProps );
|
|
||||||
|
|
||||||
// XPropertySetInfo
|
|
||||||
css::uno::Sequence< css::beans::Property > SAL_CALL getProperties() throw () { return _aProps;}
|
|
||||||
css::beans::Property SAL_CALL getPropertyByName(const OUString& Name)
|
|
||||||
throw( css::uno::RuntimeException );
|
|
||||||
bool SAL_CALL hasPropertyByName(const OUString& Name)
|
|
||||||
throw ( css::uno::RuntimeException );
|
|
||||||
};
|
|
||||||
|
|
||||||
class SbPropertySetInfo: public ::cppu::WeakImplHelper< css::beans::XPropertySetInfo >
|
|
||||||
{
|
|
||||||
PropertySetInfoImpl aImpl;
|
|
||||||
|
|
||||||
public:
|
|
||||||
SbPropertySetInfo( const SbPropertyValueArr_Impl &rPropVals );
|
|
||||||
virtual ~SbPropertySetInfo();
|
|
||||||
|
|
||||||
// XPropertySetInfo
|
|
||||||
virtual css::uno::Sequence< css::beans::Property > SAL_CALL getProperties()
|
|
||||||
throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
|
|
||||||
virtual css::beans::Property SAL_CALL getPropertyByName(const OUString& Name)
|
|
||||||
throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
|
|
||||||
virtual sal_Bool SAL_CALL hasPropertyByName(const OUString& Name)
|
|
||||||
throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class StarBASIC;
|
class StarBASIC;
|
||||||
class SbxArray;
|
class SbxArray;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user