[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - include/vcl officecfg/registry sfx2/source svtools/source vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Mar 12 12:44:33 UTC 2019


 include/vcl/button.hxx                                     |    2 +
 include/vcl/settings.hxx                                   |    2 +
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |    6 +++
 sfx2/source/appl/sfxhelp.cxx                               |    5 +--
 svtools/source/config/accessibilityoptions.cxx             |   20 +++++++++++++
 vcl/source/app/settings.cxx                                |   20 ++++++++++++-
 vcl/source/control/button.cxx                              |   11 +++++++
 7 files changed, 62 insertions(+), 4 deletions(-)

New commits:
commit e5a0bafa330c58d6c9352d3acbe4e97fafa1ad56
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Mon Mar 11 22:40:32 2019 -0400
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Mar 12 13:44:08 2019 +0100

    Make the Help URL configurable
    
    When the Help URL is blank, the Help
    buttons are hidden LOK (but not desktop).
    
    Change-Id: Ibd76452108d1e3a92fb43f2c0af0586b0cbed073
    Reviewed-on: https://gerrit.libreoffice.org/69071
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx
index fbba11e5ef81..af8354994025 100644
--- a/include/vcl/button.hxx
+++ b/include/vcl/button.hxx
@@ -269,6 +269,8 @@ private:
                         HelpButton( const HelpButton & ) = delete;
                         HelpButton & operator= ( const HelpButton & ) = delete;
 
+    virtual void    StateChanged( StateChangedType nStateChange ) override;
+
 public:
     explicit        HelpButton( vcl::Window* pParent, WinBits nStyle = 0 );
 
diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index 494e2bb8f24f..3f03059c7fc3 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -650,6 +650,8 @@ public:
     void                            SetTipTimeout( sal_uLong nTipTimeout );
     sal_uLong                       GetTipTimeout() const;
     sal_uLong                       GetBalloonDelay() const;
+    OUString                        GetHelpURL() const;
+    void                            SetHelpURL(const OUString& rsHelpURL);
 
     bool                            operator ==( const HelpSettings& rSet ) const;
     bool                            operator !=( const HelpSettings& rSet ) const;
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index d65e0f194c08..8cecbaedc258 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -6043,6 +6043,12 @@
         </info>
         <value>true</value>
       </prop>
+      <prop oor:name="HelpURL" oor:type="xs:string" oor:nillable="false">
+        <info>
+          <desc>Specifies the URL to the Office help page. Blank disables help buttons.</desc>
+        </info>
+        <value>https://help.collaboraoffice.com/help.html?</value>
+      </prop>
       <prop oor:name="HelpTipSeconds" oor:type="xs:short" oor:nillable="false">
         <info>
           <desc>Enables or disables the automatic time out of help tips. You
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 473103cf7e47..5ee590123929 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -535,12 +535,11 @@ bool SfxHelp::Start( const OUString& rURL, const vcl::Window* pWindow )
 /// Redirect the vnd.sun.star.help:// urls to http://help.libreoffice.org
 static bool impl_showOnlineHelp( const OUString& rURL )
 {
-    OUString aInternal( "vnd.sun.star.help://"  );
+    static const OUString aInternal("vnd.sun.star.help://");
     if ( rURL.getLength() <= aInternal.getLength() || !rURL.startsWith(aInternal) )
         return false;
 
-    OUString aHelpLink("https://help.collaboraoffice.com/help.html?");
-
+    OUString aHelpLink = Application::GetSettings().GetHelpSettings().GetHelpURL();
     OUString aTarget = "Target=" + rURL.copy(aInternal.getLength());
     aTarget = aTarget.replaceAll("%2F", "/").replaceAll("?", "&");
     aHelpLink += aTarget;
diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx
index 98f5eb96a452..23c06d4a0d3a 100644
--- a/svtools/source/config/accessibilityoptions.cxx
+++ b/svtools/source/config/accessibilityoptions.cxx
@@ -65,6 +65,7 @@ public:
     sal_Int16   GetListBoxMaximumLineCount() const;
     sal_Int16   GetColorValueSetColumnCount() const;
     bool        GetPreviewUsesCheckeredBackground() const;
+    OUString    GetHelpURL() const;
 };
 
 // initialization of static members --------------------------------------
@@ -134,6 +135,24 @@ bool SvtAccessibilityOptions_Impl::GetIsHelpTipsDisappear() const
     return bRet;
 }
 
