diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2017-11-22 22:25:20 +0530 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-11-28 17:50:49 +0100 |
commit | 667d7003c2525f79b21cbf2a870f03168634e232 (patch) | |
tree | 287e85e1b2e6b52775fa135a5aea37390cefd049 /sw | |
parent | d7a6ca1778784379e3fa5474a40734fd6c6026c6 (diff) |
lokdialog: Changed dialog painting to allow for modal dialogs
Split IDialogNotifier from IDialogRenderable and make SfxViewShell
implement it.
We now just send the dialog UNO command to the backend and wait for core
to emit a 'created' dialog callback which signals dialog creation in the
backend. The client is then supposed to send the paint commands for
rendering the dialog.
Change-Id: I1bfbce83c17955fa0212408376d6bcd1b2d2d1dd
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/unotxdoc.hxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 127 |
2 files changed, 26 insertions, 107 deletions
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 90b5cb315a05..5e9c13fa17d4 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -464,12 +464,6 @@ public: void postDialogChildMouseEvent(const vcl::DialogID& rDialogID, int nType, int nX, int nY, int nCount, int nButtons, int nModifier) override; - void notifyDialog(const vcl::DialogID& rDialogID, - const OUString& rAction, - const std::vector<vcl::LOKPayloadItem>& rPayload = std::vector<vcl::LOKPayloadItem>()) override; - - void notifyDialogChild(const vcl::DialogID& rDialogID, const OUString& rAction, const Point& rPos) 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 33a9aeda0a0b..51fd19fba506 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3713,70 +3713,33 @@ void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_I void SwXTextDocument::paintDialog(const vcl::DialogID& rDialogID, VirtualDevice& rDevice) { - SfxViewFrame* pViewFrame = pDocShell->GetView()->GetViewFrame(); - SfxSlotPool* pSlotPool = SW_MOD()->GetSlotPool(); - const SfxSlot* pSlot = pSlotPool->GetUnoSlot(rDialogID); - if (!pSlot) - { - SAL_WARN("lok.dialog", "No slot found for " << rDialogID); - return; - } - SfxChildWindow* pChild = pViewFrame->GetChildWindow(pSlot->GetSlotId()); - if (!pChild) - { - pViewFrame->ToggleChildWindow(pSlot->GetSlotId()); - pChild = pViewFrame->GetChildWindow(pSlot->GetSlotId()); - if (!pChild) - { - SAL_WARN("lok.dialog", "Dialog " << rDialogID << " is not supported"); - return; - } - } - - Dialog* pDlg = static_cast<Dialog*>(pChild->GetWindow()); - // register the instance so that vcl::Dialog can emit LOK callbacks - pDlg->registerDialogRenderable(this, rDialogID); - pDlg->paintDialog(rDevice); + SfxViewShell* pViewShell = SfxViewShell::Current(); + VclPtr<Dialog> pDlg = pViewShell->GetOpenedDlg(rDialogID); + if (pDlg) + pDlg->paintDialog(rDevice); } void SwXTextDocument::getDialogInfo(const vcl::DialogID& rDialogID, OUString& rDialogTitle, int& rWidth, int& rHeight) { - SfxViewFrame* pViewFrame = pDocShell->GetView()->GetViewFrame(); - SfxSlotPool* pSlotPool = SW_MOD()->GetSlotPool(); - const SfxSlot* pSlot = pSlotPool->GetUnoSlot(rDialogID); - if (!pSlot) + SfxViewShell* pViewShell = SfxViewShell::Current(); + VclPtr<Dialog> pDlg = pViewShell->GetOpenedDlg(rDialogID); + if (pDlg) { - SAL_WARN("lok.dialog", "No slot found for " << rDialogID); - return; + rDialogTitle = pDlg->GetText(); + const Size aSize = pDlg->GetOptimalSize(); + rWidth = aSize.getWidth(); + rHeight = aSize.getHeight(); } - SfxChildWindow* pChild = pViewFrame->GetChildWindow(pSlot->GetSlotId()); - if (!pChild) - return; - - Dialog* pDlg = static_cast<Dialog*>(pChild->GetWindow()); - rDialogTitle = pDlg->GetText(); - const Size aSize = pDlg->GetOptimalSize(); - rWidth = aSize.getWidth(); - rHeight = aSize.getHeight(); } void SwXTextDocument::postDialogKeyEvent(const vcl::DialogID& rDialogID, int nType, int nCharCode, int nKeyCode) { SolarMutexGuard aGuard; - // check if dialog is already open - SfxViewFrame* pViewFrame = pDocShell->GetView()->GetViewFrame(); - SfxSlotPool* pSlotPool = SW_MOD()->GetSlotPool(); - const SfxSlot* pSlot = pSlotPool->GetUnoSlot(rDialogID); - if (!pSlot) - { - SAL_WARN("lok.dialog", "No slot found for " << rDialogID); - return; - } - SfxChildWindow* pChild = pViewFrame->GetChildWindow(pSlot->GetSlotId()); - if (pChild) + SfxViewShell* pViewShell = SfxViewShell::Current(); + VclPtr<Dialog> pDialog = pViewShell->GetOpenedDlg(rDialogID); + if (pDialog) { - Dialog* pDialog = static_cast<Dialog*>(pChild->GetWindow()); KeyEvent aEvent(nCharCode, nKeyCode, 0); switch (nType) @@ -3799,19 +3762,10 @@ void SwXTextDocument::postDialogMouseEvent(const vcl::DialogID& rDialogID, int n { SolarMutexGuard aGuard; - // check if dialog is already open - SfxViewFrame* pViewFrame = pDocShell->GetView()->GetViewFrame(); - SfxSlotPool* pSlotPool = SW_MOD()->GetSlotPool(); - const SfxSlot* pSlot = pSlotPool->GetUnoSlot(rDialogID); - if (!pSlot) + SfxViewShell* pViewShell = SfxViewShell::Current(); + VclPtr<Dialog> pDialog = pViewShell->GetOpenedDlg(rDialogID); + if (pDialog) { - SAL_WARN("lok.dialog", "No slot found for " << rDialogID); - return; - } - SfxChildWindow* pChild = pViewFrame->GetChildWindow(pSlot->GetSlotId()); - if (pChild) - { - Dialog* pDialog = static_cast<Dialog*>(pChild->GetWindow()); Point aPos(nX , nY); MouseEvent aEvent(aPos, nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier); @@ -3839,19 +3793,10 @@ void SwXTextDocument::postDialogChildMouseEvent(const vcl::DialogID& rDialogID, { SolarMutexGuard aGuard; - // check if dialog is already open - SfxViewFrame* pViewFrame = pDocShell->GetView()->GetViewFrame(); - SfxSlotPool* pSlotPool = SW_MOD()->GetSlotPool(); - const SfxSlot* pSlot = pSlotPool->GetUnoSlot(rDialogID); - if (!pSlot) - { - SAL_WARN("lok.dialog", "No slot found for " << rDialogID); - return; - } - SfxChildWindow* pChild = pViewFrame->GetChildWindow(pSlot->GetSlotId()); - if (pChild) + SfxViewShell* pViewShell = SfxViewShell::Current(); + VclPtr<Dialog> pDialog = pViewShell->GetOpenedDlg(rDialogID); + if (pDialog) { - Dialog* pDialog = static_cast<Dialog*>(pChild->GetWindow()); Point aPos(nX , nY); MouseEvent aEvent(aPos, nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier); @@ -3873,36 +3818,16 @@ void SwXTextDocument::postDialogChildMouseEvent(const vcl::DialogID& rDialogID, } } -void SwXTextDocument::notifyDialog(const vcl::DialogID& rDialogID, - const OUString& rAction, - const std::vector<vcl::LOKPayloadItem>& rPayload) -{ - SfxLokHelper::notifyDialog(rDialogID, rAction, rPayload); -} - -void SwXTextDocument::notifyDialogChild(const vcl::DialogID& rDialogID, const OUString& rAction, const Point& rPos) -{ - SfxLokHelper::notifyDialogChild(rDialogID, rAction, rPos); -} - void SwXTextDocument::paintActiveFloatingWindow(const vcl::DialogID& rDialogID, VirtualDevice& rDevice, int& nWidth, int& nHeight) { - SfxViewFrame* pViewFrame = pDocShell->GetView()->GetViewFrame(); - SfxSlotPool* pSlotPool = SW_MOD()->GetSlotPool(); - const SfxSlot* pSlot = pSlotPool->GetUnoSlot(rDialogID); - if (!pSlot) + SfxViewShell* pViewShell = SfxViewShell::Current(); + VclPtr<Dialog> pDialog = pViewShell->GetOpenedDlg(rDialogID); + if (pDialog) { - SAL_WARN("lok.dialog", "No slot found for " << rDialogID); - return; + const Size aSize = pDialog->PaintActiveFloatingWindow(rDevice); + nWidth = aSize.getWidth(); + nHeight = aSize.getHeight(); } - SfxChildWindow* pChild = pViewFrame->GetChildWindow(pSlot->GetSlotId()); - if (!pChild) - return; - - Dialog* pDlg = static_cast<Dialog*>(pChild->GetWindow()); - const Size aSize = pDlg->PaintActiveFloatingWindow(rDevice); - nWidth = aSize.getWidth(); - nHeight = aSize.getHeight(); } void * SAL_CALL SwXTextDocument::operator new( size_t t) throw() |