Kaydet (Commit) aec29756 authored tarafından Mikhail Voitenko's avatar Mikhail Voitenko

#112923# ole implementation related changes

üst 5ea5c0af
...@@ -2,4 +2,5 @@ es embeddedobj : offuh sal cppu cppuhelper NULL ...@@ -2,4 +2,5 @@ es embeddedobj : offuh sal cppu cppuhelper NULL
es embeddedobj usr1 - all eo_mkout NULL es embeddedobj usr1 - all eo_mkout NULL
es embeddedobj\source\commonembedding nmake - all eo_commonembed NULL es embeddedobj\source\commonembedding nmake - all eo_commonembed NULL
es embeddedobj\source\general nmake - all eo_general NULL es embeddedobj\source\general nmake - all eo_general NULL
es embeddedobj\util nmake - all eo_util eo_commonembed eo_general NULL es embeddedobj\source\msole nmake - all eo_msole NULL
es embeddedobj\util nmake - all eo_util eo_commonembed eo_general eo_msole NULL
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: embedobj.cxx,v $ * $RCSfile: embedobj.cxx,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: mav $ $Date: 2003-10-27 12:57:28 $ * last change: $Author: mav $ $Date: 2003-11-14 15:24:24 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -181,6 +181,9 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState ) ...@@ -181,6 +181,9 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
if ( !xModif.is() ) if ( !xModif.is() )
throw uno::RuntimeException(); throw uno::RuntimeException();
if ( !m_xClientSite.is() )
throw embed::WrongStateException(); //TODO: client site is not set!
// store document if it is modified // store document if it is modified
if ( xModif->isModified() ) if ( xModif->isModified() )
{ {
...@@ -324,7 +327,7 @@ void SAL_CALL OCommonEmbeddedObject::doVerb( sal_Int32 nVerbID ) ...@@ -324,7 +327,7 @@ void SAL_CALL OCommonEmbeddedObject::doVerb( sal_Int32 nVerbID )
} }
//---------------------------------------------- //----------------------------------------------
uno::Sequence< sal_Int32 > SAL_CALL OCommonEmbeddedObject::getSupportedVerbs() uno::Sequence< embed::VerbDescr > SAL_CALL OCommonEmbeddedObject::getSupportedVerbs()
throw ( embed::WrongStateException, throw ( embed::WrongStateException,
uno::RuntimeException ) uno::RuntimeException )
{ {
...@@ -336,7 +339,7 @@ uno::Sequence< sal_Int32 > SAL_CALL OCommonEmbeddedObject::getSupportedVerbs() ...@@ -336,7 +339,7 @@ uno::Sequence< sal_Int32 > SAL_CALL OCommonEmbeddedObject::getSupportedVerbs()
throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object has no persistence!\n" ), throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object has no persistence!\n" ),
uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) );
uno::Sequence< sal_Int32 > aResult; uno::Sequence< embed::VerbDescr > aResult;
sal_Int32 nResLen = 0; sal_Int32 nResLen = 0;
// verbs list will be set on initialization depending from document type // verbs list will be set on initialization depending from document type
...@@ -345,7 +348,8 @@ uno::Sequence< sal_Int32 > SAL_CALL OCommonEmbeddedObject::getSupportedVerbs() ...@@ -345,7 +348,8 @@ uno::Sequence< sal_Int32 > SAL_CALL OCommonEmbeddedObject::getSupportedVerbs()
if ( m_aVerbTable[nVerbInd][1] == m_aAcceptedStates[nStatesInd] ) if ( m_aVerbTable[nVerbInd][1] == m_aAcceptedStates[nStatesInd] )
{ {
aResult.realloc( ++nResLen ); aResult.realloc( ++nResLen );
aResult[nResLen-1] = m_aVerbTable[nVerbInd][0]; // TODO: fill the whole structure
aResult[nResLen-1].VerbID = m_aVerbTable[nVerbInd][0];
} }
return aResult; return aResult;
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: persistence.cxx,v $ * $RCSfile: persistence.cxx,v $
* *
* $Revision: 1.2 $ * $Revision: 1.3 $
* *
* last change: $Author: mav $ $Date: 2003-11-04 14:30:19 $ * last change: $Author: mav $ $Date: 2003-11-14 15:24:24 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -499,7 +499,7 @@ uno::Reference< frame::XModel > OCommonEmbeddedObject::CreateTempDocFromLink_Imp ...@@ -499,7 +499,7 @@ uno::Reference< frame::XModel > OCommonEmbeddedObject::CreateTempDocFromLink_Imp
} }
//------------------------------------------------------ //------------------------------------------------------
sal_Bool SAL_CALL OCommonEmbeddedObject::setPersistentEntry( void SAL_CALL OCommonEmbeddedObject::setPersistentEntry(
const uno::Reference< embed::XStorage >& xStorage, const uno::Reference< embed::XStorage >& xStorage,
const ::rtl::OUString& sEntName, const ::rtl::OUString& sEntName,
sal_Int32 nEntryConnectionMode, sal_Int32 nEntryConnectionMode,
...@@ -547,6 +547,10 @@ sal_Bool SAL_CALL OCommonEmbeddedObject::setPersistentEntry( ...@@ -547,6 +547,10 @@ sal_Bool SAL_CALL OCommonEmbeddedObject::setPersistentEntry(
::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ), ::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) );
// TODO: the OOo link will have persistence
if ( m_bIsLink )
return;
uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY ); uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY );
if ( !xNameAccess.is() ) if ( !xNameAccess.is() )
throw uno::RuntimeException(); //TODO throw uno::RuntimeException(); //TODO
...@@ -565,10 +569,6 @@ sal_Bool SAL_CALL OCommonEmbeddedObject::setPersistentEntry( ...@@ -565,10 +569,6 @@ sal_Bool SAL_CALL OCommonEmbeddedObject::setPersistentEntry(
m_xParentStorage = xStorage; m_xParentStorage = xStorage;
m_aEntryName = sEntName; m_aEntryName = sEntName;
// the object should be based on the storage ??? TODO
if ( bElExists && !xStorage->isStorageElement( sEntName ) )
throw io::IOException(); // TODO access denied
if ( nEntryConnectionMode == embed::EntryInitModes::ENTRY_DEFAULT_INIT ) if ( nEntryConnectionMode == embed::EntryInitModes::ENTRY_DEFAULT_INIT )
{ {
if ( bElExists ) if ( bElExists )
...@@ -593,9 +593,8 @@ sal_Bool SAL_CALL OCommonEmbeddedObject::setPersistentEntry( ...@@ -593,9 +593,8 @@ sal_Bool SAL_CALL OCommonEmbeddedObject::setPersistentEntry(
if ( nEntryConnectionMode == embed::EntryInitModes::ENTRY_NO_INIT ) if ( nEntryConnectionMode == embed::EntryInitModes::ENTRY_NO_INIT )
{ {
// the document just already changed its storage to store to // the document just already changed its storage to store to
// the links to OOo documents will ignore this call and return false // the links to OOo documents for now ignore this call
if ( m_bIsLink ) // TODO: OOo links will have persistence so it will be switched here
return sal_False;
} }
else if ( nEntryConnectionMode == embed::EntryInitModes::ENTRY_TRUNCATE_INIT ) else if ( nEntryConnectionMode == embed::EntryInitModes::ENTRY_TRUNCATE_INIT )
{ {
...@@ -621,8 +620,6 @@ sal_Bool SAL_CALL OCommonEmbeddedObject::setPersistentEntry( ...@@ -621,8 +620,6 @@ sal_Bool SAL_CALL OCommonEmbeddedObject::setPersistentEntry(
uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ), uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ),
3 ); 3 );
} }
return sal_True;
} }
//------------------------------------------------------ //------------------------------------------------------
...@@ -986,10 +983,6 @@ void SAL_CALL OCommonEmbeddedObject::breakLink( const uno::Reference< embed::XSt ...@@ -986,10 +983,6 @@ void SAL_CALL OCommonEmbeddedObject::breakLink( const uno::Reference< embed::XSt
m_xParentStorage = xStorage; m_xParentStorage = xStorage;
m_aEntryName = sEntName; m_aEntryName = sEntName;
// the object should be based on the storage ??? TODO
if ( bElExists && !xStorage->isStorageElement( sEntName ) )
throw io::IOException(); // TODO access denied
// for linked object it means that it becomes embedded object // for linked object it means that it becomes embedded object
// the document must switch it's persistence also // the document must switch it's persistence also
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: commonembobj.hxx,v $ * $RCSfile: commonembobj.hxx,v $
* *
* $Revision: 1.2 $ * $Revision: 1.3 $
* *
* last change: $Author: mav $ $Date: 2003-11-04 14:30:20 $ * last change: $Author: mav $ $Date: 2003-11-14 15:24:26 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -275,7 +275,7 @@ public: ...@@ -275,7 +275,7 @@ public:
::com::sun::star::uno::Exception, ::com::sun::star::uno::Exception,
::com::sun::star::uno::RuntimeException ); ::com::sun::star::uno::RuntimeException );
virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getSupportedVerbs() virtual ::com::sun::star::uno::Sequence< ::com::sun::star::embed::VerbDescr > SAL_CALL getSupportedVerbs()
throw ( ::com::sun::star::embed::WrongStateException, throw ( ::com::sun::star::embed::WrongStateException,
::com::sun::star::uno::RuntimeException ); ::com::sun::star::uno::RuntimeException );
...@@ -326,7 +326,7 @@ public: ...@@ -326,7 +326,7 @@ public:
// XEmbedPersist // XEmbedPersist
virtual sal_Bool SAL_CALL setPersistentEntry( virtual void SAL_CALL setPersistentEntry(
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
const ::rtl::OUString& sEntName, const ::rtl::OUString& sEntName,
sal_Int32 nEntryConnectionMode, sal_Int32 nEntryConnectionMode,
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: olecomponent.cxx,v $ * $RCSfile: olecomponent.cxx,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: mav $ $Date: 2003-11-13 17:01:13 $ * last change: $Author: mav $ $Date: 2003-11-14 15:24:27 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -312,9 +312,15 @@ OleComponent::OleComponent( const uno::Reference< lang::XMultiServiceFactory >& ...@@ -312,9 +312,15 @@ OleComponent::OleComponent( const uno::Reference< lang::XMultiServiceFactory >&
, m_nAdvConn( 0 ) , m_nAdvConn( 0 )
, m_nSupportedFormat( 0 ) , m_nSupportedFormat( 0 )
, m_nSupportedMedium( 0 ) , m_nSupportedMedium( 0 )
, m_bOleInitialized( sal_False )
{ {
OSL_ENSURE( m_pUnoOleObject, "No owner object is provided!" ); OSL_ENSURE( m_pUnoOleObject, "No owner object is provided!" );
HRESULT hr = OleInitialize( NULL );
OSL_ENSURE( hr == S_OK || hr == S_FALSE, "The ole can not be successfuly initialized\n" );
if ( hr == S_OK || hr == S_FALSE )
m_bOleInitialized = sal_True;
m_pOleWrapClientSite = new OleWrapperClientSite( (OleComponent*)this ); m_pOleWrapClientSite = new OleWrapperClientSite( (OleComponent*)this );
m_pOleWrapClientSite->AddRef(); m_pOleWrapClientSite->AddRef();
...@@ -352,6 +358,9 @@ OleComponent::~OleComponent() ...@@ -352,6 +358,9 @@ OleComponent::~OleComponent()
delete m_pInterfaceContainer; delete m_pInterfaceContainer;
m_pInterfaceContainer = NULL; m_pInterfaceContainer = NULL;
} }
if ( m_bOleInitialized )
OleUninitialize();
} }
//---------------------------------------------- //----------------------------------------------
...@@ -654,8 +663,6 @@ uno::Sequence< embed::VerbDescr > OleComponent::GetVerbList() ...@@ -654,8 +663,6 @@ uno::Sequence< embed::VerbDescr > OleComponent::GetVerbList()
if( !m_aVerbList.getLength() ) if( !m_aVerbList.getLength() )
{ {
// InitOle(); // TODO: makes sence to do in a central place
CComPtr< IEnumOLEVERB > pEnum; CComPtr< IEnumOLEVERB > pEnum;
if( SUCCEEDED( m_pOleObject->EnumVerbs( &pEnum ) ) ) if( SUCCEEDED( m_pOleObject->EnumVerbs( &pEnum ) ) )
{ {
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: olecomponent.hxx,v $ * $RCSfile: olecomponent.hxx,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: mav $ $Date: 2003-11-13 17:01:32 $ * last change: $Author: mav $ $Date: 2003-11-14 15:24:27 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -146,6 +146,7 @@ class OleComponent : public ::cppu::WeakImplHelper2< ::com::sun::star::util::XCl ...@@ -146,6 +146,7 @@ class OleComponent : public ::cppu::WeakImplHelper2< ::com::sun::star::util::XCl
sal_uInt16 m_nSupportedFormat; sal_uInt16 m_nSupportedFormat;
sal_uInt32 m_nSupportedMedium; sal_uInt32 m_nSupportedMedium;
sal_Bool m_bOleInitialized;
sal_Bool InitializeObject_Impl( sal_uInt32 nIconHandle ); sal_Bool InitializeObject_Impl( sal_uInt32 nIconHandle );
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
# #
# $RCSfile: makefile.mk,v $ # $RCSfile: makefile.mk,v $
# #
# $Revision: 1.2 $ # $Revision: 1.3 $
# #
# last change: $Author: mav $ $Date: 2003-10-29 08:32:00 $ # last change: $Author: mav $ $Date: 2003-11-14 15:24:28 $
# #
# The Contents of this file are made available subject to the terms of # The Contents of this file are made available subject to the terms of
# either of the following licenses # either of the following licenses
...@@ -88,12 +88,27 @@ SHL1OBJS= \ ...@@ -88,12 +88,27 @@ SHL1OBJS= \
$(SLO)$/closepreventer.obj\ $(SLO)$/closepreventer.obj\
$(SLO)$/intercept.obj $(SLO)$/intercept.obj
SHL1OBJS+= \
$(SLO)$/olecomponent.obj\
$(SLO)$/olepersist.obj\
$(SLO)$/oleembed.obj\
$(SLO)$/olevisual.obj\
$(SLO)$/olemisc.obj\
$(SLO)$/olewrapclient.obj\
$(SLO)$/advisesink.obj
SHL1STDLIBS=\ SHL1STDLIBS=\
$(SALLIB)\ $(SALLIB)\
$(CPPULIB)\ $(CPPULIB)\
$(CPPUHELPERLIB) $(CPPUHELPERLIB)
SHL1STDLIBS +=\
ole32.lib\
gdi32.lib\
uuid.lib\
oleaut32.lib
SHL1DEF= $(MISC)$/$(SHL1TARGET).def SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET) DEF1NAME= $(SHL1TARGET)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment