summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2019-03-11 22:40:32 -0400
committerAndras Timar <andras.timar@collabora.com>2019-03-12 13:44:08 +0100
commite5a0bafa330c58d6c9352d3acbe4e97fafa1ad56 (patch)
tree099192880087ea92589323def40c64c367d71ea2
parentab71569a7c1e1a262bfbfac998cf4acb092ed383 (diff)
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@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--include/vcl/button.hxx2
-rw-r--r--include/vcl/settings.hxx2
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs6
-rw-r--r--sfx2/source/appl/sfxhelp.cxx5
-rw-r--r--svtools/source/config/accessibilityoptions.cxx20
-rw-r--r--vcl/source/app/settings.cxx20
-rw-r--r--vcl/source/control/button.cxx11
7 files changed, 62 insertions, 4 deletions
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;