From a934115b3ea90d7883681a6ca8922a4b859be36f Mon Sep 17 00:00:00 2001 From: Mikhail Voitenko Date: Wed, 5 Mar 2003 14:50:11 +0000 Subject: Initial revision --- embedserv/source/inc/common.h | 120 ++++++++++++++++++++++++++++ embedserv/source/inc/embeddoc.hxx | 164 ++++++++++++++++++++++++++++++++++++++ embedserv/source/inc/servprov.hxx | 142 +++++++++++++++++++++++++++++++++ embedserv/source/inc/stdafx.h | 26 ++++++ 4 files changed, 452 insertions(+) create mode 100755 embedserv/source/inc/common.h create mode 100755 embedserv/source/inc/embeddoc.hxx create mode 100755 embedserv/source/inc/servprov.hxx create mode 100755 embedserv/source/inc/stdafx.h (limited to 'embedserv/source/inc') diff --git a/embedserv/source/inc/common.h b/embedserv/source/inc/common.h new file mode 100755 index 000000000000..f61bb4228cf9 --- /dev/null +++ b/embedserv/source/inc/common.h @@ -0,0 +1,120 @@ +/************************************************************************* + * + * $RCSfile: common.h,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: mav $ $Date: 2003-03-05 15:49:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 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 + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _COMMON_H_ +#define _COMMON_H_ + +#include "stdafx.h" +#include + +#ifndef _RTL_USTRING_HXX_ +#include +#endif + +#ifndef _OSL_INTERLOCK_H_ +#include +#endif + +#define SUPPORTED_FACTORIES_NUM 7 + +namespace com { namespace sun { namespace star { + namespace lang { + class XMultiServiceFactory; + } + namespace frame { + class XModel; + } + namespace beans { + struct PropertyValue; + } + namespace io { + class XInputStream; + class XOutputStream; + } +} } } + +const sal_Int32 nConstBufferSize = 32000; + + +// {30A2652A-DDF7-45e7-ACA6-3EAB26FC8A4E} +DEFINE_GUID(OID_WriterTextServer, 0x30a2652a, 0xddf7, 0x45e7, 0xac, 0xa6, 0x3e, 0xab, 0x26, 0xfc, 0x8a, 0x4e ); + +// {43FEEA23-228B-4726-AFFE-214598F47289} +DEFINE_GUID(OID_WriterWebServer, 0x43feea23, 0x228b, 0x4726, 0xaf, 0xfe, 0x21, 0x45, 0x98, 0xf4, 0x72, 0x89 ); + +// {1386E9B2-8706-438b-BF51-5CA7864770C5} +DEFINE_GUID(OID_WriterGlobalServer, 0x1386e9b2, 0x8706, 0x438b, 0xbf, 0x51, 0x5c, 0xa7, 0x86, 0x47, 0x70, 0xc5 ); + +// {7B342DC4-139A-4a46-8A93-DB0827CCEE9C} +DEFINE_GUID(OID_CalcServer, 0x7b342dc4, 0x139a, 0x4a46, 0x8a, 0x93, 0xdb, 0x8, 0x27, 0xcc, 0xee, 0x9c ); + +// {41662FC2-0D57-4aff-AB27-AD2E12E7C273} +DEFINE_GUID(OID_DrawingServer, 0x41662fc2, 0xd57, 0x4aff, 0xab, 0x27, 0xad, 0x2e, 0x12, 0xe7, 0xc2, 0x73 ); + +// {E5A0B632-DFBA-4549-9346-E414DA06E6F8} +DEFINE_GUID(OID_PresentationServer, 0xe5a0b632, 0xdfba, 0x4549, 0x93, 0x46, 0xe4, 0x14, 0xda, 0x6, 0xe6, 0xf8 ); + +// {D0484DE6-AAEE-468a-991F-8D4B0737B57A} +DEFINE_GUID(OID_MathServer, 0xd0484de6, 0xaaee, 0x468a, 0x99, 0x1f, 0x8d, 0x4b, 0x7, 0x37, 0xb5, 0x7a ); + + +#endif + diff --git a/embedserv/source/inc/embeddoc.hxx b/embedserv/source/inc/embeddoc.hxx new file mode 100755 index 000000000000..e581ce904326 --- /dev/null +++ b/embedserv/source/inc/embeddoc.hxx @@ -0,0 +1,164 @@ +/************************************************************************* + * + * $RCSfile: embeddoc.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: mav $ $Date: 2003-03-05 15:49:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 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 + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _EMBEDDOC_HXX_ +#define _EMBEDDOC_HXX_ + +#include "common.h" +#include + +#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ +#include +#endif +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_ +#include +#endif + + +class GDIMetaFile; + +class EmbedDocument_Impl : public IPersistStorage + , public IDataObject + , public IOleObject +{ +protected: + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > + fillArgsForLoading_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xStream, + DWORD nStreamMode ); + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > + fillArgsForStoring_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xStream ); + + HRESULT SaveTo_Impl( IStorage* pStg ); + + sal_uInt64 getMetaFileHandle_Impl( sal_Bool isEnhMeta ); + +public: + EmbedDocument_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& smgr, + const GUID* guid ); + ~EmbedDocument_Impl(); + + /* IUnknown methods */ + STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj); + STDMETHOD_(ULONG, AddRef)(); + STDMETHOD_(ULONG, Release)(); + + /* 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); + + /* 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 ); + + /* 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 ); + +protected: + oslInterlockedCount m_refCount; + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDocument; + + CComPtr< IStorage > m_pMasterStorage; + CComPtr< IStream > m_pOwnStream; + GUID m_guid; + + sal_Bool m_bIsDirty; + + CComPtr< IOleClientSite > m_pClientSite; +}; + +#endif //_EMBEDDOC_HXX_ + diff --git a/embedserv/source/inc/servprov.hxx b/embedserv/source/inc/servprov.hxx new file mode 100755 index 000000000000..8a4f1ccf581c --- /dev/null +++ b/embedserv/source/inc/servprov.hxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * $RCSfile: servprov.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: mav $ $Date: 2003-03-05 15:49:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 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 + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SERVPROV_HXX +#define _SERVPROV_HXX + +#include "common.h" +#include + +#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ +#include +#endif +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_ +#include +#endif + +#ifndef _COM_SUN_STAR_UNO_XINTERFACE_HPP_ +#include +#endif +#ifndef __COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include +#endif + + +class EmbedProviderFactory_Impl; + +class EmbedServer_Impl : public ::cppu::OWeakObject, ::com::sun::star::lang::XTypeProvider +{ +public: + EmbedServer_Impl( const ::com::sun::star::uno::Reference<::com::sun::star::lang::XMultiServiceFactory> &xFactory ); + ~EmbedServer_Impl(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL release() throw (::com::sun::star::uno::RuntimeException); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw(::com::sun::star::uno::RuntimeException); + +protected: + + CComPtr< EmbedProviderFactory_Impl > m_pOLEFactories[ SUPPORTED_FACTORIES_NUM ]; + ::com::sun::star::uno::Reference<::com::sun::star::lang::XMultiServiceFactory> m_xFactory; +}; + +class EmbedProviderFactory_Impl : public IClassFactory +{ +public: + + EmbedProviderFactory_Impl( const ::com::sun::star::uno::Reference<::com::sun::star::lang::XMultiServiceFactory>& xFactory, const GUID* pGuid); + ~EmbedProviderFactory_Impl(); + + sal_Bool registerClass(); + sal_Bool deregisterClass(); + + /* 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: + + oslInterlockedCount m_refCount; + GUID m_guid; + DWORD m_factoryHandle; + + ::com::sun::star::uno::Reference<::com::sun::star::lang::XMultiServiceFactory> m_xFactory; +}; + +#endif + diff --git a/embedserv/source/inc/stdafx.h b/embedserv/source/inc/stdafx.h new file mode 100755 index 000000000000..51530f054cd8 --- /dev/null +++ b/embedserv/source/inc/stdafx.h @@ -0,0 +1,26 @@ +#if !defined(AFX_STDAFX_H_) +#define AFX_STDAFX_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define STRICT +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0400 +#endif +#define _ATL_APARTMENT_THREADED +// #define _ATL_STATIC_REGISTRY + +#include +//You may derive a class from CComModule and use it if you want to override +//something, but do not change the name of _Module +extern CComModule _Module; +#include +#include + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif + -- cgit v1.2.3