sw/source/ui/index/cnttab.cxx | 14 +++++- sw/source/uibase/inc/swuicnttab.hxx | 1 sw/uiconfig/swriter/ui/tocindexpage.ui | 74 +++++++++++++++++---------------- 3 files changed, 53 insertions(+), 36 deletions(-)
New commits: commit 185899c145dba0c67e1d15e37dce206da8abc283 Author: Sohrab Kazak <sohrab.ka...@gmail.com> AuthorDate: Tue Aug 27 10:55:47 2024 -0700 Commit: Heiko Tietze <heiko.tie...@documentfoundation.org> CommitDate: Thu Sep 26 09:23:16 2024 +0200 tdf#148320 Toggle ToC/Index Title Implements the checkbox to toggle the title in the ToC/Index. The checkbox does not disable the text entry of the title only hard codes the title to be an empty string. Solution could use more work. Change-Id: I752953ebb6b970dd3e802d76bdc15f478b535a89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172477 Tested-by: Heiko Tietze <heiko.tie...@documentfoundation.org> Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org> diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index d1146b5a05b5..e530a1c5e61d 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -761,6 +761,7 @@ SwTOXSelectTabPage::SwTOXSelectTabPage(weld::Container* pPage, weld::DialogContr , m_xTypeFT(m_xBuilder->weld_label(u"typeft"_ustr)) , m_xTypeLB(m_xBuilder->weld_combo_box(u"type"_ustr)) , m_xReadOnlyCB(m_xBuilder->weld_check_button(u"readonly"_ustr)) + , m_xTitleToggleCB(m_xBuilder->weld_check_button(u"usetitle"_ustr)) , m_xAreaFrame(m_xBuilder->weld_widget(u"areaframe"_ustr)) , m_xAreaLB(m_xBuilder->weld_combo_box(u"scope"_ustr)) , m_xLevelFT(m_xBuilder->weld_label(u"levelft"_ustr)) @@ -848,6 +849,7 @@ SwTOXSelectTabPage::SwTOXSelectTabPage(weld::Container* pPage, weld::DialogContr m_xInitialCapsCB->connect_toggled(aLk); m_xKeyAsEntryCB->connect_toggled(aLk); m_xParaStyleCB->connect_toggled(aLk); + m_xTitleToggleCB->connect_toggled(aLk); m_xTitleED->connect_changed(LINK(this, SwTOXSelectTabPage, ModifyEntryHdl)); m_xLevelNF->connect_value_changed(LINK(this, SwTOXSelectTabPage, ModifySpinHdl)); @@ -957,7 +959,6 @@ void SwTOXSelectTabPage::ApplyTOXDescription() SwMultiTOXTabDialog* pTOXDlg = static_cast<SwMultiTOXTabDialog*>(GetDialogController()); const CurTOXType aCurType = pTOXDlg->GetCurrentTOXType(); SwTOXDescription& rDesc = pTOXDlg->GetTOXDescription(aCurType); - m_xReadOnlyCB->set_active(rDesc.IsReadonly()); if (!m_xTitleED->get_value_changed_from_saved()) { @@ -967,6 +968,7 @@ void SwTOXSelectTabPage::ApplyTOXDescription() m_xTitleED->set_text(OUString()); m_xTitleED->save_value(); } + m_xTitleToggleCB->set_active( !m_xTitleED->get_text().isEmpty() ); // if no title, toggle off m_xAreaLB->set_active(rDesc.IsFromChapter() ? 1 : 0); @@ -1109,7 +1111,15 @@ void SwTOXSelectTabPage::FillTOXDescription() SwMultiTOXTabDialog* pTOXDlg = static_cast<SwMultiTOXTabDialog*>(GetDialogController()); CurTOXType aCurType = pTOXDlg->GetCurrentTOXType(); SwTOXDescription& rDesc = pTOXDlg->GetTOXDescription(aCurType); - rDesc.SetTitle(m_xTitleED->get_text()); + if (m_xTitleToggleCB->get_active()) + { + rDesc.SetTitle(m_xTitleED->get_text()); + } + else + { + rDesc.SetTitle(OUString()); + } + m_xTitleED->set_sensitive(m_xTitleToggleCB->get_active()); rDesc.SetFromChapter(1 == m_xAreaLB->get_active()); SwTOXElement nContentOptions = SwTOXElement::NONE; if (m_xTOXMarksCB->get_visible() && m_xTOXMarksCB->get_active()) diff --git a/sw/source/uibase/inc/swuicnttab.hxx b/sw/source/uibase/inc/swuicnttab.hxx index 103f65e7cb93..254fda6a1ca6 100644 --- a/sw/source/uibase/inc/swuicnttab.hxx +++ b/sw/source/uibase/inc/swuicnttab.hxx @@ -133,6 +133,7 @@ class SwTOXSelectTabPage final : public SfxTabPage std::unique_ptr<weld::Label> m_xTypeFT; std::unique_ptr<weld::ComboBox> m_xTypeLB; std::unique_ptr<weld::CheckButton> m_xReadOnlyCB; + std::unique_ptr<weld::CheckButton> m_xTitleToggleCB; std::unique_ptr<weld::Widget> m_xAreaFrame; std::unique_ptr<weld::ComboBox> m_xAreaLB; diff --git a/sw/uiconfig/swriter/ui/tocindexpage.ui b/sw/uiconfig/swriter/ui/tocindexpage.ui index 7b0f30a5ffbb..0d3c90226132 100644 --- a/sw/uiconfig/swriter/ui/tocindexpage.ui +++ b/sw/uiconfig/swriter/ui/tocindexpage.ui @@ -86,38 +86,6 @@ <property name="vexpand">True</property> <property name="row-spacing">6</property> <property name="column-spacing">12</property> - <child> - <object class="GtkLabel" id="mainstyleft"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label" translatable="yes" context="tocindexpage|mainstyleft">_Title:</property> - <property name="use-underline">True</property> - <property name="mnemonic-widget">title</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">0</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="title"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="hexpand">True</property> - <property name="activates-default">True</property> - <property name="truncate-multiline">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="title-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="tocindexpage|extended_tip|title">Enter a title for the selected index.</property> - </object> - </child> - </object> - <packing> - <property name="left-attach">1</property> - <property name="top-attach">0</property> - </packing> - </child> <child> <object class="GtkLabel" id="typeft"> <property name="visible">True</property> @@ -178,6 +146,44 @@ <property name="width">2</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="usetitle"> + <property name="label" translatable="yes" context="tocindexpage|readonly">Title:</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="active">True</property> + <property name="draw-indicator">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="usetitle-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="tocindexpage|extended_tip|readonly">Prevents the contents of the index from being changed.</property> + </object> + </child> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">0</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="title"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + <property name="activates-default">True</property> + <property name="truncate-multiline">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="title-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="tocindexpage|extended_tip|title">Enter a title for the selected index.</property> + </object> + </child> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">0</property> + </packing> + </child> </object> </child> <child type="label"> @@ -372,10 +378,10 @@ <property name="visible">True</property> <property name="can-focus">True</property> <property name="receives-default">False</property> + <property name="tooltip-text" translatable="yes" context="tocindexpage|tooltip_text|indexmarks">Choose this option to include any index entries inserted in the document for the selected index “Type”.</property> <property name="use-underline">True</property> <property name="active">True</property> <property name="draw-indicator">True</property> - <property name="tooltip_text" translatable="yes" context="tocindexpage|tooltip_text|indexmarks">Choose this option to include any index entries inserted in the document for the selected index “Type”.</property> <child internal-child="accessible"> <object class="AtkObject" id="indexmarks-atkobject"> <property name="AtkObject::accessible-description" translatable="yes" context="tocindexpage|extended_tip|indexmarks">Choose this option to include any index entries inserted in the document for the selected index “Type”. Use “Insert - Table of Contents and Index - Index Entry” to insert index entries in the document.</property> @@ -469,10 +475,10 @@ <property name="visible">True</property> <property name="can-focus">True</property> <property name="receives-default">False</property> + <property name="tooltip-text" translatable="yes" context="tocindexpage|uselevel|tooltip_text">Assign index level according to the outline level of the heading immediately prior to the object.</property> <property name="margin-start">12</property> <property name="use-underline">True</property> <property name="draw-indicator">True</property> - <property name="tooltip-text" translatable="yes" context="tocindexpage|uselevel|tooltip_text">Assign index level according to the outline level of the heading immediately prior to the object.</property> <child internal-child="accessible"> <object class="AtkObject" id="uselevel-atkobject"> <property name="AtkObject::accessible-description" translatable="yes" context="tocindexpage|extended_tip|uselevel">Assign index level to table, graphic, frame, and OLE objects according to the outline level of the heading immediately prior to the object. For example, if “Tables” is selected, then each table in the document is assigned an index level that corresponds to the outline level of the first heading before the table (i.e., a table is assigned index level 3 if it follows a heading with outline level 3). With default settings, larger index levels are indented more in the Table of Contents. Use the “Entries” tab to customize the formatting and indentation for each index level.</property>