summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2014-07-29 15:31:00 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2014-09-30 09:48:57 +0200
commit5fc1238af0239a35f3b0c6f5ff4ecb1c1cd6ae3b (patch)
tree180fc56d0b7277fa4eed1f1acb0916fb08bf604f
parente1840939dcfce9808a5d14c0ed7a6a3af2148ce1 (diff)
MM: refactor cancel handling for dbui dialogs
This simplifies the handling of CreateMonitor and PrintMonitor in the combined mail merge function. Change-Id: Iacf933ec1a6017949b29b3d5f62d5f55c4691053 Reviewed-on: https://gerrit.libreoffice.org/10984 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com> (cherry picked from commit 57d7802145befa4ebc191cc646069aefb58f5c32) Conflicts: sw/source/ui/dbui/mmoutputpage.cxx sw/source/uibase/dbui/dbmgr.cxx sw/source/uibase/dbui/dbui.cxx sw/source/uibase/inc/dbui.hxx
-rw-r--r--sw/source/ui/dbui/dbmgr.cxx2
-rw-r--r--sw/source/ui/dbui/dbui.cxx21
-rw-r--r--sw/source/ui/dbui/mmoutputpage.cxx2
-rw-r--r--sw/source/ui/inc/dbui.hxx20
4 files changed, 29 insertions, 16 deletions
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index 6cbc207f0e7f..a87a1d6af278 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -976,7 +976,7 @@ sal_Bool SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell,
PrintMonitor aPrtMonDlg(&pSourceShell->GetView().GetEditWin(), PrintMonitor::MONITOR_TYPE_PRINT);
aPrtMonDlg.aDocName.SetText(pSourceShell->GetView().GetDocShell()->GetTitle(22));
- aPrtMonDlg.aCancel.SetClickHdl(LINK(this, SwNewDBMgr, PrtCancelHdl));
+ aPrtMonDlg.SetCancelHdl(LINK(this, SwNewDBMgr, PrtCancelHdl));
if (!IsMergeSilent())
aPrtMonDlg.Show();
diff --git a/sw/source/ui/dbui/dbui.cxx b/sw/source/ui/dbui/dbui.cxx
index 17c18dabc925..ae541c750f28 100644
--- a/sw/source/ui/dbui/dbui.cxx
+++ b/sw/source/ui/dbui/dbui.cxx
@@ -24,14 +24,13 @@
#include "dbui.hxx"
PrintMonitor::PrintMonitor( Window *pParent, PrintMonitorType eType )
-: ModelessDialog( pParent, SW_RES(DLG_PRINTMONITOR) ),
+: CancelableModelessDialog( pParent, SW_RES(DLG_PRINTMONITOR) ),
aDocName (this, SW_RES( FT_DOCNAME )),
aPrinting (this, SW_RES(
eType == MONITOR_TYPE_MAIL ?
FT_SENDING : eType == MONITOR_TYPE_SAVE ? FT_SAVING : FT_PRINTING )),
aPrinter (this, SW_RES( FT_PRINTER )),
- aPrintInfo (this, SW_RES( FT_PRINTINFO )),
- aCancel (this, SW_RES( PB_CANCELPRNMON ))
+ aPrintInfo (this, SW_RES( FT_PRINTINFO ))
{
switch (eType)
{
@@ -78,18 +77,17 @@ void PrintMonitor::ResizeControls()
lcl_RePosControl( &aDocName, nDiff );
lcl_RePosControl( &aPrinting, nDiff );
lcl_RePosControl( &aPrintInfo, nDiff );
- lcl_RePosControl( &aCancel, nDiff );
+ lcl_RePosControl( &aCancelButton, nDiff );
}
}
// Progress Indicator for Creation of personalized Mail Merge documents:
CreateMonitor::CreateMonitor( Window *pParent )
-: ModelessDialog( pParent, SW_RES(DLG_MM_CREATIONMONITOR) ),
+: CancelableModelessDialog( pParent, SW_RES(DLG_MM_CREATIONMONITOR) ),
m_aStatus (this, SW_RES( FT_STATUS )),
m_aProgress (this, SW_RES( FT_PROGRESS )),
m_aCreateDocuments (this, SW_RES( FT_CREATEDOCUMENTS )),
m_aCounting (this, SW_RES( FT_COUNTING )),
- m_aCancelButton (this, SW_RES( PB_CANCELPRNMON )),
m_sCountingPattern(),
m_sVariable_Total( OUString("%Y") ),
m_sVariable_Position( OUString("%X") ),
@@ -122,9 +120,16 @@ void CreateMonitor::SetCurrentPosition( sal_Int32 nCurrent )
UpdateCountingText();
}
-void CreateMonitor::SetCancelHdl( const Link& rLink )
+CancelableModelessDialog::CancelableModelessDialog( Window *pParent,
+ const ResId& rResId )
+: ModelessDialog( pParent, rResId ),
+ aCancelButton( this, SW_RES( PB_CANCELPRNMON ))
{
- m_aCancelButton.SetClickHdl( rLink );
+}
+
+void CancelableModelessDialog::SetCancelHdl( const Link& rLink )
+{
+ aCancelButton.SetClickHdl( rLink );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx
index f6be127277e2..e2a697be7865 100644
--- a/sw/source/ui/dbui/mmoutputpage.cxx
+++ b/sw/source/ui/dbui/mmoutputpage.cxx
@@ -746,7 +746,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton)
SwView* pSourceView = rConfigItem.GetSourceView();
PrintMonitor aSaveMonitor(this, PrintMonitor::MONITOR_TYPE_SAVE);
aSaveMonitor.aDocName.SetText(pSourceView->GetDocShell()->GetTitle(22));
- aSaveMonitor.aCancel.SetClickHdl(LINK(this, SwMailMergeOutputPage, SaveCancelHdl_Impl));
+ aSaveMonitor.SetCancelHdl(LINK(this, SwMailMergeOutputPage, SaveCancelHdl_Impl));
aSaveMonitor.aPrinter.SetText( INetURLObject( sPath ).getFSysPath( INetURLObject::FSYS_DETECT ) );
aSaveMonitor.ResizeControls();
diff --git a/sw/source/ui/inc/dbui.hxx b/sw/source/ui/inc/dbui.hxx
index 967f2a11640f..669cc8c14834 100644
--- a/sw/source/ui/inc/dbui.hxx
+++ b/sw/source/ui/inc/dbui.hxx
@@ -25,7 +25,18 @@
#include <vcl/fixed.hxx>
-class SW_DLLPUBLIC PrintMonitor: public ModelessDialog
+class SW_DLLPUBLIC CancelableModelessDialog : public ModelessDialog
+{
+protected:
+ CancelButton aCancelButton;
+ CancelableModelessDialog( Window *pParent, const ResId& rResId );
+
+public:
+ virtual ~CancelableModelessDialog() {};
+ void SetCancelHdl( const Link& rLink );
+};
+
+class SW_DLLPUBLIC PrintMonitor: public CancelableModelessDialog
{
public:
enum PrintMonitorType
@@ -34,18 +45,18 @@ public:
MONITOR_TYPE_MAIL,
MONITOR_TYPE_SAVE
};
+
FixedText aDocName;
FixedText aPrinting;
FixedText aPrinter;
FixedText aPrintInfo;
- CancelButton aCancel;
PrintMonitor( Window *pParent, PrintMonitorType eType );
void ResizeControls();
};
-class CreateMonitor : public ModelessDialog
+class CreateMonitor : public CancelableModelessDialog
{
public:
CreateMonitor( Window *pParent );
@@ -53,8 +64,6 @@ public:
void SetTotalCount( sal_Int32 nTotal );
void SetCurrentPosition( sal_Int32 nCurrent );
- void SetCancelHdl( const Link& rLink );
-
private: //methods
void UpdateCountingText();
@@ -63,7 +72,6 @@ private: //member
FixedText m_aProgress;
FixedText m_aCreateDocuments;
FixedText m_aCounting;
- CancelButton m_aCancelButton;
String m_sCountingPattern;
String m_sVariable_Total;