20#include <config_folders.h>
29#include <Foundation/NSString.h>
30#include <CoreFoundation/CFURL.h>
31#include <CoreServices/CoreServices.h>
36#include <com/sun/star/uno/Reference.h>
37#include <com/sun/star/frame/Desktop.hpp>
38#include <com/sun/star/frame/UnknownModuleException.hpp>
39#include <com/sun/star/frame/XFrame2.hpp>
41#include <com/sun/star/awt/XWindow.hpp>
42#include <com/sun/star/awt/XTopWindow.hpp>
43#include <com/sun/star/beans/XPropertySet.hpp>
44#include <com/sun/star/frame/FrameSearchFlag.hpp>
46#include <com/sun/star/frame/ModuleManager.hpp>
52#include <rtl/byteseq.hxx>
53#include <rtl/ustring.hxx>
55#include <officecfg/Office/Common.hxx>
56#include <osl/process.h>
57#include <osl/file.hxx>
69#include <LibreOfficeKit/LibreOfficeKitEnums.h>
76#include <sfx2/strings.hrc>
78#include <rtl/string.hxx>
93 std::unique_ptr<weld::MessageDialog> m_xErrBox;
102 m_xErrBox->connect_help(
LINK(
nullptr, NoHelpErrorBox, HelpRequestHdl));
123OUString
const & getHelpRootURL()
125 static OUString
const s_instURL = []()
127 OUString tmp = officecfg::Office::Common::Path::Current::Help::get();
131 tmp =
"$(instpath)/" LIBO_SHARE_HELP_FOLDER;
139 if (osl::FileBase::getFileURLFromSystemPath(tmp, url) == osl::FileBase::E_None)
146bool impl_checkHelpLocalePath(OUString
const & rpPath)
148 osl::DirectoryItem directoryItem;
151 osl::FileStatus fileStatus(osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL | osl_FileStatus_Mask_FileName);
152 if (osl::DirectoryItem::get(rpPath, directoryItem) == osl::FileBase::E_None &&
153 directoryItem.getFileStatus(fileStatus) == osl::FileBase::E_None &&
154 fileStatus.isDirectory())
163bool impl_hasHelpInstalled()
171 OUString helpRootURL = getHelpRootURL() +
"/" + aLocaleStr +
"/err.html";
173 osl::DirectoryItem directoryItem;
174 if(osl::DirectoryItem::get(helpRootURL, directoryItem) == osl::FileBase::E_None){
178 SAL_INFO(
"sfx.appl",
"Checking old help installed " << bOK);
184bool impl_hasHTMLHelpInstalled()
192 OUString helpRootURL = getHelpRootURL() +
"/" + aLocaleStr +
"/text";
193 bool bOK = impl_checkHelpLocalePath( helpRootURL );
194 SAL_INFO(
"sfx.appl",
"Checking new help (html) installed " << bOK);
206 static OUString aLocaleStr;
207 if (!aLocaleStr.isEmpty())
210 static constexpr OUStringLiteral aEnglish(
u"en-US");
214 if ( aLocaleStr.isEmpty() )
216 aLocaleStr = aEnglish;
221 OUString sLang = aLocaleStr;
222 sal_Int32 nSepPos = sLang.indexOf(
'-' );
225 sLang = sLang.copy( 0, nSepPos );
227 OUString sHelpPath(
"");
229 if (impl_checkHelpLocalePath(sHelpPath))
234 if (impl_checkHelpLocalePath(sHelpPath))
239 sHelpPath = getHelpRootURL() +
"/" + aLocaleStr;
240 if (impl_checkHelpLocalePath(sHelpPath))
244 sHelpPath = getHelpRootURL() +
"/" + sLang;
245 if (impl_checkHelpLocalePath(sHelpPath))
251 if (impl_checkHelpLocalePath(sHelpPath))
253 aLocaleStr = aEnglish;
256 sHelpPath = getHelpRootURL() +
"/" + aEnglish;
257 if (impl_checkHelpLocalePath(sHelpPath))
259 aLocaleStr = aEnglish;
280 rURL.append(
"Language=");
281 rURL.append(aLocaleStr);
282 rURL.append(
"&System=");
283 rURL.append(officecfg::Office::Common::Help::System::get());
284 rURL.append(
"&Version=");
295 Reference< css::ucb::XCommandEnvironment >(),
301 if ( !sAnchor.isEmpty() )
309 SAL_WARN(
"sfx.appl",
"Property 'AnchorName' is missing" );
312 catch (
const css::uno::Exception&)
324 static OUString GetHelpText(
const OUString& aCommandURL,
const OUString& rModule );
329OUString SfxHelp_Impl::GetHelpText(
const OUString& aCommandURL,
const OUString& rModule )
334 sal_Int32
nIndex = aHelpURL.lastIndexOf(
'#' );
336 nIndex = aHelpURL.getLength();
337 aHelpURL.insert( nIndex,
"&Active=true" );
344 , bLaunchingHelp(false)
349 OUString sEnvVarName(
"HELP_DEBUG" );
350 osl_getEnvironment( sEnvVarName.pData, &sHelpDebug.pData );
360 OUString sDefaultModule;
363 sDefaultModule =
"swriter";
365 sDefaultModule =
"scalc";
367 sDefaultModule =
"simpress";
369 sDefaultModule =
"sdraw";
371 sDefaultModule =
"smath";
373 sDefaultModule =
"schart";
375 sDefaultModule =
"sbasic";
377 sDefaultModule =
"sdatabase";
380 SAL_WARN(
"sfx.appl",
"getDefaultModule_Impl(): no module installed" );
382 return sDefaultModule;
387 OUString sIdentifier;
388 Reference < XComponentContext > xContext = ::comphelper::getProcessComponentContext();
389 Reference < XModuleManager2 > xModuleManager = ModuleManager::create(xContext);
390 Reference < XDesktop2 > xDesktop = Desktop::create(xContext);
391 Reference < XFrame > xCurrentFrame = xDesktop->getCurrentFrame();
393 if ( xCurrentFrame.is() )
397 sIdentifier = xModuleManager->identify( xCurrentFrame );
399 catch (
const css::frame::UnknownModuleException&)
401 SAL_INFO(
"sfx.appl",
"SfxHelp::getCurrentModuleIdentifier_Impl(): unknown module (help in help?)" );
405 TOOLS_WARN_EXCEPTION(
"sfx.appl",
"SfxHelp::getCurrentModuleIdentifier_Impl(): exception of XModuleManager::identify()" );
414 OUString MapModuleIdentifier(
const OUString &rFactoryShortName)
416 OUString aFactoryShortName(rFactoryShortName);
419 if ( aFactoryShortName ==
"chart2" )
420 aFactoryShortName =
"schart" ;
421 else if ( aFactoryShortName ==
"BasicIDE" )
422 aFactoryShortName =
"sbasic";
423 else if ( aFactoryShortName ==
"sweb"
424 || aFactoryShortName ==
"sglobal"
425 || aFactoryShortName ==
"swxform" )
426 aFactoryShortName =
"swriter" ;
427 else if ( aFactoryShortName ==
"dbquery"
428 || aFactoryShortName ==
"dbbrowser"
429 || aFactoryShortName ==
"dbrelation"
430 || aFactoryShortName ==
"dbtable"
431 || aFactoryShortName ==
"dbapp"
432 || aFactoryShortName ==
"dbreport"
433 || aFactoryShortName ==
"dbtdata"
434 || aFactoryShortName ==
"swreport"
435 || aFactoryShortName ==
"swform" )
436 aFactoryShortName =
"sdatabase";
437 else if ( aFactoryShortName ==
"sbibliography"
438 || aFactoryShortName ==
"sabpilot"
439 || aFactoryShortName ==
"scanner"
440 || aFactoryShortName ==
"spropctrlr"
441 || aFactoryShortName ==
"StartModule" )
442 aFactoryShortName.clear();
444 return aFactoryShortName;
450 OUString aFactoryShortName;
457 std::u16string_view sRemainder;
460 std::size_t nEndModule = sRemainder.find(
u'/');
461 aFactoryShortName = nEndModule != std::u16string_view::npos
462 ? sRemainder.substr(0, nEndModule) : sRemainder;
465 if (aFactoryShortName.isEmpty())
468 if (!aModuleIdentifier.isEmpty())
472 Reference < XModuleManager2 > xModuleManager(
473 ModuleManager::create(::comphelper::getProcessComponentContext()) );
474 Sequence< PropertyValue > lProps;
475 xModuleManager->getByName( aModuleIdentifier ) >>= lProps;
476 auto pProp = std::find_if(std::cbegin(lProps), std::cend(lProps),
477 [](
const PropertyValue& rProp) {
return rProp.Name ==
"ooSetupFactoryShortName"; });
478 if (pProp != std::cend(lProps))
479 pProp->Value >>= aFactoryShortName;
488 if (!aFactoryShortName.isEmpty())
489 aFactoryShortName = MapModuleIdentifier(aFactoryShortName);
490 if (aFactoryShortName.isEmpty())
493 return aFactoryShortName;
499 OUStringBuffer aHelpURL(
"vnd.sun.star.help://");
500 bool bHasAnchor =
false;
503 OUString aModuleName( rModuleName );
504 if (aModuleName.isEmpty())
507 aHelpURL.append(aModuleName);
509 if ( aCommandURL.isEmpty() )
510 aHelpURL.append(
"/start");
513 aHelpURL.append(
"/" +
514 rtl::Uri::encode(aCommandURL,
515 rtl_UriCharClassRelSegment,
516 rtl_UriEncodeKeepEscapes,
517 RTL_TEXTENCODING_UTF8));
519 OUStringBuffer aTempURL = aHelpURL;
527 aHelpURL.append(
"#" + aAnchor);
529 return aHelpURL.makeStringAndClear();
533 Reference< XFrame >& rHelpContent)
535 Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
538 Reference< XFrame2 > xHelpTask(
539 xDesktop->findFrame(
"OFFICE_HELP_TASK", FrameSearchFlag::TASKS | FrameSearchFlag::CREATE),
545 Reference< css::awt::XWindow > xParentWindow = xHelpTask->getContainerWindow();
550 Reference< XFrame > xHelpContent;
551 if (xHelpTask->setComponent( xHelpWindow, Reference< XController >() ))
554 xHelpTask->setName(
"OFFICE_HELP_TASK");
556 Reference< XPropertySet > xProps(xHelpTask, UNO_QUERY);
558 xProps->setPropertyValue(
562 pHelpWindow->setContainerWindow( xParentWindow );
563 xParentWindow->setVisible(
true);
564 xHelpWindow->setVisible(
true);
568 xHelpContent = xHelpTask->findFrame(
"OFFICE_HELP", FrameSearchFlag::CHILDREN);
571 if (!xHelpContent.is())
577 xHelpContent->setName(
"OFFICE_HELP");
579 rHelpTask = xHelpTask;
580 rHelpContent = xHelpContent;
589 OUString sHelpText = SfxHelp_Impl::GetHelpText( sRealCommand.isEmpty() ? aCommandURL : sRealCommand, sModuleName );
593 if (pWindow && sHelpText.isEmpty())
600 sHelpText = SfxHelp_Impl::GetHelpText( aNewHelpId, sModuleName );
601 if (!sHelpText.isEmpty())
607 if (
bIsDebug && sHelpText.isEmpty())
614 sHelpText +=
"\n-------------\n" +
615 sModuleName +
": " + aCommandURL;
616 if ( !aNewHelpId.isEmpty() )
618 sHelpText +=
" - " + aNewHelpId;
630 OUString sHelpText = SfxHelp_Impl::GetHelpText( sRealCommand.isEmpty() ? aCommandURL : sRealCommand, sModuleName );
634 if (pWidget && sHelpText.isEmpty())
637 std::unique_ptr<weld::Widget> xParent(pWidget->
weld_parent());
640 aNewHelpId = xParent->get_help_id();
641 sHelpText = SfxHelp_Impl::GetHelpText( aNewHelpId, sModuleName );
642 if (!sHelpText.isEmpty())
645 xParent = xParent->weld_parent();
648 if (
bIsDebug && sHelpText.isEmpty())
655 sHelpText +=
"\n-------------\n" +
656 sModuleName +
": " + aCommandURL;
657 if ( !aNewHelpId.isEmpty() )
659 sHelpText +=
" - " + aNewHelpId;
674 OUString aModStr(aModifiedCode.
GetName());
675 aModStr = aModStr.replaceFirst(aCode.
GetName(),
"");
676 aModStr = aModStr.replaceAll(
"+",
"");
678 = bCtrlClickHlink ?
SfxResId(STR_CTRLCLICKHYPERLINK) :
SfxResId(STR_CLICKHYPERLINK);
679 aHelpStr = aHelpStr.replaceFirst(
"%{key}", aModStr);
680 aHelpStr = aHelpStr.replaceFirst(
"%{link}",
aURL);
704 bool bRet =
Start_Impl(rURL, pWidget, OUString());
712 static constexpr OUStringLiteral aInternal(
u"vnd.sun.star.help://");
713 if ( rURL.getLength() <= aInternal.getLength() || !rURL.startsWith(aInternal) )
716 OUString aHelpLink = officecfg::Office::Common::Help::HelpRootURL::get();
717 OUString aTarget = OUString::Concat(
"Target=") + rURL.subView(aInternal.getLength());
718 aTarget = aTarget.replaceAll(
"%2F",
"/").replaceAll(
"?",
"&");
719 aHelpLink += aTarget;
725 pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED,
742 LSOpenCFURLRef(CFURLCreateWithString(kCFAllocatorDefault,
743 CFStringCreateWithCString(kCFAllocatorDefault,
744 aHelpLink.toUtf8().getStr(),
745 kCFStringEncodingUTF8),
762bool rewriteFlatpakHelpRootUrl(OUString * helpRootUrl) {
763 assert(helpRootUrl !=
nullptr);
768 struct Failure:
public std::exception {};
770 static auto const url = [] {
775 osl::File ini(
"file:///.flatpak-info");
776 auto err = ini.open(osl_File_OpenFlag_Read);
777 if (err != osl::FileBase::E_None) {
778 SAL_WARN(
"sfx.appl",
"LIBO_FLATPAK mode failure opening /.flatpak-info: " << err);
783 bool havePath =
false;
784 bool haveExtensions =
false;
785 for (
bool instance =
false; !(havePath && haveExtensions);) {
786 rtl::ByteSequence
bytes;
788 if (err != osl::FileBase::E_None) {
791 "LIBO_FLATPAK mode reading /.flatpak-info fails with " << err
792 <<
" before [Instance] app-path");
795 std::string_view
const line(
796 reinterpret_cast<char const *
>(
bytes.getConstArray()),
bytes.getLength());
798 static constexpr auto keyPath = std::string_view(
"app-path=");
799 static constexpr auto keyExtensions = std::string_view(
"app-extensions=");
800 if (!havePath &&
line.length() >= keyPath.size()
801 &&
line.substr(0, keyPath.size()) == keyPath.data())
803 auto const value =
line.substr(keyPath.size());
804 if (!rtl_convertStringToUString(
806 osl_getThreadTextEncoding(),
807 (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR
808 | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
809 | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)))
813 "LIBO_FLATPAK mode failure converting app-path \"" << value
818 }
else if (!haveExtensions &&
line.length() >= keyExtensions.size()
819 &&
line.substr(0, keyExtensions.size()) == keyExtensions.data())
821 auto const value =
line.substr(keyExtensions.size());
822 if (!rtl_convertStringToUString(
824 osl_getThreadTextEncoding(),
825 (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR
826 | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
827 | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)))
831 "LIBO_FLATPAK mode failure converting app-extensions \"" << value
835 haveExtensions =
true;
836 }
else if (
line.length() > 0 && line[0] ==
'[') {
839 "LIBO_FLATPAK mode /.flatpak-info lacks [Instance] app-path and"
843 }
else if (line ==
"[Instance]") {
850 for (sal_Int32 i = 0;;) {
851 OUString elem =
extensions.getToken(0,
';', i);
852 if (elem.startsWith(
"org.libreoffice.LibreOffice.Help=", &sha)) {
858 "LIBO_FLATPAK mode /.flatpak-info [Instance] app-extensions \""
859 <<
extensions <<
"\" org.libreoffice.LibreOffice.Help");
869 static constexpr OUStringLiteral segments =
u"/app/org.libreoffice.LibreOffice/";
870 auto const i1 = path.lastIndexOf(segments);
876 "LIBO_FLATPAK mode /.flatpak-info [Instance] app-path \"" << path
877 <<
"\" doesn't contain /app/org.libreoffice.LibreOffice/");
880 auto const i2 = i1 + segments.getLength();
881 auto i3 = path.indexOf(
'/', i2);
885 "LIBO_FLATPAK mode /.flatpak-info [Instance] app-path \"" << path
886 <<
"\" doesn't contain branch segment");
889 i3 = path.indexOf(
'/', i3 + 1);
893 "LIBO_FLATPAK mode /.flatpak-info [Instance] app-path \"" << path
894 <<
"\" doesn't contain sha segment");
898 auto const i4 = path.indexOf(
'/', i3);
902 "LIBO_FLATPAK mode /.flatpak-info [Instance] app-path \"" << path
903 <<
"\" doesn't contain files segment");
906 path = path.subView(0, i1) + OUString::Concat(
"/runtime/org.libreoffice.LibreOffice.Help/")
907 + path.subView(i2, i3 - i2) + sha + path.subView(i4);
910 err = osl::FileBase::getFileURLFromSystemPath(path, url_);
911 if (err != osl::FileBase::E_None) {
914 "LIBO_FLATPAK mode failure converting app-path \"" << path <<
"\" to URL: "
922 }
catch (Failure &) {
931constexpr OUStringLiteral
SHTML1 =
u"<!DOCTYPE HTML><html lang=\"en-US\"><head><meta charset=\"UTF-8\">";
932constexpr OUStringLiteral
SHTML2 =
u"<noscript><meta http-equiv=\"refresh\" content=\"0; url='";
933constexpr OUStringLiteral
SHTML3 =
u"/noscript.html'\"></noscript><meta http-equiv=\"refresh\" content=\"1; url='";
934constexpr OUStringLiteral
SHTML4 =
u"'\"><script type=\"text/javascript\"> window.location.href = \"";
935constexpr OUStringLiteral
SHTML5 =
u"\";</script><title>Help Page Redirection</title></head><body></body></html>";
940 OUString aBaseInstallPath = getHelpRootURL();
947 OUString aHelpLink( aBaseInstallPath +
"/index.html?" );
948 OUString aTarget = OUString::Concat(
"Target=") + rURL.subView(RTL_CONSTASCII_LENGTH(
"vnd.sun.star.help://"));
949 aTarget = aTarget.replaceAll(
"%2F",
"/").replaceAll(
"?",
"&");
950 aHelpLink += aTarget;
954 static constexpr OUStringLiteral aExtension(
u".html");
955 OUString * parent =
nullptr;
975 LSOpenCFURLRef(CFURLCreateWithString(kCFAllocatorDefault,
976 CFStringCreateWithCString(kCFAllocatorDefault,
977 aTempFile.
GetURL().toUtf8().getStr(),
978 kCFStringEncodingUTF8),
1014 std::unique_ptr<weld::CheckButton> m_xHideOfflineHelpCB;
1018 : MessageDialogController(pParent,
"sfx/ui/helpmanual.ui",
"onlinehelpmanual",
"hidedialog")
1019 , m_xHideOfflineHelpCB(m_xBuilder->weld_check_button(
"hidedialog"))
1027 bool GetOfflineHelpPopUp()
const {
return !m_xHideOfflineHelpCB->get_active(); }
1034 OUStringBuffer aHelpRootURL(
"vnd.sun.star.help://");
1053 switch ( nProtocol )
1055 case INetProtocol::VndSunStarHelp:
1062 OUString aRealCommand;
1064 if ( nProtocol == INetProtocol::Uno )
1072 aHelpURL =
CreateHelpURL_Impl( aRealCommand.isEmpty() ? rURL : aRealCommand, aHelpModuleName );
1080 OUString aHelpId = pParent->
GetHelpId();
1102 pWindow = GetBestParent(pWindow);
1111 if (@available(macOS 10.14, *)) {
1114 CFURLRef pBrowser = LSCopyDefaultApplicationURLForURL(
1115 CFURLCreateWithString(
1116 kCFAllocatorDefault,
1117 static_cast<CFStringRef
>(
@"https://www.libreoffice.org"),
1119 kLSRolesAll,
nullptr);
1120 if([
static_cast<NSString*
>(CFURLGetString(pBrowser)) hasSuffix:
@"/Applications/Safari.app/"]) {
1138 if ( !impl_hasHelpInstalled() )
1140 bool bShowOfflineHelpPopUp = officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::get();
1144 if(bShowOfflineHelpPopUp)
1147 HelpManualMessage aQueryBox(pWeldWindow);
1148 short OnlineHelpBox = aQueryBox.run();
1149 bShowOfflineHelpPopUp = OnlineHelpBox !=
RET_OK;
1151 officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::set(aQueryBox.GetOfflineHelpPopUp(), xChanges);
1155 if(!bShowOfflineHelpPopUp)
1162 NoHelpErrorBox aErrBox(pWeldWindow);
1176 Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
1181 Reference< XFrame2 > xHelp(
1182 xDesktop->findFrame(
"OFFICE_HELP_TASK", FrameSearchFlag::CHILDREN),
1184 Reference< XFrame > xHelpContent = xDesktop->findFrame(
1186 FrameSearchFlag::CHILDREN);
1193 if (!xHelp.is() || !xHelpContent.is() || !pHelpWindow)
1196 SAL_INFO(
"sfx.appl",
"HelpId = " << aHelpURL);
1201 Reference < css::awt::XTopWindow > xTopWindow( xHelp->getContainerWindow(), UNO_QUERY );
1202 if ( xTopWindow.is() )
1203 xTopWindow->toFront();
1210 OUStringBuffer aHelpRootURL(
"vnd.sun.star.help://");
1229 switch ( nProtocol )
1231 case INetProtocol::VndSunStarHelp:
1238 OUString aRealCommand;
1240 if ( nProtocol == INetProtocol::Uno )
1248 aHelpURL =
CreateHelpURL_Impl( aRealCommand.isEmpty() ? rURL : aRealCommand, aHelpModuleName );
1252 bool bUseFinalFallback =
true;
1254 pWidget->
help_hierarchy_foreach([&aHelpModuleName, &aHelpURL, &bUseFinalFallback](
const OUString& rHelpId){
1255 if (rHelpId.isEmpty())
1260 bUseFinalFallback =
false;
1264 if (bUseFinalFallback)
1280 if (@available(macOS 10.14, *)) {
1283 CFURLRef pBrowser = LSCopyDefaultApplicationURLForURL(
1284 CFURLCreateWithString(
1285 kCFAllocatorDefault,
1286 static_cast<CFStringRef
>(
@"https://www.libreoffice.org"),
1288 kLSRolesAll,
nullptr);
1289 if([
static_cast<NSString*
>(CFURLGetString(pBrowser)) hasSuffix:
@"/Applications/Safari.app/"]) {
1307 if ( !impl_hasHelpInstalled() )
1309 bool bShowOfflineHelpPopUp = officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::get();
1313 if(bShowOfflineHelpPopUp)
1316 HelpManualMessage aQueryBox(pWidget);
1317 short OnlineHelpBox = aQueryBox.run();
1318 bShowOfflineHelpPopUp = OnlineHelpBox !=
RET_OK;
1320 officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::set(aQueryBox.GetOfflineHelpPopUp(), xChanges);
1324 if(!bShowOfflineHelpPopUp)
1331 NoHelpErrorBox aErrBox(pWidget);
1346 Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
1351 Reference< XFrame2 > xHelp(
1352 xDesktop->findFrame(
"OFFICE_HELP_TASK", FrameSearchFlag::CHILDREN),
1354 Reference< XFrame > xHelpContent = xDesktop->findFrame(
1356 FrameSearchFlag::CHILDREN);
1363 if (!xHelp.is() || !xHelpContent.is() || !pHelpWindow)
1366 SAL_INFO(
"sfx.appl",
"HelpId = " << aHelpURL);
1370 if (!rKeyword.isEmpty())
1373 Reference < css::awt::XTopWindow > xTopWindow( xHelp->getContainerWindow(), UNO_QUERY );
1374 if ( xTopWindow.is() )
1375 xTopWindow->toFront();
1398 return impl_hasHelpInstalled();
PropertiesInfo aProperties
const LanguageTag & GetUILanguageTag() const
virtual void libreOfficeKitViewCallback(int nType, const OString &pPayload) const override
static const AllSettings & GetSettings()
INetProtocol GetProtocol() const
LanguageType getLanguageType(bool bResolveSystem=true) const
const OUString & getBcp47(bool bResolveSystem=true) const
static OUString GetActiveHelpString(const OUString &rURL)
static std::vector< OUString > GetResultSet(const OUString &rURL)
static bool IsHelpErrorDocument(std::u16string_view rURL)
void SetHelpURL(std::u16string_view rURL)
void OpenKeyword(const OUString &rKeyword)
void loadHelpContent(const OUString &sHelpURL, bool bAddToHistory=true)
static SAL_DLLPRIVATE OUString CreateHelpURL_Impl(const OUString &aCommandURL, const OUString &rModuleName)
virtual SAL_DLLPRIVATE void SearchKeyword(const OUString &rKeyWord) override
static SAL_DLLPRIVATE bool Start_Impl(const OUString &rURL, weld::Widget *pWidget, const OUString &rKeyword)
static OUString CreateHelpURL(const OUString &aCommandURL, const OUString &rModuleName)
virtual SAL_DLLPRIVATE bool Start(const OUString &rURL, weld::Widget *pWidget=nullptr) override
virtual ~SfxHelp() override
static bool IsHelpInstalled()
static OUString GetURLHelpText(std::u16string_view)
static SAL_DLLPRIVATE OUString GetHelpModuleName_Impl(std::u16string_view rHelpId)
static OUString GetCurrentModuleIdentifier()
static OUString GetDefaultHelpModule()
virtual OUString GetHelpText(const OUString &, const vcl::Window *pWindow) override
One SfxViewShell more or less represents one edit window for a document, there can be multiple ones f...
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
bool WriteUnicodeOrByteText(std::u16string_view rStr, rtl_TextEncoding eDestCharSet)
void SetStreamCharSet(rtl_TextEncoding eCharSet)
static OUString GetLanguageString(const LanguageType eType)
bool IsModuleInstalled(EModule eModule) const
OUString SubstituteVariable(const OUString &rVar) const
void incBusy(const weld::Widget *pIgnore)
static css::uno::Reference< css::awt::XWindow > GetInterface(vcl::Window *pWindow)
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
static std::shared_ptr< ConfigurationChanges > create()
css::uno::Any getPropertyValue(const OUString &rPropertyName)
static OUString getProductVersion()
static OUString getUILocale()
void EnableKillingFile(bool bEnable=true)
SvStream * GetStream(StreamMode eMode)
OUString const & GetURL() const
vcl::Window * GetParent() const
WindowType GetType() const
const OUString & GetHelpId() const
bool IsSystemWindow() const
weld::Window * GetFrameWeld() const
OUString get_primary_text() const
void set_primary_text(const OUString &rText)
#define TOOLS_WARN_EXCEPTION(area, stream)
constexpr sal_uInt16 KEY_MOD1
constexpr sal_uInt16 KEY_SPACE
#define LINK(Instance, Class, Member)
#define DECL_STATIC_LINK(Class, Member, ArgType, RetType)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
def run(arg=None, arg2=-1)
bool IsOptionSet(EOption eOption)
const LanguageTag & getLanguageTag()
Reference< XComponentContext > getProcessComponentContext()
bool createTemporaryHtmlDirectory(OUString **url)
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
void openUriExternally(const OUString &sURI, bool bHandleSystemShellExecuteException, weld::Widget *pDialogParent)
Open a URI via com.sun.star.system.SystemShellExecute.
Sequence< beans::PropertyValue > GetCommandProperties(const OUString &rsCommandName, const OUString &rsModuleName)
OUString GetRealCommandForCommand(const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
std::vector< sal_uInt8 > bytes
constexpr OUStringLiteral SHTML2
static OUString getCurrentModuleIdentifier_Impl()
static SfxHelpWindow_Impl * impl_createHelp(Reference< XFrame2 > &rHelpTask, Reference< XFrame > &rHelpContent)
constexpr OUStringLiteral SHTML3
constexpr OUStringLiteral SHTML4
constexpr OUStringLiteral SHTML5
constexpr OUStringLiteral SHTML1
static OUString const & HelpLocaleString()
Return the locale we prefer for displaying help.
static OUString getDefaultModule_Impl()
IMPL_STATIC_LINK_NOARG(NoHelpErrorBox, HelpRequestHdl, weld::Widget &, bool)
static bool impl_showOnlineHelp(const OUString &rURL, weld::Widget *pDialogParent)
Redirect the vnd.sun.star.help:// urls to http://help.libreoffice.org.
void AppendConfigToken(OUStringBuffer &rURL, bool bQuestionMark)
Appends ?Language=xy&System=abc to the help URL in rURL.
static bool impl_showOfflineHelp(const OUString &rURL, weld::Widget *pDialogParent)
static bool GetHelpAnchor_Impl(std::u16string_view _rURL, OUString &_rAnchor)
OUString SfxResId(TranslateId aId)
VCL_DLLPUBLIC Application * GetpApp()