summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-11-05 18:40:52 +0530
committerJan Holesovsky <kendy@collabora.com>2017-11-15 17:07:18 +0100
commit3bf083c40e8fcd543a7dbbb399cb3bd3f541edd8 (patch)
treec7146d0b67dc31a8d3b3cca7de818d73b5162725 /sw
parentf13dfb4c018080e94d8ed247984bf2f37e0653b8 (diff)
lokdialog: Move getting dialog information in separate LOK call
Using outparameters to get the dialog information with the paintDialog call was quite confusing. Change-Id: Ief331b251dc66e66084b827ce5b025ba6c9ce7d2 Reviewed-on: https://gerrit.libreoffice.org/44473 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: pranavk <pranavk@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/unotxdoc.hxx3
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx24
2 files changed, 21 insertions, 6 deletions
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index bb6dc4d6dbc5..00b2887e60c6 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -452,7 +452,8 @@ public:
/// @see vcl::ITiledRenderable::getPostIts().
OUString getPostIts() override;
- void paintDialog(const vcl::DialogID& rDialogID, VirtualDevice& rDevice, OUString& rDialogTitle, int& nWidth, int& nHeight) override;
+ void paintDialog(const vcl::DialogID& rDialogID, VirtualDevice& rDevice) override;
+ void getDialogInfo(const vcl::DialogID& rDialogID, OUString& rDialogTitle, int& rWidth, int& rHeight) override;
void paintActiveFloatingWindow(const vcl::DialogID& rDialogID, VirtualDevice& rDevice, int& nWidth, int& nHeight) override;
void postDialogKeyEvent(const vcl::DialogID& rDialogID, int nType,
int nCharCode, int nKeyCode) override;
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index ee9413b1231c..45e905646ed0 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3711,7 +3711,7 @@ void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_I
#endif
}
-void SwXTextDocument::paintDialog(const vcl::DialogID& rDialogID, VirtualDevice& rDevice, OUString& rDialogTitle, int& nWidth, int& nHeight)
+void SwXTextDocument::paintDialog(const vcl::DialogID& rDialogID, VirtualDevice& rDevice)
{
SfxViewFrame* pViewFrame = pDocShell->GetView()->GetViewFrame();
SfxSlotPool* pSlotPool = SW_MOD()->GetSlotPool();
@@ -3737,12 +3737,27 @@ void SwXTextDocument::paintDialog(const vcl::DialogID& rDialogID, VirtualDevice&
// register the instance so that vcl::Dialog can emit LOK callbacks
pDlg->registerDialogRenderable(this, rDialogID);
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)
+ {
+ SAL_WARN("lok.dialog", "No slot found for " << rDialogID);
+ return;
+ }
+ SfxChildWindow* pChild = pViewFrame->GetChildWindow(pSlot->GetSlotId());
+ if (!pChild)
+ return;
- // set outparams
+ Dialog* pDlg = static_cast<Dialog*>(pChild->GetWindow());
rDialogTitle = pDlg->GetText();
const Size aSize = pDlg->GetOptimalSize();
- nWidth = aSize.getWidth();
- nHeight = aSize.getHeight();
+ rWidth = aSize.getWidth();
+ rHeight = aSize.getHeight();
}
void SwXTextDocument::postDialogKeyEvent(const vcl::DialogID& rDialogID, int nType, int nCharCode, int nKeyCode)
@@ -3883,7 +3898,6 @@ void SwXTextDocument::paintActiveFloatingWindow(const vcl::DialogID& rDialogID,
return;
Dialog* pDlg = static_cast<Dialog*>(pChild->GetWindow());
- // register the instance so that vcl::Dialog can emit LOK callbacks
const Size aSize = pDlg->PaintActiveFloatingWindow(rDevice);
nWidth = aSize.getWidth();
nHeight = aSize.getHeight();