summaryrefslogtreecommitdiffstats
path: root/editeng/source
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 05:03:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 05:09:28 +0000
commit97ac77f067910fa5e8206d75160fa63546a9358d (patch)
treee6fa64b43e8150ef65578afa4f1f40f3e19f7fa3 /editeng/source
parentReleasing progress-linux version 4:24.2.2-3~progress7.99u1. (diff)
downloadlibreoffice-97ac77f067910fa5e8206d75160fa63546a9358d.tar.xz
libreoffice-97ac77f067910fa5e8206d75160fa63546a9358d.zip
Merging upstream version 4:24.2.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'editeng/source')
-rw-r--r--editeng/source/editeng/impedit.hxx2
-rw-r--r--editeng/source/editeng/impedit2.cxx4
-rw-r--r--editeng/source/editeng/impedit4.cxx11
3 files changed, 9 insertions, 8 deletions
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index e4352f298f..0aabebe2ab 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -702,7 +702,7 @@ private:
EditPaM WordRight( const EditPaM& rPaM, sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES );
EditPaM StartOfWord( const EditPaM& rPaM );
EditPaM EndOfWord( const EditPaM& rPaM );
- EditSelection SelectWord( const EditSelection& rCurSelection, sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES, bool bAcceptStartOfWord = true );
+ EditSelection SelectWord( const EditSelection& rCurSelection, sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES, bool bAcceptStartOfWord = true, bool bAcceptEndOfWord = false );
EditSelection SelectSentence( const EditSelection& rCurSel ) const;
EditPaM CursorVisualLeftRight( EditView const * pEditView, const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode, bool bToLeft );
EditPaM CursorVisualStartEnd( EditView const * pEditView, const EditPaM& rPaM, bool bStart );
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 40f111b72e..afb6a07671 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -1566,7 +1566,7 @@ EditPaM ImpEditEngine::EndOfWord( const EditPaM& rPaM )
return aNewPaM;
}
-EditSelection ImpEditEngine::SelectWord( const EditSelection& rCurSel, sal_Int16 nWordType, bool bAcceptStartOfWord )
+EditSelection ImpEditEngine::SelectWord( const EditSelection& rCurSel, sal_Int16 nWordType, bool bAcceptStartOfWord, bool bAcceptEndOfWord )
{
EditSelection aNewSel( rCurSel );
EditPaM aPaM( rCurSel.Max() );
@@ -1588,7 +1588,7 @@ EditSelection ImpEditEngine::SelectWord( const EditSelection& rCurSel, sal_Int16
aPaM.GetNode()->GetString(), aPaM.GetIndex(), aLocale, nWordType, true);
// don't select when cursor at end of word
- if ( ( aBoundary.endPos > aPaM.GetIndex() ) &&
+ if ( ( aBoundary.endPos > aPaM.GetIndex() || ( bAcceptEndOfWord && aBoundary.endPos == aPaM.GetIndex() ) ) &&
( ( aBoundary.startPos < aPaM.GetIndex() ) || ( bAcceptStartOfWord && ( aBoundary.startPos == aPaM.GetIndex() ) ) ) )
{
aNewSel.Min().SetIndex( aBoundary.startPos );
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 3bf44cdb91..0258900725 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -2701,11 +2701,12 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
if ( !aSel.HasRange() )
{
- /* Cursor is inside of a word */
- if (nTransliterationMode == TransliterationFlags::SENTENCE_CASE)
- aSel = SelectSentence( aSel );
- else
- aSel = SelectWord( aSel );
+ aSel = SelectWord( aSel, css::i18n::WordType::ANYWORD_IGNOREWHITESPACES, true, true );
+ if (!aSel.HasRange() && aSel.Min().GetIndex() > 0 &&
+ OUString(".!?").indexOf(aSel.Min().GetNode()->GetChar(aSel.Min().GetIndex() - 1)) > -1 )
+ {
+ aSel = SelectSentence(aSel);
+ }
}
// tdf#107176: if there's still no range, just return aSel