[Libreoffice-commits] core.git: sw/inc sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Mon Aug 29 11:34:47 UTC 2016
sw/inc/redline.hxx | 2 -
sw/qa/extras/tiledrendering/tiledrendering.cxx | 33 ++++++++++++++++++++++++-
sw/source/core/doc/DocumentRedlineManager.cxx | 1
3 files changed, 34 insertions(+), 2 deletions(-)
New commits:
commit d017362bc68fe40c4bd79db76614d84aa9be913d
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Aug 29 12:32:51 2016 +0200
sw lok: emit REDLINE_TABLE_ENTRY_MODIFIED when deleting self-added characters
This doesn't work out of the box via SwRangeRedline::SetStart/End,
because the range of the redline is adjusted when redlining is disabled
by sw::DocumentRedlineManager::AppendRedline() when it compresses the
insert and delete redlines into a single reduced insert redline, and
then the redline is updated implicitly via SwIndex.
Change-Id: I4b652348b256df75e4c774ea5f3fdd78f59deb01
Reviewed-on: https://gerrit.libreoffice.org/28454
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index 55d4076..d1dbd52 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -190,7 +190,6 @@ class SW_DLLPUBLIC SwRangeRedline : public SwPaM
void CopyToSection();
void DelCopyOfSection(size_t nMyPos);
void MoveFromSection(size_t nMyPos);
- void MaybeNotifyModification();
public:
SwRangeRedline( RedlineType_t eType, const SwPaM& rPam );
@@ -282,6 +281,7 @@ public:
bool operator<( const SwRangeRedline& ) const;
void dumpAsXml(struct _xmlTextWriter* pWriter) const;
+ void MaybeNotifyModification();
};
/// Base object for 'Redlines' that are not of 'Ranged' type (like table row insert\delete)
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 0df932d..ab9be3d 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -69,6 +69,7 @@ public:
void testShapeTextUndoGroupShells();
void testTrackChanges();
void testTrackChangesCallback();
+ void testRedlineUpdateCallback();
CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback);
@@ -103,6 +104,7 @@ public:
CPPUNIT_TEST(testShapeTextUndoGroupShells);
CPPUNIT_TEST(testTrackChanges);
CPPUNIT_TEST(testTrackChangesCallback);
+ CPPUNIT_TEST(testRedlineUpdateCallback);
CPPUNIT_TEST_SUITE_END();
private:
@@ -119,6 +121,7 @@ private:
int m_nSelectionAfterSearchResult;
int m_nInvalidations;
int m_nRedlineTableSizeChanged;
+ int m_nRedlineTableEntryModified;
};
SwTiledRenderingTest::SwTiledRenderingTest()
@@ -126,7 +129,8 @@ SwTiledRenderingTest::SwTiledRenderingTest()
m_nSelectionBeforeSearchResult(0),
m_nSelectionAfterSearchResult(0),
m_nInvalidations(0),
- m_nRedlineTableSizeChanged(0)
+ m_nRedlineTableSizeChanged(0),
+ m_nRedlineTableEntryModified(0)
{
}
@@ -205,6 +209,11 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload)
++m_nRedlineTableSizeChanged;
}
break;
+ case LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED:
+ {
+ ++m_nRedlineTableEntryModified;
+ }
+ break;
}
}
@@ -1199,6 +1208,28 @@ void SwTiledRenderingTest::testTrackChangesCallback()
comphelper::LibreOfficeKit::setActive(false);
}
+void SwTiledRenderingTest::testRedlineUpdateCallback()
+{
+ // Load a document.
+ comphelper::LibreOfficeKit::setActive();
+ SwXTextDocument* pXTextDocument = createDoc("dummy.fodt");
+ SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
+ pWrtShell->GetSfxViewShell()->registerLibreOfficeKitViewCallback(&SwTiledRenderingTest::callback, this);
+
+ // Turn on track changes, type "xx" and delete the second one.
+ uno::Reference<beans::XPropertySet> xPropertySet(mxComponent, uno::UNO_QUERY);
+ xPropertySet->setPropertyValue("RecordChanges", uno::makeAny(true));
+ pWrtShell->Insert("xx");
+ m_nRedlineTableEntryModified = 0;
+ pWrtShell->DelLeft();
+
+ // Assert that we get exactly one notification about the redline update.
+ // This was 0, as LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED wasn't sent.
+ CPPUNIT_ASSERT_EQUAL(1, m_nRedlineTableEntryModified);
+
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index c879859..2672437 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1215,6 +1215,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall
}
delete pNewRedl;
pNewRedl = nullptr;
+ pRedl->MaybeNotifyModification();
break;
case POS_OUTSIDE:
More information about the Libreoffice-commits
mailing list