summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorJustin Luth <jluth@mail.com>2024-05-04 13:26:53 -0400
committerJustin Luth <jluth@mail.com>2024-05-08 15:28:08 +0200
commit22dd422f7ccf7a1ce4dc7fe5b274263a55e464c7 (patch)
treee52d9d39ea9a6d4639d7eb655ed569b4a89a22f1 /sw/source
parenta551290fc46d5f91b89615700c88b863a403bc7a (diff)
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 <jluth@mail.com> Tested-by: Jenkins
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/crsr/crbm.cxx9
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx6
-rw-r--r--sw/source/uibase/inc/edtwin.hxx2
-rw-r--r--sw/source/uibase/inc/wrtsh.hxx2
-rw-r--r--sw/source/uibase/uitest/uiobject.cxx37
-rw-r--r--sw/source/uibase/wrtsh/wrtsh3.cxx4
6 files changed, 7 insertions, 53 deletions
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();