vcl: drop WeldedTabbedNotebookbar

"WeldedToolbar" no longer exists after
commit fd65cea59c
Author: Xisco Fauli <xiscofauli@libreoffice.org>
Date:   Mon Jun 1 17:14:35 2026 +0200

    drop notebookbar_online.ui

Change-Id: I2b90745e184321d4973b087003c25a7882e2111e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205907
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Xisco Fauli
2026-06-02 17:25:28 +02:00
parent fb3c28c1a9
commit 8754a75d98
8 changed files with 2 additions and 238 deletions
@@ -14918,7 +14918,6 @@ sfx2::SafeMode::getFilePath(rtl::OUString const&)
sfx2::SfxNotebookBar::CloseMethod(SystemWindow*)
sfx2::SfxNotebookBar::RemoveCurrentLOKWrapper()
sfx2::SfxNotebookBar::RemoveListeners(SystemWindow const*)
sfx2::SfxNotebookBar::ResetActiveToolbarModeToDefault(vcl::EnumContext::Application)
sfx2::SfxNotebookBar::ShowMenubar(SfxViewFrame const*, bool)
sfx2::SfxNotebookBar::ShowMenubar(bool)
sfx2::SfxNotebookBar::StateMethod(SystemWindow*, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, std::basic_string_view<char16_t, std::char_traits<char16_t> >, bool)
@@ -15166,7 +15166,6 @@ sfx2::SfxNotebookBar::CloseMethod(SystemWindow*)
sfx2::SfxNotebookBar::ReloadNotebookBar(std::basic_string_view<char16_t, std::char_traits<char16_t> >)
sfx2::SfxNotebookBar::RemoveCurrentLOKWrapper()
sfx2::SfxNotebookBar::RemoveListeners(SystemWindow const*)
sfx2::SfxNotebookBar::ResetActiveToolbarModeToDefault(vcl::EnumContext::Application)
sfx2::SfxNotebookBar::ShowMenubar(SfxViewFrame const*, bool)
sfx2::SfxNotebookBar::ShowMenubar(bool)
sfx2::SfxNotebookBar::StateMethod(SystemWindow*, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, std::basic_string_view<char16_t, std::char_traits<char16_t> >, bool)
-1
View File
@@ -212,7 +212,6 @@ public:
// vcl/inc/jsdialog/jsdialogbuilder.hxx
|| name == "m_aWidgetRegister" // LOK only, similar case as above
//
|| name == "gNotebookBarManager" // LOK only case, when notebookbar is closed - VclPtr instance is removed
|| name == "gStaticManager" // vcl/source/graphic/Manager.cxx - stores non-owning pointers
|| name == "aThreadedInterpreterPool" // ScInterpreterContext(Pool), not owning
|| name == "aNonThreadedInterpreterPool" // ScInterpreterContext(Pool), not owning
@@ -70,11 +70,6 @@ public:
private:
static bool m_bLock;
static bool m_bHide;
static void ResetActiveToolbarModeToDefault(vcl::EnumContext::Application eApp);
static void RemoveCurrentLOKWrapper();
DECL_DLLPRIVATE_STATIC_LINK(SfxNotebookBar, VclDisposeHdl, const SfxViewShell*, void);
};
} // namespace sfx2
-47
View File
@@ -1,47 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_SFX2_NOTEBOOKBAR_WRITERTABBEDNOTEBOOKBAR_HXX
#define INCLUDED_SFX2_NOTEBOOKBAR_WRITERTABBEDNOTEBOOKBAR_HXX
#include <config_options.h>
#include <vcl/dllapi.h>
#include <rtl/ustring.hxx>
#include <vcl/weld/Builder.hxx>
#include <vcl/weld/Toolbar.hxx>
#include <vcl/weld/weld.hxx>
namespace com::sun::star::frame
{
class XFrame;
}
/**
* Welded wrapper for NotebookBar used for online
*/
class UNLESS_MERGELIBS(VCL_DLLPUBLIC) WeldedTabbedNotebookbar
{
std::unique_ptr<weld::Builder> m_xBuilder;
std::unique_ptr<weld::Container> m_xContainer;
std::unique_ptr<weld::Toolbar> m_xWeldedToolbar;
public:
WeldedTabbedNotebookbar(const VclPtr<vcl::Window>& pContainerWindow,
const OUString& rUIFilePath,
const css::uno::Reference<css::frame::XFrame>& rFrame,
sal_uInt64 nWindowId);
weld::Toolbar& getWeldedToolbar() { return *m_xWeldedToolbar; }
weld::Builder& getBuilder() { return *m_xBuilder; }
};
#endif // INCLUDED_SFX2_NOTEBOOKBAR_SFXNOTEBOOKBAR_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+2 -158
View File
@@ -31,7 +31,6 @@
#include <vcl/notebookbar/NotebookBarAddonsItem.hxx>
#include <vector>
#include <unordered_map>
#include <vcl/WeldedTabbedNotebookbar.hxx>
using namespace sfx2;
using namespace css::uno;
@@ -45,68 +44,6 @@ const char MERGE_NOTEBOOKBAR_URL[] = "URL";
bool SfxNotebookBar::m_bLock = false;
bool SfxNotebookBar::m_bHide = false;
namespace
{
/** View specific notebook bar data */
struct NotebookBarViewData
{
std::unique_ptr<WeldedTabbedNotebookbar> m_pWeldedWrapper;
VclPtr<NotebookBar> m_pNotebookBar;
std::unique_ptr<ToolbarUnoDispatcher> m_pToolbarUnoDispatcher;
~NotebookBarViewData()
{
if (m_pNotebookBar)
m_pNotebookBar.disposeAndClear();
}
};
/** Notebookbar instance manager is a singleton that is used for track the
* per-view instances of view specific data contained in NotebookBarViewData
* class.
**/
class NotebookBarViewManager final
{
private:
// map contains a view data instance for a view (SfxViewShell pointer)
std::unordered_map<const SfxViewShell*, std::unique_ptr<NotebookBarViewData>> m_pViewDataList;
// private constructor to prevent any other instantiation outside of get() method
NotebookBarViewManager() = default;
// prevent class copying
NotebookBarViewManager(const NotebookBarViewManager&) = delete;
NotebookBarViewManager& operator=(const NotebookBarViewManager&) = delete;
public:
// Singleton get method - creates an instance on first get() call
static NotebookBarViewManager& get()
{
static NotebookBarViewManager gNotebookBarManager;
return gNotebookBarManager;
}
NotebookBarViewData& getViewData(const SfxViewShell* pViewShell)
{
auto aFound = m_pViewDataList.find(pViewShell);
if (aFound != m_pViewDataList.end()) // found
return *aFound->second;
// Create new view data instance
NotebookBarViewData* pViewData = new NotebookBarViewData;
m_pViewDataList.emplace(pViewShell, std::unique_ptr<NotebookBarViewData>(pViewData));
return *pViewData;
}
void removeViewData(const SfxViewShell* pViewShell)
{
m_pViewDataList.erase(pViewShell);
}
};
} // end anonymous namespace
static void NotebookbarAddonValues(
std::vector<Image>& aImageValues,
std::vector<css::uno::Sequence<css::uno::Sequence<css::beans::PropertyValue>>>&
@@ -258,19 +195,6 @@ static utl::OConfigurationNode lcl_getCurrentImplConfigNode(const Reference<css:
return utl::OConfigurationNode();
}
void SfxNotebookBar::RemoveCurrentLOKWrapper()
{
const SfxViewShell* pViewShell = SfxViewShell::Current();
auto& rViewData = NotebookBarViewManager::get().getViewData(pViewShell);
if (rViewData.m_pNotebookBar)
{
// Calls STATIC_LINK SfxNotebookBar -> VclDisposeHdl
// which clears the whole InstanceManager
rViewData.m_pNotebookBar.disposeAndClear();
}
}
void SfxNotebookBar::CloseMethod(SfxBindings& rBindings)
{
SfxFrame& rFrame = rBindings.GetDispatcher_Impl()->GetFrame()->GetFrame();
@@ -279,12 +203,6 @@ void SfxNotebookBar::CloseMethod(SfxBindings& rBindings)
void SfxNotebookBar::CloseMethod(SystemWindow* pSysWindow)
{
if (comphelper::LibreOfficeKit::isActive())
{
RemoveCurrentLOKWrapper();
return;
}
if (pSysWindow)
{
if(pSysWindow->GetNotebookBar())
@@ -372,26 +290,6 @@ bool SfxNotebookBar::IsActive(bool bConsiderSingleToolbar)
return false;
}
void SfxNotebookBar::ResetActiveToolbarModeToDefault(vcl::EnumContext::Application eApp)
{
const OUString appName( lcl_getAppName( eApp ) );
if ( appName.isEmpty() )
return;
const OUString aPath = "org.openoffice.Office.UI.ToolbarMode/Applications/" + appName;
utl::OConfigurationTreeRoot aAppNode(
::comphelper::getProcessComponentContext(),
aPath,
true);
if ( !aAppNode.isValid() )
return;
aAppNode.setNodeValue( u"Active"_ustr, Any( u"Default"_ustr ) );
aAppNode.commit();
}
void SfxNotebookBar::ExecMethod(SfxBindings& rBindings, const OUString& rUIName)
{
// Save active UI file name
@@ -435,10 +333,6 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
return false;
}
const SfxViewShell* pViewShell = SfxViewShell::Current();
auto& rViewData = NotebookBarViewManager::get().getViewData(pViewShell);
bool hasWeldedWrapper = bool(rViewData.m_pWeldedWrapper);
if (IsActive())
{
const css::uno::Reference<css::uno::XComponentContext>& xContext = comphelper::getProcessComponentContext();
@@ -457,11 +351,10 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
bool bChangedFile = sNewFile != sCurrentFile;
if ((!bIsLOK && (
if (!bIsLOK && (
(!sFile.isEmpty() && bChangedFile) ||
(!pNotebookBar || !pNotebookBar->IsVisible()) ||
bReloadNotebookbar)
) || (bIsLOK && !hasWeldedWrapper))
bReloadNotebookbar))
{
OUString aBuf = rUIFile + sFile;
@@ -477,45 +370,6 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
pNotebookBarAddonsItem->aImageValues = std::move(aImageValues);
}
if (bIsLOK)
{
if (!pViewShell)
return false;
// Notebookbar was loaded too early what caused:
// * in LOK: Paste Special feature was incorrectly initialized
// Skip first request so Notebookbar will be initialized after document was loaded
static std::map<const void*, bool> bSkippedFirstInit;
if (eApp == vcl::EnumContext::Application::Writer
&& bSkippedFirstInit.find(pViewShell) == bSkippedFirstInit.end())
{
bSkippedFirstInit[pViewShell] = true;
ResetActiveToolbarModeToDefault(eApp);
return false;
}
// update the current LOK language and locale for the dialog tunneling
comphelper::LibreOfficeKit::setLanguageTag(pViewShell->GetLOKLanguageTag());
comphelper::LibreOfficeKit::setLocale(pViewShell->GetLOKLocale());
pNotebookBar = VclPtr<NotebookBar>::Create(pSysWindow, "NotebookBar", aBuf, xFrame, std::move(pNotebookBarAddonsItem));
rViewData.m_pNotebookBar = pNotebookBar;
assert(pNotebookBar->IsWelded());
sal_uInt64 nWindowId = reinterpret_cast<sal_uInt64>(pViewShell);
rViewData.m_pWeldedWrapper.reset(
new WeldedTabbedNotebookbar(pNotebookBar->GetMainContainer(),
pNotebookBar->GetUIFilePath(),
xFrame, nWindowId));
pNotebookBar->SetDisposeCallback(LINK(nullptr, SfxNotebookBar, VclDisposeHdl), pViewShell);
rViewData.m_pToolbarUnoDispatcher.reset(
new ToolbarUnoDispatcher(rViewData.m_pWeldedWrapper->getWeldedToolbar(),
rViewData.m_pWeldedWrapper->getBuilder(), xFrame));
return true;
}
// tdf#164899 don't call SystemWindow::SetNotebookBar recursively
// if NoteBookBar is in process of getting set
if (pSysWindow->isSettingUpNoteBookBar())
@@ -543,11 +397,6 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
return true;
}
else if (comphelper::LibreOfficeKit::isActive())
{
// don't do anything to not close notebookbar of other session
return hasWeldedWrapper;
}
else if (auto pNotebookBar = pSysWindow->GetNotebookBar())
{
vcl::Window* pParent = pNotebookBar->GetParent();
@@ -687,9 +536,4 @@ void SfxNotebookBar::ReloadNotebookBar(std::u16string_view sUIPath)
sfx2::SfxNotebookBar::StateMethod(pViewShell->GetViewFrame().GetBindings(), sUIPath, true);
}
IMPL_STATIC_LINK(SfxNotebookBar, VclDisposeHdl, const SfxViewShell*, pViewShell, void)
{
NotebookBarViewManager::get().removeViewData(pViewShell);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-1
View File
@@ -261,7 +261,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/control/PriorityHBox \
vcl/source/control/PriorityMergedHBox \
vcl/source/control/notebookbar \
vcl/source/control/WeldedTabbedNotebookbar \
vcl/source/control/quickselectionengine \
vcl/source/control/prgsbar \
vcl/source/control/roadmap \
@@ -1,24 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <vcl/WeldedTabbedNotebookbar.hxx>
#include <vcl/svapp.hxx>
#include <jsdialog/jsdialogbuilder.hxx>
WeldedTabbedNotebookbar::WeldedTabbedNotebookbar(
const VclPtr<vcl::Window>& pContainerWindow, const OUString& rUIFilePath,
const css::uno::Reference<css::frame::XFrame>& rFrame, sal_uInt64 nWindowId)
: m_xBuilder(JSInstanceBuilder::CreateNotebookbarBuilder(
pContainerWindow, AllSettings::GetUIRootDir(), rUIFilePath, rFrame, nWindowId))
{
m_xContainer = m_xBuilder->weld_container(u"NotebookBar"_ustr);
m_xWeldedToolbar = m_xBuilder->weld_toolbar(u"WeldedToolbar"_ustr);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */