Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <com/sun/star/awt/XControl.hpp>
21 : #include <com/sun/star/awt/XControlContainer.hpp>
22 : #include <com/sun/star/awt/FontWeight.hpp>
23 : #include <com/sun/star/awt/FontSlant.hpp>
24 : #include <com/sun/star/awt/FontStrikeout.hpp>
25 : #include <com/sun/star/awt/FontUnderline.hpp>
26 : #include <com/sun/star/container/XNameContainer.hpp>
27 : #include <com/sun/star/script/XInvocation.hpp>
28 : #include <com/sun/star/lang/WrappedTargetException.hpp>
29 : #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
30 :
31 : #include "vbacontrols.hxx"
32 : #include "vbacontrol.hxx"
33 : #include <cppuhelper/implbase2.hxx>
34 : #include <ooo/vba/XControlProvider.hpp>
35 : #include <unordered_map>
36 :
37 : using namespace com::sun::star;
38 : using namespace ooo::vba;
39 :
40 :
41 : typedef ::cppu::WeakImplHelper2< container::XNameAccess, container::XIndexAccess > ArrayWrapImpl;
42 :
43 : typedef std::unordered_map< OUString, sal_Int32, OUStringHash,
44 : std::equal_to< OUString > > ControlIndexMap;
45 : typedef std::vector< uno::Reference< awt::XControl > > ControlVec;
46 :
47 0 : class ControlArrayWrapper : public ArrayWrapImpl
48 : {
49 : uno::Reference< awt::XControlContainer > mxDialog;
50 : uno::Sequence< OUString > msNames;
51 : ControlVec mControls;
52 : ControlIndexMap mIndices;
53 :
54 : private:
55 0 : void SetArrayElementTo( const uno::Reference< awt::XControl >& xCtrl, sal_Int32 nIndex = -1 )
56 : {
57 : // initialize the element with specified index to the control
58 0 : if ( xCtrl.is() )
59 : {
60 0 : if ( nIndex == -1 )
61 0 : nIndex = msNames.getLength();
62 :
63 0 : if ( nIndex >= msNames.getLength() )
64 0 : msNames.realloc( nIndex );
65 :
66 0 : msNames[ nIndex ] = getControlName( xCtrl );
67 0 : mControls.push_back( xCtrl );
68 0 : mIndices[ msNames[ nIndex ] ] = nIndex;
69 : }
70 0 : }
71 : void getNestedControls( ControlVec& vControls, uno::Reference< awt::XControlContainer >& xContainer )
72 : {
73 : uno::Sequence< uno::Reference< awt::XControl > > aControls = xContainer->getControls();
74 : const uno::Reference< awt::XControl >* pCtrl = aControls.getConstArray();
75 : const uno::Reference< awt::XControl >* pCtrlsEnd = pCtrl + aControls.getLength();
76 : for ( ; pCtrl < pCtrlsEnd; ++pCtrl )
77 : {
78 : uno::Reference< awt::XControlContainer > xC( *pCtrl, uno::UNO_QUERY );
79 : vControls.push_back( *pCtrl );
80 : if ( xC.is() )
81 : getNestedControls( vControls, xC );
82 : }
83 : }
84 : public:
85 0 : explicit ControlArrayWrapper( const uno::Reference< awt::XControl >& xDialog )
86 0 : {
87 : try
88 : {
89 0 : mxDialog.set( xDialog, uno::UNO_QUERY_THROW );
90 0 : uno::Sequence< uno::Reference< awt::XControl > > sXControls = mxDialog->getControls();
91 :
92 0 : msNames.realloc( sXControls.getLength() );
93 0 : for ( sal_Int32 i = 0; i < sXControls.getLength(); ++i )
94 0 : SetArrayElementTo( sXControls[ i ], i );
95 : }
96 0 : catch (const uno::Exception&)
97 : {
98 : // accept the case when the dialog already does not exist
99 : // in this case the wrapper should work in dummy mode
100 : }
101 0 : }
102 :
103 0 : static OUString getControlName( const uno::Reference< awt::XControl >& xCtrl )
104 : {
105 0 : if ( !xCtrl.is() )
106 0 : throw uno::RuntimeException();
107 :
108 0 : uno::Reference< beans::XPropertySet > xProp( xCtrl->getModel(), uno::UNO_QUERY_THROW );
109 0 : OUString sName;
110 0 : xProp->getPropertyValue( "Name" ) >>= sName;
111 0 : return sName;
112 : }
113 :
114 :
115 : // XElementAccess
116 0 : virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
117 : {
118 0 : return cppu::UnoType<awt::XControl>::get();
119 : }
120 :
121 0 : virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
122 : {
123 0 : return ( !mControls.empty() );
124 : }
125 :
126 : // XNameAcess
127 0 : virtual uno::Any SAL_CALL getByName( const OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception) SAL_OVERRIDE
128 : {
129 0 : if ( !hasByName( aName ) )
130 0 : throw container::NoSuchElementException();
131 0 : return getByIndex( mIndices[ aName ] );
132 : }
133 :
134 0 : virtual uno::Sequence< OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
135 : {
136 0 : return msNames;
137 : }
138 :
139 0 : virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
140 : {
141 0 : ControlIndexMap::iterator it = mIndices.find( aName );
142 0 : return it != mIndices.end();
143 : }
144 :
145 : // XElementAccess
146 0 : virtual ::sal_Int32 SAL_CALL getCount( ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
147 : {
148 0 : return mControls.size();
149 : }
150 :
151 0 : virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception ) SAL_OVERRIDE
152 : {
153 0 : if ( Index < 0 || Index >= static_cast< sal_Int32 >( mControls.size() ) )
154 0 : throw lang::IndexOutOfBoundsException();
155 0 : return uno::makeAny( mControls[ Index ] );
156 : }
157 : };
158 :
159 :
160 0 : class ControlsEnumWrapper : public EnumerationHelper_BASE
161 : {
162 : uno::Reference<XHelperInterface > m_xParent;
163 : uno::Reference<uno::XComponentContext > m_xContext;
164 : uno::Reference<container::XIndexAccess > m_xIndexAccess;
165 : uno::Reference<awt::XControl > m_xDlg;
166 : uno::Reference< frame::XModel > m_xModel;
167 : double mfOffsetX;
168 : double mfOffsetY;
169 : sal_Int32 nIndex;
170 :
171 : public:
172 :
173 0 : ControlsEnumWrapper(
174 : const uno::Reference< XHelperInterface >& xParent,
175 : const uno::Reference< uno::XComponentContext >& xContext,
176 : const uno::Reference< container::XIndexAccess >& xIndexAccess,
177 : const uno::Reference< awt::XControl >& xDlg,
178 : const uno::Reference< frame::XModel >& xModel,
179 : double fOffsetX, double fOffsetY ) :
180 : m_xParent( xParent ),
181 : m_xContext( xContext),
182 : m_xIndexAccess( xIndexAccess ),
183 : m_xDlg( xDlg ),
184 : m_xModel( xModel ),
185 : mfOffsetX( fOffsetX ),
186 : mfOffsetY( fOffsetY ),
187 0 : nIndex( 0 ) {}
188 :
189 0 : virtual sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
190 : {
191 0 : return ( nIndex < m_xIndexAccess->getCount() );
192 : }
193 :
194 0 : virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception) SAL_OVERRIDE
195 : {
196 0 : if ( nIndex < m_xIndexAccess->getCount() )
197 : {
198 0 : uno::Reference< awt::XControl > xControl;
199 0 : m_xIndexAccess->getByIndex( nIndex++ ) >>= xControl;
200 :
201 0 : uno::Reference< msforms::XControl > xVBAControl;
202 0 : if ( xControl.is() && m_xDlg.is() )
203 0 : xVBAControl = ScVbaControlFactory::createUserformControl( m_xContext, xControl, m_xDlg, m_xModel, mfOffsetX, mfOffsetY );
204 0 : return uno::makeAny( xVBAControl );
205 : }
206 0 : throw container::NoSuchElementException();
207 : }
208 :
209 : };
210 :
211 :
212 : static uno::Reference<container::XIndexAccess >
213 0 : lcl_controlsWrapper( const uno::Reference< awt::XControl >& xDlg )
214 : {
215 0 : return new ControlArrayWrapper( xDlg );
216 : }
217 :
218 0 : ScVbaControls::ScVbaControls(
219 : const uno::Reference< XHelperInterface >& xParent,
220 : const uno::Reference< uno::XComponentContext >& xContext,
221 : const css::uno::Reference< awt::XControl >& xDialog,
222 : const uno::Reference< frame::XModel >& xModel,
223 : double fOffsetX, double fOffsetY ) :
224 : ControlsImpl_BASE( xParent, xContext, lcl_controlsWrapper( xDialog ) ),
225 : mxDialog( xDialog ),
226 : mxModel( xModel ),
227 : mfOffsetX( fOffsetX ),
228 0 : mfOffsetY( fOffsetY )
229 : {
230 0 : }
231 :
232 : uno::Reference< container::XEnumeration >
233 0 : ScVbaControls::createEnumeration() throw (uno::RuntimeException)
234 : {
235 0 : uno::Reference< container::XEnumeration > xEnum( new ControlsEnumWrapper( mxParent, mxContext, m_xIndexAccess, mxDialog, mxModel, mfOffsetX, mfOffsetY ) );
236 0 : if ( !xEnum.is() )
237 0 : throw uno::RuntimeException();
238 0 : return xEnum;
239 : }
240 :
241 : uno::Any
242 0 : ScVbaControls::createCollectionObject( const css::uno::Any& aSource )
243 : {
244 : // Create control from awt::XControl
245 0 : uno::Reference< awt::XControl > xControl( aSource, uno::UNO_QUERY_THROW );
246 0 : uno::Reference< msforms::XControl > xVBAControl = ScVbaControlFactory::createUserformControl( mxContext, xControl, mxDialog, mxModel, mfOffsetX, mfOffsetY );
247 0 : return uno::Any( xVBAControl );
248 : }
249 :
250 : void SAL_CALL
251 0 : ScVbaControls::Move( double cx, double cy ) throw (uno::RuntimeException, std::exception)
252 : {
253 0 : uno::Reference< container::XEnumeration > xEnum( createEnumeration() );
254 0 : while ( xEnum->hasMoreElements() )
255 : {
256 0 : uno::Reference< msforms::XControl > xControl( xEnum->nextElement(), uno::UNO_QUERY_THROW );
257 0 : xControl->setLeft( xControl->getLeft() + cx );
258 0 : xControl->setTop( xControl->getTop() + cy );
259 0 : }
260 0 : }
261 :
262 0 : uno::Any SAL_CALL ScVbaControls::Add( const uno::Any& Object, const uno::Any& StringKey, const uno::Any& /*Before*/, const uno::Any& /*After*/ )
263 : throw (uno::RuntimeException, std::exception)
264 : {
265 0 : uno::Any aResult;
266 0 : OUString aComServiceName;
267 :
268 : try
269 : {
270 0 : if ( !mxDialog.is() )
271 0 : throw uno::RuntimeException();
272 :
273 0 : uno::Reference< awt::XControl > xNewControl;
274 0 : uno::Reference< lang::XMultiServiceFactory > xModelFactory( mxDialog->getModel(), uno::UNO_QUERY_THROW );
275 :
276 0 : uno::Reference< container::XNameContainer > xDialogContainer( xModelFactory, uno::UNO_QUERY_THROW );
277 :
278 0 : Object >>= aComServiceName;
279 :
280 : // TODO: Support Before and After?
281 0 : OUString aNewName;
282 0 : StringKey >>= aNewName;
283 0 : if ( aNewName.isEmpty() )
284 : {
285 0 : aNewName = aComServiceName;
286 0 : if ( aNewName.isEmpty() )
287 0 : aNewName = "Control";
288 :
289 0 : sal_Int32 nInd = 0;
290 0 : while( xDialogContainer->hasByName( aNewName ) && (nInd < SAL_MAX_INT32) )
291 : {
292 0 : aNewName = aComServiceName;
293 0 : aNewName += OUString::number( nInd++ );
294 : }
295 : }
296 :
297 0 : double fDefWidth = 72.0, fDefHeight = 18.0;
298 0 : if ( !aComServiceName.isEmpty() )
299 : {
300 : // create a UNO control model based on the passed control type
301 0 : uno::Reference< awt::XControlModel > xNewModel;
302 0 : bool bFontSupport = false;
303 0 : bool bNativeAX = false;
304 0 : if( aComServiceName.equalsIgnoreAsciiCase( "Forms.CommandButton.1" ) )
305 : {
306 0 : xNewModel.set( xModelFactory->createInstance( "com.sun.star.awt.UnoControlButtonModel" ), uno::UNO_QUERY_THROW );
307 0 : fDefWidth = 72.0; fDefHeight = 24.0;
308 0 : bFontSupport = true;
309 : }
310 0 : else if( aComServiceName.equalsIgnoreAsciiCase( "Forms.Label.1" ) )
311 : {
312 0 : xNewModel.set( xModelFactory->createInstance( "com.sun.star.awt.UnoControlFixedTextModel" ), uno::UNO_QUERY_THROW );
313 0 : fDefWidth = 72.0; fDefHeight = 18.0;
314 0 : bFontSupport = true;
315 : }
316 0 : else if( aComServiceName.equalsIgnoreAsciiCase( "Forms.Image.1" ) )
317 : {
318 0 : xNewModel.set( xModelFactory->createInstance( "com.sun.star.awt.UnoControlImageControlModel" ), uno::UNO_QUERY_THROW );
319 0 : fDefWidth = 72.0; fDefHeight = 72.0;
320 : }
321 0 : else if( aComServiceName.equalsIgnoreAsciiCase( "Forms.CheckBox.1" ) )
322 : {
323 0 : xNewModel.set( xModelFactory->createInstance( "com.sun.star.awt.UnoControlCheckBoxModel" ), uno::UNO_QUERY_THROW );
324 0 : fDefWidth = 108.0; fDefHeight = 18.0;
325 0 : bFontSupport = true;
326 : }
327 0 : else if( aComServiceName.equalsIgnoreAsciiCase( "Forms.OptionButton.1" ) )
328 : {
329 0 : xNewModel.set( xModelFactory->createInstance( "com.sun.star.awt.UnoControlRadioButtonModel" ), uno::UNO_QUERY_THROW );
330 0 : fDefWidth = 108.0; fDefHeight = 18.0;
331 0 : bFontSupport = true;
332 : }
333 0 : else if( aComServiceName.equalsIgnoreAsciiCase( "Forms.TextBox.1" ) )
334 : {
335 0 : xNewModel.set( xModelFactory->createInstance( "com.sun.star.awt.UnoControlEditModel" ), uno::UNO_QUERY_THROW );
336 0 : fDefWidth = 72.0; fDefHeight = 18.0;
337 0 : bFontSupport = true;
338 : }
339 0 : else if( aComServiceName.equalsIgnoreAsciiCase( "Forms.ListBox.1" ) )
340 : {
341 0 : xNewModel.set( xModelFactory->createInstance( "com.sun.star.awt.UnoControlListBoxModel" ), uno::UNO_QUERY_THROW );
342 0 : fDefWidth = 72.0; fDefHeight = 18.0;
343 0 : bFontSupport = true;
344 : }
345 0 : else if( aComServiceName.equalsIgnoreAsciiCase( "Forms.ComboBox.1" ) )
346 : {
347 0 : xNewModel.set( xModelFactory->createInstance( "com.sun.star.awt.UnoControlComboBoxModel" ), uno::UNO_QUERY_THROW );
348 0 : uno::Reference< beans::XPropertySet > xProps( xNewModel, uno::UNO_QUERY_THROW );
349 0 : xProps->setPropertyValue( "Dropdown" , uno::Any( true ) );
350 0 : fDefWidth = 72.0; fDefHeight = 18.0;
351 0 : bFontSupport = true;
352 : }
353 0 : else if( aComServiceName.equalsIgnoreAsciiCase( "Forms.ToggleButton.1" ) )
354 : {
355 0 : xNewModel.set( xModelFactory->createInstance( "com.sun.star.awt.UnoControlButtonModel" ), uno::UNO_QUERY_THROW );
356 0 : uno::Reference< beans::XPropertySet > xProps( xNewModel, uno::UNO_QUERY_THROW );
357 0 : xProps->setPropertyValue( "Toggle" , uno::Any( true ) );
358 0 : fDefWidth = 72.0; fDefHeight = 18.0;
359 0 : bFontSupport = true;
360 : }
361 0 : else if( aComServiceName.equalsIgnoreAsciiCase( "Forms.Frame.1" ) )
362 : {
363 0 : xNewModel.set( xModelFactory->createInstance( "com.sun.star.awt.UnoControlGroupBoxModel" ), uno::UNO_QUERY_THROW );
364 0 : fDefWidth = 216.0; fDefHeight = 144.0;
365 0 : bFontSupport = true;
366 : }
367 0 : else if( aComServiceName.equalsIgnoreAsciiCase( "Forms.SpinButton.1" ) )
368 : {
369 0 : xNewModel.set( xModelFactory->createInstance( "com.sun.star.awt.UnoControlSpinButtonModel" ), uno::UNO_QUERY_THROW );
370 0 : fDefWidth = 12.75; fDefHeight = 25.5;
371 : }
372 0 : else if( aComServiceName.equalsIgnoreAsciiCase( "Forms.ScrollBar.1" ) )
373 : {
374 0 : xNewModel.set( xModelFactory->createInstance( "com.sun.star.awt.UnoControlScrollBarModel" ), uno::UNO_QUERY_THROW );
375 0 : fDefWidth = 12.75; fDefHeight = 63.8;
376 : }
377 : else
378 : {
379 0 : xNewModel.set( xModelFactory->createInstance( "com.sun.star.custom.awt.UnoControlSystemAXContainerModel" ), uno::UNO_QUERY_THROW );
380 0 : fDefWidth = 72.0; fDefHeight = 18.0;
381 0 : bNativeAX = true;
382 : }
383 :
384 : // need to set a few font properties to get rid of the default DONT_KNOW values
385 0 : if( bFontSupport )
386 : {
387 0 : uno::Reference< beans::XPropertySet > xModelProps( xNewModel, uno::UNO_QUERY_THROW );
388 0 : xModelProps->setPropertyValue( "FontName" , uno::Any( OUString("Tahoma" ) ) );
389 0 : xModelProps->setPropertyValue( "FontHeight" , uno::Any( float( 8.0 ) ) );
390 0 : xModelProps->setPropertyValue( "FontWeight" , uno::Any( awt::FontWeight::NORMAL ) );
391 0 : xModelProps->setPropertyValue( "FontSlant" , uno::Any( awt::FontSlant_NONE ) );
392 0 : xModelProps->setPropertyValue( "FontUnderline" , uno::Any( awt::FontUnderline::NONE ) );
393 0 : xModelProps->setPropertyValue( "FontStrikeout" , uno::Any( awt::FontStrikeout::NONE ) );
394 : }
395 :
396 0 : xDialogContainer->insertByName( aNewName, uno::makeAny( xNewModel ) );
397 0 : uno::Reference< awt::XControlContainer > xControlContainer( mxDialog, uno::UNO_QUERY_THROW );
398 0 : xNewControl = xControlContainer->getControl( aNewName );
399 :
400 0 : if( bNativeAX ) try
401 : {
402 0 : uno::Reference< script::XInvocation > xControlInvoke( xNewControl, uno::UNO_QUERY_THROW );
403 :
404 0 : uno::Sequence< uno::Any > aArgs( 1 );
405 0 : aArgs[0] <<= aComServiceName;
406 0 : uno::Sequence< sal_Int16 > aOutIDDummy;
407 0 : uno::Sequence< uno::Any > aOutDummy;
408 0 : xControlInvoke->invoke( "SOAddAXControl" , aArgs, aOutIDDummy, aOutDummy );
409 : }
410 0 : catch (const uno::Exception&)
411 : {
412 0 : xDialogContainer->removeByName( aNewName );
413 0 : throw;
414 0 : }
415 : }
416 :
417 0 : if ( xNewControl.is() )
418 : {
419 0 : UpdateCollectionIndex( lcl_controlsWrapper( mxDialog ) );
420 0 : aResult <<= xNewControl;
421 0 : aResult = createCollectionObject( aResult );
422 0 : uno::Reference< msforms::XControl > xVBAControl( aResult, uno::UNO_QUERY_THROW );
423 0 : if( fDefWidth > 0.0 )
424 0 : xVBAControl->setWidth( fDefWidth );
425 0 : if( fDefHeight > 0.0 )
426 0 : xVBAControl->setHeight( fDefHeight );
427 : }
428 : else
429 0 : throw uno::RuntimeException();
430 : }
431 0 : catch (const uno::RuntimeException&)
432 : {
433 0 : throw;
434 : }
435 0 : catch (const uno::Exception& e)
436 : {
437 : throw lang::WrappedTargetRuntimeException( "Can not create AXControl!",
438 : uno::Reference< uno::XInterface >(),
439 0 : uno::makeAny( e ) );
440 : }
441 :
442 0 : return aResult;
443 : }
444 :
445 0 : void SAL_CALL ScVbaControls::Remove( const uno::Any& StringKeyOrIndex )
446 : throw (uno::RuntimeException, std::exception)
447 : {
448 0 : OUString aControlName;
449 0 : sal_Int32 nIndex = -1;
450 :
451 : try
452 : {
453 0 : if ( !mxDialog.is() )
454 0 : throw uno::RuntimeException();
455 :
456 0 : uno::Reference< lang::XMultiServiceFactory > xModelFactory( mxDialog->getModel(), uno::UNO_QUERY_THROW );
457 0 : uno::Reference< container::XNameContainer > xDialogContainer( xModelFactory, uno::UNO_QUERY_THROW );
458 :
459 0 : if ( !( ( StringKeyOrIndex >>= aControlName ) && !aControlName.isEmpty() )
460 0 : && !( ( StringKeyOrIndex >>= nIndex ) && nIndex >= 0 && nIndex < m_xIndexAccess->getCount() ) )
461 0 : throw uno::RuntimeException();
462 :
463 0 : uno::Reference< awt::XControl > xControl;
464 0 : if ( !aControlName.isEmpty() )
465 : {
466 0 : uno::Reference< awt::XControlContainer > xControlContainer( mxDialog, uno::UNO_QUERY_THROW );
467 0 : xControl = xControlContainer->getControl( aControlName );
468 : }
469 : else
470 : {
471 0 : m_xIndexAccess->getByIndex( nIndex ) >>= xControl;
472 : }
473 :
474 0 : if ( !xControl.is() )
475 0 : throw uno::RuntimeException();
476 :
477 0 : if ( aControlName.isEmpty() )
478 0 : aControlName = ControlArrayWrapper::getControlName( xControl );
479 :
480 0 : xDialogContainer->removeByName( aControlName );
481 0 : xControl->dispose();
482 : }
483 0 : catch (const uno::RuntimeException&)
484 : {
485 : // the exceptions are not rethrown, impossibility to find or remove the control is currently not reported
486 : // since in most cases it means just that the controls is already not there, the VBA seems to do it in the same way
487 :
488 : // throw;
489 : }
490 0 : catch (const uno::Exception&)
491 : {
492 : // throw lang::WrappedTargetException("Can not create AXControl!",
493 : // uno::Reference< uno::XInterface >(),
494 : // uno::makeAny( e ) );
495 0 : }
496 0 : }
497 :
498 :
499 : uno::Type
500 0 : ScVbaControls::getElementType() throw (uno::RuntimeException)
501 : {
502 0 : return cppu::UnoType<ooo::vba::msforms::XControl>::get();
503 : }
504 :
505 0 : VBAHELPER_IMPL_XHELPERINTERFACE( ScVbaControls, "ooo.vba.msforms.Controls" )
506 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|