[Libreoffice-commits] core.git: icon-themes/galaxy officecfg/registry sw/inc sw/qa sw/sdi sw/source sw/uiconfig

Miklos Vajna vmiklos at collabora.co.uk
Tue Sep 27 09:03:43 UTC 2016


 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 d378cd2f766eeb1fd1c98f62c9ae6b5b59fd00f1
Author: Miklos Vajna <vmiklos at 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
    
    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 eecbb0a..6ec9141 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 @@
           <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 7223028..284bcfb 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 d6deb9d..6792919 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>
@@ -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<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 a6991e8..88a1f9c 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 c5c6568..93c18fa 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 64d6370..17b3df9 100644
--- a/sw/source/uibase/shells/txtattr.cxx
+++ b/sw/source/uibase/shells/txtattr.cxx
@@ -37,6 +37,7 @@
 #include <sfx2/htmlmode.hxx>
 #include <editeng/scripttypeitem.hxx>
 #include <editeng/frmdiritem.hxx>
+#include <editeng/cmapitem.hxx>
 #include "paratr.hxx"
 
 #include <fmtinfmt.hxx>
@@ -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<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();
@@ -550,6 +577,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)
@@ -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 8a8a58b..43e80fd 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"/>


More information about the Libreoffice-commits mailing list