dev/null |binary sw/inc/viewopt.hxx | 5 +- sw/qa/extras/tiledrendering/tiledrendering.cxx | 53 ++++++++++++++++--------- sw/source/uibase/config/viewopt.cxx | 6 -- 4 files changed, 39 insertions(+), 25 deletions(-)
New commits: commit ee52e5385497a04b23bcc907ec43cafd8bfadf28 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Thu Jan 25 14:50:29 2024 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Fri Jan 26 10:47:53 2024 +0100 revert: 'LOKit: always display hidden chars when showing formatting...' and add a counter-reason test. When we have multiple views of a document, whether in LOKit or in desktop via "Window, New Window" then we have just one layout and render that layout in each view. So with default settings: View, Formatting Marks, we can correctly render the Pilcows in one view but not in the another even though we share a single layout. If "Show Hidden Characters" is enabled, then when "view formatting" is also enabled then hidden characters are shown when view formatting is enabled, and not when it is disabled. But if "show hidden characters" are enabled, then if formatting marks are enabled in one view and and not another then the hidden characters will be either shown in both views or hidden in both views, depending on whether the shared layout is done with "show/hide hidden characters". So we currently can't show/hide the hidden characters per-view. revert: commit 7a6b80995f69304149e0ab7a8e1fa92a15b20d07 Date: Wed Oct 4 10:04:42 2023 -0400 LOKit: always display hidden chars when showing formatting marks This arises from noting that in kit then on turning on formatting marks in one view, then the other view rendering options changed, which isn't wanted. But on attempting to keep the other ViewShell settings unaffected it turns out to be futile given the shared layout. Change-Id: I210b86fae84bc8137af415cb9c93dacdeab7d448 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162579 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Justin Luth <jl...@mail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> (cherry picked from commit 5234435a552d3d4cc421ba5c8600d8215f9f8f4b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162549 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx index a98da0dc3cdf..8aac21e745b3 100644 --- a/sw/inc/viewopt.hxx +++ b/sw/inc/viewopt.hxx @@ -489,7 +489,10 @@ public: void SetTreatSubOutlineLevelsAsContent(bool b) { m_nCoreOptions.bTreatSubOutlineLevelsAsContent = b; } - bool IsShowHiddenChar(bool bHard = false) const; + bool IsShowHiddenChar(bool bHard = false) const + { return !m_bReadonly && m_nCoreOptions.bCharHidden && + (m_nCoreOptions.bViewMetachars || bHard); } + void SetShowHiddenChar( bool b ) { m_nCoreOptions.bCharHidden = b; } diff --git a/sw/qa/extras/tiledrendering/data/hiddenLoremIpsum.docx b/sw/qa/extras/tiledrendering/data/hiddenLoremIpsum.docx deleted file mode 100644 index 0802f6e7d314..000000000000 Binary files a/sw/qa/extras/tiledrendering/data/hiddenLoremIpsum.docx and /dev/null differ diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 7f9bb18c0498..8f52f59211cc 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -762,6 +762,7 @@ namespace { bool m_bOwnSelectionSet; bool m_bViewSelectionSet; OString m_aViewSelection; + OString m_aViewRenderState; bool m_bTilesInvalidated; bool m_bViewCursorVisible; bool m_bGraphicViewSelection; @@ -909,6 +910,11 @@ namespace { m_bViewLock = aTree.get_child("rectangle").get_value<std::string>() != "EMPTY"; } break; + case LOK_CALLBACK_VIEW_RENDER_STATE: + { + m_aViewRenderState = pPayload; + } + break; case LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED: { m_aRedlineTableChanged.clear(); @@ -2986,24 +2992,6 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testPilcrowRedlining) comphelper::dispatchCommand(".uno:ControlCodes", {}); } -CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testShowHiddenCharsWhenShowFormatting) -{ - // In LOKit, ignore the config setting for - // Tools - Options - Writer - Formatting Aids - Display Formatting - Hidden characters - // and always show hidden content when showing pilcrow formatting - - createSwDoc("hiddenLoremIpsum.docx"); - - // Since LOKit is active in TiledRendering, turning on "Show formatting" will show hidden text. - comphelper::dispatchCommand(".uno:ControlCodes", {}); // show format marks - Scheduler::ProcessEventsToIdle(); - - // Without this patch, no body text would be visible - so only 1 page instead of 3. - CPPUNIT_ASSERT_EQUAL(3, getPages()); - - comphelper::dispatchCommand(".uno:ControlCodes", {}); -} - CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testDoubleUnderlineAndStrikeOut) { // Load a document where the tracked text moving is visible with @@ -4088,6 +4076,35 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testRedlineTooltip) CPPUNIT_ASSERT(vec[3].toInt32() != 0); } +// toggling Formatting Marks on/off for one view should have no effect on other views +CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testToggleFormattingMarks) +{ + SwXTextDocument* pXTextDocument = createDoc(); + int nView1 = SfxLokHelper::getView(); + + SfxLokHelper::createView(); + int nView2 = SfxLokHelper::getView(); + pXTextDocument->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>()); + + SfxLokHelper::setView(nView1); + ViewCallback aView1; + + SfxLokHelper::setView(nView2); + ViewCallback aView2; + + OString sOrigView2RenderState = pXTextDocument->getViewRenderState(); + + comphelper::dispatchCommand(".uno:ControlCodes", {}); + + Scheduler::ProcessEventsToIdle(); + + // 1. change to view #2 shouldn't result in an update to view #1 renderstate + CPPUNIT_ASSERT(aView1.m_aViewRenderState.isEmpty()); + // 2. toggling on ControlCodes should result in view #2 render state reporting + // 'P' for Pilcrow + CPPUNIT_ASSERT_EQUAL(OString("P" + sOrigView2RenderState), aView2.m_aViewRenderState); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx index 4ffb7a7c47f9..96ac6531e14d 100644 --- a/sw/source/uibase/config/viewopt.cxx +++ b/sw/source/uibase/config/viewopt.cxx @@ -182,12 +182,6 @@ bool SwViewOption::IsTreatSubOutlineLevelsAsContent() const return m_nCoreOptions.bTreatSubOutlineLevelsAsContent; } -bool SwViewOption::IsShowHiddenChar(bool bHard) const -{ - bool bCharHidden = comphelper::LibreOfficeKit::isActive() ? true : m_nCoreOptions.bCharHidden; - return !m_bReadonly && bCharHidden && (m_nCoreOptions.bViewMetachars || bHard); -} - void SwViewOption::DrawRect( OutputDevice *pOut, const SwRect &rRect, ::Color nCol ) {