summaryrefslogtreecommitdiff
path: root/sw
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 /sw
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 'sw')
-rw-r--r--sw/inc/unotxdoc.hxx2
-rw-r--r--sw/qa/extras/tiledrendering/tiledrendering.cxx16
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx8
3 files changed, 26 insertions, 0 deletions
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 0e1009ce42c9..381a3566bb2d 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -412,6 +412,8 @@ public:
virtual int getPart() override;
/// @see vcl::ITiledRenderable::getPartName().
virtual OUString getPartName(int nPart) override;
+ /// @see vcl::ITiledRenderable::getPartHash().
+ virtual OUString getPartHash(int nPart) override;
/// @see vcl::ITiledRenderable::initializeForTiledRendering().
virtual void initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments) override;
/// @see vcl::ITiledRenderable::registerCallback().
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 37e5cf50dfc2..d0203afde5b9 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -48,6 +48,7 @@ public:
void testSearchAll();
void testSearchAllNotifications();
void testPageDownInvalidation();
+ void testPartHash();
CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback);
@@ -65,6 +66,7 @@ public:
CPPUNIT_TEST(testSearchAll);
CPPUNIT_TEST(testSearchAllNotifications);
CPPUNIT_TEST(testPageDownInvalidation);
+ CPPUNIT_TEST(testPartHash);
CPPUNIT_TEST_SUITE_END();
private:
@@ -516,6 +518,20 @@ void SwTiledRenderingTest::testPageDownInvalidation()
comphelper::LibreOfficeKit::setActive(false);
}
+void SwTiledRenderingTest::testPartHash()
+{
+ comphelper::LibreOfficeKit::setActive();
+
+ SwXTextDocument* pXTextDocument = createDoc("pagedown-invalidation.odt");
+ int nParts = pXTextDocument->getParts();
+ for (int it = 0; it < nParts; it++)
+ {
+ CPPUNIT_ASSERT(!pXTextDocument->getPartHash(it).isEmpty());
+ }
+
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index b975697853d6..a4e7b2af702e 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3229,6 +3229,14 @@ OUString SwXTextDocument::getPartName(int nPart)
return OUString(SW_RES(STR_PAGE)) + OUString::number(nPart + 1);
}
+OUString SwXTextDocument::getPartHash(int nPart)
+{
+ SolarMutexGuard aGuard;
+ OUString sPart(OUString(SW_RES(STR_PAGE)) + OUString::number(nPart + 1));
+
+ return OUString::number(sPart.hashCode());
+}
+
void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments)
{
SolarMutexGuard aGuard;