CWS-TOOLING: integrate CWS buildid301_DEV300

This commit is contained in:
Jens-Heiner Rechtien
2008-11-20 15:13:11 +00:00
parent 40d74b23ef
commit c765b48589
18 changed files with 3239 additions and 93 deletions

View File

@@ -1,4 +1,5 @@
es embedserv : offuh sal cppu cppuhelper comphelper NULL
es embedserv usr1 - w es_mkout NULL
es embedserv\source\embed nmake - w es_embed NULL
es embedserv\util nmake - w es_util es_embed.w NULL
es embedserv\source\inprocserv nmake - w es_inproc NULL
es embedserv\util nmake - w es_util es_embed.w es_inproc.w NULL

View File

@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: docholder.cxx,v $
* $Revision: 1.31 $
* $Revision: 1.31.10.1 $
*
* This file is part of OpenOffice.org.
*
@@ -38,6 +38,7 @@
#include "intercept.hxx"
#include "syswinwrapper.hxx"
#include "iipaobj.hxx"
#include "common.h"
#include <Windows.h>
#include <com/sun/star/lang/SystemDependent.hpp>
@@ -455,8 +456,8 @@ HRESULT DocumentHolder::InPlaceActivate(
if ( m_xOleAccess.is() )
{
LockedEmbedDocument_Impl aDocLock = m_xOleAccess->GetEmbedDocument();
if ( aDocLock.m_pEmbedDocument )
aDocLock.m_pEmbedDocument->ShowObject();
if ( aDocLock.GetEmbedDocument() )
aDocLock.GetEmbedDocument()->ShowObject();
}
// setTitle(m_aDocumentNamePart);
@@ -469,6 +470,7 @@ HRESULT DocumentHolder::InPlaceActivate(
{
hr = ERROR;
}
return hr;
}
@@ -509,8 +511,8 @@ void DocumentHolder::InPlaceDeactivate(void)
if ( m_xOleAccess.is() )
{
LockedEmbedDocument_Impl aDocLock = m_xOleAccess->GetEmbedDocument();
if ( aDocLock.m_pEmbedDocument )
aDocLock.m_pEmbedDocument->SaveObject();
if ( aDocLock.GetEmbedDocument() )
aDocLock.GetEmbedDocument()->SaveObject();
}
return;
@@ -953,7 +955,7 @@ void DocumentHolder::resizeWin( const SIZEL& rNewSize )
if ( m_xOleAccess.is() )
aDocLock = m_xOleAccess->GetEmbedDocument();
if ( m_xFrame.is() && aDocLock.m_pEmbedDocument )
if ( m_xFrame.is() && aDocLock.GetEmbedDocument() )
{
uno::Reference< awt::XWindow > xWindow(
m_xFrame->getContainerWindow(), uno::UNO_QUERY );
@@ -1529,8 +1531,8 @@ DocumentHolder::notifyClosing(
m_xFrame = uno::Reference< frame::XFrame >();
LockedEmbedDocument_Impl aDocLock = m_xOleAccess->GetEmbedDocument();
if ( aDocLock.m_pEmbedDocument )
aDocLock.m_pEmbedDocument->OLENotifyClosing();
if ( aDocLock.GetEmbedDocument() )
aDocLock.GetEmbedDocument()->OLENotifyClosing();
}
else if( m_xFrame.is() && m_xFrame == aSource.Source )
m_xFrame = uno::Reference< frame::XFrame >();
@@ -1570,8 +1572,8 @@ void SAL_CALL DocumentHolder::modified( const lang::EventObject& /*aEvent*/ )
if ( m_xOleAccess.is() )
{
LockedEmbedDocument_Impl aDocLock = m_xOleAccess->GetEmbedDocument();
if ( aDocLock.m_pEmbedDocument )
aDocLock.m_pEmbedDocument->notify();
if ( aDocLock.GetEmbedDocument() )
aDocLock.GetEmbedDocument()->notify();
}
}

View File

@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: ed_ioleobject.cxx,v $
* $Revision: 1.20 $
* $Revision: 1.20.10.1 $
*
* This file is part of OpenOffice.org.
*
@@ -73,26 +73,31 @@ STDMETHODIMP EmbedDocument_Impl::SetHostNames( LPCOLESTR szContainerApp, LPCOLES
STDMETHODIMP EmbedDocument_Impl::Close( DWORD dwSaveOption )
{
if ( dwSaveOption == 2 && m_aFileName.getLength() )
{
// ask the user about saving
if ( m_pDocHolder->ExecuteSuspendCloseFrame() )
{
m_pDocHolder->CloseDocument();
return S_OK;
}
else
return OLE_E_PROMPTSAVECANCELLED;
}
HRESULT hr = S_OK;
if ( dwSaveOption != 1 )
hr = SaveObject(); // ADVF_DATAONSTOP);
if ( m_pDocHolder->HasFrame() )
{
if ( dwSaveOption == 2 && m_aFileName.getLength() )
{
// ask the user about saving
if ( m_pDocHolder->ExecuteSuspendCloseFrame() )
{
m_pDocHolder->CloseDocument();
return S_OK;
}
else
return OLE_E_PROMPTSAVECANCELLED;
}
if ( dwSaveOption != 1 )
hr = SaveObject(); // ADVF_DATAONSTOP);
m_pDocHolder->CloseFrame();
OLENotifyDeactivation();
}
m_pDocHolder->FreeOffice();
m_pDocHolder->CloseDocument();
m_pDocHolder->CloseFrame();
OLENotifyClosing();
@@ -104,9 +109,6 @@ HRESULT EmbedDocument_Impl::OLENotifyClosing()
{
HRESULT hr = S_OK;
if ( m_pClientSite )
m_pClientSite->OnShowWindow( FALSE );
AdviseSinkHashMap aAHM(m_aAdviseHashMap);
for ( AdviseSinkHashMapIterator iAdvise = aAHM.begin();
@@ -258,7 +260,8 @@ STDMETHODIMP EmbedDocument_Impl::EnumVerbs( IEnumOLEVERB ** /*ppEnumOleVerb*/ )
STDMETHODIMP EmbedDocument_Impl::Update()
{
return S_OK;
HRESULT hr = CACHE_E_NOCACHE_UPDATED;
return hr;
}
STDMETHODIMP EmbedDocument_Impl::IsUpToDate()
@@ -398,6 +401,18 @@ STDMETHODIMP EmbedDocument_Impl::Invoke( DISPID dispIdMember,
return DISP_E_MEMBERNOTFOUND;
}
//-------------------------------------------------------------------------------
// IExternalConnection
DWORD STDMETHODCALLTYPE EmbedDocument_Impl::AddConnection( DWORD , DWORD )
{
return AddRef();
}
DWORD STDMETHODCALLTYPE EmbedDocument_Impl::ReleaseConnection( DWORD , DWORD , BOOL )
{
return Release();
}
// C++ - methods
@@ -454,9 +469,33 @@ void EmbedDocument_Impl::notify( bool bDataChanged )
m_pDAdviseHolder->SendOnDataChange( (IDataObject*)this, 0, 0 );
}
void EmbedDocument_Impl::Deactivate()
{
HRESULT hr = S_OK;
if ( m_pDocHolder->HasFrame() )
{
hr = SaveObject();
m_pDocHolder->CloseFrame();
OLENotifyDeactivation();
}
}
HRESULT EmbedDocument_Impl::OLENotifyDeactivation()
{
HRESULT hr = S_OK;
if ( m_pClientSite )
hr = m_pClientSite->OnShowWindow( FALSE );
return hr;
}
// Fix strange warnings about some
// ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions.
// warning C4505: 'xxx' : unreferenced local function has been removed
#if defined(_MSC_VER)
#pragma warning(disable: 4505)
#endif

View File

@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: ed_ipersiststr.cxx,v $
* $Revision: 1.27 $
* $Revision: 1.27.10.1 $
*
* This file is part of OpenOffice.org.
*
@@ -272,6 +272,7 @@ HRESULT EmbedDocument_Impl::SaveTo_Impl( IStorage* pStg )
CComPtr< IStream > pOrigOwn = m_pOwnStream;
CComPtr< IStream > pOrigExt = m_pExtStream;
HRESULT hr = Save( pStg, sal_False );
pStg->Commit( STGC_ONLYIFCURRENT );
m_pOwnStream = pOrigOwn;
m_pExtStream = pOrigExt;
@@ -295,6 +296,12 @@ STDMETHODIMP EmbedDocument_Impl::QueryInterface( REFIID riid, void FAR* FAR* ppv
*ppv = (IPersist*) (IPersistStorage*) this;
return S_OK;
}
else if (IsEqualIID(riid, IID_IExternalConnection))
{
AddRef();
*ppv = (IExternalConnection*) this;
return S_OK;
}
else if (IsEqualIID(riid, IID_IPersistStorage))
{
AddRef();
@@ -715,6 +722,10 @@ STDMETHODIMP EmbedDocument_Impl::SaveCompleted( IStorage *pStgNew )
&m_pExtStream );
if ( FAILED( hr ) || !m_pExtStream ) return E_OUTOFMEMORY;
sal_Bool bModified = sal_False;
uno::Reference< util::XModifiable > xMod( m_pDocHolder->GetDocument(), uno::UNO_QUERY );
if ( xMod.is() )
bModified = xMod->isModified();
for ( AdviseSinkHashMapIterator iAdvise = m_aAdviseHashMap.begin(); iAdvise != m_aAdviseHashMap.end(); iAdvise++ )
{
@@ -722,6 +733,9 @@ STDMETHODIMP EmbedDocument_Impl::SaveCompleted( IStorage *pStgNew )
iAdvise->second->OnSave();
}
if ( xMod.is() )
bModified = xMod->isModified();
return S_OK;
}
@@ -922,13 +936,8 @@ STDMETHODIMP EmbedDocument_Impl::GetCurFile( LPOLESTR *ppszFileName )
LockedEmbedDocument_Impl EmbeddedDocumentInstanceAccess_Impl::GetEmbedDocument()
{
LockedEmbedDocument_Impl aResult;
::osl::MutexGuard aGuard( m_aMutex );
aResult.m_pLocker = static_cast< IPersistStorage* >( m_pEmbedDocument );
aResult.m_pEmbedDocument = m_pEmbedDocument;
return aResult;
return LockedEmbedDocument_Impl( m_pEmbedDocument );
}
void EmbeddedDocumentInstanceAccess_Impl::ClearEmbedDocument()
@@ -937,9 +946,67 @@ void EmbeddedDocumentInstanceAccess_Impl::ClearEmbedDocument()
m_pEmbedDocument = NULL;
}
// ===============================================
LockedEmbedDocument_Impl::LockedEmbedDocument_Impl()
: m_pEmbedDocument( NULL )
{}
LockedEmbedDocument_Impl::LockedEmbedDocument_Impl( EmbedDocument_Impl* pEmbedDocument )
: m_pEmbedDocument( pEmbedDocument )
{
if ( m_pEmbedDocument )
m_pEmbedDocument->AddRef();
}
LockedEmbedDocument_Impl::LockedEmbedDocument_Impl( const LockedEmbedDocument_Impl& aDocLock )
: m_pEmbedDocument( aDocLock.m_pEmbedDocument )
{
if ( m_pEmbedDocument )
m_pEmbedDocument->AddRef();
}
LockedEmbedDocument_Impl& LockedEmbedDocument_Impl::operator=( const LockedEmbedDocument_Impl& aDocLock )
{
if ( m_pEmbedDocument )
m_pEmbedDocument->Release();
m_pEmbedDocument = aDocLock.m_pEmbedDocument;
if ( m_pEmbedDocument )
m_pEmbedDocument->AddRef();
return *this;
}
LockedEmbedDocument_Impl::~LockedEmbedDocument_Impl()
{
if ( m_pEmbedDocument )
m_pEmbedDocument->Release();
}
void LockedEmbedDocument_Impl::ExecuteMethod( sal_Int16 nId )
{
if ( m_pEmbedDocument )
{
if ( nId == OLESERV_SAVEOBJECT )
m_pEmbedDocument->SaveObject();
else if ( nId == OLESERV_CLOSE )
m_pEmbedDocument->Close( 0 );
else if ( nId == OLESERV_NOTIFY )
m_pEmbedDocument->notify();
else if ( nId == OLESERV_NOTIFYCLOSING )
m_pEmbedDocument->OLENotifyClosing();
else if ( nId == OLESERV_SHOWOBJECT )
m_pEmbedDocument->ShowObject();
else if ( nId == OLESERV_DEACTIVATE )
m_pEmbedDocument->Deactivate();
}
}
// Fix strange warnings about some
// ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions.
// warning C4505: 'xxx' : unreferenced local function has been removed
#if defined(_MSC_VER)
#pragma warning(disable: 4505)
#endif

View File

@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: intercept.cxx,v $
* $Revision: 1.14 $
* $Revision: 1.14.10.1 $
*
* This file is part of OpenOffice.org.
*
@@ -199,15 +199,15 @@ Interceptor::dispatch(
if ( xOleAccess.is() )
{
LockedEmbedDocument_Impl aDocLock = xOleAccess->GetEmbedDocument();
if ( aDocLock.m_pEmbedDocument )
if ( aDocLock.GetEmbedDocument() )
{
if( !m_bLink && URL.Complete == m_aInterceptedURL[0])
aDocLock.m_pEmbedDocument->SaveObject();
aDocLock.GetEmbedDocument()->SaveObject();
else if(!m_bLink
&& ( URL.Complete == m_aInterceptedURL[2] ||
URL.Complete == m_aInterceptedURL[3] ||
URL.Complete == m_aInterceptedURL[4] ) )
aDocLock.m_pEmbedDocument->Close( 0 );
&& ( URL.Complete == m_aInterceptedURL[2] ||
URL.Complete == m_aInterceptedURL[3] ||
URL.Complete == m_aInterceptedURL[4] ) )
aDocLock.GetEmbedDocument()->Close( 0 );
else if ( URL.Complete == m_aInterceptedURL[5] )
{
uno::Sequence< beans::PropertyValue > aNewArgs = Arguments;

View File

@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: common.h,v $
* $Revision: 1.6 $
* $Revision: 1.6.10.1 $
*
* This file is part of OpenOffice.org.
*
@@ -33,10 +33,13 @@
#include "stdafx.h"
#include <initguid.h>
#include <rtl/ustring.hxx>
#include <osl/interlck.h>
#include <comphelper/classids.hxx>
#include "embservconst.h"
namespace com { namespace sun { namespace star {
namespace lang {
class XMultiServiceFactory;
@@ -53,43 +56,4 @@ namespace com { namespace sun { namespace star {
}
} } }
const sal_Int32 nConstBufferSize = 32000;
#define SUPPORTED_FACTORIES_NUM 10
#ifdef __MINGW32__
#define DECLSPEC_SELECTANY
#endif
#if defined(__MINGW32__) && !defined(INITGUID)
EXTERN_C const GUID DECLSPEC_SELECTANY OID_WriterTextServer;
EXTERN_C const GUID DECLSPEC_SELECTANY OID_WriterOASISTextServer;
EXTERN_C const GUID DECLSPEC_SELECTANY OID_CalcServer;
EXTERN_C const GUID DECLSPEC_SELECTANY OID_CalcOASISServer;
EXTERN_C const GUID DECLSPEC_SELECTANY OID_DrawingServer;
EXTERN_C const GUID DECLSPEC_SELECTANY OID_DrawingOASISServer;
EXTERN_C const GUID DECLSPEC_SELECTANY OID_PresentationServer;
EXTERN_C const GUID DECLSPEC_SELECTANY OID_PresentationOASISServer;
EXTERN_C const GUID DECLSPEC_SELECTANY OID_MathServer;
EXTERN_C const GUID DECLSPEC_SELECTANY OID_MathOASISServer;
#else
EXTERN_C const GUID DECLSPEC_SELECTANY OID_WriterTextServer = { SO3_SW_OLE_EMBED_CLASSID_60 };
EXTERN_C const GUID DECLSPEC_SELECTANY OID_WriterOASISTextServer = { SO3_SW_OLE_EMBED_CLASSID_8 };
EXTERN_C const GUID DECLSPEC_SELECTANY OID_CalcServer = { SO3_SC_OLE_EMBED_CLASSID_60 };
EXTERN_C const GUID DECLSPEC_SELECTANY OID_CalcOASISServer = { SO3_SC_OLE_EMBED_CLASSID_8 };
EXTERN_C const GUID DECLSPEC_SELECTANY OID_DrawingServer = { SO3_SDRAW_OLE_EMBED_CLASSID_60 };
EXTERN_C const GUID DECLSPEC_SELECTANY OID_DrawingOASISServer = { SO3_SDRAW_OLE_EMBED_CLASSID_8 };
EXTERN_C const GUID DECLSPEC_SELECTANY OID_PresentationServer = { SO3_SIMPRESS_OLE_EMBED_CLASSID_60 };
EXTERN_C const GUID DECLSPEC_SELECTANY OID_PresentationOASISServer = { SO3_SIMPRESS_OLE_EMBED_CLASSID_8 };
EXTERN_C const GUID DECLSPEC_SELECTANY OID_MathServer = { SO3_SM_OLE_EMBED_CLASSID_60 };
EXTERN_C const GUID DECLSPEC_SELECTANY OID_MathOASISServer = { SO3_SM_OLE_EMBED_CLASSID_8 };
#endif
#endif

View File

@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: docholder.hxx,v $
* $Revision: 1.21 $
* $Revision: 1.21.10.1 $
*
* This file is part of OpenOffice.org.
*
@@ -184,6 +184,7 @@ public:
void OnPosRectChanged(LPRECT lpRect) const;
void show();
sal_Bool HasFrame() { return m_xFrame.is(); }
/** hides the document window, even in case of an external container
* side managed window.

View File

@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: embeddoc.hxx,v $
* $Revision: 1.18 $
* $Revision: 1.18.10.1 $
*
* This file is part of OpenOffice.org.
*
@@ -39,6 +39,7 @@
#include "common.h"
#include <oleidl.h>
#include <objidl.h>
#include <hash_map>
#include <com/sun/star/uno/Reference.h>
@@ -61,7 +62,8 @@ class EmbedDocument_Impl
public IOleObject,
public IOleInPlaceObject,
public IPersistFile,
public IDispatch
public IDispatch,
public IExternalConnection
{
protected:
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
@@ -150,6 +152,10 @@ public:
STDMETHOD(GetIDsOfNames) ( REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, LCID lcid, DISPID FAR* rgDispId );
STDMETHOD(Invoke) ( DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult, EXCEPINFO FAR* pExcepInfo, unsigned int FAR* puArgErr );
/* IExternalConnection methods */
virtual DWORD STDMETHODCALLTYPE AddConnection( DWORD extconn, DWORD reserved);
virtual DWORD STDMETHODCALLTYPE ReleaseConnection( DWORD extconn, DWORD reserved, BOOL fLastReleaseCloses);
// c++ - methods
void notify( bool bDataChanged = true );
@@ -158,6 +164,9 @@ public:
GUID GetGUID() const { return m_guid; }
HRESULT OLENotifyClosing();
void Deactivate();
HRESULT OLENotifyDeactivation();
protected:
oslInterlockedCount m_refCount;

View File

@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: embeddocaccess.hxx,v $
* $Revision: 1.5 $
* $Revision: 1.5.10.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,9 +31,14 @@
#ifndef _EMBEDDOCACCESS_HXX_
#define _EMBEDDOCACCESS_HXX_
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
#undef _DEBUG
#endif
#include <cppuhelper/weak.hxx>
#define OLESERV_SAVEOBJECT 1
#define OLESERV_CLOSE 2
#define OLESERV_NOTIFY 3
#define OLESERV_NOTIFYCLOSING 4
#define OLESERV_SHOWOBJECT 5
#define OLESERV_DEACTIVATE 6
#include <oleidl.h>
#ifndef __MINGW32__
@@ -49,8 +54,21 @@
class EmbedDocument_Impl;
struct LockedEmbedDocument_Impl
{
private:
EmbedDocument_Impl* m_pEmbedDocument;
CComPtr< IPersistStorage > m_pLocker;
public:
LockedEmbedDocument_Impl();
LockedEmbedDocument_Impl( EmbedDocument_Impl* pEmbedDocument );
LockedEmbedDocument_Impl( const LockedEmbedDocument_Impl& aDocLock );
~LockedEmbedDocument_Impl();
LockedEmbedDocument_Impl& operator=( const LockedEmbedDocument_Impl& aDocLock );
EmbedDocument_Impl* GetEmbedDocument() { return m_pEmbedDocument; }
void ExecuteMethod( sal_Int16 nId );
};
class EmbeddedDocumentInstanceAccess_Impl : public ::cppu::OWeakObject

View File

@@ -0,0 +1,89 @@
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: embservconst.h,v $
*
* $Revision: 1.1.8.2 $
*
* last change: $Author: mav $ $Date: 2008/10/30 11:59:06 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
************************************************************************/
#ifndef _EMBSERVCONST_H_
#define _EMBSERVCONST_H_
#include <initguid.h>
#ifndef _COMPHELPER_CLASSIDS_HXX
#include <comphelper/classids.hxx>
#endif
#ifndef _SAL_TYPES_H_
#include <sal/types.h>
#endif
const sal_Int32 nConstBufferSize = 32000;
#define SUPPORTED_FACTORIES_NUM 10
#ifdef __MINGW32__
#define DECLSPEC_SELECTANY
#endif
#if defined(__MINGW32__) && !defined(INITGUID)
EXTERN_C const GUID DECLSPEC_SELECTANY OID_WriterTextServer;
EXTERN_C const GUID DECLSPEC_SELECTANY OID_WriterOASISTextServer;
EXTERN_C const GUID DECLSPEC_SELECTANY OID_CalcServer;
EXTERN_C const GUID DECLSPEC_SELECTANY OID_CalcOASISServer;
EXTERN_C const GUID DECLSPEC_SELECTANY OID_DrawingServer;
EXTERN_C const GUID DECLSPEC_SELECTANY OID_DrawingOASISServer;
EXTERN_C const GUID DECLSPEC_SELECTANY OID_PresentationServer;
EXTERN_C const GUID DECLSPEC_SELECTANY OID_PresentationOASISServer;
EXTERN_C const GUID DECLSPEC_SELECTANY OID_MathServer;
EXTERN_C const GUID DECLSPEC_SELECTANY OID_MathOASISServer;
#else
EXTERN_C const GUID DECLSPEC_SELECTANY OID_WriterTextServer = { SO3_SW_OLE_EMBED_CLASSID_60 };
EXTERN_C const GUID DECLSPEC_SELECTANY OID_WriterOASISTextServer = { SO3_SW_OLE_EMBED_CLASSID_8 };
EXTERN_C const GUID DECLSPEC_SELECTANY OID_CalcServer = { SO3_SC_OLE_EMBED_CLASSID_60 };
EXTERN_C const GUID DECLSPEC_SELECTANY OID_CalcOASISServer = { SO3_SC_OLE_EMBED_CLASSID_8 };
EXTERN_C const GUID DECLSPEC_SELECTANY OID_DrawingServer = { SO3_SDRAW_OLE_EMBED_CLASSID_60 };
EXTERN_C const GUID DECLSPEC_SELECTANY OID_DrawingOASISServer = { SO3_SDRAW_OLE_EMBED_CLASSID_8 };
EXTERN_C const GUID DECLSPEC_SELECTANY OID_PresentationServer = { SO3_SIMPRESS_OLE_EMBED_CLASSID_60 };
EXTERN_C const GUID DECLSPEC_SELECTANY OID_PresentationOASISServer = { SO3_SIMPRESS_OLE_EMBED_CLASSID_8 };
EXTERN_C const GUID DECLSPEC_SELECTANY OID_MathServer = { SO3_SM_OLE_EMBED_CLASSID_60 };
EXTERN_C const GUID DECLSPEC_SELECTANY OID_MathOASISServer = { SO3_SM_OLE_EMBED_CLASSID_8 };
#endif
#endif

View File

@@ -0,0 +1,180 @@
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: advisesink.cxx,v $
*
* $Revision: 1.1.8.2 $
*
* last change: $Author: mav $ $Date: 2008/10/30 11:59:06 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
************************************************************************/
#pragma warning(disable : 4668)
#include <advisesink.hxx>
namespace inprocserv
{
OleWrapperAdviseSink::OleWrapperAdviseSink()
: m_nRefCount( 0 )
, m_pFormatEtc( NULL )
, m_nAspect( DVASPECT_CONTENT )
, m_nRegID( 0 )
, m_bObjectAdvise( TRUE )
, m_nDataRegFlag( 0 )
, m_nViewRegFlag( 0 )
, m_bHandleClosed( TRUE )
, m_bClosed( FALSE )
{
}
OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener )
: m_nRefCount( 0 )
, m_pListener( pListener )
, m_pFormatEtc( NULL )
, m_nAspect( DVASPECT_CONTENT )
, m_nRegID( 0 )
, m_bObjectAdvise( TRUE )
, m_nDataRegFlag( 0 )
, m_nViewRegFlag( 0 )
, m_bHandleClosed( FALSE )
, m_bClosed( FALSE )
{
}
OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, FORMATETC* pFormatEtc, DWORD nDataRegFlag )
: m_nRefCount( 0 )
, m_pListener( pListener )
, m_pFormatEtc( NULL )
, m_nAspect( DVASPECT_CONTENT )
, m_nRegID( 0 )
, m_bObjectAdvise( FALSE )
, m_nDataRegFlag( nDataRegFlag )
, m_nViewRegFlag( 0 )
, m_bHandleClosed( FALSE )
, m_bClosed( FALSE )
{
if ( pFormatEtc )
{
m_pFormatEtc = new FORMATETC;
m_pFormatEtc->cfFormat = pFormatEtc->cfFormat;
m_pFormatEtc->ptd = NULL;
m_pFormatEtc->dwAspect = pFormatEtc->dwAspect;
m_pFormatEtc->lindex = pFormatEtc->lindex;
m_pFormatEtc->tymed = pFormatEtc->tymed;
}
}
OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, DWORD nAspect, DWORD nViewRegFlag )
: m_nRefCount( 0 )
, m_pListener( pListener )
, m_pFormatEtc( NULL )
, m_nAspect( nAspect )
, m_nRegID( 0 )
, m_bObjectAdvise( TRUE )
, m_nDataRegFlag( 0 )
, m_nViewRegFlag( nViewRegFlag )
, m_bHandleClosed( FALSE )
, m_bClosed( FALSE )
{
}
OleWrapperAdviseSink::~OleWrapperAdviseSink()
{
if ( m_pFormatEtc )
delete m_pFormatEtc;
}
STDMETHODIMP OleWrapperAdviseSink::QueryInterface( REFIID riid , void** ppv )
{
*ppv=NULL;
if ( riid == IID_IUnknown )
*ppv = (IUnknown*)this;
if ( riid == IID_IAdviseSink )
*ppv = (IAdviseSink*)this;
if ( *ppv != NULL )
{
((IUnknown*)*ppv)->AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
STDMETHODIMP_(ULONG) OleWrapperAdviseSink::AddRef()
{
return ++m_nRefCount;
}
STDMETHODIMP_(ULONG) OleWrapperAdviseSink::Release()
{
ULONG nReturn = --m_nRefCount;
if ( m_nRefCount == 0 )
delete this;
return nReturn;
}
STDMETHODIMP_(void) OleWrapperAdviseSink::OnDataChange( LPFORMATETC pFetc, LPSTGMEDIUM pMedium )
{
if ( m_pListener )
m_pListener->OnDataChange( pFetc, pMedium );
}
STDMETHODIMP_(void) OleWrapperAdviseSink::OnViewChange( DWORD dwAspect, LONG lindex )
{
if ( m_pListener )
m_pListener->OnViewChange( dwAspect, lindex );
}
STDMETHODIMP_(void) OleWrapperAdviseSink::OnRename( LPMONIKER pMoniker )
{
if ( m_pListener )
m_pListener->OnRename( pMoniker );
}
STDMETHODIMP_(void) OleWrapperAdviseSink::OnSave(void)
{
if ( m_pListener )
m_pListener->OnSave();
}
STDMETHODIMP_(void) OleWrapperAdviseSink::OnClose(void)
{
if ( m_pListener )
m_pListener->OnClose();
if ( m_bHandleClosed )
m_bClosed = TRUE;
}
} // namespace inprocserv

View File

@@ -0,0 +1,102 @@
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: advisesink.hxx,v $
*
* $Revision: 1.1.8.2 $
*
* last change: $Author: mav $ $Date: 2008/10/30 11:59:06 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
************************************************************************/
#include <windows.h>
#include "smartpointer.hxx"
namespace inprocserv {
class OleWrapperAdviseSink : public IAdviseSink
{
protected:
ULONG m_nRefCount;
ComSmart< IAdviseSink > m_pListener;
DWORD m_nListenerID;
FORMATETC* m_pFormatEtc;
DWORD m_nAspect;
DWORD m_nRegID;
DWORD m_bObjectAdvise;
DWORD m_nDataRegFlag;
DWORD m_nViewRegFlag;
BOOL m_bHandleClosed;
BOOL m_bClosed;
public:
// an AdviseSink for own needs, should be created always
OleWrapperAdviseSink();
// an AdviseSink for IOleObject interface
OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener );
// an AdviseSink for IDataObject interface
OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, FORMATETC* pFormatEtc, DWORD nDataRegFlag );
// an AdviseSink for IViewObject interface
OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, DWORD nAspect, DWORD nViewRegFlag );
virtual ~OleWrapperAdviseSink();
void SetRegID( DWORD nRegID ) { m_nRegID = nRegID; }
DWORD GetRegID() { return m_nRegID; }
BOOL IsOleAdvise() { return m_bObjectAdvise; }
DWORD GetDataAdviseFlag() { return m_nDataRegFlag; }
DWORD GetViewAdviseFlag() { return m_nViewRegFlag; }
FORMATETC* GetFormatEtc() { return m_pFormatEtc; }
DWORD GetAspect() { return m_nAspect; }
ComSmart< IAdviseSink >& GetOrigAdvise() { return m_pListener; }
void SetClosed() { m_bClosed = TRUE; }
void UnsetClosed() { m_bClosed = FALSE; }
BOOL IsClosed() { return m_bClosed; }
STDMETHODIMP QueryInterface(REFIID, void**);
STDMETHODIMP_(ULONG) AddRef(void);
STDMETHODIMP_(ULONG) Release(void);
STDMETHODIMP_(void) OnDataChange(LPFORMATETC, LPSTGMEDIUM);
STDMETHODIMP_(void) OnViewChange(DWORD, LONG);
STDMETHODIMP_(void) OnRename(LPMONIKER);
STDMETHODIMP_(void) OnSave(void);
STDMETHODIMP_(void) OnClose(void);
};
}; // namespace advisesink

View File

@@ -0,0 +1,343 @@
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dllentry.cxx,v $
*
* $Revision: 1.1.8.2 $
*
* last change: $Author: mav $ $Date: 2008/10/30 11:59:06 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
************************************************************************/
#include <stdio.h>
#include <inprocembobj.h>
#include <embservconst.h>
static const GUID* guidList[ SUPPORTED_FACTORIES_NUM ] = {
&OID_WriterTextServer,
&OID_WriterOASISTextServer,
&OID_CalcServer,
&OID_CalcOASISServer,
&OID_DrawingServer,
&OID_DrawingOASISServer,
&OID_PresentationServer,
&OID_PresentationOASISServer,
&OID_MathServer,
&OID_MathOASISServer
};
static HINSTANCE g_hInstance = NULL;
static ULONG g_nObj = 0;
static ULONG g_nLock = 0;
namespace {
int GetStringFromClassID( const GUID& guid, char* pBuf, int nLen )
{
if ( nLen < 27 )
return 0;
int nResult = sprintf( pBuf,
"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
guid.Data1,
guid.Data2,
guid.Data3,
guid.Data4[0],
guid.Data4[1],
guid.Data4[2],
guid.Data4[3],
guid.Data4[4],
guid.Data4[5],
guid.Data4[6],
guid.Data4[7] );
if ( nResult && nResult < nLen )
return ++nResult;
return 0;
}
HRESULT WriteLibraryToRegistry( char* pLibrary, DWORD nLen )
{
HRESULT hRes = E_FAIL;
if ( pLibrary && nLen )
{
HKEY hKey = NULL;
char* pPrefix = "Software\\Classes\\CLSID\\";
char* pPostfix = "\\InprocHandler32";
hRes = S_OK;
for ( int nInd = 0; nInd < SUPPORTED_FACTORIES_NUM; nInd++ )
{
char pSubKey[513];
char pCLSID[64];
int nGuidLen = GetStringFromClassID( *guidList[nInd], pCLSID, 64 );
BOOL bLocalSuccess = FALSE;
if ( nGuidLen && nGuidLen < 64 )
{
pCLSID[nGuidLen] = 0;
sprintf( pSubKey, "%s%s%s", pPrefix, pCLSID, pPostfix );
if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, pSubKey, &hKey ) )
{
if ( ERROR_SUCCESS == RegSetValueEx( hKey, "", 0, REG_SZ, (const BYTE*)pLibrary, nLen ) )
bLocalSuccess = TRUE;
}
if ( hKey )
{
RegCloseKey( hKey );
hKey = NULL;
}
}
if ( !bLocalSuccess )
hRes = E_FAIL;
}
}
return hRes;
}
};
// ===========================
// InprocEmbedProvider_Impl declaration
// ===========================
namespace inprocserv
{
class InprocEmbedProvider_Impl : public IClassFactory, public InprocCountedObject_Impl
{
public:
InprocEmbedProvider_Impl( const GUID& guid );
virtual ~InprocEmbedProvider_Impl();
/* IUnknown methods */
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
/* IClassFactory methods */
STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv);
STDMETHOD(LockServer)(int fLock);
protected:
ULONG m_refCount;
GUID m_guid;
};
}; // namespace inprocserv
// ===========================
// Entry points
// ===========================
// -------------------------------------------------------------------------------
extern "C" BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/ )
{
if (dwReason == DLL_PROCESS_ATTACH)
{
g_hInstance = hInstance;
}
else if (dwReason == DLL_PROCESS_DETACH)
{
}
return TRUE; // ok
}
// -------------------------------------------------------------------------------
extern "C" STDAPI DllGetClassObject( REFCLSID rclsid, REFIID riid, LPVOID* ppv )
{
for( int nInd = 0; nInd < SUPPORTED_FACTORIES_NUM; nInd++ )
if ( *guidList[nInd] == rclsid )
{
if ( !IsEqualIID( riid, IID_IUnknown ) && !IsEqualIID( riid, IID_IClassFactory ) )
return E_NOINTERFACE;
*ppv = new inprocserv::InprocEmbedProvider_Impl( rclsid );
if ( *ppv == NULL )
return E_OUTOFMEMORY;
((LPUNKNOWN)*ppv)->AddRef();
return S_OK;
}
return E_FAIL;
}
// -------------------------------------------------------------------------------
extern "C" STDAPI DllCanUnloadNow()
{
if ( !g_nObj && !g_nLock )
return S_OK;
return S_FALSE;
}
// -------------------------------------------------------------------------------
STDAPI DllRegisterServer( void )
{
char aLibPath[1024];
HMODULE aCurModule = GetModuleHandleA( "inprocserv.dll" );
if( aCurModule )
{
DWORD nLen = GetModuleFileNameA( aCurModule, aLibPath, 1019 );
if ( nLen && nLen < 1019 )
{
aLibPath[nLen++] = 0;
return WriteLibraryToRegistry( aLibPath, nLen );
}
}
return E_FAIL;
}
// -------------------------------------------------------------------------------
STDAPI DllUnregisterServer( void )
{
return WriteLibraryToRegistry( "ole32.dll", 10 );
}
// ===========================
// End of entry points
// ===========================
namespace inprocserv
{
// ===========================
// InprocCountedObject_Impl implementation
// ===========================
// -------------------------------------------------------------------------------
InprocCountedObject_Impl::InprocCountedObject_Impl()
{
g_nObj++;
}
// -------------------------------------------------------------------------------
InprocCountedObject_Impl::~InprocCountedObject_Impl()
{
g_nObj--;
}
// ===========================
// InprocEmbedProvider_Impl implementation
// ===========================
// -------------------------------------------------------------------------------
InprocEmbedProvider_Impl::InprocEmbedProvider_Impl( const GUID& guid )
: m_refCount( 0 )
, m_guid( guid )
{
}
// -------------------------------------------------------------------------------
InprocEmbedProvider_Impl::~InprocEmbedProvider_Impl()
{
}
// IUnknown
// -------------------------------------------------------------------------------
STDMETHODIMP InprocEmbedProvider_Impl::QueryInterface( REFIID riid, void FAR* FAR* ppv )
{
if(IsEqualIID(riid, IID_IUnknown))
{
AddRef();
*ppv = (IUnknown*) this;
return S_OK;
}
else if (IsEqualIID(riid, IID_IClassFactory))
{
AddRef();
*ppv = (IClassFactory*) this;
return S_OK;
}
*ppv = NULL;
return E_NOINTERFACE;
}
// -------------------------------------------------------------------------------
STDMETHODIMP_(ULONG) InprocEmbedProvider_Impl::AddRef()
{
return ++m_refCount;
}
// -------------------------------------------------------------------------------
STDMETHODIMP_(ULONG) InprocEmbedProvider_Impl::Release()
{
sal_Int32 nCount = --m_refCount;
if ( nCount == 0 )
delete this;
return nCount;
}
// -------------------------------------------------------------------------------
STDMETHODIMP InprocEmbedProvider_Impl::CreateInstance(IUnknown FAR* punkOuter,
REFIID riid,
void FAR* FAR* ppv)
{
// TODO/LATER: should the aggregation be supported?
// if ( punkOuter != NULL && riid != IID_IUnknown )
// return E_NOINTERFACE;
if ( punkOuter != NULL )
return CLASS_E_NOAGGREGATION;
InprocEmbedDocument_Impl* pEmbedDocument = new InprocEmbedDocument_Impl( m_guid );
if ( !pEmbedDocument )
return E_OUTOFMEMORY;
pEmbedDocument->AddRef();
HRESULT hr = pEmbedDocument->Init();
if ( SUCCEEDED( hr ) )
hr = pEmbedDocument->QueryInterface( riid, ppv );
pEmbedDocument->Release();
if ( !SUCCEEDED( hr ) )
*ppv = NULL;
return hr;
}
// -------------------------------------------------------------------------------
STDMETHODIMP InprocEmbedProvider_Impl::LockServer( int fLock )
{
if ( fLock )
g_nLock++;
else
g_nLock--;
return S_OK;
}
}; // namespace inprocserv

