Kaydet (Commit) 889a4fed authored tarafından Sumit Chauhan's avatar Sumit Chauhan Kaydeden (comit) Szymon Kłos

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: 's avatarSzymon Kłos <szymon.klos@collabora.com>
üst 79927a93
......@@ -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);
};
......
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment