summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embeddedobj/source/commonembedding/embedobj.cxx7
-rw-r--r--embeddedobj/source/commonembedding/visobj.cxx47
-rw-r--r--sfx2/source/view/ipclient.cxx19
-rw-r--r--svx/source/svdraw/svdoole2.cxx13
4 files changed, 75 insertions, 11 deletions
diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx
index cb76f5ff3c..868f77836f 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -37,7 +37,7 @@
#include <com/sun/star/embed/XInplaceClient.hpp>
#include <com/sun/star/embed/XWindowSupplier.hpp>
#include <com/sun/star/embed/StateChangeInProgressException.hpp>
-
+#include <com/sun/star/embed/Aspects.hpp>
#include <com/sun/star/awt/XWindowPeer.hpp>
#include <com/sun/star/util/XCloseBroadcaster.hpp>
@@ -225,6 +225,9 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
{
if ( nNextState == embed::EmbedStates::LOADED )
{
+ m_nClonedMapUnit = m_pDocHolder->GetMapUnit( embed::Aspects::MSOLE_CONTENT );
+ m_bHasClonedSize = m_pDocHolder->GetExtent( embed::Aspects::MSOLE_CONTENT, &m_aClonedSize );
+
// actually frame should not exist at this point
m_pDocHolder->CloseDocument( sal_False, sal_False );
@@ -447,7 +450,7 @@ void SAL_CALL OCommonEmbeddedObject::changeState( sal_Int32 nNewState )
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
sal_Int32 nOldState = m_nObjectState;
-
+
if ( m_nTargetState != -1 )
{
// means that the object is currently trying to reach the target state
diff --git a/embeddedobj/source/commonembedding/visobj.cxx b/embeddedobj/source/commonembedding/visobj.cxx
index 122599ceec..ff85611330 100644
--- a/embeddedobj/source/commonembedding/visobj.cxx
+++ b/embeddedobj/source/commonembedding/visobj.cxx
@@ -68,10 +68,21 @@ void SAL_CALL OCommonEmbeddedObject::setVisualAreaSize( sal_Int64 nAspect, const
m_bHasClonedSize = sal_False;
+ sal_Bool bBackToLoaded = sal_False;
if ( m_nObjectState == embed::EmbedStates::LOADED )
+ {
changeState( embed::EmbedStates::RUNNING );
- if ( !m_pDocHolder->SetExtent( nAspect, aSize ) )
+ // the links should be switched back to loaded state for now to avoid locking problems
+ bBackToLoaded = m_bIsLink;
+ }
+
+ sal_Bool bSuccess = m_pDocHolder->SetExtent( nAspect, aSize );
+
+ if ( bBackToLoaded )
+ changeState( embed::EmbedStates::LOADED );
+
+ if ( !bSuccess )
throw uno::Exception(); // TODO:
}
@@ -96,12 +107,24 @@ awt::Size SAL_CALL OCommonEmbeddedObject::getVisualAreaSize( sal_Int64 nAspect )
if ( m_bHasClonedSize )
return m_aClonedSize;
+ sal_Bool bBackToLoaded = sal_False;
if ( m_nObjectState == embed::EmbedStates::LOADED )
+ {
changeState( embed::EmbedStates::RUNNING );
+ // the links should be switched back to loaded state for now to avoid locking problems
+ bBackToLoaded = m_bIsLink;
+ }
+
awt::Size aResult;
- if ( !m_pDocHolder->GetExtent( nAspect, &aResult ) )
+ sal_Bool bSuccess = m_pDocHolder->GetExtent( nAspect, &aResult );
+
+ if ( bBackToLoaded )
+ changeState( embed::EmbedStates::LOADED );
+
+ if ( !bSuccess )
throw uno::Exception(); // TODO:
+
return aResult;
}
@@ -126,15 +149,24 @@ sal_Int32 SAL_CALL OCommonEmbeddedObject::getMapUnit( sal_Int64 nAspect )
if ( m_bHasClonedSize )
return m_nClonedMapUnit;
+ sal_Bool bBackToLoaded = sal_False;
if ( m_nObjectState == embed::EmbedStates::LOADED )
+ {
changeState( embed::EmbedStates::RUNNING );
+ // the links should be switched back to loaded state for now to avoid locking problems
+ bBackToLoaded = m_bIsLink;
+ }
+
sal_Int32 nResult = m_pDocHolder->GetMapUnit( nAspect );
+
+ if ( bBackToLoaded )
+ changeState( embed::EmbedStates::LOADED );
+
if ( nResult < 0 )
throw uno::Exception(); // TODO:
return nResult;
-
}
embed::VisualRepresentation SAL_CALL OCommonEmbeddedObject::getPreferredVisualRepresentation( sal_Int64 nAspect )
@@ -160,9 +192,15 @@ embed::VisualRepresentation SAL_CALL OCommonEmbeddedObject::getPreferredVisualRe
throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "Illegal call!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
+ sal_Bool bBackToLoaded = sal_False;
if ( m_nObjectState == embed::EmbedStates::LOADED )
+ {
changeState( embed::EmbedStates::RUNNING );
+ // the links should be switched back to loaded state for now to avoid locking problems
+ bBackToLoaded = m_bIsLink;
+ }
+
OSL_ENSURE( m_pDocHolder->GetComponent().is(), "Running or Active object has no component!\n" );
// TODO: return for the aspect of the document
@@ -193,6 +231,9 @@ embed::VisualRepresentation SAL_CALL OCommonEmbeddedObject::getPreferredVisualRe
throw uno::RuntimeException();
}
+ if ( bBackToLoaded )
+ changeState( embed::EmbedStates::LOADED );
+
return aVisualRepresentation;
}
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index b6e34f22ac..18fe96ebb0 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -44,6 +44,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/embed/XStateChangeListener.hpp>
#include <com/sun/star/embed/StateChangeInProgressException.hpp>
+#include <com/sun/star/embed/XLinkageSupport.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
@@ -1105,7 +1106,14 @@ void SfxInPlaceClient::DeactivateObject()
m_pViewSh->GetWindow()->GrabFocus();
}
else
- m_pImp->m_xObject->changeState( embed::EmbedStates::RUNNING );
+ {
+ // the links should not stay in running state for long time because of locking
+ uno::Reference< embed::XLinkageSupport > xLink( m_pImp->m_xObject, uno::UNO_QUERY );
+ if ( xLink.is() && xLink->isLink() )
+ m_pImp->m_xObject->changeState( embed::EmbedStates::LOADED );
+ else
+ m_pImp->m_xObject->changeState( embed::EmbedStates::RUNNING );
+ }
if ( m_pViewSh )
{
@@ -1130,7 +1138,14 @@ void SfxInPlaceClient::ResetObject()
if ( m_pImp->m_xObject->getStatus( m_pImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
m_pImp->m_xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE );
else
- m_pImp->m_xObject->changeState( embed::EmbedStates::RUNNING );
+ {
+ // the links should not stay in running state for long time because of locking
+ uno::Reference< embed::XLinkageSupport > xLink( m_pImp->m_xObject, uno::UNO_QUERY );
+ if ( xLink.is() && xLink->isLink() )
+ m_pImp->m_xObject->changeState( embed::EmbedStates::LOADED );
+ else
+ m_pImp->m_xObject->changeState( embed::EmbedStates::RUNNING );
+ }
}
catch (com::sun::star::uno::Exception& )
{}
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index f7b1d2a979..9743029e2e 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -409,7 +409,14 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::activatingUI()
if ( xObject->getStatus( pObj->GetAspect() ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE );
else
- xObject->changeState( embed::EmbedStates::RUNNING );
+ {
+ // the links should not stay in running state for long time because of locking
+ uno::Reference< embed::XLinkageSupport > xLink( xObject, uno::UNO_QUERY );
+ if ( xLink.is() && xLink->isLink() )
+ xObject->changeState( embed::EmbedStates::LOADED );
+ else
+ xObject->changeState( embed::EmbedStates::RUNNING );
+ }
}
catch (com::sun::star::uno::Exception& )
{}
@@ -644,9 +651,7 @@ void SdrEmbedObjectLink::DataChanged( const String& /*rMimeType*/,
try
{
sal_Int32 nState = xObject->getCurrentState();
- if ( nState == embed::EmbedStates::LOADED )
- xObject->changeState( embed::EmbedStates::RUNNING );
- else
+ if ( nState != embed::EmbedStates::LOADED )
{
// in some cases the linked file probably is not locked so it could be changed
xObject->changeState( embed::EmbedStates::LOADED );