View File

@@ -0,0 +1,5 @@
DllGetClassObject
DllCanUnloadNow
DllMain
DllRegisterServer
DllUnregisterServer

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,249 @@
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: inprocembobj.h,v $
*
* $Revision: 1.1.8.2 $
*
* last change: $Author: mav $ $Date: 2008/10/30 11:59:06 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
************************************************************************/
#ifndef _INPROCEMBOBJ_HXX_
#define _INPROCEMBOBJ_HXX_
#pragma warning(disable : 4668)
#include <windows.h>
#include <oleidl.h>
#include "smartpointer.hxx"
#include "advisesink.hxx"
#define DEFAULT_ARRAY_LEN 256
namespace inprocserv {
enum InitModes {
NOINIT,
INIT_FROM_STORAGE,
LOAD_FROM_STORAGE,
LOAD_FROM_FILE
};
// ==================================
// this is a common baseclass that is used to count the objects
// ==================================
class InprocCountedObject_Impl
{
public:
InprocCountedObject_Impl();
~InprocCountedObject_Impl();
};
// ==================================
// this is the inprocess embedded object implementation class
// ==================================
class InprocEmbedDocument_Impl : public InprocCountedObject_Impl
, public IOleObject
, public IDataObject
, public IPersistStorage
, public IPersistFile
, public IRunnableObject
, public IViewObject2
// , public IExternalConnection
, public IOleInPlaceObject
, public IDispatch
{
ULONG m_refCount;
BOOLEAN m_bDeleted;
GUID m_guid;
ComSmart< IUnknown > m_pDefHandler;
InitModes m_nInitMode;
DWORD m_nFileOpenMode;
wchar_t* m_pFileName;
ComSmart< IStorage > m_pStorage;
ComSmart< IOleClientSite > m_pClientSite;
ULONG m_nCallsOnStack;
// the listeners have wrappers that are directly connected to the object and call the listeners,
// the wrappers will be reconnected correctly to the new default inprocess holder object
ComSmart< OleWrapperAdviseSink > m_pOleAdvises[DEFAULT_ARRAY_LEN];
ComSmart< OleWrapperAdviseSink > m_pDataAdvises[DEFAULT_ARRAY_LEN];
ComSmart< OleWrapperAdviseSink > m_pViewAdvise;
class InternalCacheWrapper : public IOleCache2
{
InprocEmbedDocument_Impl& m_rOwnDocument;
public:
InternalCacheWrapper( InprocEmbedDocument_Impl& rOwnDocument )
: m_rOwnDocument( rOwnDocument )
{}
/* IUnknown methods */
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
/* IOleCache2 methods */
STDMETHOD(Cache)( FORMATETC *pformatetc, DWORD advf, DWORD *pdwConnection);
STDMETHOD(Uncache)( DWORD dwConnection);
STDMETHOD(EnumCache)( IEnumSTATDATA **ppenumSTATDATA);
STDMETHOD(InitCache)( IDataObject *pDataObject);
STDMETHOD(SetData)( FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease);
STDMETHOD(UpdateCache)( LPDATAOBJECT pDataObject, DWORD grfUpdf, LPVOID pReserved);
STDMETHOD(DiscardCache)( DWORD dwDiscardOptions);
} m_aInternalCache;
DWORD InsertAdviseLinkToList( const ComSmart<OleWrapperAdviseSink>& pOwnAdvise, ComSmart< OleWrapperAdviseSink > pAdvises[] );
void Clean();
public:
InprocEmbedDocument_Impl( const GUID& guid )
: m_refCount( 0 )
, m_bDeleted( FALSE )
, m_guid( guid )
, m_nInitMode( NOINIT )
, m_nFileOpenMode( 0 )
, m_pFileName( NULL )
, m_nCallsOnStack( 0 )
, m_aInternalCache( *this )
{}
virtual ~InprocEmbedDocument_Impl()
{}
HRESULT Init();
void SetFileName( LPCOLESTR pszFileName );
BOOL CheckDefHandler();
ComSmart< IUnknown >& GetDefHandler() { return m_pDefHandler; }
/* IUnknown methods */
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
/* IOleObject methods */
STDMETHOD(SetClientSite) ( IOleClientSite* pSite );
STDMETHOD(GetClientSite) ( IOleClientSite** pSite );
STDMETHOD(SetHostNames) ( LPCOLESTR szContainerApp, LPCOLESTR szContainerObj );
STDMETHOD(Close) ( DWORD dwSaveOption);
STDMETHOD(SetMoniker) ( DWORD dwWhichMoniker, IMoniker *pmk );
STDMETHOD(GetMoniker) ( DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk );
STDMETHOD(InitFromData) ( IDataObject *pDataObject, BOOL fCreation, DWORD dwReserved );
STDMETHOD(GetClipboardData) ( DWORD dwReserved, IDataObject **ppDataObject );
STDMETHOD(DoVerb) ( LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect );
STDMETHOD(EnumVerbs) ( IEnumOLEVERB **ppEnumOleVerb );
STDMETHOD(Update) ();
STDMETHOD(IsUpToDate) ();
STDMETHOD(GetUserClassID) ( CLSID *pClsid );
STDMETHOD(GetUserType) ( DWORD dwFormOfType, LPOLESTR *pszUserType );
STDMETHOD(SetExtent) ( DWORD dwDrawAspect, SIZEL *psizel );
STDMETHOD(GetExtent) ( DWORD dwDrawAspect, SIZEL *psizel );
STDMETHOD(Advise) ( IAdviseSink *pAdvSink, DWORD *pdwConnection );
STDMETHOD(Unadvise) ( DWORD dwConnection );
STDMETHOD(EnumAdvise) ( IEnumSTATDATA **ppenumAdvise );
STDMETHOD(GetMiscStatus) ( DWORD dwAspect, DWORD *pdwStatus );
STDMETHOD(SetColorScheme) ( LOGPALETTE *pLogpal );
/* IDataObject methods */
STDMETHOD(GetData) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium );
STDMETHOD(GetDataHere) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium );
STDMETHOD(QueryGetData) ( FORMATETC * pFormatetc );
STDMETHOD(GetCanonicalFormatEtc) ( FORMATETC * pFormatetcIn, FORMATETC * pFormatetcOut );
STDMETHOD(SetData) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium, BOOL fRelease );
STDMETHOD(EnumFormatEtc) ( DWORD dwDirection, IEnumFORMATETC ** ppFormatetc );
STDMETHOD(DAdvise) ( FORMATETC * pFormatetc, DWORD advf, IAdviseSink * pAdvSink, DWORD * pdwConnection );
STDMETHOD(DUnadvise) ( DWORD dwConnection );
STDMETHOD(EnumDAdvise) ( IEnumSTATDATA ** ppenumAdvise );
/* IPersistMethod */
STDMETHOD(GetClassID)(CLSID *pClassID);
/* IPersistStorage methods */
STDMETHOD(IsDirty) ();
STDMETHOD(InitNew) ( IStorage *pStg );
STDMETHOD(Load) ( IStorage* pStr );
STDMETHOD(Save) ( IStorage *pStgSave, BOOL fSameAsLoad );
STDMETHOD(SaveCompleted) ( IStorage *pStgNew );
STDMETHOD(HandsOffStorage) (void);
/* IPersistFile methods */
STDMETHOD(Load) ( LPCOLESTR pszFileName, DWORD dwMode );
STDMETHOD(Save) ( LPCOLESTR pszFileName, BOOL fRemember );
STDMETHOD(SaveCompleted) ( LPCOLESTR pszFileName );
STDMETHOD(GetCurFile) ( LPOLESTR *ppszFileName );
/* IRunnableObject methods */
STDMETHOD(GetRunningClass) ( LPCLSID lpClsid);
STDMETHOD(Run) ( LPBINDCTX pbc);
virtual BOOL STDMETHODCALLTYPE IsRunning( void);
STDMETHOD(LockRunning) ( BOOL fLock, BOOL fLastUnlockCloses );
STDMETHOD(SetContainedObject) ( BOOL fContained);
/* IViewObject2 methods */
STDMETHOD(Draw)( DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds, BOOL ( STDMETHODCALLTYPE *pfnContinue )( ULONG_PTR dwContinue ), ULONG_PTR dwContinue);
STDMETHOD(GetColorSet)( DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **ppColorSet);
STDMETHOD(Freeze)( DWORD dwDrawAspect, LONG lindex, void *pvAspect, DWORD *pdwFreeze);
STDMETHOD(Unfreeze)( DWORD dwFreeze);
STDMETHOD(SetAdvise)( DWORD aspects, DWORD advf, IAdviseSink *pAdvSink);
STDMETHOD(GetAdvise)( DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink);
STDMETHOD(GetExtent)( DWORD dwDrawAspect, LONG lindex, DVTARGETDEVICE *ptd, LPSIZEL lpsizel);
/* IOleWindow methods */
STDMETHOD(GetWindow)( HWND *phwnd);
STDMETHOD(ContextSensitiveHelp)( BOOL fEnterMode);
/* IOleInPlaceObject methods */
STDMETHOD(InPlaceDeactivate)( void);
STDMETHOD(UIDeactivate)( void);
STDMETHOD(SetObjectRects)( LPCRECT lprcPosRect, LPCRECT lprcClipRect);
STDMETHOD(ReactivateAndUndo)( void);
/*IDispatch methods*/
STDMETHOD(GetTypeInfoCount)( UINT *pctinfo);
STDMETHOD(GetTypeInfo)( UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo);
STDMETHOD(GetIDsOfNames)( REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId);
STDMETHOD(Invoke)( DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
};
} // namespace inprocserv
#endif

