include/vcl/notebookbar.hxx | 3 +++ vcl/source/control/notebookbar.cxx | 24 ++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-)
New commits: commit 889a4fed08aecfd45e5706af27510e40932f2732 Author: Sumit Chauhan <sumitc...@gmail.com> AuthorDate: Wed May 15 00:57:09 2019 +0530 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Tue Jun 4 09:48:41 2019 +0200 Rendering notebookbar*.ui file from user/share directory This patch will get the modified customized notebookbar*.ui files from user directory(if present) otherwise the files will be rendered from default shared directory. Change-Id: I9393083bc0429659039c8dd5c10541ffa6661bf7 Reviewed-on: https://gerrit.libreoffice.org/72313 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/include/vcl/notebookbar.hxx b/include/vcl/notebookbar.hxx index b2e9b8cf9f28..5ca3798587c4 100644 --- a/include/vcl/notebookbar.hxx +++ b/include/vcl/notebookbar.hxx @@ -13,6 +13,7 @@ #include <vcl/builder.hxx> #include <vcl/ctrl.hxx> #include <vcl/settings.hxx> +#include <osl/file.hxx> #include <vector> namespace com { namespace sun { namespace star { namespace ui { class XContextChangeEventListener; } } } } @@ -57,6 +58,8 @@ private: void UpdateDefaultSettings(); void UpdatePersonaSettings(); + static OUString getCustomizedUIRootDir(); + static bool doesFileExist(const OUString& sUIDir, const OUString& sUIFile); }; diff --git a/vcl/source/control/notebookbar.cxx b/vcl/source/control/notebookbar.cxx index e55ea57547c3..1865af605799 100644 --- a/vcl/source/control/notebookbar.cxx +++ b/vcl/source/control/notebookbar.cxx @@ -15,6 +15,7 @@ #include <cppuhelper/implbase.hxx> #include <comphelper/processfactory.hxx> #include <vcl/vclevent.hxx> +#include <rtl/bootstrap.hxx> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp> /** @@ -38,7 +39,11 @@ NotebookBar::NotebookBar(Window* pParent, const OString& rID, const OUString& rU : Control(pParent), m_pEventListener(new NotebookBarContextChangeEventListener(this)) { SetStyle(GetStyle() | WB_DIALOGCONTROL); - m_pUIBuilder.reset( new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID, rFrame) ); + OUString sUIDir = getUIRootDir(); + bool doesCustomizedUIExist = doesFileExist(getCustomizedUIRootDir(), rUIXMLDescription); + if ( doesCustomizedUIExist ) + sUIDir = getCustomizedUIRootDir(); + m_pUIBuilder.reset( new VclBuilder(this, sUIDir, rUIXMLDescription, rID, rFrame)); mxFrame = rFrame; // In the Notebookbar's .ui file must exist control handling context // - implementing NotebookbarContextControl interface with id "ContextContainer" @@ -251,4 +256,19 @@ void NotebookBar::UpdatePersonaSettings() aAllSettings.SetStyleSettings(aStyleSet); PersonaSettings = aAllSettings; } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ + +OUString NotebookBar::getCustomizedUIRootDir() +{ + OUString sShareLayer("$BRAND_BASE_DIR/user/config/soffice.cfg/"); + rtl::Bootstrap::expandMacros(sShareLayer); + return sShareLayer; +} + +bool NotebookBar::doesFileExist(const OUString& sUIDir, const OUString& sUIFile) +{ + OUString sUri = sUIDir + sUIFile; + osl::File file(sUri); + sal_uInt32 flag = 0; + return( file.open(flag) == osl::FileBase::E_None ); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits