summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2013-09-24 12:45:50 +0200
committerCaolán McNamara <caolanm@redhat.com>2013-09-26 07:25:02 +0000
commit1e3e64aae4014821e9cee4d4b856a5c29550d421 (patch)
tree284a11f76c80fb632ffbdd0517169bc4725d5b9e /sw
parent7924a77ef62e20d84963b5925fa738f9e711959e (diff)
String to OUString
Change-Id: I9e99c88be67a3cfa97b5d964075c77c3208136f6 Reviewed-on: https://gerrit.libreoffice.org/6031 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/ui/dbui/mailmergehelper.cxx19
-rw-r--r--sw/source/ui/dbui/mmoutputpage.cxx25
-rw-r--r--sw/source/ui/envelp/mailmrge.cxx11
-rw-r--r--sw/source/ui/inc/mailmergehelper.hxx3
4 files changed, 27 insertions, 31 deletions
diff --git a/sw/source/ui/dbui/mailmergehelper.cxx b/sw/source/ui/dbui/mailmergehelper.cxx
index f6f9a89c0cbb..7445bf94cb2c 100644
--- a/sw/source/ui/dbui/mailmergehelper.cxx
+++ b/sw/source/ui/dbui/mailmergehelper.cxx
@@ -51,23 +51,20 @@ using namespace ::com::sun::star::sdbcx;
namespace SwMailMergeHelper
{
-String CallSaveAsDialog(String& rFilter)
+OUString CallSaveAsDialog(OUString& rFilter)
{
- ErrCode nRet;
- String sFactory(OUString::createFromAscii(SwDocShell::Factory().GetShortName()));
::sfx2::FileDialogHelper aDialog( ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION,
0,
- sFactory );
+ OUString::createFromAscii(SwDocShell::Factory().GetShortName()) );
- String sRet;
- nRet = aDialog.Execute();
- if(ERRCODE_NONE == nRet)
+ if (aDialog.Execute()!=ERRCODE_NONE)
{
- uno::Reference < ui::dialogs::XFilePicker > xFP = aDialog.GetFilePicker();
- sRet = xFP->getFiles().getConstArray()[0];
- rFilter = aDialog.GetRealFilter();
+ return OUString();
}
- return sRet;
+
+ rFilter = aDialog.GetRealFilter();
+ uno::Reference < ui::dialogs::XFilePicker > xFP = aDialog.GetFilePicker();
+ return xFP->getFiles().getConstArray()[0];
}
/*
diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx
index 668969f4ff91..da72f2d395ec 100644
--- a/sw/source/ui/dbui/mmoutputpage.cxx
+++ b/sw/source/ui/dbui/mmoutputpage.cxx
@@ -600,14 +600,14 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton)
if(m_aSaveAsOneRB.IsChecked())
{
- String sFilter;
- String sPath = SwMailMergeHelper::CallSaveAsDialog(sFilter);
- if(!sPath.Len())
+ OUString sFilter;
+ const OUString sPath = SwMailMergeHelper::CallSaveAsDialog(sFilter);
+ if (sPath.isEmpty())
return 0;
uno::Sequence< beans::PropertyValue > aValues(1);
beans::PropertyValue* pValues = aValues.getArray();
pValues[0].Name = "FilterName";
- pValues[0].Value <<= OUString(sFilter);
+ pValues[0].Value <<= sFilter;
uno::Reference< frame::XStorable > xStore( pTargetView->GetDocShell()->GetModel(), uno::UNO_QUERY);
sal_uInt32 nErrorCode = ERRCODE_NONE;
@@ -645,9 +645,9 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton)
if(nEnd > rConfigItem.GetMergedDocumentCount())
nEnd = rConfigItem.GetMergedDocumentCount();
}
- String sFilter;
- String sPath = SwMailMergeHelper::CallSaveAsDialog(sFilter);
- if(!sPath.Len())
+ OUString sFilter;
+ OUString sPath = SwMailMergeHelper::CallSaveAsDialog(sFilter);
+ if (sPath.isEmpty())
return 0;
String sTargetTempURL = URIHelper::SmartRel2Abs(
INetURLObject(), utl::TempFile::CreateTempName(),
@@ -694,12 +694,11 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton)
{
SwDocMergeInfo& rInfo = rConfigItem.GetDocumentMergeInfo(nDoc);
INetURLObject aURL(sPath);
- String sExtension = aURL.getExtension();
- if(!sExtension.Len())
+ OUString sExtension = aURL.getExtension();
+ if (sExtension.isEmpty())
{
sExtension = comphelper::string::getToken(pSfxFlt->GetWildcard().getGlob(), 1, '.');
- sPath += '.';
- sPath += sExtension;
+ sPath += "." + sExtension;
}
String sStat(SW_RES(STR_STATSTR_LETTER));
sStat += ' ';
@@ -729,7 +728,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton)
String sOutPath = aURL.GetMainURL(INetURLObject::DECODE_TO_IURI);
String sCounter = OUString('_');
sCounter += OUString::number(nDoc);
- sOutPath.Insert(sCounter, sOutPath.Len() - sExtension.Len() - 1);
+ sOutPath.Insert(sCounter, sOutPath.Len() - sExtension.getLength() - 1);
while(true)
{
@@ -739,7 +738,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton)
bool bFailed = false;
try
{
- pValues[0].Value <<= OUString(sFilter);
+ pValues[0].Value <<= sFilter;
uno::Reference< frame::XStorable > xTempStore( xTempDocShell->GetModel(), uno::UNO_QUERY);
xTempStore->storeToURL( sOutPath, aValues );
}
diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx
index fdac2f94b3f8..90a87426b72d 100644
--- a/sw/source/ui/envelp/mailmrge.cxx
+++ b/sw/source/ui/envelp/mailmrge.cxx
@@ -669,14 +669,13 @@ bool SwMailMergeDlg::ExecQryShell()
INetURLObject aAbs;
if( pMedium )
aAbs = pMedium->GetURLObject();
- String sPath(
+ OUString sPath(
URIHelper::SmartRel2Abs(
aAbs, aPathED.GetText(), URIHelper::GetMaybeFileHdl()));
pModOpt->SetMailingPath(sPath);
- String sDelim = OUString(INET_PATH_TOKEN);
- if (sPath.Len() >= sDelim.Len() &&
- sPath.Copy(sPath.Len()-sDelim.Len()).CompareTo(sDelim) != COMPARE_EQUAL)
+ const OUString sDelim = OUString(INET_PATH_TOKEN);
+ if (!sPath.endsWith(sDelim))
sPath += sDelim;
pModOpt->SetIsNameFromColumn(aGenerateFromDataBaseCB.IsChecked());
@@ -693,9 +692,9 @@ bool SwMailMergeDlg::ExecQryShell()
//#i97667# reset column name - otherwise it's remembered from the last run
pMgr->SetEMailColumn(OUString());
//start save as dialog
- String sFilter;
+ OUString sFilter;
sPath = SwMailMergeHelper::CallSaveAsDialog(sFilter);
- if(!sPath.Len())
+ if (sPath.isEmpty())
return false;
m_sSaveFilter = sFilter;
}
diff --git a/sw/source/ui/inc/mailmergehelper.hxx b/sw/source/ui/inc/mailmergehelper.hxx
index 7c6bb043afe8..eb332246b1c5 100644
--- a/sw/source/ui/inc/mailmergehelper.hxx
+++ b/sw/source/ui/inc/mailmergehelper.hxx
@@ -32,6 +32,7 @@
#include <cppuhelper/compbase1.hxx>
#include <cppuhelper/compbase2.hxx>
#include <vcl/scrbar.hxx>
+#include "rtl/ustring.hxx"
#include "swdllapi.h"
class SwMailMergeConfigItem;
@@ -43,7 +44,7 @@ namespace com { namespace sun { namespace star { namespace mail {
namespace SwMailMergeHelper
{
- SW_DLLPUBLIC String CallSaveAsDialog(String& rFilter);
+ SW_DLLPUBLIC OUString CallSaveAsDialog(OUString& rFilter);
SW_DLLPUBLIC bool CheckMailAddress( const OUString& rMailAddress );
SW_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::mail::XSmtpService >
ConnectToSmtpServer( SwMailMergeConfigItem& rConfigItem,