View File

@@ -0,0 +1,77 @@
#*************************************************************************
#
# OpenOffice.org - a multi-platform office productivity suite
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1.8.2 $
#
# last change: $Author: mav $ $Date: 2008/10/30 11:59:06 $
#
# The Contents of this file are made available subject to
# the terms of GNU Lesser General Public License Version 2.1.
#
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2005 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#*************************************************************************
PRJ=..$/..
PRJNAME=embedserv
TARGET=inprocserv
use_shl_versions=
# --- Settings ----------------------------------
.INCLUDE : settings.mk
.IF "$(GUI)" == "WNT"
VERSIONOBJ=
LIBTARGET=NO
USE_DEFFILE=YES
# --- Files -------------------------------------
SLOFILES=\
$(SLO)$/dllentry.obj \
$(SLO)$/advisesink.obj \
$(SLO)$/inprocembobj.obj
SHL1TARGET=$(TARGET)
SHL1STDLIBS=\
uuid.lib\
ole32.lib\
gdi32.lib\
advapi32.lib
SHL1OBJS=$(SLOFILES)
SHL1DEF=$(MISC)$/$(TARGET).def
DEF1NAME= $(TARGET)
DEF1EXPORTFILE= exports.dxp
.ENDIF
# --- Targets ----------------------------------
.INCLUDE : target.mk

