summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2017-11-24 18:50:05 +0100
committerJan Holesovsky <kendy@collabora.com>2017-11-28 19:49:18 +0100
commit80d9696eb76e69101996c7a35ffec4c247e079d8 (patch)
tree2594fea36623214f7be95ada417e2813bbc9a8ed
parent42777e61a4060b7b78795a5bb89e3155327a2555 (diff)
lokdialog: Move the painting down to Window, and enable Calc and Impress.
Tested with .uno:FormatCellDialog in Calc, Impress not tested. Change-Id: I6d911c29616988db0625be9e2a63cf2172c69ee8
-rw-r--r--desktop/source/lib/init.cxx156
-rw-r--r--include/sfx2/lokhelper.hxx4
-rw-r--r--include/sfx2/viewsh.hxx4
-rw-r--r--include/vcl/IDialogRenderable.hxx38
-rw-r--r--include/vcl/ITiledRenderable.hxx6
-rw-r--r--include/vcl/dialog.hxx13
-rw-r--r--include/vcl/window.hxx21
-rw-r--r--sc/inc/docuno.hxx3
-rw-r--r--sc/source/ui/unoobj/docuno.cxx6
-rw-r--r--sd/source/ui/inc/unomodel.hxx3
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx6
-rw-r--r--sfx2/source/dialog/basedlgs.cxx8
-rw-r--r--sfx2/source/dialog/tabdlg.cxx4
-rw-r--r--sfx2/source/view/lokhelper.cxx4
-rw-r--r--sfx2/source/view/viewsh.cxx8
-rw-r--r--sw/inc/unotxdoc.hxx15
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx117
-rw-r--r--vcl/Library_vcl.mk1
-rw-r--r--vcl/source/app/IDialogRenderable.cxx22
-rw-r--r--vcl/source/window/dialog.cxx116
-rw-r--r--vcl/source/window/floatwin.cxx2
-rw-r--r--vcl/source/window/window.cxx118
22 files changed, 309 insertions, 366 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 1596c7788ec8..2770575a9e0d 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -564,7 +564,7 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* pThis,
int nCharCode,
int nKeyCode);
static void doc_postDialogKeyEvent(LibreOfficeKitDocument* pThis,
- unsigned nDialogId,
+ unsigned nLOKWindowId,
int nType,
int nCharCode,
int nKeyCode);
@@ -576,7 +576,7 @@ static void doc_postMouseEvent (LibreOfficeKitDocument* pThis,
int nButtons,
int nModifier);
static void doc_postDialogMouseEvent (LibreOfficeKitDocument* pThis,
- unsigned nDialogId,
+ unsigned nLOKWindowId,
int nType,
int nX,
int nY,
@@ -584,7 +584,7 @@ static void doc_postDialogMouseEvent (LibreOfficeKitDocument* pThis,
int nButtons,
int nModifier);
static void doc_postDialogChildMouseEvent (LibreOfficeKitDocument* pThis,
- unsigned nDialogId,
+ unsigned nLOKWindowId,
int nType,
int nX,
int nY,
@@ -631,14 +631,14 @@ static unsigned char* doc_renderFont(LibreOfficeKitDocument* pThis,
int* pFontHeight);
static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart);
-static void doc_paintDialog(LibreOfficeKitDocument* pThis, unsigned nDialogId, unsigned char* pBuffer,
+static void doc_paintDialog(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, unsigned char* pBuffer,
const int nX, const int nY,
const int nWidth, const int nHeight);
-static void doc_getDialogInfo(LibreOfficeKitDocument* pThis, unsigned nDialogId,
+static void doc_getDialogInfo(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId,
char** pDialogTitle, int* nWidth, int* nHeight);
-static void doc_paintActiveFloatingWindow(LibreOfficeKitDocument* pThis, unsigned nDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight);
+static void doc_paintActiveFloatingWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, unsigned char* pBuffer, int* nWidth, int* nHeight);
LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent)
: mxComponent(xComponent)
@@ -1049,7 +1049,7 @@ void CallbackFlushHandler::queue(const int type, const char* data)
boost::property_tree::ptree aTree;
std::stringstream aStream(payload);
boost::property_tree::read_json(aStream, aTree);
- const unsigned nDialogId = aTree.get<unsigned>("dialogId", 0);
+ const unsigned nLOKWindowId = aTree.get<unsigned>("dialogId", 0);
if (aTree.get<std::string>("action", "") == "invalidate")
{
std::string aRectStr = aTree.get<std::string>("rectangle", "");
@@ -1057,7 +1057,7 @@ void CallbackFlushHandler::queue(const int type, const char* data)
// remove all previous dialog part invalidations
if (aRectStr.empty())
{
- removeAll([&nDialogId] (const queue_type::value_type& elem) {
+ removeAll([&nLOKWindowId] (const queue_type::value_type& elem) {
if (elem.first == LOK_CALLBACK_DIALOG)
{
boost::property_tree::ptree aOldTree;
@@ -1065,7 +1065,7 @@ void CallbackFlushHandler::queue(const int type, const char* data)
boost::property_tree::read_json(aOldStream, aOldTree);
const unsigned nOldDialogId = aOldTree.get<unsigned>("dialogId", 0);
if (aOldTree.get<std::string>("action", "") == "invalidate" &&
- nDialogId == nOldDialogId)
+ nLOKWindowId == nOldDialogId)
{
return true;
}
@@ -1078,7 +1078,7 @@ void CallbackFlushHandler::queue(const int type, const char* data)
// if we have to invalidate all of the dialog, ignore
// any part invalidation message
const auto& pos = std::find_if(m_queue.rbegin(), m_queue.rend(),
- [&nDialogId] (const queue_type::value_type& elem)
+ [&nLOKWindowId] (const queue_type::value_type& elem)
{
if (elem.first != LOK_CALLBACK_DIALOG)
return false;
@@ -1088,7 +1088,7 @@ void CallbackFlushHandler::queue(const int type, const char* data)
boost::property_tree::read_json(aOldStream, aOldTree);
const unsigned nOldDialogId = aOldTree.get<unsigned>("dialogId", 0);
if (aOldTree.get<std::string>("action", "") == "invalidate" &&
- nDialogId == nOldDialogId &&
+ nLOKWindowId == nOldDialogId &&
aOldTree.get<std::string>("rectangle", "").empty())
{
return true;
@@ -1109,7 +1109,7 @@ void CallbackFlushHandler::queue(const int type, const char* data)
aRectStream >> nLeft >> nComma >> nTop >> nComma >> nWidth >> nComma >> nHeight;
Rectangle aNewRect = Rectangle(nLeft, nTop, nLeft + nWidth, nTop + nHeight);
bool currentIsRedundant = false;
- removeAll([&aNewRect, &nDialogId, &currentIsRedundant] (const queue_type::value_type& elem) {
+ removeAll([&aNewRect, &nLOKWindowId, &currentIsRedundant] (const queue_type::value_type& elem) {
if (elem.first != LOK_CALLBACK_DIALOG)
return false;
@@ -1129,7 +1129,7 @@ void CallbackFlushHandler::queue(const int type, const char* data)
aOldRectStream >> nOldLeft >> nOldComma >> nOldTop >> nOldComma >> nOldWidth >> nOldComma >> nOldHeight;
Rectangle aOldRect = Rectangle(nOldLeft, nOldTop, nOldLeft + nOldWidth, nOldTop + nOldHeight);
- if (nDialogId == nOldDialogId)
+ if (nLOKWindowId == nOldDialogId)
{
// new one engulfs the old one?
if (aNewRect.IsInside(aOldRect))
@@ -1342,10 +1342,14 @@ ITiledRenderable* getTiledRenderable(LibreOfficeKitDocument* pThis)
return dynamic_cast<ITiledRenderable*>(pDocument->mxComponent.get());
}
-IDialogRenderable* getDialogRenderable(LibreOfficeKitDocument* pThis)
+VclPtr<Window> findWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId)
{
- LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
- return dynamic_cast<IDialogRenderable*>(pDocument->mxComponent.get());
+ ITiledRenderable* pRenderable = getTiledRenderable(pThis);
+
+ if (!pRenderable)
+ return VclPtr<Window>();
+
+ return pRenderable->findWindow(nLOKWindowId);
}
} // anonymous namespace
@@ -2277,18 +2281,31 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nChar
pDoc->postKeyEvent(nType, nCharCode, nKeyCode);
}
-static void doc_postDialogKeyEvent(LibreOfficeKitDocument* pThis, unsigned nDialogId, int nType, int nCharCode, int nKeyCode)
+static void doc_postDialogKeyEvent(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nType, int nCharCode, int nKeyCode)
{
SolarMutexGuard aGuard;
- IDialogRenderable* pDoc = getDialogRenderable(pThis);
- if (!pDoc)
+ VclPtr<Window> pWindow = findWindow(pThis, nLOKWindowId);
+ if (!pWindow)
{
- gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering";
+ gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found.";
return;
}
- pDoc->postDialogKeyEvent(nDialogId, nType, nCharCode, nKeyCode);
+ KeyEvent aEvent(nCharCode, nKeyCode, 0);
+
+ switch (nType)
+ {
+ case LOK_KEYEVENT_KEYINPUT:
+ pWindow->LOKKeyInput(aEvent);
+ break;
+ case LOK_KEYEVENT_KEYUP:
+ pWindow->LOKKeyUp(aEvent);
+ break;
+ default:
+ assert(false);
+ break;
+ }
}
/** Class to react on finishing of a dispatched command.
@@ -2442,32 +2459,66 @@ static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX,
}
}
-static void doc_postDialogMouseEvent(LibreOfficeKitDocument* pThis, unsigned nDialogId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
+static void doc_postDialogMouseEvent(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
{
SolarMutexGuard aGuard;
- IDialogRenderable* pDoc = getDialogRenderable(pThis);
- if (!pDoc)
+ VclPtr<Window> pWindow = findWindow(pThis, nLOKWindowId);
+ if (!pWindow)
{
- gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering";
+ gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found.";
return;
}
- pDoc->postDialogMouseEvent(nDialogId, nType, nX, nY, nCount, nButtons, nModifier);
+ Point aPos(nX, nY);
+ MouseEvent aEvent(aPos, nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier);
+
+ switch (nType)
+ {
+ case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
+ pWindow->LogicMouseButtonDown(aEvent);
+ break;
+ case LOK_MOUSEEVENT_MOUSEBUTTONUP:
+ pWindow->LogicMouseButtonUp(aEvent);
+ break;
+ case LOK_MOUSEEVENT_MOUSEMOVE:
+ pWindow->LogicMouseMove(aEvent);
+ break;
+ default:
+ assert(false);
+ break;
+ }
}
-static void doc_postDialogChildMouseEvent(LibreOfficeKitDocument* pThis, unsigned nDialogId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
+static void doc_postDialogChildMouseEvent(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
{
SolarMutexGuard aGuard;
- IDialogRenderable* pDoc = getDialogRenderable(pThis);
- if (!pDoc)
+ VclPtr<Window> pWindow = findWindow(pThis, nLOKWindowId);
+ if (!pWindow)
{
- gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering";
+ gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found.";
return;
}
- pDoc->postDialogChildMouseEvent(nDialogId, nType, nX, nY, nCount, nButtons, nModifier);
+ Point aPos(nX, nY);
+ MouseEvent aEvent(aPos, nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier);
+
+ switch (nType)
+ {
+ case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
+ pWindow->LogicMouseButtonDownChild(aEvent);
+ break;
+ case LOK_MOUSEEVENT_MOUSEBUTTONUP:
+ pWindow->LogicMouseButtonUpChild(aEvent);
+ break;
+ case LOK_MOUSEEVENT_MOUSEMOVE:
+ pWindow->LogicMouseMoveChild(aEvent);
+ break;
+ default:
+ assert(false);
+ break;
+ }
}
static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int nX, int nY)
@@ -3246,14 +3297,25 @@ unsigned char* doc_renderFont(LibreOfficeKitDocument* /*pThis*/,
return nullptr;
}
-static void doc_getDialogInfo(LibreOfficeKitDocument* pThis, unsigned nDialogId,
+static void doc_getDialogInfo(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId,
char** pDialogTitle, int* nWidth, int* nHeight)
{
+ // FIXME - I guess we should kill this one, and use only the callback
+ // "created"?
+
SolarMutexGuard aGuard;
- IDialogRenderable* pDialogRenderable = getDialogRenderable(pThis);
- OUString aDialogTitle;
- pDialogRenderable->getDialogInfo(nDialogId, aDialogTitle, *nWidth, *nHeight);
+ VclPtr<Window> pWindow = findWindow(pThis, nLOKWindowId);
+ if (!pWindow)
+ {
+ gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found.";
+ return;
+ }
+
+ OUString aDialogTitle(pWindow->GetText());
+ const Size aSize = pWindow->GetSizePixel();
+ *nWidth = aSize.getWidth();
+ *nHeight = aSize.getHeight();
// copy dialog title
if (!aDialogTitle.isEmpty())
@@ -3264,14 +3326,19 @@ static void doc_getDialogInfo(LibreOfficeKitDocument* pThis, unsigned nDialogId,
}
}
-static void doc_paintDialog(LibreOfficeKitDocument* pThis, unsigned nDialogId,
+static void doc_paintDialog(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId,
unsigned char* pBuffer,
const int nX, const int nY,
const int nWidth, const int nHeight)
{
SolarMutexGuard aGuard;
- IDialogRenderable* pDialogRenderable = getDialogRenderable(pThis);
+ VclPtr<Window> pWindow = findWindow(pThis, nLOKWindowId);
+ if (!pWindow)
+ {
+ gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found.";
+ return;
+ }
ScopedVclPtrInstance<VirtualDevice> pDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT);
pDevice->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
@@ -3283,15 +3350,20 @@ static void doc_paintDialog(LibreOfficeKitDocument* pThis, unsigned nDialogId,
pDevice->SetMapMode(aMapMode);
comphelper::LibreOfficeKit::setDialogPainting(true);
- pDialogRenderable->paintDialog(nDialogId, *pDevice.get());
+ pWindow->paintDialog(*pDevice.get());
comphelper::LibreOfficeKit::setDialogPainting(false);
}
-static void doc_paintActiveFloatingWindow(LibreOfficeKitDocument* pThis, unsigned nDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight)
+static void doc_paintActiveFloatingWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, unsigned char* pBuffer, int* nWidth, int* nHeight)
{
SolarMutexGuard aGuard;
- IDialogRenderable* pDialogRenderable = getDialogRenderable(pThis);
+ VclPtr<Window> pWindow = findWindow(pThis, nLOKWindowId);
+ if (!pWindow)
+ {
+ gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found.";
+ return;
+ }
ScopedVclPtrInstance<VirtualDevice> pDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT);
pDevice->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
@@ -3299,7 +3371,9 @@ static void doc_paintActiveFloatingWindow(LibreOfficeKitDocument* pThis, unsigne
pDevice->SetOutputSizePixelScaleOffsetAndBuffer(Size(*nWidth, *nHeight), Fraction(1.0), Point(), pBuffer);
comphelper::LibreOfficeKit::setDialogPainting(true);
- pDialogRenderable->paintActiveFloatingWindow(nDialogId, *pDevice.get(), *nWidth, *nHeight);
+ const Size aSize = pWindow->PaintActiveFloatingWindow(*pDevice.get());
+ *nWidth = aSize.getWidth();
+ *nHeight = aSize.getHeight();
comphelper::LibreOfficeKit::setDialogPainting(false);
}
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index c199a5287b5c..810d537c1bed 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -42,11 +42,11 @@ public:
/// Same as notifyOtherViews(), but works on a selected "other" view, not on all of them.
static void notifyOtherView(SfxViewShell* pThisView, SfxViewShell* pOtherView, int nType, const OString& rKey, const OString& rPayload);
/// Emits a LOK_CALLBACK_DIALOG
- static void notifyDialog(vcl::LOKWindowId nDialogId,
+ static void notifyWindow(vcl::LOKWindowId nDialogId,
const OUString& rAction,
const std::vector<vcl::LOKPayloadItem>& rPayload = std::vector<vcl::LOKPayloadItem>());
/// Emits a LOK_CALLBACK_DIALOG_CHILD
- static void notifyDialogChild(vcl::LOKWindowId nDialogId, const OUString& rAction, const Point& rPos);
+ static void notifyWindowChild(vcl::LOKWindowId nDialogId, const OUString& rAction, const Point& rPos);
/// Emits a LOK_CALLBACK_INVALIDATE_TILES, but tweaks it according to setOptionalFeatures() if needed.
static void notifyInvalidation(SfxViewShell* pThisView, const OString& rPayload);
/// A special value to signify 'infinity'.
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 7602da3f5d25..e37c5137e381 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -232,8 +232,8 @@ public:
void UnregisterDlg(vcl::LOKWindowId nDialogId);
// ILibreOfficeKitNotifier
- virtual void notifyDialog(const vcl::LOKWindowId& rDialogId, const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload = std::vector<vcl::LOKPayloadItem>()) const override;
- virtual void notifyDialogChild(const vcl::LOKWindowId& rDialogId, const OUString& rAction, const Point& rPos) const override;
+ virtual void notifyWindow(vcl::LOKWindowId nLOKWindowId, const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload = std::vector<vcl::LOKPayloadItem>()) const override;
+ virtual void notifyWindowChild(vcl::LOKWindowId nLOKWindowId, const OUString& rAction, const Point& rPos) const override;
// Focus, KeyInput, Cursor
virtual void ShowCursor( bool bOn = true );
diff --git a/include/vcl/IDialogRenderable.hxx b/include/vcl/IDialogRenderable.hxx
index db3831ccd5c6..281d04385aee 100644
--- a/include/vcl/IDialogRenderable.hxx
+++ b/include/vcl/IDialogRenderable.hxx
@@ -11,53 +11,31 @@
#ifndef INCLUDED_VCL_IDIALOGRENDERABLE_HXX
#define INCLUDED_VCL_IDIALOGRENDERABLE_HXX
-#include <tools/gen.hxx>
-#include <vcl/pointr.hxx>
-#include <vcl/virdev.hxx>
-#include <vcl/window.hxx>
+#include <vcl/dllapi.h>
-#include "IDialogRenderable.hxx"
+#include <tools/gen.hxx>
+#include <rtl/ustring.hxx>
-#include <map>
+#include <vector>
namespace vcl
{
typedef std::pair<const OString, const OString> LOKPayloadItem;
-class VCL_DLLPUBLIC IDialogRenderable
-{
-public:
- virtual ~IDialogRenderable();
-
- virtual void paintDialog(const LOKWindowId& rLOKWindowId, VirtualDevice &rDevice) = 0;
-
- virtual void getDialogInfo(const LOKWindowId& rLOKWindowId, OUString& rDialogTitle, int& rWidth, int& rHeight) = 0;
-
- virtual void paintActiveFloatingWindow(const LOKWindowId& rLOKWindowId, VirtualDevice &rDevice,
- int& nOutputWidth, int& nOutputHeight) = 0;
-
- virtual void postDialogKeyEvent(const LOKWindowId& rLOKWindowId, int nType,
- int nCharCode, int nKeyCode) = 0;
-
- virtual void postDialogMouseEvent(const LOKWindowId& rLOKWindowId, int nType, int nX, int nY,
- int nCount, int nButtons, int nModifier) = 0;
-
- virtual void postDialogChildMouseEvent(const LOKWindowId& rLOKWindowId, int nType, int nX, int nY,
- int nCount, int nButtons, int nModifier) = 0;
-};
+typedef sal_uInt32 LOKWindowId;
class VCL_DLLPUBLIC ILibreOfficeKitNotifier
{
public:
virtual ~ILibreOfficeKitNotifier() {}
- // Callbacks
- virtual void notifyDialog(const LOKWindowId& rLOKWindowId,
+ /// Callbacks
+ virtual void notifyWindow(vcl::LOKWindowId nLOKWindowId,
const OUString& rAction,
const std::vector<LOKPayloadItem>& rPayload = std::vector<LOKPayloadItem>()) const = 0;
- virtual void notifyDialogChild(const LOKWindowId& rLOKWindowId, const OUString& rAction, const Point& rPos) const = 0;
+ virtual void notifyWindowChild(vcl::LOKWindowId nLOKWindowId, const OUString& rAction, const Point& rPos) const = 0;
};
} // namespace vcl
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index ae3ba9e76c3c..b57ed35ae7e9 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -241,6 +241,12 @@ public:
{
return OUString();
}
+
+ /**
+ * Find the window/dialog with the right ID for tunneling of windows,
+ * dialogs or pop-ups.
+ */
+ virtual VclPtr<Window> findWindow(vcl::LOKWindowId nLOKWindowId) const = 0;
};
} // namespace vcl
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index 76952b2f3cc5..73a68d657254 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -68,20 +68,9 @@ public:
virtual void LogicInvalidate(const Rectangle* pRectangle) override;
void InvalidateFloatingWindow(const Point& rPos);
void CloseFloatingWindow();
- Size PaintActiveFloatingWindow(VirtualDevice& rDevice);
/// Paints the current dialog to the given virtual device
- void paintDialog(VirtualDevice& rDevice);
- void LogicMouseButtonDown(const MouseEvent& rMouseEvent);
- void LogicMouseButtonUp(const MouseEvent& rMouseEvent);
- void LogicMouseMove(const MouseEvent& rMouseEvent);
- void LogicMouseButtonDownChild(const MouseEvent& rMouseEvent);
- void LogicMouseButtonUpChild(const MouseEvent& rMouseEvent);
- void LogicMouseMoveChild(const MouseEvent& rMouseEvent);
-
- void LOKKeyInput(const KeyEvent& rKeyEvent);
- void LOKKeyUp(const KeyEvent& rKeyEvent);
- void LOKCursor(const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload);
+ void paintDialog(VirtualDevice& rDevice) override;
protected:
explicit Dialog( WindowType nType );
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 08faef8e8519..d424f6fd14ab 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -34,6 +34,8 @@
#include <vcl/region.hxx>
#include <vcl/salnativewidgets.hxx>
#include <vcl/uitest/factory.hxx>
+#include <vcl/vclevent.hxx>
+#include <vcl/IDialogRenderable.hxx>
#include <rtl/ustring.hxx>
#include <rtl/ref.hxx>
#include <cppuhelper/weakref.hxx>
@@ -485,8 +487,6 @@ public:
Color* pPaintColor = nullptr);
};
-typedef sal_uInt32 LOKWindowId;
-
class VCL_DLLPUBLIC Window : public ::OutputDevice, public Resource
{
friend class ::vcl::Cursor;
@@ -1203,11 +1203,26 @@ public:
void SetComponentInterface( css::uno::Reference< css::awt::XWindowPeer > const & xIFace );
- /// Interface to register for dialog tunneling.
+ /// Interface to register for dialog / window tunneling.
void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier);
const vcl::ILibreOfficeKitNotifier* GetLOKNotifier() const;
vcl::LOKWindowId GetLOKWindowId() const;
+ /// Dialog / window tunneling related methods.
+ virtual void paintDialog(VirtualDevice& rDevice);
+ Size PaintActiveFloatingWindow(VirtualDevice& rDevice) const;
+
+ void LogicMouseButtonDown(const MouseEvent& rMouseEvent);
+ void LogicMouseButtonUp(const MouseEvent& rMouseEvent);
+ void LogicMouseMove(const MouseEvent& rMouseEvent);
+ void LogicMouseButtonDownChild(const MouseEvent& rMouseEvent);
+ void LogicMouseButtonUpChild(const MouseEvent& rMouseEvent);
+ void LogicMouseMoveChild(const MouseEvent& rMouseEvent);
+
+ void LOKKeyInput(const KeyEvent& rKeyEvent);
+ void LOKKeyUp(const KeyEvent& rKeyEvent);
+ void LOKCursor(const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload);
+
/** @name Accessibility
*/
///@{
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 917b211a82a1..6bc2c5da7ae8 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -432,6 +432,9 @@ public:
/// @see vcl::ITiledRenderable::getPostItsPos().
OUString getPostItsPos() override;
+
+ /// @see vcl::ITiledRenderable::findWindow().
+ VclPtr<vcl::Window> findWindow(vcl::LOKWindowId nLOKWindowId) const override;
};
class ScDrawPagesObj : public cppu::WeakImplHelper<
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 473a8dcb17ac..629c203399ad 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1130,6 +1130,12 @@ OUString ScModelObj::getPostItsPos()
return OUString::fromUtf8(aStream.str().c_str());
}
+VclPtr<vcl::Window> ScModelObj::findWindow(vcl::LOKWindowId nLOKWindowId) const
+{
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+ return pViewShell->GetOpenedDlg(nLOKWindowId);
+}
+
void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& /*rArguments*/)
{
SolarMutexGuard aGuard;
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 087fa521ca9e..ee1cb5687dd1 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -268,6 +268,9 @@ public:
/// @see vcl::ITiledRenderable::getPostIts().
virtual OUString getPostIts() override;
+ /// @see vcl::ITiledRenderable::findWindow().
+ VclPtr<vcl::Window> findWindow(vcl::LOKWindowId nLOKWindowId) const override;
+
// XComponent
/** This dispose implementation releases the resources held by the
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 6b852e2cb5bb..c902e2dc5104 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2705,6 +2705,12 @@ Pointer SdXImpressDocument::getPointer()
return pWindow->GetPointer();
}
+VclPtr<vcl::Window> SdXImpressDocument::findWindow(vcl::LOKWindowId nLOKWindowId) const
+{
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+ return pViewShell->GetOpenedDlg(nLOKWindowId);
+}
+
uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable()
{
uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbidenCharacters);
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index 8d2c789b9f0f..e1afc854afd5 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -170,7 +170,7 @@ void SfxModalDialog::dispose()
SfxViewShell* pViewShell = SfxViewShell::Current();
if (comphelper::LibreOfficeKit::isActive() && pViewShell)
{
- pViewShell->notifyDialog(GetLOKWindowId(), "close");
+ pViewShell->notifyWindow(GetLOKWindowId(), "close");
pViewShell->UnregisterDlg(GetLOKWindowId());
}
@@ -187,7 +187,7 @@ short SfxModalDialog::Execute()
const Size aSize = GetOptimalSize();
std::vector<vcl::LOKPayloadItem> aItems;
aItems.emplace_back(std::make_pair("size", aSize.toString()));
- pViewShell->notifyDialog(GetLOKWindowId(), "created", aItems);
+ pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems);
}
return ModalDialog::Execute();
@@ -261,7 +261,7 @@ void SfxModelessDialog::StateChanged( StateChangedType nStateChange )
const Size aOptimalSize = GetOptimalSize();
std::vector<vcl::LOKPayloadItem> aItems;
aItems.emplace_back(std::make_pair("size", aOptimalSize.toString()));
- pViewShell->notifyDialog(GetLOKWindowId(), "created", aItems);
+ pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems);
}
pImpl->bConstructed = true;
@@ -397,7 +397,7 @@ void SfxModelessDialog::dispose()
SfxViewShell* pViewShell = SfxViewShell::Current();
if (comphelper::LibreOfficeKit::isActive() && pViewShell)
{
- pViewShell->notifyDialog(GetLOKWindowId(), "close");
+ pViewShell->notifyWindow(GetLOKWindowId(), "close");
pViewShell->UnregisterDlg(GetLOKWindowId());
}
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 0fc93ed11812..64bbc97727f9 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -408,7 +408,7 @@ void SfxTabDialog::dispose()
SfxViewShell* pViewShell = SfxViewShell::Current();
if (comphelper::LibreOfficeKit::isActive() && pViewShell)
{
- pViewShell->notifyDialog(GetLOKWindowId(), "close");
+ pViewShell->notifyWindow(GetLOKWindowId(), "close");
pViewShell->UnregisterDlg(GetLOKWindowId());
}
@@ -528,7 +528,7 @@ short SfxTabDialog::Execute()
const Size aSize = GetOptimalSize();
std::vector<vcl::LOKPayloadItem> aItems;
aItems.emplace_back(std::make_pair("size", aSize.toString()));
- pViewShell->notifyDialog(GetLOKWindowId(), "created", aItems);
+ pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems);
}
return TabDialog::Execute();
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index da6cd4ac16ee..685cbe4a4a73 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -132,7 +132,7 @@ void SfxLokHelper::notifyOtherViews(SfxViewShell* pThisView, int nType, const OS
}
}
-void SfxLokHelper::notifyDialog(vcl::LOKWindowId nLOKWindowId,
+void SfxLokHelper::notifyWindow(vcl::LOKWindowId nLOKWindowId,
const OUString& rAction,
const std::vector<vcl::LOKPayloadItem>& rPayload)
{
@@ -160,7 +160,7 @@ void SfxLokHelper::notifyDialog(vcl::LOKWindowId nLOKWindowId,
}
}
-void SfxLokHelper::notifyDialogChild(vcl::LOKWindowId nLOKWindowId, const OUString& rAction, const Point& rPos)
+void SfxLokHelper::notifyWindowChild(vcl::LOKWindowId nLOKWindowId, const OUString& rAction, const Point& rPos)
{
if (SfxLokHelper::getViewsCount() <= 0 || nLOKWindowId == 0)
return;
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 46412c9db379..36229bd51ef4 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -2036,14 +2036,14 @@ Reference< view::XRenderable > SfxViewShell::GetRenderable()
return xRender;
}
-void SfxViewShell::notifyDialog(const vcl::LOKWindowId& rDialogId, const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload) const
+void SfxViewShell::notifyWindow(vcl::LOKWindowId nDialogId, const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload) const
{
- SfxLokHelper::notifyDialog(rDialogId, rAction, rPayload);
+ SfxLokHelper::notifyWindow(nDialogId, rAction, rPayload);
}
-void SfxViewShell::notifyDialogChild(const vcl::LOKWindowId& rDialogId, const OUString& rAction, const Point& rPos) const
+void SfxViewShell::notifyWindowChild(vcl::LOKWindowId nDialogId, const OUString& rAction, const Point& rPos) const
{
- SfxLokHelper::notifyDialogChild(rDialogId, rAction, rPos);
+ SfxLokHelper::notifyWindowChild(nDialogId, rAction, rPos);
}
void SfxViewShell::RegisterDlg(vcl::LOKWindowId nDialogId, VclPtr<Dialog> pDlg)
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index e16dc50f43f4..f8865610db15 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -69,7 +69,6 @@
#include <cppuhelper/implbase.hxx>
#include <vcl/event.hxx>
#include <vcl/ITiledRenderable.hxx>
-#include <vcl/IDialogRenderable.hxx>
#include <com/sun/star/tiledrendering/XTiledRenderable.hpp>
#include <unobaseclass.hxx>
@@ -131,7 +130,6 @@ class SW_DLLPUBLIC SwXTextDocument : public SwXTextDocumentBaseClass,
public SvxFmMSFactory,
public SfxBaseModel,
public vcl::ITiledRenderable,
- public vcl::IDialogRenderable,
public css::tiledrendering::XTiledRenderable
{
private:
@@ -452,17 +450,8 @@ public:
/// @see vcl::ITiledRenderable::getPostIts().
OUString getPostIts() override;
- void paintDialog(const vcl::LOKWindowId& rLOKWindowId, VirtualDevice& rDevice) override;
- void getDialogInfo(const vcl::LOKWindowId& rLOKWindowId, OUString& rDialogTitle, int& rWidth, int& rHeight) override;
- void paintActiveFloatingWindow(const vcl::LOKWindowId& rLOKWindowId, VirtualDevice& rDevice, int& nWidth, int& nHeight) override;
- void postDialogKeyEvent(const vcl::LOKWindowId& rLOKWindowId, int nType,
- int nCharCode, int nKeyCode) override;
-
- void postDialogMouseEvent(const vcl::LOKWindowId& rLOKWindowId, int nType, int nX, int nY,
- int nCount, int nButtons, int nModifier) override;
-
- void postDialogChildMouseEvent(const vcl::LOKWindowId& rLOKWindowId, int nType, int nX, int nY,
- int nCount, int nButtons, int nModifier) override;
+ /// @see vcl::ITiledRenderable::findWindow().
+ VclPtr<vcl::Window> findWindow(vcl::LOKWindowId nLOKWindowId) const 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 ) throw (::css::uno::RuntimeException, std::exception) override;
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index be7df40f4619..f92e720a34e8 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3711,123 +3711,10 @@ void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_I
#endif
}
-void SwXTextDocument::paintDialog(const vcl::LOKWindowId& rLOKWindowId, VirtualDevice& rDevice)
+VclPtr<vcl::Window> SwXTextDocument::findWindow(vcl::LOKWindowId nLOKWindowId) const
{
SfxViewShell* pViewShell = SfxViewShell::Current();
- VclPtr<Dialog> pDlg = pViewShell->GetOpenedDlg(rLOKWindowId);
- if (pDlg)
- pDlg->paintDialog(rDevice);
-}
-
-void SwXTextDocument::getDialogInfo(const vcl::LOKWindowId& rLOKWindowId, OUString& rDialogTitle, int& rWidth, int& rHeight)
-{
- SfxViewShell* pViewShell = SfxViewShell::Current();
- VclPtr<Dialog> pDlg = pViewShell->GetOpenedDlg(rLOKWindowId);
- if (pDlg)
- {
- rDialogTitle = pDlg->GetText();
- const Size aSize = pDlg->GetOptimalSize();
- rWidth = aSize.getWidth();
- rHeight = aSize.getHeight();
- }
-}
-
-void SwXTextDocument::postDialogKeyEvent(const vcl::LOKWindowId& rLOKWindowId, int nType, int nCharCode, int nKeyCode)
-{
- SolarMutexGuard aGuard;
-
- SfxViewShell* pViewShell = SfxViewShell::Current();
- VclPtr<Dialog> pDialog = pViewShell->GetOpenedDlg(rLOKWindowId);
- if (pDialog)
- {
- KeyEvent aEvent(nCharCode, nKeyCode, 0);
-
- switch (nType)
- {
- case LOK_KEYEVENT_KEYINPUT:
- pDialog->LOKKeyInput(aEvent);
- break;
- case LOK_KEYEVENT_KEYUP:
- pDialog->LOKKeyUp(aEvent);
- break;
- default:
- assert(false);
- break;
- }
- }
-}
-
-void SwXTextDocument::postDialogMouseEvent(const vcl::LOKWindowId& rLOKWindowId, int nType, int nX, int nY,
- int nCount, int nButtons, int nModifier)
-{
- SolarMutexGuard aGuard;
-
- SfxViewShell* pViewShell = SfxViewShell::Current();
- VclPtr<Dialog> pDialog = pViewShell->GetOpenedDlg(rLOKWindowId);
- if (pDialog)
- {
- Point aPos(nX , nY);
- MouseEvent aEvent(aPos, nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier);
-
- switch (nType)
- {
- case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
- pDialog->LogicMouseButtonDown(aEvent);
- break;
- case LOK_MOUSEEVENT_MOUSEBUTTONUP:
- pDialog->LogicMouseButtonUp(aEvent);
- break;
- case LOK_MOUSEEVENT_MOUSEMOVE:
- pDialog->LogicMouseMove(aEvent);
- break;
- default:
- assert(false);
- break;
- }
- }
-}
-
-
-void SwXTextDocument::postDialogChildMouseEvent(const vcl::LOKWindowId& rLOKWindowId, int nType, int nX, int nY,
- int nCount, int nButtons, int nModifier)
-{
- SolarMutexGuard aGuard;
-
- SfxViewShell* pViewShell = SfxViewShell::Current();
- VclPtr<Dialog> pDialog = pViewShell->GetOpenedDlg(rLOKWindowId);
- if (pDialog)
- {
- Point aPos(nX , nY);
- MouseEvent aEvent(aPos, nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier);
-
- switch (nType)
- {
- case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
- pDialog->LogicMouseButtonDownChild(aEvent);
- break;
- case LOK_MOUSEEVENT_MOUSEBUTTONUP:
- pDialog->LogicMouseButtonUpChild(aEvent);
- break;
- case LOK_MOUSEEVENT_MOUSEMOVE:
- pDialog->LogicMouseMoveChild(aEvent);
- break;
- default:
- assert(false);
- break;
- }
- }
-}
-
-void SwXTextDocument::paintActiveFloatingWindow(const vcl::LOKWindowId& rLOKWindowId, VirtualDevice& rDevice, int& nWidth, int& nHeight)
-{
- SfxViewShell* pViewShell = SfxViewShell::Current();
- VclPtr<Dialog> pDialog = pViewShell->GetOpenedDlg(rLOKWindowId);
- if (pDialog)
- {
- const Size aSize = pDialog->PaintActiveFloatingWindow(rDevice);
- nWidth = aSize.getWidth();
- nHeight = aSize.getHeight();
- }
+ return pViewShell->GetOpenedDlg(nLOKWindowId);
}
void * SAL_CALL SwXTextDocument::operator new( size_t t) throw()
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 701eb5c78abe..61e854a674b6 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -341,7 +341,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/app/IconThemeScanner \
vcl/source/app/IconThemeSelector \
vcl/source/app/ITiledRenderable \
- vcl/source/app/IDialogRenderable \
vcl/source/app/sound \
vcl/source/app/stdtext \
vcl/source/app/svapp \
diff --git a/vcl/source/app/IDialogRenderable.cxx b/vcl/source/app/IDialogRenderable.cxx
deleted file mode 100644
index 58ec05265101..000000000000
--- a/vcl/source/app/IDialogRenderable.cxx
+++ /dev/null
@@ -1,22 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- */
-
-#include <vcl/IDialogRenderable.hxx>
-
-namespace vcl
-{
-
-IDialogRenderable::~IDialogRenderable()
-{
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 6eab80b0c2f6..c1265b69e1b9 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -884,75 +884,16 @@ void Dialog::paintDialog(VirtualDevice& rDevice)
PaintToDevice(&rDevice, Point(0, 0), Size());
}
-Size Dialog::PaintActiveFloatingWindow(VirtualDevice& rDevice)
-{
- Size aRet;
- ImplSVData* pSVData = ImplGetSVData();
- FloatingWindow* pFirstFloat = pSVData->maWinData.mpFirstFloat;
- if (pFirstFloat)
- {
- // TODO:: run a while loop here and check all the active floating
- // windows ( chained together, cf. pFirstFloat->mpNextFloat )
- // For now just assume that the active floating window is the one we
- // want to render
- if (pFirstFloat->GetParentDialog() == this)
- {
- pFirstFloat->PaintToDevice(&rDevice, Point(0, 0), Size());
- aRet = ::isLayoutEnabled(pFirstFloat) ? pFirstFloat->get_preferred_size() : pFirstFloat->GetSizePixel();
- }
-
- pFirstFloat = nullptr;
- }
-
- return aRet;
-}
-
-void Dialog::LogicMouseButtonDownChild(const MouseEvent& rMouseEvent)
-{
- assert(comphelper::LibreOfficeKit::isActive());
-
- ImplSVData* pSVData = ImplGetSVData();
- FloatingWindow* pFirstFloat = pSVData->maWinData.mpFirstFloat;
- if (pFirstFloat && pFirstFloat->GetParentDialog() == this)
- {
- ImplWindowFrameProc(pFirstFloat->ImplGetBorderWindow(), SalEvent::ExternalMouseButtonDown, &rMouseEvent);
- }
-}
-
-void Dialog::LogicMouseButtonUpChild(const MouseEvent& rMouseEvent)
-{
- assert(comphelper::LibreOfficeKit::isActive());
-
- ImplSVData* pSVData = ImplGetSVData();
- FloatingWindow* pFirstFloat = pSVData->maWinData.mpFirstFloat;
- if (pFirstFloat && pFirstFloat->GetParentDialog() == this)
- {
- ImplWindowFrameProc(pFirstFloat->ImplGetBorderWindow(), SalEvent::ExternalMouseButtonUp, &rMouseEvent);
- }
-}
-
-void Dialog::LogicMouseMoveChild(const MouseEvent& rMouseEvent)
-{
- assert(comphelper::LibreOfficeKit::isActive());
-
- ImplSVData* pSVData = ImplGetSVData();
- FloatingWindow* pFirstFloat = pSVData->maWinData.mpFirstFloat;
- if (pFirstFloat && pFirstFloat->GetParentDialog() == this)
- {
- ImplWindowFrameProc(pFirstFloat->ImplGetBorderWindow(), SalEvent::ExternalMouseMove, &rMouseEvent);
- }
-}
-
void Dialog::InvalidateFloatingWindow(const Point& rPos)
{
if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
- pNotifier->notifyDialogChild(GetLOKWindowId(), "invalidate", rPos);
+ pNotifier->notifyWindowChild(GetLOKWindowId(), "invalidate", rPos);
}
void Dialog::CloseFloatingWindow()
{
if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
- pNotifier->notifyDialogChild(GetLOKWindowId(), "close", Point(0, 0));
+ pNotifier->notifyWindowChild(GetLOKWindowId(), "close", Point(0, 0));
}
void Dialog::LogicInvalidate(const Rectangle* pRectangle)
@@ -966,59 +907,10 @@ void Dialog::LogicInvalidate(const Rectangle* pRectangle)
if (pRectangle)
aPayload.push_back(std::make_pair(OString("rectangle"), pRectangle->toString()));
- pNotifier->notifyDialog(GetLOKWindowId(), "invalidate", aPayload);
+ pNotifier->notifyWindow(GetLOKWindowId(), "invalidate", aPayload);
}
}
-void Dialog::LogicMouseButtonDown(const MouseEvent& rMouseEvent)
-{
- // When we're not doing tiled rendering, then positions must be passed as pixels.
- assert(comphelper::LibreOfficeKit::isActive());
-
- ImplWindowFrameProc(this, SalEvent::ExternalMouseButtonDown, &rMouseEvent);
-}
-
-void Dialog::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
-{
- // When we're not doing tiled rendering, then positions must be passed as pixels.
- assert(comphelper::LibreOfficeKit::isActive());
-
- ImplWindowFrameProc(this, SalEvent::ExternalMouseButtonUp, &rMouseEvent);
-}
-
-void Dialog::LogicMouseMove(const MouseEvent& rMouseEvent)
-{
- // When we're not doing tiled rendering, then positions must be passed as pixels.
- assert(comphelper::LibreOfficeKit::isActive());
-
- ImplWindowFrameProc(this, SalEvent::ExternalMouseMove, &rMouseEvent);
-}
-
-void Dialog::LOKKeyInput(const KeyEvent& rKeyEvent)
-{
- assert(comphelper::LibreOfficeKit::isActive());
-
- ImplWindowFrameProc(this, SalEvent::ExternalKeyInput, &rKeyEvent);
-}
-
-void Dialog::LOKKeyUp(const KeyEvent& rKeyEvent)
-{
- assert(comphelper::LibreOfficeKit::isActive());
-
- ImplWindowFrameProc(this, SalEvent::ExternalKeyUp, &rKeyEvent);
-}
-
-void Dialog::LOKCursor(const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload)
-{
- assert(comphelper::LibreOfficeKit::isActive());
-
- if (comphelper::LibreOfficeKit::isDialogPainting())
- return;
-
- if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
- pNotifier->notifyDialog(GetLOKWindowId(), rAction, rPayload);
-}
-
void Dialog::ensureRepaint()
{
// ensure repaint
@@ -1350,7 +1242,7 @@ void Dialog::Resize()
// inform LOK clients
if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
- pNotifier->notifyDialog(GetLOKWindowId(), "invalidate");
+ pNotifier->notifyWindow(GetLOKWindowId(), "invalidate");
}
bool Dialog::set_property(const OString &rKey, const OString &rValue)
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 9ce9cd378b59..6a3385360ed7 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -734,7 +734,7 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, FloatWinPopupFlags
{
std::vector<vcl::LOKPayloadItem> aItems;
aItems.emplace_back(std::make_pair("size", rRect.GetSize().toString()));
- pNotifier->notifyDialog(GetLOKWindowId(), "created", aItems);
+ pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
}
}
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 7ba762908114..b0d87fdef301 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -65,6 +65,7 @@
#include <com/sun/star/datatransfer/clipboard/SystemClipboard.hpp>
#include <com/sun/star/rendering/CanvasFactory.hpp>
#include <com/sun/star/rendering/XSpriteCanvas.hpp>
+#include <comphelper/lok.hxx>
#include <comphelper/processfactory.hxx>
#include <unotools/configmgr.hxx>
@@ -3214,6 +3215,123 @@ vcl::LOKWindowId Window::GetLOKWindowId() const
return mpWindowImpl->mnLOKWindowId;
}
+void Window::paintDialog(VirtualDevice& rDevice)
+{
+ // FIXME are these two necessary?
+ Show();
+ ToTop();
+
+ PaintToDevice(&rDevice, Point(0, 0), Size());
+}
+
+Size Window::PaintActiveFloatingWindow(VirtualDevice& rDevice) const
+{
+ Size aRet;
+ ImplSVData* pSVData = ImplGetSVData();
+ FloatingWindow* pFirstFloat = pSVData->maWinData.mpFirstFloat;
+ if (pFirstFloat)
+ {
+ // TODO:: run a while loop here and check all the active floating
+ // windows ( chained together, cf. pFirstFloat->mpNextFloat )
+ // For now just assume that the active floating window is the one we
+ // want to render
+ if (pFirstFloat->GetParentDialog() == this)
+ {
+ pFirstFloat->PaintToDevice(&rDevice, Point(0, 0), Size());
+ aRet = pFirstFloat->GetSizePixel();
+ }
+
+ pFirstFloat = nullptr;
+ }
+
+ return aRet;
+}
+
+void Window::LogicMouseButtonDown(const MouseEvent& rMouseEvent)
+{
+ // When we're not doing tiled rendering, then positions must be passed as pixels.
+ assert(comphelper::LibreOfficeKit::isActive());
+
+ ImplWindowFrameProc(this, SalEvent::ExternalMouseButtonDown, &rMouseEvent);
+}
+
+void Window::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
+{
+ // When we're not doing tiled rendering, then positions must be passed as pixels.
+ assert(comphelper::LibreOfficeKit::isActive());
+
+ ImplWindowFrameProc(this, SalEvent::ExternalMouseButtonUp, &rMouseEvent);
+}
+
+void Window::LogicMouseMove(const MouseEvent& rMouseEvent)
+{
+ // When we're not doing tiled rendering, then positions must be passed as pixels.
+ assert(comphelper::LibreOfficeKit::isActive());
+
+ ImplWindowFrameProc(this, SalEvent::ExternalMouseMove, &rMouseEvent);
+}
+
+void Window::LogicMouseButtonDownChild(const MouseEvent& rMouseEvent)
+{
+ assert(comphelper::LibreOfficeKit::isActive());
+
+ ImplSVData* pSVData = ImplGetSVData();
+ FloatingWindow* pFirstFloat = pSVData->maWinData.mpFirstFloat;
+ if (pFirstFloat && pFirstFloat->GetParentDialog() == this)
+ {
+ ImplWindowFrameProc(pFirstFloat->ImplGetBorderWindow(), SalEvent::ExternalMouseButtonDown, &rMouseEvent);
+ }
+}
+
+void Window::LogicMouseButtonUpChild(const MouseEvent& rMouseEvent)
+{
+ assert(comphelper::LibreOfficeKit::isActive());
+
+ ImplSVData* pSVData = ImplGetSVData();
+ FloatingWindow* pFirstFloat = pSVData->maWinData.mpFirstFloat;
+ if (pFirstFloat && pFirstFloat->GetParentDialog() == this)
+ {
+ ImplWindowFrameProc(pFirstFloat->ImplGetBorderWindow(), SalEvent::ExternalMouseButtonUp, &rMouseEvent);
+ }
+}
+
+void Window::LogicMouseMoveChild(const MouseEvent& rMouseEvent)
+{
+ assert(comphelper::LibreOfficeKit::isActive());
+
+ ImplSVData* pSVData = ImplGetSVData();
+ FloatingWindow* pFirstFloat = pSVData->maWinData.mpFirstFloat;
+ if (pFirstFloat && pFirstFloat->GetParentDialog() == this)
+ {
+ ImplWindowFrameProc(pFirstFloat->ImplGetBorderWindow(), SalEvent::ExternalMouseMove, &rMouseEvent);
+ }
+}
+
+void Window::LOKKeyInput(const KeyEvent& rKeyEvent)
+{
+ assert(comphelper::LibreOfficeKit::isActive());
+
+ ImplWindowFrameProc(this, SalEvent::ExternalKeyInput, &rKeyEvent);
+}
+
+void Window::LOKKeyUp(const KeyEvent& rKeyEvent)
+{
+ assert(comphelper::LibreOfficeKit::isActive());
+
+ ImplWindowFrameProc(this, SalEvent::ExternalKeyUp, &rKeyEvent);
+}
+
+void Window::LOKCursor(const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload)
+{
+ assert(comphelper::LibreOfficeKit::isActive());
+
+ if (comphelper::LibreOfficeKit::isDialogPainting())
+ return;
+
+ if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
+ pNotifier->notifyWindow(GetLOKWindowId(), rAction, rPayload);
+}
+
void Window::ImplCallDeactivateListeners( vcl::Window *pNew )
{
// no deactivation if the newly activated window is my child