[Libreoffice-commits] core.git: include/vcl sfx2/inc sfx2/Library_sfx.mk sfx2/source vcl/source

Michael Stahl mstahl at redhat.com
Fri Apr 7 12:19:14 UTC 2017


 include/vcl/button.hxx               |    2 -
 sfx2/Library_sfx.mk                  |    1 
 sfx2/inc/view/signaturehelper.hxx    |   32 ----------------
 sfx2/source/doc/objserv.cxx          |    6 ---
 sfx2/source/view/signaturehelper.cxx |   67 -----------------------------------
 sfx2/source/view/viewfrm.cxx         |   36 ++++++++++++++++++
 vcl/source/control/button.cxx        |    8 +---
 7 files changed, 40 insertions(+), 112 deletions(-)

New commits:
commit b805e5705cfaafd8e54283840bec23afc789124a
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Apr 7 14:11:16 2017 +0200

    Revert "Related tdf#105566 Update Infobar when signature status changes"
    
    This reverts commit d8faf3bf9a82e8f49340b5020ec4ee931cc2f3f4.
    
    This causes an infinite recursion in JunitTest_sfx2_complex
    involving the newly added SignatureHelper::updateInfoBarState().

diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx
index 57cf7980ac71..1c9fd19f421f 100644
--- a/include/vcl/button.hxx
+++ b/include/vcl/button.hxx
@@ -75,7 +75,7 @@ public:
     const Link<Button*,void>& GetClickHdl() const { return maClickHdl; }
 
     /// Setup handler for UNO commands so that commands like .uno:Something are handled automagically by this button.
-    void                SetCommandHandler(const OUString& aCommand, bool bAddStatusListener=true);
+    void                SetCommandHandler(const OUString& aCommand);
     const OUString      GetCommand() const { return maCommand; }
 
     static OUString     GetStandardText( StandardButtonType eButton );
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 2e51f1b6e21a..f0a5a52c0cc2 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -300,7 +300,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
     sfx2/source/view/ipclient \
     sfx2/source/view/lokhelper \
     sfx2/source/view/printer \
-    sfx2/source/view/signaturehelper \
     sfx2/source/view/sfxbasecontroller \
     sfx2/source/view/userinputinterception \
     sfx2/source/view/viewfac \
diff --git a/sfx2/inc/view/signaturehelper.hxx b/sfx2/inc/view/signaturehelper.hxx
deleted file mode 100644
index e8dc089ba876..000000000000
--- a/sfx2/inc/view/signaturehelper.hxx
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#ifndef INCLUDED_SFX2_SIGNATUREHELPER_HXX
-#define INCLUDED_SFX2_SIGNATUREHELPER_HXX
-
-#include <sfx2/signaturestate.hxx>
-
-class SfxViewFrame;
-
-class SignatureHelper
-{
-public:
-    SignatureHelper(SfxViewFrame* rViewFrame);
-    /**
-     * Show the appropriate infobar according to the current signature status
-    */
-    void updateInfoBarState(SignatureState signatureState);
-private:
-    SfxViewFrame* mrViewFrame;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index d5058863a183..c2bdb2e5281a 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -90,7 +90,6 @@
 #include <sfx2/msgpool.hxx>
 #include <sfx2/objface.hxx>
 #include <sfx2/checkin.hxx>
-#include "view/signaturehelper.hxx"
 
 #include "app.hrc"
 #include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
@@ -1037,11 +1036,6 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet)
             }
             case SID_SIGNATURE:
             {
-                SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this );
-                if ( pFrame )
-                {
-                    SignatureHelper(pFrame).updateInfoBarState(GetDocumentSignatureState());
-                }
                 rSet.Put( SfxUInt16Item( SID_SIGNATURE, static_cast<sal_uInt16>(GetDocumentSignatureState()) ) );
                 break;
             }
