Kaydet (Commit) 8ffbb86b authored tarafından Marco Cecchetti's avatar Marco Cecchetti Kaydeden (comit) Marco Cecchetti

lok - calc: add support for show/hide tabs in online

Change-Id: Ibd061414a0c3a5fad83d03f7047831cef62076d2
Reviewed-on: https://gerrit.libreoffice.org/49083Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarco Cecchetti <mrcekets@gmail.com>
üst 866112db
......@@ -2298,10 +2298,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);
......
......@@ -579,6 +579,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)
{
......@@ -634,6 +636,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();
......@@ -1856,6 +1860,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;
......
......@@ -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
};
......
......@@ -360,6 +360,15 @@ public:
{
return OUString();
}
/*
* Used for sheets in spreadsheet documents.
*/
virtual OUString getPartInfo(int /*nPart*/)
{
return OUString();
}
};
} // namespace vcl
......
......@@ -313,6 +313,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;
......
......@@ -533,6 +533,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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment