diff options
author | Heiko Tietze <heiko.tietze@documentfoundation.org> | 2023-07-18 15:02:58 +0200 |
---|---|---|
committer | Heiko Tietze <heiko.tietze@documentfoundation.org> | 2023-07-26 10:37:35 +0200 |
commit | 90e3af16c12f94f487ff7516048a239db1d2ff7d (patch) | |
tree | a5494ab9240ede62b2f8c51d28da0bc49ccba7e5 | |
parent | 49b601937f5ba7739198a1b16ba6da2351897750 (diff) |
Resolves tdf#95329 - Number of comments in word count dialog
Change-Id: I29ca811065cce83f9c8630f79a2b78c2c3fe0da1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154581
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
-rw-r--r-- | sw/inc/docstat.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/doc/docstat.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/dialog/wordcountdialog.cxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/inc/wordcountdialog.hxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 5 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/wordcount.ui | 192 |
6 files changed, 122 insertions, 84 deletions
diff --git a/sw/inc/docstat.hxx b/sw/inc/docstat.hxx index fd53d80bfcbf..84476db5c065 100644 --- a/sw/inc/docstat.hxx +++ b/sw/inc/docstat.hxx @@ -36,6 +36,7 @@ struct SW_DLLPUBLIC SwDocStat sal_uLong nAsianWord; sal_uLong nChar; sal_uLong nCharExcludingSpaces; + sal_uLong nComments; bool bModified; SwDocStat(); diff --git a/sw/source/core/doc/docstat.cxx b/sw/source/core/doc/docstat.cxx index c34e8d094ba2..959c61833dd6 100644 --- a/sw/source/core/doc/docstat.cxx +++ b/sw/source/core/doc/docstat.cxx @@ -30,6 +30,7 @@ SwDocStat::SwDocStat() : nAsianWord(0), nChar(0), nCharExcludingSpaces(0), + nComments(0), bModified(true) {} @@ -45,6 +46,7 @@ void SwDocStat::Reset() nAsianWord = 0; nChar = 0; nCharExcludingSpaces = 0; + nComments = 0; bModified = true; } diff --git a/sw/source/ui/dialog/wordcountdialog.cxx b/sw/source/ui/dialog/wordcountdialog.cxx index a96e1c50b3be..b0b92a6ae1a7 100644 --- a/sw/source/ui/dialog/wordcountdialog.cxx +++ b/sw/source/ui/dialog/wordcountdialog.cxx @@ -31,6 +31,7 @@ #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <comphelper/lok.hxx> +#include <PostItMgr.hxx> #define IS_MOBILE_PHONE (comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current() && SfxViewShell::Current()->isLOKMobilePhone()) @@ -64,6 +65,7 @@ void SwWordCountFloatDlg::SetValues(const SwDocStat& rCurrent, const SwDocStat& setValue(*m_xDocCharacterFT, rDoc.nChar, rLocaleData); setValue(*m_xDocCharacterExcludingSpacesFT, rDoc.nCharExcludingSpaces, rLocaleData); setValue(*m_xDocCjkcharsFT, rDoc.nAsianWord, rLocaleData); + setValue(*m_xDocComments, rCurrent.nComments, rLocaleData); if (m_xStandardizedPagesLabelFT->get_visible()) { @@ -120,6 +122,7 @@ SwWordCountFloatDlg::SwWordCountFloatDlg(SfxBindings* _pBindings, , m_xCjkcharsLabelFT2(m_xBuilder->weld_label("cjkcharsft2")) , m_xStandardizedPagesLabelFT(m_xBuilder->weld_label("standardizedpages")) , m_xStandardizedPagesLabelFT2(m_xBuilder->weld_label("standardizedpages2")) + , m_xDocComments(m_xBuilder->weld_label("docComments")) { showCJK(SvtCJKOptions::IsAnyEnabled()); showStandardizedPages(officecfg::Office::Writer::WordCount::ShowStandardizedPageCount::get()); @@ -143,6 +146,8 @@ void SwWordCountFloatDlg::UpdateCounts() aDocStat = rSh.GetUpdatedDocStat(); rSh.EndAction(); } + SwPostItMgr* pPostItMgr = rSh.GetPostItMgr(); + aCurrCnt.nComments = pPostItMgr->end() - pPostItMgr->begin(); SetValues(aCurrCnt, aDocStat); } } diff --git a/sw/source/uibase/inc/wordcountdialog.hxx b/sw/source/uibase/inc/wordcountdialog.hxx index c5b23f0c5307..ffa0b6478dcc 100644 --- a/sw/source/uibase/inc/wordcountdialog.hxx +++ b/sw/source/uibase/inc/wordcountdialog.hxx @@ -43,6 +43,7 @@ class SwWordCountFloatDlg final : public SfxModelessDialogController std::unique_ptr<weld::Label> m_xCjkcharsLabelFT2; std::unique_ptr<weld::Label> m_xStandardizedPagesLabelFT; std::unique_ptr<weld::Label> m_xStandardizedPagesLabelFT2; + std::unique_ptr<weld::Label> m_xDocComments; public: SwWordCountFloatDlg(SfxBindings* pBindings, diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 2903bbf19c03..0fb4f0e22a2b 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -1875,9 +1875,12 @@ void SwView::StateStatusLine(SfxItemSet &rSet) OUString aWordCount(SwResId(pResId)); aWordCount = aWordCount.replaceAll("$1", aWordArg); aWordCount = aWordCount.replaceAll("$2", aCharArg); - rSet.Put( SfxStringItem( FN_STAT_WORDCOUNT, aWordCount ) ); + SwPostItMgr* pPostItMgr = rShell.GetPostItMgr(); + if (pPostItMgr) + selectionStats.nComments = pPostItMgr->end() - pPostItMgr->begin(); + SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(GetViewFrame().GetChildWindow(SwWordCountWrapper::GetChildWindowId())); if (pWrdCnt) pWrdCnt->SetCounts(selectionStats, documentStats); diff --git a/sw/uiconfig/swriter/ui/wordcount.ui b/sw/uiconfig/swriter/ui/wordcount.ui index 057936dc8195..91aebe9ac551 100644 --- a/sw/uiconfig/swriter/ui/wordcount.ui +++ b/sw/uiconfig/swriter/ui/wordcount.ui @@ -1,33 +1,33 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.36.0 --> +<!-- Generated with glade 3.40.0 --> <interface domain="sw"> <requires lib="gtk+" version="3.20"/> <object class="GtkDialog" id="WordCountDialog"> - <property name="can_focus">False</property> - <property name="border_width">6</property> + <property name="can-focus">False</property> + <property name="border-width">6</property> <property name="title" translatable="yes" context="wordcount|WordCountDialog">Word Count</property> - <property name="default_width">0</property> - <property name="default_height">0</property> - <property name="destroy_with_parent">True</property> - <property name="type_hint">dialog</property> + <property name="default-width">0</property> + <property name="default-height">0</property> + <property name="destroy-with-parent">True</property> + <property name="type-hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <property name="spacing">12</property> <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area1"> - <property name="can_focus">False</property> - <property name="layout_style">end</property> + <property name="can-focus">False</property> + <property name="layout-style">end</property> <child> <object class="GtkButton" id="close"> <property name="label" translatable="yes" context="stock">_Close</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="has_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="has-focus">True</property> + <property name="can-default">True</property> + <property name="has-default">True</property> + <property name="receives-default">True</property> <property name="use-underline">True</property> <child internal-child="accessible"> <object class="AtkObject" id="close-atkobject"> @@ -45,8 +45,8 @@ <object class="GtkButton" id="help"> <property name="label" translatable="yes" context="stock">_Help</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> <property name="use-underline">True</property> <child internal-child="accessible"> <object class="AtkObject" id="help-atkobject"> @@ -65,60 +65,60 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="pack_type">end</property> + <property name="pack-type">end</property> <property name="position">0</property> </packing> </child> <child> - <!-- n-columns=1 n-rows=1 --> + <!-- n-columns=3 n-rows=7 --> <object class="GtkGrid" id="grid1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="margin-start">6</property> <property name="margin-end">6</property> <property name="hexpand">True</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> + <property name="row-spacing">6</property> + <property name="column-spacing">12</property> <child> <object class="GtkLabel" id="label1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="wordcount|label1">Words</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="left-attach">0</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkLabel" id="label2"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="wordcount|label2">Characters including spaces</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> + <property name="left-attach">0</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkLabel" id="label3"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="wordcount|label3">Characters excluding spaces</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> + <property name="left-attach">0</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkLabel" id="selectwords"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="hexpand">True</property> <property name="label"> 0</property> @@ -126,14 +126,14 @@ <property name="xalign">1</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="left-attach">1</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkLabel" id="selectchars"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="hexpand">True</property> <property name="label"> 0</property> @@ -141,14 +141,14 @@ <property name="xalign">1</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> + <property name="left-attach">1</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkLabel" id="selectcharsnospaces"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="hexpand">True</property> <property name="label"> 0</property> @@ -156,14 +156,14 @@ <property name="xalign">1</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> + <property name="left-attach">1</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkLabel" id="label9"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="wordcount|label9">Selection</property> <attributes> @@ -171,14 +171,14 @@ </attributes> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> + <property name="left-attach">1</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkLabel" id="label10"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="wordcount|label10">Document</property> <attributes> @@ -186,14 +186,14 @@ </attributes> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">0</property> + <property name="left-attach">2</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkLabel" id="docwords"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="hexpand">True</property> <property name="label"> 0</property> @@ -201,14 +201,14 @@ <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">1</property> + <property name="left-attach">2</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkLabel" id="docchars"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="hexpand">True</property> <property name="label"> 0</property> @@ -216,14 +216,14 @@ <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">2</property> + <property name="left-attach">2</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkLabel" id="doccharsnospaces"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="hexpand">True</property> <property name="label"> 0</property> @@ -231,26 +231,26 @@ <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">3</property> + <property name="left-attach">2</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkLabel" id="cjkcharsft"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> + <property name="can-focus">False</property> + <property name="no-show-all">True</property> <property name="label" translatable="yes" context="wordcount|cjkcharsft">Asian characters and Korean syllables</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">4</property> + <property name="left-attach">0</property> + <property name="top-attach">4</property> </packing> </child> <child> <object class="GtkLabel" id="selectcjkchars"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> + <property name="can-focus">False</property> + <property name="no-show-all">True</property> <property name="halign">end</property> <property name="hexpand">True</property> <property name="label"> 0</property> @@ -258,14 +258,14 @@ <property name="xalign">1</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">4</property> + <property name="left-attach">1</property> + <property name="top-attach">4</property> </packing> </child> <child> <object class="GtkLabel" id="doccjkchars"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> + <property name="can-focus">False</property> + <property name="no-show-all">True</property> <property name="halign">end</property> <property name="hexpand">True</property> <property name="label"> 0</property> @@ -273,26 +273,26 @@ <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">4</property> + <property name="left-attach">2</property> + <property name="top-attach">4</property> </packing> </child> <child> <object class="GtkLabel" id="standardizedpages"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> + <property name="can-focus">False</property> + <property name="no-show-all">True</property> <property name="label" translatable="yes" context="wordcount|standardizedpages">Standardized pages</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">5</property> + <property name="left-attach">0</property> + <property name="top-attach">5</property> </packing> </child> <child> <object class="GtkLabel" id="selectstandardizedpages"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> + <property name="can-focus">False</property> + <property name="no-show-all">True</property> <property name="halign">end</property> <property name="hexpand">True</property> <property name="label"> 0</property> @@ -300,14 +300,14 @@ <property name="xalign">1</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">5</property> + <property name="left-attach">1</property> + <property name="top-attach">5</property> </packing> </child> <child> <object class="GtkLabel" id="docstandardizedpages"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> + <property name="can-focus">False</property> + <property name="no-show-all">True</property> <property name="halign">end</property> <property name="hexpand">True</property> <property name="label"> 0</property> @@ -315,13 +315,42 @@ <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">5</property> + <property name="left-attach">2</property> + <property name="top-attach">5</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="lbComments"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="wordcount|lbComments">Comments</property> + <property name="xalign">1</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">6</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="docComments"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="halign">end</property> + <property name="hexpand">True</property> + <property name="label"> 0</property> + <property name="xalign">1</property> + </object> + <packing> + <property name="left-attach">2</property> + <property name="top-attach">6</property> </packing> </child> <child> <placeholder/> </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="expand">False</property> @@ -335,9 +364,6 @@ <action-widget response="-7">close</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> - <child type="titlebar"> - <placeholder/> - </child> <child internal-child="accessible"> <object class="AtkObject" id="WordCountDialog-atkobject"> <property name="AtkObject::accessible-description" translatable="yes" context="wordcount|extended_tip|WordCountDialog">Counts the words and characters, with or without spaces, in the current selection and in the whole document. The count is kept up to date as you type or change the selection.</property> @@ -345,7 +371,7 @@ </child> </object> <object class="GtkSizeGroup" id="sizegroup1"> - <property name="ignore_hidden">True</property> + <property name="ignore-hidden">True</property> <widgets> <widget name="selectwords"/> <widget name="selectchars"/> |