[Libreoffice] [PATCH] fdo#32413: Add an apply button to style edit dialog in Writer

Miklos Vajna vmiklos at frugalware.org
Thu Mar 24 04:17:07 PDT 2011


Hi,

I'm attaching two patches, one for vcl, one for sw. Of course I could
introduce the define in sw, but that would cause problems when someone
would introduce a new define in vcl, so I did it this way.

Also, I can change the indentation in sw/source/ui/app/docst.cxx, I
didn't do it yet for easier review.

What's your opinion, OK to push?

Thanks.
-------------- next part --------------
From c63be26e98290cb024078ba260b6bead796e6eca Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos at frugalware.org>
Date: Thu, 24 Mar 2011 11:54:09 +0100
Subject: [PATCH] fdo#32413: Add an apply button to style edit dialog in Writer

---
 vcl/inc/vcl/msgbox.hxx |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/vcl/inc/vcl/msgbox.hxx b/vcl/inc/vcl/msgbox.hxx
index b834843..315e412 100644
--- a/vcl/inc/vcl/msgbox.hxx
+++ b/vcl/inc/vcl/msgbox.hxx
@@ -51,6 +51,7 @@ class CheckBox;
 #define RET_NO				 3
 #define RET_RETRY			 4
 #define RET_IGNORE           5
+#define RET_APPLY            6
 
 #define BUTTONID_OK 		 RET_OK
 #define BUTTONID_CANCEL 	 RET_CANCEL
-- 
1.7.4.1

-------------- next part --------------
From 9bee07e4a4abe1cb18a841c03fcb8e5606b1c8a6 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos at frugalware.org>
Date: Thu, 24 Mar 2011 11:54:59 +0100
Subject: [PATCH] fdo#32413: Add an apply button to style edit dialog in Writer

---
 sw/source/ui/app/docst.cxx    |   11 +++++++++--
 sw/source/ui/fmtui/tmpdlg.cxx |   13 +++++++++++++
 sw/source/ui/inc/tmpdlg.hxx   |    1 +
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx
index 6705e59..7525d37 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 (1)
+        {
+            short nButton = pDlg->Execute();
+            if(RET_OK == nButton || RET_APPLY == 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 != nButton)
+                break;
+        }
     }
     else
     {
diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx
index 223def1..37a72e7 100644
--- a/sw/source/ui/fmtui/tmpdlg.cxx
+++ b/sw/source/ui/fmtui/tmpdlg.cxx
@@ -314,12 +314,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 );
+    }
+    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 6a8e7de..eca821e 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,
-- 
1.7.4.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110324/86c0236b/attachment.pgp>


More information about the LibreOffice mailing list