diff options
Diffstat (limited to 'sd')
-rw-r--r-- | sd/inc/sdpage.hxx | 1 | ||||
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 18 | ||||
-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, 38 insertions, 0 deletions
diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx index b893e6a5dff8..d7da289b6392 100644 --- a/sd/inc/sdpage.hxx +++ b/sd/inc/sdpage.hxx @@ -179,6 +179,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 d50d01e8994d..88b437f3286b 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -60,6 +60,7 @@ public: void testSearchAllFollowedBySearch(); void testInsertDeletePage(); void testInsertTable(); + void testPartHash(); #endif CPPUNIT_TEST_SUITE(SdTiledRenderingTest); @@ -78,6 +79,7 @@ public: CPPUNIT_TEST(testSearchAllFollowedBySearch); CPPUNIT_TEST(testInsertDeletePage); CPPUNIT_TEST(testInsertTable); + CPPUNIT_TEST(testPartHash); #endif CPPUNIT_TEST_SUITE_END(); @@ -660,6 +662,22 @@ void SdTiledRenderingTest::testInsertTable() 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 55c779c41ff9..c903177a267c 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -2699,6 +2699,11 @@ SdPage* SdPage::getImplementation( const css::uno::Reference< css::drawing::XDra return nullptr; } +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 7b2c9d31e51d..c1097d15efec 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -241,6 +241,8 @@ public: virtual int getPart() override; virtual int getParts() override; virtual OUString getPartName( int nPart ) override; + virtual OUString getPartHash( int nPart ) override; + virtual void setPartMode( int nPartMode ) override; /// @see vcl::ITiledRenderable::initializeForTiledRendering(). diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 594c157d3d73..674ae3de4c4e 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2328,6 +2328,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(); |