tdf#159286 FORMTEXT selection changed

As long as FORMTEXT has default content of 5 en spaces a click
selects the content. If the content has changed then the cursor is
placed at the mouse position.

Change-Id: If0e7717d04d29887b63ec20ed6b82c625400421a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173812
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
Tested-by: Jenkins
This commit is contained in:
Oliver Specht
2024-10-16 13:12:11 +02:00
committed by Gabor Kelemen
parent 8b4161616b
commit a157f82649
3 changed files with 13 additions and 0 deletions
+2
View File
@@ -279,6 +279,8 @@ namespace sw::mark
OUString GetContent() const override;
void ReplaceContent(const OUString& sNewContent) override;
bool HasDefaultContent() const;
private:
sw::DocumentContentOperationsManager* m_pDocumentContentOperationsManager;
};
+5
View File
@@ -672,6 +672,11 @@ namespace sw::mark
}
Invalidate();
}
bool TextFieldmark::HasDefaultContent() const
{
return GetContent() == vEnSpaces;
}
NonTextFieldmark::NonTextFieldmark(const SwPaM& rPaM)
: Fieldmark(rPaM)
+6
View File
@@ -5139,6 +5139,12 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
rCheckboxFm.Invalidate();
rSh.InvalidateWindows( SwRect(m_rView.GetVisArea()) );
}
else if ( fieldBM->GetFieldname( ) == ODF_FORMTEXT &&
static_cast< const TextFieldmark* > ( aContentAtPos.aFnd.pFieldmark )->HasDefaultContent() )
{
rSh.GotoFieldmark( aContentAtPos.aFnd.pFieldmark );
}
}
}
else if ( IsAttrAtPos::InetAttr == aContentAtPos.eContentAtPos )