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

Initial revision

üst 43a73f08
This diff is collapsed.
/*************************************************************************
*
* $RCSfile: ed_ioleobject.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: mav $ $Date: 2003-03-05 15:50:09 $
*
* 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): _______________________________________
*
*
************************************************************************/
#include "embeddoc.hxx"
STDMETHODIMP EmbedDocument_Impl::SetClientSite( IOleClientSite* pSite )
{
m_pClientSite = pSite;
return S_OK;
}
STDMETHODIMP EmbedDocument_Impl::GetClientSite( IOleClientSite** pSite )
{
*pSite = m_pClientSite;
return S_OK;
}
STDMETHODIMP EmbedDocument_Impl::SetHostNames( LPCOLESTR szContainerApp, LPCOLESTR szContainerObj )
{
return S_OK;
}
STDMETHODIMP EmbedDocument_Impl::Close( DWORD dwSaveOption)
{
return S_OK;
}
STDMETHODIMP EmbedDocument_Impl::SetMoniker( DWORD dwWhichMoniker, IMoniker *pmk )
{
return E_NOTIMPL;
}
STDMETHODIMP EmbedDocument_Impl::GetMoniker( DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk )
{
return E_NOTIMPL;
}
STDMETHODIMP EmbedDocument_Impl::InitFromData( IDataObject *pDataObject, BOOL fCreation, DWORD dwReserved )
{
return E_NOTIMPL;
}
STDMETHODIMP EmbedDocument_Impl::GetClipboardData( DWORD dwReserved, IDataObject **ppDataObject )
{
return E_NOTIMPL;
}
STDMETHODIMP EmbedDocument_Impl::DoVerb( LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect )
{
if ( iVerb == OLEIVERB_PRIMARY || iVerb == OLEIVERB_OPEN || iVerb == OLEIVERB_SHOW )
return S_OK;
return E_NOTIMPL;
}
STDMETHODIMP EmbedDocument_Impl::EnumVerbs( IEnumOLEVERB **ppEnumOleVerb )
{
return OLE_S_USEREG;
}
STDMETHODIMP EmbedDocument_Impl::Update()
{
return S_OK;
}
STDMETHODIMP EmbedDocument_Impl::IsUpToDate()
{
return S_OK;
}
STDMETHODIMP EmbedDocument_Impl::GetUserClassID( CLSID *pClsid )
{
return GetClassID( pClsid );
}
STDMETHODIMP EmbedDocument_Impl::GetUserType( DWORD dwFormOfType, LPOLESTR *pszUserType )
{
return OLE_S_USEREG;
}
STDMETHODIMP EmbedDocument_Impl::SetExtent( DWORD dwDrawAspect, SIZEL *psizel )
{
return E_NOTIMPL;
}
STDMETHODIMP EmbedDocument_Impl::GetExtent( DWORD dwDrawAspect, SIZEL *psizel )
{
if ( psizel )
{
psizel->cx = 10000;
psizel->cy = 10000;
}
return S_OK;
}
STDMETHODIMP EmbedDocument_Impl::Advise( IAdviseSink *pAdvSink, DWORD *pdwConnection )
{
return S_OK;
}
STDMETHODIMP EmbedDocument_Impl::Unadvise( DWORD dwConnection )
{
return S_OK;
}
STDMETHODIMP EmbedDocument_Impl::EnumAdvise( IEnumSTATDATA **ppenumAdvise )
{
return E_NOTIMPL;
}
STDMETHODIMP EmbedDocument_Impl::GetMiscStatus( DWORD dwAspect, DWORD *pdwStatus )
{
return OLE_S_USEREG;
}
STDMETHODIMP EmbedDocument_Impl::SetColorScheme( LOGPALETTE *pLogpal )
{
return E_NOTIMPL;
}
This diff is collapsed.
/*************************************************************************
*
* $RCSfile: esdll.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: mav $ $Date: 2003-03-05 15:50:10 $
*
* 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): _______________________________________
*
*
************************************************************************/
#define STRICT
#define _WIN32_WINNT 0x0400
#define _WIN32_DCOM
#include <atlbase.h>
CComModule _Module;
#include <atlcom.h>
BEGIN_OBJECT_MAP(ObjectMap)
END_OBJECT_MAP()
/////////////////////////////////////////////////////////////////////////////
// DLL Entry Point
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
_Module.Init(ObjectMap, hInstance, NULL);
DisableThreadLibraryCalls(hInstance);
}
else if (dwReason == DLL_PROCESS_DETACH)
{
_Module.Term();
}
return TRUE; // ok
}
/*************************************************************************
*
* $RCSfile: guid.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: mav $ $Date: 2003-03-05 15:50:10 $
*
* 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): _______________________________________
*
*
************************************************************************/
#include "common.h"
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
#endif
::rtl::OUString getServiceNameFromGUID_Impl( GUID* guid )
{
if ( *guid == OID_WriterTextServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.TextDocument" ) );
if ( *guid == OID_WriterWebServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.WebDocument" ) );
if ( *guid == OID_WriterGlobalServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.GlobalDocument" ) );
if ( *guid == OID_CalcServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Calc.SpreadsheetDocument" ) );
if ( *guid == OID_DrawingServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.DrawingDocument" ) );
if ( *guid == OID_PresentationServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.PresentationDocument" ) );
if ( *guid == OID_MathServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Math.FormulaDocument" ) );
return ::rtl::OUString();
}
::rtl::OUString getFilterNameFromGUID_Impl( GUID* guid )
{
if ( *guid == OID_WriterTextServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Writer)" ) );
if ( *guid == OID_WriterWebServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "HTML" ) );
if ( *guid == OID_WriterGlobalServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "writer_globaldocument_StarOffice_XML_Writer_GlobalDocument" ) );
if ( *guid == OID_CalcServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Calc)" ) );
if ( *guid == OID_DrawingServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Draw)" ) );
if ( *guid == OID_PresentationServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Impress)" ) );
if ( *guid == OID_MathServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Math)" ) );
return ::rtl::OUString();
}
/*
::rtl::OUString getCurTypeNameFromGUID_Impl( const uno::Reference< lang::XMultiServiceFactory > xFactory, GUID* guid )
{
::rtl::OUString aResult;
const ::rtl::OUString aServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.document.FilterFactory" ) );
uno::Reference < container::XNameAccess > xFilters = uno::Reference < io::XOutputStream > (
xFactory->createInstance ( aServiceName ),
uno::UNO_QUERY );
if ( xFilters.is() )
{
::rtl::OUString aFilterName = getFilterNameFromGUID_Impl( guid );
if ( aFilterName.getLength() )
{
uno::Any aAnyProp = xFilters->getByName( aFilterName );
uno::Sequence< beans::PropertyValue > aProperties;
if ( aAnyProp >>= aProperties ) )
{
for ( sal_Int32 nInd = 0; nInd < aProperties.getLength; nInd++ )
if ( aProperties[nInd].Name.equalsAscii( "UIName" )
{
aProperties[nInd].Value >>= aResult;
break;
}
}
}
}
return aResult;
}
*/
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1 $
#
# last change: $Author: mav $ $Date: 2003-03-05 15:50:09 $
#
# 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): _______________________________________
#
#
#
#*************************************************************************
#MKDEPENDSOLVER=YES
PRJ=..$/..
PRJNAME=embedserv
TARGET=emser
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
#.INCLUDE : $(PRJ)$/util$/makefile.pmk
LIBTARGET=NO
USE_DEFFILE=NO
INCPRE+= $(SOLARINCDIR)$/external$/atl
# --- Files --------------------------------------------------------
SLOFILES = \
$(SLO)$/register.obj \
$(SLO)$/servprov.obj \
$(SLO)$/ed_ipersiststr.obj \
$(SLO)$/ed_idataobj.obj \
$(SLO)$/ed_ioleobject.obj \
$(SLO)$/guid.obj \
$(SLO)$/esdll.obj
EXCEPTIONSFILES= \
$(SLO)$/register.obj \
$(SLO)$/ed_ipersiststr.obj \
$(SLO)$/ed_idataobj.obj
# --- Targets -------------------------------------------------------
.INCLUDE : target.mk
/*************************************************************************
*
* $RCSfile: register.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: mav $ $Date: 2003-03-05 15:50:11 $
*
* 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): _______________________________________
*
*
************************************************************************/
//#include <rtl/unload.h>
//#include <osl/time.h>
#include "servprov.hxx"
#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_
#include <com/sun/star/registry/XRegistryKey.hpp>
#endif
#ifndef _COM_SUN_STAR_REGISTRY_INVALIDREGISTRYEXCEPTION_HPP_
#include <com/sun/star/registry/InvalidRegistryException.hpp>
#endif
#ifndef _RTL_USTRING_
#include <rtl/ustring>
#endif
#ifndef _CPPUHELPER_FACTORY_HXX_
#include <cppuhelper/factory.hxx>
#endif
using namespace ::com::sun::star;
uno::Reference<uno::XInterface> SAL_CALL EmbedServer_createInstance(
const uno::Reference<lang::XMultiServiceFactory> & xSMgr)
throw (uno::Exception)
{
uno::Reference<uno::XInterface > xService = *new EmbedServer_Impl( xSMgr );
return xService;
}
::rtl::OUString SAL_CALL EmbedServer_getImplementationName() throw()
{
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.EmbedServer") );
}
uno::Sequence< ::rtl::OUString > SAL_CALL EmbedServer_getSupportedServiceNames() throw()
{
uno::Sequence< ::rtl::OUString > aServiceNames( 1 );
aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.bridge.OleApplicationRegistration" ) );
return aServiceNames;
}
extern "C" {
void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
{
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
void * pRet = 0;
::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplName ) );
uno::Reference< lang::XSingleServiceFactory > xFactory;
if(pServiceManager && aImplName.equals( EmbedServer_getImplementationName() ) )
{
xFactory= ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>(pServiceManager),
EmbedServer_getImplementationName(),
EmbedServer_createInstance,
EmbedServer_getSupportedServiceNames() );
}
if (xFactory.is())
{
xFactory->acquire();
pRet = xFactory.get();
}
return pRet;
}
sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryKey )
{
if (pRegistryKey)
{
try
{
uno::Reference< registry::XRegistryKey > xKey( reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ) );
uno::Reference< registry::XRegistryKey > xNewKey;
xNewKey = xKey->createKey( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) +
EmbedServer_getImplementationName() +
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) );
uno::Sequence< ::rtl::OUString > &rServices = EmbedServer_getSupportedServiceNames();
for( sal_Int32 ind = 0; ind < rServices.getLength(); ind++ )
xNewKey->createKey( rServices.getConstArray()[ind] );
return sal_True;
}
catch (registry::InvalidRegistryException &)
{
OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
}
}
return sal_False;
}
} // extern "C"
/*************************************************************************
*
* $RCSfile: servprov.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: mav $ $Date: 2003-03-05 15:50:11 $
*
* 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): _______________________________________
*
*
************************************************************************/
#include "servprov.hxx"
#include "embeddoc.hxx"
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
#include <cppuhelper/typeprovider.hxx>
#endif
#ifndef _OSL_MUTEX_HXX_
#include <osl/mutex.hxx>
#endif
#include <vos/thread.hxx>
using namespace com::sun::star;
const GUID* guidList[ SUPPORTED_FACTORIES_NUM ] = {
&OID_WriterTextServer,
&OID_WriterWebServer,
&OID_WriterGlobalServer,
&OID_CalcServer,
&OID_DrawingServer,
&OID_PresentationServer,
&OID_MathServer
};
// CoInitializeEx *
typedef DECLSPEC_IMPORT HRESULT (STDAPICALLTYPE *ptrCoInitEx)( LPVOID, DWORD);
// CoInitialize *
typedef DECLSPEC_IMPORT HRESULT (STDAPICALLTYPE *ptrCoInit)( LPVOID);
void o2u_attachCurrentThread()
{
static ::vos::OThreadData oleThreadData;
if ((sal_Bool)oleThreadData.getData() != sal_True)
{
HINSTANCE inst= LoadLibrary( _T("ole32.dll"));
if( inst )
{
HRESULT hr;
ptrCoInitEx initFuncEx= (ptrCoInitEx)GetProcAddress( inst, _T("CoInitializeEx"));
if( initFuncEx)
hr= initFuncEx( NULL, COINIT_MULTITHREADED);
else
{
ptrCoInit initFunc= (ptrCoInit)GetProcAddress( inst,_T("CoInitialize"));
if( initFunc)
hr= initFunc( NULL);
}
}
oleThreadData.setData((void*)sal_True);
}
}
//===============================================================================
// EmbedServer_Impl
EmbedServer_Impl::EmbedServer_Impl( const uno::Reference<lang::XMultiServiceFactory>& xFactory):
m_xFactory( xFactory)
{
for( int nInd = 0; nInd < SUPPORTED_FACTORIES_NUM; nInd++ )
{
m_pOLEFactories[nInd] = new EmbedProviderFactory_Impl( m_xFactory, guidList[nInd] );
m_pOLEFactories[nInd]->registerClass();
}
}
EmbedServer_Impl::~EmbedServer_Impl()
{
for( int nInd = 0; nInd < SUPPORTED_FACTORIES_NUM; nInd++ )
{
if ( m_pOLEFactories[nInd] )
m_pOLEFactories[nInd]->deregisterClass();
}
}
// XInterface --------------------------------------------------
uno::Any SAL_CALL EmbedServer_Impl::queryInterface( const uno::Type& aType ) throw(uno::RuntimeException)
{
uno::Any a= ::cppu::queryInterface( aType, static_cast<lang::XTypeProvider*>(this));
if( a == uno::Any())
return OWeakObject::queryInterface( aType);
else
return a;
}
void SAL_CALL EmbedServer_Impl::acquire( ) throw(uno::RuntimeException)
{
OWeakObject::acquire();
}
void SAL_CALL EmbedServer_Impl::release( ) throw (uno::RuntimeException)
{
OWeakObject::release();
}
// XTypeProvider --------------------------------------------------
uno::Sequence< uno::Type > SAL_CALL EmbedServer_Impl::getTypes( ) throw(uno::RuntimeException)
{
static ::cppu::OTypeCollection *pCollection = 0;
if( ! pCollection )
{
::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
if( ! pCollection )
{
static ::cppu::OTypeCollection collection(
getCppuType(reinterpret_cast< uno::Reference< uno::XWeak>*>(0)),
getCppuType(reinterpret_cast< uno::Reference< lang::XTypeProvider>*>(0)) );
pCollection = &collection;
}
}
return (*pCollection).getTypes();
}
uno::Sequence< sal_Int8 > SAL_CALL EmbedServer_Impl::getImplementationId() throw(uno::RuntimeException)
{
static ::cppu::OImplementationId *pId = 0;
if( ! pId )
{
::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
if( ! pId )
{
static ::cppu::OImplementationId id( sal_False );
pId = &id;
}
}
return (*pId).getImplementationId();
}
//===============================================================================
// EmbedProviderFactory_Impl
EmbedProviderFactory_Impl::EmbedProviderFactory_Impl(const uno::Reference<lang::XMultiServiceFactory>& xFactory, const GUID* pGuid)
: m_refCount( 0L )
, m_xFactory( xFactory )
, m_guid( *pGuid )
{
}
EmbedProviderFactory_Impl::~EmbedProviderFactory_Impl()
{
}
sal_Bool EmbedProviderFactory_Impl::registerClass()
{
HRESULT hresult;
o2u_attachCurrentThread();
hresult = CoRegisterClassObject(
m_guid,
this,
CLSCTX_LOCAL_SERVER,
REGCLS_MULTIPLEUSE,
&m_factoryHandle);
return (hresult == NOERROR);
}
sal_Bool EmbedProviderFactory_Impl::deregisterClass()
{
HRESULT hresult = CoRevokeClassObject( m_factoryHandle );
return (hresult == NOERROR);
}
STDMETHODIMP EmbedProviderFactory_Impl::QueryInterface(REFIID riid, void FAR* FAR* ppv)
{
if(IsEqualIID(riid, IID_IUnknown))
{
AddRef();
*ppv = (IUnknown*) (IClassFactory*) this;
return NOERROR;
}
else if (IsEqualIID(riid, IID_IClassFactory))
{
AddRef();
*ppv = (IClassFactory*) this;
return NOERROR;
}
*ppv = NULL;
return ResultFromScode(E_NOINTERFACE);
}
STDMETHODIMP_(ULONG) EmbedProviderFactory_Impl::AddRef()
{
return osl_incrementInterlockedCount( &m_refCount);
}
STDMETHODIMP_(ULONG) EmbedProviderFactory_Impl::Release()
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex());
m_refCount--;
if (m_refCount == 0)
{
delete this;
}
return m_refCount;
}
STDMETHODIMP EmbedProviderFactory_Impl::CreateInstance(IUnknown FAR* punkOuter,
REFIID riid,
void FAR* FAR* ppv)
{
punkOuter = NULL;
IUnknown* pEmbedDocument = (IUnknown*)(IPersistStorage*)( new EmbedDocument_Impl( m_xFactory, &m_guid ) );
return pEmbedDocument->QueryInterface( riid, ppv );
}
STDMETHODIMP EmbedProviderFactory_Impl::LockServer( int fLock )
{
return NOERROR;
}
// stdafx1.cpp : source file that includes just the standard includes
// stdafx1.pch will be the pre-compiled header
// stdafx1.obj will contain the pre-compiled type information
#include "stdafx2.h"
#ifdef _ATL_STATIC_REGISTRY
#include <statreg.h>
#include <statreg.cpp>
#endif
#include <atlimpl.cpp>
/*************************************************************************
*
* $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 <initguid.h>
#ifndef _RTL_USTRING_HXX_
#include <rtl/ustring.hxx>
#endif
#ifndef _OSL_INTERLOCK_H_
#include <osl/interlck.h>
#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
/*************************************************************************
*
* $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 <oleidl.h>
#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
#include <com/sun/star/uno/Reference.h>
#endif
#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
#include <com/sun/star/uno/SEQUENCE.h>
#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_
/*************************************************************************
*
* $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 <oleidl.h>
#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
#include <com/sun/star/uno/Reference.h>
#endif
#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
#include <com/sun/star/uno/Sequence.h>
#endif
#ifndef _COM_SUN_STAR_UNO_XINTERFACE_HPP_
#include <com/sun/star/uno/XInterface.hpp>
#endif
#ifndef __COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
#include <com/sun/star/lang/XTypeProvider.hpp>
#endif
#ifndef _CPPUHELPER_WEAK_HXX_
#include <cppuhelper/weak.hxx>
#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
#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 <atlbase.h>
//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 <atlcom.h>
#include <atlctl.h>
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif
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