Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "toolkit/controls/tksimpleanimation.hxx"
30 : : #include "toolkit/helper/property.hxx"
31 : : #include "toolkit/helper/unopropertyarrayhelper.hxx"
32 : : #include <cppuhelper/typeprovider.hxx>
33 : :
34 : : //........................................................................
35 : : namespace toolkit
36 : : {
37 : : //........................................................................
38 : :
39 : : using namespace ::com::sun::star;
40 : :
41 : : //====================================================================
42 : : //= UnoSimpleAnimationControlModel
43 : : //====================================================================
44 : : //--------------------------------------------------------------------
45 : 0 : UnoSimpleAnimationControlModel::UnoSimpleAnimationControlModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
46 : 0 : :UnoControlModel( i_factory )
47 : : {
48 [ # # ]: 0 : ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
49 [ # # ]: 0 : ImplRegisterProperty( BASEPROPERTY_REPEAT );
50 [ # # ]: 0 : ImplRegisterProperty( BASEPROPERTY_STEP_TIME );
51 : 0 : }
52 : :
53 : : //--------------------------------------------------------------------
54 : 0 : ::rtl::OUString UnoSimpleAnimationControlModel::getServiceName()
55 : : throw( uno::RuntimeException )
56 : : {
57 : 0 : return ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControlModel );
58 : : }
59 : :
60 : : //--------------------------------------------------------------------
61 : 0 : uno::Any UnoSimpleAnimationControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
62 : : {
63 [ # # # # ]: 0 : switch ( nPropId )
64 : : {
65 : : case BASEPROPERTY_DEFAULTCONTROL:
66 [ # # ]: 0 : return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControl ) );
67 : :
68 : : case BASEPROPERTY_STEP_TIME:
69 [ # # ]: 0 : return uno::makeAny( (sal_Int32) 100 );
70 : :
71 : : case BASEPROPERTY_REPEAT:
72 [ # # ]: 0 : return uno::makeAny( (sal_Bool)sal_True );
73 : :
74 : : default:
75 : 0 : return UnoControlModel::ImplGetDefaultValue( nPropId );
76 : : }
77 : : }
78 : :
79 : : //--------------------------------------------------------------------
80 : 0 : ::cppu::IPropertyArrayHelper& UnoSimpleAnimationControlModel::getInfoHelper()
81 : : {
82 : : static UnoPropertyArrayHelper* pHelper = NULL;
83 [ # # ]: 0 : if ( !pHelper )
84 : : {
85 [ # # ]: 0 : uno::Sequence< sal_Int32 > aIDs = ImplGetPropertyIds();
86 [ # # ][ # # ]: 0 : pHelper = new UnoPropertyArrayHelper( aIDs );
87 : : }
88 : 0 : return *pHelper;
89 : : }
90 : :
91 : : //--------------------------------------------------------------------
92 : 0 : uno::Reference< beans::XPropertySetInfo > UnoSimpleAnimationControlModel::getPropertySetInfo( )
93 : : throw( uno::RuntimeException )
94 : : {
95 [ # # ][ # # ]: 0 : static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
[ # # ][ # # ]
[ # # ]
96 : 0 : return xInfo;
97 : : }
98 : :
99 : : //--------------------------------------------------------------------
100 : 0 : ::rtl::OUString SAL_CALL UnoSimpleAnimationControlModel::getImplementationName()
101 : : throw( uno::RuntimeException )
102 : : {
103 : 0 : return ::rtl::OUString( "com.sun.star.comp.toolkit.UnoSimpleAnimationControlModel" );
104 : : }
105 : :
106 : : //--------------------------------------------------------------------
107 : 0 : uno::Sequence< ::rtl::OUString > SAL_CALL UnoSimpleAnimationControlModel::getSupportedServiceNames()
108 : : throw( uno::RuntimeException )
109 : : {
110 : 0 : uno::Sequence< ::rtl::OUString > aServices( UnoControlModel::getSupportedServiceNames() );
111 [ # # ]: 0 : aServices.realloc( aServices.getLength() + 2 );
112 [ # # ]: 0 : aServices[sal::static_int_cast<sal_uInt32>(aServices.getLength()) - 2]
113 : 0 : = ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControlModel );
114 [ # # ]: 0 : aServices[sal::static_int_cast<sal_uInt32>(aServices.getLength()) - 1]
115 : 0 : = ::rtl::OUString::createFromAscii( szServiceName2_UnoSimpleAnimationControlModel );
116 : 0 : return aServices;
117 : : }
118 : :
119 : : //====================================================================
120 : : //= UnoSimpleAnimationControl
121 : : //====================================================================
122 : : //--------------------------------------------------------------------
123 : 0 : UnoSimpleAnimationControl::UnoSimpleAnimationControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
124 : 0 : :UnoSimpleAnimationControl_Base( i_factory )
125 : : {
126 : 0 : }
127 : :
128 : : //--------------------------------------------------------------------
129 : 0 : ::rtl::OUString UnoSimpleAnimationControl::GetComponentServiceName()
130 : : {
131 : 0 : return ::rtl::OUString("SimpleAnimation");
132 : : }
133 : :
134 : : //--------------------------------------------------------------------
135 : 0 : ::rtl::OUString SAL_CALL UnoSimpleAnimationControl::getImplementationName()
136 : : throw( uno::RuntimeException )
137 : : {
138 : 0 : return ::rtl::OUString( "com.sun.star.comp.toolkit.UnoSimpleAnimationControl" );
139 : : }
140 : :
141 : : //--------------------------------------------------------------------
142 : 0 : uno::Sequence< ::rtl::OUString > SAL_CALL UnoSimpleAnimationControl::getSupportedServiceNames()
143 : : throw( uno::RuntimeException )
144 : : {
145 : 0 : uno::Sequence< ::rtl::OUString > aServices( UnoSimpleAnimationControl_Base::getSupportedServiceNames() );
146 [ # # ]: 0 : aServices.realloc( aServices.getLength() + 1 );
147 [ # # ]: 0 : aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControl );
148 : 0 : return aServices;
149 : : }
150 : :
151 : : //--------------------------------------------------------------------
152 : 0 : void SAL_CALL UnoSimpleAnimationControl::start() throw ( uno::RuntimeException )
153 : : {
154 : 0 : uno::Reference< XSimpleAnimation > xAnimation;
155 : : {
156 [ # # ]: 0 : ::osl::MutexGuard aGuard( GetMutex() );
157 [ # # ][ # # ]: 0 : xAnimation.set( getPeer(), uno::UNO_QUERY );
[ # # ]
158 : : }
159 [ # # ]: 0 : if ( xAnimation.is() )
160 [ # # ][ # # ]: 0 : xAnimation->start();
161 : 0 : }
162 : :
163 : : //--------------------------------------------------------------------
164 : 0 : void SAL_CALL UnoSimpleAnimationControl::stop() throw ( uno::RuntimeException )
165 : : {
166 : 0 : uno::Reference< XSimpleAnimation > xAnimation;
167 : : {
168 [ # # ]: 0 : ::osl::MutexGuard aGuard( GetMutex() );
169 [ # # ][ # # ]: 0 : xAnimation.set( getPeer(), uno::UNO_QUERY );
[ # # ]
170 : : }
171 [ # # ]: 0 : if ( xAnimation.is() )
172 [ # # ][ # # ]: 0 : xAnimation->stop();
173 : 0 : }
174 : :
175 : : //--------------------------------------------------------------------
176 : 0 : void SAL_CALL UnoSimpleAnimationControl::setImageList( const uno::Sequence< uno::Reference< graphic::XGraphic > >& ImageList )
177 : : throw ( uno::RuntimeException )
178 : : {
179 : 0 : uno::Reference< XSimpleAnimation > xAnimation;
180 : : {
181 [ # # ]: 0 : ::osl::MutexGuard aGuard( GetMutex() );
182 [ # # ][ # # ]: 0 : xAnimation.set( getPeer(), uno::UNO_QUERY );
[ # # ]
183 : : }
184 [ # # ]: 0 : if ( xAnimation.is() )
185 [ # # ][ # # ]: 0 : xAnimation->setImageList( ImageList );
186 : 0 : }
187 : :
188 : : //........................................................................
189 : : } // namespace toolkit
190 : : //........................................................................
191 : :
192 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|