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#
This commit is contained in:
Ivo Hinkelmann 2009-04-23 13:48:24 +00:00
parent 726701315f
commit 600b7c043d
4 changed files with 74 additions and 10 deletions

View file

@ -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 );

View file

@ -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;
}

View file

@ -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& )
{}

View file

@ -415,7 +415,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& )
{}
@ -650,9 +657,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 );