diff options
author | Mikhail Voitenko <mav@openoffice.org> | 2003-12-15 14:37:44 +0000 |
---|---|---|
committer | Mikhail Voitenko <mav@openoffice.org> | 2003-12-15 14:37:44 +0000 |
commit | ed584a8b22895e4cb4eaf7acf14420b33200b75f (patch) | |
tree | 852644c70eb8b0845cc42981a58317e2def323e9 /embeddedobj | |
parent | 2ea6cb5785d63539ebbe35a5b2634e773c5d356d (diff) |
#112923# let object work on unix
Diffstat (limited to 'embeddedobj')
-rw-r--r-- | embeddedobj/source/inc/oleembobj.hxx | 5 | ||||
-rw-r--r-- | embeddedobj/source/msole/olecomponent.cxx | 35 | ||||
-rw-r--r-- | embeddedobj/source/msole/oleembed.cxx | 66 | ||||
-rw-r--r-- | embeddedobj/source/msole/olemisc.cxx | 28 | ||||
-rw-r--r-- | embeddedobj/source/msole/olepersist.cxx | 176 | ||||
-rw-r--r-- | embeddedobj/source/msole/olevisual.cxx | 16 |
6 files changed, 232 insertions, 94 deletions
diff --git a/embeddedobj/source/inc/oleembobj.hxx b/embeddedobj/source/inc/oleembobj.hxx index ceaaea5a7338..51e4f21413d5 100644 --- a/embeddedobj/source/inc/oleembobj.hxx +++ b/embeddedobj/source/inc/oleembobj.hxx @@ -2,9 +2,9 @@ * * $RCSfile: oleembobj.hxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: mav $ $Date: 2003-12-09 15:09:30 $ + * last change: $Author: mav $ $Date: 2003-12-15 15:37:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -205,6 +205,7 @@ public: sal_Bool OnShowWindow_Impl( sal_Bool bShow ); void CreateOleComponent_Impl( OleComponent* pOleComponent = NULL ); + void CreateOleComponentAndLoad_Impl( OleComponent* pOleComponent = NULL ); void SetObjectIsLink_Impl( sal_Bool bIsLink ) { m_bIsLink = bIsLink; } diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx index 76facb9cae98..d9dc39f0f5b5 100644 --- a/embeddedobj/source/msole/olecomponent.cxx +++ b/embeddedobj/source/msole/olecomponent.cxx @@ -2,9 +2,9 @@ * * $RCSfile: olecomponent.cxx,v $ * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * - * last change: $Author: mav $ $Date: 2003-12-15 13:10:01 $ + * last change: $Author: mav $ $Date: 2003-12-15 15:37:42 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -98,13 +98,15 @@ using namespace ::com::sun::star; #define MAX_ENUM_ELE 20 #define FORMATS_NUM 3 -const sal_Int32 n_ConstBufferSize = 32000; - sal_Bool ConvertBufferToFormat( void* pBuf, sal_uInt32 nBufSize, const ::rtl::OUString& aFormatShortName, uno::Any& aResult ); +void copyInputToOutput_Impl( const uno::Reference< io::XInputStream >& aIn, + const uno::Reference< io::XOutputStream >& aOut ); + + typedef ::std::vector< FORMATETC* > FormatEtcList; FORMATETC pFormatTemplates[FORMATS_NUM] = { @@ -326,29 +328,6 @@ sal_Bool OleComponentNative_Impl::GraphicalFlavor( const datatransfer::DataFlavo } //----------------------------------------------- -// TODO: probably later such a common function can be moved -// to a separate helper library. -void copyInputToOutput_Impl( const uno::Reference< io::XInputStream >& aIn, - const uno::Reference< io::XOutputStream >& aOut ) -{ - sal_Int32 nRead; - uno::Sequence < sal_Int8 > aSequence ( n_ConstBufferSize ); - - do - { - nRead = aIn->readBytes ( aSequence, n_ConstBufferSize ); - if ( nRead < n_ConstBufferSize ) - { - uno::Sequence < sal_Int8 > aTempBuf ( aSequence.getConstArray(), nRead ); - aOut->writeBytes ( aTempBuf ); - } - else - aOut->writeBytes ( aSequence ); - } - while ( nRead == n_ConstBufferSize ); -} - -//----------------------------------------------- sal_Bool KillFile( const ::rtl::OUString& aURL, const uno::Reference< lang::XMultiServiceFactory >& xFactory ) { if ( !xFactory.is() ) @@ -579,6 +558,8 @@ FORMATETC* OleComponentNative_Impl::GetSupportedFormatForAspect( sal_uInt32 nReq //---------------------------------------------- void OleComponent::Dispose() { + CloseObject(); + if ( m_pOleWrapClientSite ) { m_pOleWrapClientSite->disconnectOleComponent(); diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx index 54cf2519a804..3cf4a80a731f 100644 --- a/embeddedobj/source/msole/oleembed.cxx +++ b/embeddedobj/source/msole/oleembed.cxx @@ -2,9 +2,9 @@ * * $RCSfile: oleembed.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: mav $ $Date: 2003-12-12 12:50:52 $ + * last change: $Author: mav $ $Date: 2003-12-15 15:37:42 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -147,25 +147,30 @@ void SAL_CALL OleEmbeddedObject::changeState( sal_Int32 nNewState ) if ( m_nObjectState == nNewState ) return; - if ( !m_pOleComponent ) - throw uno::RuntimeException(); - +#ifdef WNT // TODO: additional verbs can be a problem, since nobody knows how the object // will behave after activation if ( nNewState == embed::EmbedStates::EMBED_LOADED ) { // This means just closing of the current object - SaveObject_Impl(); - m_pOleComponent->CloseObject(); + // If component can not be closed the object stays in loaded state + // and it holds reference to "incomplete" component + // If the object is switched to running state later + // the component will become "complete" + GetRidOfComponent( sal_False ); } - else + else if ( nNewState == embed::EmbedStates::EMBED_RUNNING || nNewState == embed::EmbedStates::EMBED_ACTIVE ) { if ( m_nObjectState == embed::EmbedStates::EMBED_LOADED ) { // if the target object is in loaded state and a different state is specified // as a new one the object first must be switched to running state. + // the component can exist already in nonrunning state + // it can be created during loading to detect type of object + CreateOleComponentAndLoad_Impl( m_pOleComponent ); + m_pOleComponent->RunObject(); m_nObjectState = embed::EmbedStates::EMBED_RUNNING; if ( m_nObjectState == nNewState ) @@ -185,9 +190,13 @@ void SAL_CALL OleEmbeddedObject::changeState( sal_Int32 nNewState ) } else { - OSL_ENSURE( sal_False, "Unreachable code executed!" ); + throw embed::UnreachableStateException(); } } + else +#endif + throw embed::UnreachableStateException(); + } //---------------------------------------------- @@ -203,18 +212,22 @@ uno::Sequence< sal_Int32 > SAL_CALL OleEmbeddedObject::getReachableStates() throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object has no persistence!\n" ), uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); - if ( !m_pOleComponent ) - throw uno::RuntimeException(); - +#ifdef WNT if ( m_nObjectState == embed::EmbedStates::EMBED_LOADED ) { // the list of supported verbs can be retrieved only when object is in running state throw embed::NeedsRunningStateException(); // TODO: } + if ( !m_pOleComponent ) + throw uno::RuntimeException(); + // the list of states can only be guessed based on standard verbs, // since there is no way to detect what additional verbs do return GetReachableStatesList_Impl( m_pOleComponent->GetVerbList() ); +#else + return uno::Sequence< sal_Int32 >(); +#endif } //---------------------------------------------- @@ -250,19 +263,26 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID ) throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object has no persistence!\n" ), uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); - if ( !m_pOleComponent ) - throw uno::RuntimeException(); - +#ifdef WNT if ( m_nObjectState == embed::EmbedStates::EMBED_LOADED ) { // if the target object is in loaded state // it must be switched to running state to execute verb + // the component can exist already in noncomplete state + // it can be created during loading + CreateOleComponentAndLoad_Impl( m_pOleComponent ); m_pOleComponent->RunObject(); m_nObjectState = embed::EmbedStates::EMBED_RUNNING; } + if ( !m_pOleComponent ) + throw uno::RuntimeException(); + m_pOleComponent->ExecuteVerb( nVerbID ); +#else + throw embed::UnreachableStateException(); +#endif } //---------------------------------------------- @@ -277,14 +297,20 @@ uno::Sequence< embed::VerbDescr > SAL_CALL OleEmbeddedObject::getSupportedVerbs( if ( m_nObjectState == -1 ) throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object has no persistence!\n" ), uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); - +#ifdef WNT if ( m_nObjectState == embed::EmbedStates::EMBED_LOADED ) { // the list of supported verbs can be retrieved only when object is in running state throw embed::NeedsRunningStateException(); // TODO: } + if ( !m_pOleComponent ) + throw uno::RuntimeException(); + return m_pOleComponent->GetVerbList(); +#else + return uno::Sequence< embed::VerbDescr >(); +#endif } //---------------------------------------------- @@ -377,6 +403,14 @@ sal_Int64 SAL_CALL OleEmbeddedObject::getStatus( sal_Int64 nAspect ) throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object must be in running state!\n" ), uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); +#ifdef WNT + if ( !m_pOleComponent ) + throw uno::RuntimeException(); + return m_pOleComponent->GetMiscStatus( nAspect ); +#else + throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "Illegal call!\n" ), + uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); +#endif } diff --git a/embeddedobj/source/msole/olemisc.cxx b/embeddedobj/source/msole/olemisc.cxx index ab8cd649a3f6..fcc34e1d6378 100644 --- a/embeddedobj/source/msole/olemisc.cxx +++ b/embeddedobj/source/msole/olemisc.cxx @@ -2,9 +2,9 @@ * * $RCSfile: olemisc.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: mav $ $Date: 2003-12-12 12:50:52 $ + * last change: $Author: mav $ $Date: 2003-12-15 15:37:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -138,20 +138,30 @@ OleEmbeddedObject::~OleEmbeddedObject() //------------------------------------------------------ void OleEmbeddedObject::GetRidOfComponent() { +#ifdef WNT if ( m_pOleComponent ) { if ( m_nObjectState != embed::EmbedStates::EMBED_LOADED ) - { SaveObject_Impl(); - m_pOleComponent->CloseObject(); - } m_pOleComponent->removeCloseListener( m_xClosePreventer ); - m_pOleComponent->close( sal_True ); + try + { + m_pOleComponent->close( sal_False ); + } + catch( uno::Exception& ) + { + // TODO: there should be a special listener to wait for component closing + // and to notify object, may be object itself can be such a listener + m_pOleComponent->addCloseListener( m_xClosePreventer ); + throw; + } + m_pOleComponent->disconnectEmbeddedObject(); m_pOleComponent->release(); m_pOleComponent = NULL; } +#endif } //------------------------------------------------------ @@ -165,6 +175,8 @@ void OleEmbeddedObject::Dispose() m_pInterfaceContainer = NULL; } + m_bDisposed = true; + if ( m_pOleComponent ) GetRidOfComponent(); @@ -183,8 +195,6 @@ void OleEmbeddedObject::Dispose() } m_xParentStorage = uno::Reference< embed::XStorage >(); - - m_bDisposed = true; } //------------------------------------------------------ @@ -229,7 +239,7 @@ uno::Reference< util::XCloseable > SAL_CALL OleEmbeddedObject::getComponent() if ( m_nObjectState == -1 || m_nObjectState == embed::EmbedStates::EMBED_LOADED ) { - // the object is still not loaded + // the object is still not running throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object is not running!\n" ), uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); } diff --git a/embeddedobj/source/msole/olepersist.cxx b/embeddedobj/source/msole/olepersist.cxx index a245d2fb560d..3474c3eff2d8 100644 --- a/embeddedobj/source/msole/olepersist.cxx +++ b/embeddedobj/source/msole/olepersist.cxx @@ -2,9 +2,9 @@ * * $RCSfile: olepersist.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: mav $ $Date: 2003-12-09 15:09:39 $ + * last change: $Author: mav $ $Date: 2003-12-15 15:37:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -109,6 +109,30 @@ using namespace ::com::sun::star; +//------------------------------------------------------ +// TODO: probably later such a common function can be moved +// to a separate helper library. + +const sal_Int32 n_ConstBufferSize = 32000; +void copyInputToOutput_Impl( const uno::Reference< io::XInputStream >& aIn, + const uno::Reference< io::XOutputStream >& aOut ) +{ + sal_Int32 nRead; + uno::Sequence < sal_Int8 > aSequence ( n_ConstBufferSize ); + + do + { + nRead = aIn->readBytes ( aSequence, n_ConstBufferSize ); + if ( nRead < n_ConstBufferSize ) + { + uno::Sequence < sal_Int8 > aTempBuf ( aSequence.getConstArray(), nRead ); + aOut->writeBytes ( aTempBuf ); + } + else + aOut->writeBytes ( aSequence ); + } + while ( nRead == n_ConstBufferSize ); +} //------------------------------------------------------ void SetStreamMediaType_Impl( const uno::Reference< io::XStream >& xStream, const ::rtl::OUString& aMediaType ) @@ -207,6 +231,7 @@ sal_Bool OleEmbeddedObject::OnShowWindow_Impl( sal_Bool bShow ) //------------------------------------------------------ void OleEmbeddedObject::CreateOleComponent_Impl( OleComponent* pOleComponent ) { +#ifdef WNT if ( !m_pOleComponent ) { m_pOleComponent = pOleComponent ? pOleComponent : new OleComponent( m_xFactory, this ); @@ -221,6 +246,29 @@ void OleEmbeddedObject::CreateOleComponent_Impl( OleComponent* pOleComponent ) } else OSL_ENSURE( sal_False, "Trying to recreate OLE component!\n" ); +#endif +} + +//------------------------------------------------------ +void OleEmbeddedObject::CreateOleComponentAndLoad_Impl( OleComponent* pOleComponent ) +{ +#ifdef WNT + if ( !m_pOleComponent ) + { + if ( !m_xObjectStream.is() ) + throw uno::RuntimeException(); + + CreateOleComponent_Impl( NULL ); + // load object from the stream + uno::Reference< io::XInputStream > xInStream = m_xObjectStream->getInputStream(); + if ( !xInStream.is() ) + throw io::IOException(); // TODO: access denied + + // after the loading the object can appear as a link + // will be detected later by olecomponent + m_pOleComponent->LoadEmbeddedObject( xInStream ); + } +#endif } //------------------------------------------------------ @@ -317,20 +365,15 @@ void SAL_CALL OleEmbeddedObject::setPersistentEntry( if ( lObjArgs[nInd].Name.equalsAscii( "StoreVisualReplacement" ) ) lObjArgs[nInd].Value >>= m_bStoreVisRepl; +#ifdef WNT if ( nEntryConnectionMode == embed::EntryInitModes::ENTRY_DEFAULT_INIT ) { - CreateOleComponent_Impl(); - if ( bElExists ) { // load object from the stream - uno::Reference< io::XInputStream > xInStream = m_xObjectStream->getInputStream(); - if ( !xInStream.is() ) - throw io::IOException(); // TODO: access denied - // after the loading the object can appear as a link - // will be detected later by olecomponent - m_pOleComponent->LoadEmbeddedObject( xInStream ); + // will be detected by olecomponent + CreateOleComponentAndLoad_Impl( NULL ); m_aClassID = m_pOleComponent->GetCLSID(); // was not set during consruction m_nObjectState = embed::EmbedStates::EMBED_LOADED; @@ -338,6 +381,7 @@ void SAL_CALL OleEmbeddedObject::setPersistentEntry( else { // create a new object + CreateOleComponent_Impl(); m_pOleComponent->CreateNewEmbeddedObject( m_aClassID ); m_pOleComponent->RunObject(); m_nObjectState = embed::EmbedStates::EMBED_RUNNING; @@ -353,8 +397,6 @@ void SAL_CALL OleEmbeddedObject::setPersistentEntry( // the document just already changed its stream to store to; // the links to OLE documents switch their persistence in the same way // as normal embedded objects - - // This mode is called NO_INIT, that means that icon can not be changed also } else if ( nEntryConnectionMode == embed::EntryInitModes::ENTRY_TRUNCATE_INIT ) { @@ -401,6 +443,19 @@ void SAL_CALL OleEmbeddedObject::setPersistentEntry( uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ), 3 ); } +#else + // On unix the ole object can not do anything except storing itself somewere + if ( nEntryConnectionMode == embed::EntryInitModes::ENTRY_DEFAULT_INIT && bElExists ) + { + // TODO: detect classID of the object + // can be a real problem for the links + } + else + throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "Wrong connection mode is provided!\n" ), + uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ), + 3 ); + +#endif } //------------------------------------------------------ @@ -436,6 +491,7 @@ void SAL_CALL OleEmbeddedObject::storeOwn() if ( m_nObjectState == embed::EmbedStates::EMBED_LOADED ) return; // nothing to do, the object is in loaded state +#ifdef WNT if ( !m_pOleComponent ) throw uno::RuntimeException(); @@ -472,6 +528,7 @@ void SAL_CALL OleEmbeddedObject::storeOwn() { // TODO: update visual representation } +#endif } //------------------------------------------------------ @@ -503,35 +560,49 @@ void SAL_CALL OleEmbeddedObject::storeToEntry( const uno::Reference< embed::XSto ::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ), uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); - OSL_ENSURE( m_bIsLink || m_xParentStorage.is() && m_xObjectStream.is(), "The object has no valid persistence!\n" ); - // ??? + OSL_ENSURE( m_xParentStorage.is() && m_xObjectStream.is(), "The object has no valid persistence!\n" ); - uno::Reference< io::XStream > xTargetStream = + if ( m_nObjectState == embed::EmbedStates::EMBED_LOADED ) + { + m_xParentStorage->copyElementTo( m_aEntryName, xStorage, sEntName ); + } +#ifdef WNT + else + { + if ( !m_pOleComponent ) + throw uno::RuntimeException(); + + uno::Reference< io::XStream > xTargetStream = xStorage->openStreamElement( sEntName, embed::ElementModes::ELEMENT_READWRITE ); - if ( !xTargetStream.is() ) - throw io::IOException(); //TODO: access denied + if ( !xTargetStream.is() ) + throw io::IOException(); //TODO: access denied - SetStreamMediaType_Impl( xTargetStream, ::rtl::OUString::createFromAscii( "application/vnd.sun.star.oleobject" ) ); - uno::Reference< io::XOutputStream > xOutStream = xTargetStream->getOutputStream(); - if ( !xOutStream.is() ) - throw io::IOException(); //TODO: access denied + SetStreamMediaType_Impl( xTargetStream, ::rtl::OUString::createFromAscii( "application/vnd.sun.star.oleobject" ) ); + uno::Reference< io::XOutputStream > xOutStream = xTargetStream->getOutputStream(); + if ( !xOutStream.is() ) + throw io::IOException(); //TODO: access denied - sal_Bool bStoreVis = m_bStoreVisRepl; - for ( sal_Int32 nInd = 0; nInd < lObjArgs.getLength(); nInd++ ) - if ( lObjArgs[nInd].Name.equalsAscii( "StoreVisualReplacement" ) ) - lObjArgs[nInd].Value >>= bStoreVis; + sal_Bool bStoreVis = m_bStoreVisRepl; + for ( sal_Int32 nInd = 0; nInd < lObjArgs.getLength(); nInd++ ) + if ( lObjArgs[nInd].Name.equalsAscii( "StoreVisualReplacement" ) ) + lObjArgs[nInd].Value >>= bStoreVis; - m_pOleComponent->StoreObjectToStream( xOutStream, bStoreVis ); + m_pOleComponent->StoreObjectToStream( xOutStream, bStoreVis ); - uno::Reference< lang::XComponent > xComp( xTargetStream, uno::UNO_QUERY ); - if ( xComp.is() ) - { - try { - xComp->dispose(); - } catch( uno::Exception& ) + uno::Reference< lang::XComponent > xComp( xTargetStream, uno::UNO_QUERY ); + if ( xComp.is() ) { + try { + xComp->dispose(); + } catch( uno::Exception& ) + { + } } } +#else + else + throw io::IOException(); // TODO +#endif // TODO: should the listener notification be done? } @@ -568,7 +639,7 @@ void SAL_CALL OleEmbeddedObject::storeAsEntry( const uno::Reference< embed::XSto OSL_ENSURE( m_xParentStorage.is() && m_xObjectStream.is(), "The object has no valid persistence!\n" ); uno::Reference< io::XStream > xTargetStream = - xStorage->openStreamElement( sEntName, embed::ElementModes::ELEMENT_READWRITE ); + xStorage->openStreamElement( sEntName, embed::ElementModes::ELEMENT_READWRITE ); if ( !xTargetStream.is() ) throw io::IOException(); //TODO: access denied @@ -582,7 +653,29 @@ void SAL_CALL OleEmbeddedObject::storeAsEntry( const uno::Reference< embed::XSto if ( lObjArgs[nInd].Name.equalsAscii( "StoreVisualReplacement" ) ) lObjArgs[nInd].Value >>= bStoreVis; - m_pOleComponent->StoreObjectToStream( xOutStream, bStoreVis ); + if ( m_nObjectState == embed::EmbedStates::EMBED_LOADED ) + { + if ( bStoreVis != m_bStoreVisRepl ) + throw lang::IllegalArgumentException( + ::rtl::OUString::createFromAscii( "Can't change store mode in loaded state!\n" ), + uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ), + 1 ); + + uno::Reference< io::XInputStream > xInStream = m_xObjectStream->getInputStream(); + copyInputToOutput_Impl( xInStream, xOutStream ); + } +#ifdef WNT + else + { + if ( !m_pOleComponent ) + throw uno::RuntimeException(); // TODO: + + m_pOleComponent->StoreObjectToStream( xOutStream, bStoreVis ); + } +#else + else + throw io::IOException(); // TODO +#endif m_bWaitSaveCompleted = sal_True; m_xNewObjectStream = xTargetStream; @@ -789,7 +882,7 @@ void SAL_CALL OleEmbeddedObject::breakLink( const uno::Reference< embed::XStorag ::rtl::OUString::createFromAscii( "The object is not a valid linked object!\n" ), uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); } - +#ifdef WNT if ( m_bReadOnly ) throw io::IOException(); // TODO: Access denied @@ -813,7 +906,15 @@ void SAL_CALL OleEmbeddedObject::breakLink( const uno::Reference< embed::XStorag throw; } - GetRidOfComponent(); + try { + GetRidOfComponent(); + } + catch( uno::Exception& ) + { + delete pNewOleComponent; + throw; + } + CreateOleComponent_Impl( pNewOleComponent ); if ( m_xParentStorage != xStorage || !m_aEntryName.equals( sEntName ) ) @@ -839,6 +940,9 @@ void SAL_CALL OleEmbeddedObject::breakLink( const uno::Reference< embed::XStorag m_bIsLink = sal_False; m_aLinkURL = ::rtl::OUString(); +#else + throw io::IOException(); //TODO: +#endif } //------------------------------------------------------ diff --git a/embeddedobj/source/msole/olevisual.cxx b/embeddedobj/source/msole/olevisual.cxx index e8bb759d8376..9a84be0bd9df 100644 --- a/embeddedobj/source/msole/olevisual.cxx +++ b/embeddedobj/source/msole/olevisual.cxx @@ -2,9 +2,9 @@ * * $RCSfile: olevisual.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mav $ $Date: 2003-11-13 17:01:14 $ + * last change: $Author: mav $ $Date: 2003-12-15 15:37:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -96,11 +96,15 @@ void SAL_CALL OleEmbeddedObject::setVisAreaSize( sal_Int64 nAspect, const awt::S if ( m_nObjectState == -1 || m_nObjectState == embed::EmbedStates::EMBED_LOADED ) throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The own object has no model!\n" ), uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); - +#ifdef WNT if ( !m_pOleComponent ) throw uno::RuntimeException(); m_pOleComponent->SetExtent( aSize, nAspect ); // will throw an exception in case of failure +#else + throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "Illegal call!\n" ), + uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); +#endif } awt::Size SAL_CALL OleEmbeddedObject::getVisAreaSize( sal_Int64 nAspect ) @@ -116,11 +120,15 @@ awt::Size SAL_CALL OleEmbeddedObject::getVisAreaSize( sal_Int64 nAspect ) if ( m_nObjectState == -1 || m_nObjectState == embed::EmbedStates::EMBED_LOADED ) throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The own object has no model!\n" ), uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); - +#ifdef WNT if ( !m_pOleComponent ) throw uno::RuntimeException(); return m_pOleComponent->GetExtent( nAspect ); // will throw an exception in case of failure +#else + throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "Illegal call!\n" ), + uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); +#endif } // Probably will be removed!!! |