Re: [Libreoffice] [PUSHED][PATCH] Word count dialog modeless

2011-11-02 Thread Matt Pratt

On 11/02/2011 10:10 AM, Caolán McNamara wrote:

On Wed, 2011-11-02 at 14:55 +, Caolán McNamara wrote:

There are some titchy little wrinkles worth looking at, e.g. its got
handlers for cursor and mouse move and things like that to update the
count, but not apparently for selecting text by clicking the mouse, i.e.
double click to select a word and single click somewhere else to
unselect the text.


I *think* the right thing to do is to additionally hook into EndSelect
which gets called when a selection is completed, and Invalidate which
seems to get called when a selection is discarded.
i.e.
http://cgit.freedesktop.org/libreoffice/core/commit/?id=0cbcb89fde8cc81db499bc1e388fd53ef6fa3c3f

Seems to work anyway.


Wow, thanks for sorting out the wrinkles and pushing the patch so quickly.

I think with your hook into EndSelect we may be able to get rid of the 
mouse hook?

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] [PATCH] Word count dialog modeless

2011-11-01 Thread Matt Pratt

Hey everyone,

I've been meaning to do an easy hack ever since LibreOffice announced. 
Not to get to political, but recently AOOo and the efforts of it's 
backers has riled me up enough to push through the build issues I was 
having and put my money (time) where my mouth is.


I've followed Michael Meek's blog over the years via planet GNOME, but 
this post struck a chord with me:


http://mail-archives.apache.org/mod_mbox/incubator-ooo-dev/201110.mbox/%3C1319628345.22078.111.camel%40linux-yjtf.site%3E

So here I am with me first contribution.

I was thinking of an easy hack, but I had to submit a brief summary 
recently where word count was limited and it was a pain to have to 
continuously open the word count dialog.


I couldn't find a LO bug on this, but there is an OOo one from 2005:

http://openoffice.org/bugzilla/show_bug.cgi?id=46785

I thought it would be easier than it turned out to be, and expect some 
changes may need to be made, but here it is, a fix for a 6 year old bug.


Patch licensed under LGPLv3+/MPL.

Thanks!
From e55b1ebaf7c21bcf532e571717626be2eebfb8cf Mon Sep 17 00:00:00 2001
From: Matt Pratt mattpratt...@gmail.com
Date: Tue, 1 Nov 2011 22:47:33 -0600
Subject: [PATCH] Word count dialog modeless

---
 sw/Library_sw.mk |1 +
 sw/inc/swabstdlg.hxx |   12 -
 sw/source/ui/app/swmodule.cxx|2 +
 sw/source/ui/dialog/swdlgfact.cxx|   45 +++--
 sw/source/ui/dialog/swdlgfact.hxx|   15 +--
 sw/source/ui/dialog/wordcountdialog.cxx  |   56 +-
 sw/source/ui/dialog/wordcountdialog.hrc  |1 +
 sw/source/ui/dialog/wordcountdialog.src  |   12 +-
 sw/source/ui/dialog/wordcountwrapper.cxx |   64 ++
 sw/source/ui/docvw/edtwin.cxx|   16 +++
 sw/source/ui/inc/wordcountdialog.hxx |   38 +-
 sw/source/ui/shells/annotsh.cxx  |   23 ---
 sw/source/ui/shells/drawsh.cxx   |   22 --
 sw/source/ui/shells/drwtxtex.cxx |   22 --
 sw/source/ui/shells/frmsh.cxx|   22 --
 sw/source/ui/shells/textsh.cxx   |1 +
 sw/source/ui/shells/textsh1.cxx  |   24 ---
 17 files changed, 280 insertions(+), 96 deletions(-)
 create mode 100644 sw/source/ui/dialog/wordcountwrapper.cxx

diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index b2ce776..a8ee383 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -615,6 +615,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
 sw/source/ui/frmdlg/frmmgr \
 sw/source/ui/globdoc/globdoc \
 sw/source/ui/index/idxmrk \
+sw/source/ui/dialog/wordcountwrapper \
 sw/source/ui/index/toxmgr \
 sw/source/ui/lingu/hhcwrp \
 sw/source/ui/lingu/hyp \
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index b928169..a8fc6ef 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -200,10 +200,11 @@ public:
 virtual void SetSectionData(SwSectionData const rSect) = 0;
 };
 
-class AbstractSwWordCountDialog : public VclAbstractDialog
+class AbstractSwWordCountFloatDlg : public VclAbstractDialog
 {
 public:
-virtual voidSetValues(const SwDocStat rCurrent, const SwDocStat rDoc) = 0;
+virtual voidUpdateCounts() = 0;
+virtual Window *GetWindow() = 0; //this method is added for return a Window type pointer
 };
 
 class AbstractSwInsertAbstractDlg : public VclAbstractDialog// add for SwInsertAbstractDlg
@@ -353,7 +354,12 @@ public:
 const ::com::sun::star::uno::Reference ::com::sun::star::frame::XFrame  _rxFrame,
 sal_uInt32 nResId
 ) = 0;
-virtual AbstractSwWordCountDialog* CreateSwWordCountDialog( Window* pWindow ) = 0;
+virtual AbstractSwWordCountFloatDlg* CreateSwWordCountDialog(int nResId,
+SfxBindings* pBindings,
+   SfxChildWindow* pChild,
+   Window *pParent,
+SfxChildWinInfo* pInfo) = 0;
+
 virtual AbstractSwInsertAbstractDlg * CreateSwInsertAbstractDlg ( Window* pParent, int nResId) = 0; // add for SwInsertAbstractDlg
 virtual AbstractSwAsciiFilterDlg*  CreateSwAsciiFilterDlg ( Window* pParent, SwDocShell rDocSh,
 SvStream* pStream, int nResId ) = 0;// add for SwAsciiFilterDlg
diff --git a/sw/source/ui/app/swmodule.cxx b/sw/source/ui/app/swmodule.cxx
index 4a66362..e1bdf64 100644
--- a/sw/source/ui/app/swmodule.cxx
+++ b/sw/source/ui/app/swmodule.cxx
@@ -122,6 +122,7 @@
 #include sfx2/appuno.hxx
 #include swatrset.hxx
 #include idxmrk.hxx
+#include wordcountdialog.hxx