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_svx.hxx" 26 27 #include <svx/svdoole2.hxx> 28 #include <com/sun/star/util/XModifyBroadcaster.hpp> 29 #include <com/sun/star/util/XModifiable.hpp> 30 #include <com/sun/star/embed/EmbedStates.hpp> 31 #include <com/sun/star/embed/ElementModes.hpp> 32 #include <com/sun/star/embed/EmbedMisc.hpp> 33 #include <com/sun/star/embed/Aspects.hpp> 34 #include <com/sun/star/embed/XInplaceClient.hpp> 35 #include <com/sun/star/embed/XInplaceObject.hpp> 36 #include <com/sun/star/embed/XLinkageSupport.hpp> 37 #include <com/sun/star/embed/NoVisualAreaSizeException.hpp> 38 #include <com/sun/star/embed/XWindowSupplier.hpp> 39 #include <com/sun/star/document/XEventListener.hpp> 40 #include <com/sun/star/container/XChild.hpp> 41 #include "com/sun/star/document/XStorageBasedDocument.hpp" 42 43 #include <comphelper/processfactory.hxx> 44 #include <cppuhelper/exc_hlp.hxx> 45 #include <unotools/ucbstreamhelper.hxx> 46 47 #include <toolkit/helper/vclunohelper.hxx> 48 #include <toolkit/awt/vclxwindow.hxx> 49 #include <toolkit/helper/convert.hxx> 50 51 #include <svtools/filter.hxx> 52 #include <svtools/embedhlp.hxx> 53 54 #include <sfx2/objsh.hxx> 55 #include <sfx2/ipclient.hxx> 56 #include <sfx2/lnkbase.hxx> 57 #include <tools/stream.hxx> 58 #include <comphelper/anytostring.hxx> 59 #include <svx/svdpagv.hxx> 60 #include <tools/globname.hxx> 61 #include <vcl/jobset.hxx> 62 #include <sot/clsids.hxx> 63 64 #include <sot/formats.hxx> 65 #include <sfx2/linkmgr.hxx> 66 #include <svtools/transfer.hxx> 67 #include <cppuhelper/implbase5.hxx> 68 69 #include <svl/solar.hrc> 70 #include <svl/urihelper.hxx> 71 #include <vos/mutex.hxx> 72 #include <vcl/svapp.hxx> 73 74 #include <svx/svdpagv.hxx> 75 #include <svx/svdmodel.hxx> 76 #include "svx/svdglob.hxx" // Stringcache 77 #include "svx/svdstr.hrc" // Objektname 78 #include <svx/svdetc.hxx> 79 #include <svx/svdview.hxx> 80 #include "unomlstr.hxx" 81 #include <svx/charthelper.hxx> 82 #include <svx/sdr/contact/viewcontactofsdrole2obj.hxx> 83 #include <svx/svdograf.hxx> 84 #include <svx/sdr/properties/oleproperties.hxx> 85 86 // #i100710# 87 #include <svx/xlnclit.hxx> 88 #include <svx/xbtmpit.hxx> 89 #include <svx/xflbmtit.hxx> 90 #include <svx/xflbstit.hxx> 91 92 // #i118485# 93 #include <basegfx/matrix/b2dhommatrix.hxx> 94 #include <basegfx/polygon/b2dpolypolygon.hxx> 95 #include <editeng/outlobj.hxx> 96 97 #include <svx/svdpage.hxx> 98 99 using namespace ::rtl; 100 using namespace ::com::sun::star; 101 102 uno::Reference < beans::XPropertySet > lcl_getFrame_throw(const SdrOle2Obj* _pObject) 103 { 104 uno::Reference < beans::XPropertySet > xFrame; 105 if ( _pObject ) 106 { 107 uno::Reference< frame::XController> xController = _pObject->GetParentXModel()->getCurrentController(); 108 if ( xController.is() ) 109 { 110 xFrame.set( xController->getFrame(),uno::UNO_QUERY_THROW); 111 } 112 } // if ( _pObject ) 113 return xFrame; 114 } 115 116 class SdrLightEmbeddedClient_Impl : public ::cppu::WeakImplHelper5 117 < embed::XStateChangeListener 118 , document::XEventListener 119 , embed::XInplaceClient 120 , embed::XEmbeddedClient 121 , embed::XWindowSupplier 122 > 123 { 124 uno::Reference< awt::XWindow > m_xWindow; 125 SdrOle2Obj* mpObj; 126 127 Fraction m_aScaleWidth; 128 Fraction m_aScaleHeight; 129 130 131 public: 132 SdrLightEmbeddedClient_Impl( SdrOle2Obj* pObj ); 133 void Release(); 134 135 void SetSizeScale( const Fraction& aScaleWidth, const Fraction& aScaleHeight ) 136 { 137 m_aScaleWidth = aScaleWidth; 138 m_aScaleHeight = aScaleHeight; 139 } 140 141 Fraction GetScaleWidth() const { return m_aScaleWidth; } 142 Fraction GetScaleHeight() const { return m_aScaleHeight; } 143 144 void setWindow(const uno::Reference< awt::XWindow >& _xWindow); 145 146 private: 147 Rectangle impl_getScaledRect_nothrow() const; 148 // XStateChangeListener 149 virtual void SAL_CALL changingState( const ::com::sun::star::lang::EventObject& aEvent, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) throw (::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::RuntimeException); 150 virtual void SAL_CALL stateChanged( const ::com::sun::star::lang::EventObject& aEvent, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) throw (::com::sun::star::uno::RuntimeException); 151 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); 152 153 // document::XEventListener 154 virtual void SAL_CALL notifyEvent( const document::EventObject& aEvent ) throw( uno::RuntimeException ); 155 156 // XEmbeddedClient 157 virtual void SAL_CALL saveObject() throw ( embed::ObjectSaveVetoException, uno::Exception, uno::RuntimeException ); 158 virtual void SAL_CALL visibilityChanged( sal_Bool bVisible ) throw ( embed::WrongStateException, uno::RuntimeException ); 159 160 // XComponentSupplier 161 virtual uno::Reference< util::XCloseable > SAL_CALL getComponent() throw ( uno::RuntimeException ); 162 163 // XInplaceClient 164 virtual sal_Bool SAL_CALL canInplaceActivate() throw ( uno::RuntimeException ); 165 virtual void SAL_CALL activatingInplace() throw ( embed::WrongStateException, uno::RuntimeException ); 166 virtual void SAL_CALL activatingUI() throw ( embed::WrongStateException, uno::RuntimeException ); 167 virtual void SAL_CALL deactivatedInplace() throw ( embed::WrongStateException, uno::RuntimeException ); 168 virtual void SAL_CALL deactivatedUI() throw ( embed::WrongStateException, uno::RuntimeException ); 169 virtual uno::Reference< ::com::sun::star::frame::XLayoutManager > SAL_CALL getLayoutManager() throw ( embed::WrongStateException, uno::RuntimeException ); 170 virtual uno::Reference< frame::XDispatchProvider > SAL_CALL getInplaceDispatchProvider() throw ( embed::WrongStateException, uno::RuntimeException ); 171 virtual awt::Rectangle SAL_CALL getPlacement() throw ( embed::WrongStateException, uno::RuntimeException ); 172 virtual awt::Rectangle SAL_CALL getClipRectangle() throw ( embed::WrongStateException, uno::RuntimeException ); 173 virtual void SAL_CALL translateAccelerators( const uno::Sequence< awt::KeyEvent >& aKeys ) throw ( embed::WrongStateException, uno::RuntimeException ); 174 virtual void SAL_CALL scrollObject( const awt::Size& aOffset ) throw ( embed::WrongStateException, uno::RuntimeException ); 175 virtual void SAL_CALL changedPlacement( const awt::Rectangle& aPosRect ) throw ( embed::WrongStateException, uno::Exception, uno::RuntimeException ); 176 177 // XWindowSupplier 178 virtual uno::Reference< awt::XWindow > SAL_CALL getWindow() throw ( uno::RuntimeException ); 179 }; 180 181 //-------------------------------------------------------------------- 182 SdrLightEmbeddedClient_Impl::SdrLightEmbeddedClient_Impl( SdrOle2Obj* pObj ) 183 : mpObj( pObj ) 184 { 185 } 186 Rectangle SdrLightEmbeddedClient_Impl::impl_getScaledRect_nothrow() const 187 { 188 MapUnit aContainerMapUnit( MAP_100TH_MM ); 189 uno::Reference< embed::XVisualObject > xParentVis( mpObj->GetParentXModel(), uno::UNO_QUERY ); 190 if ( xParentVis.is() ) 191 aContainerMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xParentVis->getMapUnit( mpObj->GetAspect() ) ); 192 Rectangle aLogicRect( mpObj->GetLogicRect() ); 193 // apply scaling to object area and convert to pixels 194 aLogicRect.SetSize( Size( Fraction( aLogicRect.GetWidth() ) * m_aScaleWidth, 195 Fraction( aLogicRect.GetHeight() ) * m_aScaleHeight ) ); 196 return aLogicRect; 197 } 198 //-------------------------------------------------------------------- 199 void SAL_CALL SdrLightEmbeddedClient_Impl::changingState( const ::com::sun::star::lang::EventObject& /*aEvent*/, ::sal_Int32 /*nOldState*/, ::sal_Int32 /*nNewState*/ ) throw (::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::RuntimeException) 200 { 201 } 202 203 //-------------------------------------------------------------------- 204 void SdrLightEmbeddedClient_Impl::Release() 205 { 206 { 207 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 208 mpObj = NULL; 209 } 210 211 release(); 212 } 213 214 //-------------------------------------------------------------------- 215 void SAL_CALL SdrLightEmbeddedClient_Impl::stateChanged( const ::com::sun::star::lang::EventObject& /*aEvent*/, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) throw (::com::sun::star::uno::RuntimeException) 216 { 217 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 218 219 if ( mpObj && nOldState == embed::EmbedStates::LOADED && nNewState == embed::EmbedStates::RUNNING ) 220 { 221 mpObj->ObjectLoaded(); 222 GetSdrGlobalData().GetOLEObjCache().InsertObj(mpObj); 223 } 224 else if ( mpObj && nNewState == embed::EmbedStates::LOADED && nOldState == embed::EmbedStates::RUNNING ) 225 { 226 GetSdrGlobalData().GetOLEObjCache().RemoveObj(mpObj); 227 } 228 } 229 230 //-------------------------------------------------------------------- 231 void SAL_CALL SdrLightEmbeddedClient_Impl::disposing( const ::com::sun::star::lang::EventObject& /*aEvent*/ ) throw (::com::sun::star::uno::RuntimeException) 232 { 233 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 234 235 GetSdrGlobalData().GetOLEObjCache().RemoveObj(mpObj); 236 } 237 238 //-------------------------------------------------------------------- 239 void SAL_CALL SdrLightEmbeddedClient_Impl::notifyEvent( const document::EventObject& aEvent ) throw( uno::RuntimeException ) 240 { 241 // TODO/LATER: when writer uses this implementation the code could be shared with SfxInPlaceClient_Impl 242 243 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 244 245 // the code currently makes sence only in case there is no other client 246 if ( mpObj && mpObj->GetAspect() != embed::Aspects::MSOLE_ICON && aEvent.EventName.equalsAscii("OnVisAreaChanged") 247 && mpObj->GetObjRef().is() && mpObj->GetObjRef()->getClientSite() == uno::Reference< embed::XEmbeddedClient >( this ) ) 248 { 249 try 250 { 251 MapUnit aContainerMapUnit( MAP_100TH_MM ); 252 uno::Reference< embed::XVisualObject > xParentVis( mpObj->GetParentXModel(), uno::UNO_QUERY ); 253 if ( xParentVis.is() ) 254 aContainerMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xParentVis->getMapUnit( mpObj->GetAspect() ) ); 255 256 MapUnit aObjMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( mpObj->GetObjRef()->getMapUnit( mpObj->GetAspect() ) ); 257 258 Rectangle aVisArea; 259 awt::Size aSz; 260 try 261 { 262 aSz = mpObj->GetObjRef()->getVisualAreaSize( mpObj->GetAspect() ); 263 } 264 catch( embed::NoVisualAreaSizeException& ) 265 { 266 OSL_ENSURE( sal_False, "No visual area size!\n" ); 267 aSz.Width = 5000; 268 aSz.Height = 5000; 269 } 270 catch( uno::Exception& ) 271 { 272 OSL_ENSURE( sal_False, "Unexpected exception!\n" ); 273 aSz.Width = 5000; 274 aSz.Height = 5000; 275 } 276 277 aVisArea.SetSize( Size( aSz.Width, aSz.Height ) ); 278 aVisArea = OutputDevice::LogicToLogic( aVisArea, aObjMapUnit, aContainerMapUnit ); 279 Size aScaledSize( static_cast< long >( m_aScaleWidth * Fraction( aVisArea.GetWidth() ) ), 280 static_cast< long >( m_aScaleHeight * Fraction( aVisArea.GetHeight() ) ) ); 281 Rectangle aLogicRect( mpObj->GetLogicRect() ); 282 283 // react to the change if the difference is bigger than one pixel 284 Size aPixelDiff = 285 Application::GetDefaultDevice()->LogicToPixel( 286 Size( aLogicRect.GetWidth() - aScaledSize.Width(), 287 aLogicRect.GetHeight() - aScaledSize.Height() ), 288 aContainerMapUnit ); 289 if( aPixelDiff.Width() || aPixelDiff.Height() ) 290 { 291 mpObj->SetLogicRect( Rectangle( aLogicRect.TopLeft(), aScaledSize ) ); 292 mpObj->BroadcastObjectChange(); 293 } 294 else 295 mpObj->ActionChanged(); 296 } 297 catch( uno::Exception& ) 298 { 299 OSL_ENSURE( sal_False, "Unexpected exception!\n" ); 300 } 301 } 302 } 303 304 //-------------------------------------------------------------------- 305 void SAL_CALL SdrLightEmbeddedClient_Impl::saveObject() 306 throw ( embed::ObjectSaveVetoException, 307 uno::Exception, 308 uno::RuntimeException ) 309 { 310 // TODO/LATER: when writer uses this implementation the code could be shared with SfxInPlaceClient_Impl 311 uno::Reference< embed::XCommonEmbedPersist > xPersist; 312 uno::Reference< util::XModifiable > xModifiable; 313 314 { 315 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 316 317 if ( !mpObj ) 318 throw embed::ObjectSaveVetoException(); 319 320 // the common persistance is supported by objects and links 321 xPersist = uno::Reference< embed::XCommonEmbedPersist >( mpObj->GetObjRef(), uno::UNO_QUERY_THROW ); 322 xModifiable = uno::Reference< util::XModifiable >( mpObj->GetParentXModel(), uno::UNO_QUERY ); 323 } 324 325 xPersist->storeOwn(); 326 327 if ( xModifiable.is() ) 328 xModifiable->setModified( sal_True ); 329 } 330 331 //-------------------------------------------------------------------- 332 void SAL_CALL SdrLightEmbeddedClient_Impl::visibilityChanged( sal_Bool /*bVisible*/ ) 333 throw ( embed::WrongStateException, 334 uno::RuntimeException ) 335 { 336 // nothing to do currently 337 // TODO/LATER: when writer uses this implementation the code could be shared with SfxInPlaceClient_Impl 338 if ( mpObj ) 339 { 340 Rectangle aLogicRect( mpObj->GetLogicRect() ); 341 Size aLogicSize( aLogicRect.GetWidth(), aLogicRect.GetHeight() ); 342 343 if( mpObj->IsChart() ) 344 { 345 //charts never should be stretched see #i84323# for example 346 mpObj->SetLogicRect( Rectangle( aLogicRect.TopLeft(), aLogicSize ) ); 347 mpObj->BroadcastObjectChange(); 348 } // if( mpObj->IsChart() ) 349 } 350 } 351 352 //-------------------------------------------------------------------- 353 uno::Reference< util::XCloseable > SAL_CALL SdrLightEmbeddedClient_Impl::getComponent() 354 throw ( uno::RuntimeException ) 355 { 356 uno::Reference< util::XCloseable > xResult; 357 358 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 359 if ( mpObj ) 360 xResult = uno::Reference< util::XCloseable >( mpObj->GetParentXModel(), uno::UNO_QUERY ); 361 362 return xResult; 363 } 364 // XInplaceClient 365 //-------------------------------------------------------------------- 366 sal_Bool SAL_CALL SdrLightEmbeddedClient_Impl::canInplaceActivate() 367 throw ( uno::RuntimeException ) 368 { 369 sal_Bool bRet = sal_False; 370 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 371 if ( mpObj ) 372 { 373 uno::Reference< embed::XEmbeddedObject > xObject = mpObj->GetObjRef(); 374 if ( !xObject.is() ) 375 throw uno::RuntimeException(); 376 // we don't want to switch directly from outplace to inplace mode 377 bRet = !( xObject->getCurrentState() == embed::EmbedStates::ACTIVE || mpObj->GetAspect() == embed::Aspects::MSOLE_ICON ); 378 } // if ( mpObj ) 379 return bRet; 380 } 381 382 //-------------------------------------------------------------------- 383 void SAL_CALL SdrLightEmbeddedClient_Impl::activatingInplace() 384 throw ( embed::WrongStateException, 385 uno::RuntimeException ) 386 { 387 } 388 389 //-------------------------------------------------------------------- 390 void SAL_CALL SdrLightEmbeddedClient_Impl::activatingUI() 391 throw ( embed::WrongStateException, 392 uno::RuntimeException ) 393 { 394 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 395 396 uno::Reference < beans::XPropertySet > xFrame( lcl_getFrame_throw(mpObj)); 397 uno::Reference < frame::XFrame > xOwnFrame( xFrame,uno::UNO_QUERY); 398 uno::Reference < frame::XFramesSupplier > xParentFrame( xOwnFrame->getCreator(), uno::UNO_QUERY ); 399 if ( xParentFrame.is() ) 400 xParentFrame->setActiveFrame( xOwnFrame ); 401 402 OLEObjCache& rObjCache = GetSdrGlobalData().GetOLEObjCache(); 403 const sal_uIntPtr nCount = rObjCache.Count(); 404 for(sal_Int32 i = nCount-1 ; i >= 0;--i) 405 { 406 SdrOle2Obj* pObj = reinterpret_cast<SdrOle2Obj*>(rObjCache.GetObject(i)); 407 if ( pObj != mpObj ) 408 { 409 // only deactivate ole objects which belongs to the same frame 410 if ( xFrame == lcl_getFrame_throw(pObj) ) 411 { 412 uno::Reference< embed::XEmbeddedObject > xObject = pObj->GetObjRef(); 413 try 414 { 415 if ( xObject->getStatus( pObj->GetAspect() ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) 416 xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE ); 417 else 418 { 419 // the links should not stay in running state for long time because of locking 420 uno::Reference< embed::XLinkageSupport > xLink( xObject, uno::UNO_QUERY ); 421 if ( xLink.is() && xLink->isLink() ) 422 xObject->changeState( embed::EmbedStates::LOADED ); 423 else 424 xObject->changeState( embed::EmbedStates::RUNNING ); 425 } 426 } 427 catch (com::sun::star::uno::Exception& ) 428 {} 429 } 430 } 431 } // for(sal_Int32 i = nCount-1 ; i >= 0;--i) 432 433 //m_pClient->GetViewShell()->UIActivating( m_pClient ); 434 } 435 436 //-------------------------------------------------------------------- 437 void SAL_CALL SdrLightEmbeddedClient_Impl::deactivatedInplace() 438 throw ( embed::WrongStateException, 439 uno::RuntimeException ) 440 { 441 } 442 443 //-------------------------------------------------------------------- 444 void SAL_CALL SdrLightEmbeddedClient_Impl::deactivatedUI() 445 throw ( embed::WrongStateException, 446 uno::RuntimeException ) 447 { 448 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 449 com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager(getLayoutManager()); 450 if ( xLayoutManager.is() ) 451 { 452 const static rtl::OUString aMenuBarURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/menubar/menubar" )); 453 if ( !xLayoutManager->isElementVisible( aMenuBarURL ) ) 454 xLayoutManager->createElement( aMenuBarURL ); 455 } 456 } 457 458 //-------------------------------------------------------------------- 459 uno::Reference< ::com::sun::star::frame::XLayoutManager > SAL_CALL SdrLightEmbeddedClient_Impl::getLayoutManager() 460 throw ( embed::WrongStateException, 461 uno::RuntimeException ) 462 { 463 uno::Reference< ::com::sun::star::frame::XLayoutManager > xMan; 464 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 465 uno::Reference < beans::XPropertySet > xFrame( lcl_getFrame_throw(mpObj)); 466 try 467 { 468 xMan.set(xFrame->getPropertyValue( ::rtl::OUString::createFromAscii("LayoutManager") ),uno::UNO_QUERY); 469 } 470 catch ( uno::Exception& ) 471 { 472 throw uno::RuntimeException(); 473 } 474 475 return xMan; 476 } 477 478 //-------------------------------------------------------------------- 479 uno::Reference< frame::XDispatchProvider > SAL_CALL SdrLightEmbeddedClient_Impl::getInplaceDispatchProvider() 480 throw ( embed::WrongStateException, 481 uno::RuntimeException ) 482 { 483 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 484 return uno::Reference < frame::XDispatchProvider >( lcl_getFrame_throw(mpObj), uno::UNO_QUERY_THROW ); 485 } 486 487 //-------------------------------------------------------------------- 488 awt::Rectangle SAL_CALL SdrLightEmbeddedClient_Impl::getPlacement() 489 throw ( embed::WrongStateException, 490 uno::RuntimeException ) 491 { 492 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 493 if ( !mpObj ) 494 throw uno::RuntimeException(); 495 496 Rectangle aLogicRect = impl_getScaledRect_nothrow(); 497 MapUnit aContainerMapUnit( MAP_100TH_MM ); 498 uno::Reference< embed::XVisualObject > xParentVis( mpObj->GetParentXModel(), uno::UNO_QUERY ); 499 if ( xParentVis.is() ) 500 aContainerMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xParentVis->getMapUnit( mpObj->GetAspect() ) ); 501 502 aLogicRect = Application::GetDefaultDevice()->LogicToPixel(aLogicRect,aContainerMapUnit); 503 return AWTRectangle( aLogicRect ); 504 } 505 506 //-------------------------------------------------------------------- 507 awt::Rectangle SAL_CALL SdrLightEmbeddedClient_Impl::getClipRectangle() 508 throw ( embed::WrongStateException, 509 uno::RuntimeException ) 510 { 511 return getPlacement(); 512 } 513 514 //-------------------------------------------------------------------- 515 void SAL_CALL SdrLightEmbeddedClient_Impl::translateAccelerators( const uno::Sequence< awt::KeyEvent >& /*aKeys*/ ) 516 throw ( embed::WrongStateException, 517 uno::RuntimeException ) 518 { 519 } 520 521 //-------------------------------------------------------------------- 522 void SAL_CALL SdrLightEmbeddedClient_Impl::scrollObject( const awt::Size& /*aOffset*/ ) 523 throw ( embed::WrongStateException, 524 uno::RuntimeException ) 525 { 526 } 527 528 //-------------------------------------------------------------------- 529 void SAL_CALL SdrLightEmbeddedClient_Impl::changedPlacement( const awt::Rectangle& aPosRect ) 530 throw ( embed::WrongStateException, 531 uno::Exception, 532 uno::RuntimeException ) 533 { 534 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 535 if ( !mpObj ) 536 throw uno::RuntimeException(); 537 538 uno::Reference< embed::XInplaceObject > xInplace( mpObj->GetObjRef(), uno::UNO_QUERY ); 539 if ( !xInplace.is() ) 540 throw uno::RuntimeException(); 541 542 // check if the change is at least one pixel in size 543 awt::Rectangle aOldRect = getPlacement(); 544 Rectangle aNewPixelRect = VCLRectangle( aPosRect ); 545 Rectangle aOldPixelRect = VCLRectangle( aOldRect ); 546 if ( aOldPixelRect == aNewPixelRect ) 547 // nothing has changed 548 return; 549 550 // new scaled object area 551 MapUnit aContainerMapUnit( MAP_100TH_MM ); 552 uno::Reference< embed::XVisualObject > xParentVis( mpObj->GetParentXModel(), uno::UNO_QUERY ); 553 if ( xParentVis.is() ) 554 aContainerMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xParentVis->getMapUnit( mpObj->GetAspect() ) ); 555 556 Rectangle aNewLogicRect = Application::GetDefaultDevice()->PixelToLogic(aNewPixelRect,aContainerMapUnit); 557 Rectangle aLogicRect = impl_getScaledRect_nothrow(); 558 559 if ( aNewLogicRect != aLogicRect ) 560 { 561 // the calculation of the object area has not changed the object size 562 // it should be done here then 563 //SfxBooleanFlagGuard aGuard( m_bResizeNoScale, sal_True ); 564 565 // new size of the object area without scaling 566 Size aNewObjSize( Fraction( aNewLogicRect.GetWidth() ) / m_aScaleWidth, 567 Fraction( aNewLogicRect.GetHeight() ) / m_aScaleHeight ); 568 569 // now remove scaling from new placement and keep this a the new object area 570 aNewLogicRect.SetSize( aNewObjSize ); 571 // react to the change if the difference is bigger than one pixel 572 Size aPixelDiff = 573 Application::GetDefaultDevice()->LogicToPixel( 574 Size( aLogicRect.GetWidth() - aNewObjSize.Width(), 575 aLogicRect.GetHeight() - aNewObjSize.Height() ), 576 aContainerMapUnit ); 577 if( aPixelDiff.Width() || aPixelDiff.Height() ) 578 { 579 mpObj->SetLogicRect( Rectangle( aLogicRect.TopLeft(), aNewObjSize ) ); 580 mpObj->BroadcastObjectChange(); 581 } 582 else 583 mpObj->ActionChanged(); 584 585 // let the window size be recalculated 586 //SizeHasChanged(); // TODO: OJ 587 } 588 } 589 // XWindowSupplier 590 //-------------------------------------------------------------------- 591 uno::Reference< awt::XWindow > SAL_CALL SdrLightEmbeddedClient_Impl::getWindow() 592 throw ( uno::RuntimeException ) 593 { 594 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 595 uno::Reference< awt::XWindow > xCurrent = m_xWindow; 596 if ( !xCurrent.is() ) 597 { 598 if ( !mpObj ) 599 throw uno::RuntimeException(); 600 uno::Reference< frame::XFrame> xFrame(lcl_getFrame_throw(mpObj),uno::UNO_QUERY_THROW); 601 xCurrent = xFrame->getComponentWindow(); 602 } // if ( !xCurrent.is() ) 603 return xCurrent; 604 } 605 void SdrLightEmbeddedClient_Impl::setWindow(const uno::Reference< awt::XWindow >& _xWindow) 606 { 607 m_xWindow = _xWindow; 608 } 609 610 //////////////////////////////////////////////////////////////////////////////////////////////////// 611 612 class SdrEmbedObjectLink : public sfx2::SvBaseLink 613 { 614 SdrOle2Obj* pObj; 615 616 public: 617 SdrEmbedObjectLink(SdrOle2Obj* pObj); 618 virtual ~SdrEmbedObjectLink(); 619 620 virtual void Closed(); 621 virtual void DataChanged( const String& rMimeType, 622 const ::com::sun::star::uno::Any & rValue ); 623 624 sal_Bool Connect() { return GetRealObject() != NULL; } 625 }; 626 627 // ----------------------------------------------------------------------------- 628 629 SdrEmbedObjectLink::SdrEmbedObjectLink(SdrOle2Obj* pObject): 630 ::sfx2::SvBaseLink( ::sfx2::LINKUPDATE_ONCALL, SOT_FORMATSTR_ID_SVXB ), 631 pObj(pObject) 632 { 633 SetSynchron( sal_False ); 634 } 635 636 // ----------------------------------------------------------------------------- 637 638 SdrEmbedObjectLink::~SdrEmbedObjectLink() 639 { 640 } 641 642 // ----------------------------------------------------------------------------- 643 644 void SdrEmbedObjectLink::DataChanged( const String& /*rMimeType*/, 645 const ::com::sun::star::uno::Any & /*rValue*/ ) 646 { 647 if ( !pObj->UpdateLinkURL_Impl() ) 648 { 649 // the link URL was not changed 650 uno::Reference< embed::XEmbeddedObject > xObject = pObj->GetObjRef(); 651 OSL_ENSURE( xObject.is(), "The object must exist always!\n" ); 652 if ( xObject.is() ) 653 { 654 // let the object reload the link 655 // TODO/LATER: reload call could be used for this case 656 657 try 658 { 659 sal_Int32 nState = xObject->getCurrentState(); 660 if ( nState != embed::EmbedStates::LOADED ) 661 { 662 // in some cases the linked file probably is not locked so it could be changed 663 xObject->changeState( embed::EmbedStates::LOADED ); 664 xObject->changeState( nState ); 665 } 666 } 667 catch ( uno::Exception& ) 668 { 669 } 670 } 671 } 672 673 pObj->GetNewReplacement(); 674 pObj->SetChanged(); 675 } 676 677 // ----------------------------------------------------------------------------- 678 679 void SdrEmbedObjectLink::Closed() 680 { 681 pObj->BreakFileLink_Impl(); 682 SvBaseLink::Closed(); 683 } 684 685 //////////////////////////////////////////////////////////////////////////////////////////////////// 686 687 class SdrOle2ObjImpl 688 { 689 public: 690 // TODO/LATER: do we really need this pointer? 691 GraphicObject* pGraphicObject; 692 String aPersistName; // name of object in persist 693 SdrLightEmbeddedClient_Impl* pLightClient; // must be registered as client only using AddOwnLightClient() call 694 695 // #107645# 696 // New local var to avoid repeated loading if load of OLE2 fails 697 sal_Bool mbLoadingOLEObjectFailed; 698 sal_Bool mbConnected; 699 700 SdrEmbedObjectLink* mpObjectLink; 701 String maLinkURL; 702 703 SdrOle2ObjImpl() 704 : pGraphicObject( NULL ) 705 // #107645# 706 // init to start situation, loading did not fail 707 , mbLoadingOLEObjectFailed( sal_False ) 708 , mbConnected( sal_False ) 709 , mpObjectLink( NULL ) 710 { 711 } 712 }; 713 714 //////////////////////////////////////////////////////////////////////////////////////////////////// 715 716 // Predicate determining whether the given OLE is an internal math 717 // object 718 static bool ImplIsMathObj( const uno::Reference < embed::XEmbeddedObject >& rObjRef ) 719 { 720 if ( !rObjRef.is() ) 721 return false; 722 723 SvGlobalName aClassName( rObjRef->getClassID() ); 724 if( aClassName == SvGlobalName(SO3_SM_CLASSID_30) || 725 aClassName == SvGlobalName(SO3_SM_CLASSID_40) || 726 aClassName == SvGlobalName(SO3_SM_CLASSID_50) || 727 aClassName == SvGlobalName(SO3_SM_CLASSID_60) || 728 aClassName == SvGlobalName(SO3_SM_CLASSID) ) 729 { 730 return true; 731 } 732 else 733 { 734 return false; 735 } 736 } 737 738 ////////////////////////////////////////////////////////////////////////////// 739 // BaseProperties section 740 741 sdr::properties::BaseProperties* SdrOle2Obj::CreateObjectSpecificProperties() 742 { 743 return new sdr::properties::OleProperties(*this); 744 } 745 746 ////////////////////////////////////////////////////////////////////////////// 747 // DrawContact section 748 749 sdr::contact::ViewContact* SdrOle2Obj::CreateObjectSpecificViewContact() 750 { 751 return new sdr::contact::ViewContactOfSdrOle2Obj(*this); 752 } 753 754 // ----------------------------------------------------------------------------- 755 756 TYPEINIT1(SdrOle2Obj,SdrRectObj); 757 DBG_NAME(SdrOle2Obj) 758 SdrOle2Obj::SdrOle2Obj(FASTBOOL bFrame_) : m_bTypeAsked(false) 759 ,m_bChart(false) 760 { 761 DBG_CTOR( SdrOle2Obj,NULL); 762 bInDestruction = sal_False; 763 mbSuppressSetVisAreaSize = false; 764 Init(); 765 bFrame=bFrame_; 766 } 767 768 // ----------------------------------------------------------------------------- 769 SdrOle2Obj::SdrOle2Obj( const svt::EmbeddedObjectRef& rNewObjRef, FASTBOOL bFrame_) 770 : xObjRef( rNewObjRef ) 771 , m_bTypeAsked(false) 772 , m_bChart(false) 773 { 774 DBG_CTOR( SdrOle2Obj,NULL); 775 bInDestruction = sal_False; 776 mbSuppressSetVisAreaSize = false; 777 Init(); 778 779 bFrame=bFrame_; 780 781 if ( xObjRef.is() && (xObjRef->getStatus( GetAspect() ) & embed::EmbedMisc::EMBED_NEVERRESIZE ) ) 782 SetResizeProtect(sal_True); 783 784 // #108759# For math objects, set closed state to transparent 785 SetClosedObj(!ImplIsMathObj( xObjRef.GetObject() )); 786 } 787 788 // ----------------------------------------------------------------------------- 789 790 SdrOle2Obj::SdrOle2Obj( const svt::EmbeddedObjectRef& rNewObjRef, const XubString& rNewObjName, FASTBOOL bFrame_) 791 : xObjRef( rNewObjRef ) 792 , m_bTypeAsked(false) 793 , m_bChart(false) 794 { 795 DBG_CTOR( SdrOle2Obj,NULL); 796 bInDestruction = sal_False; 797 mbSuppressSetVisAreaSize = false; 798 Init(); 799 800 mpImpl->aPersistName = rNewObjName; 801 bFrame=bFrame_; 802 803 if ( xObjRef.is() && (xObjRef->getStatus( GetAspect() ) & embed::EmbedMisc::EMBED_NEVERRESIZE ) ) 804 SetResizeProtect(sal_True); 805 806 // #108759# For math objects, set closed state to transparent 807 SetClosedObj(!ImplIsMathObj( xObjRef.GetObject() )); 808 } 809 810 // ----------------------------------------------------------------------------- 811 812 SdrOle2Obj::SdrOle2Obj( const svt::EmbeddedObjectRef& rNewObjRef, const XubString& rNewObjName, const Rectangle& rNewRect, FASTBOOL bFrame_) 813 : SdrRectObj(rNewRect) 814 , xObjRef( rNewObjRef ) 815 , m_bTypeAsked(false) 816 , m_bChart(false) 817 { 818 DBG_CTOR( SdrOle2Obj,NULL); 819 bInDestruction = sal_False; 820 mbSuppressSetVisAreaSize = false; 821 Init(); 822 823 mpImpl->aPersistName = rNewObjName; 824 bFrame=bFrame_; 825 826 if ( xObjRef.is() && (xObjRef->getStatus( GetAspect() ) & embed::EmbedMisc::EMBED_NEVERRESIZE ) ) 827 SetResizeProtect(sal_True); 828 829 // #108759# For math objects, set closed state to transparent 830 SetClosedObj(!ImplIsMathObj( xObjRef.GetObject() )); 831 } 832 833 // ----------------------------------------------------------------------------- 834 835 void SdrOle2Obj::Init() 836 { 837 mpImpl = new SdrOle2ObjImpl; 838 pModifyListener = NULL; 839 pGraphic=NULL; 840 mpImpl->pGraphicObject=NULL; 841 mpImpl->pLightClient = 0; 842 843 xObjRef.Lock( sal_True ); 844 } 845 846 // ----------------------------------------------------------------------------- 847 //IAccessibility2 Implementation 2009----- 848 String SdrOle2Obj::GetStyleString() 849 { 850 String strStyle; 851 if( xObjRef.is() && xObjRef.IsChart() ) 852 { 853 strStyle = xObjRef.GetChartType(); 854 } 855 return strStyle; 856 } 857 858 // ----------------------------------------------------------------------------- 859 //-----IAccessibility2 Implementation 2009 860 SdrOle2Obj::~SdrOle2Obj() 861 { 862 DBG_DTOR( SdrOle2Obj,NULL); 863 bInDestruction = sal_True; 864 865 if ( mpImpl->mbConnected ) 866 Disconnect(); 867 868 if( pGraphic!=NULL ) 869 delete pGraphic; 870 871 if(mpImpl->pGraphicObject!=NULL) 872 delete mpImpl->pGraphicObject; 873 874 if(pModifyListener) 875 { 876 pModifyListener->invalidate(); 877 pModifyListener->release(); 878 } 879 880 DisconnectFileLink_Impl(); 881 882 if ( mpImpl->pLightClient ) 883 { 884 mpImpl->pLightClient->Release(); 885 mpImpl->pLightClient = NULL; 886 } 887 888 delete mpImpl; 889 } 890 891 // ----------------------------------------------------------------------------- 892 void SdrOle2Obj::SetAspect( sal_Int64 nAspect ) 893 { 894 xObjRef.SetViewAspect( nAspect ); 895 } 896 897 // ----------------------------------------------------------------------------- 898 bool SdrOle2Obj::isInplaceActive() const 899 { 900 return xObjRef.is() && embed::EmbedStates::INPLACE_ACTIVE == xObjRef->getCurrentState(); 901 } 902 903 // ----------------------------------------------------------------------------- 904 bool SdrOle2Obj::isUiActive() const 905 { 906 return xObjRef.is() && embed::EmbedStates::UI_ACTIVE == xObjRef->getCurrentState(); 907 } 908 909 // ----------------------------------------------------------------------------- 910 911 void SdrOle2Obj::SetGraphic_Impl(const Graphic* pGrf) 912 { 913 if ( pGraphic ) 914 { 915 delete pGraphic; 916 pGraphic = NULL; 917 delete mpImpl->pGraphicObject; 918 mpImpl->pGraphicObject = NULL; 919 } 920 921 if (pGrf!=NULL) 922 { 923 pGraphic = new Graphic(*pGrf); 924 mpImpl->pGraphicObject = new GraphicObject( *pGraphic ); 925 } 926 927 SetChanged(); 928 BroadcastObjectChange(); 929 930 //if ( ppObjRef->Is() && pGrf ) 931 // BroadcastObjectChange(); 932 } 933 934 void SdrOle2Obj::SetGraphic(const Graphic* pGrf) 935 { 936 // only for setting a preview graphic 937 SetGraphic_Impl( pGrf ); 938 } 939 940 // ----------------------------------------------------------------------------- 941 942 FASTBOOL SdrOle2Obj::IsEmpty() const 943 { 944 return !(xObjRef.is()); 945 } 946 947 // ----------------------------------------------------------------------------- 948 949 void SdrOle2Obj::Connect() 950 { 951 if( IsEmptyPresObj() ) 952 return; 953 954 if( mpImpl->mbConnected ) 955 { 956 // mba: currently there are situations where it seems to be unavoidable to have multiple connects 957 // changing this would need a larger code rewrite, so for now I remove the assertion 958 // DBG_ERROR("Connect() called on connected object!"); 959 return; 960 } 961 962 Connect_Impl(); 963 AddListeners_Impl(); 964 } 965 966 // ----------------------------------------------------------------------------- 967 968 sal_Bool SdrOle2Obj::UpdateLinkURL_Impl() 969 { 970 sal_Bool bResult = sal_False; 971 972 if ( mpImpl->mpObjectLink ) 973 { 974 sfx2::LinkManager* pLinkManager = pModel ? pModel->GetLinkManager() : NULL; 975 if ( pLinkManager ) 976 { 977 String aNewLinkURL; 978 pLinkManager->GetDisplayNames( mpImpl->mpObjectLink, 0, &aNewLinkURL, 0, 0 ); 979 if ( !aNewLinkURL.EqualsIgnoreCaseAscii( mpImpl->maLinkURL ) ) 980 { 981 const_cast<SdrOle2Obj*>(this)->GetObjRef_Impl(); 982 uno::Reference< embed::XCommonEmbedPersist > xPersObj( xObjRef.GetObject(), uno::UNO_QUERY ); 983 OSL_ENSURE( xPersObj.is(), "The object must exist!\n" ); 984 if ( xPersObj.is() ) 985 { 986 try 987 { 988 sal_Int32 nCurState = xObjRef->getCurrentState(); 989 if ( nCurState != embed::EmbedStates::LOADED ) 990 xObjRef->changeState( embed::EmbedStates::LOADED ); 991 992 // TODO/LATER: there should be possible to get current mediadescriptor settings from the object 993 uno::Sequence< beans::PropertyValue > aArgs( 1 ); 994 aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ); 995 aArgs[0].Value <<= ::rtl::OUString( aNewLinkURL ); 996 xPersObj->reload( aArgs, uno::Sequence< beans::PropertyValue >() ); 997 998 mpImpl->maLinkURL = aNewLinkURL; 999 bResult = sal_True; 1000 1001 if ( nCurState != embed::EmbedStates::LOADED ) 1002 xObjRef->changeState( nCurState ); 1003 } 1004 catch( ::com::sun::star::uno::Exception& e ) 1005 { 1006 (void)e; 1007 DBG_ERROR( 1008 (OString("SdrOle2Obj::UpdateLinkURL_Impl(), " 1009 "exception caught: ") + 1010 rtl::OUStringToOString( 1011 comphelper::anyToString( cppu::getCaughtException() ), 1012 RTL_TEXTENCODING_UTF8 )).getStr() ); 1013 } 1014 } 1015 1016 if ( !bResult ) 1017 { 1018 // TODO/LATER: return the old name to the link manager, is it possible? 1019 } 1020 } 1021 } 1022 } 1023 1024 return bResult; 1025 } 1026 1027 // ----------------------------------------------------------------------------- 1028 1029 void SdrOle2Obj::BreakFileLink_Impl() 1030 { 1031 uno::Reference<document::XStorageBasedDocument> xDoc; 1032 if ( pModel ) 1033 xDoc.set( pModel->getUnoModel(),uno::UNO_QUERY); 1034 1035 if ( xDoc.is() ) 1036 { 1037 uno::Reference< embed::XStorage > xStorage = xDoc->getDocumentStorage(); 1038 if ( xStorage.is() ) 1039 { 1040 try 1041 { 1042 uno::Reference< embed::XLinkageSupport > xLinkSupport( xObjRef.GetObject(), uno::UNO_QUERY_THROW ); 1043 xLinkSupport->breakLink( xStorage, mpImpl->aPersistName ); 1044 DisconnectFileLink_Impl(); 1045 mpImpl->maLinkURL = String(); 1046 } 1047 catch( ::com::sun::star::uno::Exception& e ) 1048 { 1049 (void)e; 1050 DBG_ERROR( 1051 (OString("SdrOle2Obj::BreakFileLink_Impl(), " 1052 "exception caught: ") + 1053 rtl::OUStringToOString( 1054 comphelper::anyToString( cppu::getCaughtException() ), 1055 RTL_TEXTENCODING_UTF8 )).getStr() ); 1056 } 1057 } 1058 } 1059 } 1060 1061 // ----------------------------------------------------------------------------- 1062 1063 void SdrOle2Obj::DisconnectFileLink_Impl() 1064 { 1065 sfx2::LinkManager* pLinkManager = pModel ? pModel->GetLinkManager() : NULL; 1066 if ( pLinkManager && mpImpl->mpObjectLink ) 1067 { 1068 pLinkManager->Remove( mpImpl->mpObjectLink ); 1069 mpImpl->mpObjectLink = NULL; 1070 } 1071 } 1072 1073 // ----------------------------------------------------------------------------- 1074 1075 void SdrOle2Obj::CheckFileLink_Impl() 1076 { 1077 if ( pModel && xObjRef.GetObject().is() && !mpImpl->mpObjectLink ) 1078 { 1079 try 1080 { 1081 uno::Reference< embed::XLinkageSupport > xLinkSupport( xObjRef.GetObject(), uno::UNO_QUERY ); 1082 if ( xLinkSupport.is() && xLinkSupport->isLink() ) 1083 { 1084 String aLinkURL = xLinkSupport->getLinkURL(); 1085 if ( aLinkURL.Len() ) 1086 { 1087 // this is a file link so the model link manager should handle it 1088 sfx2::LinkManager* pLinkManager = pModel->GetLinkManager(); 1089 if ( pLinkManager ) 1090 { 1091 mpImpl->mpObjectLink = new SdrEmbedObjectLink( this ); 1092 mpImpl->maLinkURL = aLinkURL; 1093 pLinkManager->InsertFileLink( *mpImpl->mpObjectLink, OBJECT_CLIENT_OLE, aLinkURL, NULL, NULL ); 1094 mpImpl->mpObjectLink->Connect(); 1095 } 1096 } 1097 } 1098 } 1099 catch( ::com::sun::star::uno::Exception& e ) 1100 { 1101 (void)e; 1102 DBG_ERROR( 1103 (OString("SdrOle2Obj::CheckFileLink_Impl(), " 1104 "exception caught: ") + 1105 rtl::OUStringToOString( 1106 comphelper::anyToString( cppu::getCaughtException() ), 1107 RTL_TEXTENCODING_UTF8 )).getStr() ); 1108 } 1109 } 1110 } 1111 1112 // ----------------------------------------------------------------------------- 1113 1114 void SdrOle2Obj::Reconnect_Impl() 1115 { 1116 DBG_ASSERT( mpImpl->mbConnected, "Assigned unconnected object?!" ); 1117 Connect_Impl(); 1118 } 1119 1120 void SdrOle2Obj::Connect_Impl() 1121 { 1122 if( pModel && mpImpl->aPersistName.Len() ) 1123 { 1124 try 1125 { 1126 ::comphelper::IEmbeddedHelper* pPers = pModel->GetPersist(); 1127 if ( pPers ) 1128 { 1129 comphelper::EmbeddedObjectContainer& rContainer = pPers->getEmbeddedObjectContainer(); 1130 if ( !rContainer.HasEmbeddedObject( mpImpl->aPersistName ) 1131 || ( xObjRef.is() && !rContainer.HasEmbeddedObject( xObjRef.GetObject() ) ) ) 1132 { 1133 // object not known to container document 1134 // No object -> disaster! 1135 DBG_ASSERT( xObjRef.is(), "No object in connect!"); 1136 if ( xObjRef.is() ) 1137 { 1138 // object came from the outside, now add it to the container 1139 ::rtl::OUString aTmp; 1140 rContainer.InsertEmbeddedObject( xObjRef.GetObject(), aTmp ); 1141 mpImpl->aPersistName = aTmp; 1142 } 1143 } 1144 else if ( !xObjRef.is() ) 1145 { 1146 xObjRef.Assign( rContainer.GetEmbeddedObject( mpImpl->aPersistName ), xObjRef.GetViewAspect() ); 1147 m_bTypeAsked = false; 1148 } 1149 1150 if ( xObjRef.GetObject().is() ) 1151 { 1152 xObjRef.AssignToContainer( &rContainer, mpImpl->aPersistName ); 1153 mpImpl->mbConnected = true; 1154 xObjRef.Lock( sal_True ); 1155 } 1156 } 1157 1158 if ( xObjRef.is() ) 1159 { 1160 if ( !mpImpl->pLightClient ) 1161 { 1162 mpImpl->pLightClient = new SdrLightEmbeddedClient_Impl( this ); 1163 mpImpl->pLightClient->acquire(); 1164 } 1165 1166 xObjRef->addStateChangeListener( mpImpl->pLightClient ); 1167 xObjRef->addEventListener( uno::Reference< document::XEventListener >( mpImpl->pLightClient ) ); 1168 1169 if ( xObjRef->getCurrentState() != embed::EmbedStates::LOADED ) 1170 GetSdrGlobalData().GetOLEObjCache().InsertObj(this); 1171 1172 CheckFileLink_Impl(); 1173 1174 uno::Reference< container::XChild > xChild( xObjRef.GetObject(), uno::UNO_QUERY ); 1175 if( xChild.is() ) 1176 { 1177 uno::Reference< uno::XInterface > xParent( pModel->getUnoModel()); 1178 if( xParent.is()) 1179 xChild->setParent( pModel->getUnoModel() ); 1180 } 1181 1182 } 1183 } 1184 catch( ::com::sun::star::uno::Exception& e ) 1185 { 1186 (void)e; 1187 DBG_ERROR( 1188 (OString("SdrOle2Obj::Connect_Impl(), " 1189 "exception caught: ") + 1190 rtl::OUStringToOString( 1191 comphelper::anyToString( cppu::getCaughtException() ), 1192 RTL_TEXTENCODING_UTF8 )).getStr() ); 1193 } 1194 } 1195 1196 //TODO/LATER: wait for definition of MiscStatus RESIZEONPRINTERCHANGE 1197 //if ( xObjRef.is() && (*ppObjRef)->GetMiscStatus() & SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE ) 1198 { 1199 //TODO/LATER: needs a new handling for OnPrinterChanged 1200 /* 1201 if (pModel && pModel->GetRefDevice() && 1202 pModel->GetRefDevice()->GetOutDevType() == OUTDEV_PRINTER) 1203 { 1204 // Kein RefDevice oder RefDevice kein Printer 1205 sal_Bool bModified = (*ppObjRef)->IsModified(); 1206 Printer* pPrinter = (Printer*) pModel->GetRefDevice(); 1207 (*ppObjRef)->OnDocumentPrinterChanged( pPrinter ); 1208 (*ppObjRef)->SetModified( bModified ); 1209 }*/ 1210 } 1211 } 1212 1213 void SdrOle2Obj::ObjectLoaded() 1214 { 1215 AddListeners_Impl(); 1216 } 1217 1218 void SdrOle2Obj::AddListeners_Impl() 1219 { 1220 if( xObjRef.is() && xObjRef->getCurrentState() != embed::EmbedStates::LOADED ) 1221 { 1222 // register modify listener 1223 if( !pModifyListener ) 1224 { 1225 ((SdrOle2Obj*)this)->pModifyListener = new SvxUnoShapeModifyListener( (SdrOle2Obj*)this ); 1226 pModifyListener->acquire(); 1227 } 1228 1229 uno::Reference< util::XModifyBroadcaster > xBC( getXModel(), uno::UNO_QUERY ); 1230 if( xBC.is() && pModifyListener ) 1231 { 1232 uno::Reference< util::XModifyListener > xListener( pModifyListener ); 1233 xBC->addModifyListener( xListener ); 1234 } 1235 } 1236 } 1237 1238 // ----------------------------------------------------------------------------- 1239 1240 void SdrOle2Obj::Disconnect() 1241 { 1242 if( IsEmptyPresObj() ) 1243 return; 1244 1245 if( !mpImpl->mbConnected ) 1246 { 1247 DBG_ERROR("Disconnect() called on disconnected object!"); 1248 return; 1249 } 1250 1251 RemoveListeners_Impl(); 1252 Disconnect_Impl(); 1253 } 1254 1255 void SdrOle2Obj::RemoveListeners_Impl() 1256 { 1257 if( xObjRef.is() && mpImpl->aPersistName.Len() ) 1258 { 1259 try 1260 { 1261 sal_Int32 nState = xObjRef->getCurrentState(); 1262 if ( nState != embed::EmbedStates::LOADED ) 1263 { 1264 uno::Reference< util::XModifyBroadcaster > xBC( getXModel(), uno::UNO_QUERY ); 1265 if( xBC.is() && pModifyListener ) 1266 { 1267 uno::Reference< util::XModifyListener > xListener( pModifyListener ); 1268 xBC->removeModifyListener( xListener ); 1269 } 1270 } 1271 } 1272 catch( ::com::sun::star::uno::Exception& e ) 1273 { 1274 (void)e; 1275 DBG_ERROR( 1276 (OString("SdrOle2Obj::RemoveListeners_Impl(), " 1277 "exception caught: ") + 1278 rtl::OUStringToOString( 1279 comphelper::anyToString( cppu::getCaughtException() ), 1280 RTL_TEXTENCODING_UTF8 )).getStr() ); 1281 } 1282 } 1283 } 1284 1285 void SdrOle2Obj::Disconnect_Impl() 1286 { 1287 try 1288 { 1289 if ( pModel && mpImpl->aPersistName.Len() ) 1290 { 1291 if( pModel->IsInDestruction() ) 1292 { 1293 // TODO/LATER: here we must assume that the destruction of the model is enough to make clear that we will not 1294 // remove the object from the container, even if the DrawingObject itself is not destroyed (unfortunately this 1295 // There is no real need to do the following removing of the object from the container 1296 // in case the model has correct persistance, but in case of problems such a removing 1297 // would make the behaviour of the office more stable 1298 1299 comphelper::EmbeddedObjectContainer* pContainer = xObjRef.GetContainer(); 1300 if ( pContainer ) 1301 { 1302 pContainer->CloseEmbeddedObject( xObjRef.GetObject() ); 1303 xObjRef.AssignToContainer( NULL, mpImpl->aPersistName ); 1304 } 1305 1306 // happens later than the destruction of the model, so we can't assert that). 1307 //DBG_ASSERT( bInDestruction, "Model is destroyed, but not me?!" ); 1308 //TODO/LATER: should be make sure that the ObjectShell also forgets the object, because we will close it soon? 1309 /* 1310 uno::Reference < util::XCloseable > xClose( xObjRef, uno::UNO_QUERY ); 1311 if ( xClose.is() ) 1312 { 1313 try 1314 { 1315 xClose->close( sal_True ); 1316 } 1317 catch ( util::CloseVetoException& ) 1318 { 1319 // there's still someone who needs the object! 1320 } 1321 } 1322 1323 xObjRef = NULL;*/ 1324 } 1325 else if ( xObjRef.is() ) 1326 { 1327 if ( pModel->getUnoModel().is() ) 1328 { 1329 // remove object, but don't close it (that's up to someone else) 1330 comphelper::EmbeddedObjectContainer* pContainer = xObjRef.GetContainer(); 1331 if ( pContainer ) 1332 { 1333 pContainer->RemoveEmbeddedObject( xObjRef.GetObject(), sal_False); 1334 1335 // TODO/LATER: mpImpl->aPersistName contains outdated information, to have it uptodate 1336 // it should be returned from RemoveEmbeddedObject call. Currently it is no problem, 1337 // since no container is adjusted, actually the empty string could be provided as a name here 1338 xObjRef.AssignToContainer( NULL, mpImpl->aPersistName ); 1339 } 1340 1341 DisconnectFileLink_Impl(); 1342 } 1343 } 1344 } 1345 1346 if ( xObjRef.is() && mpImpl->pLightClient ) 1347 { 1348 xObjRef->removeStateChangeListener ( mpImpl->pLightClient ); 1349 xObjRef->removeEventListener( uno::Reference< document::XEventListener >( mpImpl->pLightClient ) ); 1350 xObjRef->setClientSite( NULL ); 1351 1352 GetSdrGlobalData().GetOLEObjCache().RemoveObj(this); 1353 } 1354 } 1355 catch( ::com::sun::star::uno::Exception& e ) 1356 { 1357 (void)e; 1358 DBG_ERROR( 1359 (OString("SdrOle2Obj::Disconnect_Impl(), " 1360 "exception caught: ") + 1361 rtl::OUStringToOString( 1362 comphelper::anyToString( cppu::getCaughtException() ), 1363 RTL_TEXTENCODING_UTF8 )).getStr() ); 1364 } 1365 1366 mpImpl->mbConnected = false; 1367 } 1368 1369 // ----------------------------------------------------------------------------- 1370 1371 SdrObject* SdrOle2Obj::createSdrGrafObjReplacement(bool bAddText, bool bUseHCGraphic) const 1372 { 1373 Graphic* pOLEGraphic = GetGraphic(); 1374 1375 if(bUseHCGraphic && Application::GetSettings().GetStyleSettings().GetHighContrastMode()) 1376 { 1377 pOLEGraphic = getEmbeddedObjectRef().GetHCGraphic(); 1378 } 1379 1380 if(pOLEGraphic) 1381 { 1382 // #i118485# allow creating a SdrGrafObj representation 1383 SdrGrafObj* pClone = new SdrGrafObj(*pOLEGraphic); 1384 pClone->SetModel(GetModel()); 1385 1386 // copy transformation 1387 basegfx::B2DHomMatrix aMatrix; 1388 basegfx::B2DPolyPolygon aPolyPolygon; 1389 1390 TRGetBaseGeometry(aMatrix, aPolyPolygon); 1391 pClone->TRSetBaseGeometry(aMatrix, aPolyPolygon); 1392 1393 // copy all attributes to support graphic styles for OLEs 1394 pClone->SetStyleSheet(GetStyleSheet(), false); 1395 pClone->SetMergedItemSet(GetMergedItemSet()); 1396 1397 if(bAddText) 1398 { 1399 // #i118485# copy text (Caution! Model needed, as guaranteed in aw080) 1400 OutlinerParaObject* pOPO = GetOutlinerParaObject(); 1401 1402 if(pOPO && GetModel()) 1403 { 1404 pClone->NbcSetOutlinerParaObject(new OutlinerParaObject(*pOPO)); 1405 } 1406 } 1407 1408 return pClone; 1409 } 1410 else 1411 { 1412 // #i100710# pOLEGraphic may be zero (no visualisation available), 1413 // so we need to use the OLE replacement graphic 1414 SdrRectObj* pClone = new SdrRectObj(GetSnapRect()); 1415 pClone->SetModel(GetModel()); 1416 1417 // gray outline 1418 pClone->SetMergedItem(XLineStyleItem(XLINE_SOLID)); 1419 const svtools::ColorConfig aColorConfig; 1420 const svtools::ColorConfigValue aColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES)); 1421 pClone->SetMergedItem(XLineColorItem(String(), aColor.nColor)); 1422 1423 // bitmap fill 1424 pClone->SetMergedItem(XFillStyleItem(XFILL_BITMAP)); 1425 pClone->SetMergedItem(XFillBitmapItem(String(), Graphic(GetEmtyOLEReplacementBitmap()))); 1426 pClone->SetMergedItem(XFillBmpTileItem(false)); 1427 pClone->SetMergedItem(XFillBmpStretchItem(false)); 1428 1429 return pClone; 1430 } 1431 } 1432 1433 SdrObject* SdrOle2Obj::DoConvertToPolyObj(sal_Bool bBezier, bool bAddText) const 1434 { 1435 // #i118485# missing converter added 1436 if(GetModel()) 1437 { 1438 SdrObject* pRetval = createSdrGrafObjReplacement(true, false); 1439 1440 if(pRetval) 1441 { 1442 SdrObject* pRetval2 = pRetval->DoConvertToPolyObj(bBezier, bAddText); 1443 SdrObject::Free(pRetval); 1444 1445 return pRetval2; 1446 } 1447 } 1448 1449 return 0; 1450 } 1451 1452 // ----------------------------------------------------------------------------- 1453 1454 void SdrOle2Obj::SetModel(SdrModel* pNewModel) 1455 { 1456 ::comphelper::IEmbeddedHelper* pDestPers = pNewModel ? pNewModel->GetPersist() : 0; 1457 ::comphelper::IEmbeddedHelper* pSrcPers = pModel ? pModel->GetPersist() : 0; 1458 1459 if ( pNewModel == pModel ) 1460 { 1461 // don't know if this is necessary or if it will ever happen, but who know?! 1462 SdrRectObj::SetModel( pNewModel ); 1463 return; 1464 } 1465 1466 // assignment to model has changed 1467 DBG_ASSERT( pSrcPers || !mpImpl->mbConnected, "Connected object without a model?!" ); 1468 1469 DBG_ASSERT( pDestPers, "The destination model must have a persistence! Please submit an issue!" ); 1470 DBG_ASSERT( pDestPers != pSrcPers, "The source and the destination models should have different persistences! Problems are possible!" ); 1471 1472 // this is a bug if the target model has no persistence 1473 // no error handling is possible so just do nothing in this method 1474 if ( !pDestPers ) 1475 return; 1476 1477 RemoveListeners_Impl(); 1478 1479 if( pDestPers && pSrcPers && !IsEmptyPresObj() ) 1480 { 1481 try 1482 { 1483 // move the objects' storage; ObjectRef remains the same, but PersistName may change 1484 ::rtl::OUString aTmp; 1485 comphelper::EmbeddedObjectContainer& rContainer = pSrcPers->getEmbeddedObjectContainer(); 1486 uno::Reference < embed::XEmbeddedObject > xObj = rContainer.GetEmbeddedObject( mpImpl->aPersistName ); 1487 DBG_ASSERT( !xObjRef.is() || xObjRef.GetObject() == xObj, "Wrong object identity!" ); 1488 if ( xObj.is() ) 1489 { 1490 pDestPers->getEmbeddedObjectContainer().MoveEmbeddedObject( rContainer, xObj, aTmp ); 1491 mpImpl->aPersistName = aTmp; 1492 xObjRef.AssignToContainer( &pDestPers->getEmbeddedObjectContainer(), aTmp ); 1493 } 1494 DBG_ASSERT( aTmp.getLength(), "Copying embedded object failed!" ); 1495 } 1496 catch( ::com::sun::star::uno::Exception& e ) 1497 { 1498 (void)e; 1499 DBG_ERROR( 1500 (OString("SdrOle2Obj::SetModel(), " 1501 "exception caught: ") + 1502 rtl::OUStringToOString( 1503 comphelper::anyToString( cppu::getCaughtException() ), 1504 RTL_TEXTENCODING_UTF8 )).getStr() ); 1505 } 1506 } 1507 1508 SdrRectObj::SetModel( pNewModel ); 1509 1510 // #i43086# 1511 // #i85304 redo the change for charts for the above bugfix, as #i43086# does not ocur anymore 1512 //so maybe the ImpSetVisAreaSize call can be removed here completely 1513 //Nevertheless I leave it in for other objects as I am not sure about the side effects when removing now 1514 if( pModel && !pModel->isLocked() && !IsChart() ) 1515 ImpSetVisAreaSize(); 1516 1517 if( pDestPers && !IsEmptyPresObj() ) 1518 { 1519 if ( !pSrcPers || IsEmptyPresObj() ) 1520 // object wasn't connected, now it should 1521 Connect_Impl(); 1522 else 1523 Reconnect_Impl(); 1524 } 1525 1526 AddListeners_Impl(); 1527 } 1528 1529 // ----------------------------------------------------------------------------- 1530 1531 void SdrOle2Obj::SetPage(SdrPage* pNewPage) 1532 { 1533 FASTBOOL bRemove=pNewPage==NULL && pPage!=NULL; 1534 FASTBOOL bInsert=pNewPage!=NULL && pPage==NULL; 1535 1536 if (bRemove && mpImpl->mbConnected ) 1537 Disconnect(); 1538 1539 if(!pModel && !GetStyleSheet() && pNewPage->GetModel()) 1540 { 1541 // #119287# Set default StyleSheet for SdrGrafObj here, it is different from 'Default'. This 1542 // needs to be done before the style 'Default' is set from the :SetModel() call which is triggered 1543 // from the following :SetPage(). 1544 // TTTT: Needs to be moved in branch aw080 due to having a SdrModel from the beginning, is at this 1545 // place for convenience currently (works in both versions, is not in the way) 1546 SfxStyleSheet* pSheet = pNewPage->GetModel()->GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj(); 1547 1548 if(pSheet) 1549 { 1550 SetStyleSheet(pSheet, false); 1551 } 1552 else 1553 { 1554 SetMergedItem(XFillStyleItem(XFILL_NONE)); 1555 SetMergedItem(XLineStyleItem(XLINE_NONE)); 1556 } 1557 } 1558 1559 SdrRectObj::SetPage(pNewPage); 1560 1561 if (bInsert && !mpImpl->mbConnected ) 1562 Connect(); 1563 } 1564 1565 // ----------------------------------------------------------------------------- 1566 1567 void SdrOle2Obj::SetObjRef( const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& rNewObjRef ) 1568 { 1569 DBG_ASSERT( !rNewObjRef.is() || !xObjRef.GetObject().is(), "SetObjRef called on already initialized object!"); 1570 if( rNewObjRef == xObjRef.GetObject() ) 1571 return; 1572 1573 // MBA: the caller of the method is responsible to control the old object, it will not be closed here 1574 // Otherwise WW8 import crashes because it tranfers control to OLENode by this method 1575 if ( xObjRef.GetObject().is() ) 1576 xObjRef.Lock( sal_False ); 1577 1578 // MBA: avoid removal of object in Disconnect! It is definitely a HACK to call SetObjRef(0)! 1579 // This call will try to close the objects; so if anybody else wants to keep it, it must be locked by a CloseListener 1580 xObjRef.Clear(); 1581 1582 if ( mpImpl->mbConnected ) 1583 Disconnect(); 1584 1585 xObjRef.Assign( rNewObjRef, GetAspect() ); 1586 m_bTypeAsked = false; 1587 1588 if ( xObjRef.is() ) 1589 { 1590 DELETEZ( pGraphic ); 1591 1592 if ( (xObjRef->getStatus( GetAspect() ) & embed::EmbedMisc::EMBED_NEVERRESIZE ) ) 1593 SetResizeProtect(sal_True); 1594 1595 // #108759# For math objects, set closed state to transparent 1596 SetClosedObj(!ImplIsMathObj( rNewObjRef )); 1597 1598 Connect(); 1599 } 1600 1601 SetChanged(); 1602 BroadcastObjectChange(); 1603 } 1604 1605 // ----------------------------------------------------------------------------- 1606 1607 void SdrOle2Obj::SetClosedObj( bool bIsClosed ) 1608 { 1609 // TODO/LATER: do we still need this hack? 1610 // #108759# Allow changes to the closed state of OLE objects 1611 bClosedObj = bIsClosed; 1612 } 1613 1614 // ----------------------------------------------------------------------------- 1615 1616 SdrObject* SdrOle2Obj::getFullDragClone() const 1617 { 1618 // special handling for OLE. The default handling works, but is too 1619 // slow when the whole OLE needs to be cloned. Get the Metafile and 1620 // create a graphic object with it 1621 1622 // #i118485# use central replacement generator 1623 return createSdrGrafObjReplacement(false, true); 1624 } 1625 1626 // ----------------------------------------------------------------------------- 1627 1628 void SdrOle2Obj::SetPersistName( const String& rPersistName ) 1629 { 1630 DBG_ASSERT( !mpImpl->aPersistName.Len(), "Persist name changed!"); 1631 1632 mpImpl->aPersistName = rPersistName; 1633 mpImpl->mbLoadingOLEObjectFailed = false; 1634 1635 Connect(); 1636 SetChanged(); 1637 } 1638 1639 void SdrOle2Obj::AbandonObject() 1640 { 1641 mpImpl->aPersistName.Erase(); 1642 mpImpl->mbLoadingOLEObjectFailed = false; 1643 SetObjRef(0); 1644 } 1645 1646 // ----------------------------------------------------------------------------- 1647 1648 String SdrOle2Obj::GetPersistName() const 1649 { 1650 return mpImpl->aPersistName; 1651 } 1652 1653 // ----------------------------------------------------------------------------- 1654 1655 void SdrOle2Obj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const 1656 { 1657 // #i118485# Allowing much more attributes for OLEs 1658 rInfo.bRotateFreeAllowed = true; 1659 rInfo.bRotate90Allowed = true; 1660 rInfo.bMirrorFreeAllowed = true; 1661 rInfo.bMirror45Allowed = true; 1662 rInfo.bMirror90Allowed = true; 1663 rInfo.bTransparenceAllowed = true; 1664 rInfo.bGradientAllowed = true; 1665 rInfo.bShearAllowed = true; 1666 rInfo.bEdgeRadiusAllowed = false; 1667 rInfo.bNoOrthoDesired = false; 1668 rInfo.bCanConvToPath = true; 1669 rInfo.bCanConvToPoly = true; 1670 rInfo.bCanConvToPathLineToArea = false; 1671 rInfo.bCanConvToPolyLineToArea = false; 1672 rInfo.bCanConvToContour = true; 1673 } 1674 1675 // ----------------------------------------------------------------------------- 1676 1677 sal_uInt16 SdrOle2Obj::GetObjIdentifier() const 1678 { 1679 return bFrame ? sal_uInt16(OBJ_FRAME) : sal_uInt16(OBJ_OLE2); 1680 } 1681 1682 // ----------------------------------------------------------------------------- 1683 1684 void SdrOle2Obj::TakeObjNameSingul(XubString& rName) const 1685 { 1686 rName = ImpGetResStr(bFrame ? STR_ObjNameSingulFrame : STR_ObjNameSingulOLE2); 1687 1688 const String aName(GetName()); 1689 1690 if( aName.Len() ) 1691 { 1692 rName.AppendAscii(" '"); 1693 rName += aName; 1694 rName += sal_Unicode('\''); 1695 } 1696 } 1697 1698 // ----------------------------------------------------------------------------- 1699 1700 void SdrOle2Obj::TakeObjNamePlural(XubString& rName) const 1701 { 1702 rName=ImpGetResStr(bFrame ? STR_ObjNamePluralFrame : STR_ObjNamePluralOLE2); 1703 } 1704 1705 // ----------------------------------------------------------------------------- 1706 1707 void SdrOle2Obj::operator=(const SdrObject& rObj) 1708 { 1709 //TODO/LATER: who takes over control of my old object?! 1710 if( &rObj != this ) 1711 { 1712 // #116235# 1713 // ImpAssign( rObj ); 1714 const SdrOle2Obj& rOle2Obj = static_cast< const SdrOle2Obj& >( rObj ); 1715 1716 uno::Reference < util::XCloseable > xClose( xObjRef.GetObject(), uno::UNO_QUERY ); 1717 1718 if( pModel && mpImpl->mbConnected ) 1719 Disconnect(); 1720 1721 SdrRectObj::operator=( rObj ); 1722 1723 // #108867# Manually copying bClosedObj attribute 1724 SetClosedObj( rObj.IsClosedObj() ); 1725 1726 mpImpl->aPersistName = rOle2Obj.mpImpl->aPersistName; 1727 aProgName = rOle2Obj.aProgName; 1728 bFrame = rOle2Obj.bFrame; 1729 1730 if( rOle2Obj.pGraphic ) 1731 { 1732 if( pGraphic ) 1733 { 1734 delete pGraphic; 1735 delete mpImpl->pGraphicObject; 1736 } 1737 1738 pGraphic = new Graphic( *rOle2Obj.pGraphic ); 1739 mpImpl->pGraphicObject = new GraphicObject( *pGraphic ); 1740 } 1741 1742 if( pModel && rObj.GetModel() && !IsEmptyPresObj() ) 1743 { 1744 ::comphelper::IEmbeddedHelper* pDestPers = pModel->GetPersist(); 1745 ::comphelper::IEmbeddedHelper* pSrcPers = rObj.GetModel()->GetPersist(); 1746 if( pDestPers && pSrcPers ) 1747 { 1748 DBG_ASSERT( !xObjRef.is(), "Object already existing!" ); 1749 comphelper::EmbeddedObjectContainer& rContainer = pSrcPers->getEmbeddedObjectContainer(); 1750 uno::Reference < embed::XEmbeddedObject > xObj = rContainer.GetEmbeddedObject( mpImpl->aPersistName ); 1751 if ( xObj.is() ) 1752 { 1753 ::rtl::OUString aTmp; 1754 xObjRef.Assign( pDestPers->getEmbeddedObjectContainer().CopyAndGetEmbeddedObject( rContainer, xObj, aTmp ), rOle2Obj.GetAspect() ); 1755 m_bTypeAsked = false; 1756 mpImpl->aPersistName = aTmp; 1757 CheckFileLink_Impl(); 1758 } 1759 1760 Connect(); 1761 1762 /* only needed for MSOLE-Objects, now handled inside implementation of Object 1763 if ( xObjRef.is() && rOle2Obj.xObjRef.is() && rOle2Obj.GetAspect() != embed::Aspects::MSOLE_ICON ) 1764 { 1765 try 1766 { 1767 awt::Size aVisSize = rOle2Obj.xObjRef->getVisualAreaSize( rOle2Obj.GetAspect() ); 1768 if( rOle2Obj.xObjRef->getMapUnit( rOle2Obj.GetAspect() ) == xObjRef->getMapUnit( GetAspect() ) ) 1769 xObjRef->setVisualAreaSize( GetAspect(), aVisSize ); 1770 } 1771 catch ( embed::WrongStateException& ) 1772 { 1773 // setting of VisArea not necessary for objects that don't cache it in loaded state 1774 } 1775 catch( embed::NoVisualAreaSizeException& ) 1776 { 1777 // objects my not have visual areas 1778 } 1779 catch( uno::Exception& e ) 1780 { 1781 (void)e; 1782 DBG_ERROR( "SdrOle2Obj::operator=(), unexcpected exception caught!" ); 1783 } 1784 } */ 1785 } 1786 } 1787 } 1788 } 1789 1790 // ----------------------------------------------------------------------------- 1791 1792 void SdrOle2Obj::ImpSetVisAreaSize() 1793 { 1794 // #i118524# do not again set VisAreaSize when the call comes from OLE client (e.g. ObjectAreaChanged) 1795 if(mbSuppressSetVisAreaSize) 1796 return; 1797 1798 // currently there is no need to recalculate scaling for iconified objects 1799 // TODO/LATER: it might be needed in future when it is possible to change the icon 1800 if ( GetAspect() == embed::Aspects::MSOLE_ICON ) 1801 return; 1802 1803 // the object area of an embedded object was changed, e.g. by user interaction an a selected object 1804 GetObjRef(); 1805 if ( xObjRef.is() ) 1806 { 1807 OSL_ASSERT( pModel ); 1808 sal_Int64 nMiscStatus = xObjRef->getStatus( GetAspect() ); 1809 1810 // the client is required to get access to scaling 1811 SfxInPlaceClient* pClient = SfxInPlaceClient::GetClient( dynamic_cast<SfxObjectShell*>(pModel->GetPersist()), xObjRef.GetObject() ); 1812 sal_Bool bHasOwnClient = 1813 ( mpImpl->pLightClient 1814 && xObjRef->getClientSite() == uno::Reference< embed::XEmbeddedClient >( mpImpl->pLightClient ) ); 1815 1816 if ( pClient || bHasOwnClient ) 1817 { 1818 // TODO/LATER: IMHO we need to do similar things when object is UIActive or OutplaceActive?! (MBA) 1819 if ( ((nMiscStatus & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) && 1820 svt::EmbeddedObjectRef::TryRunningState( xObjRef.GetObject() )) 1821 || xObjRef->getCurrentState() == embed::EmbedStates::INPLACE_ACTIVE 1822 ) 1823 { 1824 Fraction aScaleWidth; 1825 Fraction aScaleHeight; 1826 if ( pClient ) 1827 { 1828 aScaleWidth = pClient->GetScaleWidth(); 1829 aScaleHeight = pClient->GetScaleHeight(); 1830 } 1831 else 1832 { 1833 aScaleWidth = mpImpl->pLightClient->GetScaleWidth(); 1834 aScaleHeight = mpImpl->pLightClient->GetScaleHeight(); 1835 } 1836 1837 // The object wants to resize itself (f.e. Chart wants to recalculate the layout) 1838 // or object is inplace active and so has a window that must be resized also 1839 // In these cases the change in the object area size will be reflected in a change of the 1840 // objects' visual area. The scaling will not change, but it might exist already and must 1841 // be used in calculations 1842 MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObjRef->getMapUnit( GetAspect() ) ); 1843 Size aVisSize( (long)( Fraction( aRect.GetWidth() ) / aScaleWidth ), 1844 (long)( Fraction( aRect.GetHeight() ) / aScaleHeight ) ); 1845 1846 aVisSize = OutputDevice::LogicToLogic( aVisSize, pModel->GetScaleUnit(), aMapUnit); 1847 awt::Size aSz; 1848 aSz.Width = aVisSize.Width(); 1849 aSz.Height = aVisSize.Height(); 1850 xObjRef->setVisualAreaSize( GetAspect(), aSz ); 1851 1852 try 1853 { 1854 aSz = xObjRef->getVisualAreaSize( GetAspect() ); 1855 } 1856 catch( embed::NoVisualAreaSizeException& ) 1857 {} 1858 1859 Rectangle aAcceptedVisArea; 1860 aAcceptedVisArea.SetSize( Size( (long)( Fraction( long( aSz.Width ) ) * aScaleWidth ), 1861 (long)( Fraction( long( aSz.Height ) ) * aScaleHeight ) ) ); 1862 if (aVisSize != aAcceptedVisArea.GetSize()) 1863 { 1864 // server changed VisArea to its liking and the VisArea is different than the suggested one 1865 // store the new value as given by the object 1866 MapUnit aNewMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObjRef->getMapUnit( GetAspect() ) ); 1867 aRect.SetSize(OutputDevice::LogicToLogic( aAcceptedVisArea.GetSize(), aNewMapUnit, pModel->GetScaleUnit())); 1868 } 1869 1870 // make the new object area known to the client 1871 // compared to the "else" branch aRect might have been changed by the object and no additional scaling was applied 1872 // OJ: WHY this -> OSL_ASSERT( pClient ); 1873 if( pClient ) 1874 pClient->SetObjArea(aRect); 1875 1876 // we need a new replacement image as the object has resized itself 1877 1878 //#i79578# don't request a new replacement image for charts to often 1879 //a chart sends a modified call to the framework if it was changed 1880 //thus the replacement update is already handled there 1881 if( !IsChart() ) 1882 xObjRef.UpdateReplacement(); 1883 } 1884 else 1885 { 1886 // The object isn't active and does not want to resize itself so the changed object area size 1887 // will be reflected in a changed object scaling 1888 Fraction aScaleWidth; 1889 Fraction aScaleHeight; 1890 Size aObjAreaSize; 1891 if ( CalculateNewScaling( aScaleWidth, aScaleHeight, aObjAreaSize ) ) 1892 { 1893 if ( pClient ) 1894 { 1895 Rectangle aScaleRect(aRect.TopLeft(), aObjAreaSize); 1896 pClient->SetObjAreaAndScale( aScaleRect, aScaleWidth, aScaleHeight); 1897 } 1898 else 1899 { 1900 mpImpl->pLightClient->SetSizeScale( aScaleWidth, aScaleHeight ); 1901 } 1902 } 1903 } 1904 } 1905 else if( (nMiscStatus & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) && 1906 svt::EmbeddedObjectRef::TryRunningState( xObjRef.GetObject() ) ) 1907 { 1908 //also handle not sfx based ole objects e.g. charts 1909 //#i83860# resizing charts in impress distorts fonts 1910 uno::Reference< embed::XVisualObject > xVisualObject( this->getXModel(), uno::UNO_QUERY ); 1911 if( xVisualObject.is() ) 1912 { 1913 MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObjRef->getMapUnit( GetAspect() ) ); 1914 Point aTL( aRect.TopLeft() ); 1915 Point aBR( aRect.BottomRight() ); 1916 Point aTL2( OutputDevice::LogicToLogic( aTL, pModel->GetScaleUnit(), aMapUnit) ); 1917 Point aBR2( OutputDevice::LogicToLogic( aBR, pModel->GetScaleUnit(), aMapUnit) ); 1918 Rectangle aNewRect( aTL2, aBR2 ); 1919 xVisualObject->setVisualAreaSize( GetAspect(), awt::Size( aNewRect.GetWidth(), aNewRect.GetHeight() ) ); 1920 } 1921 } 1922 } 1923 } 1924 1925 // ----------------------------------------------------------------------------- 1926 1927 void SdrOle2Obj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) 1928 { 1929 if( pModel && !pModel->isLocked() ) 1930 { 1931 GetObjRef(); 1932 if ( xObjRef.is() && ( xObjRef->getStatus( GetAspect() ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE ) ) 1933 { 1934 // if the object needs recompose on resize 1935 // the client site should be created before the resize will take place 1936 // check whether there is no client site and create it if necessary 1937 AddOwnLightClient(); 1938 } 1939 } 1940 1941 SdrRectObj::NbcResize(rRef,xFact,yFact); 1942 1943 if( pModel && !pModel->isLocked() ) 1944 ImpSetVisAreaSize(); 1945 } 1946 1947 // ----------------------------------------------------------------------------- 1948 1949 void SdrOle2Obj::SetGeoData(const SdrObjGeoData& rGeo) 1950 { 1951 SdrRectObj::SetGeoData(rGeo); 1952 1953 if( pModel && !pModel->isLocked() ) 1954 ImpSetVisAreaSize(); 1955 } 1956 1957 // ----------------------------------------------------------------------------- 1958 1959 void SdrOle2Obj::NbcSetSnapRect(const Rectangle& rRect) 1960 { 1961 SdrRectObj::NbcSetSnapRect(rRect); 1962 1963 if( pModel && !pModel->isLocked() ) 1964 ImpSetVisAreaSize(); 1965 1966 if ( xObjRef.is() && IsChart() ) 1967 { 1968 //#i103460# charts do not necessaryly have an own size within ODF files, 1969 //for this case they need to use the size settings from the surrounding frame, 1970 //which is made available with this method as there is no other way 1971 xObjRef.SetDefaultSizeForChart( Size( rRect.GetWidth(), rRect.GetHeight() ) ); 1972 } 1973 } 1974 1975 // ----------------------------------------------------------------------------- 1976 1977 void SdrOle2Obj::NbcSetLogicRect(const Rectangle& rRect) 1978 { 1979 SdrRectObj::NbcSetLogicRect(rRect); 1980 1981 if( pModel && !pModel->isLocked() ) 1982 ImpSetVisAreaSize(); 1983 } 1984 1985 Graphic* SdrOle2Obj::GetGraphic() const 1986 { 1987 if ( xObjRef.is() ) 1988 return xObjRef.GetGraphic(); 1989 return pGraphic; 1990 } 1991 1992 void SdrOle2Obj::GetNewReplacement() 1993 { 1994 if ( xObjRef.is() ) 1995 xObjRef.UpdateReplacement(); 1996 } 1997 1998 // ----------------------------------------------------------------------------- 1999 2000 Size SdrOle2Obj::GetOrigObjSize( MapMode* pTargetMapMode ) const 2001 { 2002 return xObjRef.GetSize( pTargetMapMode ); 2003 } 2004 2005 // ----------------------------------------------------------------------------- 2006 2007 void SdrOle2Obj::NbcMove(const Size& rSize) 2008 { 2009 SdrRectObj::NbcMove(rSize); 2010 2011 if( pModel && !pModel->isLocked() ) 2012 ImpSetVisAreaSize(); 2013 } 2014 2015 // ----------------------------------------------------------------------------- 2016 2017 sal_Bool SdrOle2Obj::CanUnloadRunningObj( const uno::Reference< embed::XEmbeddedObject >& xObj, sal_Int64 nAspect ) 2018 { 2019 sal_Bool bResult = sal_False; 2020 2021 sal_Int32 nState = xObj->getCurrentState(); 2022 if ( nState == embed::EmbedStates::LOADED ) 2023 { 2024 // the object is already unloaded 2025 bResult = sal_True; 2026 } 2027 else 2028 { 2029 uno::Reference < util::XModifiable > xModifiable( xObj->getComponent(), uno::UNO_QUERY ); 2030 if ( !xModifiable.is() ) 2031 bResult = sal_True; 2032 else 2033 { 2034 sal_Int64 nMiscStatus = xObj->getStatus( nAspect ); 2035 2036 if ( embed::EmbedMisc::MS_EMBED_ALWAYSRUN != ( nMiscStatus & embed::EmbedMisc::MS_EMBED_ALWAYSRUN ) && 2037 embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY != ( nMiscStatus & embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY ) && 2038 !( xModifiable.is() && xModifiable->isModified() ) && 2039 !( nState == embed::EmbedStates::INPLACE_ACTIVE || nState == embed::EmbedStates::UI_ACTIVE || nState == embed::EmbedStates::ACTIVE ) ) 2040 { 2041 bResult = sal_True; 2042 } 2043 } 2044 } 2045 2046 return bResult; 2047 } 2048 2049 // ----------------------------------------------------------------------------- 2050 2051 sal_Bool SdrOle2Obj::Unload( const uno::Reference< embed::XEmbeddedObject >& xObj, sal_Int64 nAspect ) 2052 { 2053 sal_Bool bResult = sal_False; 2054 2055 if ( CanUnloadRunningObj( xObj, nAspect ) ) 2056 { 2057 try 2058 { 2059 xObj->changeState( embed::EmbedStates::LOADED ); 2060 bResult = sal_True; 2061 } 2062 catch( ::com::sun::star::uno::Exception& e ) 2063 { 2064 (void)e; 2065 DBG_ERROR( 2066 (OString("SdrOle2Obj::Unload=(), " 2067 "exception caught: ") + 2068 rtl::OUStringToOString( 2069 comphelper::anyToString( cppu::getCaughtException() ), 2070 RTL_TEXTENCODING_UTF8 )).getStr() ); 2071 } 2072 } 2073 2074 return bResult; 2075 } 2076 2077 // ----------------------------------------------------------------------------- 2078 2079 sal_Bool SdrOle2Obj::Unload() 2080 { 2081 sal_Bool bUnloaded = sal_False; 2082 2083 if( xObjRef.is() ) 2084 { 2085 //TODO/LATER: no refcounting tricks anymore! 2086 //"customers" must register as state change listeners 2087 //Nicht notwendig im Doc DTor (MM) 2088 //sal_uIntPtr nRefCount = (*ppObjRef)->GetRefCount(); 2089 // prevent Unload if there are external references 2090 //if( nRefCount > 2 ) 2091 // return sal_False; 2092 //DBG_ASSERT( nRefCount == 2, "Wrong RefCount for unload" ); 2093 } 2094 else 2095 bUnloaded = sal_True; 2096 2097 if ( pModel && xObjRef.is() ) 2098 { 2099 bUnloaded = Unload( xObjRef.GetObject(), GetAspect() ); 2100 } 2101 2102 return bUnloaded; 2103 } 2104 2105 // ----------------------------------------------------------------------------- 2106 2107 void SdrOle2Obj::GetObjRef_Impl() 2108 { 2109 if ( !xObjRef.is() && mpImpl->aPersistName.Len() && pModel && pModel->GetPersist() ) 2110 { 2111 // #107645# 2112 // Only try loading if it did not went wrong up to now 2113 if(!mpImpl->mbLoadingOLEObjectFailed) 2114 { 2115 xObjRef.Assign( pModel->GetPersist()->getEmbeddedObjectContainer().GetEmbeddedObject( mpImpl->aPersistName ), GetAspect() ); 2116 m_bTypeAsked = false; 2117 CheckFileLink_Impl(); 2118 2119 // #107645# 2120 // If loading of OLE object failed, remember that to not invoke a endless 2121 // loop trying to load it again and again. 2122 if( xObjRef.is() ) 2123 { 2124 mpImpl->mbLoadingOLEObjectFailed = sal_True; 2125 } 2126 2127 // #108759# For math objects, set closed state to transparent 2128 SetClosedObj(!ImplIsMathObj( xObjRef.GetObject() )); 2129 } 2130 2131 if ( xObjRef.is() ) 2132 { 2133 if( !IsEmptyPresObj() ) 2134 { 2135 // #75637# remember modified status of model 2136 const sal_Bool bWasChanged(pModel ? pModel->IsChanged() : sal_False); 2137 2138 // perhaps preview not valid anymore 2139 // #75637# This line changes the modified state of the model 2140 SetGraphic_Impl( NULL ); 2141 2142 // #75637# if status was not set before, force it back 2143 // to not set, so that SetGraphic(0L) above does not 2144 // set the modified state of the model. 2145 if(!bWasChanged && pModel && pModel->IsChanged()) 2146 { 2147 pModel->SetChanged( sal_False ); 2148 } 2149 } 2150 2151 sal_Int64 nMiscStatus = xObjRef->getStatus( GetAspect() ); 2152 (void)nMiscStatus; 2153 //TODO/LATER: wait until ResizeOnPrinterChange is defined 2154 //if ( nMiscStatus & SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE ) 2155 { 2156 if (pModel && pModel->GetRefDevice() && 2157 pModel->GetRefDevice()->GetOutDevType() == OUTDEV_PRINTER) 2158 { 2159 if(!bInDestruction) 2160 { 2161 //TODO/LATER: printerchange notification 2162 /* 2163 // prevent SetModified (don't want no update here) 2164 sal_Bool bWasEnabled = (*ppObjRef)->IsEnableSetModified(); 2165 if ( bWasEnabled ) 2166 (*ppObjRef)->EnableSetModified( sal_False ); 2167 2168 // Kein RefDevice oder RefDevice kein Printer 2169 Printer* pPrinter = (Printer*) pModel->GetRefDevice(); 2170 (*ppObjRef)->OnDocumentPrinterChanged( pPrinter ); 2171 2172 // reset state 2173 (*ppObjRef)->EnableSetModified( bWasEnabled );*/ 2174 } 2175 } 2176 } 2177 } 2178 2179 if ( xObjRef.is() ) 2180 Connect(); 2181 } 2182 2183 if ( mpImpl->mbConnected ) 2184 // move object to first position in cache 2185 GetSdrGlobalData().GetOLEObjCache().InsertObj(this); 2186 } 2187 2188 uno::Reference < embed::XEmbeddedObject > SdrOle2Obj::GetObjRef() const 2189 { 2190 const_cast<SdrOle2Obj*>(this)->GetObjRef_Impl(); 2191 return xObjRef.GetObject(); 2192 } 2193 2194 uno::Reference < embed::XEmbeddedObject > SdrOle2Obj::GetObjRef_NoInit() const 2195 { 2196 return xObjRef.GetObject(); 2197 } 2198 2199 // ----------------------------------------------------------------------------- 2200 2201 uno::Reference< frame::XModel > SdrOle2Obj::getXModel() const 2202 { 2203 GetObjRef(); 2204 if ( svt::EmbeddedObjectRef::TryRunningState(xObjRef.GetObject()) ) 2205 return uno::Reference< frame::XModel >( xObjRef->getComponent(), uno::UNO_QUERY ); 2206 else 2207 return uno::Reference< frame::XModel >(); 2208 } 2209 2210 // ----------------------------------------------------------------------------- 2211 2212 // #109985# 2213 sal_Bool SdrOle2Obj::IsChart() const 2214 { 2215 if ( !m_bTypeAsked ) 2216 { 2217 m_bChart = ChartHelper::IsChart(xObjRef); 2218 m_bTypeAsked = true; 2219 } 2220 return m_bChart; 2221 } 2222 2223 // ----------------------------------------------------------------------------- 2224 void SdrOle2Obj::SetGraphicToObj( const Graphic& aGraphic, const ::rtl::OUString& aMediaType ) 2225 { 2226 xObjRef.SetGraphic( aGraphic, aMediaType ); 2227 } 2228 2229 // ----------------------------------------------------------------------------- 2230 void SdrOle2Obj::SetGraphicToObj( const uno::Reference< io::XInputStream >& xGrStream, const ::rtl::OUString& aMediaType ) 2231 { 2232 xObjRef.SetGraphicStream( xGrStream, aMediaType ); 2233 } 2234 2235 // ----------------------------------------------------------------------------- 2236 sal_Bool SdrOle2Obj::IsCalc() const 2237 { 2238 if ( !xObjRef.is() ) 2239 return false; 2240 2241 SvGlobalName aObjClsId( xObjRef->getClassID() ); 2242 if( SvGlobalName(SO3_SC_CLASSID_30) == aObjClsId 2243 || SvGlobalName(SO3_SC_CLASSID_40) == aObjClsId 2244 || SvGlobalName(SO3_SC_CLASSID_50) == aObjClsId 2245 || SvGlobalName(SO3_SC_CLASSID_60) == aObjClsId 2246 || SvGlobalName(SO3_SC_OLE_EMBED_CLASSID_60) == aObjClsId 2247 || SvGlobalName(SO3_SC_OLE_EMBED_CLASSID_8) == aObjClsId 2248 || SvGlobalName(SO3_SC_CLASSID) == aObjClsId ) 2249 { 2250 return sal_True; 2251 } 2252 2253 return sal_False; 2254 } 2255 2256 // ----------------------------------------------------------------------------- 2257 uno::Reference< frame::XModel > SdrOle2Obj::GetParentXModel() const 2258 { 2259 uno::Reference< frame::XModel > xDoc; 2260 if ( pModel ) 2261 xDoc.set( pModel->getUnoModel(),uno::UNO_QUERY); 2262 return xDoc; 2263 } 2264 2265 // ----------------------------------------------------------------------------- 2266 sal_Bool SdrOle2Obj::CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHeight, Size& aObjAreaSize ) 2267 { 2268 // TODO/LEAN: to avoid rounding errors scaling always uses the VisArea. 2269 // If we don't cache it for own objects also we must load the object here 2270 if ( !xObjRef.is() || !pModel ) 2271 return sal_False; 2272 2273 MapMode aMapMode( pModel->GetScaleUnit() ); 2274 aObjAreaSize = xObjRef.GetSize( &aMapMode ); 2275 2276 Size aSize = aRect.GetSize(); 2277 aScaleWidth = Fraction(aSize.Width(), aObjAreaSize.Width() ); 2278 aScaleHeight = Fraction(aSize.Height(), aObjAreaSize.Height() ); 2279 2280 // reduce to 10 binary digits 2281 Kuerzen(aScaleHeight, 10); 2282 Kuerzen(aScaleWidth, 10); 2283 2284 return sal_True; 2285 } 2286 2287 // ----------------------------------------------------------------------------- 2288 sal_Bool SdrOle2Obj::AddOwnLightClient() 2289 { 2290 // The Own Light Client must be registered in object only using this method! 2291 if ( !SfxInPlaceClient::GetClient( dynamic_cast<SfxObjectShell*>(pModel->GetPersist()), xObjRef.GetObject() ) 2292 && !( mpImpl->pLightClient && xObjRef->getClientSite() == uno::Reference< embed::XEmbeddedClient >( mpImpl->pLightClient ) ) ) 2293 { 2294 Connect(); 2295 2296 if ( xObjRef.is() && mpImpl->pLightClient ) 2297 { 2298 Fraction aScaleWidth; 2299 Fraction aScaleHeight; 2300 Size aObjAreaSize; 2301 if ( CalculateNewScaling( aScaleWidth, aScaleHeight, aObjAreaSize ) ) 2302 { 2303 mpImpl->pLightClient->SetSizeScale( aScaleWidth, aScaleHeight ); 2304 try { 2305 xObjRef->setClientSite( mpImpl->pLightClient ); 2306 return sal_True; 2307 } catch( uno::Exception& ) 2308 {} 2309 } 2310 2311 } 2312 2313 return sal_False; 2314 } 2315 2316 return sal_True; 2317 } 2318 2319 ////////////////////////////////////////////////////////////////////////////// 2320 2321 Bitmap SdrOle2Obj::GetEmtyOLEReplacementBitmap() 2322 { 2323 return Bitmap(ResId(BMP_SVXOLEOBJ, *ImpGetResMgr())); 2324 } 2325 2326 ////////////////////////////////////////////////////////////////////////////// 2327 2328 void SdrOle2Obj::SetWindow(const com::sun::star::uno::Reference < com::sun::star::awt::XWindow >& _xWindow) 2329 { 2330 if ( xObjRef.is() && mpImpl->pLightClient ) 2331 { 2332 mpImpl->pLightClient->setWindow(_xWindow); 2333 } 2334 } 2335 2336 ////////////////////////////////////////////////////////////////////////////// 2337 // eof 2338