diff --git a/sfx2/source/view/signaturehelper.cxx b/sfx2/source/view/signaturehelper.cxx
deleted file mode 100644
index d5b01fd5805c..000000000000
--- a/sfx2/source/view/signaturehelper.cxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include "view/signaturehelper.hxx"
-
-#include <sfx2/infobar.hxx>
-#include <sfx2/sfxresid.hxx>
-#include <sfx2/sfx.hrc>
-#include <vcl/button.hxx>
-#include <vcl/vclptr.hxx>
-#include <tools/link.hxx>
-
-
-SignatureHelper::SignatureHelper(SfxViewFrame* rViewFrame)
-{
-    mrViewFrame = rViewFrame;
-}
-
-void SignatureHelper::updateInfoBarState(SignatureState nSignatureState)
-{
-    InfoBarType aInfoBarType(InfoBarType::Info);
-    OUString sMessage("");
-
-    switch (nSignatureState)
-    {
-    case SignatureState::BROKEN:
-        sMessage = SfxResId(STR_SIGNATURE_BROKEN);
-        aInfoBarType = InfoBarType::Danger;
-        break;
-    case SignatureState::NOTVALIDATED:
-        sMessage = SfxResId(STR_SIGNATURE_NOTVALIDATED);
-        aInfoBarType = InfoBarType::Warning;
-        break;
-    case SignatureState::PARTIAL_OK:
-        sMessage = SfxResId(STR_SIGNATURE_PARTIAL_OK);
-        aInfoBarType = InfoBarType::Warning;
-        break;
-    case SignatureState::OK:
-        sMessage = SfxResId(STR_SIGNATURE_OK);
-        aInfoBarType = InfoBarType::Info;
-        break;
-    default:
-        break;
-    }
-
-    mrViewFrame->RemoveInfoBar("signature");
-    if (!sMessage.isEmpty())
-    {
-        auto pInfoBar = mrViewFrame->AppendInfoBar("signature", sMessage, aInfoBarType);
-        if (pInfoBar == nullptr)
-            return;
-        VclPtrInstance<PushButton> xBtn(&(mrViewFrame->GetWindow()));
-        xBtn->SetText(SfxResId(STR_SIGNATURE_SHOW));
-        xBtn->SetSizePixel(xBtn->GetOptimalSize());
-        xBtn->SetCommandHandler(".uno:Signature", false); // false = No status listener, else we get in an infinite loop
-        pInfoBar->addButton(xBtn);
-    }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 12eb84e539b2..adc24f98dc98 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1138,6 +1138,42 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
                 rBind.Invalidate( SID_RELOAD );
                 rBind.Invalidate( SID_EDITDOC );
 
+                SignatureState nSignatureState = GetObjectShell()->GetDocumentSignatureState();
+                InfoBarType aInfoBarType(InfoBarType::Info);
+                OUString sMessage;
+
+                switch (nSignatureState)
+                {
+                case SignatureState::BROKEN:
+                    sMessage = SfxResId(STR_SIGNATURE_BROKEN);
+                    aInfoBarType = InfoBarType::Danger;
+                    break;
+                case SignatureState::NOTVALIDATED:
+                    sMessage = SfxResId(STR_SIGNATURE_NOTVALIDATED);
+                    aInfoBarType = InfoBarType::Warning;
+                    break;
+                case SignatureState::PARTIAL_OK:
+                    sMessage = SfxResId(STR_SIGNATURE_PARTIAL_OK);
+                    aInfoBarType = InfoBarType::Warning;
+                    break;
+                case SignatureState::OK:
+                    sMessage = SfxResId(STR_SIGNATURE_OK);
+                    aInfoBarType = InfoBarType::Info;
+                    break;
+                default:
+                    break;
+                }
+
+                if (!sMessage.isEmpty())
+                {
+                    auto pInfoBar = AppendInfoBar("signature", sMessage, aInfoBarType);
+                    VclPtrInstance<PushButton> xBtn(&GetWindow());
+                    xBtn->SetText(SfxResId(STR_SIGNATURE_SHOW));
+                    xBtn->SetSizePixel(xBtn->GetOptimalSize());
+                    xBtn->SetClickHdl(LINK(this, SfxViewFrame, SignDocumentHandler));
+                    pInfoBar->addButton(xBtn);
+                }
+
                 const SfxViewShell *pVSh;
                 const SfxShell *pFSh;
                 if ( m_xObjSh->IsOriginallyReadOnlyMedium() &&
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index e65bd06ace74..64c078e070fa 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -109,15 +109,13 @@ void Button::dispose()
     Control::dispose();
 }
 
-void Button::SetCommandHandler(const OUString& aCommand, bool bAddStatusListener)
+void Button::SetCommandHandler(const OUString& aCommand)
 {
     maCommand = aCommand;
     SetClickHdl( LINK( this, Button, dispatchCommandHandler) );
 
-    if (bAddStatusListener) {
-        mpButtonData->mpStatusListener = new VclStatusListener<Button>(this, aCommand);
-        mpButtonData->mpStatusListener->startListening();
-    }
+    mpButtonData->mpStatusListener = new VclStatusListener<Button>(this, aCommand);
+    mpButtonData->mpStatusListener->startListening();
 }
 
 void Button::Click()


More information about the Libreoffice-commits mailing list