include/editeng/unoprnms.hxx                       |    1 
 include/svl/solar.hrc                              |    2 -
 include/svx/svdograf.hxx                           |    3 ++
 include/svx/unoshprp.hxx                           |    6 +++--
 offapi/com/sun/star/drawing/GraphicObjectShape.idl |    3 ++
 oox/source/vml/vmlshape.cxx                        |    3 ++
 sc/source/ui/inc/tabvwsh.hxx                       |    1 
 sc/source/ui/view/tabvwshb.cxx                     |   22 ++++++++++++++++++++-
 svx/source/svdraw/svdograf.cxx                     |    4 +++
 svx/source/unodraw/unoshap2.cxx                    |   17 ++++++++++++++++
 sw/inc/view.hxx                                    |    1 
 sw/source/uibase/uiview/viewdlg2.cxx               |   21 ++++++++++++++++++++
 sw/source/uibase/uiview/viewstat.cxx               |    2 -
 xmloff/source/draw/SignatureLineContext.cxx        |    3 ++
 14 files changed, 84 insertions(+), 5 deletions(-)

New commits:
commit 7b6f477799d55d80775b6120ba0b5ce1bb45fb3c
Author:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
AuthorDate: Tue Nov 6 10:16:25 2018 +0100
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
CommitDate: Tue Nov 6 15:00:58 2018 +0100

    tdf#118582 Disable signature line signing once it is signed
    
    Change-Id: I720d7d4920ae9c2f5d74ad827e1e214a62fe81a9
    Reviewed-on: https://gerrit.libreoffice.org/62947
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de>

diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx
index 8ac52ede237f..67ccc1975329 100644
--- a/include/editeng/unoprnms.hxx
+++ b/include/editeng/unoprnms.hxx
@@ -175,6 +175,7 @@
 #define UNO_NAME_GRAPHOBJ_SIGNATURELINE_SHOW_SIGN_DATE 
"SignatureLineShowSignDate"
 #define UNO_NAME_GRAPHOBJ_SIGNATURELINE_CAN_ADD_COMMENT 
"SignatureLineCanAddComment"
 #define UNO_NAME_GRAPHOBJ_SIGNATURELINE_UNSIGNED_IMAGE 
"SignatureLineUnsignedImage"
+#define UNO_NAME_GRAPHOBJ_SIGNATURELINE_IS_SIGNED "SignatureLineIsSigned"
 
 #define UNO_NAME_OLE2_METAFILE                  "MetaFile"
 #define UNO_NAME_OLE2_PERSISTNAME               "PersistName"
diff --git a/include/svl/solar.hrc b/include/svl/solar.hrc
index 1945323042b5..b783e898964d 100644
--- a/include/svl/solar.hrc
+++ b/include/svl/solar.hrc
@@ -23,7 +23,7 @@
 // defines ------------------------------------------------------------------
 
 #define OWN_ATTR_VALUE_START                    3900
-#define OWN_ATTR_VALUE_END                      4002
+#define OWN_ATTR_VALUE_END                      4003
 
 #define RID_LIB_START               10000
 #define RID_LIB_END                 19999
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx
index 8cc7395a2283..c3e2ae0c1874 100644
--- a/include/svx/svdograf.hxx
+++ b/include/svx/svdograf.hxx
@@ -110,6 +110,7 @@ private:
     OUString maSignatureLineSigningInstructions;
     bool mbIsSignatureLineShowSignDate;
     bool mbIsSignatureLineCanAddComment;
+    bool mbSignatureLineIsSigned;
     css::uno::Reference<css::graphic::XGraphic> mpSignatureLineUnsignedGraphic;
 
     void                    ImpRegisterLink();
@@ -280,6 +281,8 @@ public:
     {
         mpSignatureLineUnsignedGraphic = rGraphic;
     };
+    bool isSignatureLineSigned() const { return mbSignatureLineIsSigned; };
+    void setSignatureLineIsSigned(bool bIsSigned) { mbSignatureLineIsSigned = 
bIsSigned; }
 };
 
 #endif // INCLUDED_SVX_SVDOGRAF_HXX
diff --git a/include/svx/unoshprp.hxx b/include/svx/unoshprp.hxx
index 6341c37f3dc6..0ac66b706ebd 100644
--- a/include/svx/unoshprp.hxx
+++ b/include/svx/unoshprp.hxx
@@ -190,7 +190,8 @@
 #define OWN_ATTR_SIGNATURELINE_SHOW_SIGN_DATE   (OWN_ATTR_VALUE_START+100)
 #define OWN_ATTR_SIGNATURELINE_CAN_ADD_COMMENT  (OWN_ATTR_VALUE_START+101)
 #define OWN_ATTR_SIGNATURELINE_UNSIGNED_IMAGE   (OWN_ATTR_VALUE_START+102)
