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

Luke Deller luke at deller.id.au
Fri Jul 25 03:25:51 PDT 2014


 sw/source/uibase/docvw/HeaderFooterWin.cxx |   17 ++++++++++++++--
 sw/source/uibase/docvw/docvw.hrc           |    8 ++++++-
 sw/source/uibase/docvw/docvw.src           |   30 +++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+), 3 deletions(-)

New commits:
commit 7ec3da8bb6c82d78f4bfaa69c7c91d6fc99dfad4
Author: Luke Deller <luke at deller.id.au>
Date:   Fri Jul 11 22:39:34 2014 +1000

    Improve header/footer UI label (fdo#81227)
    
    Indicate whether the header/footer being edited is only for the
    first page, left pages, or right pages if applicable.
    
    Change-Id: Ia38289503d0bae6cc6cef5917a47d5d25ca0f712
    Reviewed-on: https://gerrit.libreoffice.org/10235
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx
index 17d95ff..d16fb4e 100644
--- a/sw/source/uibase/docvw/HeaderFooterWin.cxx
+++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx
@@ -181,11 +181,24 @@ const SwPageFrm* SwHeaderFooterWin::GetPageFrame( )
 void SwHeaderFooterWin::SetOffset( Point aOffset, long nXLineStart, long nXLineEnd )
 {
     // Compute the text to show
+    const SwPageDesc* pDesc = GetPageFrame()->GetPageDesc();
+    bool bIsFirst = !pDesc->IsFirstShared() && GetPageFrame()->OnFirstPage();
+    bool bIsLeft  = !pDesc->IsHeaderShared() && !GetPageFrame()->OnRightPage();
+    bool bIsRight = !pDesc->IsHeaderShared() && GetPageFrame()->OnRightPage();
     m_sLabel = SW_RESSTR( STR_HEADER_TITLE );
     if ( !m_bIsHeader )
-        m_sLabel = SW_RESSTR( STR_FOOTER_TITLE );
+        m_sLabel = bIsFirst ? SW_RESSTR( STR_FIRST_FOOTER_TITLE )
+            : bIsLeft  ? SW_RESSTR( STR_LEFT_FOOTER_TITLE )
+            : bIsRight ? SW_RESSTR( STR_RIGHT_FOOTER_TITLE )
+            : SW_RESSTR( STR_FOOTER_TITLE );
+    else
+        m_sLabel = bIsFirst ? SW_RESSTR( STR_FIRST_HEADER_TITLE )
+            : bIsLeft  ? SW_RESSTR( STR_LEFT_HEADER_TITLE )
+            : bIsRight ? SW_RESSTR( STR_RIGHT_HEADER_TITLE )
+            : SW_RESSTR( STR_HEADER_TITLE );
+
     sal_Int32 nPos = m_sLabel.lastIndexOf( "%1" );
-    m_sLabel = m_sLabel.replaceAt( nPos, 2, GetPageFrame()->GetPageDesc()->GetName() );
+    m_sLabel = m_sLabel.replaceAt( nPos, 2, pDesc->GetName() );
 
     // Compute the text size and get the box position & size from it
     Rectangle aTextRect;
diff --git a/sw/source/uibase/docvw/docvw.hrc b/sw/source/uibase/docvw/docvw.hrc
index 3347b18..35cd1cd 100644
--- a/sw/source/uibase/docvw/docvw.hrc
+++ b/sw/source/uibase/docvw/docvw.hrc
@@ -77,8 +77,14 @@
 #define STR_FORMAT_HEADER               (RC_DOCVW_BEGIN + 25)
 #define STR_DELETE_FOOTER               (RC_DOCVW_BEGIN + 26)
 #define STR_FORMAT_FOOTER               (RC_DOCVW_BEGIN + 27)
+#define STR_FIRST_HEADER_TITLE          (RC_DOCVW_BEGIN + 28)
+#define STR_LEFT_HEADER_TITLE           (RC_DOCVW_BEGIN + 29)
+#define STR_RIGHT_HEADER_TITLE          (RC_DOCVW_BEGIN + 30)
+#define STR_FIRST_FOOTER_TITLE          (RC_DOCVW_BEGIN + 31)
+#define STR_LEFT_FOOTER_TITLE           (RC_DOCVW_BEGIN + 32)
+#define STR_RIGHT_FOOTER_TITLE          (RC_DOCVW_BEGIN + 33)
 
-#define DOCVW_ACT_END   STR_SMARTTAG_CLICK
+#define DOCVW_ACT_END   STR_RIGHT_FOOTER_TITLE
 
 #if DOCVW_ACT_END > RC_DOCVW_END
 #error Resource-Id Ueberlauf in #file, #line
diff --git a/sw/source/uibase/docvw/docvw.src b/sw/source/uibase/docvw/docvw.src
index ff10f36..71654f2 100644
--- a/sw/source/uibase/docvw/docvw.src
+++ b/sw/source/uibase/docvw/docvw.src
@@ -279,11 +279,41 @@ String STR_HEADER_TITLE
     Text [ en-US ] = "Header (%1)" ;
 };
 
+String STR_FIRST_HEADER_TITLE
+{
+    Text [ en-US ] = "First Page Header (%1)" ;
+};
+
+String STR_LEFT_HEADER_TITLE
+{
+    Text [ en-US ] = "Left Page Header (%1)" ;
+};
+
+String STR_RIGHT_HEADER_TITLE
+{
+    Text [ en-US ] = "Right Page Header (%1)" ;
+};
+
 String STR_FOOTER_TITLE
 {
     Text [ en-US ] = "Footer (%1)" ;
 };
 
+String STR_FIRST_FOOTER_TITLE
+{
+    Text [ en-US ] = "First Page Footer (%1)" ;
+};
+
+String STR_LEFT_FOOTER_TITLE
+{
+    Text [ en-US ] = "Left Page Footer (%1)" ;
+};
+
+String STR_RIGHT_FOOTER_TITLE
+{
+    Text [ en-US ] = "Right Page Footer (%1)" ;
+};
+
 String STR_DELETE_HEADER
 {
     Text [ en-US ] = "Delete Header..." ;


More information about the Libreoffice-commits mailing list