[Libreoffice] cppu::OPropertySetHelper ABI backwards compatibility

Lionel Elie Mamane lionel at mamane.lu
Tue Aug 23 08:00:08 PDT 2011


On Mon, Aug 22, 2011 at 08:35:11PM -0400, Kohei Yoshida wrote:
> On Mon, 2011-08-22 at 19:06 -0400, Kohei Yoshida wrote:

>> BTW, how do you plan to use that m_bFireEvent data member to decide to
>> skip or fire events in OPropertySetHelper::fire() ?  The method that
>> needs to be influenced by that boolean is still in the
>> OPropertySetHelper.

> Actually, if this becomes problematic we probably *could* move this
> boolean into OPropertySetHelper::Impl* m_pReserved.  That member is a
> protected member, so the derived class should have access to it.

The problem of m_bFireEvent is solved, but I don't know what to do
with queryInterface; since it is not virtual, I cannot override it in
OPropertySetHelper2. The best I could come up with is something like (in
OPropertySetHelper):

Any OPropertySetHelper::queryInterface( const ::com::sun::star::uno::Type & rType )
    throw (RuntimeException)
{
    if ( rType == ::com::sun::star::beans::XPropertySetOption::static_type() )
    {
        XPropertySetOption * tmp = dynamic_cast< XPropertySetOption * >( this );
	if ( tmp )
           return Any( &tmp, rType );
	else
	   return Any();
    }
   else
        return ::cppu::queryInterface(
            rType,
            static_cast< XPropertySet * >( this ),
            static_cast< XMultiPropertySet * >( this ),
            static_cast< XFastPropertySet * >( this ) )
}

But that is very ugly, since OPropertySetHelper has to know about
*all* the interfaces implemented by its derivatives!

Any better idea?

-- 
Lionel


More information about the LibreOffice mailing list