LCOV - code coverage report
Current view: top level - shell/source/cmdmail - cmdmailmsg.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 108 0.0 %
Date: 2014-11-03 Functions: 0 19 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "cmdmailmsg.hxx"
      21             : 
      22             : using com::sun::star::lang::IllegalArgumentException;
      23             : using com::sun::star::lang::WrappedTargetException;
      24             : using com::sun::star::container::NoSuchElementException;
      25             : using com::sun::star::container::XNameAccess;
      26             : using osl::MutexGuard;
      27             : 
      28             : using namespace cppu;
      29             : using namespace com::sun::star::uno;
      30             : 
      31             : 
      32           0 : void SAL_CALL CmdMailMsg::setBody( const OUString& aBody )
      33             :     throw (RuntimeException, std::exception)
      34             : {
      35           0 :     MutexGuard aGuard( m_aMutex );
      36           0 :     m_aBody = aBody;
      37           0 : }
      38             : 
      39           0 : OUString SAL_CALL CmdMailMsg::getBody(  )
      40             :     throw (RuntimeException, std::exception)
      41             : {
      42           0 :     MutexGuard aGuard( m_aMutex );
      43           0 :     return m_aBody;
      44             : }
      45             : 
      46           0 : void SAL_CALL CmdMailMsg::setRecipient( const OUString& aRecipient )
      47             :     throw (RuntimeException, std::exception)
      48             : {
      49           0 :     MutexGuard aGuard( m_aMutex );
      50           0 :     m_aRecipient = aRecipient;
      51           0 : }
      52             : 
      53           0 : OUString SAL_CALL CmdMailMsg::getRecipient(  )
      54             :     throw (RuntimeException, std::exception)
      55             : {
      56           0 :     MutexGuard aGuard( m_aMutex );
      57           0 :     return m_aRecipient;
      58             : }
      59             : 
      60           0 : void SAL_CALL CmdMailMsg::setCcRecipient( const Sequence< OUString >& aCcRecipient )
      61             :     throw (RuntimeException, std::exception)
      62             : {
      63           0 :     MutexGuard aGuard( m_aMutex );
      64           0 :     m_CcRecipients = aCcRecipient;
      65           0 : }
      66             : 
      67           0 : Sequence< OUString > SAL_CALL CmdMailMsg::getCcRecipient(  )
      68             :     throw (RuntimeException, std::exception)
      69             : {
      70           0 :     MutexGuard aGuard( m_aMutex );
      71           0 :     return m_CcRecipients;
      72             : }
      73             : 
      74           0 : void SAL_CALL CmdMailMsg::setBccRecipient( const Sequence< OUString >& aBccRecipient )
      75             :     throw (RuntimeException, std::exception)
      76             : {
      77           0 :     MutexGuard aGuard( m_aMutex );
      78           0 :     m_BccRecipients = aBccRecipient;
      79           0 : }
      80             : 
      81           0 : Sequence< OUString > SAL_CALL CmdMailMsg::getBccRecipient(  )
      82             :     throw (RuntimeException, std::exception)
      83             : {
      84           0 :     MutexGuard aGuard( m_aMutex );
      85           0 :     return m_BccRecipients;
      86             : }
      87             : 
      88           0 : void SAL_CALL CmdMailMsg::setOriginator( const OUString& aOriginator )
      89             :     throw (RuntimeException, std::exception)
      90             : {
      91           0 :     MutexGuard aGuard( m_aMutex );
      92           0 :     m_aOriginator = aOriginator;
      93           0 : }
      94             : 
      95           0 : OUString SAL_CALL CmdMailMsg::getOriginator(  )
      96             :     throw (RuntimeException, std::exception)
      97             : {
      98           0 :     MutexGuard aGuard( m_aMutex );
      99           0 :     return m_aOriginator;
     100             : }
     101             : 
     102           0 : void SAL_CALL CmdMailMsg::setSubject( const OUString& aSubject )
     103             :     throw (RuntimeException, std::exception)
     104             : {
     105           0 :     MutexGuard aGuard( m_aMutex );
     106           0 :     m_aSubject = aSubject;
     107           0 : }
     108             : 
     109           0 : OUString SAL_CALL CmdMailMsg::getSubject(  )
     110             :     throw (RuntimeException, std::exception)
     111             : {
     112           0 :     MutexGuard aGuard( m_aMutex );
     113           0 :     return m_aSubject;
     114             : }
     115             : 
     116           0 : void SAL_CALL CmdMailMsg::setAttachement( const Sequence< OUString >& aAttachment )
     117             :     throw (IllegalArgumentException, RuntimeException, std::exception)
     118             : {
     119           0 :     MutexGuard aGuard( m_aMutex );
     120           0 :     m_Attachments = aAttachment;
     121           0 : }
     122             : 
     123           0 : Sequence< OUString > SAL_CALL CmdMailMsg::getAttachement(  )
     124             :     throw (RuntimeException, std::exception)
     125             : {
     126           0 :     MutexGuard aGuard( m_aMutex );
     127           0 :     return m_Attachments;
     128             : }
     129             : 
     130           0 : Any SAL_CALL CmdMailMsg::getByName( const OUString& aName )
     131             :     throw (NoSuchElementException, WrappedTargetException, RuntimeException, std::exception)
     132             : {
     133           0 :     MutexGuard aGuard( m_aMutex );
     134             : 
     135           0 :     if( aName.equalsAscii( "body" ) &&  !m_aBody.isEmpty() )
     136           0 :         return makeAny( m_aBody );
     137             : 
     138           0 :     if( aName.equalsAscii( "from" ) &&  !m_aOriginator.isEmpty() )
     139           0 :         return makeAny( m_aOriginator );
     140             : 
     141           0 :     else if( aName.equalsAscii( "to" ) &&  !m_aRecipient.isEmpty() )
     142           0 :         return makeAny( m_aRecipient );
     143             : 
     144           0 :     else if( aName.equalsAscii( "cc" ) &&  m_CcRecipients.getLength() )
     145           0 :         return makeAny( m_CcRecipients );
     146             : 
     147           0 :     else if( aName.equalsAscii( "bcc" ) &&  m_BccRecipients.getLength() )
     148           0 :         return makeAny( m_BccRecipients );
     149             : 
     150           0 :     else if( aName.equalsAscii( "subject" ) &&  !m_aSubject.isEmpty() )
     151           0 :         return makeAny( m_aSubject );
     152             : 
     153           0 :     else if( aName.equalsAscii( "attachment" ) &&  m_Attachments.getLength() )
     154           0 :         return makeAny( m_Attachments );
     155             : 
     156           0 :    throw NoSuchElementException("key not found: " + aName,
     157           0 :         static_cast < XNameAccess * > (this) );
     158             : }
     159             : 
     160           0 : Sequence< OUString > SAL_CALL CmdMailMsg::getElementNames(  )
     161             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
     162             : {
     163           0 :     MutexGuard aGuard( m_aMutex );
     164             : 
     165           0 :     sal_Int32 nItems = 0;
     166           0 :     Sequence< OUString > aRet( 7 );
     167             : 
     168           0 :     if( !m_aBody.isEmpty() )
     169           0 :         aRet[nItems++] = "body";
     170             : 
     171           0 :     if( !m_aOriginator.isEmpty() )
     172           0 :         aRet[nItems++] = "from";
     173             : 
     174           0 :     if( !m_aRecipient.isEmpty() )
     175           0 :         aRet[nItems++] = "to";
     176             : 
     177           0 :     if( m_CcRecipients.getLength() )
     178           0 :         aRet[nItems++] = "cc";
     179             : 
     180           0 :     if( m_BccRecipients.getLength() )
     181           0 :         aRet[nItems++] = "bcc";
     182             : 
     183           0 :     if( !m_aSubject.isEmpty() )
     184           0 :         aRet[nItems++] = "subject";
     185             : 
     186           0 :     if( m_Attachments.getLength() )
     187           0 :         aRet[nItems++] = "attachment";
     188             : 
     189           0 :     aRet.realloc( nItems );
     190           0 :     return aRet;
     191             : }
     192             : 
     193           0 :  sal_Bool SAL_CALL CmdMailMsg::hasByName( const OUString& aName )
     194             :     throw (RuntimeException, std::exception)
     195             : {
     196           0 :     MutexGuard aGuard( m_aMutex );
     197             : 
     198           0 :     if( aName.equalsAscii( "body" ) &&  !m_aBody.isEmpty() )
     199           0 :         return sal_True;
     200             : 
     201           0 :     if( aName.equalsAscii( "from" ) &&  !m_aOriginator.isEmpty() )
     202           0 :         return sal_True;
     203             : 
     204           0 :     else if( aName.equalsAscii( "to" ) &&  !m_aRecipient.isEmpty() )
     205           0 :         return sal_True;
     206             : 
     207           0 :     else if( aName.equalsAscii( "cc" ) &&  m_CcRecipients.getLength() )
     208           0 :         return sal_True;
     209             : 
     210           0 :     else if( aName.equalsAscii( "bcc" ) &&  m_BccRecipients.getLength() )
     211           0 :         return sal_True;
     212             : 
     213           0 :     else if( aName.equalsAscii( "subject" ) &&  !m_aSubject.isEmpty() )
     214           0 :         return sal_True;
     215             : 
     216           0 :     else if( aName.equalsAscii( "attachment" ) &&  m_Attachments.getLength() )
     217           0 :         return sal_True;
     218             : 
     219           0 :     return sal_False;
     220             : }
     221             : 
     222           0 : Type SAL_CALL CmdMailMsg::getElementType(  )
     223             :     throw (RuntimeException, std::exception)
     224             : {
     225             :     // returning void for multi type container
     226           0 :     return Type();
     227             : }
     228             : 
     229           0 : sal_Bool SAL_CALL CmdMailMsg::hasElements(  )
     230             :     throw (RuntimeException, std::exception)
     231             : {
     232           0 :     return 0 != getElementNames().getLength();
     233             : }
     234             : 
     235             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10