sw/inc/strings.hrc                 |    1 +
 sw/source/uibase/utlui/content.cxx |    8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit a903d114f8d67f266e12d129333fb35c04861ae2
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Fri Jan 21 23:19:09 2022 -0900
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Sat Jan 22 22:49:15 2022 +0100

    tdf#146490 SwNavigator: replace page number field expand field text
    
    when field is in header/footer
    
    Change-Id: Ic11f020655a863d05e638e55db6ab150ce4ad7c2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128752
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>

diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index d5aaf979b66f..18d9b02081cb 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -415,6 +415,7 @@
 #define STR_HIDDEN_CHANGES_DETAIL               
NC_("STR_HIDDEN_CHANGES_DETAIL", "Document contains tracked changes and 
recording is enabled.")
 #define STR_HIDDEN_CHANGES_DETAIL2              
NC_("STR_HIDDEN_CHANGES_DETAIL2", "Recording of changes is enabled.")
 #define STR_HIDDEN_CHANGES_DETAIL3              
NC_("STR_HIDDEN_CHANGES_DETAIL3", "Document contains tracked changes.")
+#define STR_HEADER_FOOTER                       NC_("STR_HEADER_FOOTER", 
"Header/Footer")
 
 // Undo
 #define STR_CANT_UNDO                           NC_("STR_CANT_UNDO", "not 
possible")
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 517b0a658814..90ef955e00d6 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -807,7 +807,13 @@ void SwContentType::FillMemberList(bool* 
pbLevelOrVisibilityChanged)
                     if (SwTextField* pTextField = pFormatField->GetTextField())
                     {
                         const SwField* pField = pFormatField->GetField();
-                        OUString sExpandField(pField->ExpandField(true, 
m_pWrtShell->GetLayout()));
+                        OUString sExpandField;
+                        // tdf#146490 page number field type in Header/Footer
+                        if (pField->GetTypeId() == 
SwFieldTypesEnum::PageNumber &&
+                              
m_pWrtShell->GetDoc()->IsInHeaderFooter(pTextField->GetTextNode()))
+                            sExpandField = SwResId(STR_HEADER_FOOTER);
+                        else
+                            sExpandField = pField->ExpandField(true, 
m_pWrtShell->GetLayout());
                         if (!sExpandField.isEmpty())
                             sExpandField = u" - " + sExpandField;
                         OUString sText = pField->GetDescription() + u" - " + 
pField->GetFieldName()

Reply via email to