Avoid potential negative array index access to cached text.
[LibreOffice.git] / include / sfx2 / sfxhelp.hxx
blob212188063c53b60e5eef87dd2b6baffb27fa9fea
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SFX2_SFXHELP_HXX
20 #define INCLUDED_SFX2_SFXHELP_HXX
22 #include <sal/config.h>
24 #include <string_view>
26 #include <rtl/ustring.hxx>
27 #include <sfx2/dllapi.h>
28 #include <sal/types.h>
29 #include <vcl/help.hxx>
31 class SFX2_DLLPUBLIC SfxHelp final : public Help
33 bool bIsDebug;
34 bool bLaunchingHelp; // tdf#140539 don't allow help to be re-launched during help launch
36 private:
37 SAL_DLLPRIVATE static bool Start_Impl(const OUString& rURL, weld::Widget* pWidget, const OUString& rKeyword);
38 SAL_DLLPRIVATE virtual void SearchKeyword( const OUString& rKeyWord ) override;
39 SAL_DLLPRIVATE virtual bool Start(const OUString& rURL, weld::Widget* pWidget = nullptr) override;
40 SAL_DLLPRIVATE static OUString GetHelpModuleName_Impl(std::u16string_view rHelpId);
41 SAL_DLLPRIVATE static OUString CreateHelpURL_Impl( const OUString& aCommandURL, const OUString& rModuleName );
43 SAL_DLLPRIVATE static bool Start_Impl( const OUString& rURL, const vcl::Window* pWindow );
44 SAL_DLLPRIVATE virtual bool Start( const OUString& rURL, const vcl::Window* pWindow ) override;
46 public:
47 SfxHelp();
48 virtual ~SfxHelp() override;
50 virtual OUString GetHelpText(const OUString&, const vcl::Window* pWindow) override;
51 virtual OUString GetHelpText(const OUString&, const weld::Widget* pWindow) override;
53 static OUString CreateHelpURL( const OUString& aCommandURL, const OUString& rModuleName );
54 static OUString GetDefaultHelpModule();
55 static OUString GetCurrentModuleIdentifier();
56 // Check for built-in help
57 static bool IsHelpInstalled();
59 static OUString GetURLHelpText(std::u16string_view);
62 #endif // INCLUDED_SFX2_SFXHELP_HXX
64 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */