diff options
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/document.hxx | 1 | ||||
-rw-r--r-- | sc/inc/docuno.hxx | 3 | ||||
-rw-r--r-- | sc/inc/table.hxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/tiledrendering/tiledrendering.cxx | 18 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 13 | ||||
-rw-r--r-- | sc/source/core/data/table1.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 7 |
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 |