diff options
author | Samuel Mehrbrodt <s.mehrbrodt@gmail.com> | 2014-08-26 00:03:02 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-08-26 09:21:42 -0500 |
commit | 6f9a52abc8a9c8bf98568a5653c25404ef017cac (patch) | |
tree | cf1a3dcaeb21037eb6e755e11163aa37bce0e0fe /sw/source | |
parent | befd73fc725441c76f2b1e2a5b7a335566a9242e (diff) |
fdo#80617 Simplification of status bar page numbering
Change-Id: I520f53e85cca8f23992c8deeaf14ff2f4fc9bb3d
Reviewed-on: https://gerrit.libreoffice.org/11117
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 3d745c61307c..c0b6e849fcfe 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -188,24 +188,35 @@ static void lcl_SetAllTextToDefaultLanguage( SwWrtShell &rWrtSh, sal_uInt16 nWhi } } -/* Create string for showing of page in statusbar */ -OUString SwView::GetPageStr( sal_uInt16 nPg, sal_uInt16 nLogPg, - const OUString& rDisplay ) +/** + * Create string for showing the page number in the statusbar + * + * @param nPhyNum The physical page number + * @param nVirtNum The logical page number (user-assigned) + * @param rPgStr User-defined page name (will be used instead of nVirtNum) + * + * @return OUString Formatted string: Page 1/10 (rPgStr/logical page number) + **/ +OUString SwView::GetPageStr(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString& rPgStr) { - OUString aStr( m_aPageStr ); - if( !rDisplay.isEmpty() ) - aStr += rDisplay; - else - aStr += OUString::number(nLogPg); - - if( nLogPg && nLogPg != nPg ) + OUString aStr(m_aPageStr); + aStr += OUString::number(nPhyNum); + aStr += "/"; + aStr += OUString::number(GetWrtShell().GetPageCnt()); + + // Show user-defined page number in brackets if any. + OUString extra; + if (!rPgStr.isEmpty() && OUString::number(nPhyNum) != rPgStr) + extra = rPgStr; + else if (nPhyNum != nVirtNum) + extra = OUString::number(nVirtNum); + if (!extra.isEmpty()) { - aStr += " "; - aStr += OUString::number(nPg); + aStr += " ("; + aStr += m_aPageStr; + aStr += extra; + aStr += ")"; } - aStr += " / "; - aStr += OUString::number( GetWrtShell().GetPageCnt() ); - return aStr; } |