22#include <com/sun/star/beans/XPropertySet.hpp>
23#include <com/sun/star/util/XModifyBroadcaster.hpp>
24#include <com/sun/star/util/XModifiable.hpp>
25#include <com/sun/star/embed/EmbedStates.hpp>
26#include <com/sun/star/embed/EmbedMisc.hpp>
27#include <com/sun/star/embed/Aspects.hpp>
28#include <com/sun/star/embed/ObjectSaveVetoException.hpp>
29#include <com/sun/star/embed/XEmbeddedObject.hpp>
30#include <com/sun/star/embed/XEmbedPersist2.hpp>
31#include <com/sun/star/embed/XInplaceClient.hpp>
32#include <com/sun/star/embed/XInplaceObject.hpp>
33#include <com/sun/star/embed/XLinkageSupport.hpp>
34#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
35#include <com/sun/star/embed/XWindowSupplier.hpp>
36#include <com/sun/star/document/XEventListener.hpp>
37#include <com/sun/star/container/XChild.hpp>
38#include <com/sun/star/document/XStorageBasedDocument.hpp>
39#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
66#include <svx/strings.hrc>
83#include <rtl/ustrbuf.hxx>
85#include <bitmaps.hlst>
91 uno::Reference < beans::XPropertySet >
xFrame;
105class SdrLightEmbeddedClient_Impl :
public ::cppu::WeakImplHelper
106 < embed::XStateChangeListener
107 , document::XEventListener
108 , embed::XInplaceClient
109 , embed::XEmbeddedClient
110 , embed::XWindowSupplier
113 uno::Reference< awt::XWindow > m_xWindow;
121 explicit SdrLightEmbeddedClient_Impl(
SdrOle2Obj* pObj );
122 virtual ~SdrLightEmbeddedClient_Impl()
override;
124 void SetSizeScale(
const Fraction& aScaleWidth,
const Fraction& aScaleHeight )
126 m_aScaleWidth = aScaleWidth;
127 m_aScaleHeight = aScaleHeight;
130 const Fraction& GetScaleWidth()
const {
return m_aScaleWidth; }
131 const Fraction& GetScaleHeight()
const {
return m_aScaleHeight; }
133 void setWindow(
const uno::Reference< awt::XWindow >& _xWindow);
140 virtual void SAL_CALL changingState(
const css::lang::EventObject& aEvent, ::sal_Int32 nOldState, ::sal_Int32 nNewState )
override;
141 virtual void SAL_CALL stateChanged(
const css::lang::EventObject& aEvent, ::sal_Int32 nOldState, ::sal_Int32 nNewState )
override;
142 virtual void SAL_CALL disposing(
const css::lang::EventObject& aEvent )
override;
145 virtual void SAL_CALL notifyEvent(
const document::EventObject& aEvent )
override;
148 virtual void SAL_CALL saveObject()
override;
149 virtual void SAL_CALL visibilityChanged(
sal_Bool bVisible )
override;
152 virtual uno::Reference< util::XCloseable > SAL_CALL getComponent()
override;
155 virtual sal_Bool SAL_CALL canInplaceActivate()
override;
156 virtual void SAL_CALL activatingInplace()
override;
157 virtual void SAL_CALL activatingUI()
override;
158 virtual void SAL_CALL deactivatedInplace()
override;
159 virtual void SAL_CALL deactivatedUI()
override;
160 virtual uno::Reference< css::frame::XLayoutManager > SAL_CALL getLayoutManager()
override;
161 virtual uno::Reference< frame::XDispatchProvider > SAL_CALL getInplaceDispatchProvider()
override;
162 virtual awt::Rectangle SAL_CALL getPlacement()
override;
163 virtual awt::Rectangle SAL_CALL getClipRectangle()
override;
164 virtual void SAL_CALL translateAccelerators(
const uno::Sequence< awt::KeyEvent >& aKeys )
override;
165 virtual void SAL_CALL scrollObject(
const awt::Size& aOffset )
override;
166 virtual void SAL_CALL changedPlacement(
const awt::Rectangle& aPosRect )
override;
169 virtual uno::Reference< awt::XWindow > SAL_CALL getWindow()
override;
174SdrLightEmbeddedClient_Impl::SdrLightEmbeddedClient_Impl(
SdrOle2Obj* pObj )
178SdrLightEmbeddedClient_Impl::~SdrLightEmbeddedClient_Impl()
182tools::Rectangle SdrLightEmbeddedClient_Impl::impl_getScaledRect_nothrow()
const
186 aLogicRect.SetSize(
Size(
tools::Long( aLogicRect.GetWidth() * m_aScaleWidth),
187 tools::Long( aLogicRect.GetHeight() * m_aScaleHeight) ) );
191void SAL_CALL SdrLightEmbeddedClient_Impl::changingState(
const css::lang::EventObject& , ::sal_Int32 , ::sal_Int32 )
195void SAL_CALL SdrLightEmbeddedClient_Impl::stateChanged(
const css::lang::EventObject& , ::sal_Int32 nOldState, ::sal_Int32 nNewState )
199 if ( mpObj && nOldState == embed::EmbedStates::LOADED && nNewState == embed::EmbedStates::RUNNING )
201 mpObj->ObjectLoaded();
204 else if ( mpObj && nNewState == embed::EmbedStates::LOADED && nOldState == embed::EmbedStates::RUNNING )
210void SdrLightEmbeddedClient_Impl::disconnect()
219void SAL_CALL SdrLightEmbeddedClient_Impl::disposing(
const css::lang::EventObject& )
224void SAL_CALL SdrLightEmbeddedClient_Impl::notifyEvent(
const document::EventObject& aEvent )
231 if ( !(mpObj && mpObj->GetAspect() != embed::Aspects::MSOLE_ICON &&
aEvent.EventName ==
"OnVisAreaChanged"
232 && mpObj->GetObjRef().is() && mpObj->GetObjRef()->getClientSite() == uno::Reference< embed::XEmbeddedClient >(
this )) )
237 MapUnit aContainerMapUnit( MapUnit::Map100thMM );
238 uno::Reference< embed::XVisualObject > xParentVis( mpObj->GetParentXModel(), uno::UNO_QUERY );
239 if ( xParentVis.is() )
248 aSz = mpObj->GetObjRef()->getVisualAreaSize( mpObj->GetAspect() );
250 catch( embed::NoVisualAreaSizeException& )
256 catch( uno::Exception& )
272 Size( aLogicRect.GetWidth() - aScaledSize.Width(),
273 aLogicRect.GetHeight() - aScaledSize.Height() ),
277 mpObj->SetLogicRect(
tools::Rectangle( aLogicRect.TopLeft(), aScaledSize ) );
278 mpObj->BroadcastObjectChange();
281 mpObj->ActionChanged();
283 catch( uno::Exception& )
289void SAL_CALL SdrLightEmbeddedClient_Impl::saveObject()
292 uno::Reference< embed::XCommonEmbedPersist > xPersist;
293 uno::Reference< util::XModifiable > xModifiable;
299 throw embed::ObjectSaveVetoException();
302 xPersist.set( mpObj->GetObjRef(), uno::UNO_QUERY_THROW );
303 xModifiable.set( mpObj->GetParentXModel(), uno::UNO_QUERY );
306 xPersist->storeOwn();
308 if ( xModifiable.is() )
309 xModifiable->setModified(
true );
312void SAL_CALL SdrLightEmbeddedClient_Impl::visibilityChanged(
sal_Bool )
319 Size aLogicSize( aLogicRect.GetWidth(), aLogicRect.GetHeight() );
321 if( mpObj->IsChart() )
324 mpObj->SetLogicRect(
tools::Rectangle( aLogicRect.TopLeft(), aLogicSize ) );
325 mpObj->BroadcastObjectChange();
330uno::Reference< util::XCloseable > SAL_CALL SdrLightEmbeddedClient_Impl::getComponent()
332 uno::Reference< util::XCloseable > xResult;
336 xResult.set( mpObj->GetParentXModel(), uno::UNO_QUERY );
342sal_Bool SAL_CALL SdrLightEmbeddedClient_Impl::canInplaceActivate()
348 uno::Reference< embed::XEmbeddedObject > xObject = mpObj->GetObjRef();
350 throw uno::RuntimeException();
352 bRet = ( xObject->getCurrentState() != embed::EmbedStates::ACTIVE && mpObj->GetAspect() != embed::Aspects::MSOLE_ICON );
357void SAL_CALL SdrLightEmbeddedClient_Impl::activatingInplace()
361void SAL_CALL SdrLightEmbeddedClient_Impl::activatingUI()
366 uno::Reference < frame::XFrame > xOwnFrame( xFrame,uno::UNO_QUERY);
367 uno::Reference < frame::XFramesSupplier > xParentFrame = xOwnFrame->getCreator();
368 if ( xParentFrame.is() )
369 xParentFrame->setActiveFrame( xOwnFrame );
373 for(sal_Int32 i = nCount-1 ;
i >= 0;--
i)
381 const uno::Reference< embed::XEmbeddedObject >& xObject = pObj->
GetObjRef();
384 if ( xObject->getStatus( pObj->
GetAspect() ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
385 xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE );
389 uno::Reference< embed::XLinkageSupport > xLink( xObject, uno::UNO_QUERY );
390 if ( xLink.is() && xLink->isLink() )
391 xObject->changeState( embed::EmbedStates::LOADED );
393 xObject->changeState( embed::EmbedStates::RUNNING );
396 catch (css::uno::Exception& )
403void SAL_CALL SdrLightEmbeddedClient_Impl::deactivatedInplace()
407void SAL_CALL SdrLightEmbeddedClient_Impl::deactivatedUI()
410 css::uno::Reference< css::frame::XLayoutManager > xLayoutManager(getLayoutManager());
411 if ( xLayoutManager.is() )
413 static constexpr OUStringLiteral aMenuBarURL =
u"private:resource/menubar/menubar";
414 if ( !xLayoutManager->isElementVisible( aMenuBarURL ) )
415 xLayoutManager->createElement( aMenuBarURL );
419uno::Reference< css::frame::XLayoutManager > SAL_CALL SdrLightEmbeddedClient_Impl::getLayoutManager()
421 uno::Reference< css::frame::XLayoutManager > xMan;
426 xMan.set(
xFrame->getPropertyValue(
"LayoutManager"),uno::UNO_QUERY);
428 catch ( uno::Exception& ex )
431 throw css::lang::WrappedTargetRuntimeException(
ex.Message,
438uno::Reference< frame::XDispatchProvider > SAL_CALL SdrLightEmbeddedClient_Impl::getInplaceDispatchProvider()
441 return uno::Reference < frame::XDispatchProvider >(
lcl_getFrame_throw(mpObj), uno::UNO_QUERY_THROW );
444awt::Rectangle SAL_CALL SdrLightEmbeddedClient_Impl::getPlacement()
448 throw uno::RuntimeException();
451 MapUnit aContainerMapUnit( MapUnit::Map100thMM );
452 uno::Reference< embed::XVisualObject > xParentVis( mpObj->GetParentXModel(), uno::UNO_QUERY );
453 if ( xParentVis.is() )
460awt::Rectangle SAL_CALL SdrLightEmbeddedClient_Impl::getClipRectangle()
462 return getPlacement();
465void SAL_CALL SdrLightEmbeddedClient_Impl::translateAccelerators(
const uno::Sequence< awt::KeyEvent >& )
469void SAL_CALL SdrLightEmbeddedClient_Impl::scrollObject(
const awt::Size& )
473void SAL_CALL SdrLightEmbeddedClient_Impl::changedPlacement(
const awt::Rectangle& aPosRect )
477 throw uno::RuntimeException();
479 uno::Reference< embed::XInplaceObject > xInplace( mpObj->GetObjRef(), uno::UNO_QUERY_THROW );
482 awt::Rectangle aOldRect = getPlacement();
485 if ( aOldPixelRect == aNewPixelRect )
490 MapUnit aContainerMapUnit( MapUnit::Map100thMM );
491 uno::Reference< embed::XVisualObject > xParentVis( mpObj->GetParentXModel(), uno::UNO_QUERY );
492 if ( xParentVis.is() )
498 if ( aNewLogicRect == aLogicRect )
510 aNewLogicRect.
SetSize( aNewObjSize );
515 aLogicRect.
GetHeight() - aNewObjSize.Height() ),
520 mpObj->BroadcastObjectChange();
523 mpObj->ActionChanged();
527uno::Reference< awt::XWindow > SAL_CALL SdrLightEmbeddedClient_Impl::getWindow()
530 uno::Reference< awt::XWindow > xCurrent = m_xWindow;
531 if ( !xCurrent.is() )
534 throw uno::RuntimeException();
536 xCurrent =
xFrame->getComponentWindow();
540void SdrLightEmbeddedClient_Impl::setWindow(
const uno::Reference< awt::XWindow >& _xWindow)
542 m_xWindow = _xWindow;
557 const OUString& ,
const css::uno::Any & )
562 uno::Reference< embed::XEmbeddedObject > xObject =
pObj->
GetObjRef();
563 OSL_ENSURE( xObject.is(),
"The object must exist always!" );
571 sal_Int32
nState = xObject->getCurrentState();
572 if (
nState != embed::EmbedStates::LOADED )
575 xObject->changeState( embed::EmbedStates::LOADED );
576 xObject->changeState(
nState );
579 catch ( uno::Exception& )
594 SvBaseLink::Closed();
608 uno::Reference<embed::XCommonEmbedPersist> xPersObj(xObject, uno::UNO_QUERY);
614 xPersObj->reload(uno::Sequence<beans::PropertyValue>(), uno::Sequence<beans::PropertyValue>());
616 catch (
const uno::Exception&)
686static bool ImplIsMathObj(
const uno::Reference < embed::XEmbeddedObject >& rObjRef )
703 return std::make_unique<sdr::properties::OleProperties>(*
this);
710 return std::make_unique<sdr::contact::ViewContactOfSdrOle2Obj>(*
this);
756 if (rSource.
mpImpl->moGraphic)
766 if( !(pDestPers && pSrcPers) )
777 mpImpl->mbTypeAsked =
false;
778 mpImpl->aPersistName = aTmp;
788 const OUString& rNewObjName,
795 mpImpl->aPersistName = rNewObjName;
797 if (
mpImpl->mxObjRef.is() && (
mpImpl->mxObjRef->getStatus(
GetAspect() ) & embed::EmbedMisc::EMBED_NEVERRESIZE ) )
811 if (
mpImpl->mxObjRef.is() &&
mpImpl->mxObjRef.IsChart())
813 strStyle =
mpImpl->mxObjRef.GetChartType();
820 if (
mpImpl->mbConnected )
825 if (
mpImpl->mxLightClient)
827 mpImpl->mxLightClient->disconnect();
828 mpImpl->mxLightClient.clear();
834 mpImpl->mxObjRef.SetViewAspect( nAspect );
844 return mpImpl->mxObjRef.GetViewAspect();
849 return mpImpl->mxObjRef.is() && embed::EmbedStates::INPLACE_ACTIVE ==
mpImpl->mxObjRef->getCurrentState();
854 return mpImpl->mxObjRef.is() && embed::EmbedStates::UI_ACTIVE ==
mpImpl->mxObjRef->getCurrentState();
860 mpImpl->moGraphic.emplace(rGrf);
868 mpImpl->moGraphic.reset();
876 mpImpl->maProgName = rName;
881 return mpImpl->maProgName;
886 return !
mpImpl->mxObjRef.is();
908 bool bResult =
false;
910 if (
mpImpl->mpObjectLink )
916 OUString aNewLinkURL;
918 if ( !aNewLinkURL.equalsIgnoreAsciiCase(
mpImpl->maLinkURL ) )
921 uno::Reference<embed::XCommonEmbedPersist> xPersObj(
mpImpl->mxObjRef.GetObject(), uno::UNO_QUERY );
922 OSL_ENSURE( xPersObj.is(),
"The object must exist!" );
927 sal_Int32 nCurState =
mpImpl->mxObjRef->getCurrentState();
928 if ( nCurState != embed::EmbedStates::LOADED )
929 mpImpl->mxObjRef->changeState(embed::EmbedStates::LOADED);
933 "URL", aNewLinkURL) };
934 xPersObj->reload( aArgs, uno::Sequence< beans::PropertyValue >() );
936 mpImpl->maLinkURL = aNewLinkURL;
939 if ( nCurState != embed::EmbedStates::LOADED )
940 mpImpl->mxObjRef->changeState(nCurState);
942 catch( css::uno::Exception
const & )
966 uno::Reference< embed::XStorage > xStorage = xDoc->getDocumentStorage();
967 if ( !xStorage.is() )
972 uno::Reference< embed::XLinkageSupport > xLinkSupport(
mpImpl->mxObjRef.GetObject(), uno::UNO_QUERY_THROW );
973 xLinkSupport->breakLink( xStorage,
mpImpl->aPersistName );
975 mpImpl->maLinkURL.clear();
977 catch( css::uno::Exception& )
987 if ( pLinkManager &&
mpImpl->mpObjectLink )
990 mpImpl->mpObjectLink =
nullptr;
996 if (!
mpImpl->mxObjRef.GetObject().is() ||
mpImpl->mpObjectLink)
1001 uno::Reference<embed::XEmbeddedObject> xObject =
mpImpl->mxObjRef.GetObject();
1005 bool bIFrame =
false;
1008 uno::Reference<embed::XLinkageSupport> xLinkSupport(xObject, uno::UNO_QUERY);
1011 if (xLinkSupport->isLink())
1012 aLinkURL = xLinkSupport->getLinkURL();
1021 uno::Reference<beans::XPropertySet> xSet(xObject->getComponent(), uno::UNO_QUERY);
1023 xSet->getPropertyValue(
"FrameURL") >>= aLinkURL;
1028 if (!aLinkURL.isEmpty())
1038 mpImpl->mpObjectLink = pEmbedObjectLink;
1042 mpImpl->maLinkURL = aLinkURL;
1044 if (pEmbedObjectLink)
1049 catch (
const css::uno::Exception&)
1057 if(
mpImpl->aPersistName.isEmpty() )
1074 if (
mpImpl->mxObjRef.is() )
1079 mpImpl->aPersistName = aTmp;
1082 else if ( !
mpImpl->mxObjRef.is() )
1085 mpImpl->mbTypeAsked =
false;
1088 if (
mpImpl->mxObjRef.GetObject().is() )
1090 mpImpl->mxObjRef.AssignToContainer( &rContainer,
mpImpl->aPersistName );
1091 mpImpl->mbConnected =
true;
1101 uno::Reference<beans::XPropertySet> xSet(
mpImpl->mxObjRef->getComponent(), uno::UNO_QUERY);
1103 xSet->setPropertyValue(
"FrameURL",
uno::Any(sFrameURL));
1107 if (
mpImpl->mxObjRef.is() )
1109 if ( !
mpImpl->mxLightClient.is() )
1110 mpImpl->mxLightClient =
new SdrLightEmbeddedClient_Impl(
this );
1112 mpImpl->mxObjRef->addStateChangeListener(
mpImpl->mxLightClient );
1113 mpImpl->mxObjRef->addEventListener(
mpImpl->mxLightClient );
1115 if (
mpImpl->mxObjRef->getCurrentState() != embed::EmbedStates::LOADED )
1120 uno::Reference< container::XChild > xChild(
mpImpl->mxObjRef.GetObject(), uno::UNO_QUERY );
1130 catch( css::uno::Exception& )
1143 if( !(
mpImpl->mxObjRef.is() &&
mpImpl->mxObjRef->getCurrentState() != embed::EmbedStates::LOADED) )
1147 if (!
mpImpl->mxModifyListener.is())
1152 uno::Reference< util::XModifyBroadcaster > xBC(
getXModel(), uno::UNO_QUERY );
1155 xBC->addModifyListener(
mpImpl->mxModifyListener );
1164 if( !
mpImpl->mbConnected )
1166 OSL_FAIL(
"Disconnect() called on disconnected object!");
1176 if ( !
mpImpl->mxObjRef.is() ||
mpImpl->aPersistName.isEmpty() )
1181 sal_Int32
nState =
mpImpl->mxObjRef->getCurrentState();
1182 if (
nState != embed::EmbedStates::LOADED )
1184 uno::Reference< util::XModifyBroadcaster > xBC(
getXModel(), uno::UNO_QUERY );
1185 if (xBC.is() &&
mpImpl->mxModifyListener.is())
1187 xBC->removeModifyListener(
mpImpl->mxModifyListener );
1191 catch( css::uno::Exception& )
1201 if ( !
mpImpl->aPersistName.isEmpty() )
1215 mpImpl->mxObjRef.AssignToContainer(
nullptr,
mpImpl->aPersistName );
1237 else if (
mpImpl->mxObjRef.is() )
1250 mpImpl->mxObjRef.AssignToContainer(
nullptr,
mpImpl->aPersistName );
1258 if (
mpImpl->mxObjRef.is() &&
mpImpl->mxLightClient.is() )
1260 mpImpl->mxObjRef->removeStateChangeListener (
mpImpl->mxLightClient );
1261 mpImpl->mxObjRef->removeEventListener(
mpImpl->mxLightClient );
1262 mpImpl->mxObjRef->setClientSite(
nullptr );
1267 catch( css::uno::Exception& )
1272 mpImpl->mbConnected =
false;
1291 pClone->TRSetBaseGeometry(aMatrix, aPolyPolygon);
1304 pClone->NbcSetOutlinerParaObject(*pOPO);
1319 pClone->SetMergedItem(
XLineStyleItem(css::drawing::LineStyle_SOLID));
1325 pClone->SetMergedItem(
XFillStyleItem(drawing::FillStyle_BITMAP));
1341 return pRetval->DoConvertToPolyObj(bBezier, bAddText);
1349 const bool bRemove(pNewPage ==
nullptr && pOldPage !=
nullptr);
1350 const bool bInsert(pNewPage !=
nullptr && pOldPage ==
nullptr);
1352 if (bRemove &&
mpImpl->mbConnected )
1360 if (bInsert && !
mpImpl->mbConnected )
1368 DBG_ASSERT( !rNewObjRef.is() || !
mpImpl->mxObjRef.GetObject().is(),
"SetObjRef called on already initialized object!");
1369 if( rNewObjRef ==
mpImpl->mxObjRef.GetObject() )
1374 if (
mpImpl->mxObjRef.GetObject().is() )
1375 mpImpl->mxObjRef.Lock(
false );
1379 mpImpl->mxObjRef.Clear();
1381 if (
mpImpl->mbConnected )
1385 mpImpl->mbTypeAsked =
false;
1387 if (
mpImpl->mxObjRef.is() )
1389 mpImpl->moGraphic.reset();
1391 if (
mpImpl->mxObjRef->getStatus(
GetAspect() ) & embed::EmbedMisc::EMBED_NEVERRESIZE )
1421 mpImpl->aPersistName = rPersistName;
1422 mpImpl->mbLoadingOLEObjectFailed =
false;
1430 mpImpl->aPersistName.clear();
1431 mpImpl->mbLoadingOLEObjectFailed =
false;
1437 return mpImpl->aPersistName;
1466 OUStringBuffer
sName(
SvxResId(
mpImpl->mbFrame ? STR_ObjNameSingulFrame : STR_ObjNameSingulOLE2));
1470 if (!
aName.isEmpty())
1475 return sName.makeStringAndClear();
1480 return SvxResId(
mpImpl->mbFrame ? STR_ObjNamePluralFrame : STR_ObjNamePluralOLE2);
1491 if (
mpImpl->mbSuppressSetVisAreaSize)
1496 if (
GetAspect() == embed::Aspects::MSOLE_ICON )
1501 if (!
mpImpl->mxObjRef.is())
1511 mpImpl->mxObjRef.GetObject()));
1512 const bool bHasOwnClient(
1513 mpImpl->mxLightClient.is() &&
1514 mpImpl->mxObjRef->getClientSite() == uno::Reference< embed::XEmbeddedClient >(
mpImpl->mxLightClient ) );
1516 if ( pClient || bHasOwnClient )
1519 if ( ((nMiscStatus & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) &&
1521 ||
mpImpl->mxObjRef->getCurrentState() == embed::EmbedStates::INPLACE_ACTIVE
1533 aScaleWidth =
mpImpl->mxLightClient->GetScaleWidth();
1534 aScaleHeight =
mpImpl->mxLightClient->GetScaleHeight();
1544 if (sal_Int32(aScaleWidth) != 0 && sal_Int32(aScaleHeight) != 0)
1553 aSz.Width = aVisSize.
Width();
1554 aSz.Height = aVisSize.
Height();
1561 catch( embed::NoVisualAreaSizeException& )
1567 if (aVisSize != aAcceptedVisArea.
GetSize())
1588 mpImpl->mxObjRef.UpdateReplacement();
1606 mpImpl->mxLightClient->SetSizeScale( aScaleWidth, aScaleHeight );
1611 else if( (nMiscStatus & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) &&
1616 uno::Reference< embed::XVisualObject > xVisualObject(
getXModel(), uno::UNO_QUERY );
1617 if( xVisualObject.is() )
1638 xVisualObject->setVisualAreaSize(
1653 if (
mpImpl->mxObjRef.is() && (
mpImpl->mxObjRef->getStatus(
GetAspect() ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE ) )
1702 if (
mpImpl->mxObjRef.is() )
1703 return mpImpl->mxObjRef.GetGraphic();
1704 return mpImpl->moGraphic ? &*
mpImpl->moGraphic :
nullptr;
1709 if (
mpImpl->mxObjRef.is() )
1710 mpImpl->mxObjRef.UpdateReplacement();
1715 return mpImpl->mxObjRef.GetSize( pTargetMapMode );
1720 mpImpl->mbSuppressSetVisAreaSize = bNew;
1733 uno::Reference<embed::XEmbedPersist2> xPersist(xObj, uno::UNO_QUERY);
1736 if (!xPersist->isStored())
1741 bool bResult =
false;
1743 sal_Int32
nState = xObj->getCurrentState();
1744 if (
nState == embed::EmbedStates::LOADED )
1751 uno::Reference < util::XModifiable > xModifiable( xObj->getComponent(), uno::UNO_QUERY );
1752 if ( !xModifiable.is() )
1756 sal_Int64 nMiscStatus = xObj->getStatus( nAspect );
1758 if ( embed::EmbedMisc::MS_EMBED_ALWAYSRUN != ( nMiscStatus & embed::EmbedMisc::MS_EMBED_ALWAYSRUN ) &&
1759 embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY != ( nMiscStatus & embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY ) &&
1760 !( xModifiable.is() && xModifiable->isModified() ) &&
1761 !(
nState == embed::EmbedStates::INPLACE_ACTIVE ||
nState == embed::EmbedStates::UI_ACTIVE ||
nState == embed::EmbedStates::ACTIVE ) )
1771bool SdrOle2Obj::Unload(
const uno::Reference< embed::XEmbeddedObject >& xObj, sal_Int64 nAspect )
1773 bool bResult =
false;
1779 xObj->changeState( embed::EmbedStates::LOADED );
1782 catch( css::uno::Exception& )
1793 if (!
mpImpl->mxObjRef.is())
1805 if(!
mpImpl->mbLoadingOLEObjectFailed)
1810 mpImpl->mbTypeAsked =
false;
1815 if(
mpImpl->mxObjRef.is() )
1817 mpImpl->mbLoadingOLEObjectFailed =
true;
1824 if (
mpImpl->mxObjRef.is() )
1845 if (
mpImpl->mxObjRef.is() )
1849 if (
mpImpl->mbConnected )
1859 return mpImpl->mxObjRef.GetObject();
1864 return mpImpl->mxObjRef.GetObject();
1870 return uno::Reference< frame::XModel >(
mpImpl->mxObjRef->getComponent(), uno::UNO_QUERY );
1872 return uno::Reference< frame::XModel >();
1877 if (!
mpImpl->mbTypeAsked)
1880 mpImpl->mbTypeAsked =
true;
1882 return mpImpl->mbIsChart;
1887 mpImpl->mxObjRef.SetGraphic( aGraphic, OUString() );
1890 if (
const Graphic* pObjGraphic =
mpImpl->mxObjRef.is() ?
nullptr :
mpImpl->mxObjRef.GetGraphic())
1891 mpImpl->moGraphic.emplace(*pObjGraphic);
1896 mpImpl->mxObjRef.SetGraphicStream( xGrStream, aMediaType );
1899 if (
const Graphic* pObjGraphic =
mpImpl->mxObjRef.is() ?
nullptr :
mpImpl->mxObjRef.GetGraphic())
1900 mpImpl->moGraphic.emplace(*pObjGraphic);
1905 if ( !
mpImpl->mxObjRef.is() )
1928 if (!
mpImpl->mxObjRef.is())
1932 aObjAreaSize =
mpImpl->mxObjRef.GetSize( &aMapMode );
1935 if (!aObjAreaSize.
Width() || !aObjAreaSize.
Height())
1957 && !(
mpImpl->mxLightClient.is() &&
mpImpl->mxObjRef->getClientSite() == uno::Reference< embed::XEmbeddedClient >(
mpImpl->mxLightClient ) ) )
1961 if (
mpImpl->mxObjRef.is() &&
mpImpl->mxLightClient.is() )
1968 mpImpl->mxLightClient->SetSizeScale( aScaleWidth, aScaleHeight );
1970 mpImpl->mxObjRef->setClientSite(
mpImpl->mxLightClient );
1972 }
catch( uno::Exception& )
1991 if (
mpImpl->mxObjRef.is() &&
mpImpl->mxLightClient.is() )
1993 mpImpl->mxLightClient->setWindow(_xWindow);
static OutputDevice * GetDefaultDevice()
void ReduceInaccurate(unsigned nSignificantBits)
void InsertObj(SdrOle2Obj *pObj)
SVXCORE_DLLPUBLIC size_t size() const
void RemoveObj(SdrOle2Obj *pObj)
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
virtual const tools::Rectangle & GetSnapRect() const override
virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(const OUString &rMimeType, const css::uno::Any &rValue) override
SdrEmbedObjectLink(SdrOle2Obj *pObj)
virtual void Closed() override
virtual ~SdrEmbedObjectLink() override
OLEObjCache & GetOLEObjCache()
This class represents an embedded or linked bitmap graphic object.
virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(const OUString &rMimeType, const css::uno::Any &rValue) override
SdrIFrameLink(SdrOle2Obj *pObject)
::comphelper::IEmbeddedHelper * GetPersist() const
virtual void SetChanged(bool bFlg=true)
All geometrical data of an arbitrary object for use in undo/redo.
void BroadcastObjectChange() const
bool IsEmptyPresObj() const
void SetResizeProtect(bool bProt)
SdrModel & getSdrModelFromSdrObject() const
virtual void SetGeoData(const SdrObjGeoData &rGeo)
SfxStyleSheet * GetStyleSheet() const
virtual const OUString & GetName() const
virtual void SetChanged()
const SfxItemSet & GetMergedItemSet() const
bool IsInDestruction() const
sfx2::SvBaseLink * mpObjectLink
SdrOle2ObjImpl(bool bFrame, const svt::EmbeddedObjectRef &rObjRef)
svt::EmbeddedObjectRef mxObjRef
std::optional< Graphic > moGraphic
rtl::Reference< SdrLightEmbeddedClient_Impl > mxLightClient
SdrOle2ObjImpl(bool bFrame)
bool mbLoadingOLEObjectFailed
rtl::Reference< SvxUnoShapeModifyListener > mxModifyListener
bool mbSuppressSetVisAreaSize
void SetWindow(const css::uno::Reference< css::awt::XWindow > &_xWindow)
SVX_DLLPRIVATE void Init()
static Graphic GetEmptyOLEReplacementGraphic()
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
virtual ~SdrOle2Obj() override
virtual SdrObjKind GetObjIdentifier() const override
void Connect(SvxOle2Shape *pCreator=nullptr)
sal_Int64 GetAspect() const
std::unique_ptr< SdrOle2ObjImpl > mpImpl
static bool CanUnloadRunningObj(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, sal_Int64 nAspect)
SVX_DLLPRIVATE void Disconnect_Impl()
css::uno::Reference< css::embed::XEmbeddedObject > const & GetObjRef() const
const svt::EmbeddedObjectRef & getEmbeddedObjectRef() const
const Graphic * GetGraphic() const
void SetProgName(const OUString &rName)
void BreakFileLink_Impl()
const OUString & GetProgName() const
virtual rtl::Reference< SdrObject > CloneSdrObject(SdrModel &rTargetModel) const override
void setSuppressSetVisAreaSize(bool bNew)
virtual rtl::Reference< SdrObject > DoConvertToPolyObj(bool bBezier, bool bAddText) const override
SVX_DLLPRIVATE css::uno::Reference< css::embed::XEmbeddedObject > const & GetObjRef_NoInit() const
bool UpdateLinkURL_Impl()
const OUString & GetPersistName() const
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
void CheckFileLink_Impl()
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
SVX_DLLPRIVATE void RemoveListeners_Impl()
bool isInplaceActive() const
SVX_DLLPRIVATE void Connect_Impl(SvxOle2Shape *pCreator=nullptr)
SVX_DLLPRIVATE void AddListeners_Impl()
void SetObjRef(const css::uno::Reference< css::embed::XEmbeddedObject > &rNewObjRef)
void SetClosedObj(bool bIsClosed)
Change the IsClosedObj attribute.
bool CalculateNewScaling(Fraction &aScaleWidth, Fraction &aScaleHeight, Size &aObjAreaSize)
void SetGraphicToObj(const Graphic &aGraphic)
void SetGraphic(const Graphic &rGrf)
virtual void SetGeoData(const SdrObjGeoData &rGeo) override
virtual OUString TakeObjNameSingul() const override
Size GetOrigObjSize(MapMode const *pTargetMapMode=nullptr) const
virtual void NbcMove(const Size &rSize) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
SVX_DLLPRIVATE rtl::Reference< SdrObject > createSdrGrafObjReplacement(bool bAddText) const
SVX_DLLPRIVATE void ImpSetVisAreaSize()
virtual rtl::Reference< SdrObject > getFullDragClone() const override
void SetPersistName(const OUString &rPersistName, SvxOle2Shape *pCreator=nullptr)
OUString GetStyleString()
virtual OUString TakeObjNamePlural() const override
css::uno::Reference< css::frame::XModel > GetParentXModel() const
SVX_DLLPRIVATE void GetObjRef_Impl()
css::uno::Reference< css::frame::XModel > getXModel() const
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
void SetAspect(sal_Int64 nAspect)
virtual void handlePageChange(SdrPage *pOldPage, SdrPage *pNewPage) override
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
SdrOle2Obj(SdrModel &rSdrModel, bool bFrame_=false)
void DisconnectFileLink_Impl()
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Rectangle objects (rectangle, circle, ...)
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
virtual void NbcMove(const Size &rSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
tools::Rectangle const & getRectangle() const
virtual OutlinerParaObject * GetOutlinerParaObject() const override
virtual void handlePageChange(SdrPage *pOldPage, SdrPage *pNewPage) override
void setRectangleSize(sal_Int32 nWidth, sal_Int32 nHeight)
virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix &rMatrix, basegfx::B2DPolyPolygon &rPolyPolygon) const override
bool SetObjArea(const tools::Rectangle &)
void SetObjAreaAndScale(const tools::Rectangle &, const Fraction &, const Fraction &)
const Fraction & GetScaleHeight() const
const Fraction & GetScaleWidth() const
static SfxInPlaceClient * GetClient(SfxObjectShell const *pDoc, const css::uno::Reference< css::embed::XEmbeddedObject > &xObject)
constexpr tools::Long Height() const
constexpr tools::Long Width() const
virtual OUString GetAndClearInitialFrameURL()
static MapUnit UnoEmbed2VCLMapUnit(sal_Int32 nUnoEmbedMapUnit)
bool HasEmbeddedObject(const OUString &)
void CloseEmbeddedObject(const css::uno::Reference< css::embed::XEmbeddedObject > &)
css::uno::Reference< css::embed::XEmbeddedObject > CopyAndGetEmbeddedObject(EmbeddedObjectContainer &rSrc, const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, OUString &rName, const OUString &rSrcShellID, const OUString &rDestShellID)
void RemoveEmbeddedObject(const OUString &rName, bool bKeepToTempStorage=true)
css::uno::Reference< css::embed::XEmbeddedObject > GetEmbeddedObject(const OUString &, OUString const *pBaseURL=nullptr)
bool InsertEmbeddedObject(const css::uno::Reference< css::embed::XEmbeddedObject > &, OUString &)
virtual EmbeddedObjectContainer & getEmbeddedObjectContainer() const=0
virtual OUString getDocumentBaseURL() const=0
oslInterlockedCount m_refCount
#define SO3_SC_CLASSID_30
#define SO3_IFRAME_CLASSID
#define SO3_SM_CLASSID_50
#define SO3_SC_CLASSID_60
#define SO3_SM_CLASSID_60
#define SO3_SC_CLASSID_40
#define SO3_SM_CLASSID_30
#define SO3_SM_CLASSID_40
#define SO3_SC_OLE_EMBED_CLASSID_60
#define SO3_SC_CLASSID_50
#define SO3_SC_OLE_EMBED_CLASSID_8
void InsertFileLink(sfx2::SvBaseLink &, SvBaseLinkObjectType nFileType, std::u16string_view rFileNm, const OUString *pFilterNm=nullptr, const OUString *pRange=nullptr)
static bool GetDisplayNames(const SvBaseLink *, OUString *pType, OUString *pFile=nullptr, OUString *pLink=nullptr, OUString *pFilter=nullptr)
void Remove(SvBaseLink const *pLink)
void SetSynchron(bool bFlag)
static bool TryRunningState(const css::uno::Reference< css::embed::XEmbeddedObject > &)
void Lock(bool bLock=true)
css::awt::Rectangle AWTRectangle(const ::tools::Rectangle &rVCLRect)
inline ::tools::Rectangle VCLRectangle(const css::awt::Rectangle &rAWTRect)
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
OUString SvxResId(TranslateId aId)
EmbeddedObjectRef * pObject
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
Any SAL_CALL getCaughtException()
Reference< XController > xController
Reference< XFrame > xFrame
SdrGlobalData & GetSdrGlobalData()
@ OLE2
foreign graphic (StarView Graphic)
@ OLEPluginFrame
measurement object
static bool ImplIsMathObj(const uno::Reference< embed::XEmbeddedObject > &rObjRef)
static uno::Reference< beans::XPropertySet > lcl_getFrame_throw(const SdrOle2Obj *_pObject)