diff options
author | Sumit Chauhan <sumitcn25@gmail.com> | 2019-05-15 00:57:09 +0530 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2019-06-04 09:48:41 +0200 |
commit | 889a4fed08aecfd45e5706af27510e40932f2732 (patch) | |
tree | 385f5c3cc7c41a0a0e7eb00743b6863f8866b024 | |
parent | 79927a934b8a27bd4dee7a263171981e6ca22f8a (diff) |
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.klos@collabora.com>
-rw-r--r-- | include/vcl/notebookbar.hxx | 3 | ||||
-rw-r--r-- | vcl/source/control/notebookbar.cxx | 24 |
2 files changed, 25 insertions, 2 deletions
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 |