summaryrefslogtreecommitdiff
path: root/embeddedobj/source/commonembedding/embedobj.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'embeddedobj/source/commonembedding/embedobj.cxx')
-rw-r--r--embeddedobj/source/commonembedding/embedobj.cxx60
1 files changed, 33 insertions, 27 deletions
diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx
index 94aad2c32d..476dc80f36 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -113,7 +113,7 @@ void OCommonEmbeddedObject::Deactivate()
catch( uno::Exception& e )
{
throw embed::StorageWrappedTargetException(
- ::rtl::OUString::createFromAscii( "The client could not store the object!" ),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The client could not store the object!" )),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ),
uno::makeAny( e ) );
}
@@ -166,7 +166,7 @@ void OCommonEmbeddedObject::StateChangeNotification_Impl( sal_Bool bBeforeChange
void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
{
// TODO: may be needs interaction handler to detect wherether the object state
- // can be changed even after errors
+ // can be changed even after errors
if ( m_nObjectState == embed::EmbedStates::LOADED )
{
@@ -215,7 +215,7 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
}
else
{
- OSL_ENSURE( sal_False, "Unacceptable state switch!\n" );
+ OSL_FAIL( "Unacceptable state switch!\n" );
throw uno::RuntimeException(); // TODO
}
}
@@ -236,7 +236,10 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
if ( nNextState == embed::EmbedStates::INPLACE_ACTIVE )
{
if ( !m_xClientSite.is() )
- throw embed::WrongStateException(); //TODO: client site is not set!
+ throw embed::WrongStateException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "client site not set, yet" ) ),
+ *this
+ );
uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY );
if ( xInplaceClient.is() && xInplaceClient->canInplaceActivate() )
@@ -284,7 +287,7 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
}
else
{
- OSL_ENSURE( sal_False, "Unacceptable state switch!\n" );
+ OSL_FAIL( "Unacceptable state switch!\n" );
throw uno::RuntimeException(); // TODO
}
}
@@ -357,7 +360,7 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
}
else
{
- OSL_ENSURE( sal_False, "Unacceptable state switch!\n" );
+ OSL_FAIL( "Unacceptable state switch!\n" );
throw uno::RuntimeException(); // TODO
}
}
@@ -370,7 +373,7 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
}
else
{
- OSL_ENSURE( sal_False, "Unacceptable state switch!\n" );
+ OSL_FAIL( "Unacceptable state switch!\n" );
throw uno::RuntimeException(); // TODO
}
}
@@ -397,7 +400,7 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
}
}
else
- throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object is in unacceptable state!\n" ),
+ throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object is in unacceptable state!\n" )),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
}
@@ -410,7 +413,7 @@ uno::Sequence< sal_Int32 > OCommonEmbeddedObject::GetIntermediateStatesSequence_
break;
if ( nCurInd == m_aAcceptedStates.getLength() )
- throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object is in unacceptable state!\n" ),
+ throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object is in unacceptable state!\n" )),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
sal_Int32 nDestInd = 0;
@@ -420,7 +423,7 @@ uno::Sequence< sal_Int32 > OCommonEmbeddedObject::GetIntermediateStatesSequence_
if ( nDestInd == m_aAcceptedStates.getLength() )
throw embed::UnreachableStateException(
- ::rtl::OUString::createFromAscii( "The state either not reachable, or the object allows the state only as an intermediate one!\n" ),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The state either not reachable, or the object allows the state only as an intermediate one!\n" )),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
m_nObjectState,
nNewState );
@@ -444,7 +447,7 @@ void SAL_CALL OCommonEmbeddedObject::changeState( sal_Int32 nNewState )
throw lang::DisposedException(); // TODO
if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object has no persistence!\n" ),
+ throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
sal_Int32 nOldState = m_nObjectState;
@@ -486,14 +489,19 @@ void SAL_CALL OCommonEmbeddedObject::changeState( sal_Int32 nNewState )
{
if ( nOldState != m_nObjectState )
// notify listeners that the object has changed the state
- StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState ,aGuard);
+ StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState, aGuard );
throw;
}
}
// notify listeners that the object has changed the state
- StateChangeNotification_Impl( sal_False, nOldState, nNewState,aGuard );
+ StateChangeNotification_Impl( sal_False, nOldState, nNewState, aGuard );
+
+ // let the object window be shown
+ if ( nNewState == embed::EmbedStates::UI_ACTIVE || nNewState == embed::EmbedStates::INPLACE_ACTIVE )
+ PostEvent_Impl( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnVisAreaChanged" ) ),
+ uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
}
}
@@ -502,12 +510,11 @@ uno::Sequence< sal_Int32 > SAL_CALL OCommonEmbeddedObject::getReachableStates()
throw ( embed::WrongStateException,
uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( m_aMutex );
if ( m_bDisposed )
throw lang::DisposedException(); // TODO
if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object has no persistence!\n" ),
+ throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
return m_aAcceptedStates;
@@ -518,12 +525,11 @@ sal_Int32 SAL_CALL OCommonEmbeddedObject::getCurrentState()
throw ( embed::WrongStateException,
uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( m_aMutex );
if ( m_bDisposed )
throw lang::DisposedException(); // TODO
if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object has no persistence!\n" ),
+ throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
return m_nObjectState;
@@ -539,12 +545,12 @@ void SAL_CALL OCommonEmbeddedObject::doVerb( sal_Int32 nVerbID )
{
RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OCommonEmbeddedObject::doVerb" );
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::ResettableMutexGuard aGuard( m_aMutex );
if ( m_bDisposed )
throw lang::DisposedException(); // TODO
if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object has no persistence!\n" ),
+ throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
// for internal documents this call is just a duplicate of changeState
@@ -562,7 +568,10 @@ void SAL_CALL OCommonEmbeddedObject::doVerb( sal_Int32 nVerbID )
// TODO/LATER: check if the verb is a supported one and if it is produce related operation
}
else
+ {
+ aGuard.clear();
changeState( nNewState );
+ }
}
//----------------------------------------------
@@ -570,12 +579,11 @@ uno::Sequence< embed::VerbDescriptor > SAL_CALL OCommonEmbeddedObject::getSuppor
throw ( embed::WrongStateException,
uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( m_aMutex );
if ( m_bDisposed )
throw lang::DisposedException(); // TODO
if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object has no persistence!\n" ),
+ throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
return m_aObjectVerbs;
@@ -595,7 +603,7 @@ void SAL_CALL OCommonEmbeddedObject::setClientSite(
{
if ( m_nObjectState != embed::EmbedStates::LOADED && m_nObjectState != embed::EmbedStates::RUNNING )
throw embed::WrongStateException(
- ::rtl::OUString::createFromAscii( "The client site can not be set currently!\n" ),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The client site can not be set currently!\n" )),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
m_xClientSite = xClient;
@@ -607,12 +615,11 @@ uno::Reference< embed::XEmbeddedClient > SAL_CALL OCommonEmbeddedObject::getClie
throw ( embed::WrongStateException,
uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( m_aMutex );
if ( m_bDisposed )
throw lang::DisposedException(); // TODO
if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object has no persistence!\n" ),
+ throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
return m_xClientSite;
@@ -629,7 +636,7 @@ void SAL_CALL OCommonEmbeddedObject::update()
throw lang::DisposedException(); // TODO
if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object has no persistence!\n" ),
+ throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
PostEvent_Impl( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnVisAreaChanged" ) ),
@@ -646,7 +653,7 @@ void SAL_CALL OCommonEmbeddedObject::setUpdateMode( sal_Int32 nMode )
throw lang::DisposedException(); // TODO
if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object has no persistence!\n" ),
+ throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
OSL_ENSURE( nMode == embed::EmbedUpdateModes::ALWAYS_UPDATE
@@ -660,7 +667,6 @@ sal_Int64 SAL_CALL OCommonEmbeddedObject::getStatus( sal_Int64 )
throw ( embed::WrongStateException,
uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( m_aMutex );
if ( m_bDisposed )
throw lang::DisposedException(); // TODO