Issue 121161 - c.s.s.awt.XAnimatedImages attributes are in fact properties
Summary: c.s.s.awt.XAnimatedImages attributes are in fact properties
Status: ACCEPTED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P3 Normal
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-04 18:33 UTC by bmarcelly
Modified: 2017-05-20 11:27 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Macro that analyses StepTime, AutoRepeat, ScaleMode (12.72 KB, application/vnd.oasis.opendocument.text)
2012-10-04 18:33 UTC, bmarcelly
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description bmarcelly 2012-10-04 18:33:45 UTC
Created attachment 79733 [details]
Macro that analyses StepTime, AutoRepeat, ScaleMode

IDL reference says that interface com.sun.star.awt.XAnimatedImages exposes these attributes :
  StepTime
  AutoRepeat
  ScaleMode

Introspection does not say that. It says they are ordinary properties (they have PropertyConcept PROPERTYSET).
And indeed they are accessible through setPropertyValue() and getPropertyValue()

So there is an error somewhere : either they are properties of service com.sun.star.awt.AnimatedImages, or they are attributes but incorrectly declared.

The attachment contains a macro as proof.
Comment 1 Ariel Constenla-Haile 2012-10-04 19:36:23 UTC
On IDL they are defined as interface attributes:

http://svn.apache.org/viewvc/incubator/ooo/trunk/main/offapi/com/sun/star/awt/XAnimatedImages.idl?revision=1244492&view=markup#l53

This works on the C++ bridge: generated header file XAnimatedImages.idl


class SAL_NO_VTABLE XAnimatedImages : public ::com::sun::star::container::XContainer
{
public:

    // Attributes
    virtual ::sal_Int32 SAL_CALL getStepTime() throw (::com::sun::star::uno::RuntimeException) = 0;
    virtual void SAL_CALL setStepTime( ::sal_Int32 _steptime ) throw (::com::sun::star::uno::RuntimeException) = 0;
    virtual ::sal_Bool SAL_CALL getAutoRepeat() throw (::com::sun::star::uno::RuntimeException) = 0;
    virtual void SAL_CALL setAutoRepeat( ::sal_Bool _autorepeat ) throw (::com::sun::star::uno::RuntimeException) = 0;
    virtual ::sal_Int16 SAL_CALL getScaleMode() throw (::com::sun::star::uno::RuntimeException) = 0;
    virtual void SAL_CALL setScaleMode( ::sal_Int16 _scalemode ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) = 0;

    // Methods
    virtual ::sal_Int32 SAL_CALL getImageSetCount(  ) throw (::com::sun::star::uno::RuntimeException) = 0;
    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getImageSet( ::sal_Int32 i_index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) = 0;
    virtual void SAL_CALL insertImageSet( ::sal_Int32 i_index, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& i_imageURLs ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) = 0;
    virtual void SAL_CALL replaceImageSet( ::sal_Int32 i_index, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& i_imageURLs ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) = 0;
    virtual void SAL_CALL removeImageSet( ::sal_Int32 i_index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) = 0;

    static inline ::com::sun::star::uno::Type const & SAL_CALL static_type(void * = 0);
};


Interface attributes are mapped to getter (and setter, if attribute is not readonly) member functions in C++.
This should be documented somewhere, but I couldn't find it, nor here at least: http://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/C%2B%2B/Mapping_of_Interface_Types

So, the IDL side is fine.
The bug is in the implementation of the control model:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/toolkit/source/controls/animatedimages.cxx?revision=1244544&view=markup#l239

AnimatedImagesControlModel::AnimatedImagesControlModel registers these three attributes as properties:

        ImplRegisterProperty( BASEPROPERTY_AUTO_REPEAT );
	ImplRegisterProperty( BASEPROPERTY_IMAGE_SCALE_MODE );
        ImplRegisterProperty( BASEPROPERTY_STEP_TIME );
Comment 2 Ariel Constenla-Haile 2012-10-04 20:31:20 UTC
The three attributes are treated as properties in the window peer impl., I think this can be left as is, it is harmless, although I doubt anyone sets properties at the window peer.

The result would be something as the following:

Sub Main
Dim dlg As Object, aic as Object, aicm As Object

DialogLibraries.loadLibrary("Standard")
dlg = CreateUnoDialog(DialogLibraries.getByName("Standard").getByName("Dialog1"))
aicm = dlg.Model.createInstance("com.sun.star.awt.AnimatedImagesControlModel")
dlg.Model.insertByName("aicm",aicm)
aic = dlg.getControl("aicm")

showPropertyConcept(aicm, "ScaleMode")
showPropertyConcept(aicm, "StepTime")
showPropertyConcept(aicm, "AutoRepeat")

' verify that StepTime is NOT accessible as a property
On Error Resume Next
aicm.setPropertyValue("StepTime", 355)'Error, no property
aic.getPeer().setProperty("StepTime", 355)
'OK, setProperty() - function in interface ::com::sun::star::awt::XVclWindowPeer
MsgBox("StepTime = " & aic.getPeer().getProperty("StepTime") )

aicm.StepTime = 200
aicm.AutoRepeat = False

End Sub
Comment 3 Marcus 2017-05-20 11:27:38 UTC
Reset assigne to the default "issues@openoffice.apache.org".