dev/null |binary sw/inc/crsrsh.hxx | 2 - sw/qa/uitest/writer_tests8/tdf150037.py | 43 -------------------------------- sw/source/core/crsr/crbm.cxx | 9 ++---- sw/source/uibase/docvw/edtwin.cxx | 6 ---- sw/source/uibase/inc/edtwin.hxx | 2 - sw/source/uibase/inc/wrtsh.hxx | 2 - sw/source/uibase/uitest/uiobject.cxx | 37 --------------------------- sw/source/uibase/wrtsh/wrtsh3.cxx | 4 +- 9 files changed, 8 insertions(+), 97 deletions(-)
New commits: commit 22dd422f7ccf7a1ce4dc7fe5b274263a55e464c7 Author: Justin Luth <jl...@mail.com> AuthorDate: Sat May 4 13:26:53 2024 -0400 Commit: Justin Luth <jl...@mail.com> CommitDate: Wed May 8 15:28:08 2024 +0200 Revert "tdf#150037 Writer: text fieldmark behaviour changed" This reverts 24.8 commit 96323a10d3a55d212c350886e2a1344c0cd2ba95. A mouse click selects the fieldmark to be able to overwrite the field with the next text input. But I did not revert: Additionally the EN SPACE (0x2002) character is visualized by the DEGREE symbol when 'View/Formatting Marks' is active. The problem was that the field itself was also selected, so not only was the placeholder text overwritten, but so was the entire field. Additionally, it is ONLY placeholder text that should be selected, but this was also selecting non-placeholder (i.e. custom user-entered text) that was being pre-selected which is NOT what happens in MS Word. The whole point of the patch in the first place was to emulate MS Word's response to placeholder text, so we should also be emulating what happens to non-placeholder text. That would require tracking whether the field's text was placeholder or not, which is not currently track in legacy fields. Change-Id: I0a1a22f82827cd5f9d9abfb52cd562dff4651b29 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167139 Reviewed-by: Justin Luth <jl...@mail.com> Tested-by: Jenkins diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 23dd92da39e1..f5e52e398f3d 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -593,7 +593,7 @@ public: ::sw::mark::IFieldmark* GetCurrentFieldmark(); sw::mark::IFieldmark* GetFieldmarkAfter(); sw::mark::IFieldmark* GetFieldmarkBefore(); - bool GotoFieldmark( const ::sw::mark::IFieldmark* const pMark, bool completeSelection = false ); + bool GotoFieldmark(const ::sw::mark::IFieldmark* const pMark); // update Cursr, i.e. reset it into content should only be called when the // cursor was set to a random position e.g. when deleting frames diff --git a/sw/qa/uitest/data/tdf150037.docx b/sw/qa/uitest/data/tdf150037.docx deleted file mode 100644 index 4fcb18efd724..000000000000 Binary files a/sw/qa/uitest/data/tdf150037.docx and /dev/null differ diff --git a/sw/qa/uitest/data/tdf150037.odt b/sw/qa/uitest/data/tdf150037.odt deleted file mode 100644 index 15d75a694b0a..000000000000 Binary files a/sw/qa/uitest/data/tdf150037.odt and /dev/null differ diff --git a/sw/qa/uitest/writer_tests8/tdf150037.py b/sw/qa/uitest/writer_tests8/tdf150037.py deleted file mode 100644 index e81cf947affc..000000000000 --- a/sw/qa/uitest/writer_tests8/tdf150037.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -from uitest.framework import UITestCase -from uitest.uihelper.common import get_url_for_data_file -from libreoffice.uno.propertyvalue import mkPropertyValues - -class tdf150037(UITestCase): - - def test_tdf150037(self): - - with self.ui_test.load_file(get_url_for_data_file("tdf150037.docx")) as document: - - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - - xWriterEdit.executeAction("CLICK", mkPropertyValues({"START_POS": "14", "END_POS": "14"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Replacement"})) - xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "22"})) - windowState = xWriterEdit.getState(); - self.assertEqual(windowState[14].Value, "Fieldmark: Replacement") - - def test_tdf150037_protected(self): - - with self.ui_test.load_file(get_url_for_data_file("tdf150037.odt")) as document: - - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - xWriterEdit.executeAction("CLICK", mkPropertyValues({"START_POS": "14", "END_POS": "14"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Replacement"})) - xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "23"})) - windowState = xWriterEdit.getState(); - self.assertEqual(windowState[14].Value, "Fieldmark: Replacement") - - -# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx index 15b1bba2b1b6..a7d81030dcbf 100644 --- a/sw/source/core/crsr/crbm.cxx +++ b/sw/source/core/crsr/crbm.cxx @@ -302,18 +302,15 @@ sw::mark::IFieldmark* SwCursorShell::GetFieldmarkBefore() return getIDocumentMarkAccess()->getFieldmarkBefore(pos, /*bLoop*/true); } -bool SwCursorShell::GotoFieldmark(::sw::mark::IFieldmark const * const pMark, bool completeSelection) +bool SwCursorShell::GotoFieldmark(::sw::mark::IFieldmark const * const pMark) { if(pMark==nullptr) return false; // watch Cursor-Moves CursorStateHelper aCursorSt(*this); aCursorSt.SetCursorToMark(pMark); - if (!completeSelection || aCursorSt.m_pCursor->HasReadonlySel(false, false)) - { - aCursorSt.m_pCursor->GetPoint()->AdjustContent(+1); - aCursorSt.m_pCursor->GetMark()->AdjustContent(-1); - } + aCursorSt.m_pCursor->GetPoint()->AdjustContent(+1); + aCursorSt.m_pCursor->GetMark()->AdjustContent(-1); if(aCursorSt.RollbackIfIllegal()) return false; diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index b50c67811774..cf8031a527ae 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -4969,7 +4969,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) } else { - SwContentAtPos aFieldAtPos ( IsAttrAtPos::Field | IsAttrAtPos::FormControl ); + SwContentAtPos aFieldAtPos (IsAttrAtPos::Field); if ( !rSh.IsInSelect() && rSh.TestCurrPam( aDocPt ) && !rSh.GetContentAtPos( aDocPt, aFieldAtPos ) ) { @@ -5096,10 +5096,6 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) rCheckboxFm.Invalidate(); rSh.InvalidateWindows( SwRect(m_rView.GetVisArea()) ); } - else if ( fieldBM->GetFieldname( ) == ODF_FORMTEXT ) - { - rSh.GotoFieldmark( aContentAtPos.aFnd.pFieldmark, true ); - } } } else if ( IsAttrAtPos::InetAttr == aContentAtPos.eContentAtPos ) diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx index 4419cd9a446e..ac6bbaeeeeff 100644 --- a/sw/source/uibase/inc/edtwin.hxx +++ b/sw/source/uibase/inc/edtwin.hxx @@ -59,8 +59,6 @@ class SwTextFrame; class SAL_DLLPUBLIC_RTTI SwEditWin final : public vcl::DocWindow, public DropTargetHelper, public DragSourceHelper { - friend class SwEditWinUIObject; - static QuickHelpData* s_pQuickHlpData; static tools::Long s_nDDStartPosX; diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx index fc7f69b3d8de..2412c7749bb2 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -429,7 +429,7 @@ typedef bool (SwWrtShell::*FNSimpleMove)(); bool GoNextBookmark(); // true when there still was one bool GoPrevBookmark(); - bool GotoFieldmark(::sw::mark::IFieldmark const * const pMark, bool completeSelection = false); + bool GotoFieldmark(::sw::mark::IFieldmark const * const pMark); SW_DLLPUBLIC bool GotoField( const SwFormatField& rField ); diff --git a/sw/source/uibase/uitest/uiobject.cxx b/sw/source/uibase/uitest/uiobject.cxx index eed92644ef16..097769e3704f 100644 --- a/sw/source/uibase/uitest/uiobject.cxx +++ b/sw/source/uibase/uitest/uiobject.cxx @@ -14,7 +14,6 @@ #include <wrtsh.hxx> #include <ndtxt.hxx> #include <viewopt.hxx> -#include <vcl/event.hxx> #include <sfx2/sidebar/Sidebar.hxx> #include <sfx2/viewfrm.hxx> @@ -135,42 +134,6 @@ void SwEditWinUIObject::execute(const OUString& rAction, ::sfx2::sidebar::Sidebar::ShowPanel(aVal, pViewFrm->GetFrame().GetFrameInterface()); } } - else if (rAction == "CLICK") - { - if (rParameters.find("START_POS") != rParameters.end()) - { - auto itr = rParameters.find("START_POS"); - OUString aStartPos = itr->second; - TextFrameIndex const nStartPos(aStartPos.toInt32()); - - itr = rParameters.find("END_POS"); - assert(itr != rParameters.end()); - OUString aEndPos = itr->second; - TextFrameIndex const nEndPos(aEndPos.toInt32()); - - auto & shell = getWrtShell(mxEditWin); - if (shell.GetCursor_()->GetPoint()->GetNode().GetTextNode()) - { - shell.Push(); - shell.MovePara(GoCurrPara, fnParaEnd); - TextFrameIndex const len(shell.GetCursorPointAsViewIndex()); - shell.Pop(SwCursorShell::PopMode::DeleteCurrent); - SAL_WARN_IF( - sal_Int32(nStartPos) < 0 || nStartPos > len || sal_Int32(nEndPos) < 0 || nEndPos > len, "sw.ui", - "SELECT START/END_POS " << sal_Int32(nStartPos) << ".." << sal_Int32(nEndPos) << " outside 0.." << sal_Int32(len)); - shell.SelectTextView( - std::clamp(nStartPos, TextFrameIndex(0), len), std::clamp(nEndPos, TextFrameIndex(0), len)); - Point point = shell.GetCharRect().Center(); - MouseEvent mouseEvent(mxEditWin->LogicToPixel(point), 1, MouseEventModifiers::NONE, MOUSE_LEFT); - mxEditWin->MouseButtonDown(mouseEvent); - mxEditWin->MouseButtonUp(mouseEvent); - } - else - { - SAL_WARN("sw.ui", "CLICK without SwTextNode"); - } - } - } else WindowUIObject::execute(rAction, rParameters); } diff --git a/sw/source/uibase/wrtsh/wrtsh3.cxx b/sw/source/uibase/wrtsh/wrtsh3.cxx index 6920def5a3e7..0907794d7c2c 100644 --- a/sw/source/uibase/wrtsh/wrtsh3.cxx +++ b/sw/source/uibase/wrtsh/wrtsh3.cxx @@ -221,10 +221,10 @@ bool SwWrtShell::GotoContentControl(const SwFormatContentControl& rContentContro return bRet; } -bool SwWrtShell::GotoFieldmark(::sw::mark::IFieldmark const * const pMark, bool completeSelection) +bool SwWrtShell::GotoFieldmark(::sw::mark::IFieldmark const * const pMark) { (this->*m_fnKillSel)( nullptr, false ); - bool bRet = SwCursorShell::GotoFieldmark(pMark, completeSelection); + bool bRet = SwCursorShell::GotoFieldmark(pMark); if( bRet && IsSelFrameMode() ) { UnSelectFrame();