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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Sun Jul 23 17:15:01 UTC 2017


 include/svx/svxids.hrc              |    8 +++-----
 sw/inc/editsh.hxx                   |    3 +++
 sw/inc/strings.hrc                  |    1 +
 sw/inc/swundo.hxx                   |    3 ++-
 sw/source/core/edit/edfcol.cxx      |   17 +++++++++++++++++
 sw/source/core/undo/undobj.cxx      |    3 +++
 sw/source/uibase/shells/textsh1.cxx |   24 ++++++++++++++++++++++++
 7 files changed, 53 insertions(+), 6 deletions(-)

New commits:
commit a1b0408ab6655220a8ac3b6fe7f2875da8a365e7
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Jul 2 23:34:06 2017 -0400

    sw: dummy handler for paragraph signing
    
    Change-Id: If6e9f75dcf8c8628295fe013328b3b1630d064a2
    Reviewed-on: https://gerrit.libreoffice.org/40319
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index 4ed5b3ff69e9..09dc209d3e02 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -978,18 +978,16 @@
 #define SID_DRAW_MEASURELINE                            ( SID_SVX_START + 1167 )
 #define SID_AUTHOR_COLOR                                ( SID_SVX_START + 1168 )
 #define SID_BMPMASK_COLOR                               ( SID_SVX_START + 1169 )
+#define SID_PARA_SIGNATURE_ADD                          ( SID_SVX_START + 1170 )
 
 // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id
-#define SID_SVX_FIRSTFREE                               ( SID_BMPMASK_COLOR + 1 )
+#define SID_SVX_FIRSTFREE                               ( SID_PARA_SIGNATURE_ADD + 1 )
 
 // Overflow check for slot IDs
-
 #if SID_SVX_FIRSTFREE > SID_SVX_END
-#error Resource-Ueberlauf in #line, #file
+#error Resource-overflow in #line, #file
 #endif
 
 #endif
 
-// ******************************************************************* EOF
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 7a0d2d85f2d9..c539007c34c9 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -371,6 +371,9 @@ public:
     SfxWatermarkItem GetWatermark();
     void SetWatermark(const SfxWatermarkItem& rText);
 
+    /// Sign the paragraph at the cursor.
+    static void SignParagraph(SwPaM* pPaM);
+
     void Insert2(SwField&, const bool bForceExpandHints);
 
     void UpdateFields( SwField & );   ///< One single field.
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 7d85ccbda0d8..cfa4496e96c6 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -536,6 +536,7 @@
 #define STR_DRAWING_OBJECTS                     NC_("STR_DRAWING_OBJECTS", "drawing object(s)")
 #define STR_TABLE_NAME                          NC_("STR_TABLE_NAME", "table: $1$2$3")
 #define STR_PARAGRAPH_UNDO                      NC_("STR_PARAGRAPH_UNDO", "paragraph")
+#define STR_PARAGRAPH_SIGN_UNDO                 NC_("STR_PARAGRAPH_SIGN_UNDO", "Paragraph sign")
 #define STR_UNDO_FLYFRMFMT_TITLE                NC_("STR_UNDO_FLYFRMFMT_TITLE", "Change object title of $1")
 #define STR_UNDO_FLYFRMFMT_DESCRITPTION         NC_("STR_UNDO_FLYFRMFMT_DESCRITPTION", "Change object description of $1")
 #define STR_UNDO_TBLSTYLE_CREATE                NC_("STR_UNDO_TBLSTYLE_CREATE", "Create table style: $1")
diff --git a/sw/inc/swundo.hxx b/sw/inc/swundo.hxx
index c7c3f3a9b80f..54fc7225a6b1 100644
--- a/sw/inc/swundo.hxx
+++ b/sw/inc/swundo.hxx
@@ -153,7 +153,8 @@ enum class SwUndoId
     TBLSTYLE_CREATE,                   // 114
     TBLSTYLE_DELETE,                   // 115
     TBLSTYLE_UPDATE,                   // 116
-    STD_END = TBLSTYLE_UPDATE,
+    PARA_SIGN_ADD,                     // 117
+    STD_END = PARA_SIGN_ADD,
 
     // UI undo ID's...
     UI_REPLACE = STD_END + 1,
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index b44cdf43a115..503902599461 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -531,6 +531,23 @@ void SwEditShell::SetWatermark(const SfxWatermarkItem& rWatermark)
     }
 }
 
+void SwEditShell::SignParagraph(SwPaM* pPaM)
+{
+    if (!pPaM)
+        return;
+
+    const SwPosition* pPosStart = pPaM->Start();
+    SwTextNode* pNode = pPosStart->nNode.GetNode().GetTextNode();
+    if (pNode)
+    {
+        // Get the text (without fields).
+        const OUString text = pNode->GetText();
+        (void)text;
+
+        //TODO: get signature, add signature field and metadata.
+    }
+}
+
 // #i62675#
 void SwEditShell::SetTextFormatColl(SwTextFormatColl *pFormat,
                                 const bool bResetListAttrs)
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index af558e0d4bd9..37efb8eb318e 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -658,6 +658,9 @@ OUString GetUndoComment(SwUndoId eId)
             break;
         case SwUndoId::CONFLICT:
             break;
+        case SwUndoId::PARA_SIGN_ADD:
+            pId = STR_PARAGRAPH_SIGN_UNDO;
+            break;
     };
 
     assert(pId);
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 4336c5e51030..313dabcf835b 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1090,6 +1090,30 @@ void SwTextShell::Execute(SfxRequest &rReq)
             }
         }
         break;
+        case SID_PARA_SIGNATURE_ADD:
+        {
+            SwPaM* pPaM = nullptr;
+            if (pArgs)
+            {
+                const SfxPoolItem* pPaMItem = nullptr;
+                pArgs->GetItemState(GetPool().GetWhich(FN_PARAM_PAM), false, &pPaMItem);
+                if (pPaMItem)
+                    pPaM = static_cast< const SwPaMItem* >(pPaMItem)->GetValue();
+            }
+
+            if (!pPaM)
+                pPaM = rWrtSh.GetCursor();
+
+            rWrtSh.StartUndo(SwUndoId::PARA_SIGN_ADD);
+            rWrtSh.StartAction();
+
+            SwWrtShell::SignParagraph(pPaM);
+
+            rWrtSh.EndAction();
+
+            rWrtSh.EndUndo(SwUndoId::PARA_SIGN_ADD);
+        }
+        break;
         case FN_NUM_CONTINUE:
         {
             OUString sContinuedListId;


More information about the Libreoffice-commits mailing list