summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2024-03-20 12:08:42 +0100
committerMiklos Vajna <vmiklos@collabora.com>2024-03-21 01:40:11 +0100
commit55feb670ca28e0a48ac82a65b5559598704d993e (patch)
tree7e2bd36ab5aaca9b497b557d596ebbdfd90c5b8c /desktop
parent31b18d5a5f652dc1bb82ec2828e5f3a951590301 (diff)
cool#8278 sfx2 lok: fix unexpected non-json sidebar status update
Open an Impress document via LOK, open the slide layout sidebar, click the toggle icon so it gets closed: the toggle icon will signal that the sidebar is open, when it's closed already. This is a regression from commit aaf6ce108e91b1504befe19afcee471e3316ae7a (cool#7492 sfx2 lok: set language/locale on async sidebar update, 2024-01-11), previously we always emitted LOK_CALLBACK_STATE_CHANGED callbacks with plain text payloads for the sidebar, where the locale with implicit (with all its issues), but the above scenario worked fine. Fix the problem by making SidebarController::disposeDecks() consistent with SwitchToDeck(), so now we always emit JSON payloads for the sidebar deck changes. An alternative would be to improve the code around extractUnoCommand() in online.git to handle a mix of plain text and JSON payloads, but the plain text payload is tricky to extend, so using more JSON payloads sounds like a better fix. Change-Id: I5b75c2987c230c6720181a1e95ae579727943235 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165055 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx54
1 files changed, 9 insertions, 45 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 8550b9d91b1b..25ba3ade88c4 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -150,6 +150,7 @@
#include <sfx2/DocumentSigner.hxx>
#include <sfx2/sidebar/SidebarDockingWindow.hxx>
#include <sfx2/sidebar/SidebarController.hxx>
+#include <sfx2/sidebar/Sidebar.hxx>
#include <svl/numformat.hxx>
#include <svx/dialmgr.hxx>
#include <svx/strings.hrc>
@@ -986,49 +987,6 @@ void ExecuteOrientationChange()
mxUndoManager->leaveUndoContext();
}
-void setupSidebar(std::u16string_view sidebarDeckId = u"")
-{
- SfxViewShell* pViewShell = SfxViewShell::Current();
- SfxViewFrame* pViewFrame = pViewShell ? &pViewShell->GetViewFrame() : nullptr;
- if (pViewFrame)
- {
- if (!pViewFrame->GetChildWindow(SID_SIDEBAR))
- pViewFrame->SetChildWindow(SID_SIDEBAR, false /* create it */, true /* focus */);
-
- pViewFrame->ShowChildWindow(SID_SIDEBAR, true);
-
- // Force synchronous population of panels
- SfxChildWindow *pChild = pViewFrame->GetChildWindow(SID_SIDEBAR);
- if (!pChild)
- return;
-
- auto pDockingWin = dynamic_cast<sfx2::sidebar::SidebarDockingWindow *>(pChild->GetWindow());
- if (!pDockingWin)
- return;
-
- pViewFrame->ShowChildWindow( SID_SIDEBAR );
-
- const rtl::Reference<sfx2::sidebar::SidebarController>& xController
- = pDockingWin->GetOrCreateSidebarController();
-
- xController->FadeIn();
- xController->RequestOpenDeck();
-
- if (!sidebarDeckId.empty())
- {
- xController->SwitchToDeck(sidebarDeckId);
- }
- else
- {
- xController->SwitchToDefaultDeck();
- }
-
- pDockingWin->SyncUpdate();
- }
- else
- SetLastExceptionMsg(u"No view shell or sidebar"_ustr);
-}
-
void hideSidebar()
{
SfxViewShell* pViewShell = SfxViewShell::Current();
@@ -5269,12 +5227,18 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma
}
else if (gImpl && aCommand == ".uno:LOKSidebarWriterPage")
{
- setupSidebar(u"WriterPageDeck");
+ if (!sfx2::sidebar::Sidebar::Setup(u"WriterPageDeck"))
+ {
+ SetLastExceptionMsg(u"failed to set up sidebar"_ustr);
+ }
return;
}
else if (gImpl && aCommand == ".uno:SidebarShow")
{
- setupSidebar();
+ if (!sfx2::sidebar::Sidebar::Setup(u""))
+ {
+ SetLastExceptionMsg(u"failed to set up sidebar"_ustr);
+ }
return;
}
else if (gImpl && aCommand == ".uno:SidebarHide")