summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2016-04-20 13:52:31 -0400
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-04-21 13:48:33 +0000
commit1a74c6333a79ccf0579b33ebc42ce2ccc23ccadb (patch)
tree61dee187e9588e9ba65066e6196dc584413d26ba /sd
parent4779f443e9a58e3bd9ec7668796a877ef2362d99 (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.hxx1
-rw-r--r--sd/qa/unit/tiledrendering/tiledrendering.cxx18
-rw-r--r--sd/source/core/sdpage.cxx5
-rw-r--r--sd/source/ui/inc/unomodel.hxx2
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx12
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();