diff options
Diffstat (limited to 'editeng/source')
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/impedit4.cxx | 11 |
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 |