desktop/qa/desktop_lib/test_desktop_lib.cxx | 3 ++- desktop/source/lib/init.cxx | 22 ++++++++++++++++++++++ include/LibreOfficeKit/LibreOfficeKit.h | 3 +++ include/vcl/ITiledRenderable.hxx | 9 +++++++++ sc/inc/docuno.hxx | 3 +++ sc/source/ui/unoobj/docuno.cxx | 12 ++++++++++++ 6 files changed, 51 insertions(+), 1 deletion(-)
New commits: commit 2e396d37d96e1bc535da75cfc5f2afeac6b68d25 Author: Marco Cecchetti <marco.cecche...@collabora.com> Date: Thu Feb 1 12:17:45 2018 +0100 lok - calc: add support for show/hide tabs in online Change-Id: Ibd061414a0c3a5fad83d03f7047831cef62076d2 Reviewed-on: https://gerrit.libreoffice.org/49083 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Marco Cecchetti <mrcek...@gmail.com> (cherry picked from commit 8ffbb86b30e2c1674ba32e9e29447cbea3585d03) Reviewed-on: https://gerrit.libreoffice.org/53143 Tested-by: Marco Cecchetti <mrcek...@gmail.com> diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index fe2dfde9f54c..2c6046b94c64 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2297,10 +2297,11 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(38), offsetof(struct _LibreOfficeKitDocumentClass, postWindowMouseEvent)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(39), offsetof(struct _LibreOfficeKitDocumentClass, setViewLanguage)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(40), offsetof(struct _LibreOfficeKitDocumentClass, postWindowExtTextInputEvent)); + CPPUNIT_ASSERT_EQUAL(documentClassOffset(41), offsetof(struct _LibreOfficeKitDocumentClass, getPartInfo)); // Extending is fine, update this, and add new assert for the offsetof the // new method - CPPUNIT_ASSERT_EQUAL(documentClassOffset(41), sizeof(struct _LibreOfficeKitDocumentClass)); + CPPUNIT_ASSERT_EQUAL(documentClassOffset(42), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 47d4a0ad0ca8..862022863885 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -581,6 +581,8 @@ static void doc_paintWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId static void doc_postWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nAction); +static char* doc_getPartInfo(LibreOfficeKitDocument* pThis, int nPart); + LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent) : mxComponent(xComponent) { @@ -636,6 +638,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone m_pDocumentClass->setViewLanguage = doc_setViewLanguage; + m_pDocumentClass->getPartInfo = doc_getPartInfo; + gDocumentClass = m_pDocumentClass; } pClass = m_pDocumentClass.get(); @@ -1861,6 +1865,24 @@ static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart) pDoc->setPart( nPart ); } +static char* doc_getPartInfo(LibreOfficeKitDocument* pThis, int nPart) +{ + SolarMutexGuard aGuard; + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) + { + gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; + return nullptr; + } + + OUString aPartInfo = pDoc->getPartInfo( nPart ); + OString aString = OUStringToOString(aPartInfo, RTL_TEXTENCODING_UTF8); + + char* pMemory = static_cast<char*>(malloc(aString.getLength() + 1)); + strcpy(pMemory, aString.getStr()); + return pMemory; +} + static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis) { SolarMutexGuard aGuard; diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index d465d541b0e0..0799584d3097 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -306,6 +306,9 @@ struct _LibreOfficeKitDocumentClass int nType, const char* pText); + /// @see lok::Document::getPartInfo(). + char* (*getPartInfo) (LibreOfficeKitDocument* pThis, int nPart); + #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index 7221f19bac48..46ad7677e910 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -360,6 +360,15 @@ public: { return OUString(); } + + /* + * Used for sheets in spreadsheet documents. + */ + virtual OUString getPartInfo(int /*nPart*/) + { + return OUString(); + } + }; } // namespace vcl diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index 12889bfb2a97..61f75b65ba9b 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -306,6 +306,9 @@ public: /// @see vcl::ITiledRenderable::getParts(). virtual int getParts() override; + /// @see vcl::ITiledRenderable::getPartInfo(). + virtual OUString getPartInfo( int nPart ) override; + /// @see vcl::ITiledRenderable::getPartName(). virtual OUString getPartName(int nPart) override; diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 583665879932..e9382d8ab2ee 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -534,6 +534,18 @@ int ScModelObj::getPart() return pViewData->GetViewShell()->getPart(); } +OUString ScModelObj::getPartInfo( int nPart ) +{ + OUString aPartInfo; + ScViewData* pViewData = ScDocShell::GetViewData(); + bool bIsVisible = pViewData->GetDocument()->IsVisible(nPart); + + aPartInfo += "{ \"visible\": \""; + aPartInfo += OUString::number(static_cast<unsigned int>(bIsVisible)); + aPartInfo += "\" }"; + return aPartInfo; +} + OUString ScModelObj::getPartName( int nPart ) { OUString sTabName; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits