diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-09-16 14:14:04 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-09-21 07:30:21 +0200 |
commit | a04b31c9facb08a8e38b79480b9a73bd2693cb9e (patch) | |
tree | ad4b216e799831834a12da24b642e6b2d39d491e /desktop | |
parent | f2e55ea10676d14c6564696a0648c0edbe4bd36d (diff) |
LOK: make getViews() be a member function of Document
Just to be consistent, as all other view-related member functions are
there, too.
No real impact, as only the unit test uses this so far, and it always
works with a single document.
Change-Id: I46f1ed8265ab95017986ab45c1b510e961192241
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 6 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 17 |
2 files changed, 12 insertions, 11 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 7ad81278d64a..0cd88cefffa0 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -134,10 +134,10 @@ void DesktopLOKTest::testGetFonts() void DesktopLOKTest::testCreateView() { LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); - CPPUNIT_ASSERT_EQUAL(1, SfxLokHelper::getViews()); + CPPUNIT_ASSERT_EQUAL(1, pDocument->m_pDocumentClass->getViews(pDocument)); int nId = pDocument->m_pDocumentClass->createView(pDocument); - CPPUNIT_ASSERT_EQUAL(2, SfxLokHelper::getViews()); + CPPUNIT_ASSERT_EQUAL(2, pDocument->m_pDocumentClass->getViews(pDocument)); // Make sure the created view is the active one, then switch to the old // one. @@ -146,7 +146,7 @@ void DesktopLOKTest::testCreateView() CPPUNIT_ASSERT_EQUAL(0, pDocument->m_pDocumentClass->getView(pDocument)); pDocument->m_pDocumentClass->destroyView(pDocument, nId); - CPPUNIT_ASSERT_EQUAL(1, SfxLokHelper::getViews()); + CPPUNIT_ASSERT_EQUAL(1, pDocument->m_pDocumentClass->getViews(pDocument)); closeDoc(); } diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 0548ea3329ef..c4301fd7695e 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -251,6 +251,7 @@ 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); +static int doc_getViews(LibreOfficeKitDocument* pThis); LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent) : mxComponent( xComponent ) @@ -286,6 +287,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone m_pDocumentClass->destroyView = doc_destroyView; m_pDocumentClass->setView = doc_setView; m_pDocumentClass->getView = doc_getView; + m_pDocumentClass->getViews = doc_getViews; gDocumentClass = m_pDocumentClass; } @@ -313,8 +315,6 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions (LibreOfficeKit* pThi static void lo_registerCallback (LibreOfficeKit* pThis, LibreOfficeKitCallback pCallback, void* pData); -static int lo_getViews(LibreOfficeKit* pThis); - struct LibLibreOffice_Impl : public _LibreOfficeKit { OUString maLastExceptionMsg; @@ -337,7 +337,6 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit m_pOfficeClass->getError = lo_getError; m_pOfficeClass->documentLoadWithOptions = lo_documentLoadWithOptions; m_pOfficeClass->registerCallback = lo_registerCallback; - m_pOfficeClass->getViews = lo_getViews; gOfficeClass = m_pOfficeClass; } @@ -455,11 +454,6 @@ static void lo_registerCallback (LibreOfficeKit* pThis, pLib->mpCallbackData = pData; } -static int lo_getViews(LibreOfficeKit* /*pThis*/) -{ - return SfxLokHelper::getViews(); -} - static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const char* pFormat, const char* pFilterOptions) { LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis); @@ -1074,6 +1068,13 @@ static int doc_getView(LibreOfficeKitDocument* /*pThis*/) return SfxLokHelper::getView(); } +static int doc_getViews(LibreOfficeKitDocument* /*pThis*/) +{ + SolarMutexGuard aGuard; + + return SfxLokHelper::getViews(); +} + static char* lo_getError (LibreOfficeKit *pThis) { LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis); |