summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-01-23 12:27:14 +0100
committerMatúš Kukan <matus.kukan@collabora.com>2014-01-23 23:38:59 +0100
commit3b40356e841ee2a7640743eebc3f9e4c14e8dfba (patch)
treed23b623d54dbd5671c21bcbd34ac84f9263c9058 /toolkit
parent574f963fad514031190ae2a838f1d11a9fa8449f (diff)
tk: Constructor feature for AnimatedImagesControl(Model).
Change-Id: I44a398a16d61796b48ecd212832252f23c063ace
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/controls/animatedimages.cxx144
-rw-r--r--toolkit/source/helper/registerservices.cxx5
-rw-r--r--toolkit/source/helper/servicenames.cxx2
-rw-r--r--toolkit/util/tk.component6
4 files changed, 90 insertions, 67 deletions
diff --git a/toolkit/source/controls/animatedimages.cxx b/toolkit/source/controls/animatedimages.cxx
index 5946869ca904..43f2199799d5 100644
--- a/toolkit/source/controls/animatedimages.cxx
+++ b/toolkit/source/controls/animatedimages.cxx
@@ -18,53 +18,69 @@
*/
-#include "toolkit/controls/animatedimages.hxx"
-#include "toolkit/helper/servicenames.hxx"
-#include "toolkit/helper/property.hxx"
-#include "toolkit/helper/unopropertyarrayhelper.hxx"
+#include <toolkit/controls/animatedimages.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/awt/VisualEffect.hpp>
#include <com/sun/star/awt/ImageScaleMode.hpp>
+#include <com/sun/star/awt/XAnimation.hpp>
+#include <com/sun/star/awt/XAnimatedImages.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/util/XModifyListener.hpp>
-//......................................................................................................................
-namespace toolkit
+#include <toolkit/controls/unocontrolbase.hxx>
+#include <toolkit/controls/unocontrolmodel.hxx>
+
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+using namespace css::awt;
+using namespace css::container;
+using namespace css::lang;
+using namespace css::uno;
+
+namespace {
+
+typedef ::cppu::AggImplInheritanceHelper2 < UnoControlBase
+ , css::awt::XAnimation
+ , css::container::XContainerListener
+ > AnimatedImagesControl_Base;
+
+class AnimatedImagesControl : public AnimatedImagesControl_Base
{
-//......................................................................................................................
-
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::XInterface;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::UNO_SET_THROW;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::uno::RuntimeException;
- using ::com::sun::star::uno::Any;
- using ::com::sun::star::uno::makeAny;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::uno::Type;
- using ::com::sun::star::container::ContainerEvent;
- using ::com::sun::star::container::XContainerListener;
- using ::com::sun::star::beans::XPropertySetInfo;
- using ::com::sun::star::lang::DisposedException;
- using ::com::sun::star::lang::IndexOutOfBoundsException;
- using ::com::sun::star::lang::EventObject;
- using ::com::sun::star::awt::XControlModel;
- using ::com::sun::star::awt::XAnimatedImages;
- using ::com::sun::star::lang::IllegalArgumentException;
- using ::com::sun::star::awt::XWindowPeer;
- using ::com::sun::star::util::XModifyListener;
- using ::com::sun::star::awt::XToolkit;
- using ::com::sun::star::lang::XMultiServiceFactory;
-
- namespace VisualEffect = ::com::sun::star::awt::VisualEffect;
- namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode;
-
- //==================================================================================================================
- //= AnimatedImagesControl
- //==================================================================================================================
- //------------------------------------------------------------------------------------------------------------------
+public:
+ AnimatedImagesControl();
+ OUString GetComponentServiceName();
+
+ // XAnimation
+ virtual void SAL_CALL startAnimation( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL stopAnimation( ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isAnimationRunning( ) throw (css::uno::RuntimeException);
+
+ // XServiceInfo
+ OUString SAL_CALL getImplementationName( ) throw(css::uno::RuntimeException);
+ css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(css::uno::RuntimeException);
+
+ // XControl
+ sal_Bool SAL_CALL setModel( const css::uno::Reference< css::awt::XControlModel >& i_rModel ) throw ( css::uno::RuntimeException );
+ void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& i_toolkit, const css::uno::Reference< css::awt::XWindowPeer >& i_parentPeer ) throw(css::uno::RuntimeException);
+
+
+ // XContainerListener
+ virtual void SAL_CALL elementInserted( const css::container::ContainerEvent& Event ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved( const css::container::ContainerEvent& Event ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced( const css::container::ContainerEvent& Event ) throw (css::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& i_event ) throw (css::uno::RuntimeException);
+};
+
AnimatedImagesControl::AnimatedImagesControl()
:AnimatedImagesControl_Base()
{
@@ -112,7 +128,7 @@ namespace toolkit
{
Sequence< OUString > aServices( AnimatedImagesControl_Base::getSupportedServiceNames() );
aServices.realloc( aServices.getLength() + 1 );
- aServices[ aServices.getLength() - 1 ] = OUString::createFromAscii( szServiceName_AnimatedImagesControl );
+ aServices[ aServices.getLength() - 1 ] = OUString("com.sun.star.awt.AnimatedImagesControl");
return aServices;
}
@@ -121,7 +137,7 @@ namespace toolkit
{
void lcl_updatePeer( Reference< XWindowPeer > const& i_peer, Reference< XControlModel > const& i_model )
{
- const Reference< XModifyListener > xPeerModify( i_peer, UNO_QUERY );
+ const Reference< css::util::XModifyListener > xPeerModify( i_peer, UNO_QUERY );
if ( xPeerModify.is() )
{
EventObject aEvent;
@@ -189,9 +205,10 @@ namespace toolkit
UnoControlBase::disposing( i_event );
}
- //==================================================================================================================
- //= AnimatedImagesControlModel_Data
- //==================================================================================================================
+}
+
+namespace toolkit {
+
struct AnimatedImagesControlModel_Data
{
::std::vector< Sequence< OUString > > aImageSets;
@@ -224,10 +241,7 @@ namespace toolkit
}
}
- //==================================================================================================================
- //= AnimatedImagesControlModel
- //==================================================================================================================
- //------------------------------------------------------------------------------------------------------------------
+
AnimatedImagesControlModel::AnimatedImagesControlModel( Reference< com::sun::star::uno::XComponentContext > const & i_factory )
:AnimatedImagesControlModel_Base( i_factory )
,m_pData( new AnimatedImagesControlModel_Data )
@@ -263,16 +277,16 @@ namespace toolkit
}
//------------------------------------------------------------------------------------------------------------------
- Reference< XPropertySetInfo > SAL_CALL AnimatedImagesControlModel::getPropertySetInfo( ) throw(RuntimeException)
+ Reference< css::beans::XPropertySetInfo > SAL_CALL AnimatedImagesControlModel::getPropertySetInfo( ) throw(RuntimeException)
{
- static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ static Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
//------------------------------------------------------------------------------------------------------------------
OUString SAL_CALL AnimatedImagesControlModel::getServiceName() throw(RuntimeException)
{
- return OUString::createFromAscii( szServiceName_AnimatedImagesControlModel );
+ return OUString("com.sun.star.awt.AnimatedImagesControlModel");
}
//------------------------------------------------------------------------------------------------------------------
@@ -285,7 +299,7 @@ namespace toolkit
Sequence< OUString > SAL_CALL AnimatedImagesControlModel::getSupportedServiceNames() throw(RuntimeException)
{
Sequence< OUString > aServiceNames(2);
- aServiceNames[0] = OUString::createFromAscii( szServiceName_AnimatedImagesControlModel );
+ aServiceNames[0] = "com.sun.star.awt.AnimatedImagesControlModel";
aServiceNames[1] = "com.sun.star.awt.UnoControlModel";
return aServiceNames;
}
@@ -317,10 +331,10 @@ namespace toolkit
switch ( i_propertyId )
{
case BASEPROPERTY_DEFAULTCONTROL:
- return makeAny( OUString::createFromAscii( szServiceName_AnimatedImagesControl ) );
+ return makeAny( OUString("com.sun.star.awt.AnimatedImagesControl") );
case BASEPROPERTY_BORDER:
- return makeAny( VisualEffect::NONE );
+ return makeAny( css::awt::VisualEffect::NONE );
case BASEPROPERTY_STEP_TIME:
return makeAny( (sal_Int32) 100 );
@@ -477,8 +491,22 @@ namespace toolkit
BrdcstHelper.removeListener( cppu::UnoType<XContainerListener>::get(), i_listener );
}
-//......................................................................................................................
-} // namespace toolkit
-//......................................................................................................................
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+org_openoffice_comp_toolkit_AnimatedImagesControl_get_implementation(
+ css::uno::XComponentContext *,
+ css::uno::Sequence<css::uno::Any> const &)
+{
+ return cppu::acquire(new AnimatedImagesControl());
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+org_openoffice_comp_toolkit_AnimatedImagesControlModel_get_implementation(
+ css::uno::XComponentContext *context,
+ css::uno::Sequence<css::uno::Any> const &)
+{
+ return cppu::acquire(new toolkit::AnimatedImagesControlModel(context));
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx
index 125c6682e3c8..701a7aa114ed 100644
--- a/toolkit/source/helper/registerservices.cxx
+++ b/toolkit/source/helper/registerservices.cxx
@@ -41,7 +41,6 @@
#include <toolkit/controls/roadmapcontrol.hxx>
#include <toolkit/controls/tkscrollbar.hxx>
#include "toolkit/controls/tkspinbutton.hxx"
-#include <toolkit/controls/animatedimages.hxx>
#include <toolkit/controls/tabpagemodel.hxx>
#include <toolkit/controls/tabpagecontainer.hxx>
#include "toolkit/dllapi.h"
@@ -175,8 +174,6 @@ IMPL_CREATEINSTANCE_CTX( UnoControlTabPage )
IMPL_CREATEINSTANCE_CTX( UnoControlTabPageModel )
IMPL_CREATEINSTANCE_CTX( UnoControlTabPageContainer )
IMPL_CREATEINSTANCE_CTX( UnoControlTabPageContainerModel )
-IMPL_CREATEINSTANCE( AnimatedImagesControl )
-IMPL_CREATEINSTANCE_CTX( AnimatedImagesControlModel )
IMPL_CREATE_INSTANCE_WITH_GEOMETRY( UnoControlDialogModel )
@@ -280,8 +277,6 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL tk_component_getFactory( const sal_Char* sImple
GET_FACTORY( UnoControlTabPage, szServiceName_UnoControlTabPage, NULL )
GET_FACTORY( UnoControlTabPageContainerModel, szServiceName_UnoControlTabPageContainerModel, NULL )
GET_FACTORY( UnoControlTabPageContainer, szServiceName_UnoControlTabPageContainer, NULL )
- GET_FACTORY_WITH_IMPL_PREFIX( AnimatedImagesControl, "org.openoffice.comp.toolkit", szServiceName_AnimatedImagesControl, NULL )
- GET_FACTORY_WITH_IMPL_PREFIX( AnimatedImagesControlModel, "org.openoffice.comp.toolkit", szServiceName_AnimatedImagesControlModel, NULL )
if ( rtl_str_compare( sImplementationName, "com.sun.star.awt.comp.AsyncCallback" ) == 0 )
return comp_AsyncCallback_component_getFactory( sImplementationName, _pServiceManager, _pRegistryKey );
diff --git a/toolkit/source/helper/servicenames.cxx b/toolkit/source/helper/servicenames.cxx
index 5e896ab451d5..50ca170b9816 100644
--- a/toolkit/source/helper/servicenames.cxx
+++ b/toolkit/source/helper/servicenames.cxx
@@ -83,8 +83,6 @@ const sal_Char szServiceName_UnoMultiPageModel[] = "com.sun.star.awt.UnoMultiPag
const sal_Char szServiceName_UnoPageControl[] = "com.sun.star.awt.UnoControlPage";
const sal_Char szServiceName_UnoPageModel[] = "com.sun.star.awt.UnoPageModel";
const sal_Char szServiceName_UnoFrameControl[] = "com.sun.star.awt.UnoControlFrame";
-const sal_Char szServiceName_AnimatedImagesControl[] = "com.sun.star.awt.AnimatedImagesControl";
-const sal_Char szServiceName_AnimatedImagesControlModel[] = "com.sun.star.awt.AnimatedImagesControlModel";
const sal_Char szServiceName_UnoFrameModel[] = "com.sun.star.awt.UnoFrameModel";
const sal_Char szServiceName_TreeControl[] = "com.sun.star.awt.tree.TreeControl";
const sal_Char szServiceName_TreeControlModel[] = "com.sun.star.awt.tree.TreeControlModel";
diff --git a/toolkit/util/tk.component b/toolkit/util/tk.component
index 1a758303988c..c8bdc30b1211 100644
--- a/toolkit/util/tk.component
+++ b/toolkit/util/tk.component
@@ -259,10 +259,12 @@
constructor="org_openoffice_comp_toolkit_SpinningProgressControlModel_get_implementation">
<service name="com.sun.star.awt.SpinningProgressControlModel"/>
</implementation>
- <implementation name="org.openoffice.comp.toolkit.AnimatedImagesControlModel">
+ <implementation name="org.openoffice.comp.toolkit.AnimatedImagesControlModel"
+ constructor="org_openoffice_comp_toolkit_AnimatedImagesControlModel_get_implementation">
<service name="com.sun.star.awt.AnimatedImagesControlModel"/>
</implementation>
- <implementation name="org.openoffice.comp.toolkit.AnimatedImagesControl">
+ <implementation name="org.openoffice.comp.toolkit.AnimatedImagesControl"
+ constructor="org_openoffice_comp_toolkit_AnimatedImagesControl_get_implementation">
<service name="com.sun.star.awt.AnimatedImagesControl"/>
</implementation>
<implementation name="stardiv.Toolkit.UnoSpinButtonControl">