sw/inc/strings.hrc | 31 +++++++++++++++- sw/source/uibase/utlui/navipi.cxx | 72 +++++++++++++++++++++++++++++++------- 2 files changed, 88 insertions(+), 15 deletions(-)
New commits: commit 9f95e65730b273643d79d9a32cd11a8d5a40464c Author: Jim Raykowski <rayk...@gmail.com> AuthorDate: Fri Jul 19 22:04:12 2024 -0800 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Wed Oct 9 07:27:16 2024 +0200 Resolves tdf#161919 Two programatically composed UI strings not suitable for localization Change-Id: I20a914d9d158817b7c9605afc1972a91117fb5a8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170789 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> Tested-by: Jenkins diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc index 1bc9271c860e..ae2b24845615 100644 --- a/sw/inc/strings.hrc +++ b/sw/inc/strings.hrc @@ -722,8 +722,35 @@ #define STR_NEW_FILE NC_("STR_NEW_FILE", "New Document") #define STR_INSERT_TEXT NC_("STR_INSERT_TEXT", "Text") #define STR_DELETE NC_("STR_DELETE", "Delete") -#define STR_DELETE_CONTENT_TYPE NC_("STR_DELETE_CONTENT_TYPE", "Delete All %1") -#define STR_DELETE_CONTENT NC_("STR_DELETE_CONTENT", "Delete %1") +#define STR_DELETE_ALL_TABLES NC_("STR_DELETE_ALL_TABLES", "Delete All Tables") +#define STR_DELETE_ALL_FRAMES NC_("STR_DELETE_ALL_FRAMES", "Delete All Frames") +#define STR_DELETE_ALL_GRAPHIC NC_("STR_DELETE_ALL_GRAPHIC", "Delete All Images") +#define STR_DELETE_ALL_OLE_OBJECTS NC_("STR_DELETE_ALL_OLE_OBJECTS", "Delete All OLE Objects") +#define STR_DELETE_ALL_BOOKMARKS NC_("STR_DELETE_ALL_BOOKMARKS", "Delete All Bookmarks") +#define STR_DELETE_ALL_REGIONS NC_("STR_DELETE_ALL_REGIONS", "Delete All Sections") +#define STR_DELETE_ALL_URLFIELDS NC_("STR_DELETE_ALL_URLFIELDS", "Delete All Hyperlinks") +#define STR_DELETE_ALL_REFERENCES NC_("STR_DELETE_ALL_REFERENCES", "Delete All References") +#define STR_DELETE_ALL_INDEXES NC_("STR_DELETE_ALL_INDEXES", "Delete All Indexes") +#define STR_DELETE_ALL_POSTITS NC_("STR_DELETE_ALL_POSTITS", "Delete All Comments") +#define STR_DELETE_ALL_DRAWOBJECTS NC_("STR_DELETE_ALL_DRAWOBJECTS", "Delete All Drawing Objects") +#define STR_DELETE_ALL_TEXTFIELDS NC_("STR_DELETE_ALL_TEXTFIELDS", "Delete All Fields") +#define STR_DELETE_ALL_FOOTNOTES NC_("STR_DELETE_ALL_FOOTNOTES", "Delete All Footnotes") +#define STR_DELETE_ALL_ENDNOTES NC_("STR_DELETE_ALL_ENDNOTES", "Delete All Endnotes") +#define STR_DELETE_OUTLINE NC_("STR_DELETE_OUTLINE", "Delete Heading") +#define STR_DELETE_TABLE NC_("STR_DELETE_TABLE", "Delete Table") +#define STR_DELETE_FRAME NC_("STR_DELETE_FRAME", "Delete Frame") +#define STR_DELETE_GRAPHIC NC_("STR_DELETE_GRAPHIC", "Delete Image") +#define STR_DELETE_OLE_OBJECT NC_("STR_DELETE_OLE_OBJECT", "Delete OLE Object") +#define STR_DELETE_BOOKMARK NC_("STR_DELETE_BOOKMARK", "Delete Bookmark") +#define STR_DELETE_REGION NC_("STR_DELETE_REGION", "Delete Section") +#define STR_DELETE_URLFIELD NC_("STR_DELETE_URLFIELD", "Delete Hyperlink") +#define STR_DELETE_REFERENCE NC_("STR_DELETE_REFERENCE", "Delete Reference") +#define STR_DELETE_INDEX NC_("STR_DELETE_INDEX", "Delete Index") +#define STR_DELETE_POSTIT NC_("STR_DELETE_POSTIT", "Delete Comment") +#define STR_DELETE_DRAWOBJECT NC_("STR_DELETE_DRAWOBJECT", "Delete Drawing Object") +#define STR_DELETE_TEXTFIELD NC_("STR_DELETE_TEXTFIELD", "Delete Field") +#define STR_DELETE_FOOTNOTE NC_("STR_DELETE_FOOTNOTE", "Delete Footnote") +#define STR_DELETE_ENDNOTE NC_("STR_DELETE_ENDNOTE", "Delete Endnote") #define STR_DELETE_ENTRY NC_("STR_DELETE_ENTRY", "~Delete") #define STR_UPDATE_SEL NC_("STR_UPDATE_SEL", "Selection") #define STR_UPDATE_INDEX NC_("STR_UPDATE_INDEX", "Indexes") diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index b2bd8684a1dd..8fcb96144228 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -649,7 +649,7 @@ void SwNavigationPI::UpdateContentFunctionsToolbar() return; bool bUseDeleteFunctionsToolbar = true; - OUString aContentTypeName; // used in creation of delete button tooltip + ContentTypeId eContentTypeId = ContentTypeId::UNKNOWN; const bool bContentType = weld::fromId<const SwTypeNumber*>(rTreeView.get_id(*xEntry))->GetTypeId() == 1; @@ -657,10 +657,7 @@ void SwNavigationPI::UpdateContentFunctionsToolbar() if (bContentType) { const SwContentType* pContentType = weld::fromId<SwContentType*>(rTreeView.get_id(*xEntry)); - - aContentTypeName = pContentType->GetName(); - - ContentTypeId eContentTypeId = pContentType->GetType(); + eContentTypeId = pContentType->GetType(); if (eContentTypeId == ContentTypeId::OUTLINE) return; weld::Toolbar& rContentTypeToolbar = *m_aContentTypeUnoToolbarMap[eContentTypeId]; @@ -679,10 +676,7 @@ void SwNavigationPI::UpdateContentFunctionsToolbar() { const SwContentType* pContentType = weld::fromId<SwContent*>(rTreeView.get_id(*xEntry))->GetParent(); - - aContentTypeName = pContentType->GetSingleName(); - - ContentTypeId eContentTypeId = pContentType->GetType(); + eContentTypeId = pContentType->GetType(); if (eContentTypeId == ContentTypeId::OUTLINE) { m_xHeadingsContentFunctionsToolbar->show(); @@ -711,10 +705,62 @@ void SwNavigationPI::UpdateContentFunctionsToolbar() if (bUseDeleteFunctionsToolbar && m_xContentTree->IsDeletable(*xEntry)) { - OUString sToolTip = SwResId(bContentType ? STR_DELETE_CONTENT_TYPE : STR_DELETE_CONTENT); - sToolTip = sToolTip.replaceFirst("%1", aContentTypeName); - m_xDeleteFunctionToolbar->set_item_tooltip_text("delete", sToolTip); - m_xDeleteFunctionToolbar->show(); + OUString sToolTip; + switch (eContentTypeId) + { + case ContentTypeId::OUTLINE: + sToolTip = SwResId(STR_DELETE_OUTLINE); + break; + case ContentTypeId::TABLE: + sToolTip = SwResId(bContentType ? STR_DELETE_ALL_TABLES : STR_DELETE_TABLE); + break; + case ContentTypeId::FRAME: + sToolTip = SwResId(bContentType ? STR_DELETE_ALL_FRAMES : STR_DELETE_FRAME); + break; + case ContentTypeId::GRAPHIC: + sToolTip = SwResId(bContentType ? STR_DELETE_ALL_GRAPHIC : STR_DELETE_GRAPHIC); + break; + case ContentTypeId::OLE: + sToolTip = SwResId(bContentType ? STR_DELETE_ALL_OLE_OBJECTS : STR_DELETE_OLE_OBJECT); + break; + case ContentTypeId::BOOKMARK: + sToolTip = SwResId(bContentType ? STR_DELETE_ALL_BOOKMARKS : STR_DELETE_BOOKMARK); + break; + case ContentTypeId::REGION: + sToolTip = SwResId(bContentType ? STR_DELETE_ALL_REGIONS : STR_DELETE_REGION); + break; + case ContentTypeId::URLFIELD: + sToolTip = SwResId(bContentType ? STR_DELETE_ALL_URLFIELDS : STR_DELETE_URLFIELD); + break; + case ContentTypeId::REFERENCE: + sToolTip = SwResId(bContentType ? STR_DELETE_ALL_REFERENCES : STR_DELETE_REFERENCE); + break; + case ContentTypeId::INDEX: + sToolTip = SwResId(bContentType ? STR_DELETE_ALL_INDEXES : STR_DELETE_INDEX); + break; + case ContentTypeId::POSTIT: + sToolTip = SwResId(bContentType ? STR_DELETE_ALL_POSTITS : STR_DELETE_POSTIT); + break; + case ContentTypeId::DRAWOBJECT: + sToolTip = SwResId(bContentType ? STR_DELETE_ALL_DRAWOBJECTS : STR_DELETE_DRAWOBJECT); + break; + case ContentTypeId::TEXTFIELD: + sToolTip = SwResId(bContentType ? STR_DELETE_ALL_TEXTFIELDS : STR_DELETE_TEXTFIELD); + break; + case ContentTypeId::FOOTNOTE: + sToolTip = SwResId(bContentType ? STR_DELETE_ALL_FOOTNOTES : STR_DELETE_FOOTNOTE); + break; + case ContentTypeId::ENDNOTE: + sToolTip = SwResId(bContentType ? STR_DELETE_ALL_ENDNOTES : STR_DELETE_ENDNOTE); + break; + default: + break; + } + if (!sToolTip.isEmpty()) + { + m_xDeleteFunctionToolbar->set_item_tooltip_text("delete", sToolTip); + m_xDeleteFunctionToolbar->show(); + } } }