summaryrefslogtreecommitdiff
path: root/sfx2/source/dialog/mailmodel.cxx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-10-29 10:03:36 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-10-31 06:56:49 +0100
commitce22935a8586eda71fd29d4ff969d9cd7a2ec15b (patch)
treeea0e84fe6d4b5b6e6ac5f3cc4ba1295dcf1bcdb1 /sfx2/source/dialog/mailmodel.cxx
parentc6af59b234e8eb8182dc7f686290524feafd6ed6 (diff)
Prepare for removal of non-const operator[] from Sequence in sfx2
Change-Id: I0cdce64983901a6cc3b50dc9873a370ff08b9eb2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124387 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sfx2/source/dialog/mailmodel.cxx')
-rw-r--r--sfx2/source/dialog/mailmodel.cxx53
1 files changed, 29 insertions, 24 deletions
diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx
index 503efaae7ecf..382a677369f4 100644
--- a/sfx2/source/dialog/mailmodel.cxx
+++ b/sfx2/source/dialog/mailmodel.cxx
@@ -52,6 +52,7 @@
#include <tools/urlobj.hxx>
#include <unotools/useroptions.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <comphelper/string.hxx>
#include <vcl/svapp.hxx>
@@ -149,7 +150,6 @@ SfxMailModel::SaveResult SfxMailModel::ShowFilterOptionsDialog(
if( xFilterDialog.is() && xFilterProperties.is() )
{
- uno::Sequence< beans::PropertyValue > aPropsForDialog(1);
uno::Reference< document::XExporter > xExporter( xFilterDialog, uno::UNO_QUERY );
if ( rType == PDF_DOCUMENT_TYPE )
@@ -157,13 +157,15 @@ SfxMailModel::SaveResult SfxMailModel::ShowFilterOptionsDialog(
//add an internal property, used to tell the dialog we want to set a different
//string for the ok button
//used in filter/source/pdf/impdialog.cxx
- uno::Sequence< beans::PropertyValue > aFilterDataValue(1);
- aFilterDataValue[0].Name = "_OkButtonString";
- aFilterDataValue[0].Value <<= SfxResId(STR_PDF_EXPORT_SEND );
+ uno::Sequence< beans::PropertyValue > aFilterDataValue{
+ comphelper::makePropertyValue("_OkButtonString",
+ SfxResId(STR_PDF_EXPORT_SEND ))
+ };
//add to the filterdata property, the only one the PDF export filter dialog will care for
- aPropsForDialog[0].Name = "FilterData";
- aPropsForDialog[0].Value <<= aFilterDataValue;
+ uno::Sequence< beans::PropertyValue > aPropsForDialog{
+ comphelper::makePropertyValue("FilterData", aFilterDataValue)
+ };
//when executing the dialog will merge the persistent FilterData properties
xFilterProperties->setPropertyValues( aPropsForDialog );
@@ -184,8 +186,9 @@ SfxMailModel::SaveResult SfxMailModel::ShowFilterOptionsDialog(
{
//found the filterdata, add to the storing argument
rArgs.realloc( ++rNumArgs );
- rArgs[rNumArgs-1].Name = pProp->Name;
- rArgs[rNumArgs-1].Value = pProp->Value;
+ auto pArgs = rArgs.getArray();
+ pArgs[rNumArgs-1].Name = pProp->Name;
+ pArgs[rNumArgs-1].Value = pProp->Value;
}
eRet = SAVE_SUCCESSFUL;
}
@@ -308,10 +311,11 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat(
{
// Retrieve filter from type
css::uno::Sequence< css::beans::NamedValue > aQuery( bSendAsPDF ? 3 : 2 );
- aQuery[0].Name = "Type";
- aQuery[0].Value <<= aTypeName;
- aQuery[1].Name = "DocumentService";
- aQuery[1].Value <<= aModule;
+ auto pQuery = aQuery.getArray();
+ pQuery[0].Name = "Type";
+ pQuery[0].Value <<= aTypeName;
+ pQuery[1].Name = "DocumentService";
+ pQuery[1].Value <<= aModule;
if( bSendAsPDF )
{
// #i91419#
@@ -319,8 +323,8 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat(
// exact flag value as detailed in the filter configuration to get it
// this seems to be a bug
// without flags we get an import filter here, which is also unwanted
- aQuery[2].Name = "Flags";
- aQuery[2].Value <<= sal_Int32(0x80042); // EXPORT ALIEN 3RDPARTY
+ pQuery[2].Name = "Flags";
+ pQuery[2].Value <<= sal_Int32(0x80042); // SfxFilterFlags: EXPORT ALIEN 3RDPARTY
}
css::uno::Reference< css::container::XEnumeration > xEnumeration =
@@ -461,11 +465,10 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat(
OUString aFileURL = aFilePathObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
- sal_Int32 nNumArgs(0);
+ sal_Int32 nNumArgs(1);
static const OUStringLiteral aPasswordPropName( u"Password" );
- css::uno::Sequence< css::beans::PropertyValue > aArgs( ++nNumArgs );
- aArgs[nNumArgs-1].Name = "FilterName";
- aArgs[nNumArgs-1].Value <<= aFilterName;
+ css::uno::Sequence< css::beans::PropertyValue > aArgs{ comphelper::makePropertyValue(
+ "FilterName", aFilterName) };
::comphelper::SequenceAsHashMap aMediaDescrPropsHM( xModel->getArgs() );
OUString aPassword = aMediaDescrPropsHM.getUnpackedValueOrDefault(
@@ -474,8 +477,9 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat(
if ( !aPassword.isEmpty() )
{
aArgs.realloc( ++nNumArgs );
- aArgs[nNumArgs-1].Name = aPasswordPropName;
- aArgs[nNumArgs-1].Value <<= aPassword;
+ auto pArgs = aArgs.getArray();
+ pArgs[nNumArgs-1].Name = aPasswordPropName;
+ pArgs[nNumArgs-1].Value <<= aPassword;
}
bool bNeedsPreparation = false;
@@ -600,8 +604,9 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat(
{
// We need 1:1 copy of the document to preserve an added signature.
aArgs.realloc( ++nNumArgs );
- aArgs[nNumArgs-1].Name = "CopyStreamIfPossible";
- aArgs[nNumArgs-1].Value <<= true;
+ auto pArgs = aArgs.getArray();
+ pArgs[nNumArgs-1].Name = "CopyStreamIfPossible";
+ pArgs[nNumArgs-1].Value <<= true;
try
{
@@ -715,8 +720,8 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css:
if ( nToCount > 1 )
{
Sequence< OUString > aCcRecipientSeq( nToCount - 1 );
- for ( size_t i = 1; i < nToCount; ++i )
- aCcRecipientSeq[i - 1] = mpToList->at(i);
+ std::copy_n(std::next(mpToList->begin()), aCcRecipientSeq.getLength(),
+ aCcRecipientSeq.getArray());
xSimpleMailMessage->setCcRecipient( aCcRecipientSeq );
}