summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2016-04-20 13:52:31 -0400
committerHenry Castro <hcastro@collabora.com>2016-04-23 11:33:23 -0400
commit756e208be95b455d3d817610d931a742d1b04389 (patch)
tree67436ea151fa579b61d18d41cc23111daf26fa72 /sw
parentbb52a54aa49cbb75820f8ddbfc8e9e94b63281cd (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 1251f76b1e94..fc70cbbc3f85 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -416,6 +416,8 @@ public:
virtual int getPart() SAL_OVERRIDE;
/// @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;
/// @see vcl::ITiledRenderable::registerCallback().
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 240899c602c0..00d85951e7b8 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -55,6 +55,7 @@ public:
void testSearchAll();
void testSearchAllNotifications();
void testPageDownInvalidation();
+ void testPartHash();
CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback);
@@ -72,6 +73,7 @@ public:
CPPUNIT_TEST(testSearchAll);
CPPUNIT_TEST(testSearchAllNotifications);
CPPUNIT_TEST(testPageDownInvalidation);
+ CPPUNIT_TEST(testPartHash);
CPPUNIT_TEST_SUITE_END();
private:
@@ -518,6 +520,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 9a78c37b6ca2..8392cfd0ee72 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3262,6 +3262,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;