[Libreoffice-commits] core.git: sw/inc sw/source

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Aug 28 03:04:48 UTC 2017


 sw/inc/fldbas.hxx                 |    5 ++++-
 sw/inc/strings.hrc                |    1 +
 sw/source/core/fields/fldbas.cxx  |    3 ++-
 sw/source/uibase/fldui/fldmgr.cxx |   14 ++++++++++++--
 4 files changed, 19 insertions(+), 4 deletions(-)

New commits:
commit 8d912300ad1559ebd2ab2005e683753b361ba671
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sat Aug 26 23:41:17 2017 -0400

    sw: insert paragraph signature field
    
    Change-Id: Ibf062c19b9896841df765bc39716cddad8bc12f2
    Reviewed-on: https://gerrit.libreoffice.org/41602
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 91aa97657955..f8030874a782 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -74,7 +74,8 @@ enum class SwFieldIds : sal_uInt16 {
     TableOfAuthorities,
     CombinedChars,
     Dropdown,
-    LAST = Dropdown,
+    ParagraphSignature,
+    LAST = ParagraphSignature,
 
     Unknown = USHRT_MAX, // used as default value in some method calls
 };
@@ -125,6 +126,8 @@ enum SwFieldTypesEnum {
     TYP_AUTHORITY,              // 40
     TYP_COMBINED_CHARS,
     TYP_DROPDOWN,
+    TYP_CUSTOM,     // Unused - necessary for alignment with aSwFields in fldmgr.cxx
+    TYP_PARAGRAPHSIGFLD,
     TYP_END
 };
 enum SwAttrFieldTYpe {
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 9e77c736bdd8..915c0bab463b 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1343,6 +1343,7 @@
 #define STR_VALID                               NC_("STR_VALID", "Valid")
 #define STR_INVALID                             NC_("STR_INVALID", "Invalid")
 #define STR_SIGNED_BY                           NC_("STR_SIGNED_BY", "Signed-by")
+#define STR_PARAGRAPH_SIGNATURE                 NC_("STR_PARAGRAPH_SIGNATURE", "Paragraph Signature")
 
 #endif
 
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index 0fa69f428aec..2b8e111e726f 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -119,7 +119,8 @@ namespace
     /* SwFieldIds::DateTime      */      TYP_BEGIN,         // dynamic
     /* SwFieldIds::TableOfAuthorities*/  TYP_AUTHORITY,
     /* SwFieldIds::CombinedChars */      TYP_COMBINED_CHARS,
-    /* SwFieldIds::Dropdown      */      TYP_DROPDOWN
+    /* SwFieldIds::Dropdown      */      TYP_DROPDOWN,
+    /* SwFieldIds::ParagraphSignature */ TYP_PARAGRAPHSIGFLD
     };
 
 }
diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx
index ab5c79b6aa9d..875b923ffdc8 100644
--- a/sw/source/uibase/fldui/fldmgr.cxx
+++ b/sw/source/uibase/fldui/fldmgr.cxx
@@ -95,7 +95,7 @@ using namespace nsSwDocInfoSubType;
 enum
 {
     GRP_DOC_BEGIN   =  0,
-    GRP_DOC_END     =  GRP_DOC_BEGIN + 11,
+    GRP_DOC_END     =  GRP_DOC_BEGIN + 12,
 
     GRP_FKT_BEGIN   =  GRP_DOC_END,
     GRP_FKT_END     =  GRP_FKT_BEGIN + 8,
@@ -310,6 +310,7 @@ static const SwFieldPack aSwFields[] =
 
     { TYP_CHAPTERFLD,       nullptr,            0,                              FMT_CHAPTER_ARY,  SAL_N_ELEMENTS(FMT_CHAPTER_ARY) },
     { TYP_TEMPLNAMEFLD,     nullptr,            0,                              FMT_FF_ARY,       SAL_N_ELEMENTS(FMT_FF_ARY) },
+    { TYP_PARAGRAPHSIGFLD,  nullptr,            0,                              nullptr,          0 },
 
     // Functions
     { TYP_CONDTXTFLD,       nullptr,            0,                              nullptr,          0 },
@@ -1456,6 +1457,14 @@ bool SwFieldMgr::InsertField(
             static_cast<SwDropDownField*>(pField)->SetName(rData.m_sPar1);
         }
         break;
+
+        // Insert Paragraph Signature field by signing the paragraph.
+        // The resulting field is really a metadata field, created and added via signing.
+        case TYP_PARAGRAPHSIGFLD:
+            pCurShell->SignParagraph(pCurShell->GetCursor());
+            return true;
+        break;
+
         default:
         {   OSL_ENSURE(false, "wrong field type");
             return false;
@@ -1750,7 +1759,8 @@ void SwFieldType::GetFieldName_()
         STR_AUTHORITY,
         STR_COMBINED_CHARS,
         STR_DROPDOWN,
-        STR_CUSTOM_FIELD
+        STR_CUSTOM_FIELD,
+        STR_PARAGRAPH_SIGNATURE
     };
 
     // insert infos for fields


More information about the Libreoffice-commits mailing list