diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-04-23 13:48:24 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-04-23 13:48:24 +0000 |
commit | 600b7c043d4e082432e5c63f74bdb5948b9767bc (patch) | |
tree | ac8be4b7b3767f2a8d0a65d43a17e4b12590e217 /embeddedobj | |
parent | 726701315f0f5a0a411975c745ef0764f73eef3e (diff) |
CWS-TOOLING: integrate CWS mav50_DEV300
2009-04-16 17:54:43 +0200 mav r270901 : #i100993# let the links stay in loaded state if possible
2009-04-16 17:50:44 +0200 mav r270900 : #i100993# let the links stay in loaded state if possible
2009-04-16 17:46:45 +0200 mav r270899 : #i100993# let the links stay in loaded state if possible
2009-04-16 17:44:47 +0200 mav r270898 : #i100993# let the links stay in loaded state if possible#
Diffstat (limited to 'embeddedobj')
-rw-r--r-- | embeddedobj/source/commonembedding/embedobj.cxx | 5 | ||||
-rw-r--r-- | embeddedobj/source/commonembedding/visobj.cxx | 47 |
2 files changed, 48 insertions, 4 deletions
diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx index 779009fb6920..668c4a53508f 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 ); diff --git a/embeddedobj/source/commonembedding/visobj.cxx b/embeddedobj/source/commonembedding/visobj.cxx index 141ceb79af23..fa16ebae2222 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; } |