1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef TOOLKIT_ANIMATEDIMAGES_HXX 25 #define TOOLKIT_ANIMATEDIMAGES_HXX 26 27 #include "toolkit/controls/unocontrolbase.hxx" 28 #include "toolkit/controls/unocontrolmodel.hxx" 29 30 /** === begin UNO includes === **/ 31 #include <com/sun/star/awt/XAnimation.hpp> 32 #include <com/sun/star/awt/XAnimatedImages.hpp> 33 #include <com/sun/star/container/XContainerListener.hpp> 34 /** === end UNO includes === **/ 35 36 #include <cppuhelper/implbase1.hxx> 37 #include <cppuhelper/implbase2.hxx> 38 39 #include <boost/scoped_ptr.hpp> 40 41 //...................................................................................................................... 42 namespace toolkit 43 { 44 //...................................................................................................................... 45 46 //================================================================================================================== 47 //= 48 //================================================================================================================== 49 typedef ::cppu::AggImplInheritanceHelper2 < UnoControlBase 50 , ::com::sun::star::awt::XAnimation 51 , ::com::sun::star::container::XContainerListener 52 > AnimatedImagesControl_Base; 53 54 class AnimatedImagesControl : public AnimatedImagesControl_Base 55 { 56 public: 57 AnimatedImagesControl( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > const & i_factory ); 58 ::rtl::OUString GetComponentServiceName(); 59 60 // XAnimation 61 virtual void SAL_CALL startAnimation( ) throw (::com::sun::star::uno::RuntimeException); 62 virtual void SAL_CALL stopAnimation( ) throw (::com::sun::star::uno::RuntimeException); 63 virtual ::sal_Bool SAL_CALL isAnimationRunning( ) throw (::com::sun::star::uno::RuntimeException); 64 65 // XServiceInfo 66 ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); 67 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); 68 69 // XControl 70 sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& i_rModel ) throw ( ::com::sun::star::uno::RuntimeException ); 71 void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& i_toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& i_parentPeer ) throw(::com::sun::star::uno::RuntimeException); 72 73 74 // XContainerListener 75 virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException); 76 virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException); 77 virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException); 78 79 // XEventListener 80 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& i_event ) throw (::com::sun::star::uno::RuntimeException); 81 }; 82 83 //================================================================================================================== 84 //= AnimatedImagesControlModel 85 //================================================================================================================== 86 struct AnimatedImagesControlModel_Data; 87 typedef ::cppu::AggImplInheritanceHelper1 < UnoControlModel 88 , ::com::sun::star::awt::XAnimatedImages 89 > AnimatedImagesControlModel_Base; 90 class AnimatedImagesControlModel : public AnimatedImagesControlModel_Base 91 { 92 public: 93 AnimatedImagesControlModel( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > const & i_factory ); 94 AnimatedImagesControlModel( const AnimatedImagesControlModel& i_copySource ); 95 96 virtual UnoControlModel* Clone() const; 97 98 // XPropertySet 99 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); 100 101 // XPersistObject 102 ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); 103 104 // XServiceInfo 105 ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); 106 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); 107 108 // XAnimatedImages 109 virtual ::sal_Int32 SAL_CALL getStepTime() throw (::com::sun::star::uno::RuntimeException); 110 virtual void SAL_CALL setStepTime( ::sal_Int32 _steptime ) throw (::com::sun::star::uno::RuntimeException); 111 virtual ::sal_Bool SAL_CALL getAutoRepeat() throw (::com::sun::star::uno::RuntimeException); 112 virtual void SAL_CALL setAutoRepeat( ::sal_Bool _autorepeat ) throw (::com::sun::star::uno::RuntimeException); 113 virtual ::sal_Int16 SAL_CALL getScaleMode() throw (::com::sun::star::uno::RuntimeException); 114 virtual void SAL_CALL setScaleMode( ::sal_Int16 _scalemode ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 115 virtual ::sal_Int32 SAL_CALL getImageSetCount( ) throw (::com::sun::star::uno::RuntimeException); 116 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); 117 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); 118 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); 119 virtual void SAL_CALL removeImageSet( ::sal_Int32 i_index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 120 121 // XAnimatedImages::XContainer 122 virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& i_listener ) throw (::com::sun::star::uno::RuntimeException); 123 virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& i_listener ) throw (::com::sun::star::uno::RuntimeException); 124 125 protected: 126 ~AnimatedImagesControlModel(); 127 128 ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; 129 ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 130 void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception); 131 132 private: 133 ::boost::scoped_ptr< AnimatedImagesControlModel_Data > 134 m_pData; 135 }; 136 137 //...................................................................................................................... 138 } // namespace toolkit 139 //...................................................................................................................... 140 141 #endif // TOOLKIT_ANIMATEDIMAGES_HXX 142