forked from amazingfate/loongoffice
For some functions and all kinds of Exceptions. CannotConvertException CloseVetoException DisposedException EmptyUndoStackException ErrorCodeIOException Exception GridInvalidDataException GridInvalidModelException IOException IllegalAccessException IllegalArgumentException IllegalTypeException IndexOutOfBoundsException NoMasterException NoSuchElementException NoSupportException PropertyVetoException RuntimeException SAXException ScannerException StorageWrappedTargetException UnsupportedFlavorException VetoException WrappedTargetException ZipIOException throwGenericSQLException throwIllegallArgumentException createInstance createInstanceWithContext forName getByName getPackageManager getPropertyValue getUnpackedValueOrDefault getValueByName hasPropertyByName openKey setName setPropertyValue supportsService bash command: for i in `cat list`; do git grep "$i\s*(\s*OUString(\s*\"" -- '*.[hc]xx' | cut -d ':' -f1 | sort -u | xargs sed -i -e "s/\(\<$i\s*(\)\s*OUString(\s*\(\"[^\")\\]*\"\)\s*)\s*/\1\2/g" -e "s/\($i.*\)\"+ /\1\" + /g"; done Change-Id: Iaf8e641b0abf28c082906014f87a183517630535 Reviewed-on: https://gerrit.libreoffice.org/4624 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Thomas Arnhold <thomas@arnhold.org> Tested-by: Thomas Arnhold <thomas@arnhold.org>
236 lines
6.5 KiB
C++
236 lines
6.5 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/*
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
* This file incorporates work covered by the following license notice:
|
|
*
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
* with this work for additional information regarding copyright
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
* License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
|
|
*/
|
|
|
|
#include "cmdmailmsg.hxx"
|
|
|
|
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 osl::MutexGuard;
|
|
|
|
using namespace cppu;
|
|
using namespace com::sun::star::uno;
|
|
|
|
|
|
void SAL_CALL CmdMailMsg::setBody( const OUString& aBody )
|
|
throw (RuntimeException)
|
|
{
|
|
MutexGuard aGuard( m_aMutex );
|
|
m_aBody = aBody;
|
|
}
|
|
|
|
OUString SAL_CALL CmdMailMsg::getBody( )
|
|
throw (RuntimeException)
|
|
{
|
|
MutexGuard aGuard( m_aMutex );
|
|
return m_aBody;
|
|
}
|
|
|
|
void SAL_CALL CmdMailMsg::setRecipient( const OUString& aRecipient )
|
|
throw (RuntimeException)
|
|
{
|
|
MutexGuard aGuard( m_aMutex );
|
|
m_aRecipient = aRecipient;
|
|
}
|
|
|
|
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< 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( "body" ) && !m_aBody.isEmpty() )
|
|
return makeAny( m_aBody );
|
|
|
|
if( 0 == aName.compareToAscii( "from" ) && !m_aOriginator.isEmpty() )
|
|
return makeAny( m_aOriginator );
|
|
|
|
else if( 0 == aName.compareToAscii( "to" ) && !m_aRecipient.isEmpty() )
|
|
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.isEmpty() )
|
|
return makeAny( m_aSubject );
|
|
|
|
else if( 0 == aName.compareToAscii( "attachment" ) && m_Attachments.getLength() )
|
|
return makeAny( m_Attachments );
|
|
|
|
throw NoSuchElementException("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( 7 );
|
|
|
|
if( !m_aBody.isEmpty() )
|
|
aRet[nItems++] = OUString("body");
|
|
|
|
if( !m_aOriginator.isEmpty() )
|
|
aRet[nItems++] = OUString("from");
|
|
|
|
if( !m_aRecipient.isEmpty() )
|
|
aRet[nItems++] = OUString("to");
|
|
|
|
if( m_CcRecipients.getLength() )
|
|
aRet[nItems++] = OUString("cc");
|
|
|
|
if( m_BccRecipients.getLength() )
|
|
aRet[nItems++] = OUString("bcc");
|
|
|
|
if( !m_aSubject.isEmpty() )
|
|
aRet[nItems++] = OUString("subject");
|
|
|
|
if( m_Attachments.getLength() )
|
|
aRet[nItems++] = OUString("attachment");
|
|
|
|
aRet.realloc( nItems );
|
|
return aRet;
|
|
}
|
|
|
|
sal_Bool SAL_CALL CmdMailMsg::hasByName( const OUString& aName )
|
|
throw (RuntimeException)
|
|
{
|
|
MutexGuard aGuard( m_aMutex );
|
|
|
|
if( 0 == aName.compareToAscii( "body" ) && !m_aBody.isEmpty() )
|
|
return sal_True;
|
|
|
|
if( 0 == aName.compareToAscii( "from" ) && !m_aOriginator.isEmpty() )
|
|
return sal_True;
|
|
|
|
else if( 0 == aName.compareToAscii( "to" ) && !m_aRecipient.isEmpty() )
|
|
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.isEmpty() )
|
|
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();
|
|
}
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|