icon-themes/galaxy/cmd/lc_smallcaps.png |binary icon-themes/galaxy/cmd/sc_smallcaps.png |binary officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 8 ++ sw/inc/cmdid.h | 1 sw/qa/extras/uiwriter/uiwriter.cxx | 20 +++++ sw/sdi/_textsh.sdi | 6 + sw/sdi/swriter.sdi | 18 ++++ sw/source/uibase/shells/txtattr.cxx | 37 ++++++++++ sw/uiconfig/swriter/toolbar/textobjectbar.xml | 1 9 files changed, 91 insertions(+)
New commits: commit 7acac0db1b4971cd3c3de59bc661e3a8554d1d86 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Tue Sep 27 09:11:25 2016 +0200 tdf#87914 sw: add an initial .uno:SmallCaps command - handle it in SwTextShell (for normal Writer text) - simple icon in the galaxy theme (cherry picked from commit d378cd2f766eeb1fd1c98f62c9ae6b5b59fd00f1) Change-Id: Ib8f11dbca28b19a2fc0411c92d9f0b4b052277bb diff --git a/icon-themes/galaxy/cmd/lc_smallcaps.png b/icon-themes/galaxy/cmd/lc_smallcaps.png new file mode 100644 index 0000000..7ef20ce 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 0000000..eaf4101 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 0facec0..d5fdee8 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -3661,6 +3661,14 @@ <value>9</value> </prop> </node> + <node oor:name=".uno:SmallCaps" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Small capitals</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>9</value> + </prop> + </node> <node oor:name=".uno:DistributeSelection" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">~Distribution...</value> diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index cd0ce77..e677e77 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -300,6 +300,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 208efa4..f2c4263 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -11,6 +11,7 @@ #include <com/sun/star/drawing/GraphicExportFilter.hpp> #include <com/sun/star/i18n/TextConversionOption.hpp> #include <com/sun/star/frame/DispatchHelper.hpp> +#include <com/sun/star/style/CaseMap.hpp> #include <tools/errcode.hxx> #include <swmodeltestbase.hxx> #include <ndtxt.hxx> @@ -186,6 +187,7 @@ public: void testTdf96961(); void testTdf88453(); void testTdf88453Table(); + void testSmallCaps(); void testTdf98987(); void testTdf99004(); void testTdf84695(); @@ -283,6 +285,7 @@ public: CPPUNIT_TEST(testTdf96961); CPPUNIT_TEST(testTdf88453); CPPUNIT_TEST(testTdf88453Table); + CPPUNIT_TEST(testSmallCaps); CPPUNIT_TEST(testTdf98987); CPPUNIT_TEST(testTdf99004); CPPUNIT_TEST(testTdf84695); @@ -3182,6 +3185,23 @@ void SwUiWriterTest::testTdf88453Table() CPPUNIT_ASSERT_EQUAL(3, getPages()); } +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<sal_Int16>(getRun(getParagraph(1), 1), "CharCaseMap")); +} + void SwUiWriterTest::testTdf98987() { createDoc("tdf98987.docx"); diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi index 1479451..2a5df5f 100644 --- a/sw/sdi/_textsh.sdi +++ b/sw/sdi/_textsh.sdi @@ -1458,6 +1458,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 c0ba826..f5f335e 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -7787,6 +7787,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 27f3d6f9..d48b224 100644 --- a/sw/source/uibase/shells/txtattr.cxx +++ b/sw/source/uibase/shells/txtattr.cxx @@ -36,6 +36,7 @@ #include <sfx2/htmlmode.hxx> #include <editeng/scripttypeitem.hxx> #include <editeng/frmdiritem.hxx> +#include <editeng/cmapitem.hxx> #include "paratr.hxx" #include <fmtinfmt.hxx> @@ -129,6 +130,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<const SvxCaseMapItem&>(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(); @@ -549,6 +576,13 @@ void SwTextShell::GetAttrState(SfxItemSet &rSet) nLineSpace = static_cast<const SvxLineSpacingItem* >(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<const SvxCaseMapItem*>(pItem)->GetCaseMap(); + while (nSlot) { switch(nSlot) @@ -559,6 +593,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 d4957fc..845212c 100644 --- a/sw/uiconfig/swriter/toolbar/textobjectbar.xml +++ b/sw/uiconfig/swriter/toolbar/textobjectbar.xml @@ -46,6 +46,7 @@ <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:ChangeCaseToLower" toolbar:visible="false"/> <toolbar:toolbaritem xlink:href=".uno:ChangeCaseToUpper" toolbar:visible="false"/> + <toolbar:toolbaritem xlink:href=".uno:SmallCaps" toolbar:visible="false"/> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:FontColor"/> <toolbar:toolbaritem xlink:href=".uno:BackColor"/> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits