summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-11-25 10:33:42 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-11-26 09:55:11 +0100
commit35de720fcb3154cb0511b3aae8b99f20fc6712c9 (patch)
tree0e3383fe82bc2bf498a19685dcb00f35c56b13e3
parent2d341a75c083cf2336fd14db66e850109fe83c89 (diff)
tdf#126043 cache the appname and filename
Change-Id: I10987f8a447785eb0d9887f94ee0ffb0da99649a Reviewed-on: https://gerrit.libreoffice.org/83658 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--cui/source/customize/SvxNotebookbarConfigPage.cxx24
-rw-r--r--cui/source/customize/cfg.cxx3
-rw-r--r--cui/source/inc/cfg.hxx4
3 files changed, 14 insertions, 17 deletions
diff --git a/cui/source/customize/SvxNotebookbarConfigPage.cxx b/cui/source/customize/SvxNotebookbarConfigPage.cxx
index fc54f4628705..9433b860897e 100644
--- a/cui/source/customize/SvxNotebookbarConfigPage.cxx
+++ b/cui/source/customize/SvxNotebookbarConfigPage.cxx
@@ -170,12 +170,10 @@ void SvxNotebookbarConfigPage::Init()
m_xContentsListBox->clear();
m_xSaveInListBox->clear();
CustomNotebookbarGenerator::createCustomizedUIFile();
- OUString sAppName, sFileName;
- CustomNotebookbarGenerator::getFileNameAndAppName(sAppName, sFileName);
- OUString sNotebookbarInterface = getFileName(sFileName);
+ OUString sNotebookbarInterface = getFileName(m_sFileName);
OUString sScopeName
- = utl::ConfigManager::getProductName() + " " + sAppName + " - " + sNotebookbarInterface;
+ = utl::ConfigManager::getProductName() + " " + m_sAppName + " - " + sNotebookbarInterface;
OUString sSaveInListBoxID = notebookbarTabScope;
m_xSaveInListBox->append(sSaveInListBoxID, sScopeName);
@@ -213,12 +211,10 @@ short SvxNotebookbarConfigPage::QueryReset()
OUString sOriginalUIPath = CustomNotebookbarGenerator::getOriginalUIPath();
OUString sCustomizedUIPath = CustomNotebookbarGenerator::getCustomizedUIPath();
osl::File::copy(sOriginalUIPath, sCustomizedUIPath);
- OUString sAppName, sFileName;
- CustomNotebookbarGenerator::getFileNameAndAppName(sAppName, sFileName);
- OUString sNotebookbarInterface = getFileName(sFileName);
+ OUString sNotebookbarInterface = getFileName(m_sFileName);
Sequence<OUString> sSequenceEntries;
CustomNotebookbarGenerator::setCustomizedUIItem(sSequenceEntries, sNotebookbarInterface);
- OUString sUIPath = "modules/s" + sAppName.toAsciiLowerCase() + "/ui/";
+ OUString sUIPath = "modules/s" + m_sAppName.toAsciiLowerCase() + "/ui/";
sfx2::SfxNotebookBar::ReloadNotebookBar(sUIPath);
}
return nValue;
@@ -229,9 +225,6 @@ void SvxConfigPage::InsertEntryIntoNotebookbarTabUI(const OUString& sClassId,
const OUString& sUIItemCommand, int nPos,
int nStartCol)
{
- OUString sAppName, sFileName;
- CustomNotebookbarGenerator::getFileNameAndAppName(sAppName, sFileName);
-
css::uno::Reference<css::container::XNameAccess> m_xCommandToLabelMap,
m_xGlobalCommandToLabelMap;
uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
@@ -241,7 +234,7 @@ void SvxConfigPage::InsertEntryIntoNotebookbarTabUI(const OUString& sClassId,
uno::Sequence<beans::PropertyValue> aPropSeq, aGlobalPropSeq;
xNameAccess->getByName("com.sun.star.text.GlobalDocument") >>= m_xGlobalCommandToLabelMap;
- xNameAccess->getByName(getModuleId(sAppName)) >>= m_xCommandToLabelMap;
+ xNameAccess->getByName(getModuleId(m_sAppName)) >>= m_xCommandToLabelMap;
try
{
@@ -559,10 +552,7 @@ static void EditRegistryFile(const OUString& sUIItemId, const OUString& sSetEntr
void SvxNotebookbarEntriesListBox::ChangedVisibility(int nRow)
{
OUString sUIItemId = m_xControl->get_selected_id();
- OUString sAppName;
- OUString sFileName;
- CustomNotebookbarGenerator::getFileNameAndAppName(sAppName, sFileName);
- OUString sNotebookbarInterface = getFileName(sFileName);
+ OUString sNotebookbarInterface = getFileName(m_pPage->GetFileName());
OUString sVisible;
if (m_xControl->get_toggle(nRow, 0) == TRISTATE_TRUE)
@@ -574,7 +564,7 @@ void SvxNotebookbarEntriesListBox::ChangedVisibility(int nRow)
sSeqOfEntries[0] = sSetEntries;
EditRegistryFile(sUIItemId, sSetEntries, sNotebookbarInterface);
CustomNotebookbarGenerator::modifyCustomizedUIFile(sSeqOfEntries);
- OUString sUIPath = "modules/s" + sAppName.toAsciiLowerCase() + "/ui/";
+ OUString sUIPath = "modules/s" + m_pPage->GetAppName().toAsciiLowerCase() + "/ui/";
sfx2::SfxNotebookBar::ReloadNotebookBar(sUIPath);
}
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 4e084ce21951..2ff9df40902d 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -48,6 +48,7 @@
#include <acccfg.hxx>
#include <cfg.hxx>
+#include <CustomNotebookbarGenerator.hxx>
#include <SvxMenuConfigPage.hxx>
#include <SvxToolbarConfigPage.hxx>
#include <SvxNotebookbarConfigPage.hxx>
@@ -992,6 +993,8 @@ SvxConfigPage::SvxConfigPage(weld::Container* pPage, weld::DialogController* pCo
, m_xAddCommandButton(m_xBuilder->weld_button("add"))
, m_xRemoveCommandButton(m_xBuilder->weld_button("remove"))
{
+ CustomNotebookbarGenerator::getFileNameAndAppName(m_sAppName, m_sFileName);
+
m_xTopLevelListBox->connect_changed(LINK(this, SvxConfigPage, SelectElementHdl));
weld::TreeView& rTreeView = m_xFunctions->get_widget();
diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx
index 93f4346aa15f..0cd522354124 100644
--- a/cui/source/inc/cfg.hxx
+++ b/cui/source/inc/cfg.hxx
@@ -418,6 +418,8 @@ protected:
std::unique_ptr<weld::Button> m_xAddCommandButton;
std::unique_ptr<weld::Button> m_xRemoveCommandButton;
+ OUString m_sAppName;
+ OUString m_sFileName;
SvxConfigPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&);
@@ -464,6 +466,8 @@ public:
static bool CanConfig( const OUString& rModuleId );
SaveInData* GetSaveInData() { return pCurrentSaveInData; }
+ const OUString& GetAppName() const { return m_sAppName; }
+ const OUString& GetFileName() const { return m_sFileName; }
int AddFunction(int nTarget,
bool bAllowDuplicates);