LCOV - code coverage report
Current view: top level - shell/source/cmdmail - cmdmailmsg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 94 0.0 %
Date: 2012-08-25 Functions: 0 17 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <osl/diagnose.h>
      30                 :            : #include "cmdmailmsg.hxx"
      31                 :            : #include <com/sun/star/uri/XExternalUriReferenceTranslator.hpp>
      32                 :            : #include <com/sun/star/uri/ExternalUriReferenceTranslator.hpp>
      33                 :            : #include <com/sun/star/uno/Reference.hxx>
      34                 :            : #include <com/sun/star/uno/RuntimeException.hpp>
      35                 :            : 
      36                 :            : //------------------------------------------------------------------------
      37                 :            : // namespace directives
      38                 :            : //------------------------------------------------------------------------
      39                 :            : 
      40                 :            : using com::sun::star::lang::IllegalArgumentException;
      41                 :            : using com::sun::star::lang::WrappedTargetException;
      42                 :            : using com::sun::star::container::NoSuchElementException;
      43                 :            : using com::sun::star::container::XNameAccess;
      44                 :            : using rtl::OUString;
      45                 :            : using osl::MutexGuard;
      46                 :            : 
      47                 :            : using namespace cppu;
      48                 :            : using namespace com::sun::star::uno;
      49                 :            : 
      50                 :            : 
      51                 :            : //------------------------------------------------
      52                 :            : 
      53                 :          0 : void SAL_CALL CmdMailMsg::setRecipient( const ::rtl::OUString& aRecipient )
      54                 :            :     throw (RuntimeException)
      55                 :            : {
      56                 :          0 :     MutexGuard aGuard( m_aMutex );
      57                 :          0 :     m_aRecipient = aRecipient;
      58                 :          0 : }
      59                 :            : 
      60                 :            : //------------------------------------------------
      61                 :            : 
      62                 :          0 : ::rtl::OUString SAL_CALL CmdMailMsg::getRecipient(  )
      63                 :            :     throw (RuntimeException)
      64                 :            : {
      65                 :          0 :     MutexGuard aGuard( m_aMutex );
      66                 :          0 :     return m_aRecipient;
      67                 :            : }
      68                 :            : 
      69                 :            : //------------------------------------------------
      70                 :            : 
      71                 :          0 : void SAL_CALL CmdMailMsg::setCcRecipient( const Sequence< OUString >& aCcRecipient )
      72                 :            :     throw (RuntimeException)
      73                 :            : {
      74                 :          0 :     MutexGuard aGuard( m_aMutex );
      75                 :          0 :     m_CcRecipients = aCcRecipient;
      76                 :          0 : }
      77                 :            : 
      78                 :            : //------------------------------------------------
      79                 :            : 
      80                 :          0 : Sequence< OUString > SAL_CALL CmdMailMsg::getCcRecipient(  )
      81                 :            :     throw (RuntimeException)
      82                 :            : {
      83                 :          0 :     MutexGuard aGuard( m_aMutex );
      84                 :          0 :     return m_CcRecipients;
      85                 :            : }
      86                 :            : 
      87                 :            : //------------------------------------------------
      88                 :            : 
      89                 :          0 : void SAL_CALL CmdMailMsg::setBccRecipient( const Sequence< OUString >& aBccRecipient )
      90                 :            :     throw (RuntimeException)
      91                 :            : {
      92                 :          0 :     MutexGuard aGuard( m_aMutex );
      93                 :          0 :     m_BccRecipients = aBccRecipient;
      94                 :          0 : }
      95                 :            : 
      96                 :            : //------------------------------------------------
      97                 :            : 
      98                 :          0 : Sequence< OUString > SAL_CALL CmdMailMsg::getBccRecipient(  )
      99                 :            :     throw (RuntimeException)
     100                 :            : {
     101                 :          0 :     MutexGuard aGuard( m_aMutex );
     102                 :          0 :     return m_BccRecipients;
     103                 :            : }
     104                 :            : 
     105                 :            : //------------------------------------------------
     106                 :            : 
     107                 :          0 : void SAL_CALL CmdMailMsg::setOriginator( const OUString& aOriginator )
     108                 :            :     throw (RuntimeException)
     109                 :            : {
     110                 :          0 :     MutexGuard aGuard( m_aMutex );
     111                 :          0 :     m_aOriginator = aOriginator;
     112                 :          0 : }
     113                 :            : 
     114                 :            : //------------------------------------------------
     115                 :            : 
     116                 :          0 : OUString SAL_CALL CmdMailMsg::getOriginator(  )
     117                 :            :     throw (RuntimeException)
     118                 :            : {
     119                 :          0 :     MutexGuard aGuard( m_aMutex );
     120                 :          0 :     return m_aOriginator;
     121                 :            : }
     122                 :            : 
     123                 :            : //------------------------------------------------
     124                 :            : 
     125                 :          0 : void SAL_CALL CmdMailMsg::setSubject( const OUString& aSubject )
     126                 :            :     throw (RuntimeException)
     127                 :            : {
     128                 :          0 :     MutexGuard aGuard( m_aMutex );
     129                 :          0 :     m_aSubject = aSubject;
     130                 :          0 : }
     131                 :            : 
     132                 :            : //------------------------------------------------
     133                 :            : 
     134                 :          0 : OUString SAL_CALL CmdMailMsg::getSubject(  )
     135                 :            :     throw (RuntimeException)
     136                 :            : {
     137                 :          0 :     MutexGuard aGuard( m_aMutex );
     138                 :          0 :     return m_aSubject;
     139                 :            : }
     140                 :            : 
     141                 :            : //------------------------------------------------
     142                 :            : 
     143                 :          0 : void SAL_CALL CmdMailMsg::setAttachement( const Sequence< ::rtl::OUString >& aAttachment )
     144                 :            :     throw (IllegalArgumentException, RuntimeException)
     145                 :            : {
     146                 :          0 :     MutexGuard aGuard( m_aMutex );
     147                 :          0 :     m_Attachments = aAttachment;
     148                 :          0 : }
     149                 :            : 
     150                 :            : //------------------------------------------------
     151                 :            : 
     152                 :          0 : Sequence< OUString > SAL_CALL CmdMailMsg::getAttachement(  )
     153                 :            :     throw (RuntimeException)
     154                 :            : {
     155                 :          0 :     MutexGuard aGuard( m_aMutex );
     156                 :          0 :     return m_Attachments;
     157                 :            : }
     158                 :            : 
     159                 :            : //------------------------------------------------
     160                 :            : 
     161                 :          0 : Any SAL_CALL CmdMailMsg::getByName( const OUString& aName )
     162                 :            :     throw (NoSuchElementException, WrappedTargetException, RuntimeException)
     163                 :            : {
     164                 :          0 :     MutexGuard aGuard( m_aMutex );
     165                 :            : 
     166                 :          0 :     if( 0 == aName.compareToAscii( "from" ) &&  !m_aOriginator.isEmpty() )
     167                 :          0 :         return makeAny( m_aOriginator );
     168                 :            : 
     169                 :          0 :     else if( 0 == aName.compareToAscii( "to" ) &&  !m_aRecipient.isEmpty() )
     170                 :          0 :         return makeAny( m_aRecipient );
     171                 :            : 
     172                 :          0 :     else if( 0 == aName.compareToAscii( "cc" ) &&  m_CcRecipients.getLength() )
     173                 :          0 :         return makeAny( m_CcRecipients );
     174                 :            : 
     175                 :          0 :     else if( 0 == aName.compareToAscii( "bcc" ) &&  m_BccRecipients.getLength() )
     176                 :          0 :         return makeAny( m_BccRecipients );
     177                 :            : 
     178                 :          0 :     else if( 0 == aName.compareToAscii( "subject" ) &&  !m_aSubject.isEmpty() )
     179                 :          0 :         return makeAny( m_aSubject );
     180                 :            : 
     181                 :          0 :     else if( 0 == aName.compareToAscii( "attachment" ) &&  m_Attachments.getLength() )
     182                 :          0 :         return makeAny( m_Attachments );
     183                 :            : 
     184                 :            :    throw NoSuchElementException( OUString("key not found: ") + aName,
     185                 :          0 :         static_cast < XNameAccess * > (this) );
     186                 :            : }
     187                 :            : 
     188                 :            : //------------------------------------------------
     189                 :            : 
     190                 :          0 : Sequence< OUString > SAL_CALL CmdMailMsg::getElementNames(  )
     191                 :            :     throw (::com::sun::star::uno::RuntimeException)
     192                 :            : {
     193                 :          0 :     MutexGuard aGuard( m_aMutex );
     194                 :            : 
     195                 :          0 :     sal_Int32 nItems = 0;
     196                 :          0 :     Sequence< OUString > aRet( 6 );
     197                 :            : 
     198                 :          0 :     if( !m_aOriginator.isEmpty() )
     199                 :          0 :         aRet[nItems++] = OUString("from");
     200                 :            : 
     201                 :          0 :     if( !m_aRecipient.isEmpty() )
     202                 :          0 :         aRet[nItems++] = OUString("to");
     203                 :            : 
     204                 :          0 :     if( m_CcRecipients.getLength() )
     205                 :          0 :         aRet[nItems++] = OUString("cc");
     206                 :            : 
     207                 :          0 :     if( m_BccRecipients.getLength() )
     208                 :          0 :         aRet[nItems++] = OUString("bcc");
     209                 :            : 
     210                 :          0 :     if( !m_aSubject.isEmpty() )
     211                 :          0 :         aRet[nItems++] = OUString("subject");
     212                 :            : 
     213                 :          0 :     if( m_Attachments.getLength() )
     214                 :          0 :         aRet[nItems++] = OUString("attachment");
     215                 :            : 
     216                 :          0 :     aRet.realloc( nItems );
     217                 :          0 :     return aRet;
     218                 :            : }
     219                 :            : 
     220                 :            : //------------------------------------------------
     221                 :            : 
     222                 :          0 :  sal_Bool SAL_CALL CmdMailMsg::hasByName( const ::rtl::OUString& aName )
     223                 :            :     throw (RuntimeException)
     224                 :            : {
     225                 :          0 :     MutexGuard aGuard( m_aMutex );
     226                 :            : 
     227                 :          0 :     if( 0 == aName.compareToAscii( "from" ) &&  !m_aOriginator.isEmpty() )
     228                 :          0 :         return sal_True;
     229                 :            : 
     230                 :          0 :     else if( 0 == aName.compareToAscii( "to" ) &&  !m_aRecipient.isEmpty() )
     231                 :          0 :         return sal_True;
     232                 :            : 
     233                 :          0 :     else if( 0 == aName.compareToAscii( "cc" ) &&  m_CcRecipients.getLength() )
     234                 :          0 :         return sal_True;
     235                 :            : 
     236                 :          0 :     else if( 0 == aName.compareToAscii( "bcc" ) &&  m_BccRecipients.getLength() )
     237                 :          0 :         return sal_True;
     238                 :            : 
     239                 :          0 :     else if( 0 == aName.compareToAscii( "subject" ) &&  !m_aSubject.isEmpty() )
     240                 :          0 :         return sal_True;
     241                 :            : 
     242                 :          0 :     else if( 0 == aName.compareToAscii( "attachment" ) &&  m_Attachments.getLength() )
     243                 :          0 :         return sal_True;
     244                 :            : 
     245                 :          0 :     return sal_False;
     246                 :            : }
     247                 :            : 
     248                 :            : //------------------------------------------------
     249                 :            : 
     250                 :          0 : Type SAL_CALL CmdMailMsg::getElementType(  )
     251                 :            :     throw (RuntimeException)
     252                 :            : {
     253                 :            :     // returning void for multi type container
     254                 :          0 :     return Type();
     255                 :            : }
     256                 :            : 
     257                 :            : //------------------------------------------------
     258                 :            : 
     259                 :          0 : sal_Bool SAL_CALL CmdMailMsg::hasElements(  )
     260                 :            :     throw (RuntimeException)
     261                 :            : {
     262                 :          0 :     return 0 != getElementNames().getLength();
     263                 :            : }
     264                 :            : 
     265                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10