diff options
author | Vladimir Glazunov <vg@openoffice.org> | 2010-02-16 18:29:26 +0100 |
---|---|---|
committer | Vladimir Glazunov <vg@openoffice.org> | 2010-02-16 18:29:26 +0100 |
commit | 3c248f165dbe07a7a1d9087cb4dd8f53768f4821 (patch) | |
tree | 9f7f85709dfef14403e0021409de536c27945af3 /editeng | |
parent | 3ccb6c9e3a33c0b95dafc1fb0071dc5df50ce49a (diff) | |
parent | df281dde0af441f66d1be324b33571d575af77a0 (diff) |
CWS-TOOLING: integrate CWS cbosdo01
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editeng/svxacorr.hxx | 12 | ||||
-rw-r--r-- | editeng/inc/editeng/swafopt.hxx | 3 | ||||
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 4 | ||||
-rw-r--r-- | editeng/source/misc/acorrcfg.cxx | 185 | ||||
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 144 | ||||
-rw-r--r-- | editeng/source/misc/swafopt.cxx | 6 |
6 files changed, 199 insertions, 155 deletions
diff --git a/editeng/inc/editeng/svxacorr.hxx b/editeng/inc/editeng/svxacorr.hxx index fe8cf1196593..3ebb0ae9e69f 100644 --- a/editeng/inc/editeng/svxacorr.hxx +++ b/editeng/inc/editeng/svxacorr.hxx @@ -54,7 +54,7 @@ class SotStorage; // Flags fuer die AutoKorrekt-Flags const long CptlSttSntnc = 0x00000001; // Gross-Buchstaben am SatzAnfang const long CptlSttWrd = 0x00000002; // keine 2 Gr.-Buchst. am WordAnfang -const long ChgFractionSymbol= 0x00000004; // 1/2, 1/4, .. ersetzen +const long AddNonBrkSpace = 0x00000004; // Add non breaking space before :;?! const long ChgOrdinalNumber = 0x00000008; // Ordinal-Number 1st, 2nd,.. const long ChgToEnEmDash = 0x00000010; // - -> Endash/Emdash const long ChgWeightUnderl = 0x00000020; // * -> Fett, _ -> unterstreichen @@ -63,7 +63,7 @@ const long Autocorrect = 0x00000080; // Autokorrektur aufrufen const long ChgQuotes = 0x00000100; // doppelte Quotes ersetzen const long SaveWordCplSttLst= 0x00000200; // GrB. am SatzAnf. auto. aufnehmen const long SaveWordWrdSttLst= 0x00000400; // 2 GrB. am WortAnf. auto. aufnehmen -const long IngnoreDoubleSpace= 0x00000800; // 2 Spaces ignorieren +const long IgnoreDoubleSpace= 0x00000800; // 2 Spaces ignorieren const long ChgSglQuotes = 0x00001000; // einfache Quotes ersetzen const long ChgWordLstLoad = 0x20000000; // Ersetzungsliste geladen @@ -216,7 +216,6 @@ class EDITENG_DLLPUBLIC SvxAutoCorrect long nFlags; sal_Unicode cStartDQuote, cEndDQuote, cStartSQuote, cEndSQuote, - c1Div2, c1Div4, c3Div4, cEmDash, cEnDash; @@ -359,14 +358,15 @@ public: BOOL FnCptlSttWrd( SvxAutoCorrDoc&, const String&, xub_StrLen nSttPos, xub_StrLen nEndPos, LanguageType eLang = LANGUAGE_SYSTEM ); - BOOL FnChgFractionSymbol( SvxAutoCorrDoc&, const String&, - xub_StrLen nSttPos, xub_StrLen nEndPos ); BOOL FnChgOrdinalNumber( SvxAutoCorrDoc&, const String&, xub_StrLen nSttPos, xub_StrLen nEndPos, LanguageType eLang = LANGUAGE_SYSTEM ); BOOL FnChgToEnEmDash( SvxAutoCorrDoc&, const String&, xub_StrLen nSttPos, xub_StrLen nEndPos, LanguageType eLang = LANGUAGE_SYSTEM ); + BOOL FnAddNonBrkSpace( SvxAutoCorrDoc&, const String&, + xub_StrLen nSttPos, xub_StrLen nEndPos, + LanguageType eLang = LANGUAGE_SYSTEM ); BOOL FnSetINetAttr( SvxAutoCorrDoc&, const String&, xub_StrLen nSttPos, xub_StrLen nEndPos, LanguageType eLang = LANGUAGE_SYSTEM ); @@ -384,6 +384,8 @@ public: // (used to avoid occasional 'collisions' with (Thai) input-sequence-checking) static sal_Bool IsAutoCorrectChar( sal_Unicode cChar ); + sal_Bool NeedsHardspaceAutocorr( sal_Unicode cChar ); + CharClass& GetCharClass( LanguageType eLang ) { if( !pCharClass || eLang != eCharClassLang ) diff --git a/editeng/inc/editeng/swafopt.hxx b/editeng/inc/editeng/swafopt.hxx index 2cb67ee2b43b..bcd37c8e3983 100644 --- a/editeng/inc/editeng/swafopt.hxx +++ b/editeng/inc/editeng/swafopt.hxx @@ -52,7 +52,6 @@ struct EDITENG_DLLPUBLIC SvxSwAutoFmtFlags BYTE nRightMargin; - BOOL bReplaceQuote : 1; BOOL bAutoCorrect : 1; BOOL bCptlSttSntnc : 1; BOOL bCptlSttWrd : 1; @@ -65,9 +64,9 @@ struct EDITENG_DLLPUBLIC SvxSwAutoFmtFlags BOOL bDelEmptyNode : 1; BOOL bSetNumRule : 1; - BOOL bChgFracionSymbol : 1; BOOL bChgOrdinalNumber : 1; BOOL bChgToEnEmDash : 1; + BOOL bAddNonBrkSpace : 1; BOOL bChgWeightUnderl : 1; BOOL bSetINetAttr : 1; diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index e3aac4fe8c1a..b09ad506bcda 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -1148,9 +1148,7 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie pEditView->pImpEditView->DrawSelection(); // Autokorrektur ? if ( ( pImpEditEngine->GetStatus().DoAutoCorrect() ) && - ( ( nCharCode == ' ' ) || ( nCharCode == '*' ) || - ( nCharCode == '\"' ) || ( nCharCode == '\'' ) || - ( nCharCode == '_' ) )) + SvxAutoCorrect::IsAutoCorrectChar( nCharCode ) ) { aCurSel = pImpEditEngine->AutoCorrect( aCurSel, nCharCode, !pEditView->IsInsertMode() ); } diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx index 30295c2b7094..95ce034a11d3 100644 --- a/editeng/source/misc/acorrcfg.cxx +++ b/editeng/source/misc/acorrcfg.cxx @@ -113,7 +113,7 @@ Sequence<OUString> SvxBaseAutoCorrCfg::GetPropertyNames() "ChangeUnderlineWeight", // 5 "SetInetAttribute", // 6 "ChangeOrdinalNumber", // 7 - "ChangeFraction", // 8 + "AddNonBreakingSpace", // 8 "ChangeDash", // 9 "RemoveDoubleSpaces", // 10 "ReplaceSingleQuote", // 11 @@ -183,17 +183,17 @@ void SvxBaseAutoCorrCfg::Load(sal_Bool bInit) if(*(sal_Bool*)pValues[nProp].getValue()) nFlags |= ChgOrdinalNumber; break;//"ChangeOrdinalNumber", - case 8: + case 8: if(*(sal_Bool*)pValues[nProp].getValue()) - nFlags |= ChgFractionSymbol; - break;//"ChangeFraction", + nFlags |= AddNonBrkSpace; + break;//"AddNonBreakingSpace" case 9: if(*(sal_Bool*)pValues[nProp].getValue()) nFlags |= ChgToEnEmDash; break;//"ChangeDash", case 10: if(*(sal_Bool*)pValues[nProp].getValue()) - nFlags |= IngnoreDoubleSpace; + nFlags |= IgnoreDoubleSpace; break;//"RemoveDoubleSpaces", case 11: if(*(sal_Bool*)pValues[nProp].getValue()) @@ -295,16 +295,16 @@ void SvxBaseAutoCorrCfg::Commit() bVal = 0 != (nFlags & ChgOrdinalNumber); pValues[nProp].setValue(&bVal, rType); break;//"ChangeOrdinalNumber", - case 8: - bVal = 0 != (nFlags & ChgFractionSymbol); + case 8: + bVal = 0 != (nFlags & AddNonBrkSpace); pValues[nProp].setValue(&bVal, rType); - break;//"ChangeFraction", + break;//"AddNonBreakingSpace" case 9: bVal = 0 != (nFlags & ChgToEnEmDash); pValues[nProp].setValue(&bVal, rType); break;//"ChangeDash", case 10: - bVal = 0 != (nFlags & IngnoreDoubleSpace); + bVal = 0 != (nFlags & IgnoreDoubleSpace); pValues[nProp].setValue(&bVal, rType); break;//"RemoveDoubleSpaces", case 11: @@ -356,7 +356,7 @@ Sequence<OUString> SvxSwAutoCorrCfg::GetPropertyNames() "Format/Option/ChangeUnderlineWeight", // 8 "Format/Option/SetInetAttribute", // 9 "Format/Option/ChangeOrdinalNumber", //10 - "Format/Option/ChangeFraction", //11 + "Format/Option/AddNonBreakingSpace", //11 "Format/Option/ChangeDash", //12 "Format/Option/DelEmptyParagraphs", //13 "Format/Option/ReplaceUserStyle", //14 @@ -366,35 +366,34 @@ Sequence<OUString> SvxSwAutoCorrCfg::GetPropertyNames() "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily", //18 "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset", //19 "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch", //20 - "Format/Option/ReplaceQuote", //21 - "Format/Option/CombineParagraphs", //22 - "Format/Option/CombineValue", //23 - "Format/Option/DelSpacesAtStartEnd", //24 - "Format/Option/DelSpacesBetween", //25 - "Format/ByInput/Enable", //26 - "Format/ByInput/ChangeDash", //27 - "Format/ByInput/ApplyNumbering/Enable", //28 - "Format/ByInput/ChangeToBorders", //29 - "Format/ByInput/ChangeToTable", //30 - "Format/ByInput/ReplaceStyle", //31 - "Format/ByInput/DelSpacesAtStartEnd", //32 - "Format/ByInput/DelSpacesBetween", //33 - "Completion/Enable", //34 - "Completion/MinWordLen", //35 - "Completion/MaxListLen", //36 - "Completion/CollectWords", //37 - "Completion/EndlessList", //38 - "Completion/AppendBlank", //39 - "Completion/ShowAsTip", //40 - "Completion/AcceptKey", //41 - "Completion/KeepList", //42 - "Format/ByInput/ApplyNumbering/SpecialCharacter/Char", //43 - "Format/ByInput/ApplyNumbering/SpecialCharacter/Font", //44 - "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily", //45 - "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset", //46 - "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch", //47 + "Format/Option/CombineParagraphs", //21 + "Format/Option/CombineValue", //22 + "Format/Option/DelSpacesAtStartEnd", //23 + "Format/Option/DelSpacesBetween", //24 + "Format/ByInput/Enable", //25 + "Format/ByInput/ChangeDash", //26 + "Format/ByInput/ApplyNumbering/Enable", //27 + "Format/ByInput/ChangeToBorders", //28 + "Format/ByInput/ChangeToTable", //29 + "Format/ByInput/ReplaceStyle", //30 + "Format/ByInput/DelSpacesAtStartEnd", //31 + "Format/ByInput/DelSpacesBetween", //32 + "Completion/Enable", //33 + "Completion/MinWordLen", //34 + "Completion/MaxListLen", //35 + "Completion/CollectWords", //36 + "Completion/EndlessList", //37 + "Completion/AppendBlank", //38 + "Completion/ShowAsTip", //39 + "Completion/AcceptKey", //40 + "Completion/KeepList", //41 + "Format/ByInput/ApplyNumbering/SpecialCharacter/Char", //42 + "Format/ByInput/ApplyNumbering/SpecialCharacter/Font", //43 + "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily", //44 + "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset", //45 + "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch" //46 }; - const int nCount = 48; + const int nCount = 47; Sequence<OUString> aNames(nCount); OUString* pNames = aNames.getArray(); for(int i = 0; i < nCount; i++) @@ -432,7 +431,7 @@ void SvxSwAutoCorrCfg::Load(sal_Bool bInit) case 8: rSwFlags.bChgWeightUnderl = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ChangeUnderlineWeight", case 9: rSwFlags.bSetINetAttr = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/SetInetAttribute", case 10: rSwFlags.bChgOrdinalNumber = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ChangeOrdinalNumber", - case 11: rSwFlags.bChgFracionSymbol = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ChangeFraction", + case 11: rSwFlags.bAddNonBrkSpace = *(sal_Bool*)pValues[nProp].getValue( ); break; // "Format/Option/AddNonBreakingSpace", // it doesn't exist here - the common flags are used for that -> LM // case 12: rSwFlags.bChgToEnEmDash = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ChangeDash", case 13: rSwFlags.bDelEmptyNode = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/DelEmptyParagraphs", @@ -469,78 +468,77 @@ void SvxSwAutoCorrCfg::Load(sal_Bool bInit) rSwFlags.aBulletFont.SetPitch(FontPitch(nVal)); } break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch", - case 21: rSwFlags.bReplaceQuote = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ReplaceQuote", - case 22: rSwFlags.bRightMargin = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/CombineParagraphs", - case 23: + case 21: rSwFlags.bRightMargin = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/CombineParagraphs", + case 22: { sal_Int32 nVal = 0; pValues[nProp] >>= nVal; rSwFlags.nRightMargin = sal::static_int_cast< BYTE >(nVal); } break; // "Format/Option/CombineValue", - case 24: rSwFlags.bAFmtDelSpacesAtSttEnd = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/DelSpacesAtStartEnd", - case 25: rSwFlags.bAFmtDelSpacesBetweenLines = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/DelSpacesBetween", - case 26: rParent.bAutoFmtByInput = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/Enable", - case 27: rSwFlags.bChgToEnEmDash = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ChangeDash", - case 28: rSwFlags.bSetNumRule = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ApplyNumbering/Enable", - case 29: rSwFlags.bSetBorder = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ChangeToBorders", - case 30: rSwFlags.bCreateTable = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ChangeToTable", - case 31: rSwFlags.bReplaceStyles = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ReplaceStyle", - case 32: rSwFlags.bAFmtByInpDelSpacesAtSttEnd = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/DelSpacesAtStartEnd", - case 33: rSwFlags.bAFmtByInpDelSpacesBetweenLines = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/DelSpacesBetween", - case 34: rSwFlags.bAutoCompleteWords = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/Enable", - case 35: + case 23: rSwFlags.bAFmtDelSpacesAtSttEnd = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/DelSpacesAtStartEnd", + case 24: rSwFlags.bAFmtDelSpacesBetweenLines = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/DelSpacesBetween", + case 25: rParent.bAutoFmtByInput = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/Enable", + case 26: rSwFlags.bChgToEnEmDash = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ChangeDash", + case 27: rSwFlags.bSetNumRule = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ApplyNumbering/Enable", + case 28: rSwFlags.bSetBorder = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ChangeToBorders", + case 29: rSwFlags.bCreateTable = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ChangeToTable", + case 30: rSwFlags.bReplaceStyles = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ReplaceStyle", + case 31: rSwFlags.bAFmtByInpDelSpacesAtSttEnd = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/DelSpacesAtStartEnd", + case 32: rSwFlags.bAFmtByInpDelSpacesBetweenLines = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/DelSpacesBetween", + case 33: rSwFlags.bAutoCompleteWords = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/Enable", + case 34: { sal_Int32 nVal = 0; pValues[nProp] >>= nVal; rSwFlags.nAutoCmpltWordLen = sal::static_int_cast< USHORT >(nVal); } break; // "Completion/MinWordLen", - case 36: + case 35: { sal_Int32 nVal = 0; pValues[nProp] >>= nVal; rSwFlags.nAutoCmpltListLen = sal::static_int_cast< USHORT >(nVal); } break; // "Completion/MaxListLen", - case 37: rSwFlags.bAutoCmpltCollectWords = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/CollectWords", - case 38: rSwFlags.bAutoCmpltEndless = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/EndlessList", - case 39: rSwFlags.bAutoCmpltAppendBlanc = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/AppendBlank", - case 40: rSwFlags.bAutoCmpltShowAsTip = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/ShowAsTip", - case 41: + case 36: rSwFlags.bAutoCmpltCollectWords = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/CollectWords", + case 37: rSwFlags.bAutoCmpltEndless = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/EndlessList", + case 38: rSwFlags.bAutoCmpltAppendBlanc = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/AppendBlank", + case 39: rSwFlags.bAutoCmpltShowAsTip = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/ShowAsTip", + case 40: { sal_Int32 nVal = 0; pValues[nProp] >>= nVal; rSwFlags.nAutoCmpltExpandKey = sal::static_int_cast< USHORT >(nVal); } break; // "Completion/AcceptKey" - case 42 :rSwFlags.bAutoCmpltKeepList = *(sal_Bool*)pValues[nProp].getValue(); break;//"Completion/KeepList" - case 43 : + case 41 :rSwFlags.bAutoCmpltKeepList = *(sal_Bool*)pValues[nProp].getValue(); break;//"Completion/KeepList" + case 42 : { sal_Int32 nVal = 0; pValues[nProp] >>= nVal; rSwFlags.cByInputBullet = sal::static_int_cast< sal_Unicode >(nVal); } break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Char", - case 44 : + case 43 : { OUString sTemp; pValues[nProp] >>= sTemp; rSwFlags.aByInputBulletFont.SetName(sTemp); } break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Font", - case 45 : + case 44 : { sal_Int32 nVal = 0; pValues[nProp] >>= nVal; rSwFlags.aByInputBulletFont.SetFamily(FontFamily(nVal)); } break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily", - case 46 : + case 45 : { sal_Int32 nVal = 0; pValues[nProp] >>= nVal; rSwFlags.aByInputBulletFont.SetCharSet(CharSet(nVal)); } break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset", - case 47 : + case 46 : { sal_Int32 nVal = 0; pValues[nProp] >>= nVal; rSwFlags.aByInputBulletFont.SetPitch(FontPitch(nVal)); @@ -593,7 +591,7 @@ void SvxSwAutoCorrCfg::Commit() case 8: bVal = rSwFlags.bChgWeightUnderl; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/ChangeUnderlineWeight", case 9: bVal = rSwFlags.bSetINetAttr; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/SetInetAttribute", case 10: bVal = rSwFlags.bChgOrdinalNumber; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/ChangeOrdinalNumber", - case 11: bVal = rSwFlags.bChgFracionSymbol; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/ChangeFraction", + case 11: bVal = rSwFlags.bAddNonBrkSpace; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/AddNonBreakingSpace", // it doesn't exist here - the common flags are used for that -> LM case 12: bVal = sal_True; pValues[nProp].setValue(&bVal, rType); @@ -616,49 +614,48 @@ void SvxSwAutoCorrCfg::Commit() case 20: pValues[nProp] <<= (sal_Int32)rSwFlags.aBulletFont.GetPitch(); break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch", - case 21: bVal = rSwFlags.bReplaceQuote; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/ReplaceQuote", - case 22: bVal = rSwFlags.bRightMargin; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/CombineParagraphs", - case 23: + case 21: bVal = rSwFlags.bRightMargin; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/CombineParagraphs", + case 22: pValues[nProp] <<= (sal_Int32)rSwFlags.nRightMargin; break; // "Format/Option/CombineValue", - case 24: bVal = rSwFlags.bAFmtDelSpacesAtSttEnd; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/DelSpacesAtStartEnd", - case 25: bVal = rSwFlags.bAFmtDelSpacesBetweenLines; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/DelSpacesBetween", - case 26: bVal = rParent.bAutoFmtByInput; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/Enable", - case 27: bVal = rSwFlags.bChgToEnEmDash; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ChangeDash", - case 28: bVal = rSwFlags.bSetNumRule; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ApplyNumbering/Enable", - case 29: bVal = rSwFlags.bSetBorder; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ChangeToBorders", - case 30: bVal = rSwFlags.bCreateTable; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ChangeToTable", - case 31: bVal = rSwFlags.bReplaceStyles; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ReplaceStyle", - case 32: bVal = rSwFlags.bAFmtByInpDelSpacesAtSttEnd; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/DelSpacesAtStartEnd", - case 33: bVal = rSwFlags.bAFmtByInpDelSpacesBetweenLines; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/DelSpacesBetween", - case 34: bVal = rSwFlags.bAutoCompleteWords; pValues[nProp].setValue(&bVal, rType); break; // "Completion/Enable", - case 35: + case 23: bVal = rSwFlags.bAFmtDelSpacesAtSttEnd; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/DelSpacesAtStartEnd", + case 24: bVal = rSwFlags.bAFmtDelSpacesBetweenLines; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/DelSpacesBetween", + case 25: bVal = rParent.bAutoFmtByInput; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/Enable", + case 26: bVal = rSwFlags.bChgToEnEmDash; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ChangeDash", + case 27: bVal = rSwFlags.bSetNumRule; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ApplyNumbering/Enable", + case 28: bVal = rSwFlags.bSetBorder; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ChangeToBorders", + case 29: bVal = rSwFlags.bCreateTable; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ChangeToTable", + case 30: bVal = rSwFlags.bReplaceStyles; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ReplaceStyle", + case 31: bVal = rSwFlags.bAFmtByInpDelSpacesAtSttEnd; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/DelSpacesAtStartEnd", + case 32: bVal = rSwFlags.bAFmtByInpDelSpacesBetweenLines; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/DelSpacesBetween", + case 33: bVal = rSwFlags.bAutoCompleteWords; pValues[nProp].setValue(&bVal, rType); break; // "Completion/Enable", + case 34: pValues[nProp] <<= (sal_Int32)rSwFlags.nAutoCmpltWordLen; break; // "Completion/MinWordLen", - case 36: + case 35: pValues[nProp] <<= (sal_Int32)rSwFlags.nAutoCmpltListLen; break; // "Completion/MaxListLen", - case 37: bVal = rSwFlags.bAutoCmpltCollectWords; pValues[nProp].setValue(&bVal, rType); break; // "Completion/CollectWords", - case 38: bVal = rSwFlags.bAutoCmpltEndless; pValues[nProp].setValue(&bVal, rType); break; // "Completion/EndlessList", - case 39: bVal = rSwFlags.bAutoCmpltAppendBlanc; pValues[nProp].setValue(&bVal, rType); break; // "Completion/AppendBlank", - case 40: bVal = rSwFlags.bAutoCmpltShowAsTip; pValues[nProp].setValue(&bVal, rType); break; // "Completion/ShowAsTip", - case 41: + case 36: bVal = rSwFlags.bAutoCmpltCollectWords; pValues[nProp].setValue(&bVal, rType); break; // "Completion/CollectWords", + case 37: bVal = rSwFlags.bAutoCmpltEndless; pValues[nProp].setValue(&bVal, rType); break; // "Completion/EndlessList", + case 38: bVal = rSwFlags.bAutoCmpltAppendBlanc; pValues[nProp].setValue(&bVal, rType); break; // "Completion/AppendBlank", + case 39: bVal = rSwFlags.bAutoCmpltShowAsTip; pValues[nProp].setValue(&bVal, rType); break; // "Completion/ShowAsTip", + case 40: pValues[nProp] <<= (sal_Int32)rSwFlags.nAutoCmpltExpandKey; break; // "Completion/AcceptKey" - case 42 :bVal = rSwFlags.bAutoCmpltKeepList; pValues[nProp].setValue(&bVal, rType); break;// "Completion/KeepList" - case 43 : + case 41 :bVal = rSwFlags.bAutoCmpltKeepList; pValues[nProp].setValue(&bVal, rType); break;// "Completion/KeepList" + case 42 : pValues[nProp] <<= (sal_Int32)rSwFlags.cByInputBullet; break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Char", - case 44 : + case 43 : pValues[nProp] <<= OUString(rSwFlags.aByInputBulletFont.GetName()); break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Font", - case 45 : + case 44 : pValues[nProp] <<= (sal_Int32)rSwFlags.aByInputBulletFont.GetFamily(); break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily", - case 46 : + case 45 : pValues[nProp] <<= (sal_Int32)rSwFlags.aByInputBulletFont.GetCharSet(); break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset", - case 47 : + case 46 : pValues[nProp] <<= (sal_Int32)rSwFlags.aByInputBulletFont.GetPitch(); break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch", } diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 4427c1fef69e..fb8bd2ad689b 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/io/XStream.hpp> +#include <com/sun/star/lang/Locale.hpp> #include <tools/urlobj.hxx> #include <tools/table.hxx> #include <i18npool/mslangid.hxx> @@ -76,6 +77,8 @@ #include <xmloff/xmltoken.hxx> #include <vcl/help.hxx> +#define CHAR_HARDBLANK ((sal_Unicode)0x00A0) + using namespace ::com::sun::star::ucb; using namespace ::com::sun::star::uno; using namespace ::com::sun::star; @@ -312,7 +315,13 @@ sal_Bool SvxAutoCorrect::IsAutoCorrectChar( sal_Unicode cChar ) cChar == ' ' || cChar == '\'' || cChar == '\"' || cChar == '*' || cChar == '_' || cChar == '.' || cChar == ',' || cChar == ';' || - cChar == ':' || cChar == '?' || cChar == '!'; + cChar == ':' || cChar == '?' || cChar == '!' || cChar == '/'; +} + +sal_Bool SvxAutoCorrect::NeedsHardspaceAutocorr( sal_Unicode cChar ) +{ + return cChar == ';' || cChar == ':' || cChar == '?' || cChar == '!' || + cChar == '/' /*case for the urls exception*/; } /* -----------------19.11.98 10:15------------------- @@ -323,9 +332,9 @@ long SvxAutoCorrect::GetDefaultFlags() long nRet = Autocorrect | CptlSttSntnc | CptlSttWrd - | ChgFractionSymbol | ChgOrdinalNumber | ChgToEnEmDash + | AddNonBrkSpace | ChgWeightUnderl | SetINetAttr | ChgQuotes @@ -362,9 +371,6 @@ SvxAutoCorrect::SvxAutoCorrect( const String& rShareAutocorrFile, { nFlags = SvxAutoCorrect::GetDefaultFlags(); - c1Div2 = ByteString::ConvertToUnicode( '\xBD', RTL_TEXTENCODING_MS_1252 ); - c1Div4 = ByteString::ConvertToUnicode( '\xBC', RTL_TEXTENCODING_MS_1252 ); - c3Div4 = ByteString::ConvertToUnicode( '\xBE', RTL_TEXTENCODING_MS_1252 ); cEmDash = ByteString::ConvertToUnicode( '\x97', RTL_TEXTENCODING_MS_1252 ); cEnDash = ByteString::ConvertToUnicode( '\x96', RTL_TEXTENCODING_MS_1252 ); } @@ -382,7 +388,6 @@ SvxAutoCorrect::SvxAutoCorrect( const SvxAutoCorrect& rCpy ) nFlags( rCpy.nFlags & ~(ChgWordLstLoad|CplSttLstLoad|WrdSttLstLoad)), cStartDQuote( rCpy.cStartDQuote ), cEndDQuote( rCpy.cEndDQuote ), cStartSQuote( rCpy.cStartSQuote ), cEndSQuote( rCpy.cEndSQuote ), - c1Div2( rCpy.c1Div2 ), c1Div4( rCpy.c1Div4 ), c3Div4( rCpy.c3Div4 ), cEmDash( rCpy.cEmDash ), cEnDash( rCpy.cEnDash ) { } @@ -466,40 +471,6 @@ BOOL SvxAutoCorrect::FnCptlSttWrd( SvxAutoCorrDoc& rDoc, const String& rTxt, } -BOOL SvxAutoCorrect::FnChgFractionSymbol( - SvxAutoCorrDoc& rDoc, const String& rTxt, - xub_StrLen nSttPos, xub_StrLen nEndPos ) -{ - sal_Unicode cChar = 0; - - for( ; nSttPos < nEndPos; ++nSttPos ) - if( !lcl_IsInAsciiArr( sImplSttSkipChars, rTxt.GetChar( nSttPos ) )) - break; - for( ; nSttPos < nEndPos; --nEndPos ) - if( !lcl_IsInAsciiArr( sImplEndSkipChars, rTxt.GetChar( nEndPos - 1 ) )) - break; - - // 1/2, 1/4, ... ersetzen durch das entsprechende Zeichen vom Font - if( 3 == nEndPos - nSttPos && '/' == rTxt.GetChar( nSttPos+1 )) - { - switch( ( rTxt.GetChar( nSttPos )) * 256 + rTxt.GetChar( nEndPos-1 )) - { - case '1' * 256 + '2': cChar = c1Div2; break; - case '1' * 256 + '4': cChar = c1Div4; break; - case '3' * 256 + '4': cChar = c3Div4; break; - } - - if( cChar ) - { - // also austauschen: - rDoc.Delete( nSttPos+1, nEndPos ); - rDoc.Replace( nSttPos, cChar ); - } - } - return 0 != cChar; -} - - BOOL SvxAutoCorrect::FnChgOrdinalNumber( SvxAutoCorrDoc& rDoc, const String& rTxt, xub_StrLen nSttPos, xub_StrLen nEndPos, @@ -671,6 +642,80 @@ BOOL SvxAutoCorrect::FnChgToEnEmDash( return bRet; } +BOOL SvxAutoCorrect::FnAddNonBrkSpace( + SvxAutoCorrDoc& rDoc, const String& rTxt, + xub_StrLen, xub_StrLen nEndPos, + LanguageType eLang ) +{ + bool bRet = false; + + CharClass& rCC = GetCharClass( eLang ); + const lang::Locale rLocale = rCC.getLocale( ); + + if ( rLocale.Language == OUString::createFromAscii( "fr" ) ) + { + bool bFrCA = rLocale.Country == OUString::createFromAscii( "CA" ); + OUString allChars = OUString::createFromAscii( ":;!?" ); + OUString chars( allChars ); + if ( bFrCA ) + chars = OUString::createFromAscii( ":" ); + + sal_Unicode cChar = rTxt.GetChar( nEndPos ); + bool bHasSpace = chars.indexOf( sal_Unicode( cChar ) ) != -1; + bool bIsSpecial = allChars.indexOf( sal_Unicode( cChar ) ) != -1; + if ( bIsSpecial ) + { + // Get the last word delimiter position + xub_StrLen nSttWdPos = nEndPos; + while( nSttWdPos && !IsWordDelim( rTxt.GetChar( --nSttWdPos ))) + ; + + // Check the presence of "://" in the word + xub_StrLen nStrPos = rTxt.Search( String::CreateFromAscii( "://" ), nSttWdPos + 1 ); + if ( STRING_NOTFOUND == nStrPos ) + { + // Check the previous char + sal_Unicode cPrevChar = rTxt.GetChar( nEndPos - 1 ); + if ( ( chars.indexOf( sal_Unicode( cPrevChar ) ) == -1 ) && cPrevChar != '\t' ) + { + // Remove any previous normal space + xub_StrLen nPos = nEndPos - 1; + while ( cPrevChar == ' ' || cPrevChar == CHAR_HARDBLANK ) + { + if ( nPos == 0 ) break; + nPos--; + cPrevChar = rTxt.GetChar( nPos ); + } + + if ( nPos != 0 ) + { + nPos++; + if ( nEndPos - nPos > 0 ) + rDoc.Delete( nPos, nEndPos ); + + // Add the non-breaking space at the end pos + if ( bHasSpace ) + rDoc.Insert( nPos, CHAR_HARDBLANK ); + bRet = true; + } + } + } + } + else if ( cChar == '/' ) + { + // Remove the hardspace right before to avoid formatting URLs + sal_Unicode cPrevChar = rTxt.GetChar( nEndPos - 1 ); + sal_Unicode cMaybeSpaceChar = rTxt.GetChar( nEndPos - 2 ); + if ( cPrevChar == ':' && cMaybeSpaceChar == CHAR_HARDBLANK ) + { + rDoc.Delete( nEndPos - 2, nEndPos - 1 ); + bRet = true; + } + } + } + + return bRet; +} BOOL SvxAutoCorrect::FnSetINetAttr( SvxAutoCorrDoc& rDoc, const String& rTxt, xub_StrLen nSttPos, xub_StrLen nEndPos, @@ -1152,10 +1197,10 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, { //JP 10.02.97: doppelte Spaces verhindern if( nInsPos && ' ' == cChar && - IsAutoCorrFlag( IngnoreDoubleSpace ) && + IsAutoCorrFlag( IgnoreDoubleSpace ) && ' ' == rTxt.GetChar( nInsPos - 1 ) ) { - nRet = IngnoreDoubleSpace; + nRet = IgnoreDoubleSpace; break; } @@ -1183,6 +1228,13 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, rDoc.Insert( nInsPos, cChar ); else rDoc.Replace( nInsPos, cChar ); + + // Hardspaces autocorrection + if ( NeedsHardspaceAutocorr( cChar ) && IsAutoCorrFlag( AddNonBrkSpace ) && + FnAddNonBrkSpace( rDoc, rTxt, 0, nInsPos, rDoc.GetLanguage( nInsPos, FALSE ) ) ) + { + nRet = AddNonBrkSpace; + } } if( !nInsPos ) @@ -1277,9 +1329,7 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, } } - if( ( IsAutoCorrFlag( nRet = ChgFractionSymbol ) && - FnChgFractionSymbol( rDoc, rTxt, nCapLttrPos, nInsPos ) ) || - ( IsAutoCorrFlag( nRet = ChgOrdinalNumber ) && + if( ( IsAutoCorrFlag( nRet = ChgOrdinalNumber ) && FnChgOrdinalNumber( rDoc, rTxt, nCapLttrPos, nInsPos, eLang ) ) || ( IsAutoCorrFlag( nRet = SetINetAttr ) && ( ' ' == cChar || '\t' == cChar || 0x0a == cChar || !cChar ) && @@ -1325,9 +1375,9 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, if( nRet & ChgQuotes) nHelpId = 16; else if( nRet & ChgSglQuotes) nHelpId = 17; else if( nRet & SetINetAttr) nHelpId = 18; - else if( nRet & IngnoreDoubleSpace) nHelpId = 19; + else if( nRet & IgnoreDoubleSpace) nHelpId = 19; else if( nRet & ChgWeightUnderl) nHelpId = 20; - else if( nRet & ChgFractionSymbol ) nHelpId = 21; + else if( nRet & AddNonBrkSpace) nHelpId = 21; else if( nRet & ChgOrdinalNumber) nHelpId = 22; } diff --git a/editeng/source/misc/swafopt.cxx b/editeng/source/misc/swafopt.cxx index e150e8699b76..57a1b1a7b49f 100644 --- a/editeng/source/misc/swafopt.cxx +++ b/editeng/source/misc/swafopt.cxx @@ -44,14 +44,13 @@ SvxSwAutoFmtFlags::SvxSwAutoFmtFlags() RTL_CONSTASCII_STRINGPARAM( "StarSymbol" )), Size( 0, 14 ) ) { - bReplaceQuote = bAutoCorrect = bCptlSttSntnc = bCptlSttWrd = bChkFontAttr = bChgUserColl = bChgEnumNum = - bChgFracionSymbol = + bAddNonBrkSpace = bChgOrdinalNumber = bChgToEnEmDash = bChgWeightUnderl = @@ -104,7 +103,6 @@ SvxSwAutoFmtFlags::SvxSwAutoFmtFlags() SvxSwAutoFmtFlags& SvxSwAutoFmtFlags::operator=( const SvxSwAutoFmtFlags& rAFFlags ) { bAutoCorrect = rAFFlags.bAutoCorrect; - bReplaceQuote = rAFFlags.bReplaceQuote; bCptlSttSntnc = rAFFlags.bCptlSttSntnc; bCptlSttWrd = rAFFlags.bCptlSttWrd; bChkFontAttr = rAFFlags.bChkFontAttr; @@ -115,7 +113,7 @@ SvxSwAutoFmtFlags& SvxSwAutoFmtFlags::operator=( const SvxSwAutoFmtFlags& rAFFla bSetNumRule = rAFFlags.bSetNumRule; bAFmtByInput = rAFFlags.bAFmtByInput; - bChgFracionSymbol = rAFFlags.bChgFracionSymbol; + bAddNonBrkSpace = rAFFlags.bAddNonBrkSpace; bChgOrdinalNumber = rAFFlags.bChgOrdinalNumber; bChgToEnEmDash = rAFFlags.bChgToEnEmDash; bChgWeightUnderl = rAFFlags.bChgWeightUnderl; |