Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


On Sat, Mar 26, 2011 at 12:42:36AM +0100, Miklos Vajna <vmiklos@frugalware.org> wrote:
Ah, I didn't see it. We talked about this with Cedric and he explained
an idea which avoids any modification in vcl, so I'm not planning to
push this version, a better one will come soon.

The main problem is not with the modification, but if you move the
dialog, click Apply, then its position will be reset, which is ugly.

It turns out this is a separate issue, SfxTabDialog::~SfxTabDialog()
ideally takes care of this, appearantly I agree that it does not seem to
work.

Also, the idea was to extract the OK button handler from
SwDocShell::Edit() to SwTemplateDlg where the OK button callback is, but
this seems to be too complex. I've put out an attempt to
http://people.freedesktop.org/~vmiklos/move-using-context.patch, but I
find it ugly.

So I just went the route what Michael suggested, to keep the patch sort,
see the attachement.

Of course, in a separate future patch it would be interesting to fix
SfxTabDialog to really save the position, like it does save the
currently selected tab at the moment.

Thanks.
From 4effd7b1b73d8d121d853fcb9d05faf4c1223370 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@frugalware.org>
Date: Sat, 26 Mar 2011 17:07:46 +0100
Subject: [PATCH] fdo#32413: Add an apply button to style edit dialog in Writer

---
 sw/inc/swabstdlg.hxx          |    1 +
 sw/source/ui/app/docst.cxx    |   11 +++++++++--
 sw/source/ui/fmtui/tmpdlg.cxx |   14 ++++++++++++++
 sw/source/ui/inc/tmpdlg.hxx   |    1 +
 4 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index b000fc8..4d84284 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 6705e59..fca6e9d 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 223def1..9edb36d 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 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

Attachment: pgpMhdaMC_mZt.pgp
Description: PGP signature


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.