summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-08-17 12:52:55 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-08-17 13:02:33 +0200
commit1f088bb8dddfb71ebb7f5bba701a28c05651436b (patch)
tree9f2a018f051da15d59c09a6ae61a61978863ed80 /sfx2
parentdb4c4676b70bb5f9a1c169735e8fbe92b097a57b (diff)
Move application check to the point where it matters
This simplifies and deduplicates call sites, and also makes sure that we don't lookup strings until we need that. Also helps adding a check for Math in a follow-up. Change-Id: I6b073253f19afbb9a95f29806ab306c6a9f63f18 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138413 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 4384482e6740..ff645ce23384 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -70,13 +70,13 @@ namespace
const sal_Int32 gnWidthCloseThreshold (70);
const sal_Int32 gnWidthOpenThreshold (40);
- std::string UnoNameFromDeckId(std::u16string_view rsDeckId, bool isImpress = false)
+ std::string UnoNameFromDeckId(std::u16string_view rsDeckId, const sfx2::sidebar::Context& context)
{
if (rsDeckId == u"SdCustomAnimationDeck")
return ".uno:CustomAnimation";
if (rsDeckId == u"PropertyDeck")
- return isImpress ? ".uno:ModifyPage" : ".uno:Sidebar";
+ return vcl::EnumContext::Application::Impress == vcl::EnumContext::GetApplicationEnum(context.msApplication) ? ".uno:ModifyPage" : ".uno:Sidebar";
if (rsDeckId == u"SdLayoutsDeck")
return ".uno:ModifyPage";
@@ -223,7 +223,7 @@ void SidebarController::disposeDecks()
{
if (const SfxViewShell* pViewShell = mpViewFrame->GetViewShell())
{
- const std::string hide = UnoNameFromDeckId(msCurrentDeckId, vcl::EnumContext::Application::Impress == vcl::EnumContext::GetApplicationEnum(GetCurrentContext().msApplication));
+ const std::string hide = UnoNameFromDeckId(msCurrentDeckId, GetCurrentContext());
if (!hide.empty())
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
(hide + "=false").c_str());
@@ -803,13 +803,13 @@ void SidebarController::SwitchToDeck (
{
if (msCurrentDeckId != rDeckDescriptor.msId)
{
- const std::string hide = UnoNameFromDeckId(msCurrentDeckId, vcl::EnumContext::Application::Impress == vcl::EnumContext::GetApplicationEnum(GetCurrentContext().msApplication));
+ const std::string hide = UnoNameFromDeckId(msCurrentDeckId, GetCurrentContext());
if (!hide.empty())
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
(hide + "=false").c_str());
}
- const std::string show = UnoNameFromDeckId(rDeckDescriptor.msId, vcl::EnumContext::Application::Impress == vcl::EnumContext::GetApplicationEnum(GetCurrentContext().msApplication));
+ const std::string show = UnoNameFromDeckId(rDeckDescriptor.msId, GetCurrentContext());
if (!show.empty())
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
(show + "=true").c_str());
@@ -1326,7 +1326,7 @@ void SidebarController::UpdateDeckOpenState()
if (const SfxViewShell* pViewShell = mpViewFrame->GetViewShell())
{
- const std::string uno = UnoNameFromDeckId(msCurrentDeckId, vcl::EnumContext::Application::Impress == vcl::EnumContext::GetApplicationEnum(GetCurrentContext().msApplication));
+ const std::string uno = UnoNameFromDeckId(msCurrentDeckId, GetCurrentContext());
if (!uno.empty())
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
(uno + "=true").c_str());
@@ -1364,7 +1364,7 @@ void SidebarController::UpdateDeckOpenState()
if (const SfxViewShell* pViewShell = mpViewFrame->GetViewShell())
{
- const std::string uno = UnoNameFromDeckId(msCurrentDeckId, vcl::EnumContext::Application::Impress == vcl::EnumContext::GetApplicationEnum(GetCurrentContext().msApplication));
+ const std::string uno = UnoNameFromDeckId(msCurrentDeckId, GetCurrentContext());
if (!uno.empty())
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
(uno + "=false").c_str());