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 | 2d463da3e91804bbe4a6665adcc80c458b72c545 (patch) | |
tree | 2d9f428e359f2ed418c13f48b1016b2ae418673d | |
parent | dff9ecd2545210c6a006199b7106fdb1a70889d9 (diff) |
#i1601# sentence case transliteration
-rw-r--r-- | configmgr/qa/unit/data/org/openoffice/UI/GenericCommands.xcu | 5 | ||||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 8 | ||||
-rw-r--r-- | svx/inc/globlmn_tmpl.hrc | 7 | ||||
-rw-r--r-- | svx/inc/svx/svxenum.hxx | 1 | ||||
-rw-r--r-- | svx/inc/svx/svxids.hrc | 4 | ||||
-rw-r--r-- | svx/sdi/svx.sdi | 25 | ||||
-rw-r--r-- | svx/sdi/svxitems.sdi | 1 | ||||
-rw-r--r-- | svx/source/cui/chardlg.src | 3 | ||||
-rw-r--r-- | svx/source/items/svxfont.cxx | 40 | ||||
-rw-r--r-- | svx/source/items/textitem.cxx | 2 |
10 files changed, 91 insertions, 5 deletions
diff --git a/configmgr/qa/unit/data/org/openoffice/UI/GenericCommands.xcu b/configmgr/qa/unit/data/org/openoffice/UI/GenericCommands.xcu index f066fb0b96dc..af4fa2ed018f 100644 --- a/configmgr/qa/unit/data/org/openoffice/UI/GenericCommands.xcu +++ b/configmgr/qa/unit/data/org/openoffice/UI/GenericCommands.xcu @@ -2097,6 +2097,11 @@ <value xml:lang="x-no-translate"></value><value xml:lang="en-US">~Lowercase</value> </prop> </node> + <node oor:name=".uno:ChangeCaseToSentenceCase" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="x-no-translate"></value><value xml:lang="en-US">~Sentence Case</value> + </prop> + </node> <node oor:name=".uno:ChangeCaseToHalfWidth" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="x-no-translate"></value><value xml:lang="en-US">H~alf-width</value> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index 23caee9af12d..f3b6bede57f2 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -2122,6 +2122,14 @@ <value>1</value> </prop> </node> + <node oor:name=".uno:ChangeCaseToSentenceCase" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">~Sentence case</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> <node oor:name=".uno:ChangeCaseToHalfWidth" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">H~alf-width</value> diff --git a/svx/inc/globlmn_tmpl.hrc b/svx/inc/globlmn_tmpl.hrc index d40ca4de1876..6b7a9f405872 100644 --- a/svx/inc/globlmn_tmpl.hrc +++ b/svx/inc/globlmn_tmpl.hrc @@ -1355,6 +1355,13 @@ };\ MenuItem\ {\ + Identifier = SID_TRANSLITERATE_SENTENCE_CASE; \ + Command = ".uno:ChangeCaseToSentenceCase" ; \ + HelpID = SID_TRANSLITERATE_SENTENCE_CASE; \ + Text [ en-US ] = "~Sentence case";\ + };\ + MenuItem\ + {\ Identifier = SID_TRANSLITERATE_HALFWIDTH; \ Command = ".uno:ChangeCaseToHalfWidth" ; \ HelpID = SID_TRANSLITERATE_HALFWIDTH; \ diff --git a/svx/inc/svx/svxenum.hxx b/svx/inc/svx/svxenum.hxx index 01a7d80d1351..b70ec600b59d 100644 --- a/svx/inc/svx/svxenum.hxx +++ b/svx/inc/svx/svxenum.hxx @@ -39,6 +39,7 @@ enum SvxCaseMap SVX_CASEMAP_GEMEINE, SVX_CASEMAP_TITEL, SVX_CASEMAP_KAPITAELCHEN, + SVX_CASEMAP_SENTENCE, SVX_CASEMAP_END }; diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc index d7c018bedaac..c741f185a41b 100644 --- a/svx/inc/svx/svxids.hrc +++ b/svx/inc/svx/svxids.hrc @@ -1347,9 +1347,11 @@ #define SID_CHAR_DLG_PREVIEW_STRING (SID_SVX_START+1090) #define SID_RECHECK_DOCUMENT (SID_SVX_START+1091) #define SID_ATTR_PARA_OUTLINE_LEVEL (SID_SVX_START+1092) +#define SID_TRANSLITERATE_SENTENCE_CASE (SID_SVX_START+1093) + // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id -#define SID_SVX_FIRSTFREE SID_ATTR_PARA_OUTLINE_LEVEL + 1 +#define SID_SVX_FIRSTFREE SID_TRANSLITERATE_SENTENCE_CASE + 1 // -------------------------------------------------------------------------- // Overflow check for slot IDs diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index a69aae4cf9fd..3172138d1065 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -1483,6 +1483,31 @@ SfxVoidItem ChangeCaseToLower SID_TRANSLITERATE_LOWER ] //-------------------------------------------------------------------------- +SfxVoidItem ChangeCaseToSentenceCase SID_TRANSLITERATE_SENTENCE_CASE +() +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = TRUE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- SfxVoidItem ChangeCaseToUpper SID_TRANSLITERATE_UPPER () [ diff --git a/svx/sdi/svxitems.sdi b/svx/sdi/svxitems.sdi index 795f2aea1177..11f3b756f8ed 100644 --- a/svx/sdi/svxitems.sdi +++ b/svx/sdi/svxitems.sdi @@ -170,6 +170,7 @@ enum SvxCaseMap SVX_CASEMAP_VERSALIEN, SVX_CASEMAP_GEMEINE, SVX_CASEMAP_TITEL, + SVX_CASEMAP_SENTENCE, SVX_CASEMAP_KAPITAELCHEN, SVX_CASEMAP_END }; diff --git a/svx/source/cui/chardlg.src b/svx/source/cui/chardlg.src index 19ad1e090435..d8c8c662aa5a 100644 --- a/svx/source/cui/chardlg.src +++ b/svx/source/cui/chardlg.src @@ -402,6 +402,9 @@ TabPage RID_SVXPAGE_CHAR_EFFECTS < "Lowercase" ; Default ; > ; < "Title" ; Default ; > ; < "Small capitals" ; Default ; > ; +//#i1601: This specific change would be a file-format change +// and thus needs to be approved by OASIS before being activated +// < "Sentence" ; Default ; > ; }; }; FixedText FT_RELIEF diff --git a/svx/source/items/svxfont.cxx b/svx/source/items/svxfont.cxx index 1ce7190393a7..e4438d494b93 100644 --- a/svx/source/items/svxfont.cxx +++ b/svx/source/items/svxfont.cxx @@ -176,17 +176,49 @@ XubString SvxFont::CalcCaseMap( const XubString &rTxt ) const bBlank = TRUE; else { - if( bBlank ) + String aTemp( aTxt.GetChar( i ) ); + if( bBlank ) { - String aTemp( aTxt.GetChar( i ) ); aCharClass.toUpper( aTemp ); - aTxt.Replace( i, 1, aTemp ); + bBlank = FALSE; + + } + else + { + aCharClass.toLower( aTemp ); } - bBlank = FALSE; + aTxt.Replace( i, 1, aTemp ); + } } break; } + case SVX_CASEMAP_SENTENCE: + { + // SENTENCE CASE + BOOL bPoint = TRUE; + + for( USHORT i = 0; i < aTxt.Len(); ++i ) + { + sal_Unicode c = aTxt.GetChar(i); + if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) + bPoint = TRUE; + else if( sal_Unicode(' ') == c || sal_Unicode('\t') == c ) + ; + else + { + if( bPoint ) + { + String aTemp( c ); + aCharClass.toUpper( aTemp ); + aTxt.Replace( i, 1, aTemp ); + } + bPoint = FALSE; + } + } + break; + } + default: { DBG_ASSERT(!this, "SvxFont::CaseMapTxt: unknown casemap"); diff --git a/svx/source/items/textitem.cxx b/svx/source/items/textitem.cxx index 50c18cd14b17..b1aeb3608b9f 100644 --- a/svx/source/items/textitem.cxx +++ b/svx/source/items/textitem.cxx @@ -2378,6 +2378,7 @@ sal_Bool SvxCaseMapItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/ ) const case SVX_CASEMAP_VERSALIEN : nRet = style::CaseMap::UPPERCASE; break; case SVX_CASEMAP_GEMEINE : nRet = style::CaseMap::LOWERCASE; break; case SVX_CASEMAP_TITEL : nRet = style::CaseMap::TITLE ; break; + case SVX_CASEMAP_SENTENCE : nRet = style::CaseMap::SENTENCE ; break; case SVX_CASEMAP_KAPITAELCHEN: nRet = style::CaseMap::SMALLCAPS; break; } rVal <<= (sal_Int16)(nRet); @@ -2398,6 +2399,7 @@ sal_Bool SvxCaseMapItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/ ) case style::CaseMap::UPPERCASE: nVal = SVX_CASEMAP_VERSALIEN ; break; case style::CaseMap::LOWERCASE: nVal = SVX_CASEMAP_GEMEINE ; break; case style::CaseMap::TITLE : nVal = SVX_CASEMAP_TITEL ; break; + case style::CaseMap::SENTENCE : nVal = SVX_CASEMAP_SENTENCE ; break; case style::CaseMap::SMALLCAPS: nVal = SVX_CASEMAP_KAPITAELCHEN; break; } SetValue(nVal); |