diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2017-07-28 18:05:20 +0530 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-11-15 17:07:05 +0100 |
commit | 2cf317089657c36d0fd1050a54f80e650c64f8c0 (patch) | |
tree | 3a9df089db6e9fe5d035acd287ef36e5ac1a342e /sw/source/uibase | |
parent | cea322065785903d2342177816db698e62dec89b (diff) |
lokdialog: Better dialog rendering API
After painting the dialog, also write width and height of the rendered
dialog. The dialog is rendered
always on the top left of the given canvas, so client can crop the
canvas accordingly.
Change-Id: If052058a6db8a85d4e28ec88cffcca05564b17f0
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 1abd5c818edf..2c6f82bb1310 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -33,6 +33,8 @@ #include <sfx2/viewfrm.hxx> #include <sfx2/sfxbasecontroller.hxx> #include <sfx2/docfile.hxx> +#include <sfx2/msg.hxx> +#include <sfx2/msgpool.hxx> #include <sfx2/printer.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <toolkit/awt/vclxdevice.hxx> @@ -3708,32 +3710,35 @@ void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_I #endif } -vcl::DialogID SwXTextDocument::findDialog() +void SwXTextDocument::paintDialog(const vcl::DialogID& rDialogID, VirtualDevice& rDevice, int& nWidth, int& nHeight) { - return vcl::DialogID(0); -} - -void SwXTextDocument::paintDialog(vcl::DialogID /*rDialogID*/, VirtualDevice& rDevice, int nWidth, int nHeight) -{ - SfxViewShell* pViewShell = pDocShell->GetView(); - SfxViewFrame* pViewFrame = pViewShell->GetViewFrame(); - SfxChildWindow* pSfxChildWindow = SwSpellDialogChildWindow::CreateImpl(&pViewFrame->GetWindow(), SwSpellDialogChildWindow::GetChildWindowId(), - &pViewFrame->GetBindings(), nullptr); - - Size aSize(nWidth, nHeight); - - vcl::Window* pWindow = pSfxChildWindow->GetWindow(); + SfxViewFrame* pViewFrame = pDocShell->GetView()->GetViewFrame(); + SfxSlotPool* pSlotPool = SW_MOD()->GetSlotPool(); + const SfxSlot* pSlot = pSlotPool->GetUnoSlot(rDialogID); + 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; + } + } - pWindow->SetSizePixel(aSize); - pWindow->Show(); - pWindow->Paint(rDevice, tools::Rectangle(Point(), aSize)); + Dialog* pDlg = static_cast<Dialog*>(pChild->GetWindow()); + pDlg->paintDialog(rDevice); + const Size aSize = pDlg->GetOptimalSize(); + nWidth = aSize.getWidth(); + nHeight = aSize.getHeight(); } -void SwXTextDocument::postDialogMouseEvent(vcl::DialogID /*rDialogID*/, int /*nType*/, int /*nCharCode*/, int /*nKeyCode*/) +void SwXTextDocument::postDialogMouseEvent(const vcl::DialogID& /*rDialogID*/, int /*nType*/, int /*nCharCode*/, int /*nKeyCode*/) { } -void SwXTextDocument::postDialogKeyEvent(vcl::DialogID /*rDialogID*/, int /*nType*/, int /*nX*/, int /*nY*/, +void SwXTextDocument::postDialogKeyEvent(const vcl::DialogID& /*rDialogID*/, int /*nType*/, int /*nX*/, int /*nY*/, int /*nCount*/, int /*nButtons*/, int /*nModifier*/) { } |