summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-09-16 12:38:31 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-09-16 14:49:30 +0200
commitc485dfc8c38972e0538ec4dde0a457b7fa050d05 (patch)
tree28797a80ececf0fbc174e317a5bd98bd9eced450 /desktop
parenta03179ce1b9365eedeb782a4d5766f620ccadd6e (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 (cherry picked from commit dcc92a7cb5aa1faa711c8da7f7d8ecee0a192c25)
Diffstat (limited to 'desktop')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx6
-rw-r--r--desktop/source/lib/init.cxx8
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 b5da41b68f9e..0a2d8234f961 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -315,6 +315,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 7b61e66ea0ae..9f3ed4020264 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -439,6 +439,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,
@@ -486,6 +487,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;
@@ -2315,6 +2317,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,