summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/dbmgr.hxx8
-rw-r--r--sw/source/ui/dbui/mailmergewizard.cxx2
-rw-r--r--sw/source/ui/dbui/mmoutputpage.cxx2
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx15
-rw-r--r--sw/source/uibase/dbui/dbui.cxx34
-rw-r--r--sw/source/uibase/inc/dbui.hxx24
6 files changed, 60 insertions, 25 deletions
diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index aa6117b3871c..1ad4ad0a8b5e 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -63,6 +63,10 @@ struct SwDBFormatData
com::sun::star::lang::Locale aLocale;
};
+namespace vcl {
+ class Window;
+}
+
class SwView;
class SwWrtShell;
class SfxProgress;
@@ -211,7 +215,7 @@ friend class SwConnectionDisposedListener_Impl;
/// merge to file _and_ merge to e-Mail
SAL_DLLPRIVATE bool MergeMailFiles(SwWrtShell* pSh,
- const SwMergeDescriptor& rMergeDescriptor );
+ const SwMergeDescriptor& rMergeDescriptor, vcl::Window* pParent );
SAL_DLLPRIVATE bool ToNextRecord(SwDSParam* pParam);
public:
@@ -236,7 +240,7 @@ public:
inline void SetMergeSilent( bool bVal ) { bMergeSilent = bVal; }
/// Merging of data records into fields.
- bool MergeNew( const SwMergeDescriptor& rMergeDesc );
+ bool MergeNew( const SwMergeDescriptor& rMergeDesc, vcl::Window* pParent = NULL );
bool Merge(SwWrtShell* pSh);
void MergeCancel();
diff --git a/sw/source/ui/dbui/mailmergewizard.cxx b/sw/source/ui/dbui/mailmergewizard.cxx
index ced4c6e98c4c..9a577c41edb1 100644
--- a/sw/source/ui/dbui/mailmergewizard.cxx
+++ b/sw/source/ui/dbui/mailmergewizard.cxx
@@ -282,7 +282,7 @@ void SwMailMergeWizard::CreateTargetDocument()
aMergeDesc.pMailMergeConfigItem = &m_rConfigItem;
aMergeDesc.bCreateSingleFile = true;
- GetSwView()->GetWrtShell().GetDBManager()->MergeNew( aMergeDesc );
+ GetSwView()->GetWrtShell().GetDBManager()->MergeNew( aMergeDesc, this );
m_rConfigItem.SetMergeDone();
if( m_rConfigItem.GetTargetView() )
m_rConfigItem.GetTargetView()->GetViewFrame()->GetFrame().Appear();
diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx
index b31e6f1fe0f3..dfcdbba79a5b 100644
--- a/sw/source/ui/dbui/mmoutputpage.cxx
+++ b/sw/source/ui/dbui/mmoutputpage.cxx
@@ -689,7 +689,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton)
}
SwView* pSourceView = rConfigItem.GetSourceView();
- PrintMonitor aSaveMonitor(this, PrintMonitor::MONITOR_TYPE_SAVE);
+ PrintMonitor aSaveMonitor(this, false, PrintMonitor::MONITOR_TYPE_SAVE);
aSaveMonitor.m_pDocName->SetText(pSourceView->GetDocShell()->GetTitle(22));
aSaveMonitor.SetCancelHdl(LINK(this, SwMailMergeOutputPage, SaveCancelHdl_Impl));
aSaveMonitor.m_pPrinter->SetText( INetURLObject( sPath ).getFSysPath( INetURLObject::FSYS_DETECT ) );
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index fa635d7b8490..f24657595a34 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -323,7 +323,7 @@ static bool lcl_GetColumnCnt(SwDSParam* pParam, const OUString& rColumnName,
};
// import data
-bool SwDBManager::MergeNew( const SwMergeDescriptor& rMergeDesc )
+bool SwDBManager::MergeNew( const SwMergeDescriptor& rMergeDesc, vcl::Window* pParent )
{
OSL_ENSURE(!bInMerge && !pImpl->pMergeData, "merge already activated!");
@@ -441,7 +441,7 @@ bool SwDBManager::MergeNew( const SwMergeDescriptor& rMergeDesc )
case DBMGR_MERGE_SHELL:
// save files and send them as e-Mail if required
bRet = MergeMailFiles(&rMergeDesc.rSh,
- rMergeDesc);
+ rMergeDesc, pParent);
break;
default:
@@ -813,7 +813,8 @@ static void lcl_SaveDoc( SfxObjectShell *xTargetDocShell,
}
bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
- const SwMergeDescriptor& rMergeDescriptor)
+ const SwMergeDescriptor& rMergeDescriptor,
+ vcl::Window* pParent)
{
//check if the doc is synchronized and contains at least one linked section
bool bSynchronizedDoc = pSourceShell->IsLabelDoc() && pSourceShell->GetSectionFmtCount() > 1;
@@ -941,14 +942,16 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
bool bPageStylesWithHeaderFooter = false;
vcl::Window *pSourceWindow = 0;
- CancelableModelessDialog *pProgressDlg = 0;
+ CancelableDialog *pProgressDlg = 0;
if (!IsMergeSilent()) {
pSourceWindow = &pSourceShell->GetView().GetEditWin();
+ if( ! pParent )
+ pParent = pSourceWindow;
if( bMergeShell )
- pProgressDlg = new CreateMonitor( pSourceWindow );
+ pProgressDlg = new CreateMonitor( pParent, pParent != pSourceWindow );
else {
- pProgressDlg = new PrintMonitor( pSourceWindow, PrintMonitor::MONITOR_TYPE_PRINT );
+ pProgressDlg = new PrintMonitor( pParent, pParent != pSourceWindow, PrintMonitor::MONITOR_TYPE_PRINT );
static_cast<PrintMonitor*>( pProgressDlg )->SetText(pSourceShell->GetView().GetDocShell()->GetTitle(22));
}
pProgressDlg->SetCancelHdl( LINK(this, SwDBManager, PrtCancelHdl) );
diff --git a/sw/source/uibase/dbui/dbui.cxx b/sw/source/uibase/dbui/dbui.cxx
index 22e507025a9e..fd94b2818d49 100644
--- a/sw/source/uibase/dbui/dbui.cxx
+++ b/sw/source/uibase/dbui/dbui.cxx
@@ -22,8 +22,8 @@
#include "dbui.hrc"
#include "dbui.hxx"
-PrintMonitor::PrintMonitor(vcl::Window *pParent, PrintMonitorType eType )
- : CancelableModelessDialog(pParent, "PrintMonitorDialog",
+PrintMonitor::PrintMonitor(vcl::Window *pParent, bool modal, PrintMonitorType eType )
+ : CancelableDialog(pParent, modal, "PrintMonitorDialog",
"modules/swriter/ui/printmonitordialog.ui")
{
get(m_pDocName, "docname");
@@ -43,8 +43,8 @@ PrintMonitor::PrintMonitor(vcl::Window *pParent, PrintMonitorType eType )
}
// Progress Indicator for Creation of personalized Mail Merge documents:
-CreateMonitor::CreateMonitor( vcl::Window *pParent )
- : CancelableModelessDialog(pParent, "MMCreatingDialog",
+CreateMonitor::CreateMonitor( vcl::Window *pParent, bool modal )
+ : CancelableDialog(pParent, modal, "MMCreatingDialog",
"modules/swriter/ui/mmcreatingdialog.ui")
, m_sCountingPattern()
, m_sVariable_Total("%Y")
@@ -77,16 +77,36 @@ void CreateMonitor::SetCurrentPosition( sal_Int32 nCurrent )
UpdateCountingText();
}
-CancelableModelessDialog::CancelableModelessDialog( vcl::Window *pParent,
+CancelableDialog::CancelableDialog( vcl::Window *pParent, bool modal,
const OUString& rID, const OUString& rUIXMLDescription )
- : ModelessDialog( pParent , rID, rUIXMLDescription )
+ : Dialog( pParent , rID, rUIXMLDescription,
+ modal ? WINDOW_MODALDIALOG : WINDOW_MODELESSDIALOG )
+ , mbModal( modal )
{
get(m_pCancelButton, "cancel");
}
-void CancelableModelessDialog::SetCancelHdl( const Link& rLink )
+CancelableDialog::~CancelableDialog()
+{
+ EndDialog( 0 );
+}
+
+void CancelableDialog::SetCancelHdl( const Link& rLink )
{
m_pCancelButton->SetClickHdl( rLink );
}
+void CancelableDialog::Show()
+{
+ if (mbModal)
+ StartExecuteModal( LINK(this, CancelableDialog, DlgClosedHdl) );
+ else
+ Dialog::Show();
+}
+
+IMPL_LINK_NOARG(CancelableDialog, DlgClosedHdl)
+{
+ return 0;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/inc/dbui.hxx b/sw/source/uibase/inc/dbui.hxx
index 265d03bdf0e4..0649bcb9ca6e 100644
--- a/sw/source/uibase/inc/dbui.hxx
+++ b/sw/source/uibase/inc/dbui.hxx
@@ -24,19 +24,27 @@
#include <vcl/button.hxx>
#include <vcl/fixed.hxx>
-class SW_DLLPUBLIC CancelableModelessDialog : public ModelessDialog
+class SW_DLLPUBLIC CancelableDialog : public Dialog
{
+ bool mbModal;
+
protected:
CancelButton* m_pCancelButton;
- CancelableModelessDialog( vcl::Window *pParent, const OUString& rID,
- const OUString& rUIXMLDescription );
+ CancelableDialog( vcl::Window *pParent, bool modal, const OUString& rID,
+ const OUString& rUIXMLDescription );
+
+ DECL_LINK(DlgClosedHdl, void *);
+
+ using Dialog::Execute;
+ using Dialog::StartExecuteModal;
public:
- virtual ~CancelableModelessDialog() {};
+ virtual ~CancelableDialog();
void SetCancelHdl( const Link& rLink );
+ void Show();
};
-class SW_DLLPUBLIC PrintMonitor: public CancelableModelessDialog
+class SW_DLLPUBLIC PrintMonitor: public CancelableDialog
{
public:
enum PrintMonitorType
@@ -50,13 +58,13 @@ public:
FixedText* m_pPrinter;
FixedText* m_pPrintInfo;
- PrintMonitor( vcl::Window *pParent, PrintMonitorType eType );
+ PrintMonitor( vcl::Window *pParent, bool modal, PrintMonitorType eType );
};
-class CreateMonitor : public CancelableModelessDialog
+class CreateMonitor : public CancelableDialog
{
public:
- CreateMonitor( vcl::Window *pParent );
+ CreateMonitor( vcl::Window *pParent, bool modal );
void SetTotalCount( sal_Int32 nTotal );
void SetCurrentPosition( sal_Int32 nCurrent );