diff options
author | Thomas Lange <tl@openoffice.org> | 2009-07-13 11:08:01 +0000 |
---|---|---|
committer | Thomas Lange <tl@openoffice.org> | 2009-07-13 11:08:01 +0000 |
commit | 40adaff038edd3c03fb20d94c0c54e79229b671a (patch) | |
tree | 7591b09accb01febe71250076eb3f98c4269dc98 | |
parent | 1d48afcbaa598d3baae341650dbdc7e352308e3a (diff) |
#i1601# sentence case transliteration
-rw-r--r-- | starmath/sdi/svxitems.sdi | 1 | ||||
-rw-r--r-- | sw/inc/editsh.hxx | 1 | ||||
-rw-r--r-- | sw/sdi/_textsh.sdi | 6 | ||||
-rwxr-xr-x | sw/sdi/annotsh.sdi | 7 | ||||
-rw-r--r-- | sw/source/core/edit/editsh.cxx | 25 | ||||
-rw-r--r-- | sw/source/ui/config/modcfg.cxx | 2 | ||||
-rwxr-xr-x | sw/source/ui/shells/annotsh.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/shells/drwtxtsh.cxx | 6 | ||||
-rw-r--r-- | sw/source/ui/shells/textsh.cxx | 10 | ||||
-rw-r--r-- | sw/uiconfig/swriter/menubar/menubar.xml | 1 |
10 files changed, 56 insertions, 7 deletions
diff --git a/starmath/sdi/svxitems.sdi b/starmath/sdi/svxitems.sdi index a071a52f83..d382f2fba6 100644 --- a/starmath/sdi/svxitems.sdi +++ b/starmath/sdi/svxitems.sdi @@ -48,6 +48,7 @@ enum SvxCaseMap SVX_CASEMAP_VERSALIEN, SVX_CASEMAP_GEMEINE, SVX_CASEMAP_TITEL, + SVX_CASEMAP_SENTENCE, SVX_CASEMAP_KAPITAELCHEN, SVX_CASEMAP_END }; diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 57a3c1e701..d6962d1b65 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -201,6 +201,7 @@ public: // change text to Upper/Lower/Hiragana/Katagana/... void TransliterateText( sal_uInt32 nType ); + void TransliterateText( const String& rModuleName ); // count words in current selection void CountWords( SwDocStat& rStat ) const; diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi index b09e5f74b1..0604777ffe 100644 --- a/sw/sdi/_textsh.sdi +++ b/sw/sdi/_textsh.sdi @@ -1495,6 +1495,12 @@ interface BaseText StateMethod = NoState ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_TRANSLITERATE_SENTENCE_CASE + [ + ExecMethod = ExecTransliteration; + StateMethod = NoState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] SID_TRANSLITERATE_HALFWIDTH [ ExecMethod = ExecTransliteration; diff --git a/sw/sdi/annotsh.sdi b/sw/sdi/annotsh.sdi index eb842e6ab0..5ba49134fa 100755 --- a/sw/sdi/annotsh.sdi +++ b/sw/sdi/annotsh.sdi @@ -194,6 +194,13 @@ interface Annotation : _Annotation StateMethod = NoState ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + + SID_TRANSLITERATE_SENTENCE_CASE + [ + ExecMethod = ExecTransliteration; + StateMethod = NoState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] SID_TRANSLITERATE_HALFWIDTH [ diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 0a033d9ed3..11efef9fca 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -1179,6 +1179,31 @@ void SwEditShell::TransliterateText( sal_uInt32 nType ) EndAllAction(); } +void SwEditShell::TransliterateText( const String& rModuleName ) +{ + utl::TransliterationWrapper aTrans(::comphelper::getProcessServiceFactory(), 0 ); + aTrans.loadModuleByImplName( rModuleName, LANGUAGE_SYSTEM ); + StartAllAction(); + SET_CURR_SHELL( this ); + + SwPaM* pCrsr = GetCrsr(); + if( pCrsr->GetNext() != pCrsr ) + { + GetDoc()->StartUndo(UNDO_EMPTY, NULL); + FOREACHPAM_START( this ) + + if( PCURCRSR->HasMark() ) + GetDoc()->TransliterateText( *PCURCRSR, aTrans ); + + FOREACHPAM_END() + GetDoc()->EndUndo(UNDO_EMPTY, NULL); + } + else + GetDoc()->TransliterateText( *pCrsr, aTrans ); + + EndAllAction(); +} + void SwEditShell::CountWords( SwDocStat& rStat ) const { FOREACHPAM_START( this ) diff --git a/sw/source/ui/config/modcfg.cxx b/sw/source/ui/config/modcfg.cxx index 3f004af143..e22dfeb02c 100644 --- a/sw/source/ui/config/modcfg.cxx +++ b/sw/source/ui/config/modcfg.cxx @@ -328,6 +328,7 @@ sal_Int32 lcl_ConvertAttrToCfg(const AuthorCharAttr& rAttr) case SVX_CASEMAP_GEMEINE : nRet = 6;break; case SVX_CASEMAP_KAPITAELCHEN: nRet = 7;break; case SVX_CASEMAP_TITEL : nRet = 8;break; + case SVX_CASEMAP_SENTENCE : nRet = 10;break; } } break; @@ -386,6 +387,7 @@ void lcl_ConvertCfgToAttr(sal_Int32 nVal, AuthorCharAttr& rAttr, sal_Bool bDelet case 6: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.nAttr = SVX_CASEMAP_GEMEINE ; break; case 7: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.nAttr = SVX_CASEMAP_KAPITAELCHEN ; break; case 8: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.nAttr = SVX_CASEMAP_TITEL ; break; + case 10:rAttr.nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.nAttr = SVX_CASEMAP_SENTENCE ; break; case 9: rAttr.nItemId = SID_ATTR_BRUSH; break; } } diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index 124471389c..24d9d39db6 100755 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -34,6 +34,7 @@ #include <tools/shl.hxx> #include <com/sun/star/i18n/TransliterationModules.hpp> +#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> #include <com/sun/star/i18n/TextConversionOption.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/lang/XInitialization.hpp> @@ -1292,6 +1293,9 @@ void SwAnnotationShell::ExecTransliteration(SfxRequest &rReq) case SID_TRANSLITERATE_LOWER: nMode = TransliterationModules_UPPERCASE_LOWERCASE; break; + case SID_TRANSLITERATE_SENTENCE_CASE: + nMode = TransliterationModulesExtra::SENTENCE_CASE; + break; case SID_TRANSLITERATE_HALFWIDTH: nMode = TransliterationModules_FULLWIDTH_HALFWIDTH; break; diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx index 7ba01b121f..baab2e0696 100644 --- a/sw/source/ui/shells/drwtxtsh.cxx +++ b/sw/source/ui/shells/drwtxtsh.cxx @@ -55,6 +55,7 @@ #include <svx/svdoutl.hxx> #include <unoobj.hxx> #include <com/sun/star/i18n/TransliterationModules.hpp> +#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> #include <com/sun/star/i18n/TextConversionOption.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/lang/XInitialization.hpp> @@ -739,14 +740,15 @@ void SwDrawTextShell::ExecTransliteration( SfxRequest & rReq ) case SID_TRANSLITERATE_LOWER: nMode = TransliterationModules_UPPERCASE_LOWERCASE; break; - + case SID_TRANSLITERATE_SENTENCE_CASE: + nMode = TransliterationModulesExtra::SENTENCE_CASE; + break; case SID_TRANSLITERATE_HALFWIDTH: nMode = TransliterationModules_FULLWIDTH_HALFWIDTH; break; case SID_TRANSLITERATE_FULLWIDTH: nMode = TransliterationModules_HALFWIDTH_FULLWIDTH; break; - case SID_TRANSLITERATE_HIRAGANA: nMode = TransliterationModules_KATAKANA_HIRAGANA; break; diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx index 046beba2ca..b8bf1a15ca 100644 --- a/sw/source/ui/shells/textsh.cxx +++ b/sw/source/ui/shells/textsh.cxx @@ -71,9 +71,8 @@ #include <svx/htmlmode.hxx> #include <svx/pfiledlg.hxx> #include <svx/htmlcfg.hxx> -#ifndef _COM_SUN_STAR_I18N_TRANSLITERATIONMODULES_HDL_ -#include <com/sun/star/i18n/TransliterationModules.hdl> -#endif +#include <com/sun/star/i18n/TransliterationModules.hpp> +#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> #include <sot/clsids.hxx> #include <svx/acorrcfg.hxx> @@ -1051,14 +1050,15 @@ void SwTextShell::ExecTransliteration( SfxRequest & rReq ) case SID_TRANSLITERATE_LOWER: nMode = TransliterationModules_UPPERCASE_LOWERCASE; break; - + case SID_TRANSLITERATE_SENTENCE_CASE: + nMode = TransliterationModulesExtra::SENTENCE_CASE; + break; case SID_TRANSLITERATE_HALFWIDTH: nMode = TransliterationModules_FULLWIDTH_HALFWIDTH; break; case SID_TRANSLITERATE_FULLWIDTH: nMode = TransliterationModules_HALFWIDTH_FULLWIDTH; break; - case SID_TRANSLITERATE_HIRAGANA: nMode = TransliterationModules_KATAKANA_HIRAGANA; break; diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml index 7c44f84982..d0f838e4c6 100644 --- a/sw/uiconfig/swriter/menubar/menubar.xml +++ b/sw/uiconfig/swriter/menubar/menubar.xml @@ -221,6 +221,7 @@ <menu:menupopup> <menu:menuitem menu:id=".uno:ChangeCaseToUpper"/> <menu:menuitem menu:id=".uno:ChangeCaseToLower"/> + <menu:menuitem menu:id=".uno:ChangeCaseToSentenceCase"/> <menu:menuitem menu:id=".uno:ChangeCaseToHalfWidth"/> <menu:menuitem menu:id=".uno:ChangeCaseToFullWidth"/> <menu:menuitem menu:id=".uno:ChangeCaseToHiragana"/> |