[Libreoffice-commits] core.git: sw/source
Jan-Marek Glogowski
glogow at fbihome.de
Fri Sep 12 13:42:25 PDT 2014
sw/source/ui/dbui/mmoutputpage.cxx | 2 +-
sw/source/uibase/dbui/dbmgr.cxx | 2 +-
sw/source/uibase/dbui/dbui.cxx | 15 ++++++++++-----
sw/source/uibase/inc/dbui.hxx | 21 +++++++++++++++------
4 files changed, 27 insertions(+), 13 deletions(-)
New commits:
commit 57d7802145befa4ebc191cc646069aefb58f5c32
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date: Tue Jul 29 15:31:00 2014 +0200
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 at redhat.com>
Tested-by: Michael Stahl <mstahl at redhat.com>
diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx
index 0d8ca5c..581ed8d 100644
--- a/sw/source/ui/dbui/mmoutputpage.cxx
+++ b/sw/source/ui/dbui/mmoutputpage.cxx
@@ -645,7 +645,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton)
SwView* pSourceView = rConfigItem.GetSourceView();
PrintMonitor aSaveMonitor(this, PrintMonitor::MONITOR_TYPE_SAVE);
aSaveMonitor.m_pDocName->SetText(pSourceView->GetDocShell()->GetTitle(22));
- aSaveMonitor.m_pCancel->SetClickHdl(LINK(this, SwMailMergeOutputPage, SaveCancelHdl_Impl));
+ aSaveMonitor.SetCancelHdl(LINK(this, SwMailMergeOutputPage, SaveCancelHdl_Impl));
aSaveMonitor.m_pPrinter->SetText( INetURLObject( sPath ).getFSysPath( INetURLObject::FSYS_DETECT ) );
m_bCancelSaving = false;
aSaveMonitor.Show();
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index bc242be..b4edcab 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -965,7 +965,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
PrintMonitor aPrtMonDlg(&pSourceShell->GetView().GetEditWin(), PrintMonitor::MONITOR_TYPE_PRINT);
aPrtMonDlg.m_pDocName->SetText(pSourceShell->GetView().GetDocShell()->GetTitle(22));
- aPrtMonDlg.m_pCancel->SetClickHdl(LINK(this, SwDBManager, PrtCancelHdl));
+ aPrtMonDlg.SetCancelHdl(LINK(this, SwDBManager, PrtCancelHdl));
if (!IsMergeSilent())
aPrtMonDlg.Show();
diff --git a/sw/source/uibase/dbui/dbui.cxx b/sw/source/uibase/dbui/dbui.cxx
index 8247f5c..f9a3e16 100644
--- a/sw/source/uibase/dbui/dbui.cxx
+++ b/sw/source/uibase/dbui/dbui.cxx
@@ -23,10 +23,9 @@
#include "dbui.hxx"
PrintMonitor::PrintMonitor(Window *pParent, PrintMonitorType eType )
- : ModelessDialog(pParent, "PrintMonitorDialog",
+ : CancelableModelessDialog(pParent, "PrintMonitorDialog",
"modules/swriter/ui/printmonitordialog.ui")
{
- get(m_pCancel, "cancel");
get(m_pDocName, "docname");
get(m_pPrinter, "printer");
get(m_pPrintInfo, "printinfo");
@@ -45,7 +44,7 @@ PrintMonitor::PrintMonitor(Window *pParent, PrintMonitorType eType )
// Progress Indicator for Creation of personalized Mail Merge documents:
CreateMonitor::CreateMonitor( Window *pParent )
- : ModelessDialog(pParent, "MMCreatingDialog",
+ : CancelableModelessDialog(pParent, "MMCreatingDialog",
"modules/swriter/ui/mmcreatingdialog.ui")
, m_sCountingPattern()
, m_sVariable_Total("%Y")
@@ -53,7 +52,6 @@ CreateMonitor::CreateMonitor( Window *pParent )
, m_nTotalCount(0)
, m_nCurrentPosition(0)
{
- get(m_pCancelButton, "cancel");
get(m_pCounting, "progress");
m_sCountingPattern = m_pCounting->GetText();
m_pCounting->SetText("...");
@@ -79,7 +77,14 @@ void CreateMonitor::SetCurrentPosition( sal_Int32 nCurrent )
UpdateCountingText();
}
-void CreateMonitor::SetCancelHdl( const Link& rLink )
+CancelableModelessDialog::CancelableModelessDialog( Window *pParent,
+ const OString& rID, const OUString& rUIXMLDescription )
+ : ModelessDialog( pParent , rID, rUIXMLDescription )
+{
+ get(m_pCancelButton, "cancel");
+}
+
+void CancelableModelessDialog::SetCancelHdl( const Link& rLink )
{
m_pCancelButton->SetClickHdl( rLink );
}
diff --git a/sw/source/uibase/inc/dbui.hxx b/sw/source/uibase/inc/dbui.hxx
index 9f4022f..4e613ec 100644
--- a/sw/source/uibase/inc/dbui.hxx
+++ b/sw/source/uibase/inc/dbui.hxx
@@ -24,7 +24,19 @@
#include <vcl/button.hxx>
#include <vcl/fixed.hxx>
-class SW_DLLPUBLIC PrintMonitor: public ModelessDialog
+class SW_DLLPUBLIC CancelableModelessDialog : public ModelessDialog
+{
+protected:
+ CancelButton* m_pCancelButton;
+ CancelableModelessDialog( Window *pParent, const OString& rID,
+ const OUString& rUIXMLDescription );
+
+public:
+ virtual ~CancelableModelessDialog() {};
+ void SetCancelHdl( const Link& rLink );
+};
+
+class SW_DLLPUBLIC PrintMonitor: public CancelableModelessDialog
{
public:
enum PrintMonitorType
@@ -32,16 +44,16 @@ public:
MONITOR_TYPE_PRINT,
MONITOR_TYPE_SAVE
};
+
FixedText* m_pDocName;
FixedText* m_pPrinting;
FixedText* m_pPrinter;
FixedText* m_pPrintInfo;
- CancelButton* m_pCancel;
PrintMonitor( Window *pParent, PrintMonitorType eType );
};
-class CreateMonitor : public ModelessDialog
+class CreateMonitor : public CancelableModelessDialog
{
public:
CreateMonitor( Window *pParent );
@@ -49,14 +61,11 @@ public:
void SetTotalCount( sal_Int32 nTotal );
void SetCurrentPosition( sal_Int32 nCurrent );
- void SetCancelHdl( const Link& rLink );
-
private:
void UpdateCountingText();
private:
FixedText* m_pCounting;
- CancelButton* m_pCancelButton;
OUString m_sCountingPattern;
OUString m_sVariable_Total;
More information about the Libreoffice-commits
mailing list