From dc00592b4e48a111efc6ff78bdbf7af998e58e22 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 16 Sep 2016 10:15:31 +0200 Subject: lok::Document: rename getViews() to getViewsCount() As this only returns the number of views, not the actual views. Since it's a rename, it's just an API (but not an ABI) change. Change-Id: Ib4f0ea56a90e5ae9c80ee1781aa2f29aff4259e7 --- desktop/qa/desktop_lib/test_desktop_lib.cxx | 6 +++--- desktop/source/lib/init.cxx | 8 ++++---- include/LibreOfficeKit/LibreOfficeKit.h | 4 ++-- include/LibreOfficeKit/LibreOfficeKit.hxx | 12 ++++++------ include/sfx2/lokhelper.hxx | 2 +- libreofficekit/source/gtk/lokdocview.cxx | 2 +- sfx2/source/view/lokhelper.cxx | 4 ++-- sw/qa/extras/tiledrendering/tiledrendering.cxx | 2 +- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 28d78bc09a90..8f3807ee79d5 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -310,11 +310,11 @@ void DesktopLOKTest::testGetFonts() void DesktopLOKTest::testCreateView() { LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); - CPPUNIT_ASSERT_EQUAL(1, pDocument->m_pDocumentClass->getViews(pDocument)); + CPPUNIT_ASSERT_EQUAL(1, pDocument->m_pDocumentClass->getViewsCount(pDocument)); int nId0 = pDocument->m_pDocumentClass->getView(pDocument); int nId1 = pDocument->m_pDocumentClass->createView(pDocument); - CPPUNIT_ASSERT_EQUAL(2, pDocument->m_pDocumentClass->getViews(pDocument)); + CPPUNIT_ASSERT_EQUAL(2, pDocument->m_pDocumentClass->getViewsCount(pDocument)); // Make sure the created view is the active one, then switch to the old // one. @@ -323,7 +323,7 @@ void DesktopLOKTest::testCreateView() CPPUNIT_ASSERT_EQUAL(nId0, pDocument->m_pDocumentClass->getView(pDocument)); pDocument->m_pDocumentClass->destroyView(pDocument, nId1); - CPPUNIT_ASSERT_EQUAL(1, pDocument->m_pDocumentClass->getViews(pDocument)); + CPPUNIT_ASSERT_EQUAL(1, pDocument->m_pDocumentClass->getViewsCount(pDocument)); } void DesktopLOKTest::testGetPartPageRectangles() diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index affc0197799d..967d73073e07 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -437,7 +437,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); +static int doc_getViewsCount(LibreOfficeKitDocument* pThis); static unsigned char* doc_renderFont(LibreOfficeKitDocument* pThis, const char *pFontName, int* pFontWidth, @@ -484,7 +484,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference destroyView = doc_destroyView; m_pDocumentClass->setView = doc_setView; m_pDocumentClass->getView = doc_getView; - m_pDocumentClass->getViews = doc_getViews; + m_pDocumentClass->getViewsCount = doc_getViewsCount; m_pDocumentClass->renderFont = doc_renderFont; m_pDocumentClass->getPartHash = doc_getPartHash; @@ -2306,11 +2306,11 @@ static int doc_getView(LibreOfficeKitDocument* /*pThis*/) return SfxLokHelper::getView(); } -static int doc_getViews(LibreOfficeKitDocument* /*pThis*/) +static int doc_getViewsCount(LibreOfficeKitDocument* /*pThis*/) { SolarMutexGuard aGuard; - return SfxLokHelper::getViews(); + return SfxLokHelper::getViewsCount(); } unsigned char* doc_renderFont(LibreOfficeKitDocument* /*pThis*/, diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 81d65c1ace38..a0ed81947280 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -219,8 +219,8 @@ struct _LibreOfficeKitDocumentClass void (*setView) (LibreOfficeKitDocument* pThis, int nId); /// @see lok::Document::getView(). int (*getView) (LibreOfficeKitDocument* pThis); - /// @see lok::Document::getViews(). - int (*getViews) (LibreOfficeKitDocument* pThis); + /// @see lok::Document::getViewsCount(). + int (*getViewsCount) (LibreOfficeKitDocument* pThis); /// @see lok::Document::renderFont(). unsigned char* (*renderFont) (LibreOfficeKitDocument* pThis, diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index eae43af27178..cd3488505673 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -363,7 +363,7 @@ public: * By default a loaded document has 1 view. * @return the ID of the new view. */ - uintptr_t createView() + int createView() { return mpDoc->pClass->createView(mpDoc); } @@ -372,7 +372,7 @@ public: * Destroy a view of an existing document. * @param nId a view ID, returned by createView(). */ - void destroyView(uintptr_t nId) + void destroyView(int nId) { mpDoc->pClass->destroyView(mpDoc, nId); } @@ -381,7 +381,7 @@ public: * Set an existing view of an existing document as current. * @param nId a view ID, returned by createView(). */ - void setView(uintptr_t nId) + void setView(int nId) { mpDoc->pClass->setView(mpDoc, nId); } @@ -390,7 +390,7 @@ public: * Get the current view. * @return a view ID, previously returned by createView(). */ - uintptr_t getView() + int getView() { return mpDoc->pClass->getView(mpDoc); } @@ -398,9 +398,9 @@ public: /** * Get number of views of this document. */ - inline int getViews() + inline int getViewsCount() { - return mpDoc->pClass->getViews(mpDoc); + return mpDoc->pClass->getViewsCount(mpDoc); } /** diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx index 852aa79af058..7460377fd3ba 100644 --- a/include/sfx2/lokhelper.hxx +++ b/include/sfx2/lokhelper.hxx @@ -28,7 +28,7 @@ public: /// Get the currently active view. static int getView(SfxViewShell* pViewShell = nullptr); /// Get the number of views of the current object shell. - static std::size_t getViews(); + static std::size_t getViewsCount(); /// Invoke the LOK callback of all views except pThisView, with a payload of rKey-rPayload. static void notifyOtherViews(SfxViewShell* pThisView, int nType, const OString& rKey, const OString& rPayload); diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index e2ea5ca2133f..195335c6a531 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -2532,7 +2532,7 @@ static void lok_doc_view_finalize (GObject* object) priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, nullptr, nullptr); aGuard.unlock(); - if (priv->m_pDocument && priv->m_pDocument->pClass->getViews(priv->m_pDocument) > 1) + if (priv->m_pDocument && priv->m_pDocument->pClass->getViewsCount(priv->m_pDocument) > 1) { priv->m_pDocument->pClass->destroyView(priv->m_pDocument, priv->m_nViewId); } diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 36203ceafd0a..5769127c299d 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -88,7 +88,7 @@ int SfxLokHelper::getView(SfxViewShell* pViewShell) return pViewShell->GetViewShellId(); } -std::size_t SfxLokHelper::getViews() +std::size_t SfxLokHelper::getViewsCount() { SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl(); return rViewArr.size(); @@ -109,7 +109,7 @@ void SfxLokHelper::notifyOtherView(SfxViewShell* pThisView, SfxViewShell* pOther void SfxLokHelper::notifyOtherViews(SfxViewShell* pThisView, int nType, const OString& rKey, const OString& rPayload) { - if (SfxLokHelper::getViews() <= 1) + if (SfxLokHelper::getViewsCount() <= 1) return; SfxViewShell* pViewShell = SfxViewShell::GetFirst(); diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index d5bcf1da6ce8..69f965c2d8dc 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -897,7 +897,7 @@ void SwTiledRenderingTest::testViewCursorCleanup() // Now destroy the second view. SfxLokHelper::destroyView(nView2); Scheduler::ProcessEventsToIdle(); - CPPUNIT_ASSERT_EQUAL(static_cast(1), SfxLokHelper::getViews()); + CPPUNIT_ASSERT_EQUAL(static_cast(1), SfxLokHelper::getViewsCount()); // Make sure that the graphic view selection on the first view is cleaned up. CPPUNIT_ASSERT(!aView1.m_bGraphicViewSelection); mxComponent->dispose(); -- cgit