[Libreoffice-commits] core.git: sw/source
Samuel Mehrbrodt
s.mehrbrodt at gmail.com
Tue Aug 26 07:22:05 PDT 2014
sw/source/uibase/uiview/view2.cxx | 41 ++++++++++++++++++++++++--------------
1 file changed, 26 insertions(+), 15 deletions(-)
New commits:
commit 6f9a52abc8a9c8bf98568a5653c25404ef017cac
Author: Samuel Mehrbrodt <s.mehrbrodt at gmail.com>
Date: Tue Aug 26 00:03:02 2014 +0200
fdo#80617 Simplification of status bar page numbering
Change-Id: I520f53e85cca8f23992c8deeaf14ff2f4fc9bb3d
Reviewed-on: https://gerrit.libreoffice.org/11117
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 3d745c6..c0b6e84 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;
}
More information about the Libreoffice-commits
mailing list