View File

@@ -0,0 +1,189 @@
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: smartpointer.hxx,v $
*
* $Revision: 1.1.8.2 $
*
* last change: $Author: mav $ $Date: 2008/10/30 11:59:06 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
************************************************************************/
#ifndef _INPROCSERV_SMARTPOINTER_HXX_
#define _INPROCSERV_SMARTPOINTER_HXX_
namespace inprocserv{
template< class T > class ComSmart
{
T* m_pInterface;
void OwnRelease()
{
if ( m_pInterface )
{
T* pInterface = m_pInterface;
m_pInterface = NULL;
pInterface->Release();
}
}
public:
ComSmart()
: m_pInterface( NULL )
{}
ComSmart( const ComSmart<T>& rObj )
: m_pInterface( rObj.m_pInterface )
{
if ( m_pInterface != NULL )
m_pInterface->AddRef();
}
ComSmart( T* pInterface )
: m_pInterface( pInterface )
{
if ( m_pInterface != NULL )
m_pInterface->AddRef();
}
~ComSmart()
{
OwnRelease();
}
ComSmart& operator=( const ComSmart<T>& rObj )
{
OwnRelease();
m_pInterface = rObj.m_pInterface;
if ( m_pInterface != NULL )
m_pInterface->AddRef();
return *this;
}
ComSmart<T>& operator=( T* pInterface )
{
OwnRelease();
m_pInterface = pInterface;
if ( m_pInterface != NULL )
m_pInterface->AddRef();
return *this;
}
operator T*() const
{
return m_pInterface;
}
T& operator*() const
{
return *m_pInterface;
}
T** operator&()
{
OwnRelease();
m_pInterface = NULL;
return &m_pInterface;
}
T* operator->() const
{
return m_pInterface;
}
BOOL operator==( const ComSmart<T>& rObj ) const
{
return ( m_pInterface == rObj.m_pInterface );
}
BOOL operator!=( const ComSmart<T>& rObj ) const
{
return ( m_pInterface != rObj.m_pInterface );
}
BOOL operator==( const T* pInterface ) const
{
return ( m_pInterface == pInterface );
}
BOOL operator!=( const T* pInterface ) const
{
return ( m_pInterface != pInterface );
}
};
class CSGuard
{
CRITICAL_SECTION* m_pCriticalSection;
public:
CSGuard( CRITICAL_SECTION* pCS )
: m_pCriticalSection( pCS )
{
if ( m_pCriticalSection )
EnterCriticalSection( m_pCriticalSection );
}
~CSGuard()
{
if ( m_pCriticalSection )
LeaveCriticalSection( m_pCriticalSection );
}
};
class ULONGGuard
{
ULONG* m_pValue;
public:
ULONGGuard( ULONG* pValue )
: m_pValue( pValue )
{
if ( m_pValue )
(*m_pValue)++;
}
~ULONGGuard()
{
if ( m_pValue )
(*m_pValue)--;
}
};
} // namespace inprocserv
#endif