summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-08-03 14:42:21 +0530
committerPranav Kant <pranavk@collabora.co.uk>2017-10-02 11:01:13 +0530
commit44737be728c1d1afa23631e7576569ddf2d3016c (patch)
treefc8be71d9f3e55eaa4090b4b4a44d3ae7c6107cb
parentd43ffd307a21af234576e8efc99f306b110765b1 (diff)
lokdialog: Register IDIalogRenderable with vcl::Dialog
Change-Id: I344f5a9c7167abfde15dcd21c747819cc79b12b1
-rw-r--r--include/sfx2/basedlgs.hxx2
-rw-r--r--include/vcl/IDialogRenderable.hxx3
-rw-r--r--include/vcl/dialog.hxx9
-rw-r--r--sfx2/source/dialog/basedlgs.cxx8
-rw-r--r--sw/inc/unotxdoc.hxx2
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx8
-rw-r--r--vcl/source/window/dialog.cxx17
7 files changed, 37 insertions, 12 deletions
diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx
index 7609229db2a6..cb403c78a075 100644
--- a/include/sfx2/basedlgs.hxx
+++ b/include/sfx2/basedlgs.hxx
@@ -105,8 +105,6 @@ public:
SfxBindings& GetBindings()
{ return *pBindings; }
- virtual void LogicInvalidate(const tools::Rectangle* pRectangle) override;
-
DECL_LINK(TimerHdl, Timer *, void);
};
diff --git a/include/vcl/IDialogRenderable.hxx b/include/vcl/IDialogRenderable.hxx
index cf9d41e54cde..b2c0dee552cd 100644
--- a/include/vcl/IDialogRenderable.hxx
+++ b/include/vcl/IDialogRenderable.hxx
@@ -38,6 +38,9 @@ public:
virtual void postDialogMouseEvent(const DialogID& rDialogID, int nType, int nX, int nY,
int nCount, int nButtons, int nModifier) = 0;
+
+ // Callbacks
+ virtual void notifyDialogInvalidation(const DialogID& rDialogID) = 0;
};
} // namespace vcl
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index 93f2080c8352..ef3bcd5e8099 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -25,7 +25,7 @@
#include <vcl/dllapi.h>
#include <vcl/syswin.hxx>
#include <vcl/vclptr.hxx>
-
+#include <vcl/IDialogRenderable.hxx>
struct DialogImpl;
class VclBox;
@@ -59,6 +59,8 @@ private:
VclPtr<VclButtonBox> mpActionArea;
VclPtr<VclBox> mpContentArea;
+ vcl::IDialogRenderable* mpDialogRenderable; // to emit LOK callbacks
+
SAL_DLLPRIVATE void ImplInitDialogData();
SAL_DLLPRIVATE void ImplInitSettings();
@@ -77,7 +79,10 @@ protected:
public:
SAL_DLLPRIVATE bool IsInClose() const { return mbInClose; }
virtual void doDeferredInit(WinBits nBits) override;
- virtual void LogicInvalidate(const tools::Rectangle* pRectangle) override { (void)pRectangle; }
+ virtual void LogicInvalidate(const tools::Rectangle* pRectangle) override;
+
+ /// Necessary to register dialog renderable instance to emit LOK callbacks
+ void registerDialogRenderable(vcl::IDialogRenderable* pDialogRenderable);
/// Paints the current dialog to the given virtual device
void paintDialog(VirtualDevice& rDevice);
void LogicMouseButtonDown(const MouseEvent& rMouseEvent);
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index 0d2d90d142de..bfc0ac45a39b 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -393,14 +393,6 @@ void SfxModelessDialog::FillInfo(SfxChildWinInfo& rInfo) const
rInfo.nFlags |= SfxChildWindowFlags::ZOOMIN;
}
-
-void SfxModelessDialog::LogicInvalidate(const tools::Rectangle* /*pRectangle*/)
-{
- if (!comphelper::LibreOfficeKit::isDialogPainting())
- SfxLokHelper::notifyDialogInvalidation(maID);
-}
-
-
bool SfxFloatingWindow::EventNotify( NotifyEvent& rEvt )
/* [Description]
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 3df958033c5e..e93173451b3c 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -438,6 +438,8 @@ public:
void postDialogMouseEvent(const vcl::DialogID& rDialogID, int nType, int nX, int nY,
int nCount, int nButtons, int nModifier) override;
+ void notifyDialogInvalidation(const vcl::DialogID& rDialogID) override;
+
// css::tiledrendering::XTiledRenderable
virtual void SAL_CALL paintTile( const ::css::uno::Any& Parent, ::sal_Int32 nOutputWidth, ::sal_Int32 nOutputHeight, ::sal_Int32 nTilePosX, ::sal_Int32 nTilePosY, ::sal_Int32 nTileWidth, ::sal_Int32 nTileHeight ) override;
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 8d2184a3bfa2..fbb5bf808957 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -31,6 +31,7 @@
#include <vcl/svapp.hxx>
#include <vcl/print.hxx>
#include <sfx2/viewfrm.hxx>
+#include <sfx2/lokhelper.hxx>
#include <sfx2/sfxbasecontroller.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/msg.hxx>
@@ -3661,6 +3662,8 @@ void SwXTextDocument::paintDialog(const vcl::DialogID& rDialogID, VirtualDevice&
}
Dialog* pDlg = static_cast<Dialog*>(pChild->GetWindow());
+ // register the instance so that vcl::Dialog can emit LOK callbacks
+ pDlg->registerDialogRenderable(this);
pDlg->paintDialog(rDevice);
const Size aSize = pDlg->GetOptimalSize();
nWidth = aSize.getWidth();
@@ -3740,6 +3743,11 @@ void SwXTextDocument::postDialogMouseEvent(const vcl::DialogID& rDialogID, int n
}
}
+void SwXTextDocument::notifyDialogInvalidation(const vcl::DialogID& rDialogID)
+{
+ SfxLokHelper::notifyDialogInvalidation(rDialogID);
+}
+
void * SAL_CALL SwXTextDocument::operator new( size_t t) throw()
{
return SwXTextDocumentBaseClass::operator new(t);
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 3ca7fff70211..e5d784e4f667 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -348,6 +348,7 @@ struct DialogImpl
void Dialog::ImplInitDialogData()
{
+ mpDialogRenderable = nullptr;
mpWindowImpl->mbDialog = true;
mpPrevExecuteDlg = nullptr;
mbInExecute = false;
@@ -863,6 +864,14 @@ bool Dialog::selectPageByUIXMLDescription(const OString& /*rUIXMLDescription*/)
return true;
}
+void Dialog::registerDialogRenderable(vcl::IDialogRenderable* pDialogRenderable)
+{
+ if (pDialogRenderable && !mpDialogRenderable)
+ {
+ mpDialogRenderable = pDialogRenderable;
+ }
+}
+
void Dialog::paintDialog(VirtualDevice& rDevice)
{
setDeferredProperties();
@@ -874,6 +883,14 @@ void Dialog::paintDialog(VirtualDevice& rDevice)
PaintToDevice(&rDevice, Point(0, 0), Size());
}
+void Dialog::LogicInvalidate(const tools::Rectangle* /*pRectangle*/)
+{
+ if (comphelper::LibreOfficeKit::isActive() && mpDialogRenderable && !maID.isEmpty())
+ {
+ mpDialogRenderable->notifyDialogInvalidation(maID);
+ }
+}
+
void Dialog::LogicMouseButtonDown(const MouseEvent& rMouseEvent)
{
// When we're not doing tiled rendering, then positions must be passed as pixels.