diff options
author | Vert D <devoptmsoi@gmx.com> | 2021-04-29 10:29:00 -0500 |
---|---|---|
committer | Heiko Tietze <heiko.tietze@documentfoundation.org> | 2021-07-05 12:53:22 +0200 |
commit | 06d063a9de41a24922f15cd3aa47411b61d30c23 (patch) | |
tree | 9af8698e567ef62b161286c527e0a68612cbe0c9 /include | |
parent | 25e09087d8e2c5cecca1d548c69a263c7bf8b7ca (diff) |
tdf#138906 prevent built-in category deletion
*Remove category selection dialog for Delete Category.
*Delete Category now deletes the current Category.
*Import now imports to current category.
*Remove Buttons, add items to menu.
*Enable delete multi selection.
*Change Dialog titles.
*Remove searchview class. (I see no reason for it, it just copies code from localview and localview can handle search results on its own.)
Change-Id: I5add4aa9fa68ac68c796a6b98fb54a5d0da93bd0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113712
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/sfx2/strings.hrc | 26 | ||||
-rw-r--r-- | include/sfx2/templatedlg.hxx | 30 | ||||
-rw-r--r-- | include/sfx2/templatedlglocalview.hxx | 6 | ||||
-rw-r--r-- | include/sfx2/templatelocalview.hxx | 12 |
4 files changed, 42 insertions, 32 deletions
diff --git a/include/sfx2/strings.hrc b/include/sfx2/strings.hrc index 0967a31c1109..676ff541059b 100644 --- a/include/sfx2/strings.hrc +++ b/include/sfx2/strings.hrc @@ -27,13 +27,15 @@ #define STR_SAVEASDOC NC_("STR_SAVEASDOC", "Save ~As...") #define STR_SAVEACOPY NC_("STR_SAVEACOPY", "Save a Copy...") #define STR_CLOSEDOC NC_("STR_CLOSEDOC", "~Close") -#define STR_OPEN NC_("STR_OPEN", "Open") -#define STR_EDIT_TEMPLATE NC_("STR_EDIT_TEMPLATE", "Edit") -#define STR_DEFAULT_TEMPLATE NC_("STR_DEFAULT_TEMPLATE", "Set as Default") -#define STR_RESET_DEFAULT NC_("STR_RESET_DEFAULT", "Reset Default") -#define STR_DELETE NC_("STR_DELETE", "Delete") -#define STR_SFX_RENAME NC_("STR_SFX_RENAME", "Rename") -#define STR_CATEGORY_RENAME NC_("STR_CATEGORY_RENAME", "Rename Category") +#define STR_OPEN NC_("STR_OPEN", "~Open") +#define STR_EDIT_TEMPLATE NC_("STR_EDIT_TEMPLATE", "~Edit") +#define STR_DEFAULT_TEMPLATE NC_("STR_DEFAULT_TEMPLATE", "Set as De~fault") +#define STR_RESET_DEFAULT NC_("STR_RESET_DEFAULT", "Reset De~fault") +#define STR_DELETE_TEMPLATE NC_("STR_DELETE_TEMPLATE", "~Delete") +#define STR_SFX_RENAME NC_("STR_SFX_RENAME", "~Rename") +#define STR_MOVE NC_("STR_ACTION_MOVE","~Move") +#define STR_EXPORT NC_("STR_ACTION_EXPORT","E~xport") +#define STR_CATEGORY_RENAME NC_("STR_CATEGORY_RENAME", "Ren~ame Category") #define STR_RENAME_TEMPLATE NC_("STR_RENAME_TEMPLATE", "Enter new template name:") #define STR_TEMPLATE_TOOLTIP NC_("STR_TEMPLATE_TOOLTIP", "Title: $1\nCategory: $2") #define STR_TEMPLATE_SELECTION NC_("STR_TEMPLATE_SELECTION", "Select a Template") @@ -351,6 +353,16 @@ #define STR_RECENT NC_("STR_RECENT", "Recently used") #define STR_NORECENT NC_("STR_NORECENT", "No recent characters") +#define STR_ACTION_RESET_ALL_DEAULT_TEMPLATES NC_("STR_ACTION_RESET_ALL_DEAULT_TEMPLATES","Reset All De~fault Templates") +#define STR_ACTION_RESET_WRITER_TEMPLATE NC_("STR_ACTION_RESET_WRITER_TEMPLATE","Reset De~fault Text Document") +#define STR_ACTION_RESET_CALC_TEMPLATE NC_("STR_ACTION_RESET_CALC_TEMPLATE","Reset De~fault Spreadsheet") +#define STR_ACTION_RESET_IMPRESS_TEMPLATE NC_("STR_ACTION_RESET_IMPRESS_TEMPLATE","Reset De~fault Presentation") +#define STR_ACTION_RESET_DRAW_TEMPLATE NC_("STR_ACTION_RESET_DRAW_TEMPLATE","Reset De~fault Drawing") +#define STR_ACTION_IMPORT NC_("STR_ACTION_IMPORT","~Import") +#define STR_ACTION_EXTENSIONS NC_("STR_ACTION_EXTENSIONS","E~xtensions") +#define STR_WINDOW_TITLE_RENAME_TEMPLATE NC_("STR_WINDOW_TITLE_RENAME_TEMPLATE","Rename") +#define STR_WINDOW_TITLE_RENAME_CATEGORY NC_("STR_WINDOW_TITLE_RENAME_CATEGORY","Rename Category") +#define STR_WINDOW_TITLE_RENAME_NEW_CATEGORY NC_("STR_WINDOW_TITLE_RENAME_NEW_CATEGORY","New Category") #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/templatedlg.hxx b/include/sfx2/templatedlg.hxx index 89d0b6d3d61e..40af96278d47 100644 --- a/include/sfx2/templatedlg.hxx +++ b/include/sfx2/templatedlg.hxx @@ -22,7 +22,6 @@ #include <sfx2/templatedlglocalview.hxx> -class TemplateSearchView; class ThumbnailViewItem; namespace com @@ -61,10 +60,9 @@ protected: DECL_LINK(SelectRegionHdl, weld::ComboBox&, void); DECL_LINK(OkClickHdl, weld::Button&, void); - DECL_LINK(MoveClickHdl, weld::Button&, void); - DECL_LINK(ExportClickHdl, weld::Button&, void); - DECL_LINK(ImportClickHdl, weld::Button&, void); - DECL_STATIC_LINK(SfxTemplateManagerDlg, LinkClickHdl, weld::Button&, void); + void ImportActionHdl(); + void ExportActionHdl(); + static void ExtensionsActionHdl(); DECL_LINK(TVItemStateHdl, const ThumbnailViewItem*, void); @@ -75,10 +73,13 @@ protected: DECL_LINK(CreateContextMenuHdl, ThumbnailViewItem*, void); DECL_LINK(OpenTemplateHdl, ThumbnailViewItem*, void); DECL_LINK(EditTemplateHdl, ThumbnailViewItem*, void); - DECL_LINK(DeleteTemplateHdl, ThumbnailViewItem*, void); + DECL_LINK(DeleteTemplateHdl, void*, void); DECL_LINK(DefaultTemplateHdl, ThumbnailViewItem*, void); + DECL_LINK(MoveTemplateHdl, void*, void); + DECL_LINK(ExportTemplateHdl, void*, void); void SearchUpdate(); + void FilterSearch(); DECL_LINK(SearchUpdateHdl, weld::Entry&, void); DECL_LINK(GetFocusHdl, weld::Widget&, void); @@ -89,7 +90,6 @@ protected: DECL_LINK(ListViewHdl, weld::Toggleable&, void); DECL_LINK(ThumbnailViewHdl, weld::Toggleable&, void); DECL_LINK(FocusRectLocalHdl, weld::Widget&, tools::Rectangle); - DECL_LINK(FocusRectSearchHdl, weld::Widget&, tools::Rectangle); void OnTemplateImportCategory(std::u16string_view sCategory); // static void OnTemplateLink (); @@ -102,7 +102,7 @@ protected: void OnCategoryRename(); void OnCategoryDelete(); - void createDefaultTemplateMenu(); + void updateMenuItems(); /** * @@ -112,14 +112,6 @@ protected: void localMoveTo(sal_uInt16 nMenuId); - /** - * - * Move search result templates stored in the filesystem to another folder. - * - **/ - - void localSearchMoveTo(sal_uInt16 nMenuId); - /// Return filter according to the currently selected application filter. FILTER_APPLICATION getCurrentApplicationFilter() const; @@ -135,16 +127,10 @@ protected: std::unique_ptr<weld::ComboBox> mxCBFolder; std::unique_ptr<weld::Button> mxOKButton; - std::unique_ptr<weld::Button> mxMoveButton; - std::unique_ptr<weld::Button> mxExportButton; - std::unique_ptr<weld::Button> mxImportButton; - std::unique_ptr<weld::Button> mxMoreTemplatesButton; std::unique_ptr<weld::CheckButton> mxCBXHideDlg; std::unique_ptr<weld::MenuButton> mxActionBar; - std::unique_ptr<TemplateSearchView> mxSearchView; std::unique_ptr<TemplateDlgLocalView> mxLocalView; std::unique_ptr<weld::Menu> mxTemplateDefaultMenu; - std::unique_ptr<weld::CustomWeld> mxSearchViewWeld; std::unique_ptr<weld::CustomWeld> mxLocalViewWeld; std::unique_ptr<weld::Toggleable> mxListViewButton; std::unique_ptr<weld::Toggleable> mxThumbnailViewButton; diff --git a/include/sfx2/templatedlglocalview.hxx b/include/sfx2/templatedlglocalview.hxx index 409a1acaa578..65b77ead1c9a 100644 --- a/include/sfx2/templatedlglocalview.hxx +++ b/include/sfx2/templatedlglocalview.hxx @@ -30,7 +30,8 @@ public: virtual bool KeyInput(const KeyEvent& rKEvt) override; - void createContextMenu(const bool bIsDefault, const bool bIsBuiltIn); + void createContextMenu(const bool bIsDefault, const bool bIsBuiltIn, const bool bIsSingleSel, + const OUString& rDefaultImg); virtual void Show() override; @@ -45,6 +46,9 @@ public: void MakeItemVisible(sal_uInt16 nId) { ThumbnailView::MakeItemVisible(nId); } + void insertItems(const std::vector<TemplateItemProperties>& rTemplates, bool isRegionSelected, + bool bShowCategoryInTooltip); + private: void ContextMenuSelectHdl(std::string_view rIdent); diff --git a/include/sfx2/templatelocalview.hxx b/include/sfx2/templatelocalview.hxx index a37d72d1cf50..5ee5b60ed30a 100644 --- a/include/sfx2/templatelocalview.hxx +++ b/include/sfx2/templatelocalview.hxx @@ -137,14 +137,20 @@ public: void setEditTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink); - void setDeleteTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink); + void setDeleteTemplateHdl(const Link<void*,void> &rLink); void setDefaultTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink); + void setMoveTemplateHdl(const Link<void*,void> &rLink); + + void setExportTemplateHdl(const Link<void*,void> &rLink); + void updateThumbnailDimensions(tools::Long itemMaxSize); void RemoveDefaultTemplateIcon( std::u16string_view rPath); + bool IsBuiltInRegion(const OUString& rRegionName); + static BitmapEx scaleImg (const BitmapEx &rImg, tools::Long width, tools::Long height); static BitmapEx getDefaultThumbnail( const OUString& rPath ); @@ -171,8 +177,10 @@ protected: Link<ThumbnailViewItem*,void> maCreateContextMenuHdl; Link<ThumbnailViewItem*,void> maOpenTemplateHdl; Link<ThumbnailViewItem*,void> maEditTemplateHdl; - Link<ThumbnailViewItem*,void> maDeleteTemplateHdl; + Link<void*,void> maDeleteTemplateHdl; Link<ThumbnailViewItem*,void> maDefaultTemplateHdl; + Link<void*,void> maMoveTemplateHdl; + Link<void*,void> maExportTemplateHdl; std::unique_ptr<SfxDocumentTemplates> mpDocTemplates; std::vector<std::unique_ptr<TemplateContainerItem> > maRegions; |