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/tkthrobber.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 : : //= UnoThrobberControlModel
43 : : //====================================================================
44 : : //--------------------------------------------------------------------
45 : 0 : UnoThrobberControlModel::UnoThrobberControlModel( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
46 : 0 : :UnoControlModel( i_factory )
47 : : {
48 [ # # ]: 0 : ImplRegisterProperty( BASEPROPERTY_BORDER );
49 [ # # ]: 0 : ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
50 [ # # ]: 0 : ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
51 [ # # ]: 0 : ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
52 [ # # ]: 0 : ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
53 [ # # ]: 0 : ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
54 [ # # ]: 0 : ImplRegisterProperty( BASEPROPERTY_HELPURL );
55 : 0 : }
56 : :
57 : : //--------------------------------------------------------------------
58 : 0 : ::rtl::OUString UnoThrobberControlModel::getServiceName( ) throw ( uno::RuntimeException )
59 : : {
60 : 0 : return ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControlModel );
61 : : }
62 : :
63 : : //--------------------------------------------------------------------
64 : 0 : uno::Any UnoThrobberControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
65 : : {
66 [ # # # ]: 0 : switch ( nPropId )
67 : : {
68 : : case BASEPROPERTY_DEFAULTCONTROL:
69 [ # # ]: 0 : return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControl ) );
70 : : case BASEPROPERTY_BORDER:
71 [ # # ]: 0 : return uno::makeAny( (sal_Int16) 0 );
72 : : default:
73 : 0 : return UnoControlModel::ImplGetDefaultValue( nPropId );
74 : : }
75 : : }
76 : :
77 : : //--------------------------------------------------------------------
78 : 0 : ::cppu::IPropertyArrayHelper& UnoThrobberControlModel::getInfoHelper()
79 : : {
80 : : static UnoPropertyArrayHelper* pHelper = NULL;
81 [ # # ]: 0 : if ( !pHelper )
82 : : {
83 [ # # ]: 0 : uno::Sequence< sal_Int32 > aIDs = ImplGetPropertyIds();
84 [ # # ][ # # ]: 0 : pHelper = new UnoPropertyArrayHelper( aIDs );
85 : : }
86 : 0 : return *pHelper;
87 : : }
88 : :
89 : : //--------------------------------------------------------------------
90 : 0 : uno::Reference< beans::XPropertySetInfo > UnoThrobberControlModel::getPropertySetInfo()
91 : : throw( uno::RuntimeException )
92 : : {
93 [ # # ][ # # ]: 0 : static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
[ # # ][ # # ]
[ # # ]
94 : 0 : return xInfo;
95 : : }
96 : :
97 : : //--------------------------------------------------------------------
98 : 0 : ::rtl::OUString SAL_CALL UnoThrobberControlModel::getImplementationName()
99 : : throw( uno::RuntimeException )
100 : : {
101 : 0 : return ::rtl::OUString( "com.sun.star.comp.toolkit.UnoThrobberControlModel" );
102 : : }
103 : :
104 : : //--------------------------------------------------------------------
105 : 0 : uno::Sequence< ::rtl::OUString > SAL_CALL UnoThrobberControlModel::getSupportedServiceNames()
106 : : throw( uno::RuntimeException )
107 : : {
108 : 0 : uno::Sequence< ::rtl::OUString > aServices( UnoControlModel::getSupportedServiceNames() );
109 [ # # ]: 0 : aServices.realloc( aServices.getLength() + 2 );
110 [ # # ]: 0 : aServices[sal::static_int_cast<sal_uInt32>(aServices.getLength()) - 2] =
111 : 0 : ::rtl::OUString::createFromAscii(szServiceName_UnoThrobberControlModel);
112 [ # # ]: 0 : aServices[sal::static_int_cast<sal_uInt32>(aServices.getLength()) - 1] =
113 : 0 : ::rtl::OUString::createFromAscii(szServiceName2_UnoThrobberControlModel);
114 : 0 : return aServices;
115 : : }
116 : :
117 : : //====================================================================
118 : : //= UnoThrobberControl
119 : : //====================================================================
120 : : //--------------------------------------------------------------------
121 : 0 : UnoThrobberControl::UnoThrobberControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
122 : 0 : :UnoControlBase( i_factory )
123 : : {
124 : 0 : }
125 : :
126 : : //--------------------------------------------------------------------
127 : 0 : ::rtl::OUString UnoThrobberControl::GetComponentServiceName()
128 : : {
129 : 0 : return ::rtl::OUString("Throbber");
130 : : }
131 : :
132 : : //--------------------------------------------------------------------
133 : 0 : uno::Any UnoThrobberControl::queryAggregation( const uno::Type & rType ) throw( uno::RuntimeException )
134 : : {
135 : 0 : uno::Any aRet = UnoControlBase::queryAggregation( rType );
136 [ # # ]: 0 : if ( !aRet.hasValue() )
137 [ # # ]: 0 : aRet = UnoThrobberControl_Base::queryInterface( rType );
138 : 0 : return aRet;
139 : : }
140 : :
141 : : //--------------------------------------------------------------------
142 [ # # ][ # # ]: 0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoThrobberControl, UnoControlBase, UnoThrobberControl_Base )
[ # # ]
143 : :
144 : : //--------------------------------------------------------------------
145 : 0 : void UnoThrobberControl::dispose() throw( uno::RuntimeException )
146 : : {
147 [ # # ]: 0 : ::osl::ClearableMutexGuard aGuard( GetMutex() );
148 : :
149 [ # # ][ # # ]: 0 : UnoControl::dispose();
150 : 0 : }
151 : :
152 : : //--------------------------------------------------------------------
153 : 0 : ::rtl::OUString SAL_CALL UnoThrobberControl::getImplementationName()
154 : : throw( uno::RuntimeException )
155 : : {
156 : 0 : return ::rtl::OUString( "com.sun.star.comp.toolkit.UnoThrobberControl" );
157 : : }
158 : :
159 : : //--------------------------------------------------------------------
160 : 0 : uno::Sequence< ::rtl::OUString > SAL_CALL UnoThrobberControl::getSupportedServiceNames()
161 : : throw( uno::RuntimeException )
162 : : {
163 : 0 : uno::Sequence< ::rtl::OUString > aServices( UnoControlBase::getSupportedServiceNames() );
164 [ # # ]: 0 : aServices.realloc( aServices.getLength() + 2 );
165 [ # # ]: 0 : aServices[sal::static_int_cast<sal_uInt32>(aServices.getLength()) - 2] =
166 : 0 : ::rtl::OUString::createFromAscii(szServiceName_UnoThrobberControl);
167 [ # # ]: 0 : aServices[sal::static_int_cast<sal_uInt32>(aServices.getLength()) - 1] =
168 : 0 : ::rtl::OUString::createFromAscii(szServiceName2_UnoThrobberControl);
169 : 0 : return aServices;
170 : : }
171 : :
172 : : //--------------------------------------------------------------------
173 : 0 : void UnoThrobberControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit,
174 : : const uno::Reference< awt::XWindowPeer > & rParentPeer )
175 : : throw( uno::RuntimeException )
176 : : {
177 : 0 : UnoControl::createPeer( rxToolkit, rParentPeer );
178 : 0 : }
179 : :
180 : : //--------------------------------------------------------------------
181 : 0 : void SAL_CALL UnoThrobberControl::start() throw ( uno::RuntimeException )
182 : : {
183 [ # # ]: 0 : ::osl::MutexGuard aGuard( GetMutex() );
184 : :
185 [ # # ][ # # ]: 0 : uno::Reference< XThrobber > xAnimation( getPeer(), uno::UNO_QUERY );
186 [ # # ]: 0 : if ( xAnimation.is() )
187 [ # # ][ # # ]: 0 : xAnimation->start();
[ # # ]
188 : 0 : }
189 : :
190 : : //--------------------------------------------------------------------
191 : 0 : void SAL_CALL UnoThrobberControl::stop() throw ( uno::RuntimeException )
192 : : {
193 [ # # ]: 0 : ::osl::MutexGuard aGuard( GetMutex() );
194 : :
195 [ # # ][ # # ]: 0 : uno::Reference< XThrobber > xAnimation( getPeer(), uno::UNO_QUERY );
196 [ # # ]: 0 : if ( xAnimation.is() )
197 [ # # ][ # # ]: 0 : xAnimation->stop();
[ # # ]
198 : 0 : }
199 : :
200 : : //........................................................................
201 : : } // namespace toolkit
202 : : //........................................................................
203 : :
204 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|