Kaydet (Commit) 878f279f authored tarafından Noel Grandin's avatar Noel Grandin

convert include/sfx2/mailmodelapi.hxx from String to OUString

Change-Id: Ib6ea30bf17a30f7df9be8ce5643b34eed360a06e
üst 92cda0a9
......@@ -27,8 +27,7 @@
#include "sfx2/dllapi.h"
// class AddressList_Impl ------------------------------------------------
typedef String* AddressItemPtr_Impl;
typedef ::std::vector< AddressItemPtr_Impl > AddressList_Impl;
typedef ::std::vector< OUString > AddressList_Impl;
// class SfxMailModel_Impl -----------------------------------------------
......@@ -74,13 +73,12 @@ private:
AddressList_Impl* mpToList;
AddressList_Impl* mpCcList;
AddressList_Impl* mpBccList;
String maFromAddress;
String maSubject;
OUString maFromAddress;
OUString maSubject;
MailPriority mePriority;
sal_Bool mbLoadDone;
void ClearList( AddressList_Impl* pList );
SaveResult ShowFilterOptionsDialog( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMGR,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel,
const OUString& rFilterName,
......@@ -102,9 +100,9 @@ public:
SfxMailModel();
~SfxMailModel();
void AddAddress( const String& rAddress, AddressRole eRole );
void SetFromAddress( const String& rAddress ) { maFromAddress = rAddress; }
void SetSubject( const String& rSubject ) { maSubject = rSubject; }
void AddAddress( const OUString& rAddress, AddressRole eRole );
void SetFromAddress( const OUString& rAddress ) { maFromAddress = rAddress; }
void SetSubject( const OUString& rSubject ) { maSubject = rSubject; }
void SetPriority( MailPriority ePrio ) { mePriority = ePrio; }
/** attaches a document to the current attachment list, can be called more than once.
......@@ -129,7 +127,7 @@ public:
sal_Bool IsEmpty() const;
};
sal_Bool CreateFromAddress_Impl( String& rFrom );
sal_Bool CreateFromAddress_Impl( OUString& rFrom );
#endif // INCLUDED_SFX_MAILMODEL_HXX
......
......@@ -131,16 +131,6 @@ void PrepareListener_Impl::disposing(const css::lang::EventObject& /*rEvent*/) t
static const char PDF_DOCUMENT_TYPE[] = "pdf_Portable_Document_Format";
void SfxMailModel::ClearList( AddressList_Impl* pList )
{
if ( pList )
{
for( size_t i = 0, n = pList->size(); i < n; ++i )
delete pList->at(i);
pList->clear();
}
}
sal_Bool HasDocumentValidSignature( const css::uno::Reference< css::frame::XModel >& xModel )
{
try
......@@ -701,18 +691,15 @@ SfxMailModel::SfxMailModel() :
SfxMailModel::~SfxMailModel()
{
ClearList( mpToList );
delete mpToList;
ClearList( mpCcList );
delete mpCcList;
ClearList( mpBccList );
delete mpBccList;
}
void SfxMailModel::AddAddress( const String& rAddress, AddressRole eRole )
void SfxMailModel::AddAddress( const OUString& rAddress, AddressRole eRole )
{
// don't add a empty address
if ( rAddress.Len() > 0 )
if ( !rAddress.isEmpty() )
{
AddressList_Impl* pList = NULL;
if ( ROLE_TO == eRole )
......@@ -744,8 +731,7 @@ void SfxMailModel::AddAddress( const String& rAddress, AddressRole eRole )
if ( pList )
{
// add address to list
AddressItemPtr_Impl pAddress = new String( rAddress );
pList->push_back( pAddress );
pList->push_back( rAddress );
}
}
}
......@@ -804,7 +790,7 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css:
if ( xSimpleMailMessage.is() )
{
sal_Int32 nSendFlags = SimpleMailClientFlags::DEFAULTS;
if ( maFromAddress.Len() == 0 )
if ( maFromAddress.isEmpty() )
{
// from address not set, try figure out users e-mail address
CreateFromAddress_Impl( maFromAddress );
......@@ -819,12 +805,12 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css:
if ( nToCount > 1 )
{
nCcSeqCount = nToCount - 1 + nCcCount;
xSimpleMailMessage->setRecipient( *mpToList->at( 0 ) );
xSimpleMailMessage->setRecipient( mpToList->at( 0 ) );
nSendFlags = SimpleMailClientFlags::NO_USER_INTERFACE;
}
else if ( nToCount == 1 )
{
xSimpleMailMessage->setRecipient( *mpToList->at( 0 ) );
xSimpleMailMessage->setRecipient( mpToList->at( 0 ) );
nSendFlags = SimpleMailClientFlags::NO_USER_INTERFACE;
}
......@@ -839,13 +825,13 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css:
{
for ( size_t i = 1; i < nToCount; ++i )
{
aCcRecipientSeq[nIndex++] = *mpToList->at(i);
aCcRecipientSeq[nIndex++] = mpToList->at(i);
}
}
for ( size_t i = 0; i < nCcCount; i++ )
{
aCcRecipientSeq[nIndex++] = *mpCcList->at(i);
aCcRecipientSeq[nIndex++] = mpCcList->at(i);
}
xSimpleMailMessage->setCcRecipient( aCcRecipientSeq );
}
......@@ -856,7 +842,7 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css:
Sequence< OUString > aBccRecipientSeq( nBccCount );
for ( size_t i = 0; i < nBccCount; ++i )
{
aBccRecipientSeq[i] = *mpBccList->at(i);
aBccRecipientSeq[i] = mpBccList->at(i);
}
xSimpleMailMessage->setBccRecipient( aBccRecipientSeq );
}
......@@ -928,7 +914,7 @@ SfxMailModel::SendMailResult SfxMailModel::SaveAndSend( const css::uno::Referenc
// functions -------------------------------------------------------------
sal_Bool CreateFromAddress_Impl( String& rFrom )
sal_Bool CreateFromAddress_Impl( OUString& rFrom )
/* [Description]
......@@ -953,7 +939,7 @@ sal_Bool CreateFromAddress_Impl( String& rFrom )
rFrom = comphelper::string::strip(aFirstName, ' ');
if ( aName.Len() )
rFrom += ' ';
rFrom += " ";
}
rFrom += comphelper::string::strip(aName, ' ');
// remove illegal characters
......@@ -969,13 +955,13 @@ sal_Bool CreateFromAddress_Impl( String& rFrom )
if ( aEmailName.Len() )
{
if ( rFrom.Len() )
rFrom += ' ';
( ( rFrom += '<' ) += comphelper::string::strip(aEmailName, ' ') ) += '>';
if ( !rFrom.isEmpty() )
rFrom += " ";
rFrom = rFrom + "<" + comphelper::string::strip(aEmailName, ' ') + ">";
}
else
rFrom.Erase();
return ( rFrom.Len() > 0 );
rFrom = "";
return !rFrom.isEmpty();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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