summaryrefslogtreecommitdiff
path: root/sw
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
commitc62b8fc02d9357cea7fd399b173ed5280bf4c53c (patch)
treeb9f7bd09f088576a6a397d177b45ccb8a154a34d /sw
parent559cec04ecf8293497cee2cfa4c04b1cfd7faca3 (diff)
fdo#32413: Add an apply button to style edit dialog in Writer
Diffstat (limited to 'sw')
-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 b000fc80ae..4d8428485d 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 6705e59c6e..fca6e9d8a6 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 223def1d61..9edb36d085 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 6a8e7de1b8..eca821e945 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,