summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/edit/acorrect.cxx4
-rw-r--r--sw/source/core/edit/autofmt.cxx21
-rw-r--r--sw/source/core/inc/acorrect.hxx3
3 files changed, 16 insertions, 12 deletions
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index 1a5ffe5ca762..9a8e45cb137c 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -507,7 +507,7 @@ bool SwAutoCorrDoc::ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
return bRet;
}
-bool SwAutoCorrDoc::TransliterateRTLWord( sal_Int32& rSttPos, sal_Int32 nEndPos )
+bool SwAutoCorrDoc::TransliterateRTLWord( sal_Int32& rSttPos, sal_Int32 nEndPos, bool bApply )
{
if( m_bUndoIdInitialized )
m_bUndoIdInitialized = true;
@@ -530,7 +530,7 @@ bool SwAutoCorrDoc::TransliterateRTLWord( sal_Int32& rSttPos, sal_Int32 nEndPos
const OUString sFrameText = pFrame->GetText();
SwDoc* pDoc = m_rEditSh.GetDoc();
- if ( pFrame->IsRightToLeft() )
+ if ( pFrame->IsRightToLeft() || bApply )
{
// transliterate to Old Hungarian using Numbertext via NatNum12 number format modifier
OUString sWord(sFrameText.copy(rSttPos, nEndPos - rSttPos));
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 12df8e7383e9..0763cc06784c 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -94,6 +94,7 @@ class SwAutoFormat
SwDoc* m_pDoc;
SwTextNode* m_pCurTextNd; // the current TextNode
SwTextFrame* m_pCurTextFrame; // frame of the current TextNode
+ bool m_bIsRightToLeft; // text direction of the current frame
sal_uLong m_nEndNdIdx; // for the percentage-display
mutable std::unique_ptr<CharClass> m_pCharClass; // Character classification
mutable LanguageType m_eCharClassLang;
@@ -336,6 +337,7 @@ void SwAutoFormat::GoNextPara()
m_pCurTextNd = static_cast<SwTextNode*>(pNewNd);
m_pCurTextFrame = GetFrame( *m_pCurTextNd );
+ m_bIsRightToLeft = m_pCurTextFrame->IsRightToLeft();
}
bool SwAutoFormat::HasObjects(const SwTextFrame & rFrame)
@@ -2142,8 +2144,14 @@ void SwAutoFormat::AutoCorrect(TextFrameIndex nPos)
{
*m_aDelPam.GetPoint() = m_pCurTextFrame->MapViewToModelPos(nPos);
SetRedlineText( STR_AUTOFMTREDL_USE_REPLACE );
- if( m_aFlags.bAutoCorrect &&
- aACorrDoc.ChgAutoCorrWord(reinterpret_cast<sal_Int32&>(nSttPos), sal_Int32(nPos), *pATst, nullptr))
+
+ LanguageType eLang = bGetLanguage
+ ? m_pCurTextFrame->GetLangOfChar(nSttPos, 0, true)
+ : LANGUAGE_SYSTEM;
+
+ if( m_bIsRightToLeft && m_aFlags.bTransliterateRTL && eLang == LANGUAGE_HUNGARIAN &&
+ SetRedlineText( STR_AUTOFMTREDL_TRANSLITERATE_RTL ) &&
+ aACorrDoc.TransliterateRTLWord(reinterpret_cast<sal_Int32&>(nSttPos), sal_Int32(nPos), /*bApply=*/true))
{
nPos = m_pCurTextFrame->MapModelToViewPos(*m_aDelPam.GetPoint());
@@ -2160,13 +2168,8 @@ void SwAutoFormat::AutoCorrect(TextFrameIndex nPos)
continue; // do not check further
}
- LanguageType eLang = bGetLanguage
- ? m_pCurTextFrame->GetLangOfChar(nSttPos, 0, true)
- : LANGUAGE_SYSTEM;
-
- if( m_aFlags.bTransliterateRTL && eLang == LANGUAGE_HUNGARIAN &&
- SetRedlineText( STR_AUTOFMTREDL_TRANSLITERATE_RTL ) &&
- aACorrDoc.TransliterateRTLWord(reinterpret_cast<sal_Int32&>(nSttPos), sal_Int32(nPos)))
+ if( m_aFlags.bAutoCorrect &&
+ aACorrDoc.ChgAutoCorrWord(reinterpret_cast<sal_Int32&>(nSttPos), sal_Int32(nPos), *pATst, nullptr) )
{
nPos = m_pCurTextFrame->MapModelToViewPos(*m_aDelPam.GetPoint());
if( m_aFlags.bWithRedlining )
diff --git a/sw/source/core/inc/acorrect.hxx b/sw/source/core/inc/acorrect.hxx
index f8c9c765ec41..ef826f78da04 100644
--- a/sw/source/core/inc/acorrect.hxx
+++ b/sw/source/core/inc/acorrect.hxx
@@ -80,7 +80,8 @@ public:
virtual bool ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
SvxAutoCorrect& rACorrect,
OUString* pPara ) override;
- virtual bool TransliterateRTLWord( sal_Int32& rSttPos, sal_Int32 nEndPos ) override;
+ virtual bool TransliterateRTLWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
+ bool bApply = false ) override;
// Will be called after swapping characters by the functions
// - FnCapitalStartWord and