summaryrefslogtreecommitdiff
path: root/shell/source/cmdmail
diff options
context:
space:
mode:
Diffstat (limited to 'shell/source/cmdmail')
-rw-r--r--shell/source/cmdmail/cmdmail.component34
-rw-r--r--shell/source/cmdmail/cmdmail.xml47
-rwxr-xr-xshell/source/cmdmail/cmdmailentry.cxx111
-rwxr-xr-xshell/source/cmdmail/cmdmailmsg.cxx302
-rw-r--r--shell/source/cmdmail/cmdmailmsg.hxx128
-rwxr-xr-xshell/source/cmdmail/cmdmailsuppl.cxx328
-rw-r--r--shell/source/cmdmail/cmdmailsuppl.hxx95
-rw-r--r--shell/source/cmdmail/exports.dxp2
-rw-r--r--shell/source/cmdmail/makefile.mk71
9 files changed, 1118 insertions, 0 deletions
diff --git a/shell/source/cmdmail/cmdmail.component b/shell/source/cmdmail/cmdmail.component
new file mode 100644
index 000000000000..7e56741d16c1
--- /dev/null
+++ b/shell/source/cmdmail/cmdmail.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org 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 version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.system.SimpleCommandMail">
+ <service name="com.sun.star.system.SimpleCommandMail"/>
+ </implementation>
+</component>
diff --git a/shell/source/cmdmail/cmdmail.xml b/shell/source/cmdmail/cmdmail.xml
new file mode 100644
index 000000000000..51de9cc1e4da
--- /dev/null
+++ b/shell/source/cmdmail/cmdmail.xml
@@ -0,0 +1,47 @@
+<?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> cmdmail </module-name>
+ <component-description>
+ <author> Oliver Braun </author>
+ <name>com.sun.star.comp.system.SimpleCommandMail</name>
+ <description>
+ A generic implementation of a SimpleCommandMail service.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language> c++ </language>
+ <status value="beta"/>
+ <supported-service> com.sun.star.system.SimpleCommandMail </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.XEventListener </type>
+ <type> com.sun.star.lang.XMultiServiceFactory </type>
+ <type> com.sun.star.lang.XSingleServiceFactory </type>
+ <type> com.sun.star.lang.XSingleComponentFactory </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.lang.XComponent </type>
+ <type> com.sun.star.uno.RuntimeException </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.uno.XComponentContext </type>
+ <type> com.sun.star.registry.XRegistryKey </type>
+ <type> com.sun.star.container.XNameAccess </type>
+ <type> com.sun.star.container.XSet </type>
+ <type> com.sun.star.beans.PropertyValue </type>
+ <type> com.sun.star.beans.XPropertySet </type>
+ <type> com.sun.star.uri.ExternalUriReferenceTranslator </type>
+ <type> com.sun.star.uri.XExternalUriReferenceTranslator </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$(COM) </runtime-module-dependency>
+ <runtime-module-dependency> cppu3 </runtime-module-dependency>
+ <runtime-module-dependency> sal3 </runtime-module-dependency>
+</module-description>
diff --git a/shell/source/cmdmail/cmdmailentry.cxx b/shell/source/cmdmail/cmdmailentry.cxx
new file mode 100755
index 000000000000..740f87cd76f1
--- /dev/null
+++ b/shell/source/cmdmail/cmdmailentry.cxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_shell.hxx"
+
+//-----------------------------------------------------------------------
+// includes of other projects
+//-----------------------------------------------------------------------
+#include <cppuhelper/factory.hxx>
+#include <com/sun/star/container/XSet.hpp>
+#include <osl/diagnose.h>
+#include "cmdmailsuppl.hxx"
+
+//-----------------------------------------------------------------------
+// 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.SimpleCommandMail"
+#define COMP_IMPL_NAME "com.sun.star.comp.system.SimpleCommandMail"
+
+//-----------------------------------------------------------------------
+//
+//-----------------------------------------------------------------------
+
+namespace
+{
+ Reference< XInterface > SAL_CALL createInstance( const Reference< XComponentContext >& xContext )
+ {
+ return Reference< XInterface >( static_cast< XSimpleMailClientSupplier* >( new CmdMailSuppl( xContext ) ) );
+ }
+}
+
+//-----------------------------------------------------------------------
+// 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;
+}
+
+//----------------------------------------------------------------------
+// component_getFactory
+//----------------------------------------------------------------------
+
+void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* /*pSrvManager*/, uno_Interface* /*pRegistryKey*/ )
+{
+ Reference< XSingleComponentFactory > xFactory;
+
+ if (0 == ::rtl_str_compare( pImplName, COMP_IMPL_NAME ))
+ {
+ OUString serviceName( RTL_CONSTASCII_USTRINGPARAM(COMP_SERVICE_NAME) );
+
+ xFactory = ::cppu::createSingleComponentFactory(
+ createInstance,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(COMP_IMPL_NAME) ),
+ Sequence< OUString >( &serviceName, 1 ) );
+ }
+
+ if (xFactory.is())
+ xFactory->acquire();
+
+ return xFactory.get();
+}
+
+} // extern "C"
diff --git a/shell/source/cmdmail/cmdmailmsg.cxx b/shell/source/cmdmail/cmdmailmsg.cxx
new file mode 100755
index 000000000000..77de429ed771
--- /dev/null
+++ b/shell/source/cmdmail/cmdmailmsg.cxx
@@ -0,0 +1,302 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_shell.hxx"
+
+//------------------------------------------------------------------------
+// includes
+//------------------------------------------------------------------------
+#include <osl/diagnose.h>
+#include "cmdmailmsg.hxx"
+#include <com/sun/star/uri/XExternalUriReferenceTranslator.hpp>
+#include <com/sun/star/uri/ExternalUriReferenceTranslator.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+
+//------------------------------------------------------------------------
+// namespace directives
+//------------------------------------------------------------------------
+
+using com::sun::star::lang::IllegalArgumentException;
+using com::sun::star::lang::WrappedTargetException;
+using com::sun::star::container::NoSuchElementException;
+using com::sun::star::container::XNameAccess;
+using rtl::OUString;
+using osl::MutexGuard;
+
+using namespace cppu;
+using namespace com::sun::star::uno;
+
+
+//------------------------------------------------
+//
+//------------------------------------------------
+
+void SAL_CALL CmdMailMsg::setRecipient( const ::rtl::OUString& aRecipient )
+ throw (RuntimeException)
+{
+ MutexGuard aGuard( m_aMutex );
+ m_aRecipient = aRecipient;
+}
+
+//------------------------------------------------
+//
+//------------------------------------------------
+
+::rtl::OUString SAL_CALL CmdMailMsg::getRecipient( )
+ throw (RuntimeException)
+{
+ MutexGuard aGuard( m_aMutex );
+ return m_aRecipient;
+}
+
+//------------------------------------------------
+//
+//------------------------------------------------
+
+void SAL_CALL CmdMailMsg::setCcRecipient( const Sequence< OUString >& aCcRecipient )
+ throw (RuntimeException)
+{
+ MutexGuard aGuard( m_aMutex );
+ m_CcRecipients = aCcRecipient;
+}
+
+//------------------------------------------------
+//
+//------------------------------------------------
+
+Sequence< OUString > SAL_CALL CmdMailMsg::getCcRecipient( )
+ throw (RuntimeException)
+{
+ MutexGuard aGuard( m_aMutex );
+ return m_CcRecipients;
+}
+
+//------------------------------------------------
+//
+//------------------------------------------------
+
+void SAL_CALL CmdMailMsg::setBccRecipient( const Sequence< OUString >& aBccRecipient )
+ throw (RuntimeException)
+{
+ MutexGuard aGuard( m_aMutex );
+ m_BccRecipients = aBccRecipient;
+}
+
+//------------------------------------------------
+//
+//------------------------------------------------
+
+Sequence< OUString > SAL_CALL CmdMailMsg::getBccRecipient( )
+ throw (RuntimeException)
+{
+ MutexGuard aGuard( m_aMutex );
+ return m_BccRecipients;
+}
+
+//------------------------------------------------
+//
+//------------------------------------------------
+
+void SAL_CALL CmdMailMsg::setOriginator( const OUString& aOriginator )
+ throw (RuntimeException)
+{
+ MutexGuard aGuard( m_aMutex );
+ m_aOriginator = aOriginator;
+}
+
+//------------------------------------------------
+//
+//------------------------------------------------
+
+OUString SAL_CALL CmdMailMsg::getOriginator( )
+ throw (RuntimeException)
+{
+ MutexGuard aGuard( m_aMutex );
+ return m_aOriginator;
+}
+
+//------------------------------------------------
+//
+//------------------------------------------------
+
+void SAL_CALL CmdMailMsg::setSubject( const OUString& aSubject )
+ throw (RuntimeException)
+{
+ MutexGuard aGuard( m_aMutex );
+ m_aSubject = aSubject;
+}
+
+//------------------------------------------------
+//
+//------------------------------------------------
+
+OUString SAL_CALL CmdMailMsg::getSubject( )
+ throw (RuntimeException)
+{
+ MutexGuard aGuard( m_aMutex );
+ return m_aSubject;
+}
+
+//------------------------------------------------
+//
+//------------------------------------------------
+
+void SAL_CALL CmdMailMsg::setAttachement( const Sequence< ::rtl::OUString >& aAttachment )
+ throw (IllegalArgumentException, RuntimeException)
+{
+ MutexGuard aGuard( m_aMutex );
+ m_Attachments = aAttachment;
+}
+
+//------------------------------------------------
+//
+//------------------------------------------------
+
+Sequence< OUString > SAL_CALL CmdMailMsg::getAttachement( )
+ throw (RuntimeException)
+{
+ MutexGuard aGuard( m_aMutex );
+ return m_Attachments;
+}
+
+//------------------------------------------------
+//
+//------------------------------------------------
+
+Any SAL_CALL CmdMailMsg::getByName( const OUString& aName )
+ throw (NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ MutexGuard aGuard( m_aMutex );
+
+ if( 0 == aName.compareToAscii( "from" ) && m_aOriginator.getLength() )
+ return makeAny( m_aOriginator );
+
+ else if( 0 == aName.compareToAscii( "to" ) && m_aRecipient.getLength() )
+ return makeAny( m_aRecipient );
+
+ else if( 0 == aName.compareToAscii( "cc" ) && m_CcRecipients.getLength() )
+ return makeAny( m_CcRecipients );
+
+ else if( 0 == aName.compareToAscii( "bcc" ) && m_BccRecipients.getLength() )
+ return makeAny( m_BccRecipients );
+
+ else if( 0 == aName.compareToAscii( "subject" ) && m_aSubject.getLength() )
+ return makeAny( m_aSubject );
+
+ else if( 0 == aName.compareToAscii( "attachment" ) && m_Attachments.getLength() )
+ return makeAny( m_Attachments );
+
+ throw NoSuchElementException( OUString::createFromAscii( "key not found: ") + aName,
+ static_cast < XNameAccess * > (this) );
+}
+
+//------------------------------------------------
+//
+//------------------------------------------------
+
+Sequence< OUString > SAL_CALL CmdMailMsg::getElementNames( )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ MutexGuard aGuard( m_aMutex );
+
+ sal_Int32 nItems = 0;
+ Sequence< OUString > aRet( 6 );
+
+ if( m_aOriginator.getLength() )
+ aRet[nItems++] = OUString::createFromAscii( "from" );
+
+ if( m_aRecipient.getLength() )
+ aRet[nItems++] = OUString::createFromAscii( "to" );
+
+ if( m_CcRecipients.getLength() )
+ aRet[nItems++] = OUString::createFromAscii( "cc" );
+
+ if( m_BccRecipients.getLength() )
+ aRet[nItems++] = OUString::createFromAscii( "bcc" );
+
+ if( m_aSubject.getLength() )
+ aRet[nItems++] = OUString::createFromAscii( "subject" );
+
+ if( m_Attachments.getLength() )
+ aRet[nItems++] = OUString::createFromAscii( "attachment" );
+
+ aRet.realloc( nItems );
+ return aRet;
+}
+
+//------------------------------------------------
+//
+//------------------------------------------------
+
+ sal_Bool SAL_CALL CmdMailMsg::hasByName( const ::rtl::OUString& aName )
+ throw (RuntimeException)
+{
+ MutexGuard aGuard( m_aMutex );
+
+ if( 0 == aName.compareToAscii( "from" ) && m_aOriginator.getLength() )
+ return sal_True;
+
+ else if( 0 == aName.compareToAscii( "to" ) && m_aRecipient.getLength() )
+ return sal_True;
+
+ else if( 0 == aName.compareToAscii( "cc" ) && m_CcRecipients.getLength() )
+ return sal_True;
+
+ else if( 0 == aName.compareToAscii( "bcc" ) && m_BccRecipients.getLength() )
+ return sal_True;
+
+ else if( 0 == aName.compareToAscii( "subject" ) && m_aSubject.getLength() )
+ return sal_True;
+
+ else if( 0 == aName.compareToAscii( "attachment" ) && m_Attachments.getLength() )
+ return sal_True;
+
+ return sal_False;
+}
+
+//------------------------------------------------
+//
+//------------------------------------------------
+
+Type SAL_CALL CmdMailMsg::getElementType( )
+ throw (RuntimeException)
+{
+ // returning void for multi type container
+ return Type();
+}
+
+//------------------------------------------------
+//
+//------------------------------------------------
+
+sal_Bool SAL_CALL CmdMailMsg::hasElements( )
+ throw (RuntimeException)
+{
+ return 0 != getElementNames().getLength();
+}
diff --git a/shell/source/cmdmail/cmdmailmsg.hxx b/shell/source/cmdmail/cmdmailmsg.hxx
new file mode 100644
index 000000000000..520bd0acbb56
--- /dev/null
+++ b/shell/source/cmdmail/cmdmailmsg.hxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CMDMAILMSG_HXX_
+#define _CMDMAILMSG_HXX_
+
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+#ifndef _COM_SUN_STAR_SYS_SHELL_XSYSTEMSHELLEXECUTE_HPP_
+#include <com/sun/star/system/XSimpleMailMessage.hpp>
+#endif
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+//----------------------------------------------------------
+// class declaration
+//----------------------------------------------------------
+
+class CmdMailMsg :
+ public cppu::WeakImplHelper2<
+ ::com::sun::star::system::XSimpleMailMessage,
+ ::com::sun::star::container::XNameAccess >
+{
+ ::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_Attachments;
+
+ ::osl::Mutex m_aMutex;
+
+public:
+
+ CmdMailMsg() {};
+
+ //------------------------------------------------
+ // XSimpleMailMessage
+ //------------------------------------------------
+
+ 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);
+
+ //------------------------------------------------
+ // XNameAccess
+ //------------------------------------------------
+
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
+ throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( )
+ throw (::com::sun::star::uno::RuntimeException) ;
+
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //------------------------------------------------
+ // XElementAccess
+ //------------------------------------------------
+
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL hasElements( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+#endif
diff --git a/shell/source/cmdmail/cmdmailsuppl.cxx b/shell/source/cmdmail/cmdmailsuppl.cxx
new file mode 100755
index 000000000000..4878f8d7783f
--- /dev/null
+++ b/shell/source/cmdmail/cmdmailsuppl.cxx
@@ -0,0 +1,328 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_shell.hxx"
+
+//------------------------------------------------------------------------
+// includes
+//------------------------------------------------------------------------
+#include <osl/diagnose.h>
+#include <osl/thread.h>
+
+#include <rtl/bootstrap.hxx>
+
+#include <osl/file.hxx>
+#include <rtl/strbuf.hxx>
+#include "cmdmailsuppl.hxx"
+#include "cmdmailmsg.hxx"
+#include <com/sun/star/system/SimpleMailClientFlags.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+
+//------------------------------------------------------------------------
+// namespace directives
+//------------------------------------------------------------------------
+
+using com::sun::star::beans::PropertyValue;
+using com::sun::star::system::XSimpleMailClientSupplier;
+using com::sun::star::system::XSimpleMailClient;
+using com::sun::star::system::XSimpleMailMessage;
+using com::sun::star::container::XNameAccess;
+using com::sun::star::container::NoSuchElementException;
+using rtl::OUString;
+using rtl::OUStringToOString;
+using rtl::OString;
+using rtl::OStringBuffer;
+using osl::MutexGuard;
+using osl::FileBase;
+
+using namespace cppu;
+using namespace com::sun::star::system::SimpleMailClientFlags;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+
+//------------------------------------------------------------------------
+// defines
+//------------------------------------------------------------------------
+
+#define COMP_IMPL_NAME "com.sun.star.comp.system.SimpleCommandMail2"
+
+//------------------------------------------------------------------------
+// helper functions
+//------------------------------------------------------------------------
+
+namespace // private
+{
+ Sequence< OUString > SAL_CALL Component_getSupportedServiceNames()
+ {
+ Sequence< OUString > aRet(1);
+ aRet[0] = OUString::createFromAscii("com.sun.star.system.SimpleCommandMail");
+ return aRet;
+ }
+
+} // end private namespace
+
+//-------------------------------------------------
+//
+//-------------------------------------------------
+
+CmdMailSuppl::CmdMailSuppl( const Reference< XComponentContext >& xContext ) :
+ WeakImplHelper3< XSimpleMailClientSupplier, XSimpleMailClient, XServiceInfo >()
+{
+ Reference< XMultiComponentFactory > xServiceManager = xContext->getServiceManager();
+
+ if ( xServiceManager.is() ) {
+ m_xConfigurationProvider = Reference< XMultiServiceFactory > (
+ xServiceManager->createInstanceWithContext(
+ OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" ), xContext ),
+ UNO_QUERY );
+ }
+}
+
+//-------------------------------------------------
+// XSimpleMailClientSupplier
+//-------------------------------------------------
+
+Reference< XSimpleMailClient > SAL_CALL CmdMailSuppl::querySimpleMailClient( )
+ throw (RuntimeException)
+{
+ return static_cast < XSimpleMailClient * > (this);
+}
+
+//------------------------------------------------
+// XSimpleMailClient
+//------------------------------------------------
+
+Reference< XSimpleMailMessage > SAL_CALL CmdMailSuppl::createSimpleMailMessage( )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return Reference< XSimpleMailMessage >( new CmdMailMsg( ) );
+}
+
+//------------------------------------------------
+// XSimpleMailClient
+//------------------------------------------------
+
+void SAL_CALL CmdMailSuppl::sendSimpleMailMessage( const Reference< XSimpleMailMessage >& xSimpleMailMessage, sal_Int32 /*aFlag*/ )
+ throw (IllegalArgumentException, Exception, RuntimeException)
+{
+ if ( ! xSimpleMailMessage.is() )
+ {
+ throw ::com::sun::star::lang::IllegalArgumentException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM( "No message specified" )),
+ static_cast < XSimpleMailClient * > (this), 1 );
+ }
+
+ if( ! m_xConfigurationProvider.is() )
+ {
+ throw ::com::sun::star::uno::Exception(
+ OUString(RTL_CONSTASCII_USTRINGPARAM( "Can not access configuration" )),
+ static_cast < XSimpleMailClient * > (this) );
+ }
+
+ OStringBuffer aBuffer;
+ aBuffer.append("\"");
+
+ OUString aProgramURL(RTL_CONSTASCII_USTRINGPARAM("$OOO_BASE_DIR/program/senddoc"));
+ rtl::Bootstrap::expandMacros(aProgramURL);
+
+ OUString aProgram;
+ if ( FileBase::E_None != FileBase::getSystemPathFromFileURL(aProgramURL, aProgram))
+ {
+ throw ::com::sun::star::uno::Exception(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Cound not convert executable path")),
+ static_cast < XSimpleMailClient * > (this));
+ }
+
+ aBuffer.append(OUStringToOString(aProgram, osl_getThreadTextEncoding()));
+ aBuffer.append("\" ");
+
+ try
+ {
+ // Query XNameAccess interface of the org.openoffice.Office.Common/ExternalMailer
+ // configuration node to retriece the users preferred email application. This may
+ // transparently by redirected to e.g. the corresponding GConf setting in GNOME.
+ OUString aConfigRoot = OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/ExternalMailer" ) );
+
+ PropertyValue aProperty;
+ aProperty.Name = OUString::createFromAscii( "nodepath" );
+ aProperty.Value = makeAny( aConfigRoot );
+
+ Sequence< Any > aArgumentList( 1 );
+ aArgumentList[0] = makeAny( aProperty );
+
+ Reference< XNameAccess > xNameAccess =
+ Reference< XNameAccess > (
+ m_xConfigurationProvider->createInstanceWithArguments(
+ OUString::createFromAscii( "com.sun.star.configuration.ConfigurationAccess" ),
+ aArgumentList ),
+ UNO_QUERY );
+
+ if( xNameAccess.is() )
+ {
+ OUString aMailer;
+
+ // Retrieve the value for "Program" node and append it feed senddoc with it
+ // using the (undocumented) --mailclient switch
+ xNameAccess->getByName( OUString::createFromAscii( "Program" ) ) >>= aMailer;
+
+ if( aMailer.getLength() )
+ {
+ // make sure we have a system path
+ FileBase::getSystemPathFromFileURL( aMailer, aMailer );
+
+ aBuffer.append("--mailclient ");
+ aBuffer.append(OUStringToOString( aMailer, osl_getThreadTextEncoding() ));
+ aBuffer.append(" ");
+ }
+#ifdef MACOSX
+ else
+ aBuffer.append("--mailclient Mail ");
+#endif
+ }
+
+ }
+
+ catch( RuntimeException e )
+ {
+ m_xConfigurationProvider.clear();
+ OSL_TRACE( "RuntimeException caught accessing configuration provider." );
+ OSL_TRACE( OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ throw e;
+ }
+
+ // Append originator if set in the message
+ if ( xSimpleMailMessage->getOriginator().getLength() > 0 )
+ {
+ aBuffer.append("--from \"");
+ aBuffer.append(OUStringToOString(xSimpleMailMessage->getOriginator(), osl_getThreadTextEncoding()));
+ aBuffer.append("\" ");
+ }
+
+ // Append receipient if set in the message
+ if ( xSimpleMailMessage->getRecipient().getLength() > 0 )
+ {
+ aBuffer.append("--to \"");
+ aBuffer.append(OUStringToOString(xSimpleMailMessage->getRecipient(), osl_getThreadTextEncoding()));
+ aBuffer.append("\" ");
+ }
+
+ // Append carbon copy receipients set in the message
+ Sequence< OUString > aStringList = xSimpleMailMessage->getCcRecipient();
+ sal_Int32 n, nmax = aStringList.getLength();
+ for ( n = 0; n < nmax; n++ )
+ {
+ aBuffer.append("--cc \"");
+ aBuffer.append(OUStringToOString(aStringList[n], osl_getThreadTextEncoding()));
+ aBuffer.append("\" ");
+ }
+
+ // Append blind carbon copy receipients set in the message
+ aStringList = xSimpleMailMessage->getBccRecipient();
+ nmax = aStringList.getLength();
+ for ( n = 0; n < nmax; n++ )
+ {
+ aBuffer.append("--bcc \"");
+ aBuffer.append(OUStringToOString(aStringList[n], osl_getThreadTextEncoding()));
+ aBuffer.append("\" ");
+ }
+
+ // Append subject if set in the message
+ if ( xSimpleMailMessage->getSubject().getLength() > 0 )
+ {
+ aBuffer.append("--subject \"");
+ aBuffer.append(OUStringToOString(xSimpleMailMessage->getSubject(), osl_getThreadTextEncoding()));
+ aBuffer.append("\" ");
+ }
+
+ // Append attachments set in the message
+ aStringList = xSimpleMailMessage->getAttachement();
+ nmax = aStringList.getLength();
+ for ( n = 0; n < nmax; n++ )
+ {
+ OUString aSystemPath;
+ if ( FileBase::E_None == FileBase::getSystemPathFromFileURL(aStringList[n], aSystemPath) )
+ {
+ aBuffer.append("--attach \"");
+ aBuffer.append(OUStringToOString(aSystemPath, osl_getThreadTextEncoding()));
+ aBuffer.append("\" ");
+ }
+ }
+
+ OString cmd = aBuffer.makeStringAndClear();
+ if ( 0 != pclose(popen(cmd.getStr(), "w")) )
+ {
+ throw ::com::sun::star::uno::Exception(
+ OUString(RTL_CONSTASCII_USTRINGPARAM( "No mail client configured" )),
+ static_cast < XSimpleMailClient * > (this) );
+ }
+}
+
+// -------------------------------------------------
+// XServiceInfo
+// -------------------------------------------------
+
+OUString SAL_CALL CmdMailSuppl::getImplementationName( )
+ throw( RuntimeException )
+{
+ return OUString::createFromAscii( COMP_IMPL_NAME );
+}
+
+// -------------------------------------------------
+// XServiceInfo
+// -------------------------------------------------
+
+sal_Bool SAL_CALL CmdMailSuppl::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 CmdMailSuppl::getSupportedServiceNames( )
+ throw( RuntimeException )
+{
+ return Component_getSupportedServiceNames();
+}
+
diff --git a/shell/source/cmdmail/cmdmailsuppl.hxx b/shell/source/cmdmail/cmdmailsuppl.hxx
new file mode 100644
index 000000000000..343de67cb68c
--- /dev/null
+++ b/shell/source/cmdmail/cmdmailsuppl.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CMDMAILSUPPL_HXX_
+#define _CMDMAILSUPPL_HXX_
+
+//----------------------------------------------------------
+// includes of other projects
+//----------------------------------------------------------
+
+#include <cppuhelper/implbase3.hxx>
+#include <osl/mutex.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#ifndef _COM_SUN_STAR_SYS_SHELL_XSYSTEMSHELLEXECUTE_HPP_
+#include <com/sun/star/system/XSimpleMailClient.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_SYS_SHELL_XSYSTEMSHELLEXECUTE_HPP_
+#include <com/sun/star/system/XSimpleMailClientSupplier.hpp>
+#endif
+
+//----------------------------------------------------------
+// class declaration
+//----------------------------------------------------------
+
+class CmdMailSuppl :
+ public cppu::WeakImplHelper3<
+ com::sun::star::system::XSimpleMailClientSupplier,
+ com::sun::star::system::XSimpleMailClient,
+ com::sun::star::lang::XServiceInfo >
+{
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xConfigurationProvider;
+
+public:
+ CmdMailSuppl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
+
+ //------------------------------------------------
+ // XSimpleMailClientSupplier
+ //------------------------------------------------
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::system::XSimpleMailClient > SAL_CALL querySimpleMailClient( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //------------------------------------------------
+ // XSimpleMailClient
+ //------------------------------------------------
+
+ 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);
+
+ //------------------------------------------------
+ // 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);
+};
+
+#endif
diff --git a/shell/source/cmdmail/exports.dxp b/shell/source/cmdmail/exports.dxp
new file mode 100644
index 000000000000..f0e1c69934bc
--- /dev/null
+++ b/shell/source/cmdmail/exports.dxp
@@ -0,0 +1,2 @@
+component_getImplementationEnvironment
+component_getFactory
diff --git a/shell/source/cmdmail/makefile.mk b/shell/source/cmdmail/makefile.mk
new file mode 100644
index 000000000000..e4d5ec48b925
--- /dev/null
+++ b/shell/source/cmdmail/makefile.mk
@@ -0,0 +1,71 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=shell
+TARGET=cmdmail
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+COMP1TYPELIST=$(TARGET)
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+DLLPRE=
+
+SLOFILES= \
+ $(SLO)$/cmdmailsuppl.obj \
+ $(SLO)$/cmdmailmsg.obj \
+ $(SLO)$/cmdmailentry.obj
+SHL1OBJS=$(SLOFILES)
+
+SHL1TARGET=$(TARGET).uno
+SHL1IMPLIB=i$(TARGET)
+
+SHL1STDLIBS=$(CPPULIB)\
+ $(CPPUHELPERLIB)\
+ $(SALLIB)
+
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/cmdmail.component
+
+$(MISC)/cmdmail.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ cmdmail.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt cmdmail.component