[Libreoffice-commits] core.git: sw/inc sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Dec 16 15:09:31 UTC 2019


 sw/inc/strings.hrc                  |    7 +++++++
 sw/source/uibase/utlui/unotools.cxx |   27 +++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

New commits:
commit 4ebde6f969f0c774586fda46890075ea39d1f942
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Dec 16 12:45:43 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Dec 16 16:08:40 2019 +0100

    Resolves: tdf#129355 mark toc index marks translatable
    
    Change-Id: I039c5fb47ff65b0b1646f28b096ca1ae66e4bc72
    Reviewed-on: https://gerrit.libreoffice.org/85215
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 34b5c4b9a5bf..13bb0760b394 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -369,6 +369,13 @@
 #define STR_IDXEXAMPLE_IDXTXT_ENTRY12           NC_("STR_IDXEXAMPLE_IDXTXT_ENTRY12", "This is the content from chapter 1.2. This keyword is a main entry.")
 #define STR_IDXEXAMPLE_IDXTXT_TABLE1            NC_("STR_IDXEXAMPLE_IDXTXT_TABLE1", "Table 1: This is table 1")
 #define STR_IDXEXAMPLE_IDXTXT_IMAGE1            NC_("STR_IDXEXAMPLE_IDXTXT_IMAGE1", "Image 1: This is image 1")
+#define STR_IDXEXAMPLE_IDXMARK_CHAPTER          NC_("STR_IDXEXAMPLE_IDXMARK_CHAPTER", "Chapter")
+#define STR_IDXEXAMPLE_IDXMARK_KEYWORD          NC_("STR_IDXEXAMPLE_IDXMARK_KEYWORD", "Keyword")
+#define STR_IDXEXAMPLE_IDXMARK_USER_DIR_ENTRY   NC_("STR_IDXEXAMPLE_IDXMARK_USER_DIR_ENTRY", "User Directory Entry")
+#define STR_IDXEXAMPLE_IDXMARK_ENTRY            NC_("STR_IDXEXAMPLE_IDXMARK_ENTRY", "Entry")
+#define STR_IDXEXAMPLE_IDXMARK_THIS             NC_("STR_IDXEXAMPLE_IDXMARK_THIS", "this")
+#define STR_IDXEXAMPLE_IDXMARK_PRIMARY_KEY      NC_("STR_IDXEXAMPLE_IDXMARK_PRIMARY_KEY", "Primary key")
+#define STR_IDXEXAMPLE_IDXMARK_SECONDARY_KEY    NC_("STR_IDXEXAMPLE_IDXMARK_SECONDARY_KEY", "Secondary key")
 #define STR_CONTENT_TYPE_SINGLE_OUTLINE         NC_("STR_CONTENT_TYPE_SINGLE_OUTLINE", "Heading")
 #define STR_CONTENT_TYPE_SINGLE_TABLE           NC_("STR_CONTENT_TYPE_SINGLE_TABLE", "Table")
 #define STR_CONTENT_TYPE_SINGLE_FRAME           NC_("STR_CONTENT_TYPE_SINGLE_FRAME", "Text frame")
diff --git a/sw/source/uibase/utlui/unotools.cxx b/sw/source/uibase/utlui/unotools.cxx
index f6ad9b7ce0c9..abe8d64a50bf 100644
--- a/sw/source/uibase/utlui/unotools.cxx
+++ b/sw/source/uibase/utlui/unotools.cxx
@@ -344,6 +344,33 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer, void )
               }
             }
             while(pSh->Right(sal_uInt16(1), sal_uInt16(1), true));
+
+            TOXTypes eTypes[] = { TOX_INDEX, TOX_USER, TOX_CONTENT };
+            for (auto eType : eTypes)
+            {
+                const SwTOXType* pTOXType = pDoc->GetTOXType(eType, 0);
+                SwTOXMarks aMarks;
+                SwTOXMark::InsertTOXMarks(aMarks, *pTOXType);
+                for (auto pMark : aMarks)
+                {
+                    if (pMark->GetAlternativeText() == "Chapter")
+                        pMark->SetAlternativeText(SwResId(STR_IDXEXAMPLE_IDXMARK_CHAPTER));
+                    else if (pMark->GetAlternativeText() == "Keyword")
+                        pMark->SetAlternativeText(SwResId(STR_IDXEXAMPLE_IDXMARK_KEYWORD));
+                    else if (pMark->GetAlternativeText() == "this")
+                        pMark->SetAlternativeText(SwResId(STR_IDXEXAMPLE_IDXMARK_THIS));
+                    else if (pMark->GetAlternativeText() == "User Directory Entry")
+                        pMark->SetAlternativeText(SwResId(STR_IDXEXAMPLE_IDXMARK_USER_DIR_ENTRY));
+                    else if (pMark->GetAlternativeText() == "Entry")
+                        pMark->SetAlternativeText(SwResId(STR_IDXEXAMPLE_IDXMARK_ENTRY));
+
+                    if (pMark->GetPrimaryKey() == "Primary key")
+                        pMark->SetPrimaryKey(SwResId(STR_IDXEXAMPLE_IDXMARK_PRIMARY_KEY));
+
+                    if (pMark->GetSecondaryKey() == "Secondary key")
+                        pMark->SetSecondaryKey(SwResId(STR_IDXEXAMPLE_IDXMARK_SECONDARY_KEY));
+                }
+            }
         }
 
         uno::Reference< beans::XPropertySet >  xCursorProp(m_xCursor, uno::UNO_QUERY);


More information about the Libreoffice-commits mailing list