diff options
author | Henry Castro <hcastro@collabora.com> | 2016-04-20 13:52:31 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2016-04-23 11:33:23 -0400 |
commit | 756e208be95b455d3d817610d931a742d1b04389 (patch) | |
tree | 67436ea151fa579b61d18d41cc23111daf26fa72 /sd | |
parent | bb52a54aa49cbb75820f8ddbfc8e9e94b63281cd (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 'sd')
-rw-r--r-- | sd/inc/sdpage.hxx | 1 | ||||
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 19 | ||||
-rw-r--r-- | sd/source/core/sdpage.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/inc/unomodel.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 12 |
5 files changed, 39 insertions, 0 deletions
diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx index 6e6a354408b1..58f6fe6651ff 100644 --- a/sd/inc/sdpage.hxx +++ b/sd/inc/sdpage.hxx @@ -186,6 +186,7 @@ public: OUString GetPresObjText(PresObjKind eObjKind) const; SfxStyleSheet* GetStyleSheetForMasterPageBackground() const; SfxStyleSheet* GetStyleSheetForPresObj(PresObjKind eObjKind) const; + sal_Int64 GetHashCode() const; bool RestoreDefaultText( SdrObject* pObj ); /** @return true if the given SdrObject is inside the presentation object list */ diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 7c63bf275ac7..4fe421ede4a1 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -66,6 +66,7 @@ public: void testSearchAllSelections(); void testSearchAllNotifications(); void testSearchAllFollowedBySearch(); + void testPartHash(); #endif CPPUNIT_TEST_SUITE(SdTiledRenderingTest); @@ -83,6 +84,8 @@ public: //CPPUNIT_TEST(testSearchAllSelections); CPPUNIT_TEST(testSearchAllNotifications); CPPUNIT_TEST(testSearchAllFollowedBySearch); + CPPUNIT_TEST(testInsertDeletePage); + CPPUNIT_TEST(testPartHash); #endif CPPUNIT_TEST_SUITE_END(); @@ -622,6 +625,22 @@ void SdTiledRenderingTest::testInsertDeletePage() comphelper::LibreOfficeKit::setActive(false); } +void SdTiledRenderingTest::testPartHash() +{ + comphelper::LibreOfficeKit::setActive(); + SdXImpressDocument* pDoc = createDoc("dummy.odp"); + + int nParts = pDoc->getParts(); + for (int it = 0; it < nParts; it++) + { + CPPUNIT_ASSERT(!pDoc->getPartHash(it).isEmpty()); + } + + // check part that it does not exists + CPPUNIT_ASSERT(pDoc->getPartHash(100).isEmpty()); + comphelper::LibreOfficeKit::setActive(false); +} + #endif CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest); diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 5a8de34029fe..e6c550fa9ca7 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -2700,6 +2700,11 @@ SdPage* SdPage::getImplementation( const ::com::sun::star::uno::Reference< ::com return 0; } +sal_Int64 SdPage::GetHashCode() const +{ + return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); +} + void SdPage::SetName (const OUString& rName) { OUString aOldName( GetName() ); diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index 1fd97568f363..388bfc5045eb 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -240,6 +240,8 @@ public: virtual int getPart() SAL_OVERRIDE; virtual int getParts() SAL_OVERRIDE; virtual OUString getPartName( int nPart ) SAL_OVERRIDE; + virtual OUString getPartHash( int nPart ) SAL_OVERRIDE; + virtual void setPartMode( int nPartMode ) SAL_OVERRIDE; /// @see vcl::ITiledRenderable::initializeForTiledRendering(). diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index adb1fc72586d..19be0ad85797 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2339,6 +2339,18 @@ OUString SdXImpressDocument::getPartName( int nPart ) return pPage->GetName(); } +OUString SdXImpressDocument::getPartHash( int nPart ) +{ + SdPage* pPage = mpDoc->GetSdPage( nPart, PK_STANDARD ); + if (!pPage) + { + SAL_WARN("sd", "DrawViewShell not available!"); + return OUString(); + } + + return OUString::number(pPage->GetHashCode()); +} + void SdXImpressDocument::setPartMode( int nPartMode ) { DrawViewShell* pViewSh = GetViewShell(); |