summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2011-03-26 17:07:46 +0100
committerMiklos Vajna <vmiklos@frugalware.org>2011-03-28 11:29:36 +0200
commit1ed7acbd03d458b64fd2792386e8c9aa609d4cef (patch)
tree37122c6b2fa3e04996e353f0e1ddc5970102d1fe
parent1d21a4249661b1b55cf8fbea67ad47ffb4f813fa (diff)
fdo#32413: Add an apply button to style edit dialog in Writer
-rw-r--r--sw/inc/swabstdlg.hxx1
-rw-r--r--sw/source/ui/app/docst.cxx11
-rw-r--r--sw/source/ui/fmtui/tmpdlg.cxx14
-rw-r--r--sw/source/ui/inc/tmpdlg.hxx1
4 files changed, 25 insertions, 2 deletions
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index d5219da395ba..c5f8f231451c 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -323,6 +323,7 @@ public:
#define RET_EDIT_RESULT_DOC 102
#define RET_TARGET_CREATED 103
#define RET_REMOVE_TARGET 104
+#define RET_APPLY_TEMPLATE 105
class SwView;
class SwMailMergeConfigItem;
diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx
index 57f574b7fbe3..a3a52d95edf2 100644
--- a/sw/source/ui/app/docst.cxx
+++ b/sw/source/ui/app/docst.cxx
@@ -663,7 +663,10 @@ sal_uInt16 SwDocShell::Edit( const String &rName, const String &rParent, sal_uIn
0, *(xTmp.get()), nFamily, bColumn,
pActShell ? pActShell : pWrtShell, bNew);
OSL_ENSURE(pDlg, "Dialogdiet fail!");
- if(RET_OK == pDlg->Execute())
+ while (true)
+ {
+ short nButton = pDlg->Execute();
+ if(RET_OK == nButton || RET_APPLY_TEMPLATE == nButton)
{
GetWrtShell()->StartAllAction();
@@ -726,7 +729,8 @@ sal_uInt16 SwDocShell::Edit( const String &rName, const String &rParent, sal_uIn
// Destroy dialog before EndAction - with page-templates the
// ItemSet must be destroyed, so that the cursors get removed
// from Headers/Footers. Otherwise "GPF" happen!!!
- delete pDlg;
+ if(RET_OK == nButton)
+ delete pDlg;
pDoc->SetModified();
if( !bModified ) // Bug 57028
@@ -748,6 +752,9 @@ sal_uInt16 SwDocShell::Edit( const String &rName, const String &rParent, sal_uIn
pDoc->ResetModified();
delete pDlg;
}
+ if(RET_APPLY_TEMPLATE != nButton)
+ break;
+ }
}
else
{
diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx
index 588660b83995..73fff1e88d4c 100644
--- a/sw/source/ui/fmtui/tmpdlg.cxx
+++ b/sw/source/ui/fmtui/tmpdlg.cxx
@@ -71,6 +71,7 @@
#include <poolfmt.hxx>
#include <uitool.hxx>
#include <shellres.hxx>
+#include <swabstdlg.hxx>
#include <cmdid.h>
#include <helpid.h>
@@ -314,12 +315,25 @@ SwTemplateDlg::SwTemplateDlg(Window* pParent,
OSL_ENSURE(!this, "wrong family");
}
+ EnableApplyButton( true );
+ SetApplyHandler( LINK(this, SwTemplateDlg, ApplyHdl ) );
}
SwTemplateDlg::~SwTemplateDlg()
{
}
+IMPL_LINK( SwTemplateDlg, ApplyHdl, void*, pVoid )
+{
+ (void)pVoid; //unused
+ if ( OK_Impl() )
+ {
+ Ok();
+ EndDialog( RET_APPLY_TEMPLATE );
+ }
+ return 0;
+}
+
short SwTemplateDlg::Ok()
{
short nRet = SfxTabDialog::Ok();
diff --git a/sw/source/ui/inc/tmpdlg.hxx b/sw/source/ui/inc/tmpdlg.hxx
index cc2a9c18d441..479e54da06c1 100644
--- a/sw/source/ui/inc/tmpdlg.hxx
+++ b/sw/source/ui/inc/tmpdlg.hxx
@@ -45,6 +45,7 @@ class SwTemplateDlg: public SfxStyleDialog
sal_Bool bNewStyle;
DECL_LINK( NumOptionsHdl, PushButton* );
+ DECL_LINK( ApplyHdl, void* );
public:
SwTemplateDlg( Window* pParent,