summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lange <tl@openoffice.org>2009-07-13 11:08:01 +0000
committerThomas Lange <tl@openoffice.org>2009-07-13 11:08:01 +0000
commitef3a831525f975b27c5db2eb2a3cad48a0135c3c (patch)
tree96892b766c1bcb31ecf892b1f933fd08a1d89a11
parentc988d4b6e0fb0ec0c708cfd41553a88e9968813e (diff)
#i1601# sentence case transliteration
-rw-r--r--configmgr/qa/unit/data/org/openoffice/UI/GenericCommands.xcu5
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu8
-rw-r--r--svx/inc/globlmn_tmpl.hrc7
-rw-r--r--svx/inc/svx/svxenum.hxx1
-rw-r--r--svx/inc/svx/svxids.hrc4
-rw-r--r--svx/sdi/svx.sdi25
-rw-r--r--svx/sdi/svxitems.sdi1
-rw-r--r--svx/source/cui/chardlg.src3
-rw-r--r--svx/source/items/svxfont.cxx42
-rw-r--r--svx/source/items/textitem.cxx2
10 files changed, 92 insertions, 6 deletions
diff --git a/configmgr/qa/unit/data/org/openoffice/UI/GenericCommands.xcu b/configmgr/qa/unit/data/org/openoffice/UI/GenericCommands.xcu
index 512b759478..d34db7424c 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 23caee9af1..f3b6bede57 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 327bd45d53..9811df04dd 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 d2f2530f27..429f595766 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 4bfad86fba..a1e9349a5e 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 a69aae4cf9..3172138d10 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 9650864679..4961b1c66a 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 19ad1e0904..76515fc945 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 98c911c8a8..ed3225d58c 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 ) );
+ String aTemp( aTxt.GetChar( i ) );
+ if( bBlank )
+ {
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 32e8b9f617..cabc6ffa21 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);