-// ATTENTION: maximum is OWN_ATTR_VALUE_START+102 svx, see 
include/svl/solar.hrc
+#define OWN_ATTR_SIGNATURELINE_IS_SIGNED        (OWN_ATTR_VALUE_START+103)
+// ATTENTION: maximum is OWN_ATTR_VALUE_START+103 svx, see 
include/svl/solar.hrc
 
 // #FontWork#
 #define FONTWORK_PROPERTIES \
@@ -440,7 +441,8 @@
     { OUString(UNO_NAME_GRAPHOBJ_SIGNATURELINE_SIGNING_INSTRUCTIONS), 
OWN_ATTR_SIGNATURELINE_SIGNING_INSTRUCTIONS, cppu::UnoType<OUString>::get(), 0, 
0}, \
     { OUString(UNO_NAME_GRAPHOBJ_SIGNATURELINE_SHOW_SIGN_DATE), 
OWN_ATTR_SIGNATURELINE_SHOW_SIGN_DATE, cppu::UnoType<bool>::get(), 0, 0}, \
     { OUString(UNO_NAME_GRAPHOBJ_SIGNATURELINE_CAN_ADD_COMMENT), 
OWN_ATTR_SIGNATURELINE_CAN_ADD_COMMENT, cppu::UnoType<bool>::get(), 0, 0}, \
-    { OUString(UNO_NAME_GRAPHOBJ_SIGNATURELINE_UNSIGNED_IMAGE), 
OWN_ATTR_SIGNATURELINE_UNSIGNED_IMAGE, 
cppu::UnoType<css::graphic::XGraphic>::get(), 0, 0},
+    { OUString(UNO_NAME_GRAPHOBJ_SIGNATURELINE_UNSIGNED_IMAGE), 
OWN_ATTR_SIGNATURELINE_UNSIGNED_IMAGE, 
cppu::UnoType<css::graphic::XGraphic>::get(), 0, 0}, \
+    { OUString(UNO_NAME_GRAPHOBJ_SIGNATURELINE_IS_SIGNED), 
OWN_ATTR_SIGNATURELINE_IS_SIGNED, cppu::UnoType<bool>::get(), 0, 0},
 
 #define SPECIAL_3DSCENEOBJECT_PROPERTIES_DEFAULTS \
     { OUString(UNO_NAME_3D_SCENE_AMBIENTCOLOR),     
SDRATTR_3DSCENE_AMBIENTCOLOR   , ::cppu::UnoType<sal_Int32>::get(),   0,  0}, \
diff --git a/offapi/com/sun/star/drawing/GraphicObjectShape.idl 
b/offapi/com/sun/star/drawing/GraphicObjectShape.idl
index 2c319ccf8de5..defad53e97e0 100644
--- a/offapi/com/sun/star/drawing/GraphicObjectShape.idl
+++ b/offapi/com/sun/star/drawing/GraphicObjectShape.idl
@@ -151,6 +151,9 @@ published service GraphicObjectShape
      *  (you can get the matching signature with the SignatureLineId property).
      */
     [optional, property] com::sun::star::graphic::XGraphic 
