summaryrefslogtreecommitdiff
path: root/embeddedobj/source/commonembedding
diff options
context:
space:
mode:
Diffstat (limited to 'embeddedobj/source/commonembedding')
-rw-r--r--embeddedobj/source/commonembedding/embedobj.cxx7
-rw-r--r--embeddedobj/source/commonembedding/visobj.cxx47
2 files changed, 49 insertions, 5 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;
}