[Libreoffice-commits] .: sfx2/inc sfx2/source
Joseph Powers
jpowers at kemper.freedesktop.org
Fri Dec 17 07:51:08 PST 2010
sfx2/inc/mailmodelapi.hxx | 32 ++++++++++----------
sfx2/source/dialog/mailmodel.cxx | 57 +++++++++++++++---------------------
sfx2/source/dialog/mailmodelapi.cxx | 27 ++++++-----------
3 files changed, 52 insertions(+), 64 deletions(-)
New commits:
commit dcac46d40f8874880476edde078417d1a782d2a4
Author: Joseph Powers <jpowers27 at cox.net>
Date: Fri Dec 17 07:50:58 2010 -0800
Remove DECLARE_LIST( AddressList_Impl, AddressItemPtr_Impl )
diff --git a/sfx2/inc/mailmodelapi.hxx b/sfx2/inc/mailmodelapi.hxx
index 685e74b..9072811 100644
--- a/sfx2/inc/mailmodelapi.hxx
+++ b/sfx2/inc/mailmodelapi.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -34,12 +34,14 @@
#include "tools/link.hxx"
#include <tools/string.hxx>
#include "sfx2/dllapi.h"
-
-// class SfxMailModel_Impl -----------------------------------------------
-class AddressList_Impl;
+// class AddressList_Impl ------------------------------------------------
+typedef String* AddressItemPtr_Impl;
+typedef ::std::vector< AddressItemPtr_Impl > AddressList_Impl;
+
+// class SfxMailModel_Impl -----------------------------------------------
-class SFX2_DLLPUBLIC SfxMailModel
+class SFX2_DLLPUBLIC SfxMailModel
{
public:
enum MailPriority
@@ -85,8 +87,8 @@ private:
void ClearList( AddressList_Impl* pList );
void MakeValueList( AddressList_Impl* pList, String& rValueList );
SaveResult SaveDocumentAsFormat( const rtl::OUString& aSaveFileName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xFrameOrModel,
- const rtl::OUString& rType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xFrameOrModel,
+ const rtl::OUString& rType,
rtl::OUString& rFileNamePath );
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,
@@ -105,7 +107,7 @@ public:
SEND_MAIL_CANCELLED,
SEND_MAIL_ERROR
};
-
+
SfxMailModel();
~SfxMailModel();
@@ -113,26 +115,26 @@ public:
void SetFromAddress( const String& rAddress ) { maFromAddress = rAddress; }
void SetSubject( const String& rSubject ) { maSubject = rSubject; }
void SetPriority( MailPriority ePrio ) { mePriority = ePrio; }
-
+
/** attaches a document to the current attachment list, can be called more than once.
* at the moment there will be a dialog for export executed for every model which is going to be attached.
*
- * \param sDocumentType
+ * \param sDocumentType
The doc type to export. PDF will be at the moment only a direct export (no dialog).
- * \param xModel
+ * \param xModel
The current model to attach
- * \param sAttachmentTitle
+ * \param sAttachmentTitle
The title which will be used as attachment title
* \return @see error code
*/
- SendMailResult AttachDocument( const ::rtl::OUString& sDocumentType,
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xFrameOrModel,
+ SendMailResult AttachDocument( const ::rtl::OUString& sDocumentType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xFrameOrModel,
const ::rtl::OUString& sAttachmentTitle );
SendMailResult SaveAndSend( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
const rtl::OUString& rType );
SendMailResult Send( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame );
-
+
sal_Int32 GetCount() const;
sal_Bool IsEmpty() const;
};
diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx
index c3f0d25..bff3f05 100644
--- a/sfx2/source/dialog/mailmodel.cxx
+++ b/sfx2/source/dialog/mailmodel.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -96,11 +96,6 @@ using namespace ::rtl;
namespace css = ::com::sun::star;
-// class AddressList_Impl ------------------------------------------------
-
-typedef String* AddressItemPtr_Impl;
-DECLARE_LIST( AddressList_Impl, AddressItemPtr_Impl )
-
// class SfxMailModel -----------------------------------------------
static const char PDF_DOCUMENT_TYPE[] = "pdf_Portable_Document_Format";
@@ -110,10 +105,9 @@ void SfxMailModel::ClearList( AddressList_Impl* pList )
{
if ( pList )
{
- ULONG i, nCount = pList->Count();
- for ( i = 0; i < nCount; ++i )
- delete pList->GetObject(i);
- pList->Clear();
+ for( size_t i = 0, n = pList->size(); i < n; ++i )
+ delete pList->at(i);
+ pList->clear();
}
}
@@ -122,12 +116,11 @@ void SfxMailModel::MakeValueList( AddressList_Impl* pList, String& rValueList )
rValueList.Erase();
if ( pList )
{
- ULONG i, nCount = pList->Count();
- for ( i = 0; i < nCount; ++i )
+ for( size_t i = 0, n = pList->size(); i < n; ++i )
{
if ( rValueList.Len() > 0 )
rValueList += ',';
- rValueList += *pList->GetObject(i);
+ rValueList += *pList->at(i);
}
}
}
@@ -704,21 +697,21 @@ void SfxMailModel::AddAddress( const String& rAddress, AddressRole eRole )
{
if ( !mpToList )
// create the list
- mpToList = new AddressList_Impl;
+ mpToList = new AddressList_Impl();
pList = mpToList;
}
else if ( ROLE_CC == eRole )
{
if ( !mpCcList )
// create the list
- mpCcList = new AddressList_Impl;
+ mpCcList = new AddressList_Impl();
pList = mpCcList;
}
else if ( ROLE_BCC == eRole )
{
if ( !mpBccList )
// create the list
- mpBccList = new AddressList_Impl;
+ mpBccList = new AddressList_Impl();
pList = mpBccList;
}
else
@@ -730,7 +723,7 @@ void SfxMailModel::AddAddress( const String& rAddress, AddressRole eRole )
{
// add address to list
AddressItemPtr_Impl pAddress = new String( rAddress );
- pList->Insert( pAddress, LIST_APPEND );
+ pList->push_back( pAddress );
}
}
}
@@ -793,58 +786,58 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css:
}
xSimpleMailMessage->setOriginator( maFromAddress );
- sal_Int32 nToCount = mpToList ? mpToList->Count() : 0;
- sal_Int32 nCcCount = mpCcList ? mpCcList->Count() : 0;
- sal_Int32 nCcSeqCount = nCcCount;
+ size_t nToCount = mpToList ? mpToList->size() : 0;
+ size_t nCcCount = mpCcList ? mpCcList->size() : 0;
+ size_t nCcSeqCount = nCcCount;
// set recipient (only one) for this simple mail server!!
if ( nToCount > 1 )
{
nCcSeqCount = nToCount - 1 + nCcCount;
- xSimpleMailMessage->setRecipient( *mpToList->GetObject( 0 ));
+ xSimpleMailMessage->setRecipient( *mpToList->at( 0 ) );
nSendFlags = SimpleMailClientFlags::NO_USER_INTERFACE;
}
else if ( nToCount == 1 )
{
- xSimpleMailMessage->setRecipient( *mpToList->GetObject( 0 ));
+ xSimpleMailMessage->setRecipient( *mpToList->at( 0 ) );
nSendFlags = SimpleMailClientFlags::NO_USER_INTERFACE;
}
// all other recipient must be handled with CC recipients!
if ( nCcSeqCount > 0 )
{
- sal_Int32 nIndex = 0;
- Sequence< OUString > aCcRecipientSeq;
+ size_t nIndex = 0;
+ Sequence< OUString > aCcRecipientSeq;
aCcRecipientSeq.realloc( nCcSeqCount );
if ( nCcSeqCount > nCcCount )
{
- for ( sal_Int32 i = 1; i < nToCount; ++i )
+ for ( size_t i = 1; i < nToCount; ++i )
{
- aCcRecipientSeq[nIndex++] = *mpToList->GetObject(i);
+ aCcRecipientSeq[nIndex++] = *mpToList->at(i);
}
}
- for ( sal_Int32 i = 0; i < nCcCount; i++ )
+ for ( size_t i = 0; i < nCcCount; i++ )
{
- aCcRecipientSeq[nIndex++] = *mpCcList->GetObject(i);
+ aCcRecipientSeq[nIndex++] = *mpCcList->at(i);
}
xSimpleMailMessage->setCcRecipient( aCcRecipientSeq );
}
- sal_Int32 nBccCount = mpBccList ? mpBccList->Count() : 0;
+ size_t nBccCount = mpBccList ? mpBccList->size() : 0;
if ( nBccCount > 0 )
{
Sequence< OUString > aBccRecipientSeq( nBccCount );
- for ( sal_Int32 i = 0; i < nBccCount; ++i )
+ for ( size_t i = 0; i < nBccCount; ++i )
{
- aBccRecipientSeq[i] = *mpBccList->GetObject(i);
+ aBccRecipientSeq[i] = *mpBccList->at(i);
}
xSimpleMailMessage->setBccRecipient( aBccRecipientSeq );
}
Sequence< OUString > aAttachmentSeq(&(maAttachedDocuments[0]),maAttachedDocuments.size());
-
+
if ( xSimpleMailMessage->getSubject().getLength() == 0 ) {
OUString baseName( maAttachedDocuments[0].copy( maAttachedDocuments[0].lastIndexOf( '/' ) + 1 ) );
OUString subject( baseName );
diff --git a/sfx2/source/dialog/mailmodelapi.cxx b/sfx2/source/dialog/mailmodelapi.cxx
index e0c0f87..c786234 100644
--- a/sfx2/source/dialog/mailmodelapi.cxx
+++ b/sfx2/source/dialog/mailmodelapi.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -213,21 +213,15 @@ void SAL_CALL OMailSendThreadImpl::onTerminated()
delete this;
}
-// class AddressList_Impl ------------------------------------------------
-
-typedef String* AddressItemPtr_Impl;
-DECLARE_LIST( AddressList_Impl, AddressItemPtr_Impl )
-
// class SfxMailModel -----------------------------------------------
void SfxMailModel::ClearList( AddressList_Impl* pList )
{
if ( pList )
{
- ULONG i, nCount = pList->Count();
- for ( i = 0; i < nCount; ++i )
- delete pList->GetObject(i);
- pList->Clear();
+ for ( size_t i = 0, nCount = pList->size(); i < nCount; ++i )
+ delete pList->at(i);
+ pList->clear();
}
}
@@ -236,12 +230,11 @@ void SfxMailModel::MakeValueList( AddressList_Impl* pList, String& rValueList )
rValueList.Erase();
if ( pList )
{
- ULONG i, nCount = pList->Count();
- for ( i = 0; i < nCount; ++i )
+ for ( size_t i = 0, nCount = pList->size(); i < nCount; ++i )
{
if ( rValueList.Len() > 0 )
rValueList += ',';
- rValueList += *pList->GetObject(i);
+ rValueList += *pList->at(i);
}
}
}
@@ -539,21 +532,21 @@ void SfxMailModel::AddAddress( const String& rAddress, AddressRole eRole )
{
if ( !mpToList )
// create the list
- mpToList = new AddressList_Impl;
+ mpToList = new AddressList_Impl();
pList = mpToList;
}
else if ( ROLE_CC == eRole )
{
if ( !mpCcList )
// create the list
- mpCcList = new AddressList_Impl;
+ mpCcList = new AddressList_Impl();
pList = mpCcList;
}
else if ( ROLE_BCC == eRole )
{
if ( !mpBccList )
// create the list
- mpBccList = new AddressList_Impl;
+ mpBccList = new AddressList_Impl();
pList = mpBccList;
}
else
@@ -565,7 +558,7 @@ void SfxMailModel::AddAddress( const String& rAddress, AddressRole eRole )
{
// add address to list
AddressItemPtr_Impl pAddress = new String( rAddress );
- pList->Insert( pAddress, LIST_APPEND );
+ pList->push_back( pAddress );
}
}
}
More information about the Libreoffice-commits
mailing list