SignatureLineUnsignedImage;
+
+    /// Whether the signature line is signed using a digital signature
+    [optional, property] boolean SignatureLineIsSigned;
 };
 
 
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index ee80a0cfbd98..eea8ffbca981 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -1256,6 +1256,7 @@ Reference< XShape > ComplexShape::implConvertAndInsert( 
const Reference< XShapes
     if( getShapeModel().mbIsSignatureLine )
     {
         uno::Reference<graphic::XGraphic> xGraphic;
+        bool bIsSigned(false);
         try
         {
             // Get the document signatures
@@ -1279,6 +1280,7 @@ Reference< XShape > ComplexShape::implConvertAndInsert( 
const Reference< XShapes
                 // then the signature line is not digitally signed.
                 if (xSignatureInfo[i].SignatureLineId == 
getShapeModel().maSignatureId)
                 {
+                    bIsSigned = true;
                     if (xSignatureInfo[i].SignatureIsValid)
                     {
                         // Signature is valid, use the 'valid' image
@@ -1338,6 +1340,7 @@ Reference< XShape > ComplexShape::implConvertAndInsert( 
const Reference< XShapes
         xPropertySet->setPropertyValue(
             "SignatureLineCanAddComment",
             uno::makeAny(getShapeModel().mbSignatureLineCanAddComment));
+        xPropertySet->setPropertyValue("SignatureLineIsSigned", 
uno::makeAny(bIsSigned));
 
         if (!aGraphicPath.isEmpty())
         {
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 28e19d4e3e3b..d35f1f67e1b6 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -172,6 +172,7 @@ private:
     void            DoReadUserData( const OUString& rData );
     void            DoReadUserDataSequence( const css::uno::Sequence< 
css::beans::PropertyValue >& rSettings );
     bool            IsSignatureLineSelected();
+    bool            IsSignatureLineSigned();
 
     DECL_LINK( SimpleRefClose, const OUString*, void );
     DECL_LINK( SimpleRefDone, const OUString&, void );
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index 3cd9c496d56e..80984cfa0656 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -537,7 +537,7 @@ void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet)
                 break;
             case SID_EDIT_SIGNATURELINE:
             case SID_SIGN_SIGNATURELINE:
-                if (!IsSignatureLineSelected())
+                if (!IsSignatureLineSelected() || IsSignatureLineSigned())
                     rSet.DisableItem(nWhich);
                 break;
 
@@ -595,6 +595,26 @@ bool ScTabViewShell::IsSignatureLineSelected()
     return pGraphic->isSignatureLine();
 }
 
+bool ScTabViewShell::IsSignatureLineSigned()
+{
+    SdrView* pSdrView = GetSdrView();
+    if (!pSdrView)
+        return false;
+
+    if (pSdrView->GetMarkedObjectCount() != 1)
+        return false;
+
+    SdrObject* pPickObj = pSdrView->GetMarkedObjectByIndex(0);
+    if (!pPickObj)
+        return false;
+
+    SdrGrafObj* pGraphic = dynamic_cast<SdrGrafObj*>(pPickObj);
+    if (!pGraphic)
+        return false;
+
+    return pGraphic->isSignatureLineSigned();
+}
+
 void ScTabViewShell::ExecuteUndo(SfxRequest& rReq)
 {
     SfxShell* pSh = GetViewData().GetDispatcher().GetShell(0);
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 175abd23252a..c0cebde414b5 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -193,6 +193,7 @@ SdrGrafObj::SdrGrafObj(SdrModel& rSdrModel)
     ,mbIsSignatureLine(false)
     ,mbIsSignatureLineShowSignDate(true)
     ,mbIsSignatureLineCanAddComment(false)
+    ,mbSignatureLineIsSigned(false)
 {
     onGraphicChanged();
 
@@ -219,6 +220,7 @@ SdrGrafObj::SdrGrafObj(
     ,mbIsSignatureLine(false)
     ,mbIsSignatureLineShowSignDate(true)
     ,mbIsSignatureLineCanAddComment(false)
+    ,mbSignatureLineIsSigned(false)
 {
     onGraphicChanged();
 
@@ -244,6 +246,7 @@ SdrGrafObj::SdrGrafObj(
     ,mbIsSignatureLine(false)
     ,mbIsSignatureLineShowSignDate(true)
     ,mbIsSignatureLineCanAddComment(false)
+    ,mbSignatureLineIsSigned(false)
 {
     onGraphicChanged();
 
@@ -731,6 +734,7 @@ SdrGrafObj& SdrGrafObj::operator=( const SdrGrafObj& rObj )
     maSignatureLineSigningInstructions = 
rObj.maSignatureLineSigningInstructions;
     mbIsSignatureLineShowSignDate = rObj.mbIsSignatureLineShowSignDate;
     mbIsSignatureLineCanAddComment = rObj.mbIsSignatureLineCanAddComment;
+    mbSignatureLineIsSigned = false;
     mpSignatureLineUnsignedGraphic = rObj.mpSignatureLineUnsignedGraphic;
     if (mbIsSignatureLine && rObj.mpSignatureLineUnsignedGraphic)
         mpGraphicObject->SetGraphic(rObj.mpSignatureLineUnsignedGraphic);
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index 20802ca894ca..1370119973e0 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -1390,6 +1390,17 @@ bool SvxGraphicObject::setPropertyValueImpl( const 
OUString& rName, const SfxIte
         break;
     }
 
+    case OWN_ATTR_SIGNATURELINE_IS_SIGNED:
+    {
+        bool bIsSigned;
+        if (rValue >>= bIsSigned)
+        {
+            
static_cast<SdrGrafObj*>(GetSdrObject())->setSignatureLineIsSigned(bIsSigned);
+            bOk = true;
+        }
+        break;
+    }
+
     default:
         return SvxShapeText::setPropertyValueImpl( rName, pProperty, rValue );
     }
@@ -1526,6 +1537,12 @@ bool SvxGraphicObject::getPropertyValueImpl( const 
OUString& rName, const SfxIte
         break;
     }
 
+    case OWN_ATTR_SIGNATURELINE_IS_SIGNED:
+    {
+        rValue <<= 
static_cast<SdrGrafObj*>(GetSdrObject())->isSignatureLineSigned();
+        break;
+    }
+
     default:
         return SvxShapeText::getPropertyValueImpl(rName, pProperty,rValue);
     }
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index 2bddda1a67cd..ae3db0670892 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -534,6 +534,7 @@ public:
     bool            BeginTextEdit(  SdrObject* pObj, SdrPageView* pPV=nullptr,
                                     vcl::Window* pWin=nullptr, bool 
bIsNewObj=false, bool bSetSelectionToStart=false );
     bool isSignatureLineSelected();
+    bool isSignatureLineSigned();
 
     void            StateTabWin(SfxItemSet&);
 
diff --git a/sw/source/uibase/uiview/viewdlg2.cxx 
b/sw/source/uibase/uiview/viewdlg2.cxx
index 6308b552a1ae..08b3985a046e 100644
--- a/sw/source/uibase/uiview/viewdlg2.cxx
+++ b/sw/source/uibase/uiview/viewdlg2.cxx
@@ -111,6 +111,27 @@ bool SwView::isSignatureLineSelected()
     return pGraphic->isSignatureLine();
 }
 
+bool SwView::isSignatureLineSigned()
+{
+    SwWrtShell& rSh = GetWrtShell();
+    SdrView* pSdrView = rSh.GetDrawView();
+    if (!pSdrView)
+        return false;
+
+    if (pSdrView->GetMarkedObjectCount() != 1)
+        return false;
+
+    SdrObject* pPickObj = pSdrView->GetMarkedObjectByIndex(0);
+    if (!pPickObj)
+        return false;
+
+    SdrGrafObj* pGraphic = dynamic_cast<SdrGrafObj*>(pPickObj);
+    if (!pGraphic)
+        return false;
+
+    return pGraphic->isSignatureLineSigned();
+}
+
 void SwView::AutoCaption(const sal_uInt16 nType, const SvGlobalName *pOleId)
 {
     SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
diff --git a/sw/source/uibase/uiview/viewstat.cxx 
b/sw/source/uibase/uiview/viewstat.cxx
index 49020bde88e1..38ffb27df5da 100644
--- a/sw/source/uibase/uiview/viewstat.cxx
+++ b/sw/source/uibase/uiview/viewstat.cxx
@@ -113,7 +113,7 @@ void SwView::GetState(SfxItemSet &rSet)
                 break;
             case SID_EDIT_SIGNATURELINE:
             case SID_SIGN_SIGNATURELINE:
-                if (!isSignatureLineSelected())
+                if (!isSignatureLineSelected() || isSignatureLineSigned())
                     rSet.DisableItem(nWhich);
                 break;
             case FN_INSERT_CAPTION:
diff --git a/xmloff/source/draw/SignatureLineContext.cxx 
b/xmloff/source/draw/SignatureLineContext.cxx
index b22a7465c46d..c95dfc8c72da 100644
--- a/xmloff/source/draw/SignatureLineContext.cxx
+++ b/xmloff/source/draw/SignatureLineContext.cxx
@@ -61,6 +61,7 @@ SignatureLineContext::SignatureLineContext(SvXMLImport& 
rImport, sal_uInt16 nPrf
     xPropSet->setPropertyValue("SignatureLineCanAddComment", 
Any(bCanAddComment));
 
     Reference<XGraphic> xGraphic;
+    bool bIsSigned(false);
     try
     {
         // Get the document signatures
@@ -87,6 +88,7 @@ SignatureLineContext::SignatureLineContext(SvXMLImport& 
rImport, sal_uInt16 nPrf
             // then the signature line is not digitally signed.
             if (xSignatureInfo[i].SignatureLineId == 
xAttrList->getValueByName("loext:id"))
             {
+                bIsSigned = true;
                 if (xSignatureInfo[i].SignatureIsValid)
                 {
                     // Signature is valid, use the 'valid' image
@@ -112,6 +114,7 @@ SignatureLineContext::SignatureLineContext(SvXMLImport& 
rImport, sal_uInt16 nPrf
                 break;
             }
         }
+        xPropSet->setPropertyValue("SignatureLineIsSigned", Any(bIsSigned));
     }
     catch (css::uno::Exception&)
     {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to