Resolves tdf#161574 - Individual labels for TOXes in the UI

+ Upper-case for Delete Index
+ User-Defined amended with Index

Change-Id: I972ee22fa3681a0f1159426836a0ec1b83fa5e3f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173849
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Tested-by: Jenkins
This commit is contained in:
Heiko Tietze 2024-09-24 10:26:24 +02:00 committed by Heiko Tietze
parent b248260bf8
commit e0808a1f84
7 changed files with 26 additions and 6 deletions

View file

@ -220,7 +220,7 @@
</node>
<node oor:name=".uno:RemoveTableOf" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Delete index</value>
<value xml:lang="en-US">Delete Index</value>
</prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>

View file

@ -424,6 +424,9 @@
#define STR_HYPERLINK NC_("STR_HYPERLINK", "Hyperlink")
#define STR_SECTIONLINK NC_("STR_SECTIONLINK", "Section Link")
#define STR_SECTIONCOPY NC_("STR_SECTIONCOPY", "Section Copy")
#define STR_EDITINDEX NC_("STR_EDITINDEX", "Edit %1")
#define STR_UPDATEINDEX NC_("STR_UPDATEINDEX", "Update %1")
#define STR_DELETEINDEX NC_("STR_DELETEINDEX", "Delete %1")
// Undo
#define STR_CANT_UNDO NC_("STR_CANT_UNDO", "not possible")
@ -753,7 +756,7 @@
#define STR_FIELD_FIXED NC_("STR_FIELD_FIXED", "(fixed)")
#define STR_DURATION_FORMAT NC_("STR_DURATION_FORMAT", " Y: %1 M: %2 D: %3 H: %4 M: %5 S: %6")
#define STR_TOI NC_("STR_TOI", "Alphabetical Index")
#define STR_TOU NC_("STR_TOU", "User-Defined")
#define STR_TOU NC_("STR_TOU", "User-Defined Index")
#define STR_TOC NC_("STR_TOC", "Table of Contents")
#define STR_TOX_AUTH NC_("STR_TOX_AUTH", "Bibliography")
#define STR_TOX_CITATION NC_("STR_TOX_CITATION", "Citation")

View file

@ -1686,7 +1686,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks)
CPPUNIT_ASSERT(aSet.HasItem(RES_TXTATR_INETFMT));
pWrtShell->Push();
OUString const url(aSet.GetItem<SwFormatINetFormat>(RES_TXTATR_INETFMT)->GetValue());
CPPUNIT_ASSERT_EQUAL(u"#1%19the%20udmark%19UUser-Defined%7Ctoxmark"_ustr, url);
CPPUNIT_ASSERT_EQUAL(u"#1%19the%20udmark%19UUser-Defined%20Index%7Ctoxmark"_ustr,
url); // User-Defined => User-Defined Index, tdf#161574
rView.JumpToSwMark(url.subView(1));
CPPUNIT_ASSERT_EQUAL(OUString(OUStringChar(CH_TXTATR_INWORD) + "udmark the first"),
pWrtShell->GetCursor()->GetPointNode().GetTextNode()->GetText());
@ -1701,7 +1702,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks)
CPPUNIT_ASSERT(aSet.HasItem(RES_TXTATR_INETFMT));
pWrtShell->Push();
OUString const url(aSet.GetItem<SwFormatINetFormat>(RES_TXTATR_INETFMT)->GetValue());
CPPUNIT_ASSERT_EQUAL(u"#2%19the%20udmark%19UUser-Defined%7Ctoxmark"_ustr, url);
CPPUNIT_ASSERT_EQUAL(u"#2%19the%20udmark%19UUser-Defined%20Index%7Ctoxmark"_ustr,
url); // User-Defined => User-Defined Index, tdf#161574
rView.JumpToSwMark(url.subView(1));
CPPUNIT_ASSERT_EQUAL(OUString(OUStringChar(CH_TXTATR_INWORD) + "udmark the 2nd"),
pWrtShell->GetCursor()->GetPointNode().GetTextNode()->GetText());

View file

@ -3446,7 +3446,7 @@ class TextPortionEnumerationTest(unittest.TestCase):
xIndex5 = xIndexes["User-Defined1"]
self.assertTrue(self.eq(xIndex5.MetadataReference,
StringPair("content.xml", "idUD")), "idUD")
xIndex5s = xSections["User-Defined1"]
xIndex5s = xSections["User-Defined Index1"] # User-Defined => User-Defined Index, tdf#161574
self.assertTrue(self.eq(xIndex5s.MetadataReference,
StringPair("content.xml", "idUD")), "idUD")
xIndex6 = xIndexes["Table of Objects1"]

View file

@ -34,6 +34,8 @@
#include <idxmrk.hxx>
#include <toxmgr.hxx>
#include <swabstdlg.hxx>
#include <strings.hrc>
#include <svl/whiter.hxx>
#include <ndtxt.hxx>
#include <fmtfld.hxx>
@ -270,6 +272,12 @@ void SwTextShell::GetIdxState(SfxItemSet &rSet)
else
rSet.Put(SfxBoolItem(FN_INSERT_AUTH_ENTRY_DLG, true));
SfxWhichIter aIter(rSet);
if (aIter.FirstWhich() == FN_REMOVE_CUR_TOX)
{
const OUString sLabel = SwResId(STR_DELETEINDEX).replaceAll("%1", pBase->GetTypeName());
rSet.Put(SfxStringItem(FN_REMOVE_CUR_TOX, sLabel));
}
}
else if ( rSh.CursorInsideInputField() )
{

View file

@ -288,6 +288,13 @@ void SwView::GetState(SfxItemSet &rSet)
if(nullptr == (pBase = m_pWrtShell->GetCurTOX()) ||
(FN_EDIT_CURRENT_TOX == nWhich && pBase->IsTOXBaseInReadonly()))
rSet.DisableItem(nWhich);
else
{
const OUString sLabel
= SwResId(nWhich == FN_EDIT_CURRENT_TOX ? STR_EDITINDEX : STR_UPDATEINDEX)
.replaceAll("%1", pBase->GetTypeName());
rSet.Put(SfxStringItem(nWhich, sLabel));
}
}
break;
case SID_TWAIN_SELECT:

View file

@ -142,7 +142,7 @@
<item id="2" translatable="yes" context="tocindexpage|liststore1">Alphabetical Index</item>
<item id="4" translatable="yes" context="tocindexpage|liststore1">Table of Figures</item>
<item id="8" translatable="yes" context="tocindexpage|liststore1">Index of Tables</item>
<item id="16" translatable="yes" context="tocindexpage|liststore1">User-Defined</item>
<item id="16" translatable="yes" context="tocindexpage|liststore1">User-Defined Index</item>
<item id="32" translatable="yes" context="tocindexpage|liststore1">Table of Objects</item>
<item id="64" translatable="yes" context="tocindexpage|liststore1">Bibliography</item>
</items>