summaryrefslogtreecommitdiff
path: root/sw/source/ui/dbui
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui/dbui')
-rw-r--r--sw/source/ui/dbui/addresslistdialog.cxx12
-rw-r--r--sw/source/ui/dbui/dbinsdlg.cxx14
-rw-r--r--sw/source/ui/dbui/dbmgr.cxx11
-rw-r--r--sw/source/ui/dbui/mailmergechildwindow.src4
-rw-r--r--sw/source/ui/dbui/mmoutputpage.cxx40
5 files changed, 67 insertions, 14 deletions
diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx
index b68bdc0e923a..91248fa1e422 100644
--- a/sw/source/ui/dbui/addresslistdialog.cxx
+++ b/sw/source/ui/dbui/addresslistdialog.cxx
@@ -68,7 +68,7 @@
#include <swunohelper.hxx>
#include <vcl/waitobj.hxx>
#include <svtools/pathoptions.hxx>
-
+#include <svtools/urihelper.hxx>
#include <addresslistdialog.hrc>
#include <dbui.hrc>
@@ -145,6 +145,8 @@ struct AddressUserData_Impl
if(!sCharSet.compareToAscii( cUTF8 ))
{
sURL = String(sDBURL).Copy( 10 );
+ //#i97577# at this point the 'URL' can also be a file name!
+ sURL = URIHelper::SmartRel2Abs( INetURLObject(), sURL );
sURL += C2U("/");
sURL += aFilters[0];
sURL += C2U(".");
@@ -269,6 +271,7 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent) :
m_xDBContext->getByName(pNames[nName]) >>= xSourceProperties;
pUserData->sURL = lcl_getFlatURL( xSourceProperties );
bEnableEdit = pUserData->sURL.getLength() > 0 &&
+ SWUnoHelper::UCB_IsFile( pUserData->sURL ) && //#i97577#
!SWUnoHelper::UCB_IsReadOnlyFileName( pUserData->sURL );
}
catch(const uno::Exception& )
@@ -553,6 +556,7 @@ IMPL_STATIC_LINK(SwAddressListDialog, StaticListBoxSelectHdl_Impl, SvLBoxEntry*,
pThis->m_aListLB.SetEntryText(String(), pSelect, ITEMID_TABLE - 1);
}
pThis->m_aEditPB.Enable(pUserData && pUserData->sURL.getLength() &&
+ SWUnoHelper::UCB_IsFile( pUserData->sURL ) && //#i97577#
!SWUnoHelper::UCB_IsReadOnlyFileName( pUserData->sURL ) );
pThis->m_bInSelectHdl = false;
pThis->LeaveWait();
@@ -638,11 +642,15 @@ void SwAddressListDialog::DetectTablesAndQueries(
m_xDBContext->getByName(m_aDBData.sDataSource) >>= xSourceProperties;
pUserData->sURL = lcl_getFlatURL( xSourceProperties );
- m_aListLB.SetEntryText(m_aDBData.sCommand, pSelect, ITEMID_TABLE - 1);
pUserData->xColumnsSupplier = SwNewDBMgr::GetColumnSupplier(pUserData->xConnection,
m_aDBData.sCommand,
m_aDBData.nCommandType == CommandType::TABLE ?
SW_DB_SELECT_TABLE : SW_DB_SELECT_QUERY );
+ //#i97577#
+ if( pUserData->xColumnsSupplier.is() )
+ m_aListLB.SetEntryText(m_aDBData.sCommand, pSelect, ITEMID_TABLE - 1);
+ else
+ m_aListLB.SetEntryText(String(), pSelect, ITEMID_TABLE - 1);
}
String sCommand = m_aListLB.GetEntryText(pSelect, ITEMID_TABLE - 1);
m_aOK.Enable(pSelect && sCommand.Len());
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index 3048eac3de22..07e9b0a0eec0 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -131,6 +131,7 @@
#include "swabstdlg.hxx"
#include "table.hrc"
#include <unomid.h>
+#include <IDocumentMarkAccess.hxx>
namespace swui
@@ -1334,6 +1335,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
BOOL bSetCrsr = TRUE;
USHORT n = 0, nCols = aColArr.Count();
+ ::sw::mark::IMark* pMark = NULL;
for( sal_Int32 i = 0 ; ; ++i )
{
BOOL bBreak = FALSE;
@@ -1452,7 +1454,10 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
// rSh.SwCrsrShell::MovePara( fnParaCurr, fnParaStart );
rSh.SwCrsrShell::MovePara(
GetfnParaCurr(), GetfnParaStart() );
- rSh.SetBookmark( KeyCode(), C2S("DB_Mark"), aEmptyStr, IDocumentBookmarkAccess::MARK );
+ pMark = rSh.SetBookmark(
+ KeyCode(),
+ ::rtl::OUString(),
+ ::rtl::OUString(), IDocumentMarkAccess::UNO_BOOKMARK );
// rSh.SwCrsrShell::MovePara( fnParaCurr, fnParaEnd );
rSh.SwCrsrShell::MovePara(
GetfnParaCurr(), GetfnParaEnd() );
@@ -1479,11 +1484,12 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
pWait = ::std::auto_ptr<SwWait>(new SwWait( *pView->GetDocShell(), TRUE ));
}
- if( !bSetCrsr && USHRT_MAX != (n = rSh.FindBookmark( C2S("DB_Mark" ))) )
+ if( !bSetCrsr && pMark != NULL)
{
rSh.SetMark();
- rSh.GotoBookmark( n );
- rSh.DelBookmark( n );
+ rSh.GotoMark( pMark );
+ rSh.getIDocumentMarkAccess()->deleteMark( pMark );
+ break;
}
}
}
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index bf6bef6959b3..cbc77678e84e 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -1332,7 +1332,6 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell,
pStoreToFilterOptions = &rMergeDescriptor.sSaveToFilterOptions;
}
}
- String sAddress;
bCancel = FALSE;
// in case of creating a single resulting file this has to be created here
@@ -1399,7 +1398,6 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell,
pViewFrm = SfxViewFrame::GetNext(*pViewFrm, pSourrceDocSh);
}
ULONG nDocNo = 1;
- ULONG nCounter = 0;
long nStartRow, nEndRow;
// collect temporary files
@@ -1410,6 +1408,7 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell,
{
String sPath(sSubject);
+ String sAddress;
if( !bEMail && bColumnName )
{
SwDBFormatData aDBFormat;
@@ -1419,14 +1418,18 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell,
if (!sAddress.Len())
sAddress = '_';
sPath += sAddress;
- nCounter = 0;
}
// create a new temporary file name - only done once in case of bCreateSingleFile
if( 1 == nDocNo || (!rMergeDescriptor.bCreateSingleFile && !bAsSingleFile) )
{
INetURLObject aEntry(sPath);
- String sLeading(aEntry.GetBase());
+ String sLeading;
+ //#i97667# if the name is from a database field then it will be used _as is_
+ if( sAddress.Len() )
+ sLeading = sAddress;
+ else
+ sLeading = aEntry.GetBase();
aEntry.removeSegment();
sPath = aEntry.GetMainURL( INetURLObject::NO_DECODE );
String sExt( pStoreToFilter->GetDefaultExtension() );
diff --git a/sw/source/ui/dbui/mailmergechildwindow.src b/sw/source/ui/dbui/mailmergechildwindow.src
index fd0e59fb0623..6d9f0bc49272 100644
--- a/sw/source/ui/dbui/mailmergechildwindow.src
+++ b/sw/source/ui/dbui/mailmergechildwindow.src
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: mailmergechildwindow.src,v $
- * $Revision: 1.11 $
+ * $Revision: 1.11.240.1 $
*
* This file is part of OpenOffice.org.
*
@@ -251,7 +251,7 @@ ModalDialog DLG_MM_SENDWARNING
Pos = MAP_APPFONT ( 40 , 6 ) ;
Size = MAP_APPFONT ( 170 , 30 ) ;
WordBreak = TRUE;
- Text[ en-US ] = "The following error occured:";
+ Text[ en-US ] = "The following error occurred:";
};
FixedText FT_DETAILS
{
diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx
index 4a5884a9daeb..64fd024fab57 100644
--- a/sw/source/ui/dbui/mmoutputpage.cxx
+++ b/sw/source/ui/dbui/mmoutputpage.cxx
@@ -55,6 +55,8 @@
#include <svx/langitem.hxx>
#include <svtools/itemset.hxx>
#include <svtools/stritem.hxx>
+#include <svtools/ehdl.hxx>
+#include <svtools/sfxecode.hxx>
#include <vcl/msgbox.hxx>
#include <sfx2/dinfdlg.hxx>
#include <sfx2/printer.hxx>
@@ -752,7 +754,24 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton)
pValues[0].Value <<= ::rtl::OUString(sFilter);
uno::Reference< frame::XStorable > xStore( pTargetView->GetDocShell()->GetModel(), uno::UNO_QUERY);
- xStore->storeToURL( sPath, aValues );
+ sal_uInt32 nErrorCode = ERRCODE_NONE;
+ try
+ {
+ xStore->storeToURL( sPath, aValues );
+ }
+ catch( task::ErrorCodeIOException& aErrorEx )
+ {
+ nErrorCode = (sal_uInt32)aErrorEx.ErrCode;
+ }
+ catch( Exception& )
+ {
+ nErrorCode = ERRCODE_IO_GENERAL;
+ }
+ if( nErrorCode != ERRCODE_NONE )
+ {
+ SfxErrorContext aEc(ERRCTX_SFX_SAVEASDOC, pTargetView->GetDocShell()->GetTitle());
+ ErrorHandler::HandleError( nErrorCode );
+ }
}
else
{
@@ -787,7 +806,24 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton)
pValues[0].Value <<= ::rtl::OUString(pSfxFlt->GetFilterName());
uno::Reference< frame::XStorable > xStore( pTargetView->GetDocShell()->GetModel(), uno::UNO_QUERY);
- xStore->storeToURL( sTargetTempURL, aValues );
+ sal_uInt32 nErrorCode = ERRCODE_NONE;
+ try
+ {
+ xStore->storeToURL( sTargetTempURL, aValues );
+ }
+ catch( task::ErrorCodeIOException& aErrorEx )
+ {
+ nErrorCode = (sal_uInt32)aErrorEx.ErrCode;
+ }
+ catch( Exception& )
+ {
+ nErrorCode = ERRCODE_IO_GENERAL;
+ }
+ if( nErrorCode != ERRCODE_NONE )
+ {
+ SfxErrorContext aEc(ERRCTX_SFX_SAVEASDOC, pTargetView->GetDocShell()->GetTitle());
+ ErrorHandler::HandleError( nErrorCode );
+ }
SwView* pSourceView = rConfigItem.GetSourceView();
PrintMonitor aSaveMonitor(this, PrintMonitor::MONITOR_TYPE_SAVE);