summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2018-02-01 12:17:45 +0100
committerJan Holesovsky <kendy@collabora.com>2018-02-22 12:17:20 +0100
commit0a25b404359ff28ef21603c47a8e0acdb9d8b3fb (patch)
treebcbf57b994f11ea79c9c9655cae0a7edfa7447e2
parent90440d7b06c48ea76c72f5fd7fdd8ba17d13891b (diff)
lok - calc: add support for show/hide tabs in online
Change-Id: Ibd061414a0c3a5fad83d03f7047831cef62076d2 Reviewed-on: https://gerrit.libreoffice.org/49978 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx3
-rw-r--r--desktop/source/lib/init.cxx22
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h3
-rw-r--r--include/vcl/ITiledRenderable.hxx9
-rw-r--r--sc/inc/docuno.hxx3
-rw-r--r--sc/source/ui/unoobj/docuno.cxx12
6 files changed, 51 insertions, 1 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 7524c34637d5..145bf0928067 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -2212,10 +2212,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, postExtTextInputEvent));
+ 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 6309802f6971..1bf6d00674a8 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -640,6 +640,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)
{
@@ -695,6 +697,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();
@@ -1903,6 +1907,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 2af965e4a45d..e58e690242c7 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -295,6 +295,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 b91a67fdc0a3..f6da97484bdc 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -259,6 +259,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 0b91ec3ddcfc..1d2ab0e1d966 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -373,6 +373,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 7df255a31ebd..f415a7b5cd4c 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -531,6 +531,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(bIsVisible);
+ aPartInfo += "\" }";
+ return aPartInfo;
+}
+
OUString ScModelObj::getPartName( int nPart )
{
OUString sTabName;