diff options
author | Sumit Chauhan <sumitcn25@gmail.com> | 2019-05-31 14:59:54 +0530 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2019-06-14 15:17:33 +0200 |
commit | 015dc88a595c1c92d2b724cd868aecb07199f995 (patch) | |
tree | 075dddcd4a125cd84cd249700cd7dc36cb218a9c /cui/source/inc | |
parent | ddbee6231c12581a57d0d8dbbda16c05c715806c (diff) |
UI for the Notebookbar Customization tab
This patch generates the UI for the notebookbar customization tab.
Patch is working and one can show/hide the UIItem by clicking on the
checkbox.
Change-Id: I4923c57e6443474f178a72922646619f07b5ffc1
Reviewed-on: https://gerrit.libreoffice.org/73261
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Tested-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'cui/source/inc')
-rw-r--r-- | cui/source/inc/CustomNotebookbarGenerator.hxx | 1 | ||||
-rw-r--r-- | cui/source/inc/SvxNotebookbarConfigPage.hxx | 85 | ||||
-rw-r--r-- | cui/source/inc/cfg.hxx | 12 | ||||
-rw-r--r-- | cui/source/inc/helpids.h | 1 |
4 files changed, 98 insertions, 1 deletions
diff --git a/cui/source/inc/CustomNotebookbarGenerator.hxx b/cui/source/inc/CustomNotebookbarGenerator.hxx index 89276a1b9088..21424d0b9248 100644 --- a/cui/source/inc/CustomNotebookbarGenerator.hxx +++ b/cui/source/inc/CustomNotebookbarGenerator.hxx @@ -29,6 +29,7 @@ class CustomNotebookbarGenerator public: CustomNotebookbarGenerator(); static OUString getCustomizedUIPath(); + static OUString getOriginalUIPath(); static char* convertToCharPointer(const OUString& sString); static Sequence<OUString> getCustomizedUIItem(OUString sNotebookbarConfigType); static void getFileNameAndAppName(OUString& sAppName, OUString& sNotebookbarUIFileName); diff --git a/cui/source/inc/SvxNotebookbarConfigPage.hxx b/cui/source/inc/SvxNotebookbarConfigPage.hxx new file mode 100644 index 000000000000..97ae96be19c3 --- /dev/null +++ b/cui/source/inc/SvxNotebookbarConfigPage.hxx @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CUI_SOURCE_INC_SVXNOTEBOOKBARCONFIGPAGE_HXX +#define INCLUDED_CUI_SOURCE_INC_SVXNOTEBOOKBARCONFIGPAGE_HXX + +#include <libxml/xmlmemory.h> +#include <libxml/parser.h> +#include <vcl/weld.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/ui/XUIConfigurationListener.hpp> +#include <com/sun/star/ui/XUIConfigurationManager.hpp> +#include <com/sun/star/ui/XImageManager.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/lang/XSingleComponentFactory.hpp> + +#include <sfx2/tabdlg.hxx> +#include <memory> +#include <vector> + +//#include "cfgutil.hxx" +#include "cfg.hxx" //for SvxConfigPage and SaveInData + +class SvxNotebookbarConfigPage : public SvxConfigPage +{ +private: + void UpdateButtonStates() override; + short QueryReset() override; + void Init() override; + void DeleteSelectedContent() override; + void DeleteSelectedTopLevel() override; + virtual void SelectElement() override; + +public: + struct NotebookbarEntries + { + OUString sUIItemID; + OUString sActionName; + OUString sVisibleValue; + int nPos; + }; + SvxNotebookbarConfigPage(TabPageParent pParent, const SfxItemSet& rItemSet); + virtual ~SvxNotebookbarConfigPage() override; + SaveInData* CreateSaveInData(const css::uno::Reference<css::ui::XUIConfigurationManager>&, + const css::uno::Reference<css::ui::XUIConfigurationManager>&, + const OUString& aModuleId, bool docConfig) override; + static void FillFunctionsList(std::vector<NotebookbarEntries>& aEntries); + static void searchNodeandAttribute(std::vector<NotebookbarEntries>& aEntries, xmlNode* pNodePtr, + int nPos); + static void getNodeValue(xmlNode* pNodePtr, NotebookbarEntries& aNodeEntries); +}; + +class SvxNotebookbarEntriesListBox final : public SvxMenuEntriesListBox +{ + void ChangedVisibility(int nRow); + typedef std::pair<int, int> row_col; + DECL_LINK(CheckButtonHdl, const row_col&, void); + DECL_LINK(KeyInputHdl, const KeyEvent&, bool); + +public: + SvxNotebookbarEntriesListBox(std::unique_ptr<weld::TreeView> xControl, SvxConfigPage* pPg); + virtual ~SvxNotebookbarEntriesListBox() override; +}; + +#endif // INCLUDED_CUI_SOURCE_INC_SVXNOTEBOOKBARCONFIGPAGE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx index eba2c917c3d0..2a88e269396c 100644 --- a/cui/source/inc/cfg.hxx +++ b/cui/source/inc/cfg.hxx @@ -45,6 +45,8 @@ #include "cfgutil.hxx" #include "CommandCategoryListBox.hxx" +#define notebookbarTabScope "notebookbarTabScope" + static const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL"; static const char ITEM_DESCRIPTOR_CONTAINER[] = "ItemDescriptorContainer"; static const char ITEM_DESCRIPTOR_LABEL[] = "Label"; @@ -380,15 +382,21 @@ protected: // Left side of the dialog where command categories and the available // commands in them are displayed as a searchable list - std::unique_ptr<weld::Entry> m_xSearchEdit; std::unique_ptr<CommandCategoryListBox> m_xCommandCategoryListBox; std::unique_ptr<CuiConfigFunctionListBox> m_xFunctions; + std::unique_ptr<weld::Label> m_xCategoryLabel; + std::unique_ptr<weld::ComboBox> m_xCategoryListBox; std::unique_ptr<weld::Label> m_xDescriptionFieldLb; std::unique_ptr<weld::TextView> m_xDescriptionField; + std::unique_ptr<weld::Label> m_xLeftFunctionLabel; + std::unique_ptr<weld::Entry> m_xSearchEdit; + std::unique_ptr<weld::Label> m_xSearchLabel; + // Right side of the dialog where the contents of the selected // menu or toolbar are displayed + std::unique_ptr<weld::Label> m_xCustomizeLabel; std::unique_ptr<weld::ComboBox> m_xTopLevelListBox; // Used to add and remove toolbars/menus std::unique_ptr<weld::MenuButton> m_xGearBtn; @@ -440,6 +448,8 @@ protected: void InsertEntryIntoUI(SvxConfigEntry* pNewEntryData, int nPos, int nStartCol); + void InsertEntryIntoNotebookbarTabUI(OUString& sUIItemId, OUString& sUIItemCommand, int nPos, + int nStartCol, int nSpace); SvxEntries* FindParentForChild( SvxEntries* pParentEntries, SvxConfigEntry* pChildData ); diff --git a/cui/source/inc/helpids.h b/cui/source/inc/helpids.h index 318abb331485..5f65df49d892 100644 --- a/cui/source/inc/helpids.h +++ b/cui/source/inc/helpids.h @@ -28,6 +28,7 @@ #define HID_OFADLG_TREELISTBOX "CUI_HID_OFADLG_TREELISTBOX" #define HID_SVX_CONFIG_TOOLBAR "CUI_HID_SVX_CONFIG_TOOLBAR" #define HID_SVX_CONFIG_TOOLBAR_CONTENTS "CUI_HID_SVX_CONFIG_TOOLBAR_CONTENTS" +#define HID_SVX_CONFIG_NOTEBOOKBAR_CONTENTS "CUI_HID_SVX_CONFIG_NOTEBOOKBAR_CONTENTS" #define HID_HANGULDLG_SUGGESTIONS_GRID "CUI_HID_HANGULDLG_SUGGESTIONS_GRID" #define HID_HANGULDLG_SUGGESTIONS_LIST "CUI_HID_HANGULDLG_SUGGESTIONS_LIST" #define HID_SVX_CONFIG_NAME_SUBMENU "CUI_HID_SVX_CONFIG_NAME_SUBMENU" |