summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2025-02-28 09:00:22 +0100
committerMiklos Vajna <vmiklos@collabora.com>2025-03-03 11:45:24 +0100
commitae6d396552cd3cebd7fba4942e6ca2fd5de579af (patch)
tree573cb581740ba00d88ef7619764028ec63db012c /desktop
parent509b6d19d4b4310bad80d2a91ddd1429ccabc51f (diff)
cool#11226 sw per-view redline on: add view-aware getter
Have 2 views, view 1 enables tracked changes recording by dispatching .uno:TrackChanges, view 2 does not. The result is that this gets enabled in both views, including the toolbar button state, insertion recording, deletion recording. The toolbar button state behavior was introduced in commit d890ec2f130188af9d998abf5968f06e7218b7a4 (tdf#101592 sw: track changes state is doc-specific, not view-specific, 2016-08-19), but there the motivation was that *if* the setting is per-doc, then all views should show the same toolbar button state. Fix the problem by: - improving SwDocShell::IsChangeRecording(), so it takes a hitn on what is the relevant view; the relevant view is the view where the state is updated, it may not be the current view - using sw::DocumentRedlineManager::GetRedlineFlags() everywhere, so we'll have a central points for reading these flags - extending sw::DocumentRedlineManager::GetRedlineFlags() to try to take the "is recording" setting from the current view (if there is such a view) - improving SwEditShell::GetRedlineFlags() to pass itself to sw::DocumentRedlineManager::GetRedlineFlags(), so the entire chain of calls for the toolbar button work with the correct view Also add tests to make sure all of uno command state, insert & delete works. Drop the desktop/ test that is now redundant -- and testing per-view callbacks there is harder than in sw/. Change-Id: I6dbd826ea27facb9f8d06029efe805c637b7e080 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182423 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx22
1 files changed, 0 insertions, 22 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index a91270f94bad..43fe3a7960ef 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -180,7 +180,6 @@ public:
void testBinaryCallback();
void testInput();
void testRedlineWriter();
- void testTrackChanges();
void testRedlineCalc();
void testPaintPartTile();
void testPaintPartTileDifferentSchemes();
@@ -253,7 +252,6 @@ public:
CPPUNIT_TEST(testBinaryCallback);
CPPUNIT_TEST(testInput);
CPPUNIT_TEST(testRedlineWriter);
- CPPUNIT_TEST(testTrackChanges);
CPPUNIT_TEST(testRedlineCalc);
CPPUNIT_TEST(testPaintPartTile);
CPPUNIT_TEST(testPaintPartTileDifferentSchemes);
@@ -1039,26 +1037,6 @@ void DesktopLOKTest::testWriterComments()
CPPUNIT_ASSERT_EQUAL(u"test"_ustr, xTextField->getPropertyValue(u"Content"_ustr).get<OUString>());
}
-void DesktopLOKTest::testTrackChanges()
-{
- // Load a document and create two views.
- LibLibreOffice_Impl aOffice;
- LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
- pDocument->pClass->initializeForRendering(pDocument, nullptr);
- pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this);
- pDocument->pClass->createView(pDocument);
- pDocument->pClass->initializeForRendering(pDocument, nullptr);
- pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this);
- Scheduler::ProcessEventsToIdle();
-
- // Enable track changes and assert that both views get notified.
- m_nTrackChanges = 0;
- pDocument->pClass->postUnoCommand(pDocument, ".uno:TrackChanges", nullptr, false);
- Scheduler::ProcessEventsToIdle();
- // This was 1, only the active view was notified.
- CPPUNIT_ASSERT_EQUAL(2, m_nTrackChanges);
-}
-
void DesktopLOKTest::testSheetOperations()
{
LibLODocument_Impl* pDocument = loadDoc("sheets.ods");