+OUString SvtAccessibilityOptions_Impl::GetHelpURL() const
+{
+    css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+    OUString sRet;
+
+    try
+    {
+        if(xNode.is())
+            xNode->getPropertyValue("HelpURL") >>= sRet;
+    }
+    catch(const css::uno::Exception& ex)
+    {
+        SAL_WARN("svtools.config", "Caught unexpected: " << ex);
+    }
+
+    return sRet;
+}
+
 bool SvtAccessibilityOptions_Impl::GetIsAllowAnimatedGraphics() const
 {
     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
@@ -304,6 +323,7 @@ void SvtAccessibilityOptions_Impl::SetVCLSettings()
     bool StyleSettingsChanged(false);
 
     aHelpSettings.SetTipTimeout( GetIsHelpTipsDisappear() ? GetHelpTipSeconds() * 1000 : HELP_TIP_TIMEOUT);
+    aHelpSettings.SetHelpURL(GetHelpURL());
     aAllSettings.SetHelpSettings(aHelpSettings);
 
     const sal_Int16 nEdgeBlendingCountA(GetEdgeBlending());
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index e2841b8b4ed2..0490654461ae 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -228,6 +228,7 @@ struct ImplHelpData
     sal_uLong                           mnTipDelay;
     sal_uLong                           mnTipTimeout;
     sal_uLong                           mnBalloonDelay;
+    OUString                            msHelpURL;
 };
 
 struct ImplAllSettingsData
@@ -2590,6 +2591,7 @@ ImplHelpData::ImplHelpData( const ImplHelpData& rData )
     mnTipDelay                  = rData.mnTipDelay;
     mnTipTimeout                = rData.mnTipTimeout;
     mnBalloonDelay              = rData.mnBalloonDelay;
+    msHelpURL                   = rData.msHelpURL;
 }
 
 HelpSettings::HelpSettings()
@@ -2608,7 +2610,8 @@ bool HelpSettings::operator ==( const HelpSettings& rSet ) const
 
     return (mxData->mnTipDelay        == rSet.mxData->mnTipDelay ) &&
          (mxData->mnTipTimeout      == rSet.mxData->mnTipTimeout ) &&
-         (mxData->mnBalloonDelay    == rSet.mxData->mnBalloonDelay );
+         (mxData->mnBalloonDelay    == rSet.mxData->mnBalloonDelay ) &&
+         (mxData->msHelpURL == rSet.mxData->msHelpURL);
 }
 
 sal_uLong
@@ -2639,6 +2642,21 @@ HelpSettings::GetBalloonDelay() const
     return mxData->mnBalloonDelay;
 }
 
+OUString
+HelpSettings::GetHelpURL() const
+{
+    return mxData->msHelpURL;
+}
+
+void HelpSettings::SetHelpURL(const OUString& rsHelpURL)
+{
+    // copy if other references exist
+    if ( ! mxData.unique() ) {
+        mxData = std::make_shared<ImplHelpData>(*mxData);
+    }
+    mxData->msHelpURL = rsHelpURL;
+}
+
 bool
 HelpSettings::operator !=( const HelpSettings& rSet ) const
 {
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 0371940d5644..6e44e13bc67b 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -45,6 +45,7 @@
 #include <o3tl/make_unique.hxx>
 
 #include <comphelper/dispatchcommand.hxx>
+#include <comphelper/lok.hxx>
 
 
 using namespace css;
@@ -1811,6 +1812,16 @@ void HelpButton::Click()
     PushButton::Click();
 }
 
+void HelpButton::StateChanged( StateChangedType nStateChange )
+{
+    // Hide when we have no help URL.
+    if (comphelper::LibreOfficeKit::isActive() &&
+        Application::GetSettings().GetHelpSettings().GetHelpURL().isEmpty())
+        Hide();
+    else
+        PushButton::StateChanged(nStateChange);
+}
+
 void RadioButton::ImplInitRadioButtonData()
 {
     mbChecked       = false;


More information about the Libreoffice-commits mailing list