diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2020-06-05 06:42:45 +0200 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2020-07-02 08:21:10 +0200 |
commit | 699a31ec958a8fdc3ccf4a021298dd7c1c6ee714 (patch) | |
tree | 74653c3607f9027841c83af5590ae14773a60976 /sfx2 | |
parent | 111b05e412f278037b3c1a852b4ab6d9fca461f9 (diff) |
notebookbar: build using weld::Builder
and provide welded implementation for writer tabbed
Change-Id: Id6c71234cb1f40fd3889555785fcdbe84b801edd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96917
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97517
Tested-by: Jenkins
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/notebookbar/SfxNotebookBar.cxx | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx index 3a943c28f6fb..78a8d0edc4bf 100644 --- a/sfx2/source/notebookbar/SfxNotebookBar.cxx +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -29,6 +29,8 @@ #include <framework/addonsoptions.hxx> #include <vcl/NotebookBarAddonsMerger.hxx> #include <vector> +#include <vcl/WeldedTabbedNotebookbar.hxx> + using namespace sfx2; using namespace css::uno; using namespace css::ui; @@ -41,6 +43,7 @@ const char MERGE_NOTEBOOKBAR_IMAGEID[] = "ImageIdentifier"; bool SfxNotebookBar::m_bLock = false; bool SfxNotebookBar::m_bHide = false; +std::unique_ptr<WeldedTabbedNotebookbar> SfxNotebookBar::m_pNotebookBarWeldedWrapper; static void NotebookbarAddonValues( std::vector<Image>& aImageValues, @@ -355,18 +358,9 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, OUString sCurrentFile; VclPtr<NotebookBar> pNotebookBar = pSysWindow->GetNotebookBar(); if ( pNotebookBar ) - sCurrentFile = OStringToOUString( pNotebookBar->getUIFile(), RTL_TEXTENCODING_ASCII_US ); - - bool bChangedFile = true; - if ( sCurrentFile.getLength() && sNewFile.getLength() ) - { - // delete "/" - sCurrentFile = sCurrentFile.copy( 0, sCurrentFile.getLength() - 1 ); - // delete ".ui" - sNewFile = sNewFile.copy( 0, sNewFile.getLength() - 3 ); + sCurrentFile = pNotebookBar->GetUIFilePath(); - bChangedFile = sNewFile != sCurrentFile; - } + bool bChangedFile = sNewFile != sCurrentFile; if ((!sFile.isEmpty() && bChangedFile) || !pNotebookBar || !pNotebookBar->IsVisible() || bReloadNotebookbar) @@ -387,6 +381,15 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, pSysWindow->SetNotebookBar(aBuf, xFrame, aNotebookBarAddonsItem , bReloadNotebookbar); pNotebookBar = pSysWindow->GetNotebookBar(); pNotebookBar->Show(); + + if ((!m_pNotebookBarWeldedWrapper || bReloadNotebookbar) && pNotebookBar->IsWelded()) + { + m_pNotebookBarWeldedWrapper.reset(new WeldedTabbedNotebookbar(pNotebookBar->GetMainContainer(), + pNotebookBar->GetUIFilePath(), + xFrame)); + pNotebookBar->SetDisposeCallback(LINK(nullptr, SfxNotebookBar, VclDisposeHdl)); + } + pNotebookBar->GetParent()->Resize(); utl::OConfigurationTreeRoot aRoot(lcl_getCurrentImplConfigRoot()); @@ -547,4 +550,9 @@ void SfxNotebookBar::ReloadNotebookBar(const OUString& sUIPath) } } +IMPL_STATIC_LINK_NOARG(SfxNotebookBar, VclDisposeHdl, const void*, void) +{ + m_pNotebookBarWeldedWrapper.reset(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |