diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-16 12:38:31 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-16 14:48:23 +0200 |
commit | dcc92a7cb5aa1faa711c8da7f7d8ecee0a192c25 (patch) | |
tree | f6ed2e55dd7dad168af83e266dc53acbe2926af9 /desktop | |
parent | 9035f00ede7925eb699864d17baf7c897a8c7e53 (diff) |
sfx2: add SfxLokHelper::getViewIds
and also expose it in the LOK API. This way clients don't have to keep
track of what views they created / destroyed, they can also get an up to
date list with this method.
Change-Id: Ibaee42c545803e04a31e7c13ab6ec370b99465c4
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 6 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 8 |
2 files changed, 14 insertions, 0 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 8f3807ee79d5..a7e24fcd7255 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -316,6 +316,12 @@ void DesktopLOKTest::testCreateView() int nId1 = pDocument->m_pDocumentClass->createView(pDocument); CPPUNIT_ASSERT_EQUAL(2, pDocument->m_pDocumentClass->getViewsCount(pDocument)); + // Test getViewIds(). + std::vector<int> aViewIds(2); + CPPUNIT_ASSERT(pDocument->m_pDocumentClass->getViewIds(pDocument, aViewIds.data(), aViewIds.size())); + CPPUNIT_ASSERT_EQUAL(nId0, aViewIds[0]); + CPPUNIT_ASSERT_EQUAL(nId1, aViewIds[1]); + // Make sure the created view is the active one, then switch to the old // one. CPPUNIT_ASSERT_EQUAL(nId1, pDocument->m_pDocumentClass->getView(pDocument)); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 967d73073e07..39e6c6599690 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -438,6 +438,7 @@ static void doc_destroyView(LibreOfficeKitDocument* pThis, int nId); static void doc_setView(LibreOfficeKitDocument* pThis, int nId); static int doc_getView(LibreOfficeKitDocument* pThis); static int doc_getViewsCount(LibreOfficeKitDocument* pThis); +static bool doc_getViewIds(LibreOfficeKitDocument* pThis, int* pArray, size_t nSize); static unsigned char* doc_renderFont(LibreOfficeKitDocument* pThis, const char *pFontName, int* pFontWidth, @@ -485,6 +486,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone m_pDocumentClass->setView = doc_setView; m_pDocumentClass->getView = doc_getView; m_pDocumentClass->getViewsCount = doc_getViewsCount; + m_pDocumentClass->getViewIds = doc_getViewIds; m_pDocumentClass->renderFont = doc_renderFont; m_pDocumentClass->getPartHash = doc_getPartHash; @@ -2313,6 +2315,12 @@ static int doc_getViewsCount(LibreOfficeKitDocument* /*pThis*/) return SfxLokHelper::getViewsCount(); } +static bool doc_getViewIds(LibreOfficeKitDocument* /*pThis*/, int* pArray, size_t nSize) +{ + SolarMutexGuard aGuard; + return SfxLokHelper::getViewIds(pArray, nSize); +} + unsigned char* doc_renderFont(LibreOfficeKitDocument* /*pThis*/, const char* pFontName, int* pFontWidth, |