include/svx/ClassificationDialog.hxx       |    5 ++++-
 svx/source/dialog/ClassificationDialog.cxx |    8 ++++++--
 sw/source/uibase/app/docsh2.cxx            |    9 ++++++---
 3 files changed, 16 insertions(+), 6 deletions(-)

New commits:
commit 0bef045346b47f45d0fbd354dd5fcb24c7c8903d
Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk>
Date:   Sun Sep 24 15:01:48 2017 -0400

    TSCP: sign paragraph from classification dialog
    
    Change-Id: Iebd50de0abecb80a4de38257fa2eea10b81962b7
    Reviewed-on: https://gerrit.libreoffice.org/42738
    Reviewed-by: Ashod Nakashian <ashnak...@gmail.com>
    Tested-by: Ashod Nakashian <ashnak...@gmail.com>

diff --git a/include/svx/ClassificationDialog.hxx 
b/include/svx/ClassificationDialog.hxx
index 9b315c997381..c2e48e4a760c 100644
--- a/include/svx/ClassificationDialog.hxx
+++ b/include/svx/ClassificationDialog.hxx
@@ -40,6 +40,9 @@ private:
     SfxClassificationHelper maHelper;
     SfxClassificationHelper maInternationalHelper;
 
+    const bool m_bPerParagraph;
+    const std::function<void()> m_aParagraphSignHandler;
+
     DECL_LINK(ButtonClicked, Button*, void);
     DECL_LINK(SelectClassificationHdl, ListBox&, void);
     DECL_LINK(SelectMarkingHdl, ListBox&, void);
@@ -49,7 +52,7 @@ private:
     void insertField(ClassificationType eType, OUString const & rString);
 
 public:
-    ClassificationDialog(vcl::Window* pParent);
+    ClassificationDialog(vcl::Window* pParent, bool bPerParagraph, const 
std::function<void()>& rParagraphSignHandler = [](){});
     virtual ~ClassificationDialog() override;
     virtual void dispose() override;
 
diff --git a/svx/source/dialog/ClassificationDialog.cxx 
b/svx/source/dialog/ClassificationDialog.cxx
index 7f0b33ec7813..45e83af10ae7 100644
--- a/svx/source/dialog/ClassificationDialog.cxx
+++ b/svx/source/dialog/ClassificationDialog.cxx
@@ -31,10 +31,12 @@ const SvxFieldItem* findField(editeng::Section const & 
rSection)
 
 } // end anonymous namespace
 
-ClassificationDialog::ClassificationDialog(vcl::Window* pParent)
+ClassificationDialog::ClassificationDialog(vcl::Window* pParent, const bool 
bPerParagraph, const std::function<void()>& rParagraphSignHandler)
     : ModalDialog(pParent, "AdvancedDocumentClassificationDialog", 
"svx/ui/classificationdialog.ui")
     , maHelper(SfxObjectShell::Current()->getDocProperties())
     , maInternationalHelper(SfxObjectShell::Current()->getDocProperties(), 
/*bUseLocalizedPolicy*/ false)
+    , m_bPerParagraph(bPerParagraph)
+    , m_aParagraphSignHandler(rParagraphSignHandler)
 {
     get(m_pEditWindow, "classificationEditWindow");
     get(m_pSignButton, "signButton");
@@ -48,6 +50,8 @@ ClassificationDialog::ClassificationDialog(vcl::Window* 
pParent)
     get(m_pIntellectualPropertyPartEdit, "intellectualPropertyPartEntry");
 
     m_pSignButton->SetClickHdl(LINK(this, ClassificationDialog, 
ButtonClicked));
+    m_pSignButton->Show(m_bPerParagraph);
+
     m_pBoldButton->SetClickHdl(LINK(this, ClassificationDialog, 
ButtonClicked));
     m_pIntellectualPropertyPartAddButton->SetClickHdl(LINK(this, 
ClassificationDialog, ButtonClicked));
 
@@ -257,7 +261,7 @@ IMPL_LINK(ClassificationDialog, ButtonClicked, Button*, 
pButton, void)
     }
     else if (pButton == m_pSignButton)
     {
-        //TODO sign current paragraph
+        m_aParagraphSignHandler();
     }
     else if (pButton == m_pIntellectualPropertyPartAddButton)
     {
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 0064f54f0622..a3708b58df91 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -1166,7 +1166,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
         break;
         case SID_CLASSIFICATION_DIALOG:
         {
-            ScopedVclPtr<svx::ClassificationDialog> 
pDialog(VclPtr<svx::ClassificationDialog>::Create(nullptr));
+            ScopedVclPtr<svx::ClassificationDialog> 
pDialog(VclPtr<svx::ClassificationDialog>::Create(nullptr, false));
 
             SwWrtShell* pShell = GetWrtShell();
             std::vector<svx::ClassificationResult> aInput = 
pShell->CollectAdvancedClassification();
@@ -1180,9 +1180,12 @@ void SwDocShell::Execute(SfxRequest& rReq)
         break;
         case SID_PARAGRAPH_SIGN_CLASSIFY_DLG:
         {
-            ScopedVclPtr<svx::ClassificationDialog> 
pDialog(VclPtr<svx::ClassificationDialog>::Create(nullptr));
-
             SwWrtShell* pShell = GetWrtShell();
+            ScopedVclPtr<svx::ClassificationDialog> 
pDialog(VclPtr<svx::ClassificationDialog>::Create(nullptr, true, [pShell]()
+            {
+                pShell->SignParagraph(pShell->GetCursor());
+            }));
+
             std::vector<svx::ClassificationResult> aInput = 
pShell->CollectAdvancedClassification();
             pDialog->setupValues(aInput);
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to