summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embeddedobj/source/msole/olepersist.cxx103
1 files changed, 49 insertions, 54 deletions
diff --git a/embeddedobj/source/msole/olepersist.cxx b/embeddedobj/source/msole/olepersist.cxx
index 286f24b709fc..eedc8c4fe63b 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -1878,72 +1878,67 @@ void SAL_CALL OleEmbeddedObject::breakLink( const uno::Reference< embed::XStorag
#ifdef _WIN32
- if ( m_pOleComponent )
- {
- // TODO: create an object based on the link
-
- // disconnect the old temporary URL
- OUString aOldTempURL = m_aTempURL;
- m_aTempURL.clear();
+ // TODO: create an object based on the link
- OleComponent* pNewOleComponent = new OleComponent( m_xFactory, this );
- try {
- pNewOleComponent->InitEmbeddedCopyOfLink( m_pOleComponent );
- }
- catch ( const uno::Exception& )
- {
- delete pNewOleComponent;
- if ( !m_aTempURL.isEmpty() )
- KillFile_Impl( m_aTempURL, m_xFactory );
- m_aTempURL = aOldTempURL;
- throw;
- }
+ // disconnect the old temporary URL
+ OUString aOldTempURL = m_aTempURL;
+ m_aTempURL.clear();
- try {
- GetRidOfComponent();
- }
- catch( const uno::Exception& )
- {
- delete pNewOleComponent;
- if ( !m_aTempURL.isEmpty() )
- KillFile_Impl( m_aTempURL, m_xFactory );
- m_aTempURL = aOldTempURL;
- throw;
- }
+ OleComponent* pNewOleComponent = new OleComponent(m_xFactory, this);
+ try {
+ pNewOleComponent->InitEmbeddedCopyOfLink(m_pOleComponent);
+ }
+ catch (const uno::Exception&)
+ {
+ delete pNewOleComponent;
+ if (!m_aTempURL.isEmpty())
+ KillFile_Impl(m_aTempURL, m_xFactory);
+ m_aTempURL = aOldTempURL;
+ throw;
+ }
- KillFile_Impl( aOldTempURL, m_xFactory );
+ try {
+ GetRidOfComponent();
+ }
+ catch (const uno::Exception&)
+ {
+ delete pNewOleComponent;
+ if (!m_aTempURL.isEmpty())
+ KillFile_Impl(m_aTempURL, m_xFactory);
+ m_aTempURL = aOldTempURL;
+ throw;
+ }
- CreateOleComponent_Impl( pNewOleComponent );
+ KillFile_Impl(aOldTempURL, m_xFactory);
- if ( m_xParentStorage != xStorage || !m_aEntryName.equals( sEntName ) )
- SwitchOwnPersistence( xStorage, sEntName );
+ CreateOleComponent_Impl(pNewOleComponent);
- if ( m_nObjectState != embed::EmbedStates::LOADED )
- {
- // TODO: should we activate the new object if the link was activated?
+ if (m_xParentStorage != xStorage || !m_aEntryName.equals(sEntName))
+ SwitchOwnPersistence(xStorage, sEntName);
- sal_Int32 nTargetState = m_nObjectState;
- m_nObjectState = embed::EmbedStates::LOADED;
+ if (m_nObjectState != embed::EmbedStates::LOADED)
+ {
+ // TODO: should we activate the new object if the link was activated?
- if ( m_nObjectState == embed::EmbedStates::RUNNING )
- m_pOleComponent->RunObject(); // the object already was in running state, the server must be installed
- else // m_nObjectState == embed::EmbedStates::ACTIVE
- {
- m_pOleComponent->RunObject(); // the object already was in running state, the server must be installed
- m_pOleComponent->ExecuteVerb( embed::EmbedVerbs::MS_OLEVERB_OPEN );
- }
+ const sal_Int32 nTargetState = m_nObjectState;
+ m_nObjectState = embed::EmbedStates::LOADED;
- m_nObjectState = nTargetState;
+ if (nTargetState == embed::EmbedStates::RUNNING)
+ m_pOleComponent->RunObject(); // the object already was in running state, the server must be installed
+ else // nTargetState == embed::EmbedStates::ACTIVE
+ {
+ m_pOleComponent->RunObject(); // the object already was in running state, the server must be installed
+ m_pOleComponent->ExecuteVerb(embed::EmbedVerbs::MS_OLEVERB_OPEN);
}
- m_bIsLink = false;
- m_aLinkURL.clear();
- }
- else
-#endif
- {
- throw io::IOException(); //TODO:
+ m_nObjectState = nTargetState;
}
+
+ m_bIsLink = false;
+ m_aLinkURL.clear();
+#else // ! _WIN32
+ throw io::IOException(); //TODO:
+#endif // _WIN32
}