summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2016-04-20 13:52:31 -0400
committerHenry Castro <hcastro@collabora.com>2016-04-23 11:33:23 -0400
commit756e208be95b455d3d817610d931a742d1b04389 (patch)
tree67436ea151fa579b61d18d41cc23111daf26fa72 /sc
parentbb52a54aa49cbb75820f8ddbfc8e9e94b63281cd (diff)
lokit: add getPartHash
In the tiled rendering case, the slides, no matter if it is inserted or deleted, the part names always return sequential names i.e. Slide 1, Slide 2, ..., Slide N. However the client side needs to know what slides had been deleted or inserted, so it is necessary to send the hash codes. Change-Id: I0e9caeec660c3e42dd9f751bdce7690f9ad365a1 Reviewed-on: https://gerrit.libreoffice.org/24267 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/document.hxx1
-rw-r--r--sc/inc/docuno.hxx3
-rw-r--r--sc/inc/table.hxx2
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx18
-rw-r--r--sc/source/core/data/document.cxx13
-rw-r--r--sc/source/core/data/table1.cxx5
-rw-r--r--sc/source/ui/unoobj/docuno.cxx7
7 files changed, 49 insertions, 0 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 69e6f5bd9586..272d2eb1b3a0 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -596,6 +596,7 @@ public:
SC_DLLPUBLIC void SetVisibleTab(SCTAB nTab) { nVisibleTab = nTab; }
SC_DLLPUBLIC bool HasTable( SCTAB nTab ) const;
+ SC_DLLPUBLIC bool GetHashCode( SCTAB nTab, sal_Int64& rHashCode) const;
SC_DLLPUBLIC bool GetName( SCTAB nTab, OUString& rName ) const;
SC_DLLPUBLIC bool GetCodeName( SCTAB nTab, OUString& rName ) const;
SC_DLLPUBLIC bool SetCodeName( SCTAB nTab, const OUString& rName );
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 09fd69c670c0..6eb32920307c 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -392,6 +392,9 @@ public:
/// @see vcl::ITiledRenderable::getPartName().
virtual OUString getPartName(int nPart) SAL_OVERRIDE;
+ /// @see vcl::ITiledRenderable::getPartHash().
+ virtual OUString getPartHash( int nPart ) SAL_OVERRIDE;
+
/// @see vcl::ITiledRenderable::initializeForTiledRendering().
virtual void initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments) SAL_OVERRIDE;
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 7454188f04a7..a912bea5db71 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -292,6 +292,8 @@ public:
void SetLink( sal_uInt8 nMode, const OUString& rDoc, const OUString& rFlt,
const OUString& rOpt, const OUString& rTab, sal_uLong nRefreshDelay );
+ sal_Int64 GetHashCode () const;
+
void GetName( OUString& rName ) const;
void SetName( const OUString& rNewName );
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 52d6af174c24..4f33ffb67ce0 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -54,12 +54,14 @@ public:
#if !defined(WNT) && !defined(MACOSX)
void testRowColumnSelections();
void testSortAscendingDescending();
+ void testPartHash();
#endif
CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
#if !defined(WNT) && !defined(MACOSX)
CPPUNIT_TEST(testRowColumnSelections);
CPPUNIT_TEST(testSortAscendingDescending);
+ CPPUNIT_TEST(testPartHash);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -257,6 +259,22 @@ void ScTiledRenderingTest::testSortAscendingDescending()
comphelper::LibreOfficeKit::setActive(false);
}
+void ScTiledRenderingTest::testPartHash()
+{
+ comphelper::LibreOfficeKit::setActive();
+ ScModelObj* pModelObj = createDoc("sort-range.ods");
+
+ int nParts = pModelObj->getParts();
+ for (int it = 0; it < nParts; it++)
+ {
+ CPPUNIT_ASSERT(!pModelObj->getPartHash(it).isEmpty());
+ }
+
+ // check part that it does not exists
+ CPPUNIT_ASSERT(pModelObj->getPartHash(100).isEmpty());
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
#endif
CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index f207610d3013..95c7ae5dca12 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -192,6 +192,19 @@ bool ScDocument::HasTable( SCTAB nTab ) const
return false;
}
+bool ScDocument::GetHashCode( SCTAB nTab, sal_Int64& rHashCode ) const
+{
+ if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()))
+ {
+ if (maTabs[nTab])
+ {
+ rHashCode = maTabs[nTab]->GetHashCode();
+ return true;
+ }
+ }
+ return false;
+}
+
bool ScDocument::GetName( SCTAB nTab, OUString& rName ) const
{
if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()))
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index d93d1f4d7ed3..be738f9c5a6e 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -354,6 +354,11 @@ ScTable::~ScTable()
aCol[k].PrepareBroadcastersForDestruction();
}
+sal_Int64 ScTable::GetHashCode() const
+{
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
+}
+
void ScTable::GetName( OUString& rName ) const
{
rName = aName;
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index cba78bd63e70..f03768d1ec48 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -523,6 +523,13 @@ OUString ScModelObj::getPartName( int nPart )
return sTabName;
}
+OUString ScModelObj::getPartHash( int nPart )
+{
+ sal_Int64 nHashCode;
+ ScViewData* pViewData = ScDocShell::GetViewData();
+ return (pViewData->GetDocument()->GetHashCode(nPart, nHashCode) ? OUString::number(nHashCode) : OUString());
+}
+
Size ScModelObj::getDocumentSize()
{
Size aSize(10, 10); // minimum size