[Libreoffice-commits] core.git: sw/inc sw/source
Jim Raykowski (via logerrit)
logerrit at kemper.freedesktop.org
Wed Feb 19 01:58:22 UTC 2020
sw/inc/strings.hrc | 3 +--
sw/source/uibase/utlui/content.cxx | 11 +++++++----
2 files changed, 8 insertions(+), 6 deletions(-)
New commits:
commit 791aeac1e492d3f3b6c99fa480226c0b2cc4f7d6
Author: Jim Raykowski <raykowj at gmail..com>
AuthorDate: Mon Feb 17 17:07:06 2020 -0900
Commit: Jim Raykowski <raykowj at gmail.com>
CommitDate: Wed Feb 19 02:57:47 2020 +0100
Fold chapter strings in to one pluralized string
Change-Id: I3b1198a4ade99baa84923ff5b628e2c3ef1839be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88906
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj at gmail.com>
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index b276d5888c75..e7215eded7ff 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -551,8 +551,7 @@
#define STR_GRAPHIC NC_("STR_GRAPHIC", "image")
#define STR_DRAWING_OBJECTS NC_("STR_DRAWING_OBJECTS", "drawing object(s)")
#define STR_TABLE_NAME NC_("STR_TABLE_NAME", "table: $1$2$3")
-#define STR_CHAPTER_NAME NC_("STR_CHAPTER_NAME", "chapter")
-#define STR_CHAPTERS_NAME NC_("STR_CHAPTERS_NAME", "chapters")
+#define STR_CHAPTERS NNC_("STR_CHAPTERS", "chapter", "chapters")
#define STR_PARAGRAPH_UNDO NC_("STR_PARAGRAPH_UNDO", "paragraph")
#define STR_PARAGRAPH_SIGN_UNDO NC_("STR_PARAGRAPH_SIGN_UNDO", "Paragraph sign")
#define STR_UNDO_FLYFRMFMT_TITLE NC_("STR_UNDO_FLYFRMFMT_TITLE", "Change object title of $1")
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 7cc8bf889998..52b863602d8e 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3425,20 +3425,23 @@ void SwContentTree::ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry )
void SwContentTree::DeleteOutlineSelections()
{
- OUString sChapter = GetSelectionCount() > 1 ? SwResId(STR_CHAPTERS_NAME) : SwResId(STR_CHAPTER_NAME);
- SwRewriter aRewriter;
- aRewriter.AddRule(UndoArg1, sChapter);
m_pActiveShell->StartAction();
- m_pActiveShell->StartUndo(SwUndoId::DELETE, &aRewriter);
m_pActiveShell->EnterAddMode();
+ auto nChapters(0);
for (SvTreeListEntry* pEntry = FirstSelected(); pEntry; pEntry = NextSelected(pEntry))
{
+ ++nChapters;
+ if ((pEntry->HasChildren() || pEntry->HasChildrenOnDemand()) && !IsExpanded(pEntry)) // only count children if not expanded
+ nChapters += pEntry->GetChildEntries().size();
m_pActiveShell->SttSelect();
SwOutlineNodes::size_type nActPos = static_cast<SwOutlineContent*>(pEntry->GetUserData())->GetOutlinePos();
m_pActiveShell->MakeOutlineSel(nActPos, nActPos, !IsExpanded(pEntry), false); // select children if not expanded
m_pActiveShell->EndSelect();
}
m_pActiveShell->LeaveAddMode();
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UndoArg1, SwResId(STR_CHAPTERS, nChapters));
+ m_pActiveShell->StartUndo(SwUndoId::DELETE, &aRewriter);
m_pActiveShell->SetTextFormatColl(nullptr);
m_pActiveShell->Delete();
m_pActiveShell->ClearMark();
More information about the Libreoffice-commits
mailing list