summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-09-15 09:31:49 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-10-06 16:19:06 +0200
commit65070716e06fd05765b8da53073d1325dfd9f886 (patch)
tree0ffa2727be650932d5313aa61aa24e8f862519c2 /desktop
parent77c645fb3ac929a76ed0388b544c0d3edb00f2b4 (diff)
lok::Document: add destroyView()
Change-Id: Id9e92593217541b4123e95279019cec3c958056c (cherry picked from commit 10a0cad9d6990abac507899a34fbcdeb466187f7)
Diffstat (limited to 'desktop')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx5
-rw-r--r--desktop/source/lib/init.cxx9
2 files changed, 13 insertions, 1 deletions
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 f7132e9d3c27..75fbafaf69fc 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -251,6 +251,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 <css::lang::XComponent> &xComponent) :
mxComponent( xComponent )
@@ -283,6 +284,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
m_pDocumentClass->getCommandValues = doc_getCommandValues;
m_pDocumentClass->createView = doc_createView;
+ m_pDocumentClass->destroyView = doc_destroyView;
gDocumentClass = m_pDocumentClass;
}
@@ -1058,6 +1060,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<LibLibreOffice_Impl*>(pThis);