Kaydet (Commit) 71d18a67 authored tarafından Tino Rachui's avatar Tino Rachui

*** empty log message ***

üst 84208493
component_getImplementationEnvironment
component_writeInfo
component_getFactory
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1 $
#
# last change: $Author: tra $ $Date: 2001-05-14 08:09:08 $
#
# 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): _______________________________________
#
#
#
#*************************************************************************
PRJ=..$/..$/..
PRJNAME=shell
TARGET=smplmail
LIBTARGET=NO
ENABLE_EXCEPTIONS=TRUE
COMP1TYPELIST=$(TARGET)
COMPRDB=$(SOLARBINDIR)$/applicat.rdb
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
# --- Files --------------------------------------------------------
#.INCLUDE : ..$/cppumaker.mk
SLOFILES=$(SLO)$/smplmailentry.obj\
$(SLO)$/smplmailmsg.obj\
$(SLO)$/smplmailclient.obj\
$(SLO)$/smplmailsuppl.obj\
$(SLO)$/simplemapi.obj
SHL1TARGET=$(TARGET)
SHL1STDLIBS=$(CPPULIB)\
$(CPPUHELPERLIB)\
$(SALLIB)
SHL1LIBS=
SHL1DEPN=
SHL1IMPLIB=i$(SHL1TARGET)
SHL1OBJS=$(SLOFILES)
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
DEF1NAME=$(SHL1TARGET)
DEF1EXPORTFILE= exports.dxp
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
/*************************************************************************
*
* $RCSfile: simplemapi.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: tra $ $Date: 2001-05-14 08:09:15 $
*
* 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 _SIMPLEMAPI_HXX_
#include "simplemapi.hxx"
#endif
//----------------------------------------------------------
// static variables
//----------------------------------------------------------
CSimpleMapi* CSimpleMapi::s_Instance = NULL;
osl::Mutex CSimpleMapi::s_aMutex;
CSimpleMapi::SIMPLEMAPI_SINGLETON_DESTROYER_T CSimpleMapi::s_SingletonDestroyer;
//----------------------------------------------------------
//
//----------------------------------------------------------
CSimpleMapi* CSimpleMapi::create( )
{
if ( !s_Instance )
{
osl::MutexGuard aGuard( s_aMutex );
if ( !s_Instance )
{
s_Instance = new CSimpleMapi( );
s_SingletonDestroyer.reset( s_Instance );
}
}
return s_Instance;
}
//----------------------------------------------------------
//
//----------------------------------------------------------
CSimpleMapi::CSimpleMapi( ) :
m_lpfnMapiLogon( NULL ),
m_lpfnMapiLogoff( NULL ),
m_lpfnMapiSendMail( NULL )
{
// load the library
m_hMapiDll = LoadLibrary( "mapi32.dll" );
if ( m_hMapiDll )
{
// initialize the function pointer
m_lpfnMapiLogon = reinterpret_cast< LPMAPILOGON >(
GetProcAddress( m_hMapiDll, "MAPILogon" ) );
m_lpfnMapiLogoff = reinterpret_cast< LPMAPILOGOFF >(
GetProcAddress( m_hMapiDll, "MAPILogoff" ) );
m_lpfnMapiSendMail = reinterpret_cast< LPMAPISENDMAIL >(
GetProcAddress( m_hMapiDll, "MAPISendMail" ) );
}
}
//----------------------------------------------------------
//
//----------------------------------------------------------
CSimpleMapi::~CSimpleMapi( )
{
if ( m_hMapiDll )
FreeLibrary( m_hMapiDll );
}
//----------------------------------------------------------
//
//----------------------------------------------------------
ULONG CSimpleMapi::MAPILogon(
ULONG ulUIParam,
LPTSTR lpszProfileName,
LPTSTR lpszPassword,
FLAGS flFlags,
ULONG ulReserved,
LPLHANDLE lplhSession )
{
ULONG ulRet = MAPI_E_FAILURE;
if ( m_lpfnMapiLogon )
ulRet = m_lpfnMapiLogon(
ulUIParam,
lpszProfileName,
lpszPassword,
flFlags,
ulReserved,
lplhSession );
return ulRet;
}
//----------------------------------------------------------
//
//----------------------------------------------------------
ULONG CSimpleMapi::MAPILogoff(
LHANDLE lhSession,
ULONG ulUIParam,
FLAGS flFlags,
ULONG ulReserved )
{
ULONG ulRet = MAPI_E_FAILURE;
if ( m_lpfnMapiLogoff )
ulRet = m_lpfnMapiLogoff(
lhSession, ulUIParam, flFlags, ulReserved );
return ulRet;
}
//----------------------------------------------------------
//
//----------------------------------------------------------
ULONG CSimpleMapi::MAPISendMail(
LHANDLE lhSession,
ULONG ulUIParam,
lpMapiMessage lpMessage,
FLAGS flFlags,
ULONG ulReserved )
{
ULONG ulRet = MAPI_E_FAILURE;
if ( m_lpfnMapiSendMail )
ulRet = m_lpfnMapiSendMail(
lhSession, ulUIParam, lpMessage, flFlags, ulReserved );
return ulRet;
}
/*************************************************************************
*
* $RCSfile: simplemapi.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: tra $ $Date: 2001-05-14 08:09:21 $
*
* 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 _SIMPLEMAPI_HXX_
#define _SIMPLEMAPI_HXX_
#ifndef _OSL_MUTEX_HXX_
#include <osl/mutex.hxx>
#endif
#include <memory>
#include <windows.h>
#include <mapi.h>
#include <mapix.h>
//----------------------------------------------------------
// class declaration
//----------------------------------------------------------
class CSimpleMapi
{
public:
static CSimpleMapi* create( );
ULONG MAPILogon(
ULONG ulUIParam,
LPTSTR lpszProfileName,
LPTSTR lpszPassword,
FLAGS flFlags,
ULONG ulReserved,
LPLHANDLE lplhSession );
ULONG MAPILogoff(
LHANDLE lhSession,
ULONG ulUIParam,
FLAGS flFlags,
ULONG ulReserved );
ULONG MAPISendMail(
LHANDLE lhSession,
ULONG ulUIParam,
lpMapiMessage lpMessage,
FLAGS flFlags,
ULONG ulReserved );
private:
CSimpleMapi( );
~CSimpleMapi( );
typedef std::auto_ptr< CSimpleMapi > SIMPLEMAPI_SINGLETON_DESTROYER_T;
private:
HMODULE m_hMapiDll;
LPMAPILOGON m_lpfnMapiLogon;
LPMAPILOGOFF m_lpfnMapiLogoff;
LPMAPISENDMAIL m_lpfnMapiSendMail;
static CSimpleMapi* s_Instance;
static osl::Mutex s_aMutex;
static SIMPLEMAPI_SINGLETON_DESTROYER_T s_SingletonDestroyer;
friend SIMPLEMAPI_SINGLETON_DESTROYER_T;
};
#endif
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
<module-name> smplmail </module-name>
<component-description>
<author> Tino Rachui </author>
<name>com.sun.star.comp.system.SimpleSystemMail</name>
<description>
The win32 implementation of a SimpleSystemMail service.
</description>
<loader-name>com.sun.star.loader.SharedLibrary</loader-name>
<language> c++ </language>
<status value="beta"/>
<supported-service> com.sun.star.system.SimpleSystemMail </supported-service>
<service-dependency>...</service-dependency>
<type> com.sun.star.system.XSimpleMailClient </type>
<type> com.sun.star.system.XSimpleMailClientSupplier </type>
<type> com.sun.star.system.XSimpleMailMessage </type>
<type> com.sun.star.system.SimpleMailClientFlags </type>
<type> com.sun.star.lang.XMultiServiceFactory </type>
<type> com.sun.star.lang.XSingleServiceFactory </type>
<type> com.sun.star.lang.XServiceInfo </type>
<type> com.sun.star.lang.XTypeProvider </type>
<type> com.sun.star.lang.IllegalArgumentException </type>
<type> com.sun.star.uno.TypeClass </type>
<type> com.sun.star.uno.XWeak </type>
<type> com.sun.star.uno.XAggregation </type>
<type> com.sun.star.registry.XRegistryKey </type>
<type> com.sun.star.container.XSet </type>
</component-description>
<project-build-dependency> cppuhelper </project-build-dependency>
<project-build-dependency> cppu </project-build-dependency>
<project-build-dependency> sal </project-build-dependency>
<runtime-module-dependency> cppuhelper </runtime-module-dependency>
<runtime-module-dependency> cppu2 </runtime-module-dependency>
<runtime-module-dependency> sal2 </runtime-module-dependency>
</module-description>
This diff is collapsed.
/*************************************************************************
*
* $RCSfile: smplmailclient.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: tra $ $Date: 2001-05-14 08:08:31 $
*
* 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 _SMPLMAILCLIENT_HXX_
#define _SMPLMAILCLIENT_HXX_
//_______________________________________________________________________________________________________________________
// includes of other projects
//_______________________________________________________________________________________________________________________
#ifndef _CPPUHELPER_COMPBASE1_HXX_
#include <cppuhelper/compbase1.hxx>
#endif
#ifndef _OSL_MUTEX_HXX_
#include <osl/mutex.hxx>
#endif
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif
#ifndef _COM_SUN_STAR_SYS_SHELL_XSYSTEMSHELLEXECUTE_HPP_
#include <com/sun/star/system/XSimpleMailClient.hpp>
#endif
#ifndef _SIMPLEMAPI_HXX_
#include "simplemapi.hxx"
#endif
#ifndef _GENERICBUFFER_HXX_
#include "genericbuffer.hxx"
#endif
//----------------------------------------------------------
// class declaration
//----------------------------------------------------------
class CSmplMailClient :
public cppu::WeakImplHelper1< com::sun::star::system::XSimpleMailClient >
{
public:
CSmplMailClient( );
//------------------------------------------------
//
//------------------------------------------------
virtual ::com::sun::star::uno::Reference< ::com::sun::star::system::XSimpleMailMessage > SAL_CALL createSimpleMailMessage( )
throw (::com::sun::star::uno::RuntimeException);
//------------------------------------------------
//
//------------------------------------------------
virtual void SAL_CALL sendSimpleMailMessage( const ::com::sun::star::uno::Reference< ::com::sun::star::system::XSimpleMailMessage >& xSimpleMailMessage, sal_Int32 aFlag )
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
private:
void validateParameter( const ::com::sun::star::uno::Reference< ::com::sun::star::system::XSimpleMailMessage >& xSimpleMailMessage, sal_Int32 aFlag );
void initMapiMessage( const ::com::sun::star::uno::Reference< ::com::sun::star::system::XSimpleMailMessage >& xSimpleMailMessage, MapiMessage& aMapiMessage );
void initMapiSendMailFlags( sal_Int32 aFlags, FLAGS& aMapiFlags );
inline
sal_uInt32 calcNumRecipients(
const ::com::sun::star::uno::Reference< ::com::sun::star::system::XSimpleMailMessage >& xSimpleMailMessage );
inline
void initRecipientList( const ::com::sun::star::uno::Sequence< rtl::OUString >& aRecipList,
ULONG ulRecipClass,
size_t& nPos );
inline
void initAttachementList(
const ::com::sun::star::uno::Reference< ::com::sun::star::system::XSimpleMailMessage >& xSimpleMailMessage );
rtl::OUString getMapiErrorMsg( ULONG ulMapiError );
private:
CSimpleMapi* m_pSimpleMapi;
rtl::OString m_Subject;
rtl::OString m_SmtpAddressOriginator;
std::vector< rtl::OString > m_RecipsSmtpAddressList;
std::vector< rtl::OString > m_AttchmtsSysPathList;
MapiRecipDesc m_MsgOriginator;
TGenericBuffer< MapiRecipDesc > m_RecipientList;
TGenericBuffer< MapiFileDesc > m_AttachementList;
};
#endif
/*************************************************************************
*
* $RCSfile: smplmailentry.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: tra $ $Date: 2001-05-14 08:08:25 $
*
* 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): _______________________________________
*
*
************************************************************************/
//-----------------------------------------------------------------------
// includes of other projects
//-----------------------------------------------------------------------
#ifndef _CPPUHELPER_FACTORY_HXX_
#include <cppuhelper/factory.hxx>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XSET_HPP_
#include <com/sun/star/container/XSet.hpp>
#endif
#ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h>
#endif
#ifndef _SMPLMAILSUPPL_HXX_
#include "smplmailsuppl.hxx"
#endif
//-----------------------------------------------------------------------
// namespace directives
//-----------------------------------------------------------------------
using namespace ::rtl ;
using namespace ::com::sun::star::uno ;
using namespace ::com::sun::star::container ;
using namespace ::com::sun::star::lang ;
using namespace ::com::sun::star::registry ;
using namespace ::cppu ;
using com::sun::star::system::XSimpleMailClientSupplier;
//-----------------------------------------------------------------------
// defines
//-----------------------------------------------------------------------
#define COMP_SERVICE_NAME "com.sun.star.system.SimpleSystemMail"
#define COMP_IMPL_NAME "com.sun.star.system.SimpleSystemMail"
#define COMP_REGKEY_NAME "/com.sun.star.system.SimpleSystemMail/UNO/SERVICES/com.sun.star.system.SimpleSystemMail"
//-----------------------------------------------------------------------
//
//-----------------------------------------------------------------------
namespace
{
Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& rServiceManager )
{
return Reference< XInterface >( static_cast< XSimpleMailClientSupplier* >( new CSmplMailSuppl( ) ) );
}
}
//-----------------------------------------------------------------------
// the 3 important functions which will be exported
//-----------------------------------------------------------------------
extern "C"
{
//----------------------------------------------------------------------
// component_getImplementationEnvironment
//----------------------------------------------------------------------
void SAL_CALL component_getImplementationEnvironment(
const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
{
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//-----------------------------------------------------------------------
//
//-----------------------------------------------------------------------
sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey )
{
sal_Bool bRetVal = sal_True;
if ( pRegistryKey )
{
try
{
Reference< XRegistryKey > pXNewKey( static_cast< XRegistryKey* >( pRegistryKey ) );
pXNewKey->createKey(
OUString::createFromAscii( COMP_REGKEY_NAME ) );
}
catch( InvalidRegistryException& )
{
OSL_ENSURE(sal_False, "InvalidRegistryException caught");
bRetVal = sal_False;
}
}
return bRetVal;
}
//----------------------------------------------------------------------
// component_getFactory
// returns a factory to create XFilePicker-Services
//----------------------------------------------------------------------
void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* pRegistryKey )
{
void* pRet = 0;
if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, COMP_IMPL_NAME ) ) )
{
Sequence< OUString > aSNS( 1 );
aSNS.getArray( )[0] = OUString::createFromAscii( COMP_SERVICE_NAME );
Reference< XSingleServiceFactory > xFactory ( createOneInstanceFactory(
reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
OUString::createFromAscii( pImplName ),
createInstance,
aSNS ) );
if ( xFactory.is() )
{
xFactory->acquire();
pRet = xFactory.get();
}
}
return pRet;
}
} // extern "C"
/*************************************************************************
*
* $RCSfile: smplmailmsg.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: tra $ $Date: 2001-05-14 08:08:43 $
*
* 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): _______________________________________
*
*
************************************************************************/
//------------------------------------------------------------------------
// includes
//------------------------------------------------------------------------
#ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h>
#endif
#include <osl/file.h>
#ifndef _SMPLMAILMSG_HXX_
#include "smplmailmsg.hxx"
#endif
//------------------------------------------------------------------------
// namespace directives
//------------------------------------------------------------------------
using com::sun::star::uno::Reference;
using com::sun::star::uno::RuntimeException;
using com::sun::star::uno::Sequence;
using com::sun::star::lang::XServiceInfo;
using com::sun::star::lang::IllegalArgumentException;
using rtl::OUString;
using osl::Mutex;
using namespace cppu;
//------------------------------------------------------------------------
// helper functions
//------------------------------------------------------------------------
CSmplMailMsg::CSmplMailMsg( )
{
}
//------------------------------------------------
//
//------------------------------------------------
void SAL_CALL CSmplMailMsg::setRecipient( const ::rtl::OUString& aRecipient )
throw (RuntimeException)
{
m_aRecipient = aRecipient;
}
//------------------------------------------------
//
//------------------------------------------------
::rtl::OUString SAL_CALL CSmplMailMsg::getRecipient( )
throw (RuntimeException)
{
return m_aRecipient;
}
//------------------------------------------------
//
//------------------------------------------------
void SAL_CALL CSmplMailMsg::setCcRecipient( const Sequence< OUString >& aCcRecipient )
throw (RuntimeException)
{
m_CcRecipients = aCcRecipient;
}
//------------------------------------------------
//
//------------------------------------------------
Sequence< OUString > SAL_CALL CSmplMailMsg::getCcRecipient( )
throw (RuntimeException)
{
return m_CcRecipients;
}
//------------------------------------------------
//
//------------------------------------------------
void SAL_CALL CSmplMailMsg::setBccRecipient( const Sequence< OUString >& aBccRecipient )
throw (RuntimeException)
{
m_BccRecipients = aBccRecipient;
}
//------------------------------------------------
//
//------------------------------------------------
Sequence< OUString > SAL_CALL CSmplMailMsg::getBccRecipient( )
throw (RuntimeException)
{
return m_BccRecipients;
}
//------------------------------------------------
//
//------------------------------------------------
void SAL_CALL CSmplMailMsg::setOriginator( const OUString& aOriginator )
throw (RuntimeException)
{
m_aOriginator = aOriginator;
}
//------------------------------------------------
//
//------------------------------------------------
OUString SAL_CALL CSmplMailMsg::getOriginator( )
throw (RuntimeException)
{
return m_aOriginator;
}
//------------------------------------------------
//
//------------------------------------------------
void SAL_CALL CSmplMailMsg::setSubject( const OUString& aSubject )
throw (RuntimeException)
{
m_aSubject = aSubject;
}
//------------------------------------------------
//
//------------------------------------------------
OUString SAL_CALL CSmplMailMsg::getSubject( )
throw (RuntimeException)
{
return m_aSubject;
}
//------------------------------------------------
//
//------------------------------------------------
void SAL_CALL CSmplMailMsg::setAttachement( const Sequence< ::rtl::OUString >& aAttachement )
throw (IllegalArgumentException, RuntimeException)
{
m_Attachements = aAttachement;
}
//------------------------------------------------
//
//------------------------------------------------
Sequence< OUString > SAL_CALL CSmplMailMsg::getAttachement( )
throw (RuntimeException)
{
return m_Attachements;
}
\ No newline at end of file
/*************************************************************************
*
* $RCSfile: smplmailmsg.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: tra $ $Date: 2001-05-14 08:08:37 $
*
* 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 _SMPLMAILMSG_HXX_
#define _SMPLMAILMSG_HXX_
//_______________________________________________________________________________________________________________________
// includes of other projects
//_______________________________________________________________________________________________________________________
#ifndef _CPPUHELPER_COMPBASE1_HXX_
#include <cppuhelper/compbase1.hxx>
#endif
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_ILLEGALARGUMENTEXCEPTION_HPP_
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#endif
#ifndef _COM_SUN_STAR_SYS_SHELL_XSYSTEMSHELLEXECUTE_HPP_
#include <com/sun/star/system/XSimpleMailMessage.hpp>
#endif
//----------------------------------------------------------
// class declaration
//----------------------------------------------------------
class CSmplMailMsg :
public cppu::WeakImplHelper1< com::sun::star::system::XSimpleMailMessage >
{
public:
CSmplMailMsg( );
//------------------------------------------------
//
//------------------------------------------------
virtual void SAL_CALL setRecipient( const ::rtl::OUString& aRecipient )
throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getRecipient( )
throw (::com::sun::star::uno::RuntimeException);
//------------------------------------------------
//
//------------------------------------------------
virtual void SAL_CALL setCcRecipient( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aCcRecipient )
throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getCcRecipient( )
throw (::com::sun::star::uno::RuntimeException);
//------------------------------------------------
//
//------------------------------------------------
virtual void SAL_CALL setBccRecipient( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aBccRecipient )
throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getBccRecipient( )
throw (::com::sun::star::uno::RuntimeException);
//------------------------------------------------
//
//------------------------------------------------
virtual void SAL_CALL setOriginator( const ::rtl::OUString& aOriginator )
throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getOriginator( )
throw (::com::sun::star::uno::RuntimeException);
//------------------------------------------------
//
//------------------------------------------------
virtual void SAL_CALL setSubject( const ::rtl::OUString& aSubject )
throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getSubject( )
throw (::com::sun::star::uno::RuntimeException);
//------------------------------------------------
//
//------------------------------------------------
virtual void SAL_CALL setAttachement( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aAttachement )
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAttachement( )
throw (::com::sun::star::uno::RuntimeException);
private:
rtl::OUString m_aRecipient;
rtl::OUString m_aOriginator;
rtl::OUString m_aSubject;
com::sun::star::uno::Sequence< rtl::OUString > m_CcRecipients;
com::sun::star::uno::Sequence< rtl::OUString > m_BccRecipients;
com::sun::star::uno::Sequence< rtl::OUString > m_Attachements;
};
#endif
/*************************************************************************
*
* $RCSfile: smplmailsuppl.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: tra $ $Date: 2001-05-14 08:08:49 $
*
* 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): _______________________________________
*
*
************************************************************************/
//------------------------------------------------------------------------
// includes
//------------------------------------------------------------------------
#ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h>
#endif
#ifndef _SMPLMAILSUPPL_HXX_
#include "smplmailsuppl.hxx"
#endif
#ifndef _SMPLMAILCLIENT_HXX_
#include "smplmailclient.hxx"
#endif
//------------------------------------------------------------------------
// namespace directives
//------------------------------------------------------------------------
using com::sun::star::uno::Reference;
using com::sun::star::uno::RuntimeException;
using com::sun::star::uno::Sequence;
using com::sun::star::lang::XServiceInfo;
using com::sun::star::system::XSimpleMailClientSupplier;
using com::sun::star::system::XSimpleMailClient;
using rtl::OUString;
using osl::Mutex;
using namespace cppu;
//------------------------------------------------------------------------
// defines
//------------------------------------------------------------------------
#define COMP_IMPL_NAME "com.sun.star.sys.shell.SimpleSystemMail"
//------------------------------------------------------------------------
// helper functions
//------------------------------------------------------------------------
namespace // private
{
Sequence< OUString > SAL_CALL Component_getSupportedServiceNames()
{
Sequence< OUString > aRet(1);
aRet[0] = OUString::createFromAscii("com.sun.star.sys.shell.SimpleSystemMail");
return aRet;
}
} // end private namespace
//-------------------------------------------------
//
//-------------------------------------------------
CSmplMailSuppl::CSmplMailSuppl( ) :
WeakComponentImplHelper2< XSimpleMailClientSupplier, XServiceInfo >( m_aMutex ),
m_pSimpleMapi( CSimpleMapi::create( ) )
{
}
//-------------------------------------------------
//
//-------------------------------------------------
CSmplMailSuppl::~CSmplMailSuppl( )
{
}
//-------------------------------------------------
//
//-------------------------------------------------
Reference< XSimpleMailClient > SAL_CALL CSmplMailSuppl::querySimpleMailClient( )
throw (RuntimeException)
{
// try to determine if a valid mapi mail client
// is available
// if so create and return a new instance of a
// simple mail client
FLAGS flFlag =MAPI_NEW_SESSION;// | MAPI_LOGON_UI;
LHANDLE hSession;
ULONG ulRet = m_pSimpleMapi->MAPILogon(
0, NULL, NULL, flFlag, 0L, &hSession );
Reference< XSimpleMailClient > xSmplMailClient;
if ( SUCCESS_SUCCESS == ulRet )
{
xSmplMailClient =
Reference< XSimpleMailClient >( new CSmplMailClient( ) );
// logoff again
m_pSimpleMapi->MAPILogoff( hSession, 0, 0, 0 );
}
return xSmplMailClient;
}
// -------------------------------------------------
// XServiceInfo
// -------------------------------------------------
OUString SAL_CALL CSmplMailSuppl::getImplementationName( )
throw( RuntimeException )
{
return OUString::createFromAscii( COMP_IMPL_NAME );
}
// -------------------------------------------------
// XServiceInfo
// -------------------------------------------------
sal_Bool SAL_CALL CSmplMailSuppl::supportsService( const OUString& ServiceName )
throw( RuntimeException )
{
Sequence < OUString > SupportedServicesNames = Component_getSupportedServiceNames();
for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; )
if (SupportedServicesNames[n].compareTo(ServiceName) == 0)
return sal_True;
return sal_False;
}
// -------------------------------------------------
// XServiceInfo
// -------------------------------------------------
Sequence< OUString > SAL_CALL CSmplMailSuppl::getSupportedServiceNames( )
throw( RuntimeException )
{
return Component_getSupportedServiceNames();
}
/*************************************************************************
*
* $RCSfile: smplmailsuppl.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: tra $ $Date: 2001-05-14 08:08:56 $
*
* 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 _SMPLMAILSUPPL_HXX_
#define _SMPLMAILSUPPL_HXX_
//----------------------------------------------------------
// includes of other projects
//----------------------------------------------------------
#ifndef _CPPUHELPER_COMPBASE2_HXX_
#include <cppuhelper/compbase2.hxx>
#endif
#ifndef _OSL_MUTEX_HXX_
#include <osl/mutex.hxx>
#endif
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif
#ifndef _COM_SUN_STAR_SYS_SHELL_XSYSTEMSHELLEXECUTE_HPP_
#include <com/sun/star/system/XSimpleMailClientSupplier.hpp>
#endif
#ifndef _SIMPLEMAPI_HXX_
#include "simplemapi.hxx"
#endif
//----------------------------------------------------------
// class declaration
//----------------------------------------------------------
class CSmplMailSupplBase
{
protected:
osl::Mutex m_aMutex;
};
class CSmplMailSuppl :
public CSmplMailSupplBase,
public cppu::WeakComponentImplHelper2<
com::sun::star::system::XSimpleMailClientSupplier,
com::sun::star::lang::XServiceInfo >
{
public:
CSmplMailSuppl( );
~CSmplMailSuppl( );
//------------------------------------------------
// XSimpleMailClientSupplier
//------------------------------------------------
virtual ::com::sun::star::uno::Reference< ::com::sun::star::system::XSimpleMailClient > SAL_CALL querySimpleMailClient( )
throw (::com::sun::star::uno::RuntimeException);
//------------------------------------------------
// XServiceInfo
//------------------------------------------------
virtual ::rtl::OUString SAL_CALL getImplementationName( )
throw(::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
throw(::com::sun::star::uno::RuntimeException);
private:
CSimpleMapi* m_pSimpleMapi;
};
#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