summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-10-21 19:29:38 -0400
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-25 19:25:01 +0200
commitca8f1ff34e291b74068dace619e58c37ef169f88 (patch)
tree3746aeb309ebc75f38d017d5f01a2d21e7b88368 /desktop
parent987c03d5c237c6a86ac886991435220e7381ced1 (diff)
LOK: support resizing windows
And delegate resizing of floating windows. Currently used for resizing sidebars in LOK. Change-Id: Iadc1b71c15a7d16a8c9dd7246490ae6bd645644c Reviewed-on: https://gerrit.libreoffice.org/73509 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx3
-rw-r--r--desktop/source/lib/init.cxx21
2 files changed, 23 insertions, 1 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index e590b0a7f974..f10e1fb0f035 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -2717,9 +2717,10 @@ void DesktopLOKTest::testABI()
CPPUNIT_ASSERT_EQUAL(documentClassOffset(48), offsetof(struct _LibreOfficeKitDocumentClass, createViewWithOptions));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(49), offsetof(struct _LibreOfficeKitDocumentClass, selectPart));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(50), offsetof(struct _LibreOfficeKitDocumentClass, moveSelectedParts));
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(51), offsetof(struct _LibreOfficeKitDocumentClass, resizeWindow));
// Extending is fine, update this, and add new assert for the offsetof the
// new method
- CPPUNIT_ASSERT_EQUAL(documentClassOffset(51), sizeof(struct _LibreOfficeKitDocumentClass));
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(52), sizeof(struct _LibreOfficeKitDocumentClass));
}
CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 42972ce713b5..3f00cd57020f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -846,6 +846,9 @@ static int doc_getSignatureState(LibreOfficeKitDocument* pThis);
static size_t doc_renderShapeSelection(LibreOfficeKitDocument* pThis, char** pOutput);
+static void doc_resizeWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId,
+ const int nWidth, const int nHeight);
+
LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent)
: mxComponent(xComponent)
{
@@ -904,6 +907,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
m_pDocumentClass->paintWindow = doc_paintWindow;
m_pDocumentClass->paintWindowDPI = doc_paintWindowDPI;
m_pDocumentClass->postWindow = doc_postWindow;
+ m_pDocumentClass->resizeWindow = doc_resizeWindow;
m_pDocumentClass->setViewLanguage = doc_setViewLanguage;
@@ -4604,6 +4608,23 @@ static int doc_getSignatureState(LibreOfficeKitDocument* pThis)
return int(pObjectShell->GetDocumentSignatureState());
}
+static void doc_resizeWindow(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId,
+ const int nWidth, const int nHeight)
+{
+ SolarMutexGuard aGuard;
+ if (gImpl)
+ gImpl->maLastExceptionMsg.clear();
+
+ VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId);
+ if (!pWindow)
+ {
+ gImpl->maLastExceptionMsg = "Document doesn't support dialog resizing, or window not found.";
+ return;
+ }
+
+ pWindow->SetSizePixel(Size(nWidth, nHeight));
+}
+
static char* lo_getError (LibreOfficeKit *pThis)
{
comphelper::ProfileZone aZone("lo_getError");