summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedricbosdo@openoffice.org>2010-01-21 13:58:49 +0100
committerCédric Bosdonnat <cedricbosdo@openoffice.org>2010-01-21 13:58:49 +0100
commitd43e8de87f6dddbb1a9af9d2f4a8f6d77f246d79 (patch)
treed49a25b9bef4188c717df4ae207788d86da61c21 /sw/source/core
parent7081bd29f9bb5a10099799365075a90eb5aab8e5 (diff)
cbosdo01: Changed the behaviour of nbsp autocorr
* The Non-breaking space insertion autocorrection is now done when typing the :!?; character instead of the word separator following it. * Removed the custom quote replacement option in autocorrection.
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/edit/autofmt.cxx36
1 files changed, 27 insertions, 9 deletions
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index e77f1bad98d3..f100ecbe7aa4 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -1892,8 +1892,13 @@ void SwAutoFormat::BuildHeadLine( USHORT nLvl )
// dann lasse doch mal das AutoCorrect auf den akt. TextNode los
void SwAutoFormat::AutoCorrect( xub_StrLen nPos )
{
+ SvxAutoCorrect* pATst = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ long aSvxFlags = pATst->GetFlags( );
+ bool bReplaceQuote = ( aSvxFlags & ChgQuotes ) > 0;
+ bool bReplaceSglQuote = ( aSvxFlags & ChgSglQuotes ) > 0;
+
if( aFlags.bAFmtByInput ||
- (!aFlags.bAutoCorrect && !aFlags.bReplaceQuote &&
+ (!aFlags.bAutoCorrect && !bReplaceQuote && !bReplaceSglQuote &&
!aFlags.bCptlSttSntnc && !aFlags.bCptlSttWrd &&
!aFlags.bChgOrdinalNumber &&
!aFlags.bChgToEnEmDash && !aFlags.bSetINetAttr &&
@@ -1915,7 +1920,6 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos )
aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, 0 );
SwAutoCorrDoc aACorrDoc( *pEditShell, aDelPam );
- SvxAutoCorrect* pATst = SvxAutoCorrCfg::Get()->GetAutoCorrect();
SwTxtFrmInfo aFInfo( 0 );
@@ -1931,8 +1935,8 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos )
if( nPos == pTxt->Len() )
break; // das wars
- if( aFlags.bReplaceQuote &&
- ( '\"' == cChar || '\'' == cChar ) &&
+ if( ( ( bReplaceQuote && '\"' == cChar ) ||
+ ( bReplaceSglQuote && '\'' == cChar ) ) &&
( !nPos || ' ' == pTxt->GetChar( nPos-1 ) ) )
{
// --------------------------------------
@@ -1985,7 +1989,7 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos )
{
case '\"':
case '\'':
- if( aFlags.bReplaceQuote )
+ if( ( cChar == '\"' && bReplaceQuote ) || ( cChar == '\'' && bReplaceSglQuote ) )
{
// --------------------------------------
// beachte: Sonderfall Symbolfonts !!!
@@ -2070,6 +2074,18 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos )
}
}
break;
+ case '/':
+ if ( aFlags.bAddNonBrkSpace )
+ {
+ LanguageType eLang = (bGetLanguage && pAktTxtNd)
+ ? pAktTxtNd->GetLang( nSttPos )
+ : LANGUAGE_SYSTEM;
+
+ SetRedlineTxt( STR_AUTOFMTREDL_NON_BREAK_SPACE );
+ if ( pATst->FnAddNonBrkSpace( aACorrDoc, *pTxt, nSttPos, nPos, eLang ) )
+ --nPos;
+ }
+ break;
case '.':
case '!':
@@ -2078,7 +2094,6 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos )
bFirstSent = TRUE;
//alle Wortrenner loesen die Autokorrektur aus!
// break;
-
default:
//alle Wortrenner loesen die Autokorrektur aus!
// case ' ':
@@ -2127,15 +2142,18 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos )
? pAktTxtNd->GetLang( nSttPos )
: LANGUAGE_SYSTEM;
+ if ( aFlags.bAddNonBrkSpace )
+ {
+ SetRedlineTxt( STR_AUTOFMTREDL_NON_BREAK_SPACE );
+ pATst->FnAddNonBrkSpace( aACorrDoc, *pTxt, nSttPos, nPos, eLang );
+ }
+
if( ( aFlags.bChgOrdinalNumber &&
SetRedlineTxt( STR_AUTOFMTREDL_ORDINAL ) &&
pATst->FnChgOrdinalNumber( aACorrDoc, *pTxt, nSttPos, nPos, eLang ) ) ||
( aFlags.bChgToEnEmDash &&
SetRedlineTxt( STR_AUTOFMTREDL_DASH ) &&
pATst->FnChgToEnEmDash( aACorrDoc, *pTxt, nSttPos, nPos, eLang ) ) ||
- ( aFlags.bAddNonBrkSpace &&
- SetRedlineTxt( STR_AUTOFMTREDL_NON_BREAK_SPACE ) &&
- pATst->FnAddNonBrkSpace( aACorrDoc, *pTxt, nSttPos, nPos, eLang ) ) ||
( aFlags.bSetINetAttr &&
( nPos == pTxt->Len() || IsSpace( pTxt->GetChar( nPos )) ) &&
SetRedlineTxt( STR_AUTOFMTREDL_DETECT_URL ) &&