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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_embeddedobj.hxx"
26 #include <com/sun/star/embed/EmbedUpdateModes.hpp>
27 #include <com/sun/star/embed/EmbedStates.hpp>
28 #include <com/sun/star/lang/XComponent.hpp>
29 #include <com/sun/star/lang/DisposedException.hpp>
30
31 #include <cppuhelper/interfacecontainer.h>
32
33 #include <oleembobj.hxx>
34 #include <olecomponent.hxx>
35
36 #include "ownview.hxx"
37
38 using namespace ::com::sun::star;
39
40 sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang::XMultiServiceFactory >& xFactory );
41
42
43 //------------------------------------------------------
OleEmbeddedObject(const uno::Reference<lang::XMultiServiceFactory> & xFactory,const uno::Sequence<sal_Int8> & aClassID,const::rtl::OUString & aClassName)44 OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< lang::XMultiServiceFactory >& xFactory,
45 const uno::Sequence< sal_Int8 >& aClassID,
46 const ::rtl::OUString& aClassName )
47 : m_pOleComponent( NULL )
48 , m_pInterfaceContainer( NULL )
49 , m_bReadOnly( sal_False )
50 , m_bDisposed( sal_False )
51 , m_nObjectState( -1 )
52 , m_nTargetState( -1 )
53 , m_nUpdateMode ( embed::EmbedUpdateModes::ALWAYS_UPDATE )
54 , m_xFactory( xFactory )
55 , m_aClassID( aClassID )
56 , m_aClassName( aClassName )
57 , m_bWaitSaveCompleted( sal_False )
58 , m_bNewVisReplInStream( sal_True )
59 , m_bStoreLoaded( sal_False )
60 , m_bVisReplInitialized( sal_False )
61 , m_bVisReplInStream( sal_False )
62 , m_bStoreVisRepl( sal_False )
63 , m_bIsLink( sal_False )
64 , m_bHasCachedSize( sal_False )
65 , m_nCachedAspect( 0 )
66 , m_bHasSizeToSet( sal_False )
67 , m_nAspectToSet( 0 )
68 , m_bGotStatus( sal_False )
69 , m_nStatus( 0 )
70 , m_nStatusAspect( 0 )
71 , m_pOwnView( NULL )
72 , m_bFromClipboard( sal_False )
73 , m_bTriedConversion( sal_False )
74 {
75 }
76
77 //------------------------------------------------------
78 // In case of loading from persistent entry the classID of the object
79 // will be retrieved from the entry, during construction it is unknown
OleEmbeddedObject(const uno::Reference<lang::XMultiServiceFactory> & xFactory,sal_Bool bLink)80 OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< lang::XMultiServiceFactory >& xFactory, sal_Bool bLink )
81 : m_pOleComponent( NULL )
82 , m_pInterfaceContainer( NULL )
83 , m_bReadOnly( sal_False )
84 , m_bDisposed( sal_False )
85 , m_nObjectState( -1 )
86 , m_nTargetState( -1 )
87 , m_nUpdateMode( embed::EmbedUpdateModes::ALWAYS_UPDATE )
88 , m_xFactory( xFactory )
89 , m_bWaitSaveCompleted( sal_False )
90 , m_bNewVisReplInStream( sal_True )
91 , m_bStoreLoaded( sal_False )
92 , m_bVisReplInitialized( sal_False )
93 , m_bVisReplInStream( sal_False )
94 , m_bStoreVisRepl( sal_False )
95 , m_bIsLink( bLink )
96 , m_bHasCachedSize( sal_False )
97 , m_nCachedAspect( 0 )
98 , m_bHasSizeToSet( sal_False )
99 , m_nAspectToSet( 0 )
100 , m_bGotStatus( sal_False )
101 , m_nStatus( 0 )
102 , m_nStatusAspect( 0 )
103 , m_pOwnView( NULL )
104 , m_bFromClipboard( sal_False )
105 , m_bTriedConversion( sal_False )
106 {
107 }
108 #ifdef WNT
109 //------------------------------------------------------
110 // this constructor let object be initialized from clipboard
OleEmbeddedObject(const uno::Reference<lang::XMultiServiceFactory> & xFactory)111 OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< lang::XMultiServiceFactory >& xFactory )
112 : m_pOleComponent( NULL )
113 , m_pInterfaceContainer( NULL )
114 , m_bReadOnly( sal_False )
115 , m_bDisposed( sal_False )
116 , m_nObjectState( -1 )
117 , m_nTargetState( -1 )
118 , m_nUpdateMode( embed::EmbedUpdateModes::ALWAYS_UPDATE )
119 , m_xFactory( xFactory )
120 , m_bWaitSaveCompleted( sal_False )
121 , m_bNewVisReplInStream( sal_True )
122 , m_bStoreLoaded( sal_False )
123 , m_bVisReplInitialized( sal_False )
124 , m_bVisReplInStream( sal_False )
125 , m_bStoreVisRepl( sal_False )
126 , m_bIsLink( sal_False )
127 , m_bHasCachedSize( sal_False )
128 , m_nCachedAspect( 0 )
129 , m_bHasSizeToSet( sal_False )
130 , m_nAspectToSet( 0 )
131 , m_bGotStatus( sal_False )
132 , m_nStatus( 0 )
133 , m_nStatusAspect( 0 )
134 , m_pOwnView( NULL )
135 , m_bFromClipboard( sal_True )
136 , m_bTriedConversion( sal_False )
137 {
138 }
139 #endif
140 //------------------------------------------------------
~OleEmbeddedObject()141 OleEmbeddedObject::~OleEmbeddedObject()
142 {
143 OSL_ENSURE( !m_pInterfaceContainer && !m_pOleComponent && !m_xObjectStream.is(),
144 "The object is not closed! DISASTER is possible!" );
145
146 if ( m_pOleComponent || m_pInterfaceContainer || m_xObjectStream.is() )
147 {
148 // the component must be cleaned during closing
149 m_refCount++; // to avoid crash
150 try {
151 Dispose();
152 } catch( uno::Exception& ) {}
153 }
154
155 if ( m_aTempURL.getLength() )
156 KillFile_Impl( m_aTempURL, m_xFactory );
157
158 if ( m_aTempDumpURL.getLength() )
159 KillFile_Impl( m_aTempDumpURL, m_xFactory );
160 }
161
162 //------------------------------------------------------
MakeEventListenerNotification_Impl(const::rtl::OUString & aEventName)163 void OleEmbeddedObject::MakeEventListenerNotification_Impl( const ::rtl::OUString& aEventName )
164 {
165 if ( m_pInterfaceContainer )
166 {
167 ::cppu::OInterfaceContainerHelper* pContainer =
168 m_pInterfaceContainer->getContainer(
169 ::getCppuType( ( const uno::Reference< document::XEventListener >*) NULL ) );
170 if ( pContainer != NULL )
171 {
172 document::EventObject aEvent( static_cast< ::cppu::OWeakObject* >( this ), aEventName );
173 ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
174 while (pIterator.hasMoreElements())
175 {
176 try
177 {
178 ((document::XEventListener*)pIterator.next())->notifyEvent( aEvent );
179 }
180 catch( uno::RuntimeException& )
181 {
182 }
183 }
184 }
185 }
186 }
187 #ifdef WNT
188 //----------------------------------------------
StateChangeNotification_Impl(sal_Bool bBeforeChange,sal_Int32 nOldState,sal_Int32 nNewState)189 void OleEmbeddedObject::StateChangeNotification_Impl( sal_Bool bBeforeChange, sal_Int32 nOldState, sal_Int32 nNewState )
190 {
191 if ( m_pInterfaceContainer )
192 {
193 ::cppu::OInterfaceContainerHelper* pContainer = m_pInterfaceContainer->getContainer(
194 ::getCppuType( ( const uno::Reference< embed::XStateChangeListener >*) NULL ) );
195 if ( pContainer != NULL )
196 {
197 lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
198 ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
199
200 while (pIterator.hasMoreElements())
201 {
202 if ( bBeforeChange )
203 {
204 try
205 {
206 ((embed::XStateChangeListener*)pIterator.next())->changingState( aSource, nOldState, nNewState );
207 }
208 catch( uno::Exception& )
209 {
210 // even if the listener complains ignore it for now
211 }
212 }
213 else
214 {
215 try
216 {
217 ((embed::XStateChangeListener*)pIterator.next())->stateChanged( aSource, nOldState, nNewState );
218 }
219 catch( uno::Exception& )
220 {
221 // if anything happened it is problem of listener, ignore it
222 }
223 }
224 }
225 }
226 }
227 }
228 #endif
229 //------------------------------------------------------
GetRidOfComponent()230 void OleEmbeddedObject::GetRidOfComponent()
231 {
232 #ifdef WNT
233 if ( m_pOleComponent )
234 {
235 if ( m_nObjectState != -1 && m_nObjectState != embed::EmbedStates::LOADED )
236 SaveObject_Impl();
237
238 m_pOleComponent->removeCloseListener( m_xClosePreventer );
239 try
240 {
241 m_pOleComponent->close( sal_False );
242 }
243 catch( uno::Exception& )
244 {
245 // TODO: there should be a special listener to wait for component closing
246 // and to notify object, may be object itself can be such a listener
247 m_pOleComponent->addCloseListener( m_xClosePreventer );
248 throw;
249 }
250
251 m_pOleComponent->disconnectEmbeddedObject();
252 m_pOleComponent->release();
253 m_pOleComponent = NULL;
254 }
255 #endif
256 }
257
258 //------------------------------------------------------
Dispose()259 void OleEmbeddedObject::Dispose()
260 {
261 if ( m_pInterfaceContainer )
262 {
263 lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
264 m_pInterfaceContainer->disposeAndClear( aSource );
265 delete m_pInterfaceContainer;
266 m_pInterfaceContainer = NULL;
267 }
268
269 if ( m_pOwnView )
270 {
271 m_pOwnView->Close();
272 m_pOwnView->release();
273 m_pOwnView = NULL;
274 }
275
276 if ( m_pOleComponent )
277 try {
278 GetRidOfComponent();
279 } catch( uno::Exception& )
280 {
281 m_bDisposed = true;
282 throw; // TODO: there should be a special listener that will close object when
283 // component is finally closed
284 }
285
286 if ( m_xObjectStream.is() )
287 {
288 uno::Reference< lang::XComponent > xComp( m_xObjectStream, uno::UNO_QUERY );
289 OSL_ENSURE( xComp.is(), "Storage stream doesn't support XComponent!\n" );
290
291 if ( xComp.is() )
292 {
293 try {
294 xComp->dispose();
295 } catch( uno::Exception& ) {}
296 }
297 m_xObjectStream = uno::Reference< io::XStream >();
298 }
299
300 m_xParentStorage = uno::Reference< embed::XStorage >();
301
302 m_bDisposed = true;
303 }
304
305 //------------------------------------------------------
getClassID()306 uno::Sequence< sal_Int8 > SAL_CALL OleEmbeddedObject::getClassID()
307 {
308 // begin wrapping related part ====================
309 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
310 if ( xWrappedObject.is() )
311 {
312 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
313 return xWrappedObject->getClassID();
314 }
315 // end wrapping related part ====================
316
317 ::osl::MutexGuard aGuard( m_aMutex );
318 if ( m_bDisposed )
319 throw lang::DisposedException(); // TODO
320
321 return m_aClassID;
322 }
323
324 //------------------------------------------------------
getClassName()325 ::rtl::OUString SAL_CALL OleEmbeddedObject::getClassName()
326 {
327 // begin wrapping related part ====================
328 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
329 if ( xWrappedObject.is() )
330 {
331 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
332 return xWrappedObject->getClassName();
333 }
334 // end wrapping related part ====================
335
336 ::osl::MutexGuard aGuard( m_aMutex );
337 if ( m_bDisposed )
338 throw lang::DisposedException(); // TODO
339
340 return m_aClassName;
341 }
342
343 //------------------------------------------------------
setClassInfo(const uno::Sequence<sal_Int8> & aClassID,const::rtl::OUString & aClassName)344 void SAL_CALL OleEmbeddedObject::setClassInfo(
345 const uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName )
346 {
347 // begin wrapping related part ====================
348 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
349 if ( xWrappedObject.is() )
350 {
351 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
352 xWrappedObject->setClassInfo( aClassID, aClassName );
353 return;
354 }
355 // end wrapping related part ====================
356
357 // the object class info can not be changed explicitly
358 throw lang::NoSupportException(); //TODO:
359 }
360
361 //------------------------------------------------------
getComponent()362 uno::Reference< util::XCloseable > SAL_CALL OleEmbeddedObject::getComponent()
363 {
364 // begin wrapping related part ====================
365 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
366 if ( xWrappedObject.is() )
367 {
368 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
369 return xWrappedObject->getComponent();
370 }
371 // end wrapping related part ====================
372
373 ::osl::MutexGuard aGuard( m_aMutex );
374 if ( m_bDisposed )
375 throw lang::DisposedException(); // TODO
376
377 if ( m_nObjectState == -1 ) // || m_nObjectState == embed::EmbedStates::LOADED )
378 {
379 // the object is still not running
380 throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object is not loaded!\n" ),
381 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
382 }
383
384 // if ( m_bWaitSaveCompleted )
385 // throw embed::WrongStateException(
386 // ::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
387 // uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) );
388
389 if ( !m_pOleComponent )
390 {
391 // TODO/LATER: Is it correct???
392 return uno::Reference< util::XCloseable >();
393 // throw uno::RuntimeException(); // TODO
394 }
395
396 return uno::Reference< util::XCloseable >( static_cast< ::cppu::OWeakObject* >( m_pOleComponent ), uno::UNO_QUERY );
397 }
398
399 //----------------------------------------------
addStateChangeListener(const uno::Reference<embed::XStateChangeListener> & xListener)400 void SAL_CALL OleEmbeddedObject::addStateChangeListener( const uno::Reference< embed::XStateChangeListener >& xListener )
401 {
402 // begin wrapping related part ====================
403 uno::Reference< embed::XStateChangeBroadcaster > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
404 if ( xWrappedObject.is() )
405 {
406 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
407 xWrappedObject->addStateChangeListener( xListener );
408 return;
409 }
410 // end wrapping related part ====================
411
412 ::osl::MutexGuard aGuard( m_aMutex );
413 if ( m_bDisposed )
414 throw lang::DisposedException(); // TODO
415
416 if ( !m_pInterfaceContainer )
417 m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
418
419 m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< embed::XStateChangeListener >*)0 ),
420 xListener );
421 }
422
423 //----------------------------------------------
removeStateChangeListener(const uno::Reference<embed::XStateChangeListener> & xListener)424 void SAL_CALL OleEmbeddedObject::removeStateChangeListener(
425 const uno::Reference< embed::XStateChangeListener >& xListener )
426 {
427 // begin wrapping related part ====================
428 uno::Reference< embed::XStateChangeBroadcaster > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
429 if ( xWrappedObject.is() )
430 {
431 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
432 xWrappedObject->removeStateChangeListener( xListener );
433 return;
434 }
435 // end wrapping related part ====================
436
437 ::osl::MutexGuard aGuard( m_aMutex );
438 if ( m_pInterfaceContainer )
439 m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< embed::XStateChangeListener >*)0 ),
440 xListener );
441 }
442
443
444 //----------------------------------------------
close(sal_Bool bDeliverOwnership)445 void SAL_CALL OleEmbeddedObject::close( sal_Bool bDeliverOwnership )
446 {
447 // begin wrapping related part ====================
448 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
449 if ( xWrappedObject.is() )
450 {
451 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
452 xWrappedObject->close( bDeliverOwnership );
453 return;
454 }
455 // end wrapping related part ====================
456
457 ::osl::MutexGuard aGuard( m_aMutex );
458 if ( m_bDisposed )
459 throw lang::DisposedException(); // TODO
460
461 uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >( this ) );
462 lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
463
464 if ( m_pInterfaceContainer )
465 {
466 ::cppu::OInterfaceContainerHelper* pContainer =
467 m_pInterfaceContainer->getContainer( ::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) );
468 if ( pContainer != NULL )
469 {
470 ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
471 while (pIterator.hasMoreElements())
472 {
473 try
474 {
475 ((util::XCloseListener*)pIterator.next())->queryClosing( aSource, bDeliverOwnership );
476 }
477 catch( uno::RuntimeException& )
478 {
479 pIterator.remove();
480 }
481 }
482 }
483
484 pContainer = m_pInterfaceContainer->getContainer(
485 ::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) );
486 if ( pContainer != NULL )
487 {
488 ::cppu::OInterfaceIteratorHelper pCloseIterator(*pContainer);
489 while (pCloseIterator.hasMoreElements())
490 {
491 try
492 {
493 ((util::XCloseListener*)pCloseIterator.next())->notifyClosing( aSource );
494 }
495 catch( uno::RuntimeException& )
496 {
497 pCloseIterator.remove();
498 }
499 }
500 }
501 }
502
503 Dispose();
504 }
505
506 //----------------------------------------------
addCloseListener(const uno::Reference<util::XCloseListener> & xListener)507 void SAL_CALL OleEmbeddedObject::addCloseListener( const uno::Reference< util::XCloseListener >& xListener )
508 {
509 // begin wrapping related part ====================
510 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
511 if ( xWrappedObject.is() )
512 {
513 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
514 xWrappedObject->addCloseListener( xListener );
515 return;
516 }
517 // end wrapping related part ====================
518
519 ::osl::MutexGuard aGuard( m_aMutex );
520 if ( m_bDisposed )
521 throw lang::DisposedException(); // TODO
522
523 if ( !m_pInterfaceContainer )
524 m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
525
526 m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< util::XCloseListener >*)0 ), xListener );
527 }
528
529 //----------------------------------------------
removeCloseListener(const uno::Reference<util::XCloseListener> & xListener)530 void SAL_CALL OleEmbeddedObject::removeCloseListener( const uno::Reference< util::XCloseListener >& xListener )
531 {
532 // begin wrapping related part ====================
533 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
534 if ( xWrappedObject.is() )
535 {
536 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
537 xWrappedObject->removeCloseListener( xListener );
538 return;
539 }
540 // end wrapping related part ====================
541
542 ::osl::MutexGuard aGuard( m_aMutex );
543 if ( m_bDisposed )
544 throw lang::DisposedException(); // TODO
545
546 if ( m_pInterfaceContainer )
547 m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< util::XCloseListener >*)0 ),
548 xListener );
549 }
550
551 //------------------------------------------------------
addEventListener(const uno::Reference<document::XEventListener> & xListener)552 void SAL_CALL OleEmbeddedObject::addEventListener( const uno::Reference< document::XEventListener >& xListener )
553 {
554 // begin wrapping related part ====================
555 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
556 if ( xWrappedObject.is() )
557 {
558 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
559 xWrappedObject->addEventListener( xListener );
560 return;
561 }
562 // end wrapping related part ====================
563
564 ::osl::MutexGuard aGuard( m_aMutex );
565 if ( m_bDisposed )
566 throw lang::DisposedException(); // TODO
567
568 if ( !m_pInterfaceContainer )
569 m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
570
571 m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< document::XEventListener >*)0 ), xListener );
572 }
573
574 //------------------------------------------------------
removeEventListener(const uno::Reference<document::XEventListener> & xListener)575 void SAL_CALL OleEmbeddedObject::removeEventListener(
576 const uno::Reference< document::XEventListener >& xListener )
577 {
578 // begin wrapping related part ====================
579 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
580 if ( xWrappedObject.is() )
581 {
582 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
583 xWrappedObject->removeEventListener( xListener );
584 return;
585 }
586 // end wrapping related part ====================
587
588 ::osl::MutexGuard aGuard( m_aMutex );
589 if ( m_bDisposed )
590 throw lang::DisposedException(); // TODO
591
592 if ( m_pInterfaceContainer )
593 m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< document::XEventListener >*)0 ),
594 xListener );
595 }
596
597 // XInplaceObject ( wrapper related implementation )
598 //------------------------------------------------------
setObjectRectangles(const awt::Rectangle & aPosRect,const awt::Rectangle & aClipRect)599 void SAL_CALL OleEmbeddedObject::setObjectRectangles( const awt::Rectangle& aPosRect,
600 const awt::Rectangle& aClipRect )
601 {
602 // begin wrapping related part ====================
603 uno::Reference< embed::XInplaceObject > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
604 if ( xWrappedObject.is() )
605 {
606 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
607 xWrappedObject->setObjectRectangles( aPosRect, aClipRect );
608 return;
609 }
610 // end wrapping related part ====================
611
612 throw embed::WrongStateException();
613 }
614
615 //------------------------------------------------------
enableModeless(sal_Bool bEnable)616 void SAL_CALL OleEmbeddedObject::enableModeless( sal_Bool bEnable )
617 {
618 // begin wrapping related part ====================
619 uno::Reference< embed::XInplaceObject > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
620 if ( xWrappedObject.is() )
621 {
622 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
623 xWrappedObject->enableModeless( bEnable );
624 return;
625 }
626 // end wrapping related part ====================
627
628 throw embed::WrongStateException();
629 }
630
631 //------------------------------------------------------
translateAccelerators(const uno::Sequence<awt::KeyEvent> & aKeys)632 void SAL_CALL OleEmbeddedObject::translateAccelerators(
633 const uno::Sequence< awt::KeyEvent >& aKeys )
634 {
635 // begin wrapping related part ====================
636 uno::Reference< embed::XInplaceObject > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
637 if ( xWrappedObject.is() )
638 {
639 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
640 xWrappedObject->translateAccelerators( aKeys );
641 return;
642 }
643 // end wrapping related part ====================
644
645 // throw embed::WrongStateException();
646 }
647
648 // XChild
649 //------------------------------------------------------
getParent()650 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL OleEmbeddedObject::getParent()
651 {
652 // begin wrapping related part ====================
653 uno::Reference< container::XChild > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
654 if ( xWrappedObject.is() )
655 {
656 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
657 return xWrappedObject->getParent();
658 }
659 // end wrapping related part ====================
660
661 return m_xParent;
662 }
663
664 //------------------------------------------------------
setParent(const com::sun::star::uno::Reference<com::sun::star::uno::XInterface> & xParent)665 void SAL_CALL OleEmbeddedObject::setParent( const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& xParent )
666 {
667 // begin wrapping related part ====================
668 uno::Reference< container::XChild > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
669 if ( xWrappedObject.is() )
670 {
671 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
672 xWrappedObject->setParent( xParent );
673 return;
674 }
675 // end wrapping related part ====================
676
677 m_xParent = xParent;
678 }
679