diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-09-16 09:30:41 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-09-21 07:30:20 +0200 |
commit | 46588c42a546d4517b773853856b9c8f8c2e5ece (patch) | |
tree | ee35d297a358b2f28a388003e48920d7929535b9 /desktop | |
parent | 855e1bac1d5155352706c7d849942f5dc453c67d (diff) |
lok::Document: add get/setView()
Change-Id: Ic3bce8f01d7e048e853c063c4bce1255845c60d0
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 6 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 18 |
2 files changed, 24 insertions, 0 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 6baaa32239c9..7ad81278d64a 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -139,6 +139,12 @@ void DesktopLOKTest::testCreateView() int nId = pDocument->m_pDocumentClass->createView(pDocument); CPPUNIT_ASSERT_EQUAL(2, SfxLokHelper::getViews()); + // Make sure the created view is the active one, then switch to the old + // one. + CPPUNIT_ASSERT_EQUAL(1, pDocument->m_pDocumentClass->getView(pDocument)); + pDocument->m_pDocumentClass->setView(pDocument, 0); + CPPUNIT_ASSERT_EQUAL(0, pDocument->m_pDocumentClass->getView(pDocument)); + 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 15ab2e7ffa50..fd332975f2e7 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -249,6 +249,8 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo static int doc_createView(LibreOfficeKitDocument* pThis); static void doc_destroyView(LibreOfficeKitDocument* pThis, int nId); +static void doc_setView(LibreOfficeKitDocument* pThis, int nId); +static int doc_getView(LibreOfficeKitDocument* pThis); LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent) : mxComponent( xComponent ) @@ -282,6 +284,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone m_pDocumentClass->createView = doc_createView; m_pDocumentClass->destroyView = doc_destroyView; + m_pDocumentClass->setView = doc_setView; + m_pDocumentClass->getView = doc_getView; gDocumentClass = m_pDocumentClass; } @@ -1064,6 +1068,20 @@ static void doc_destroyView(LibreOfficeKitDocument* /*pThis*/, int nId) SfxLokHelper::destroyView(nId); } +static void doc_setView(LibreOfficeKitDocument* /*pThis*/, int nId) +{ + SolarMutexGuard aGuard; + + SfxLokHelper::setView(nId); +} + +static int doc_getView(LibreOfficeKitDocument* /*pThis*/) +{ + SolarMutexGuard aGuard; + + return SfxLokHelper::getView(); +} + static char* lo_getError (LibreOfficeKit *pThis) { LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis); |