From 10a0cad9d6990abac507899a34fbcdeb466187f7 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 15 Sep 2015 09:31:49 +0200 Subject: lok::Document: add destroyView() Change-Id: Id9e92593217541b4123e95279019cec3c958056c --- desktop/qa/desktop_lib/test_desktop_lib.cxx | 5 ++++- desktop/source/lib/init.cxx | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'desktop') diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 8642f4491f9f..6baaa32239c9 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -136,8 +136,11 @@ void DesktopLOKTest::testCreateView() LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); CPPUNIT_ASSERT_EQUAL(1, SfxLokHelper::getViews()); - pDocument->m_pDocumentClass->createView(pDocument); + int nId = pDocument->m_pDocumentClass->createView(pDocument); CPPUNIT_ASSERT_EQUAL(2, SfxLokHelper::getViews()); + + pDocument->m_pDocumentClass->destroyView(pDocument, nId); + CPPUNIT_ASSERT_EQUAL(1, SfxLokHelper::getViews()); closeDoc(); } diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 95213017726f..15ab2e7ffa50 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -248,6 +248,7 @@ static void doc_resetSelection (LibreOfficeKitDocument* pThis); static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCommand); static int doc_createView(LibreOfficeKitDocument* pThis); +static void doc_destroyView(LibreOfficeKitDocument* pThis, int nId); LibLODocument_Impl::LibLODocument_Impl(const uno::Reference &xComponent) : mxComponent( xComponent ) @@ -280,6 +281,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference getCommandValues = doc_getCommandValues; m_pDocumentClass->createView = doc_createView; + m_pDocumentClass->destroyView = doc_destroyView; gDocumentClass = m_pDocumentClass; } @@ -1055,6 +1057,13 @@ static int doc_createView(LibreOfficeKitDocument* pThis) return SfxLokHelper::createView(pViewShell); } +static void doc_destroyView(LibreOfficeKitDocument* /*pThis*/, int nId) +{ + SolarMutexGuard aGuard; + + SfxLokHelper::destroyView(nId); +} + static char* lo_getError (LibreOfficeKit *pThis) { LibLibreOffice_Impl* pLib = static_cast(pThis); -- cgit