diff options
author | Jan Holesovsky <kendy@collabora.com> | 2017-11-24 18:50:05 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-11-29 10:16:57 +0100 |
commit | e2ae221f6164ba240da7d6470fd52c1982fa07d2 (patch) | |
tree | b8d37d7566c0bc4435c6c02e03d632912843ee0e | |
parent | 5de24bea47e7ae971a53b51ee7d1b85d134bbe52 (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.cxx | 156 | ||||
-rw-r--r-- | include/sfx2/lokhelper.hxx | 4 | ||||
-rw-r--r-- | include/sfx2/viewsh.hxx | 4 | ||||
-rw-r--r-- | include/vcl/IDialogRenderable.hxx | 36 | ||||
-rw-r--r-- | include/vcl/ITiledRenderable.hxx | 6 | ||||
-rw-r--r-- | include/vcl/dialog.hxx | 13 | ||||
-rw-r--r-- | include/vcl/window.hxx | 20 | ||||
-rw-r--r-- | sc/inc/docuno.hxx | 3 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/inc/unomodel.hxx | 3 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/dialog/basedlgs.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/dialog/tabdlg.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/view/lokhelper.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 8 | ||||
-rw-r--r-- | sw/inc/unotxdoc.hxx | 15 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 117 | ||||
-rw-r--r-- | vcl/Library_vcl.mk | 1 | ||||
-rw-r--r-- | vcl/source/app/IDialogRenderable.cxx | 22 | ||||
-rw-r--r-- | vcl/source/window/dialog.cxx | 116 | ||||
-rw-r--r-- | vcl/source/window/floatwin.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 118 |
22 files changed, 308 insertions, 364 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index b40ff1a609e4..cf5827ecbebd 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -544,7 +544,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); @@ -556,7 +556,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, @@ -564,7 +564,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, @@ -611,14 +611,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) @@ -1029,7 +1029,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", ""); @@ -1037,7 +1037,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; @@ -1045,7 +1045,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; } @@ -1058,7 +1058,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; @@ -1068,7 +1068,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; @@ -1089,7 +1089,7 @@ void CallbackFlushHandler::queue(const int type, const char* data) aRectStream >> nLeft >> nComma >> nTop >> nComma >> nWidth >> nComma >> nHeight; tools::Rectangle aNewRect = tools::Rectangle(nLeft, nTop, nLeft + nWidth, nTop + nHeight); bool currentIsRedundant = false; - removeAll([&aNewRect, &nDialogId, ¤tIsRedundant] (const queue_type::value_type& elem) { + removeAll([&aNewRect, &nLOKWindowId, ¤tIsRedundant] (const queue_type::value_type& elem) { if (elem.first != LOK_CALLBACK_DIALOG) return false; @@ -1109,7 +1109,7 @@ void CallbackFlushHandler::queue(const int type, const char* data) aOldRectStream >> nOldLeft >> nOldComma >> nOldTop >> nOldComma >> nOldWidth >> nOldComma >> nOldHeight; tools::Rectangle aOldRect = tools::Rectangle(nOldLeft, nOldTop, nOldLeft + nOldWidth, nOldTop + nOldHeight); - if (nDialogId == nOldDialogId) + if (nLOKWindowId == nOldDialogId) { // new one engulfs the old one? if (aNewRect.IsInside(aOldRect)) @@ -1322,10 +1322,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 @@ -2257,18 +2261,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. @@ -2422,32 +2439,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) @@ -3226,14 +3277,25 @@ unsigned char* doc_renderFont(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pTh 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()) @@ -3244,14 +3306,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))); @@ -3263,15 +3330,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))); @@ -3279,7 +3351,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 170d65a794d0..00288d04faac 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 const* 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 const* pThisView, const OString& rPayload); /// A special value to signify 'infinity'. diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index 2fcf7283399a..d0d68b3b48ae 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -227,8 +227,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 20515c86d2a6..281d04385aee 100644 --- a/include/vcl/IDialogRenderable.hxx +++ b/include/vcl/IDialogRenderable.hxx @@ -11,51 +11,31 @@ #ifndef INCLUDED_VCL_IDIALOGRENDERABLE_HXX #define INCLUDED_VCL_IDIALOGRENDERABLE_HXX +#include <vcl/dllapi.h> + #include <tools/gen.hxx> -#include <vcl/pointr.hxx> -#include <vcl/virdev.hxx> -#include <vcl/window.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 7b0720a429b7..016704bb09db 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -228,6 +228,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 4347917b7675..30fae84afa9a 100644 --- a/include/vcl/dialog.hxx +++ b/include/vcl/dialog.hxx @@ -78,20 +78,9 @@ public: virtual void LogicInvalidate(const tools::Rectangle* pRectangle) override; void InvalidateFloatingWindow(const Point& rPos); void CloseFloatingWindow(); - Size PaintActiveFloatingWindow(VirtualDevice& rDevice) const; /// 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 be9d88d48adc..b0ae9d319d49 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -34,6 +34,7 @@ #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> @@ -489,8 +490,6 @@ public: Color const * pPaintColor = nullptr); }; -typedef sal_uInt32 LOKWindowId; - class VCL_DLLPUBLIC Window : public ::OutputDevice { friend class ::vcl::Cursor; @@ -1203,11 +1202,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 67ee07440884..01fc9d9be960 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -363,6 +363,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 ca287c11b398..9144363f5f0c 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 404c34c49b72..d93ccdd89da9 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -265,6 +265,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 2699b62bb97f..8af06f170e54 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2669,6 +2669,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(mxForbiddenCharacters); diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index 18d2a395631d..fba79fdcc1b0 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -164,7 +164,7 @@ void SfxModalDialog::dispose() SfxViewShell* pViewShell = SfxViewShell::Current(); if (comphelper::LibreOfficeKit::isActive() && pViewShell) { - pViewShell->notifyDialog(GetLOKWindowId(), "close"); + pViewShell->notifyWindow(GetLOKWindowId(), "close"); pViewShell->UnregisterDlg(GetLOKWindowId()); } @@ -181,7 +181,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(); @@ -255,7 +255,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; @@ -393,7 +393,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 7b53bbc32ff3..10cacfb0eee2 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -406,7 +406,7 @@ void SfxTabDialog::dispose() SfxViewShell* pViewShell = SfxViewShell::Current(); if (comphelper::LibreOfficeKit::isActive() && pViewShell) { - pViewShell->notifyDialog(GetLOKWindowId(), "close"); + pViewShell->notifyWindow(GetLOKWindowId(), "close"); pViewShell->UnregisterDlg(GetLOKWindowId()); } @@ -526,7 +526,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 cfd9041ab421..f9543e9d0471 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -144,7 +144,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) { @@ -172,7 +172,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 778a9d9f68b7..c286992d168e 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1948,14 +1948,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 85c1d4a4ead6..288f32fa3df7 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -70,7 +70,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" @@ -132,7 +131,6 @@ class SW_DLLPUBLIC SwXTextDocument : public SwXTextDocumentBaseClass, public SvxFmMSFactory, public SfxBaseModel, public vcl::ITiledRenderable, - public vcl::IDialogRenderable, public css::tiledrendering::XTiledRenderable { private: @@ -431,17 +429,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 ) override; diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index fc7c7a6a2b59..cae647d2948b 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3639,123 +3639,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 699d6abd67f5..c1f3cc5324e7 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -331,7 +331,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 68232e872e5d..702575f53d65 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -883,75 +883,16 @@ void Dialog::paintDialog(VirtualDevice& rDevice) PaintToDevice(&rDevice, Point(0, 0), Size()); } -Size Dialog::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 = ::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 tools::Rectangle* pRectangle) @@ -965,59 +906,10 @@ void Dialog::LogicInvalidate(const tools::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 @@ -1339,7 +1231,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 OUString &rValue) diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index b00da3a18a77..f5d9927a2482 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -725,7 +725,7 @@ void FloatingWindow::StartPopupMode( const tools::Rectangle& rRect, FloatWinPopu { 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 ba61ea70a3b3..852dae458f35 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -64,6 +64,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> @@ -3177,6 +3178,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 |