diff --git a/icon-themes/galaxy/cmd/lc_smallcaps.png b/icon-themes/galaxy/cmd/lc_smallcaps.png new file mode 100644 index 000000000000..7ef20cedf7a1 Binary files /dev/null and b/icon-themes/galaxy/cmd/lc_smallcaps.png differ diff --git a/icon-themes/galaxy/cmd/sc_smallcaps.png b/icon-themes/galaxy/cmd/sc_smallcaps.png new file mode 100644 index 000000000000..eaf41017cde8 Binary files /dev/null and b/icon-themes/galaxy/cmd/sc_smallcaps.png differ diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index eecbb0aea356..6ec914148730 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -3871,6 +3871,14 @@ 9 + + + Small capitals + + + 9 + + ~Distribution... diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 7223028fc858..284bcfb95dcb 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -311,6 +311,7 @@ #define FN_AUTOFORMAT_REDLINE_APPLY (FN_FORMAT + 6 ) /* apply autoformat with Redlining */ #define FN_SET_SUPER_SCRIPT (FN_FORMAT + 11) /* superscript */ #define FN_SET_SUB_SCRIPT (FN_FORMAT + 12) /* subscript */ +#define FN_SET_SMALL_CAPS (FN_FORMAT + 13) /* small caps */ #define FN_FORMAT_PAGE_SETTING_DLG (FN_FORMAT + 42) /* */ #define FN_NUM_FORMAT_TABLE_DLG (FN_FORMAT + 45) /* number format in table */ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index d6deb9d231b9..6792919e0591 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -199,6 +200,7 @@ public: void testTdf88453(); void testTdf88453Table(); void testClassificationPaste(); + void testSmallCaps(); void testTdf98987(); void testTdf99004(); void testTdf84695(); @@ -307,6 +309,7 @@ public: CPPUNIT_TEST(testTdf88453); CPPUNIT_TEST(testTdf88453Table); CPPUNIT_TEST(testClassificationPaste); + CPPUNIT_TEST(testSmallCaps); CPPUNIT_TEST(testTdf98987); CPPUNIT_TEST(testTdf99004); CPPUNIT_TEST(testTdf84695); @@ -3710,6 +3713,23 @@ void SwUiWriterTest::testClassificationPaste() xSourceComponent->dispose(); } +void SwUiWriterTest::testSmallCaps() +{ + // Create a document, add some characters and select them. + createDoc(); + SwDoc* pDoc = createDoc(); + SwDocShell* pDocShell = pDoc->GetDocShell(); + SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); + pWrtShell->Insert("text"); + pWrtShell->SelAll(); + + // Dispatch the command to make them formatted small capitals. + lcl_dispatchCommand(mxComponent, ".uno:SmallCaps", {}); + + // This was css::style::CaseMap::NONE as the shell didn't handle the command. + CPPUNIT_ASSERT_EQUAL(css::style::CaseMap::SMALLCAPS, getProperty(getRun(getParagraph(1), 1), "CharCaseMap")); +} + void SwUiWriterTest::testTdf98987() { createDoc("tdf98987.docx"); diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi index a6991e8ab8d1..88a1f9cf2eba 100644 --- a/sw/sdi/_textsh.sdi +++ b/sw/sdi/_textsh.sdi @@ -1442,6 +1442,12 @@ interface BaseText StateMethod = GetAttrState ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + FN_SET_SMALL_CAPS + [ + ExecMethod = ExecCharAttr ; + StateMethod = GetAttrState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] SID_ATTR_CHAR_CASEMAP // status(final|play) [ ExecMethod = ExecTextCtrl; diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index c5c65688c47a..93c18fae6b15 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -5737,6 +5737,24 @@ SfxBoolItem SuperScript FN_SET_SUPER_SCRIPT GroupId = GID_FORMAT; ] +SfxBoolItem SmallCaps FN_SET_SMALL_CAPS + +[ + AutoUpdate = TRUE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + SfxVoidItem SwBrwInsert FN_SBA_BRW_INSERT () [ diff --git a/sw/source/uibase/shells/txtattr.cxx b/sw/source/uibase/shells/txtattr.cxx index 64d6370f4751..17b3df9a6fca 100644 --- a/sw/source/uibase/shells/txtattr.cxx +++ b/sw/source/uibase/shells/txtattr.cxx @@ -37,6 +37,7 @@ #include #include #include +#include #include "paratr.hxx" #include @@ -130,6 +131,32 @@ void SwTextShell::ExecCharAttr(SfxRequest &rReq) } break; + case FN_SET_SMALL_CAPS: + { + SvxCaseMap eCaseMap = SVX_CASEMAP_KAPITAELCHEN; + switch (eState) + { + case STATE_TOGGLE: + { + SvxCaseMap eTmpCaseMap = static_cast(aSet.Get(RES_CHRATR_CASEMAP)).GetCaseMap(); + if (eTmpCaseMap == SVX_CASEMAP_KAPITAELCHEN) + eCaseMap = SVX_CASEMAP_NOT_MAPPED; + } + break; + case STATE_ON: + // Nothing to do, already set. + break; + case STATE_OFF: + eCaseMap = SVX_CASEMAP_NOT_MAPPED; + break; + } + SvxCaseMapItem aCaseMap(eCaseMap, RES_CHRATR_CASEMAP); + rSh.SetAttrItem(aCaseMap); + rReq.AppendItem(aCaseMap); + rReq.Done(); + } + break; + case FN_UPDATE_STYLE_BY_EXAMPLE: rSh.QuickUpdateStyle(); rReq.Done(); @@ -550,6 +577,13 @@ void SwTextShell::GetAttrState(SfxItemSet &rSet) nLineSpace = static_cast(pItem)->GetPropLineSpace(); } + SvxCaseMap eCaseMap = SVX_CASEMAP_NOT_MAPPED; + eState = aCoreSet.GetItemState(RES_CHRATR_CASEMAP, false, &pItem); + if (eState == SfxItemState::DEFAULT) + pItem = &rPool.GetDefaultItem(RES_CHRATR_CASEMAP); + if (eState >= SfxItemState::DEFAULT) + eCaseMap = static_cast(pItem)->GetCaseMap(); + while (nSlot) { switch(nSlot) @@ -560,6 +594,9 @@ void SwTextShell::GetAttrState(SfxItemSet &rSet) case FN_SET_SUB_SCRIPT: bFlag = 0 > nEsc; break; + case FN_SET_SMALL_CAPS: + bFlag = eCaseMap == SVX_CASEMAP_KAPITAELCHEN; + break; case SID_ATTR_PARA_ADJUST_LEFT: if (eAdjust == -1) { diff --git a/sw/uiconfig/swriter/toolbar/textobjectbar.xml b/sw/uiconfig/swriter/toolbar/textobjectbar.xml index 8a8a58bf2dcb..43e80fd433f5 100644 --- a/sw/uiconfig/swriter/toolbar/textobjectbar.xml +++ b/sw/uiconfig/swriter/toolbar/textobjectbar.xml @@ -46,6 +46,7 @@ +