diff options
author | Oliver Specht <oliver.specht@cib.de> | 2024-04-30 13:52:09 +0200 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2024-05-08 10:25:08 +0200 |
commit | de8eaca887762568e158024ad5bdbfb21526b734 (patch) | |
tree | 47093f927751e42ba2448f8a086b396543b04e91 /sw | |
parent | 90eb9ea881a7497bb2ec348b3e4cba5aa5d51fa8 (diff) |
Case Rotation in Impress and Writer improved
Word boundaries at the end of the paragraph are now correctly detected.
Sentence case is not applied without multi word selection in Writer anymore.
Change-Id: If6e2eeaa1ecca215d583e8f33364db466bf7c57d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166928
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/crsrsh.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/crsr/crstrvl1.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/crsr/swcrsr.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/inc/wrtsh.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh.cxx | 14 | ||||
-rw-r--r-- | sw/source/uibase/wrtsh/select.cxx | 4 |
6 files changed, 14 insertions, 14 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 1d85ce278736..23dd92da39e1 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -766,6 +766,7 @@ public: SW_DLLPUBLIC bool GoStartSentence(); SW_DLLPUBLIC bool GoEndSentence(); bool SelectWord( const Point* pPt ); + bool SelectWordWT( const Point* pt, sal_Int16 nWordType ); void ExpandToSentenceBorders(); // get position from current cursor diff --git a/sw/source/core/crsr/crstrvl1.cxx b/sw/source/core/crsr/crstrvl1.cxx index 5654566769c8..260cc07ba3d4 100644 --- a/sw/source/core/crsr/crstrvl1.cxx +++ b/sw/source/core/crsr/crstrvl1.cxx @@ -85,6 +85,11 @@ bool SwCursorShell::SelectWord( const Point* pPt ) return m_pCurrentCursor->SelectWord( this, pPt ); } +bool SwCursorShell::SelectWordWT( const Point* pPt, sal_Int16 nWordType ) +{ + return m_pCurrentCursor->SelectWordWT( this, nWordType, pPt ); +} + void SwCursorShell::ExpandToSentenceBorders() { m_pCurrentCursor->ExpandToSentenceBorders(GetLayout()); diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 63b107f823d8..d0584fc97887 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -1452,10 +1452,10 @@ bool SwCursor::SelectWordWT( SwViewShell const * pViewShell, sal_Int16 nWordType } else { - bool bForward = true; sal_Int32 nPtPos = GetPoint()->GetContentIndex(); HideWrapper w(pViewShell->GetLayout(), pTextNd, nPtPos); + bool bForward = w.m_pText->getLength() == w.m_nPtIndex ? false : true; Boundary aBndry( g_pBreakIt->GetBreakIter()->getWordBoundary( *w.m_pText, w.m_nPtIndex, diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx index 6c0d4c2dda0b..fc7f69b3d8de 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -200,7 +200,7 @@ public: // select word / sentence bool SelNearestWrd(); - SW_DLLPUBLIC bool SelWrd(const Point * = nullptr ); + SW_DLLPUBLIC bool SelWrd(const Point * = nullptr, sal_Int16 nWordType = i18n::WordType::ANYWORD_IGNOREWHITESPACES ); // #i32329# Enhanced selection void SelSentence (const Point *); SW_DLLPUBLIC void SelPara (const Point *); diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index 93020de3bad2..77f300367f50 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -90,6 +90,8 @@ #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <IDocumentUndoRedo.hxx> #include <formatcontentcontrol.hxx> +#include <com/sun/star/i18n/WordType.hpp> + using namespace ::com::sun::star; @@ -894,16 +896,8 @@ void SwTextShell::ExecRotateTransliteration( SfxRequest const & rReq ) else { if (bSentenceCase) - { - if (!rSh.IsEndSentence()) - rSh.EndSentence(false); - } - if (rSh.IsEndSentence()) - { - rSh.BwdSentence(true); - rSh.TransliterateText(transFlags); - } - else if ((rSh.IsEndWrd() || rSh.IsStartWord() || rSh.IsInWord()) && rSh.SelWrd()) + transFlags = m_aRotateCase.getNextMode(); + if ((rSh.IsEndWrd() || rSh.IsStartWord() || rSh.IsInWord()) && rSh.SelWrd(nullptr, i18n::WordType::WORD_COUNT)) rSh.TransliterateText(transFlags); } } diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx index 3ae5842f6187..d104ce90aa9b 100644 --- a/sw/source/uibase/wrtsh/select.cxx +++ b/sw/source/uibase/wrtsh/select.cxx @@ -79,13 +79,13 @@ bool SwWrtShell::SelNearestWrd() return SelWrd(); } -bool SwWrtShell::SelWrd(const Point *pPt ) +bool SwWrtShell::SelWrd(const Point *pPt, sal_Int16 nWordType ) { bool bRet; { SwMvContext aMvContext(this); SttSelect(); - bRet = SwCursorShell::SelectWord( pPt ); + bRet = SwCursorShell::SelectWordWT( pPt, nWordType ); } EndSelect(); if( bRet ) |